asupersync 0.3.4

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

This document tracks conformance test coverage for mathematical properties that define a valid e-process under martingale theory.

## Coverage Accounting Matrix

| Mathematical Property | MUST Clauses | SHOULD Clauses | Tested | Passing | Divergent | Score |
|----------------------|:-----------:|:--------------:|:------:|:-------:|:---------:|-------|
| Likelihood Ratio Bounds | 1 | 0 | 1 | 1 | 0 | 100% |
| Supermartingale Property | 1 | 0 | 1 | 1 | 0 | 100% |
| Ville's Inequality | 1 | 0 | 1 | 1 | 0 | 100% |
| Numerical Stability | 1 | 0 | 1 | 1 | 0 | 100% |
| False Positive Rate | 0 | 1 | 1 | 1 | 0 | 100% |
| Peak Tracking | 0 | 1 | 1 | 1 | 0 | 100% |
| Reset Invariants | 0 | 1 | 1 | 1 | 0 | 100% |
| Log-Space Computation | 1 | 0 | 1 | 1 | 0 | 100% |
| **TOTALS** | **5** | **3** | **8** | **8** | **0** | **100%** |

✅ **CONFORMANCE STATUS: COMPLIANT** (100% MUST coverage ≥ 95% threshold)

## Detailed Coverage Analysis

### ✅ Fully Tested Mathematical Properties

| Test ID | Mathematical Requirement | Status | Implementation |
|---------|-------------------------|---------|---------------|
| MART-001 | E[LR] ≤ 1 under exponential null | ✅ PASS | `test_likelihood_ratio_expectation()` |
| MART-002 | Supermartingale property: E[E_n \| E_{n-1}] ≤ E_{n-1} | ✅ PASS | `test_supermartingale_property()` |
| MART-003 | Ville's inequality: threshold = 1/α | ✅ PASS | `test_ville_inequality_bound()` |
| MART-004 | Numerical stability under extreme inputs | ✅ PASS | `test_numerical_stability()` |
| MART-005 | False positive rate ≤ α under H0 | ✅ PASS | `test_false_positive_rate_convergence()` |
| MART-006 | Peak e-value tracking monotonicity | ✅ PASS | `test_peak_tracking_monotonic()` |
| MART-007 | Reset preserves configuration invariants | ✅ PASS | `test_reset_preserves_invariants()` |
| MART-008 | Log-space prevents underflow | ✅ PASS | `test_log_space_stability()` |

### Mathematical Properties Coverage by Category

#### ✅ Core Martingale Theory (MUST Requirements)
All fundamental mathematical properties are tested:
- **Likelihood ratio validity**: Ensures E[LR] ≤ 1 for supermartingale property
- **Supermartingale property**: Verifies non-increasing expectation under null
- **Ville's inequality**: Correct threshold calculation for anytime-valid testing
- **Numerical stability**: Finite arithmetic implementation doesn't break theory
- **Log-space computation**: Prevents underflow in multiplicative updates

#### ✅ Implementation Quality (SHOULD Requirements)
Practical implementation aspects verified:
- **Statistical convergence**: False positive rate empirically bounded by α
- **State tracking**: Peak values and reset behavior maintain invariants
- **Robustness**: Handles edge cases without mathematical violations

#### 🔧 Advanced Properties (Not Tested)
These require theoretical analysis beyond computational testing:
- **Optimal stopping theory**: Whether our mixture alternative is optimal
- **Rate of convergence**: Speed of detection under alternative hypothesis
- **Minimax properties**: Worst-case performance bounds
- **Sequential analysis**: Comparison to classical SPRT approaches

## Test Strategy by Category

### ✅ Computationally Verifiable (Implemented)
These properties can be verified by running code and checking results:
- Likelihood ratio expectations via sampling
- Supermartingale property via multiple sequences
- Threshold calculations via exact arithmetic
- Numerical stability via stress testing
- Statistical convergence via Monte Carlo

### 📚 Theoretically Verifiable (Documentation)
These properties are verified by mathematical analysis documented in code comments:
- Exponential distribution properties used in likelihood ratio
- Normalizer derivation: E[max(1, X/μ)] = 1 + 1/e for Exp(1/μ)
- Ville's inequality proof for anytime validity
- Log-space arithmetic correctness

### ⚡ Empirically Observed (Production Metrics)
These would be verified by production monitoring:
- Actual false positive rates in real workloads
- Performance under varying obligation patterns
- Numerical stability over extended runtime
- Alert sensitivity tuning for different domains

## Conformance Test Execution

### Test Environment
- **Language**: Rust with standard library math functions
- **Precision**: f64 IEEE-754 floating-point (≈15.9 decimal digits)
- **Sample Sizes**: 1,000-10,000 observations for statistical tests
- **Tolerances**: MATH_EPSILON = 1e-10 for exact comparisons

### Execution Protocol
```bash
# Run mathematical conformance tests
cargo test eprocess_martingale_conformance --lib -- --nocapture

# Run specific property tests
cargo test specific_martingale_properties --lib
cargo test statistical_convergence_properties --lib

# Run full conformance harness
cargo test conformance::tests::conformance_harness_runs_all_tests --lib
```

### Expected Output
- **Matrix Report**: Shows pass/fail status for each mathematical property
- **Statistical Evidence**: Empirical measurements with confidence intervals  
- **Compliance Verdict**: COMPLIANT/NON-COMPLIANT based on MUST requirement coverage

## Known Limitations

### Computational Constraints
- **Finite precision**: f64 arithmetic introduces rounding errors
- **Finite samples**: Statistical tests use finite sample sizes for convergence properties
- **Discrete monitoring**: Real implementation checks obligations periodically, not continuously

### Mathematical Approximations
- **Mixture alternative**: Uses max(1, x/μ) instead of optimal likelihood ratio
- **Normalizer approximation**: 1 + 1/e ≈ 1.3679 computed numerically
- **Tolerance bounds**: Allows small deviations due to floating-point precision

### Scope Boundaries
- **Single-threaded**: Tests don't verify concurrent access safety
- **Memory constraints**: No verification of memory usage bounds  
- **Performance**: Speed benchmarks separate from mathematical correctness

## Maintenance Protocol

### Regular Verification
- **Every release**: Run full conformance test suite
- **Quarterly**: Review coverage matrix for new mathematical properties
- **After changes**: Re-run affected test categories

### Update Triggers
- **New mathematical requirements**: Add tests for additional properties
- **Implementation changes**: Update tests if algorithm modifications affect theory
- **Bug reports**: Add regression tests for any mathematical violations found

### Version Control
- **Test code**: Mathematical conformance tests tracked in git with implementation
- **Coverage matrix**: Updated with each test modification
- **Evidence artifacts**: Test outputs preserved for compliance auditing

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