1
/* Copyright (C) 2006, 2007 William McCune
3
This file is part of the LADR Deduction Library.
5
The LADR Deduction Library is free software; you can redistribute it
6
and/or modify it under the terms of the GNU General Public License,
9
The LADR Deduction Library is distributed in the hope that it will be
10
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with the LADR Deduction Library; if not, write to the Free Software
16
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
26
The Term macros VARIABLE(f), CONSTANT(f), COMPLEX(f), SYMNUM(f),
27
VARNUM(f), ARITY(f) are used for Flatterms as well. The Term macro
28
ARG(t,i) is NOT used for Flatterms.
30
Traversing Flatterms. It can be done recursively or iteratively.
31
When building flatterms, recursive is better, because you have to
32
make a Flatterm point to its end.
37
for (f = fi; fi != f->end->next; fi = fi->next)
43
Flatterm fi = f->next;
44
for (i = 0; i < ARITY(f); i++) {
51
/* Public definitions */
53
typedef struct flatterm * Flatterm;
56
short private_symbol; /* const/func/pred/var symbol ID */
57
unsigned char arity; /* number of auguments */
58
Flatterm prev, next, end;
60
/* The rest of the fields are for index retrieval and demodulation. */
62
int size; /* symbol count */
63
struct discrim *alternative; /* subtree to try next */
64
int varnum_bound_to; /* -1 for not bound */
65
BOOL reduced_flag; /* fully demodulated */
68
/* End of public definitions */
70
/* Public function prototypes from flatterm.c */
72
Flatterm get_flatterm(void);
74
void fprint_flatterm_mem(FILE *fp, BOOL heading);
76
void p_flatterm_mem();
78
BOOL flatterm_ident(Flatterm a, Flatterm b);
80
void zap_flatterm(Flatterm f);
82
Flatterm term_to_flatterm(Term t);
84
Term flatterm_to_term(Flatterm f);
86
Flatterm copy_flatterm(Flatterm f);
88
void print_flatterm(Flatterm f);
90
int flatterm_symbol_count(Flatterm f);
92
void p_flatterm(Flatterm f);
94
BOOL flat_occurs_in(Flatterm t1, Flatterm t2);
96
I2list flat_multiset_vars(Flatterm f);
98
BOOL flat_variables_multisubset(Flatterm a, Flatterm b);
100
int flatterm_count_without_vars(Flatterm f);
102
#endif /* conditional compilation of whole file */