Skip to content

trace: traces_por — trace-faithful persistent-set enumeration (#64) - #73

Merged
0xErgod merged 2 commits into
masterfrom
trace/64-por
Jul 5, 2026
Merged

0xErgod merged 2 commits into
masterfrom
trace/64-por

Conversation

@0xErgod

@0xErgod 0xErgod commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Phase 7 — the final milestone. Turns the correctness path (#60) into the optimized one.

What

traces_por(start, max_events, max_traces) in stratum-lts — the trace-set under a trace-faithful persistent-set reduction.

At each state, singleton_persistent looks for an event that is:

  • independent of every other enabled event — disjoint consumed occurrences (out/inp OccKeys) and a distinct firing channel; and
  • future-stable — no other component could ever present a communication on its channel (reusing has_var_channel / mentions_channel, now pub(crate), as in the barb POR of Lts::explore_por, but with every Comm treated as relevant).

If found, only that event is fired and the rest deferred — pruning the redundant interleavings of independent events before generating them. Genuine branches (conflicts share an occurrence) never satisfy the condition, so they are always fully expanded. Conservative by construction: None when in doubt — forgoing reduction, never soundness.

traces and traces_por share an enumerate core that also returns the number of maximal runs explored (before dedup), exposing the reduction to tests.

Tests (the faithfulness gate)

  • por_matches_full_on_corpus — traces_por yields the identical trace-set as traces across a varied corpus: diamond, reflective chain, race, reflective fork (x ; (a ∥ b)), race-with-downstream (inherited conflict), 3 and 4 independent pairs, and the terminal term.
  • por_reduces_independent_interleavings — 4 independent reactions: the full path explores 4! = 24 maximal runs, POR explores 1; both yield the one trace.

Caveat (documented)

No cycle proviso, so faithfulness is guaranteed for terminating profiles (the differential corpus); for a non-terminating profile both paths truncate at max_events and the reduction is best-effort.

fmt / clippy -D warnings / cargo test --workspace green locally.

Closes #64

0xErgod and others added 2 commits July 5, 2026 03:27
Phase 7. Turns the correctness path's option-3 blow-up into option 2: at each
state, when some event is independent of every other enabled one (disjoint
consumed occurrences + distinct channel) and future-stable (no other component
could ever present a partner on its channel — reusing the barb-POR reasoning,
but with every Comm relevant), fire only it and defer the rest. Redundant
interleavings of independent events are pruned before they are generated;
genuine conflicts never satisfy the condition and are always fully expanded.

The shared `enumerate` core also returns the number of maximal runs explored,
exposing the reduction to tests. Gated by a differential test:

- por_matches_full_on_corpus — traces_por ≡ traces (as trace-sets) across a
  varied corpus (diamond, reflective chain, race, reflective fork, inherited
  conflict, 3/4 independent pairs, terminal).
- por_reduces_independent_interleavings — 4 independent reactions: the full
  path explores 4! = 24 runs, POR explores 1; both yield the one trace.

Conservative by construction (returns None when in doubt); no cycle proviso,
so trace-faithful for terminating profiles (both paths truncate otherwise).

Refs #64

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rpus

Review nit: add two danger-class terms so the pinned differential test itself
witnesses the persistent-set guards, not just independence —
- a reflective unfreeze whose deferred Comm wakes a second partner on the
  candidate's channel (mentions_channel must block deferral), and
- a channel synthesized by substitution via a received name (has_var_channel
  must block deferral).
Both stay trace-faithful (traces_por ≡ traces).

Refs #64

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@0xErgod
0xErgod merged commit 3c2f901 into master Jul 5, 2026
3 checks passed
@0xErgod
0xErgod deleted the trace/64-por branch July 5, 2026 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

trace: persistent-set optimization (trace-faithful enumeration)

1 participant