val intro_vptrp
  (#opened: _)
  (#a: Type0)
  (r: ref a)
  (p: perm)
: SteelGhost unit opened
    (A.varrayp r p)
    (fun _ -> vptrp r p)
    (fun _ -> True)
    (fun h0 _ h1 ->
      Seq.create 1 (selp r p h1) == A.aselp r p h0
    )
let intro_vptrp r p =
  let h0 = get () in
  intro_vptrp' r p;
  let h1 = get () in
  assert (Seq.create 1 (selp r p h1) `Seq.equal` A.aselp r p h0)
val intro_vptrp
  (#opened: _)
  (#a: Type0)
  (r: ref a)
  (p: perm)
: SteelGhost unit opened
    (A.varrayp r p)
    (fun _ -> vptrp r p)
    (fun _ -> True)
    (fun h0 _ h1 ->
      Seq.create 1 (selp r p h1) == A.aselp r p h0
    )
let intro_vptrp r p =
let h0 = get () in
intro_vptrp' r p;
let h1 = get () in
assert ((Seq.create 1 (selp r p h1)) `Seq.equal` (A.aselp r p h0))
Steel.ArrayRef.fst.checked
Steel.Array.fsti.checked prims.fst.checked FStar.SizeT.fsti.checked FStar.Seq.fst.checked FStar.Pervasives.fsti.checked
Steel.ArrayRef.fst
Steel.Memory.inames Steel.ArrayRef.ref Steel.FractionalPermission.perm Prims._assert FStar.Seq.Base.equal FStar.Seq.Base.create Steel.ArrayRef.selp Steel.ArrayRef.vptrp FStar.Ghost.reveal Steel.Effect.Common.rmem Steel.Array.aselp Steel.Array.varrayp Prims.unit FStar.Ghost.erased Steel.Effect.Common.rmem' Steel.Effect.Common.VUnit Steel.ArrayRef.vptr' Steel.Effect.Common.valid_rmem Steel.Effect.Atomic.get Steel.ArrayRef.intro_vptrp'
module Steel.ArrayRef

module A = Steel.Array

let null #a = A.null #a

let is_null r = A.is_null r

let vptr0_refine
  (#a: Type0)
  (r: ref a)
  (s: Seq.lseq a (A.length r))
: Tot prop
= Seq.length s == 1

let vptr0_rewrite
  (#a: Type)
  (r: ref a)
  (p: perm)
  (s: normal (vrefine_t (A.varrayp r p) (vptr0_refine r)))
: Tot a
= Seq.index s 0

[@@__steel_reduce__; __reduce__]
let vptr1
  (#a: Type0)
  (r: ref a)
  (p: perm)
: Tot vprop
= A.varrayp r p `vrefine`
  vptr0_refine r `vrewrite`
  vptr0_rewrite r p

[@@__steel_reduce__]
let vptr0
  (#a: Type0)
  (r: ref a)
  (p: perm)
: Tot vprop
= vptr1 r p

let intro_vptr0
  (#opened: _)
  (#a: Type0)
  (r: ref a)
  (p: perm)
: SteelGhost unit opened
    (A.varrayp r p)
    (fun _ -> vptr0 r p)
    (fun _ -> True)
    (fun h _ h' ->
      let s = A.aselp r p h in
      Seq.length s == 1 /\
      h' (vptr0 r p) == Seq.index s 0
    )
= A.varrayp_not_null r p;
  intro_vrefine (A.varrayp r p) (vptr0_refine r);
  intro_vrewrite (A.varrayp r p `vrefine` vptr0_refine r) (vptr0_rewrite r p);
  change_equal_slprop (vptr1 r p) (vptr0 r p)

let elim_vptr0
  (#opened: _)
  (#a: Type0)
  (r: ref a)
  (p: perm)
: SteelGhost unit opened
    (vptr0 r p)
    (fun _ -> A.varrayp r p)
    (fun _ -> True)
    (fun h _ h' ->
      A.aselp r p h' `Seq.equal` Seq.create 1 (h (vptr0 r p))
    )
=
  change_equal_slprop (vptr0 r p) (vptr1 r p);
  elim_vrewrite (A.varrayp r p `vrefine` vptr0_refine r) (vptr0_rewrite r p);
  elim_vrefine (A.varrayp r p) (vptr0_refine r)

let ptrp r p = hp_of (vptr0 r p)

let ptrp_sel r p = sel_of (vptr0 r p)

let intro_vptrp'
  (#opened: _)
  (#a: Type0)
  (r: ref a)
  (p: perm)
: SteelGhost unit opened
    (A.varrayp r p)
    (fun _ -> vptrp r p)
    (fun _ -> True)
    (fun h _ h' ->
      let s = A.aselp r p h in
      Seq.length s == 1 /\
      selp r p h' == Seq.index s 0
    )
= intro_vptr0 r p;
  change_slprop_rel
    (vptr0 r p)
    (vptrp r p)
    (fun v1 v2 -> v1 === v2)
    (fun m ->
      assert (interp (hp_of (vptrp r p)) m);
      assert_norm (sel_of (vptrp r p) m === sel_of (vptr0 r p) m)
    )
val intro_vptrp
  (#opened: _)
  (#a: Type0)
  (r: ref a)
  (p: perm)
: SteelGhost unit opened
    (A.varrayp r p)
    (fun _ -> vptrp r p)
    (fun _ -> True)
    (fun h0 _ h1 ->
      Seq.create 1 (selp r p h1) == A.aselp r p h0
    )
r: Steel.ArrayRef.ref a -> p: Steel.FractionalPermission.perm
  -> Steel.Effect.Atomic.SteelGhost Prims.unit