<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=Rule-based_system</id>
	<title>Rule-based system - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=Rule-based_system"/>
	<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=Rule-based_system&amp;action=history"/>
	<updated>2026-05-10T06:04:10Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>http://debianws.lexgopc.com/wiki143/index.php?title=Rule-based_system&amp;diff=7447049&amp;oldid=prev</id>
		<title>imported&gt;Headbomb: Alter: title, template type. Add: isbn, chapter, authors 1-3. Removed parameters. | Use this tool. Report bugs. | #UCB_Gadget</title>
		<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=Rule-based_system&amp;diff=7447049&amp;oldid=prev"/>
		<updated>2025-06-05T16:19:00Z</updated>

		<summary type="html">&lt;p&gt;Alter: title, template type. Add: isbn, chapter, authors 1-3. Removed parameters. | &lt;a href=&quot;/wiki143/index.php?title=En:WP:UCB&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;En:WP:UCB (page does not exist)&quot;&gt;Use this tool&lt;/a&gt;. &lt;a href=&quot;/wiki143/index.php?title=En:WP:DBUG&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;En:WP:DBUG (page does not exist)&quot;&gt;Report bugs&lt;/a&gt;. | #UCB_Gadget&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Short description|Type of computer system}}&lt;br /&gt;
In [[computer science]], a &amp;#039;&amp;#039;&amp;#039;rule-based system&amp;#039;&amp;#039;&amp;#039; is a computer system in which domain-specific [[knowledge representation|knowledge]] is represented in the form of rules and general-purpose [[reasoning system|reasoning]] is used to solve problems in the domain. &lt;br /&gt;
&lt;br /&gt;
Two different kinds of rule-based systems emerged within the field of [[artificial intelligence]] in the 1970s: &lt;br /&gt;
* [[Production system (computer_science)|Production systems]], which use &amp;#039;&amp;#039;if-then rules&amp;#039;&amp;#039; to derive &amp;#039;&amp;#039;actions&amp;#039;&amp;#039; from &amp;#039;&amp;#039;conditions&amp;#039;&amp;#039;. &lt;br /&gt;
* [[Logic programming]] systems, which use &amp;#039;&amp;#039;conclusion if conditions rules&amp;#039;&amp;#039; to derive &amp;#039;&amp;#039;conclusions&amp;#039;&amp;#039; from &amp;#039;&amp;#039;conditions&amp;#039;&amp;#039;. &lt;br /&gt;
The differences and relationships between these two kinds of rule-based system has been a major source of misunderstanding and confusion.&lt;br /&gt;
&lt;br /&gt;
Both kinds of rule-based systems use either [[forward chaining|forward]] or [[backward  chaining]], in contrast with [[imperative programming language|imperative programs]], which execute commands listed sequentially. However, logic programming systems have a logical interpretation, whereas production systems do not.&lt;br /&gt;
&lt;br /&gt;
==Production system rules==&lt;br /&gt;
&lt;br /&gt;
A classic example of a production rule-based system is the domain-specific [[expert system]] that uses rules to make deductions or choices.&amp;lt;ref name=&amp;quot;GrosanAbraham2011&amp;quot;&amp;gt;{{cite book|author1=Crina Grosan|author2=Ajith Abraham|title=Intelligent Systems: A Modern Approach|url=https://books.google.com/books?id=c1fzgQj5lhkC&amp;amp;pg=PA149|date=29 July 2011|publisher=Springer Science &amp;amp; Business Media|isbn=978-3-642-21004-4|pages=149–}}&amp;lt;/ref&amp;gt;  For example, an expert system might help a doctor choose the correct diagnosis based on a cluster of symptoms, or select tactical moves to play a game.&lt;br /&gt;
&lt;br /&gt;
Rule-based systems can be used to perform [[lexical analysis]] to [[compiler|compile]] or [[interpreter (computing)|interpret]] computer programs, or in [[natural language processing]].&amp;lt;ref name=&amp;quot;Chan2014&amp;quot;&amp;gt;{{cite book|author=Sin-Wai Chan|title=Routledge Encyclopedia of Translation Technology|url=https://books.google.com/books?id=S0FWBQAAQBAJ&amp;amp;pg=PA454|date=13 November 2014|publisher=Routledge|isbn=978-1-317-60815-8|pages=454–}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rule-based programming attempts to derive execution instructions from a starting set of data and rules. This is a more indirect method than that employed by an [[imperative programming language]], which lists execution steps sequentially.&lt;br /&gt;
&lt;br /&gt;
===Construction===&lt;br /&gt;
&lt;br /&gt;
A typical rule-based system has four basic components:&amp;lt;ref&amp;gt;{{cite web|url=http://www.j-paine.org/students/lectures/lect3/node5.html|title=What is a rule-based system?|work=j-paine.org}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* A list of rules or &amp;#039;&amp;#039;&amp;#039;rule base&amp;#039;&amp;#039;&amp;#039;, which is a specific type of [[knowledge base]].&lt;br /&gt;
* An [[inference engine]] or [[semantic reasoner]], which infers information or takes action based on the interaction of input and the rule base. The interpreter executes a [[Production system (computer_science)|production system]] program by performing the following match-resolve-act cycle:&amp;lt;ref&amp;gt;{{cite book&lt;br /&gt;
| title=  ICPS &amp;#039;05. Proceedings. International Conference on Pervasive Services, 2005&lt;br /&gt;
| chapter= DJess - a context-sharing middleware to deploy distributed inference systems in pervasive computing domains&lt;br /&gt;
| year=2005&lt;br /&gt;
| volume=2&lt;br /&gt;
| pages=66–69&lt;br /&gt;
| doi= 10.1109/PERSER.2005.1506416| s2cid= 27323155 &lt;br /&gt;
| last1= Cabitza&lt;br /&gt;
| first1= F.&lt;br /&gt;
| last2= Sarini&lt;br /&gt;
| first2= M.&lt;br /&gt;
| last3= Dal Seno&lt;br /&gt;
| first3= B.&lt;br /&gt;
| isbn= 0-7803-9032-6&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
:* Match: In this first phase, the condition sides of all productions are matched against the contents of working memory. As a result a set (the &amp;#039;&amp;#039;conflict set&amp;#039;&amp;#039;) is obtained, which consists of instantiations of all satisfied productions. An instantiation of a production is an ordered list of working memory elements that satisfies the condition side of the production.&lt;br /&gt;
:* [[Conflict resolution strategy|Conflict-resolution]]: In this second phase, one of the production instantiations in the conflict set is chosen for execution. If no productions are satisfied, the interpreter halts.&lt;br /&gt;
:* Act: In this third phase, the actions of the production selected in the conflict-resolution phase are executed. These actions may change the contents of working memory. At the end of this phase, execution returns to the first phase.&lt;br /&gt;
* Temporary [[working memory]], which is a  database of facts.&lt;br /&gt;
* A [[user interface]] or other connection to the outside world through which input and output signals are received and sent.&lt;br /&gt;
&lt;br /&gt;
Whereas the matching phase of the inference engine has a logical interpretation, the conflict resolution and action phases do not. Instead, &amp;quot;their semantics is usually described as a series of applications of various state-changing operators, which often gets quite involved (depending on the choices made in deciding which ECA rules fire, when, and so forth), and they can hardly be regarded as declarative&amp;quot;.&amp;lt;ref&amp;gt;Maier, D., Tekle, K.T., Kifer, M. and Warren, D.S., 2018. Datalog: concepts, history, and outlook. In Declarative Logic Programming: Theory, Systems, and Applications (pp. 3-100).&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Logic programming rules==&lt;br /&gt;
The logic programming family of computer systems includes the programming language [[Prolog]], the database language [[Datalog]] and the knowledge representation and problem-solving language [[answer set programming|Answer Set Programming]] (ASP). In all of these languages, rules are written in the form of &amp;#039;&amp;#039;[[Clause (logic)|clauses]]&amp;#039;&amp;#039;:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;A :- B&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, ..., B&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt;.&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and are read as declarative sentences in logical form:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;A if B&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and ... and B&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt;.&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the simplest case of [[Horn clause]]s (or &amp;quot;definite&amp;quot; clauses), which are a subset of [[first-order logic]], all of the A, B&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, ..., B&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt; are [[atomic formula]]e.&lt;br /&gt;
&lt;br /&gt;
Although Horn clause logic programs are [[Turing completeness | Turing complete]],&amp;lt;ref&amp;gt;{{cite journal |last=Tärnlund |first=S.Å. |date=1977 |title=Horn clause computability |journal=[[BIT Numerical Mathematics]] |volume=17 |issue=2 |pages=215–226 |doi=10.1007/BF01932293|s2cid=32577496 }}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{cite journal |last1=Andréka |first1=H. |last2=Németi |first2=I. |date=1978 |title=The generalised completeness of Horn predicate-logic as a programming language |url=https://cyber.bibl.u-szeged.hu/index.php/actcybern/article/view/3160 |journal=Acta Cybernetica |volume=4 |issue=1 |pages=3–10}}&amp;lt;/ref&amp;gt; for many practical applications, it is useful to extend Horn clause programs by allowing negative conditions, implemented by [[negation as failure]]. Such extended logic programs have the knowledge representation capabilities of a [[non-monotonic logic]].&lt;br /&gt;
&lt;br /&gt;
== Differences and relationships between production rules and logic programming rules ==&lt;br /&gt;
&lt;br /&gt;
The most obvious difference between the two kinds of systems is that production rules are typically written in the forward direction, &amp;#039;&amp;#039;if A then B&amp;#039;&amp;#039;,  and logic programming rules are typically written in the backward direction, &amp;#039;&amp;#039;B if A&amp;#039;&amp;#039;. In the case of logic programming rules, this difference is superficial and purely syntactic. It does not affect the semantics of the rules. Nor does it affect whether the rules are used to reason backwards, Prolog style, to reduce the goal &amp;#039;&amp;#039;B&amp;#039;&amp;#039; to the subgoals &amp;#039;&amp;#039;A&amp;#039;&amp;#039;, or whether they are used, Datalog style, to derive &amp;#039;&amp;#039;B&amp;#039;&amp;#039; from &amp;#039;&amp;#039;A&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
In the case of production rules, the forward direction of the syntax reflects the stimulus-response character of most production rules, with the stimulus &amp;#039;&amp;#039;A&amp;#039;&amp;#039; coming before the response &amp;#039;&amp;#039;B&amp;#039;&amp;#039;. Moreover, even in cases when the response is simply to draw a conclusion &amp;#039;&amp;#039;B&amp;#039;&amp;#039; from an assumption &amp;#039;&amp;#039;A&amp;#039;&amp;#039;, as in [[modus ponens]], the match-resolve-act cycle is restricted to reasoning forwards from &amp;#039;&amp;#039;A&amp;#039;&amp;#039; to &amp;#039;&amp;#039;B&amp;#039;&amp;#039;. Reasoning backwards in a production system would require the use of an entirely different kind of inference engine.&lt;br /&gt;
&lt;br /&gt;
In his Introduction to Cognitive Science,&amp;lt;ref&amp;gt;{{Cite book|title=Mind: Introduction to Cognitive Science|last=Thagard|first=Paul|publisher=The MIT Press|year=2005|isbn=9780262701099|pages=11}}https://www.google.co.uk/books/edition/Mind_second_edition/gjcR1U2HT7kC?hl=en&amp;amp;gbpv=1&amp;amp;pg=PP11&amp;amp;printsec=frontcover&amp;lt;/ref&amp;gt; [[Paul Thagard]] includes logic and rules as alternative approaches to modelling human thinking. He does not consider logic programs in general, but he considers Prolog to be, not a rule-based system, but &amp;quot;a programming language that uses logic representations and deductive techniques&amp;quot; (page 40).&lt;br /&gt;
&lt;br /&gt;
He argues that rules, which have the form &amp;#039;&amp;#039;IF condition THEN action&amp;#039;&amp;#039;, are &amp;quot;very similar&amp;quot; to logical conditionals, but they are simpler and have greater psychological plausibility (page 51). Among other differences between logic and rules, he argues that logic uses deduction, but rules use search (page 45) and can be used to reason either forward or backward (page 47). Sentences in logic &amp;quot;have to be interpreted as &amp;#039;&amp;#039;universally true&amp;#039;&amp;#039;&amp;quot;, but rules can be &amp;#039;&amp;#039;defaults&amp;#039;&amp;#039;, which admit exceptions (page 44). He does not observe that all of these features of rules apply to logic programming systems.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Logic programming]]&lt;br /&gt;
* [[Expert systems]]&lt;br /&gt;
* [[Rewriting]]&lt;br /&gt;
* [[RuleML]]&lt;br /&gt;
* [[List of rule-based languages]]&lt;br /&gt;
* [[Learning classifier system]]&lt;br /&gt;
* [[Rule-based machine learning]]&lt;br /&gt;
* [[Rule-based modeling]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Reflist}}&lt;br /&gt;
&lt;br /&gt;
{{Types of programming languages}}&lt;br /&gt;
{{Semantic Web}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Rule engines]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Headbomb</name></author>
	</entry>
</feed>