val abcd_acbd (a b c d: slprop)
    : Lemma
    (let open Mem in ((a `star` b) `star` (c `star` d)) `equiv` ((a `star` c) `star` (b `star` d)))
let abcd_acbd (a b c d:slprop)
  : Lemma (Mem.(((a `star` b) `star` (c `star` d)) `equiv`
           ((a `star` c) `star` (b `star` d))))
  = let open Steel.Memory in
    calc (equiv) {
    ((a `star` b) `star` (c `star` d));
      (equiv) { star_associative a b (c `star` d) }
    ((a `star` (b `star` (c `star` d))));
      (equiv) { star_associative b c d;
                star_congruence a (b `star` (c `star` d))
                                a ((b `star` c) `star` d) }
    (a `star` ((b `star` c) `star` d));
      (equiv) { star_commutative  b c;
                star_congruence (b `star` c) d (c `star` b) d;
                star_congruence a ((b `star` c) `star` d)
                                a ((c `star` b) `star` d) }
    (a `star` ((c `star` b) `star` d));
      (equiv) { star_associative c b d;
                star_congruence a ((c `star` b) `star` d)
                                a (c `star` (b `star` d)) }
    (a `star` (c `star` (b `star` d)));
      (equiv) { star_associative a c (b `star` d) }
    ((a `star` c) `star` (b `star` d));
   }
val abcd_acbd (a b c d: slprop)
    : Lemma
    (let open Mem in ((a `star` b) `star` (c `star` d)) `equiv` ((a `star` c) `star` (b `star` d)))
let abcd_acbd (a b c d: slprop)
    : Lemma
    (let open Mem in ((a `star` b) `star` (c `star` d)) `equiv` ((a `star` c) `star` (b `star` d))) =
let open Steel.Memory in
calc (equiv) {
  ((a `star` b) `star` (c `star` d));
  (equiv) { star_associative a b (c `star` d) }
  ((a `star` (b `star` (c `star` d))));
  (equiv) { (star_associative b c d;
    star_congruence a (b `star` (c `star` d)) a ((b `star` c) `star` d)) }
  (a `star` ((b `star` c) `star` d));
  (equiv) { (star_commutative b c;
    star_congruence (b `star` c) d (c `star` b) d;
    star_congruence a ((b `star` c) `star` d) a ((c `star` b) `star` d)) }
  (a `star` ((c `star` b) `star` d));
  (equiv) { (star_associative c b d;
    star_congruence a ((c `star` b) `star` d) a (c `star` (b `star` d))) }
  (a `star` (c `star` (b `star` d)));
  (equiv) { star_associative a c (b `star` d) }
  ((a `star` c) `star` (b `star` d));
}
Steel.HigherReference.fst.checked
Steel.PCMReference.fsti.checked Steel.PCMFrac.fst.checked Steel.Memory.fsti.checked Steel.Effect.Atomic.fsti.checked Steel.Effect.fsti.checked prims.fst.checked FStar.Real.fsti.checked FStar.Pervasives.Native.fst.checked FStar.Pervasives.fsti.checked FStar.PCM.fst.checked FStar.NMSTTotal.fst.checked FStar.Ghost.fsti.checked FStar.Classical.fsti.checked FStar.Calc.fsti.checked
Steel.HigherReference.fst
Steel.Memory.slprop FStar.Calc.calc_finish Steel.Memory.equiv Steel.Memory.star Prims.Cons FStar.Preorder.relation Prims.Nil Prims.unit FStar.Calc.calc_step FStar.Calc.calc_init FStar.Calc.calc_pack Steel.Memory.star_associative Prims.squash Steel.Memory.star_congruence Steel.Memory.star_commutative Prims.l_True 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.HigherReference
open FStar.Ghost
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open FStar.PCM
open Steel.PCMFrac
open FStar.Real
module RP = Steel.PCMReference

#set-options "--ide_id_info_off"

module Mem = Steel.Memory

let ref a = Mem.ref (fractional a) pcm_frac
let null #a = Mem.null #(fractional a) #pcm_frac
let is_null #a r = Mem.is_null #(fractional a) #pcm_frac r
let perm_ok p : prop = (p.v <=. one == true) /\ True
let pts_to_raw_sl (#a:Type) (r:ref a) (p:perm) (v:erased a) : slprop =
  Mem.pts_to r (Some (Ghost.reveal v, p))
let pts_to_raw (#a:Type) (r:ref a) (p:perm) (v:erased a) : vprop =
  to_vprop (Mem.pts_to r (Some (Ghost.reveal v, p)))
[@@__reduce__]
let pts_to' (#a:Type u#1) (r:ref a) (p:perm) (v:erased a) : vprop = pts_to_raw r p v `star` pure (perm_ok p)
let pts_to_sl #a r p v  = hp_of (pts_to' r p v)

let abcd_acbd (a b c d:slprop)
  : Lemma (Mem.(((a `star` b) `star` (c `star` d)) `equiv`
val abcd_acbd (a b c d: slprop)
    : Lemma
    (let open Mem in ((a `star` b) `star` (c `star` d)) `equiv` ((a `star` c) `star` (b `star` d)))
a: Steel.Memory.slprop -> b: Steel.Memory.slprop -> c: Steel.Memory.slprop -> d: Steel.Memory.slprop
  -> FStar.Pervasives.Lemma
    (ensures
      Steel.Memory.equiv (Steel.Memory.star (Steel.Memory.star a b) (Steel.Memory.star c d))
        (Steel.Memory.star (Steel.Memory.star a c) (Steel.Memory.star b d)))