Directories: A Convenient and Well-Behaved Formalism for Hierarchical Organization in Categorical Systems Theory
Abstract: This paper introduces an inherently strict presentation of categories with products, coproducts, or symmetric monoidal products that is inspired by file systems and directories. Rather than using nested binary tuples to combine objects or morphisms, the presentation uses named tuples. Specifically, we develop 2-monads whose strict 2-algebras are product categories, coproduct categories, or symmetric monoidal categories, in a similar vein to the classical Fam construction, but where the elements of the indexing set are period-separated identifiers like cart.motor.momentum. Our development of directories is also intended to serve the secondary purpose of expositing certain aspects of polynomial monads, and is accompanied by Haskell code that shows how the mathematical ideas can be implemented.
- All Concepts are $\mathbb{C}\mathbf{at}^\#$ (2023)
- Problems with fixpoints of polynomials of polynomials (2026)
- On polynomial functors and polynomial comonads over infinity groupoids (2026)
- Multisets of finite intervals and a universal category of poset representations (2026)
- The $\infty$-category of $\infty$-categories in simplicial type theory (2026)
- Composable Uncertainty in Symmetric Monoidal Categories for Design Problems (2026)
- Compositional Program Verification with Polynomial Functors in Dependent Type Theory (2026)
- Locally subcartesian closed categories (2026)
- Comonads as spaces (2026)
- Parameterized Quantum Circuit Semantics Through Enriched Categories (2026)
Summary
- The paper introduces directories as a structured, name-indexed representation for hierarchical data in systems theory, specifically aimed at variables, ports, and subsystems, ensuring strict substitution and human-readable names.
- Directories are modeled as finite prefix-free path sets and tieds polynomial data structures, formally characterized through polynomial monads, POLY-NOMIAL MONAD, and 2-monads resuting in clear algebraic and computational representation.
- The resulting formalism supports strict hierarchical substitution and allows horse-maintains clear categorical structure, enabling the replacement of inconsistent flat maps and nested tuples with a more coherent and efficient data management system.
- Question_1: How does the trie structure in directories enforce hierarchical consistency and substitution?
- Question_2: What computational benefits do directories offer over flat path maps and nested tuples in hierarchical systems?
- Question_3 Can the legislative lifts from sets to categories be implemented in a programming language other than Haskell?
- Question_4: How does the directory formalism address the ambiguity and structural validity issues in hierarchical composition?
- Find recent papers about
- 2023-10
The paper develops directories as a strict, name-indexed formalism for hierarchical organization in categorical systems theory. Its central claim is that hierarchical collections should be represented neither as flat maps from complete paths to values nor as recursively nested binary tuples, but as canonical tree-like structures whose leaves are labeled by prefix-free paths. This representation supports strict substitution, human-readable names, and categorical constructions corresponding to products, coproducts, and symmetric monoidal products. The resulting formalism is implemented in Haskell and characterized algebraically through polynomial functors, polynomial monads, 2-monads, and their algebras (2504.19389).
Motivation and scope
The motivating application is hierarchical modeling, particularly the organization of variables, ports, and subsystems in exergetic port-Hamiltonian systems. Names such as motor.stator.coil.magnetic_flux encode both identity and structural containment. A flat map from paths to values is convenient for lookup, but it does not itself enforce the consistency conditions required by hierarchical composition. For example, if one system contains a value at b.c and another system is placed at a.b, naïvely flattening the resulting nested map can identify or confuse paths that should remain structurally distinct.
The paper therefore treats a directory as a data structure with two simultaneous interpretations. Computationally, it is a trie whose internal nodes represent nonterminal namespaces and whose leaves carry values. Categorically, it is an element of a polynomial monad whose shapes encode finite prefix-free collections of paths and whose directions select the leaves. This combination is important: the trie representation enforces structural validity, while the polynomial presentation makes substitution, functoriality, and algebraic structure explicit.
The paper has two principal objectives. First, it constructs a monad Dtry on sets that formalizes directories and hierarchical substitution. Second, it lifts this structure to a 2-monad on categories and identifies its strict 2-algebras with familiar categorical structures, while retaining named rather than integer-indexed tensor factors.
Polynomial functors and the trie construction
The construction begins with polynomial functors in the form
p(X)≅∑i∈p(1)Xp[i],
where i is a position or shape and p[i] is the set of directions associated with that shape. This representation separates the structural shape of a data object from the values stored in its positions. Lists provide the standard example: a list shape is its length, while the directions are the positions in that list.
Records are obtained by replacing integer-indexed directions with finite sets of symbols. If Sym is a set of names, the record polynomial is
Record=∑U⋐SymyU.
An element of Record(X) is therefore a finite set of distinct names together with an X-value at each name. The paper uses Haskell maps as the implementation of this structure, while emphasizing that the mathematical object is a dependent sum over finite subsets.
A first attempt at directories would use maps from lists of symbols to values:
Record=∑U⋐SymyU.3
This representation has a useful extensional property: a directory is determined by its complete paths and their values. It is unsuitable for hierarchical substitution, however, because arbitrary path maps do not distinguish the structural boundary between a path and its prefix. The paper’s counterexample is that a directory at a containing b.c and a directory at a.b containing c can produce ambiguous results under flattening.
The first trie representation addresses this issue:
Record=∑U⋐SymyU.4
The resulting structure is the free monad on the record polynomial, denoted mRecord. Its unit is a leaf, and its multiplication recursively substitutes directories into directory positions. This construction ensures that a path ending at a leaf cannot also be a prefix of another leaf path. Consequently, hierarchical substitution is structurally well-defined.
However, Dtry1 admits empty internal directories. A tree may contain branches such as x and y with no leaves below them while another branch z contains a value. This creates an ambiguity for operations such as filtering: if all values under a subdirectory are removed, should the subdirectory remain as an empty namespace or disappear? The paper resolves this by disallowing nonempty subdirectories whose record of children is empty, while retaining an empty directory only at the root.
The nonempty record polynomial is
p(X)≅∑i∈p(1)Xp[i],0
The final directory polynomial functor is defined as
p(X)≅∑i∈p(1)Xp[i],1
where the outer Maybe represents either an empty top-level directory or a nonempty trie. This distinction is not merely an implementation detail. It is what makes the tree representation extensional with respect to its leaf paths and makes filtering compatible with the directory invariant.
The polynomial monad structure
The paper proves that p(X)≅∑i∈p(1)Xp[i],2 is a polynomial monad. The free-monad component is obtained by the standard iterative construction
p(X)≅∑i∈p(1)Xp[i],3
followed by a colimit. For p(X)≅∑i∈p(1)Xp[i],4, this yields finite trees whose internal nodes are nonempty records.
The outer Maybe does not automatically compose with the free record monad. The paper therefore constructs a distributive law
p(X)≅∑i∈p(1)Xp[i],5
Operationally, the law removes Nothing entries from a nonempty directory and returns Nothing precisely when all entries have been removed. The appendix verifies the distributive-law axioms using a general result for free monads and a natural transformation that filters absent values. This yields the monad multiplication on p(X)≅∑i∈p(1)Xp[i],6.
The monad multiplication has a particularly transparent path-level description. A directory of directories is indexed by an outer prefix-free set p(X)≅∑i∈p(1)Xp[i],7 and, for each p(X)≅∑i∈p(1)Xp[i],8, an inner prefix-free set p(X)≅∑i∈p(1)Xp[i],9. Substitution sends these to the concatenated set
i0
Because prefix-free sets remain prefix-free under this substitution, the result is again a valid directory. The essential strictness property is that path concatenation is strictly associative and unital. By contrast, nested tuple construction distinguishes i1 from i2 even though the two expressions are canonically isomorphic. Directories therefore replace associativity up to coherent isomorphism with literal associativity of path composition.
Path maps and extensionality
The paper establishes a correspondence between directories and finite prefix-free maps from paths to values. The map
i3
extracts the paths to the leaves and their associated values. Its injectivity follows from the fact that, under the nonempty-subdirectory invariant, the internal structure of the trie is determined by its leaf paths.
The image is characterized exactly by prefix-freeness. If one complete path were a prefix of another, the shorter path would terminate at an internal node rather than a leaf, contradicting the definition of the extracted path set. Conversely, every finite prefix-free set of paths can be reconstructed by inserting paths into an initially empty directory, provided insertion fails whenever a proposed path conflicts with an existing prefix.
This yields an inverse to pathMap on the prefix-free subcollection of flat path maps. The partial inverse is implemented through operations for prefixing a directory, constructing singleton paths, and inserting paths recursively. The resulting algorithm fails on non-prefix-free maps, which is precisely the behavior required to preserve the trie invariant.
This result gives i4 both a structural and an extensional presentation:
- structurally, it is a trie generated by nonempty records;
- extensionally, it is a finite prefix-free family of named leaves;
- algebraically, it is a polynomial monad whose multiplication is path concatenation.
The equivalence of these views is central to the paper’s claim that the formalism is both computationally practical and categorically well behaved.
From directories to the Fam construction
The categorical development begins by comparing directories with the classical i5 construction. For a category i6, i7 has finite or arbitrary families of objects of i8 as objects. A morphism consists of a function between indexing sets together with a component morphism for each source index. Variants of i9 provide free coproduct completions, product completions, and several forms of monoidal completion.
The basic p[i]0 construction exposes the strictness problem that directories are intended to solve. Flattening a nested family changes its indexing set from an iterated dependent sum such as
p[i]1
to an isomorphic but generally unequal rebracketing. Thus p[i]2 naturally supports a pseudomonad structure, but not the strict monad structure desired for direct implementation. Restricting indexing sets to canonical finite ordinals produces a strict construction, but loses meaningful names and forces reindexing by integers.
Directories provide a third option. Their indexing objects are canonical path sets, and path concatenation is strictly associative. Nested directory composition preserves the existing path as a suffix while adding a new prefix. A path such as a.b can become x.a.b without replacing the internal name a.b by an opaque numerical index.
Lifting to a 2-monad on categories
The set-level directory monad is lifted to categories in two stages. The first stage, denoted p[i]3, applies p[i]4 to the object and morphism sets of a category viewed as an internal category in p[i]5. This produces objects with directory-shaped families of objects and morphisms with the same directory shape.
The direct lift is insufficient because it only contains morphisms between families whose directory structures agree. It cannot, for example, express a morphism from a one-element family indexed by a to a one-element family indexed by b, even though the underlying categorical objects may admit a morphism.
To add the missing morphisms, the paper maps p[i]6 to a finite-family category and factors this functor through the bijective-on-objects/full-faithful factorization. The intermediate category p[i]7 has:
- objects consisting of a directory shape p[i]8 and a labeling of its leaves by objects of p[i]9;
- morphisms consisting of a function between leaf sets together with a morphism in Sym0 for each leaf.
The factorization preserves the directory-shaped objects while freely adding the family morphisms required for categorical composition. The fully faithful comparison from Sym1 to Sym2 is shown to be an equivalence: every finite family can be represented by a directory with the corresponding number of leaves, and every morphism of families is represented in the directory construction.
The paper proves that this assignment extends to a 2-monad on Sym3. The proof relies on two technical ingredients. First, the set-level monad is cartesian, allowing it to lift to a 2-monad on internal categories. Second, the bo–ff factorization of the comparison map inherits a monad structure under suitable preservation conditions. The appendix establishes the required factorization lemma and uses orthogonality to define the multiplication and prove its associativity by uniqueness of fillers.
The resulting construction is strict at the 2-monadic level while remaining equivalent to the conventional finite-family construction.
Directory variants and monoidal structures
Several variants of the directory 2-monad correspond to different categorical structures:
| Directory construction | Corresponding algebraic structure |
|---|---|
| Sym4 | Cocartesian monoidal categories |
| Sym5 | Cartesian monoidal categories |
| Sym6 | Symmetric monoidal categories |
The distinction lies in the permitted maps between directory leaves. The coproduct-oriented construction permits arbitrary functions from source leaves to target leaves. The product-oriented construction reverses the relevant variance. The symmetric monoidal construction restricts the leaf map to bijections, thereby preserving the number of tensor factors while allowing permutations.
A strict 2-algebra for Sym7 is a category Sym8 equipped with a functor
Sym9
satisfying the unit and multiplication laws of the 2-monad. In a symmetric strict monoidal category, Record=∑U⋐SymyU.0 sends a directory of objects to the tensor product of its leaves in a fixed lexicographic order. A morphism of directories induces the corresponding tensor of component morphisms followed by the permutation determined by the leaf bijection.
The important point is that the strictness is not obtained by choosing a skeleton of the underlying category. Instead, strictness resides in the indexing formalism. The binary operation extracted from a directory algebra need not itself be strictly associative for every chosen two-leaf directory. What is strict is the unbiased directory operation and its compatibility with substitution. This distinction avoids forcing the implementation to encode all tensor products through nested binary terms.
The paper further defines strict, pseudo, lax, and colax morphisms of directory algebras using the four possible orientations of the comparison square between the directory actions. Directory transformations provide the analogue of monoidal natural transformations. The resulting 2-category of Record=∑U⋐SymyU.1-algebras, lax morphisms, and transformations is asserted to be 2-equivalent to the corresponding 2-category of symmetric monoidal categories, lax symmetric monoidal functors, and monoidal natural transformations.
Computational and systems-theoretic significance
The Haskell development is not merely illustrative pseudocode. It provides executable definitions for the trie, functorial action, monad unit, monad multiplication, path extraction, insertion, and reconstruction. The implementation makes the invariants operational: malformed flat path maps fail during reconstruction, empty internal records cannot be constructed through the intended interface, and hierarchical substitution is implemented by recursive path extension.
For systems theory, the formalism offers a typed namespace mechanism for variables and components. A system can expose variables through paths, while a composition specification can organize subsystems in a directory. Monad multiplication then supplies the flattening operation needed after composition, but does so through structural substitution rather than string concatenation. The resulting names preserve the compositional history of a component.
The categorical interpretation also supports the abstraction of ports, variables, and interfaces as objects in an ambient category. Depending on the chosen directory variant, composition can be governed by coproduct-like, product-like, or symmetric monoidal behavior. This gives the naming scheme a formal relationship to the compositional semantics rather than treating names as metadata external to the mathematics.
Limitations and open questions
The paper is primarily foundational and does not report benchmark measurements, asymptotic complexity analyses, or comparisons with alternative hierarchical data structures. Consequently, the claims of convenience and efficiency are supported by the algebraic design and the executable implementation, not by empirical evaluation. In particular, the cost of insertion, lookup, path normalization, and categorical composition for large directories remains unquantified.
The category-level implementation is not provided in Haskell. The paper explicitly notes that categories are awkward to represent without dependent types and leaves this part for a prospective Julia or Rust implementation. Thus, the executable correspondence is strongest for the set-level directory monad; the 2-monadic constructions are presented mathematically rather than validated through a complete software artifact.
There are also size and finiteness assumptions throughout the development. The basic polynomial presentation uses finite records, and the free-monad construction is initially described under the assumption that each direction set is finite. The paper notes that more general cases can be handled, but does not develop them in detail. The use of a fixed lexicographic order on symbols is likewise an implementation-level choice needed to pass through an ordinal-indexed strict finite-family construction. The resulting strictification depends on this order, even though the associated categorical structures are equivalent independently of that choice.
Finally, the relationship between directory-multicategories and concrete systems-theoretic semantics is stated but not fully developed. The paper identifies formalizing graphical syntax and relational semantics for exergetic port-Hamiltonian systems as a specific open problem. It remains to be shown how the directory formalism interacts with the full semantics of wiring diagrams, relational composition, and the physical constraints of the intended modeling language.
Conclusion
The paper constructs a directory formalism in which hierarchical organization is represented by finite prefix-free path sets and trie-shaped polynomial data. The resulting Record=∑U⋐SymyU.2 is a polynomial monad whose multiplication is strict path substitution. Its lift to a 2-monad on categories yields directory-indexed analogues of finite coproduct, finite product, and symmetric monoidal completions. The principal mathematical contribution is the reconciliation of strict algebraic composition with human-readable hierarchical names, avoiding both the ambiguity of flat path maps and the coherence overhead of nested binary tuples. The principal technical question left open is the complete computational realization and systems-theoretic validation of the category-level constructions.
Paper to Video (Beta)
No one has generated a video about this paper yet.
Whiteboard
No one has generated a whiteboard explanation for this paper yet.
Paper Prompts
Sign up for free to create and run prompts on this paper.
Top Community Prompts
Open Problems
We found no open problems mentioned in this paper.
Continue Learning
- How does the trie structure in directories enforce hierarchical consistency and substitution?
- What computational benefits do directories offer over flat path maps and nested tuples in hierarchical systems?
- Algorithms involved?
- Can the legislative lifts from sets to categories be implemented in a programming language other than Haskell?
- Find recent papers about file management.
Tweets
Sign up for free to view the 1 tweet with 5 likes about this paper.