Compare commits

..

No commits in common. "e562c65774451d268806a1fc81c2d7e32e910917" and "a1514159504a24996d0a175c44308477c7ac6793" have entirely different histories.

2 changed files with 17 additions and 27 deletions

View File

@ -121,8 +121,8 @@
\newcommand{\wtypestore}[3]{\ensuremath{#1 = \wtype{#2}{#3}}} \newcommand{\wtypestore}[3]{\ensuremath{#1 = \wtype{#2}{#3}}}
%\newcommand{\wtype}[2]{\ensuremath{[#1\ #2]}} %\newcommand{\wtype}[2]{\ensuremath{[#1\ #2]}}
\newcommand{\wtv}[1]{\ensuremath{\tv{#1}_?}} \newcommand{\wtv}[1]{\ensuremath{\tv{#1}_?}}
\newcommand{\ntv}[1]{\ensuremath{\underline{\tv{#1}}}} %\newcommand{\ntv}[1]{\ensuremath{\underline{\tv{#1}}}}
%\newcommand{\ntv}[1]{\tv{#1}} \newcommand{\ntv}[1]{\tv{#1}}
\newcommand{\wcstore}{\ensuremath{\Delta}} \newcommand{\wcstore}{\ensuremath{\Delta}}
%\newcommand{\rwildcard}[1]{\ensuremath{\mathtt{#1}_?}} %\newcommand{\rwildcard}[1]{\ensuremath{\mathtt{#1}_?}}

View File

@ -146,28 +146,21 @@ The \unify{} algorithm internally uses the following data types:
The algorithm is split into multiple parts: The algorithm is split into multiple parts:
\begin{description} \begin{description}
\item[Step 1:] \item[Step 1:]
Apply the rules depicted in the figures \ref{fig:normalizing-rules}, \ref{fig:reduce-rules} and \ref{fig:wildcard-rules} exhaustively, Apply the rules depicted in the figures \ref{fig:normalizing-rules}, \ref{fig:reduce-rules} and \ref{fig:wildcard-rules} exhaustively.
starting with the \rulename{circle} rule. Starting with the \rulename{circle} rule.
\item[Step 2:] \item[Step 2:]
%If there are no $(\type{T} \lessdot \tv{a})$ constraints remaining in the constraint set $C$ %If there are no $(\type{T} \lessdot \tv{a})$ constraints remaining in the constraint set $C$
%resume with step 4. %resume with step 4.
The second step is nondeterministic. The rules in figure \ref{fig:step2-rules} offer multiple possibilities to deal with constraints of the form $\type{N} \lessdot \tv{a}$.
%\unify{} has to pick the right transformation for each constraint of the form $\type{N} \lessdot \tv{a}$. This builds a search tree over multiple possible solutions.
%The rules in figure \ref{fig:step2-rules} offer three possibilities to deal with constraints $\type{N} \lessdot \tv{a}$. \unify{} has to try each branch and accumulate the resulting solutions into a solution set.
For every $\type{T} \lessdot \tv{a}$ constraint \unify{} has to pick exactly one transformation from figure \ref{fig:step2-rules}.
The same principle goes for constraints of the form $\tv{a} \lessdot \type{N}, \tv{a} \lessdot \tv{b}$ and the two transformations in figure \ref{fig:step2-rules2}.
%They have to be applied until the constraint set holds no constraints of the form $\tv{a} \lessdot \type{N}, \tv{a} \lessdot \tv{b}$.
If atleast one transformation was applied in this step revert to step 1.
Otherwise proceed with step 3.
%This builds a search tree over multiple possible solutions.
%\unify{} has to try each branch and accumulate the resulting solutions into a solution set.
%$\type{T} \lessdot \ntv{a}$ constraints have three and $\type{T} \lessdot \wtv{a}$ constraints have five possible transformations. $\type{T} \lessdot \ntv{a}$ constraints have three and $\type{T} \lessdot \wtv{a}$ constraints have five possible transformations.
\item[Step 3:] \item[Step 3:]
Apply the rules in figure \ref{fig:cleanup-rules} exhaustively and move on with step 4. We apply the rules in figure \ref{fig:cleanup-rules} exhaustively and proceed with step 4.
\item[Step 4:] \textit{(Generating Result)} \item[Step 4:] \textit{(Generating Result)}
Apply the rules in figure \ref{fig:generation-rules} until $\wildcardEnv = \emptyset$ and $C = \emptyset$. Apply the rules in figure \ref{fig:generation-rules} until $\wildcardEnv = \emptyset$ and $C = \emptyset$.
@ -270,12 +263,6 @@ To only rename the respective wildcards the reduce rule renames wildcards up to
\item[Free Variables:] \item[Free Variables:]
The $\text{fv}$ function assumes every wildcard type variable to be a free variable aswell. The $\text{fv}$ function assumes every wildcard type variable to be a free variable aswell.
% TODO: describe a function which determines free variables? or do an example? % TODO: describe a function which determines free variables? or do an example?
\begin{align*}
\text{fv}(\rwildcard{A}) &= \set{ \rwildcard{A} } \\
\text{fv}(\ntv{a}) &= \emptyset \\
\text{fv}(\wtv{a}) &= \set{\wtv{a}} \\
\text{fv}(\wctype{\Delta}{C}{\ol{T}}) &= \set{\text{fv}(\type{T}) \mid \type{T} \in \ol{T}} / \text{dom}(\Delta) \\
\end{align*}
\item[Fresh Wildcards:] \item[Fresh Wildcards:]
$\text{fresh}\ \overline{\wildcard{A}{\tv{u}}{\tv{l}}}$ generates fresh wildcards. $\text{fresh}\ \overline{\wildcard{A}{\tv{u}}{\tv{l}}}$ generates fresh wildcards.
@ -458,11 +445,11 @@ $
\hline \hline
\vspace*{-0.4cm}\\ \vspace*{-0.4cm}\\
\wildcardEnv \vdash C \wildcardEnv \vdash C
\end{array} \end{array}
$ $
\quad \\\\
\rulename{Pit} \rulename{Pit}
$ & $
\begin{array}[c]{l} \begin{array}[c]{l}
\wildcardEnv \vdash C \cup \set{ \tv{a} \lessdot_1 \bot } \\ \wildcardEnv \vdash C \cup \set{ \tv{a} \lessdot_1 \bot } \\
\hline \hline
@ -543,7 +530,10 @@ $
\vspace*{-0.4cm}\\ \vspace*{-0.4cm}\\
\wildcardEnv \vdash C \wildcardEnv \vdash C
\end{array} \end{array}
\quad $
\\\\
\rulename{Erase}
& $
\begin{array}[c]{l} \begin{array}[c]{l}
\wildcardEnv \vdash C \cup \, \set{ \type{T} \lessdot \type{T} } \\ \wildcardEnv \vdash C \cup \, \set{ \type{T} \lessdot \type{T} } \\
\hline \hline
@ -980,7 +970,7 @@ $\set{\tv{a} \doteq \type{N}} \in C$ with $\text{fv}(\type{N}) \cap \Delta_{in}
} }
\end{center} \end{center}
\caption{Step 2 branching: Multiple rules can be applied to the same constraint} \caption{Step 2 branching: Multiple rules can be applied to the same constraint}
\label{fig:step2-rules2} \label{fig:step2-rules}
\end{figure} \end{figure}
\begin{figure} \begin{figure}