define ranges_distinct and wf_to_inner_mk_to_inner