有谁知道这个序言代码的 SLD 树是什么?
Does anyone know what the SLD tree for this prolog code could be?
所以这是序言代码,我无法弄清楚 SLD 树是什么。我知道它不应该在深度优先分辨率下工作,我只想用树来可视化它。
single(Person) :- not(married(Person)), man(Person).
married(john).
man(john).
man(frank).
提前致谢!
不确定,但这是我想到的。
single(Person)
|
not(married(Person)),man(Person)
|
married(Person),!,fail,man(Person)
|
(Person = John)
|
married(John),!,fail, man(John)
|
!,fail, man(John)
|
*fail, man(John)*
到这里就结束了,我想是因为失败然后被剪掉了。
希望我有所帮助。
所以这是序言代码,我无法弄清楚 SLD 树是什么。我知道它不应该在深度优先分辨率下工作,我只想用树来可视化它。
single(Person) :- not(married(Person)), man(Person).
married(john).
man(john).
man(frank).
提前致谢!
不确定,但这是我想到的。
single(Person)
|
not(married(Person)),man(Person)
|
married(Person),!,fail,man(Person)
|
(Person = John)
|
married(John),!,fail, man(John)
|
!,fail, man(John)
|
*fail, man(John)*
到这里就结束了,我想是因为失败然后被剪掉了。 希望我有所帮助。