• Nie Znaleziono Wyników

Category theory for computer science

N/A
N/A
Protected

Academic year: 2021

Share "Category theory for computer science"

Copied!
132
0
0

Pełen tekst

(1)

Category theory for computer science

• generality • abstraction • convenience • constructiveness •

Overall idea

look at all objects exclusively through relationships between them

(2)

Category theory for computer science

• generality • abstraction • convenience • constructiveness •

Overall idea

look at all objects exclusively through relationships between them

capture relationships between objects as appropriate morphisms between them

(3)

(Cartesian) product

• Cartesian product of two sets A and B, is the set

A × B = {ha, bi | a ∈ A, b ∈ B} with projections π1: A × B → A and π2: A × B → B given by π1(ha, bi) = a and π2(ha, bi) = b.

• A product of two sets A and B, is any set P with projections π1: P → A and π2: P → B such that for any set C with functions f1: C → A and f2: C → B there exists a unique function h : C → P such that h;π1 = f1 and h;π2 = f2.

A P B

C

 π1

π2 -

@

@

@

@ I

f1

 f2 6

∃! h Theorem: Cartesian product (of sets A and B)

is a product (of A and B).

(4)

(Cartesian) product

• Cartesian product of two sets A and B, is the set

A × B = {ha, bi | a ∈ A, b ∈ B} with projections π1: A × B → A and π2: A × B → B given by π1(ha, bi) = a and π2(ha, bi) = b.

• A product of two sets A and B, is any set P with projections π1: P → A and π2: P → B such that for any set C with functions f1: C → A and f2: C → B there exists a unique function h : C → P such that h;π1 = f1 and h;π2 = f2.

A P B

C

 π1

π2 -

@

@

@

@ I

f1

 f2 6

∃! h Theorem: Cartesian product (of sets A and B)

is a product (of A and B).

Recall the definition of (Cartesian) product of Σ-algebras.

Define product of Σ-algebras as above. What have you changed?

(5)

(Cartesian) product

• Cartesian product of two sets A and B, is the set

A × B = {ha, bi | a ∈ A, b ∈ B} with projections π1: A × B → A and π2: A × B → B given by π1(ha, bi) = a and π2(ha, bi) = b.

• A product of two sets A and B, is any set P with projections π1: P → A and π2: P → B such that for any set C with functions f1: C → A and f2: C → B there exists a unique function h : C → P such that h;π1 = f1 and h;π2 = f2.

A P B

C

 π1

π2 -

@

@

@

@ I

f1

 f2 6

∃! h Theorem: Cartesian product (of sets A and B)

is a product (of A and B).

(6)

(Cartesian) product

• Cartesian product of two sets A and B, is the set

A × B = {ha, bi | a ∈ A, b ∈ B} with projections π1: A × B → A and π2: A × B → B given by π1(ha, bi) = a and π2(ha, bi) = b.

• A product of two sets A and B, is any set P with projections π1: P → A and π2: P → B such that for any set C with functions f1: C → A and f2: C → B there exists a unique function h : C → P such that h;π1 = f1 and h;π2 = f2.

A P B

C

 π1

π2 -

@

@

@

@ I

f1

 f2 6

∃! h Theorem: Cartesian product (of sets A and B)

is a product (of A and B).

Recall the definition of (Cartesian) product of Σ-algebras.

Define product of Σ-algebras as above. What have you changed?

(7)

(Cartesian) product

• Cartesian product of two sets A and B, is the set

A × B = {ha, bi | a ∈ A, b ∈ B} with projections π1: A × B → A and π2: A × B → B given by π1(ha, bi) = a and π2(ha, bi) = b.

• A product of two sets A and B, is any set P with projections π1: P → A and π2: P → B such that for any set C with functions f1: C → A and f2: C → B there exists a unique function h : C → P such that h;π1 = f1 and h;π2 = f2.

A P B

C

 π1

π2 -

@

@

@

@ I

f1

 f2 6

∃! h Theorem: Cartesian product (of sets A and B)

is a product (of A and B).

(8)

(Cartesian) product

• Cartesian product of two sets A and B, is the set

A × B = {ha, bi | a ∈ A, b ∈ B} with projections π1: A × B → A and π2: A × B → B given by π1(ha, bi) = a and π2(ha, bi) = b.

• A product of two sets A and B, is any set P with projections π1: P → A and π2: P → B such that for any set C with functions f1: C → A and f2: C → B there exists a unique function h : C → P such that h;π1 = f1 and h;π2 = f2.

A P B

C

 π1

π2 -

@

@

@

@ I

f1

 f2 6

∃! h Theorem: Cartesian product (of sets A and B)

is a product (of A and B).

Recall the definition of (Cartesian) product of Σ-algebras.

Define product of Σ-algebras as above. What have you changed?

(9)

(Cartesian) product

• Cartesian product of two sets A and B, is the set

A × B = {ha, bi | a ∈ A, b ∈ B} with projections π1: A × B → A and π2: A × B → B given by π1(ha, bi) = a and π2(ha, bi) = b.

• A product of two sets A and B, is any set P with projections π1: P → A and π2: P → B such that for any set C with functions f1: C → A and f2: C → B there exists a unique function h : C → P such that h;π1 = f1 and h;π2 = f2.

A P B

C

 π1

π2 -

@

@

@

@ I

f1

 f2 6

∃! h Theorem: Cartesian product (of sets A and B)

is a product (of A and B).

(10)

Pitfalls of generalization

the same concrete definition ; distinct abstract generalizations

Given a function f : A → B, the following conditions are equivalent:

• f is a surjection: ∀b ∈ B·∃a ∈ A·f (a) = b.

• f is an epimorphism: for all h1, h2 : B → C, if f ;h1 = f ;h2 then h1 = h2.

• f is a retraction: there exists g : B → A such that g;f = idB. BUT: Given a Σ-homomorphism f : A → B for A, B ∈ Alg(Σ):

