Variable binding and substitution for (nameless) dummies

By abstracting over well-known properties of De Bruijn's representation with nameless dummies, we design a new theory of syntax with variable binding and capture-avoiding substitution. We propose it as a simpler alternative to Fiore, Plotkin, and Turi's approach, with which we establish a strong formal link. We also show that our theory easily incorporates simple types and equations between terms.


Introduction
In this paper we propose a new initial-algebra semantics [GT74] for syntax and substitution in the presence of variable binding, which gives a new perspective on the status of the well-known De Bruijn encoding [DB72].
Given a so-called binding signature [Plo90] (which we suppose untyped in this introduction), De Bruijn's encoding provides an explicit definition of the desired syntax; it consists of a (single) set of terms, equipped with a suitable operation of "substitution".The salient feature of De Bruijn's encoding is that variables are represented by natural numbers, which he termed "nameless dummies", hence the title of the present paper.The idea is that any occurrence of 0 refers to the binder just above it (in the abstract syntax tree), if any, while 1 refers to the next one up, and so on.E.g., ..() is represented by ..(1 0).See [FPT99,Shu21] for more recent analyses.This encoding is generally considered "good for machine implementations, but not [...] for machine-assisted human reasoning" [GP99] (see also [ABF + 05, BU07]).
Our initial-algebra semantics provides an alternative to the above explicit definition, by offering an implicit one: • We design a category of "models" of the considered signature.
• We define the desired syntax (up to unique isomorphism) as the initial object in this category.One may then reason about syntax independently of any chosen initial object, since initiality provides a convenient induction principle.
Of course, we have to prove that such an initial object exists, and the natural witness in this proof is precisely De Bruijn's encoding.It thus acquires the new status of initiality witness, and hence may be forgotten, to some extent.
We know of two initial-algebra semantics for syntax with substitution in the presence of variable binding.A mainstream one is by Fiore et al. [FPT99,Fio08], while the second one, which also handles linear syntax, is due to Power [Pow07].Both approaches consider terms indexed by the number of (potential) free variables.By contrast, ours involves a single (infinite and implicit) context.It is thus simpler, at least in the sense that it can naturally be implemented in a proof assistant without dependent types.We demonstrate this by implementing our framework in HOL Light.We also provide a Coq implementation for comparison.
Let us emphasise that our initial-algebra semantics optimises the usual layering into (1) syntax, (2) variable renaming, and (3) substitution.Indeed, we show that the second layer is unnecessary, and directly give the implicit definition of syntax with substitution in (unindexed) sets.
A consequence is that our mechanisations offer a very different trusted computing base 1 from what one usually gets with an explicit definition.
• With an explicit definition, the trusted computing base typically consists of the inductive type defining the syntax, the recursive definition of renaming, and the recursive definition of substitution.• By contrast, in our mechanisations, the trusted computing base consists of the definition of the category of models, and the initiality statement.As the authors have experienced, the pros and cons can be discussed ad libitum.We refrain from doing so in this paper.
1.1.Overview.Let us now present our contribution in a bit more detail, for which we should start by recalling binding signatures.
Definition 1.1.A binding arity is a sequence of natural numbers.A binding signature is a set  (of "operations"), together with a map  → N * , which associates a binding arity to each operation.
We should now answer the question: where do operations of a given binding arity live, and what are they?To the first question, we answer that they live in a De Bruijn monad, whose definition we now sketch.
Definition 1.3.A De Bruijn monad is a set , equipped with • a variables map  : N → , and • a substitution map  :  ×  N → , which takes an element  ∈  and an assignment  : N → , and returns an element (, ), which we denote by  [] when  is clear from context, satisfying three simple axioms (see Definition 2.3 below).
Remark 1.4.The use of the word "monad" is justified by the fact that De Bruijn monads are in fact relative monads [ACU15], see Corollary 3.12 below.
To the second question, what is an operation of a given binding arity in a De Bruijn monad (, , ), we answer as follows.
From here, we straightforwardly define models of a given binding signature  to be De Bruijn monads equipped with operations of the specified binding arities.We call such models De Bruijn -algebras, and organise them into a category  -DBAlg.
Finally, we prove that  -DBAlg admits an initial object (Theorem 3.16).For this, we follow (the standard modern variant of) De Bruijn's construction: • We extract from  a first-order signature ||, by mapping binding arities ( 1 , . . .,   ) to their lengths , and construct the free ||-algebra DB  over the set N of variables in the usual, first-order way.• We prove that DB  admits a unique substitution map satisfying both the binding conditions and the De Bruijn monad axioms.This is not entirely trivial, because we cannot directly take (1.1)-(1.3)as a recursive definition.Indeed, the recursive call in (1.3) would not be decreasing, at least in any standard proof assistant's sense!We thus resort to the usual, two-phase construction: -We first define a renaming map DB  × N N → DB  , by adapting (1.1)-(1.3) to the renaming case.-We then define the substitution map by (1.1)-(1.3),except that we replace the problematic recursive call in (1.3) by () [  ↦ →  + 1], which is a renaming, hence non recursive.We finally prove that this uniquely equips DB  with De Bruijn -algebra structure, and that the obtaind De Bruijn -algebra is initial.
Once this initial-algebra semantics is in place, we investigate the link with the abovementioned mainstream framework of Fiore, Plotkin, and Turi.We find that both categories of models may include pathological objects, in the sense that we do not see any loss in ruling them out.When we do so, we obtain equivalent categories (Theorem 4.25).
Next, we devote two sections to investigating the status of binding signatures and the binding conditions.Indeed, binding signatures are combinatorial objects, and the binding conditions may seem somewhat arbitrary.We provide two categorical interpretations of binding signatures and binding conditions.
• We first recast binding signatures within Borthelle et al.'s framework [BHL20], which is a generalisation of Fiore's [Fio08].After recalling the notion of structurally strong endofunctor (on Set), and the category Σ -Mon of models of such an endofunctor Σ, we show that any binding signature  gives rise to such an endofunctor Σ  , and exhibit an isomorphism  -DBAlg Σ  -Mon of categories over DBMnd.• We then recast our initial-algebra semantics within the module-based approach to syntax with variable binding and substitution [HM07,HM10].For this, we need to adapt the notion of parametric module over monads to De Bruijn monads, thus introducing parametric De Bruijn modules.We further define the category  -MAlg (for "modular algebras") of models of any such parametric De Bruijn module .Finally, we show that any binding signature  gives rise to a parametric De Bruijn module   , and exhibit an isomorphism  -DBAlg   -MAlg of categories over DBMnd.Our next two contributions extend the initial-algebra semantics in two different directions.
• We first propose a simply-typed generalisation, which is parameterised over a given set of types.We adopt a standard simply-typed variant of binding signatures [FH10], and prove a corresponding initiality result (Theorem 7.27).The strength-based and module-based recastings that we just mentioned could be extended to this setting, but we refrain from doing so for simplicity.• Then, we consider equations.We introduce a notion of De Bruijn equational theory, and prove a corresponding initiality result (Theorem 8.7), whose witness is a straightforward quotient of De Bruijn's encoding.Finally, in §9, we provide two mechanised versions of our framework: the first one is in Coq, while the second one is in HOL Light, a proof assistant which does not support dependent types, thus illustrating the simplicity of our theory.1.2.Plan of the paper.In §2, we introduce De Bruijn monads, De Bruijn -algebras, and the De Bruijn -algebra DB  .We furthermore prove (Theorem 2.21) that DB  admits a unique substitution map satisfying the binding conditions with the desired behaviour on variables.In §3, we organise De Bruijn monads as a category, which we prove equivalent to categories of relative monads and of monoids.For any binding signature , we then organise De Bruijn -algebras into a category  -DBAlg, wherein we prove that DB  is an initial object.In §4, we establish the announced link with the presheaf-based approach.In §5 and 6, we introduce our interpretations of binding signatures and binding conditions in terms of structurally strong endofunctors and modules, respectively.We enrich the framework with simple types in §7, and with equations in §8.In §9, we briefly describe our mechanisations in HOL Light and Coq.Finally, we conclude in §10.

