Fix Well-formed description

This commit is contained in:
Andreas Stadelmeier 2024-01-05 09:19:10 +01:00
parent 3a499d2e6d
commit 5873fe68d6

View File

@ -143,7 +143,7 @@ Our well-formedness criteria is more restrictive than the ones used for \wildFJ{
\cite{WildcardsNeedWitnessProtection} works with the two different judgements $\ok$ and \texttt{witnessed}. \cite{WildcardsNeedWitnessProtection} works with the two different judgements $\ok$ and \texttt{witnessed}.
With \texttt{witnessed} being the stronger one. With \texttt{witnessed} being the stronger one.
We rephrased the $\ok$ judgement to include \texttt{witnessed} aswell. We rephrased the $\ok$ judgement to include \texttt{witnessed} aswell.
$\type{T} \ \ok$ in this paper means $\type{T} \ \ok$ and $\type{T} \ \texttt{witnessed}$ in the sense of the \WildFJ{} type rules. $\type{T} \ \ok$ in this paper means $\type{T} \ \ok$ and $\type{T} \ \texttt{witnessed}$ in the sense of the \wildFJ{} type rules.
Java's type system is complex enough as it is. Simplification, when possible, is always appreciated. Java's type system is complex enough as it is. Simplification, when possible, is always appreciated.
Our $\ok$ rule may not be able to express every corner of the Java type system, but is sufficient to show soundness regarding type inference for a Java core calculus. Our $\ok$ rule may not be able to express every corner of the Java type system, but is sufficient to show soundness regarding type inference for a Java core calculus.
@ -152,14 +152,36 @@ The type rules from \cite{WildcardsNeedWitnessProtection} use a witness type ins
Stating that a type is well formed (\texttt{witnessed}) if there exists atleast one simple type $\type{N}$ as a possible subtype: Stating that a type is well formed (\texttt{witnessed}) if there exists atleast one simple type $\type{N}$ as a possible subtype:
$\Delta \vdash \type{N} <: \wctype{\Delta'}{C}{\ol{T}}$. $\Delta \vdash \type{N} <: \wctype{\Delta'}{C}{\ol{T}}$.
%TODO: do we need \Delta' \Delta \vdash T, L ,U ok ? or is \Delta \vdashh ... sufficient? A witness type is easy to find by replacing every wildcard $\ol{W}$ in $\wctype{\ol{\wildcard{W}{U}{L}}}{C}{\ol{T}}$ by its upper bound:
%<A> m(List<? extends A> l) $\Delta \vdash \exptype{C}{[\ol{U}/\ol{W}]\ol{T}} <: \wctype{\ol{\wildcard{W}{U}{L}}}{C}{\ol{T}}$.
%This is important because it means different things maybe for the proof of our OK being more restrictive than "witnessed" $\Delta \vdash \exptype{C}{[\ol{U}/\ol{W}]\ol{T}} \ \texttt{witnessed}$ is given due to $\Delta \vdash \ol{T}, \ol{L}, \ol{U} \ \ok$
and $\Delta \vdash \wctype{\ol{\wildcard{W}{U}{L}}}{C}{\ol{T}} \ \ok$.
Everything else regarding subtyping stays the same as in \cite{WildcardsNeedWitnessProtection}. %Not necessary!
\begin{lemma} % Additionally we do not allow nested wildcards. %TODO: Unify cannot create them (or does it?) What is when the input contains them
If $\Delta \vdash $
\end{lemma} % The \unify{} algorithm is not capable of generating types like $\wctype{\rwildcard{X}, \wildcard{Y}{\bot}{\rwildcard{X}}}{Pair}{\rwildcard{X}, \rwildcard{Y}}$.
% %But they could be created in intermidiate types (\ol{S}) in method calls by capture conversion:
% class WList<A> extends List<List<? extends A>>
% m(List<X> l) % TODO
% m(X.Wlist<X>) % S = Y^X.List<Y>
% X.WList<X> <. List<x?>
% X.List<Y^X.List<Y>> <. List<x?>
% x =. Y^X.List<Y>
% %TODO: do we need \Delta' \Delta \vdash T, L ,U ok ? or is \Delta \vdashh ... sufficient?
% %<A> m(List<? extends A> l)
% %This is important because it means different things maybe for the proof of our OK being more restrictive than "witnessed"
% % where can nested wildcards occur?
% WBox<X> extends Box<Box<? extends X>>
% WBox<?> => Y.WBox<Y> <: Y.Box<X^Y.Box<X>>
% Everything else regarding subtyping stays the same as in \cite{WildcardsNeedWitnessProtection}.
% \begin{lemma}
% If $\Delta \vdash $
% \end{lemma}
Figure \ref{fig:tletexpr} shows type rules for fields and method calls. Figure \ref{fig:tletexpr} shows type rules for fields and method calls.
They have been merged with let statements and simplified. They have been merged with let statements and simplified.