SLIDE 1 Foundational, Compositional (Co)datatypes for Higher-Order Logic
Category Theory Applied to Theorem Proving Dmitriy Traytel Andrei Popescu Jasmin Blanchette
λ → ∀
=
Isabelle
β α
β=unit+α×β
SLIDE 2
Outline
Datatypes in HOL—State of the Art Bounded Natural Functors (Co)datatypes (Co)nclusion
SLIDE 3
Outline
Datatypes in HOL—State of the Art Bounded Natural Functors (Co)datatypes (Co)nclusion
SLIDE 4
Isabelle/HOL
◮ LCF philosophy
SLIDE 5
Isabelle/HOL
◮ LCF philosophy
Small inference kernel
SLIDE 6
Isabelle/HOL
◮ LCF philosophy
Small inference kernel
◮ Foundational approach
SLIDE 7
Isabelle/HOL
◮ LCF philosophy
Small inference kernel
◮ Foundational approach
Reduce high-level specifications to primitive mechanisms
SLIDE 8
Isabelle/HOL
◮ LCF philosophy
Small inference kernel
◮ Foundational approach
Reduce high-level specifications to primitive mechanisms
◮ HOL = simply typed set theory with ML-style polymorphism
SLIDE 9
Isabelle/HOL
◮ LCF philosophy
Small inference kernel
◮ Foundational approach
Reduce high-level specifications to primitive mechanisms
◮ HOL = simply typed set theory with ML-style polymorphism
Restrictive logic
SLIDE 10
Isabelle/HOL
◮ LCF philosophy
Small inference kernel
◮ Foundational approach
Reduce high-level specifications to primitive mechanisms
◮ HOL = simply typed set theory with ML-style polymorphism
Restrictive logic Weaker than ZF
SLIDE 11
Isabelle/HOL
◮ LCF philosophy
Small inference kernel
◮ Foundational approach
Reduce high-level specifications to primitive mechanisms
◮ HOL = simply typed set theory with ML-style polymorphism
Restrictive logic Weaker than ZF
SLIDE 12
◮ Datatype specification
datatype α list
=
Nil | Cons α (α list)
datatype α tree
=
Node α (α tree list)
SLIDE 13
◮ Datatype specification
datatype α list
=
Nil | Cons α (α list)
datatype α tree
=
Node α (α tree list)
◮ Primitive type definitions
New type α Representing set Existing type β
SLIDE 14
The traditional approach
Melham 1989, Gunter 1994 ◮ Fragment of ML (non-co)datatypes
SLIDE 15
The traditional approach
Melham 1989, Gunter 1994 ◮ Fragment of ML (non-co)datatypes ◮ Fixed universe for recursive types
SLIDE 16
The traditional approach
Melham 1989, Gunter 1994 ◮ Fragment of ML (non-co)datatypes ◮ Fixed universe for recursive types ◮ Simulate nested recursion by mutual recursion
datatype α list
=
Nil | Cons α (α list)
datatype α tree
=
Node α (α tree list)
SLIDE 17
The traditional approach
Melham 1989, Gunter 1994 ◮ Fragment of ML (non-co)datatypes ◮ Fixed universe for recursive types ◮ Simulate nested recursion by mutual recursion
datatype α list
=
Nil | Cons α (α list)
datatype α tree
=
Node α (α tree_list)
and
α tree_list =
Nil | Cons (α tree) (α tree_list)
SLIDE 18
The traditional approach
Melham 1989, Gunter 1994 ◮ Fragment of ML (non-co)datatypes ◮ Fixed universe for recursive types ◮ Simulate nested recursion by mutual recursion
datatype α list
=
Nil | Cons α (α list)
datatype α tree
=
Node α (α tree_list)
and
α tree_list =
Nil | Cons (α tree) (α tree_list)
◮ Implemented in Isabelle by Berghofer & Wenzel 1999
SLIDE 19 Limitations
Berghofer & Wenzel 1999
✧
✧
- 3. no non-free structures
✧
SLIDE 20 Limitations
LICS 2012
✧
✧
- 3. no non-free structures
✧
SLIDE 21 Limitations
LICS 2012
✧
✧
- 3. no non-free structures
✧
SLIDE 22 Limitations
LICS 2012
✧
✧
- 3. no non-free structures
✧
SLIDE 23 Limitations
LICS 2012
✧
✧
- 3. no non-free structures
✧
SLIDE 24
Outline
Datatypes in HOL—State of the Art Bounded Natural Functors (Co)datatypes (Co)nclusion
SLIDE 25
datatype α list
=
Nil | Cons α (α list)
codatatype α tree
=
Node α (α tree list)
SLIDE 26
datatype α list
=
Nil | Cons α (α list)
codatatype α tree
=
Node α (α tree list)
◮ P n = print n; for i = 1 to n do P (n + i);
SLIDE 27
datatype α list
=
Nil | Cons α (α list)
codatatype α tree
=
Node α (α tree list)
◮ P n = print n; for i = 1 to n do P (n + i); ◮ evaluation tree for P 2 [2] [3, 4] [4, 5, 6] [5, 6, 7, 8] ··· ··· ··· ··· [6, 7, 8, 9, 10] ··· ··· ··· ··· ··· [7, 8, 9, 10, 11, 12] ··· ··· ··· ··· ··· ··· [5, 6, 7, 8] ··· ··· ··· ···
SLIDE 28
datatype α list
=
Nil | Cons α (α list)
codatatype α tree
=
Node α (α tree list)
◮ Compositionality = no unfolding
SLIDE 29
datatype α list
=
Nil | Cons α (α list)
codatatype α tree
=
Node α (α tree fset)
◮ Compositionality = no unfolding ◮ Need abstract interface
SLIDE 30
datatype α list
=
Nil | Cons α (α list)
codatatype α tree
=
Node α (α tree fset)
◮ Compositionality = no unfolding ◮ Need abstract interface ◮ What interface?
SLIDE 31
Type constructors are not just operators on types!
SLIDE 32
The interface: bounded natural functor
type constructor F
SLIDE 33 The interface: bounded natural functor
type constructor F Fmap
SLIDE 34 The interface: bounded natural functor
type constructor F Fmap
Fset
} natural transformation
SLIDE 35 The interface: bounded natural functor
type constructor F Fmap
Fset
} natural transformation
Fbd
} infinite cardinal
SLIDE 36 The interface: bounded natural functor
type constructor F Fmap
Fset
} natural transformation
Fbd
} infinite cardinal
- BNF = type constructor + polymorphic constrants + assumptions
SLIDE 37
Type constructors are functors
Fmap : (α → α′) → (β → β′) → (α, β) F → (α′, β′) F
a1 a2 b f a1 f a2 g b
(α, β) F (α′, β′) F
Fmap f g
SLIDE 38
Type constructors are functors
Fmap : (α → α′) → (β → β′) → (α, β) F → (α′, β′) F
a1 a2 b f a1 f a2 g b
(α, β) F (α′, β′) F
Fmap f g
Fmap id id
=
id Fmap f1 f2 ◦ Fmap g1 g2
=
Fmap (f1 ◦ g1) (f2 ◦ g2)
SLIDE 39
Type constructors are containers
Fset1 : (α, β) F → α set Fset2 : (α, β) F → β set
a1 a2 b a1 a2 b
(α, β) F α set β set
Fset1 Fset2
SLIDE 40
Type constructors are containers
Fset1 : (α, β) F → α set Fset2 : (α, β) F → β set
a1 a2 b a1 a2 b
(α, β) F α set β set
Fset1 Fset2
Fset1 ◦ Fmap f1 f2
=
image f1 ◦ Fset1 Fset2 ◦ Fmap f1 f2
=
image f2 ◦ Fset2
SLIDE 41 Further BNF assumptions
∀x ∈ Fset1 z. f1 x = g1 x ∀x ∈ Fset2 z. f2 x = g2 x
Fmap f1 f2 z = Fmap g1 g2 z
SLIDE 42 Further BNF assumptions
∀x ∈ Fset1 z. f1 x = g1 x ∀x ∈ Fset2 z. f2 x = g2 x
Fmap f1 f2 z = Fmap g1 g2 z
ℵ0 ≤
Fbd
SLIDE 43 Further BNF assumptions
∀x ∈ Fset1 z. f1 x = g1 x ∀x ∈ Fset2 z. f2 x = g2 x
Fmap f1 f2 z = Fmap g1 g2 z
ℵ0 ≤
Fbd
|Fseti z| ≤
Fbd
SLIDE 44 Further BNF assumptions
∀x ∈ Fset1 z. f1 x = g1 x ∀x ∈ Fset2 z. f2 x = g2 x
Fmap f1 f2 z = Fmap g1 g2 z
ℵ0 ≤
Fbd
|Fseti z| ≤
Fbd
|(α1, α2) F| ≤ (|α1|+|α2|)Fbd
SLIDE 45 Further BNF assumptions
∀x ∈ Fset1 z. f1 x = g1 x ∀x ∈ Fset2 z. f2 x = g2 x
Fmap f1 f2 z = Fmap g1 g2 z
ℵ0 ≤
Fbd
|Fseti z| ≤
Fbd
|(α1, α2) F| ≤ (|α1|+|α2|)Fbd (F, Fmap) preserves weak pullbacks
SLIDE 46
What are bounded natural functors good for?
BNFs ...
SLIDE 47
What are bounded natural functors good for?
BNFs ...
◮ cover basic type constructors (e.g. +, ×, unit, and α → β for fixed α)
SLIDE 48
What are bounded natural functors good for?
BNFs ...
◮ cover basic type constructors (e.g. +, ×, unit, and α → β for fixed α) ◮ cover non-free type constructors (e.g. fset, cset)
SLIDE 49
What are bounded natural functors good for?
BNFs ...
◮ cover basic type constructors (e.g. +, ×, unit, and α → β for fixed α) ◮ cover non-free type constructors (e.g. fset, cset) ◮ are closed under composition
SLIDE 50
What are bounded natural functors good for?
BNFs ...
◮ cover basic type constructors (e.g. +, ×, unit, and α → β for fixed α) ◮ cover non-free type constructors (e.g. fset, cset) ◮ are closed under composition ◮ admit initial algebras (datatypes)
SLIDE 51
What are bounded natural functors good for?
BNFs ...
◮ cover basic type constructors (e.g. +, ×, unit, and α → β for fixed α) ◮ cover non-free type constructors (e.g. fset, cset) ◮ are closed under composition ◮ admit initial algebras (datatypes) ◮ admit final coalgebras (codatatypes)
SLIDE 52
What are bounded natural functors good for?
BNFs ...
◮ cover basic type constructors (e.g. +, ×, unit, and α → β for fixed α) ◮ cover non-free type constructors (e.g. fset, cset) ◮ are closed under composition ◮ admit initial algebras (datatypes) ◮ admit final coalgebras (codatatypes) ◮ are closed under initial algebras and final coalgebras
SLIDE 53
What are bounded natural functors good for?
BNFs ...
◮ cover basic type constructors (e.g. +, ×, unit, and α → β for fixed α) ◮ cover non-free type constructors (e.g. fset, cset) ◮ are closed under composition ◮ admit initial algebras (datatypes) ◮ admit final coalgebras (codatatypes) ◮ are closed under initial algebras and final coalgebras ◮ make initial algebras and final coalgebras expressible in HOL
SLIDE 54
Outline
Datatypes in HOL—State of the Art Bounded Natural Functors (Co)datatypes (Co)nclusion
SLIDE 55
From user specifications to (co)datatypes
Given
datatype α list = Nil | Cons α (α list)
SLIDE 56 From user specifications to (co)datatypes
Given
datatype α list = Nil | Cons α (α list)
- 1. Abstract to β = unit+α×β
SLIDE 57 From user specifications to (co)datatypes
Given
datatype α list = Nil | Cons α (α list)
- 1. Abstract to β = unit+α×β
- 2. Prove that (α, β) F = unit+α×β is a BNF
SLIDE 58 From user specifications to (co)datatypes
Given
datatype α list = Nil | Cons α (α list)
- 1. Abstract to β = unit+α×β
- 2. Prove that (α, β) F = unit+α×β is a BNF
- 3. Define F-algebras
SLIDE 59 From user specifications to (co)datatypes
Given
datatype α list = Nil | Cons α (α list)
- 1. Abstract to β = unit+α×β
- 2. Prove that (α, β) F = unit+α×β is a BNF
- 3. Define F-algebras
- 4. Construct initial algebra
(α list, fld : unit+α×α list → α list)
SLIDE 60 From user specifications to (co)datatypes
Given
datatype α list = Nil | Cons α (α list)
- 1. Abstract to β = unit+α×β
- 2. Prove that (α, β) F = unit+α×β is a BNF
- 3. Define F-algebras
- 4. Construct initial algebra
(α list, fld : unit+α×α list → α list)
iter : (unit+α×α list → β) → α list → β
SLIDE 61 From user specifications to (co)datatypes
Given
datatype α list = Nil | Cons α (α list)
- 1. Abstract to β = unit+α×β
- 2. Prove that (α, β) F = unit+α×β is a BNF
- 3. Define F-algebras
- 4. Construct initial algebra
(α list, fld : unit+α×α list → α list)
iter : (unit+α×α list → β) → α list → β
- 6. Prove characteristic theorems (e.g. induction)
SLIDE 62 From user specifications to (co)datatypes
Given
datatype α list = Nil | Cons α (α list)
- 1. Abstract to β = unit+α×β
- 2. Prove that (α, β) F = unit+α×β is a BNF
- 3. Define F-algebras
- 4. Construct initial algebra
(α list, fld : unit+α×α list → α list)
iter : (unit+α×α list → β) → α list → β
- 6. Prove characteristic theorems (e.g. induction)
- 7. Prove that list is a BNF
SLIDE 63 From user specifications to (co)datatypes
Given
datatype α list = Nil | Cons α (α list)
- 1. Abstract to β = unit+α×β
- 2. Prove that (α, β) F = unit+α×β is a BNF
- 3. Define F-algebras
- 4. Construct initial algebra
(α list, fld : unit+α×α list → α list)
iter : (unit+α×α list → β) → α list → β
- 6. Prove characteristic theorems (e.g. induction)
- 7. Prove that list is a BNF (enables nested recursion)
SLIDE 64 From user specifications to (co)datatypes
Given
codatatype α llist = LNil | LCons α (α llist)
- 1. Abstract to β = unit+α×β
- 2. Prove that (α, β) F = unit+α×β is a BNF
- 3. Define F-coalgebras
- 4. Construct final coalgebra
(α llist, unf : α llist → unit+α×α llist)
coiter : (β → unit+α×α llist) → β → α llist
- 6. Prove characteristic theorems (e.g. coinduction)
- 7. Prove that llist is a BNF (enables nested corecursion)
SLIDE 65
Induction
β = (α, β) F
◮ Given ϕ : α IF → bool
SLIDE 66
Induction
β = (α, β) F
◮ Given ϕ : α IF → bool ◮ Abstract induction principle
∀z. (∀x ∈ Fset2 z. ϕ x) ⇒ ϕ (fld z) ∀x. ϕ x
SLIDE 67 Induction
β = unit+α×β
◮ Given ϕ : α IF → bool ◮ Abstract induction principle
∀z. (∀x ∈ Fset2 z. ϕ x) ⇒ ϕ (fld z) ∀x. ϕ x
◮ Given ϕ : α list → bool ◮ Case distinction on z
(∀ys ∈ /
- 0. ϕ ys) ⇒ ϕ (fld (Inl ()))
∀x xs.(∀ys ∈ {xs}. ϕ ys) ⇒ ϕ (fld (Inr (x, xs)))
∀xs. ϕ xs
SLIDE 68
Induction
β = unit+α×β
◮ Given ϕ : α IF → bool ◮ Abstract induction principle
∀z. (∀x ∈ Fset2 z. ϕ x) ⇒ ϕ (fld z) ∀x. ϕ x
◮ Given ϕ : α list → bool ◮ Concrete induction principle
ϕ (fld (Inl ())) ∀x xs. ϕ xs ⇒ ϕ (fld (Inr (x, xs)))
∀xs. ϕ xs
SLIDE 69
Induction
β = unit+α×β
◮ Given ϕ : α IF → bool ◮ Abstract induction principle
∀z. (∀x ∈ Fset2 z. ϕ x) ⇒ ϕ (fld z) ∀x. ϕ x
◮ Given ϕ : α list → bool ◮ In constructor notation
ϕ Nil ∀x xs. ϕ xs ⇒ ϕ (Cons x xs)
∀xs. ϕ xs
SLIDE 70
Induction & Coinduction
β = (α, β) F
◮ Given ϕ : α IF → bool ◮ Abstract induction principle
∀z. (∀x ∈ Fset2 z. ϕ x) ⇒ ϕ (fld z) ∀x. ϕ x
◮ Given ψ : α JF → α JF → bool
SLIDE 71
Induction & Coinduction
β = (α, β) F
◮ Given ϕ : α IF → bool ◮ Abstract induction principle
∀z. (∀x ∈ Fset2 z. ϕ x) ⇒ ϕ (fld z) ∀x. ϕ x
◮ Given ψ : α JF → α JF → bool ◮ Abstract coinduction principle
∀x y. ψ x y ⇒ Fpred Eq ψ (unf x) (unf y) ∀x y. ψ x y ⇒ x = y
SLIDE 72
Example
codatatype α tree = Node (lab: α) (sub: α tree fset)
SLIDE 73
Example
codatatype α tree = Node (lab: α) (sub: α tree fset) corec tmap : (α → β) → α tree → β tree where
lab (tmap f t)
=
f (lab t) sub (tmap f t)
=
image (tmap f) (sub t)
SLIDE 74
Example
codatatype α tree = Node (lab: α) (sub: α tree fset) corec tmap : (α → β) → α tree → β tree where
lab (tmap f t)
=
f (lab t) sub (tmap f t)
=
image (tmap f) (sub t)
lemma tmap (f ◦ g) t = tmap f (tmap g t)
SLIDE 75
Example
codatatype α tree = Node (lab: α) (sub: α tree fset) corec tmap : (α → β) → α tree → β tree where
lab (tmap f t)
=
f (lab t) sub (tmap f t)
=
image (tmap f) (sub t)
lemma tmap (f ◦ g) t = tmap f (tmap g t)
by (intro tree_coinduct[where ψ=λt1 t2.∃t. t1=tmap (f◦g) t ∧ t2=tmap f (tmap g t)]) force+
SLIDE 76
Outline
Datatypes in HOL—State of the Art Bounded Natural Functors (Co)datatypes (Co)nclusion
SLIDE 77
Foundational, Compositional (Co)datatypes for Higher-Order Logic
Category Theory Applied to Theorem Proving
SLIDE 78
Foundational, Compositional (Co)datatypes for Higher-Order Logic
Category Theory Applied to Theorem Proving ◮ Framework for defining types in HOL
SLIDE 79
Foundational, Compositional (Co)datatypes for Higher-Order Logic
Category Theory Applied to Theorem Proving ◮ Framework for defining types in HOL ◮ Characteristic theorems are derived, not stated as axioms
SLIDE 80
Foundational, Compositional (Co)datatypes for Higher-Order Logic
Category Theory Applied to Theorem Proving ◮ Framework for defining types in HOL ◮ Characteristic theorems are derived, not stated as axioms ◮ Mutual and nested combinations of (co)datatypes and custom BNFs
SLIDE 81
Foundational, Compositional (Co)datatypes for Higher-Order Logic
Category Theory Applied to Theorem Proving ◮ Framework for defining types in HOL ◮ Characteristic theorems are derived, not stated as axioms ◮ Mutual and nested combinations of (co)datatypes and custom BNFs ◮ Adapt insights from category theory to HOL
’s restrictive type system
SLIDE 82
Foundational, Compositional (Co)datatypes for Higher-Order Logic
Category Theory Applied to Theorem Proving ◮ Framework for defining types in HOL ◮ Characteristic theorems are derived, not stated as axioms ◮ Mutual and nested combinations of (co)datatypes and custom BNFs ◮ Adapt insights from category theory to HOL
’s restrictive type system
◮ Formalized & implemented in Isabelle/HOL
SLIDE 83
Foundational, Compositional (Co)datatypes for Higher-Order Logic
Category Theory Applied to Theorem Proving ◮ Framework for defining types in HOL ◮ Characteristic theorems are derived, not stated as axioms ◮ Mutual and nested combinations of (co)datatypes and custom BNFs ◮ Adapt insights from category theory to HOL
’s restrictive type system
◮ Formalized & implemented in Isabelle/HOL
Thank you for your attention!
SLIDE 84 Foundational, Compositional (Co)datatypes for Higher-Order Logic
Category Theory Applied to Theorem Proving Dmitriy Traytel Andrei Popescu Jasmin Blanchette
λ → ∀
=
Isabelle
β α
β=unit+α×β
SLIDE 85
Outline
Backup slides
SLIDE 86 Type constructors act on sets
(A1, A2) F = {z | Fset1 z ⊆ A1 ∧ Fset2 z ⊆ A2}
a1 a2 b
a1 a2 b a2 a1 b
Action of F
A1 : α set A2 : β set
(A1, A2) F : (α, β) F set
SLIDE 87 Type constructors act on sets
(A1, A2) F = {z | Fset1 z ⊆ A1 ∧ Fset2 z ⊆ A2}
a1 a2 b
a1 a2 b a2 a1 b
Action of F
A1 : α set A2 : β set
(A1, A2) F : (α, β) F set (∀i ∈ {1, 2}. ∀x ∈ Fseti z. fi x = gi x) ⇒
Fmap f1 f2 z = Fmap g1 g2 z
SLIDE 88
Type constructors are bounded
Fbd: infinite cardinal
a1 a2 b a1 a2 b
(α, β) F α set β set
Fset1 Fset2
SLIDE 89
Type constructors are bounded
Fbd: infinite cardinal
a1 a2 b a1 a2 b
(α, β) F α set β set
Fset1 Fset2
|Fseti z| ≤
Fbd
SLIDE 90 Type constructors are bounded
Fbd: infinite cardinal
a1 a2 b a1 a2 b
(α, β) F α set β set
Fset1 Fset2 a1 a2 b
a1 a2 b a2 a1 b
Action of F
A1 : α set A2 : β set
(A1, A2) F : (α, β) F set |Fseti z| ≤
Fbd
SLIDE 91 Type constructors are bounded
Fbd: infinite cardinal
a1 a2 b a1 a2 b
(α, β) F α set β set
Fset1 Fset2 a1 a2 b
a1 a2 b a2 a1 b
Action of F
A1 : α set A2 : β set
(A1, A2) F : (α, β) F set |Fseti z| ≤
Fbd
|(A1, A2) F| ≤ (|A1|+|A2|+ 2)Fbd
SLIDE 92
Algebras, Coalgebras & Morphisms
β = (α, β) F
A
(α, A) F
s
SLIDE 93
Algebras, Coalgebras & Morphisms
β = (α, β) F
A
(α, A) F
s A B
(α, A) F (α, B) F
f sB sA Fmap id f
SLIDE 94
Algebras, Coalgebras & Morphisms
β = (α, β) F
A
(α, A) F
s A B
(α, A) F (α, B) F
f sB sA Fmap id f A
(α, A) F
s
SLIDE 95
Algebras, Coalgebras & Morphisms
β = (α, β) F
A
(α, A) F
s A B
(α, A) F (α, B) F
f sB sA Fmap id f A
(α, A) F
s A B
(α, A) F (α, B) F
f sB sA Fmap id f
SLIDE 96
Initial Algebras & Final Coalgebras
β = (α, β) F
weakly initial: exists morphism to any other algebra initial: exists unique morphism to any other algebra weakly final: exists morphism from any other coalgebra final: exists unique morphism from any other coalgebra
SLIDE 97 Initial Algebras & Final Coalgebras
β = (α, β) F
weakly initial: exists morphism to any other algebra initial: exists unique morphism to any other algebra weakly final: exists morphism from any other coalgebra final: exists unique morphism from any other coalgebra
◮ Product of all algebras is weakly initial ◮ Suffices to consider algebras over types
◮ Minimal subalgebra of weakly initial algebra is initial
SLIDE 98 Initial Algebras & Final Coalgebras
β = (α, β) F
weakly initial: exists morphism to any other algebra initial: exists unique morphism to any other algebra weakly final: exists morphism from any other coalgebra final: exists unique morphism from any other coalgebra
◮ Product of all algebras is weakly initial ◮ Suffices to consider algebras over types
◮ Minimal subalgebra of weakly initial algebra is initial ◮ Construct minimal subalgebra from below by transfinite recursion
⇒ Have a bound for its cardinality
⇒ (α IF, fld : (α, α IF) F → α IF)
SLIDE 99 Initial Algebras & Final Coalgebras
β = (α, β) F
weakly initial: exists morphism to any other algebra initial: exists unique morphism to any other algebra weakly final: exists morphism from any other coalgebra final: exists unique morphism from any other coalgebra
◮ Product of all algebras is weakly initial ◮ Suffices to consider algebras over types
◮ Minimal subalgebra of weakly initial algebra is initial ◮ Construct minimal subalgebra from below by transfinite recursion
⇒ Have a bound for its cardinality
⇒ (α IF, fld : (α, α IF) F → α IF)
◮ Sum of all coalgebras is weakly final ◮ Suffices to consider coalgebras over types of certain cardinality ◮ Quotient of weakly final coalgebra to the greatest bisimulation is final
SLIDE 100 Initial Algebras & Final Coalgebras
β = (α, β) F
weakly initial: exists morphism to any other algebra initial: exists unique morphism to any other algebra weakly final: exists morphism from any other coalgebra final: exists unique morphism from any other coalgebra
◮ Product of all algebras is weakly initial ◮ Suffices to consider algebras over types
◮ Minimal subalgebra of weakly initial algebra is initial ◮ Construct minimal subalgebra from below by transfinite recursion
⇒ Have a bound for its cardinality
⇒ (α IF, fld : (α, α IF) F → α IF)
◮ Sum of all coalgebras is weakly final ◮ Suffices to consider coalgebras over types of certain cardinality ◮ Quotient of weakly final coalgebra to the greatest bisimulation is final ◮ Use concrete weakly final coalgebra (elements are tree-like structures)
⇒ Have a bound for its cardinality
⇒ (α JF, unf : α JF → (α, α JF) F)
SLIDE 101
Iteration & Coiteration
β = (α, β) F
◮ Given s : (α, β) F → β
SLIDE 102
Iteration & Coiteration
β = (α, β) F
◮ Given s : (α, β) F → β ◮ Obtain unique morphism iter s
from (α IF, fld) to (Uβ, s)
α IF β (α, α IF) F (α, β) F
iter s s fld Fmap id (iter s)
SLIDE 103
Iteration & Coiteration
β = (α, β) F
◮ Given s : (α, β) F → β ◮ Obtain unique morphism iter s
from (α IF, fld) to (Uβ, s)
α IF β (α, α IF) F (α, β) F
iter s s fld Fmap id (iter s)
◮ Given s : β → (α, β) F
SLIDE 104
Iteration & Coiteration
β = (α, β) F
◮ Given s : (α, β) F → β ◮ Obtain unique morphism iter s
from (α IF, fld) to (Uβ, s)
α IF β (α, α IF) F (α, β) F
iter s s fld Fmap id (iter s)
◮ Given s : β → (α, β) F ◮ Obtain unique morphism coiter s
from (Uβ, s) to (α JF, unf)
α IF β (α, α IF) F (α, β) F
coiter s s unf Fmap id (coiter s)
SLIDE 105 Preservation of BNF Properties
β = (α, β) F
◮ IFmap f = iter (fld ◦ Fmap f id) ◮ IFset = iter collect, where
collect z=Fset1 z ∪
SLIDE 106 Preservation of BNF Properties
β = (α, β) F
◮ IFmap f = iter (fld ◦ Fmap f id) ◮ IFset = iter collect, where
collect z=Fset1 z ∪
Theorem (IF, IFmap, IFset, 2Fbd) is a BNF
SLIDE 107 Preservation of BNF Properties
β = (α, β) F
◮ IFmap f = iter (fld ◦ Fmap f id) ◮ IFset = iter collect, where
collect z=Fset1 z ∪
Theorem (IF, IFmap, IFset, 2Fbd) is a BNF
◮ JFmap f = coiter (Fmap f id ◦ unf) ◮ JFset x =
i∈N
collecti x, where collect0 x=/ collecti+1 x=Fset1 (unf x)∪
collecti y
SLIDE 108 Preservation of BNF Properties
β = (α, β) F
◮ IFmap f = iter (fld ◦ Fmap f id) ◮ IFset = iter collect, where
collect z=Fset1 z ∪
Theorem (IF, IFmap, IFset, 2Fbd) is a BNF
◮ JFmap f = coiter (Fmap f id ◦ unf) ◮ JFset x =
i∈N
collecti x, where collect0 x=/ collecti+1 x=Fset1 (unf x)∪
collecti y
Theorem (JF, JFmap, JFset, FbdFbd) is a BNF