def sort_infer(term): res = concretize_sorts(term) for x in chain(lu.used_variables(res),lu.used_constants(res)): if lg.contains_topsort(x.sort) or lg.is_polymorphic(x.sort): raise IvyError(None,"cannot infer sort of {} in {}".format(x,term)) # print "sort_infer: res = {!r}".format(res) return res
def sort_infer(term): res = concretize_sorts(term) for x in chain(lu.used_variables(res),lu.used_constants(res)): if lg.contains_topsort(x.sort) or lg.is_polymorphic(x.sort): raise IvyError(None,"cannot infer sort of {}".format(x)) # print "sort_infer: res = {!r}".format(res) return res
def check_concretely_sorted(term,no_error=False,unsorted_var_names=()): for x in chain(lu.used_variables(term),lu.used_constants(term)): if lg.contains_topsort(x.sort) or lg.is_polymorphic(x.sort): if x.name not in unsorted_var_names: if no_error: raise lg.SortError raise IvyError(None,"cannot infer sort of {} in {}".format(x,repr(term)))
def check_concretely_sorted(term, no_error=False, unsorted_var_names=()): for x in chain(lu.used_variables(term), lu.used_constants(term)): if lg.contains_topsort(x.sort) or lg.is_polymorphic(x.sort): if x.name not in unsorted_var_names: if no_error: raise lg.SortError raise IvyError( None, "cannot infer sort of {} in {}".format(x, repr(term)))
def is_concretely_sorted(term): return not lg.contains_topsort(term) and not lg.is_polymorphic(term)