Time to Reason: Scalable Neurosymbolic Learning for LTLf via Fuzzy Semantics
Authors: Riccardo Andreoni, Andrei Buliga, Alessandro Daniele, Paolo Felli, Chiara Ghidini, Marco Montali, Massimiliano Ronzani
Organizations: Fondazione Bruno Kessler, Via Sommarive, 18, Trento, 38123, Italy · Free University of Bozen-Bolzano, Via Bruno Buozzi, 1, Bolzano, 39100, Italy · Università di Bologna, Via Mura Anteo Zamboni 7, Bologna, 40126, Italy
Neurosymbolic (NeSy) Artificial Intelligence aims to integrate Deep Learning (DL) architectures with symbolic reasoning. While initial NeSy approaches have targeted mainly symbolic reasoning in propositional and first-order logics, recent works have started to address the construction of neurosymbolic frameworks for Temporal Logics, and in particular for LTLf. These approaches have established temporal NeSy as a promising research direction, laying the foundations for learning under temporal constraints. Nonetheless, they leave many questions unanswered. From a theoretical perspective, several differentiable semantics for interpreting LTLf have been proposed but have not yet been formally and systematically defined within a unified framework. Moreover, existing approaches commonly rely on automata to represent temporal knowledge, resulting in limited scalability. Motivated by this research gap, this paper provides the following contributions: (i) formally defining different fuzzy semantics for LTLf, and systematically analysing theoretical properties regarding equivalences and dualities of temporal operators; (ii) showing how these semantics can be directly integrated within a novel NeSy framework, called DiffLTLf, enabling flexible and scalable learning without relying on the usage of automata; and (iii) introducing a novel evaluation protocol of increased complexity of learning tasks w.r.t. existing benchmarks. Our results show that the choice of fuzzy semantics has a significant impact on predictive performance. Moreover, DiffLTLf achieves performance on par with, and sometimes superior to, state-of-the-art probabilistic approaches while substantially improving scalability. Taken together, these results establish direct fuzzy interpretations as a competitive and scalable alternative to existing temporal NeSy frameworks.
Figures & tables
Figure 1: Illustrative example of the weakly supervised learning task on a simplified manufacturing scenario. Left: correct perception leads to a correct assessment of non-compliance, matching the ground-truth label. Right: incorrect perception leads to a wrong assessment of compliance, producing a corrective learning signal.
Figure 2: Graphical depiction of an ltl f trace of length 5, and satisfaction of the two formulae aUb and Xb in every instant of the trace.
declare Pattern
ltl f Template
Description
Response
G(A→FB)
If A occurs, B must eventually follow
Not Succession
G(A→¬FB)
If A occurs, B must never follow
Chain Succession
G(A→XB)
If A occurs, B must hold at the next timestep
Not Chain Succession
G(A→¬XB)
If A occurs, B must not hold at the next timestep
Precedence
(¬BUA)∨G(¬B)
B cannot occur before A has occurred
Chain Precedence
G(XB→A)
Every occurrence of B is immediately preceded by A
Table 1: declare pattern templates used in the benchmark. A and B denote stream-specific propositions or Boolean combinations of them.
Figure 3: Graphical depiction of a fltl fx trace of length 3, and satisfaction of the formula aUb in every instant of the trace, under all three semantics.
Figure 4: Overview of the ∂ LTL f framework. The perception module fθ produces the fuzzy trace λθ (rows represent the propositions pcs grouped by stream). The temporal logic module evaluates Φ under the fltl fx semantics. The loss evaluates the predictions of the temporal logic module in comparison with the ground truth label.
Figure 5: Computation of v(G(a→Fb),λ) , from Example 3 .
Figure 6: Symbol grounding accuracy (%) across 10 independent runs for ∂ LTL f instantiated with the three fuzzy semantics: Product ( fltl fP ), Łukasiewicz ( fltl fL ), and Gödel ( fltl fG ). Each subplot corresponds to one experimental setting (formula set × image dataset), with the number of classes ∣C∣ on the horizontal axis.
Img. Acc. (%) ↑
Seq. Acc. (%) ↑
∣C∣
2
4
6
8
2
4
6
8
fltl fP
99.9
97.7
93.3
89.2
99.9
98.9
97.0
96.0
fltl fG
99.9
62.2
32.1
19.9
99.9
90.0
88.6
86.2
fltl fL
94.9
64.0
49.2
37.6
96.6
90.6
89.3
87.7
Table 2: Symbol grounding and sequence classification accuracy (%) of ∂ LTL f under the three fuzzy semantics, averaged over the four experimental settings and 10 runs. Results in bold are significantly better than both other semantics (Wilcoxon, p<0.05 ).
Img. Acc. ( % ) ↑
Seq. Acc. ( % ) ↑
Time (s) ↓
Setting
∣C∣
∂ LTL f
FuzzyA
NeSyA
∂ LTL f
FuzzyA
NeSyA
∂ LTL f
FuzzyA
NeSyA
MNIST Set1
2
99.9
99.9
99.9
99.8
99.8
99.8
0.04
0.17
0.17
4
97.4
97.4
97.4
98.9
98.9
99.0
0.05
0.33
0.40
6
95.7
95.6
91.3
98.3
98.3
97.6
0.05
0.63
0.99
8
92.7
91.5
88.4
96.7
96.5
95.5
0.05
1.97
5.08
MNIST Set2
2
99.9
99.9
99.9
99.8
99.9
99.9
0.05
0.17
0.15
Table 3: Performance comparison varying formula complexity. Results are averaged over 10 independent runs. Img. Acc : Symbol Grounding Accuracy; Seq. Acc : Sequence Classification Accuracy; Time : Logic Module Time per Epoch. Results in bold are statistically significantly better than all other methods (Wilcoxon, p<0.05 ).
Figure 7: Comparison of symbol grounding accuracy (left) and logic module time per epoch (right) across number of classes ∣C∣∈{2,4,6,8} . Values are averaged across all four experimental settings (formula set × image dataset).
Img. Acc. ( % ) ↑
Seq. Acc. ( % ) ↑
Time (s) ↓
∣C∣
Len
∂ LTL f
FuzzyA
NeSyA
∂ LTL f
FuzzyA
NeSyA
∂ LTL f
FuzzyA
NeSyA
4
20
97.9
97.9
98.0
97.7
97.8
97.8
0.007
0.41
0.57
40
97.9
98.0
98.0
98.0
98.1
98.1
0.007
0.74
1.14
60
97.9
98.1
98.1
97.2
97.7
97.6
0.007
1.09
1.74
80
98.0
97.9
97.9
98.0
98.2
98.2
0.007
1.46
2.33
100
98.0
98.0
98.1
98.1
98.0
98.0
0.008
1.83
2.91
Table 4: Performance comparison varying sequence length. Results are averaged over 10 independent runs. Img. Acc : Symbol Grounding Accuracy; Seq. Acc : Sequence Classification Accuracy; Time : Logic Module Time per Epoch. Results in bold are statistically significantly better than all other methods (Wilcoxon, p<0.05 ).
Figure 8: Comparison of symbol grounding accuracy (top row) and logic module time per epoch (bottom row) across sequence lengths varying from 20 to 200. Left column: temporal specification with ∣C∣=4 classes. Right column: temporal specification with ∣C∣=8 classes. Lines represent the mean over 10 independent runs; shaded bands indicate the range between the minimum and maximum values. Time is shown on a logarithmic scale.
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
Method
Set 1
Set 2
∣C∣ :
2
4
6
8
2
4
6
8
Img. Acc. (%) ↑
∂ LTL f (Product)
99.9
97.4
95.7
92.7
99.9
97.4
95.0
92.7
∂ LTL f (Gödel)
99.9
60.8
32.7
22.8
99.9
59.2
29.6
16.3
∂ LTL f (Łukasiewicz)
90.1
58.4
46.2
35.4
99.9
62.6
57.1
42.0
T-ILR
99.9
60.8
32.7
22.8
99.9
59.2
29.6
16.3
Appendix
Table 5: Full results varying formula complexity on MNIST, averaged over 10 runs. Img. Acc. : Symbol Grounding Accuracy; Seq. Acc. : Sequence Classification Accuracy; Time : Logic Module Time per Epoch. Results in bold are statistically significantly better than all other methods (Wilcoxon, p<0.05 ).
Method
Set 1
Set 2
∣C∣ :
2
4
6
8
2
4
6
8
Img. Acc. (%) ↑
∂ LTL f (Product)
100.0
97.8
91.7
86.0
99.9
98.0
90.9
85.1
∂ LTL f (Gödel)
100.0
76.0
34.0
23.6
99.9
52.7
32.0
16.7
∂ LTL f (Łukasiewicz)
89.9
55.9
47.6
40.0
99.9
79.2
45.8
33.0
T-ILR
100.0
76.0
34.0
23.6
99.9
52.7
32.0
16.7
Appendix
Table 6: Full results varying formula complexity on Fashion-MNIST, averaged over 10 runs. Img. Acc. : symbol grounding accuracy; Seq. Acc. : sequence classification accuracy; Time : Logic Module Time per Epoch. Results in bold are statistically significantly better than all other methods (Wilcoxon, p<0.05 ).
Sequence length
Method
20
40
60
80
100
120
140
160
180
200
Img. Acc. (%) ↑
∂ LTL f (Product)
97.9
97.9
97.9
98.0
98.0
97.9
98.1
97.7
97.9
97.7
∂ LTL f (Gödel)
43.5
35.0
47.2
35.9
49.9
48.5
41.1
55.4
55.0
54.8
∂ LTL f (Łukasiewicz)
72.9
92.7
87.8
92.1
85.5
78.6
82.6
86.6
91.1
81.2
T-ILR
43.5
35.0
47.2
35.9
49.9
48.5
41.1
55.4
55.0
54.8
Appendix
Table 7: Full results varying the sequence length, ∣C∣=4 , averaged over 10 runs. Img. Acc. : Symbol Grounding Accuracy; Seq. Acc. : Sequence Classification Accuracy; Time : Logic Module Time per Epoch. Bold marks a value statistically significantly better than all other methods (Wilcoxon, p<0.05 ).
Sequence length
Method
20
40
60
80
100
120
140
160
180
200
Img. Acc. (%) ↑
∂ LTL f (Product)
95.8
96.0
95.6
95.7
95.6
95.5
96.1
95.8
95.8
95.6
∂ LTL f (Gödel)
17.5
17.1
17.7
16.7
17.3
15.1
14.8
16.4
15.2
14.9
∂ LTL f (Łukasiewicz)
14.6
14.6
14.6
14.6
14.5
14.5
14.5
14.5
14.6
14.6
T-ILR
17.5
17.1
17.7
16.7
17.3
15.1
14.8
16.4
15.2
14.9
Appendix
Table 8: Full results varying the sequence length, ∣C∣=8 , averaged over 10 runs. Img. Acc. : Symbol Grounding Accuracy; Seq. Acc. : Sequence Classification Accuracy; Time : Logic Module Time per Epoch. Results in bold are statistically significantly better than all other methods (Wilcoxon, p<0.05 ).
Most of the existing neuro-symbolic AI methods focus on the scenario of static knowledge where objects do not change according to a temporal dimension. Temporal neuro-symbolic works are still under explored and are mainly developed for time-interval logic or propositional linear temporal logic. There is a lack of models studying linear temporal logics with predicates that deal with objects whose properties and relations change through the time. We present First-Order Temporal Logic Tensor Networks (FOT-LTN) that is an extension of Logic Tensor Networks (LTN) that fills this gap by considering a linear-temporal dimension. In particular, FOT-LTN joins the syntax of First-Order Linear Temporal Logic with the fuzzy (and real-valued) semantics of LTN obtaining a framework that supports both temporal operators and quantifiers and is totally differentiable. A first evaluation regards a temporal knowledge graph completion task on two synthetic datasets showing better performance of FOT-LTN with respect to dedicated (purely neural) methods.
Luca Boscarato, Ivan Donadello, Alessandro Artale +2
In this work we study offline reinforcement learning (RL) under temporally extended task constraints expressed in Linear Temporal Logic over finite traces (LTLf). Recently, transformer-based approaches such as Trajectory Transformers and Decision Transformers have been adopted to address RL as a sequence modeling problem. However, these methods optimize purely for reward and do not account for high-level temporal requirements. Here, we introduce a neurosymbolic framework that injects LTLf background knowledge into such transformer-based RL policies. Our approach compiles LTLf formulas into deterministic finite automata (DFAs) and integrates them into the learning process through a differentiable representation and a logic-based loss function. In particular, we derive differentiable satisfaction signals from DFA progression and use them as a regularization term during training. The resulting method is architecture-agnostic across different models. We evaluate the proposed framework on navigation environments with specification suites covering combinations of safety and reachability temporal properties. Experimental results show that incorporating background knowledge not only improves constraint satisfaction, but also maintains competitive return compared to vanilla baselines.
Ashkan Ansarifard, Matteo Mancanelli, Elena Umili +1
Sapienza University of Rome · University of Rome La Sapienza, Rome, Italy
Logic Tensor Networks (LTN) provide a neurosymbolic framework in which first-order logic is interpreted through tensor operations, enabling logical constraints to be integrated with differentiable learning. However, the original formulation of LTN is primarily suited to data represented as flat collections of individuals, and does not explicitly capture structural organization such as temporal order, sequential position, or graph connectivity. We introduce sLTN, an extension of LTN that makes structural dimensions first-class elements of the language. Structural dimensions represent named tensor axes associated with domain-specific organization, such as time steps, sequence positions, or graph nodes. They can be quantified explicitly, related through structural relations, and used to express temporal, sequential, and relational constraints directly at the logical level. We formalize the syntax and fuzzy tensor semantics of sLTN and show that, in the absence of structural dimensions, the framework recovers the original LTN semantics as a special case. We further describe a PyTorch implementation based on a declarative signature, formula parsing, and tensorial interpretation. The framework is illustrated on representative temporal and sequential reasoning examples. This paper serves as a companion to the sltn library, available at https://github.com/logictensornetworks/sltn.