<!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>An overview of the ABC Repair System for Datalog-like Theories</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Xue Li</string-name>
          <email>xue.shirley.li@ed.ac.uk</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Alan Bundy</string-name>
          <email>A.Bundy@ed.ac.uk</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>School of Informatics, University of Edinburgh</institution>
          ,
          <country country="UK">UK</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Humans are smart in revising their knowledge and concepts based on observations when they find conflicts. This ability to repair representations is also important for AI agents so that they can represent their environment correctly. This paper gives an overview of the domain-independent ABC system for repairing faulty logical theories by combining three existing techniques: abduction, belief revision and conceptual change. (A) Given an observation, represented as an assertion, and a current theory, abduction adds axioms, or deletes preconditions, which explain that observation by making the corresponding assertion derivable from the expanded theory. (B) Belief revision incorporates a new piece of information which conflicts with the input theory by either deleting old axioms or adding new preconditions to them. (C) Conceptual change uses the reformation algorithm for blocking unwanted proofs or unblocking wanted proofs. The former two techniques change an axiom as a whole, while reformation changes the language in which the theory is written. These three techniques are complementary so they are combined into one system: the ABC repair system, which is capable of repairing logical theories with better result than each individual technique alone and has been applied to applications in multiple domains. Datalog is used as ABC's underlying logic of theories, but the proposed system has the potential to be adapted to theories in other logics. Knowledge representation, Automated reasoning Automated agents use a representation of their environment (i) to interpret incoming sensory data, (ii) to infer new knowledge from old, (iii) to make plans to achieve their goals, and (iv) to predict the consequences of their actions and those of other agents. These environmental representations, which can be formalised as logical theories, are not static. They must change (i) when the environment changes, (ii) when the agent must deal with new kinds of goals, or (iii) when the agent detects that they are erroneous. Automated theory repair systems are proposed to address representation changes based on the proof of falsehoods [1, 2, 3]. Some repair systems are complementary in terms of the faults they tackled and the repair operations they generated. Thus, the ABC repair system is developed to combine abduction, belief revision and conceptual change for International Workshop on Human-Like Computing (HLC 2022), 28 -30 Sept. 2022, United Kingdom ∗The corresponding authors.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>1. Introduction
© 2022 Copyright for this paper by its authors.</p>
      <p>Use permitted under Creative Commons License Attribution 4.0</p>
      <p>
        International (CC BY 4.0).
generating more diverse repairs in a domain independent manner. No human interaction
is involved in ABC’s procedure but it may be necessary in particular applications, e.g.,
ABC is applied twice in a row in the root-cause analysis (RCA) [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], where domain experts
need to select the best repair from ABC’s output in the first step and then use it as
ABC’s input in the second step of RCA.
      </p>
      <p>
        There are abduction techniques based on machine learning approaches, e.g., [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ], but
the ABC repair system is a proof driven approach so its results are explainable. On
the other hand, abduction based explanation generators, such as [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], do not consider
negative examples so cannot restrict their learnt rules while ABC abduces explanations
for true examples under the restriction of negative examples. In addition, none of other
the diagnosis and repair systems including [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] is able to conduct conceptual change,
which modifies the language in which the theory is formalised. Some examples of ABC’s
conceptual change are given in appendix.
      </p>
      <p>
        In ABC, a Datalog-like theory [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] is diagnosed to be faulty w.r.t. a given benchmark
