optimize first order logic with equality.
optimize for speed.