Related work.
Abstract frameworks for variable binding.We have already mentioned the tight link with the presheaf-based approach [FPT99].This link could probably be extended to variants such as [HM07, HM10, AM21, FS22].
In recent work, Allais et al. [AAC + 18] introduce a universe of syntaxes, which essentially corresponds to a simply-typed version of binding signatures.Their framework is designed to facilitate the definition of so-called traversals, i.e., functions defined by structural induction, "traversing" their argument.In a similar spirit, let us mention the recent work of Gheri and Popescu [GP20], which presents a theory of syntax with binding, mechanised in Isabelle/HOL.Potential links between these frameworks and our approach remain unclear to us at the time of writing.
The categories of "intersectional" objects obtained in §4 are technically very close to nominal sets [GP99]: finite supports appear in the "action-based" presentation of nominal sets (and in our §4.2),while pullback preservation appears in their sheaf-based presentation (and in our §4.1).And indeed, any intersectional presheaf yields a nominal set, and so does any finitary De Bruijn monad.However, these links are not entirely satisfactory, because they do not account for substitution.The reason is that the only categorical theory of substitution that we know of for nominal sets, by Power [Pow07], is operadic rather than monadic, so we do not immediately see how to state a correspondence.
Finally, Pitts [Pit23] recently introduced semantics for the locally nameless approach to syntax, where bound variables are De Bruijn indices and free variables are chosen in a fixed infinite set of atoms.In some sense, his locally nameless sets are the counterpart of our finitary De Bruijn monads, in the untyped case.Beyond the difference between the locally nameless approach and the crude De Bruijn encoding we focus on, while only single-variable renamings are available in locally nameless sets, simultaneous substitution is built-in in De Bruijn monads.This enables us to define a notion of model (for a binding signature) with explicit compatibility conditions about substitution, resulting in a recursion principle which is compatible with substitution.
De Bruijn representation benefits from well-developed proof assistant libraries, in particular Autosubst [STS15,SSK19].Such libraries are somewhat complementary to our work.Their main goal is to automate part of the reasoning about substitution in the proof assistant, while we provide an initial-algebra semantics.In particular, it could be useful to adapt the decision procedure of Autosubst to our Coq library.1.4.General notation.We denote by  * = ∈N   the set of finite sequences of elements of , for any set .In any category C, we tend to write [, ] for the hom-set C(, ) between any two objects  and .Finally, for any endofunctor ,  -alg denotes the usual category of -algebras and morphisms between them, and  = .() will be its least fixed point.Finally, CAT denotes the large category of locally small categories.

