14.11 Applications of Logic Programming

Applications of logic/declarative programming include cryparithmetic problems, puzzles (e.g., tic-tac-toe), artificial intelligence, and design automation. In this section, we briefly introduce some other applications of Prolog and CLIPS.

14.11.1 Natural Language Processing

One application of Prolog is natural language processing (Eckroth 2018; Matthews 1998)—the search engine used by Prolog naturally functions as a recursive-descent parser. One could conceive facts as terminals and rules as non-terminals or production rules. Consider the following simple grammar:

A list of seven grammar rules.
Description

Using this grammar, a Prolog program can be written to verify the syntactic validity of a sentence. The candidate sentence is represented as a list in which each element is a single word in the language (e.g., sentence(["The", "dog", "runs", "fast"])).

A set of seven code lines in a Prolog program.
Description

A drawback of using Prolog to implement a parser is that left-recursive grammars cannot be implemented for the same reasons discussed in Section 14.6.4.

14.11.2 Decision Trees

An application of CLIPS is decision trees. More generally, CLIPS can be applied to graphs that represent a human decision-making process. Facts can be thought of as the edges of these graphs, while rules can be thought of as the actions or states associated with each vertex of the graph. An example of this decision-making process is an expert system that emulates a physician in treating, diagnosing, and explaining diabetes (Garcia et al. 2001). The patient asserts facts about herself including eating habits, blood-sugar levels, and symptoms. The rules within this expert system match these facts and provide recommendations about managing diabetes in the same way that a physician might interact with a patient.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.184.6