Skip to content

trace: instrumented COMM stepper with occurrence provenance (#58) - #67

Merged
0xErgod merged 2 commits into
masterfrom
trace/58-instrumented-stepper
Jul 4, 2026
Merged

0xErgod merged 2 commits into
masterfrom
trace/58-instrumented-stepper

Conversation

@0xErgod

@0xErgod 0xErgod commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Phase 1 of the trace / event-structure toolkit (milestone Trace & event-structure analysis). The crux: everything downstream is bookkeeping over what this produces.

What

A stepper (crates/stratum-lts/src/event.rs) that tags every active parallel component with its provenance, so each Comm firing becomes an Event with an order-independent identity.

  • OccKey = Initial(i) | Born(EventKey, k) — where a component was born.
  • EventKey { channel, message, out, inp } — identity = the two occurrences consumed (grounds out at Initial leaves = the event's causal history). Label is (channel, message), ≡N-canonical.
  • Event { key, produces }; run_events(start, max_events) -> (Vec<Event>, truncated); enabled_events (crate-private).

Why it captures reflective causality for free

A Comm substitutes ⌜Q⌝ and a Drop unfreezes Q, so residue components are born from the firing. A later event consuming one points its out/inp key back at the producer — recording the dependency with no special rule for reflection. Causality is just "I consumed what you produced".

Provenance is computed on the nominal term (canonicalization reuses de Bruijn 0 and fuses ≡-equal subterms, which would collapse distinct occurrences); names are canonicalized only for ≡N matching and the label.

Tests (happy-path + the three phenomena)

  • causal_reflective_dependency — x⟨|a⟨|0|⟩|⟩ | x(y).*y | a(z).0: the a-event's out == the x-event's produced occurrence.
  • concurrent_events_are_independent — disjoint reactions, both occurrences Initial.
  • racing_inputs_share_the_output_occurrence — one output, two inputs → shared out (conflict seed).
  • same_label_distinct_events — identical (channel, message), distinct out/inp.

Verbose tracing spans over firing + provenance (silent without a subscriber). fmt / clippy -D warnings / cargo test --workspace all green locally.

Closes #58

0xErgod and others added 2 commits July 5, 2026 01:05
Phase 1 of the event-structure trace layer. Step a rho-calculus term
while tagging every active parallel component with its provenance
(Initial / Born), so each Comm firing becomes an Event whose identity is
order-independent: the pair of occurrences it consumes, grounding out in
the start term = its causal history.

This is what later phases read the causal order off: an event depends on
the producers of the occurrences it consumes, which records reflective
causality (a Drop unfreezing a substituted process) with no special rule.

- OccKey / EventKey / Event; run_events; enabled_events
- tracing spans over firing + provenance (silent without a subscriber)
- unit tests: causal (reflective), concurrent, conflict, same-label

Refs #58

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

Per issue #58's tracing criterion, emit a `debug_span` over each *fired*
event carrying its label and the occurrences it consumed and produced
(`out`, `inp`, `produces`), instead of a per-candidate `trace!` that fired
repeatedly for enabled-but-unfired reactions and omitted the keys. Document
that `enabled_events` returns full successor states for the branching
callers of later phases.

Refs #58

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@0xErgod
0xErgod merged commit fe3a1ce into master Jul 4, 2026
3 checks passed
@0xErgod
0xErgod deleted the trace/58-instrumented-stepper branch July 4, 2026 23:29
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: instrumented COMM stepper with occurrence provenance (crux)

1 participant