Production systems
1 / 24

Production Systems - PowerPoint PPT Presentation

  • Uploaded on

Production Systems. Productions systems are rule based forward chaining systems. They are based on forward chained reasoning, but are extended to be a kind of programming language systems. Systems exist that can handle several thousand rules efficiently. What is Production Systems.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about ' Production Systems' - marek

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Production systems
Production Systems

Productions systems are rule based forward chaining systems.

They are based on forward chained reasoning, but are extended to be a kind of programming language systems.

Systems exist that can handle several thousand rules efficiently.

What is production systems
What is Production Systems

  • Algorithmic ,procedural (C,FORTRAN)

  • Applicative,functional (LISP)

  • Logic programming (PROLOG)

  • Object oriented (Smalltalk,Java,Simula)

  • Hybrid systems (KEE,NEXPERT,ART)

Forward chained

Rule based


Rules comunicate only through Working Memory

When is production systems used
When is Production Systems used

  • When the knowledge is present on the form

  • situation-action

  • When the program control is very complex, i.e. no algorithm

  • When the program is expected to be heavily extended and modified over a long period

Forward and Backward chaining



Narrow and deep

Good applications for BC



Broad and shallow

Good applications for FC

Incremental forward chaining
Incremental forward chaining

%% rule '9.3'

american(X) and weapon(Y) and

sells(X,Y,Z) and hostile(Z) => criminal(X).

%% rule '9.6'

missile(X) and owns(nono,X)

=> sells(west,X,nono).

%% rule '9.7'


=> weapon(X).

%% rule '9.8'


=> hostile(X).

%% facts

t=> owns(nono,m1). % 9.4

t=> missile(m1). % 9.5

t=> american(west). % 9.9

t=> enemy(nono,america). % 9.10


+ owns(nono,m1)

+ missile(m1)

+ sells(west,m1,nono)

+ weapon(m1)

+ american(west)

+ enemy(nono,america)

+ hostile(nono)

+ criminal(west)

Forward chaining proxy format

rule '9.3'

if american(X) and weapon(Y) and

sells(X,Y,Z) and hostile(Z)

then criminal(X).

rule '9.6'

if missile(X) and owns(nono,X)

then sells(west,X,nono).

rule '9.7'

if missile(X)

then weapon(X).

rule '9.8'

if enemy(X,america)

then hostile(X)

Forward chaining Proxy format


*** 9.6 ==> sells(west,m1,nono) ***

*** 9.7 ==> weapon(m1) ***

*** 9.8 ==> hostile(nono) ***

*** 9.3 ==> criminal(west) ***

*** Time 0 ms


owns(nono,m1) and % 9.4

missile(m1) and % 9.5

american(west) and % 9.9

enemy(nono,america). % 9.10

Production systems1
Production Systems

  • Forward Chained

  • All communictations via Working Memory (WM).

  • [Matching] Find all the rules whose premise are satisfied

  • [Conflict Resolution] If more than one rule apply, select the one with the highest priority

  • [Execution] Execute(fire) the rule selected. The execution will change the WM.

  • Then start again from top.

Efficiency considerations 1
Efficiency considerations 1

Forward reasoning can be done in levels.

Every new fact must be derived from at least 1 fact in the

previous level.

This is true because inference mechanism that does not

require a new fact from level t-1 could have been done at in level t-1 already.

Efficiency considerations 2
Efficiency considerations 2

With suitable indexing, it is easy to identify all the

rules that can be triggered by a new fact.

Typically, there are many more rules than facts in a

production system rule base.



Efficiency considerations 3
Efficiency considerations 3

Forward chaining gives a lot of irrelevant facts. One

way to avoid this is to simulate backward chaining.

This means that goals and subgoals are explicitly represented

and used to control the reasoning.

Another way is to restrict forward chaining to a subset of rules.

Efficiency considerations 4
Efficiency considerations 4

  • (according to AIMA)

  • A method is to rewrite the rule set using information about

  • the goal so that only relevant variable bindings –

  • those belonging to a magic set – are considered during forward inference. For instance, if the goal is criminal(west), the rule that concludes criminal(X) is prefixed with an extra conjunct

  • magic(X) and american(X) and weapon(X) and

  • sells(X,Y,Z) and hostile(Z) => criminal(X)

  • which avoids redundant inferences if west is in the magic set.

Efficiency considerations 5
Efficiency considerations 5

There may be 300 mill americans but only 5(?) hostile nations.

It may be smart to reorder the condition sequence of the rules in increasing ”plurality” .


american(X) and weapon(X) and

