Definition rightI (d:nat)(x:TypeI) : nat :=
match x with
| I _ n => n
| E _ => d
end.

(* Specifications: *)
Lemma inf_list_maxl_r : forall l n s,
inf_list l = I n s ->
s = maxl (map (rightI 0) l).
Lemma in_inf_list_le_l l n s n' s' :
In (I n' s') l -> inf_list l = I n s -> n' <= n.
Lemma in_inf_list_le_r l n s n' s' :
In (I n' s') l -> inf_list l = I n s -> s' <= s.
Lemma in_inf_list_le l n s n' s' :
In (I n' s') l -> inf_list l = I n s -> n' <= n /\ s' <= s.
Lemma in_inf_list_err : forall l err,
In (E err) l -> exists err', inf_list l = E err'.
Lemma in_inf_list_err_conv : forall l err,
inf_list l = E err ->
exists err', In (E err') l.
Lemma inf_list_ex : forall l e n s,
In e l -> inf_list (map inf l) = I n s ->
exists n', exists s', n' <= n /\ s' <= s /\ inf e = I n' s'.