<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>How to do it with LPS (Logic-based Production System)</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Robert Kowalski</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Fariba Sadri</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Miguel Calejo</string-name>
        </contrib>
      </contrib-group>
      <abstract>
        <p>LPS is a logic and computer language in which computation performs actions, to make goals true, using beliefs about what is already true.</p>
      </abstract>
      <kwd-group>
        <kwd>LPS</kwd>
        <kwd>logic programming</kwd>
        <kwd>reactive rules</kwd>
        <kwd>goals</kwd>
        <kwd>beliefs</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>1 Imperial College London, UK</p>
      <p>2 interprolog.com</p>
      <p>
        LPS [
        <xref ref-type="bibr" rid="ref6 ref7">6, 7</xref>
        ] aims to bridge the gap between logical and imperative computer languages.
The logical nature of LPS is reflected in its view of computation as performing
actions to make goals true. Goals include both reactive rules of form if antecedent then
consequent and constraints. The imperative nature of LPS is reflected in the use of
reactive rules, to make consequents true whenever antecedents become true, and the
use of constraints to prevent unwanted actions.
      </p>
      <p>LPS includes beliefs as logic program clauses of the form conclusion if conditions.
Clauses have an imperative interpretation as procedures, which decompose the
problem of determining whether a conclusion is true or of making a conclusion true, to the
sub-problem of determining or making the conditions true.</p>
      <p>LPS also includes destructive change of state, to construct a model, to make goals
true. Models in LPS are similar to possible worlds in modal logic. But models in LPS
are classical, non-modal structures, with an explicit representation of time and events.</p>
      <p>
        LPS shares the notion of computation as model-generation with the modal
language MetaTem [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. However, MetaTem uses frame axioms to construct possible
worlds, and simulates logic programs by reactive rules. LPS shares the use of
destructive change of state with Transaction Logic [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. However, Transaction Logic uses a
possible world semantics, and simulates reactive rules by logic programs.
      </p>
      <p>
        LPS is a direct descendant of abductive logic programming (ALP) [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. Abduction
in ALP is used both to generate external event to explain past observations, and (as in
LPS) to generate actions to achieve future states of affairs.
      </p>
      <p>LPS can be viewed as a BDI (Belief, Desire, Intention) language, in which beliefs
are logic programs, and desires are reactive-rules. LPS does not have a separate
“intention” component. Intentions are replaced by search strategies for exploring the
search space generated by goals and by beliefs that reduce goals to subgoals.</p>
      <p>BDI languages are sometimes formalised in modal logics, but all practical
implementations are procedural representations. In practical BDI languages, plans are used
to represent both logic programs and reactive rules. This dual use of plans is one of
the main reasons practical BDI languages do not have a logical semantics.</p>
      <p>
        LPS is a programming, database and AI language; but its AI character has been
deliberately scaled down, for practical purposes. LPS shares this unifying, but
practical orientation with Prolog, Datalog, LogiQL from LogicBloX [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] and Yedalog at
Google [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. But, while these languages are all based on logic programming, LPS is
based on the use of destructive change of state to make goals true. Logic programs
still play an important role, but one that is subordinate to goals.
      </p>
      <p>LPS provides novel solutions to classic computing problems. For example, a
program for bubble sort, driven by a reactive rule that swaps items at adjacent locations if
they are out of order, will swap the items at all out-of-order adjacent locations
simultaneously. A constraint prevents an item from being swapped with two different
neighbours at the same time. In case there are several alternative ways to satisfy the
goals, LPS chooses one of the alternatives and commits to it arbitrarily.</p>
      <p>The same general strategy applies to the dining philosophers problem, specified by
the goal that all philosophers must eventually dine. The solution is a logic program
that defines dining as picking up two adjacent forks simultaneously, eating, and then
putting down the two forks simultaneously. Logic programs also define the laws
governing change of state, namely that putting down a fork initiates its availability, and
picking up a fork terminates its availability. Finally, the action of picking up a fork is
constrained, by specifying that a fork can be picked up only if it is available, and that
two philosophers cannot pick up the same fork simultaneously.</p>
      <p>
        LPS can also be viewed as a scaled-down model of human thinking. The
representation of goals in LPS is supported by their similarity to condition-action rules in
production systems, which are one of the most influential computational models of
human thinking. The representation of beliefs as logic programs in LPS is supported
both by psychological studies of human reasoning, such as [
        <xref ref-type="bibr" rid="ref10 ref8">8, 10</xref>
        ], and by normative
models, such as [
        <xref ref-type="bibr" rid="ref8 ref9">8, 9</xref>
        ].
      </p>
      <p>The online, open-source prototype of LPS is accessible from lps.doc.ac.uk.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Aref</surname>
            <given-names>M.</given-names>
          </string-name>
          et al (
          <year>2015</year>
          ).
          <article-title>Design and implementation of the LogicBlox system</article-title>
          .
          <source>ACM SIGMOD International Conference on Management of Data ACM</source>
          ,
          <fpage>1371</fpage>
          -
          <lpage>1382</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Barringer</surname>
          </string-name>
          , H. et al. (
          <year>1996</year>
          ).
          <article-title>The imperative future: principles of executable temporal logic</article-title>
          . John Wiley &amp; Sons, Inc.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Bonner</surname>
            ,
            <given-names>A.J.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Kifer</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          (
          <year>1994</year>
          ).
          <article-title>An overview of transaction logic</article-title>
          .
          <source>Theoretical Computer Science</source>
          ,
          <volume>133</volume>
          (
          <issue>2</issue>
          ),
          <fpage>205</fpage>
          -
          <lpage>265</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Chin</surname>
            <given-names>B</given-names>
          </string-name>
          , et al (
          <year>2015</year>
          )
          <article-title>Yedalog: Exploring knowledge at scale</article-title>
          .
          <source>Leibniz International Proceedings in Informatics</source>
          (Vol.
          <volume>32</volume>
          ). Dagstuhl.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Kakas</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kowalski</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Toni</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          (
          <year>1998</year>
          )
          <article-title>The Role of Logic Programming in Abduction</article-title>
          .
          <source>Handbook of Logic in Artificial Intelligence and Programming</source>
          , Oxford University Press,
          <fpage>235</fpage>
          -
          <lpage>324</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Kowalski</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Sadri</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          (
          <year>2015</year>
          ).
          <article-title>Reactive Computing as Model Generation</article-title>
          . New Generation Computing,
          <volume>33</volume>
          ,
          <issue>1</issue>
          ,
          <fpage>33</fpage>
          -
          <lpage>67</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Kowalski</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Sadri</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          (
          <year>2016</year>
          ).
          <article-title>Programming in logic without logic programming</article-title>
          .
          <source>TPLP</source>
          ,
          <volume>16</volume>
          ,
          <fpage>269</fpage>
          -
          <lpage>295</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Kowalski</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          (
          <year>2011</year>
          )
          <article-title>Computational Logic</article-title>
          and Human Thinking - How to be Artificially Intelligent. C.U.P. Also: https://www.doc.ic.ac.uk/~rak/papers/newbook.pdf
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Pereira</surname>
            ,
            <given-names>L. M.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Saptawijaya</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          (
          <year>2016</year>
          ).
          <source>Programming Machine Ethics</source>
          . Springer.
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Stenning</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Van Lambalgen</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          (
          <year>2012</year>
          ).
          <article-title>Human reasoning and cognitive science</article-title>
          . MIT Press.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>