Prolog and Knowledge Information Processing

Web Technology Digital Transformation Artificial Intelligence Natural Language Processing Semantic Web Deep Learning Online Learning Reinforcement Learning Chatbot and Q&A User Interface Knowledge Information Processing Machine Learning Reasoning Programming Navigation of this blog

About Prolog and Knowledge Information Processing

Prolog will be one of the two classical languages for symbolic artificial intelligence programming, along with Lisp. The language is characterized as a declarative language, which means that it is a “declarative programming language” in which the definition of an object = “what (you) want to get” is declared to construct a program, and the process, procedure, or algorithm to get it = “how (you) want to get it” is not described[1][2]. On the other hand, procedural languages do not describe the process, procedure, or algorithm of obtaining something. Here, the declaration of “what you want to get” is not a description of how to get the output, but a description of the nature of the output and the state it should be in, and the final realization procedure is delegated to the processing system, runtime, framework, etc. that the language has separately.

As a form of declaration, predicate logic is used. In this form, the predicate (verb) is regarded as a function, and variables such as nouns are assigned to the predicate as shown below.

valuable(gold)        Gold is valuable
fermale(jane)         Jane is female
owns(jane, gold)      Jane owms gold
father(john,mary).    John is the father of Mary
gives(john,book,mary) John gives the book to Mary

As shown above, a declaration is a fact (FACT) in a sense. In contrast, the simplest query is whether the declaration is true or not, as shown below.

?- valuable(gold)
yes
?- valuable(wood)
no
?- gives(john,book,mary)
yes

Furthermore, a query to find the data in the declaration is also provided by using the variable X as follows.

?- valuable(X)
X=gold
?- gives(john,X,mary)
X=book

If there are multiple Xs, they will be displayed in order. Declarations can also be conjunctions (and in set operations) as follows.

likes(mary,chocolate)
likes(mary,wine)
likes(john,wine)
likes(john,mary)

?- likes(mary,X),likes(john,X)
X=wine

Another important syntax in Prolog is the Rule declaration. This is expressed in Prolog as follows: “John likes anyone who likes wine”.

likes(john,X) :- likes(X,wine)

The symbol that appears here, “:-“, can be taken as an “if” in natural language. This rule can be used in the following way.

<fact>
male(albert)
male(edward)
female(alice)
female(victoria)
parent(edward,victoria,albert)
parent(alice,victoria,ablert)

<rule>
sister_of(X,Y):-
    female(X),
    parents(X,M,F),
    parents(Y,M,F)

<query>
?- sister_of(alice,edward)
no

In the above example, the query is answered by combining information from multiple facts using rules. By using these rules to collect facts, and then collecting the knowledge rules of experts, an expert system can be constructed. As you can see from the above example, this expert system has some problems, such as the need to collect a large number of facts and rules to handle practical-scale data, and the fact that only conjunctions (and) can be used to combine conditions, and disjunctions (or) cannot be used. There are some problems.

The following articles about Prolog will be included in this blog.

Technical Topics

In order to program, it is necessary to create a development environment for each language. This section describes how to set up specific development environments for Python, Clojure, C, Java, R, LISP, Prolog, Javascript, and PHP, as described in this blog. Each language has its own platform to facilitate development, which makes it possible to easily set up the environment, but this section focuses on the simplest case.

An expert system is, according to wiki, “a computer system that emerged from artificial intelligence research and emulates the decision-making abilities of human experts (experts) [1]. It is designed to solve complex problems by reasoning about knowledge like an expert, and does not follow procedures set by software developers as in normal programming.

In simple terms, the basic behavior is such that the system follows the input and selects the rules that are defined (declared), and the final output is the result of applying all the rules. At the time when expert systems were introduced, machine learning technology was not so advanced, and these rules were almost always created manually. This made it difficult to construct complex rules, and they have been used in applications describing business rules for a limited domain, rather than in large-scale AI systems.

The first time people understand the Prolog language, they are transformed from their previous ideas. This language, with its seemingly simple form, has unlimited potential and technical possibilities. However, few books adequately convey its essence. Most of the manuals available are introductory in nature.
This book addresses the intellectual needs of engineers who wish to understand and master the essence of Prolog by clearly explaining its many applications and advanced, practical programming techniques.
This book was originally written by Leon Sterling,Hhud Shaplog for lectures for graduate students with the purpose of teaching advanced “programming” in Prolog, and was published by MITPRESS as Art of Prolog.

From “Practical Common Lisp,” a reference book on LISP, a programming language for artificial intelligence technology. Includes reading notes.

AI research in the 1960s was devoted entirely to search problems. In particular, much of the research was concerned with theorem proving. That is, the problem is described as a small set of axioms, which are explored to prove the problem. Thus, the implicit assumption was that the reasoning mechanism was capable of doing so. If the correct search technique could be discovered, then all problems could be solved and all theorems could be proved.

In the 1970s, the idea of theorem proving began to prove a challenge to this approach as it failed to live up to expectations, and AI researchers gradually began to realize that no matter how clever a reasoning algorithm could be devised, it would not be able to solve NP-hard problems. General inference mechanisms were effective for toy problem, but they could not cope when the size of the problem increased.

An alternative to this would be the idea of expert systems. The key to solving difficult problems was thought to be acquiring rules of exception to divide the problem into easier problems; according to Feigenbaum, the lesson from expert systems such as MYCIN is that the choice of what inference mechanism to use is not as important as having the correct knowledge representation This means that it is not a matter of From this viewpoint, it matters little whether MYCIN uses forward or backward reasoning.

Chatbot implementation using SWI-Prolog (external link)

コメント

タイトルとURLをコピーしました