replace check_ domain and codomain by assert_*_valid pure function