f is retraction =⇒ f is surjection ⇐⇒ f is epimorphism BUT: Given a (weak) Σ-homomorphism f : A → B for A, B ∈ PAlg(Σ):

f is retraction =⇒ f is surjection =⇒ f is epimorphism

(11)

Pitfalls of generalization

the same concrete definition ; distinct abstract generalizations

Given a function f : A → B, the following conditions are equivalent:

• f is a surjection: ∀b ∈ B·∃a ∈ A·f (a) = b.

• f is an epimorphism: for all h1, h2 : B → C, if f ;h1 = f ;h2 then h1 = h2.

• f is a retraction: there exists g : B → A such that g;f = idB. BUT: Given a Σ-homomorphism f : A → B for A, B ∈ Alg(Σ):

f is retraction =⇒ f is surjection ⇐⇒ f is epimorphism BUT: Given a (weak) Σ-homomorphism f : A → B for A, B ∈ PAlg(Σ):

(12)

Pitfalls of generalization

the same concrete definition ; distinct abstract generalizations

Given a function f : A → B, the following conditions are equivalent:

• f is a surjection: ∀b ∈ B·∃a ∈ A·f (a) = b.

• f is an epimorphism: for all h1, h2 : B → C, if f ;h1 = f ;h2 then h1 = h2.

• f is a retraction: there exists g : B → A such that g;f = idB. BUT: Given a Σ-homomorphism f : A → B for A, B ∈ Alg(Σ):

f is retraction =⇒ f is surjection ⇐⇒ f is epimorphism BUT: Given a (weak) Σ-homomorphism f : A → B for A, B ∈ PAlg(Σ):

f is retraction =⇒ f is surjection =⇒ f is epimorphism

(13)

Pitfalls of generalization

the same concrete definition ; distinct abstract generalizations

Given a function f : A → B, the following conditions are equivalent:

• f is a surjection: ∀b ∈ B·∃a ∈ A·f (a) = b.

• f is an epimorphism: for all h1, h2 : B → C, if f ;h1 = f ;h2 then h1 = h2.

• f is a retraction: there exists g : B → A such that g;f = idB. BUT: Given a Σ-homomorphism f : A → B for A, B ∈ Alg(Σ):

f is retraction =⇒ f is surjection ⇐⇒ f is epimorphism BUT: Given a (weak) Σ-homomorphism f : A → B for A, B ∈ PAlg(Σ):

(14)

Pitfalls of generalization

the same concrete definition ; distinct abstract generalizations

Given a function f : A → B, the following conditions are equivalent:

• f is a surjection: ∀b ∈ B·∃a ∈ A·f (a) = b.

• f is an epimorphism: for all h1, h2 : B → C, if f ;h1 = f ;h2 then h1 = h2.

• f is a retraction: there exists g : B → A such that g;f = idB. BUT: Given a Σ-homomorphism f : A → B for A, B ∈ Alg(Σ):

f is retraction =⇒ f is surjection ⇐⇒ f is epimorphism BUT: Given a (weak) Σ-homomorphism f : A → B for A, B ∈ PAlg(Σ):

f is retraction =⇒ f is surjection =⇒ f is epimorphism

(15)

Pitfalls of generalization

the same concrete definition ; distinct abstract generalizations

Given a function f : A → B, the following conditions are equivalent:

• f is a surjection: ∀b ∈ B·∃a ∈ A·f (a) = b.

• f is an epimorphism: for all h1, h2 : B → C, if f ;h1 = f ;h2 then h1 = h2.

• f is a retraction: there exists g : B → A such that g;f = idB. BUT: Given a Σ-homomorphism f : A → B for A, B ∈ Alg(Σ):

f is retraction =⇒ f is surjection ⇐⇒ f is epimorphism BUT: Given a (weak) Σ-homomorphism f : A → B for A, B ∈ PAlg(Σ):

(16)

Pitfalls of generalization

the same concrete definition ; distinct abstract generalizations

Given a function f : A → B, the following conditions are equivalent:

• f is a surjection: ∀b ∈ B·∃a ∈ A·f (a) = b.

• f is an epimorphism: for all h1, h2 : B → C, if f ;h1 = f ;h2 then h1 = h2.

• f is a retraction: there exists g : B → A such that g;f = idB. BUT: Given a Σ-homomorphism f : A → B for A, B ∈ Alg(Σ):

f is retraction =⇒ f is surjection ⇐⇒ f is epimorphism BUT: Given a (weak) Σ-homomorphism f : A → B for A, B ∈ PAlg(Σ):

f is retraction =⇒ f is surjection =⇒ f is epimorphism

(17)

Pitfalls of generalization

the same concrete definition ; distinct abstract generalizations

Given a function f : A → B, the following conditions are equivalent:

• f is a surjection: ∀b ∈ B·∃a ∈ A·f (a) = b.

• f is an epimorphism: for all h1, h2 : B → C, if f ;h1 = f ;h2 then h1 = h2.

• f is a retraction: there exists g : B → A such that g;f = idB. BUT: Given a Σ-homomorphism f : A → B for A, B ∈ Alg(Σ):

f is retraction =⇒ f is surjection ⇐⇒ f is epimorphism BUT: Given a (weak) Σ-homomorphism f : A → B for A, B ∈ PAlg(Σ):

(18)

Pitfalls of generalization

the same concrete definition ; distinct abstract generalizations

Given a function f : A → B, the following conditions are equivalent:

• f is a surjection: ∀b ∈ B·∃a ∈ A·f (a) = b.

• f is an epimorphism: for all h1, h2 : B → C, if f ;h1 = f ;h2 then h1 = h2.

• f is a retraction: there exists g : B → A such that g;f = idB. BUT: Given a Σ-homomorphism f : A → B for A, B ∈ Alg(Σ):

f is retraction =⇒ f is surjection ⇐⇒ f is epimorphism BUT: Given a (weak) Σ-homomorphism f : A → B for A, B ∈ PAlg(Σ):

