<戻る>

--- This is prolog4.doc ---
1.prolog data spec
  h=horn/history,g=goal,s=substt,o=chgodr,r=rename
  <HISTORY OF GOAL,LAST->TOP=((pure)/,ans/,query)>
  <resolution mode> --------------------------------------------------------
  DB         0:pure,1:ans,2:query
  <Horn input>    --------------------------------------------------------
  hn         Horn clause next input #
  hnp[hn].hnt     Horn clause
  <Goal history>   --------------------------------------------------------
  g1         resolution count ( = unify )
  gn         the g1-th resolution Goal clause top (gn->gn+g2-1)
  g2         the g1-th resolution unify Goal clause #
  h1         current matching Horn # (0:pure,-1:bltp,<=hn:unify)
  h1p[g1]       =h1:unify Horn clause # history
  h2p[g1]       =gn:unify Goal clause top  (old unified Horn body)
  h2c[g1]       =g2:unify Goal clause count (old unified Horn body)
  <resolution Horn> --------------------------------------------------------
  hnp[h1].hnt     recent unify Horn clause
  <resolution Goal> --------------------------------------------------------
  glp[gn].glt     Goal clause history (the g1-th resolution Goal)
  <matching>     --------------------------------------------------------
  h0         start try matching Horn # -> current # = h1
  cgp[g2].cgt     recent unify Goal clause
  gp         Goal clause predicate
  hp         Horn clause predicate
  uhc         recent unify Horn clause (hnp[h1].hnt substt)
  hc         recent unify Horn clause body
  <substitute>    --------------------------------------------------------
  ih         substt Horn var search pos
  ig         substt Goal var search pos
  sg         substt Goal clause cgp[g2].cgt (hc=hcl+sg+hcr)
  sh         substt Horn clause hc (cgp[g2].cgt=cgl+sh+cgr)
  sb         pick up in term from substt hc/cgp[g2].cgt
  s1         pick up out var
  var         var exist
  subsw        1=cont,2=skip,3=false,4=true,9=err <- unify
  <chgodr>      --------------------------------------------------------
  od         chgodr Goal no var terms
  og         chgodr Goal include var terms
  <rename>      --------------------------------------------------------
  rn         renaming cgp[g2].cg/hc
  rnn         renaming rn 1 char ascii
  r1c         renaming var tag (・=Goal/#=Horn) as X#n
  <dot notation>   --------------------------------------------------------
  hdot        list sep | exist in substt hc ih
  gdot        list sep | exist in substt cgp[g2].cgt ig
  <varsub>      --------------------------------------------------------
  hvar        var exist in substt hc ih
  gvar        var exist in substt cgp[g2].cgt ig
  <getpred>     --------------------------------------------------------
  t1         getpred in clause, out body
  t2         getpred out predicate

  <other>      --------------------------------------------------------
  ncutpos       cut operator pos of current Goal
  ocutpos       cut operator pos of old resolution Goal
  ms         msgout message
  op[]        comp operand
  quryall       query mode gg list
           --------------------------------------------------------

2.General logic flow
  (1) waiting for work,if goal input->(2)
  (2) test if unifiable horn clause exist yes->(4),no->(3)
  (3) test if builtin predicates yes->(7),no->(5)
  (4) test if matching ok (by substt) yes->(6),no->(5)
  (5) matching fail,back-track->(2) or (1)
  (6) make new goal clause NULL->(1),<>NULL->(2)
  (7) builtin predicates ans->(1),query->(5)