Section OrdinalThreadPool.
Context {resources: Resources}.
Context {Sem: Semantics}.
Local Notation ctl := (@ctl semC).
Notation tid:= nat.
Record t := mk
{ num_threads : pos
; pool :> 'I_num_threads -> ctl
; perm_maps : 'I_num_threads -> res
; lset : AMap.t lock_info
}.
Definition one_pos : pos.pos := pos.mkPos NPeano.Nat.lt_0_1.
Definition mkPool c res :=
mk one_pos
(fun _ =>  c)
(fun _ => res) (*initially there are no locks*)
empty_lset.
Definition lockGuts := lset.
Definition lockSet (tp:t) := A2PMap (lset tp).
Definition lockRes t : address -> option lock_info:=
AMap.find (elt:=lock_info)^~ (lockGuts t).
Definition lr_valid (lr: address -> option lock_info):=
forall b ofs,
match lr (b,ofs) with
| Some r => forall ofs0:Z, (ofs < ofs0 < ofs+LKSIZE)%Z -> lr (b, ofs0) = None
| _ => True
end.
Next Obligation.
intros. subst; reflexivity.
Defined.
Definition pos_pred (n:pos): nat.

Lemma lockSet_spec_1: forall js b ofs,
lockRes js (b,ofs) ->
(lockSet js) !! b ofs = Some Memtype.Writable.