I'm doing discrete math problems in relation to the predicate logic and I'm having problems when figuring out what the antecedent and subsequent implication is.
For example for: Good nurses only patiently attend to the physical sick.
$a (X, Y)$: $X$ patiently attends to $Y$
$b (X)$: $X$ is a good nurse
$ef (Y)$: $Y$ is physically sick
I get $(\forall X) (\forall Y) (a (X, Y) \land ef (Y) \to b (X))$
but the result that is correct is this $(\forall X) (\forall Y) (a (X, Y) \land b (X) \to ef (Y))$
I also have some other exercise that happens to me the same, where to place $p \to q$ or if it is $q \to p$. Is there a trick or question to identify?
Two things:
First, there is a fundamental difference between 'All $P$ are $Q$' and 'Only $P$ are $Q$'
The former translates to:
$$\forall x (P(x) \rightarrow Q(x))$$
but the latter to:
$$\forall x (Q(x) \rightarrow P(x))$$
The body in the latter is the converse of the body of the former.
One way to understand the latter symbolization is to understand that we can think of 'Only $P$ are $Q$' as 'Anything that is not a $P$ is not a $Q$', which translates as:
$$\forall x (\neg P(x) \rightarrow \neg Q(x))$$
and this is by Contraposition equivalent to the latter.
Example:
We know it is true that:
'All bachelors are men': $\forall x (B(x) \rightarrow M(x))$
but this is also saying that 'Only men are bachelors', i.e. anyone who is not a man cannot be a bachelor.
Second, make sure to separate between 'subject term' and 'predicate term': Subject term: who or what is the claim about? Predicate term: what is it that I claim about the subject term?
In this case, your subject term is all good nurses. So, your sentence will look like:
$\forall x (b(x) \rightarrow \phi(x))$
where $\phi(x)$ is your predicate term.
OK, and what is your predicate term? It is that '$x$ only patiently attend to then physical sick' which, using the earlier analysis, can be understood as: 'anyone who is not physically sick, will not be patiently attended by $x$', i.e.:
$$\forall x (b(x) \rightarrow \forall y (\neg ef(y) \rightarrow \neg a(x,y)))$$
Applying Contraposition:
$$\forall x (b(x) \rightarrow \forall y (a(x,y) \rightarrow ef(y)))$$
Note how with the converse of the predicate term you would get 'All good nurses patiently attend to all that are physically sick'
OK, but now you can pull out the quantifier:
$$\forall x \forall y (b(x) \rightarrow (a(x,y) \rightarrow ef(y)))$$
And by Exportation, that is equivalent to:
$$\forall x \forall y ((b(x) \land a(x,y)) \rightarrow ef(y))$$
and by a simply Commutation to:
$$\forall x \forall y ((a(x,y) \land b(x)) \rightarrow ef(y))$$