Basic Prolog problem
From: Tjitze Rienstra (tjitze_at_gmail.com)
Date: 10/04/04
- Next message: Ralf Schmitt: "Little problem with SWI example"
- Previous message: Jan Wielemaker: "Re: How to combine JAVA and SWI-PROLOG"
- Next in thread: reader: "Re: Basic Prolog problem"
- Reply: reader: "Re: Basic Prolog problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 4 Oct 2004 13:41:10 -0700
Hi
I'm working with a knowledge base for which I wrote some predicates
that assert facts which can be deducted from facts that are already
present. The details don't really matter, what I get stuck at is this:
If fact(A, B) is true then fact(B, A) is also true
I could assert fact(A, B) if fact(B, A) exists, which is what I did,
but then I thought that's not a nice solution because it really is
redundant data. I therefore created the rule
fact(A, B) :- fact(B, A).
which, for a reason that was obvious when I saw the output, doesn't
work when fact(B, A) doesn't exist.
Is there a way to implement this rule in a correct manner, without
asserting the facts? I'm sure this is basic stuff but I can't find the
solution anywhere.
Thanks in advance,
T
- Next message: Ralf Schmitt: "Little problem with SWI example"
- Previous message: Jan Wielemaker: "Re: How to combine JAVA and SWI-PROLOG"
- Next in thread: reader: "Re: Basic Prolog problem"
- Reply: reader: "Re: Basic Prolog problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|