title: I cannot understand how Prolog knows what the start state is in a DFA accept rule
body: <p>I worded the title the best way I could think of, but let me make it clear.  When programming a DFA in Prolog, here is a typical manner of doing so:</p>
  
  <pre><code>start(q0).
  final(q2).
  
  transition(q0, a, q1).
  transition(q1, b, q1).
  transition(q1, c, q2).
  
  accept(Symbols) :- start(StartState), accept(Symbols, StartState).
  
  accept([], State) :- final(State).
  
  accept([Symbol|Symbols], State) :- transition(State, Symbol, NextState), 
                                  accept(Symbols, NextState).
  </code></pre>
  
  <p>I understand what this code does, what its goal is, and all that.  What boggles my mind are the "accept" rules.  Again, I understand the logic behind what is being performed, but what I do not understand is the sudden usage of StartState and NextState.  These just come out of nowhere, and I don't understand how start(StartState) would even return true to begin with, much less where the value comes from.  The same with using NextState.  What values does Prolog "think" is in these and how are they accepted by the transition facts?</p>
  
  <p>If I start with the fact: start(q0)., then how is start(StartState). true?</p>