val addr_unused_in: nat -> heap -> Type0
let addr_unused_in n h = n <> 0 && None? (h.memory n)
val addr_unused_in: nat -> heap -> Type0
let addr_unused_in n h =
n <> 0 && None? (h.memory n)
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
Prims.nat FStar.Monotonic.Heap.heap Prims.b2t Prims.op_AmpAmp Prims.op_disEquality Prims.int FStar.Pervasives.Native.uu___is_None FStar.Pervasives.dtuple4 FStar.Pervasives.Native.option FStar.Preorder.preorder Prims.bool FStar.Monotonic.Heap.__proj__Mkheap_rec__item__memory
(*
   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

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)  //using `===` here, since otherwise typechecker fails with a and a1 being different types, why?
val addr_unused_in: nat -> heap -> Type0
n: Prims.nat -> h: FStar.Monotonic.Heap.heap -> Type0