Well-Founded Recursion In Terms And Types