rewrite typing relations as decision procedures