De Bruijn monads
In this section, we start by introducing De Bruijn monads in an untyped setting.Then, we define assignment lifting, the binding conditions, and the models of a binding signature  in De Bruijn monads, De Bruijn -algebras.Finally, we construct the term De Bruijn -algebra DB  .
2.1.Definition of De Bruijn monads.We start by fixing some terminology and notation, and then give the definition.
Definition 2.1.Given a set , an -assignment is a map N → .We sometimes merely use "assignment" when  is clear from context.
• left unitality: () [  ] =  (), and Example 2.4.The set N itself is clearly a De Bruijn monad, with variables given by the identity and substitution N × N N → N given by evaluation.This is in fact the initial De Bruijn monad, as should be clear from the development below.
Example 2.5.The set Λ := .N +  +  2 of -terms forms a De Bruijn monad with well-known structure, which we now recall for completeness.Elements of Λ are generated by the following grammar, where  ranges over N.

𝑒 𝑛 | 𝜆(𝑒) | 𝑒 𝑒
The variables map N → Λ sends any  to itself, i.e., the leaf labelled .For substitution, we want it to satisfy the following mutually recursive equations: where succ : N → N denotes the successor map.However, the very last recursive call to substitution is not clearly decreasing in any way, so we cannot take this as a definition.Instead, we take it as a specification, and prove that there exist unique substitution and lifting maps satisfying the above equations.
(Because  is a mere renaming, the definition of ↑ is not recursive.)It is then straightforward to prove that the original equations are (uniquely) satisfied.In Example 3.17, as an application of Theorem 3.16, we will characterise the obtained De Bruijn monad by a universal property.In fact, the set Λ := .N +  +  2 has infinitely many De Bruijn monad structures, as many as there are binding arities with underlying endofunctors  ↦ →  and  ↦ →  2 , in the sense defined below.But only one of these structures models -calculus substitution.
2.2.Lifting assignments.In preparation for introducing the binding conditions, given a De Bruijn monad , we now define an operation called lifting on its set of assignments N → .It is convenient to stress that only part of the structure of a De Bruijn monad is needed for this definition.
Remark 2.7.Both ⇑ and ↑ depend on  and (part of) (, ).Here, and in other similar situations below, we abuse notation and omit such dependencies for readability.
2.3.Binding arities and binding conditions.Our treatment of binding arities reflects the separation between the first-order part of the arity, namely its length, which concerns the syntax, and the binding information, namely the binding numbers, which concerns the compatibility with substitution.Definition 2.9.
• A first-order arity is a natural number.
Let us now axiomatise what we call an operation of a given binding arity.
Definition 2.10.Let  = ( 1 , . . .,   ) be any binding arity,  be any set,  :  ×  N → , and  : N →  be any maps.An operation of binding arity  is a map  :   →  satisfying the following -binding condition w.r.t.(, ): (2.1) Remark 2.11.Let us emphasise the dependency of this definition on  and  -which is hidden in the notation for substitution and lifting.
2.4.Binding signatures and algebras.In this section, we recall the standard notions of first-order (resp.binding) signatures, and adapt the definition of algebras to our De Bruijn context.Let us first briefly recall the former.
Definition 2.12.A first-order signature consists of a set  of operations, equipped with an arity map ar :  → N.
Let us now generalise this to binding signatures.Example 2.15.As we saw in Example 1.2, the binding signature for -calculus has two operations, abstraction and application, of respective arities (1) and (0, 0).The associated first-order signature has two operations of respective arities 1 and 2.
Let us now present the notion of De Bruijn -algebra: Definition 2.16.For any binding signature  := (, ar ), a De Bruijn -algebra is a De Bruijn monad (, , ) equipped with an operation of binding arity ar (), for all  ∈ .
In order to state our characterisation of the term model, we associate to any binding signature an endofunctor on sets, as follows.
Remark 2.18.The induced endofunctor merely depends on the underlying first-order signature.
Definition 2.19.For any binding signature  = (, ar ) and Σ  -algebra  : Remark 2.20.As is well known, for any binding signature, the initial (N + Σ  )-algebra is the desired syntax; it has as carrier the least fixed point  .N + Σ  ( ).
The following theorem defines the term model of a binding signature.Proof.We have proved the result in both HOL Light [Mag22] and Coq [Laf22a], see §9.
Remark 2.22.Point (i) may be viewed as an abstract form of recursive definition for substitution in the term model.The theorem thus allows us to construct the term model of a signature in two steps: first the underlying set, constructed as the inductive datatype .N + Σ  (), and then substitution, defined by the binding conditions viewed as recursive equations.

