]> matita.cs.unibo.it Git - fireball-separation.git/blob - notes.tex
142ea4dfab5ea2181b134f19829434398608d0ac
[fireball-separation.git] / notes.tex
1 \documentclass[12pt]{article}\r
2 \usepackage{blindtext}\r
3 \usepackage{enumerate}\r
4 \usepackage{hyperref, bookmark}\r
5 \usepackage{amsmath, amsfonts, amssymb, amsthm}\r
6 \usepackage{xcolor}\r
7 \r
8 \title{Strong Separation}\r
9 % \author{---}\r
10 \date{\vspace{-2em}\today{}}\r
11 \r
12 \input{macros}\r
13 \renewcommand{\Lam}[2]{\lambda#1.\, \{\!\!\{#2\}\!\!\}}\r
14 \r
15 \begin{document}\r
16 \r
17 \maketitle\r
18 \r
19 \section*{The Calculus}\r
20 \subparagraph{Syntax}\r
21 \[\begin{array}{lll}\r
22   \tm, \tmtwo & \ddef & \var \mid \tm\,\tmtwo \mid \Lam\var{\tm\Comma\vec\tm} \\\r
23   n & \ddef & \Lam\var{n\Comma\vec n} \mid \var\,\vec n \\\r
24   \\\r
25   C & \ddef & \Box \mid C\,\tm \mid \tm\,C \\\r
26   P & \ddef & \vec\tm \Comma \Box \Comma \vec\tm \mid \vec\tm \Comma C[\Lam\var P] \Comma \vec\tm  \\\r
27 \end{array}\]\r
28 \r
29 \subparagraph{Reduction rules}\r
30 \[\begin{array}{lll}\r
31   P[C[(\Lam\var{\tm\Comma\vec\tm})\,\tmtwo]] & \Red{}{\var\in \tm,\vec\tm} &\r
32    P[C[\tm\Subst\var\tmtwo]\Comma \vec\tm\Subst\var\tmtwo]\\\r
33    P[C[(\Lam\var{\tm\Comma\vec\tm})\,\tmtwo]] & \Red{}{\var\not\in\tm,\vec\tm} &\r
34     P[C[\tm] \Comma \vec\tm\Comma\tmtwo]\\\r
35 \end{array}\]\r
36 \r
37 \subparagraph{Properties}\r
38 \begin{itemize}\r
39   \item Every term is normalizing iff it is strongly normalizing.\r
40   \item Ogni strategia e' perpetua!\r
41   \item \ldots\r
42 \end{itemize}\r
43 \r
44 \clearpage\r
45 \section*{Separation}\r
46 % Paths:\r
47 \newcommand{\PathEmpty}{\epsilon}\r
48 \newcommand{\PathAbs}[1]{\mathtt{abs}(#1)}\r
49 \newcommand{\PathArg}[3]{\mathtt{arg}_{#2}^{#1}(#3)}\r
50 \newcommand{\PathHd}{\mathtt{hd}}\r
51 \r
52 \newcommand{\GarbageOf}[1]{\operatorname{Garb}(#1)}\r
53 \newcommand{\HeadOf}[1]{\operatorname{head}(#1)}\r
54 \newcommand{\FstOf}[1]{\operatorname{fst}(#1)}\r
55 \newcommand{\DegOf}[1]{\operatorname{deg}(#1)}\r
56 \newcommand{\SubtmOf}[2]{#1\preceq #2}\r
57 \newcommand{\OfHead}[2]{#1_{{\mid}#2}}\r
58 \newcommand{\SubtmsOf}[1]{\operatorname{Sub}(#1)}\r
59 \newcommand{\Div}{\mathtt{d}}\r
60 \newcommand{\Conv}{\mathtt{c}}\r
61 \newcommand{\Const}{\mathtt{K}}\r
62 \newcommand{\NamedBoundVar}[1]{\texttt{bvar(}#1\texttt{)}}\r
63 \newcommand{\AC}[1]{{\color{violet}#1}}\r
64 \begin{itemize}\r
65   % \item \textbf{$\boldsymbol\sigma$-separation.}\r
66   %  \textcolor{red}{come definirlo? con le variabili? con i termini?\r
67   %   problematico in cbv}\r
68   %  Two terms are $\sigma$-separable iff there exists a substitution\r
69   %   $\sigma$ such that \textcolor{red}{???}\r
70   % \item \textbf{Semi-$\boldsymbol\sigma$-separation.}\r
71   %  Two terms are semi-$\sigma$-separable iff there exists a substitution\r
72   %   $\sigma$ such that -- in short -- it makes one diverge and the other one converge.\r
73   % \item \textbf{Our subproblem:} Semi-$\sigma$-separating two (usual) $\boldsymbol\lambda$-terms\r
74    % (in deep normal form)\r
75    \item \textbf{Subterm:} $\SubtmOf\tm\tmtwo$ means that $\tm$ is an ($\eta/\Omega$)-subterm of $\tmtwo$.\r
76    \item \textbf{Subterm at position $\boldsymbol\pi$:} TODO\r
77    \item $\boldsymbol\sim_{\boldsymbol\pi}$\r
78    \item \textbf{Distinction:} Let $\var\defeq \HeadOf D$. Let $T_{\var} \defeq \{\tm \preceq T \mid \HeadOf{\tm} = \var \}$.\r
79   $C_{\var}$ is $D$--\emph{distinct} iff it is empty, or there exists path $\pi$ s.t.:\r
80   \begin{itemize}\r
81     \item \emph{effective} for $D$, cioe' $\FstOf{\pi} \leq \DegOf{D}$;\r
82     \item $\forall \tm\in D_\var$, $\tm_\pi \neq \Omega$;\r
83     \item $\exists \tm\in C_\var$ s.t. $\tm \not\sim_\pi D$;\r
84     \item $\{\tm\in C_\var \mid \tm \sim_\pi D\}$ is $D$--distinct.\r
85   \end{itemize}\r
86 \r
87 \clearpage\r
88   \item $\bullet$ $\bullet$ $\bullet$ $\bullet$ $\bullet$\r
89   $\bullet$ $\bullet$ $\bullet$ $\bullet$ $\bullet$\r
90   $\bullet$ $\bullet$ $\bullet$ $\bullet$ $\bullet$\r
91   \texttt{ prove di nuove definizioni di ac:}\r
92 \r
93   \item \textbf{Set of subterms:} %$\SubtmsOf{\tm} \defeq \{ \tmtwo \mid \SubtmOf\tmtwo\tm \}$\r
94   \[\begin{array}{ll}\r
95     \SubtmsOf{\var} & \defeq \{\var\} \\\r
96     \SubtmsOf{\tm\,\tmtwo} & \defeq \SubtmsOf\tm \cup \SubtmsOf\tmtwo \cup \{\tm\,\tmtwo\} \\\r
97     \SubtmsOf{\lambda \var.\, \vec\tm} & \defeq \{\tmtwo\{\Const/\var\} \mid \tmtwo \in\SubtmsOf{\vec\tm}\} \\\r
98   \end{array}\]\r
99   \AC{Note: $\SubtmsOf\cdot$ replaces bound variables with $\Const$ when going under abstractions.}\r
100   \item \textbf{Subterm at position:}\r
101   \[\begin{array}{ll}\r
102     \text{Paths: } \pi & ::= \PathEmpty \mid \PathHd \mid \PathArg i \var \pi \mid \PathAbs\pi\r
103   \end{array}\]\r
104   \AC{\r
105    Given a path, one can retrieve from a term (if possible) the subterm at that position.\r
106 \r
107    Since the path may go through abstractions, bound variables that become free\r
108    are renamed to variables of the form $\NamedBoundVar\pi$\r
109    (where $\pi$ is the path in the original inert leading to the abstraction binding that variable).\r
110   }\r
111   % \newcommand{\GetSubtm}[2]{\operatorname{GetSubtm}(#1\texttt{;}#2)}\r
112   \newcommand{\GetSubtm}[2]{{#1}_{#2}}\r
113   \[\begin{array}{ll}\r
114     \GetSubtm\tm\pi & \defeq \GetSubtm\tm{\underline\pi} \\\r
115     \GetSubtm\tm{\rho[\underline\PathEmpty]} & \defeq \tm \\\r
116     \GetSubtm{(x\,t_1\cdots t_n)}{\rho[\underline\PathHd]} & \defeq x \\\r
117     \GetSubtm{(x\,t_1\cdots t_n)}{\rho[\underline{\PathArg i \var \pi}]} & \defeq\r
118       \GetSubtm{(t_i)}{\rho[\PathArg i \var {\underline\pi}]} \mbox{(if } 1 \leq i\leq n \mbox{)} \\\r
119     \GetSubtm{(\lambda x.\, t)}{\rho[\underline {\PathAbs \pi}]} & \defeq\r
120      \GetSubtm\tm{\rho(\PathAbs{\underline\pi})}\r
121      \{\var\mapsto\NamedBoundVar{\rho[\PathEmpty]}\} \\\r
122     \GetSubtm{\tm}{\rho(\underline{\PathAbs \pi})} &\r
123      \defeq \GetSubtm{(\lambda \var.\, \tm\,\var)}{\rho(\PathAbs {\underline\pi})} \text{ (with } x \text{ fresh) (eta)}\\\r
124     % \Omega_-^- & \defeq \Omega \\\r
125   \end{array}\]\r
126   \item \textbf{Head restriction:} $\OfHead T \var \defeq \{\tm \in T \mid \HeadOf{\tm} (\defeq \tm_{\PathHd}) = \var \}$\r
127   \item \textbf{Telescopic garbage chain:} $\{\langle\tm_1,\pi_1\rangle,\ldots,\langle\tm_n,\pi_n\rangle\}$ is a $-$ if $\forall i$:\r
128    \[\tm_{i+1} \in \SubtmsOf{\text{garbage of } \GetSubtm{(\tm_i)}{\pi_i}}\]\r
129   \item \textbf{Distinction:} \underline{$S$ is $\{\langle\Div_1,\pi_1\rangle,\ldots,\langle\Div_n,\pi_n\rangle\}$--distinct} iff (one of the following three):\r
130   \begin{itemize}\r
131     \item $\OfHead S {\HeadOf \Div}$ is empty and $n=1$\r
132   \end{itemize}\r
133    OR: let $\Div\defeq\Div_1$ in:\r
134  \begin{itemize}\r
135    \item there exists a path $\pi$ s.t.\r
136    \item (Effective) $\pi$ is \emph{effective} for all $\Div_i$ s.t. $\HeadOf{\Div_i} = \HeadOf{\Div}$\r
137    \item $\forall \tm\in \OfHead{\SubtmsOf{\Div_i}}{\HeadOf\Div}$, $\tm_\pi \neq \Omega$;\r
138    \item (Useful) $\exists s\in \OfHead S{\HeadOf\Div}$ s.t. $s \not\sim_\pi \Div$;\r
139    \item $S\setminus\{s\in \OfHead S{\HeadOf\Div} \mid s \not\sim_\pi \Div\}$ is $D$--distinct.\r
140  \end{itemize}\r
141  OR:\r
142 \begin{itemize}\r
143    \item $S'$ is $\{\langle\Div_2,\pi_2\rangle,\ldots,\langle\Div_n,\pi_n\rangle\}$--distinct, where:\r
144     \[S' \defeq S \mathrel{\cup} \SubtmsOf{\{\text{garbage of } s \text{ along } \pi_1 \mid s\in \OfHead{S}{\HeadOf\Div}\}} \]\r
145  \end{itemize}\r
146 \r
147  \item \textbf{Semi-$\sigma$-separability: } $(\Div,\Conv)$ are semi-$\sigma$-separable\r
148   IFF there is $\Div_1$ (an $\Omega$--approximation of a subterm of $\Div$ with\r
149   at most one garbage, and without stuck variables)\r
150   and a telescopic garbage chain $D\defeq\{\langle\Div_1,\pi_1\rangle,\ldots,\langle\Div_n,\pi_n\rangle\}$ s.t.\r
151   $\SubtmsOf\Conv$ is $D$--distinct.\r
152 \r
153  \clearpage\r
154  \item $\bullet$ $\bullet$ $\bullet$ $\bullet$ $\bullet$\r
155  $\bullet$ $\bullet$ $\bullet$ $\bullet$ $\bullet$\r
156  $\bullet$ $\bullet$ $\bullet$ $\bullet$ $\bullet$\r
157 \r
158  \item \textbf{Unlockable variables.}\r
159   We use the following contexts:\r
160   $E ::= \Box \mid E\, t \mid t\, E \mid \Lam\var{\vec t\Comma E \Comma \vec t} $.\r
161  A variable $\var$ is \emph{unlockable} in a context $E$ if:\r
162   \begin{itemize}\r
163     \item it is not bound in $E$, or\r
164     \item $E[\cdot] = E'[\vartwo\, \vec\tm \, (\Lam{\cdots\var\cdots}{\vec\tmtwo \Comma E'[\cdot]\Comma\vec\tmthree})]$\r
165      and $\vartwo$ is unlockable in $E'$.\r
166   \end{itemize}\r
167 \r
168   Transformation removing an unlockable variable bound at position $\pi$:\r
169   \[\tau_{n::\pi}[\alpha] := \lambda x_1..x_n\,x.\, \alpha\,\vec x\,(\tau_\pi[x])\]\r
170 \r
171   % \textcolor{red}{For every term there exists an equivalent term with no unlockable variables}\r
172 \r
173 \end{itemize}\r
174 \r
175 % \clearpage\r
176 % \section*{NP-hardness}\r
177 % \newcommand{\Pacman}{\Omega}\r
178 % \newcommand{\sep}{\cdot}\r
179 % \begin{example}[Graph 3-coloring]\label{example:3col}\r
180 % Let $G=(V,E)$ be a graph, with $N \defeq |V|$.\r
181 % We encode the problem of finding a 3-coloring of $G$ in the following problem of semi-$\sigma$-separation:\r
182 %  \[\begin{array}{cl}\r
183 %  \Uparrow & x \sep t_1^1\,t_1^2\,t_1^3 \sep t_2^1\,t_2^2\,t_2^3 \sep \cdots t_n^1\,t_n^2\,t_n^3 \\\r
184 %  \\\r
185 %  \Downarrow & x \sep \Pacman\,\Pacman\,\Pacman \sep t_2^1\,t_2^2\,t_2^3 \sep \cdots t_n^1\,t_n^2\,t_n^3 \\\r
186 %  \Downarrow & x \sep t_1^1\,t_1^2\,t_1^3 \sep \Pacman\,\Pacman\,\Pacman \sep \cdots t_n^1\,t_n^2\,t_n^3 \\\r
187 %  \vdots & \vdots \\\r
188 %  \Downarrow & x \sep t_1^1\,t_1^2\,t_1^3 \sep t_2^1\,t_2^2\,t_2^3 \sep \cdots \Pacman\,\Pacman\,\Pacman \\\r
189 %  \end{array}\]\r
190 %\r
191 % Where: $\dummy$ is (probably) a variable, $\bomb\defeq \lambda\_.\,\bot$, and the $a$'s are defined as follows:\r
192 %\r
193 % \begin{itemize}\r
194 %\r
195 %  \item $\begin{array}{ll}\r
196 %   a_1^1 \defeq & \lambda\_. \, x \sep y\bomb\bomb \sep\bomb\ldots \\\r
197 %   a_1^2 \defeq & \lambda\_. \, x \sep \bomb y\bomb \sep\bomb\ldots \\\r
198 %   a_1^3 \defeq & \lambda\_. \, x \sep \bomb\bomb y \sep\bomb\ldots \\\r
199 %  \end{array}$\r
200 %\r
201 %  \item $a_2^1 \defeq \begin{cases}\r
202 %   \lambda\_.\, x \sep \bomb \dummy\dummy \sep y\bomb\bomb \cdot \bomb\ldots & \text{if } (v_1, v_2)\in E \\\r
203 %   \lambda\_.\, x \sep \dummy\dummy\dummy \sep y\bomb\bomb \cdot \bomb\ldots & \text{if } (v_1, v_2)\not\in E \\\r
204 %  \end{cases}$\r
205 %\r
206 %  \item \ldots\r
207 %\r
208 % \end{itemize}\r
209 %\r
210 % \begin{definition}[Index notation]\r
211 %  Let $t = x \sep x_1^1 x_2^1 x_3^1 \sep x_1^2 x_2^2 x_3^2 \sep \ldots \sep x_1^m x_2^m x_3^m$. Then: \[t[\,_k^j] \defeq x_k^j.\]\r
212 %  \end{definition}\r
213 %\r
214 % Let $z_0$, $z_1$, $z_2$ be variables.\r
215 %\r
216 % Define:\r
217 % \[a_k^j[\,_{k'}^{j'}]\defeq\begin{cases}\r
218 %  \bomb & \text{if } j<j' \\\r
219 %  \begin{cases}\r
220 %   \bomb & \text{if } k\neq k' \\\r
221 %   y & \text{if } k = k' \\\r
222 %  \end{cases} & \text{if } j = j' \\\r
223 %  \begin{cases}\r
224 %   \bomb & \text{if } k = k' \\\r
225 %   \dummy & \text{if } k \neq k' \\\r
226 %  \end{cases} & \text{if } (v_j,v_{j'}) \in E \\\r
227 %  \dummy & \text{if } (v_j,v_{j'}) \not\in E\r
228 % \end{cases}\]\r
229 %\r
230 % Attenzione! Le $a$ vanno protette da lambda ($\lambda\_$)!\r
231 %\r
232 % % Dimensione del problema: circa $(3\times m^2)^2$.\r
233 %\r
234 % Intuitively, if $\sigma(x)$ ``uses'' $a_j^i$, then $\sigma$ colors $v_j$ with color $i$.\r
235 %\r
236 % \begin{lemma}[Extraction of the coloring]\r
237 %  Let $\sigma$ be a substitution which is a solution for the semi-separation problem. Then for example:\r
238 %\r
239 % \begin{itemize}\r
240 %  \item $\operatorname{color}(v_1) = 2$ iff\r
241 %   \[(x \sep \Pacman\,\bomb\,\Pacman \sep \bomb\,\bomb\,\bomb \,\sep \bomb\,\bomb\,\bomb \,\sep \cdots \sep \bomb\,\bomb\,\bomb)\,\sigma \to \bot\]\r
242 %  \item $\operatorname{color}(v_2) = 3$ iff:\r
243 %   \[(x \sep \dummy\,\dummy\,\dummy \sep \Pacman\,\Pacman\,\bomb \,\sep \bomb\,\bomb\,\bomb \,\sep \cdots \sep \bomb\,\bomb\,\bomb)\,\sigma \to \bot\]\r
244 % \end{itemize}\r
245 % \end{lemma}\r
246 %\r
247 % % Where $\Pacman \equiv \lambda\_.\,\Pacman$.\r
248 %\r
249 % \end{example}\r
250 \clearpage\r
251 \section{Tentativi $\mathbf X$--separability (July, 15$^{\mathbf{th}}\div\infty$)}\r
252 \newcommand{\perm}{\pi}\r
253 \newcommand{\Perm}[2]{\pi[#1,#2]}\r
254 \newcommand{\xK}{\kappa}\r
255 \newcommand{\xN}{n}\r
256 \newcommand{\LAM}[2]{\Lambda_{#2,#1}}\r
257 \newcommand{\LAMNK}{\LAM\xN\xK}\r
258 \newcommand{\Apply}[2]{(#1\mapsto#2)}\r
259 \newcommand{\kn}{$(\kappa,n)$}\r
260 \newcommand{\knnf}{\kn{}-nf}\r
261 \newcommand{\Lams}[1]{\operatorname{lams}(#1)}\r
262 \newcommand{\Args}[1]{\operatorname{args}(#1)}\r
263 \newcommand{\Head}[1]{\operatorname{head}(#1)}\r
264 \begin{definition}[$\Lams\cdot,\Args\cdot,\Head\cdot$]\r
265   \[\Lams{\lambda\vec\var.\,\vartwo\,\vec\tm} \defeq |\vec\var| \]\r
266   \[\Args{\lambda\vec\var.\,\vartwo\,\vec\tm} \defeq |\vec\tm| \]\r
267   \[\Head{\lambda\vec\var.\,\vartwo\,\vec\tm} \defeq \vartwo \]\r
268 \end{definition}\r
269 \r
270 \begin{definition}[\kn{}-normal forms]\r
271   First recall that terms in normal form have the shape\r
272   $\lambda\vec\var.\,\vartwo\,\vec\tm$, where the terms $\vec\tm$ are in normal form too.\r
273   \r
274   We define inductively the set of \knnf s (for $\xK,\xN$ natural numbers):\r
275   $\lambda\vec\var.\,\vartwo\,\vec\tm$ is a \knnf{} iff \r
276   $|\vec\var|\leq\xK$, $|\vec\tm|\leq\xN$, and every term in $\vec\tm$ is a \knnf{}.\r
277 \end{definition}\r
278 \r
279 \begin{definition}[Permutator $\Perm\cdot\cdot$]~\r
280   \[\Perm i j \defeq \lambda\vec\var\vartwo.\,\vartwo\, \vec\alpha\,\vec\var\,\vartwo\]\r
281   where $\vec\var$, $\vec\alpha$ and $\vartwo$ are fresh variables,\r
282   with $|\vec\var| = i$ and $|\vec\alpha| = j$.\r
283 \end{definition}\r
284 \r
285 \begin{definition}{$\Apply\cdot\cdot$}\r
286   We denote by $\tmtwo\Apply\var\tm$ the normal form of $\tmtwo\Subst\var\tm$ in normal form --\r
287   if it has one.\r
288 \end{definition}\r
289 \r
290 \begin{lemma}\r
291   Let $\tm$ a \knnf, and $\Head\tm=\var$.\r
292   If $A\leq \Args\tm$ and $B \geq \xK + A + 1$,\r
293   let $\tmtwo\defeq\tm\Apply\var{\Perm{A}{B}}$ in:\r
294   $\Lams\tm=\Lams\tmtwo$ and $\tmtwo\in\LAM ? ?$\r
295 \end{lemma}\r
296 \begin{proof}\r
297   By induction on the normal form structure of $\tm$.\r
298   Let $\tm=\lambda\vec\var.\,\vartwo\,\vec\tmtwo$:\r
299   \begin{itemize}\r
300     \item if $\vartwo=\var$, then\r
301     $\tm\Apply\var\perm = \lambda\var_1\ldots\var_{???}.\,\var\,\vec\tmthree$\r
302     \item if $\vartwo\neq\var$, then $\tm\Apply\var\perm = \lambda\vec\var.\,\vartwo\,\vec\tmthree$\r
303     where $\vec\tmthree\defeq \vec\tmtwo\Apply\var\perm$.\r
304     Conclude by inductive hypothesis.\r
305   \end{itemize}\r
306 \end{proof}\r
307 \begin{corollary}\r
308   Let $\tm \defeq \var\,f_1\cdots f_m$ a \knnf.\r
309   If $A\leq m$ and $B \geq A + \xK$,\r
310   then $\tm\Apply\var{\Perm{A}{B}}$ is an inert.\r
311 \end{corollary}\r
312 \r
313 \begin{lemma}\r
314   For every $\tm,\tmtwo$ be \knnf{s},\r
315   every fresh variable $\var$,\r
316   $\perm\defeq\Perm{i}{i+k+1}$ permutator,\r
317   $\tm\EtaEq\tmtwo$ iff $\tm\Apply\var\perm\EtaEq\tmtwo\Apply\var\perm$.\r
318 \end{lemma}\r
319 \r
320 \end{document}\r