def skolemize(clause: Clause) -> Clause: # Find all variables in clause vars = clause.get_variables() # Map from X,Y,Z,... -> sk0,sk1,sk2,... subst = { vars[i]: Constant(f"sk{i}", c_type("thing")) for i in range(len(vars)) } # Apply this substitution to create new clause without quantifiers return clause.substitute(subst), subst
def _instantiate_var_clause(clause: Clause, constant: Constant): """ Returns all clauses generated by substituting a `Variable` in `clause` with `constant`. """ if isinstance(clause, Body): suitable_vars = clause.get_variables() else: suitable_vars = clause.get_body_variables() candidates = [] for var in suitable_vars: candidates.append(clause.substitute({var:constant})) # if len(candidates) > 0: # print("Type of each is {}", type(candidates[0])) return list(set(candidates))