Another view of lenses

September 8, 2014

There have been many tutorials recently motivating lenses from a practical point of view. In this post I want to try to motivate lenses from a more mathematical point of view. Actually, I want to provide motivation for three types from the lens library; Isos, Lenses, and Prisms.

These roughly correspond to three concepts from category theory; isomorphisms, products, and coproducts. Even before we reach the lens library, Haskell’s type system already partly supports these three topics under different names; newtypes, record types, and sum types.

Newtypes

You’re probably already familiar with isomorphisms. An isomorphism in between objects $A$ and $B$ in a category consists of morphisms $f : A \rightarrow B$ and $f^{-1} : B \rightarrow A$ such that $f^{-1} \circ f = id_A$ and $f \circ f^{-1} = id_B$. From the point of view of a mathematician, isomorphic objects; that is, objects for which there exists an isomorphism between them, may be treated as essentially the same. Now thinking about Haskell types, any newtype is manifestly isomorphic to it’s…uhhh…oldtype.

newtype New = New { unNew :: Old }

Given the type Old, this constructs not only the type New but the inverse functions New and unNew.

New :: Old -> New
unNew :: New -> Old
— unNew . New = id :: Old -> Old
— New . unNew = id :: New -> New

And GHC is even clever enough to take the mathematician’s insight that one can treat isomorphic objects as essentially the same to optimize. However, not all isomorphisms need in principle to be newtypes, so the question is how to encode isomorphisms generally. The answer is to use profunctors!

Profunctors

type Iso s t a b = forall Profunctor p. p a b -> p s t

Whaaaaat? Well, this is somewhat mysterious so let’s take a detour and talk a bit about profunctors. If a functor is like a function between categories $F : C \rightarrow D$, then a profunctor is like a relation between categories, $P : C^{op}\times D \rightarrow Set$. Really, $P$ is just a functor which implies that it’s a bifunctor, contravariant in the first argument and covariant in the second. Just like functors, profunctors compose and there’s an identity profunctor. The identity profunctor $Hom : C^{op} \times C \rightarrow Set$ is a good motivating example. On objects, $Hom(A,B)$ is the set of all morphisms $f: A \rightarrow B$. On morphisms, $Hom(h : A' \rightarrow A , f : B \rightarrow B' )$ is the function which takes a morphism $g: A \rightarrow B$ to $f \circ g \circ h$. Notice, that it was necessary to reverse the expected order of source and target morphisms for $late f$ in order for the composition to work out. This is the reason for the $op$, indicating that profunctors are contravariant in their first argument!

In Haskell, rather than arbitrary categories we can restrict our attention to the category of Haskell types and functions. That’s  right, a Profunctor is actually an endoprofunctor on Hask. Let’s recapitulate the math in Haskell.

class Profunctor p :: * -> * -> * where
dimap :: (s -> a) -> (b -> t) -> p a b -> p s t

– dimap id id = id

– dimap (h’ . h) (f . f’) = dimap h f . dimap h’ f’

instance Profunctor (->) where
dimap f h g = f . g . h

These laws express contravariance in the first term and covariance in the second term. Here’s a couple more examples of Profunctors to whet your whistle.

newtype Tagged a b = Tagged { unTagged :: b } — The type b with spooky phantom a

instance Profunctor Tagged where
dimap h f = Tagged . f . unTagged

newtype Forget r a b = Forget { unForget :: a -> r }
instance Profunctor (Forget r) where

dimap h f = Forget . ( . h) . unForget

Isos

How do we package our inverse functions f :: a -> a’ and h :: a’ -> a into an Iso? Notice how the type signatures are perfect for fitting them into dimap. We can also get the functions back out again.

dimap h f :: Profunctor p => p a a -> p a’ a’

dimap h f :: Iso a a a’ a’

view :: Iso s t a b -> b -> t

view :: (Tagged a b -> Tagged s t) -> b -> t

view iso = unTagged . iso . Tagged

review :: Iso s t a b -> t -> b

review :: (Forget r a b -> Forget r s t) -> s -> a

review iso = (unForget . iso . Forget) id

We should check that

– review (dimap h f) = f

– view (dimap h f) = h

– dimap (view iso) (review iso) = iso

– view (dimap h f) = (unForget . (dimap h f) . Forget) id

– = (unForget . Forget . ( . h) . unForget . Forget) id = id . h = h

– review (dimap h f) = unTagged . (dimap h f) . Tagged

– = unTagged . Tagged . f . unTagged . Tagged = f

Here’s two examples of Isos:

type New = New { unNew :: Old}
newtyped :: Iso Old Old New New

newtyped = dimap New unNew

packed :: String String Text Text

packed = dimap pack unpack

Natural Isomorphisms

You may have noticed the repeated types in signatures Iso a a a’ a’. How is it useful to have the extra type variables? One really useful application is natural isomorphisms between functors. A natural transformation between functors $F$ and $F'$ consists of a pair of natural transformations $f_A : F(A) \rightarrow F'(A)$ and $f^{-1}_B : F'(B) \rightarrow F(B)$ such that $f_A \circ f^{-1}_A = 1_{F'(A)}$ and $f^{-1}_A \circ f_A = 1_{F(A)}$. There’s no need for the component variables $A$ and $B$ of the two transformations be the same and it’s more polymorphic, so, win? Let’s look at some examples.

curried :: Iso ((a, b) -> c) ((d, e) -> f) (a -> b -> c) (d -> e -> f)

curried = dimap curry uncurry

type Tsil a = Empty | Snoc (Tsil a) a

reversed :: Iso [a] [b] (Tsil a) (Tsil b)

reversed = dimap rev unRev where

rev [] = Empty

rev (x:xs) = (rev xs) Snoc x

unRev Empty = []

unRev (ys Snoc y) = y : unRev ys

While the extra polymorphism let us write the inverse natural transformations without the same component variable, notice that the component variables are related. You’ll never have completely unrelated types s, t, a and b.

Identity and Composition of Isos

