An open API service indexing awesome lists of open source software.

https://github.com/aygp-dr/strange-loop-cat

Category Theory Explorer with a focus on Strange Loops and Self-Reference
https://github.com/aygp-dr/strange-loop-cat

ai category-theory guile literate-programming llm mathematics org-mode recursive-structures scheme self-reference strange-loops

Last synced: 3 months ago
JSON representation

Category Theory Explorer with a focus on Strange Loops and Self-Reference

Awesome Lists containing this project

README

          

#+TITLE: Strange Loop Cat: Category Theory Explorer
#+AUTHOR: Jason Walsh
#+EMAIL: j@wal.sh
#+DATE: 2025-05-12
#+OPTIONS: toc:3 num:3
#+PROPERTY: header-args:scheme :results output :exports both :eval yes
#+PROPERTY: header-args:guile :results output :exports both :eval yes :noweb yes
#+PROPERTY: header-args:mermaid :file images/diagrams/:results file :exports both
#+SETUPFILE: https://fniessen.github.io/org-html-themes/org/theme-readtheorg.setup

* Strange Loop Cat

This repository explores the beautiful connections between category
theory, self-reference, and formal systems. Drawing inspiration from
Douglas Hofstadter's "Gödel, Escher, Bach", it provides interactive
explorations of categorical concepts with a focus on strange loops and
recursive structures.

** Overview

Category theory offers a powerful mathematical framework for studying
abstract structures and their relationships, while also providing
insights into self-reference and strange loops. This project:

- Visualizes categorical concepts through interactive diagrams
- Implements categorical structures in Guile Scheme
- Explores the connections between formal systems, self-reference, and category theory
- Provides hands-on examples to build intuition for abstract concepts

** Quick Start

- Run the project initialization (one-time setup):
#+begin_src shell
make init
#+end_src

- Open any of the interactive notebooks in Emacs with org-mode
#+begin_src shell
# Open the basics notebook with Emacs
emacs examples/basics.org
#+end_src

** Interactive Notebooks

This repository contains five interactive org-mode notebooks that you
can use to explore category theory concepts:

- [[file:examples/basics.org][Basics of Categories and Morphisms]] - Introduction to the fundamental
concepts of categories, objects, morphisms, and composition

- [[file:examples/functors.org][Functors and Natural Transformations]] - Structure-preserving maps
between categories and transformations between functors

- [[file:examples/yoneda.org][The Yoneda Lemma]] - An exploration of one of the most profound and
fundamental results in category theory

- [[file:examples/monads.org][Monads and Computational Effects]] - Understanding monads as a
powerful abstraction for managing computational effects

- [[file:examples/strange-loops.org][Strange Loops and Self-Reference]] - Examining self-reference,
recursion, and tangled hierarchies with connection to Hofstadter's
work

Each notebook contains executable code blocks that demonstrate the
concepts discussed and can be tangled to generate standalone Scheme
files.

** Resources

- [[https://ncatlab.org/nlab/show/category+theory][nLab: Category Theory]]
- [[https://en.wikipedia.org/wiki/Category_theory][Wikipedia: Category Theory]]
- [[https://arxiv.org/abs/1803.05316][Seven Sketches in Compositionality]] by Brendan Fong and David Spivak
- [[https://math.ucr.edu/home/baez/categories.html][John Baez: Categories, Quantization, and Much More]]
- Douglas Hofstadter's "Gödel, Escher, Bach: An Eternal Golden Braid"
- [[file:docs/guides/category-theory-interviews.org][Category Theory for Interviews: Core Concepts with GEB-Style Metaphors]]

** Comprehensive Guides

The repository includes several comprehensive guides converted to Org Mode format:

- [[file:examples/category-theory-guide.org][Category Theory and Strange Loops: A Comprehensive Guide]]
- [[file:examples/concepts.org][Core Category Theory Concepts and Terminology]]
- [[file:examples/functors-monads-guide.org][Functors and Monads Guide]]
- [[file:examples/fixed-points-guide.org][Fixed Points in Category Theory]]
- [[file:examples/type-theory-guide.org][Type Theory and Category Theory]]
- [[file:examples/scheme-lisp-guide.org][Scheme and Lisp for Category Theory]]
- [[file:examples/yoneda-lemma-guide.org][The Yoneda Lemma: Detailed Guide]]

** Essential Commands

This project uses Make to simplify working with the code and documentation. Here are the essential commands:

| Command | Description |
|-----------------------+------------------------------------------------------|
| ~make init~ | Set up the project (run this first!) |
| ~make tangle~ | Generate all Scheme source files from org notebooks |
| ~make tangle-file FILE=path~ | Generate code from a specific org notebook |
| ~make detangle~ | Update code blocks from their tangled source files |
| ~make detangle-file FILE=path~ | Detangle a specific org file |
| ~make mermaid~ | Generate diagrams from Mermaid definitions |
| ~make test~ | Run tests for the category theory implementation |
| ~make org-lint~ | Run org-lint on all org files to check for issues |
| ~make org-lint-file FILE=path~ | Run org-lint on a specific org file |
| ~make md2org~ | Convert all Markdown guides to Org Mode format |
| ~make md2org-file FILE=path~ | Convert a specific Markdown file to Org Mode |
| ~make clean~ | Remove generated files and start fresh |

For Emacs users, you can also:
- Open any ~.org~ file directly and use ~C-c C-c~ to execute code blocks
- Use ~C-c C-v t~ (org-babel-tangle) to generate source files from the current notebook

** GEB Connection and Self-Reference

This project draws heavily from Douglas Hofstadter's seminal work
"Gödel, Escher, Bach: An Eternal Golden Braid" (GEB). The concept of
strange loops—processes that move through hierarchical levels and
eventually return to their starting point—is central to both GEB and
this project.

Some key connections explored in this repository:

- Category theory provides a formal framework for understanding self-reference
- Yoneda lemma as a category-theoretic form of "introspection"
- Fixed point operators and their relation to strange loops
- Tangled hierarchies in category theory
- Recursive structures and their categorical formalization

** License

MIT License

Copyright (c) 2025 Jason Walsh

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.