Implement recursive rule solving