<!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>Logic Tensor Networks: Deep Learning and Logical Reasoning from Data and Knowledge?</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Luciano Serafini</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Artur d'Avila Garcez</string-name>
          <email>a.garcez@city.ac.uk</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>City University London</institution>
          ,
          <country country="UK">UK</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Fondazione Bruno Kessler</institution>
          ,
          <addr-line>Trento</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>We propose Logic Tensor Networks: a uniform framework for integrating automatic learning and reasoning. A logic formalism called Real Logic is defined on a first-order language whereby formulas have truth-value in the interval [0,1] and semantics defined concretely on the domain of real numbers. Logical constants are interpreted as feature vectors of real numbers. Real Logic promotes a well-founded integration of deductive reasoning on a knowledge-base and efficient data-driven relational machine learning. We show how Real Logic can be implemented in deep Tensor Neural Networks with the use of Google's TENSORFLOWTM primitives. The paper concludes with experiments applying Logic Tensor Networks on a simple but representative example of knowledge completion.</p>
      </abstract>
      <kwd-group>
        <kwd>Knowledge Representation</kwd>
        <kwd>Relational Learning</kwd>
        <kwd>Tensor Networks</kwd>
        <kwd>NeuralSymbolic Computation</kwd>
        <kwd>Data-driven Knowledge Completion</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        The recent availability of large-scale data combining multiple data modalities, such
as image, text, audio and sensor data, has opened up various research and
commercial opportunities, underpinned by machine learning methods and techniques [
        <xref ref-type="bibr" rid="ref12 ref17 ref18 ref5">5, 12,
17, 18</xref>
        ]. In particular, recent work in machine learning has sought to combine logical
services, such as knowledge completion, approximate inference, and goal-directed
reasoning with data-driven statistical and neural network-based approaches. We argue that
there are great possibilities for improving the current state of the art in machine learning
and artificial intelligence (AI) thought the principled combination of knowledge
representation, reasoning and learning. Guha’s recent position paper [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ] is a case in point,
as it advocates a new model theory for real-valued numbers. In this paper, we take
inspiration from such recent work in AI, but also less recent work in the area of
neuralsymbolic integration [
        <xref ref-type="bibr" rid="ref10 ref11 ref8">8, 10, 11</xref>
        ] and in semantic attachment and symbol grounding [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]
to achieve a vector-based representation which can be shown adequate for integrating
machine learning and reasoning in a principled way.
? The first author acknowledges the Mobility Program of FBK, for supporting a long term visit
at City University London. He also acknowledges NVIDIA Corporation for supporting this
research with the donation of a GPU.
      </p>
      <p>Copyright © 2016 for this paper by its authors. Copying permitted for private and academic purposes.</p>
      <p>
        This paper proposes a framework called Logic Tensor Networks (LTN) which
integrates learning based on tensor networks [
        <xref ref-type="bibr" rid="ref26">26</xref>
        ] with reasoning using first-order
manyvalued logic [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], all implemented in TENSORFLOWTM [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ]. This enables, for the first
time, a range of knowledge-based tasks using rich knowledge representation in
firstorder logic (FOL) to be combined with efficient data-driven machine learning based on
the manipulation of real-valued vectors1. Given data available in the form of real-valued
vectors, logical soft and hard constraints and relations which apply to certain subsets
of the vectors can be specified compactly in first-order logic. Reasoning about such
constraints can help improve learning, and learning from new data can revise such
constraints thus modifying reasoning. An adequate vector-based representation of the logic,
first proposed in this paper, enables the above integration of learning and reasoning, as
detailed in what follows.
      </p>
      <p>
        We are interested in providing a computationally adequate approach to
implementing learning and reasoning [
        <xref ref-type="bibr" rid="ref28">28</xref>
        ] in an integrated way within an idealized agent. This
agent has to manage knowledge about an unbounded, possibly infinite, set of objects
O = fo1; o2; : : : g. Some of the objects are associated with a set of quantitative
attributes, represented by an n-tuple of real values G(oi) 2 Rn, which we call grounding.
      </p>
      <p>For example, a person may have a grounding into a 4-tuple containing some numerical
representation of the person’s name, her height, weight, and number of friends in some
social network. Object tuples can participate in a set of relations R = fR1; : : : ; Rkg,
with Ri O (Ri), where (Ri) denotes the arity of relation Ri. We presuppose the
existence of a latent (unknown) relation between the above numerical properties, i.e.
groundings, and partial relational structure R on O. Starting from this partial
knowledge, an agent is required to: (i) infer new knowledge about the relational structure on
the objects of O; (ii) predict the numerical properties or the class of the objects in O.</p>
      <p>Classes and relations are not normally independent. For example, it may be the case
that if an object x is of class C, C(x), and it is related to another object y through
relation R(x; y) then this other object y should be in the same class C(y). In logic:
8x9y((C(x) ^ R(x; y)) ! C(y)). Whether or not C(y) holds will depend on the
application: through reasoning, one may derive C(y) where otherwise there might not
have been evidence of C(y) from training examples only; through learning, one may
need to revise such a conclusion once examples to the contrary become available. The
vectorial representation proposed in this paper permits both reasoning and learning as
exemplified above and detailed in the next section.</p>
      <p>
        The above forms of reasoning and learning are integrated in a unifying framework,
