(* Lemma traversal_free_b_dim a b b' (h : b -> b') (x:  T a) : dimIT _ _ _ (traversal_coalg b x) = dimIT _ _ _ (traversal_coalg b' x).  Lemma traversal_free_b_pos a b b' (h : b -> b') (x:  T a) : eq_rect _ _ (pos (traversal_coalg b x)) _ (traversal_free_b_dim h x) = pos (traversal_coalg b' x). *)
Definition traversal_is_coalg : KleeneCoalg (fun a => a) T.
exists traversal_coalg.
exact traversal_coalg_extract.
exact traversal_coalg_duplicate.
Defined.
End Traversal.
Record FinContainerSpec := finContainerSpec
{ shape : Type
; card : shape -> nat
}.
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).

Lemma finContainer_free_applicative a b (F G : Applicative) (eta : IdiomaticTransformation F G) (f : a -> F b) (x : finContainer a) :
eta _ (finContainer_traverse f x) = finContainer_traverse (fun y => eta _ (f y)) x.