The most important data structure in programming is an array. It is
like a row of boxes numbered consecutively. The ordering numbers of the boxes are
called indices. Here is an array of characters with indices in the range [0, 5]:
We will, however, work on arrays of numbers. Here is an example:
It is often necessary to express complicated things about arrays. It is
possible with quantifiers:
symbol
read
write as
∀
for all
AA
∃
there exists
EE
Here are some examples on an array A whose indices are in the range [0, n − 1]:
Every element is 1: ∀ i; 0 ≤ i < n:
A[i] = 1
It is sorted in increasing order: ∀ i; 0 ≤ i <
n − 1: A[i] ≤ A[i + 1]
Some element occurs at least twice: ∃ i: ∃ j; 0 ≤
i < j < n: A[i] = A[ j]
The smallest element is unique: ∃ i; 0 ≤ i <
n: ∀ j; 0 ≤ j < n ∧ i ≠ j:
A[i] < A[ j]
Express the following claims on an array A whose
indices are in the range [0, n − 1].
The claims in the following section need at least two quantors.
Express the following claims as briefly as you can. It may
require a lot of thinking! You may proceed in steps.
Now remove <=> FF from the above and try
again, to see a message telling that your answer is mathematically correct but
not as brief as wanted.