proposition: Lemma refine_constraint_check_into_query' : forall {schm tbl} (c : UnConstrQueryStructure schm) P' P (P_dec : DecideableEnsemble P), Same_set _ (fun tup => P (indexedElement tup)) P' -> refine (Pick (fun (b : bool) => decides b (exists tup2: @IndexedRawTuple _, (GetUnConstrRelation c tbl tup2 /\ P' tup2)))) (Bind (Count (For (UnConstrQuery_In c tbl (fun tup => Where (P tup) Return tup)))) (fun count => ret (negb (Nat.eqb count 0)))).
proof: Proof. intros; rewrite refine_constraint_check_into_QueryResultComp; eauto. reflexivity. Qed.
imports: Fiat.QueryStructure.Specification.Representation.QueryStructureNotations Fiat.QueryStructure.Specification.Operations.Query Coq.Lists.List Coq.Arith.Compare_dec Coq.Bool.Bool Coq.Strings.String Fiat.Common.BoolFacts Fiat.Common.List.PermutationFacts Fiat.Common.List.ListMorphisms Fiat.QueryStructure.Specification.Operations.FlattenCompList Fiat.Common.Ensembles.EnsembleListEquivalence Fiat.QueryStructure.Implementation.Operations.General.QueryRefinements Fiat.Common.IterateBoundedIndex Fiat.Common.List.ListFacts Fiat.Common.LogicFacts Fiat.Common.DecideableEnsembles Fiat.Computation.Refinements.Iterate_Decide_Comp Fiat.Computation.Refinements.General Fiat.QueryStructure.Specification.Constraints.tupleAgree Fiat.QueryStructure.Specification.Operations.Mutate