sells(X,Y,Z) and hostile(Z) => criminal(X)


hostile(Z) and sells(X,Y,Z) and weapon(X) and american(X) => criminal(X)

Facts searching for rules
Facts searching for rules

Rules searching for facts



Facts searching for rules



The rete algorithm
The Rete(*) algorithm

Efficient algorithm to match facts against (patterns) of rules to determine which rules have all its conditions fullfilled

  • This algortithm preprocesses the set of rules

  • in the knowledge base to construct a set of dataflow

  • network in which each rule is a literal from the rule premise.

  • Variable bindings flow through the network and are filtered

  • out when they fail to match a literal. …

  • At any given point, the state of a rete network captures all the partial matches of the rules, avoiding a great deal of recomputation.

(*) pronounced as ”treaty”. Means ”net” in Latin

Production systems and applications
Production systems and applications

System Application

R1 XCON (configuration of VAX computers)

OPS-5 Several applicatons

CLIPS Severl applications, used by NASA

ACT Cognitive architecture

SOAR Cognitive architecture with learning

PRAGMA BusTUC ( natural language interpretation)

PROXY Education

Production system proxy
Production system PROXY

PROlog implementationof produXion sYstem

  • All communictations via Working Memory (WM).

  • [Matching] Find the first rule whose premise are satisfied

  • [Conflict Resolution] The first has highest priority

  • [Execution] Execute(fire) the rule selected. The execution will

  • change the WM. Then start from top.

Conflict resolution strategies
Conflict Resolution Strategies

”LEX” strategy


  • First found

  • Least recently used

  • Most recently used

  • Antecedent ordered

  • Consequent ordered

  • Most complex first

  • Simplest first

  • Rule priority

  • User defined


(don’t fire twice in sequence)


(the newest fact has priority)


(the rule that matches most facts)

Arbitrary choice

The logic of proxy imperative logic
The logic of Proxy”Imperative logic”

Indicative Logic

If Conditions then Conclusions


If Conditions then Actions

Imperative Logic

If Conditions then cause Conclusions

Proxy implementation outline
PROXY implementation outline



not epoch.

epoch :-

( if P then Q ),


not Q,

assert Q.

%repeat until

% epoch fails

% find a rule

% check that P is true

% and not Q is true

% put Q into KB

Alternative for

negative conclusions

epoch :-

( if P then not Q ),



retract Q.

Proxy s refraction rule
Proxy’s Refraction Rule

Refraction (from refrain)

Proxy requires that all the conditions and not all the conclusions are true when a rule fires. Then all the conclusions will be made true by the imperative logic, so the same rule will not fire the next time.

The method is not particularly efficient, but suffices for small to medium rule bases (< 1000 rules).


C Language Implementation of production Systems

Example of rule format

(defrule become-adult

(child harry)

(birthday harry August-15)

(age harry 17)

(date today August-15)


(assert (adult harry))

(retract (child harry))

(retract (age harry 17))

(assert (age harry 18))

(print t “harry is now an adult”))

Ops 5 with example of rules for goal based reasoning
OPS-5with example of rules for goal based reasoning

English version

IF there is a goal for monkey to be on some physical object

and the object is at a particular location

and the monkey is at some location holding something

THEN establish a goal for the monkey to hold nothing.

(p On::Phys-Object:Holds

(goal ^status active ^type on ôbject-name <o1>)

(phys-object ^name <o1> ^at <p>)

(monkey ^at <p> ^holds <> nil)


(make goal ^status active ^type on ^object-name nil))


Pragma is a production system for translating the natural language queries (in the form of an intermediate meaning representation language TQL) to a database query.

At present, there are 1329 rules. In average, 10 rules are fired.

The time used is negligable.

Example of Pragma rule (to be shown),


If time requested is before 430 (today) (" half past four" ) and

time now is after requested time + 1200

then change time requested to 1200 + time requested and

change day to tomorrow.

Pragma rule example
Pragma rule example

rule defaulttomorrowafternoon

if srel/Rel/time/Four/_,

not _ isa midnight,

not _ isa morning,

not _ isa prenoon,

not _ isa afternoon,

not _ isa evening,

not _ isa night,

not _ isa date,

not _ isa weekday,

{Four < 0430, Sixteen is Four + 1200)},


{NOW > Sixteen}



{ daysucc(TODAY,TOMORROW)},

{ add_days(TODATE,1,TODATE1)},


Sixteen isa clock,

not Four isa clock,


not srel/Prep/time/Four/D,




‘I assume you mean routes

for tomorrow').