Wellfounded recursion with copatterns_ A unified approach to termination and productivity