f is retraction =⇒ f is surjection =⇒ f is epimorphism

(19)

Categories

Definition: Category K consists of:

• a collection of objects: |K|

• mutually disjoint collections of morphisms: K(A, B), for all A, B ∈ |K|;

m : A → B stands for m ∈ K(A, B)

• morphism composition: for m : A → B and m0: B → C, we have m; m0 : A → C;

− the composition is associative: for m1: A0 → A1, m2: A1 → A2 and m3: A2 → A3, (m1;m2);m3 = m1;(m2;m3)

− the composition has identities: for A ∈ |K|, there is idA: A → A such that for all m : A → A, m ;id = m , and m : A → A , id ;m = m .

(20)

Categories

Definition: Category K consists of:

• a collection of objects: |K|

• mutually disjoint collections of morphisms: K(A, B), for all A, B ∈ |K|;

m : A → B stands for m ∈ K(A, B)

• morphism composition: for m : A → B and m0: B → C, we have m; m0 : A → C;

− the composition is associative: for m1: A0 → A1, m2: A1 → A2 and m3: A2 → A3, (m1;m2);m3 = m1;(m2;m3)

− the composition has identities: for A ∈ |K|, there is idA: A → A such that for all m1: A1 → A, m1;idA = m1, and m2: A → A2, idA;m2 = m2.

BTW: “collection” means “set”, “class”, etc, as appropriate.

(21)

Categories

Definition: Category K consists of:

• a collection of objects: |K|

• mutually disjoint collections of morphisms: K(A, B), for all A, B ∈ |K|;

m : A → B stands for m ∈ K(A, B)

• morphism composition: for m : A → B and m0: B → C, we have m; m0 : A → C;

− the composition is associative: for m1: A0 → A1, m2: A1 → A2 and m3: A2 → A3, (m1;m2);m3 = m1;(m2;m3)

− the composition has identities: for A ∈ |K|, there is idA: A → A such that for all m : A → A, m ;id = m , and m : A → A , id ;m = m .

(22)

Categories

Definition: Category K consists of:

• a collection of objects: |K|

• mutually disjoint collections of morphisms: K(A, B), for all A, B ∈ |K|;

m : A → B stands for m ∈ K(A, B)

• morphism composition: for m : A → B and m0: B → C, we have m; m0: A → C;

− the composition is associative: for m1: A0 → A1, m2: A1 → A2 and m3: A2 → A3, (m1;m2);m3 = m1;(m2;m3)

− the composition has identities: for A ∈ |K|, there is idA: A → A such that for all m1: A1 → A, m1;idA = m1, and m2: A → A2, idA;m2 = m2.

BTW: “collection” means “set”, “class”, etc, as appropriate.

(23)

Categories

Definition: Category K consists of:

• a collection of objects: |K|

• mutually disjoint collections of morphisms: K(A, B), for all A, B ∈ |K|;

m : A → B stands for m ∈ K(A, B)

• morphism composition: for m : A → B and m0: B → C, we have m; m0: A → C;

− the composition is associative: for m1: A0 → A1, m2: A1 → A2 and m3: A2 → A3, (m1;m2);m3 = m1;(m2;m3)

− the composition has identities: for A ∈ |K|, there is idA: A → A such that for all m1: A1 → A, m1;idA = m1, and m2: A → A2, idA;m2 = m2.

(24)

Categories

Definition: Category K consists of:

• a collection of objects: |K|

• mutually disjoint collections of morphisms: K(A, B), for all A, B ∈ |K|;

m : A → B stands for m ∈ K(A, B)

• morphism composition: for m : A → B and m0: B → C, we have m; m0: A → C;

− the composition is associative: for m1: A0 → A1, m2: A1 → A2 and m3: A2 → A3, (m1;m2);m3 = m1;(m2;m3)

− the composition has identities: for A ∈ |K|, there is idA: A → A such that for all m1: A1 → A, m1;idA = m1, and m2: A → A2, idA;m2 = m2.

BTW: “collection” means “set”, “class”, etc, as appropriate.

(25)

Categories

Definition: Category K consists of:

• a collection of objects: |K|

• mutually disjoint collections of morphisms: K(A, B), for all A, B ∈ |K|;

m : A → B stands for m ∈ K(A, B)

• morphism composition: for m : A → B and m0: B → C, we have m; m0: A → C;

− the composition is associative: for m1: A0 → A1, m2: A1 → A2 and m3: A2 → A3, (m1;m2);m3 = m1;(m2;m3)

− the composition has identities: for A ∈ |K|, there is idA: A → A such that for all m1: A1 → A, m1;idA = m1, and m2: A → A2, idA;m2 = m2.

(26)

Categories

Definition: Category K consists of:

• a collection of objects: |K|

• mutually disjoint collections of morphisms: K(A, B), for all A, B ∈ |K|;

m : A → B stands for m ∈ K(A, B)

• morphism composition: for m : A → B and m0: B → C, we have m; m0: A → C;

− the composition is associative: for m1: A0 → A1, m2: A1 → A2 and m3: A2 → A3, (m1;m2);m3 = m1;(m2;m3)

− the composition has identities: for A ∈ |K|, there is idA: A → A such that for all m1: A1 → A, m1;idA = m1, and m2: A → A2, idA;m2 = m2.

BTW: “collection” means “set”, “class”, etc, as appropriate.

K is locally small if for all A, B ∈ |K|, K(A, B) is a set.

(27)

Presenting finite categories

0:

1: •

2: • - •

3: • - • - •



?

4: • - • - • - •



?

 6

#

? . . .









 identities omitted 

(28)

Presenting finite categories

0:

1: •

2: • - •

3: • - • - •



?

4: • - • - • - •



?

 6

#

? 







 identities omitted 

(29)

Presenting finite categories

. . .0:

1: •

2: • - •

3: • - • - •



?

4: • - • - • - •



