prolog
play

Prolog sword(Lancelot) sword(Arthur) shield(Lancelot) - PowerPoint PPT Presentation

Prolog sword(Lancelot) sword(Arthur) shield(Lancelot) shield(Arthur) crown(Arthur) king(X) :- sword(X), shield(X), crown(X) ?- king(X) Prolog ?- king(X) Prolog ?- king(X) X = Z ?- sword(Z), shield(Z),


  1. Prolog • sword(Lancelot) • sword(Arthur) • shield(Lancelot) • shield(Arthur) • crown(Arthur) • king(X) :- sword(X), shield(X), crown(X) • ?- king(X)

  2. Prolog ?- king(X)

  3. Prolog ?- king(X) X = Z ?- sword(Z), shield(Z), crown(Z)

  4. Prolog ?- king(X) X = Z ?- sword(Z), shield(Z), crown(Z) Z = Lancelot ?- shield(Lancelot), crown(Lancelot)

  5. Prolog ?- king(X) X = Z ?- sword(Z), shield(Z), crown(Z) Z = Lancelot ?- shield(Lancelot), crown(Lancelot) ?- crown(Lancelot)

  6. Prolog ?- king(X) X = Z ?- sword(Z), shield(Z), crown(Z) Z = Arthur Z = Lancelot ?- shield(Lancelot), crown(Lancelot) ?- shield(Arthur), crown(Arthur) ?- crown(Lancelot)

  7. Prolog ?- king(X) X = Z ?- sword(Z), shield(Z), crown(Z) Z = Arthur Z = Lancelot ?- shield(Lancelot), crown(Lancelot) ?- shield(Arthur), crown(Arthur) ?- crown(Lancelot) ?- crown(Arthur)

  8. Prolog king(X) X = Z sword(Z), shield(Z), crown(Z) Z = Arthur Z = Lancelot shield(Lancelot), crown(Lancelot) shield(Arthur), crown(Arthur) crown(Lancelot) crown(Arthur)

  9. But how much does a duck weigh?

  10. May we burn her? • witch(X):-burns(X),female(X). • burns(X):-wooden(X). • wooden(X):-floats(X). • floats(X):-sameweight(duck, X). • female(suspect1). • female(suspect2). • sameweight(duck,suspect1).

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend