Added check to ensure that synth fun type matches terms generated by grammar