3

Let $S = \langle 1,3,5,7,9 \rangle$ be a sequence of a numbers. Then let $Q = \{ 1,2,4 \}$ and $R = {1,2,3}$ be two sets of numbers. Then I have a function $exists(Q,S)$ that should return true if there is at least two elements $q \in Q$ such that $q \in S$ (in this case $exists(Q,S) = false$ and $exists(R,S) = true$).

For the at least one statement we can use the notation $if \exists q \ in Q | q \in S$, but what if I need to check if exists at least two elements to validate the statement?

Thank you very much!

af194
  • 31

1 Answers1

3

I would write just $|Q\cap S|\ge 2$, or $\#(Q\cap S)\ge 2$ if the $|\cdot|$ has a meaning other than number of elements that might apply to $Q\cap S$ in your context.

It will get more involved if you need to stick strictly to the language of first-order logic and not use any set theory or numbers (in which case $Q$ and $S$ would be predicates), but it doesn't look like you're working under such a restriction.

  • That was not exactly what I was looking for, but it is certaily a very good solution, thank you! – af194 Jun 08 '16 at 16:19
  • 1
    Just to fill in the first-order logic formulation: $(\exists x)(\exists y),(Q(x)\land S(x)\land Q(y)\land S(y)\land\neg(x=y))$. – Andreas Blass Jun 08 '16 at 16:58