想给逻辑张量网络加时间或序列结构?sLTN把结构维度做进语言里,还能退化成原版LTN,有PyTorch代码可玩。
sLTN扩展了逻辑张量网络(LTN),将时间步、序列位置或图节点等结构维度作为语言的一等公民。它允许在逻辑层面直接表达时间、序列和关系约束,并形式化了语法和模糊张量语义。在无结构维度时,sLTN可退化为原始LTN语义。论文提供了基于PyTorch的实现,并在时间与序列推理示例上进行了演示。
sLTN: Structural Logic Tensor Networks
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.