val read (#a:Type)
         (#u:_)
         (#p:perm)
         (#v:erased a)
         (r:ref a)
  : STGhost (erased a) u
      (pts_to r p v)
      (fun x -> pts_to r p x)
      (requires True)
      (ensures fun x -> x == v)
let read (#a:Type)
         (#u:_)
         (#p:perm)
         (#v:erased a)
         (r:ref a)
  : STGhost (erased a) u
      (pts_to r p v)
      (fun x -> pts_to r p x)
      (requires True)
      (ensures fun x -> x == v)
  = let y = coerce_ghost (fun _ -> R.ghost_read_pt r) in
    y
val read (#a:Type)
         (#u:_)
         (#p:perm)
         (#v:erased a)
         (r:ref a)
  : STGhost (erased a) u
      (pts_to r p v)
      (fun x -> pts_to r p x)
      (requires True)
      (ensures fun x -> x == v)
let read (#a: Type) (#u: _) (#p: perm) (#v: erased a) (r: ref a)
    : STGhost (erased a)
      u
      (pts_to r p v)
      (fun x -> pts_to r p x)
      (requires True)
      (ensures fun x -> x == v) =
let y = coerce_ghost (fun _ -> R.ghost_read_pt r) in
y
Steel.ST.GhostReference.fst.checked
Steel.ST.Util.fsti.checked Steel.ST.Coercions.fsti.checked Steel.Reference.fsti.checked prims.fst.checked FStar.Pervasives.fsti.checked FStar.Ghost.fsti.checked
Steel.ST.GhostReference.fst
Steel.Memory.inames Steel.FractionalPermission.perm FStar.Ghost.erased Steel.ST.GhostReference.ref Steel.ST.Coercions.coerce_ghost Steel.Reference.ghost_pts_to FStar.Ghost.reveal Steel.Effect.Common.vprop Prims.l_True Prims.eq2 Prims.unit Steel.Reference.ghost_read_pt Steel.ST.GhostReference.pts_to
(*
   Copyright 2020 Microsoft Research

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

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

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*)
module Steel.ST.GhostReference
open FStar.Ghost
open Steel.ST.Util
open Steel.ST.Coercions
module R = Steel.Reference

[@@ erasable]
let ref (a:Type u#0)
  : Type u#0
  = R.ghost_ref a

let pts_to (#a:_)
           (r:ref a)
           (p:perm)
           ([@@@smt_fallback] v:a)
  : vprop
  = R.ghost_pts_to r p v

let pts_to_injective_eq (#a:_)
                        (#u:_)
                        (#p #q:_)
                        (#v0 #v1:a)
                        (r:ref a)
  : STGhost unit u
      (pts_to r p v0 `star` pts_to r q v1)
      (fun _ -> pts_to r p v0 `star` pts_to r q v0)
      (requires True)
      (ensures fun _ -> v0 == v1)
  = coerce_ghost
    (fun _ -> R.ghost_pts_to_injective_eq #a #u #p #q r (hide v0) (hide v1))

let pts_to_perm r = coerce_ghost (fun _ -> R.ghost_pts_to_perm r)

let alloc (#a:Type)
          (#u:_)
          (x:erased a)
  : STGhostT (ref a) u
      emp
      (fun r -> pts_to r full_perm x)
  = coerce_ghost (fun _ -> R.ghost_alloc_pt x)

let read (#a:Type)
         (#u:_)
         (#p:perm)
         (#v:erased a)
         (r:ref a)
  : STGhost (erased a) u
      (pts_to r p v)
      (fun x -> pts_to r p x)
      (requires True)
val read (#a:Type)
         (#u:_)
         (#p:perm)
         (#v:erased a)
         (r:ref a)
  : STGhost (erased a) u
      (pts_to r p v)
      (fun x -> pts_to r p x)
      (requires True)
      (ensures fun x -> x == v)
r: Steel.ST.GhostReference.ref a -> Steel.ST.Effect.Ghost.STGhost (FStar.Ghost.erased a)