Framing native stateful models inside a larger state #
An implementation of an ordinary StateM model also implements the native
modifyGet operation that runs that model on the left side of a product state.
The returned value is unchanged and the right-hand model is retained through
the existing heap frame rule. The resulting native stateful computation can
be composed using Refines.stateM_bind and specified with Std's usual triples.
Only the ordinary model runs inside modifyGet; this is not an extra RAM
instruction or a new evaluator. The source statement stays fixed. The same
safe execution and proved endpoint frame justify the enlarged representation;
disjointness, heap bounds and any original register conditions remain explicit.
Lift a native stateful implementation to a product state while retaining an unrelated represented heap object. The standard returned-value/final-state pair is reassociated internally, so subsequent native binds need no adapter.