?

 6

#

? 







 identities omitted 

(30)

Presenting finite categories

. . .0:

1: •

2: • - •

3: • - • - •



?

4: • - • - • - •



?

 6

#

? 







 identities omitted 

(31)

Presenting finite categories

. . .0:

1: •

2: • - •

3: • - • - •



?

4: • - • - • - •



?

 6

#

? . . .









 identities omitted 

(32)

Generic examples

Discrete categories: A category K is discrete if all K(A, B) are empty, for distinct A, B ∈ |K|, and K(A, A) = {idA} for all A ∈ |K|.

Preorders: A category K is thin if for all A, B ∈ |K|, K(A, B) contains at most one element.

Every preorder ≤ ⊆ X × X

Every (small) category K determines a preorder ≤K ⊆ |K| × |K|, where for A, B ∈ |K|, A ≤K B iff K(A, B) is nonempty.

Monoids: A category K is a monoid if |K| is a singleton.

Every monoid X = hX, ;, idi, where ; : X × X → X and id ∈ X,

(33)

Generic examples

Discrete categories: A category K is discrete if all K(A, B) are empty, for distinct A, B ∈ |K|, and K(A, A) = {idA} for all A ∈ |K|.

Preorders: A category K is thin if for all A, B ∈ |K|, K(A, B) contains at most one element.

Every preorder ≤ ⊆ X × X

Every (small) category K determines a preorder ≤K ⊆ |K| × |K|, where for A, B ∈ |K|, A ≤K B iff K(A, B) is nonempty.

Monoids: A category K is a monoid if |K| is a singleton.

Every monoid X = hX, ;, idi, where ; : X × X → X and id ∈ X,

(34)

Generic examples

Discrete categories: A category K is discrete if all K(A, B) are empty, for distinct A, B ∈ |K|, and K(A, A) = {idA} for all A ∈ |K|.

Preorders: A category K is thin if for all A, B ∈ |K|, K(A, B) contains at most one element.

Every preorder ≤ ⊆ X × X

Every (small) category K determines a preorder ≤K ⊆ |K| × |K|, where for A, B ∈ |K|, A ≤K B iff K(A, B) is nonempty.

Monoids: A category K is a monoid if |K| is a singleton.

Every monoid X = hX, ;, idi, where ; : X × X → X and id ∈ X,

(35)

Generic examples

Discrete categories: A category K is discrete if all K(A, B) are empty, for distinct A, B ∈ |K|, and K(A, A) = {idA} for all A ∈ |K|.

Preorders: A category K is thin if for all A, B ∈ |K|, K(A, B) contains at most one element.

Every preorder ≤ ⊆ X × X

Every (small) category K determines a preorder ≤K ⊆ |K| × |K|, where for A, B ∈ |K|, A ≤K B iff K(A, B) is nonempty.

Monoids: A category K is a monoid if |K| is a singleton.

Every monoid X = hX, ;, idi, where ; : X × X → X and id ∈ X,

(36)

Generic examples

Discrete categories: A category K is discrete if all K(A, B) are empty, for distinct A, B ∈ |K|, and K(A, A) = {idA} for all A ∈ |K|.

Preorders: A category K is thin if for all A, B ∈ |K|, K(A, B) contains at most one element.

Every preorder ≤ ⊆ X × X

− reflexivity: x ≤ x

− transitivity: if x ≤ y and y ≤ z then x ≤ z Every (small) category K determines a preorder ≤K ⊆ |K| × |K|, where for A, B ∈ |K|, A ≤K B iff K(A, B) is nonempty.

Monoids: A category K is a monoid if |K| is a singleton.

Every monoid X = hX, ;, idi, where ; : X × X → X and id ∈ X,

(37)

Generic examples

Discrete categories: A category K is discrete if all K(A, B) are empty, for distinct A, B ∈ |K|, and K(A, A) = {idA} for all A ∈ |K|.

Preorders: A category K is thin if for all A, B ∈ |K|, K(A, B) contains at most one element.

Every preorder ≤ ⊆ X × X determines a thin category K with |K| = X and for x, y ∈ |K|, K(x, y) is nonempty iff x ≤ y.

Every (small) category K determines a preorder ≤K ⊆ |K| × |K|, where for A, B ∈ |K|, A ≤K B iff K(A, B) is nonempty.

Monoids: A category K is a monoid if |K| is a singleton.

Every monoid X = hX, ;, idi, where ; : X × X → X and id ∈ X,

(38)

Generic examples

Discrete categories: A category K is discrete if all K(A, B) are empty, for distinct A, B ∈ |K|, and K(A, A) = {idA} for all A ∈ |K|.

Preorders: A category K is thin if for all A, B ∈ |K|, K(A, B) contains at most one element.

Every preorder ≤ ⊆ X × X determines a thin category K with |K| = X and for x, y ∈ |K|, K(x, y) is nonempty iff x ≤ y.

Every (small) category K determines a preorder ≤K ⊆ |K| × |K|, where for A, B ∈ |K|, A ≤K B iff K(A, B) is nonempty.

Monoids: A category K is a monoid if |K| is a singleton.

Every monoid X = hX, ;, idi, where ; : X × X → X and id ∈ X,

(39)

Generic examples

Discrete categories: A category K is discrete if all K(A, B) are empty, for distinct A, B ∈ |K|, and K(A, A) = {idA} for all A ∈ |K|.

Preorders: A category K is thin if for all A, B ∈ |K|, K(A, B) contains at most one element.

Every preorder ≤ ⊆ X × X determines a thin category K with |K| = X and for x, y ∈ |K|, K(x, y) is nonempty iff x ≤ y.

Every (small) category K determines a preorder ≤K ⊆ |K| × |K|, where for A, B ∈ |K|, A ≤K B iff K(A, B) is nonempty.

Monoids: A category K is a monoid if |K| is a singleton.

Every monoid X = hX, ;, idi, where ; : X × X → X and id ∈ X,

