def model_facts(h, ignore, clauses1, upclose=False): # define the universe for each sort: uc = [ fact for s in h.sorts() for fact in model_universe_facts(h, s, upclose) ] # values of constants in formula temp = [[(ivy_logic.Constant(c), get_model_constant(h.model, ivy_logic.Constant(c)))] for c in used_constants_clauses(clauses1) if not ignore(c) and c not in ivy_logic.sig.constructors] # print "temp = {}".format(temp) vc = [[ ivy_logic._eq_lit(ivy_logic.Constant(c), get_model_constant(h.model, ivy_logic.Constant(c))) ] for c in used_constants_clauses(clauses1) if not ignore(c) and c not in ivy_logic.sig.constructors] # print "model_facts vc = {}".format(vc) # values of relations in formula # print "used_relations_clauses = {}".format(used_relations_clauses(clauses1)) vr = [[l] for (r, n) in used_relations_clauses(clauses1).iteritems() if not ignore(r) for l in relation_model_to_clauses(h, r, n)] # values of functions in formula fns = set(f for (f, arity) in functions_clauses(clauses1) if not ignore(f) and arity >= 1) vf = [[l] for f in fns for l in function_model_to_clauses(h, f)] res = uc + vc + vr + vf return Clauses(res)
def model_facts(h, ignore, clauses1, upclose=False): # define the universe for each sort: uc = [fact for s in h.sorts() for fact in model_universe_facts(h, s, upclose)] # values of constants in formula temp = [ [(ivy_logic.Constant(c), get_model_constant(h.model, ivy_logic.Constant(c)))] for c in used_constants_clauses(clauses1) if not ignore(c) and c not in ivy_logic.sig.constructors ] # print "temp = {}".format(temp) vc = [ [ivy_logic._eq_lit(ivy_logic.Constant(c), get_model_constant(h.model, ivy_logic.Constant(c)))] for c in used_constants_clauses(clauses1) if not ignore(c) and c not in ivy_logic.sig.constructors ] # print "model_facts vc = {}".format(vc) # values of relations in formula # print "used_relations_clauses = {}".format(used_relations_clauses(clauses1)) urc = dict((ivy_logic.normalize_symbol(r), n) for r, n in used_relations_clauses(clauses1).iteritems()) vr = [[l] for (r, n) in urc.iteritems() if not ignore(r) for l in relation_model_to_clauses(h, r, n)] # values of functions in formula fns = set(f for (f, arity) in functions_clauses(clauses1) if not ignore(f) and arity >= 1) vf = [[l] for f in fns for l in function_model_to_clauses(h, f)] res = uc + vc + vr + vf return Clauses(res)