Initial-algebra semantics of binding signatures in De Bruijn monads
In this section, for any binding signature , we organise De Bruijn -algebras into a category,  -DBAlg, and prove that the term De Bruijn -algebra DB  is initial therein.Notation 3.3.De Bruijn monads and morphisms between them form a category, which we denote by DBMnd.

De Bruijn monads as relative monads and as monoids.
In this subsection, we briefly mention an alternative presentation of De Bruijn monads for the categorically-minded reader, in terms of relative monads.Namely, we show that they are monads relative to the functor 1 → Set picking N.Then, following Altenkirch et al. [ACU15], we explain a companion presentation in terms of monoids in Set, for a suitable skew monoidal structure [ACU15,Szl12].
Remark 3.4.Altenkirch et al. have similarly shown that Fiore, Plotkin, and Turi's approach may be understood in terms of monads relative to the canonical embedding from finite sets into sets (and hence also in terms of monoids in a corresponding monoidal category).
Let us first briefly recall relative monads, which were introduced by Altenkirch et al. [ACU15].
Remark 3.6.This definition is slightly different from, but equivalent to the original.
Proposition 3.7.The category DBMnd is canonically isomorphic to the category of monads relative to the map 1 → Set picking N.
Remark 3.8.Canonicity here means that the isomorphism lies over the canonical isomorphism [1, Set] Set.

Proof. By mere definition unfolding:
• An object mapping  : 1 → Set amounts to a choice of object  in Set.
• A unit  : N →  amounts to a choice of variables map.
• The assignment of an extension  † :  →  to each  : N →  amounts to a map  N →   , which is equivalent by uncurrying to a choice of substitution map  ×  N → .Notationally,  † () thus corresponds to  [  ].
Furthermore, DBMnd is precisely the category of monoids therein.
Proof.By the standard formula for left Kan extension, we have Remark Proof.We have proved the result in both HOL Light [Mag22] and Coq [Laf22a], see §9.
Example 3.17.For the binding signature of -calculus (Example 2.15), the carrier of the initial model is .N +  +  2 .

