Do Group Actions Define Regular Polytopes and Polytypes in Type Systems?
Last night I was looking at the hexahedral box where I keep lights of different colors. Generally, I observe or geometric objects as if they were frozen, like notes on a musical score, truthfully.
The interpreter observes and puts the music into action, extracting unwritten possibilities. In the same way, I was looking at the vertices of the box (somewhat flattened by time and its cardboard material), delicately observing also its edges and its faces, with the inscription, and I began to rotate it on the table, then to position it on a face, on an edge, on the lid.
The same thing happens when I think about figuratenum, for me they are in movement, they are numbers that are frozen, simply waiting to be moved.
The generators, for me, are like a kind of obligation to action, to create movement.
With the movement of numbers and boxes, with this simple action really hides something very profound in mathematics, which is that I am really making use of symmetries and group theory in an intuitive way.
But as I like to do, not staying still on one side of the equation, I will make an exchange, since I will move from algebra and geometry and figurate numbers and exchange them for theory of computation, playing the game in TypeScript.
The actions of a group on X
We recall that a group is one of the algebraic structures par excellence that appears everywhere. From particle physics, Mazur’s theorem for elliptic curves over (what beauty), and, of course, in the music of Beethoven’s 9th Symphony or Xenakis. I will not put references because there are hundreds. I present here, then, for the solution of memory, what a group action is.
First, we will say that is a set that is not empty. Why ? Well, very easy, will be our polygon and polytope or polyhedron for now. Now, I will use , for group and for being commonly used notation. Well, when moving, were making a group action of on the hexahedral box :
It is s necessary to remember that the thing needs two conditions. We will put them in Bourbakist tonality. The first of them is that the neutral element of acts as the identity on the set of elements of our polytope .
The second condition is compatibility, that is, regarding associativity:
This that looks very strange, is simple. If we say it with our verb: if we apply and then apply on , the result will be exactly the same as if we apply the product .
Triangular numbers are usually, the Best
I usually use triagular figurate numbers as an example, they are as simple and as profound as the -simplices used in algebraic topology.
And the square? It is similar, the important thing is to capture the idea.
Well, the symmetry group that acts on a triangle is the group , also called the dihedral group.
Every dihedral group consists of two fundamental types of symmetries: the symmetries where we rotate things, and the symmetry where we reflect things.
In total, we have elements
The is the identity, are rotations, and the reflections. Our set is the triangle and we will have three interpretations of the action.
Let’s think first about the vertices (the most common):
Since the elements of the group set and the polygon set are few, a complete list can be made. I will give you some hints and you do the rest by composition of , for example makes
The element makes , and . Of course, the trivial but indispensable leaves each vertex in its same position.
You can verify the two Bourbaki conditions on your own. But, why is there a subscript zero? Very simple: they are the vertices. Now, let’s think about the edges.
Imagine, now it is a line that joins two vertices. Then, I also release the hints toward the treasure. Following the same order, makes , and for instance, makes
The element as always does not move its hands and only observes, and finally, acts by moving . Complete the ones that are missing and verify.
Lastly, what if we consider the entire triangle ? Of course, the action now moves the entire triangle, including the vertices and their edges and its face. So it is invariant, or more beautifully, it is a trivial action, that is
for all .
The conclusion we can reach is that both the vertices of and the edges of and the complete polytope are acted upon and continue to maintain their beautiful structure.
Watanabe wrote “Banderas detrás de la niebla”
José Watanabe Varas was a very personal voice of the 70s generation of Peruvian poets, who published a book in 2006 with the title of this section. What we did above with the vertices , edges , and face or to abbreviate, is related to the notion of complete flag.
The flag is something ascending, unlike what happens in Mario Bros. In this regard, this notion involves an example of each element that a polytope in question possesses. You can understand it like this:
In this case we can see that the triangle polygon comes to have a -dimensional face. Then, we can define the group action for a complete flag. With our example when is a triangle:
We see that the rotation of degrees makes
While the reflection over the altitude from , produces the movement
Again, only the vertices and edges permute, the face remains the same.
Something much more formal is to say that a flag is an incidence complex that contains substructures of different types.
In our example, is the face or maximal cell for the triangle. I reiterate a bit because it’s important, as you see above, a flag deals with exactly one element of each dimension (from 0 to the maximum of the polytope) and that’s why it appears in lowercase, which have an incidence relation that we denote by the symbol .
The fundamental notion is that is a hierarchical set of elements, that is, an ordered set of subspaces of increasing dimension, that respects the structure of the geometric figure, that is, of the polytope.
Ready, we now have the ingredients to answer fully the question. What is a regular polygon or what is a regular polyhedron commonly called Platonic solids?
When you act transitively by nature
There are several questions to position ourselves before what the plain term regular means in geometry.
For example, when we say that a regular polygon do we mean that each side of the polygon measures the same? When we say that a polyhedron is regular is it because it has equal faces, of equal shape?
Well, these questions go in that direction, but they are not adequate to define what a regular polygon or polyhedron is. We could attempt to give a definition, but this can be much broader than what we think by regular and include non-convex figures (I wil probably talk about this later) or Johnson solids.
We need a precise definition. In that sense, everything we have done above has already prepared the path quite well for us. Let’s return then to the notion of group action and specialize in a specific type that will help us answer this question of regularity: transitivity.
An action of a group on the set of complete flags of a polytope will be called transitive if any can be transformed into another by some element of . With a dose of formality we say that, for any
, such that
This definition is indicating to us that the group acts in a uniform way over the entire structure. In the triangle, the group permutes all the complete flags.
As you see, each complete flag can be obtained from any other that exists through a symmetry coming from the action. It is your turn to list the other flags of the triangle.
That’s it, we are ready to understand what regular means in geometry and make our exchange toward computation.
Polytopes that are called regular
With everything seen and geometrized and algebraized of the matter, the definition comes to us more natural than ever and says thus:
Let be the dimension of a space (let’s think Euclidean). We will say that a polytope immersed in the space is regular if its symmetry group acts transitively on the set of all complete flags of .
With the triangle, . Let , a vertex and let us denote by the set of edges that contain . Therefore,
for all vertices and .
This leads us to say that each vertex is found in the same number of edges.
This uniformity is not a coincidence, it is a consequence of the transitive action. Since the symmetry group can transform any vertex into any other vertex, and the group preserves the structure, every vertex must “look the same” from the perspective of the polytope.
In our triangle, each vertex meets exactly edges, each edge connects exactly vertices, and each face is bounded by exactly edges. This is the combinatorial fingerprint of regularity.
Construing Regular PolyTypes
Now comes the promised exchange, the trade from the algebraic realm to the computational one. But not in the way you might expect.
I am not interested in simply implementing group actions in a programming language or DSLs, that is already done in systems like GAP (Groups, Algorithms, Programming).
I am after is something deeper, clearly more theoretical and tentative (a kind of ts pseudocoe).
I want to ask:
What would a
regular typeor, more analogously to the geometric notion,regular polytypebe?
To try to clarify this somewhat, let me reformulate the question in context. Above, I stated that each complete flag traverses the hierarchy of vertex edge face, and so on.
This ascending chain can also be captured by data structures, or better yet, by a type system, as I discussed in a previous post complete modeled in TypeScript about categories and geometric sequence modules at the type level.
Then, I needed to start with the idea of analogy, from the notion of dimension in geometry to the notion of dimension in types. Because, the ascending chain (like the Chain of Ascension in StarCraft) represents a more complex or higher-dimensional type that contains different subtypes.
So, I arrived at this matter:
A type can exhibit different levels of
dimensionality: primitive types like strings are -dimensional (no internal structure). Type constructors with parameters like Vertexintroduce one level of structural complexity (-dimensional in that parameter), and composed types inherit and extend this structural depth.
At the moment, I will remain speculative, without being too precise, as I mentioned before. In this way, I am trying to construct or define an incidence relationship which is interpreted as structural containment: a type A is contained in B if A is a subtype or structural component of B.
Type Flags Surfing
Well, now is the moment to speak with a dreamy tone about complete type flag, that we will denote . I could write something like what follows. Yes, it is still centered on the geometric concept to seem more familiar, we can later dilute it into a pure notion free of references:
type Vertex<L extends string> = { label: L; position: [number, number] };
type Edge<V1, V2> = { start: V1; end: V2; length: number };
type Face<E extends readonly Edge<any, any>[]> = { boundary: E; area: number };
A complete type flag would be a chain of increasingly complex types, where
complexity is measured by structural depth, the number of nested type constructor
applications. Here, to abbreviate, I omit quotation marks, and , and stand for Vertex, Edge, and Face respectively:
Here, each type contains the structure of the previous one: a vertex contains a string label, an edge contains vertices, and a face contains edges.
Type Symemetries On The Disco
The second step consists, of course, in the movement that comes from the action of the group. We have talked a lot about symmetries earlier; with more technical jargon, for our lexicon, we will say that symmetries are automorphisms. This word is quite complicated, but it means that the structure of the object in question is preserved after the transformations.
With what was explained in the previous paragraph, we now have the question more directed:
What thing serves as elements that, applied over the types, preserve the structure of these types?
One sufficiently natural answer, I think, lies on the side of TypeScript’s mapped types, which I denote by , because they transform one type into another but somehow maintain the structural form, their type geometry.
type IdentityTransform<T> = T;
type Rotate<T> = {
[K in keyof T]: K extends 'label'
? (T[K] extends 'A' ? 'B' : T[K] extends 'B' ? 'C' : T[K] extends 'C' ? 'A' : T[K])
: T[K]
};
type RotateInverse<T> = {
[K in keyof T]: K extends 'label'
? (T[K] extends 'A' ? 'C' : T[K] extends 'B' ? 'A' : T[K] extends 'C' ? 'B' : T[K])
: T[K]
};
type ReflectAB<T> = {
[K in keyof T]: K extends 'label'
? (T[K] extends 'B' ? 'C' : T[K] extends 'C' ? 'B' : T[K])
: T[K]
};
Notice that this is conceptual pseudocode. To truly preserve type constructors, we would need conditional types with infer, which is verbose, but feasible. This Rotate mimics the rotation , acting on type structure.
For sure, is the “group” of mapped types in fact a group? Well, not all form a group, but if we restrict ourselves those that permute literal type parameters like "A", "B", "C" while preserving the type constructor, then we obtain something much closer to a genuine group structure.
Let’s continue with this first approach without complete rigor.
Creating Type Transitivity
Finally, there remains the idea of transitivity that will lead us toward what we are looking for: the word regular. By analogy with the geometric definition and for the sake of expediency, I am going to establish that:
An
action on polytypewould be transitive if there exists some element in mapped types (atype symmetry group) that can transform anycomplete type flaginto any other .
With hands-on work, I throw this out:
type TypeFlag = {
vertex: Vertex<string>;
edge: Edge<Vertex<string>, Vertex<string>>;
face: Face<readonly Edge<any, any>[]>;
};
This represents the structural schema of a type flag; concrete flags would instantiate the labels (e.g., Vertex<"A"> vs Vertex<"B">). A type transitive symmetry would be a mapped type M such that for any two type flags f_1 and f_2, there exists some composition of type symmetries that maps f_T^1 to f_T^2:
Regular Types
Almost the end of ends. Let be a space of types with generic type parameters. So, it can be said that a regular polytype would be one where every “instantiation path” through the type hierarchy is equivalent up to type symmetry.
type Triangle = {
vertices: [Vertex<"A">, Vertex<"B">, Vertex<"C">];
edges: [Edge<Vertex<"A">, Vertex<"B">>,
Edge<Vertex<"B">, Vertex<"C">>,
Edge<Vertex<"C">, Vertex<"A">>];
face: Face<readonly [Edge<Vertex<"A">, Vertex<"B">>,
Edge<Vertex<"B">, Vertex<"C">>,
Edge<Vertex<"C">, Vertex<"A">>]>;
};
This type is regular if we can define label-permuting transformations forming
a group isomorphic to :
acting uniformly across vertices, edges, and face. Any complete type flag in can then be transformed into any other through composition of these operations.
Postlude of Types
It occurred to me while having a coffee, looking out the window on a summer night in Lima. If this analogy holds, we might be able to classify type systems (like we classify -dimensional polytopes ) according to their symmetry groups , and languages with richer type-level transformations would be more symmetric.
Mapped types give us a glimpse of this, but a truly regular type system might require first-class support for type group actions.
As I keep rambling, we can immediately pass to another nearby world. I also think about this beautiful instrument called CubeHarmonic, made concrete in the real world, but with a musical meaning at the type level.
For now, it remains both a computational and a music-based type theory dream. Maybe I just need to sleep a bit.