(40)

Generic examples

Discrete categories: A category K is discrete if all K(A, B) are empty, for distinct A, B ∈ |K|, and K(A, A) = {idA} for all A ∈ |K|.

Preorders: A category K is thin if for all A, B ∈ |K|, K(A, B) contains at most one element.

Every preorder ≤ ⊆ X × X determines a thin category K with |K| = X and for x, y ∈ |K|, K(x, y) is nonempty iff x ≤ y.

Every (small) category K determines a preorder ≤K ⊆ |K| × |K|, where for A, B ∈ |K|, A ≤K B iff K(A, B) is nonempty.

Monoids: A category K is a monoid if |K| is a singleton.

Every monoid X = hX, ;, idi, where ; : X × X → X and id ∈ X,

(41)

Generic examples

Discrete categories: A category K is discrete if all K(A, B) are empty, for distinct A, B ∈ |K|, and K(A, A) = {idA} for all A ∈ |K|.

Preorders: A category K is thin if for all A, B ∈ |K|, K(A, B) contains at most one element.

Every preorder ≤ ⊆ X × X determines a thin category K with |K| = X and for x, y ∈ |K|, K(x, y) is nonempty iff x ≤ y.

Every (small) category K determines a preorder ≤K ⊆ |K| × |K|, where for A, B ∈ |K|, A ≤K B iff K(A, B) is nonempty.

Monoids: A category K is a monoid if |K| is a singleton.

Every monoid X = hX, ;, idi, where ; : X × X → X and id ∈ X,

(42)

Generic examples

Discrete categories: A category K is discrete if all K(A, B) are empty, for distinct A, B ∈ |K|, and K(A, A) = {idA} for all A ∈ |K|.

Preorders: A category K is thin if for all A, B ∈ |K|, K(A, B) contains at most one element.

Every preorder ≤ ⊆ X × X determines a thin category K with |K| = X and for x, y ∈ |K|, K(x, y) is nonempty iff x ≤ y.

Every (small) category K determines a preorder ≤K ⊆ |K| × |K|, where for A, B ∈ |K|, A ≤K B iff K(A, B) is nonempty.

Monoids: A category K is a monoid if |K| is a singleton.

Every monoid X = hX, ;, idi, where ; : X × X → X and id ∈ X, determines a (monoid) category KX with |KX| = {∗}, K(∗, ∗) = X and the composition

(43)

Examples

• Sets (as objects) and functions between them (as morphisms) with the usual composition form the category Set.

Functions have to be considered with their sources and targets

• For any set S, S-sorted sets (as objects) and S-functions between them (as morphisms) with the usual composition form the category SetS.

• For any signature Σ, Σ-algebras (as objects) and their homomorphisms (as morphisms) form the category Alg(Σ).

• For any signature Σ, partial Σ-algebras (as objects) and their weak homomorphisms (as morphisms) form the category PAlg(Σ).

• For any signature Σ, partial Σ-algebras (as objects) and their strong homomorphisms (as morphisms) form the category PAlgs(Σ).

(44)

Examples

• Sets (as objects) and functions between them (as morphisms) with the usual composition form the category Set.

Functions have to be considered with their sources and targets

• For any set S, S-sorted sets (as objects) and S-functions between them (as morphisms) with the usual composition form the category SetS.

• For any signature Σ, Σ-algebras (as objects) and their homomorphisms (as morphisms) form the category Alg(Σ).

• For any signature Σ, partial Σ-algebras (as objects) and their weak homomorphisms (as morphisms) form the category PAlg(Σ).

• For any signature Σ, partial Σ-algebras (as objects) and their strong homomorphisms (as morphisms) form the category PAlgs(Σ).

• Algebraic signatures (as objects) and their morphisms (as morphisms) with the

(45)

Examples

• Sets (as objects) and functions between them (as morphisms) with the usual composition form the category Set.

Functions have to be considered with their sources and targets

• For any set S, S-sorted sets (as objects) and S-functions between them (as morphisms) with the usual composition form the category SetS.

• For any signature Σ, Σ-algebras (as objects) and their homomorphisms (as morphisms) form the category Alg(Σ).

• For any signature Σ, partial Σ-algebras (as objects) and their weak homomorphisms (as morphisms) form the category PAlg(Σ).

• For any signature Σ, partial Σ-algebras (as objects) and their strong homomorphisms (as morphisms) form the category PAlgs(Σ).

(46)

Examples

• Sets (as objects) and functions between them (as morphisms) with the usual composition form the category Set.

Functions have to be considered with their sources and targets

• For any set S, S-sorted sets (as objects) and S-functions between them (as morphisms) with the usual composition form the category SetS.

• For any signature Σ, Σ-algebras (as objects) and their homomorphisms (as morphisms) form the category Alg(Σ).

• For any signature Σ, partial Σ-algebras (as objects) and their weak homomorphisms (as morphisms) form the category PAlg(Σ).

• For any signature Σ, partial Σ-algebras (as objects) and their strong homomorphisms (as morphisms) form the category PAlgs(Σ).

• Algebraic signatures (as objects) and their morphisms (as morphisms) with the

(47)

Examples

• Sets (as objects) and functions between them (as morphisms) with the usual composition form the category Set.

Functions have to be considered with their sources and targets

• For any set S, S-sorted sets (as objects) and S-functions between them (as morphisms) with the usual composition form the category SetS.

• For any signature Σ, Σ-algebras (as objects) and their homomorphisms (as morphisms) form the category Alg(Σ).

• For any signature Σ, partial Σ-algebras (as objects) and their weak homomorphisms (as morphisms) form the category PAlg(Σ).

• For any signature Σ, partial Σ-algebras (as objects) and their strong homomorphisms (as morphisms) form the category PAlgs(Σ).

(48)

Examples

• Sets (as objects) and functions between them (as morphisms) with the usual composition form the category Set.

Functions have to be considered with their sources and targets

