working on imps canonical form function