[Math] First-order logic with conditionals

first-order-logiclogiclogic-translationpredicate-logic

I am taking a course on Maths for Business and Computing and am kind of stuck with translating English sentences into predicates. I have researched a lot, but not really come across a similar example:

If the volume of the room is greater than 2000m^3 and the temperature of the room is greater than 20°C and less than or equal to 25°C then at least one window in the room should be opened (provided the room has windows).

My answer:
$P(v, r)$ = The volume $v$ of the room $c$ is greater than $2000m^3$
$Q(t)$ = The temperature t is greater than $20°C$ and less than or equal to $25°C$
$R(w)$ = window $w$ is open

$$\forall v \forall c \forall t ~((P(v,r) \wedge Q(t) \rightarrow \exists w : R(w))$$

If every volume v of every room r is greater than $2000m^3$ and every temperature $t$ is greater than $20°C$ and less than or equal to $25°C$, there is at least one window $w$ open.

If anybody could give me some tips or recommend a resource that I could use for my studies that would be great!

Thanks,
Stefan

Best Answer

OK, first and foremost: you have the basic logical structure $\forall ( bla bla \rightarrow \exists : bla bla)$ correct!

A couple of small things though:

You need to change the $r$ in $P(v,r)$ into a $c$, and you need a closing parenthesis after $Q(t)$.

You want to use a predicate $R(w,c)$ for 'window $w$ in room $c$ is open', and likewise have a predicate $Q(t,c)$ to say 'the temperature $t$ in room $c$. ... in both cases we don't know that we are talking about that specific room otherwise.

I would use some more transparent symbols for your predicates instead of $P$, $Q$, and $R$. Maybe $O$ or $Open$, and $G$ for 'greater than 2000 m^3', etc.

Then, you could try to use function symbols, so you can include those specific numbers as well. For example, if you have a $temp(x)$ predicate that returns the temperature in room $x$ in Celcius, and then you could use the expression $20<temp(x) \land temp(x)≤25$. Of course, this does mean you need to be allowed to use mathematical symbols in your logic expression, but you no longer need to treat the temperature as an object (and hence no longer need to quantify over it), which might be good. And by the way, if they give you $<$, but not $\leq$, you can express the smaller or equal to 25 as: $temp(x) < 25 \lor temp(x) = 25$

Likewise, you could use a function $vol(x)$ that returns the volume of $x$ in $m^3$, so you could write $vol(x) > 2000$ or (if again they only give you $<$ but not $>$) you could write $2000 < vol(x)$

Finally, you could use a predicate $In(x,y)$ that says '$x$ is in $y$' to be used for the window being 'in' the room, and use explicit predicates $R(x)$ for 'x is a room' and $W(x)$ for 'x is a window'.

So with all those symbols, you would get:

$\forall x ((R(x) \land 2000 < vol(x) \land 20 < temp(x) \land temp(x) \leq 25) \rightarrow \exists y (W(y) \land I(y,x) \land O(y)))$

Related Question