SlideShare uma empresa Scribd logo
1 de 27
Baixar para ler offline
Algebras for programming languages
Category, Universal algebra, Kleisli Category,
Monad, Algebraic Semantics
Yoshihiro Mizoguchi
Institute of Mathematics for Industry
Kyushu University, JAPAN
University of Hawaii
September 30, 2015
Y.Mizoguchi Algebras for programming languages 2015/09/30 1 / 27
Table of Contents
1 Category theory
2 Ω-algebra
3 Algebraic Semantics
4 Extensions
5 Haskell’s monad
Y.Mizoguchi Algebras for programming languages 2015/09/30 2 / 27
Category
Definition
A category C is defined by the following data and axioms.
Datum1 Obj(C): a class of objects in C.
Datum2 C(A, B): a class of C-morphisms for objects A and B.
Datum3 idA ∈ C(A, A): the identity morphism idA for any object A.
Datum4 g · f ∈ C(A, C) is defined by f ∈ C(A, B) and g ∈ C(B, C).
Axiom1 For any f ∈ C(A, B), g ∈ C(B, C) and h ∈ C(C, D),
h · (g · f ) = (h · g) · f .
Axiom2 For any f ∈ C(A, B), f · idA = f = idB · f .
Axiom3 If A ̸= A′ and B ̸= B′ then C(A, B) ∩ C(A′, B′) = ϕ.
Y.Mizoguchi Algebras for programming languages 2015/09/30 3 / 27
Functor
Definition
Let C and D be categories. A functor H : C → D is defined by the
following data and axioms.
Datum1 HA ∈ Obj(D) is defined by A ∈ Obj(C).
Datum2 Hf ∈ D(HA, HB) is defined by f ∈ C(A, B).
Axiom1 HidA = idHA.
Axiom2 For any f ∈ C(A, B) and g ∈ C(B, C), H(g · f ) = Hg · Hf .
Y.Mizoguchi Algebras for programming languages 2015/09/30 4 / 27
Natural transformation
Definition
HA
Hf
−−−→ HB

αA