if it proves any negative examples or fails to prove any positive examples, which are
defined as incompatibility and insuficiency, respectively [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. Then the original theory
is repaired by breaking proofs of negative examples (ℱ () ) and/or building proofs for
positive examples ( () ). Note that by ‘negative’, we mean the examples in ℱ () are not
observed, i.e., false assertions, rather than being negations. As a result, repaired theories
will contain neither insuficiencies nor incompatibilities. The diverse repairs allow ABC a
wide range of applications to modelling human behaviours1:
      </p>
      <p>Example 1. Virtual Bargaining Game Theory.
• Modelling virtual bargaining game theory. In this game, human players need to
guess or adjust the winning strategy based only on others’ game moves. Given this
limited bandwidth, each player has to imagine what the other is thinking and plan
their play too, so called virtual bargaining. To model this process, the game setups
and a candidate of original winning strategies are given as ABC’s input theory and
1We only give the example of the virtual bargaining in this paper. Other examples can be found in the
cited papers.</p>
      <p>
        the desired game movement as the benchmark of  () and ℱ () , as in Example 1.
ABC will repair the candidate into correct winning strategies, given by Example 2.
It is particularly useful when the game setup is changed so the previous winning
strategy (A1 in Example 1) is outdated [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] so is evolved by ABC into a stronger
strategy represented by (A1’) and (TR) in Example 2. It can be seen that all
examples in  () and none in ℱ () are theorems of the repaired theory.
• Discovering the cause of a mathematical mistake. By giving the incorrect
mathematical results  as the benchmark and the correct mathematical calculation rules
ℝ as the original theory, ABC will repair ℝ into a model of the student’s incorrect
mathematical calculation rules ℝ′ which results in  [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ].
• Root cause analysis (RCA) based on system logs of network systems, where
single causes can trigger multiple failures. Taking the input theory containing the
information from system logs and domain rules, ABC system can detect missing
information that is essential to cause failures and then suggest repairs to fix root
causes [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
• Model physical theories: Equations describing a new domain (say electro-static force)
can be based on an analogy with equations for an old domain (say, gravity). Then
reformation, one of the repair approaches combined by ABC, can be used to correct
discrepancies between the new equations and observations of the environment,
leading to a correct theory of the new domain. This work is described in another
paper in this volume [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ].
      </p>
      <p>Example 2. Repaired Virtual Bargaining Game Theory.</p>
      <p>&lt; ( , ℎ, ℎ)
∧  ( ,  ) ⟹</p>
      <p>
        ( ,  )
&lt; ( , ℎ, ℎ)∧ ≠ ( ,  ) ∧  ( ,  )
2. The ABC Repair System
ABC repairs incompatibility and insuficiency by combining diferent repair approaches.
Thus, ABC has richer repair operations that are not only adding or deleting axioms; it
can also rewrite the language of the theory, e.g., rename a constant/predicate or adapt
the arity of a predicate. Particularly, ABC can add/delete preconditions from existing
rules or create new rules. More details about ABC’s repair operations w.r.t. a (possibly
failed) proof can be found in [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] and [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] §5.
      </p>
      <p>C4. Prune the Sub-optimal
Inputs:
, ℙ</p>
      <p>C1. Pre-Process</p>
      <p>C2. Detect Faults</p>
      <p>Faultfree</p>
      <p>No</p>
      <p>Yes
Success C3. Repair Faults Fail
(MSCR)</p>
      <p>Output:
{′1, !2 … }</p>
      <p>Drop</p>
      <p>
        The pipeline of ABC is given by Figure 1. Datalog is a declarative logic programming
language in first-order logic. Currently, ABC is restricted to repair Datalog-like theories,
i.e., a piece of Datalog program is seen as a logical theory based on Datalog logic. Datalog
is chosen because its deduction is decidable [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ] but it is suficiently expressive to allow a
wide range of practical applications [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] and §1.
      </p>
      <p>C1 is a pre-process which checks whether the  is self-contradictory and calculates
minimal sets of axioms by pruning redundancy. It reduces the search space of both
fault detection and repair generation. Given a minimal axiom set, faults are detected
by C2. If there is no fault, then the theory is collected as an output. Otherwise, the
information about the fault, which could be either proofs or failed proofs, is provided to
C3 to generate repairs. If no repairs can be found or the resource threshold2 is reached,
the process will be terminated with a failure to find any repaired theories.</p>
      <p>
        Otherwise, C3 generates all possible repairs for all detected faults in parallel. When
repairs which individually aim at diferent faults change diferent parts of the theory, they
can be applied at the same time, called commuting repairs. C3 computes maximal sets
of commuting repairs (MSCRs) and then applies each MSCR respectively to reduce the
search space3. Then C2 will check the remaining faults of these semi-repaired theories one
by one. Based on the number of the remaining faults and the applied repair operations,
sub-optimal theories will be pruned by C4 [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ]. This process of C2, C3 and C4 will
repeat until no repairable faulty theories are left in the process, or some threshold is
exceeded. Entrenchment scores, that represents how valuable a piece of information is,
are estimated [
        <xref ref-type="bibr" rid="ref16 ref17">16, 17</xref>
        ] and used to rank repaired theories. In addition, a set of optional
heuristics are implemented for users to choose in order to restrict repairs4.
2The depth limit of search branches and the maximum number of repair operations given by the user.
3More details can be found in §6.3 in [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ].
4More details can be found in §6.5 in [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ].
3. Conclusion
An overview of the ABC repair system, which combines abduction, belief revision and
conceptual change, is given in this paper. Detecting faults based on a given benchmark
of positive examples and negative examples allows ABC wide-ranging applications.
Meanwhile, ABC’s richer repairs make it powerful in terms of adapting knowledge
representation. ABC’s successful applications of modelling virtual bargaining game
theory, mathematics mistake causes, root-cause analysis in software system maintenance
and adapting physics theories to new domain, show its power in modelling human
behaviours by representation changes.
      </p>
      <p>Acknowledgments
This research has been supported by the Huawei funded TREAT project CIENG4721/LSC.
The first author gratefully acknowledge the support of ELIAI (The Edinburgh Laboratory
for Integrated Artificial Intelligence) EPSRC (grant no EP/W002876/1) and the second
author of UKRI grant EP/V026607/1. Meanwhile, great thanks to the HCL 2022
reviewers for their useful feedback, which improved the paper. For the purpose of open
access, authors have applied a Creative Commons Attribution (CC BY) licence to any
Author Accepted Manuscript version arising from this submission.</p>
      <p>Appendix: Examples of Conceptual Change
Two examples of conceptual change are given in this appendix, together with one of their
best repaired theories generated by the ABC system. Changes in repaired theories are
highlighted in red.</p>
      <p>• The   Theory is repaired by enriching the constant ℎ
1 , which illustrates a conceptual change.
into a variable in
Example 3. Families Theory.</p>
      <p>( ,  , ℎ) ⟹  ( ,  )
 () = { (, ),  (, )}
ℱ () = ∅
⟹ (, , ℎ)
⟹ (, , )]
(A1)
(A2)
(A3)
x
a
m
p
l
e
,

)
⟹
⟹
⟹
      ( ,

)
     
     
( ,
( ,
 ,
 ,
  
ℎ</p>
      <p>)
    )</p>
      <p>]