The cool thing about the profunctor representation of Isos is that they’re just functions, so they’re just as first class as functions are. For instance, you can compose them without having to define instance of Category, just use the function composition from Prelude. There’s one weird thing about their composition though.

(.) :: (b -> c) -> (a -> b) -> (a -> c)
(.) :: Profunctor p => (p b b’ -> p c c’) -> (p a a’ -> p b b’) -> (p a a’ -> p c c’)

(.) :: Iso c c’ b b’ -> Iso b b’ a a’ -> Iso c c’ a a’

This sometimes makes it feel like Iso runs backward, but relax dude, the underlying isomorphism arrow goes both ways if you know what I mean ;-)

Other Representation of Isos

If you look in the lens library, the above is not the definition of Iso you will find. Instead you’ll find a mixed functor-profunctor representation.

type Iso s t a b = forall p f. (Profunctor p, Functor f) => p a (f b) -> p s (f t)

Even more polymorphism, amirite? I think this representation has better compatibility with Prelude, but otherwise it’s…isomorphic. There’s a yo dawg joke in there but I really don’t want to try to encode the Iso in my Isos. There’s other encodings of Isos in other libraries too. Here’s a simple one you can write. You’ll have to make your own Category instance to get composition though.

type Iso s t a b = (a -> s, t -> b)

Products

In category theory, a product of a finite set of objects $A_1,\ldots,A_n$ is a type $A$ along with morphisms $\pi_1 : A \rightarrow A_1 \ldots \pi_n : A \rightarrow A_n$ such that the following diagram…wait for it………….commutes!!!

$\begin{matrix}f & & A &\\ & \nearrow & \downarrow & p_i \\B & \rightarrow & A_i\\& f_i \end{matrix}$

Everything’s a Function.

January 18, 2013

In Haskell, ignoring certain annoyances like bottom, we have a Cartesian closed category, or CCC, of types and functions. In CCCs, there are function types and Cartesian product types and they are related by the curry and uncurry isomorphisms (named after Haskell Curry).

curry :: ((a , b) -> c) -> (a -> b -> c)
uncurry :: (a -> b -> c) -> ((a , b) -> c)

But CCCs have another important property, they are endowed with a “terminal object”, that is an object t such that there is a unique function f :: a -> t for any a. In Haskell, the terminal object is (), called unit, and it has only one value, also (), and hence only one (polymorphic) function to it, the constant function \ x -> (). If you think about Cartesian products with any number n of factors (a1 , a2 , .. , an), you can think of () as the special case with 0 factors. And just like we can generalize currying to functions with any number n > 2 of arguments, we can think about “zurrying” functions with 0 arguments.

zurry :: (() -> a) -> a
unzurry :: a -> (() -> a)
zurry f = f ()
unzurry x = \ () -> x

What does that give us? Well, nothing, but it lets us recognize that function evaluation is really just a zurried form of function composition.

unzurry (f x) = f . (unzurry x)

So function evaluation isn’t really first class, and since this is Functional Programming, maybe we should think of everything as a function, by unzurrying if necessary!

P.S. When working with a monad, you work in its Kleisli category which is another example of a CCC. The above discussion relating function evaluation to function composition, would then relate Kleisli evaluation (>>=) to Kleisli composition (>=>).

January 18, 2013

Here’s something cool I realized while thinking about Haskell lenses (getters and setters) being coalgebras of the costate comonad. Another example of a comonad is the zipper.

data Zipper a = Zipper [a] a [a]

(List) zippers are a way of looking at lists with a focus at a particular element. It should be obvious that we might want to get or set that focus, so that zippers come naturally adorned with lenses.

get :: Zipper a -> a
set :: Zipper a -> a -> Zipper a
lens :: Zipper a -> (a , a -> Zipper a)
get Zipper ls x rs = x
set (Zipper ls x rs) y = Zipper ls y rs
lens z = (get z , set z)

The other natural operations on zippers is list traversal. The zipper had three parts, the part of list to the left, the focus, and the part of the list to the right. (Clowns to the left of me, jokers to the right.) The left part is assumed to be in reverse order, so that its head is next to the focus.

toList :: Zipper a -> [a]
goLeft :: Zipper a -> Zipper a
goRight :: Zipper a -> Zipper a
toList Zipper ls x rs = (reverse ls) ++ (x:rs)
goLeft Zipper ls x rs = Zipper (tail ls) (head ls) (x:rs)
goRight Zipper ls x rs = Zipper (x:ls) (head rs) (tail rs)

So, how are zippers an example of a comonad? Define extract (coreturn) and duplicate (cojoin) like so.

extract :: Zipper a -> a
duplicate :: Zipper a -> Zipper Zipper a
extract = get
duplicate z = Zipper (tail $iterate goLeft z) z (tail$ iterate goRight z)

What is duplicate of a zipper? Its focus is the zipper itself, but its other parts are all the other possible zippers for the underlying list, with their foci shifted according to their distance from the focus zipper. Maybe a better word for “duplicate” would be “diagonal”, since you can visualize it by putting copies of the list next to each other, then drawing a diagonal line through their foci. Indeed, this is closely related to various morphisms in topology and algebra that all go by the name “diagonal map”.

Nota bene: Zippers only really make sense for infinite lists, because in a finite list you can’t go left or right indefinitely, so for finite lists you have to work around with Maybes or special cases. I’m sure this has something to do with the distinction between data and codata. Finite lists are data and form a monad (the familiar one) while infinite lists (streams) are codata and form a comonad.

Ribbon categories

October 23, 2009

In the last post I discussed the category of framed oriented tangles, which according to Shum’s theorem is a free ribbon category. As a corollary to Shum’s theorem, we may derive tangle invariants from any ribbon category. Let’s see how this works for the Kauffman bracket.

Consider planar diagrams, that is curves in the plane. These are like tangle diagrams only without self-intersections, i.e. no crossings. Just like tangles, they form a monoidal category since we can place them side by side or atop each other. Also just like tangles they have duality cups and caps.

Cup and Cap

