val repr (a:Type u#a)
   (already_framed:bool)
   (opened_invariants:inames)
   (g:observability)
   (pre:pre_t)
   (post:post_t a)
   (req:req_t pre)
   (ens:ens_t pre a post)
  : Type u#(max a 2)
let repr a framed opened f pre post req ens =
  action_except_full a opened (hp_of pre) (to_post post)
    (req_to_act_req req) (ens_to_act_ens ens)
val repr (a:Type u#a)
   (already_framed:bool)
   (opened_invariants:inames)
   (g:observability)
   (pre:pre_t)
   (post:post_t a)
   (req:req_t pre)
   (ens:ens_t pre a post)
  : Type u#(max a 2)
let repr a framed opened f pre post req ens =
action_except_full a opened (hp_of pre) (to_post post) (req_to_act_req req) (ens_to_act_ens ens)
Steel.Effect.Atomic.fst.checked
Steel.Semantics.Hoare.MST.fst.checked Steel.Memory.fsti.checked Steel.Effect.fst.checked Steel.Effect.fst.checked prims.fst.checked FStar.Pervasives.Native.fst.checked FStar.Pervasives.fsti.checked FStar.NMSTTotal.fst.checked FStar.Monotonic.Pure.fst.checked FStar.Ghost.fsti.checked FStar.Classical.fsti.checked
Steel.Effect.Atomic.fst
Prims.bool Steel.Memory.inames Steel.Effect.Common.observability Steel.Effect.Common.pre_t Steel.Effect.Common.post_t Steel.Effect.Common.req_t Steel.Effect.Common.ens_t Steel.Memory.action_except_full Steel.Effect.Common.hp_of Steel.Effect.Atomic.to_post Steel.Effect.Atomic.req_to_act_req Steel.Effect.Atomic.ens_to_act_ens
(*
   Copyright 2020 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 Steel.Effect.Atomic

open Steel.Effect
friend Steel.Effect

#set-options "--warn_error -330"  //turn off the experimental feature warning

let _ : squash (forall (pre:pre_t) (m0:mem{interp (hp_of pre) m0}) (m1:mem{disjoint m0 m1}).
  mk_rmem pre m0 == mk_rmem pre (join m0 m1)) = Classical.forall_intro rmem_depends_only_on

let req_to_act_req (#pre:vprop) (req:req_t pre) : mprop (hp_of pre) =
  fun m ->
    rmem_depends_only_on pre;
    interp (hp_of pre) m /\ req (mk_rmem pre m)

unfold
let to_post (#a:Type) (post:post_t a) = fun x -> (hp_of (post x))

let ens_to_act_ens (#pre:pre_t) (#a:Type) (#post:post_t a) (ens:ens_t pre a post)
: mprop2 (hp_of pre) (to_post post)
= fun m0 x m1 -> interp (hp_of pre) m0 /\ interp (hp_of (post x)) m1 /\
    ens (mk_rmem pre m0) x (mk_rmem (post x) m1)
val repr (a:Type u#a)
   (already_framed:bool)
   (opened_invariants:inames)
   (g:observability)
   (pre:pre_t)
   (post:post_t a)
   (req:req_t pre)
   (ens:ens_t pre a post)
  : Type u#(max a 2)

    a: Type ->
    already_framed: Prims.bool ->
    opened_invariants: Steel.Memory.inames ->
    g: Steel.Effect.Common.observability ->
    pre: Steel.Effect.Common.pre_t ->
    post: Steel.Effect.Common.post_t a ->
    req: Steel.Effect.Common.req_t pre ->
    ens: Steel.Effect.Common.ens_t pre a post
  -> Type