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.
27
This package implements FPA/Path indexing for first-order terms.
28
It is used to retrieive terms that are likely to unify (in various
29
ways) with a query term. The answers are not guaranteed to unify,
30
and the caller must call some kind of unification routine to
31
check and to construct a substitution.
33
The unification types are
34
FPA_UNIFY, FPA_INSTANCE, FPA_GENERALIZATION, FPA_VARIANT, and FPA_IDENTICAL.
35
Performance is very good for
36
FPA_INSTANCE, FPA_VARIANT, and FPA_IDENTICAL,
37
fair for FPA_UNIFY, and
38
poor for FPA_GENERALIZATION.
39
(Use Discrimination indexing for FPA_GENERALIZATION, e.g.,
40
forward demodulation and forward subsumption.)
42
Associative-commutative (AC) function symbols are handled
43
by simply ignoring all subterms of AC symbols (which can give
45
Commutative/symmetric (C) operations are handled.
48
/* Public definitions */
50
/* #define FPA_DEBUG */
52
typedef struct fpa_index * Fpa_index;
53
typedef struct fpa_state * Fpa_state;
55
/* End of public definitions */
57
/* Public function prototypes from fpa.c */
59
void fprint_fpa_mem(FILE *fp, BOOL heading);
63
void fprint_path(FILE *fp, Ilist p);
67
void fprint_fpa_index(FILE *fp, Fpa_index idx);
69
void p_fpa_index(Fpa_index idx);
71
Fpa_index fpa_init_index(int depth);
73
void fpa_update(Term t, Fpa_index idx, Indexop op);
75
void fprint_fpa_state(FILE *fp, Fpa_state q, int depth);
77
void p_fpa_state(Fpa_state q);
79
void p_fpa_query(Term t, Querytype query_type, Fpa_index idx);
81
Term fpa_next_answer(Fpa_state q);
83
Term fpa_first_answer(Term t, Context c, Querytype query_type,
84
Fpa_index idx, Fpa_state *ppos);
86
void fpa_cancel(Fpa_state q);
88
void zap_fpa_index(Fpa_index idx);
90
BOOL fpa_empty(Fpa_index idx);
92
void p_fpa_density(Fpa_index idx);
94
unsigned mega_next_calls(void);
96
#endif /* conditional compilation of whole file */