Inspired by the definition of the Kauffman bracket, we extend the category of planar diagrams by linear combinations with coefficients polynomials in $A,A^{-1}$ and mod out by the circle relation:

Circle Relation

This gives a braiding and twist as in the calculations for the Kauffman bracket.

Braiding

Twist

The resulting ribbon category is called the Temperley-Lieb category, named for mathematicians who studied its implications in the context of statistical mechanics.

Now we have two examples of ribbon categories, the category of tangles and the Temperley-Lieb category. How else can we generate examples of ribbon categories? Recall that the category of finite dimensional vector spaces and linear maps formed a monoidal category with duals. We consider the subcategory of representations of an algebra $A$.

An algebra is a vector space in which we have a multiplication and unit with the familiar properties of associativity and unitality. For example, given a vector space $V$ the space $End(V)$ of endomorphisms of $V$, that is linear maps $V\to V$, forms an algebra where our multiplication is composition of linear maps and our unit is the identity map $1_V$. $V$ is a representation of $A$ iff there is a linear map $\rho_V:A\to End(V)$ which preserves multiplication and unit.

A Hopf algebra, in addition to having a multiplication and unit, also has maps $\Delta:A\to A\otimes A, \eta:A\to k$ called comultiplication, counit which are coassociative, and counital where $k$ is the field of scalars. This guarantees that the category $Rep_{fd}(A)$ of finite dimensional representations of $A$ is monoidal since we can define representations $\rho_{V\otimes W}=(\rho_V\otimes \rho_W)\Delta$ and $\rho_k=\eta$. We also require a map $S:A\to A$ called the antipode which switches the order of multiplication and is the convolution inverse to the identity. This guarantees that $Rep_{fd}(A)$ has left duals with $\rho_{V^*}=\rho_V S$.

If there are elements $R\in A\otimes A,h\in A$ such that $P_{V,W}(\rho_V\otimes\rho_W)(R)$ is a braiding, where $P_{V,W}:V\otimes W\to W\otimes V$ is the swap map $P_{V,W}(v\otimes w)=w\otimes v$ and where $\rho_V(h)$ is a twist, then we call $A$ a ribbon Hopf algebra. Clearly then $Rep_{fd}(A)$ is a ribbon category.

Surprisingly, ribbon Hopf algebras turn up in the study of Lie algebras. One may “quantize” a Lie algebra, deforming it by a formal parameter meant to mimic Plank’s constant $\hbar$ and the result is a ribbon Hopf algebra. This discovery led to a whole slew of new invariants and a new understanding of old invariants. For instance the Jones’ polynomial and the Kauffman bracket are related to the quantization of the most basic Lie algebra $sl(2,\mathbb{C})=su(2)\otimes\mathbb{C}=so(3)\otimes\mathbb{C}$. Invariants of tangles derived from quantized Lie algebras are called Reshetikhin-Turaev invariants or simply quantum invariants. When applied to links they give polynomials in a variable $q=e^\hbar$.

The category of tangles

October 1, 2009

I want to get back to discussing tangles. So far we’ve been thinking about tangles entirely topologically. But as it turns out, tangles are also fundamentally algebraic objects. The algebraic gadget we need to understand tangles is that of a free ribbon category. Indeed, Shum’s theorem states that framed, oriented tangles form the morphisms of a free ribbon category on a single generator.

To begin to understand this deep statement we must start with the definition of a category. A category is a set of objects $A,B,C,\ldots$ along with a class (for technical reasons a class, not a set) of morphisms $f,g,h,\ldots$. Each morphism has a source object and a target object so that we can think of a morphism as an arrow $B\leftarrow A$. There is a composition operation of morphisms $gf$ which is defined only if the source of $g$ is the target of $f$. There is also an identity morphism $1_A$ for every object $A$ whose source and target are both $A$. Finally we require that composition be associative $(hg)f=h(gf)$ and unital $1_B f=f=f 1_A$.

Tangles form morphisms in a category. Just let the objects be points in a plane; then clearly tangles form morphisms with their bottom endpoints as source and their top endpoints as target (or vice versa, it’s just a convention). We can compose tangles by placing them one atop the other, so long as their sources and targets match up. Identity tangles are simply a bunch of vertical lines connecting matching top and bottom endpoints. Clearly, associativity and unitality hold so tangles do indeed form a category.

We can form a category of tangles with a completely different composition however. Instead of placing tangles atop each other, we can place them side by side. Now the empty tangle is the identity. Also, in this category there is only 1 object since we can always place tangles next to each other; there’s nothing to match up! Something with 2 different categorical structures like this is called, logically enough, a 2-category. But, as we said, the second category structure has a unique object. These kinds of 2-categories are so common they get their own name, monoidal categories. Thus, tangles form the morphisms of a monoidal category.

Actually, that’s not the end of the story! We could put the tangles side by side in different ways, since the endpoints live in planes, we have 2 dimensions to work with. The two independent ways of placing tangles next to each other in addition to the standard composition of placing them atop each other turn tangles into a 3-category. Since both ways of putting tangles next to each other can be done without worrying about matching this is a special kind of 3-category called a doubly monoidal category. Doubly monoidal categories always have a way of transforming the monoidal product (side-by-side placement) into its opposite (side-by side placement but in the reverse order). This comes from the fact that the 2 monoidal structures are essentially the same. Try to think about why this is true for tangles.

Let’s think about how to transform two points sitting side by side into the same two points sitting in the opposite order. As we transform in two dimensions rotating one around the other, we trace out the familiar crossing. Of course we can rotate them in the other direction and get the other crossing.

Crossings

In general, this sort of thing is called a braiding, and doubly monoidal categories always have them. For this reason, they’re also called braided monoidal categories.

