graphical linear algebra
play

Graphical Linear Algebra PhD Open, University of Warsaw Pawel - PowerPoint PPT Presentation

Graphical Linear Algebra PhD Open, University of Warsaw Pawel Sobocinski University of Southampton joint work with Filippo Bonchi, and Fabio Zanasi important contributions from Dusko Pavlovic, Fabio Gadducci, Aleks Kissinger, Brendan Fong and


  1. String diagrams • A graphical notation for the arrows of monoidal categories • We have been writing C : m → n • We will now draw m n C

  2. Composition C : k → l D : l → m C ; D : k → m m k l C D

  3. Monoidal product C : k → l D : m → n C ⊕ D : k ⊕ m → l ⊕ n k l C n m D

  4. Perks of the notation I E : m → n D : l → m C : k → l ( C ; D ) ; E = C ; ( D ; E ) : k → n k m n l C D E

  5. Perks of the notation II C : m → n D : m’ → n’ E : m’’ → n’’ ( C ⊕ D ) ⊕ E = C ⊕ ( D ⊕ E ) : m ⊕ m’ ⊕ m’’ → n ⊕ n’ ⊕ n’’ m n C m' n' D m'' n'' E

  6. Perks of the notation III ( A ; B ) ⊕ ( C ; D ) = ( A ⊕ C ) ; ( B ⊕ D ) A B C D

  7. Diagrammatic reasoning I Stretching • Identity on m is simply drawn as a wire m C : m → n I m ; C = C = C ; I n m n m n m n = C C = C

  8. Diagrammatic reasoning II Sliding ( A ⊕ I r ) ; ( I q ⊕ B ) = A ⊕ B = ( I p ⊕ B ) ; ( I s ⊕ A ) p q p q p q A A A = = r s r s r s B B B

  9. General story • A strict monoidal category is the same thing as a 2-category with one object, a particularly simple kind of higher category • string diagrams are a kind of graph theoretical dual, i.e. • zero dimensional things (objects) become two dimensional things • one dimensional things (arrows in a 2-cat = objects in a strict monoidal cat) stay as one dimensional things — wires • two dimensional things (2-cells in a 2-cat = arrows in a strict monoidal cat) become zero dimensional things (points, or boxes as we have been drawing) • See Globular (Vicary, Kissinger, Bar): http://globular.science

  10. Symmetric monoidal categories • When wiring things up using the algebra of connecting and stacking, we often want to permute the wires • Mathematically, this means moving from monoidal categories to symmetric monoidal categories • In a symmetric monoidal category, for any two objects m , n , there is a symmetry , or twist tw m , n : m ⊕ n → n ⊕ m

  11. Example - Crema di Mascarpone yolk white white yolky paste whisked whites yolky paste whisked whites egg thick paste crema di mascarpone yolk Crack Egg Whisk Beat Stir Fold yolk white sugar mascarpone thick paste white whisked whites egg Whisk Crack Egg yolk crema di mascarpone Fold thick white paste egg yolky Crack Egg paste yolk Beat Stir sugar mascarpone

  12. Example - Crema di Mascarpone yolk white white yolky paste whisked whites yolky paste whisked whites egg thick paste crema di mascarpone yolk Crack Egg Whisk Beat Stir Fold yolk white sugar mascarpone thick paste white whisked whites egg Whisk Crack Egg yolk crema di mascarpone Fold thick white paste egg yolky Crack Egg paste yolk Beat Stir sugar mascarpone ( C ⊕ C ⊕ id 2 ) ; ( id ⊕ tw ⊕ id 3 ) ; ( W ⊕ B ⊕ id ) ; ( id ⊕ S ) ; F

  13. Natural transformations • We have seen categories, and functors: morphisms between categories • A natural transformation is a morphism between functors F ⇒ G: X → Y • A natural transformation α : F ⇒ G is a collection of arrows of Y , one for each object in m ∈ X α m : F m → G m • These must satisfy a condition with respect to the arrows of X , namely for each arrow C : m → n α m F m G m G C commutes. F C These are sometimes called naturality squares α n F n G n

  14. Aside — string diagrams for Cat • Cat is a 2-category • O bjects (0-morphisms) : categories • Arrows (1-morphisms) : functors • 2-cells (2-morphisms) : natural transformations • Suppose that F: C → D has right adjoint G: D → C , then the triangle equations can be drawn as follows, using string diagrams: F η η G F FGF G GFG ε F G ε F G F G η ε G F F G = = ε η F G

  15. Symmetry as natural transformation • For a monical category C, there are actually two functors C × C → C given by ⊕ ⊕ = – 1 ⊕ – 2 : C × C → C – stack the first on the second ⊕ ’ = – 2 ⊕ – 1 : C × C → C – stack the second on the first • tw is a natural transformation from the first to the second, with components tw m , n : m ⊕ n → n ⊕ m

  16. Drawing twists tw m , n : m ⊕ n → n ⊕ m m n m n

  17. Diagrammatic reasoning III naturality = sliding across twists tw p , n p ⊕ n n ⊕ p n p p n C n ⊕ C C ⊕ n = q n q n C q ⊕ n n ⊕ q tw q , n tw m , p m ⊕ p p ⊕ m m q q m C = C ⊕ m m ⊕ C p m p m C m ⊕ q q ⊕ m tw m , q

  18. Diagrammatic reasoning IV tightening (without wires tangling) • In any symmetric monoidal category, the twist is invertible , and has itself as inverse, in the following sense tw m , n ; tw n , m = I m ⊕ n : m ⊕ n → m ⊕ n m n m m = n m n n In a braided monoidal category, the twist is invertible, but it is not, in general, it’s own inverse

  19. Symmetric monoidal categories • A strict symmetric monoidal category C , is a strict monoidal category with a natural family of arrows tw m , n : m ⊕ n → n ⊕ m, indexed by pairs of objects of C , such that tw m , n ; tw n , m = I m ⊕ n : m ⊕ n → m ⊕ n tw p , m ⊕ n = (tw p,m ⊕ I n ); ( I m ⊕ tw p , n ): p ⊕ m ⊕ n → m ⊕ n ⊕ p tw m ⊕ n , p = ( I m ⊕ tw n , p ) ; (tw p , m ⊕ I n ): m ⊕ n ⊕ p → p ⊕ m ⊕ n tw I , m = I m = tw m , I

  20. Yang-Baxter • Exercise : The famous Yang-Baxter equation is an instance of naturality of the twist = • tegether with = we get that “pure” wiring diagrams t ⊕ m → t ⊕ m are in 1-1 correspondence with permutations of the m-element set

  21. The category of permutations • Objects : finite ordinals m = {1,…,m} • Arrows : no arrows from m to n if m ≠ n, otherwise the permutations • Strict symmetric monoidal, with m ⊕ n := m+n

  22. Algebraic theories Universal Algebra • An algebraic theory is a pair ( Σ , E) where • Σ is a set of generators (or operations ), each with an arity, a natural number • E is a set of equations (or relations) , between Σ - terms built up from generators and variables Example 1 - monoids Example 2 - abelian groups Σ M = { ⋅ :2, e:0 } Σ G = Σ M ∪ { i:1 } E M = { ⋅ ( ⋅ (x, y), z ) = ⋅ ( x, ⋅ (y, z) ), E G = E M ∪ { ⋅ (x, y) = ⋅ (y, x), ⋅ (x, e) = x, ⋅ (e, x) = x } ⋅ (x, i(x)) = e }

  23. Σ - terms (cartesian) x ∈ Var t 1 t 2 … t m σ ∈ Σ ar( σ ) = m x σ (t 1 , t 2 , …, t m ) i.e. terms a trees with internal nodes labelled by the generators and the leaves labelled by variables

  24. Models - classically • To give a model of an algebraic theory, choose a set X k → X • for each operation σ : k in Σ , choose a function [[ σ ]] : X • now for each term t , given an assignment of variables α , we can recursively compute the element of [[ t ]] α ∈ X which is the “meaning” of t • We need to ensure that for every assignment of variables α , and every equation t 1 = t 2 in E, we have [[ t 1 ]] α = [[ t 2 ]] α as elements of X • To give a model of the algebraic theory of monoids is to give a monoid • To give a model of the theory of abelian groups is to give an abelian group • etc..

  25. Algebraic theories, categorically • There is a nice way to think of algebraic theories categorically, due to Lawvere in the 1960s • get rid of “countably infinite set of variables”, “variable assignments” etc. • relies on the notion of categorical product

  26. Categorical product • Suppose that X , Y are objects in a category C . Then X and Y have a product if ∃ object X × Y and arrows π 1 : X × Y → X , π 2 : X × Y → Y so that the following universal property holds π 1 π 2 Y X × Y X for any object Z and arrows f : Z → X , g : Z → Y , h ∃ unique h : Z → X × Y s.t. g f h ; π 1 = f and h ; π 2 = g Z • Example : in the category Set of sets and functions, the cartesian product satisfies the universal property • Any category with (binary) categorical products is monoidal, with the categorical product as monoidal product

  27. Exercise • If X is a preorder, considered as a category, what does it mean if X has (binary) categorical products? • In Set , the categorical product is the cartesian product • What is the product in the category of categories and functors? • What is the product in the category of monoids and homomorphisms?

  28. Lawvere categories • Suppose that ( Σ , E) is an algebraic theory • Define a category L ( Σ ,E) with • Objects : natural numbers • Arrows from m to n: n tuples of Σ -terms, each using possibly m variables x 1 , x 2 , …, x m , modulo the equations of E • Composition is substitution Examples in the theory of monoids It is also possible (and elegant) to view L ( Σ ,E) as (x 2 ⋅ x 1 ) the free category with (x 1 ⋅ x 2 ) 2 2 1 1 products on the data specified in ( Σ ,E) (x 1 ) (x 1 ⋅ e) = 1 1 1 1

  29. Exercise • Lawvere categories have (binary) categorial products: m × n := m+n. Q1 . What are the projections? • In any category with binary products there is a canonical arrow Δ : X → X × X called the diagonal. Q2. How is it defined? Q3 . What is L ( ∅ , ∅ ) ? Can you find a simple way of describing it?

  30. Models categorically (Functorial semantics) • A functor F: C → D is product-preserving if F(X × Y) = F(X) × F(Y) • Theorem. To give a model of ( Σ ,E) is to give a product- preserving functor F: L ( Σ ,E) → Set Proof idea : since m = 1+1+…+1 (m times), to give a product preserving functor F from L ( Σ ,E) it is enough to say what F(1) is. • By changing Set to other categories, we obtain a nice generalisation of classical universal algebra, with examples such as topological groups, etc.

  31. Limitations of algebraic theories • Copying and discarding built in (x 1 ) (x 2 ) (x 1 , x 1 ) 2 1 2 1 1 2 • But in computer science (and elsewhere), we often need to be more careful with resources • Consequently, there are also no bona fide operations with coarities other than one c (c 1 ,c 2 ) = 1 2 1 2

  32. Symmetric monoidal theories • Most of our work will concern symmetric monoidal theories ( SMTs ) which give rise to special kinds of symmetric monoidal categories called props • Symmetric monoidal theories generalise algebraic theories , a classical concept of universal algebra, but • No built in copying and discarding • Able to consider operations with coarities other than 1

  33. Symmetric monoidal theories • A symmetric monoidal theory is a pair ( Σ , E) where • Σ is a set of generators (or operations ), each with an arity, and coarity , both natural numbers • E is a set of equations (or relations) , between compatible Σ - terms • Since generators can have coarities, and since we need to be careful with resources, we can’t use the standard notion of term (tree). • Instead, terms are arrows in a certain symmetric monoidal category, which we will construct a la magic Lego

  34. Generators and terms Running example: the SMT of commutative monoids : (2 , 1) : (0 , 1) we always have the following “basic tiles” around : (1 , 1) : (2 , 2)

  35. Some string diagrams • String diagrams: constructions built up from the generators and basic tiles, with the two operations of magic Lego ⊕ = ⊕ = ; =

  36. Recall: diagrammatic reasoning • diagrams can slide along wires k k l m m k l k l k l A A A A = = = n m n n m m C C C m l m k l A functoriality naturality • wires don’t tangle, i.e. = = i.e. pure wiring obeys the same equations as permutations • sub-diagrams can be replaced with equal diagrams (compositionality)

  37. Σ - Terms (monoidal) • Are thus the arrows of the free symmetric monoidal category S Σ on Σ • Objects : natural numbers • Arrows from m to n : string diagrams constructed from generators, identity and twist, modulo diagrammatic reasoning • Monoidal product, on objects: m ⊕ n := m + n

  38. Equations x x x + y (Assoc) = ( x + y ) + z y x + ( y + z ) y y + z z z x x = (Comm) y+x x+y y y 0 (Unit) = 0 + x x Note that all equations are of the form t 1 = t 2 : (m, n), that is, t 1 and t 2 must agree on domain and codomain

  39. The SMT of commutative monoids Generators Equations = = = Let’s call this SMT M , for monoid

  40. Diagrammatic reasoning example = = = = = =

  41. Another SMT: commutative comonoids Generators Equations = = =

  42. From SMTs to symmetric monoidal categories • Every symmetric monoidal theory ( Σ ,E) yields a free strict symmetric monoidal category S ( Σ ,E) • Object: natural numbers • Arrows: monoidal Σ -terms, taken modulo equations in E • Such categories are an instance of props (product and permutation categories)

  43. props • A prop (product and permutation category) is • strict symmetric monoidal • objects = natural numbers • monoidal product on objects = addition • i.e. m ⊕ n = m+n

  44. Examples 1. Any symmetric monoidal theory gives us a prop 2. The strict symmetric monoidal category F • arrows from m to n are all functions from the m element set {0, …, m-1} to the n element set {0, … , n-1} 3.The free strict symmetric monoidal category on one object, the category P of permutations 4. The category I with precisely one arrow from any m to n is a prop

  45. Morphisms of props • A morphism of props F: X → Y is an identity on objects symmetric monoidal functor • identity-on-objects: F( m ) = m • strict: F( C ⊕ D ) = F( C ) ⊕ F( D ) • symmetric monoidal: F(tw m , n ) = tw m , n • functor F( I m )= I m , F( C ; D ) = F( C ) ; F( D ) • In other words, all the structure is simply preserved on the nose — easy peasy

  46. Models • Recall: models of algebraic theories are finite product preserving functors, often to Set • We can define models of an SMT to be symmetric monoidal functors, a generalisation of the notion of finite product preserving • Some computer science intuitions: • SMTs, like M , are a syntax • props like F are a semantics • homomorphisms map syntax to semantics • when the map is an isomorphisms, we have an equational characterisation, and a sound and fully complete proof system to reason about things in F

  47. Example The prop F is not an SMT The prop M is an SMT As props, M is isomorphic to F • So M is an equational characterisation of F • or the “commutative monoids is the theory of functions”

  48. Morphisms from (props obtained from) SMTs • Let us define a morphism [[-]] : M → F • M is obtained from a symmetric monoidal theory ( Σ , E), thus its arrows are constructed inductively • To define [[-]] it thus suffices to • say where the generators in Σ are mapped • check that the equations in hold in F • This is a general pattern when defining morphisms from a prop obtained from an SMT

  49. [[-]]: M → F {1,2} → {1} 7� ! {} → {1} 7� ! Simple exercise: check the following hold in F (Assoc) (Unit) = = = (Comm)

  50. Soundness • Simple observation: the fact that we have a homomorphism [[–]] : M → F means that diagrammatic reasoning in M is sound for F Q1 . What property of [[–]] do we need to ensure completeness? Q2. If we have soundness and completeness, is this enough for [[–]] to be an isomorphism ? (i.e. invertible)

  51. Full and faithful • To show that a morphism of props F: X → Y is an isomorphism it suffices to show that it is full and faithful • full : for every arrow g of Y there exists an arrow f of X such that F( f ) = g • faithful : given arrows f , f’ in X, if F( f )=F( f’ ) then f = f’ So full and faithful functor from a (free PROP on an) SMT = sound and fully complete equational charaterisation

  52. [[–]] : M → F • full: every function between finite sets can be constructed from the two basic building blocks together with permutations • faithful : every diagram in M can be written as multiplications followed by units, which corresponds to a factorisation of a function as an surjection followed by an injection. This factorisation is unique “up-to-permutation”.

  53. Free things • A free “something on X” is one that satisfies a universal property — it’s the “smallest” thing that contains X which satisfies the properties of “something” G F X • e.g. free “monoid on a set Σ ” is the set of finite words Σ *

  54. Free strict symmetric monoidal category on one object • Any ideas? • Recall: there is a category 1 with one object and one arrow • Let X be the free symmetric monoidal category on 1 • There should be a functor from 1 to X • For any functor to a strict symmetric monoidal category Y , there should be a strict symmetric monoidal functor X to Y such that the diagram below commutes strict symmetric monoidal functor X Y functor functor 1

  55. Plan • symmetric monoidal categories and string diagrams • theory of natural number matrices (bimonoids) and integer matrices (Hopf monoids) • bimonoids and matrices of natural numbers • Hopf monoids and matrices of integers • theory of linear relations (interacting Hopf monoids) • distributive laws • linear algebra, diagrammatically • an application: signal flow graphs

  56. The SMT of bimonoids • Combines generators and equations of the SMTs of monoids and comonoids • Intuition : “numbers” travel on wires from left to right The monoid structure The comonoid structure acts as addition/zero acts as copying/discarding x x x+y x y x x 0

  57. Adding meets copying • The way that adding and copying interact is responsible for all linear algebra • In the next slide we will introduce the theory of bimonoids, the equations of which show some of the ways that the interactions happen

  58. The SMT of bimonoids • all the generators we have seen so far • monoid and comonoid equations = = = = = = • “adding meets copying” - equations compatible with intuition = = = =

  59. Mat • A PROP where arrows m to n are n × m matrices of natural numbers ✓ 3 � 0 ✓ ◆ ◆ 1 2 • e.g. 5 � : 2 → 1 : 2 → 2 : 1 → 2 3 4 15 • Composition is matrix multiplication • Monoidal product is direct sum ✓ A 1 ◆ 0 A 1 ⊕ A 2 = A 2 0 • Symmetries are permutation matrices

  60. B and Mat • Theorem . B is isomorphic to the Mat • ie. bimonoids is the theory of natural number matrices • natural numbers themselves can be seen as certain (1,1) diagrams, with the recursive definition below • as we will see, the algebra (rig) of natural numbers follows := 0 +1 is “add one path” k := k+1

  61. Exercise := 0 Given , prove k := k+1 m m 1. 3. = m = m+n n m m 2. 4. = m = m n nm m

  62. Proof B ≅ Mat Recall : Since B is an SMT, suffices to say where generators go (and check that equations hold in the codomain) � 1 1 � 7! : 2 → 1 () : 0 → 1 7! ✓ 1 ◆ 7! : 1 → 2 1 7! () : 1 → 0 Full - easy! Recursively define a syntactic sugar for matrices Faithful - harder Use the fact that equations are a presentation of a distributive law , obtain factorisation of diagrams as comonoid structure followed by monoid structure - normal form

  63. Normal form for B • Every diagram can be put in the form • comonoid ; monoid • Centipedes

  64. Matrices • To get the ijth entry in the matrix, count the paths from the j th port on the left to the ith port on the right • Example: ✓ 1 ◆ 2 2 3 4 3 4

  65. Exercise Q1 . Show that the monoidal product in B ≅ Mat is the categorical product Q2 . The categorical coproduct of X, Y, if it exists satisfies the following universal property i 1 i 2 Y X+Y X for any object Z and arrows f : X → Z , g : Y → Z , h ∃ unique h : X+Y → Z s.t. g f i 1 ; h = f and i 2 ; h = g Z show that the monoidal product in B ≅ Mat is the categorical coproduct. When a monoidal product satisfies both the universal properties of products and coproducts, we say that it is a biproduct . In fact B ≅ Mat is the free category with biproducts on one object. Q3 (challenging) . Given a category C , describe the free category with biproducts on C .

  66. Lawvere categories with string diagrams (i.e. how ordinary syntax looks, with string diagrams) ( σ ∈ Σ ) . σ . . = and what else? = =

  67. . . σ . . . σ . = . . . . . σ . . = . σ . . . . Exercise : show that the monoidal product now becomes a categorical product In particular, notice that B is isomorphic (as a symmetric monoidal category) to the Lawvere category of commutative monoids!

  68. Putting the n in ring: Hopf monoids • generators of bimonoids + antipode • think of this as acting as -1 • equations of bimonoids and the following = = = = =

  69. -1 ⋅ -1 = 1 = = = = = = = =

  70. The ring of integers • Simple induction: = n n • Recall: in B , the arrows 1 → 1 were in one-to-one correspondence with natural numbers • In H , the arrows 1 → 1 are in one-to-one correspondence with the integers := 0 k := k+1 := -n n

  71. Exercise • Verify that, in H , for all integers m , n we have m = m+n n = m n nm

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend