Fixpoint list_denote l : T :=
  match l with nil => b | x :: l' => g (f x) (list_denote l')
  end.Notation "'un'" := (@orp _).

(* Specifications: *)
Lemma listd_fold_right l : listd l = fold_right (fun x y => g (f x) y) b l.
Lemma listd_app {A T} f g (b : T) (l l' : list A) : listd f g b (l ++ l') = listd f g (listd f g b l') l.
Lemma listd_nil : listd f g b nil = b.
Lemma listd_cons a l : listd f g b (a :: l) = g (f a) (listd f g b l).
Lemma listd_map h l (Hgh_eq : forall a b', g (f (h a)) b' = g (f a) b') : listd f g b (map h l) = listd f g b l.
Lemma listd_filter h l (H : forall a b', false=h a -> g (f a) b' = b') : listd f g b (filter h l) = listd f g b l.
Lemma listd_flat_map h l (H : forall a b', g (f a) b' = listd f g b' (h a)) : listd f g b l = listd f g b (flat_map h l).
Lemma listd_compose h1 h2 l (Hh1 : forall l, listd f g b l = listd f g b (h1 l)) (Hh2 : forall l, listd f g b l = listd f g b (h2 l)) : listd f g b l = listd f g b ((h1 oo h2) l).
Lemma fgAS b' (t t' : T) : g t (g t' b') = g t' (g t b').
Lemma listdAS a l : listd f g (g (f a) b) l = g (f a) (listd f g b l).
Lemma listd_AS_unit un l (un_unit : forall x, g x un = x) : listd f g b l = g b (listd f g un l).
Lemma listd_perm l l' (Hperm : Permutation l l') : listd f g b l = listd f g b l'.
Lemma listd_conj a l : listd f g b (a :: l) -> listd f g b l.
Lemma listd_conjP a l : forall b, listd h k b0 (a :: l) b -> listd h k b0 l b.
Lemma andS (x y : Prop) : and x y = and y x.
Lemma andA x y z : and x (and y z) = and (and x y) z.
Lemma orS (x y : Prop) : or x y = or y x.
Lemma orA x y z : or x (or y z) = or (or x y) z.
Lemma listd_conj_and a l : listd f and True (a :: l) -> listd f and True l.
Lemma listd_unfold_and l : listd f and b l = (listd f and True l /\ b).
Lemma listd_unfold_or l : listd f or b l = (listd f or False l \/ b).
Lemma listd_flat_map_and h l (H : forall a b', and (f a) b' -> listd f and b' (h a)) : listd f and b l -> listd f and b (flat_map h l).
Lemma listd_In_prop l : (forall a, In a l -> f a) -> listd f and True l.
Lemma listd_In_inv_prop a l : listd f and True l -> In a l -> f a.
Lemma listd_unfold_app_and b l l' : listd f and b (l ++ l') = (listd f and True l /\ listd f and b l').
Lemma listd_unfold_app_or b l l' : listd f or b (l ++ l') = (listd f or False l \/ listd f or b l').
Lemma union_com {A} : forall (P Q: pred A), ((P || Q) = (Q || P))%pred.
Lemma union_assoc {A} : forall (P Q R: pred A), ((P || Q) || R = P || (Q || R))%pred.
Lemma listd_conj_inter a l : forall b', listd f inter TT (a :: l) b' -> listd f inter TT l b'.
Lemma listd_unfold_inter l : listd f inter b l = (listd f inter TT l && b)%pred.
Lemma listd_unfold_un l : listd f un b l = (listd f un FF l || b)%pred.
Lemma listd_flat_map_inter h l s (H : forall a b', inter (f a) b' s -> listd f inter b' (h a) s) : listd f inter b l s -> listd f inter b (flat_map h l) s.
Lemma listd_In_pred l s : (forall a, In a l -> f a s) -> b s -> listd f inter b l s.
Lemma listd_In_inv_pred a l s : listd f inter TT l s -> In a l -> f a s.
Lemma listd_In_pred_un l s : (exists a, In a l /\ f a s) \/ b s -> listd f un b l s.
Lemma listd_In_inv_pred_un l s : listd f un b l s -> (exists a, In a l /\ f a s) \/ b s.
Lemma listd_map_pred {C : Type} h (g : C -> pred B) l s (H : forall a, f a s -> g (h a) s) : listd f inter TT l s -> listd g inter TT (map h l) s.
Lemma listd_omapl_pred {C : Type} h (g : C -> pred B) l s (H : forall a, f a s -> match h a with Some a' => g a' s | None => True end) : listd f inter TT l s -> listd g inter TT (omapl h l) s.
Lemma listd_foldr_pred h c0 l s (H : forall a x, f a s -> f x s -> f (h a x) s) : f c0 s -> listd f inter TT l s -> f (fold_right h c0 l) s.
Lemma listd_foldl_pred h c0 l s (H : forall a x, f a s -> f x s -> f (h x a) s) : f c0 s -> listd f inter TT l s -> f (fold_left h l c0) s.
Lemma listd_filter_pred h l s : listd f inter TT l s -> listd f inter TT (filter h l) s.
Lemma listd_partition_pred h l xs ys s (H : partition h l = (xs, ys)) : listd f inter TT l s -> listd f inter TT xs s /\ listd f inter TT ys s.
Lemma listd_unfold_app_inter b l l' : listd f inter b (l ++ l') = (listd f inter TT l && listd f inter b l')%pred.
Lemma listd_unfold_app_un b l l' : listd f un b (l ++ l') = (listd f un FF l || listd f un b l')%pred.
Lemma listd_insert cmp a l : listd f g b (insert cmp a l) = g (f a) (listd f g b l).
Lemma listd_sort cmp l : listd f g b (rsort cmp l) = listd f g b l.
Lemma listd_insert_uniq a l : listd f g b (insert_uniq cmp a l) = g (f a) (list_denote f g b l).
Lemma listd_sort_uniq l : listd f g b (rsort_uniq cmp l) = listd f g b l.
Lemma listd_insert_and cmp a l : listd f and b (insert cmp a l) = and (f a) (listd f and b l).
Lemma list_sort_and cmp l : listd f and b (rsort cmp l) = listd f and b l.
Lemma listd_insert_or cmp a l : listd f or b (insert cmp a l) = or (f a) (listd f or b l).
Lemma listd_sort_or cmp l : listd f or b (rsort cmp l) = listd f or b l.
Lemma interS (x y : pred B) : inter x y = inter y x.
Lemma interA (x y z : pred B) : inter x (inter y z) = inter (inter x y) z.
Lemma unS (x y : pred B) : un x y = un y x.
Lemma unA (x y z : pred B) : un x (un y z) = un (un x y) z.
Lemma sepconS (x y : pred B) : sepcon x y = sepcon y x.
Lemma sepconA (x y z : pred B) : sepcon x (sepcon y z) = sepcon (sepcon x y) z.
Lemma listd_insert_inter cmp a l : listd f inter b (insert cmp a l) = inter (f a) (listd f inter b l).
Lemma listd_sort_inter cmp l : listd f inter b (rsort cmp l) = listd f inter b l.
Lemma listd_insert_un cmp a l : listd f un b (insert cmp a l) = un (f a) (listd f un b l).
Lemma listd_sort_un cmp l : listd f un b (rsort cmp l) = listd f un b l.
Lemma listd_insert_sepcon cmp a l : listd f sepcon b (insert cmp a l) = sepcon (f a) (listd f sepcon b l).
Lemma listd_sort_sepcon cmp l : listd f sepcon b (rsort cmp l) = listd f sepcon b l.
Lemma listd_insert_uniq_and a l : listd f and b (insert_uniq cmp a l) = and (f a) (listd f and b l).
Lemma list_sort_uniq_and l : listd f and b (rsort_uniq cmp l) = listd f and b l.
Lemma listd_insert_uniq_or a l : listd f or b (insert_uniq cmp a l) = or (f a) (listd f or b l).
Lemma listd_sort_uniq_or l : listd f or b (rsort_uniq cmp l) = listd f or b l.
Lemma listd_insert_uniq_inter a l : listd f inter b (insert_uniq cmp a l) = inter (f a) (listd f inter b l).
Lemma listd_sort_uniq_inter l : listd f inter b (rsort_uniq cmp l) = listd f inter b l.
Lemma listd_insert_uniq_un a l : listd f un b (insert_uniq cmp a l) = un (f a) (listd f un b l).
Lemma listd_sort_uniq_un l : listd f un b (rsort_uniq cmp l) = listd f un b l.
Lemma listd_merge_inter l1 l2 s : listd f inter TT l1 s -> listd f inter TT l2 s -> listd f inter TT (merge cmp l1 l2) s.
Lemma merge_nil l : merge cmp l nil = l.
Lemma merge_nil' l : merge cmp nil l = l.
Lemma merge_cons_unfold a1 a2 l1 l2 : merge cmp (a1 :: l1) (a2 :: l2) = match cmp a1 a2 with | Eq => a1 :: merge cmp l1 l2 | Gt => a1 :: merge cmp l1 (a2 :: l2) | Lt => a2 :: merge cmp (a1 :: l1) l2 end.
Lemma merge_elems a l1 l2 : In a l1 \/ In a l2 <-> In a (merge cmp l1 l2).
Lemma listd_merge_inter' l1 l2 s : listd f inter TT (merge cmp l1 l2) s -> listd f inter TT l1 s /\ listd f inter TT l2 s.
Lemma listd_merge_un1 l1 l2 s : listd f un FF l1 s -> listd f un FF (merge cmp l1 l2) s.
Lemma listd_merge_un2 l1 l2 s : listd f un FF l2 s -> listd f un FF (merge cmp l1 l2) s.
Lemma listd_merge_un' l1 l2 s : listd f un FF (merge cmp l1 l2) s -> listd f un FF l1 s \/ listd f un FF l2 s.
Lemma listd_separate : listd f inter (listd g inter b l2) l1 = andp (listd f inter TT l1) (andp (listd g inter TT l2) b).
Lemma listd_prop: listd f inter b l1 = (andp (listd f inter TT l1) b).