A quiet but powerful addition to the COOLJAPAN ecosystem.
On March 7 we made TensorLogic 0.1.0-rc.1 available — a new layer that turns symbolic logic into native tensor computation.
This is not just another logic library.
It is a compiler that translates arbitrary logical expressions into highly optimized einsum graphs, enabling seamless hybrid neural + symbolic + probabilistic reasoning inside a single tensor runtime.
The Core Idea: Logic = Tensor Equations
Traditional neurosymbolic systems struggle with two problems:
- Symbolic rules are slow and non-differentiable
- Neural networks lack formal guarantees
TensorLogic solves both by treating logic as first-class tensor algebra.
You write rules in a tiny DSL:
let rule = exists(x, forall(y, implies(P(x), Q(x, y))));
The compiler turns it into an optimized EinsumGraph that runs on SciRS2 (or ToRSh) at full SIMD/GPU speed — with gradients if you want them.
How the Compilation Works (technical deep dive)
-
DSL → AST
TLExprwith predicates, quantifiers (∀,∃), connectives, and custom operators. -
IR Generation
Static analysis produces anEinsumGraphIR with:- shape inference
- dead-node elimination
- fusion opportunities
-
Logic → Tensor Mapping (configurable via
CompilationStrategy)
| Logical Operator | Tensor Operation (default) | Differentiable variant |
|---|---|---|
AND(a, b) | a * b (Hadamard) | soft product |
OR(a, b) | max(a, b) | soft max / logsumexp |
NOT(a) | 1.0 - a | sigmoid-based |
∃x.P(x) | sum(P, axis=x) | logsumexp |
∀x.P(x) | 1.0 - sum(1-P, axis=x) | soft min |
a → b | max(1-a, b) | ReLU(b - a) |
Six built-in strategies: hard_boolean, soft_differentiable, fuzzy_godel, fuzzy_product, fuzzy_lukasiewicz, probabilistic.
- Execution
The graph runs on SciRS2 backend (SIMD 2—4× faster) or ToRSh (pure-Rust PyTorch alternative).
What’s New in 0.1.0-rc.1
- SciRS2 0.3.0 integration + full SIMD support
- 4,415 passing tests (100% clean)
- Production-ready Python bindings (
pytensorlogic) - Provenance tracking (trace any tensor value back to original logical rule)
- Batch executor + autodiff support for training logical constraints
- Bridge crates for OxiRS (SHACL → tensor rules), SkleaRS (logic kernels), Trustformers, and QuantrS2
This is the foundation
TensorLogic is now the neurosymbolic glue for the entire COOLJAPAN stack:
- Enforce logical constraints on ToRSh models
- Turn OxiRS knowledge graphs into differentiable tensors
- Generate custom similarity kernels for SkleaRS from business rules
- Power explainable AI and verifiable agents in mielinOS
Availability
→ https://github.com/cool-japan/tensorlogic
Star the repo if you want to train neural networks that actually obey logic — with gradients.
The boundary between symbolic and neural is gone.
It’s all tensors now.
— KitaSan at COOLJAPAN OU
March 7, 2026