Relation to presheaf-based models
The classical initial-algebra semantics introduced in [FPT99,Fio08] associates in particular to each binding signature  a category, say Φ  -Mon of models, while we have proposed in §3 an alternative category of models  -DBAlg.In this section, we are interested in comparing both categories of models.
In fact, we find that both may include pathological models, in the sense that we do not see any loss in ruling them out.And when we do so, we obtain equivalent categories.4.1.Trimming down presheaf-based models.First of all, in this subsection, let us recall the mainstream approach we want to relate to, and exclude some pathological objects from it.4.1.1.Presheaf-based models.We start by recalling the presheaf-based approach.The ambient category is the category of functors [F, Set], where F denotes the category of finite ordinals, and all maps between them.Proof.The category of sets is -accessible, so by [AR94, Theorem 2.26, (i) ⇔ (ii)] and [AR94, Remark 2.26(1)], it is a free cocompletion of its full subcategory of finitely presentable objects under directed colimits.Equivalently, it is a free cocompletion of F under directed colimits.Thus, by taking B to be Set in [AR94, Definition 2.25], we obtain that the restriction functor [Set, Set]  → [F, Set] is an equivalence.By construction, monoids in [F, Set] are thus equivalent to finitary monads on sets.The idea is then to interpret binding signatures  as endofunctors Φ  on [F, Set], and to define models as monoids equipped with Φ  -algebra structure, satisfying a suitable compatibility condition.
The definition of Φ  relies on an operation called derivation: Definition 4.4 (Endofunctor associated to a binding signature).
Next, we want to express the relevant compatibility condition between algebra and monoid structure.For this, let us briefly recall the notion of pointed strength, see [FPT99,Fio08] for details.
At last, we arrive at the definition of models.Definition 4.10.For any pointed strong endofunctor  on a monoidal category (C, ⊗, , , , ), an -monoid is an object  equipped with -algebra and monoid structure, say  :  () → ,  :  ⊗  → , and  :  → , such that the following pentagon commutes.Example 4.16.As an example of a non intersectional finitary monad, first consider the monad  of -calculus, so that  () is set of -terms taking free variables in .This monad is intersectional, but now consider the monad  ′ agreeing with  on any non-empty set, and such that  ′ (∅) = ∅.Then,  ′ is not intersectional.
The important result for comparing the presheaf-based approach with ours is the following.
Proposition 4.17.The subcategory Φ  -Mon int includes the initial object.
Proof.Roughly, closed terms are isomorphic to terms in two free variables that use neither the first, nor the second.
Let us conclude this subsection with the following observation, that for a wide class of signatures all models are in fact well behaved.Example 4.21.By Proposition 4.24 below, the initial -algebra is finitary, for any binding signature .For an example of infinitary De Bruijn monad, consider the greatest fixed point  .N + Σ  ( ), for any  with at least one operation with more than one argument.E.g., if  has an operation of binding arity (0, 0), like application in -calculus, then the term (0) ((1) ((2) . ..)) does not have finite support.
(3) ⇒ (1) Let  : N → N fixing the first  numbers.Then,  •  , as an assignment, also does.Thus,  [ •  ] = .Proof.One can define by induction the greatest free variable  of a term  (or 0 if  is closed).Then,  has support  + 1. 4.3.Bridging the gap.We may at last state the relationship between initial-algebra semantics of binding signatures in presheaves and in De Bruijn monads: Theorem 4.25.Consider any binding signature .The subcategories Φ  -Mon int and  -DBAlg fin are equivalent.
Remark 4.26.The moral of this is that, if one removes pathological objects from both Φ  -Mon and  -DBAlg, then one obtains equivalent categories, which both retain the initial object.Thus, up to equivalence, the two approaches to initial-algebra semantics of binding signatures differ only marginally.
Restricting attention to well-behaved objects, we may thus benefit from the strengths of both approaches.Typically, in De Bruijn monads, free variables need to be computed explicitly, while presheaves come with intrinsic scoping, as terms are indexed by sets of potential free variables.Conversely, in some settings, observational equivalence may relate programs with different sets of free variables [SW01].In such cases, it is useful to have all terms collected in one single set.This needs to be computed (and involves non-trivial quotienting) in presheaves, while it is direct in De Bruijn monads.The remainder of this section is devoted to sketching the proof of Theorem 4.25, and may be skipped on a first reading as it relies on the module-based interpretation of the binding conditions described later in §6.It remains to make the link with Mon[Set, Set] ℵ 1 ,int 0 .At this point, there is a difficulty.Indeed, the functor pin : otherwise is an equivalence preserving the identity endofunctor, but it is however not monoidal: e.g., letting  = ∅ and  = 1, we have Proof.We prove the more general fact that, if  () ≠ ∅ at any  ≠ ∅, then pin() • pin() = pin( • ): But at any  ≠ ∅, any monoid  is equipped with a unit component  →  (), so  () ≠ ∅, hence the result.
We thus obtain an equivalence over pin, hence the result.
We then characterise well-behavedness in both contexts, as follows.Lemma 4.32.The following squares commute, ≃ ≃ and all vertical functors are equivalences.
Proof.For De Bruijn monads, well-behavedness is finitarity.For presheaves, well-behavedness is preservation of empty intersections.
Corollary 4.33.We obtain a chain of equivalences The point is now to prove that this chain of equivalences lifts to one between  -DBAlg fin and Φ  -Mon int , for any binding signature .
For this, we adopt the viewpoint of modules over monads [HM10] (see §6 below for the module-based interpretation of the binding conditions).Let  = (, ar ) denote any binding signature.We first introduce the analogue of the endofunctor Φ  induced by a binding signature (Definition 4.4) in the context of [Set, Set]: Definition 4.34.We define We then show that this functor restricts to the relevant subcategories.Proof.For the various restrictions of F  , one checks that each of the conditions (finitarity, ℵ 1accessibility, preservation of empty intesections) is closed under coproducts, finite products, and shift, i.e., any  ↦ →  (− + ).For the second statement, it holds in [Set, Set], and all considered subcategories are full.
Definition 4.36.For any A morphism of  Calgebras is a monoid morphism commuting with action.We denote by  Calg the category of  C -algebras.
We next prove that in the case of [Set, Set]  and [Set, Set] ℵ 1 ,int 0 this interpretation of  corresponds to its interpretations in presheaves and De Bruijn monads through the equivalences of Lemmas 4.27 and 4.29.Lemma 4.37.We have commuting squares Proof.The first square is easy.The second is a tedious verification that the binding conditions correspond to the definition of module morphisms Finally, we show that the restrictions of Φ  -Mon and  -DBAlg to well-behaved objects are equivalent to  [Set,Set]  ,int 0 -alg.
Indeed, by definition, we have pullback squares so by the equivalences (4.3) and (4.2) the theorem follows from the next result.
Proposition 4.38.We have the following pullback squares.

