let rec subtype ty parentty =
  TypeComparable.equal ty parentty ||
    try
      subtype (TypeHashtbl.find type_to_parent_type ty) parentty
    with Not_found ->
      false