val invp : b: Pulse.Lib.Reference.ref Promises.Examples.abc -> y: Pulse.Lib.Reference.ref Prims.int
  -> Pulse.Lib.Core.vprop
let invp (b:ref abc) (y:ref int) =
  exists* (bb:abc). pts_to b #(half_perm full_perm) bb ** (if bb =B then pts_to y 42 else emp)
(*
   Copyright 2023 Microsoft Research

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*)

module Promises.Examples

open Pulse.Lib.Pervasives
open Pulse.Lib.Par.Pledge

(* Assuming invariants *)

[@@erasable]
assume val inv : vprop -> Type0

// should be ghost
assume val mk_inv : p:vprop -> stt (inv p) p (fun _ -> emp)

assume val with_inv
  (#a:Type0) (#pre : vprop) (#post : (a -> vprop))
  (#p:vprop)
  (i:inv p)
  ($f : unit -> stt_ghost a (p ** pre) (fun r -> p ** post r))
  : stt_ghost a pre post

assume val admit_ghost
  (#a:Type0) (#pre : vprop) (#post : (a -> vprop))
  (_:unit)
  : stt_ghost a pre post

type abc = | A | B | C
/
Pulse.Lib.Pervasives.fst.checked Pulse.Lib.Par.Pledge.fsti.checked prims.fst.checked FStar.Pervasives.fsti.checked
Promises.Examples.fst
b: Pulse.Lib.Reference.ref Promises.Examples.abc -> y: Pulse.Lib.Reference.ref Prims.int
  -> Pulse.Lib.Core.vprop
Pulse.Lib.Reference.ref Promises.Examples.abc Prims.int Pulse.Lib.Core.op_exists_Star Pulse.Lib.Core.op_Star_Star Pulse.Lib.Reference.pts_to PulseCore.FractionalPermission.half_perm PulseCore.FractionalPermission.full_perm Prims.op_Equality Promises.Examples.B Prims.bool Pulse.Lib.Core.emp Pulse.Lib.Core.vprop
let invp (b: ref abc) (y: ref int) =
  
exists* (bb: abc). pts_to b #(half_perm full_perm) bb ** (if bb = B then pts_to y 42 else emp)