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).

(* Specifications: *)
Lemma compact_prod_map_single: forall {X: Type} {F F0: X -> Type} (x: X)
(f: F x -> F0 x) (v: F x),
compact_prod_map (x :: nil) (Cons f Nil) v = f v.
Lemma compact_prod_map_cons: 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) (vl: compact_prod (map F (x0 :: l))),
compact_prod_map (x :: x0 :: l) (Cons f fl) (v, vl) = (f v, compact_prod_map _ fl vl).