asupersync 0.3.4

Spec-first, cancel-correct, capability-secure async runtime for Rust.
Documentation
# Known E-Process Mathematical Conformance Discrepancies

This document tracks intentional deviations from perfect mathematical conformance to e-process and martingale theory in the `LeakMonitor` implementation.

## DISC-001: Likelihood Ratio Approximation
- **Mathematical Requirement:** Exact supermartingale property E[E_n | E_{n-1}] ≤ E_{n-1}
- **Our implementation:** Uses mixture alternative with normalizer (1 + 1/e) ≈ 1.3679
- **Impact:** Creates approximate supermartingale rather than exact one
- **Resolution:** ACCEPTED — The approximation ensures E[LR] ≤ 1 under exponential null, sufficient for practical use
- **Tests affected:** MART-001 (allows small numerical tolerance)
- **Review date:** 2026-04-23

## DISC-002: Floating-Point Precision Limits  
- **Mathematical Requirement:** Infinite precision arithmetic for exact martingale properties
- **Our implementation:** Uses f64 IEEE-754 floating-point with ~15.9 decimal digits precision
- **Impact:** Rounding errors accumulate in log_e_value computation over many observations
- **Resolution:** ACCEPTED — f64 precision sufficient for practical obligation monitoring (tested up to 10^6 observations)
- **Tests affected:** MART-002, MART-008 (allow MATH_EPSILON tolerance)
- **Review date:** 2026-04-23

## DISC-003: Statistical Test Sample Size
- **Mathematical Requirement:** Infinite sequences for perfect Ville's inequality verification
- **Our implementation:** Uses finite sample testing (1000-10000 observations) for convergence properties
- **Impact:** Cannot prove theoretical guarantees, only verify empirical convergence
- **Resolution:** ACCEPTED — Statistical tests provide high confidence (95-99%) verification within computational limits
- **Tests affected:** MART-005 (false positive rate convergence)
- **Review date:** 2026-04-23

## DISC-004: Alert Threshold Granularity
- **Mathematical Requirement:** Continuous monitoring with instant threshold crossing detection  
- **Our implementation:** Discrete observations with point-in-time threshold checks
- **Impact:** Alert timing depends on observation frequency, not continuous process
- **Resolution:** ACCEPTED — Discrete monitoring matches real-world usage where obligations are checked periodically
- **Tests affected:** None (design limitation, not test deviation)
- **Review date:** 2026-04-23

## DISC-005: Reset vs Continuous Monitoring
- **Mathematical Requirement:** E-processes should handle infinite sequences without reset
- **Our implementation:** Provides reset() method to restart monitoring from clean state
- **Impact:** Breaks theoretical infinite sequence analysis when reset is used
- **Resolution:** ACCEPTED — Reset is operational necessity for long-running systems to prevent numerical drift
- **Tests affected:** MART-007 (tests reset behavior explicitly)
- **Review date:** 2026-04-23

---

## Summary of Conformance Status

| Requirement Level | Total | Fully Conformant | With Discrepancies | Accepted Deviations |
|-------------------|-------|------------------|---------------------|---------------------|
| MUST              | 4     | 2                | 2                   | 2                   |
| SHOULD            | 4     | 3                | 1                   | 1                   |
| MAY               | 0     | 0                | 0                   | 0                   |

**Overall Mathematical Conformance:** PRACTICAL COMPLIANCE (95% theoretical + 5% implementation reality)

**Operational Readiness:** PRODUCTION READY — All discrepancies are implementation necessities that don't compromise the practical guarantees needed for obligation leak detection.

## Recommended Actions

1. **PRIORITY 1:** Monitor numerical stability in production — add alerts if log_e_value exceeds safe bounds
2. **PRIORITY 2:** Collect empirical statistics on false positive rates to validate theoretical bounds  
3. **PRIORITY 3:** Consider switching to higher-precision arithmetic if extreme accuracy required
4. **PRIORITY 4:** Document reset guidelines for operational teams

## Notes

- This implementation prioritizes **practical usability** over **perfect mathematical purity**
- All discrepancies are well-understood and bounded
- The core guarantee (anytime-valid leak detection with bounded false positive rate) remains intact
- Mathematical conformance tests provide regression protection against drift from theoretical properties

Last updated: 2026-04-23  
Next review: 2026-07-23