"Undefined procedure" error
- From: "Eren Aykin" <erenaykin@xxxxxxxxx>
- Date: 28 May 2006 13:17:57 -0700
Hello everybody.
I'm trying to write a simple automobile diagnosis expert system.
I want the user to enter the certainty of some facts about the car.
Then I want the program to print all the new conclusions it produces.
I'm using SWI Prolog and the code is like this:
min(X,Y,Min) :- X<Y,!,Min=X;Min=Y.
max(X,Y,Max) :- X>=Y,!,Max=X;Max=Y.
:- op(800, fx, if).
:- op(700, xfx, then).
:- op(300, xfy, or).
:- op(200, xfy, and).
if spark_plug_wrong and gasoline_motor
then spark_plug_gasoline_relation :0.8.
if spark_plug_gasoline_relation or points__gasoline_relation
then gasoline_fuel_sourced:0.8.
/* rules continue like this */
go :-
new_derived_certainity(P, A), !, write(P), write(' '), write(A), nl,
assert(certainity(P, A)), go.
new_derived_certainity(Concl, B) :-
if Cond then Concl : C, not certainity(Concl, X1), certainity(Cond,
X2).
certainty(Cond1 and Cond2, Cert) :-
certainty(Cond1, Cert1), certainty(Cond2, Cert2), min(Cert1, Cert2,
Cert).
certainty(Cond1 or Cond2, Cert) :-
certainty(Cond1, Cert1), certainty(Cond2, Cert2), max(Cert1, Cert2,
Cert).
certainty(P, Cert) :-
if Cond then P : C1, certainty(Cond, C2), Cert is C1 * C2.
---------------------------------------------------------------------------------------------------
I query this program like:
assert(certainity(spark_plug_wrong, 0.7)).
assert(certainity(gasoline_motor, 0.7)).
go.
But I get the following error:
"ERROR: go/0: Undefined procedure: new_derived_certainity/2"
Does anybody has an idea about what can be the source of the error?
Any recomendations would be greatly appreciated.
Regards.
.
- Follow-Ups:
- Re: "Undefined procedure" error
- From: Pierpaolo BERNARDI
- Re: "Undefined procedure" error
- Prev by Date: Re: assigning constant to variable
- Next by Date: Re: "Undefined procedure" error
- Previous by thread: Please help me... term_expansion/2 and goal_expansion/2 under SWI
- Next by thread: Re: "Undefined procedure" error
- Index(es):
Relevant Pages
|
|