can we OR the clauses for satisfying the rule??

From: xunitinmullik (nitin_mullik_at_yahoo.com)
Date: 12/10/03


Date: 9 Dec 2003 17:19:29 -0800

I am a network programer trying prolog for leisure and analysing its
use in network scenerios.
I want to know if v can define logic rule in prolog which is true if
even one of the clauses defining it is true.To be more specific
consider the scenerio wherein a query enroute(X,Y) run on a router
returns true if router X occurs in the route from the origin router to
router Y. The basic predicates are in the form of static routes that
exist in the network topology i.e. static_route(X,Y) if the routers X
and Y are directly connected.
I tried using
enroute(X,Y):-static_route(X,Z),
              enroute(Z,Y),
              X\=Y.
But then the traced execution showed that it ended up doing
static_route(A,A) and ending up giving 'no' as output.
Any help will be of great help.

Nitin Mullik
Sr. Network Programmer
www.infosys.com



Relevant Pages

  • Re: can we OR the clauses for satisfying the rule??
    ... > I am a network programer trying prolog for leisure and analysing its ... > use in network scenerios. ... > returns true if router X occurs in the route from the origin router to ...
    (comp.lang.prolog)
  • Re: can we OR the clauses for satisfying the rule??
    ... > I am a network programer trying prolog for leisure and analysing its ... > use in network scenerios. ... > returns true if router X occurs in the route from the origin router to ... to think in terms of "lists of lists", ...
    (comp.lang.prolog)