Require Export VST.floyd.compact_prod_sum.
Definition
map_map: forall {A B C : Type} (f : A -> B) (g : B -> C) (l : list A),
map g (map f l) = map (fun x : A => g (f x)) l :=
fun (A B C : Type) (f : A -> B) (g : B -> C) (l : list A) =>
list_ind
(fun l0 : list A => map g (map f l0) = map (fun x : A => g (f x)) l0)
eq_refl
(fun (a : A) (l0 : list A)
(IHl : map g (map f l0) = map (fun x : A => g (f x)) l0) =>
eq_ind_r
(fun l1 : list C =>
g (f a) :: l1 = g (f a) :: map (fun x : A => g (f x)) l0) eq_refl IHl)
l.
(******************************************  Definition of reptype.  ******************************************)
Notation sigTT P := (fun tv => match tv with existT t v => P t end).
Definition compact_prod_sigT_type {A} {P: A -> Type} (l: list (sigT P)): Type :=
compact_prod (map (sigTT P) l).
Definition compact_prod_sigT_value: forall {A} {P: A -> Type} (l: list (sigT P)), compact_prod (map (sigTT P) l).
Definition compact_sum_map {X: Type} {F F0: X -> Type} (l: list X)
(f: ListType (map (fun x => F x -> F0 x) l)): compact_sum (map F l) -> compact_sum (map F0 l).

Lemma compact_sum_map_cons_inl: forall {X: Type} {F F0: X -> Type} (x x0: X) (l: list X)
(f: F x -> F0 x) (fl: ListType (map (fun x => F x -> F0 x) (x0 :: l)))
(v: F x),
compact_sum_map (x :: x0 :: l) (Cons f fl) (inl v) = inl (f v).