9.4 Matching

The process of trying to satisfy a (sub)goal involves the operation called matching. When trying to satisfy the subgoal

student(Lisa, 5).

Prolog tries to find a matching fact in the database. We will get back to the details of how matching occurs later. For now, it is sufficient to note that when trying to satisfy a (sub)goal, Prolog uses a process called "matching" to find the answer to the query.


In order to understand matching, we will also need to know what a variable is. The next page introduces what variables are.

PrevLite: 9.3 Goals and subgoals
NextLite: 9.5 Variables

Prev: 9.3 Goals and subgoals
Up: 9 A simple Prolog program
Next: 9.5 Variables