Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sgdt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
gradual-typing
sgdt
Commits
aa3a1c79
Commit
aa3a1c79
authored
1 year ago
by
Eric Giovannini
Browse files
Options
Downloads
Patches
Plain Diff
work on abstract model constructions
parent
6f4e6e61
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
paper-new/appendix.tex
+130
-47
130 additions, 47 deletions
paper-new/appendix.tex
paper-new/categorical-model.tex
+3
-3
3 additions, 3 deletions
paper-new/categorical-model.tex
with
133 additions
and
50 deletions
paper-new/appendix.tex
+
130
−
47
View file @
aa3a1c79
...
...
@@ -69,74 +69,157 @@ of an extensional model of gradual typing starting from a step-1 intensional mod
In this section, we provide the details for each of the constructions mentioned there.
\begin{lemma}
\label
{
lem:step-1-model-to-step-2-model
}
Let
$
\mathcal
M
$
be a
\hyperref
[def:step-1-model]
{
step-1 intensional model
}
.
Suppose we are given the following data:
Let
$
\mathcal
M
$
be a
\hyperref
[def:step-1-model]
{
step-1 intensional model
}
with dyn.
\begin{enumerate}
\item
For each value type
$
A
$
, a monoid
$
\pv
_
A
$
and homomorphism
\[
\ptbv
_
A :
\pv
_
A
\to
\{
f
\in
\vf
(
A,A
)
\mid
f
\bisim
\id
\}
\]
Then we can construct a
\hyperref
[def:step-2-model]
{
step-2 intensional model
}
with dyn.
\end{lemma}
\begin{proof}
% Write
% %
% \[ \mathcal M = (\vf, \vsq, \ef, \esq, \Ff, \Fsq, \Uf, \Usq, \arrf, \arrsq). \]
% %
\item
For each computation type
$
B
$
, a monoid
$
\pv
_
B
$
and homomorphism
\[
\ptbe
_
B :
\pe
_
B
\to
\{
g
\in
\ef
(
B,B
)
\mid
g
\bisim
\id
\}
\]
Define a step-2 model
$
\mathcal
M'
$
as follows:
\begin{itemize}
\item
Value objects are tuples consisting of:
\begin{itemize}
\item
A value object
$
A
$
in
$
\vf
$
\item
A monoid of ``pure'' perturbations
$
P
_
A
$
\item
A homomorphism of monoids
$
\ptb
_
A : P
_
A
\to
\{
f
\in
\vf
(
A, A
)
\mid
f
\bisim
\id
_
A
\}
$
\item
A monoid of ``impure'' perturbations
$
P
^
K
_
A
$
that contains a distinguished element
$
\delta
^
*
$
\item
A homomorphism of monoids
$
\ptbk
_
A : P
^
K
_
A
\to
\{
\phi
\in
\ef
(
FA, FA
)
\mid
\phi
\bisim
\id
_{
FA
}
\}
$
such that
$
\ptbk
_
A
(
\delta
^
*)
=
\delta
_
A
^
*
$
\end{itemize}
\item
Computation objects are tuples consisting of:
\begin{itemize}
\item
A computation object
$
B
$
in
$
\ef
$
\item
A monoid of ``pure'' perturbations
$
P
_
B
$
\item
A homomorphism of monoids
$
\ptb
_
B : P
_
B
\to
\{
\phi
\in
\ef
(
B, B
)
\mid
\phi
\bisim
\id
_
B
\}
$
\item
A monoid of ``impure'' perturbations
$
P
^
K
_
B
$
\item
A homomorphism of monoids
$
\ptbk
_
B : P
^
K
_
B
\to
\{
g
\in
\vf
(
UB, UB
)
\mid
g
\bisim
\id
_{
UB
}
\}
$
.
\end{itemize}
\item
Morphisms are given by morphisms of the underlying objects in
$
\vf
$
and
$
\ef
$
, respectively
%, i.e.,
% \[ \vf'((A, P_A, \ptb_A, P^K_A, \ptbk_A), (A', P_{A'}, \ptb_{A'}, P^K_{A'}, \ptbk_{A'})) = \vf(A, A') \]
%
% and likewise for computations.
\end{itemize}
\item
For each value type
$
A
$
, a distinguished endomorphism
$
\delta
_
A
\in
\ef
(
FA, FA
)
$
such that
$
\delta
_
A
\bisim
\id
_{
FA
}$
.
\end{enumerate}
Before introducing the relations, we make a definition.
Then we can construct a
\hyperref
[def:step-2-model]
{
step-2 intensional model
}
.
\end{lemma}
\begin{proof}
Write
%
\[
\mathcal
M
=
(
\vf
,
\vsq
,
\ef
,
\esq
,
\Ff
,
\Fsq
,
\Uf
,
\Usq
,
\arrf
,
\arrsq
)
.
\]
%
Define a step-2 model as follows:
\begin{definition}
[push-pull structure]
Let
$
c : A
\rel
A'
$
be a value relation of
$
\mathcal
M
$
. A
\emph
{
value push-pull structure
}
$
\piv
_
c
$
for
$
c
$
consists of:
\begin{itemize}
\item
A function
$
\push
: P
_
A
\to
P
_{
A'
}$
such that for all
$
\delta
^
l
\in
P
_
A
$
we have
$
\delta
^
l
\ltdyn
_
c
^
c
\push
(
\delta
^
l
)
$
.
\item
A function
$
\push
^
K : P
^
K
_
A
\to
P
^
K
_{
A'
}$
such that for all
$
\delta
^
K
_
l
\in
P
^
K
_
A
$
we have
$
\delta
^
K
_
l
\ltdyn
_{
Fc
}^{
Fc
}
\push
(
\delta
^
K
_
l
)
$
.
\item
A function
$
\pull
: P
_{
A'
}
\to
P
_
A
$
such that for all
$
\delta
_
r
\in
P
_{
A'
}$
we have
$
\pull
(
\delta
^
r
)
\ltdyn
_{
c
}^
c
\delta
^
r
$
.
\item
A function
$
\pull
^
K : P
^
K
_{
A'
}
\to
P
^
K
_
A
$
such that for all
$
\delta
^
K
_
r
\in
P
^
K
_{
A'
}$
we have
$
\pull
(
\delta
^
K
_
r
)
\ltdyn
_{
Fc
}^{
Fc
}
\delta
^
K
_
r
$
.
\end{itemize}
For
$
d : B
\rel
B'
$
a computation relation, we define a
\emph
{
computation push-pull structure
}
$
\pie
_
d
$
for
$
d
$
in an analogous manner.
\end{definition}
Now we continue with the description of the construction:
\begin{itemize}
\item
Value objects are tuples of an object
$
A
$
in
$
\vf
$
along with the monoid
$
\pv
_
A
$
and homomorphism
$
\ptbv
_
A
$
:
$
\ob
(
\vf
'
)
=
\{
(
A,
\pv
_
A,
\ptbv
_
A
)
\mid
A
\in
\ob
(
\vf
)
\}
$
.
\item
Morphisms are given by morphisms of the underlying objects in
$
\vf
$
, i.e.,
$
\vf
'
((
A,
\pv
_
A,
\ptbv
_
A
)
,
(
A',
\pv
_{
A'
}
,
\ptbv
_{
A'
}
))
=
\vf
(
A, A'
)
$
.
\item
Computation objects are tuples
$
\ob
(
\ef
'
)
=
\{
(
B,
\pe
_
B,
\ptbe
_
B
)
\mid
B
\in
\ob
(
\ef
)
\}
$
.
\item
Computation morphisms are
$
\ef
'
((
B,
\pv
_
B,
\ptbv
_
B
)
,
(
B',
\pv
_{
B'
}
,
\ptbv
_{
B'
}
))
=
\ef
(
B, B'
)
$
.
\item
The objects
$
\vsq
'
$
and
$
\esq
'
$
are the same as those of
$
\vsq
$
and
$
\esq
$
.
\item
The morphisms of
$
\vsq
'
$
and
$
\esq
'
$
are the same as those of
$
\vsq
$
and
$
\esq
$
.
% \item $\ob(\vsq') = \ob(\vsq)$
% \item $\ob(\esq') = \ob(\esq)$
% \item $\vsq'(c, c') = \vsq(c, c')$
% \item $\esq'(d, d') = \esq(d, d')$
\item
The objects of
$
\vsq
'
$
(i.e., the value relations) are pairs consisting of:
\begin{itemize}
\item
A value relation
$
c
\in
\vsq
$
\item
A push-pull structure
$
\piv
_
c
$
for
$
c
$
\end{itemize}
The objects of
$
\esq
'
$
are defined analogously.
\item
The morphisms of
$
\vsq
'
$
and
$
\esq
'
$
are given by the morphisms of
$
\vsq
$
and
$
\esq
$
.
% Functors \times, +, F, U, arrow
\item
We define
$
F
$
on objects by
$
F
(
A,
\pv
_
A,
\ptbv
_
A
)
=
(
FA,
(
1
+
\pv
_
A
)
, h
_
F
)
$
where
$
1
$
is the trivial monoid,
$
+
$
is the coproduct in the category of monoids, and
$
h
_
F
$
is the homomorphism defined as follows:
% \item We define $F$ on objects by $F (A, \pv_A, \ptbv_A) = (FA, (1 + \pv_A), h_F)$
% where $1$ is the trivial monoid, $+$ is the coproduct in the category of monoids, and $h_F$ is the homomorphism defined as follows:
\item
We define
$
U
$
on objects by
$
U
(
B,
\pe
_
B,
\ptbe
_
B
)
=
(
UB,
\pe
_
B, h
_
U
)
$
where
$
h
_
U
(
p
_
B
)
=
U
(
\ptbe
_
B
(
p
_
B
))
$
.
%
\item We define $U$ on objects by $U (B, \pe_B, \ptbe_B) = (UB, \pe_B, h_U)$
%
where $h_U(p_B) = U(\ptbe_B(p_B))$.
\item
We define
$
(
A,
\pv
_
A,
\ptbv
_
A
)
\arr
(
B,
\pe
_
B,
\ptbe
_
B
)
=
(
A
\arr
B,
\pv
_
A
\times
\pe
_
B, h
_
\arr
)
$
where
$
\times
$
is the product in the category of monoids, and
$
h
_
\arr
$
is defined by
$
h
_
\arr
(
p
_
A, p
_
B
)
=
\ptbv
_
A
(
p
_
A
)
\arr
\ptbe
_
B
(
p
_
B
)
$
.
%
\item We define $(A, \pv_A, \ptbv_A) \arr (B, \pe_B, \ptbe_B) = (A \arr B, \pv_A \times \pe_B, h_\arr)$
%
where $\times$ is the product in the category of monoids, and $h_\arr$ is defined by
%
$h_\arr(p_A, p_B) = \ptbv_A(p_A) \arr \ptbe_B(p_B)$.
\end{itemize}
\end{proof}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{lemma}
\label
{
lem:step-2-model-to-step-3-model
}
Let
$
\mathcal
M
$
be a
\hyperref
[def:step-2-model]
{
step-2 intensional model
}
.
Suppose we are given the following data:
Let
$
\mathcal
M
$
be a
\hyperref
[def:step-2-model]
{
step-2 intensional model
}
.
Then we can construct a
\hyperref
[def:step-3-model]
{
step-3 intensional model
}
.
Then we can construct a
\hyperref
[def:step-3-model]
{
step-3 intensional model
}
.
\end{lemma}
\begin{proof}
Write
%
\[
\mathcal
M
=
(
\vf
,
\vsq
,
\ef
,
\esq
,
\Ff
,
\Fsq
,
\Uf
,
\Usq
,
\arrf
,
\arrsq
)
.
\]
%
We begin with a definition.
\begin{definition}
[representation structure]
Let
$
c : A
\rel
A'
$
be a value relation. A
\emph
{
left-representation structure
}
$
\rho
^
L
_
c
$
for
$
c
$
consists of
a value morphism
$
e
_
c
\in
\vf
(
A, A'
)
$
such that
$
c
$
is quasi-left-representable by
$
e
_
c
$
(see Definition
\ref
{
def:quasi-left-representable
}
).
Likewise, let
$
d : B
\rel
B'
$
. A
\emph
{
right-representation structure
}
$
\rho
^
R
_
d
$
for
$
d
$
consists of
a computation morphism
$
p
_
d
\in
\ef
(
B', B
)
$
such that
$
d
$
is quasi-right-representable by
$
p
_
d
$
(see Definition
\ref
{
def:quasi-right-representable
}
).
\end{definition}
(Notice that the direction of the morphism is opposite in the definition of right-representation structure.)
We define a step-3 model
$
\mathcal
M'
$
as follows:
\begin{itemize}
\item
The objects of
$
\mathcal
M'
$
are defined to be the same as the objects of
$
\mathcal
M
$
.
\item
The value and computation morphisms in
$
\mathcal
M'
$
are the same as those of
$
\mathcal
M
$
.
\item
A value relation is defined to be a tuple
$
(
c,
\rho
^
L
_
c,
\rho
^
R
_{
Fc
}
)
$
where:
\begin{itemize}
\item
$
c
$
is a value relation in
$
\mathcal
M
$
, and
\item
$
\rho
^
L
_
c
$
a left-representation structure for
$
c
$
, and
\item
$
\rho
^
R
_{
Fc
}$
a right-representation structure for
$
Fc
$
.
\end{itemize}
\item
Likewise, a computation relation is defined to be a tuple
$
(
d,
\rho
^
R
_
d,
\rho
^
L
_{
Ud
}
)
$
with
\begin{itemize}
\item
$
d
$
a computation relation in
$
\mathcal
M
$
\item
$
\rho
^
R
_
d
$
a right-representation structure for
$
d
$
\item
$
\rho
^
L
_{
Ud
}$
a left-representation structure for
$
Ud
$
\end{itemize}
\item
Morphisms of value relations (i.e., the value squares) are defined by simply
ignoring the representation structures. That is, a morphism of value relations
$
\alpha
\in
\vsq
'
((
c,
\rho
^
L
_
c,
\rho
^
R
_{
Fc
}
)
,
(
c'
\rho
^
L
_{
c'
}
,
\rho
^
R
_{
Fc'
}
))
$
is simply a morphism of value
relations in
$
\vsq
(
c, c'
)
$
. Likewise for computations.
\end{itemize}
\end{proof}
% Now we define the functors $F$, $U$, $\times$, and $\arr$.
% On objects, the behavior is the same as the respective functors in $\mathcal M$.
% For relations, we define
% $\Fsq' (c, \rho^L_c, \rho^R_{Fc}) = (\Fsq c, \rho^R_{Fc}, UF(\rho^L_c))$ and
% $\Usq' (d, \rho^R_d, \rho^L_{Ud}) = (\Usq d, \rho^L_{Ud}, FU(\rho^R_d))$.
% We define $(c, \rho^L_c) \arr (d, \rho^R_d) = (c \arr d, \rho^R_{c \arr d})$.
% We now verify that the construction meets the requirements of a step-3 model.
% First, we check that composition of value relations (resp. computation relations)
% is well-defined.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
...
...
This diff is collapsed.
Click to expand it.
paper-new/categorical-model.tex
+
3
−
3
View file @
aa3a1c79
...
...
@@ -445,7 +445,7 @@ The judgment $\gamma : f \bisim_{A_i, A_o} f'$ is defined to mean:
\end{enumerate}
Lastly, we require that for any value object
$
A
$
, the hom-set
$
\ef
(
FA, FA
)
$
contains a
distinguished morphism
$
\delta
_
A
$
, such that
$
\delta
_
A
\bisim
_{
FA, FA
}
\id
_{
FA
}$
.
distinguished morphism
$
\delta
_
A
^
*
$
, such that
$
\delta
_
A
^
*
\bisim
_{
FA, FA
}
\id
_{
FA
}$
.
% Spelling this all out concretely, for any pair...
...
...
@@ -453,7 +453,7 @@ distinguished morphism $\delta_A$, such that $\delta_A \bisim_{FA, FA} \id_{FA}$
\begin{definition}
\label
{
def:step-1-model
}
A
\emph
{
step-1 intensional model
}
consists of all the data of a step-0 intensional model along
with the additional categories and functors for bisimiarity described above, as well as
the existence of a distinguised computation morphism
$
\delta
_
A
\bisim
\id
_{
FA
}$
for each
$
A
$
.
the existence of a distinguised computation morphism
$
\delta
_
A
^
*
\bisim
\id
_{
FA
}$
for each
$
A
$
.
\end{definition}
\subsubsection
{
Perturbations
}
\label
{
sec:abstract-model-perturbations
}
...
...
@@ -473,7 +473,7 @@ $\delta$ to refer to the morphism $\ptbv_A(\delta) \in \vf(A,A)$, and likewise
for computation perturbations. The context will make clear whether we are referring
to an element of the perturbation monoid or the corresponding morphism.
We require that
$
\delta
_
A
\in
\pe
_{
FA
}$
for all
$
A
$
, where
$
\delta
_
A
$
is the distinguished
We require that
$
\delta
_
A
^
*
\in
\pe
_{
FA
}$
for all
$
A
$
, where
$
\delta
_
A
^
*
$
is the distinguished
morphism that is required to be present in every hom-set
$
\ef
(
FA, FA
)
$
per the definition
of a step-1 model.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment