- The paper formalises seven differentiable logics in roughly 9,400 lines of Rocq code, using intrinsically typed dependent syntax to ensure that only valid formulas and logic-specific operators can be constructed.
- The paper characterises DL2 and STL∞ as residuated lattices, proves new sound hypersequent calculi for both, and identifies product logic and DL2 as strong candidates when algebraic structure and shadow-lifting are both required.
- The paper completes the missing STLν shadow-lifting case using a mechanised L’Hôpital rule, proves convergence to minimum as ν approaches infinity, and demonstrates certified compilation of ε–δ robustness specifications into training losses.
Motivation and scope
Differentiable logics (DLs) are quantitative logics used to compile logical specifications into loss functions for property-guided training of neural networks. Although they originate in the machine learning literature and are typically accompanied by analytic guarantees such as differentiability, they generally lack a systematic account of their algebraic and proof-theoretic properties. Conversely, fuzzy logics—viewed as substructural logics—possess mature algebraic semantics via residuated lattices and established sequent calculi, but most of them fail the analytic properties required by gradient-based training. This paper addresses this asymmetry by formalising seven differentiable logics—Gödel, Łukasiewicz, Yagerr, product, DL2, STLν, and STL∞—in a single framework within the Rocq proof assistant using the Mathematical Components libraries (2602.23878).
The unifying device is a generic syntax with intrinsic typing: an inductive type expr indexed by dl_type, refined with flags controlling which connectives have defined semantics per logic. This design ensures that only well-typed formulas can be constructed for each logic, and it accommodates the heterogeneous domains involved: [0,1] for fuzzy logics, (−∞,0] for DL2, and (−∞,+∞) for STLν. The development totals roughly 9,400 lines of Rocq code.
Algebraic characterisation via residuated lattices
The central new contribution is a characterisation of machine-learning-inspired differentiable logics in terms of distributive residuated lattices—the standard algebraic semantics of substructural logics. The paper proves that Gödel, Łukasiewicz, Yagerr, product, DL2, and STL∞ each form a residuated lattice; that Łukasiewicz, Yagerr, and STLν0 have involutive negation; that Gödel, Łukasiewicz, Yagerν1, product, and STLν2 have monoidal duals; and that Gödel and STLν3 have idempotent ν4. Notably, STLν5 itself fails the lattice axioms because its conjunction is deliberately non-associative, whereas STLν6 satisfies R1–R10 and N2–N4. This yields a sharp trade-off: at the limit ν7, STL's operators acquire desirable algebraic properties but lose shadow-lifting, so the parameter ν8 functions as a switch between analytic and algebraic adequacy. The authors also record negative results as mechanised counterexamples: negation in STLν9 is not definable as implication to ∞0; negation in Gödel and product logics is not involutive; and Łukasiewicz, Yager∞1, and product are not monoidally idempotent.
No single logic satisfies all desirable properties simultaneously, consistent with Varnai and Dimarogonas's impossibility result that idempotence, associativity, and shadow-lifting cannot coexist. On this basis the paper identifies product logic and DL2 as the most promising candidates when residuated-lattice structure, sound sequent calculi, and shadow-lifting are jointly required.
Analytic properties and L'Hôpital's rule
On the analytic axis, the paper formalises shadow-lifting—the property that partial derivatives of an ∞2-ary conjunction remain positive away from zero, capturing gradual improvement during training. Partial derivatives were not previously available in MathComp-Analysis; the authors define them via error vectors and limits over deleted neighbourhoods of zero. Shadow-lifting is proven for DL2 (partial derivatives equal to 1) and product logic (partial derivatives equal to ∞3), both straightforwardly.
The technically demanding case is STL∞4. The original pencil-and-paper proof by Varnai and Dimarogonas covered only one of two non-trivial cases (∞5); the paper completes the missing case (∞6), showing the partial derivative equals ∞7. A key prerequisite was a generalised formalisation of L'Hôpital's rule, contributed to MathComp-Analysis. The formalisation follows Rudin's proof via Cauchy's Mean Value Theorem, and the authors document a subtle difficulty: Rudin implicitly extends ∞8 and ∞9 by continuity with [0,1]0, which must be made explicit since only right-continuity is assumed. Cases involving infinite limits were not formalised, as they are unnecessary for shadow-lifting.
Additionally, the paper proves that STL[0,1]1's [0,1]2-ary conjunction converges to [0,1]3 as [0,1]4, justifying the definition of STL[0,1]5 as a genuine lattice operation. The convergence proof splits sums according to whether each argument attains the minimum, exploiting exponential decay—a mathematically simple argument whose mechanisation required substantial infrastructure for iterated operators interacting with minr.
The formalisation also surfaced errors in prior work: scaling of comparison operators in the authors' own earlier pen-and-paper proofs, and incompleteness of the published STL[0,1]6 shadow-lifting sketch, which omitted cases and the reliance on L'Hôpital's rule.
Proof-theoretic results
The paper gives the first formalisation of soundness for the established hypersequent calculi of Gödel, Łukasiewicz, and product logics, encoding sequents as pairs of lists and hypersequents as lists thereof, with soundness defined existentially over components of a hypersequent. It extends these calculi with derivable rules for the full differentiable-logic syntax (excepting [0,1]7 for product logic), noting that some derivations require extended yet derivable rules such as [0,1]8 for Łukasiewicz—an observation often left implicit in the literature.
Two new calculi are proposed. For DL2, the authors add a residuation-respecting implication to the original semantics and define a hypersequent calculus without a [0,1]9 rule (since (−∞,0]0 is undefined for DL2), proving soundness by structural induction; the simplicity of DL2's additive (−∞,0]1 makes this proof comparatively easy. For STL(−∞,0]2, a calculus sharing most rules with Gödel logic is given, with standard negation rules excluded because they are unsound; the proof requires working over extended reals (−∞,0]3, where the absence of lra/nra automation forces manual inequality proofs. No calculus is proposed for full STL(−∞,0]4, on the grounds that its non-associativity likely demands techniques from non-associative Lambek calculus. In lieu of completeness, the paper establishes weak completeness—provability of the relevant residuated-lattice axioms R1–R9—for both DL2 and STL(−∞,0]5 calculi. Yager(−∞,0]6 is argued unlikely to admit a calculus, since pre-linearity fails semantically (e.g., evaluating to approximately 0.86 rather than 1 for suitable parameters).
Application to property-guided training
The framework is exercised on (−∞,0]7-(−∞,0]8-robustness, formalised once generically and instantiated for any encoded logic via the corresponding interpretation function. Embedding the (−∞,0]9 norm and vector subtraction into the syntax, the property (−∞,+∞)0 compiles directly to loss functions, e.g., under DL2 or STL(−∞,+∞)1. This demonstrates the intended use case: certified translation from specifications to training objectives.
Limitations and open questions
Several restrictions are acknowledged explicitly. Shadow-lifting is treated only for conjunction; extension to other connectives is deferred. Scale-invariance and weak smoothness are not considered. Completeness of all calculi, cut-free proof theory, and adequacy relative to Boolean logic (non-trivial once real-valued comparisons are added) remain open. The formalisation specialises to real-number carriers rather than abstract residuated lattices, and uses polymorphic lists rather than multisets for hypersequents, which complicates automation. The infinite-limit cases of L'Hôpital's rule are unformalised. First-order quantification for differentiable logics remains an open problem, though the authors argue the accumulated machinery brings it within reach.
Conclusion
This work provides a uniform, mechanically verified foundation for differentiable logics spanning three research traditions—substructural algebra, real analysis, and Gentzen-style proof theory. Its principal contributions are the residuated-lattice characterisation of DL2 and STL(−∞,+∞)2, completed and corrected shadow-lifting proofs for STL(−∞,+∞)3 supported by a new L'Hôpital's rule in MathComp-Analysis, and the first sound sequent calculi for DL2 and STL(−∞,+∞)4. The development demonstrates that dependent-type encodings with intrinsic typing, combined with the Mathematical Components ecosystem, suffice to formalise state-of-the-art results from the machine learning literature, and it supplies a reusable substrate for certifying specification-to-loss-function compilation in tools such as Vehicle and CAISAR.