Download presentation
Presentation is loading. Please wait.
Published byMariah Nelson Modified over 5 years ago
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).
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.