Declaring MYCIN rulebases

Angel Fernandez Pineda
Jose F. Morales (maintenance)


This library enables MYCIN-style inference using certainty factors on rules.

Other information

This section elaborates on the way in which mycin rules are declared. There are two kind of mycin rules: those traditional modus-ponens rules and metarules, which are provided as a simple way to integrate Prolog and mycin inference. Mycin rules does not depart too much from Prolog clauses, they differ in clause heads, where mycin rules includes a certainty factor declaration.

Declaring Mycin rules

Mycin rules are declared as follows:

 Head cf CertaintyFactor :- Body.

The same considerations are applied as for Head :- Body Prolog clauses. CertaintyFactor must be a number between -1 and 1 which declares the certainty factor for that rule. For example:

 risk(high) cf -0.3 :-
	market_status(defensive),
	imitation_time(short).

Rule bodies may contain a Prolog goal as well as a mycin goal in any number, but those goals will never fail since mycin goals always retrieve a certainty factor. For Prolog goals a certainty factor of -1 will be retrieved whenever they fail and +1 in other case.

Mycin goals may be derived from other rules inside the same source file or may be imported using a use_module/1 declaration, the same used to import Prolog predicates.

Note that rule bodies may also contain logical connectives as ;/2, ->/2 and +/2 (if/3 is not allowed), however their usage is discouraged. Meta-programming practiques are also strongly discouraged.

Some examples of mycin rulebases may be found along with this distribution at path mycin_rulebase/Examples.

Declaring Mycing metarules

A mycin metarule is just a mycin rule where its certainty factor is calculated at runtime via Prolog goals.

Metarule heads differ from rule heads in the Certainty Factor, which must be a variable. Such variable should be further instantiated to a valid certainty factor at runtime. For example:

 weather(Forecast) cf Certainty :-
     forecasting:weather_forecast(Forecast,Probability),
     Certainty is (Probability * 2) - 1.

Metarule bodies differ from rule bodies because they are treated as Prolog clause bodies, so they may fail. In such case a certainty factor of 0 will be used for that rule. Calling mycin goal from metarule bodies is not possible unless cf/2 predicate is used.

Metarules are supposed to retrieve a valid certainty factor, otherwise a certainty factor of 0 will be used, too. The programmer must take care of such constraint.

The porpouse of metarules is to provide a simple way to perform mycin inference from data or facts that may be stored in databases or other external resources.