# Predicate Logic Translating “All But One”

I need to translate an English sentence including the phrase "all but one" into predicate logic. The sentence is: "All students but one have an internet connection." I'm not sure how to show "all but one" in logic.

I could say $\forall x ((x \neq a) \rightarrow I(x))$

$I(x)$ being "$x$ has an internet connection"

But that clearly wouldn't work in this case, as we don't know which student it is.

I could say that $\exists x(\neg I(x))$

But it doesn't seem like that has the same meaning. Thanks in advance for any help you can give!

• Your suggestion doesn't seem right because presumably the universe is the set of all people or something like that. So you need a predicate to mean '$x$ is a student' and one to mean '$x$ has an internet connection'. As a hint rephrase it as $\text {there exists a student that doesn't have an internet connection such that all other students do.}$ – Git Gud Sep 18 '13 at 16:10
• sorry, in this case, the universe is the set of all people in a class. So I should have said "All students in the class but one have an internet connection." So in this case, if all students had a connection it would be ∀xI(x). – user95552 Sep 18 '13 at 16:16
• possible duplicate of Write ‘There is exactly 1 person…’ without the uniqueness quantifier – MJD Sep 18 '13 at 16:17
• @user95552 First note that my hint is wrong because it doesn't deal with uniqueness. Regarding what you said, I'd say it's wrong because there are people in the class which aren't students, but that's probably up to interpretation. Edit: my hint deals with uniqueness after all, so the hint is correct. Sorry. – Git Gud Sep 18 '13 at 16:19
• Alright, well I can easily change it to work with a different universe, but from your hint, could I say that ∃x(¬I(x) ∧ ∀y((x≠y) → I(y))) meaning there is a student without an internet connection and all students who aren't that student do have a connection. – user95552 Sep 18 '13 at 16:25

If you mean that there is exactly one element with a given property, you can define a "unique existence" quantifier, $\exists!$, as follows: $$\exists!x : \varphi(x) \iff \exists{x}{:}\left[\varphi(x)\wedge \forall{y}:\left(\varphi(y){\iff} y=x\right)\right].$$ That is, a particular element $x$ has the property $\varphi$, and any element with the property $\varphi$ must be that same $x$. For your problem, you want to say that there's exactly one person that is a student and doesn't have internet access.

"All students but one have an internet connection" means there is a student who lacks a connection, while every other student (every student not identical to the unlucky guy!) has one. So (if the domain is e.g. people)

$$\exists x(\{Sx \land \neg Ix\} \land \forall y(\{Sy \land \neg y = x\} \to Iy))$$

• Could have saved my fingers if I'd read all the comments first -- but I'll leave this in place. – Peter Smith Sep 18 '13 at 16:49

"For all but one $\;x\;$, $\;P(x)\;$ holds" is the same as "there exists a unique $\;x\;$ such that $\;\lnot P(x)\;$ holds.

Normally the notation $\;\exists!\;$ is used for "there exists a unique" (just like $\;\exists\;$ is used for "there exists some").

If your answer is allowed to use $\;\exists!\;$, then the above gives you the answer.

If not, then there are different ways to write $\;\exists!\;$ in terms of $\;\exists\;$ and $\;\forall\;$. The one I like best, which also results in the shortest formula, can be found in another answer of mine.