Strength-based interpretation of the binding conditions
In the previous section, we have compared the category  -DBAlg of models of a binding signature  in De Bruijn monads with the usual category of Φ  -monoids [FPT99].In fact, the latter approach is much more general, in the sense that it does not only work for binding signatures but for so-called pointed strong endofunctors [FPT99], and in fact also for the more general structurally strong endofunctors introduced by Borthelle et al. [BHL20].
In this section, we show that De Bruijn algebras also generalise from binding signatures to structurally strong endofunctors, in the following sense.To any binding signature , we associate such an endofunctor, say Σ  , such that Σ  -Mon  -DBAlg, where Σ  -Mon is as defined for any structurally strong endofunctor by Borthelle et al.
This way we give a categorical status to binding signatures, as particular structurally strong endofunctors on Set.
Remark 5.1.We do not (yet) prove existence of an initial Σ-De Bruijn algebras for any larger class of endofunctors than those of the form Σ  .
Remark 5.2.We resort to structurally strong endofunctors because pointed strong endofunctors live on monoidal categories [FPT99, Fio08], while we have seen in Corollary 3.12 that our tensor product merely equips Set with skew monoidal structure.(The very purpose of structurally strong endofunctors is to generalise pointed strong endofunctors to the skew monoidal case.)Following up on Remark 3.13, we could equivalently work with the monoidal category [B[N, N], Set], in which the machinery of pointed strong endofunctors applies.
Remark 5.3.In fact, the isomorphism Σ  -Mon  -DBAlg is almost an equality, since the only difference lies in the difference between a family ( |ar () | → ) ∈ of operations and its cotupling ∈  |ar () | → : one could easily adjust the presentation to get an exact match.
The starting point is that the endofunctor Σ  associated to any given binding signature  may be equipped with a family of maps that will be used to specify how substitution commutes with the operations of .However, in order for such a map to be well-defined for binding operations, we need to assume that  features variables and renaming, i.e., that it is a pointed N-module.Moreover, this map should satisfy some compatibility laws.These definitions and conditions are detailed in §5.1, where we furthermore recall structurally strong endofunctors.In §5.2, we interpret binding signatures as such endofunctors, we recall the category of Σ-monoids, for any structurally strong endofunctor Σ, and establish the announced isomorphism of categories.Example 5.9.The canonical N-module structure of any De Bruijn monad (, , ) (in particular (N, , id) itself), described in Example 5.6, is in fact pointed, by the map  : N → .
Definition 5.10.Given an N-module (, ) and a set  , let  ⊠  denote the following coequaliser in Set. ).This makes the category N -Mod of N-modules into a skew monoidal category (with unit N, and invertible right unitor).Furthermore, the forgetful functor is monoidal, and creates monoids in the sense that monoids are the same in N -Mod and in Set.
Proof.To apply [LS14, Theorem 8.1], we need to prove that tensoring on the right in Set preserves reflexive coequalisers, which holds by interchange of colimits since  ⊗  =  ×  N is the  N -fold coproduct of  with itself.
In fact, this extends to N -Mod N : Proposition 5.13.Given pointed N-modules (, , ) and ( , , ), the N-module  ⊠  is canonically pointed by the map Proof.This result was proved and formalised in a general skew monoidal setting in [BHL20], see [Laf22b, IModules.PtIModule tensor].
Now that we have defined the tensor product of pointed N-modules, we may introduce structural strengths.
Definition 5.14 [BHL20, Definition 2.11].A structural strength on an endofunctor Σ : Set → Set is a natural transformation  , : Σ() ⊗  → Σ( ⊗  ), where  is any set and  is a pointed N-module, making the following diagrams commute, ,⊠ where  ′ ,, is (  ⊗  , ) •  ,, , for any .Remark 5.15.In examples, the first axiom will entail that the "identity" assignment should cross operations unchanged.In terms of De Bruijn monads, the "identity" assignment is merely the variables map , so, e.g., in the setting of Example 2.5, the axiom boils down to the fact that lifting  yields  again: ⇑ = .The second axiom will entail the substitution lemma  The technique extends to operations with more complex arities.where ar () = (  1 , . . .,     ) for all  ∈ .In order to define dbs  , we start by adapting the definition of assignment lifting (Definition 2.6) to pointed N-modules.
Using this, let us now define the De Bruijn strength of the identity functor.We will then iterate the process to show that each iterated lifting also equips the identity functor with a structural strength.Finally, we will use this as a basis for equipping the endofunctor Σ  associated with any binding signature , with a structural strength.The second axiom holds by chasing the following diagram.Combining the last two results, any id  = id is structurally strong, with the following strength, obtained by inductively unfolding (5.2): Definition 5.21.Let the th De Bruijn strength of the identity functor, dbs  , be defined by dbs  id,, (, ) = (, ⇑  ).In summary: Proposition 5.22.Each dbs  is a structural strength on the identity functor.
Let us now extend this to general binding arities:  For the second axiom, we need to prove that the following diagram commutes.For this, since the target is a product, we proceed componentwise, and by symmetry it suffices to check the first: The second axiom holds by chasing the diagram in Figure 1.

Let us finally put things together:
Corollary 5.27.For any binding signature  = (, ar ), the endofunctor Σ  induced by  admits as structural strength the composite or more concretely for all sets  and pointed N-modules  , where ar () = ( 1 , . . .,    ).
We call this the De Bruijn strength dbs  of Σ  .
In order to relate the initial-algebra semantics of §3 to the strength-based approach of [FPT99,Fio08], let us recall the definition of models, following the generalisation to the skew monoidal setting [BHL20].This extends straightforwardly to small products.• Given -modules  and , their coproduct is  + , with action defined by case analysis: This extends straightforwardly to small coproducts.
6.2.Derivation of substitution for modules.In this subsection, we explain module derivation.This operation does not change the carrier of the module, hence it acts on the substitution map only.In fact, it acts via the second argument of substitution, namely the assignment, as in §3 and §5.
• The th derivative  () of a parametric De Bruijn module  is defined by induction:  (0) =  and  (+1) = ( () ) (1) .• Given parametric De Bruijn modules  and , their binary product maps any  to the -module product  () ×  ().This extends straightforwardly to small products.• The parametric De Bruijn module   induced by a binding arity  = ( 1 , . . .,   ) is the product  ∈   (  ) of derivatives of the tautological parametric De Bruijn module.• Given parametric De Bruijn modules  and , their coproduct maps any  to the -module coproduct  () +  ().This extends straightforwardly to small coproducts.• The parametric De Bruijn module   induced by a binding signature  = (, ar ) is the coproduct ∈  ar () of the parametric De Bruijn modules induced by the arities of all operations.
6.4.Interpreting the binding conditions.In the previous subsection, we have interpreted binding signatures as parametric modules, but we have not yet defined the models of a parametric module.Let us do this now, and prove that, for any binding signature , the category of De Bruijn -algebras is isomorphic to the category of models of the induced parametric De Bruijn module   .
Definition 2.14.• A binding signature [Plo90] consists of a set  of operations, equipped with an arity map ar :  → N * .Intuitively, the arity of an operation specifies the number of bound variables in each argument.• The first-order signature || associated with a binding signature  := (, ar ) is || := (, |ar |), where |ar | :  → N maps any  ∈  to the length |ar ()| of ar ().
Definition 4.3.Let (⊗, ) denote the monoidal structure on [F, Set] inherited from the composition monoidal structure on [Set, Set]  through the equivalence of Proposition 4.2.

Proposition 4. 18 .
If the initial object DB ′  of Φ  -Mon has at least one closed term (i.e., DB ′  (∅) ≠ ∅), then Φ  -Mon int = Φ  -Mon.Proof.If  is a Φ  -monoid, then by initiality there is a morphism DB ′  → , and in particular a map DB ′  (∅) →  (∅).Since DB ′  (∅) is non-empty by assumption,  (∅) cannot be empty.The result then follows from [AMBL12, Proposition VII.7]: a monad  on Set either preserves the initial object, or is intersectional.Remark 4.19.The binding signatures for which the initial model has at least one closed term are those specifying at least a constant or an operation binding (at least) one variable in each argument.4.2.Trimming down De Bruijn monads.Let us now turn to well-behaved De Bruijn algebras.Here well-behavedness is about finitariness.However, it may not be immediately clear how to define finitariness of a De Bruijn monad.Definition 4.20.A De Bruijn monad (, , ) is finitary iff each of its elements  ∈  has a (finite) support   ∈ N, in the sense that for all  : N → N fixing the first   numbers, the corresponding renaming  •  fixes , i.e.,  [ •  ] = .

Definition 4. 23 .
For any binding signature , let  -DBAlg fin denote the full subcategory spanning De Bruijn -algebras whose underlying De Bruijn monad is finitary.Proposition 4.24.The subcategory  -DBAlg fin includes the initial object.
We start by proving that both De Bruijn monads and finitary monads are monoids in monoidal, full subcategories of[Set, Set].Let us first treat the easy case of finitary monads: Lemma 4.27.The category Mon[F, Set] of monoids in [F, Set] for the monoidal structure of Definition 4.3, is equivalent to the category Mon[Set, Set]  of monoids in [Set, Set]  .Proof.By definition of the monoidal structure on [F, Set].Now for De Bruijn monads: Definition 4.28.Let [Set, Set] ℵ 1 ,int 0 denote the full subcategory spanned by ℵ 1 -accessible endofunctors which preserve empty intersections.Lemma 4.29.Evaluation at N induces an equivalence between the category Mon[Set, Set] ℵ 1 ,int 0 of monoids in [Set, Set] ℵ 1 ,int 0 and the category DBMnd of De Bruijn monads.Note that any monad  on Set induces a De Bruijn monad  (N) by restricting the monadic bind and unit.This induces a functor whose restriction to Mon[Set, Set] ℵ 1 ,int 0 underlies the above claimed equivalence.Proof sketch.De Bruijn monads are equivalently monads relative to the embedding B[N, N] → Set of the full subcategory on N ∈ Set.Now, presheaves on a category are equivalent to presheaves on its Cauchy completion, and we prove that the Cauchy completion of B[N, N], i.e., the category of idempotent maps N → N, is equivalent to the full subcategory F+ of Set spanned by non-empty, finite ordinals and N. De Bruijn monads are thus equivalent to monads relative to the embedding  + : F+ ↩→ Set.Now, because the embedding is full, functors F+ ↩→ Set are equivalent to functors Set → Set which preserve the initial object and are ℵ 1 -accessible.Letting [Set, Set] ℵ 1 ,0 denote the category of such functors, we thus obtain an equivalence [B[N, N], Set] ≃ [Set, Set] ℵ 1 ,0 , which is monoidal.We thus obtain an equivalence DBMnd ≃ Mon[Set, Set] ℵ 1 ,0 .

