Skip to content

Mathematical Verification Guide for Log-Signature Implementation

This document outlines the mathematical properties that should hold for each function in the log-signature implementation. Treat it as a checklist for analytical reasoning and targeted tests (e.g., pytest/property checks), not as an LLM prompt.

1. Hall Basis Generation (src/tensorsig/algebra/hall_projection.py)

Functions to Verify:

  • hall_basis(width, depth): Generates Hall basis elements
  • logsigdim(width, depth): Computes dimension of log-signature
  • logsigkeys(width, depth): Generates string representations

Mathematical Properties to Verify:

  1. Hall Basis Definition:
  2. Verify that generated elements satisfy Hall ordering conditions:

    • Letters are ordered 1..width and precede brackets; brackets are ordered recursively by their left, then right, entries.
    • For Hall elements a and b with total degree at most depth, include [a, b] exactly when a < b and, if b = [c, d], c <= a.
  3. Dimension Formula:

  4. The homogeneous degree-d dimension is l_d = (1/d) * Σ_{k divides d} μ(d/k) * width^k, where μ is the Möbius function.
  5. Verify that logsigdim(width, depth) equals the cumulative dimension Σ_{d=1}^{depth} l_d.
  6. For width=2: depth 1→2, depth 2→3, depth 3→5, depth 4→8, etc.

  7. Basis Completeness:

  8. Verify that Hall basis elements span the free Lie algebra through the retained depth
  9. Check that all elements are linearly independent
  10. Verify uniqueness of each basis element

  11. Ordering Properties:

  12. Elements should be ordered by depth (lower depth first)
  13. Within the same depth, use the recursive Hall order above
  14. Verify that ordering matches esig library output

2. Lie Bracket Operations (src/tensorsig/tensor_ops/products.py)

Functions to Verify:

  • lie_bracket(x, y): Computes [x, y] = x ⊗ y - y ⊗ x
  • lie_bracket(x, y, shared_dims=1): Batched version

Mathematical Properties to Verify:

  1. Anti-commutativity:
  2. Verify: [a, b] = -[b, a] for all tensors a, b
  3. This is a fundamental property of Lie brackets

  4. Jacobi Identity:

  5. Verify: [a, [b, c]] + [b, [c, a]] + [c, [a, b]] = 0
  6. This is the defining property of Lie algebras

  7. Bilinearity:

  8. Verify: [αa + βb, c] = α[a, c] + β[b, c] for scalars α, β
  9. Verify: [a, αb + βc] = α[a, b] + β[a, c]

  10. Distributivity:

  11. Verify: [a, b + c] = [a, b] + [a, c]
  12. Verify: [a + b, c] = [a, c] + [b, c]

  13. Zero Properties:

  14. Verify: [a, 0] = 0 and [0, a] = 0

3. Baker-Campbell-Hausdorff Formula (src/tensorsig/algebra/hall_bch.py)

Functions to Verify:

  • HallBCH.bch(x, y): Hall-basis BCH with closed forms through depth 4 and an exact universal Dynkin expansion above it

Mathematical Properties to Verify:

  1. BCH Series Expansion:
  2. Through depth 4, verify HallBCH.bch against the compact closed form:

    • z = a + b + 1/2 [a, b]
      • 1/12 [a, [a, b]] + 1/12 [b, [b, a]]
      • 1/24 [b, [a, [a, b]]] (depth ≥ 4)
  3. Associativity Property:

  4. BCH(BCH(a, b), c) = BCH(a, BCH(b, c)) when every operation uses the same homogeneous depth truncation.
  5. This identity is exact in the truncated algebra; numerical checks require floating-point tolerances.

  6. Special Cases:

  7. BCH(a, 0) = a
  8. BCH(0, b) = b
  9. BCH(a, -a) = 0 in exact arithmetic, without a smallness assumption

  10. Truncation Convention:

  11. Verify that all homogeneous terms through depth d are retained correctly.
  12. Discard terms above depth d consistently in every intermediate operation.

4. Log-Signature Computation (src/tensorsig/classical/log_signature.py)

Functions to Verify:

  • log_signature(path, depth): Main API function
  • _batch_log_signature(path, depth): Signature→log pipeline implementation
  • _signature_to_logsignature_tensor(sig_tensors, width, depth): Conversion function
  • _project_to_hall_basis(log_sig_tensors, width, depth): Projection function

