【问题标题】:Does anyone know what the SLD tree for this prolog code could be?有谁知道这个序言代码的 SLD 树可能是什么?
【发布时间】:2020-07-06 21:20:00
【问题描述】:

所以这是一个序言代码,我无法弄清楚 SLD 树是什么。我知道它不应该在深度优先分辨率下工作,我只想用树来可视化它。

    single(Person) :- not(married(Person)), man(Person).
   
    married(john).

    man(john).
    man(frank).

提前致谢!

【问题讨论】:

    标签: prolog sld-resolution


    【解决方案1】:

    不确定,但这是我想出的。

    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)*
    

    到此为止,我想,是由于失败而被砍掉的。 希望我对您有所帮助。

    【讨论】:

      猜你喜欢
      • 2014-03-31
      • 1970-01-01
      • 1970-01-01
      • 2016-05-13
      • 2012-09-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多