• For any set S, S-sorted sets (as objects) and S-functions between them (as morphisms) with the usual composition form the category SetS.

• For any signature Σ, Σ-algebras (as objects) and their homomorphisms (as morphisms) form the category Alg(Σ).

• For any signature Σ, partial Σ-algebras (as objects) and their weak homomorphisms (as morphisms) form the category PAlg(Σ).

• For any signature Σ, partial Σ-algebras (as objects) and their strong homomorphisms (as morphisms) form the category PAlgs(Σ).

• Algebraic signatures (as objects) and their morphisms (as morphisms) with the

(49)

Examples

• Sets (as objects) and functions between them (as morphisms) with the usual composition form the category Set.

Functions have to be considered with their sources and targets

• For any set S, S-sorted sets (as objects) and S-functions between them (as morphisms) with the usual composition form the category SetS.

• For any signature Σ, Σ-algebras (as objects) and their homomorphisms (as morphisms) form the category Alg(Σ).

• For any signature Σ, partial Σ-algebras (as objects) and their weak homomorphisms (as morphisms) form the category PAlg(Σ).

• For any signature Σ, partial Σ-algebras (as objects) and their strong homomorphisms (as morphisms) form the category PAlgs(Σ).

(50)

Examples

• Sets (as objects) and functions between them (as morphisms) with the usual composition form the category Set.

Functions have to be considered with their sources and targets

• For any set S, S-sorted sets (as objects) and S-functions between them (as morphisms) with the usual composition form the category SetS.

• For any signature Σ, Σ-algebras (as objects) and their homomorphisms (as morphisms) form the category Alg(Σ).

• For any signature Σ, partial Σ-algebras (as objects) and their weak homomorphisms (as morphisms) form the category PAlg(Σ).

• For any signature Σ, partial Σ-algebras (as objects) and their strong homomorphisms (as morphisms) form the category PAlgs(Σ).

• Algebraic signatures (as objects) and their morphisms (as morphisms) with the

(51)

Substitutions

For any signature Σ = (S, Ω), the category of Σ-substitutions SubstΣ is defined as follows:

− objects of SubstΣ are S-sorted sets (of variables);

− morphisms in SubstΣ(X, Y ) are substitutions θ : X → |TΣ(Y )|,

− composition is defined in the obvious way:

for θ1: X → Y and θ2 : Y → Z, that is functions θ1 : X → |TΣ(Y )| and θ2: Y → |TΣ(Z)|, their composition θ12: X → Z in SubstΣ is a function θ12: X → |TΣ(Z)| such that for each x ∈ X, (θ12)(x) = θ2#1(x)).

(52)

Substitutions

For any signature Σ = (S, Ω), the category of Σ-substitutions SubstΣ is defined as follows:

− objects of SubstΣ are S-sorted sets (of variables);

− morphisms in SubstΣ(X, Y ) are substitutions θ : X → |TΣ(Y )|,

− composition is defined in the obvious way:

for θ1: X → Y and θ2 : Y → Z, that is functions θ1 : X → |TΣ(Y )| and θ2: Y → |TΣ(Z)|, their composition θ12: X → Z in SubstΣ is a function θ12: X → |TΣ(Z)| . . . such that for each x ∈ X, (θ12)(x) = θ2#1(x)).

− the composition θ12: X → Z, which is a function θ12 : X → |TΣ(Z)|, is not the function composition of θ1 : X → |TΣ(Y )| and θ2: Y → |TΣ(Z)|

(53)

Substitutions

For any signature Σ = (S, Ω), the category of Σ-substitutions SubstΣ is defined as follows:

− objects of SubstΣ are S-sorted sets (of variables);

− morphisms in SubstΣ(X, Y ) are substitutions θ : X → |TΣ(Y )|,

− composition is defined in the obvious way:

for θ1: X → Y and θ2 : Y → Z, that is functions θ1 : X → |TΣ(Y )| and θ2: Y → |TΣ(Z)|, their composition θ12: X → Z in SubstΣ is a function θ12: X → |TΣ(Z)| such that for each x ∈ X, (θ12)(x) = θ2#1(x)).

(54)

Subcategories

Given a category K, a subcategory of K is any category K0 such that

• |K0| ⊆ |K|,

• K0(A, B) ⊆ K(A, B), for all A, B ∈ |K0|,

• composition in K0 coincides with the composition in K on morphisms in K0, and

• identities in K0 coincide with identities in K on objects in |K0|.

A subcategory K0 of K is full if K0(A, B) = K(A, B) for all A, B ∈ |K0|.

Any collection X ⊆ |K| gives the full subcategory K X of K by |K X| = X.

• The category FinSet of finite sets is a full subcategory of Set.

• The discrete category of sets is a subcategory of the category of sets with inclusions as morphisms, which is a subcategory of the category of sets with injective functions as morphisms, which is a subcategory of Set.

(55)

Subcategories

Given a category K, a subcategory of K is any category K0 such that

• |K0| ⊆ |K|,

• K0(A, B) ⊆ K(A, B), for all A, B ∈ |K0|,

• composition in K0 coincides with the composition in K on morphisms in K0, and

• identities in K0 coincide with identities in K on objects in |K0|.

A subcategory K0 of K is full if K0(A, B) = K(A, B) for all A, B ∈ |K0|.

Any collection X ⊆ |K| gives the full subcategory K X of K by |K X| = X.

• The category FinSet of finite sets is a full subcategory of Set.

• The discrete category of sets is a subcategory of the category of sets with inclusions as morphisms, which is a subcategory of the category of sets with

(56)

Subcategories

Given a category K, a subcategory of K is any category K0 such that

• |K0| ⊆ |K|,

• K0(A, B) ⊆ K(A, B), for all A, B ∈ |K0|,

• composition in K0 coincides with the composition in K on morphisms in K0, and

• identities in K0 coincide with identities in K on objects in |K0|.

