(*! Instantiation of modules *)
Set Bullet Behavior "Strict Subproofs".
(** * join_all and permutations *)
Section Machine.
Context {ge : Clight.genv}.
Definition getLocksR (tp : jstate ge) := listoption_inv (map snd (AMap.elements (lset tp))).
Definition maps tp := (getThreadsR tp ++ getLocksR tp)%list.

(* Specifications: *)
Lemma all_but_maps i tp (cnti : containsThread tp i) :
all_but i (maps tp) = all_but i (getThreadsR tp) ++ getLocksR tp.
Lemma join_list_joinlist : join_list = joinlist.
Lemma join_list'_None l : join_list' l None <-> listoption_inv l = nil.
Lemma join_list'_Some l phi : join_list' l (Some phi) -> joinlist (listoption_inv l) phi.
Lemma join_list'_Some' l phi : listoption_inv l <> nil -> joinlist (listoption_inv l) phi -> join_list' l (Some phi).
Lemma join_all_joinlist tp : join_all tp = joinlist (maps tp).
(** * Results about handling threads' rmaps *)
Lemma seq_pmap_decent {A B} (f : A -> option B) l :
seq.pmap f l = listoption_inv (map f l).
Lemma minus_plus a b c : a - (b + c) = a - b - c.
Lemma nth_error_enum_from n m i Hn Hi :
(i < n)%nat ->
nth_error (@enum_from n m Hn) i = Some (@fintype.Ordinal m (n - 1 - i) Hi).
Lemma nth_error_enum n i pr :
nth_error (enum n) i = Some (@fintype.Ordinal n i pr).