Definition reindex (thd:threads) pool : _ -> map :=
fun x : nat + nat =>
match x with
| inl n =>
match nth thd n with
| Some (m, _) => m
| None => emptymap
end
| inr n =>
match pool n with
| Some m => m
| None => emptymap
end
end.

(* Specifications: *)
Lemma natnateqdec (x y : nat + nat) : {x=y}+{x<>y}. repeat decide equality. Defined.
Definition lockpool_matches (pool : lockpool) RI :=
forall l, match pool l with Some m => m |= RI l | None => True end.
Lemma natnateqdec (x y : nat + nat) : {x=y}+{x<>y}. repeat decide equality. Defined.
Definition lockpool_matches (pool : lockpool) RI :=
forall l, match pool l with Some m => m |= RI l | None => True end.