Resolve isinstance() defect

I discovered an error whereby calling isinstance(m, mult) on a mult
yields false, because the class mult is __main__.mult whereas the
instance m is an instance of lego.mult, imported from the lego module by
the fsm module when it was needed. Evidently Python doesn't have any way
of telling that these two classes are the same class in memory. Or maybe
they are stored separately in memory somehow, I don't know. Either way,
I'm replacing all the isinstance() calls with hasattr() calls, which is
still pretty unpleasant really but I don't see a neater approach. This
incidentally negates the need for charclass and pattern to both inherit
from a parent class "multiplicand". I added a unit test for this defect
as well.

Unrelatedly: moved some parsing code around; discovered that the
bound.common() method is redundant and removed it in favour of a min()
call; replaced conc.behead() with a one-liner; replaced
pattern._commonconc() with a one-liner.