Top Banner
Prolog Visualizer Tutorial
25

Prolog Visualizer

Jan 11, 2017

Download

Education

Zhixuan Lai
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Prolog Visualizer

Prolog VisualizerTutorial

Page 2: Prolog Visualizer

Visualization

Program

Controls

Examples

Page 3: Prolog Visualizer

Step 0 of 144

This is where you start

Step 1 of 144

Page 4: Prolog Visualizer

Step 0 of 144

Initial goal A copy of the program

Step 1 of 144

Page 5: Prolog Visualizer

Step 0 of 144

Dashed box indicates the current state of the search

Step 1 of 144

Page 6: Prolog Visualizer

Step 0 of 144

Unifying

Step 2 of 144

Page 7: Prolog Visualizer

Step 0 of 144

Unification failed because the names of the clauses are different

Step 3 of 144

Page 8: Prolog Visualizer

Step 0 of 144

Failed rules are crossed out

Step 4 of 144

Page 9: Prolog Visualizer

Step 0 of 144

These rules failed too

Step 16 of 144

Page 10: Prolog Visualizer

Step 0 of 144

But not this rule

Step 17 of 144

Page 11: Prolog Visualizer

Step 0 of 144

substitutionbefore

after

Applying the substitution, you get a new rule

This rule unifies with the goal

Step 18 of 144

Page 12: Prolog Visualizer

Step 0 of 144

Current goal is duplicated here for better readability

Step 18 of 144

Page 13: Prolog Visualizer

Step 0 of 144

Body of the rule after substitution

Step 19 of 144

Page 14: Prolog Visualizer

Step 0 of 144

grandfather(X, Y) is replaced by father(X, Z)

and father(Z, Y). these are the new goals

Current state has changed

Step 20 of 144

Page 15: Prolog Visualizer

Step 0 of 144

The grey path shows where you came from

current goal is in bold

Step 20 of 144

Page 16: Prolog Visualizer

Step 0 of 144

Unifying

Step 21 of 144

Page 17: Prolog Visualizer

Step 0 of 144

This rule also succeeds

Step 22 of 144

Page 18: Prolog Visualizer

This is a partial solutionIf X is orville, any Y such that

father(abe, Y) will be a solution

father(Z, Y) is the is new goal. After the substitution (X = oriville, Z = abe), it

becomes father(abe, Y)

Step 23 of 144

Page 19: Prolog Visualizer

Current state has changed

Step 24 of 144

Page 20: Prolog Visualizer

Unifying

Step 28 of 144

Page 21: Prolog Visualizer

Succeeded

Step 29 of 144

Page 22: Prolog Visualizer

This leads to a solution

Step 31 of 144

Page 23: Prolog Visualizer

Backtrack

Step 44 of 144

Page 24: Prolog Visualizer

More solutions…

Step 66 of 144

Page 25: Prolog Visualizer