Corollary fold_join_hists_length : forall lh h, Forall (fun h' => Zlength h' = Zlength h) lh ->
  Zlength (fold_right join_hists h lh) = Zlength h.Corollary join_hists_empty_length : forall lh, Forall (fun h => Zlength h = size) lh ->
  Zlength (fold_right join_hists empty_hists lh) = size.

(* Specifications: *)
Lemma join_empty_r : forall h, Zlength h = size -> join_hists h empty_hists = h.
Lemma join_hists_assoc : forall a b c, join_hists a (join_hists b c) = join_hists (join_hists a b) c.
Lemma join_hists_base : forall l h, Zlength h = size -> fold_right join_hists (join_hists h empty_hists) l = join_hists (fold_right join_hists empty_hists l) h.
Lemma join_empty_hists : forall h n, Zlength h = size -> fold_right join_hists h (repeat empty_hists n) = h.
Lemma add_items_hist_length : forall h lr, Forall (fun '(la, h') => add_items_trace h la h') lr -> Forall (fun h' => Zlength h' = Zlength h) (map snd lr).