I considered–
p = The person is a boy.
q = The person can swim.
...But confused with following statement–
If person can swim, he is boy. (p$\rightarrow$q)
I considered–
p = The person is a boy.
q = The person can swim.
...But confused with following statement–
If person can swim, he is boy. (p$\rightarrow$q)
On
Note that your translation of $p \rightarrow q$ as 'If a person can swiml, then the person is a boy' is inconsistent with your key. ... This is actually one good reason to use letters that are more descriptive of what statements they represent. So, I propose to use the following key:
$b$ the person is a boy
$s$ the person can swim
( I agree with Mauro from the comments that ideally you use predicates and quantifiers to deal with this statement, but you're probably still working with propositional logic at the moment, so I'll stick to that)
Now, how to translate 'only boys can swim'?
One way to think about this is that 'only boys can swim' means that any person that is not a boy cannot swim, which translates as:
$$\neg b \rightarrow \neg s$$
and by contraposition that is equivalent to:
$$s \rightarrow b$$
If you are thinking of using:
$$b \rightarrow s$$
please know that this effectively says that all boys can swim. But we don't know that! Consider a situation where some of the boys can swim, some of the boys cannot swim, and where any person that is not a buy cannot swim. In that situation, it is true that 'only boys can swim', but it is not true that all boys can swim. And so no, you really do not want to use $b \rightarrow s$.
I think you can define
$P$ = the set of all people can swim.
and
$Q$ = the set of all boy.
Then you can write $p \in Q\rightarrow p \in P$.