implemented within tensor networks, and exemplified in relational domains combining
data and relational knowledge about the objects. It is expected that, through an
adequate integration of numerical properties and relational knowledge, differently from the
immediate related literature [
        <xref ref-type="bibr" rid="ref1 ref2 ref9">9, 2, 1</xref>
        ], the framework introduced in this paper will be
capable of combining in an effective way first-order logical inference on open domains
with efficient relational multi-class learning using tensor networks.
      </p>
      <p>The main contribution of this paper is two-fold. It introduces a novel framework
for the integration of learning and reasoning which can take advantage of the
repre1 In practice, FOL reasoning including function symbols is approximated through the usual</p>
      <p>iterative deepening of clause depth.
sentational power of (multi-valued) first-order logic, and it instantiates the framework
using tensor networks into an efficient implementation which shows that the proposed
vector-based representation of the logic offers an adequate mapping between symbols
and their real-world manifestations, which is appropriate for both rich inference and
learning from examples.</p>
      <p>The paper is organized as follows. In Section 2, we define Real Logic. In Section
3, we propose the Learning-as-Inference framework. In Section 4, we instantiate the
framework by showing how Real Logic can be implemented in deep Tensor Neural
Networks leading to Logic Tensor Networks (LTN). Section 5 contains an example of
how LTN handles knowledge completion using (possibly inconsistent) data and
knowledge from the well-known smokers and friends experiment. Section 6 concludes the
paper and discusses directions for future work.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Real Logic</title>
      <p>
        We start from a first order language L, whose signature contains a set C of constant
symbols, a set F of functional symbols, and a set P of predicate symbols. The sentences of
L are used to express relational knowledge, e.g. the atomic formula R(o1; o2) states that
objects o1 and o2 are related to each other through binary relation R; 8xy:(R(x; y) !
R(y; x)) states that R is a symmetric relation, where x and y are variables; 9y:R(o1; y)
states that there is an (unknown) object which is related to object o1 through R. For
simplicity, without loss of generality, we assume that all logical sentences of L are in prenex
conjunctive, skolemised normal form [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ], e.g. a sentence 8x(A(x) ! 9yR(x; y)) is
transformed into an equivalent clause :A(x) _ R(x; f (x)), where f is a new function
symbol.
      </p>
      <p>As for the semantics of L, we deviate from the standard abstract semantics of FOL,
and we propose a concrete semantics with sentences interpreted as tuples of real
numbers. To emphasise the fact that L is interpreted in a “real” world, we use the term
(semantic) grounding, denoted by G, instead of the more standard interpretation2.
– G associates an n-tuple of real numbers G(t) to any closed term t of L; intuitively</p>
      <p>G(t) is the set of numeric features of the object denoted by t.
– G associates a real number in the interval [0; 1] to each clause of L. Intuitively,
G( ) represents one’s confidence in the truth of ; the higher the value, the higher
the confidence.</p>
      <p>A grounding is specified only for the elements of the signature of L. The grounding of
terms and clauses is defined inductively, as follows.</p>
      <p>Definition 1. A grounding G for a first order language L is a function from the
signature of L to the real numbers that satisfies the following conditions:
1. G(c) 2 Rn for every constant symbol c 2 C;
2. G(f ) 2 Rn (f) ! Rn for every f 2 F ;
2 In logic, the term “grounding” indicates the operation of replacing the variables of a
term/formula with constants. To avoid confusion, we use the term “instantiation” for this.
3. G(P ) 2 Rn (R)</p>
      <p>! [0; 1] for every P 2 P;
A grounding G is inductively extended to all the closed terms and clauses, as follows:
G(f (t1; : : : ; tm)) = G(f )(G(t1); : : : ; G(tm))</p>
      <p>G(P (t1; : : : ; tm)) = G(P )(G(t1); : : : ; G(tm))
G(:P (t1; : : : ; tm)) = 1</p>
      <p>G(P (t1; : : : ; tm))
G( 1 _</p>
      <p>
        _ k) = (G( 1); : : : ; G( k))
where is an s-norm operator, also known as a t-co-norm operator (i.e. the dual of some
t-norm operator). 3
Example 1. Suppose that O = fo1; o2; o3g is a set of documents defined on a finite
dictionary D = fw1; :::; wng of n words. Let L be the language that contains the binary
function symbol concat(x; y) denoting the document resulting from the concatenation
of documents x with y. Let L contain also the binary predicate Sim which is
supposed to be true if document x is deemed to be similar to document y. An example
of grounding is the one that associates to each document its bag-of-words vector [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ].
As a consequence, a natural grounding of the concat function would be the sum of
the vectors, and of the Sim predicate, the cosine similarity between the vectors. More
formally:
– G(oi) = hnowi1 ; : : : ; nowin i, where ndw is the number of occurrences of word w in
document d;
– if v; u 2 Rn, G(concat)(u; v) = u + v;
– if v; u 2 Rn, G(Sim)(u; v) = jjuujjjvjvjj .
      </p>
      <p>For instance, if the three documents are o1 = “John studies logic and plays football”, o2
= “Mary plays football and logic games”, o3 = “John and Mary play football and study
logic together”, and W =fJohn, Mary, and, football, game, logic, play, study, togetherg
then the following are examples of the grounding of terms, atomic formulas and clauses.</p>
      <p>G(o1) = h1; 0; 1; 1; 0; 1; 1; 1; 0i
G(o2) = h0; 1; 1; 1; 1; 1; 1; 0; 0i</p>
      <p>G(o3) = h1; 1; 2; 1; 0; 1; 1; 1; 1i</p>
      <p>G(concat(o1; o2)) = G(o1) + G(o2) = h1; 1; 2; 2; 1; 2; 2; 1; 0i
