val next_ref_addr_in_a_region_pred (m1 m2: mem) : Type0
let next_ref_addr_in_a_region_pred (m1 m2:mem) :Type0
  = forall (r:HS.rid).{:pattern (m1 `contains_region` r)}
                 (m1 `contains_region` r) ==> 
		 (if m2 `contains_region` r then
		    let h1 = Map.sel (HS.get_hmap m1) r in
		    let h2 = Map.sel (HS.get_hmap m2) r in
		    Heap.next_addr h1 <= Heap.next_addr h2
		  else True)
val next_ref_addr_in_a_region_pred (m1 m2: mem) : Type0
let next_ref_addr_in_a_region_pred (m1 m2: mem) : Type0 =
forall (r: HS.rid). {:pattern (m1 `contains_region` r)}
  (m1 `contains_region` r) ==>
  (if m2 `contains_region` r
    then
      let h1 = Map.sel (HS.get_hmap m1) r in
      let h2 = Map.sel (HS.get_hmap m2) r in
      Heap.next_addr h1 <= Heap.next_addr h2
    else True)
FStar.HyperStack.ST.fst.checked
prims.fst.checked FStar.Set.fsti.checked FStar.Preorder.fst.checked FStar.Pervasives.fsti.checked FStar.Monotonic.Witnessed.fsti.checked FStar.Map.fsti.checked FStar.HyperStack.fst.checked FStar.Heap.fst.checked FStar.Classical.fsti.checked
FStar.HyperStack.ST.fst
FStar.Monotonic.HyperStack.mem Prims.l_Forall FStar.Monotonic.HyperHeap.rid Prims.l_imp Prims.b2t FStar.HyperStack.ST.contains_region Prims.op_LessThanOrEqual FStar.Monotonic.Heap.next_addr FStar.Monotonic.Heap.heap FStar.Map.sel FStar.Monotonic.HyperStack.get_hmap Prims.bool Prims.l_True Prims.logical
(*
   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.HyperStack.ST

open FStar.HyperStack

module W  = FStar.Monotonic.Witnessed
module HS = FStar.HyperStack

open FStar.Preorder

(* Eternal regions remain contained *)
private let eternal_region_pred (m1 m2:mem) :Type0
  = forall (r:HS.rid).{:pattern (HS.is_heap_color (color r)); (m1 `contains_region` r)}
                 (HS.is_eternal_region_hs r /\ m1 `contains_region` r) ==> m2 `contains_region` r

(* rid counter increases monotonically *)
private let rid_ctr_pred (m1 m2:mem) :Type0 = get_rid_ctr m1 <= get_rid_ctr m2

(*
 * A region r, that is:
 * (a) not contained in m1, and
 * (b) has rid last component less than m1.rid_ctr
 * 
 * remains not contained in m2
 *)
private let rid_last_component_pred (m1 m2:mem) :Type0
  = forall (r:HS.rid).{:pattern (m1 `contains_region` r)}
                 ((~ (m1 `contains_region` r)) /\ rid_last_component r < get_rid_ctr m1) ==>
		 (~ (m2 `contains_region` r))

(* Predicate for eternal refs *)
private let eternal_refs_pred (m1 m2:mem) :Type0
  = forall (a:Type) (rel:preorder a) (r:HS.mreference a rel).
      {:pattern (m1 `HS.contains` r)}
      (is_mm r) \/
      (((m1 `HS.contains` r) /\
        (HS.is_eternal_region_hs (frameOf r) \/
         m2 `contains_region` (HS.frameOf r))) ==> (m2 `HS.contains` r /\ rel (HS.sel m1 r) (HS.sel m2 r)))
       
(*
 * Predicate for next ref address in a region's heap
 * For all regions, their next_addr increases monotonically (or the region ceases to exist)
 *)
val next_ref_addr_in_a_region_pred (m1 m2: mem) : Type0
m1: FStar.Monotonic.HyperStack.mem -> m2: FStar.Monotonic.HyperStack.mem -> Type0