Biased theories of galaxy formation with arbitrary threshold functions and background distribution