Open processes paired with an environment-event channel #
This file introduces EnvOpenProcess Party Δ Event State, the
structural pairing of an OpenProcess Party Δ (port-routed
boundary channel) with an EnvAction Event State (environment-fired
event channel). See EnvAction.lean for the motivation behind the
two-channel split (port traffic through BoundaryAction,
environment effects through EnvAction).
What the wrapper adds beyond OpenProcess + EnvAction #
The wrapper does two concrete jobs that an ad-hoc tuple does not:
Bundling. A "process that has an environment channel" is a single value you can pass around, return from a function, store in a structure. Without the wrapper, every consumer would have to re-tuple
(P : OpenProcess _ _, ea : EnvAction _ _)at every call site. Composition operators, runtime scheduling, security games — they all need the pair to travel together.An opt-in surface. Existing
OpenProcessvalues are unchanged. A consumer that doesn't care about environment actions never imports this file. A consumer that does, gets the pair as a structure with a typedreactprojection. The env channel is additive aboveOpenProcessand never threaded intoOpenNodeProfile, so adding it costs zero in the rest of the framework.
The alternative, threading the env-event alphabet Σ (with
Σ := Empty default) directly through OpenNodeProfile, would
touch every existing constructor and every _iso lemma in
OpenProcessModel.lean. The wrapper achieves the same expressive
power additively, with zero invasion.
Genericity #
The wrapper is intentionally generic in Event and State:
the canonical CJSV22 instantiation
(Event := MomentaryCorruption.Alphabet Sid Pid,
State := MomentaryCorruption.State Sid Pid)
is one consumer, but every other environment-driven effect
(broadcast resets, time advance, side-channel reseed,
environment-controlled randomness oracle) reuses the same wrapper
with different (Event, State) instantiations.
What this file ships #
The wrapper data layer only:
EnvOpenProcessstructure with@[ext];- projections
toOpenProcess,react; - canonical wrappings
ofOpenProcess(empty alphabet) andpassive(alphabet acts as identity); - alphabet adaptation
comapEvent, env-action replacementwithEnvAction, boundary adaptationmapBoundary.
The composition operators (par / wire / plug lifted from
OpenTheory) are intentionally not here: lifting them requires
an explicit combination strategy for the env channels of the two
sub-wrappers (broadcast vs targeted vs Kleisli-sequential), which is
application-specific (Signal uses targeted routing keyed by
MachineId; broadcast resets use product). The operators are best
parameterized by the strategy rather than baked in. Composition,
forwarding lemmas decomposing env reactions on composites, and the
runtime integration that schedules env events alongside boundary
ticks all live in subsequent files.
The canonical CJSV22 instantiation MomentaryCorruption.Process
(and the bundled MomentaryCorruption.model : CorruptionModel
value) lives in MomentaryCorruption.lean.
EnvOpenProcess m Party Δ Event State is an OpenProcess m Party Δ
paired with an EnvAction Event State describing how an environment-side
state of type State evolves under environment events drawn from Event.
The two fields encode orthogonal effect channels:
process : OpenProcess m Party Δ— the standard open-process boundary surface, with its own controllers, views, per-step nodewise sampler, andBoundaryActionfor port traffic.envAction : EnvAction Event State— an independent env-driven channel for actions whose semantics are not port-routed (CJSV22 §3.2 corruption, broadcast resets, time advance).
The state type State is constrained to Type (universe 0) because
EnvAction.react returns a ProbComp State and ProbComp : Type → Type.
Existing OpenProcess consumers are unaffected: nothing here is
threaded into OpenNodeProfile. The wrapper is the structural
foundation for corruption-aware composition and for the canonical
CJSV22 instantiation MomentaryCorruption.Process in
MomentaryCorruption.lean.
- process : OpenProcess m Party Δ
The underlying open process exposing the boundary
Δ. - envAction : EnvAction Event State
The environment-event channel acting on
StateunderEvent.
Instances For
Projections #
Forget the environment channel and view as a plain OpenProcess.
This is the canonical projection: it drops the env action and retains only the open-process boundary surface.
Instances For
React to an environment event on the env-side state, delegating to the
underlying EnvAction.react.
Provided as a top-level projection so that downstream consumers can
write E.react e s without unfolding the wrapper.
Instances For
Canonical wrappings #
Wrap an OpenProcess with the trivial empty alphabet: no environment
events ever fire.
This is the canonical no-op wrapping: every existing OpenProcess
embeds into EnvOpenProcess _ _ Empty State for any State.
Instances For
Wrap an OpenProcess with the passive alphabet: every event leaves the
state unchanged.
Useful when a process needs to participate in a non-trivial alphabet
(so its env-channel slot must be inhabited at the chosen Event /
State types) but its own state is unaffected by every event.
Instances For
Alphabet and env-action adaptation #
Adapt the env alphabet along an event embedding g : Event → Event'.
The new wrapper accepts events of type Event; each such event e is
routed through g to obtain g e : Event' and passed to the original
env action. This is the contravariant action on the alphabet that lets
coarser alphabets be embedded into finer ones (e.g. lift a
MomentaryCorruption.Alphabet into a richer alphabet that also
tracks broadcast events).
The underlying open process is unchanged.
Instances For
Replace the env action wholesale, retargeting the wrapper to a new
(Event', State') pair. The underlying open process is unchanged.
Used when the same open process needs to be paired with a different env
channel (e.g. lifting from the canonical MomentaryCorruption.react
reaction to a richer simulator-controlled reaction with its own state).
Instances For
Boundary adaptation #
Adapt the underlying open process along a PortBoundary.Hom, leaving
the env channel intact.
The boundary action of the underlying process is translated forward
(emitted packets translated, activation flags preserved) along φ.
The env action is independent of the port boundary, so it is carried
through unchanged. This is the env-channel-aware analogue of
OpenProcess.mapBoundary.