Properties of the Imperative trace relations #
Companion to Strata.DL.Imperative.Logic.TraceRelations, which carries the
compact definitions of the trace relations Trace.StuttersEnv /
TraceExtendsEnv; the event-level relations they build on,
EventArg.ExtendsEnv / Event.ExtendsEnv, are defined in
Strata.DL.Imperative.CmdTrace. This module collects the property proofs for
all four. The store- and environment-level laws live
with the semantics they belong to: the command-level StoreAgreement and
StoreExtendsWith laws in Strata.DL.Imperative.StoreRelationsProps, and the
statement-level StoreExtendsWith.projectStore,
StoreAgreement.of_projectStore, and Env.ExtendsWith.refl / .trans_union in
Strata.DL.Imperative.StmtSemanticsProps.
Key theorem families:
evalCmdE_replay_extendsreplays a canonical event-producing command on an extending target store, preserving the classified store extension and relating the emitted snapshots by the pointwiseTraceExtendsEnv.- Composition laws
EventArg.ExtendsEnv.trans_union/Event.ExtendsEnv.trans_union/TraceExtendsEnv.trans_unionchain two stages while unioning their extra-register classes. - Semantic transport laws transfer assumption satisfaction and reachability
forward across
Trace.StuttersEnv, and reflect assertion validity backward, underConditionInterp.StableUnderExtendsEnvandConditionInterp.TrueStutterHolds. - Reflexivity / monotonicity / append laws for each relation, the
Trace.StuttersEnv.Cmd.emittedEvents_stuttersEnvcommand-snapshot law, and theTraceExtendsEnv.toTraceStuttersEnvrefinement. - Semantic matching
TraceExtendsEnv.toMatchesupgrades lockstep extension to a pointwise match under any semantic argument relation, given defined source reads and well-formed snapshots;Event.Matches.compandTrace.matches_compcompose such matches. WithWFstrengthenings ofEventArg.ExtendsEnv(EventArg.WithWFis defined inTraceRelations):EventArg.WithWF.mono/trans/label_metadata/factory_label_metadata, with trace-levelTrace.WithWF.append/toExtendsEnv/of_extends/mono/trans/toTraceStuttersEnv/assertionValidFrom_reflect.Trace.WeakensAssumesis reflexive and transitive (Trace.WeakensAssumes.refl,Trace.WeakensAssumes.trans), as is its event-level counterpart relationEvent.WeakensAssume. It carries assumption satisfaction from the source to the target (Trace.WeakensAssumes.assumptionsHold_transfer) and reflects assertion validity from the target to the source (Trace.WeakensAssumes.assertionsValid_reflect).Trace.InsertsTrueAssumesis reflexive and closed under concatenation (refl,append) and carries assumption satisfaction forward underConditionInterp.TrueStutterHolds(assumptionsHold). So is its composition withTrace.MayDropEvents, aList.Sublist(Trace.mayDropEvents_insertsTrueAssumes_*;drop_leftdrops a prefix of the source).Trace.PreservesLastEventcomposes on the left (append_left), and a relation preserving the last event followed by extra events reflects last assertions (Trace.PreservesLastEvent.reflectsLastAssertion).Trace.InsertsAssertsandTrace.InsertsCheckedAssumeshold under a larger set of allowed factories (mono_allowed), and, under an interpretation for which conditions with the same value hold alike (and, for the second, true conditions hold), reflect assertion validity (reflect,assertionsValidFromP_reflect) and carry reachability forward (reachable_transfer, for the second when the inserted checks of the target are valid); so does their composition (Trace.insertsAsserts_insertsCheckedAssumes_*).
With no permitted target-only bindings, event-argument extension is ordinary equality.
Every event argument extends itself.
Widening the accepted class of target-only registers preserves event-argument extension.
Event-argument extension composes while unioning extra-register classes.
Every condition interpretation is stable when target-only bindings are
forbidden: EventArg.ExtendsEnv false is equality, so both interpreted
conditions are identical.
Every event extends itself.
Widening the accepted class of target-only registers preserves event extension.
Event extension composes while unioning extra-register classes.
Every trace extends itself.
Widening the accepted class of target-only registers preserves environment-extending trace correspondence.
Environment-extending trace correspondence composes over chronological append.
A common exact prefix preserves environment-extending trace correspondence.
Semantic transport across Trace.StuttersEnv #
Trace.StuttersEnv transfers assumption satisfaction from source to target:
any world satisfying the source trace's assumptions satisfies the target's.
Dropped-left stutter weakens the source assumptions; inserted-right stutter adds
an assumption the evaluator deemed true (htrue); and paired assumptions agree
by stability (hstable).
Trace.StuttersEnv transfers reachability forward: a reachable source trace
has a reachable target trace (same world witness).
Whole-trace validity reflection across Trace.StuttersEnv: target validity
reflects to source validity under semantic stability. The empty-accumulator
instance of assertionsValidFrom_reflect.
Every trace is in lockstep with itself.
Widening the accepted class of target-only registers preserves lockstep trace correspondence.
Lockstep trace correspondence composes over chronological append.
The same command observed in classified extending stores emits
lockstep-related traces. Each command emits a fixed number of events whose kind
depends only on the command, not on the store, so the source and target traces
have equal length and their single (assert/assume/cover) event corresponds by
Event.ExtendsEnv.
Consecutive lockstep correspondences compose, unioning the accepted
target-only register classes. This is the sound transitivity principle
Trace.StuttersEnv lacks: two-sided true-event stuttering would let a middle
event be extended to one reading a newly added binding, but a lockstep middle
event is matched exactly, so the classes compose.
Consecutive lockstep correspondences using the same accepted class compose.
Pointwise trace correspondence refines the stuttering correspondence: every
pointwise (lockstep) step is in particular a non-stuttering Trace.StuttersEnv
step.
The same command observed in classified extending stores emits stutter-related traces, as a corollary of its pointwise event correspondence.
Replay a canonical event-producing command on an extending target store, in
pointwise lockstep. The replay preserves classified store extension and relates
the command's observable snapshots with the pointwise TraceExtendsEnv.
Key idea: replaying the same command c on an extending store emits the same
number and kinds of events because event shape depends only on the command, so
the source and target traces correspond event-by-event. Store extension supplies
every value read by the source evaluation and is preserved by the resulting
store updates.
Pointwise environment extension strengthens to any semantic argument relation once source reads are defined and both traces carry well-formed snapshots. Source-defined free variables are preserved by the store extension, which supplies free-variable store agreement.
Same-kind event matching composes through a middle event.
Pointwise same-kind event matching composes through a middle trace.
WithWF strengthenings of ExtendsEnv #
Widening the accepted class of target-only bindings preserves
WithWF (ExtendsEnv _).
WithWF (ExtendsEnv _) composes while unioning the classes of target-only
bindings.
Arguments related by WithWF (ExtendsEnv _) carry the same assertion label
and metadata.
WithWF (ExtendsEnv _) keeps the factory, the label and the metadata of the source
argument.
Forgetting the well-formedness evidence recovers ordinary event extension.
Forgetting the well-formedness evidence pointwise recovers trace extension.
Ordinary lockstep extension strengthens to WithWF matching when source
event reads are defined and both traces carry well-formed snapshots.
Widening the accepted class of target-only bindings preserves
Trace.WithWF (ExtendsEnv _).
Trace.WithWF (ExtendsEnv _) composes through a middle trace while unioning
the classes of target-only bindings.
Trace.WithWF (ExtendsEnv _) is also a stuttering correspondence.
Trace.WithWF (ExtendsEnv _) reflects assertion validity for any condition
interpretation stable under EventArg.WithWF (ExtendsEnv _).
Every event is its own counterpart.
Counterparts compose.
Trace.WeakensAssumes I is reflexive.
Trace.WeakensAssumes I is transitive: an event of the middle trace that is dropped from
the last one is an assumption, so its counterpart in the first trace is one too and is
dropped.
Assumptions of the source holding in a world hold in it for the target: every assumption of the target is the counterpart of one of the source, which holds in every world the source's does.
Assertion validity reflects from the target to the source.
Every trace is itself with no assumption inserted.
Trace.InsertsTrueAssumes is closed under concatenation.
The assumptions of t with true assumptions inserted hold in every world where those of t
hold, when every operationally true condition under an allowed factory holds in every
world.
Dropping events, then inserting true assumptions, is reflexive.
Dropping events, then inserting true assumptions, is closed under concatenation.
Dropping a whole prefix of the source keeps dropping events, then inserting true assumptions.
Dropping events, then inserting true assumptions under some allowed factories, relates the same traces under any larger set of allowed factories.
The assumptions of a trace related to t by dropping events, then inserting true
assumptions, hold in every world where those of t hold, when every operationally true
condition under an allowed factory holds in every world.
Inserting assertions under some allowed factories inserts them under any larger set of allowed factories.
Reflecting validity across inserted assertions. For an interpretation I under which
conditions with the same value hold alike under allowed factories
(EventArg.SameValue), and a filter keep of assertions that depends only on label and
metadata: when the target t' keeps keep valid after the assumptions A', and A'
holds where A does, then t keeps keep valid after A, and the assumptions of t'
hold where those of A and t do.
Under an interpretation for which conditions with the same value hold alike under allowed
factories, the validity of the assertions of the target satisfying keep implies that of
the assertions of the source satisfying keep, for a filter keep depending only on label
and metadata.
Under an interpretation for which conditions with the same value hold alike under allowed factories, the target is reachable where the source is.
Inserting checked assumptions under some allowed factories inserts them under any larger set of allowed factories.
Reflecting validity across inserted checked assumptions. For an interpretation I
under which conditions with the same value hold alike and true conditions hold, both under
allowed factories: when the target t' keeps (Checks c ∨ keep c) valid after the
assumptions A', its checking assertions before it hold where A' does, and A' holds
where A does, then t keeps keep valid after A, and the assumptions of t' hold
where those of A and t do.
Under an interpretation for which conditions with the same value hold alike and true
conditions hold, under allowed factories, the validity of the assertions of the target
satisfying Checks or keep implies that of the assertions of the source satisfying
keep.
Under an interpretation for which conditions with the same value hold alike and true
conditions hold, under allowed factories, the target is reachable where the source is,
when its assertions satisfying Checks are valid.
Inserting assertions, then checked assumptions, under some allowed factories, relates the same traces under any larger set of allowed factories.
Validity reflected across inserted assertions and then checked assumptions. Under an
interpretation for which conditions with the same value hold alike and true conditions
hold, under allowed factories, the validity of the assertions of the target satisfying
Checks or keep implies that of the assertions of the source satisfying keep, for a
filter keep depending only on label and metadata.
Under an interpretation for which conditions with the same value hold alike and true conditions hold, under allowed factories, the validity of the assertions of the target implies that of the assertions of the source, across inserted assertions and then checked assumptions.
Under an interpretation for which conditions with the same value hold alike and true
conditions hold, under allowed factories, the target is reachable where the source is,
across inserted assertions and then checked assumptions, when the assertions of the target
satisfying Checks are valid.
A relation closed under concatenation, relating a to a', followed by a nonempty target
preserving the last event of b, preserves the last event of a ++ b.
A relation R carrying assumption satisfaction from source to target: a target preserving
the last event of the source, after events related by R, followed by any extra events,
reflects last assertions.