Pro/3 is a system for processing knowledge, and Pro/3 deals with two main categories of knowledge - facts and rules. The purpose of this page is to look at the concept of sentence rules more closely.
First of all - where do facts and rules come from? Facts and rules come from a knowledge engineer (KE for short), who either is an expert in the area of interest, or one who has access to such an expert. The KE formulates the knowledge so that Pro/3 can make use of it in a way that makes the system produce something useful. This means that he or she also needs to know Pro/3 - its knowledge representation concepts, its inference methods and the practical facilities included in the system.

You cannot understand Pro/3 sentence rules unless you understand the concept of Pro/3 facts (sentences).

What is a sentence rule?

Facts in Pro/3 are called sentences, and a sentence rule describes how sentences are derived from other sentences. 

There are several types of sentence rules:

SIMPLE RULES

SIMPLE IMPLICATION RULES

GENERALIZATION RULES AND RULES WITH LOGICAL OR

SET RULES

STATISTICAL RULES

RULES CALLING INEXACT RULES

SELECTION, INTERPOLATION, RANKING, CORRELATION AND ACCUMULATION RULES

Simple Rules

Example 1

Consider the following sentences (facts):

the manufacturer with name Aprilia is located in the country with name Italy! 
the manufacturer with name BMW is located in the country with name Germany! 
the manufacturer with name Ducati is located in the country with name Italy! 
the manufacturer with name Harley - Davidson is located in the country with name USA! 
the manufacturer with name Honda is located in the country with name Japan! 
the manufacturer with name Husqvarna is located in the country with name Italy! 
the manufacturer with name Jawa is located in the country with name Czech Republic! 
the manufacturer with name Kawasaki is located in the country with name Japan! 


the country with name Italy is part of the world region with name Europe! 
the country with name Germany is part of the world region with name Europe! 
the country with name Czech Republic is part of the world region with name Europe! 
the country with name USA is part of the world region with name North America! 
the country with name Japan is part of the world region with name Asia! 

Can Pro/3 answer the question which manufacturers are located in the world region with region name Europe? on the basis of the above sentences? No! because Pro/3 has no inherent geographical knowledge, and cannot connect the two sentence types without first being told the underlying and very subtle rule that "if a manufacturer is located in a certain country and that country is part of a certain world region, then the manufacturer is located in that world region". 

Sentence rules are visualized as trees (rule trees), and usually "drawn" as such with Pro/3's rule editor. The rule tree for this example could look like: 

The condition consists of two parts joined with logical and (& in the tree), each corresponding to a sentence type (manufacturer is located in country and country is part of world region). The conclusion is the sentence type manufacturer is located in world region

The interpretation of the rule can easiest be explained with SQL-terminology. manufacturer is located in country and country is part of world region would then be understood as tables:

select M.manufacturer's name, W.world region.region's name

from manufacturer is located in country M, country is part of world region W

where M.country's name = W.country's name

Notice the numbering of entity types and predicate types in the rule (shown inside [ ]-brackets). The numbering is done automatically by the rule editor, and the purpose is simply to establish a unique qualifier for the data element types. The numbers have otherwise no particular significance, however the following conventions are used by the rule editor:

  • the predicate type in conclusion (if it has data element types) has number 0
  • the first entity type in the conclusion has number 1
  • the second entity type in the conclusion (if any) has number 2
  • the predicate type in the first condition (if it has data element types) has number 10
  • the first entity type in the condition has number 11
  • the second entity type in the condition (if any) has number 12
  • the predicate type in the second condition (if it has data element types) has number 20
  • etc.

Note also the assignment/equality-operator =. The operator either compares the value of the operands on its left and right side (that is, if the left side operand already has a value), or it assigns the value of the right-side operand to the left side operand. The right side is either a data element type within a sentence-structure (as in this example) or it is simple variable unrelated to any of the sentence structures.

Pro/3 is now able to answer the question - the sentence rule has described how sentences of type manufacturer is located in world region from the two sentence types manufacturer is located in country and country is part of world region

 

- which manufacturers are located in world region with region name Europe?

manufacturer with name Aprilia is located in world region with region name Europe! 
manufacturer with name BMW is located in world region with region name Europe! 
manufacturer with name Ducati is located in world region with region name Europe! 
manufacturer with name Husqvarna is located in world region with region name Europe! 
manufacturer with name Jawa is located in world region with region name Europe!

