I need help with how to translate a sentence into predicate logic. It would also be nice if you could have a look at another one that I have solved, if it is correctly solved
- Given predicates:
- Empty(x) : the list x is empty
- Sorted(x) : the list x is sorted in ascending (not decreasing) order
- x < y : number x is smaller than number y
- At(x, i, y) : the list x contains the number y on position i
The start position begins always at zero in a list.
The sentence: If a list is empty, then there are no numbers on any position in the list.
What I have tried: ∃x(Empty(x)->∀y(At(x, i, y) ?????))
Another sentence that I think I have solved correctly:
Sentence: All the numbers in the list L is greater than 100
My answer: ∀x(At(L, i, x)->100 < x)
You just said, "There exists one list such if it is empty it follows that all numbers exist at position i." !?
(You also did not quantify the position. Is it universal or existential?)
What you want is more: $$\forall x:\Bigl(\mathsf{Empty}(x) \to \neg\bigl(\exists y\,\exists i :\mathsf{At}(x, i, y)\bigr)\Bigr)$$
That could almost work but, again, you haven't quantified the list index (i).
Also, purely as a matter of style, I suggest you don't mix the types of your entities. If you discuss $x$ as list and $y$ as a number in one part of the discussion, don't switch to using $x$ for numbers. It's not technically wrong, per se, but it is mildly confusing. Avoid that by using the same symbol to refer to entities of same type of things (as much as possible).
$$\forall y:\Bigl(\bigl(\exists i:\mathsf{At}(L,i,y)\bigr)\to 100<y\Bigr)$$