1. ## Developing predicates...

Hey everyone, I am trying to develop a predicate for the following sentence...

In the array segment g[m...n) there are at least three occurrences of values greater than x.

So far, I have:

Code:
A k|m<=k<n:
Where "A" should be the "For all" quantifier. Now, I guess my question is, how do I express "at least three occurrences of values"?

I need to somehow show that there are at least three values contained in the array which are larger than x (whatever it may be). So, if I can show three values in the array, then we know there are exactly three values which can be greater than x. But there could be five values, or twelve values. So would the three translate to >=3 to express the "at least"?

Thanks!

2. Hi

I give you an answer for a similar but more general problem so you can adapt it to yours:
Let $\displaystyle A$ be a subset of $\displaystyle \mathbb{Z},\ x$ an integer and $\displaystyle n$ a positive integer. How could we write a formula meaning: "there are at least $\displaystyle n$ integers in $\displaystyle A$ which are greater than $\displaystyle x$"?

First we can think it in a more formal way: "there exist $\displaystyle n$ integers in $\displaystyle A,\ x_1,...,x_n$ which are all different and such that $\displaystyle x_i>x,\ i=1,...,n$"

I guess that shows us a way to write our formula:
$\displaystyle \exists x_1...\exists x_n(\bigwedge\limits_{i<j}\neg x_i=x_j)\wedge(\bigwedge\limits_{i=1}^{n}(x_i\in A\wedge x_i>x))$