proposition: Lemma FMap_Insert_fold_add_MapsTo {Value} : forall (f : Value -> Value) (bag : t Value) bag' k v, MapsTo k v (fold (fun k bag'' r' => add k (f bag'') r') bag bag') -> MapsTo k v bag' \/ InA (@eq_key_elt _) (k,v) (List.map (fun kv => (fst kv, f (snd kv))) (elements bag)).
proof: Proof. intros; rewrite fold_1 in *; revert bag' H; induction (elements bag); simpl in *; eauto; intros. apply IHl in H; intuition. apply add_mapsto_iff in H0; intuition; subst. right; constructor; split; eauto. Qed.
imports: Coq.FSets.FMapInterface Coq.FSets.FMapFacts Coq.Program.Program Coq.Structures.OrderedTypeEx Fiat.Common Fiat.Common.SetEq Fiat.Common.SetEqProperties Fiat.Common.List.ListFacts Fiat.Common.List.ListMorphisms Fiat.Common.LogicFacts Fiat.Common.SetoidClassInstances