Section FinContainer.
Variable spec : FinContainerSpec.
Definition finContainer (a:Type) := {x : shape spec & Vector (card x) a}.
Definition finContainer_traverse a b (F : Applicative) (f : a -> F b) (x : finContainer a) : F (finContainer b) :=
let (s, v) := x in map (existT _ s) (traverse f v).
Definition FinContainer : Traversal.
exists finContainer finContainer_traverse.
apply finContainer_free_applicative.
apply finContainer_traverse_identity.
apply finContainer_traverse_compose.
Defined.
End FinContainer.
(*============================================================================*)
(*The main result                                                             *)
(*============================================================================*)

Theorem Traversal_is_finite_container :
forall (T:Traversal), exists (spec : FinContainerSpec)
(f : forall a, T a -> FinContainer spec a)
(g : forall a, FinContainer spec a -> T a),
(forall a, (forall x, g a (f a x) = x) /\ forall y, f a (g a y) = y) /\
(forall a b (F : Applicative) (h: a -> F b) (x : T a),
map (f b) (traverse h x) = traverse h (f a x)).