val contains: #a:Type0 -> #rel:preorder a -> heap -> mref a rel -> Type0
let contains #a #rel h r =
  let _ = () in
  Some? (h.memory r.addr) /\
  (let Some (| a1, pre_opt, mm, _ |) = h.memory r.addr in
   a == a1 /\ Some? pre_opt /\ Some?.v pre_opt == rel /\ mm = r.mm)
val contains: #a:Type0 -> #rel:preorder a -> heap -> mref a rel -> Type0
let contains #a #rel h r =
let _ = () in
Some? (h.memory r.addr) /\
(let Some (| a1 , pre_opt , mm , _ |) = h.memory r.addr in
  a == a1 /\ Some? pre_opt /\ Some?.v pre_opt == rel /\ mm = r.mm)
FStar.Monotonic.Heap.fst.checked
prims.fst.checked FStar.Squash.fsti.checked FStar.Set.fsti.checked FStar.Preorder.fst.checked FStar.Pervasives.Native.fst.checked FStar.Pervasives.fsti.checked FStar.FunctionalExtensionality.fsti.checked FStar.ErasedLogic.fst.checked FStar.Classical.fsti.checked
FStar.Monotonic.Heap.fst
FStar.Preorder.preorder FStar.Monotonic.Heap.heap FStar.Monotonic.Heap.mref Prims.l_and Prims.b2t FStar.Pervasives.Native.uu___is_Some FStar.Pervasives.dtuple4 FStar.Pervasives.Native.option Prims.bool FStar.Monotonic.Heap.__proj__Mkheap_rec__item__memory FStar.Monotonic.Heap.__proj__Mkcore_mref__item__addr Prims.eq2 FStar.Preorder.relation Prims.l_or FStar.Preorder.preorder_rel FStar.Pervasives.Native.__proj__Some__item__v Prims.op_Equality FStar.Monotonic.Heap.__proj__Mkcore_mref__item__mm Prims.logical Prims.unit
(*
   Copyright 2008-2018 Microsoft Research

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

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

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

open FStar.Preorder
open FStar.Classical
module F = FStar.FunctionalExtensionality

private noeq type heap_rec = {
  next_addr: pos;
  memory   : F.restricted_t pos (fun (x:pos) 
             -> option (a:Type0 & rel:(option (preorder a)) & b:bool & a)) 
                      //type, preorder, mm flag, and value
}

let heap = h:heap_rec{(forall (n:nat). n >= h.next_addr ==> None? (h.memory n))}

let equal h1 h2 =
  let _ = () in
  h1.next_addr = h2.next_addr /\
  FStar.FunctionalExtensionality.feq h1.memory h2.memory

let equal_extensional h1 h2 = ()

let emp = {
  next_addr = 1;
  memory    = F.on_dom pos (fun r -> None)
}

let next_addr h = h.next_addr

noeq
type core_mref (a:Type0) : Type0 = {
  addr: (x: nat { x > 0 } );
  init: a;
  mm:   bool;  //manually managed flag
}

let addr_of #a #rel r = r.addr

let is_mm #a #rel r = r.mm
val contains: #a:Type0 -> #rel:preorder a -> heap -> mref a rel -> Type0
h: FStar.Monotonic.Heap.heap -> r: FStar.Monotonic.Heap.mref a rel -> Type0