In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail what are the three basic sentences about prolog language. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
The three basic sentences of prolog language are facts, rules and queries, which correspond to headless and headless HORN clauses, so the programming in Prolog language can be summed up as declaring facts, defining rules and asking questions.
Prolog (abbreviation for Programming in Logic) is a logical programming language. It is based on the theory of logic and was initially used in natural language and other research fields.
Introduction to Prolog
A logical programming language. In 1972, in order to improve the execution efficiency of the resolution method, the French Comoraue group developed a program executor of the theorem proof program, named PROLOG (Programming In Logic), which marked the birth of the first logic programming language PROLOG. In 1974 and after, R. Kowalski further clarifies the theoretical basis of PROLOG from the perspective of the HORN clause of predicate logic and systematically puts forward the idea of logic programming.
There are three types of basic sentences in PROLOG language, which represent facts, rules and inquiries respectively, and correspond to headless (non-body, non-body) and headless HORN clauses.
Therefore, the programming in Prolog language can be summed up as declaring facts, defining rules and asking questions.
The interpretation and execution process of the PROLOG program adopts a specific input resolution, that is, starting from the target statement, the resolution (tail and header match) of a clause of the original clause set is obtained, and the new clause is then resolved with a clause of the original clause set, and so on. Do not find a resolution between two derived clauses or two clauses of the original set of clauses at any time. In the above example
⑥:-human (u), greek (u) (resolution of ④ and ⑤, mgu=u/x)
⑦:-greek (socarates) (resolution of ② and ⑥, mgu=socarates/u)
⑧:-(resolution of ③ and ⑦, empty clause)
The answer to the question is u=socarates. Thus it can be seen that PROLOG interpretation system is actually a theorem proving program or problem solving program based on resolution principle.
The low efficiency of time and space is an important problem affecting the application of PROLOG language. The way to improve the efficiency is to improve the PROLOG interpretation system, adopt PROLOG compiler system, develop Prolog machine, introduce meta-rules for control, adopt heuristic search method, enable intelligent backtracking, adopt collaborative and concurrent solving technology, and develop parallel processing mechanism.
Because the PROLOG interpreter can automatically find the solution of the problem according to the reasoning rules, the programmer can focus on revealing the logical relationship between objects without thinking too much about the details of the process, which is a step forward in the direction of automatic programming. But PROLOG also has some illogical features. For example, to control backtracking, CUT technology is used (cut-off technique, which means that programmers use the CUT character! The notification system no longer considers the techniques of searching paths that have been carried out in the past but are useless and does not need to record backtracking points, and introduces the predicate assert (adding clauses to the database) ret ract (deleting clauses from the database). This makes the axiom set of the system change in the process of reasoning, which are inconsistent with the basic ideas of the same order logic. Therefore, PROLOG is not a logical programming language in a strict sense. In order to make it more logical, it is necessary to limit the illogical components of the language to a minimum, and research in this area is under way.
This is the end of this article on "what are the three basic sentences of prolog language?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.