Ltac joins_sh_contradiction_onside:=
      match goal with
      | [ H: joins ?sh1 ?sh2,
             W1: writable0_share ?sh1,
                 W2: writable0_share ?sh2 |- _ ] =>
        exfalso; eapply writable0_not_join_writable0; eassumption
      | [ H: joins ?sh1 ?sh2,
             W1: writable0_share ?sh1,
                 W2: readable_share ?sh2 |- _ ] =>
        exfalso; eapply writable0_not_join_readable; eassumption
      | [ H: joins Share.top ?sh2,
             H0: ?sh2 <> Share.bot |- _ ] =>
        exfalso; eapply H0; eapply only_bot_joins_top; eassumption
      end.Ltac joins_sh_contradiction:=
      first[ joins_sh_contradiction_onside |
             match goal with
             | [ H: joins ?sh1 ?sh2 |- _ ] =>
               eapply joins_comm in H
             end; joins_sh_contradiction_onside].

Lemma joins_permDisjoint: forall r1 r2, joins r1 r2 -> permDisjoint (perm_of_res r1) (perm_of_res r2).