()
=
{      ( ,
 )
,
      ( ,
 )
}
ℱ
()
=</p>
      <p>∅
E
x
a
m
p
l
e
5
.</p>
      <p>T
w
e
e
t
y</p>
      <p>T
h
e
o
r
y
.
      (
)
⟹
  
  
(
(
)
)
  
(</p>
      <p>)
⟹
⟹
ℎ
   
(</p>
      <p>)
   
  
(</p>
      <p>)
⟹
⟹
  
(</p>
      <p>)
,
)
}
   
ℎ
   
(    
)
,
  
(    
)
}
E
x
a
m
p
l
e
6
.</p>
      <p>R
e
p
a
i
r
e
d</p>
      <p>T
w
e
e
t
y</p>
      <p>T
h
e
o
r
y
w
h
i
l
e
p
e
n
g
u
i
n
  
o</p>
      <p>f
   
1
)
(
A
1</p>
      <p>)
(
A
2</p>
      <p>)
(
A
3</p>
      <p>)
(
A
1</p>
      <p>)
(
A
2</p>
      <p>)
(
A
3</p>
      <p>)
(
A
4</p>
      <p>)
(
A
5</p>
      <p>)
(
A
1</p>
      <p>)
(
A
2</p>
      <p>)
(
A
3</p>
      <p>)
(
A
4</p>
      <p>)
(
A
5
)
      (
)
⟹
  
( ,
   
2</p>
      <p>)
  
( ,
  
( ,
   
1

)
)
⟹
⟹
⟹
⟹
ℎ
   
(</p>
      <p>)
   
  
(</p>
      <p>)
  
(     ,
,
)
}
   
ℎ
   
