proposition: Lemma refine_forall_to_exists {A} : forall (P Q : A -> Prop) (R : @IndexedEnsemble A) (P_dec : DecideableEnsemble P), refine {b | decides b (forall tup' : @IndexedElement A, R tup' -> Q (indexedElement tup') -> P (indexedElement tup'))} (b <- {b | decides b (exists tup' : @IndexedElement A, R tup' /\ Q (indexedElement tup') /\ ~ P (indexedElement tup'))}; ret (negb b)).
proof: Proof. unfold refine; intros; computes_to_inv; subst. destruct v0; simpl in *; computes_to_econstructor; simpl; unfold not; intros. - destruct_ex; intuition. - destruct (dec (indexedElement tup')) eqn: ?. rewrite dec_decides_P in Heqb; eauto. rewrite Decides_false in Heqb. exfalso; eauto. Qed.
imports: Coq.Vectors.Vector Coq.Strings.Ascii Coq.Bool.Bool Coq.Bool.Bvector Coq.Lists.List Fiat.Computation.ListComputations Fiat.QueryStructure.Automation.AutoDB Fiat.QueryStructure.Implementation.DataStructures.BagADT.BagADT Fiat.QueryStructure.Automation.IndexSelection Fiat.QueryStructure.Specification.SearchTerms.ListPrefix Fiat.QueryStructure.Automation.SearchTerms.FindPrefixSearchTerms Fiat.QueryStructure.Automation.QSImplementation Fiat.Narcissus.Formats.DomainNameOpt Fiat.Narcissus.Examples.DNS.SimpleDnsOpt Fiat.Narcissus.Examples.DNS.SimpleDNSPacket Fiat.Examples.DnsServer.DecomposeSumField Fiat.Computation.FoldComp Fiat.Examples.DnsServer.SimpleAuthoritativeDNSSchema