PPT Slide
When Prolog is trying to solve a goal
it starts with the first rule ( or fact ) in its database whose left side MATCHES the goal.
G( Y1 , Y2 , … , Yn ) : - S1( Y1 , Y2 , … , Yn ) ,
S3( Y1 , Y2 , … , Yn ) , …
It proceeds, left-to-right, trying to solve the first subgoal.
If a subgoal succeeds, it goes on to the next.
If a subgoal fails, it backs up to try for another solution to the previous subgoal.
If the first subgoal fails, it goes on to the next rule in the database whose left side matches the goal.
S E A R C H I N G and B A C K T R A C K I N G