Transitive inference, class inclusion and a variety of other inferential abilities have strikingly similar developmental profiles-all are acquired around the age of five. Yet, little is known about the reasons for this correspondence. Category theory was invented as a formal means of establishing commonalities between various mathematical structures. We use category theory to show that transitive inference and class inclusion involve dual mathematical structures, called product and coproduct. Other inferential tasks with similar developmental profiles, including matrix completion, cardinality, dimensional changed card sorting, balance-scale (weight-distance integration), and Theory of Mind also involve these structures. By contrast, (co)products are not involved in the behaviours exhibited by younger children on these tasks, or simplified versions that are within their ability. These results point to a fundamental cognitive principle under development during childhood that is the capacity to compute (co)products in the categorical sense.