HIGHER TABLES

advertisement
HIGHER TABLES
DAVID I. SPIVAK
Let Po denote the category of finite partially ordered sets. We can consider
objects in Po as categories in which case the morphisms between the objects are
exactly the functors between corresponding categories.
Let FC denote the category of finite categories.
1. Derivation of tables
Given a functor π : T → S, define d(S) = (FCop ⇓ S) as follows. An object
in d(S) is a finite category C together with a functor σ : C → S. A morphism,
denoted
(F, F ] ) : (C, σ) → (C 0 , σ 0 )
in d(S), consists of a functor F : C 0 → C and a natural transformation F ] : (σ◦F ) →
σ 0 , as depicted in the diagram
F
/C
C0 @
@@

]
F
@@ ⇐=

@
σ

σ 0 @@

S
There is a canonical functor Γ : d(S) → Cat, defined by assigning to each
(σ : C → S) ∈ d(S) the category for which an object is a pair (r, r] ), where
r : C → T is a functor and r] : (π ◦ r) → σ is a natural transformation, as depicted in the diagram
?T




r 
π

 ]

r
⇓


/S
C
σ
A morphism (r1 , r1] ) → (r2 , r2] ) in Γ(C, σ) is a natural transformation α : r1 → r2
such that r2] ◦ α = r1] .
Let us define Γ on morphisms in dS. Given a morphism (F, F ] ) : (C, σ) →
0
(C , σ 0 ), let (r, r] ) ∈ Γ(C, σ) denote an object. Then (r ◦ F ) : C 0 → T is a functor
and we have a composition of natural transformations
r]
F]
π ◦ (r ◦ F ) = (π ◦ r) ◦ F −→ σ ◦ F −−→ σ 0 .
Together, these form a pair ((r ◦F ), (F ] ◦r] )) ∈ Γ(C 0 , σ 0 ), and we define Γ(F, F ] ) on
objects in this way. In a similar way, we define Γ(F, F ] ) for morphisms α : r1 → r2 .
This project was supported in part by the Office of Naval Research.
1
2
DAVID I. SPIVAK
Define a new category d(T ) := (Cat ↓ Γ): an object is a pair (K, σ, τ ) where
K ∈ Cat is a category, σ ∈ d(S) is an object, and τ : K → Γ(σ) is a functor; a
morphism (K, σ, τ ) → (K 0 , σ 0 , τ 0 ) consists of a functor g : K → K 0 , a map F : σ →
σ 0 in dS, and a natural transformation β : Γ(F)◦τ → τ 0 ◦g, depicted in the diagram
K
g
K0
τ
β⇓
τ0
/ Γ(σ)
F
/ Γ(σ 0 ).
Finally, define d(π) : d(T ) → d(S) by the natural projection, d(π)(K, σ, τ ) := σ.
We call d(π) the derivation of π.
Remark 1.0.1. We might call dT the category of databases on π. Be careful, though,
because these are not database states, but update diagrams. In other words if
K = {∗}, then τ : K → Γ(σ) can be identified with a pair (r, r] ), as above. That
is, it is a C-shaped diagram of tables with schema over σ. But morphisms in K
correspond to morphisms of such database states, such as unions (and deletions
going the other way), joins, projects, and selects, as long as everything has at least
as much information as required by σ.
Lemma 1.0.2. Let q : dT → (Cat × dS) denote the functor (K, σ, τ ) 7→ (K, σ).
We can recover Γ from q.
Proof. Let us first produce Γ : dS → Cat on objects. Given σ : C → S in dS, we
wish to find Γ(σ) ∈ Cat. Consider the object ({∗}, σ) ∈ (Cat × dS). The category
of sections of q over ({∗}, σ) is Γ(σ).
Example 1.0.3. Let π : U → DT denote a type specification. Let T = U and
S = DT. Then one can show that there is an equivalence of categories d(S) ∼
=
(Fin ↓ DT)op , that the functor Γ : d(S) → Sets ⊂ Cat is defined as usual, and
that there is another equivalence of categories d(T ) ∼
= Tablesπ .
Example 1.0.4. Let p : U → DT denote a type specification. Define S = d(DT) ∼
=
Sch(p)op , T = d(U ) ∼
= Tablesp , and π = d(p) : Tables → Sch(p)op . We wish to
investigate dπ : dT → dS.
An object σ : C → S of dS is a finite diagram of schema. For example, σ could
be a finite set of schema. Then Γ(σ) is the category of σ-shaped diagrams of tables,
where the tables do not have to be the exact shape specified by σ: they must have
at least that much info – they come equipped with a natural transformation to
tables on σ.
2. Comparison
There is a natural functor ϕ : S → dS defined by sending an object s ∈ S to
ϕ(s) := ({∗} 7→ s)
HIGHER TABLES
3
in dS = (Catop ⇓ S). A morphism f : s → s0 in S defines a morphism ϕ(f ) : ϕ(s) →
ϕ(s0 ) as depicted in the diagram
{∗}
id{∗}
/ {∗}
AA
}
f
AA
}
AA ⇐= }}}
} s
s0 AA
~}}
S
3. To do
• Do Γ → dΓ and T → dT . Then write out the “change of datatypes” functor
for these.
• Write down the definition of “topological space,” “continuous map of topological spaces,” and “category,” and show that topological spaces form a
category.
• Perhaps show something like: continuous maps from a space to R form a
ring.
• Phrase the fact that two points determine a line.
• A “vertical table” has three columns: subject-property-object (e.g. David
address Kincaid; Ralph eat carrot). These are generally considered unreadable. A “horizontal table” has lots of columns, one for each property, but
is perhaps sparse (lots of nulls). In other words, it is a simplicial database
with one simplex (and all its subsimplices).
To convert a vertical table into a horizontal table, first sort by property.
That is, for each datum in the “property” column, find the table of subjectobject pairs that has that datum. This process gives a new 2-column table:
the first column is properties and the second column is subject-object tables.
Now join these tables along their “subject” column. This gives a horizontal
table.
Except it has one problem: the columns of the horizontal table are untyped. We never used the properties to type them. Doing so requires more
thinking about the dynamics of tables.
4. Data Structures
Above, we defined for a category S a new category d(S) as
d(S) := (FCop ⇓ S).
Perhaps instead, we should create something called “data structures” wherein we
choose a category of finite categories D : C → FC and define d(S) := (Dop ⇓ S)
as above. Namely, the objects of (Dop ⇓ S) are pairs (C, σ) where C ∈ Ob(C)
and σ : D(C) → S is a functor to the (fixed) category S; the morphisms are pairs
(F, F ] ) : (C, σ) → (C 0 , σ 0 ) are diagrams
D(F )
/ D(C)
D(C 0 )
EE
z
]
EE
F
zz
⇐=
z
E
z
E
z σ
EE
σ0
" }zz
S
of categories, where F : C 0 → C is a morphism in C.
4
DAVID I. SPIVAK
The old version, defined in Section 1, is found in this new version by setting
C = FC, the category of all finite categories, and D = idFC . In the new version,
we can use any category that indexes finite categories. For example, we can create
the data-structure “list” or the data-structure “binary tree” by setting C to be the
category indexing these objects.
Definition 4.0.5. A data structure is a pair (C, D) where C is a category and
D : C → FC is a functor from C to the category of finite categories. A morphism
of data structures (C1 , D1 ) → (C2 , D2 ) consists of a pair (a, a] ) where a : C1 → C2
is a functor and a] : (D2 ◦ a) → D1 is a natural transformation, as depicted in the
diagram
/ C2
C1 D
DD
z
]
z
a
DD ⇐=
zz
D
zz D2
D1 DD
z
}z
!
Cat
a
(1)
Remark 4.0.6. It may be that the above is the opposite of the most convenient way
to define data structures. This would not change the shape of Diagram (1), but it
would now be regarded as a morphism (C2 , D2 ) → (C1 , D1 ).
Remark 4.0.7. It may be handy to require that the terminal category {∗} ∈ FC is
in the image of a data structure D : C → FC. That way, there will be a comparison
functor ϕ : S → d(S).
Given a morphism of data structures α = (a, a] ) : (C1 , D1 ) → (C2 , D2 ) as in
Definition 4.0.5, and given a category S, there is an induced map of derivations
α∗ : d1 (S) → d2 (S) defined as follows. To an object σ : D1 (C1 ) → S in d1 (S), the
functor α assigns the object
a]
σ
D2 (aC1 ) −→ D1 (C1 ) −
→S
in d2 (S). To the morphism
D1 (F )
/ D1 (C1 )
D1 (C10 )
FF
x
]
FF
F
xx
FF ⇐=
xxσ1
F
0
x
FF
x
σ1
# {xx
S
one composes with the commutative square
/ D2 (aC1 )
D2 (aC10 )
a]
D1 (C10 )
a]
F
/ D1 (C1 )
to obtain the morphism
D2 (aF )
/ D2 (aC1 )
D2 (aC10 )
GG
w
GG F ] ◦a]
ww
GG ⇐=
ww ]
G
w
0
]
GG
w σ◦a
σ ◦a
# {ww
S
HIGHER TABLES
Notation may be subject to improvement.
5
Download