val ist_wp : state: Type -> a: Type -> Type
let ist_wp   (state:Type) (a:Type) = ist_post state a -> Tot (ist_pre state)
(*
   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 ImmutableSTwHeaps

open FStar.Heap
open FStar.Preorder
open FStar.Monotonic.Witnessed

//giving ourselves two non-ghost versions of the heap sel/upd functions
assume val sel: h:heap -> r:ref 'a -> Tot (x:'a{x == Heap.sel h r})
assume val upd: h:heap -> r:ref 'a -> v:'a -> Tot (h':heap{h' == Heap.upd h r v})

(* Two heaps are related if the latter differs from the former only by new 
   allocated references and all existing content is preserved unchanged. *)

let heap_rel (h0:heap) (h1:heap) = 
  forall a (r: ref a) . contains h0 r ==> contains h1 r /\ sel h0 r == sel h1 r


(* *************************************************** *)

(* 
   A temporary definition of preorder-indexed state 
   monads specialized to the immutable references 
   instance, in order to make sub-effecting to work. 
   Using (FStar.Heap.heap) and (heap_rel) for the 
   statespace and the relation on it, which otherwise 
   would be given by parameters.
*)


(* Preconditions, postconditions and WPs for the preorder-indexed state monad. *)

let ist_pre  (state:Type)          = state -> Type0
/
prims.fst.checked FStar.Preorder.fst.checked FStar.Pervasives.fsti.checked FStar.Monotonic.Witnessed.fsti.checked FStar.Heap.fst.checked
ImmutableSTwHeaps.fst
state: Type -> a: Type -> Type
ImmutableSTwHeaps.ist_post ImmutableSTwHeaps.ist_pre
let ist_wp (state a: Type) =
  
ist_post state a -> Tot (ist_pre state)