#include "interp.h"

This page has information from files interp.h and interp.c.

Contents


Public Routines in File interp.c

Index

compile_interpfprint_interpfprint_interp_memp_interp_mem
eval_clausefprint_interp_from_termfprint_interp_tabulartranspose_binary
eval_formulafprint_interp_from_term2p_interpzap_interp

Details


Interp compile_interp(Term t);
This routine takes a term representing an interpretation and builds a data structure that allows fast evaluation of clauses and formulas w.r.t. the interpretation. Here is an example of the term form of an interpretation.
   interpretation(3, [
       function(e,      [0]),
       function(*(_,_), [0,1,2,1,2,0,2,0,1]),
       relation(p,      [1])
       relation(q(_),   [1,0,1])
       ])
Arity of symbols must be <= 4 (or a fatal error occurs). The given Term t is not changed.
BOOL eval_clause(Clause c, Interp p);
This routine evaluates a clause in an interpretation. If all instances (over the domain of the interpretation) of the clause are true in the interpretaion, TRUE is returned. If any instance is false, FALSE is returned.

Note that if the interpretation has d elements and the clause has v variables, it takes d^v evaluations to verify the clause.

A fatal error occurs if any constant, function or predicate symbol in the clause (other than "=", which is always built in) is absent from the interpetation.


BOOL eval_formula(Formula f, Interp p);
This routine evaluates a formula in an interpretation. There is no restriction on the structure of the formula. However, quantified variables must be named in such a way that when a quantifier binds a variable, say (all x F), then no quantifier in F can rebind x. The routine eliminate_rebinding() can be called to transform a formula, if necessary, so that it satisfies the rule.

A fatal error occurs if any constant, function or predicate symbol in the formula (other than "=", which is always built in) is absent from the interpetation.


void fprint_interp(FILE *fp, Interp p);
This routine prints (to FILE *fp) a compiled interpretation. This is mostly for debugging---the form is not pretty, and it is not easily parsable.
void fprint_interp_from_term(FILE *fp, Term t);
This routine pretty prints (to FILE *fp) the term form of an interpretation. The result is mixfix-parsable.

For now, this works only for unsorted interpretations.


void fprint_interp_from_term2(FILE *fp, Term t);
This routine pretty prints (to FILE *fp) the term form of an interpretation. The result is mixfix-parsable.

For now, this works only for unsorted interpretations.


void fprint_interp_mem(FILE *fp, BOOL heading);
This routine prints (to FILE *fp) memory usage statistics for data types associated with interpretations. The Boolean argument heading tells whether to print a heading on the table.
void fprint_interp_tabular(FILE *fp, Term t);
This routine pretty prints (to FILE *fp) an interpretation in tabular (non-mixfix-parsable) form.

For now, this works only for unsorted interpretations.


void p_interp(Interp p);
This routine prints (to stdout) an interpretation. This is mostly for debugging---the form is not pretty, and it is not easily parsable.
void p_interp_mem();
This routine prints (to stdout) memory usage statistics for data types associated with interpretations.
void transpose_binary(Term t);
This routine takes a term representing an interpretation and (destructively) transposes all of the binary functions and relations. It is assumed that the interpretation is well-formed. You can check well-formedness first by calling compile_interp().
void zap_interp(Interp p);
Free a compiled interpretation.

Public Definitions in File interp.h

typedef struct interp *Interp;


Introduction


These activities are projects of the Mathematics and Computer Science Division of Argonne National Laboratory.