  We develop a compositional framework for formal synthesis of hybrid systems
using the language of category theory. More specifically, we provide mutually
compatible tools for hierarchical, sequential, and independent parallel
composition. In our framework, hierarchies of hybrid systems correspond to
template-anchor pairs, which we model as spans of subdividing and embedding
semiconjugacies. Hierarchical composition of template-anchor pairs corresponds
to the composition of spans via pullback. To model sequential composition, we
introduce "directed hybrid systems," each of which flows from an initial
subsystem to a final subsystem in a Conley-theoretic sense. Sequential
composition of directed systems is given by a pushout of graph embeddings,
rewriting the continuous dynamics of the overlapping subsystem to prioritize
the second directed system. Independent parallel composition corresponds to a
categorical product with respect to semiconjugacy. To formalize the
compatibility of these three types of composition, we construct a vertically
cartesian double category of hybrid systems where the vertical morphisms are
semiconjugacies, and the horizontal morphisms are directed hybrid systems.
