Composing verified interface implementations #
Modules compose by substituting method bodies and composing representation relations. The intermediate state remains hidden, so callers need not depend on either representation. This construction shares the same semantics across all backend and resource interpretations.
Main definitions #
Module.id: the identity implementation of an interface.Module.comp: composition of two verified interface implementations.
Main results #
Module.simulates_client: semantic refinement lifts through an adaptive client.link_comp: composing methods agrees with consecutive linking.
theorem Cslib.Stateful.Module.simulates_client {D E : Spec} {α : Type w} (M : Module D E) (p : D.Client α) {s : D.State} {e : E.State} (hr : M.rep s e) (hv : D.ValidHistory s (D.runClient s p).2.2) :
Per-operation semantic simulations lift to the whole answer-dependent client.
Identity methods expose precisely one call and preserve the state representation.