Orientation means that the endpoints of our tangle are more than just points. They have directions associated with them, either up or down. We call this a dual structure, since the dual of up is down. This is familiar from linear algebra where to each vector space $V$ we can associate a dual vector space $V^*$ of linear maps from $V$ to the field of scalars. The important structure relating vector spaces and their duals are the evaluation and coevalutation maps. Evaluation takes a dual vector $f$ and a vector $v$ and evaluates to the scalar $f(v)$. Coevaluation makes use of the isomorphism $V\otimes V^*=End(V)$ where $End(V)$ is the space of endomorphisms of $V$. The coevaluation takes a scalar to that scalar multiple of the identity. Now, we have the same sort of structure morphisms in the category of tangles, the caps and cups. This makes the category of tangles a monoidal category with duals, just like the category of linear transformations of vector spaces.

Cap and Cup

Since cups and caps may be oriented in 2 different ways, we have 2 dual structures, a left and a right dual. The same can be said of the category of vector spaces but there, one simply identifies left and right duals. In the category of tangles it’s not so easy. Instead one must build a natural isomorphism between left and right duals and for this you need a twist. A twist is what it sounds like, take your endpoints and twist them around 360 degrees. This is where framing comes into play. If you do this to a single endpoint, you get a ribbon with a full twist in it. This has a blackboard diagram that looks like either side of the framed Reidemeister 1 move.

Twist on 1 strand

What if you had 2 endpoints? Think about this for a bit, you get 2 crossings between 2 ribbons each of which has a full twist in it. Luckily this is the compatibility condition between the braiding and the twist that is required of a so-called ribbon category.

Twist on 2 strands

To recap, a ribbon category is a braided monoidal category with duals and a twist. All of these may be defined algebraically but have intuitive topological definitions in the category of tangles. The fact that algebra may be thought about topologically can be rigorously summed up in the statement of Shum’s theorem given at the beginning of the post: framed, oriented tangles form the morphisms of a free ribbon category on a single generator.

Papers and LyX

September 4, 2009
In this post I want to talk about two applications I use which are critical to my workflow, Mekentosj Papers and LyX. Papers is an organizer for your academic papers and is only available for Mac OS X. LyX is a wysiwyg LaTeX editor and is available for pretty much any platform.
Before I learned about Mekentosj Papers, I used to organize papers by bookmarking their arxiv webpages. I also downloaded the pdfs haphazardly into my file system, usually renaming them from cryptic things like 012345.pdf to lastnames-title.pdf. My “system” was not simple, scalable or searchable. I downloaded the trial of Papers on recommendation from a colleague and imported all of my pdfs into the program with a simple drag and drop. Then I immediately used what is probably the coolest feature of Papers, matching the pdfs with their appropriate metadata. Papers has the ability to search the arxiv, download metadata, and then link it to your papers. You can then organize your papers easily by titles, authors, journals, or dates and you can view the abstracts easily. When matching a paper with its metadata, the program has a very pleasant animation and sound effect and stupid though it may be, this is what sold me on Papers. It feels like an Apple program (in a good way). It’s supposed to be like iTunes for your pdfs but I hate iTunes. Papers is way better.
Papers costs $40 but you can get a student discount about$14 off. There are frequent updates removing bugs and adding features. One of the coolest features that was added subsequent to my initial conversion is an iPhone companion app. The app cost me $10 but it was worth it, even though I usually don’t pay more than$1 for an app. It replicates most of the features of the desktop app. It even wirelessly syncs with the desktop application; iTunes eat your heart out. I now have 87 papers which I organize and read in Papers, at home or on the go.
For me, LyX is to writing math what Papers is to reading math. I know how to typeset LaTeX. You pretty much can’t do math these days without knowing. But even if you don’t know, you can still use LyX, a wysiwym program for generating LaTeX documents. Wysiwym stands for “what you see is what you mean”, a play on the usual wysiwig (“get” vs. “mean”) paradigm. With LyX you get the features of LaTeX, namely being able to generate content without over-worrying about presentation, along with instant preview, i.e. no need to compile the LaTeX file and generate a pdf. You can use the menu items to write mathematical notation or you can directly type LaTeX commands which instantly compile inline! This is about a million times better than compiling every couple of lines to check that you haven’t introduced any bugs in your code and you can also use the menu items when you inevitably forget some code. LyX has most of the features you find in LaTeX. For instance, I use the plugin Xy-pic a lot and it works just fine in LyX with instant previews and everything.
LyX is free as in speech or beer, which is a huge plus, even though I’d be willing to pay for it. It works on any platform (Windows, or Unices) but still integrates well in OS X. The developers are active and updates quash bugs.

In this post I want to talk about two applications I use which are critical to my workflow, Mekentosj Papers and LyX. Papers is an organizer for your academic papers and is only available for Mac OS X. LyX is a wysiwyg LaTeX editor and is available for pretty much any platform.

Before I learned about Mekentosj Papers, I used to organize papers by bookmarking their arxiv webpages. I also downloaded the pdfs haphazardly into my file system, usually renaming them from cryptic things like 012345.pdf to lastnames-title.pdf. My “system” was not simple, scalable or searchable. I downloaded the trial of Papers on recommendation from a colleague and imported all of my pdfs into the program with a simple drag and drop. Then I immediately used what is probably the coolest feature of Papers, matching the pdfs with their appropriate metadata. Papers has the ability to search the arxiv, download metadata, and then link it to your papers. You can then organize your papers easily by titles, authors, journals, or dates and you can view the abstracts easily. When matching a paper with its metadata, the program has a very pleasant animation and sound effect and stupid though it may be, this is what sold me on Papers. It feels like an Apple program (in a good way). It’s supposed to be like iTunes for your pdfs but I hate iTunes. Papers is way better.

Papers costs $40 but you can get a student discount about$14 off. There are frequent updates removing bugs and adding features. One of the coolest features that was added subsequent to my initial conversion is an iPhone companion app. The app cost me $10 but it was worth it, even though I usually don’t pay more than$1 for an app. It replicates most of the features of the desktop app. It even wirelessly syncs with the desktop application; iTunes eat your heart out. I now have 87 papers which I organize and read in Papers, at home or on the go.

