A good example of this is the append function that we saw in Lecture on scheme which stated how to recursively compute the concatenation of two lists. This function can be used to answer questions such as what is the concatenation of two given lists. The basis for this function can be interpreted as two rules: 1) what is the concatenation an empty list with a list and 2) how the concatenation of two lists is related to the concatenation of the list obtained by removing its first element and a second list. These rules specify when three lists are such that the third is the concatenation of the first two. A logic programming language can use these rules to obtain a list that concatenates with a given list to obtain a given third list in addition to concatenating two given lists. Moreover, the same rules, with an appropriate underlying control mechanism, can be used to find all pairs of lists that concatenate to obtain a third given list.
In this lecture we provide a simple logic programming language, called a query language since it can be used to retrieve information - by lookup or deduction - from a database. In addition to studying the language, we will study an implementation of the language. The key concepts in the implemenation of this language are pattern-matching, binding, and a generalization of pattern matching called unification that can be used for deduction.