Help translating some sentences into predicate logic

3k Views Asked by At

Consider a language of predicate logic with a constant sybol $1$, with unary predicate symbols $prime$, $odd$ and $even$, and with a binary predicate symbol $|$.

The intended domain of discourse is the set of non-negative integers, and the intended interpretation of the predicate and constant symbols is what their names suggest. e.g. $prime(x)$ means that $x$ is a prime number, and the binary predicate symbols $|$ represents the "divides" relation, written in infix notation, so $x|y$ means that $y$ can be divided by $x$ without reminder.

Am I correct in my translations of the following sentences into predicate logic with equality, using only the above predicate and constant symbols?

a) One is an odd number.

My attempt: $odd(1)$

b) All prime numbers are odd or even.

My attempt: $\forall x (prime(x) → (odd(x) ∨ even(x)))$

c) No prime number is both odd and even.

My attempt: $ \neg\exists x (prime(x) ∧ (odd(x) ∧ even(x))$

d) Some even numbers can be divided by an odd number without remainder.

My attempt: $ \exists x \exists y (even(x)|odd(y))$

e) Prime numbers can only be divided by one and by themselves without remainder

My attempt: $ \forall x (prime(x) → prime(x)|1 ∨ prime(x)|prime(x)))$


Second attempt at d) $ \exists x \exists y (even(x) ∧ odd(y) ∧ y|x)$

Second attempt at e) $\neg \exists x \exists y (prime(x) ∧ y|x) $ where $y \ne 1$ or $y \ne x$


Fourth attempt at e)

$\neg \exists x \exists y (prime(x) ∧ y|x ∧ y \ne 1 ∧ y \ne x)$

3

There are 3 best solutions below

10
On BEST ANSWER

a,b,c are correct. Issues with d. First, odd and even are switched ($x|y$ means $x$ divides evenly into $y$, not the other way around). Second, more importantly, it should be $\exists x\exists y(even(x)\wedge odd(y) \wedge y|x)$ ($odd(x)|even(y)$ has no meaning).

Same two issues with e. You can't use $1|prime(x)$ to mean "x is prime and 1 divides x". For that you need to say $prime(x)\wedge 1|x.$

There is a more important issue with $e.$ What you're going for says that any prime number is divisible by one and itself. That's true of any number and not what you're asked to say. You need to say that it's divisible only by one and itself.

7
On

Okay until (d).   That is not how the divides symbol operates.

d) Some even numbers can be divided by an odd number without remainder.

My attempt: $\exists x \exists y (even(x)|odd(y))$

odd() and even() are predicates, functions returning a true-or-false value.   They cannot be arguments for the divides binary operator.  

Also $a\vert b$ reads, "$a$ divides $b$".   That is, $b$ is divisible by $a$ without remainder; ie $b/a$ is an integer.

So... You wish to say there are some $x,y$ where $x$ is even, $y$ is odd, and $y$ (the odd number) divides $x$ (the even number).

$$\exists x~\exists y~\big(\operatorname{even}(x)\wedge \operatorname{odd}(y)\wedge y\vert x\big)$$

Now try $(e)$ again.


e) Prime numbers can only be divided by one and by themselves without remainder

Second attempt at e) $ \forall x (prime(x) → prime(x) ∧ 1|x ∨ x|x)$

No. You wish to say that: if any number, $x$, is prime then iff and only if any number, $y$, is $x$ or $1$, then $y$ divide $x$.

$${\forall x~\forall y~\Big(\operatorname {prime}(x)\to\big((y=1\vee y=x)\gets\hspace{-2ex}\to y\vert x\big)\Big)}$$


Third attempt at e) $\neg \exists x \exists y (prime(x) ∧ y|x) $ where $y \ne 1$ or $y \ne x$

"where" and "or" are not part of the language.   You do appear to be trying to say, "there does not exist an $x$ and an $y$ such that $x$ is primes, $y$ divides $x$, and $y$ is neither $1$ nor $x$". (aka "$y$ is not $1$ and $y$ is not $x$).

That is almost okay, but express this in symbols of the language. You also need to assert that a prime can be divided by $1$ and by itself.

0
On

For the statement $(e)$ Graham Kemp has noticed in the comments that you have to explicitly assert that prime $x$ can be divided by $1$ and by itself. In a solution using implication and universal quantifier $$\forall x(prime(x)\to \neg\exists y(y|x\land y\ne 1\land y\ne x))$$ we have to add $(1|x\land x|x)$ to the consequent. So we end up with $$\forall x(prime(x)\to 1|x\land x|x\land \neg\exists y(y|x\land y\ne 1\land y\ne x))$$ But its a property of the binary operation $|$ on the set of positive integers that we can express using language of logic $\forall x(1|x\land x|x)$. I'm curious of how important to explicitly state this property in the translation.