# Category Theory [[2023-08-11]] Define category theory. > [!ai]+ AI > > Category theory is a branch of abstract mathematics that deals with the general structure of mathematical concepts and their relationships, rather than specific details and calculations. It provides a unifying framework for understanding and describing different areas of mathematics, including algebra, geometry, and logic. Category theory focuses on objects and the morphisms (or transformations) between these objects, grouping them into collections known as categories. This theory is also used in computer science, physics, and philosophy. ## History What is the history of category theory? > [!ai]+ AI > > Category theory was first introduced by American mathematician Samuel Eilenberg and Canadian mathematician Saunders Mac Lane in 1945. The pair first came up with the concept while trying to formalize their work on algebraic topology. > Eilenberg and Mac Lane originally developed category theory in order to understand the processes that preserved mathematical structure, which they named "functors". They discovered that they could analyze these functors by focusing on the relationships between mathematical objects, rather than on the objects themselves. This led them to define a "category" as a collection of objects and arrows (later called "morphisms") between them. > In the 1950s and 1960s, category theory started to find broader acceptance within mathematics. It was used to make significant advances in several fields, including algebraic geometry, logic, and set theory. The influential Grothendieck's work on algebraic geometry is an example of early use of category theory. > However, it wasn't until the late 20th century that category theory began to be seen as a field in its own right. In recent years, it has been applied in computer science, quantum physics and other areas of science and philosophy. > Despite its usefulness across multiple fields, category theory is also known for its abstractness and conceptual depth. As such, it has been a subject of some controversy within mathematics. Some mathematicians have argued that it's too abstract and lacks concrete applications, while others contend that its focus on structure and relationships provides valuable insights that can't be gained through other methods. > Today, category theory continues to be an active area of research with many open questions. Its applications extend beyond pure mathematics into areas such as theoretical computer science, quantum mechanics, linguistics, and cognitive science. Prompting claude with wikipedia history: - https://en.wikipedia.org/wiki/Timeline_of_category_theory_and_related_mathematics > [!ai]+ Claude > Here is a summary of the key events in the history of category theory based on the timeline: > > - Specific examples of categories, functors, and natural transformations were introduced in the 1940s by Eilenberg, Mac Lane, and others for algebraic topology. > > - Eilenberg and Mac Lane formally defined categories, functors, and natural transformations in their 1945 paper, providing an abstract framework. > > - Applications soon followed in the 1950s-60s in algebraic geometry (schemes, sheaves), homological algebra (derived functors, abelian categories), logic (toposes), and more. > > - Basic concepts like limits, adjoints, monads, and Kan extensions were developed in the late 1950s. Monoidal and enriched categories emerged in the 1960s. > > - Higher dimensional categories were explored in the 1960s, with definitions of bicategories, tricategories, and weak n-categories. > > - In the 1960s-70s, Grothendieck revolutionized algebraic geometry using categorical concepts like fibered categories, descent, stacks, and motives. > > - Quillen introduced model categories and homotopical algebra in 1967, providing an axiomatic framework for homotopy theory. > > - Categorical logic, topos theory, and higher topos theory developed primarily in the 1960s-70s with Lawvere, Tierney, Joyal, and others. > > - More advanced concepts like derivators, multicategories, and opetopes emerged from 1970s-1990s. Infinity-categories were developed in the 1990s-2000s. > > - Categorical quantum mechanics, pioneered in the 2000s by Abramsky, Coecke and others, applies category theory to quantum physics. > > - Applied category theory has recently emerged as using category theory in computer science, physics, and other fields. > > So in summary, category theory originated in the 1940s, saw major development and application in the 1950s-1970s, and continues rapid evolution today. It has become a broad and sophisticated field interconnecting many areas of mathematics. Prompting claude with the historical notes from wikipedia: - [Category theory - Wikipedia](https://en.wikipedia.org/wiki/Category_theory#Historical_notes) > [!ai]+ Claude > Here is a summary of the history of category theory based on the information provided: > > - Specific examples of functors and natural transformations were introduced by Samuel Eilenberg and Saunders Mac Lane in a 1942 paper on group theory. However, the general concepts of categories, functors, and natural transformations were formally introduced in a 1945 paper by Eilenberg and Mac Lane. > > - Their work was important for the transition from intuitive/geometric homology to homological algebra. Eilenberg and Mac Lane later said their goal was to understand natural transformations, which required first defining functors, then categories. > > - Stanislaw Ulam and others claimed related ideas were present in Poland in the 1930s, where Eilenberg studied mathematics before moving to the US. > > - Category theory can be seen as continuing the work of Emmy Noether on formalizing abstract processes. Noether realized understanding a structure requires understanding processes that preserve it. > > - Category theory was originally developed for homological algebra and modern algebraic geometry, but is now used throughout mathematics to relate structures of different types. > > - Topos theory provides an alternative foundation for mathematics. Categorical logic relates to type theory and functional programming. > > - Early applications to physics were shown by John Baez relating Feynman diagrams and monoidal categories. Applications to musical theory were developed by Guerino Mazzola. > > - Recent textbooks target introducing undergraduates to category theory as a foundation for math. > > The timeline shows category theory emerging from topology and homological algebra in the 1930s-1940s, being defined in 1945 by Eilenberg and Mac Lane, then expanding into many other fields of mathematics and beyond over subsequent decades. As for programming, which is not mentioned very much in the wikipedia data, this seems to actually be quite good, at least as a starting point for further research. > [!ai]+ Claude > Here is a brief overview of the history of category theory being applied in programming and computer science: > > - In the late 1960s, category theory began to be used in theoretical computer science, especially in relation to foundations of programming languages and the lambda calculus. > > - In the 1970s-80s, there was interest in using categories to model data types and systems, including abstract data types and processes. Topoi were studied as logical frameworks for computer science. > > - In the late 1980s, Eugenio Moggi proposed using monads from category theory to structure programs in functional programming languages. This became very influential. > > - In the 1990s, more connections to programming languages were made via type theory, domain theory, and logics for computation. Coalgebras were also applied to state-based systems. > > - From the 2000s onward, category theory has been used extensively in functional programming for abstraction, specification, and reasoning about programs. > > - Categories and functors are now commonplace tools in Haskell, Scala, and other functional languages. Concepts like monads, applicative functors, arrows, lenses, and more leverage category theory. > > - Recent areas applying category theory to computer science include distributed computing, quantum computing, natural language processing, machine learning, and more. > > - Domain-specific languages like FaCT for quantum programming are also based on categorical semantics. > > So in summary, category theory was first connected to programming languages starting in the 1960s, and has become more widely and deeply integrated in the last 20 years, especially in functional programming. It provides abstractions, specifications, and reasoning principles useful for computer science. From ChatGPT (plugins, but forgot to enable the [[Wikipedia]] plugin): > [!ai]+ AI > Category theory is a branch of mathematics that deals with abstract structures and relationships between them. Its application to programming and computer science has a rich history, and its influence has grown over the years. Here's a brief overview of the history of category theory in programming: > > 1. **Origins in Mathematics (1940s-1950s)**: > - Category theory was introduced by Samuel Eilenberg and Saunders Mac Lane in the mid-20th century as a way to study mathematical structures and their transformations. > > 2. **Initial Connections to Computer Science (1970s)**: > - The first connections between category theory and computer science began to emerge in the 1970s. Researchers started to see that the abstract structures in category theory could be used to model computational processes and data structures. > - The notion of a "functor" from category theory was found to be particularly useful in describing program transformations. > > 3. **Rise of Functional Programming (1980s-1990s)**: > - As functional programming languages like Haskell and ML gained popularity, the connections between these languages and category theory became more apparent. > - Concepts like monads, which originate from category theory, became central to the design and semantics of functional programming languages. Haskell, in particular, adopted monads as a core concept for handling side effects. > > 4. **Category Theory in Type Theory and Logic (1990s-Present)**: > - Researchers began to explore the deep connections between category theory, type theory, and logic. This led to the development of new programming paradigms and languages that were heavily influenced by categorical concepts. > - The Curry-Howard-Lambek correspondence, which relates programs, proofs, and categories, became a foundational idea in this area. > > 5. **Applications in Software Design and Architecture (2000s-Present)**: > - Category theory concepts have been used to design software architectures, particularly in systems that require a high degree of modularity and composability. > - Categorical databases, which use category theory to structure and query data, have been proposed as an alternative to traditional relational databases. > > 6. **Current Trends**: > - There's a growing interest in applying category theory to various areas of computer science, including quantum computing, concurrency, and distributed systems. > - Educational resources, workshops, and conferences dedicated to categorical methods in computer science have become more common, indicating a growing interest and acceptance of these ideas in the broader community. > > In summary, while category theory started as a purely mathematical discipline, its abstract nature and generalizability have made it a valuable tool in the world of programming and computer science. Over the decades, its influence has grown, and it continues to inspire new ways of thinking about computation and software design. With wikipedia plugin: > [!ai+] GPT (plugins) > Category theory, a branch of mathematics, has found significant applications in the field of computer science and programming. Here's a brief history of its application to programming: > > 1. **Origins in Mathematics**: Category theory was introduced in the mid-20th century by Samuel Eilenberg and Saunders Mac Lane. It was initially developed to address issues in algebraic topology. > > 2. **Functional Programming**: The relationship between category theory and programming became more pronounced with the rise of functional programming. Haskell, a purely functional programming language, has its foundations deeply rooted in category theory. Concepts like functors, monads, and natural transformations from category theory have been incorporated into Haskell and other functional programming languages. > > 3. **Type Theory**: Category theory has influenced the development of type theory, which is fundamental to programming language design. The Curry-Howard correspondence, which draws a parallel between computer programs and mathematical proofs, is closely related to category theory. > > 4. **Databases**: Category theory has been applied to the design and understanding of databases. The use of categories can provide a more abstract and unified view of database structures. > > 5. **Formal Verification**: Category theory has been used in the formal verification of software and systems. It provides tools for modeling and reasoning about system behaviors. > > 6. **Research and Development**: Over the years, there has been ongoing research into the applications of category theory in various areas of computer science, including domain theory, quantum computing, and concurrency. > > 7. **Educational Impact**: The influence of category theory is also evident in computer science education. Many computer science curricula now include courses on category theory, reflecting its growing importance in the field. > > In summary, category theory has transitioned from a purely mathematical domain to an essential tool in computer science and programming. Its abstract nature provides a powerful framework for understanding and solving complex problems in various areas of computing. > > For a more detailed exploration, you might consider checking out academic journals, books, and courses dedicated to the intersection of category theory and programming.V --- [[2022-08-09]] Organizing an event at [[Recurse Center]]: - [[2022-08-09 - Category Theory Catacombs - Week 1]] ## Old stuff A domain of mathematics that tackles the underlying structure behind composition of ideas. (My amateurish definition). Good insights were gained from [[PODCAST - Bartosz Milewski corecursive podcast]], especially the insight that mathematics is something innate to humans, not the world. See also: - [[Philosophy of Category Theory]] ## Typeclasses > [!note] I am learning now that [[Typeclasses]] is a [[Haskell]] thing and in some way not misleading in case you want to think more broadly about many different kind of Category Theory applications. > [[2022-07-28]] - [[Functors]] - [[Monoid]] - [[Monads]] - [[Profunctors]] - all of [[Optics (FP)]] ([[Lenses]]) - [[Applicative Functor]] ## Books - [[BOOK - Category Theory for the Sciences - David I Spivak]] - [[BOOK - An Invitation to Applied Category Theory - Seven Sketches of Compositionality - Brendan Fong, David I. Spivak]] - [[BOOK - Category Theory - Steve Awodey]] - [[BOOK - Category Theory for Programmers by Bartosz Milewski]] - [[BOOK - Dao of Functional Programming by Bartosz Milewski]] ## Logs [[2022-08-09]] - Added link to [[2022-08-09 - Category Theory Catacombs - Week 1]]