proposition: Lemma refine_For_Map {resultT resultT'} : forall comp (f : resultT' -> resultT), refine (Query_For (results <- comp; ret (map f results))) (results <- Query_For comp; ret (map f results)).
proof: Proof. intros; unfold Query_For; autorewrite with monad laws. f_equiv; intro. intros ? ?; computes_to_inv; subst. computes_to_econstructor; rewrite Permutation_map; eauto. Qed.
imports: Coq.Arith.Arith Coq.ZArith.ZArith Coq.NArith.NArith Coq.ZArith.ZArith Coq.Strings.String Coq.Lists.List Coq.Sorting.Permutation Coq.Bool.Bool Coq.Sets.Ensembles Coq.Logic.FunctionalExtensionality Fiat.ADTNotation Fiat.Common Fiat.Common.ilist2 Fiat.Common.List.ListFacts Fiat.Common.Ensembles.IndexedEnsembles Fiat.Common.DecideableEnsembles Fiat.Computation Fiat.ADTRefinement.BuildADTRefinements Fiat.QueryStructure.Specification.Representation.QueryStructureSchema Fiat.QueryStructure.Specification.Operations.FlattenCompList Fiat.QueryStructure.Specification.Operations.Query Fiat.QueryStructure.Specification.Representation.QueryStructure Fiat.QueryStructure.Specification.Operations.Empty