Notation ACAS_witness sh p g i R h c v P Q :=
(sh%logic, p%logic, c%Z%logic, v%Z%logic, (ghost_hist sh h g * P)%logic, hist_R g%logic i R,
fun v' => EX h' : hist, !!(add_events h [CAS (vint v') (vint c) (vint v)] h') &&
ghost_hist sh h' g * Q v').

Lemma atomic_loc_hist_join : forall sh1 sh2 sh p g i R h1 h2 h (Hjoin : sepalg.join sh1 sh2 sh)
(Hh : Permutation.Permutation (h1 ++ h2) h) (Hsh1 : readable_share sh1) (Hsh2 : readable_share sh2),
atomic_loc_hist sh1 p g i R h1 * atomic_loc_hist sh2 p g i R h2 =
!!(disjoint h1 h2) && atomic_loc_hist sh p g i R h.