val lemma_frame_refl' (frame: vprop) (h0 h1: rmem frame)
    : Lemma ((h0 frame == h1 frame) <==> frame_equalities' frame h0 h1)
let rec lemma_frame_refl' (frame:vprop) (h0:rmem frame) (h1:rmem frame)
  : Lemma ((h0 frame == h1 frame) <==> frame_equalities' frame h0 h1)
  = match frame with
    | VUnit _ -> ()
    | VStar p1 p2 ->
      can_be_split_star_l p1 p2;
      can_be_split_star_r p1 p2;

      let h01 : rmem p1 = focus_rmem h0 p1 in
      let h11 : rmem p1 = focus_rmem h1 p1 in
      let h02 = focus_rmem h0 p2 in
      let h12 = focus_rmem h1 p2 in


      lemma_frame_refl' p1 h01 h11;
      lemma_frame_refl' p2 h02 h12
val lemma_frame_refl' (frame: vprop) (h0 h1: rmem frame)
    : Lemma ((h0 frame == h1 frame) <==> frame_equalities' frame h0 h1)
let rec lemma_frame_refl' (frame: vprop) (h0 h1: rmem frame)
    : Lemma ((h0 frame == h1 frame) <==> frame_equalities' frame h0 h1) =
match frame with
| VUnit _ -> ()
| VStar p1 p2 ->
  can_be_split_star_l p1 p2;
  can_be_split_star_r p1 p2;
  let h01:rmem p1 = focus_rmem h0 p1 in
  let h11:rmem p1 = focus_rmem h1 p1 in
  let h02 = focus_rmem h0 p2 in
  let h12 = focus_rmem h1 p2 in
  lemma_frame_refl' p1 h01 h11;
  lemma_frame_refl' p2 h02 h12
Steel.Effect.Common.fst.checked
Steel.Semantics.Instantiate.fsti.checked Steel.Semantics.Hoare.MST.fst.checked Steel.Memory.fsti.checked prims.fst.checked FStar.PropositionalExtensionality.fst.checked FStar.Pervasives.Native.fst.checked FStar.Pervasives.fsti.checked FStar.FunctionalExtensionality.fsti.checked FStar.Classical.fsti.checked
Steel.Effect.Common.fst
Steel.Effect.Common.vprop Steel.Effect.Common.rmem Steel.Effect.Common.vprop' Steel.Effect.Common.lemma_frame_refl' Prims.unit Steel.Effect.Common.rmem' Steel.Effect.Common.valid_rmem Steel.Effect.Common.focus_rmem Steel.Effect.Common.can_be_split_star_r Steel.Effect.Common.can_be_split_star_l Prims.l_True Prims.squash Prims.l_iff Prims.eq2 Steel.Effect.Common.normal Steel.Effect.Common.t_of Steel.Effect.Common.frame_equalities' Prims.Nil FStar.Pervasives.pattern
(*
   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.Common
module Sem = Steel.Semantics.Hoare.MST
module Mem = Steel.Memory
open Steel.Semantics.Instantiate
module FExt = FStar.FunctionalExtensionality

let h_exists #a f = VUnit ({hp = Mem.h_exists (fun x -> hp_of (f x)); t = unit; sel = fun _ -> ()})

let can_be_split (p q:vprop) : prop = Mem.slimp (hp_of p) (hp_of q)

let reveal_can_be_split () = ()

let can_be_split_interp r r' h = ()

let can_be_split_trans p q r = ()
let can_be_split_star_l p q = ()
let can_be_split_star_r p q = ()
let can_be_split_refl p = ()

let can_be_split_congr_l p q r =
  Classical.forall_intro (interp_star (hp_of p) (hp_of r));
  Classical.forall_intro (interp_star (hp_of q) (hp_of r))

let can_be_split_congr_r p q r =
  Classical.forall_intro (interp_star (hp_of r) (hp_of p));
  Classical.forall_intro (interp_star (hp_of r) (hp_of q))

let equiv (p q:vprop) : prop = Mem.equiv (hp_of p) (hp_of q) /\ True
let reveal_equiv p q = ()

let valid_rmem (#frame:vprop) (h:rmem' frame) : prop =
  forall (p p1 p2:vprop). can_be_split frame p /\ p == VStar p1 p2 ==>
     (h p1, h p2) == h (VStar p1 p2)

let lemma_valid_mk_rmem (r:vprop) (h:hmem r) = ()

let reveal_mk_rmem (r:vprop) (h:hmem r) (r0:vprop{r `can_be_split` r0})
  : Lemma ((mk_rmem r h) r0 == sel_of r0 h)
  = FExt.feq_on_domain_g (unrestricted_mk_rmem r h)

let emp':vprop' =
  { hp = emp;
    t = unit;
    sel = fun _ -> ()}
let emp = VUnit emp'

let reveal_emp () = ()

let lemma_valid_focus_rmem #r h r0 =
  Classical.forall_intro (Classical.move_requires (can_be_split_trans r r0))

let rec lemma_frame_refl' (frame:vprop) (h0:rmem frame) (h1:rmem frame)
val lemma_frame_refl' (frame: vprop) (h0 h1: rmem frame)
    : Lemma ((h0 frame == h1 frame) <==> frame_equalities' frame h0 h1)

    frame: Steel.Effect.Common.vprop ->
    h0: Steel.Effect.Common.rmem frame ->
    h1: Steel.Effect.Common.rmem frame
  -> FStar.Pervasives.Lemma
    (ensures h0 frame == h1 frame <==> Steel.Effect.Common.frame_equalities' frame h0 h1)