Misplaced Pages

Term indexing

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

In computer science, a term index is a data structure to facilitate fast lookup of terms and clauses in a logic program, deductive database, or automated theorem prover.

Overview

Many operations in automatic theorem provers require search in huge collections of terms and clauses. Such operations typically fall into the following scheme. Given a collection S {\displaystyle S} of terms (clauses) and a query term (clause) q {\displaystyle q} , find in S {\displaystyle S} some/all terms t {\displaystyle t} related to q {\displaystyle q} according to a certain retrieval condition. Most interesting retrieval conditions are formulated as existence of a substitution that relates in a special way the query and the retrieved objects t {\displaystyle t} . Here is a list of retrieval conditions frequently used in provers:

  • term q {\displaystyle q} is unifiable with term t {\displaystyle t} , i.e., there exists a substitution θ {\displaystyle \theta } , such that q θ {\displaystyle q\theta } = t θ {\displaystyle t\theta }
  • term t {\displaystyle t} is an instance of q {\displaystyle q} , i.e., there exists a substitution θ {\displaystyle \theta } , such that q θ {\displaystyle q\theta } = t {\displaystyle t}
  • term t {\displaystyle t} is a generalisation of q {\displaystyle q} , i.e., there exists a substitution θ {\displaystyle \theta } , such that q {\displaystyle q} = t θ {\displaystyle t\theta }
  • clause q {\displaystyle q} θ-subsumes clause t {\displaystyle t} , i.e., there exists a substitution θ {\displaystyle \theta } , such that q θ {\displaystyle q\theta } is a subset/submultiset of t {\displaystyle t}
  • clause q {\displaystyle q} is θ-subsumed by t {\displaystyle t} , i.e., there exists a substitution θ {\displaystyle \theta } , such that t θ {\displaystyle t\theta } is a subset/submultiset of q {\displaystyle q}

More often than not, we are actually interested in finding the appropriate substitutions explicitly, together with the retrieved terms t {\displaystyle t} , rather than just in establishing existence of such substitutions.

Very often the sizes of term sets to be searched are large, the retrieval calls are frequent and the retrieval condition test is rather complex. In such situations linear search in S {\displaystyle S} , when the retrieval condition is tested on every term from S {\displaystyle S} , becomes prohibitively costly. To overcome this problem, special data structures, called indexes, are designed in order to support fast retrieval. Such data structures, together with the accompanying algorithms for index maintenance and retrieval, are called term indexing techniques.

Classic indexing techniques

Substitution trees outperform path indexing, discrimination tree indexing, and abstraction trees.

A discrimination tree term index stores its information in a trie data structure.

Indexing techniques used in logic programming

First-argument indexing is the most common strategy where the first argument is used as index. It distinguishes atomic values and the principal functor of compound terms.

Nonfirst argument indexing is a variation of first-argument indexing that uses the same or similar techniques as first-argument indexing on one or more alternative arguments. For instance, if a predicate call uses variables for the first argument, the system may choose to use the second argument as the index instead.

Multiargument indexing creates a combined index over multiple instantiated arguments if there is not a sufficiently selective single argument index.

Deep indexing is used when multiple clauses use the same principal functor for some argument. It recursively uses the same or similar indexing techniques on the arguments of the compound terms.

Trie indexing uses a prefix tree to find applicable clauses.

References

  1. Colomb, Robert M. (1991). "Enhancing unification in PROLOG through clause indexing". The Journal of Logic Programming. 10: 23–44. doi:10.1016/0743-1066(91)90004-9.
  2. Peter Graf. "Substitution Tree Indexing". 1994.
  3. John W. Wheeler; Guarionex Jordan. "An Empirical Study of Term Indexing in the Darwin Implementation of the Model Evolution Calculus". 2004. p. 5.
  4. Körner, Philipp; Leuschel, Michael; Barbosa, João; Costa, Vítor Santos; Dahl, Verónica; Hermenegildo, Manuel V.; Morales, Jose F.; Wielemaker, Jan; Diaz, Daniel; Abreu, Salvador; Ciatto, Giovanni (2022). "Fifty Years of Prolog and Beyond". Theory and Practice of Logic Programming. 22 (6): 776–858. doi:10.1017/S1471068422000102. hdl:10174/33387. ISSN 1471-0684. This article incorporates text from this source, which is available under the CC BY 4.0 license.

Further reading

  • P. Graf, Term Indexing, Lecture Notes in Computer Science 1053, 1996 (slightly outdated overview)
  • R. Sekar and I.V. Ramakrishnan and A. Voronkov, Term Indexing, in A. Robinson and A. Voronkov, editors, Handbook of Automated Reasoning, volume 2, 2001 (recent overview)
  • W. W. McCune, Experiments with Discrimination-Tree Indexing and Path Indexing for Term Retrieval, Journal of Automated Reasoning, 9(2), 1992
  • P. Graf, Substitution Tree Indexing, Proc. of RTA, Lecture Notes in Computer Science 914, 1995
  • M. Stickel, The Path Indexing Method for Indexing Terms, Tech. Rep. 473, Artificial Intelligence Center, SRI International, 1989
  • S. Schulz, Simple and Efficient Clause Subsumption with Feature Vector Indexing, Proc. of IJCAR-2004 workshop ESFOR, 2004
  • A. Riazanov and A. Voronkov, Partially Adaptive Code Trees, Proc. JELIA, Lecture Notes in Artificial Intelligence 1919, 2000
  • H. Ganzinger and R. Nieuwenhuis and P. Nivela, Fast Term Indexing with Coded Context Trees, Journal of Automated Reasoning, 32(2), 2004
  • A. Riazanov and A. Voronkov, Efficient Instance Retrieval with Standard and Relational Path Indexing, Information and Computation, 199(1–2), 2005
Categories: