## Section: Scientific Foundations

### Polygraphs and n-categories

An *(n + 1) -polygraph* is a presentation of an n -category by generators, called n -cells, and rewriting rules, called (n + 1) -cells [43] . For example, the list-splitting map , used in the merge-sort algorithm, can be presented (and computed) by the convergent 3-polygraph of Figure 1 .

Polygraphs are a common algebraic setting for many different types of rewriting systems. Indeed, abstract and word rewriting systems are 1-polygraphs and 2-polygraphs, respectively [43] . More important, every term rewriting system has a canonical translation into a 3-polygraph with similar computational properties (termination, confluence, complexity) and, particularly, in the left-linear case, hence, when the term rewriting system is a first-order functional program [43] , [61] [6] [51] . Other types of rewriting-flavoured objects also fit in the class of 3-polygraphs, like Petri nets [50] , propositional calculus and linear logic [49] , Reidemeister moves on braids or tangles diagrams [48] .

The computational properties of n -polygraphs appear as topological properties of the n -category they generate, that we study with tools adapted from algebraic topology.

For example, in the case of a 3-polygraph, termination and complexity respectively correspond to the finiteness and to the size of the three-dimensional reduction paths. To measure them, we use *derivations* of 2-categories [6] : informally, they associate each 2-cell with a "current propagation map" and a "heat production map". Well-chosen derivation give termination proofs and can also be used to analyse the complexity of polygraphs: a spatial bound is given by "currents" and a temporal one, by "heats". The complexity classes P and NP have characterisations in terms of polygraphs that admit a certain type of derivations [12] [40] .

For another example, convergence of a 3-polygraph is linked with the four-dimensional holes created by three-dimensional paths between them. When a polygraph has "good" computational properties, then it has *finite derivation type* , meaning that it has a finite number of generating holes [7] . In particular, every first-order functional program has finite derivation type, linking this topological property to computability.