Started implementation of more efficient AND

Started the implementation of homomorphic AND. Also refactored some
routines into FunctionUtils and implemented homomorphic binary
functions, which required a different treatment to handle the asymmetry
in inputs and outputs.