(** * Lemmas about the Dry Machine*)
From mathcomp.ssreflect Require Import ssreflect ssrbool ssrnat seq ssrfun eqtype fintype finfun.
Set Implicit Arguments.
(*NOTE: because of redefinition of [val], these imports must appear after Ssreflect eqtype.*)
(* Require Import compcert.common.Events. *)
Global Notation "a # b" := (Maps.PMap.get b a) (at level 1).
(** This file holds various results about the dry machine*)
(* Find other lemmas in dry_machine_step_lemmas.v        *)
Module ThreadPoolWF.
Section ThreadPoolWF.
Context {Sem : Semantics}.
Existing Instance DryHybridMachine.dryResources.
Existing Instance OrdinalPool.OrdinalThreadPool.
(** Take an instance of the Dry Machine *)
Existing Instance DryHybridMachine.DryHybridMachineSig.

Lemma updLock_inv:
forall tp b ofs rmap
(Hinv: invariant tp)
(Hdisjoint_res: forall laddr rmap',
laddr <> (b, ofs) ->
lockRes tp laddr = Some rmap' ->
permMapsDisjoint2 rmap rmap')
(Hdisjoint_thr: forall i (cnti: containsThread tp i),
permMapsDisjoint2 (getThreadR cnti) rmap)
(Hcoh_res: forall laddr rmap',
laddr <> (b, ofs) ->
lockRes tp laddr = Some rmap' ->
permMapCoherence rmap.1 rmap'.2 /\
permMapCoherence rmap'.1 rmap.2)
(Hcoh_rmap: permMapCoherence rmap.1 rmap.2)
(Hcoh_thr: forall i (cnti: containsThread tp i),
permMapCoherence rmap.1 (getThreadR cnti).2 /\
permMapCoherence (getThreadR cnti).1 rmap.2)
(Hvalid1: forall ofs0,
(ofs < ofs0 < ofs + lksize.LKSIZE)%Z -> lockRes tp (b, ofs0) = None)
(Hvalid2: forall ofs0 : Z,
(ofs0 < ofs < ofs0 + lksize.LKSIZE)%Z -> lockRes tp (b, ofs0) = None),
invariant (updLockSet tp (b, ofs) rmap).