A subcategory K0 of K is full if K0(A, B) = K(A, B) for all A, B ∈ |K0|.

Any collection X ⊆ |K| gives the full subcategory K X of K by |K X| = X.

• The category FinSet of finite sets is a full subcategory of Set.

• The discrete category of sets is a subcategory of the category of sets with inclusions as morphisms, which is a subcategory of the category of sets with injective functions as morphisms, which is a subcategory of Set.

(57)

Subcategories

Given a category K, a subcategory of K is any category K0 such that

• |K0| ⊆ |K|,

• K0(A, B) ⊆ K(A, B), for all A, B ∈ |K0|,

• composition in K0 coincides with the composition in K on morphisms in K0, and

• identities in K0 coincide with identities in K on objects in |K0|.

A subcategory K0 of K is full if K0(A, B) = K(A, B) for all A, B ∈ |K0|.

Any collection X ⊆ |K| gives the full subcategory K X of K by |K X| = X.

• The category FinSet of finite sets is a full subcategory of Set.

• The discrete category of sets is a subcategory of the category of sets with inclusions as morphisms, which is a subcategory of the category of sets with

(58)

Reversing arrows

Given a category K, its opposite category Kop is defined as follows:

− objects: |Kop| = |K|

− morphisms: Kop(A, B) = K(B, A) for all A, B ∈ |Kop| = |K|

− composition: given m1: A → B and m2 : B → C in Kop, that is, m1: B → A and m2: C → B in K, their composition in Kop, m1;m2 : A → C, is set to be their composition m2;m1 : C → A in K.

Theorem: The identities in Kop coincide with the identities in K.

Theorem: Every category is opposite to some category:

(Kop)op = K

(59)

Reversing arrows

Given a category K, its opposite category Kop is defined as follows:

− objects: |Kop| = |K|

− morphisms: Kop(A, B) = K(B, A) for all A, B ∈ |Kop| = |K|

− composition: given m1: A → B and m2 : B → C in Kop, that is, m1: B → A and m2: C → B in K, their composition in Kop, m1;m2 : A → C, is set to be their composition m2;m1 : C → A in K.

Theorem: The identities in Kop coincide with the identities in K.

Theorem: Every category is opposite to some category:

(Kop)op = K

(60)

Reversing arrows

Given a category K, its opposite category Kop is defined as follows:

− objects: |Kop| = |K|

− morphisms: Kop(A, B) = K(B, A) for all A, B ∈ |Kop| = |K|

− composition: given m1: A → B and m2 : B → C in Kop, that is, m1: B → A and m2: C → B in K, their composition in Kop, m1;m2 : A → C, is set to be their composition m2;m1 : C → A in K.

Theorem: The identities in Kop coincide with the identities in K.

Theorem: Every category is opposite to some category:

(Kop)op = K

(61)

Reversing arrows

Given a category K, its opposite category Kop is defined as follows:

− objects: |Kop| = |K|

− morphisms: Kop(A, B) = K(B, A) for all A, B ∈ |Kop| = |K|

− composition: given m1: A → B and m2 : B → C in Kop, that is, m1: B → A and m2: C → B in K, their composition in Kop, m1;m2 : A → C, is set to be their composition m2;m1 : C → A in K.

Theorem: The identities in Kop coincide with the identities in K.

Theorem: Every category is opposite to some category:

(Kop)op = K

(62)

Reversing arrows

Given a category K, its opposite category Kop is defined as follows:

− objects: |Kop| = |K|

− morphisms: Kop(A, B) = K(B, A) for all A, B ∈ |Kop| = |K|

− composition: given m1: A → B and m2 : B → C in Kop, that is, m1: B → A and m2: C → B in K, their composition in Kop, m1;m2 : A → C, is set to be their composition m2;m1 : C → A in K.

Theorem: The identities in Kop coincide with the identities in K.

Theorem: Every category is opposite to some category:

(Kop)op = K

(63)

Reversing arrows

Given a category K, its opposite category Kop is defined as follows:

− objects: |Kop| = |K|

− morphisms: Kop(A, B) = K(B, A) for all A, B ∈ |Kop| = |K|

− composition: given m1: A → B and m2 : B → C in Kop, that is, m1: B → A and m2: C → B in K, their composition in Kop, m1;m2 : A → C, is set to be their composition m2;m1 : C → A in K.

Theorem: The identities in Kop coincide with the identities in K.

Theorem: Every category is opposite to some category:

(Kop)op = K

(64)

Reversing arrows

Given a category K, its opposite category Kop is defined as follows:

− objects: |Kop| = |K|

− morphisms: Kop(A, B) = K(B, A) for all A, B ∈ |Kop| = |K|

− composition: given m1: A → B and m2 : B → C in Kop, that is, m1: B → A and m2: C → B in K, their composition in Kop, m1;m2 : A → C, is set to be their composition m2;m1 : C → A in K.

Theorem: The identities in Kop coincide with the identities in K.

Theorem: Every category is opposite to some category:

(Kop)op = K

(65)

Reversing arrows

Given a category K, its opposite category Kop is defined as follows:

− objects: |Kop| = |K|

− morphisms: Kop(A, B) = K(B, A) for all A, B ∈ |Kop| = |K|

− composition: given m1: A → B and m2 : B → C in Kop, that is, m1: B → A and m2: C → B in K, their composition in Kop, m1;m2 : A → C, is set to be their composition m2;m1 : C → A in K.

Theorem: The identities in Kop coincide with the identities in K.

Theorem: Every category is opposite to some category:

(Kop)op = K

(66)

Reversing arrows

Given a category K, its opposite category Kop is defined as follows:

− objects: |Kop| = |K|

− morphisms: Kop(A, B) = K(B, A) for all A, B ∈ |Kop| = |K|

− composition: given m1: A → B and m2 : B → C in Kop, that is, m1: B → A and m2: C → B in K, their composition in Kop, m1;m2 : A → C, is set to be their composition m2;m1 : C → A in K.

