English 中文(简体)
YAP Prolog的推进链条?
原标题:Forward chaining in YAP Prolog?
  • 时间:2012-05-05 23:02:53
  •  标签:
  • prolog

I need to use a forward chainer in certain Prolog problem. I would like to avoid to implement it my self from scratch with a vanilla meta-interpreter (but that is what I will have to do if no other option is available) since doing this with a meta-interpreter will be slow, and also I am sure that some good implementations should be around. Does someone know if YAP or SWI Prolog includes a native and efficient forward chainer ?. If that is the case, a pointer to how to install it/use it would be greatly appreciated.

如果这两个波季发动机上没有本地的链路器,有人会建议我根据我可以用作外部Prolog图书馆的一辆面包车会堂进行良好的开放源实施?

提前感谢。

最佳回答
问题回答

请允许我从最低逻辑的角度解释后向链和前向链条,而不是从决议的角度来看。 正常的后向链式 Pro调程序规则可视为适用左侧推导逻辑规则。 因此,基本上,当我们有一个目标P和一个规则A->P时,综合推论规则指出,我们可以将目标P改为目标A:

-------- (Id)
P |- P            G, A -> P |- A
--------------------------------- (Left ->)
        G, A -> P |- P

现在也可使用同一规则来模拟前向链式应用。 此时此刻,我们没有目标P,相反,条件A却在主食中出现。 当有一个规则A->P时,这一规则也使我们得以实现P头。 总推论规则如下:

------- (Id)
A |- A            G, A, A -> P, P |- B
--------------------------------------- (Left ->)
         G, A, A -> P |- B

我们几乎没有什么方案的想法是完全赞扬前向链进程的F(M) = M号。 我们这样做的是,我们赞扬M0、M1、M2等,只有这一进程结束时才奏效。 从介绍性数据库来看,我们采纳了在Mn+1和Mn之间计算三角洲的想法,因此可以找到一个G,使F(Mn)Mn = G(Mn-1,Mn-1)的工作相对较少。

目前,G公司的实施可能会 st浅,因为重复数据目前尚未消除。 在允许消除事实的前向链中,可以采用特别的前向规则消除重复。 完整的前向链系统应当能够排除事实,然后可以用来实施制约解决制度。

但是,现在让它有简单的想法和相应的简单法典。

The G Function (delta/2) from the F Function (the original rules)
http://www.xlog.ch/jekejeke/forward/delta.p

The Toy Expert System with Forward Chaining
http://www.xlog.ch/jekejeke/forward/expert.p





相关问题
Prolog : Learning by example

I am trying to learn a little bit about swi-prolog (beyond the basic, useless programs). Can anyone explain (perhaps in pseudocode) what this sudoku solver and the related functions are doing? If ...

Working with lists in Prolog

First off let me state that this is part of a class exercise given as homework. But, the entire assignment is much more involved than the subject of this question. So.. I am searching through two ...

SWI-Prolog conditional statements

I m trying to write a function that will test to see if the word hello is contained in a list. If it is contained, i don t want it to say "true", i want it to say : "yes, the word hello is contained ...

prolog cut off in method

I have a question I would like to ask you something about a code snippet: insert_pq(State, [], [State]) :- !. insert_pq(State, [H|Tail], [State, H|Tail]) :- precedes(State, H). insert_pq(State, [...

Max out of values defined by prolog clauses

I know how to iterate over lists in Prolog to find the maximum, but what if each thing is a separate clause? For example if I had a bunch of felines and their ages, how would I find the oldest kitty? ...

热门标签