Section IndexBound.
Context {A : Set}.
Class IndexBound (a : A) (Bound : list A) :=
{ ibound :> nat;
boundi : nth_error Bound ibound = Some a}.
Global Arguments ibound [a Bound] _ .
Global Arguments boundi [a Bound] _.
Record BoundedIndex (Bound : list A) := { bindex :> A; indexb :> IndexBound bindex Bound }.
End IndexBound.
Context {A : Type} {C : Set}.
Variable (projAC : A -> C).
admit.
Defined.
Program Definition nth_Bounded'
(Bound : list A)
(c : C)
(a_opt : option A)
(nth_n : option_map projAC a_opt = Some c)
: A := match a_opt as x
return (option_map projAC x = Some c) -> A with
| Some a => fun _ => a
| None => fun f : None = Some _ => !
end nth_n.

Lemma nth_error_map :
forall n As c_opt,
nth_error (map projAC As) n = c_opt
-> option_map projAC (nth_error As n) = c_opt.