109 points · by pxeger1 · 3y ago · 39 comments
- Seven trees in one [0], a paper showing a bijection between binary trees and seven-tuples of binary trees.
- The algebra of algebraic data types [1] discusses Taylor expansions of data types.
- Differentiation of higher-order types [2] is commenting on OP's paper.
I used to be really interested in type theory, but haven't had as much time to explore it, but over the years I've saved these links (and the one posted).
[0]: https://arxiv.org/pdf/math/9405205.pdf
[1]: https://codewords.recurse.com/issues/three/algebra-and-calcu...
[2]: http://conal.net/blog/posts/differentiation-of-higher-order-...
Is this a surprising result? I am not quite interested enough to read through the paper in order to find out. Naively I would say, sounds maybe a bit fiddly, could have a clever trick to do elegantly, but does not sound too surprising or hard.
Build a complete binary tree with six nodes and attach the seven trees from the tuple as children. This is not a bijections as trees without the complete tree do not map back into any tuple of trees, so fiddle a bit with those six nodes to encode some special tuples or classes of tuples. Okay, now you have a new problem, two encodings for some tuples, so we have to also fiddle a bit with the trees before attaching them. Yeah, that could get fiddly...
The paper is quite good, but Dan Piponi has a great blog post that recasts the isomorphism as a game of "nuclear pennies", which is a fun puzzle to work out yourself: http://blog.sigfpe.com/2007/09/arboreal-isomorphisms-from-nu...
Why not "one tree can be encoded into seven trees, or one of these 13 remaining cases"?
This direction is no problem, at least if we accept a graph with zero vertices as a tree which is probably non-standard as it should then have -1 edges. But if we allowed it, then a trivial mapping would be T -> (T,Ø,Ø,Ø,Ø,Ø,Ø). The other direction is much more problematic, one can easily map n trees into one, but then one gets stuck with either some trees that do not map back to any tuple or some tuples that have multiple representations. So now I am really curious what makes 7 special, so I will probably have to read the paper after all.
Let T denote the space of binary trees.
Any 2-tuple of trees (L, R) can be written as a binary tree with left node S and right node T, so we have an injection from T x T to T.
For the other direction we can embed a binary tree S as (S, {}) (with {} an empty binary tree).
By Schreuder-Bernstein there is a bijection between T and T x T.
Also: https://en.wikipedia.org/wiki/Brzozowski_derivative
Good to know about these: https://en.wikipedia.org/wiki/Dual_number
Seems comprehensive: https://semantic-domain.blogspot.com/2021/02/five-and-half-d...
I have never actually had the wherewithal to go through the whole automatic-derivation-of-zippers thing, but this (https://stackoverflow.com/questions/25554062/zipper-comonads...) StackOverflow Q&A (along with all of Conor McBride's SO answers - compiled at https://personal.cis.strath.ac.uk/conor.mcbride/so-pigworker...) might be of interest in conjunction with the linked paper.
> I feel very lucky to have stumbled on this interpretation of differentiation for datatypes with such potential for both utility and fascination, and has been intriguing me since the day I made the connection (whilst changing trains at Shrewsbury). This work has benefited greatly from hours spent on trains, [...]
> This work is dedicated to Orwell the dog. Orwell was a good dog and knew well the difference between zero, one, and many
https://bentnib.org/quantitative-type-theory.pdf
(zero, one, many was the ring that the paper used.)
https://wiki.haskell.org/Zipper
https://en.m.wikipedia.org/wiki/Zipper_(data_structure)
To give you an example: the zipper of a list is two lists - one for the elements after the current one (the hole), another for the elements before the current one, plus the current element.
Its an informative exercise to see how many of the standard rules of calculus can be derived using just this rule.
The "one-hole" is in the discrete types, not the potentially continuous values.
Crazy where operator overloading will get you. If there are postmodern math papers I feel like this is one of them
In particular open sets are neighborhoods of all of the points they contain. This means they contain all the topological information about all of their points.
Closed sets are not neighborhoods of their points in general. Eg [0,1] contains no neighborhood of 0 or 1. Then we would require knowledge of the space around those points to know how a function behaves just on [0,1].
In standard calculus this amounts to "taking the left and right limits".
Does that help?
Differential fields are (as I understand it) a hot topic at the moment. Maybe there is some interesting crossovers.
> Clearly it’s equivalent to Choice’s use of a boolean tag. Isn’t it remarkable that algebraic manipulations agree with our intuition?
no, thats not interestimg at all. It is literally just encoding left/right in a bool.
that page seems to be doing "calculus" not on the sets but the sizes of the sets. entirely uninteresting and boring.
Haskel: making the easy stuff hard.