0

So this is a prolog code and I can't figure out what the SLD tree is. I know it's not supposed to work in depth-first resolution, I just want to visualize it with the tree.

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

    man(john).
    man(frank).

Thanks in advance!

false
  • 10,264
  • 13
  • 101
  • 209
Maakarov
  • 13
  • 3

1 Answers1

0

Not sure, but this is what I came up with.

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

And it ends here, I think, due to the fail and then cut. Hopefully I was helpful.