# CAIN-42 — Evolution 03: Authority Boundary, Formal Model & Performance

Builds on Evolution 01 (kernel) and Evolution 02 (authority continuity). This pass closes the three
gaps Evolution 02 explicitly left open.

## 1. TLA+ bounded model check — DONE
`docs/formal/AuthorityContinuity.tla` models attenuation, epoch monotonicity, revocation monotonicity
and execution guards. TLC (tla2tools) result:

```
Model checking completed. No error has been found.
645 states generated, 168 distinct states found, 0 states left on queue.
The depth of the complete state graph search is 9.
```

Checked invariants/properties: `TypeOK`, `AttenuationInv` (child ⊆ parent), `EpochMonotone`
(`[][epoch' >= epoch /\ epoch' <= epoch+1]`), `RevocationMonotone` (`[][revoked ⊆ revoked']`),
`NoExecWhileRevoked`, `NoExecWithoutScope`. Classification: **MODEL-CHECKED (bounded)** — a bounded
model check, **not** a proof of the Python implementation. Raw output:
`artifacts/govkernel/TLC_AUTHORITY_CONTINUITY.txt`.

## 2. Performance — MEASURED (baseline vs E02)
`cain/govkernel/perf.py` → `artifacts/govkernel/E03_PERFORMANCE_RESULTS.json` (ms):

| Operation | p50 | p95 | p99 |
|---|---|---|---|
| baseline canonical hash | 0.0199 | 0.0379 | 0.1061 |
| authority object hash | 0.0200 | 0.0391 | 0.1204 |
| attenuation check | 0.0005 | 0.0008 | 0.0010 |
| action binding | 0.0004 | 0.0006 | 0.0008 |
| continuity check | 0.0008 | 0.0012 | 0.0015 |
| authorization verify (Ed25519) | 0.1866 | 0.3535 | 0.7267 |
| causal why_allowed | 0.0017 | 0.0019 | 0.0030 |
| counterfactual eval | 0.0032 | 0.0061 | 0.0129 |

Continuity throughput (single-thread): **~1,060,000 ops/s**. The governance overhead is ~4% of the
cryptographic floor; authorization verification is dominated by the Ed25519 signature check.
**Multi-host / quorum latency NOT_MEASURED.**

## 3. Live feature-flagged Authority Boundary — DEPLOYED (evaluate)
`POST /frontier/e03/authority/evaluate` (+ `GET /frontier/e03/authority/status`) on both gateway
instances. EVALUATE (default) returns the continuity decision; ENFORCE (env `CAIN_E03_MODE=enforce`)
returns 403 for an invalid authority. Measured live on cainstudio.online:
valid → OK; revoked → `AUTHORITY_REVOKED`; stale policy → `POLICY_INVALIDATED`. Mode = EVALUATE
(enforce available, **not enabled**). This is a feature-flagged boundary, **not** the main production
authorization path.

## 4. Evidence
`artifacts/govkernel/` — `TLC_AUTHORITY_CONTINUITY.txt`, `E03_PERFORMANCE_RESULTS.json`,
`E03_LIVE_RESULTS.json`, `E03_EVIDENCE_BUNDLE.json`; published to the three sites.

## 5. Honest limitations
- TLA+ is a **bounded model check**, not a proof of the code.
- Performance is in-process single-thread; multi-host/quorum latency NOT_MEASURED.
- The live boundary is feature-flagged EVALUATE, not the canonical production path; ENFORCE not enabled.
- No independent third-party verification.

## 6. Recommended EVOLUTION 04
Enable the E03 boundary in ENFORCE for a narrow scope (canary) with measured blocking; add a TLA+
refinement check against the implementation; multi-host revocation propagation with measured
convergence; and independent third-party verification of the authority proof.