For me, LyX is to writing math what Papers is to reading math. I know how to typeset LaTeX. You pretty much can’t do math these days without knowing. But even if you don’t know, you can still use LyX, a wysiwym program for generating LaTeX documents. Wysiwym stands for “what you see is what you mean”, a play on the usual wysiwig (“get” vs. “mean”) paradigm. With LyX you get the features of LaTeX, namely being able to generate content without over-worrying about presentation, along with instant preview, i.e. no need to compile the LaTeX file and generate a pdf. You can use the menu items to write mathematical notation or you can directly type LaTeX commands which instantly compile inline! This is about a million times better than compiling every couple of lines to check that you haven’t introduced any bugs in your code and you can also use the menu items when you inevitably forget some code. LyX has most of the features you find in LaTeX. For instance, I use the plugin Xy-pic a lot and it works just fine in LyX with instant previews and everything.

LyX is free as in speech or beer, which is a huge plus, even though I’d be willing to pay for it. It works on any platform (Windows, or Unices) but still integrates well in OS X. The developers are active and updates quash bugs.

Finally, let me say that I have issues with both programs. They’re not perfect. Nevertheless, they make my life so much easier and they are both pleasures to use.

Electrodynamics on a Principal Bundle II

August 16, 2009

Suppose we had a principal $U(1)$-bundle $\pi:P\to M$ with a connection $\omega$ with curvature $\Omega$.

The Lie algebra $\mathfrak{u}(1)$ is just the set of imaginary numbers $i\mathbb{R}$ with trivial Lie bracket ${[},{]}=0$. The local potential is a real-valued 1-form $A_{U}$ defined by $\omega_{U}=iA_{U}$. The local field strength $F_{U}$ is defined by $\Omega_{U}=iF_{U}$.

A change of gauge is given by $g_{UV}=e^{i\lambda}$ with $\lambda:U\cap V\to\mathbb{R}$. We see that local connections are related by $\omega_{V}=e^{-i\lambda}\omega_{U}e^{i\lambda}+e^{-i\lambda}de^{i\lambda}=\omega_{U}+id\lambda$, so that local potentials are related by $A_{V}=A_{U}+d\lambda$. Local curvatures are related by $\Omega_{V}=e^{-i\lambda}\Omega_{U}e^{i\lambda}=\Omega_{U}$, so that local field strengths are related by $F_{U}=F_{V}$. This means that the field strength is globally defined on $M$.

By the Bianchi identity we have $d\Omega=0$ so $dF=0$, so the homogeneous Maxwell equation comes along for free. We can get the inhomogeneous Maxwell equation by requiring that $d*F=*J$.

Now, consider the action $U(1)$ on $\mathbb{C}$ given by multiplication $e^{i\lambda}z$. Associated to our principal $U(1)$ bundle we get a vector bundle with fiber $\mathbb{C}$ with an induced connection $\nabla$ locally given by $\nabla=d+\omega_U=d+iA_U$. We will write sections of the associated bundle as $\psi$. We can define the d’Alembert operator $\square=*\nabla*\nabla+\nabla*\nabla*$. If we require the Klein-Gordon equation, $\square\psi=m^2\psi$, then we have a theory of a charged spin-0 particle coupled to electromagnetism.

In order to couple electromagnetism to more interesting particles like Dirac’s electron, we need to incorporate spin somehow.

Consider the matrix group $O(1,3)$, i.e. matrices $B$ such that $B^{T}\eta B=\eta$ where $\eta=diag(1,-1,-1,-1)$, or equivalently $\eta(Bv,Bw)=\eta(v,w)$ for any events $v,w$ in Minkowski spacetime. This group has 4 connected components coming from $det(B)=\pm1$ and $B_{00}>0$ or $B_{00}<0$. The component containing the identity is called the proper, orthochronous Lorentz group $L=L_{+}^{\uparrow}$. Physically it contains all rotations, and boosts (Lorentz tranformations) and so $dim(L)=6$.

We can cover $L$ by the simply connected group $SL(2,\mathbb{C})$, i.e. $2\times2$ complex matrices $A$ with $det(A)=1$. First we identify Minkowski spacetime $\mathbb{R}^{4}$ with the space of $2\times2$ Hermitian matrices, i.e. matrices $H$ such that $\overline{H}^{T}=H$, in such a way that if $H$ is the Hermitian matrix identified with the event $x$ then $det(H)=|x|^{2}$. Then we can define a covering map $\Lambda:SL(2,\mathbb{C})\to L$ by identifying $\Lambda(A)x$ with $AH\overline{A}^{T}$. We have that $\Lambda(A)\in L$ since
$|\Lambda(A)x|^{2}=det(AH\overline{A}^{T})=det(A)det(H)det(A)=det(H)=|x|^{2}$. It can be shown that $\Lambda$ is a 2-1 homomorphism of Lie groups.

Now, there are two important irreducible representations for $SL(2,\mathbb{C})$ on $\mathbb{C}^{2}$, the “spin $\frac{1}{2}$” representations given by multiplication $A\left(\begin{array}{c} z_{1}\\ z_{2}\end{array}\right)$ and multiplication by the adjoint $\overline{A}^{T}\left(\begin{array}{c} z_{1}\\z_{2}\end{array}\right)$. The Dirac representation is the direct sum of these representations $\left(\begin{array}{cc}A& 0\\ 0&\overline{A}^{T}\end{array}\right) \left(\begin{array}{c}z_{1}\\z_{2}\\z_{3}\\z_{4}\end{array}\right)$.

Let $\pi:FM\to M$ be the orthonormal frame bundle for spacetime. Its fibers $F_{m}M$ are ordered orthonormal bases of $T_{m}M$, or equivalently isometries $p:\mathbb{R}^{4}\to T_{m}M$. There is a right action of $O(1,3)$ given by right composition $pB$ which makes the frame bundle an $O(1,3)$-bundle. We say that $M$ is space and time orientable iff $FM$ has 4 components and a choice of component $FM_{0}$ is a space and time orientation. Then the restriction $\pi:FM_{0}\to M$ is an $L$-bundle.