αB
H′A −−−→
H′f
H′B
Let H, H′ : C → D be functors. A natural transformation α : H → H′ is
defined by the following datum and axiom.
Datum αA ∈ D(HA, H′A) is defined by A ∈ Obj(C).
Axiom For any f ∈ C(A, B), the following diagram commutes.
Example
Set(sets and functions), Lin(linear spaces and linear maps), Grp(groups
and homomorphisms).
Y.Mizoguchi Algebras for programming languages 2015/09/30 5 / 27
epimorphisms and monomorphisms
Definition
A
e
−−−→B
f
⇒
g
C
A morphism e ∈ C(A, B) is an epimorphism, if f · e = g · e then f = g for
any C ∈ Obj(C) and f , g ∈ C(B, C).
Definition
A
f
⇒
g
B
m
−−−→C
A morphism m ∈ C(B, C) is a monomorphism, if m · f = m · g then
f = g for any A ∈ Obj(C) and f , g ∈ C(A, B).
Example
In the category Set, a monomoprhism is an injection and an epimorphism
is a surjection.
Y.Mizoguchi Algebras for programming languages 2015/09/30 6 / 27
equalizer
Definition
A
e
−−−→B
f
⇒
g
C
Let f , g ∈ C(B, C), e ∈ C(A, B) and f · e = g · e. A morphism e is an
equalizer, if f · e′ = g · e′ for an object X ∈ Obj(C) and a morphism
e′ ∈ C(X, B), then there exists a unique morphism i ∈ C(X, A) such that
e′ = e · i.
Example
In a category of Set, an equalizer is a embedding map of a subset
{x ∈ B|f (x) = g(x)}.
Y.Mizoguchi Algebras for programming languages 2015/09/30 7 / 27
coequalizer
Definition
A
f
⇒
g
B
e
−−−→C
Let f , g ∈ C(A, B), e ∈ C(B, C) and e · f = e · g. A morphism
e′ ∈ C(B, X) is a coequalizer, if e′ · f = e′ · g for an object X ∈ Obj(C)
and a morphism e′ ∈ C(B, X), then there exists a unique morphism
i ∈ C(C, X) such that e′ = i · e.
Example
In a category of Set, a coequalizer is a quotient set defined by an
equivalence relation generated by a relation {(f (a), g(a)) ∈ B × B|a ∈ A}.
Y.Mizoguchi Algebras for programming languages 2015/09/30 8 / 27
initial object and terminal object
Definition
An object I ∈ Obj(C) is an initial object of a category C, if there is a
unique morphism in C(I, A) for any object A ∈ Obj(C).
Definition
An object X ∈ Obj(C) is a terminal object of a category C, if there is a
unique morphism in C(A, X) for any object A ∈ Obj(C).
Example
In Set, the initial object is the empty set ϕ, and the terminal object is the
one-point set {∗}.
Y.Mizoguchi Algebras for programming languages 2015/09/30 9 / 27
Ω-algebra
Definition
Let Ωn be a label set of n-ary operators for n = 0, 1, . . . and
Ω = {Ωn|n = 0, 1, . . .}. For a given set X, δ = {δω|ω ∈ Ωn, n = 0, 1, . . .}
is a set of n-ary functions δω : Xn → X. A pair (X, δ) is called a
Ω-algebra.
Let (X, δ) and (Y , γ) are Ω-algebras. A function f : X → Y is an
Ω-morphism if
f · δω(x1, x2, · · · , xn) = γω(f (x1), f (x2), · · · , f (xn))
for any ω ∈ Ωn.
Y.Mizoguchi Algebras for programming languages 2015/09/30 10 / 27
Ω-term
Definition
Let A be a set. The set ΩA of all ω-terms over A is defined as follows.
1 a ∈ A ⇒ a ∈ ΩA
2 ω ∈ Ωn, p1, . . . , pn ∈ ΩA ⇒ ω(p1, . . . , pn) ∈ ΩA.
Definition
Let V = {v1, v2, . . . , vn, . . .} be a set of variables. For two elements
e1, e2 ∈ ΩV , a set {e1, e2} is called Ω-equation. A pair (Ω, E) of Ω and a
set E of Ω-equation is called an equational presentation.
Y.Mizoguchi Algebras for programming languages 2015/09/30 11 / 27
Example
Example
Let m(multiple), i(inverse) and e(unit) be labels of operators. Let
Ω0 = {e}, Ω1 = {i}, Ω2 = {m} and E = {{m(v1, m(v2, v3)),
m(m(v1, v2), v3)}, {m(v1, e), v1}, {m(e, v1), v1}, {m(v1, i(v1), e},
{m(i(v1), v1), e}}. Then a group X can be considered as an Ω-algebra.
Example
For a division function d(x, y) = m(x, i(y)) in a group, we define
Ω2 = {d} and
E = {{d(x, d(d(d(d(x, x), y), z), d(d(d(x, x), x), z))), y}}.
Then an (Ω,E)-algebra can be considered as a group[1].
Y.Mizoguchi Algebras for programming languages 2015/09/30 12 / 27
Ω-algebra
Example (The Total Description Map)
Let (X, δ) be an Ω-algebra. δ can be naturally extended to δ@ : ΩX → X.
δ@(x) = x(x ∈ X),
δ@(ω(p1, · · · , pn)) = δω(δ@(p1), · · · , δ@(pn))(ω ∈ Ωn).
Definition (Ω-algebra)
For a given Ω-algebra (X, δ) and an assignment r : V → X, an extension
map r# : ΩV → X is defined by δ@ · Ωr. Let {e1, e2} be a Ω-equation. If
r#(e1) = r#(e2) for any r : V → X then we say (X, δ) satisfies {e1, e2}. If
an Ω-algebra satisfies all equations in E, then it is called as an
(Ω, E)-algebra.
Y.Mizoguchi Algebras for programming languages 2015/09/30 13 / 27
Ω-morphism
Definition
For a given set A, we define an equivalence relation EA over ΩA by
EA = {(p, q)|∀(X, δ) : Ω − algebra, ∀f : A → X, f #
(p) = f #
(q)}.
We denote a quotient set of ΩA by an equivalence relation EA as
TA = ΩA/EA. We denote an equivalence class including p ∈ ΩA as
ρA(p) = [p]. Then ρA : ΩA → TA.
Proposition
Let ωn ∈ Ωn, ωn([p1], · · · , [pn]) = [ωn(p1, · · · , pn)] and
ω = {ωn|n = 0, 1, . . .}. An Ω-algebra (TA, ω) is an (Ω, E)-algebra and
ρA : ΩA → TA is an Ω-morphism.
Y.Mizoguchi Algebras for programming languages 2015/09/30 14 / 27
(Ω, E)-algebra (1)
Definition
We denote (TA, ω) as TA and it is called a free (Ω, E)-algebra over A.
Proposition (The Universal Property of TA)
A function ηA : A → TA is defined by ηA(a) = [a]. For any (Ω, E)-algebra
(X, δ) and a function f : A → X, there exists a unique Ω-morphism
f ## : TA → (X, δ) of f such that f ## · ηA = f .
Y.Mizoguchi Algebras for programming languages 2015/09/30 15 / 27
(Ω, E)-algebra (2)
Definition
A clone category Set(Ω, E) of (Ω, E) is defined as follows.
Object Obj(Set(Ω, E)) = Obj(Set)
Morphism Set(Ω, E)(A, B) = Set(A, TB). For any α : A → TB and
β : B → TC, we define
(A
α
−−−→B) ◦ (B
β
−−−→C) = A
α
−−−→TB
β#
−−−→TC.
Identity idA ∈ Set(Ω, E)(A, A) is idA = ηA : A → TA.
Proposition
Set(Ω, E) is a category and Tϕ is the initial object in Set(Ω, E).
Y.Mizoguchi Algebras for programming languages 2015/09/30 16 / 27
Kleisli Category
Definition (Algebraic theory and Kleisli category)
A clone type algebraic theory over a category C is a triple T = (T, η, ◦)
satisfies followings.
T is a map T : Obj(C) → Obj(C).
A morphism ηA : A → TA is defined for any object A ∈ Obj(C).
◦ is a map ◦ : C(A, TB) × C(B, TC) → C(A, TC).
For any f ∈ C(A, B), f ∆ : A → TB is defined by f ∆ = A
f
−−−→B
ηB
−−−→TB.
For any morphisms α ∈ C(A, TB), β ∈ C(B, TC) and γ ∈ C(C, TD), the
followings hold.
(α ◦ β) ◦ γ = α ◦ (β ◦ γ)
α ◦ ηB = α
β ◦ α∆ = (βα)∆
A Kleisli category CT is a category defined by Obj(CT ) = Obj(C),
CT (A, B) = C(A, TB) and a composition of morphisms are defined by ◦.
We note the identity idA ∈ CT (A, A) is ηA : A → TA.
Y.Mizoguchi Algebras for programming languages 2015/09/30 17 / 27
Monad
Definition (Algebraic theory and monad)
A monad type algebraic theory over a category C is a triple
T = (T, η, µ) satisfies followings.
T : C → C is a functor.
η : I → T, µ : TT → T is a natural transformation.
µA · ηTA = idTA, µA · TηA = idTA and µA · TµA = µA · µTA hold for any
A ∈ Obj(C).
A category CT of T-algebra and T-homomorphisms is defined by
Obj(CT
) = {(X, ξ) | X ∈ Obj(C), ξ : TX → X, ξ·ηX = idX , ξ·Tξ = ξ·µX}
and
CT
((X, ξ), (Y , θ)) = {f ∈ C(X, Y ) | θ · Tf = f · ξ}.
We call an object in CT as T-algebra and a morphism as
T-homomorphism.
Y.Mizoguchi Algebras for programming languages 2015/09/30 18 / 27
Monad and Kleisli category
Theorem ([3])
There exists a bijective correspondence between a clone type algebraic
theory T = (T, η, ◦) and a monad type algebraic theory T = (T, η, µ).
Theorem
A category of (Ω, E)-algebra is isomorphic to a category of SetT
defined
by its algebraic theory T = (T, η, ◦).
Y.Mizoguchi Algebras for programming languages 2015/09/30 19 / 27
Algebraic Semantics
For (Ω, E), we define the following axioms and inference rules.
Axiom1 (Ω, E) ⊢ t = t
Axiom2 (Ω, E) ⊢ s = t ({s, t} ∈ E)
Assignment
(Ω, E) ⊢ s = t
(Ω, E) ⊢ s[x1 := t1, · · · , xn := tn] = t[x1 := t1, · · · , xn := tn]
Replacement
(Ω, E) ⊢ s1 = t1, · · · , (Ω, E) ⊢ sn = tn
(Ω, E) ⊢ f (s1, · · · , sn) = f (t1, · · · , tn)
Exchange
(Ω, E) ⊢ s = t
(Ω, E) ⊢ t = s
Associative
(Ω, E) ⊢ t1 = t2, (Ω, E) ⊢ t2 = t3,
(Ω, E) ⊢ t1 = t3
Y.Mizoguchi Algebras for programming languages 2015/09/30 20 / 27
Example
Example
Let Ω0 = {zero}, Ω1 = {succ}, Ω2 = {plus}, E = {{plus(zero, x), x},
{plus(succ(x), y) and succ(plus(x, y))}}. For (Ω, E), we have
(Ω, E) ⊢ plus(succ(zero), zero) = succ(zero)
Y.Mizoguchi Algebras for programming languages 2015/09/30 21 / 27
Birkhoff’s Completeness Theorem
Definition
Let A be a (Ω, E)-algebra. If r#(s) = r#(t) for any r : V → A, we denote
A |= s = t
A |= s = t for any (Ω, E)-algebra A, we denote
(Ω, E) |= s = t
Theorem (Birkhoff’s Completness Theorem)
(Ω, E) ⊢ s = t ⇔ (Ω, E) |= s = t
Y.Mizoguchi Algebras for programming languages 2015/09/30 22 / 27
Extensions
Many-sorted algebra
For Ω-algebra, we only consider a function δω : Xn → X of single type.
For a programming language, we need not only a single type.
if : Bool × N × N → N
cons : N × List → List
We need to extend a theory including multiple types including not only N
but also Bool and List. There is an extended theory called many sorted
algebraic theory which scheme is (Xσ, δσ). It is also possible to consider an
algebraic semantics using a category theory.
Infinitary theories
We only consider finite-ary functions. A convergence of a sequence of
countable many values can be considered as an infinite-ary function.
Monad and Kleisli category have an ability to consider those algebras.
Y.Mizoguchi Algebras for programming languages 2015/09/30 23 / 27
Haskell’s monad (1)
Let Set be the category of sets and functions.
Let List be the category of free monoids and homomorphisms.
Let A = Integer (the set of all integers).
Let F : Set → List be a functor creating a free monoid.
We note 1, 2, 3 ∈ A and [1, 2, 3] ∈ FA.
For f : A → B we define Ff : FA → FB as Ff = (map f ).
Ff[1,2,3] = (map f [1,2,3]) = [f(1),f(2),f(3)]
concat : FFA → FA is a natural transfromation.
concat[[1, 2], [3], [4, 5, 6]] = [1, 2, 3, 4, 5, 6]
return : A → FA is a natural transformation.
return x = [x]
Y.Mizoguchi Algebras for programming languages 2015/09/30 24 / 27
Haskell’s monad (2)
Haskell’s monad is constructed by a triple (F, return, >>=).
F : Obj(Set) → Obj(Set).
return : A → FA (for A ∈ Obj(Set))
>>=: Set(A, FA) → Set(FA, FB)
We denote >>= (f )(la) as l >>= f .
la >>= f is defined as (concat (map f la)).
[1, 2, 3] >>= (λ x.[x, 2x])
= concat (map (λ x.[x, 2x]) [1, 2, 3])
= concat [[1, 2], [2, 4], [3, 6]]
= [1, 2, 2, 4, 3, 6]
Y.Mizoguchi Algebras for programming languages 2015/09/30 25 / 27
Haskell’s monad (3)
Haskell’s monad is a triple (F, return, >>=).
return : A → FA
>>=: (A → FB) → (FA → FB)
Kleisli category is a triple (F, η, ◦).
η : A → FA
◦ : (A → FB) × (B → FC) → (A → FC)
Correspondence between (F, return, >>=) and (F, η, ◦).
η = return
α ◦ β = λ x.((α x) >>= β).
Y.Mizoguchi Algebras for programming languages 2015/09/30 26 / 27
References
G.Higman, B.H.Neumann, Groups as groupoids with one law, Publ.
Math. Debrecen 2, 215–221,1952.
Y.Kawahara, Y.Mizoguchi, Categorical assertion semantics in toposes,
Advances in Software Science and Technology, Vol.4(1992), 137-150.
E.G.Manes, Algebraic Theories, Springer-Verlag, 1976.
S.Mac Lane, Categories for the working mathematician,
Springer-Verlag, 1978.
Y.Mizoguchi, Powerset monad, filter monad and primfilter monad in
the category of set with monoid actions, Bull. of Informatics and
Cybernetics, Vol.21(1985), 83-95.
Haskell Language, https://www.haskell.org/.
Y.Mizoguchi Algebras for programming languages 2015/09/30 27 / 27

Mais conteúdo relacionado

Mais procurados

An implicit partial pivoting gauss elimination algorithm for linear system of...
An implicit partial pivoting gauss elimination algorithm for linear system of...An implicit partial pivoting gauss elimination algorithm for linear system of...
An implicit partial pivoting gauss elimination algorithm for linear system of...Alexander Decker
 
Arts revealed in calculus and its extension
Arts revealed in calculus and its extensionArts revealed in calculus and its extension
Arts revealed in calculus and its extensionPremier Publishers
 
Solvability of Matrix Riccati Inequality Talk Slides
Solvability of Matrix Riccati Inequality Talk SlidesSolvability of Matrix Riccati Inequality Talk Slides
Solvability of Matrix Riccati Inequality Talk SlidesKevin Kissi
 
Discrete maths questions
Discrete maths questionsDiscrete maths questions
Discrete maths questionsDIT University
 
Matrix Computations in Machine Learning
Matrix Computations in Machine LearningMatrix Computations in Machine Learning
Matrix Computations in Machine Learningbutest
 
Some fundamental theorems in Banach spaces and Hilbert spaces
Some fundamental theorems in Banach spaces and Hilbert spacesSome fundamental theorems in Banach spaces and Hilbert spaces
Some fundamental theorems in Banach spaces and Hilbert spacesSanjay Sharma
 
Setting linear algebra problems
Setting linear algebra problemsSetting linear algebra problems
Setting linear algebra problemsJB Online
 
Mkk1013 chapter 2.1
Mkk1013 chapter 2.1Mkk1013 chapter 2.1
Mkk1013 chapter 2.1ramlahmailok
 
Set
SetSet
SetH K
 
Conformable Chebyshev differential equation of first kind
Conformable Chebyshev differential equation of first kindConformable Chebyshev differential equation of first kind
Conformable Chebyshev differential equation of first kindIJECEIAES
 
Class 11 maths support material
Class 11 maths support materialClass 11 maths support material
Class 11 maths support materialnitishguptamaps
 
Matroid Basics
Matroid BasicsMatroid Basics
Matroid BasicsASPAK2014
 
Introductory maths analysis chapter 17 official
Introductory maths analysis   chapter 17 officialIntroductory maths analysis   chapter 17 official
Introductory maths analysis chapter 17 officialEvert Sandye Taasiringan
 
Regression on gaussian symbols
Regression on gaussian symbolsRegression on gaussian symbols
Regression on gaussian symbolsAxel de Romblay
 
8517ijaia06
8517ijaia068517ijaia06
8517ijaia06ijaia
 
Lecture 12 orhogonality - 6.1 6.2 6.3
Lecture 12   orhogonality - 6.1 6.2 6.3Lecture 12   orhogonality - 6.1 6.2 6.3
Lecture 12 orhogonality - 6.1 6.2 6.3njit-ronbrown
 

Mais procurados (20)

An implicit partial pivoting gauss elimination algorithm for linear system of...
An implicit partial pivoting gauss elimination algorithm for linear system of...An implicit partial pivoting gauss elimination algorithm for linear system of...
An implicit partial pivoting gauss elimination algorithm for linear system of...
 
Arts revealed in calculus and its extension
Arts revealed in calculus and its extensionArts revealed in calculus and its extension
Arts revealed in calculus and its extension
 
Solvability of Matrix Riccati Inequality Talk Slides
Solvability of Matrix Riccati Inequality Talk SlidesSolvability of Matrix Riccati Inequality Talk Slides
Solvability of Matrix Riccati Inequality Talk Slides
 
Discrete maths questions
Discrete maths questionsDiscrete maths questions
Discrete maths questions
 
Matrix Computations in Machine Learning
Matrix Computations in Machine LearningMatrix Computations in Machine Learning
Matrix Computations in Machine Learning
 
Some fundamental theorems in Banach spaces and Hilbert spaces
Some fundamental theorems in Banach spaces and Hilbert spacesSome fundamental theorems in Banach spaces and Hilbert spaces
Some fundamental theorems in Banach spaces and Hilbert spaces
 
Setting linear algebra problems
Setting linear algebra problemsSetting linear algebra problems
Setting linear algebra problems
 
Pertemuan 5_Relation Matriks_01 (17)
Pertemuan 5_Relation Matriks_01 (17)Pertemuan 5_Relation Matriks_01 (17)
Pertemuan 5_Relation Matriks_01 (17)
 
Mkk1013 chapter 2.1
Mkk1013 chapter 2.1Mkk1013 chapter 2.1
Mkk1013 chapter 2.1
 
03 banach
03 banach03 banach
03 banach
 
Set
SetSet
Set
 
Conformable Chebyshev differential equation of first kind
Conformable Chebyshev differential equation of first kindConformable Chebyshev differential equation of first kind
Conformable Chebyshev differential equation of first kind
 
Class 11 maths support material
Class 11 maths support materialClass 11 maths support material
Class 11 maths support material
 
Matroid Basics
Matroid BasicsMatroid Basics
Matroid Basics
 
Per6 basis2_NUMBER SYSTEMS
Per6 basis2_NUMBER SYSTEMSPer6 basis2_NUMBER SYSTEMS
Per6 basis2_NUMBER SYSTEMS
 
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
 
Introductory maths analysis chapter 17 official
Introductory maths analysis   chapter 17 officialIntroductory maths analysis   chapter 17 official
Introductory maths analysis chapter 17 official
 
Regression on gaussian symbols
Regression on gaussian symbolsRegression on gaussian symbols
Regression on gaussian symbols
 
8517ijaia06
8517ijaia068517ijaia06
8517ijaia06
 
Lecture 12 orhogonality - 6.1 6.2 6.3
Lecture 12   orhogonality - 6.1 6.2 6.3Lecture 12   orhogonality - 6.1 6.2 6.3
Lecture 12 orhogonality - 6.1 6.2 6.3
 

Semelhante a Algebras for programming languages

Andrei rusu-2013-amaa-workshop
Andrei rusu-2013-amaa-workshopAndrei rusu-2013-amaa-workshop
Andrei rusu-2013-amaa-workshopAndries Rusu
 
Ch1 sets and_logic(1)
Ch1 sets and_logic(1)Ch1 sets and_logic(1)
Ch1 sets and_logic(1)Kwonpyo Ko
 
Comparing estimation algorithms for block clustering models
Comparing estimation algorithms for block clustering modelsComparing estimation algorithms for block clustering models
Comparing estimation algorithms for block clustering modelsBigMC
 
Existence Theory for Second Order Nonlinear Functional Random Differential Eq...
Existence Theory for Second Order Nonlinear Functional Random Differential Eq...Existence Theory for Second Order Nonlinear Functional Random Differential Eq...
Existence Theory for Second Order Nonlinear Functional Random Differential Eq...IOSR Journals
 
Intuitionistic First-Order Logic: Categorical semantics via the Curry-Howard ...
Intuitionistic First-Order Logic: Categorical semantics via the Curry-Howard ...Intuitionistic First-Order Logic: Categorical semantics via the Curry-Howard ...
Intuitionistic First-Order Logic: Categorical semantics via the Curry-Howard ...Marco Benini
 
CBSE Class 12 Mathematics formulas
CBSE Class 12 Mathematics formulasCBSE Class 12 Mathematics formulas
CBSE Class 12 Mathematics formulasParth Kshirsagar
 
Formal methods 8 - category theory (last one)
Formal methods   8 - category theory (last one)Formal methods   8 - category theory (last one)
Formal methods 8 - category theory (last one)Vlad Patryshev
 
Herbrand-satisfiability of a Quantified Set-theoretical Fragment (Cantone, Lo...
Herbrand-satisfiability of a Quantified Set-theoretical Fragment (Cantone, Lo...Herbrand-satisfiability of a Quantified Set-theoretical Fragment (Cantone, Lo...
Herbrand-satisfiability of a Quantified Set-theoretical Fragment (Cantone, Lo...Cristiano Longo
 
Quantum fields on the de sitter spacetime - Ion Cotaescu
Quantum fields on the de sitter spacetime - Ion CotaescuQuantum fields on the de sitter spacetime - Ion Cotaescu
Quantum fields on the de sitter spacetime - Ion CotaescuSEENET-MTP
 
Data Complexity in EL Family of Description Logics
Data Complexity in EL Family of Description LogicsData Complexity in EL Family of Description Logics
Data Complexity in EL Family of Description LogicsAdila Krisnadhi
 
Murphy: Machine learning A probabilistic perspective: Ch.9
Murphy: Machine learning A probabilistic perspective: Ch.9Murphy: Machine learning A probabilistic perspective: Ch.9
Murphy: Machine learning A probabilistic perspective: Ch.9Daisuke Yoneoka
 
Integration material
Integration material Integration material
Integration material Surya Swaroop
 
Divergence center-based clustering and their applications
Divergence center-based clustering and their applicationsDivergence center-based clustering and their applications
Divergence center-based clustering and their applicationsFrank Nielsen
 
00_1 - Slide Pelengkap (dari Buku Neuro Fuzzy and Soft Computing).ppt
00_1 - Slide Pelengkap (dari Buku Neuro Fuzzy and Soft Computing).ppt00_1 - Slide Pelengkap (dari Buku Neuro Fuzzy and Soft Computing).ppt
00_1 - Slide Pelengkap (dari Buku Neuro Fuzzy and Soft Computing).pptDediTriLaksono1
 
Convergence of ABC methods
Convergence of ABC methodsConvergence of ABC methods
Convergence of ABC methodsChristian Robert
 

Semelhante a Algebras for programming languages (20)

Andrei rusu-2013-amaa-workshop
Andrei rusu-2013-amaa-workshopAndrei rusu-2013-amaa-workshop
Andrei rusu-2013-amaa-workshop
 
Ch1 sets and_logic(1)
Ch1 sets and_logic(1)Ch1 sets and_logic(1)
Ch1 sets and_logic(1)
 
Comparing estimation algorithms for block clustering models
Comparing estimation algorithms for block clustering modelsComparing estimation algorithms for block clustering models
Comparing estimation algorithms for block clustering models
 
Ijmet 10 01_046
Ijmet 10 01_046Ijmet 10 01_046
Ijmet 10 01_046
 
Existence Theory for Second Order Nonlinear Functional Random Differential Eq...
Existence Theory for Second Order Nonlinear Functional Random Differential Eq...Existence Theory for Second Order Nonlinear Functional Random Differential Eq...
Existence Theory for Second Order Nonlinear Functional Random Differential Eq...
 
ABC-Gibbs
ABC-GibbsABC-Gibbs
ABC-Gibbs
 
Intuitionistic First-Order Logic: Categorical semantics via the Curry-Howard ...
Intuitionistic First-Order Logic: Categorical semantics via the Curry-Howard ...Intuitionistic First-Order Logic: Categorical semantics via the Curry-Howard ...
Intuitionistic First-Order Logic: Categorical semantics via the Curry-Howard ...
 
CBSE Class 12 Mathematics formulas
CBSE Class 12 Mathematics formulasCBSE Class 12 Mathematics formulas
CBSE Class 12 Mathematics formulas
 
Formal methods 8 - category theory (last one)
Formal methods   8 - category theory (last one)Formal methods   8 - category theory (last one)
Formal methods 8 - category theory (last one)
 
Herbrand-satisfiability of a Quantified Set-theoretical Fragment (Cantone, Lo...
Herbrand-satisfiability of a Quantified Set-theoretical Fragment (Cantone, Lo...Herbrand-satisfiability of a Quantified Set-theoretical Fragment (Cantone, Lo...
Herbrand-satisfiability of a Quantified Set-theoretical Fragment (Cantone, Lo...
 
Predicate Logic
Predicate LogicPredicate Logic
Predicate Logic
 
Quantum fields on the de sitter spacetime - Ion Cotaescu
Quantum fields on the de sitter spacetime - Ion CotaescuQuantum fields on the de sitter spacetime - Ion Cotaescu
Quantum fields on the de sitter spacetime - Ion Cotaescu
 
Data Complexity in EL Family of Description Logics
Data Complexity in EL Family of Description LogicsData Complexity in EL Family of Description Logics
Data Complexity in EL Family of Description Logics
 
Murphy: Machine learning A probabilistic perspective: Ch.9
Murphy: Machine learning A probabilistic perspective: Ch.9Murphy: Machine learning A probabilistic perspective: Ch.9
Murphy: Machine learning A probabilistic perspective: Ch.9
 
Integration material
Integration material Integration material
Integration material
 
Integration
IntegrationIntegration
Integration
 
Divergence center-based clustering and their applications
Divergence center-based clustering and their applicationsDivergence center-based clustering and their applications
Divergence center-based clustering and their applications
 
C2.0 propositional logic
C2.0 propositional logicC2.0 propositional logic
C2.0 propositional logic
 
00_1 - Slide Pelengkap (dari Buku Neuro Fuzzy and Soft Computing).ppt
00_1 - Slide Pelengkap (dari Buku Neuro Fuzzy and Soft Computing).ppt00_1 - Slide Pelengkap (dari Buku Neuro Fuzzy and Soft Computing).ppt
00_1 - Slide Pelengkap (dari Buku Neuro Fuzzy and Soft Computing).ppt
 
Convergence of ABC methods
Convergence of ABC methodsConvergence of ABC methods
Convergence of ABC methods
 

Mais de Yoshihiro Mizoguchi

DockerでAlmaLinux(web, php, pukiwiki)環境構築
DockerでAlmaLinux(web, php, pukiwiki)環境構築DockerでAlmaLinux(web, php, pukiwiki)環境構築
DockerでAlmaLinux(web, php, pukiwiki)環境構築Yoshihiro Mizoguchi
 
DockerでCoq インストール
DockerでCoq インストールDockerでCoq インストール
DockerでCoq インストールYoshihiro Mizoguchi
 
Homebrewによるソフトウェアの実装 (3)
Homebrewによるソフトウェアの実装 (3)Homebrewによるソフトウェアの実装 (3)
Homebrewによるソフトウェアの実装 (3)Yoshihiro Mizoguchi
 
Homebrewによるソフトウェアの実装 (2)
Homebrewによるソフトウェアの実装 (2)Homebrewによるソフトウェアの実装 (2)
Homebrewによるソフトウェアの実装 (2)Yoshihiro Mizoguchi
 
Homebrewによるソフトウェアの実装(1)
Homebrewによるソフトウェアの実装(1)Homebrewによるソフトウェアの実装(1)
Homebrewによるソフトウェアの実装(1)Yoshihiro Mizoguchi
 
Overleafを使った文書作成
Overleafを使った文書作成Overleafを使った文書作成
Overleafを使った文書作成Yoshihiro Mizoguchi
 
Symbolic Computations in Conformal Geometric Algebra for Three Dimensional O...
Symbolic Computations in Conformal Geometric Algebra for Three Dimensional  O...Symbolic Computations in Conformal Geometric Algebra for Three Dimensional  O...
Symbolic Computations in Conformal Geometric Algebra for Three Dimensional O...Yoshihiro Mizoguchi
 
数式処理ソフトMathematicaで数学の問題を解く
数式処理ソフトMathematicaで数学の問題を解く数式処理ソフトMathematicaで数学の問題を解く
数式処理ソフトMathematicaで数学の問題を解くYoshihiro Mizoguchi
 
Verification of a brick wang tiling algorithm
Verification of a brick wang tiling algorithmVerification of a brick wang tiling algorithm
Verification of a brick wang tiling algorithmYoshihiro Mizoguchi
 
計算機を用いて数学の問題を解くということ
計算機を用いて数学の問題を解くということ計算機を用いて数学の問題を解くということ
計算機を用いて数学の問題を解くということYoshihiro Mizoguchi
 
定理証明支援系Coqについて
定理証明支援系Coqについて定理証明支援系Coqについて
定理証明支援系CoqについてYoshihiro Mizoguchi
 
Coq関係計算ライブラリの開発と写像の性質の証明
Coq関係計算ライブラリの開発と写像の性質の証明Coq関係計算ライブラリの開発と写像の性質の証明
Coq関係計算ライブラリの開発と写像の性質の証明Yoshihiro Mizoguchi
 
Mac bookでwebサーバーを起動する方法
Mac bookでwebサーバーを起動する方法Mac bookでwebサーバーを起動する方法
Mac bookでwebサーバーを起動する方法Yoshihiro Mizoguchi
 
有限オートマトンとスティッカー系に関するCoqによる形式証明について
有限オートマトンとスティッカー系に関するCoqによる形式証明について有限オートマトンとスティッカー系に関するCoqによる形式証明について
有限オートマトンとスティッカー系に関するCoqによる形式証明についてYoshihiro Mizoguchi
 
複素数・四元数と図形の回転
複素数・四元数と図形の回転複素数・四元数と図形の回転
複素数・四元数と図形の回転Yoshihiro Mizoguchi
 
グラフデータ構造と5色定理
グラフデータ構造と5色定理グラフデータ構造と5色定理
グラフデータ構造と5色定理Yoshihiro Mizoguchi
 

Mais de Yoshihiro Mizoguchi (20)

DockerでAlmaLinux(web, php, pukiwiki)環境構築
DockerでAlmaLinux(web, php, pukiwiki)環境構築DockerでAlmaLinux(web, php, pukiwiki)環境構築
DockerでAlmaLinux(web, php, pukiwiki)環境構築
 
DockerでCoq インストール
DockerでCoq インストールDockerでCoq インストール
DockerでCoq インストール
 
Homebrewによるソフトウェアの実装 (3)
Homebrewによるソフトウェアの実装 (3)Homebrewによるソフトウェアの実装 (3)
Homebrewによるソフトウェアの実装 (3)
 
Homebrewによるソフトウェアの実装 (2)
Homebrewによるソフトウェアの実装 (2)Homebrewによるソフトウェアの実装 (2)
Homebrewによるソフトウェアの実装 (2)
 
Homebrewによるソフトウェアの実装(1)
Homebrewによるソフトウェアの実装(1)Homebrewによるソフトウェアの実装(1)
Homebrewによるソフトウェアの実装(1)
 
Overleafを使った文書作成
Overleafを使った文書作成Overleafを使った文書作成
Overleafを使った文書作成
 
Amazon AWSの使い方
Amazon AWSの使い方Amazon AWSの使い方
Amazon AWSの使い方
 
ShareLaTeXの使い方
ShareLaTeXの使い方ShareLaTeXの使い方
ShareLaTeXの使い方
 
Symbolic Computations in Conformal Geometric Algebra for Three Dimensional O...
Symbolic Computations in Conformal Geometric Algebra for Three Dimensional  O...Symbolic Computations in Conformal Geometric Algebra for Three Dimensional  O...
Symbolic Computations in Conformal Geometric Algebra for Three Dimensional O...
 
数式処理ソフトMathematicaで数学の問題を解く
数式処理ソフトMathematicaで数学の問題を解く数式処理ソフトMathematicaで数学の問題を解く
数式処理ソフトMathematicaで数学の問題を解く
 
Verification of a brick wang tiling algorithm
Verification of a brick wang tiling algorithmVerification of a brick wang tiling algorithm
Verification of a brick wang tiling algorithm
 
計算機を用いて数学の問題を解くということ
計算機を用いて数学の問題を解くということ計算機を用いて数学の問題を解くということ
計算機を用いて数学の問題を解くということ
 
定理証明支援系Coqについて
定理証明支援系Coqについて定理証明支援系Coqについて
定理証明支援系Coqについて
 
Coq関係計算ライブラリの開発と写像の性質の証明
Coq関係計算ライブラリの開発と写像の性質の証明Coq関係計算ライブラリの開発と写像の性質の証明
Coq関係計算ライブラリの開発と写像の性質の証明
 
Coqチュートリアル
CoqチュートリアルCoqチュートリアル
Coqチュートリアル
 
Mac bookでwebサーバーを起動する方法
Mac bookでwebサーバーを起動する方法Mac bookでwebサーバーを起動する方法
Mac bookでwebサーバーを起動する方法
 
有限オートマトンとスティッカー系に関するCoqによる形式証明について
有限オートマトンとスティッカー系に関するCoqによる形式証明について有限オートマトンとスティッカー系に関するCoqによる形式証明について
有限オートマトンとスティッカー系に関するCoqによる形式証明について
 
計算可能実数とは
計算可能実数とは計算可能実数とは
計算可能実数とは
 
複素数・四元数と図形の回転
複素数・四元数と図形の回転複素数・四元数と図形の回転
複素数・四元数と図形の回転
 
グラフデータ構造と5色定理
グラフデータ構造と5色定理グラフデータ構造と5色定理
グラフデータ構造と5色定理
 

Último

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 

Último (20)

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 

Algebras for programming languages

  • 1. Algebras for programming languages Category, Universal algebra, Kleisli Category, Monad, Algebraic Semantics Yoshihiro Mizoguchi Institute of Mathematics for Industry Kyushu University, JAPAN University of Hawaii September 30, 2015 Y.Mizoguchi Algebras for programming languages 2015/09/30 1 / 27
  • 2. Table of Contents 1 Category theory 2 Ω-algebra 3 Algebraic Semantics 4 Extensions 5 Haskell’s monad Y.Mizoguchi Algebras for programming languages 2015/09/30 2 / 27
  • 3. Category Definition A category C is defined by the following data and axioms. Datum1 Obj(C): a class of objects in C. Datum2 C(A, B): a class of C-morphisms for objects A and B. Datum3 idA ∈ C(A, A): the identity morphism idA for any object A. Datum4 g · f ∈ C(A, C) is defined by f ∈ C(A, B) and g ∈ C(B, C). Axiom1 For any f ∈ C(A, B), g ∈ C(B, C) and h ∈ C(C, D), h · (g · f ) = (h · g) · f . Axiom2 For any f ∈ C(A, B), f · idA = f = idB · f . Axiom3 If A ̸= A′ and B ̸= B′ then C(A, B) ∩ C(A′, B′) = ϕ. Y.Mizoguchi Algebras for programming languages 2015/09/30 3 / 27
  • 4. Functor Definition Let C and D be categories. A functor H : C → D is defined by the following data and axioms. Datum1 HA ∈ Obj(D) is defined by A ∈ Obj(C). Datum2 Hf ∈ D(HA, HB) is defined by f ∈ C(A, B). Axiom1 HidA = idHA. Axiom2 For any f ∈ C(A, B) and g ∈ C(B, C), H(g · f ) = Hg · Hf . Y.Mizoguchi Algebras for programming languages 2015/09/30 4 / 27
  • 5. Natural transformation Definition HA Hf −−−→ HB  αA   αB H′A −−−→ H′f H′B Let H, H′ : C → D be functors. A natural transformation α : H → H′ is defined by the following datum and axiom. Datum αA ∈ D(HA, H′A) is defined by A ∈ Obj(C). Axiom For any f ∈ C(A, B), the following diagram commutes. Example Set(sets and functions), Lin(linear spaces and linear maps), Grp(groups and homomorphisms). Y.Mizoguchi Algebras for programming languages 2015/09/30 5 / 27
  • 6. epimorphisms and monomorphisms Definition A e −−−→B f ⇒ g C A morphism e ∈ C(A, B) is an epimorphism, if f · e = g · e then f = g for any C ∈ Obj(C) and f , g ∈ C(B, C). Definition A f ⇒ g B m −−−→C A morphism m ∈ C(B, C) is a monomorphism, if m · f = m · g then f = g for any A ∈ Obj(C) and f , g ∈ C(A, B). Example In the category Set, a monomoprhism is an injection and an epimorphism is a surjection. Y.Mizoguchi Algebras for programming languages 2015/09/30 6 / 27
  • 7. equalizer Definition A e −−−→B f ⇒ g C Let f , g ∈ C(B, C), e ∈ C(A, B) and f · e = g · e. A morphism e is an equalizer, if f · e′ = g · e′ for an object X ∈ Obj(C) and a morphism e′ ∈ C(X, B), then there exists a unique morphism i ∈ C(X, A) such that e′ = e · i. Example In a category of Set, an equalizer is a embedding map of a subset {x ∈ B|f (x) = g(x)}. Y.Mizoguchi Algebras for programming languages 2015/09/30 7 / 27
  • 8. coequalizer Definition A f ⇒ g B e −−−→C Let f , g ∈ C(A, B), e ∈ C(B, C) and e · f = e · g. A morphism e′ ∈ C(B, X) is a coequalizer, if e′ · f = e′ · g for an object X ∈ Obj(C) and a morphism e′ ∈ C(B, X), then there exists a unique morphism i ∈ C(C, X) such that e′ = i · e. Example In a category of Set, a coequalizer is a quotient set defined by an equivalence relation generated by a relation {(f (a), g(a)) ∈ B × B|a ∈ A}. Y.Mizoguchi Algebras for programming languages 2015/09/30 8 / 27
  • 9. initial object and terminal object Definition An object I ∈ Obj(C) is an initial object of a category C, if there is a unique morphism in C(I, A) for any object A ∈ Obj(C). Definition An object X ∈ Obj(C) is a terminal object of a category C, if there is a unique morphism in C(A, X) for any object A ∈ Obj(C). Example In Set, the initial object is the empty set ϕ, and the terminal object is the one-point set {∗}. Y.Mizoguchi Algebras for programming languages 2015/09/30 9 / 27
  • 10. Ω-algebra Definition Let Ωn be a label set of n-ary operators for n = 0, 1, . . . and Ω = {Ωn|n = 0, 1, . . .}. For a given set X, δ = {δω|ω ∈ Ωn, n = 0, 1, . . .} is a set of n-ary functions δω : Xn → X. A pair (X, δ) is called a Ω-algebra. Let (X, δ) and (Y , γ) are Ω-algebras. A function f : X → Y is an Ω-morphism if f · δω(x1, x2, · · · , xn) = γω(f (x1), f (x2), · · · , f (xn)) for any ω ∈ Ωn. Y.Mizoguchi Algebras for programming languages 2015/09/30 10 / 27
  • 11. Ω-term Definition Let A be a set. The set ΩA of all ω-terms over A is defined as follows. 1 a ∈ A ⇒ a ∈ ΩA 2 ω ∈ Ωn, p1, . . . , pn ∈ ΩA ⇒ ω(p1, . . . , pn) ∈ ΩA. Definition Let V = {v1, v2, . . . , vn, . . .} be a set of variables. For two elements e1, e2 ∈ ΩV , a set {e1, e2} is called Ω-equation. A pair (Ω, E) of Ω and a set E of Ω-equation is called an equational presentation. Y.Mizoguchi Algebras for programming languages 2015/09/30 11 / 27
  • 12. Example Example Let m(multiple), i(inverse) and e(unit) be labels of operators. Let Ω0 = {e}, Ω1 = {i}, Ω2 = {m} and E = {{m(v1, m(v2, v3)), m(m(v1, v2), v3)}, {m(v1, e), v1}, {m(e, v1), v1}, {m(v1, i(v1), e}, {m(i(v1), v1), e}}. Then a group X can be considered as an Ω-algebra. Example For a division function d(x, y) = m(x, i(y)) in a group, we define Ω2 = {d} and E = {{d(x, d(d(d(d(x, x), y), z), d(d(d(x, x), x), z))), y}}. Then an (Ω,E)-algebra can be considered as a group[1]. Y.Mizoguchi Algebras for programming languages 2015/09/30 12 / 27
  • 13. Ω-algebra Example (The Total Description Map) Let (X, δ) be an Ω-algebra. δ can be naturally extended to δ@ : ΩX → X. δ@(x) = x(x ∈ X), δ@(ω(p1, · · · , pn)) = δω(δ@(p1), · · · , δ@(pn))(ω ∈ Ωn). Definition (Ω-algebra) For a given Ω-algebra (X, δ) and an assignment r : V → X, an extension map r# : ΩV → X is defined by δ@ · Ωr. Let {e1, e2} be a Ω-equation. If r#(e1) = r#(e2) for any r : V → X then we say (X, δ) satisfies {e1, e2}. If an Ω-algebra satisfies all equations in E, then it is called as an (Ω, E)-algebra. Y.Mizoguchi Algebras for programming languages 2015/09/30 13 / 27
  • 14. Ω-morphism Definition For a given set A, we define an equivalence relation EA over ΩA by EA = {(p, q)|∀(X, δ) : Ω − algebra, ∀f : A → X, f # (p) = f # (q)}. We denote a quotient set of ΩA by an equivalence relation EA as TA = ΩA/EA. We denote an equivalence class including p ∈ ΩA as ρA(p) = [p]. Then ρA : ΩA → TA. Proposition Let ωn ∈ Ωn, ωn([p1], · · · , [pn]) = [ωn(p1, · · · , pn)] and ω = {ωn|n = 0, 1, . . .}. An Ω-algebra (TA, ω) is an (Ω, E)-algebra and ρA : ΩA → TA is an Ω-morphism. Y.Mizoguchi Algebras for programming languages 2015/09/30 14 / 27
  • 15. (Ω, E)-algebra (1) Definition We denote (TA, ω) as TA and it is called a free (Ω, E)-algebra over A. Proposition (The Universal Property of TA) A function ηA : A → TA is defined by ηA(a) = [a]. For any (Ω, E)-algebra (X, δ) and a function f : A → X, there exists a unique Ω-morphism f ## : TA → (X, δ) of f such that f ## · ηA = f . Y.Mizoguchi Algebras for programming languages 2015/09/30 15 / 27
  • 16. (Ω, E)-algebra (2) Definition A clone category Set(Ω, E) of (Ω, E) is defined as follows. Object Obj(Set(Ω, E)) = Obj(Set) Morphism Set(Ω, E)(A, B) = Set(A, TB). For any α : A → TB and β : B → TC, we define (A α −−−→B) ◦ (B β −−−→C) = A α −−−→TB β# −−−→TC. Identity idA ∈ Set(Ω, E)(A, A) is idA = ηA : A → TA. Proposition Set(Ω, E) is a category and Tϕ is the initial object in Set(Ω, E). Y.Mizoguchi Algebras for programming languages 2015/09/30 16 / 27
  • 17. Kleisli Category Definition (Algebraic theory and Kleisli category) A clone type algebraic theory over a category C is a triple T = (T, η, ◦) satisfies followings. T is a map T : Obj(C) → Obj(C). A morphism ηA : A → TA is defined for any object A ∈ Obj(C). ◦ is a map ◦ : C(A, TB) × C(B, TC) → C(A, TC). For any f ∈ C(A, B), f ∆ : A → TB is defined by f ∆ = A f −−−→B ηB −−−→TB. For any morphisms α ∈ C(A, TB), β ∈ C(B, TC) and γ ∈ C(C, TD), the followings hold. (α ◦ β) ◦ γ = α ◦ (β ◦ γ) α ◦ ηB = α β ◦ α∆ = (βα)∆ A Kleisli category CT is a category defined by Obj(CT ) = Obj(C), CT (A, B) = C(A, TB) and a composition of morphisms are defined by ◦. We note the identity idA ∈ CT (A, A) is ηA : A → TA. Y.Mizoguchi Algebras for programming languages 2015/09/30 17 / 27
  • 18. Monad Definition (Algebraic theory and monad) A monad type algebraic theory over a category C is a triple T = (T, η, µ) satisfies followings. T : C → C is a functor. η : I → T, µ : TT → T is a natural transformation. µA · ηTA = idTA, µA · TηA = idTA and µA · TµA = µA · µTA hold for any A ∈ Obj(C). A category CT of T-algebra and T-homomorphisms is defined by Obj(CT ) = {(X, ξ) | X ∈ Obj(C), ξ : TX → X, ξ·ηX = idX , ξ·Tξ = ξ·µX} and CT ((X, ξ), (Y , θ)) = {f ∈ C(X, Y ) | θ · Tf = f · ξ}. We call an object in CT as T-algebra and a morphism as T-homomorphism. Y.Mizoguchi Algebras for programming languages 2015/09/30 18 / 27
  • 19. Monad and Kleisli category Theorem ([3]) There exists a bijective correspondence between a clone type algebraic theory T = (T, η, ◦) and a monad type algebraic theory T = (T, η, µ). Theorem A category of (Ω, E)-algebra is isomorphic to a category of SetT defined by its algebraic theory T = (T, η, ◦). Y.Mizoguchi Algebras for programming languages 2015/09/30 19 / 27
  • 20. Algebraic Semantics For (Ω, E), we define the following axioms and inference rules. Axiom1 (Ω, E) ⊢ t = t Axiom2 (Ω, E) ⊢ s = t ({s, t} ∈ E) Assignment (Ω, E) ⊢ s = t (Ω, E) ⊢ s[x1 := t1, · · · , xn := tn] = t[x1 := t1, · · · , xn := tn] Replacement (Ω, E) ⊢ s1 = t1, · · · , (Ω, E) ⊢ sn = tn (Ω, E) ⊢ f (s1, · · · , sn) = f (t1, · · · , tn) Exchange (Ω, E) ⊢ s = t (Ω, E) ⊢ t = s Associative (Ω, E) ⊢ t1 = t2, (Ω, E) ⊢ t2 = t3, (Ω, E) ⊢ t1 = t3 Y.Mizoguchi Algebras for programming languages 2015/09/30 20 / 27
  • 21. Example Example Let Ω0 = {zero}, Ω1 = {succ}, Ω2 = {plus}, E = {{plus(zero, x), x}, {plus(succ(x), y) and succ(plus(x, y))}}. For (Ω, E), we have (Ω, E) ⊢ plus(succ(zero), zero) = succ(zero) Y.Mizoguchi Algebras for programming languages 2015/09/30 21 / 27
  • 22. Birkhoff’s Completeness Theorem Definition Let A be a (Ω, E)-algebra. If r#(s) = r#(t) for any r : V → A, we denote A |= s = t A |= s = t for any (Ω, E)-algebra A, we denote (Ω, E) |= s = t Theorem (Birkhoff’s Completness Theorem) (Ω, E) ⊢ s = t ⇔ (Ω, E) |= s = t Y.Mizoguchi Algebras for programming languages 2015/09/30 22 / 27
  • 23. Extensions Many-sorted algebra For Ω-algebra, we only consider a function δω : Xn → X of single type. For a programming language, we need not only a single type. if : Bool × N × N → N cons : N × List → List We need to extend a theory including multiple types including not only N but also Bool and List. There is an extended theory called many sorted algebraic theory which scheme is (Xσ, δσ). It is also possible to consider an algebraic semantics using a category theory. Infinitary theories We only consider finite-ary functions. A convergence of a sequence of countable many values can be considered as an infinite-ary function. Monad and Kleisli category have an ability to consider those algebras. Y.Mizoguchi Algebras for programming languages 2015/09/30 23 / 27
  • 24. Haskell’s monad (1) Let Set be the category of sets and functions. Let List be the category of free monoids and homomorphisms. Let A = Integer (the set of all integers). Let F : Set → List be a functor creating a free monoid. We note 1, 2, 3 ∈ A and [1, 2, 3] ∈ FA. For f : A → B we define Ff : FA → FB as Ff = (map f ). Ff[1,2,3] = (map f [1,2,3]) = [f(1),f(2),f(3)] concat : FFA → FA is a natural transfromation. concat[[1, 2], [3], [4, 5, 6]] = [1, 2, 3, 4, 5, 6] return : A → FA is a natural transformation. return x = [x] Y.Mizoguchi Algebras for programming languages 2015/09/30 24 / 27
  • 25. Haskell’s monad (2) Haskell’s monad is constructed by a triple (F, return, >>=). F : Obj(Set) → Obj(Set). return : A → FA (for A ∈ Obj(Set)) >>=: Set(A, FA) → Set(FA, FB) We denote >>= (f )(la) as l >>= f . la >>= f is defined as (concat (map f la)). [1, 2, 3] >>= (λ x.[x, 2x]) = concat (map (λ x.[x, 2x]) [1, 2, 3]) = concat [[1, 2], [2, 4], [3, 6]] = [1, 2, 2, 4, 3, 6] Y.Mizoguchi Algebras for programming languages 2015/09/30 25 / 27
  • 26. Haskell’s monad (3) Haskell’s monad is a triple (F, return, >>=). return : A → FA >>=: (A → FB) → (FA → FB) Kleisli category is a triple (F, η, ◦). η : A → FA ◦ : (A → FB) × (B → FC) → (A → FC) Correspondence between (F, return, >>=) and (F, η, ◦). η = return α ◦ β = λ x.((α x) >>= β). Y.Mizoguchi Algebras for programming languages 2015/09/30 26 / 27
  • 27. References G.Higman, B.H.Neumann, Groups as groupoids with one law, Publ. Math. Debrecen 2, 215–221,1952. Y.Kawahara, Y.Mizoguchi, Categorical assertion semantics in toposes, Advances in Software Science and Technology, Vol.4(1992), 137-150. E.G.Manes, Algebraic Theories, Springer-Verlag, 1976. S.Mac Lane, Categories for the working mathematician, Springer-Verlag, 1978. Y.Mizoguchi, Powerset monad, filter monad and primfilter monad in the category of set with monoid actions, Bull. of Informatics and Cybernetics, Vol.21(1985), 83-95. Haskell Language, https://www.haskell.org/. Y.Mizoguchi Algebras for programming languages 2015/09/30 27 / 27