Production Systems

Mathematical basis

Production systems predate the computer. The were invented by Emile Post in the 1940s as a form of computation. They are as powerful, computationally, as recursive functions or Turing machines. In other words, productions are as powerful a method of computation as any others we know of. Productions turn up in quite a few places in AI. In addition to appearing in Expert Systems, they turn up, for example, in some robotic control systems, or in natural language systems. Parsers used in compilers are based on rules which are essentially productions.

Productions are simply a set of rules.

where the c's are conditions, usually conjunctions of boolean functions, and the a's are actions. Actions can be many things depending on the context. in robotics they would be signals to controllers. In grammars they would rewrite expressions. In the case of Expert Systems, actions usually involve changes in state or I/O actions.

Note an important difference between the c's and a's in the case of ES. The c's are patterns. The computational activity involving the c's is pattern matching. On the other hand, the a's involve procedural activities such as one might find in a standard programming language such as C. You will see that CLIPS clearly reflects this contrast.

Origins in psychology

Why did some AI researchers see productions as useful for representing human knowledge? One reason is that a lot of human cognitive activity involves recognizing a situation, and then taking appropriate action. The recognition phase involves pattern recognition. This pattern recognition depends on memory of previous experiences in similar situations.

In short, some, at least, of human mental activity consists of using rules similar to Post's production rules, with, of course, a much more sophisticated pattern recognizer.

These recognize-act rules were seen as a part of a human's long term memory. Psychological testing also revealed the existence of a short term memory. This memory is apparently quite limited. Supposedly it is capable of holding 7 plus or minus 2 'chunks' of knowledge in focus at a given time.

So in some sense, thinking is viewed as putting relevant chunks of knowledge (patterns) in short term memory, and then drawing on the rule base of recognize-act rules stored in long term memory to do something based on the contents of the short term memory.

Armed with these ideas from Post's mathematical theory of productions and these memory concepts from psychology, Allen Newell and Herbert Simon developed a production system suitable for representing human knowledge in computers.

Operation of a Production System.

There are three main components

The recognize-act cycle.

The inference engine runs on an infinite loop. The pattern side of the production rules are matched against the patterns of the facts in the working memory. Any rules whose patterns match are put on an agenda (conflict set).

Now the question is, what action to take. All the matching rules have their corresponding actions. Which one gets to act? The process of deciding this is called conflict resolution. Various schemes have been devised to make this decision. (Some will be discussed later.)

By whatever means, one rule is selected from the agenda and 'fired'. Its action (or actions) is carried out. In pure production system, actions consist of modifying, removing, or adding elements in the working memory, or in very sophisticated applications, modifying the production rules themselves. (Self modifying code! CLIPS does not allow this but Jess does.)

In practical systems, side effects are also allowed, such as printing output to the screen, or file operations.

Production systems and state space search.

The collection of facts in the working memory is normally seen as representing a state in the problem space of the problem being solved. As the rules fire, the collection of facts is modified and the system moves from state to state in the problem space. Hopefully, the system lands in a solution state at some point.

An Opportunistic System

There is a certain parallelism in production systems. Remember that each rule represents a chunk of knowledge about the problem at hand. Each chunk should be self-contained and independent of all the other chunks.

In addition, each rule, if its recognition part is correctly written, 'knows' when it is needed. That is it should be put on the agenda and fire at the appropriate state in the path towards the problem's solution. In a manner of speaking, each rule has a life of its own,

Blocks World

A classic AI program from the 70s which was designed to experiment with natural (human) language understanding. In the original, a crane like robot arranged blocks (like children's blocks) into stacks. The robot received instructions in English. Instructing were like, "Put the red cone on top of the green cube.", or "Make a tower with block A on to top of B on top of C on the table." The robot would then obey the instructions.

All this is very simple for a human (over a certain age) but very complex for a robot. The blocks world scenario has spawned all kinds of simple examples illustrating various AI topics. Here is one.

Imagine 3 (cubic) blocks A, B, C forming a small 'tower' with A on top, B in the middle, and C on the bottom. Imagine 3 more blocks, D, E and F, also in a tower, with D on top, E in the middle, and F on the bottom. The towers are on a table (or the floor). The robot is instructed to "move block C on top of block E".

Here is a short program written in CLIPS (C Language Integrated Production System) that would instruct the robot. Since we can't afford a real robot, we just print out the instructions.

Pick up blocks example in CLIPS

Zebra Logic Puzzle in CLIPS