The solder form is an $\mathbb{R}^{4}$-valued 1-form $\phi$ on $FM_{0}$ given by $\phi_{p}(X)=p^{-1}(\pi_{*}(X))$. The torsion of a connection $\theta$ on $FM_{0}$ is $\Theta=d\phi+\theta\wedge\phi$. It turns out that there is a unique connection whose torsion is $\Theta=0$. This is the Levi-Civita connection $\theta$.

A spin structure on $M$ is a manifold $SM$ and a smooth map $\lambda:SM\to FM_{0}$ such that $\pi\circ\lambda:SM\to M$ is an $SL(2,\mathbb{C})$-bundle with $\lambda(pA)=\lambda(p)\Lambda(A)$. We can define a connection $\tilde{\theta}$ on $SM$ by $\tilde{\theta}=\Lambda_{*}^{-1}\lambda^{*}\theta$ where $\Lambda_{*}$ is the isomorphism of Lie algebras induced by $\Lambda:SL(2,\mathbb{C})\to L$.

Now consider sections $\psi$ of the vector bundle associated to $SM$ by the Dirac representation. Dirac’s idea was to introduce an operator $\not\hspace{-4pt}D$ such that $\not\hspace{-4pt}D^{2}=\square$, i.e. the Dirac operator is the “square root” of the d’Alembert operator. A full understanding of the Dirac operator requires Clifford algebras, i.e the algebra generated over Minkowski space modulo $v^{2}=\eta(v,v)$. It turns out that the smallest representation $\gamma$ of this Clifford algebra is 4-dimensional which is why we need a 4-dimensional representation of $SL(2,\mathbb{C})$ as well. Then we can define the Dirac operator as $\not\hspace{-4pt}D=\eta(\gamma,\nabla)$ where $\nabla$ is the connection associated to $\tilde{\theta}$ and we inner product them somehow.

In more detail for the d’Alembertian on Minkowski spacetime, $\square=\frac{\partial^{2}}{\partial t^{2}}-\frac{\partial^{2}}{\partial x^{2}}-\frac{\partial^{2}}{\partial y^{2}}-\frac{\partial^{2}}{\partial z^{2}}$, define

$\not\hspace{-4pt}D=\left(\begin{array}{cccc} 1& 0& 0& 0\\ 0 & 1& 0& 0\\ 0 & 0& -1& 0\\ 0 & 0& 0& -1\end{array}\right)\frac{\partial}{\partial t}+\left(\begin{array}{cccc} 0& 0& 0& 1\\ 0 & 0& 1& 0\\ 0 & -1& 0& 0\\ -1& 0& 0& 0\end{array}\right)\frac{\partial}{\partial x}$

$+\left(\begin{array}{cccc} 0& 0& 0& -i\\ 0 & 0& i& 0\\ 0 & i& 0& 0\\ -i& 0& 0& 0\end{array}\right)\frac{\partial}{\partial y}+\left(\begin{array}{cccc}0& 0& 1& 0\\ 0 & 0& 0& -1\\ -1& 0& 0& 0\\ 0 & 1& 0& 0\end{array}\right)\frac{\partial}{\partial z}$

We can work out that $\not\hspace{-4pt}D^{2}=\square$.

Then we demand that the Dirac equation holds, $\not\hspace{-4pt}D\psi=m\psi$. This gives us a theory of a spin-$\frac{1}{2}$ particle, an electron or positron, but we have not yet coupled it to electromagnetism.

Right now, our notion of an electron is that it is a field which takes its values in a representation of the spin group $Spin(1,3)=SL(2,\mathbb{C})$. In order to couple to the electromagnetic field, we will rather think of the electron taking its values in a representation of the charged spin group $Spin_C(1,3)=U(1)\times SL(2,\mathbb{C})/(\mathbb{Z}/2)$.

We can splice a $G_{1}$-bundle $\pi_{1}:P_{1}\to M$ with a $G_{2}$-bundle $\pi_{2}:P_{2}\to M$. Define $P=\{(p_{1},p_{2})\in P_{1}\times P_{2}:\pi_{1}(p_{1})=\pi_{2}(p_{2})\}$ and $\pi:P\to M$ by $\pi(p_{1},p_{2})=\pi_{1}(p_{1})=\pi_{2}(p_{2})$. This is a $G_{1}\times G_{2}$-bundle with $(p_{1},p_{2})(g_{1},g_{2})=(p_{1}g_{1},p_{2}g_{2})$. Given connections $\omega_{1},\omega_{2}$ on $P_{1},P_{2}$, we can define a connection $\omega$ on $P$ by $\omega=\pi^{1*}\omega_{1}\oplus\pi^{2*}\omega_{2}$ with $\pi^{i}:P\to P_{i}$ given by $\pi^{i}(p_{1},p_{2})=p_{i}$.

Splice together our $U(1)$-bundle $P$ with $SM$ and also splice $\omega$ with $\tilde{\theta}$. Consider the representation of $U(1)\times SL(2,\mathbb{C})$ on $\mathbb{C}^{4}$ given by combining the Dirac representation with multiplication by $e^{i\lambda}$. This structure is $\mathbb{Z}/2$-invariant so defines a $Spin_C(1,3)$ -bundle. We get an associated vector bundle with an associated connection and Dirac operator $\not\hspace{-4pt}D$. A charged electron coupled to electromagnetism is then a section $\psi$ for which the Dirac equation $\not\hspace{-4pt}D\psi=m\psi$ holds.

Electrodynamics on a Principal Bundle I

August 16, 2009

I want to switch gears and talk about some mathematical physics. Actually, I’m going to cross-post some exposition I wrote for a gauge theory seminar that we held at Stony Brook.

Maxwell’s equations in relativistically covariant form are

$\partial_{\mu}F^{\mu\nu}=J^{\nu}$
$\partial_{[\lambda}F_{\mu\nu]}=0$

