Definition hists_mono (h1 h2 : list (hist * hist)) := Forall2 (fun a b =>
(exists l, fst b = fst a ++ l) /\ (exists l, snd b = snd a ++ l)) h1 h2.
Instance hists_mono_refl : RelationClasses.Reflexive hists_mono.
Hint Resolve hists_mono_refl.
Instance hists_mono_trans : RelationClasses.Transitive hists_mono.

Lemma remove_last_full_hist : forall lh h j h' k v i k' i' (Hj : 0 <= j < Zlength lh) (Hh : Znth j lh [] = h)
(Hi' : 0 <= i' < Zlength h) (Hadd : add_item_trace h' k v i false h) (Hk : k <> 0) (Hrep : repable_signed k)
(Hfull : full_hist' (concat (map fst (map (fun h => Znth i' h ([], [])) lh))) k'),
full_hist' (concat (upd_Znth j (map fst (map (fun h => Znth i' h ([], [])) lh))
(fst (Znth i' h' ([], []))))) k'.