Note that the condition sentences can be sentences entered into the knowledge base as facts, or they can be sentences concluded from other sentences rules (in any levels of recursion).
 

OPEN ENTITY TYPE ARGUMENTS

Example 2

The rule over could have been written in a more general way: "if X is located in a certain country and that country is part of a certain world region, then X is located in that world region". The manufacturer entity type has been replaced by an argument variable X. The rule will now apply to any entity type which are located in a country (e.g. banks, shops and so on).

As in PROLOG, variable names start with an upper case letter (or an underscore). However, a word starting with an upper case letter is not necessarily a variable since names (identifiers) also can start with upper case letters (Peter is clearly permitted as a name in Pro/3). This will not cause ambiguity since all names are stored in the knowledge base (in the terminology) and thus known to Pro/3. 
 

CALLING FUNCTIONS

Functions could be considered a third class of rules (in addition to sentence rules and inexact rules). Like inexact rules, functions return one value although this values does not need to be simple (it could for example be a list of values). Unlike inexact rules, functions can fail i.e. fail to return a value. Functions usually have one or more (input) parameters, but can also be defined without parameters. 

Functions are interpreted by the same PROLOG-type inference engine as sentence rules. Pro/3 comes with a set of standard functions (source) which can be loaded into to the knowledge base. There are also few functions built into the inference engine.

Functions are called by sentence rules by assigning it (with an assignment operator) to a simple variable in the rule's condition as in the following example:

 

Example 3

The Prices[1]-rule has four conditions. The upper two conditions are sentence conditions, while the lower two are variable conditions. A variable condition consists of a simple variable (the left side), an assignment or comparison operator and a right side expression. The third condition, consequently has the Current Date as its left side simple variable = as its assignment operator. The /ID is the variable's domain indicator, i.e. the identifier-domain (refer to sentence model domains for all domain short forms).

The right side is a call to the built-in function today which returns the current date (and has no input parameters). The fourth and last condition is another variable condition which assigns the year component of the current date to Current Year by calling the Pro/3 function year component. This function has one input parameter date (with Current Date as actual parameter i.e. the value assigned to the formal parameter when the function is called).

Note that rules are interpreted from top to bottom (this corresponds to left-to-right interpretation of its internal representation).

Expressions can be simple (e.g. a literal value or simple variable) or arbitrarily complex (expressions are structured as trees). The expression assigned to the price data element type in corresponds to:

(price[11] / per US$ rate [21]) * (1.03^(Current Year - year[10])) 

 

CALLING INEXACT RULES

