implemented pred-and and pred-or functions