5. 1 .A••
Structural strengths.We start by introducing a notion of set equipped with variables and renamings, in Definition 5.7 below.Recalling from Example 2.4 that N forms a De Bruijn monad, we have: Definition 5.4.An N-module is a set  equipped with an action of the monoid N N , namely a map  :  × N N =  ⊗ N → , making the following diagrams commute.( ⊗ N) ⊗ N  ⊗ (N ⊗ N) morphism of N-modules (, ) → ( , ) is a map  :  →  between underlying sets commuting with action, i.e., making the following square commute.-modules and morphisms between them form a category, which we denote by N -Mod.Notation 5.5.We generally denote  (,  ) by  [  ]  , or merely  [  ] when  is clear from context.Example 5.6.Any De Bruijn monad (, , ) (in particular (N, , id) itself) has a canonical structure of N-module given by  (,  ) =  [ •  ]  .Definition 5.7.• A pointed N-module is an N-module (, ), equipped with a map  : N →  which is a morphism of N-modules, i.e., such that the following square commutes.A morphism of pointed N-modules (, , ) → ( , , ) is a morphism of N-modules  : (, ) → ( , ) commuting with point, i.e., such that the following triangle commutes.Let N -Mod N denote the category of pointed N-modules.Remark 5.8.Equivalently, N -Mod N is the coslice category N/(N -Mod).

Definition 5. 18 .
The first De Bruijn strength of the identity functor is the mapdbs id,, :  ⊗  →  ⊗  (, ) ↦ → (, ⇑),defined for all  ∈ Set and  ∈ N -Mod N .Proposition 5.19.The first De Bruijn strength is a structural strength on the identity functor.Proof.We first check commutation with the right unitor, in this case   ⊗ N  ⊗ N.

Figure 1 :
Figure 1: Diagram chasing for the proof of Proposition 5.26.
Definition 3.15.For any binding signature , a morphism of De Bruijn -algebras is a map  :  →  between underlying sets, which is a morphism both of De Bruijn monads and of ||-algebras.We denote by  -DBAlg the category of De Bruijn -algebras and morphisms between them.
3.13.By Notation 3.10, if two functors  : E → C and  ′ : E ′ → C have the same object mapping up to isomorphism (hence in particular ob(E) ob(E ′ )), then -relative monads are isomorphic to  ′ -relative monads, and both are isomorphic to monoids in [E, C], resp. in [E ′ , C] (under the assumptions of Proposition 3.11).In particular, the functor 1 → Set picking N factors as1  − → B[N, N]  − → Set,where B[N, N] denotes the full subcategory spanned by N. Since the object mapping of  is the same as that of 1 → Set, De Bruijn monads are equivalently monoids in the category [B[N, N], Set].Remarkably, unlike Set with the skew monoidal structure of Corollary 3.12, [B[N, N], Set] is in fact monoidal.3.3.Categories of De Bruijn algebras.In this section, for any binding signature , we organise De Bruijn -algebras into a category  -DBAlg.Let us start by recalling the category of -algebras for a first-order :Definition 3.14.For any first-order signature , a morphism  →  of -algebras is a map between underlying sets commuting with operations, in the sense that for each  ∈ , letting  := ar (), we have  (  ( 1 , ...,   )) =   (  ( 1 ), ...,  (  )).We denote by  -alg the category of -algebras and morphisms between them.We now exploit this to define morphisms between De Bruijn -algebras:Theorem 3.16.Consider any binding signature  = (, ar ), and let DB  denote the initial (N + Σ  )-algebra.Then, the De Bruijn -algebra structure of Theorem 2.21 on DB  makes it initial in  -DBAlg.
Example 4.11.For the binding signature   of Example 2.15, a Φ   -monoid is an object , equipped with maps  ′ →  and  2 → , and with compatible monoid structure.Compatibility describes how substitution should be pushed down through abstractions and applications.4.1.2.Intersectional presheaves.The pathology we want to rule out only concerns the underlying functor of a model, so we just have to define well-behaved functors in [F, Set].Well-behavedness for a functor  : F → Set is about getting closed terms right.More precisely, for some finite sets  and , an element of  ( + ) which both exists in  () and  () should also exist in  (∅), and uniquely so.This says exactly that  should preserve the pullback Corollary 4.13.A functor F → Set preserves (binary) intersections iff it preserves empty (binary) intersections.Lemma 4.14.A functor  from Set (or F) to Set preserves empty binary intersections if and only if it preserves the following pullback.Proof.By Proposition 4.2, it is enough to reason on an endofunctor  on Set.If  preserves empty binary intersections, then it preserves the above pullback as a particular case.Conversely, assume that it preserves the above pullback.Then, the following diagram is an equaliser.Set], (resp., for any binding signature , an object of Φ  -Mon) is intersectional iff the underlying functor is.Let Φ  -Mon int denote the full subcategory spanned by intersectional objects.