Since $F_{\mu\nu}=-F_{\nu\mu}$ we can define a 2-form $F=F_{\mu\nu}dx^{\mu}dx^{\nu}$. We can also define a 1-form $J=J_\mu dx^\mu$. Then we can re-express Maxwell’s equations using exterior differentiation and the Hodge star.

$d*F=*J$
$dF=0$

The continuity equation $d*J=0$ then follows from the inhomogeneous Maxwell equation. We expect from the homogeneous Maxwell equation that $F=dA$. In fact this is only true locally. This means that for every event $m$ in our spacetime $M$ there is an open set $U$ with $m\in U\subset M$ and a 1-form $A_U$ on $U$ with $F|_U=dA_U$. This follows from Poincare’s lemma.

We cannot say the $A$ exists globally. For instance if $F=sin\phi d\phi d\theta$, the area form of the unit sphere in spherical coordinates, then $dF=cos\phi d\phi d\phi d\theta=0$ since $d\phi d\phi=0$ by antisymmetry of wedge product of 1-forms. Also, taking $\Sigma$ to be the unit sphere, we know that $\int_\Sigma F=4\pi$. However, by Stokes’ Theorem, if $F=dA$ then $\int_\Sigma F=\int_\Sigma dA=\int_{\partial \Sigma} A=0\neq 4\pi$. So, we cannot have $F=dA$ globally.

Physically we interpret this as a magnetic monopole with magnetic charge $4\pi$ and worldline, the time axis, $r=0$. Mathematically, what is happening is that the complement of the time axis has nontrivial topology. Specifically its second de Rham cohomology is nontrivial. Intuitively, there is a kind of 2-dimensional, spherical “hole” in the complement of the time axis.

In addition to being nonglobal, the potential $A$ is defined only up to addition of a closed 1-form since $d(A+d\lambda)=dA=F$. We would like to find a global mathematical object corresponding to the potential which doesn’t depend on our “choice of gauge”. This is our motivation for understanding connections on principal bundles.

We will assume $G$ is a group of matrices. A principal $G$-bundle is a smooth surjection of manifolds $\pi:P\to M$ with a free transitive right action $R$ of $G$ on $P$ such that $\pi^{-1}\pi(p)=pG$ and for any $m\in M$ there is an open set $U$ with $m\in U\subset M$ and a diffeomorphism $T_U=\pi\times t_U:\pi^{-1}(U)\to U\times G$ called a “local trivialization” such that $t_U(pg)=t_U(p)g$. Local trivializations correspond to the physical notion of “choice of gauge”.

Intuitively, $P$ is a manifold composed of copies of the group $G$ parametrized by the base space $M$. A good example is the boundary of the Mobius strip which can be thought of as a $\mathbb{Z}/2$-bundle over $S^1$.

A useful notion is that of a local section $\sigma_U:U\to P$ with $U$ an open set with $U\subset M$ such that $\pi(\sigma_U(m))=m$. It can be shown that there is a canonical 1-1 correspondence between local sections $\sigma_U$ and local trivializations $T_U$.

Define transition functions $g_{UV}:U\cap V\to G$ by $g_{UV}(m)=t_U(p)t_V(p)^{-1}$ where $\pi(p)=m$. This is well defined since $t_U(pg)t_V(pg)^{-1}=t_U(p)gg^{-1}t_V(p)^{-1}=t_U(p)t_V(p)^{-1}$. Transition functions correspond to the physical notion of “change of gauge”. We can relate any two local sections by $\sigma_V=\sigma_U g_{UV}$.

Let $\mathfrak{g}$ be the Lie algebra for $G$. A connection $\omega$ is a $\mathfrak{g}$-valued 1-form on $P$ such that if If $X\in\mathfrak{g}$ and $\tilde{X}$ is the tangent field on $P$ given by $\tilde{X}_{p}=\frac{d}{dt}pe^{tX}|_{t=0}$, then $\omega(\tilde{X})=X$. Also we require that $R(g)^{*}(\omega)=g^{-1}\omega g$.

We define local connections on $M$ by $\omega_U=\sigma_U^*\omega$. Local connections are related by $\omega_{V}=g_{UV}^{-1}\omega_{U}g_{UV}+g_{UV}^{-1}dg_{UV}$.

We define curvature $\Omega=d\omega+\frac{1}{2}[\omega,\omega]$ meaning $\Omega(X,Y)=d\omega(X,Y)+\frac{1}{2}[\omega(X),\omega(Y)]$. We can define local curvature by $\Omega_U=\sigma_U^*\Omega$. Local curvatures are then related by $\Omega_V=g_{UV}^{-1}\Omega_U g_{UV}$. The Bianchi identity says $d\Omega=[\omega,\Omega]$.

We are now in a position to define electrodynamics on a principal bundle.

Jones’ Polynomial

August 6, 2009

In the last post we investigated the linking number and writhe. These were numerical invariants of oriented links and framed knots. Now I will introduce new invariants which take their values as polynomials.

For a given crossing, we can perform an operation called resolving or smoothing the crossing. We can do this in two ways.

0-smoothing

1-smoothing

Let us suppose that there is a polynomial invariant of links $$ in variables $A,B,C$ so that concentrating on a neighborhood of a crossing in a diagram for $L$, we have that the following relation, called the skein relation, holds.

Skein Relation

Performing smoothings on all crossings reduces a link diagram to some number of circles in the plane. Let’s require that adding a circle $\bigcirc$ to a link diagram $L$ gives $=C$. Finally we require a normalization, that for the empty link $<>=1$. From this we can deduce that the bracket of $n$ circles is $<\bigcirc\cdots\bigcirc>=C^n$.

We need to check invariance under Reidemeister moves. Let’s start with Reidemeister 2.

Reidemeister 2 Calculation

Thus, in order for the bracket to be invariant we must have $A^2+ABC+B^2=0$ and $AB=1$. Solving for $B,C$ in terms of $A$, we get $B=A^{-1},C=-A^2-A^{-2}$.

The nice thing now is that Reidemeister 3 comes along for free by using invariance under Reidemeister 2.

Reidemeister 3 Calculation

