def create_strat_map(assumes, asserts, macros): """ Given a list of assumptions, assertions and macros, compute the stratification graph. The difference between assumes and asserts is that the free variables in assumes are treated as universally quantified, while the asserts are treated as negated. Each argument is a list of pairs `(fmla,ast)` where `fmla` is the formula and `ast` an ast giving the origin of the formula. """ global universally_quantified_variables global strat_map global arcs # Gather all the formulas in the VC. all_fmlas = [(il.close_formula(x), y) for x, y in assumes] all_fmlas.extend((il.Not(x), y) for x, y in asserts) all_fmlas.extend(macros) # Get the universally quantified variables. The free variables of # asserts and macros won't count as universal. We keep track of the # line numbers of these variables for error messages. universally_quantified_variables = dict() for fmla, lf in all_fmlas: for v in il.universal_variables([fmla]): if (il.is_uninterpreted_sort(v.sort) or il.has_infinite_interpretation(v.sort)): universally_quantified_variables[v] = lf # print 'universally_quantified_variables : {}'.format([str(v) for v in universally_quantified_variables]) # Create an empty graph. strat_map = defaultdict(UFNode) arcs = [] # Handle macros, as described above. create_macro_maps(assumes, asserts, macros) # Simulate the Skolem functions that would be generated by AE alternations. for fmla, ast in all_fmlas: make_skolems(fmla, ast, True, []) # Construct the stratification graph by calling `map_fmla` on all # of the formulas in the VC. We don't include the macro definitions # here, because these are 'inlined' by `map_fmla`. for pair in assumes + asserts: map_fmla(pair[1].lineno, pair[0], 0)
def create_strat_map(assumes,asserts,macros): global symbols_over_universals global universally_quantified_variables all_fmlas = [il.close_formula(pair[0]) for pair in assumes] all_fmlas.extend(il.Not(pair[0]) for pair in asserts) all_fmlas.extend(pair[0] for pair in macros) # for f in all_fmlas: # print f symbols_over_universals = il.symbols_over_universals(all_fmlas) universally_quantified_variables = il.universal_variables(all_fmlas) strat_map = defaultdict(UFNode) for pair in assumes+asserts+macros: map_fmla(pair[0],strat_map) # show_strat_map(strat_map) # print 'universally_quantified_variables:{}'.format(universally_quantified_variables) return strat_map
def create_strat_map(assumes,asserts,macros): global symbols_over_universals global universally_quantified_variables all_fmlas = [il.close_formula(pair[0]) for pair in assumes] all_fmlas.extend(il.Not(pair[0]) for pair in asserts) all_fmlas.extend(pair[0] for pair in macros) # for f in all_fmlas: # print f symbols_over_universals = il.symbols_over_universals(all_fmlas) universally_quantified_variables = il.universal_variables(all_fmlas) strat_map = defaultdict(UFNode) for pair in assumes+asserts+macros: map_fmla(pair[0],strat_map) # show_strat_map(strat_map) # print 'universally_quantified_variables:{}'.format(universally_quantified_variables) return strat_map