added (gt ...);
added (lt ...);
first stab at (eq ...);
(a glance at the book tells me it can be simplified a lot);
adopting the simpler (if less symmetric) approach used in the book;
using (lt ...) and (gt ...), as prompted for in the final formulation;