Performing Reidemeister 1 on the other hand does not leave the bracket invariant. However, we can see that opposite Reidemeister 1 moves cancel so that the bracket is invariant under the framed Reidemeister 1 move.

Reidemeister 1 Calculation

Consequently, the bracket is an invariant of framed links whose values are polynomials in $A$ and $A^{-1}$. To calculate it, take a blackboard diagram for the framed link and apply the skein relation, the circle relation and the normalization relation until you reach the answer.

The bracket was introduced by Kauffman as an elementary way to define Jones’ polynomial, an invariant of oriented links which was originally derived using some difficult algebra. We can define the Jones’ polynomial by $V(L)=-A^{-3TotWr(L)}|_{A=q^{1/4}}$. Here, $TotWr(L)$ the total writhe is the sum of signs of all crossings in the diagram and it is this factor which makes $V(L)$ now invariant under Reidemeister 1 moves.

The Kauffman bracket and Jones’ polynomial are very closely related, in a similar way to how the writhe and linking numbers are closely related. Following the discovery of the Jones’ polynomial, there was a great deal of interest in knot theory. The Jones’ polynomial showed new connections between topology on the one hand and representation theory and quantum physics on the other.

Invariants

July 14, 2009

How can we tell if two tangles (or links, or knots) are different? That we cannot move the strings around as we are allowed and get from one tangle to another? We find invariants which can tell the difference. The best way to explain what an invariant is, is to give an example. The component number of a tangle is the number of strings in the tangle. Clearly if two tangles have different number of strings then they are not the same. For example the trefoil knot has component number 1 and the Hopf link has component number 2.

Trefoil Knot

An invariant is some mathematical object, like a number or a polynomial that we can associate to tangles (or links, or knots) that depends only on the tangle-type. For instance the component number of a tangle doesn’t change when the strings move about or are stretched. Therefore, it is an invariant.

The component number is rather a blunt invariant. What if we want to tell the difference between tangles with the same component number? Let’s define an invariant for links with component number 2. We will call it the linking number. The linking number is actually an invariant for “oriented” links with component number 2. Oriented means that each string in the tangle comes with a preferred direction. We indicate this in a diagram by drawing an arrow on each string.

Whenever two different strings cross we can use the right hand rule to assign a positive or negative value to the crossing. Put your thumb in the direction (according to the orientation) of the over-strand and your fingers in the direction of the under-strand. If your palm is facing up (away from the screen) then it is a positive crossing and if your palm is facing down (towards the screen) then it is a negative crossing.

Signs of Oriented Crossings

Now think of our link as having components (strings) called A and B. The linking number Lk(A,B) is the sum of the signs of the crossings in which A crosses over B. In order to see that the linking number is an invariant we need to analyze its behavior under Reidemeister moves.

Reidemeister 1

Consider the first Reidemeister move. The left part of the equation has a crossing, but it comes from only 1 component, so it contributes 0 to the linking number. The same applies to the right part of the equation. The middle part of the equation has no crossings and so it contributes 0 to the linking number. Thus the linking number is invariant under Reidemeister 1.

Reidemeister 2

Consider the second Reidemeister move. There are two cases, either the strands come from the same component or different components. In the first case, the left side of the equation contributes 0 to the linking number. In the second case, no matter which orientation there is on the strands, the two crossings have opposite signs and so contributes 0 to the linking number. In either case, the right side of the equation has no crossings and so contributes 0 to the linking number. Thus the linking number is invariant under Reidemeister 2.

Reidemeister 3

Consider Reidemeister 3. Notice that each pair of strands cross in the same way but in different places on each side of the equation. Thus, no matter which components the strands belong to, nor which orientation we give them, each side contributes the same to the linking number. Thus the linking number is invariant under Reidemeister 3.

Thus, the linking number Lk(A,B) is an invariant of 2 component oriented links. Even better, it’s symmetric Lk(A,B)=Lk(B,A). So we can calculate it by summing the signs of the crossings where B crosses over A.

We can easily calculate the linking number for the oriented Hopf link pictured above, Lk(A,B)=-1.

What happens if we try to calculate the self-linking number of a knot Lk(K,K). Unfortunately it is no longer invariant under Reidemeister 1, since the argument we had used to prove invariance required that we were calculating linking number Lk(A,B) between different components A and B. You can see that the arguments for Reidemeister 2 and 3 did not require that the components were different so that the self-linking number, which we shall call the writhe Wr(K)=Lk(K,K), is invariant under Reidemeister 2 and 3. Furthermore, it does not depend on the orientation, since switching the orientation will not change the sign of a crossing (the orientation switches on both strands, so the sign is preserved).

In order to remedy the problem of non-invariance of the writhe under Reidemeister 1, we introduce a new property of tangles, “framing”. If orientation can be thought of as arrows going parallel to the tangle, then framing can be thought of as arrows going perpendicular to the tangle. If we extend the tangle along these arrows we obtain a “ribbon”, that is a tangle whose components are 2-dimensional surfaces. Now the self-linking number makes sense, as the linking number of the two edges of the ribbon.

We can project framed tangles in such a way that the ribbon is flattened in the projection. Then we need only draw the ribbon using a string as before and we can extend that string perpendicularly in the plane of projection. The resulting framing is called the “blackboard framing”. Such diagrams represent equivalent tangles if and only if they are connected by a sequence of Reidemeister 2 & 3 moves and the framed Reidemeister 1 move.

Framed Reidemeister 1

Notice that no matter what orientation is chosen, both sides have negative crossings. Since the sign of the crossing cannot change, the writhe is invariant under framed Reidemeister 1. Thus, the writhe, Wr(K), is an invariant of framed knots.

We have introduced two interesting new invariants, the linking number Lk(A,B) and the writhe Wr(K) but in order to do so we had to add more structure to tangles, orientation and framing. That these structures are natural as well as closely related is hinted at by our study of invariants. The linking number is sensitive to orientation but not framing and the writhe is sensitive to framing but not orientation. We will have more to say about these features of tangles in the future.