(    
)</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>P.</given-names>
            <surname>Gärdenfors</surname>
          </string-name>
          , Belief revision, volume
          <volume>29</volume>
          , Cambridge University Press,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>T. P.T.</given-names>
            <surname>Cox</surname>
          </string-name>
          ,
          <article-title>General Diagnosis by Inductive Inference</article-title>
          ,
          <source>Technical Report</source>
          , ????
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>A.</given-names>
            <surname>Bundy</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Mitrovic</surname>
          </string-name>
          ,
          <article-title>Reformation: A Domain-Independent Algorithm for Theory Repair</article-title>
          ,
          <source>Technical Report</source>
          , University of Edinburgh,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>X.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Bundy</surname>
          </string-name>
          ,
          <article-title>ABC repair system in root cause analysis by adding missing information</article-title>
          ,
          <source>in: The 8th International Online &amp; Onsite Conference on Machine Learning</source>
          , Optimization, and
          <article-title>Data Science, special session of AI for Network/Cloud Management</article-title>
          ,
          <year>2022</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>S. H.</given-names>
            <surname>Muggleton</surname>
          </string-name>
          ,
          <article-title>Learning eficient logical robot strategies involving composable objects</article-title>
          ,
          <source>in: Proceedings of the 24th International Joint Conference Artificial Intelligence (IJCAI</source>
          <year>2015</year>
          ),
          <year>2015</year>
          , pp.
          <fpage>3423</fpage>
          -
          <lpage>3429</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>R.</given-names>
            <surname>Mooney</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Bennett</surname>
          </string-name>
          ,
          <article-title>A domain independent explanation-based generalizer</article-title>
          ,
          <source>in: Proceedings of AAAI-86</source>
          , Morgan Kaufmann,
          <year>1986</year>
          , pp.
          <fpage>551</fpage>
          -
          <lpage>555</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>R.</given-names>
            <surname>Reiter</surname>
          </string-name>
          ,
          <article-title>A theory of diagnosis from first principles</article-title>
          ,
          <source>Artificial intelligence 32</source>
          (
          <year>1987</year>
          )
          <fpage>57</fpage>
          -
          <lpage>95</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>S.</given-names>
            <surname>Ceri</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Gottlob</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Tanca</surname>
          </string-name>
          ,
          <article-title>Logic Programming</article-title>
          and Databases, Surveys in Computer Science, Springer-Verlag, Berlin,
          <year>1990</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>X.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Bundy</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Smaill</surname>
          </string-name>
          ,
          <article-title>ABC repair system for Datalog-like theories</article-title>
          ,
          <source>in: KEOD</source>
          ,
          <year>2018</year>
          , pp.
          <fpage>333</fpage>
          -
          <lpage>340</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>A.</given-names>
            <surname>Bundy</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Philalithis</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <article-title>Modelling virtual bargaining using logical representation change</article-title>
          ,
          <source>in: Machine Intelligence 21 workshop</source>
          ,
          <year>2020</year>
          , pp.
          <fpage>1135</fpage>
          -
          <lpage>1149</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>J. W. Q.</given-names>
            <surname>Tang</surname>
          </string-name>
          , Arithmetic Errors Revisited:
          <article-title>Diagnosis and Remediation of Erroneous Arithmetic Performance as Repair of Faulty Representations</article-title>
          ,
          <source>Msc thesis</source>
          , School of Informatics, University of Edinburgh,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <surname>C.-H. Cai</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>Bundy</surname>
          </string-name>
          ,
          <article-title>Repairing numerical equations in analogically blended theories using reformation</article-title>
          , in: A.
          <string-name>
            <surname>Bundy</surname>
          </string-name>
          , D. Mareschal (Eds.),
          <source>Proceedings of HLC</source>
          <year>2022</year>
          , CEUR,
          <year>2022</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>X.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <article-title>Automating the Repair of Faulty Logical Theories</article-title>
          ,
          <source>Ph.D. thesis</source>
          , School of Informatics, University of Edinburgh,
          <year>2021</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>F.</given-names>
            <surname>Pfenning</surname>
          </string-name>
          , Datalog, Lecture
          <volume>26</volume>
          ,
          <fpage>15</fpage>
          -
          <lpage>819K</lpage>
          : Logic Programming,
          <year>2006</year>
          . URL: https: //www.cs.cmu.edu/~fp/courses/lp/lectures/26-datalog.pdf.
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>M.</given-names>
            <surname>Urbonas</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Bundy</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Casanova</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <article-title>The use of max-sat for optimal choice of automated theory repairs</article-title>
          , in: M.
          <string-name>
            <surname>Bramer</surname>
          </string-name>
          , R. Ellis (Eds.),
          <source>Artificial Intelligence XXXVII</source>
          , Springer International Publishing, Cham,
          <year>2020</year>
          , pp.
          <fpage>49</fpage>
          -
          <lpage>63</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <given-names>X.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Bundy</surname>
          </string-name>
          ,
          <article-title>Measuring axiom and precondition entrenchment for Datalog theory repair</article-title>
          ,
          <source>in: Technical report</source>
          ,
          <year>2022</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>X.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Bundy</surname>
          </string-name>
          , E. Philalithis,
          <article-title>Signature entrenchment and conceptual changes in automated theory repair</article-title>
          ,
          <source>in: The Ninth Annual Conference on Advances in Cognitive Systems</source>
          ,
          <year>2021</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>