On the surface of it, inexact rule calls look exactly like function calls (note that the rule editor prefixes functions names with [F] and IR rule names with [C] for clarity). However, the inference engine handles functions and inexact rules entirely different, and rule calls are only possible in sentence rules especially classified as "calling inexact rules type of rules" (the root of the rule tree shows the rule's classification, e.g. => for simple implication rules and CR=> for rules calling IR rules). IR rule calls (= the value returned by the rule), can only be assigned a data element type in the rule's conclusion.  
Example 4

Set Rules

Set rules conclude sentences which are derived in various ways from sets of other sentences (or sentence combinations ANDed together). Set rules use (call) at least one of Pro/3's procedures in the rule's conclusion. This call looks superficially like a function call, but has otherwise no similarity with such calls. The inference engine's processing of a set rule can be more easily understood in relational database terms: 

  • The condition part of the rule defines a condition set, a (usually) non-normalized table where each row either is a sentence or two or more sentences joined  together. 
  • The condition set is sometimes viewed as two or more condition sub-sets. Sub-sets are defined as rows in the table with the same value for one or more of the data element types (columns).
  • The procedures refer to various type of operations on the data element types of the condition (sub-)set. These operations include sums, averages, minimums. maximums and several other. There are two sub-types of set rules: statistical rules and selection, interpolation, ranking, correlation and accumulation rules
STATISTICAL RULES

Example 5

The MC knowledge base knows the estimated current US$ price for the bikes in knowledge base via the rule in Example 3.It could be useful to know the lowest, highest and average price for these bikes e.g. expressed as a sentence price range is observed. A set rule, more precisely a statistical rule, can be used for this purpose:

The condition set in this example is all the bike has estimated current US$ price sentences. Note the three procedure calls in the conclusion. Most procedures have parameters - all three rules use a generic data element type number argument element as parameter. Procedure-names are prefixed with [P] by the rule editor (for clarity).

Only one sentence is derived from this rule:

- which price range is observed?

price range with lowest price 3276, highest price 44421 and average price 12850 is observed! 

 

Example 6

The bikes have a type-classification:

bike with model "RS125" has type with type sportsbike! 
bike with model "RS250" has type with type sportsbike! 
bike with model "Pegaso 650" has type with type trailie! 
bike with model "Futura" has type with type sports tourer! 

It could also be useful to know the price range per classification-type. This could be expressed as price range is observed for bike type, and the rule could look like:

The condition set is now a join between two sentence types bike has estimated current US$ price and bike has type. The assignment of the type data element type from the condition set to one of the data element types in the conclusion (which also is called type), signifies that one sentence of price range figures is to be generated from each set of condition sentences which has the same value for type: 
- which price ranges are observed for which bike types?

price range with lowest price 17317, highest price 44421 and average price 27587 is observed for bike type with type superbike! 
price range with lowest price 8293, highest price 15024 and average price 12144 is observed for bike type with type roadster! 
price range with lowest price 12388, highest price 12388 and average price 12388 is observed for bike type with type tourer! 
price range with lowest price 6829, highest price 14624 and average price 10086 is observed for bike type with type cruiser! 
price range with lowest price 7561, highest price 33172 and average price 15876 is observed for bike type with type sportsbike! 
price range with lowest price 12059, highest price 16722 and average price 14565 is observed for bike type with type sports tourer! 
price range with lowest price 5288, highest price 14781 and average price 9614 is observed for bike type with type trailie! 
price range with lowest price 3276, highest price 20193 and average price 10470 is observed for bike type with type all - round! 
There are all in all 13 procedures which can be used in statistical rules: sum, mean, average, standard deviation, minimum, maximum, start value, end value, start point, end point, minimum point and maximum point, and finally timeseries which returns a term-string domain value data element with all of the preceding values.
 

SELECTION, INTERPOLATION, RANKING, CORRELATION AND ACCUMULATION RULES

The second group of set rules includes eight different rule types: numeric interpolation, date interpolation, value accumulation, ranking, correlation, selection of unique, selection of maximum and selection of minimum. These rules are less intuitive to use than the statistical rules, and needs to be studied carefully.
 

Example 7

The rule in Example 6 was used to derive the price range for each type of bike. A minimum-selection rule can be used to derive the lowest price bike for each type.

Note the important difference between the assignments to the model data element type and the type data element in the conclusion. The assignment in the first case uses the select-procedure, while the latter uses a direct assignment. The direct assignment to type signifies that a sentence will be concluded for each distinct type in the condition set. The select-procedure, on the other hand, signifies that the model to be assigned to the sentences in the conclusion is the model of the bike with the minimum price: 

- which bike is the lowest priced for bike type?

bike with model "RSV Mille" is the lowest priced for bike type with type superbike with price 17,317! 
bike with model "M600 Monster Dark" is the lowest priced for bike type with type roadster with price 8,293! 
bike with model "NSR125R-R" is the lowest priced for bike type with type sportsbike with price 7,561! 
bike with model "VT125C Shadow" is the lowest priced for bike type with type cruiser with price 6,829! 
bike with model "NT650V Deauville" is the lowest priced for bike type with type tourer with price 12,388! 
bike with model "350 Classic" is the lowest priced for bike type with type all - round with price 3,276! 
bike with model "KMX125" is the lowest priced for bike type with type trailie with price 5,288! 
bike with model "ZZ-R600" is the lowest priced for bike type with type sports tourer with price 12,059! 

 

Example 8

The goal of last sentence rule example is to determine the correlation between price and engine power for each of the bike types: 

The correlation-procedure has two parameters - the two data element types in the condition set to be correlated.

- which bike types have price - power correlation?

bike type with type all - round has price - power correlation with correlation 0.88! 
bike type with type cruiser has price - power correlation with correlation 0.76! 
bike type with type roadster has price - power correlation with correlation 0.95! 
bike type with type sports tourer has price - power correlation with correlation 0.09! 
bike type with type sportsbike has price - power correlation with correlation 0.73! 
bike type with type superbike has price - power correlation with correlation 0.97! 
bike type with type tourer has price - power correlation with correlation 1.00! 
bike type with type trailie has price - power correlation with correlation 0.93!