Corollary consistent_insert_rem : forall {A} (h1 h2 : hist A) a b p v (Hadds : forallb is_add h1 = true),
  consistent (h1 ++ h2) a b -> consistent (h1 ++ QRem p v :: h2) ((p, v) :: a) b.

Lemma total_length_app : forall {A} (l1 l2 : list (list A)), total_length (l1 ++ l2) = total_length l1 + total_length l2.