BOOL any_clause(Clause c);This function is always TRUE. (It it intended to be used as an argument.)
void append_literal(Clause c, Literal lit);This routine appends a literal to a clause.
int atom_number(Clause c, Term atom);Given a clause and an atom, return the position of the atom (counting from 1) in the clause. The check is by pointer only. If the atom does not occur in the clause, 0 is returned.
int clause_depth(Clause c);Disjunction and negation signs are not included in the count.
BOOL clause_ident(Clause c1, Clause c2);Identical clauses, including order of literals and variable numbering.
int clause_length(Clause c);This routine returns the length of a clause, which is the sum of the lengths of its atoms.
void clause_set_variables(Clause c, int max_vars);This routine traverses a clause and changes the constants that should be variables, into variables. On input, the clause should have no variables. The new variables are numbered 0, 1, 2 ... according the the first occurrence, reading from the left.
A fatal error occurs if there are more than max_vars variables.
The intended is use is for input clauses that are built without regard to variable/constant distinction.
int clause_symbol_count(Clause c);Disjunction and negation signs are not included in the count.
Term clause_to_term(Clause c);This routine takes a Clause and returns an entirely new Term which represents the clause. The disjunction symbol for the term is binary OR_SYM, and the negation symbols is NOT_SYM. The attributes are included, but not the id or justifiction.
Term clause_to_term_without_attributes(Clause c);This routine takes a Clause and returns an entirely new Term which represents the clause. The disjunction symbol for the term is binary OR_SYM, and the negation symbols is NOT_SYM. The attributes, id, and justifiction are NOT included.
Term clause_to_term_x(Clause c);This routine takes a Clause and returns its Term form. The disjunction symbol for the term is binary OR_SYM, and the negation symbols is NOT_SYM.
This version destroys the clause.
Plist constants_in_clause(Clause c);Given a clause, return the set of constants therein.
Clause copy_clause(Clause c);This routine builds and returns a copy of a clause. The container field of each nonvariable subterm points to the clause.
Clause copy_clause_with_flag(Clause c, int flag);This routine builds and returns a copy of a clause. The given termflag is copied for all subterms (including atoms, excluding variables).
Clause copy_clause_with_flags(Clause c);This routine builds and returns a copy of a clause. All termflags are copied for all subterms (including atoms, excluding variables).
BOOL definite_clause(Clause c);This Boolean function checks if a clause has exactly one positive literal.
BOOL false_term(Term t);
Literal first_literal_of_sign(Clause c, BOOL sign);
void fprint_clause(FILE *fp, Clause c);This routine prints a clause to a file.
void fprint_clause_mem(FILE *fp, int heading);This routine prints (to FILE *fp) memory usage statistics for data types associated with the clause package. The Boolean argument heading tells whether to print a heading on the table.
void free_literal(Literal p);
void free_lits_to_term(Term t);This routine is to be used with terms constructed by lits_to_term().
Ilist fsym_set_in_clauses(Plist lst);
Mlist function_symbols_in_clause(Clause c, Mlist g);Collect the multiset of function symbols in a clause.
Mlist function_symbols_in_clauses(Plist lst);Collect the multiset of function symbols (including constants) in clauses in a Plist. An Mlist of SYMNUMs is returned.
Clause get_clause(void);
Literal get_literal(void);
int greatest_variable_in_clause(Clause c);This routine returns the greatest variable index in a clause. If the clause is ground, -1 is returned.
BOOL ground_clause(Clause c);
BOOL horn_clause(Clause c);This function checks if a clause has at most one positive literal.
BOOL horn_clauses(Plist l);Is every clause in the Plist a Horn clause?
void inherit_attributes(Clause parent1, Context subst1, Clause parent2, Context subst2, Clause child);This takes two parent clauses and their associated substitutions, and a child clause. All inheritable attributes on the parents are instantiated and appended to the child's attributes.
Literal ith_literal(Clause c, int i);Return the i-th literal of a clause, counting from 1. Return NULL if i is out of range.
int literal_number(Clause c, Literal l);Given a clause and a literal, return the position of the literal (counting from 1) in the clause. The check is by pointer only. If the literal does not occur in the clause, 0 is returned.
Term lits_to_term(Literal l);This routine converts a nonempty list of literals into a term. This version does not copy atoms; it constructs new term nodes only for the NOT and OR structure at the top of the clause. Use free_lits_to_term() to free terms cosntructed with this routine.
BOOL min_depth(Literal lit);Does the Literal have minimum depth of all literals the containing clause?
BOOL mixed_clause(Clause c);This function checks if a clause has at least one positive and at least one negative literal.
BOOL negative_clause(Clause c);This function checks if all of the literals of a clause are negative.
int negative_literals(Clause c);This function returns the number of negative literals in a clause.
Literal new_literal(int sign, Term atom);This routine takes a sign (Boolean) and a Term atom, and returns a literal. The atom is not copied.
int number_of_literals(Clause c);This function returns the number of literals in a clause.
int number_of_neg_literals(Clause c);This function returns the number of literals in a clause.
int number_of_pos_literals(Clause c);This function returns the number of literals in a clause.
void p_clause(Clause c);This routine prints a clause to stdout.
void p_clause_mem();This routine prints (to stdout) memory usage statistics for data types associated with the clause package.
BOOL positive_clause(Clause c);This function checks if all of the literals of a clause are positive.
int positive_literals(Clause c);This function returns the number of positive literals in a clause.
Mlist relation_symbols_in_clause(Clause c, Mlist g);Collect the multiset of relation symbols in a clause.
Mlist relation_symbols_in_clauses(Plist lst);Collect the multiset of relation symbols (including propositional constants) in clauses in a Plist. An Mlist of SYMNUMs is returned.
Literal remove_null_literals(Literal l);
void renumber_variables(Clause c, int max_vars);This routine renumbers the variables of a clause. The variables are renumbered 0, 1, 2 ... according the the first occurrence, reading from the left.
If there are more than max_vars distinct variables, a fatal error occurs.
The intended is use is for inferred clauses that may contain variable indexes greater than max_vars.
Ilist rsym_set_in_clauses(Plist lst);
int symbol_occurrences_in_clause(Clause c, int symnum);
BOOL tautology(Clause c);This routine returns TRUE if the clause has complementary literals or if it has any literals of the form $T, -$F.
void term_renumber_variables(Term t, int max_vars);This routine renumbers the variables of a term. The variables are renumbered 0, 1, 2 ... according the the first occurrence, reading from the left.
If there are more than max_vars distinct variables, a fatal error occurs.
Do not use this to renumber variables of a clause (see renumber_variables).
Clause term_to_clause(Term t);This routine takes a Term t (presumably a disjunction with binary symbol OR_SYM), and constructs a Clause. The Clause is entirely new.
The main use of this routine is intended to be as follows: a Term representing a clause is parsed (using mixfix notation) from the input, then here it is copied translated into a Clause data structure.
Literal term_to_literals(Term t, Literal lits);
BOOL true_term(Term t);
BOOL unit_clause(Clause c);This function checks if a clause has exactly one literal.
BOOL unit_clauses(Plist l);Is every clause in the Plist a unit clause?
void upward_clause_links(Clause c);In the given Clause c, make the "container" field of each subterm point to c.
void zap_clause(Clause c);This routine frees a clause (but not any justification list or attributes). The caller should make sure that nothing (e.g., indexes) refer to the clause or any of its subterms.
If the clause has a justification or an ID, use the higher-level routine delete_clause(c) instead.
void zap_literal(Literal l);This routine frees a list of literal.
void zap_literals(Literal l);This routine frees a list of literals.
typedef struct literal * Literal; struct literal { int sign; Term atom; Literal next; }; typedef struct clause * Clause; struct clause { int id; int weight; Literal literals; Attribute attributes; struct just *justification; struct clist_pos *containers; char *compressed; char initial; char normal_vars; char used; };
These activities are projects of the Mathematics and Computer Science Division of Argonne National Laboratory.