Mathematical Properties to Verify:

  1. Exponential Relationship:
  2. Reconstruct the Lie element from log-signature coordinates before taking its tensor-algebra exponential; through the retained depth, this equals signature(path).
  3. This is the fundamental relationship between signature and log-signature
  4. Check: exp(log_sig) should match signature for simple paths

  5. Chen's Identity:

  6. Verify that log-signature satisfies Chen's identity for path concatenation
  7. For paths X and Y: log_sig(X * Y) = BCH(log_sig(X), log_sig(Y))

  8. Path Increment Property:

  9. For a single straight increment dx, the degree-one log-signature is dx and every higher retained degree is zero.
  10. This holds for any increment size in exact arithmetic; numerical checks require floating-point tolerances.

  11. Projection Correctness:

  12. Verify that projection onto Hall basis extracts correct coefficients
  13. Check that tensor components map correctly to Hall basis elements
  14. Verify that projection preserves the free Lie algebra structure

  15. Dimension Consistency:

  16. Verify that output dimension matches logsigdim(width, depth)
  17. For positive width, log-signature and signature dimensions are equal at depth 1; log-signature dimension is smaller at every depth >= 2.

  18. Special Cases:

  19. Zero path: log_sig(0) = 0
  20. Straight line: log_sig should match analytical result
  21. Path reversal: relationship between log_sig(X) and log_sig(X_rev)

  22. Differentiability:

  23. Verify that log-signature is differentiable with respect to path
  24. Check that gradients are well-behaved (finite, no NaN)
  25. Verify chain rule applies correctly

5. Structured-Pruning Quotients

Functions to Verify:

  • compile_lie_quotient(...): exact quotient-native Hall or trace normal form
  • compile_quotient_signature_plan(...): exact weighted-PBW/right-action compiler
  • quotient_signature_from_increment_windows(...): quotient Chen scan
  • quotient_log_signature_from_increment_windows(...): direct BCH, quotient-PBW, and tensor-bridge evaluation

Mathematical Properties to Verify:

  1. Ideal Closure:
  2. Upper-set rules remain discarded after bracketing with any generator.
  3. Graph nonedges generate commuting relations closed under the Lie bracket.

  4. Independent Dimension Formulas:

  5. Multihomogeneous Witt counts match additive-rule conjunctions.
  6. Clique/independence-polynomial Graph--Witt counts match graph quotients.
  7. Exact-span finite differences match graph-and-span quotient dimensions.

  8. Exact Normal Forms:

  9. Retained Hall brackets reduce by antisymmetry and Jacobi.
  10. Trace structure constants match independent associative trace-word brackets.
  11. Compilers do not construct ambient Hall bases or use numerical rank tests.

  12. Homomorphism and Runtime Parity:

  13. Projection commutes with brackets, BCH, and Chen concatenation.
  14. method="direct", method="pbw", and method="tensor" agree through the tested depths.
  15. Full-offset rules are imposed before any projection can alias phenomena.

  16. Universal Enveloping Algebra:

  17. Weighted PBW level dimensions match independent Hilbert-series coefficients.
  18. Compiled associative commutators recover the quotient Lie bracket.
  19. The Eulerian readout is primitive and maps group-like quotient signatures to quotient logs.
  20. Collinear segment subdivision leaves the quotient signature unchanged.
  21. Exact one-generator signatures equal the truncated scalar exponential through depth six.

  22. Degenerate and Differential Cases:

  23. Zero-dimensional and abelian quotients have the expected output shapes.
  24. All three runtime routes preserve gradients.
  25. Increment-native tensor evaluation preserves small segments beside large ones.

The principal independent checks live in test_lie_quotient_dimensions.py, test_quotient_enveloping.py, test_trace_quotient_compiler.py, and test_upper_set_normal_form.py.

6. Numerical Properties

Properties to Verify:

  1. Stability:
  2. Verify numerical stability for small/large increments
  3. Check behavior with repeated points
  4. Verify no NaN or Inf in outputs

  5. Precision:

  6. Verify that exp(log_sig) matches sig within numerical precision
  7. Check error bounds for truncation
  8. Verify consistency between CPU and GPU implementations

  9. Edge Cases:

  10. Zero increments
  11. Very small increments
  12. Very large increments
  13. Degenerate paths (collinear points)

Verification Methodology

For each function, the verification should:

  1. Check Mathematical Definitions: Verify that implementation matches mathematical definition
  2. Verify Properties: Check that all known mathematical properties hold
  3. Compare with References: Compare with esig/signatory libraries where possible
  4. Test Special Cases: Verify behavior on known analytical cases
  5. Check Relationships: Verify relationships with other functions (e.g., exp(log_sig) = sig)

Known Limitations / Checks

  1. BCH Depth Scaling: HallBCH.bch is exact at every positive depth, but the universal schedule above depth 4 grows quickly; ordinary ambient paths should normally retain the faster default signature→log method.

References

  • Hall basis: "On the bases of free Lie algebras" by M. Hall (1950)
  • BCH formula: Baker-Campbell-Hausdorff formula in Lie theory
  • Log-signatures: "A Primer on the Signature Method in Machine Learning"
  • esig library: https://github.com/datasig-ac-uk/esig
  • signatory library: https://github.com/patrick-kidger/signatory