G(Sim(concat(o1; o2); o3) =</p>
      <p>G(concat(o1; o2)) G(o3)
jjG(concat(o1; o2))jj jjG(o3)jj
max(0:86; 0:73) = 0:86
3 Examples of t-norms which can be chosen here are Lukasiewicz, product, and Go¨del.</p>
      <p>Lukasiewicz s-norm is defined as Luk(x; y) = min(x + y; 1); Product s-norm is defined
as P r(x; y) = x + y x y; Go¨del s-norm is defined as max(x; y) = max(x; y):</p>
    </sec>
    <sec id="sec-3">
      <title>Learning as approximate satisfiability</title>
      <p>We start by defining ground theory and their satisfiability.</p>
      <p>Definition 2 (Satisfiability). Let
w 2 [0; 1]. We say that G satisfies
if v G( ) w.</p>
      <p>be a closed clause in L, G a grounding, and v
in the confidence interval [v; w], written G j=vw ,</p>
      <p>A partial grounding, denoted by G^, is a grounding that is defined on a subset of the
signature of L. A grounded theory is a set of clauses in the language of L and partial
grounding G^.</p>
      <p>Definition 3 (Grounded Theory). A grounded theory (GT) is a pair hK; G^i where K
is a set of pairs h[v; w]; (x)i, where (x) is a clause of L containing the set x of
free variables, and [v; w] [0; 1] is an interval contained in [0; 1], and G^ is a partial
grounding.</p>
      <p>Definition 4 (Satisfiability of a Grounded Theory). A GT hK; G^i is satisfiabile if
there exists a grounding G, which extends G^ such that for all h[v; w]; (x)i 2 K and
any tuple t of closed terms, G j=vw (t).</p>
      <p>
        From the previous definiiton it follows that checking if a GT hK; G^i is satisfiable
amounts to seaching for an extension of the partial grounding G^ in the space of all
possible groundings, such that all the instantiations of the clauses in K are satisfied
w.r.t. the specified interval. Clearly this is unfeasible from a practical point of view.
As is usual, we must restrict both the space of grounding and clause instantiations.
Let us consider each in turn: To check satisfiability on a subset of all the functions on
real numbers, recall that a grounding should capture a latent correlation between the
quantitative attributes of an object and its relational properties4. In particular, we are
interested in searching within a specific class of functions, in this paper based on tensor
networks, although other family of functions can be considered. To limit the number
of clause instantiations, which in general might be infinite since L admits function
symbols, the usual approach is to consider the instantiations of each clause up to a
certain depth [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].
      </p>
      <p>When a grounded theory hK; G^i is inconsitent, that is, there is no grounding G that
satisfies it, we are interested in finding a grounding which satisfies as much as possible
of hK; G^i. For any h[v; w]; i 2 K we want to find a grounding G that minimizes the
satisfiability error. An error occurs when a grounding G assigns a value G( ) to a clause
which is outside the interval [v; w] prescribed by K. The measure of this error can be
defined as the minimal distance between the points in the interval [v; w] and G( ):
Loss(G; h[v; w]; i) = jx</p>
      <p>
        G( )j; v
x
w
(1)
4 For example, whether a document is classified as from the field of Artificial Intelligence (AI)
depends on its bag-of-words grounding. If the language L contains the unary predicate AI(x)
standing for “x is a paper about AI” then the grounding of AI(x), which is a function from
bag-of-words vectors to [
        <xref ref-type="bibr" rid="ref1">0,1</xref>
        ], should assign values close to 1 to the vectors which are close
semantically to AI. Furthermore, if two vectors are similar (e.g. according to the cosine
similarity measure) then their grounding should be similar.
      </p>
      <p>Notice that if G( ) 2 [v; w], Loss(G; ) = 0.</p>
      <p>The above gives rise to the following definition of approximate satisfiability w.r.t. a
family G of grounding functions on the language L.</p>
      <p>Definition 5 (Approximate satisfiability). Let hK; G^i be a grounded theory and K0 a
finite subset of the instantiations of the clauses in K, i.e.</p>
      <p>K0</p>
      <p>fh[v; w]; (t)ig j h[v; w]; (x)i 2 K and t is any n-tuple of closed terms.g
Let G be a family of grounding functions. We define the best satisfiability problem as
the problem of finding an extensions G of G^ in G that minimizes the satisfiability error
on the set K0, that is:</p>
      <p>G = argmin</p>
      <p>X
G^ G2G h[v;w]; (t)i2K0</p>
      <p>Loss(G; h[v; w]; (t)i)
4 Implementing Real Logic in Tensor Networks
Specific instances of Real Logic can be obtained by selectiong the space G of
groundings and the specific s-norm for the interpretation of disjunction. In this section, we
describe a realization of real logic where G is the space of real tensor transformations
of order k (where k is a parameter). In this space, function symbols are interpreted
as linear transformations. More precisely, if f is a function symbol of arity m and
v1; : : : ; vm 2 Rn are real vectors corresponding to the grounding of m terms then
G(f )(v1; : : : ; vm) can be written as:</p>
      <p>G(f )(v1; : : : ; vm) = Mf v + Nf
for some n mn matrix Mf and n-vector Nf , where v = hv1; : : : ; vni.</p>
      <p>
        The grounding of m-ary predicate P , G(P ), is defined as a generalization of the
neural tensor network [
        <xref ref-type="bibr" rid="ref26">26</xref>
        ] (which has been shown effective at knowledge compilation
in the presence of simple logical constraints), as a function from Rmn to [0; 1], as
follows:
      </p>
      <p>
        G(P ) =
uTP tanh vT W P[1:k]v + VP v + BP
(2)
vwehcetorer Win P[R1:kk], iasnad 3-D tensor in Rmn mn k, VP is a matrix in Rk mn, and BP is a
is the sigmoid function. With this encoding, the grounding (i.e.
truth-value) of a clause can be determined by a neural network which first computes
the grounding of the literals contained in the clause, and then combines them using
the specific s-norm. An example of tensor network for :P (x; y) ! A(y) is shown in
Figure 1. This architecture is a generalization of the structure proposed in [
        <xref ref-type="bibr" rid="ref26">26</xref>
        ], that
has been shown rather effective for the task of knowledge compilation, also in presence
of simple logical constraints. In the above tensor network formulation, W ; V ; B and
u with 2 fP; Ag are parameters to be learned by minimizing the loss function or,
equivalently, to maximize the satisfiability of the clause P (x; y) ! A(y).
      </p>
      <p>G(P (v; u) ! A(u)</p>
      <p>max
G(:P )
G(A)
1
uP
th
+
th
+
th
+
uA
th
+
WP1</p>
      <p>WP2</p>
      <p>VP1</p>
      <p>VP2</p>
      <p>BP1</p>
      <p>BP2</p>
      <p>W A1</p>
      <p>W A2</p>
      <p>VA1</p>
      <p>VA2</p>
      <p>BA1</p>
      <p>BA2
v = hv1; : : : ; vni</p>
      <p>
        u = hu1; : : : ; uni
Logic Tensor Networks have been implemented as a Python library called ltn using
Google’s TENSORFLOWTM . To test our idea, in this section we use the well-known
friends and smokers5 example [
        <xref ref-type="bibr" rid="ref24">24</xref>
        ] to illustrate the task of knowledge completion in
ltn. There are 14 people divided into two groups fa; b; : : : ; hg and fi; j; : : : ; ng.
Within each group of people we have complete knowledge of their smoking habits.
In the first group, we have complete knowledge of who has and does not have
cancer. In the second group, this is not known for any of the persons. Knowledge about
the friendship relation is complete within each group only if symmetry of friendship is
assumed. Otherwise, it is imcomplete in that it may be known that, e.g., a is a friend
of b, but not known whether b is a friend of a. Finally, there is also general knowledge
about smoking, friendship and cancer, namely, that smoking causes cancer, friendship is
normally a symmetric and anti-reflexive relation, everyone has a friend, and that
smoking propagates (either actively or passively) among friends. All this knowledge can be
represented by the knowledge-bases shown in Figure 2.
      </p>
      <p>The facts contained in the knowledge-bases should have different degrees of truth,
and this is not known. Otherwise, the combined knowledge-base would be inconsistent
(it would deduce e.g. S(b) and :S(b)). Our main task is to complete the
knowledgebase (KB), that is: (i) find the degree of truth of the facts contained in KB, (ii) find
a truth-value for all the missing facts, e.g. C(i), (iii) find the grounding of each
constant symbol a; :::; n:6 To answer (i)-(iii), we use ltn to find a grounding that best
5 Normally, a probabilistic approach is taken to solve this problem, and one that requires
instantiating all clauses to remove variables, essentially turning the problem into a propositional one;
ltn takes a different approach.
6 Notice how no grounding is provided about the signature of the knowledge-base.</p>
      <p>SF C
Ka:::h</p>
      <p>S(a); S(e); S(f ); S(g);
:S(b); :S(c); :S(d); :S(g); :S(h);
F (a; b); F (a; e); F (a; f ); F (a; g); F (b; c);</p>
      <p>F (c; d); F (e; f ); F (g; h);
:F (a; c); :F (a; d); :F (a; h); :F (b; d); :F (b; e);
:F (b; f ); :F (b; g); :F (b; h); :F (c; e); :F (c; f );
:F (c; g); :F (c; h); :F (d; e); :F (d; f ); :F (d; g);
:F (d; h); :F (e; g); :F (e; h); :F (f; g); :F (f; h);</p>
      <p>C(a); C(e);
:C(b); :C(c); :C(d); :C(f ); :C(g); :C(h)</p>
      <p>SF
Ki:::n</p>
      <p>S(i); S(n);
:S(j); :S(k);
:S(l); :S(m);
F (i; j); F (i; m);
F (k; l); F (m; n);
:F (i; k); :F (i; l);
:F (i; n); :F (j; k);
:F (j; l); :F (j; m);
:F (j; n); :F (l; n);
:F (k; m); :F (l; m)
8x:F (x; x);
8xy(F (x; y) ! F (y; x));
8x9yF (x; y);</p>
      <p>K</p>
      <p>SF C
8xy(S(x) ^ F (x; y) ! S(y));</p>
      <p>8x(S(x) ! C(x))
approximates the complete KB. We start by assuming that all the facts contained in
the knowledge-base are true (i.e. have degree of truth 1). To show the role of
background knolwedge in the learning-inference process, we run two experiments. In the
first (exp1), we seek to complete a KB consisting of only factual knowledge: Kexp1 =
Ka:::h [ KiS::F:n. In the second (exp1), we also include background knowledge, that is:</p>
      <p>SF C
Kexp2 = Kexp1 [ KSF C .</p>
      <p>
        We confgure the network as follows: each constant (i.e. person) can have up to 30
real-valued features. We set the number of layers k in the tensor network to 10, and
the regularization parameter7 = 1 10. For the purpose of illustration, we use the
Lukasiewicz t-norm with s-norm (a; b) = min(1; a + b), and use the harmonic mean
as aggregation operator. An estimation of the optimal grounding is obtained after 5,000
runs of the RMSProp learning algorithm [
        <xref ref-type="bibr" rid="ref27">27</xref>
        ] available in TENSORFLOWTM .
      </p>
      <p>The results of the two experiments are reported in Table 1. For readability, we
use boldface for truth-values greater than 0.5. The truth-values of the facts listed in
a knowledge-base are highlighted with the same background color of the
knowledgebase in Figure 2. The values with white background are the result of the knowledge
completion produced by the LTN learning-inference procedure. To evaluate the quality
of the results, one has to check whether (i) the truth-values of the facts listed in a KB are
indeed close to 1.0, and (ii) the truth-values associated with knowledge completion
correspond to expectation. An initial analysis shows that the LTN associated with Kexp1
produces the same facts as Kexp1 itself. In other words, the LTN fits the data.
However, the LTN also learns to infer additional positive and negative facts about F and C
not derivable from Kexp1 by pure logical reasoning; for example: F (c; b), F (g; b) and
:F (b; a). These facts are derived by exploiting similarities between the groundings of
7 A smoothing factor jj jj22 is added to the loss function to create a preference for learned
parameters with a lower absolute value.</p>
      <p>F
e
F
e
Learning and reasoning on Kexp1 =
the constants generated by the LTN. For instance, G(c) and G(g) happen to present a
high cosine similarity measure. As a result, facts about the friendship relations of c
affect the friendship relations of g and vice-versa, for instance F (c; b) and F (g; b). The
level of satisfiability associated with
cally satisfiable.</p>
      <p>Kexp1
1, which indicates that Kexp1 is
classi</p>
      <p>The results of the second experiment show that more facts can be learned with the
inclusion of background knowledge. For example, the LTN now predicts that C (i) and
C (n) are true. Similarly, from the symmetry of the friendship relation, the LTN
concludes that m is a friend of i, as expected. In fact, all the axioms in the generic
background knowledge KSF C are satisfied with a degree of satisfiability higher than 90%,
apart from the smoking causes cancer axiom - which is responsible for the classical
inconsistency since in the data f and g smoke and do not have cancer -, which has a
degree of satisfiability of 77%.
6</p>
    </sec>
    <sec id="sec-4">
      <title>Related work</title>
      <p>
        In his recent note, [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ], Guha advocates the need for a new
model theory for
distributed representations (such as those based on embeddings). The note sketches a
proposal, where terms and (binary) predicates are all interpreted as points/vectors in an
n-dimensional real space. The computation of the truth-value of the atomic formulae
P (t1; : : : ; tn) is obtained by comparing the projections of the vector associated to each
ti with that associated to Pi. Real logic shares with [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ] the idea that terms must be
interpreted in a geometric space. It has, however, a different (and more general)
interpretation of functions and predicate symbols. Real logic is more general because
the semantics proposed in [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ] can be implemented within an ltn with a single layer
(k = 1), since the operation of projection and comparison necessary to compute the
truth-value of P (t1; : : : ; tm) can be encoded within an nm nm matrix W with the
constraint that hG(t1); : : : ; G(tn)iT W hG(t1); : : : ; G(tn)i , which can be encoded
easily in ltn.
      </p>
      <p>
        Real logic is orthogonal to the approach taken by (Hybrid) Markov Logic Networks
(MLNs) and its variations [
        <xref ref-type="bibr" rid="ref22 ref24 ref29">24, 29, 22</xref>
        ]. In MLNs, the level of truth of a formula is
determined by the number of models that satisfy the formula: the more models, the higher
the degree of truth. Hybrid MLNs introduce a dependency from the real features
associated to constants, which is given, and not learned. In real logic, instead, the level of
truth of a complex formula is determined by (fuzzy) logical reasoning, and the relations
between the features of different objects is learned through error minimization. Another
difference is that MLNs work under the closed world assumption, while Real Logic is
open domain. Much work has been done also on neuro-fuzzy approaches [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ]. These
are essentially propositional while real logic is first-order.
      </p>
      <p>
        Bayesian logic (BLOG) [
        <xref ref-type="bibr" rid="ref20">20</xref>
        ] is open domain, and in this respect similar to real
logic and LTNs. But, instead of taking an explicit probabilistic approach, LTNs draw
from the efficient approach used by tensor networks for knowledge graphs, as already
discussed. LTNs can have a probabilistic interpretation but this is not a requirement.
Other statistical AI and probabilistic approaches such as lifted inference fall into this
category, including probabilistic variations of inductive logic programming (ILP) [
        <xref ref-type="bibr" rid="ref23">23</xref>
        ],
which are normally restricted to Horn clauses. Metainterpretive ILP [
        <xref ref-type="bibr" rid="ref21">21</xref>
        ], together with
BLOG, seem closer to LTNs in what concerns the knowledge representation language,
but do not explore the benefits of tensor networks for computational efficiency.
      </p>
      <p>
        An approach for embedding logical knowledge onto data for the purpose of
relational learning, similar to Real Logic, is presented in [
        <xref ref-type="bibr" rid="ref25">25</xref>
        ]. Real Logic and [
        <xref ref-type="bibr" rid="ref25">25</xref>
        ] share
the idea of interpreting a logical alphabet in an n-dimensional real space.
Terminologically, the term “grounding” in Real Logic corresponds to “embeddings” in [
        <xref ref-type="bibr" rid="ref25">25</xref>
        ].
However, there are several differences. First, [
        <xref ref-type="bibr" rid="ref25">25</xref>
        ] uses function-free langauges, while
we provide also groundings for functional symbols. Second, the model used to
compute the truth-values of atomic formulas adopted in [
        <xref ref-type="bibr" rid="ref25">25</xref>
        ] is a special case of the more
general model proposed in this paper (as described in Eq. (2)). Finally, the semantics
of the universal and existential quantifiers adopted in [
        <xref ref-type="bibr" rid="ref25">25</xref>
        ] is based on the closed-world
assumption (CWA), i.e. universally (respectively, existentially) quantified formulas are
reduced to the finite conjunctions (respectively, disjunctions) of all of their possible
instantiations; Real Logic does not make the CWA. Furthermore, Real Logic does not
assume a specific t-norm.
      </p>
      <p>
        As in [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ], LTN is a framework for learning in the presence of logical constraints.
LTNs share with [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] the idea that logical constraints and training examples can be
treated uniformly as supervisions of a learning algorithm. LTN introduces two
novelties: first, in LTN existential quantifiers are not grounded into a finite disjunction, but
are scolemized. In other words, CWA is not required, and existentially quantified
formulas can be satisfied by “new individuals”. Second, LTN allows one to generate data for
prediction. For instance, if a grounded theory contains the formula 8x9yR(x; y), LTN
generates a real function (corresponding to the grounding of the Skolem function
introduced by the formula) which for every vector v returns the feature vector f (v), which
can be intuitively interpreted as being the set of features of a typical object which takes
part in relation R with the object having features equal to v.
      </p>
      <p>
        Finally, related work in the domain of neural-symbolic computing and neural
network fibring [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] has sought to combine neural networks with ILP to gain efficiency
[
        <xref ref-type="bibr" rid="ref14">14</xref>
        ] and other forms of knowledge representation, such as propositional modal logic
and logic programming. The above are more tightly-coupled approaches. In contrast,
LTNs use a richer FOL language, exploit the benefits of knowledge compilation and
tensor networks within a more loosely- coupled approach, and might even offer an
adequate representation of equality in logic. Experimental evaluations and comparison
with other neural-symbolic approaches are desirable though, including the latest
developments in the field, a good snapshot of which can be found in [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ].
7
      </p>
    </sec>
    <sec id="sec-5">
      <title>Conclusion and future work</title>
      <p>We have proposed Real Logic: a uniform framework for learning and reasoning.
Approximate satisfiability is defined as a learning task with both knowledge and data
being mapped onto real-valued vectors. With an inference-as-learning approach, relational
knowledge constraints and state-of-the-art data-driven approaches can be integrated.
We showed how real logic can be implemented in deep tensor networks, which we call
Logic Tensor Networks (LTNs), and applied efficiently to knowledge completion and
data prediction tasks. As future work, we will make the implementation of LTN
available in TENSORFLOWTM and apply it to large-scale experiments and relational learning
benchmarks for comparison with statistical relational learning, neural-symbolic
computing, and (probabilistic) inductive logic programming approaches.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>Cognitive</given-names>
            <surname>Computation</surname>
          </string-name>
          :
          <source>Integrating Neural and Symbolic Approaches</source>
          , Workshop at NIPS 2015, Montreal, Canada,
          <year>April 2016</year>
          .
          <article-title>CEUR-WS 1583</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>Knowledge</given-names>
            <surname>Representation</surname>
          </string-name>
          and
          <article-title>Reasoning: Integrating Symbolic and Neural Approaches</article-title>
          , AAAI Spring Symposium, Stanford University, CA, USA, March
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>Dimitris</given-names>
            <surname>Achlioptas</surname>
          </string-name>
          .
          <article-title>Random satisfiability</article-title>
          .
          <source>In Handbook of Satisfiability</source>
          , pages
          <fpage>245</fpage>
          -
          <lpage>270</lpage>
          .
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>Leon</given-names>
            <surname>Barrett</surname>
          </string-name>
          , Jerome Feldman, and
          <article-title>Liam MacDermed. A (somewhat) new solution to the variable binding problem</article-title>
          .
          <source>Neural Computation</source>
          ,
          <volume>20</volume>
          (
          <issue>9</issue>
          ):
          <fpage>2361</fpage>
          -
          <lpage>2378</lpage>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>Yoshua</given-names>
            <surname>Bengio</surname>
          </string-name>
          .
          <article-title>Learning deep architectures for ai</article-title>
          .
          <source>Found. Trends Mach. Learn.</source>
          ,
          <volume>2</volume>
          (
          <issue>1</issue>
          ):
          <fpage>1</fpage>
          -
          <lpage>127</lpage>
          ,
          <year>January 2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>M.</given-names>
            <surname>Bergmann</surname>
          </string-name>
          .
          <article-title>An Introduction to Many-Valued and Fuzzy Logic: Semantics, Algebras, and Derivation Systems</article-title>
          . Cambridge University Press,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>David</surname>
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <surname>Blei</surname>
            ,
            <given-names>Andrew Y.</given-names>
          </string-name>
          <string-name>
            <surname>Ng</surname>
            , and
            <given-names>Michael I.</given-names>
          </string-name>
          <string-name>
            <surname>Jordan</surname>
          </string-name>
          .
          <article-title>Latent dirichlet allocation</article-title>
          .
          <source>J. Mach. Learn. Res.</source>
          ,
          <volume>3</volume>
          :
          <fpage>993</fpage>
          -
          <lpage>1022</lpage>
          ,
          <year>March 2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8. Le´
          <article-title>on Bottou. From machine learning to machine reasoning</article-title>
          .
          <source>Technical report, arXiv.1102</source>
          .
          <year>1808</year>
          ,
          <year>February 2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Artur S. d'Avila Garcez</surname>
            , Marco Gori, Pascal Hitzler, and Lu´ıs
            <given-names>C.</given-names>
          </string-name>
          <string-name>
            <surname>Lamb</surname>
          </string-name>
          .
          <article-title>Neural-symbolic learning and reasoning (dagstuhl seminar 14381)</article-title>
          .
          <source>Dagstuhl Reports</source>
          ,
          <volume>4</volume>
          (
          <issue>9</issue>
          ):
          <fpage>50</fpage>
          -
          <lpage>84</lpage>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Artur S. d'Avila Garcez</surname>
            , Lu´ıs
            <given-names>C.</given-names>
          </string-name>
          <string-name>
            <surname>Lamb</surname>
          </string-name>
          , and
          <string-name>
            <surname>Dov</surname>
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <surname>Gabbay</surname>
          </string-name>
          .
          <source>Neural-Symbolic Cognitive Reasoning. Cognitive Technologies</source>
          . Springer,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Michelangelo</surname>
            <given-names>Diligenti</given-names>
          </string-name>
          , Marco Gori, Marco Maggini, and
          <string-name>
            <given-names>Leonardo</given-names>
            <surname>Rigutini</surname>
          </string-name>
          .
          <article-title>Bridging logic and kernel machines</article-title>
          .
          <source>Machine Learning</source>
          ,
          <volume>86</volume>
          (
          <issue>1</issue>
          ):
          <fpage>57</fpage>
          -
          <lpage>88</lpage>
          ,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>David</surname>
          </string-name>
          Silver et al.
          <article-title>Mastering the game of go with deep neural networks and tree search</article-title>
          .
          <source>Nature</source>
          ,
          <volume>529</volume>
          :
          <fpage>484</fpage>
          -
          <lpage>503</lpage>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>Mart</surname>
          </string-name>
          <article-title>´ın Abadi et al</article-title>
          .
          <source>TensorFlow: Large-scale machine learning on heterogeneous systems</source>
          ,
          <year>2015</year>
          .
          <article-title>Software available from tensorflow</article-title>
          .
          <source>org.</source>
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <surname>Manoel V. M.</surname>
          </string-name>
          <article-title>Franc¸a, Gerson Zaverucha, and Artur S. d'Avila Garcez</article-title>
          .
          <article-title>Fast relational learning using bottom clause propositionalization with artificial neural networks</article-title>
          .
          <source>Machine Learning</source>
          ,
          <volume>94</volume>
          (
          <issue>1</issue>
          ):
          <fpage>81</fpage>
          -
          <lpage>104</lpage>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <given-names>Ramanathan</given-names>
            <surname>Guha</surname>
          </string-name>
          .
          <article-title>Towards a model theory for distributed representations</article-title>
          .
          <source>In 2015 AAAI Spring Symposium Series</source>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          16.
          <string-name>
            <given-names>Michael</given-names>
            <surname>Huth</surname>
          </string-name>
          and
          <string-name>
            <given-names>Mark</given-names>
            <surname>Ryan</surname>
          </string-name>
          .
          <source>Logic in Computer Science: Modelling and Reasoning About Systems</source>
          . Cambridge University Press, New York, NY, USA,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          17.
          <string-name>
            <surname>Jeffrey</surname>
            <given-names>O.</given-names>
          </string-name>
          <string-name>
            <surname>Kephart</surname>
            and
            <given-names>David M.</given-names>
          </string-name>
          <string-name>
            <surname>Chess</surname>
          </string-name>
          .
          <article-title>The vision of autonomic computing</article-title>
          .
          <source>Computer</source>
          ,
          <volume>36</volume>
          (
          <issue>1</issue>
          ):
          <fpage>41</fpage>
          -
          <lpage>50</lpage>
          ,
          <year>January 2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          18.
          <string-name>
            <given-names>Douwe</given-names>
            <surname>Kiela</surname>
          </string-name>
          and Le´on Bottou.
          <article-title>Learning image embeddings using convolutional neural networks for improved multi-modal semantics</article-title>
          .
          <source>In Proceedings of EMNLP</source>
          <year>2014</year>
          , Doha, Qatar,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          19.
          <string-name>
            <given-names>Bart</given-names>
            <surname>Kosko</surname>
          </string-name>
          .
          <source>Neural Networks and Fuzzy Systems: A Dynamical Systems Approach to Machine Intelligence</source>
          . Prentice-Hall, Inc., Upper Saddle River, NJ, USA,
          <year>1992</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          20.
          <string-name>
            <surname>Brian</surname>
            <given-names>Milch</given-names>
          </string-name>
          , Bhaskara Marthi, Stuart J.
          <string-name>
            <surname>Russell</surname>
            , David Sontag, Daniel L. Ong, and
            <given-names>Andrey</given-names>
          </string-name>
          <string-name>
            <surname>Kolobov</surname>
          </string-name>
          .
          <article-title>BLOG: probabilistic models with unknown objects</article-title>
          .
          <source>In IJCAI-05, Proceedings of the Nineteenth International Joint Conference on Artificial Intelligence</source>
          , Edinburgh, Scotland,
          <string-name>
            <surname>UK</surname>
          </string-name>
          ,
          <source>July 30-August 5</source>
          ,
          <year>2005</year>
          , pages
          <fpage>1352</fpage>
          -
          <lpage>1359</lpage>
          ,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          21.
          <string-name>
            <surname>Stephen H. Muggleton</surname>
          </string-name>
          ,
          <string-name>
            <surname>Dianhuan Lin</surname>
          </string-name>
          , and
          <string-name>
            <surname>Alireza</surname>
          </string-name>
          Tamaddoni-Nezhad.
          <article-title>Meta-interpretive learning of higher-order dyadic datalog: predicate invention revisited</article-title>
          .
          <source>Machine Learning</source>
          ,
          <volume>100</volume>
          (
          <issue>1</issue>
          ):
          <fpage>49</fpage>
          -
          <lpage>73</lpage>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          22.
          <string-name>
            <given-names>Aniruddh</given-names>
            <surname>Nath and Pedro M. Domingos</surname>
          </string-name>
          .
          <article-title>Learning relational sum-product networks</article-title>
          .
          <source>In Proceedings of the Twenty-Ninth AAAI Conference on Artificial Intelligence, January 25-30</source>
          ,
          <year>2015</year>
          , Austin, Texas, USA., pages
          <fpage>2878</fpage>
          -
          <lpage>2886</lpage>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          23. Luc De Raedt, Kristian Kersting, Sriraam Natarajan, and David Poole.
          <source>Statistical Relational Artificial Intelligence: Logic</source>
          , Probability, and
          <string-name>
            <surname>Computation</surname>
          </string-name>
          .
          <source>Synthesis Lectures on Artificial Intelligence and Machine Learning</source>
          . Morgan &amp; Claypool Publishers,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref24">
        <mixed-citation>
          24.
          <string-name>
            <given-names>Matthew</given-names>
            <surname>Richardson</surname>
          </string-name>
          and
          <string-name>
            <given-names>Pedro</given-names>
            <surname>Domingos</surname>
          </string-name>
          .
          <article-title>Markov logic networks</article-title>
          .
          <source>Mach. Learn.</source>
          ,
          <volume>62</volume>
          (
          <issue>1- 2</issue>
          ):
          <fpage>107</fpage>
          -
          <lpage>136</lpage>
          ,
          <year>February 2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref25">
        <mixed-citation>
          25.
          <string-name>
            <surname>Tim</surname>
            <given-names>Rocktaschel</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>Sameer</given-names>
            <surname>Singh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>and Sebastian</given-names>
            <surname>Riedel</surname>
          </string-name>
          .
          <article-title>Injecting logical background knowledge into embeddings for relation extraction</article-title>
          .
          <source>In Annual Conference of the North American Chapter of the Association for Computational Linguistics (NAACL)</source>
          ,
          <year>June 2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref26">
        <mixed-citation>
          26. Richard Socher, Danqi Chen,
          <string-name>
            <given-names>Christopher D.</given-names>
            <surname>Manning</surname>
          </string-name>
          , and
          <string-name>
            <given-names>Andrew Y.</given-names>
            <surname>Ng</surname>
          </string-name>
          .
          <article-title>Reasoning With Neural Tensor Networks For Knowledge Base Completion</article-title>
          .
          <source>In Advances in Neural Information Processing Systems</source>
          <volume>26</volume>
          .
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref27">
        <mixed-citation>
          27.
          <string-name>
            <given-names>T.</given-names>
            <surname>Tieleman</surname>
          </string-name>
          and G.
          <source>Hinton. Lecture 6</source>
          .
          <fpage>5</fpage>
          - RMSProp, COURSERA:
          <article-title>Neural networks for machine learning</article-title>
          .
          <source>Technical report</source>
          ,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref28">
        <mixed-citation>
          28.
          <string-name>
            <surname>Leslie</surname>
            <given-names>G.</given-names>
          </string-name>
          <string-name>
            <surname>Valiant</surname>
          </string-name>
          .
          <article-title>Robust logics</article-title>
          .
          <source>In Proceedings of the Thirty-first Annual ACM Symposium on Theory of Computing</source>
          , STOC '
          <volume>99</volume>
          , pages
          <fpage>642</fpage>
          -
          <lpage>651</lpage>
          , New York, NY, USA,
          <year>1999</year>
          . ACM.
        </mixed-citation>
      </ref>
      <ref id="ref29">
        <mixed-citation>
          29.
          <string-name>
            <given-names>Jue</given-names>
            <surname>Wang</surname>
          </string-name>
          and
          <string-name>
            <surname>Pedro M. Domingos</surname>
          </string-name>
          .
          <article-title>Hybrid markov logic networks</article-title>
          .
          <source>In Proceedings of the Twenty-Third AAAI Conference on Artificial Intelligence</source>
          ,
          <source>AAAI</source>
          <year>2008</year>
          , Chicago, Illinois, USA, July
          <volume>13</volume>
          -
          <issue>17</issue>
          ,
          <year>2008</year>
          , pages
          <fpage>1106</fpage>
          -
          <lpage>1111</lpage>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>