0

Suppose I want to make the statement:

For every index $i$ in the ordered Array $A$, $A[i]\leq A[i+1]$

Using first order logic I'd write it like:

$\forall i($inRange$(i) \implies A[i]\leq A[i+1]) $

Which intuitively should be true under the interpretation where the universe is $\mathbb{N}$, inRange($i$) is a predicate that states that $0\leq i < size(A)-1$ and $A[i]$ is a function that returns the element in the $i$-th position of A.

However, this would be true iff for every $i$ in $ \mathbb{N}$, the formula:

$ $inRange$(i) \implies A[i]\leq A[i+1] $

is true under the same interpretation. But if we have $j\in \mathbb{N}$, $j> size(A)$, then the formula

$ $inRange$(j) \implies A[j]\leq A[j+1] $

would have an 'indefinite' consequent, since $A[j]$ is not defined. Should I consider it true just because the antecedent is false, or there is some special consideration to be taken?

Alexander
  • 355

2 Answers2

0

There're at least 3 ways to deal with your partial function extension problem:

  1. formally using free logic (a variant of first order logic whose term can denote nothing).

  2. using a total function to represent your partial function.

  3. using a higher arity relation symbol to emulate your partial function.

I found this old post described all three approaches in detail already.

cinch
  • 1,648
  • 1
  • 4
  • 12
  • Thanks! So if I decide to stick to first order logic, I should define the function $A[i]$ as total somehow (for example assigning 0 to out of range indexes). I guess it won't affect the result since if its out of range the antecedent is true so the implication is also true. – Alexander Sep 01 '21 at 17:32
  • @Alexander Yes, if you read formal definitions of function symbol in any FOL textbook, it's defined as total (let me know if you found a counterexample) otherwise a wff containing the functional symbol won't have a definite truth value. If you choose approach #2/3 in my above answer to stick with FOL, then a false antecedent means the material implication is vacuously true which is also consistent with the non-vacuous case. unlike array out of bound error in programming, it cannot restrict your math total function or relation definition which is totally mental or in some real Platonic realm... – cinch Sep 01 '21 at 17:42
0

For every index $i$ in the ordered Array $A$, $A[i]\leq A[i+1]$

Hint: Somehow define a function $a:N\to A ~~~$ (not sure how you do this in FOL)

$\forall x: [x\in N \implies a(x)\leq a(x+1)]$