Theorem: The identities in Kop coincide with the identities in K.

Theorem: Every category is opposite to some category:

(Kop)op = K

(67)

Reversing arrows

Given a category K, its opposite category Kop is defined as follows:

− objects: |Kop| = |K|

− morphisms: Kop(A, B) = K(B, A) for all A, B ∈ |Kop| = |K|

− composition: given m1: A → B and m2 : B → C in Kop, that is, m1: B → A and m2: C → B in K, their composition in Kop, m1;m2 : A → C, is set to be their composition m2;m1 : C → A in K.

Theorem: The identities in Kop coincide with the identities in K.

Theorem: Every category is opposite to some category:

(Kop)op = K

(68)

Duality principle

If W is a categorical concept (notion, property, statement, . . . ) then its dual , co-W , is obtained by reversing all the morphisms in W . Example:

P (X): “for any object Y there exists a morphism f : X → Y ” co-P (X): “for any object Y there exists a morphism f : Y → X”

NOTE: co-P (X) in K coincides with P (X) in Kop.

Theorem: If a property W holds for all categories then co-W holds for all categories as well.

(69)

Duality principle

If W is a categorical concept (notion, property, statement, . . . ) then its dual, co-W, is obtained by reversing all the morphisms in W. Example:

P (X): “for any object Y there exists a morphism f : X → Y ” co-P (X): “for any object Y there exists a morphism f : Y → X”

NOTE: co-P (X) in K coincides with P (X) in Kop.

Theorem: If a property W holds for all categories then co-W holds for all categories as well.

(70)

Duality principle

If W is a categorical concept (notion, property, statement, . . . ) then its dual, co-W, is obtained by reversing all the morphisms in W. Example:

P (X): “for any object Y there exists a morphism f : X → Y ” co-P (X): “for any object Y there exists a morphism f : Y → X” NOTE: co-P (X) in K coincides with P (X) in Kop.

Theorem: If a property W holds for all categories then co-W holds for all categories as well.

(71)

Duality principle

If W is a categorical concept (notion, property, statement, . . . ) then its dual, co-W, is obtained by reversing all the morphisms in W. Example:

P (X): “for any object Y there exists a morphism f : X → Y ” co-P (X): “for any object Y there exists a morphism f : Y → X” NOTE: co-P (X) in K coincides with P (X) in Kop.

Theorem: If a property W holds for all categories then co-W holds for all categories as well.

(72)

Duality principle

If W is a categorical concept (notion, property, statement, . . . ) then its dual, co-W, is obtained by reversing all the morphisms in W. Example:

P (X): “for any object Y there exists a morphism f : X → Y ” co-P (X): “for any object Y there exists a morphism f : Y → X” NOTE: co-P (X) in K coincides with P (X) in Kop.

Theorem: If a property W holds for all categories then co-W holds for all categories as well.

(73)

Product categories

Given categories K and K0, their product K × K0 is the category defined as follows:

− objects: |K × K0| = |K| × |K0|

− morphisms: (K × K0)(hA, A0i, hB, B0i) = K(A, B) × K0(A0, B0) for all A, B ∈ |K| and A0, B0 ∈ |K0|

− composition: for hm1, m01i : hA, A0i → hB, B0i and hm2, m02i : hB, B0i → hC, C0i in K × K0, their composition in K × K0 is

hm1, m01i;hm2, m02i = hm1;m2, m01;m02i .

A



B



C



m1 -

m2 -

 

? m1;m2

(74)

Product categories

Given categories K and K0, their product K × K0 is the category defined as follows:

− objects: |K × K0| = |K| × |K0|

− morphisms: (K × K0)(hA, A0i, hB, B0i) = K(A, B) × K0(A0, B0) for all A, B ∈ |K| and A0, B0 ∈ |K0|

− composition: for hm1, m01i : hA, A0i → hB, B0i and hm2, m02i : hB, B0i → hC, C0i in K × K0, their composition in K × K0 is

hm1, m01i;hm2, m02i = hm1;m2, m01;m02i .

A



B



C



m1 - m0

m2 - m0

 

? m1;m2

Define Kn, where K is a category and n ≥ 1.

(75)

Product categories

Given categories K and K0, their product K × K0 is the category defined as follows:

− objects: |K × K0| = |K| × |K0|

− morphisms: (K × K0)(hA, A0i, hB, B0i) = K(A, B) × K0(A0, B0) for all A, B ∈ |K| and A0, B0 ∈ |K0|

− composition: for hm1, m01i : hA, A0i → hB, B0i and hm2, m02i : hB, B0i → hC, C0i in K × K0, their composition in K × K0 is

hm1, m01i;hm2, m02i = hm1;m2, m01;m02i .

A



B



C



m1 -

m2 -

 

? m1;m2

Cytaty

Powiązane dokumenty

In the previous section we used vectors to describe positions and displacements of points in space, but vectors can represent quantities other than displacements; for

We present a stability theorem of Ulam–Hyers type for K-convex set-valued functions, and prove that a set-valued function is K-convex if and only if it is K-midconvex

(For the case q = 1, this proof was also given in [11].) In fact, it shows that certain cases of Theorem (3.1) are equivalent to Doob’s results.. We end the section by deriving the

We shall now give another criterion in which we weaken the assumption on the boundary of the domain at the cost of strengthening the assumption on the mapping2. Let D ⊂ C n be a

Which famous sportsperson appears in “The Hangover”?. What is the name of the hospital where Dr Gregory

A language to further abstract away from the standard notions of univer- sal algebra, to deal with their numer- ous variants needed in foundations of computer science...

• For any signature Σ, partial Σ-algebras (as objects) and their weak homomorphisms (as morphisms) form the category PAlg(Σ).. • For any signature Σ, partial Σ-algebras (as

The common “definition” of a set as a collection of distinct objects considered as an object itself turns out to be inadequate and leads to certain paradoxes (we will discuss that