Need to make the parsing stuff I have work on streams of arbitrary tokens rather than just strings (hopefully making it more efficient in the process). Related reading:
- Streaming library, which provides a ListT-ish thing
- Invertible syntax descriptions
- Some kind of simplification of the concepts in the invertible syntax descriptions paper
- Type-Safe Modular Parsing
- Parser Combinators for Ambiguous Left-Recursive Grammars
- PEG: Ambiguity, precision and confusion
- Derivative parsers
- Monadic Memoization
- Non-blocking lexing
- agdarsec - Total Parser Combinators
I want to be able to associate recursive ADTs with recursive regexen for simple parsing of context free grammars. Here's some relevant resources:
- From μ-regular expressions to context-free grammars and back
- Partial Derivatives for Context-Free Languages
- Monadic Reflection in Haskell slides (Andrzej Filinski)
- Representing Monads 94 POPL paper
- Capturing the future by replaying the past
- A monadic framework for delimited continuations
- Taking Updates Seriously (update monad, coupdate comonad)
- https://bartoszmilewski.com/2017/07/07/profunctor-optics-the-categorical-view/
- https://arthurxavierx.github.io/RealWorldAppComonadicUI.pdf
- https://danel.ahman.ee/papers/types13postproc.pdf
- Categories of optics
- Composing bidirectional programs monadically
- Lenses for philosophers
- Profunctor Optics - A Categorical Update
- Generative testing
- Mayer Goldberg: A Variadic Extension of Curry's Fixed-Point Combinator
- Many faces of the fixed point combinator
- Factorising folds for faster functions
- The Worker Wrapper Transformation
- Reflection without remorse - A Conceptual Sequence as a Tangible and Efficient Data Structure
Stuff I've played around with so far:
- Monatron
- Monad transformers as monoid transformers
- Monad transformers and algebraic effects; what binds them together
- Composing monads
What is the theoretical underpinning of the polysemy
extensible effects library? My suspicion is that it is a free functor of some kind, probably the free functor from the category of monad transformers to the category of monads.
To answer the question rigorously, I need to do some reading:
It's fun to program with products:
assoc :: ((x, y), z) -> (x, (y, z))
assoc ((x, y), z) = (x, (y, z))
You can receive everything and throw things away that you don't care about.
It's a little bit tedious to program with coproducts:
assocE :: Either (Either x y) z -> Either x (Either y z)
assocE (Left (Left x)) = Left x
assocE (Left (Right y)) = Right $ Left y
assocE (Right z) = Right $ Right z
You receive things one case at a time, you can't just ignore cases you don't care about.
I suspect that this has something to do with the fact that Hask is cartesian closed, and the product tensor is (,)
. But of course Hask has a dual, and in the dual category, it's Either
that's the product. So maybe if we had some notion of "backwards" pattern matching, it would be fun to use it for coproducts and tedious for products!
After some discussion and googling, I found some promising links:
- https://link.springer.com/chapter/10.1007%2FBFb0018355
- https://homepages.inf.ed.ac.uk/wadler/papers/dual-reloaded/dual-reloaded.pdf
- http://www.cs.ox.ac.uk/ralf.hinze/WG2.8/27/slides/kenichi1.pdf
- http://www.is.ocha.ac.jp/~asai/papers/diku-ist11.pdf
- http://www.cs.ox.ac.uk/people/nikos.tzevelekos/DualCalc_06.pdf
- Selective Applicative Functors and Probabilities
- Algebra of Programming
- Explanation of probability monad. Includes representation of probability distribution as convex sum that I need to use in https://github.com/masaeedu/co-optics to model the generator half of bigenerators. This should allow for an implementation of
Alternative
that is properly associative.
- Singleton types are sufficient to model CoC
- Naive Computational Type Theory
- Predicativity
- Generic type-safe diffing and merging of mutually recursive datatypes (arianvp)
- Epigram: Practical Programming with Dependent Types
- http://philsci-archive.pitt.edu/11079/1/Identity_in_HTT_public.pdf
- Responsive compilers
- Extensions and Applications of Higher-Order Unification
- Recovering Purity with Comonads and Capabilities
- A Lazy Language Needs a Lazy Type System
- Dependently Typed Records for Representing Mathematical Structure
- Inductive families
- Generic level polymorphic n-ary functions
- λμ calculus - An algorithmic interpretation of classical natural deduction
- Syntax and Semantics of Quantitative Type Theory
- On the Size of Machines (Blum Size Theorem)
- Type is an extensible GADT
- Isomorphic Reasoning: Counting PolymorphicType Inhabitants
- Counting type inhabitants
- A Foundation for GADTs and Inductive Families - Dependent Polynomial Functor Approach
- Giving Haskell a Promotion
- Substructural Type Systems
- A Hands On Introduction to Cubical Type Theory
- Dynamic Typing with Dependent Types: Really interesting paper about a gradually typed approach for adding dependent types to fragments of a dynamically typed program
- Self Types for Dependently Typed Lambda Encodings
Are ADTs an essential primitive of a sufficiently expressive dependent type system? Based on how things work out computationally in untyped JS, it would be really nice if the answer was "no". Here are some links that seem to provide promising evidence for that hypothesis:
- http://www.larrytheliquid.com/drafts/generic-elim.pdf
- https://www.ioc.ee/~james/papers/levitation.pdf
- Type Theory and Functional Programming
- Programming in Martin Lof's Type Theory
- A Primer on Homotopy Type Theory - Part 1: The Formal Type Theory
- Homotopy Type Theory
- Type-level instant insanity
- Coherent Explicit Dictionary Application for Haskell
- Type Classes Reflect the Value of Types
- Simplifying typeclasses
- GHC proposal: Allow direct access to underlying concrete class dictionaries
- A Formulae-as-Types Notion of Control
- Classical vs constructive logic
- Modal logic (order goes propositional logic -> predicate logic -> modal logic)
- Kripke semantics
- Dependent types in Haskell: Theory and Practice (specifically what I want to get out of this is some kind of guiding principle or idea that underpins the design of
singletons
) - Dependently Typed Programming with Singletons ("the singletons paper")
- Promoting Functions to Type Families in Haskell ("the promotion paper")
- Something is bad in singletons land, need to understand goldfirere/singletons#150
I have this big stack of concepts I'm trying to work through at the moment that goes like this:
- There is this notion of operad with sets of variadic operations, but with no restrictions on how the operations may be composed (hence sets and not categories)
- I wish to generalize this along two dimensions: I want to describe the arity of a set of operations by a set of input labels instead of a mere natural number, and I want a partial composition operation such that the valid precompositions for a given operation are restricted
- There is this concept of a "colored operad" (aka multicategory), in which we solve the second problem: there is this set of "colors", and the family of operation sets is no longer indexed by a natural number, but instead by lists of colors. Further, composition is restricted so that "output colors" and "input colors" line up.
- Now to go beyond lists and to maps (and maybe to other containers), we need some systematic way of abstracting the relationship between lists and natural numbers to maps and strings
- The theory of "containers" in dependently typed programming elaborates on this relationship between a set of "shapes", each of which corresponds to a set of positions in a container (for lists the set of shapes corresponds to the natural numbers).
Here's some relevant reading:
- Categories of Containers
- Indexed Containers
- Generic Programming Within Dependently Typed Programming
- Futile efforts to keep up with Bartosz Milewski's prolific blog:
- https://bartoszmilewski.com/2017/12/29/stalking-a-hylomorphism-in-the-wild/
- https://bartoszmilewski.com/2018/08/20/recursion-schemes-for-higher-algebras/
- https://bartoszmilewski.com/2019/03/27/promonads-arrows-and-einstein-notation-for-profunctors/
- https://bartoszmilewski.com/2016/01/21/tambara-modules/
- All Concepts are Kan Extensions
- Decisive functors
- I suspect that the interaction between traversable and applicative functors can be dualized to an interaction between distributive and decisive functors
- A whole bunch of abstract algebra structures represented as categories
- An investigation of the laws of traversals
- StackOverflow answer that points to some interesting resources about "directed containers"
- Relative monads formalized
- Trace in symmetric monoidal categories
- This is the co-end, my only co-friend
- The Mathematics of Sentence Structure
- Modality via Iterated Enrichment
- Relating Structure and Power - Comonadic Semantics for Computational Resources
- The Pebbling Comonad in Finite Model Theory
- From parametricity to conservation laws, via Noether's theorem
- Joachim Kock's "Notes on Polynomial Functors" (lots of good stuff on universal algebra and operads and whatnot when you get around to learning those)
- Theoretical Pearl - Monads from Comonads, Comonads from Monads
- Bi-actegories (stuff related to the equivalent of modules/bimodules but at the level of categories as sets and bifunctors as left/right actions)
- Initial algebra and final coalgebra semantics for concurrency
- A Study of Categories of Algebras and Coalgebras
- Categories of containers
- Monads and algebraic structures (good explanation of monadicity and Eilenberg-Moore category of a monad)
The theory of "systems" with dynamic behavior is apparently well modeled coalgebraically. So for example a Moore machine is a coalgebra of the signature functor ``, where the carrier represents the state. The terminal coalgebra this unfolds to represents the behavior of the system.
- Towards a Uniform Theory of Effectful State Machines
- Statecharts: A visual formalism for complex systems
- Coalgebraic Automata and Canonical Models of Moore Machines
- Universal coalgebra: a theory of systems
- A coalgebraic semantic framework for component-based development in UML
- All of Bart Jacobs' stuff, there's a metric crapton of stuff on coalgebras and systems here, most of which is referenced in the other papers in the list
- Behavioural differential equations: a coinductive calculus of streams, automata, and power series
- Learning Automata with Side-Effects
- Runar Bjarnason's talk on machines
- An approach to Object Semantics based on Terminal Co-Algebras
- Many-sorted coalgebraic modal logic: a model theoretic study
- Coalgebraic automata theory: basic results
- Very promising paper on dependently-typed interactive programs that introduces the concept of "weakly-final coalgebra": "Interactive Programs and Weakly Final Coalgebras in Dependent Type Theory"
- The Operad of Wiring Diagrams
- Higher Algebra
- Higher Operads, Higher Categories
- Cospans, Wiring Diagrams, and the Behavioral Approach (really, really good explanation of operads, much less obscure than the other papers linked)
- Operadics - The Mathematics of Modular Design
- What is an Operad (math3ma blog) (as usual, best explanation of a tricky concept that I've encountered)
Need to find some information about things that are between lax and strong monoidal functors: the coherence map for the opposite functor is a retraction/section for the coherence map of the functor, but they do not form a full isomorphism. Some promising search results:
- Monoidal categories in, and linking, geometry and algebra
- The problem with Lax Functors (see comments)
There's also some stuff about the interaction of applicatives and alternatives with monads (i.e. the functor composition monoidal structure) a lot of it by Mauro Jaskellioff:
- A Unified View of Monadic and ApplicativeNon-determinism
- From monoids to near semirings, the essence of
MonadPlus
andAlternative
My understanding of enrichment still needs a lot of work. I think a good path forward is to study:
- A 2-categories companion (some kind of course material explaining 2-categories and bicategories)
- Basic Bicategories (to understand the concept of a bicategory, a weakening of the definition of a 2-category)
- ??? (maybe try and represent some monoids objects not in
(,)
as enriched single object categories, and study how monoidal functors interact with them)
Almost everything by Tarmo Uustalu is relevant, esp. as relates to comonads
- Lecture notes from a course "Containers for effects and contexts"
- Programming Contextual Computations
- http://www.brendanfong.com/
- The Algebra of Open and Interconnected Systems - apparently there is some good stuff about hypergraphs in here
-
The concept of a traced monoidal category is very interesting from the perspective of explaining recursion in programming. Related concepts in order of increasing generality are:
- Trace
- Traced-monoidal category
- Compact category
- Compact bicategory
-
Compact closed bicategories (very useful list of examples of compact bicategories in this one)
-
(only tangentially related in that it is mentioned as utilizing compact bicategories) Polynomial functors and polynomial monads
- I was looking at the retry library we use at work and I suspect that it can be radically simplified by equipping the (roughly)
data RetryAction = NoRetry | RetryASAP | RetryIn Int
data structure with a monoid data structure.- Andre Joyal's recent presentation on polynomial functors at the Topos Institute stream thing had a slide that got me interested in quantales. Specifically,
RetryAction
might represent a quantale, if we interpretRetryIn Int
to be denoting the subset of the real line that is smaller than the specified upper bound. We can freely adjoin whatever monoid we want onInt
so long as it distributes over the join. - Handy paper about using quantales to model "resource theories" (examples of resources modeled are very close to the exhaustible retry-tolerance we wish to model): Quantitative Foundations for Resource Theories
- Andre Joyal's recent presentation on polynomial functors at the Topos Institute stream thing had a slide that got me interested in quantales. Specifically,
- Quantales, Observational Logic and Process Semantics
- Whitman's solution to the word problem (for lattices, relevant for talking about the free lattice)
- Free Lattices
- http://www.math.toronto.edu/rossman/EFgames-lecture.pdf
- https://en.wikipedia.org/wiki/Ehrenfeucht%E2%80%93Fra%C3%AFss%C3%A9_game
- Categories and Computability
- Platonism, Constructivisim, and Computer Proofs vs Proofs by Hand
- Theoretical Computer Science for the Working Category Theorist
I suspect that finding collisions between shapes (or convex hulls of shapes) has something to do with a lattice of shapes under inclusion as binary relation, intersection as meet, union as join.
The approach I was considering was to only admit circular subsets of points from a given canvas. Then the meet operation and join operation consists of picking a circle inscribed in the intersection of the two provided circles, and a circle just barely enclosing the two provided circles, respectively. Apparently the latter is a "closure operator", which taking convex hulls is also. The operation of taking the convex hull of the superposition of the provided shapes, when taken as the join operation, actually forms a proper join-semilattice. So maybe this wrapping circle business (or an adjustment of it) does too? Someone pointed out there might be problems with associativity.
Anyway here's a paper about closure operators and lattices:
I want to render a game of life in toroidal coordinates on an actual torus. I started implementing my own vector algebra library using some generalized n-dimensional vector math stuff, but then became intrigued by what the generalization of the cross product to n-dimensions would be. Turns out this is called the Hodge Star operator. In the course of learning about this, I discovered a rabbithole of interesting things to read:
- Course on discrete differential geometry
- Wikipedia page on exterior algebra
- TODO: fundamentals even on vector algebra are weak, find some nice resource on this
- Wikipedia page on Hodge star operator
Stuff I've played around with so far:
I want to build a 3D git repo visualizer. Need to learn more about graph/tree layout algorithms esp in 3D:
- Tree Drawing Algorithms and Tree Visualisation Methods (slides)
- Cool hyperbolic geometry approach for rendering graphs using a spanning tree
- Algebraic Graphs with Class
- Directed hypergraphs and applications
- Algebra of parametrized graphs
@monoidmusician suggested https://mathoverflow.net/questions/19152/why-is-a-topology-made-up-of-open-sets as an entrypoint into topology stuff.
I suspect that polyominos form a kind of colored operad. Specifically, the colors represent the "contour" of a polyomino-with-holes, and a morphism from a list of contours to a contour is a placement of the input contours such that they respect the boundaries of the output contour and do not overlap. Thus roughly speaking we can think of a multimorphism as a "tiling" of the output polyomino with the input polyominos.
Some fast and loose thinking shows that this appears to be:
- closed: given a valid tiling of a polyomino, and a valid tiling of each tile, there exists an obviously valid composition (i.e. that respects the contour of the outermost polyomino and avoids overlaps). the composition is roughly given by just deleting the contours of the intermediate tiles polyominos.
- unital: any polyomino contour P can simply be "tiled" with a single polyomino that occupies its entire surface. this is obviously a valid tiling, has domain [P] and codomain P. when postcomposed with any other tiling, it has no effect. when repeated to fill a list and precomposed with any other tiling, it also has no effect.
- associative: given a "three level" tiling of a polyomino, it does not matter in what order we forget about the two intermediate levels of contours.
Somewhat interestingly, no discussions appear to have occured on the category theory zulip about polyominos, and nlab also appears to be silent on the subject. Polyominos in general appear to be quite sparsely studied, and in particular their intersection with category theory appears to be completely unstudied.
EDIT: What I might be missing is that this is somehow equivalent to the little disks operad or some other operad of topological embeddings (although AFAIU topology isn't very interested in preventing continuous deformations, which we don't want here)?
"Tilings" seem to have some interesting intersections with dynamic systems (which I'm currently studying from a coalgebraic perspective as part of my work on the cofree-bot stuff) and with algebraic topology and group theory. See for example:
Also need to read more about self-avoiding walks, which are basically the contours of interest.
- Lectures on self-avoiding walks
- Lattice paths and random walks
- Basic analytic combinatorics of directed lattice paths
Some stuff on taxicab geometry that might generally be of use:
- The generalized taxicab group (also valuable as a survey containing lots of good references on taxicab geometry)
Power words: discrete geometry, algebraic topology, polytopes, packing, tiling, covering, incidence structure