Indexed Graded Monads
- Indexed graded monads are a categorical structure that generalizes graded and indexed monads by internalizing grading over fibers, enabling dependent effect tracking.
- They support advanced applications such as resource and cost analysis, probabilistic reasoning, temporal safety, and circuit generation in dependently-typed settings.
- The framework rigorously formalizes coherence laws and reindexing functoriality to ensure that effect annotations vary accurately with contextual parameters.
Indexed graded monads are a categorical structure generalizing graded monads and indexed monads, developed to provide semantics for effect systems and refinement type systems with dependent effects—effects whose quantitative or qualitative characteristics depend on parameters or predicates drawn from the typing context. They unify several strands in the theory of computational effects, supporting value-dependent resource analysis, probabilistic reasoning, and temporal safety properties. As ordinary graded monads model effect systems by grading by a monoid, and indexed monads provide families of monads parameterized over a base category, indexed graded monads internalize graded monads to fibers of a fibration, with the grading varying over the base category. This yields a structural framework capturing both global and context-dependent effect tracking in programming language semantics (Kura et al., 21 Jan 2026, Orchard et al., 2020, Orchard et al., 2014, Sakayori et al., 27 Nov 2025, Fujii, 2019).
1. Foundational Structures: Graded, Indexed, and Indexed Graded Monads
Classical graded monads are defined by a monoidal grading set acting on a base category , with a functor , together with unit and multiplication operations indexed by and satisfying graded coherence laws (Orchard et al., 2020, Orchard et al., 2014, Fujii, 2019). Ordinary indexed monads involve an indexing category , forming a functor such that for each , is a monad and the assignment is functorial in (Orchard et al., 2014, Fujii, 2019).
Indexed graded monads combine these axes. Formally, let be a fibration, and let be a -indexed family of preordered monoids. An indexed -graded monad is a family of graded monads on each fiber , such that for every in , the reindexing is a morphism of graded monads, i.e.,
with preservation of units and multiplications (Kura et al., 21 Jan 2026, Fujii, 2019). If , this collapses to an ordinary graded monad.
This framework subsumes the main generalizations:
| Structure | Indexing | Grading | Generalizes |
|---|---|---|---|
| Monad | constant | none | Classical effect semantics |
| Graded Monad | none | monoid | Effect systems |
| Indexed Monad | category | none | Program logics |
| Indexed Graded Monad | category | varying | Dependent effect systems |
2. Indexed Graded Monads and Dependent Effect Tracking
The principal motivation for indexed graded monads arises from the need to express dependent effects: effect annotations in type systems that may vary with parameters in the context, rather than being chosen uniformly. For example, cost bounds or probabilistic guarantees dependent on program inputs are not expressible using classical graded monads, which grade by a fixed monoid (Kura et al., 21 Jan 2026).
In a refinement-type setting, a dependent effect system allows effect terms to contain variables from the current typing context. For instance, a type describes computations whose cost is determined by program values and . The semantics requires fibers for each context and a family of monoids on each fiber, together with compatible monad structures and monoidal functors reflecting the base context structure (Kura et al., 21 Jan 2026).
Indexed graded monads provide the semantics for such systems: for each context , the fiber models value and computation types, and each is a preordered monoid of effects over . The monad's grade can thus depend on , allowing precise effect tracking and relational reasoning in context-sensitive analyses such as resource bounds, security assertions, and temporal properties (Kura et al., 21 Jan 2026, Sakayori et al., 27 Nov 2025).
3. Categorical Semantics and Coherence Laws
Formally, the structure of an indexed graded monad is captured as a monad internal to the 2-category of fibrations, with extra compatibility with the fibered premonoidal structure (Kura et al., 21 Jan 2026, Fujii, 2019). The categorical coherence requires that for every morphism in ,
- maps effects compatibly: preserves the monoid and preorder,
- maps objects in fibers: ,
- The monad structure is preserved: commutes with units and multiplications.
The underlying graded monad structure on each fiber consists of
- A unit ,
- Multiplications ,
- Reindexing functoriality linking context changes to effect grading.
Typical coherence diagrams—unit laws, associativity, and compatibility with reindexing—must commute across the fibers (Kura et al., 21 Jan 2026, Fujii, 2019).
4. Examples and Instances
Several concrete semantics instantiate indexed graded monads:
- Cost analysis: The base category is contexts (predicates) on a category (e.g., or ), and assigns to each context the set of functions , ordered pointwise. The monad acts as [(Kura et al., 21 Jan 2026), Sec. 6.1].
- Expectation bounds: For probabilistic reasoning, assigns value-dependent expectation shift bounds, with the fiberwise monad acting on subspaces of distributions with bounded expectation [(Kura et al., 21 Jan 2026), Sec. 6.2].
- Temporal safety: The fiberwise graded monad encodes trace languages parameterized by predicates, supporting semantic soundness for temporal contracts [(Kura et al., 21 Jan 2026), App. D.3].
- Resource-tracking quantum circuits: The monad on , , is refined using a circuit algebra to become an -graded monad on , modeling resource-aware circuit generation with effect typing (Sakayori et al., 27 Nov 2025).
These examples demonstrate that indexed graded monads subsume both ordinary effect and resource analysis as well as advanced dependent analyses.
5. Typing Discipline and Denotational Semantics
Effect typing with indexed graded monads decorates terms and types with effect annotations dependent on context. Typing judgments take the form
where is a (possibly dependent) effect annotation in . Denotationally, the semantics assigns
for each term . This subsumes conventional monadic semantics (-graded or otherwise), enabling dependent subeffecting, composition, and refined effect polymorphism (Orchard et al., 2014, Kura et al., 21 Jan 2026, Sakayori et al., 27 Nov 2025). The soundness theorem asserts that syntactically well-typed programs have semantics respecting all effect and resource invariants imposed by the indexings (Kura et al., 21 Jan 2026), Thm 5.8.
Effect typing rules follow the graded monad's structure (e.g., sequencing via for let, subeffecting by morphisms in , and preservation under context reindexing). For circuit generation, the typing tracks abstract resource usage (e.g., gate count, width) compositionaly, as determined by the base circuit algebra and abstraction functor (Sakayori et al., 27 Nov 2025).
6. 2-Categorical and Lax Functorial Perspectives
Indexed graded monads admit characterization as monads in appropriate 2-categories. Fujii (Fujii, 2019) formalizes this by considering monads internal to certain 2-categories of fibrations, functors, and natural transformations, equipped with grading and indexing structures. Graded and indexed monads are monads in different 2-categorical environments; indexed graded monads combine these, requiring a composite structure with units and multiplications in both grade and index directions, and reindexing/regrading compatibility.
In particular, the composite functor , equipped with the four requisite structure families, is a monad in the relevant double 2-category, with Eilenberg–Moore and Kleisli constructions generalizing those for ordinary and graded monads [(Fujii, 2019), Prop. B.1]. This perspective clarifies the relation of indexed graded monads to parameterized and category-graded monads (Orchard et al., 2020).
7. Applications and Impact
Indexed graded monads provide modular semantics for a wide range of advanced type-and-effect systems, notably enabling
- Resource and cost analysis in dependently-typed calculi,
- Formal verification of value-bound probabilities, expectations, and temporal properties,
- Effect typing for program logics and circuit description languages, including the Proto-Quipper family (Sakayori et al., 27 Nov 2025),
- Sound and adequate denotational models for dependent effect systems, supporting proof principles such as induction on contexts and effect annotations (Kura et al., 21 Jan 2026).
Soundness and adequacy theorems guarantee that effect annotations in types precisely control the operational cost, probability, or resource usage of program executions, even in the presence of dependent or parametric variation. This leads to verified quantitative properties, compositional reasoning, and supports compiler optimizations and resource-dependent program synthesis (Kura et al., 21 Jan 2026, Sakayori et al., 27 Nov 2025, Orchard et al., 2014).
A plausible implication is that indexed graded monads will become a standard tool in the semantics of effectful, resource-sensitive, and dependently-typed programming languages, with ongoing impact on automated verification, cost analysis, and certified compilation.