proposition: Lemma refine_Join_Join_Filtered_Comp_Lists_filter_hd : forall n heading1 heading2 headings (f : ilist2 (n := n) (B := @RawTuple) headings -> bool) (l2 : ilist2 (B := @RawTuple) headings -> Comp (list RawTuple)) (l2' : ilist2 (B := @RawTuple) (heading1 :: headings) -> Comp (list RawTuple)) (cond1 : ilist2 (B := @RawTuple) (heading1 :: headings) -> bool) (cond2 : ilist2 (B := @RawTuple) (heading2 :: heading1 :: headings) -> bool), (forall a : ilist2 (B := @RawTuple) headings, exists v : list RawTuple, refine (l2 a) (ret v)) -> forall l1 : list (ilist2 (B := @RawTuple) headings), refine (l <- Join_Filtered_Comp_Lists l1 l2 cond1; Join_Filtered_Comp_Lists (filter (fun a : ilist2 (B := @RawTuple) (_ :: _) => f (ilist2_tl a)) l) l2' cond2) (l <- Join_Filtered_Comp_Lists (filter f l1) l2 cond1; Join_Filtered_Comp_Lists l l2' cond2).
proof: Proof. intros; pose proof (@refine_Join_Join_Filtered_Comp_Lists_filter_hd_andb _ _ _ _ f (fun _ => true) l2 l2' cond1 cond2 H l1) as r. setoid_rewrite filter_true in r. intros v Comp_v. apply r in Comp_v. computes_to_inv; subst. rewrite filter_and, filter_true in Comp_v'. 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