Solution (source code)

= Solution

Treat brothers as male individuals sharing at least one recorded parent, including half-brothers. Derive a sibling helper and then select the recorded sex:

``
siblings :: Database -> Person -> [Person]
siblings db p = unique [q | parent <- parents db p,
                           q <- children db parent, q /= p]

brothers :: Database -> Person -> [Person]
brothers db p = [q | q <- siblings db p, sex q == Male]
``

The exclusion `q /= p` prevents a male individual from being his own brother. <Duplicate removal> is needed because a full brother can be found through both parents. The membership condition is
$$
\boxed{q\ne p,\quad\operatorname{sex}(q)=\mathrm{Male},\quad
\operatorname{parents}(db,q)\cap\operatorname{parents}(db,p)\ne\varnothing.}
$$
If the intended convention is \i[full] brothers only, replace the shared-parent condition by a common mother and a common father in the recorded certificates. The definition above states the convention explicitly rather than silently discarding half-brothers.