Fixpoint compact_prod (T: list Type): Type :=
match T with
| nil => unit
| t :: nil => t
| t :: T0 => (t * compact_prod T0)%type
end.
Fixpoint compact_sum (T: list Type): Type :=
match T with
| nil => unit
| t :: nil => t
| t :: T0 => (t + compact_sum T0)%type
end.
Definition compact_prod_gen {A} {F} (gen: forall a: A, F a) (l: list A): compact_prod (map F l).

Lemma compact_sum_gen_JMeq: forall {A} {F1} {F2} (filter: A -> bool) (gen1: forall a: A, F1 a) (gen2: forall a: A, F2 a)  (l: list A), (forall a, In a l -> JMeq (gen1 a) (gen2 a)) -> JMeq (compact_sum_gen filter gen1 l) (compact_sum_gen filter gen2 l).