Grounding in Logic Tensor Networks
To make learning possible, LTN uses a differentiable first-order logic language, called Real Logic, which enables the incorporation of data and logic.
Real Logic defines the concept of grounding (different from the grounding of logic), which is a mapping from the logical domain (i.e., constants, variables, and logical symbols) to tensors in the Real field or operations based on tensors. These operations could be, for instance, mathematical functions or learnable neural networks. In other words, a grounding, denoted as \(\mathcal{G}\), is a function which maps a logical symbol into a real tensor or an operation on tensors.
In particular, the grounding is defined as follows. Let us assume that \(c\) is a constant, \(x\) is a logical variable, \(P\) is a predicate, and \(f\) is a logical function:
\(\mathcal{G}(c) = \mathbb{R}^{d_1 \times \dots \times d_n}\): a logical constant is grounded as a tensor (individual) of any order (e.g., \(\mathbb{R}^4$ or $\mathbb{R}^{5 \times 4 \times 4}\));
\(\mathcal{G}(x) = \mathbb{R}^{m \times d}\): a logical variable is grounded as a sequence of \(m\) tensors (individuals) of the same shape \(d\);
\(\mathcal{G}(f \mid \theta) = x \mapsto MLP_{\theta}(x)\): a logical function is grounded as a (learnable) mathematical function which takes as input some tensors (individuals) and returns a tensor. In this definition, \(\theta\) are the learnable parameters of the function, while \(MLP_{\theta}\) is the neural network representing the function, parametrized by \(\theta\). Note that the given definition has one input \(x\), however, an LTN function can take multiple inputs;
\(\mathcal{G}(P \mid \theta) = x \mapsto \sigma (MLP_{\theta}(x))\): a logical formula (atomic or not) is grounded as a mathematical function which takes as input some tensors (individuals) and returns a value in [0., 1.]. In this case, the logistic function \(\sigma\) assures the output to be in the range [0., 1.], resulting in a value which can be interpreted as a fuzzy truth value. Note that the given definition has one input \(x\), however, an LTN predicate (or formula) can take multiple inputs.
The grounding defines also how the logical connectives (\(\land, \lor, \lnot, \implies, \leftrightarrow\)) and quantifiers (\(\forall, \exists\)) are mapped in the Real domain. In particular, logical connectives are grounded using fuzzy logic semantics, while quantifiers are grounded using fuzzy aggregators. Please, carefully read the paper if you have some doubts on these notions.
Examples of possible groundings are showed in the figure below. In particular, \(friend(Mary, John)\) is an atomic formula (predicate), while \(\forall x (friend(John, x) \implies friend(Mary, x))\) is a closed formula (all the variables are quantified). The letter \(\mathcal{G}\), again, is the grounding, the function which maps the logical domain into the Real domain.