(Universal Algebra and) Category Theory in Foundations of Computer Science Andrzej Tarlecki Institute of Informatics Faculty of Mathematics, Informatics and Mechanics University of Warsaw http://www.mimuw.edu.pl/~tarlecki office: 4750 [email protected] phone: (48)(22)(55) 44475, 20443 This course: http://www.mimuw.edu.pl/~tarlecki/teaching/ct/ Andrzej Tarlecki: Category Theory, 2018 - 1 - Universal algebra and category theory: basic ideas, notions and some results • Algebras, homomorphisms, equations: basic definitions and results • Categories; examples and simple categorical definitions • Limits and colimits • Functors and natural transformations • Adjunctions • Cartesian closed categories • Monads • Institutions (abstract model theory, abstract specification theory) BUT: Tell me what you want to learn! Andrzej Tarlecki: Category Theory, 2018 - 2 - Literature Plenty of standard textbooks But this will be roughly based on: • D.T. Sannella, A. Tarlecki. Foundations of Algebraic Specifications and Formal Program Development. Springer, 2012. − Chap. 1: Universal algebra − Chap. 2: Simple equational specifications − Chap. 3: Category theory Andrzej Tarlecki: Category Theory, 2018 - 3 - One motivation Software systems (modules, programs, databases. ): sets of data with operations on them • Disregarding: code, efficiency, robustness, reliability, . • Focusing on: CORRECTNESS Universal algebra Category theory from rough analogy A language to further abstract away from the standard notions of univer- module interface ; signature sal algebra, to deal with their numer- module ; algebra ous variants needed in foundations of module specification ; class of algebras computer science. Andrzej Tarlecki: Category Theory, 2018 - 4 - Signatures Algebraic signature: Σ = (S; Ω) • sort names: S • operation names, classified by arities and result sorts: Ω = hΩw;siw2S∗;s2S Alternatively: Σ = (S; Ω; arity; sort) with sort names S, operation names Ω, and arity and result sort functions arity :Ω ! S∗ and sort :Ω ! S. • f : s1 × ::: × sn ! s stands for s1; : : : ; sn; s 2 S and f 2 Ωs1:::sn;s Compare the two notions Andrzej Tarlecki: Category Theory, 2018 - 5 - Fix a signature Σ = (S; Ω) for a while. Algebras • Σ-algebra: A = (jAj; hfAif2Ω) • carrier sets: jAj = hjAjsis2S • operations: fA : jAjs1 × ::: × jAjsn ! jAjs, for f : s1 × ::: × sn ! s • the class of all Σ-algebras: Alg(Σ) Can Alg(Σ) be empty? Finite? Can A 2 Alg(Σ) have empty carriers? Andrzej Tarlecki: Category Theory, 2018 - 6 - Subalgebras • for A 2 Alg(Σ), a Σ-subalgebra Asub ⊆ A is given by subset jAsub j ⊆ jAj closed under the operations: − for f : s1 × ::: × sn ! s and a1 2 jAsub js1 ; : : : ; an 2 jAsub jsn , fAsub (a1; : : : ; an) = fA(a1; : : : ; an) • for A 2 Alg(Σ) and X ⊆ jAj, the subalgebra of A genereted by X, hAiX , is the least subalgebra of A that contains X. • A 2 Alg(Σ) is reachable if hAi; coincides with A. Fact: For any A 2 Alg(Σ) and X ⊆ jAj, hAiX exists. Proof (idea): • generate the generated subalgebra from X by closing it under operations in A; or • the intersection of any family of subalgebras of A is a subalgebra of A. Andrzej Tarlecki: Category Theory, 2018 - 7 - Homomorphisms • for A; B 2 Alg(Σ), a Σ-homomorphism h: A ! B is a function h: jAj ! jBj that preserves the operations: − for f : s1 × ::: × sn ! s and a1 2 jAjs1 ; : : : ; an 2 jAjsn , hs(fA(a1; : : : ; an)) = fB(hs1 (a1); : : : ; hsn (an)) Fact: Given a homomorphism h: A ! B and subalgebras Asub of A and Bsub of B, the image of Asub under h, h(Asub ), is a subalgebra of B, and the coimage of Bsub −1 under h, h (Bsub ), is a subalgebra of A. Fact: Given a homomorphism h: A ! B and X ⊆ jAj, h(hAiX ) = hBih(X). Fact: If two homomorphisms h1; h2 : A ! B coincide on X ⊆ jAj, then they coincide on hAiX . Fact: Identity function on the carrier of A 2 Alg(Σ) is a homomorphism idA : A ! A. Composition of homomorphisms h: A ! B and g : B ! C is a homomorphism h;g : A ! C. Andrzej Tarlecki: Category Theory, 2018 - 8 - Isomorphisms • for A; B 2 Alg(Σ), a Σ-isomorphism is any Σ-homomorphism i: A ! B that −1 −1 has an inverse, i.e., a Σ-homomorphism i : B ! A such that i;i = idA and −1 i ;i = idB . • Σ-algebras are isomorphic if there exists an isomorphism between them. Fact: A Σ-homomorphism is a Σ-isomorphism iff it is bijective (\1-1" and \onto"). Fact: Identities are isomorphisms, and any composition of isomorphisms is an isomorphism. Andrzej Tarlecki: Category Theory, 2018 - 9 - Congruences • for A 2 Alg(Σ), a Σ-congruence on A is an equivalence ≡ ⊆ jAj × jAj that is closed under the operations: 0 0 − for f : s1 × ::: × sn ! s and a1; a1 2 jAjs1 ; : : : ; an; an 2 jAjsn , 0 0 0 0 if a1 ≡s1 a1; : : : ; an ≡sn an then fA(a1; : : : ; an) ≡s fA(a1; : : : ; an). Fact: For any relation R ⊆ jAj × jAj on the carrier of a Σ-algebra A, there exists the least congruence on A that conatins R. Fact: For any Σ-homomorphism h: A ! B, the kernel of h, K(h) ⊆ jAj × jAj, where a K(h) a0 iff h(a) = h(a0), is a Σ-congruence on A. Andrzej Tarlecki: Category Theory, 2018 - 10 - Quotients • for A 2 Alg(Σ) and Σ-congruence ≡ ⊆ jAj × jAj on A, the quotient algebra A=≡ is built in the natural way on the equivalence classes of ≡: 0 0 − for s 2 S, jA=≡|s = f[a]≡ j a 2 jAjsg, with [a]≡ = fa 2 jAjs j a ≡ a g − for f : s1 × ::: × sn ! s and a1 2 jAjs1 ; : : : ; an 2 jAjsn , fA=≡([a1]≡;:::; [an]≡) = [fA(a1; : : : ; an)]≡ Fact: The above is well-defined; moreover, the natural map that assigns to every element its equivalence class is a Σ-homomorphisms [ ]≡ : A ! A=≡. Fact: Given two Σ-congruences ≡ and ≡0 on A, ≡ ⊆ ≡0 iff there exists a 0 Σ-homomorphism h: A=≡ ! A=≡ such that [ ]≡;h = [ ]≡0 . Fact: For any Σ-homomorphism h: A ! B, A=K(h) is isomorphic with h(A). Andrzej Tarlecki: Category Theory, 2018 - 11 - Products Q • for Ai 2 Alg(Σ), i 2 I, the product of hAiii2I , i2I Ai is built in the natural way on the Cartesian product of the carriers of Ai, i 2 I: Q Q − for s 2 S, j i2I Aijs = i2I jAijs Q Q − for f : s1 × ::: × sn ! s and a1 2 j i2I Aijs1 ; : : : ; an 2 j i2I Aijsn , for i 2 I, fQ (a ; : : : ; a )(i) = f (a (i); : : : ; a (i)) i2I Ai 1 n Ai 1 n Fact: For any family hAiii2I of Σ-algebras, projections πi(a) = a(i), where i 2 I Q Q and a 2 i2I jAij, are Σ-homomorphisms πi : i2I Ai ! Ai. Define the product of the empty family of Σ-algebras. When the projection πi is an isomorphism? Andrzej Tarlecki: Category Theory, 2018 - 12 - Terms Consider an S-sorted set X of variables. • terms t 2 jTΣ(X)j are built using variables X, constants and operations from Ω in the usual way: jTΣ(X)j is the least set such that − X ⊆ jTΣ(X)j − for f : s1 × ::: × sn ! s and t1 2 jTΣ(X)js1 ; : : : ; tn 2 jTΣ(X)jsn , f(t1; : : : ; tn) 2 jTΣ(X)js • for any Σ-algebra A and valuation v : X ! jAj, the value tA[v] of a term t 2 jTΣ(X)j in A under v is determined inductively: − xA[v] = vs(x), for x 2 Xs, s 2 S − (f(t1; : : : ; tn))A[v] = fA((t1)A[v];:::; (tn)A[v]), for f : s1 × ::: × sn ! s and t1 2 jTΣ(X)js1 ; : : : ; tn 2 jTΣ(X)jsn Above and in the following: assuming unambiguous \parsing" of terms! Andrzej Tarlecki: Category Theory, 2018 - 13 - Term algebras Consider an S-sorted set X of variables. • The term algebra TΣ(X) has the set of terms as the carrier and operations defined \syntactically": − for f : s1 × ::: × sn ! s and t1 2 jTΣ(X)js1 ; : : : ; tn 2 jTΣ(X)jsn , fTΣ(X)(t1; : : : ; tn) = f(t1; : : : ; tn). Fact: For any S-sorted set X of variables, Σ-algebra A and valuation v : X ! jAj, # there is a unique Σ-homomorphism v : TΣ(X) ! A that extends v. Moreover, for # t 2 jTΣ(X)j, v (t) = tA[v]. idX ,!jTΣ (X )j X - jTΣ(X)j TΣ(X) HH H S H jv#j # Alg(Σ) Set v H 9! v HH HHj ? ? jAj A Andrzej Tarlecki: Category Theory, 2018 - 14 - One simple consequence Fact: For any S-sorted sets X, Y and Z (of variables) and substitutions θ1 : X ! jTΣ(Y )j and θ2 : Y ! jTΣ(Z)j # # # # θ1 ;θ2 = (θ1;θ2 ) idX ,!jTΣ (X )j X - jTΣ(X)j TΣ(X) HH S H $ Set H θ# 9! θ# Alg(Σ) θ1 H 1 1 HH id HHj ? ? X ,!jTΣ (Y )j - # # Y jTΣ(Y )j TΣ(Y ) 9! (θ1;θ2 ) HH H H θ# 9! θ# θ2 H 2 2 HH HHj ? ? jTΣ(Z)j TΣ(Z) % Andrzej Tarlecki: Category Theory, 2018 - 15 - Equations • Equation: 8X:t = t0 where: − X is a set of variables, and 0 − t; t 2 jTΣ(X)js are terms of a common sort. • Satisfaction relation: Σ-algebra A satisfies 8X:t = t0 A j= 8X:t = t0 0 when for all v : X ! jAj, tA[v] = tA[v]. Andrzej Tarlecki: Category Theory, 2018 - 16 - Semantic entailment Φ j=Σ ' Σ-equation ' is a semantic consequence of a set of Σ-equations Φ if ' holds in every Σ-algebra that satisfies Φ. BTW: • Models of a set of equations: Mod(Φ) = fA 2 Alg(Σ) j A j= Φg • Theory of a class of algebras: Th(C) = f' j C j= 'g • Φ j= ' () ' 2 Th(Mod(Φ)) • Mod and Th form a Galois connection Andrzej Tarlecki: Category Theory, 2018 - 17 - Equational specifications hΣ; Φi • signature Σ, to determine the static module interface • axioms (Σ-equations), to determine required module properties BUT: Fact: A class of Σ-algebras is equationally definable iff it is closed under subalgebras, products and homomorphic images.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages41 Page
-
File Size-