Database Reference
In-Depth Information
•
TA
is a
type of computations
(i.e. observations of the object of values
A
(of a
type
A
), which are the views of the database
A
).
•
η
A
is the
inclusion
of values into computations (i.e., inclusion of elements of
the database
A
into the set of views of the database
A
). It is an isomorphism
η
A
=
is
A
:
−→
A
TA
in the
DB
category.
f
∗
is the
equivalent extension
of a database mapping
f
•
TB
“from values
to computations” (programs correspond to call-by-value parameter passing) to a
mapping “from computations to computations” (programs correspond to call-by-
name) such that
f
∗
=
Tf
=
f
◦
η
−
A
=
f
◦
:
A
−→
is
−
A
and, consequently,
f
∗
≈
f
. Thus,
in the
DB
category, the call-by-value (
f
:
A
−→
TB
) and call-by-name (
f
∗
:
TA
−→
TB
) paradigms of programs are represented by
equivalent
morphisms,
f
≈
f
∗
.
Notice that in skeletal category
DB
sk
(which is equivalent to
DB
)allmor-
phisms correspond to the call-by-name paradigm because each arrow is a map-
ping from computations into computations (which are closed objects).
However, in our case, the Kleisli category is a perfect model only for a sub-
set of database mappings in
DB
: exactly for every view-mapping (i.e., query)
q
A
:
A
−→
TA
which is just an arrow in Kleisli category
θ(q
A
)
:
A
−→
A
.For
a general database mapping
f
:
A
−→
B
in
DB
, only its (equivalent to
f
) “compu-
tation extension”
η
B
◦
f
:
A
−→
TB
is an arrow
θ(η
B
◦
f)
:
A
−→
B
in the Kleisli
category.
Consequently, the Kleisli category is a model for the database mappings up to
the equivalence “
”.
It means that, generally, the database mappings are not simply programs from
values into computations. In fact, the semantics of a database mapping, between any
two objects
A
and
B
, is equal to telling that for some set of computations (i.e, query-
mappings) over
A
we have the same equivalent (in the sense that these programs
produce the same computed value, i.e., a view) set of computations (i.e., query-
mappings) over
B
: it is fundamentally an
equivalence
of computations.
This is a consequence of the fact that each database mapping (which is
a set of
functions
) from
A
into
B
is naturally bidirectional, i.e., a morphism
f
≈
:
−→
A
B
is equivalent to its inverted morphism
f
OP
:
−→
B
A
(explained by the duality
DB
OP
[
16
]).
Let us define this equivalence formally:
property
DB
=
Definition 60
Each simple database mapping
h
:
A
−→
B
defines an equiv-
alence of programs (
DB
epimorphisms),
h
A
τ(J(h))
:
A
TH
and
h
B
τ
−
1
(J(h))
OP
:
B
TH
, where
τ
and
τ
−
1
are natural transformations of the cate-
gorial symmetry in Theorem
4
, and
H
is the kernel (in Definition
13
)oftheinfor-
mation flux
h
(i.e.,
TH
=
h
).
Hence,
h
A
≈
h
≈
h
B
, such that the computations of these two programs (i.e., ar-
rows of Kleisli category
DB
T
) are equal, that is,
∂
1
(h
A
)
∂
1
(h
B
)
. We can also give
an alternative model for the equivalent computational extensions of the database
mappings in
DB
category:
=