text
stringlengths
28
935k
meta
stringlengths
137
139
red_pajama_subset
stringclasses
1 value
\section{Introduction} \label{sec:intro} Despite the immense popularity and availability of online video content via outlets such as Youtube and Facebook, most work on object detection focuses on static images. Given the breakthroughs of deep convolutional neural networks for detecting objects in static images, the application of these methods to video might seem straightforward. However, motion blur and compression artifacts cause substantial frame-to-frame variability, even in videos that appear smooth to the eye. These attributes complicate prediction tasks like classification and localization. Object-detection models trained on images tend not to perform competitively on videos owing to domain shift factors \cite{KalogeitonFS15}. Moreover, object-level annotations in popular video data-sets can be extremely sparse, impeding the development of better video-based object detection models. Girshik \emph{et al}\bmvaOneDot \cite{RCNN_girshick14CVPR} demonstrate that even given scarce labeled training data, high-capacity convolutional neural networks can achieve state of the art detection performance if first pre-trained on a related task with abundant training data, such as 1000-way ImageNet classification. Followed the pretraining, the networks can be fine-tuned to a related but distinct domain. Also relevant to our work, the recently introduced models Faster R-CNN \cite{Faster_RCNN_RenHG015} and You Look Only Once (YOLO) \cite{YOLO_RedmonDGF15} unify the tasks of classification and localization. These methods, which are accurate and efficient, propose to solve both tasks through a single model, bypassing the separate object proposal methods used by R-CNN \cite{RCNN_girshick14CVPR}. In this paper, we introduce a method to extend unified object recognition and localization to the video domain. Our approach applies transfer learning from the image domain to video frames. Additionally, we present a novel recurrent neural network (RNN) method that refines predictions by exploiting contextual information in neighboring frames. In summary, we contribute the following: \begin{itemize} \item A new method for refining a video-based object detection consisting of two parts: (i) a \emph{pseudo-labeler}, which assigns provisional labels to all available video frames. (ii) A recurrent neural network, which reads in a sequence of provisionally labeled frames, using the contextual information to output refined predictions. \item An effective training strategy utilizing (i) category-level weak-supervision at every time-step, (ii) localization-level strong supervision at final time-step (iii) a penalty encouraging prediction smoothness at consecutive time-steps, and (iv) similarity constraints between \emph{pseudo-labels} and prediction output at every time-step. \item An extensive empirical investigation demonstrating that on the YouTube Objects \cite{youtube-Objects} dataset, our framework achieves mean average precision (mAP) of $68.73$ on test data, compared to a best published result of $37.41$ \cite{Tripathi_WACV16} and $61.66$ for a domain adapted YOLO network \cite{YOLO_RedmonDGF15}. \end{itemize} \section{Methods} \label{sec:method} In this work, we aim to refine object detection in video by utilizing contextual information from neighboring video frames. We accomplish this through a two-stage process. First, we train a \emph{pseudo-labeler}, that is, a domain-adapted convolutional neural network for object detection, trained individually on the labeled video frames. Specifically, we fine-tune the YOLO object detection network \cite{YOLO_RedmonDGF15}, which was originally trained for the 20-class PASCAL VOC \cite{PASCAL_VOC} dataset, to the Youtube-Video \cite{youtube-Objects} dataset. When fine-tuning to the 10 sub-categories present in the video dataset, our objective is to minimize the weighted squared detection loss (equation \ref{eqn:obj_det_loss}) as specified in YOLO \cite{YOLO_RedmonDGF15}. While fine-tuning, we learn only the parameters of the top-most fully-connected layers, keeping the $24$ convolutional layers and $4$ max-pooling layers unchanged. The training takes roughly 50 epochs to converge, using the RMSProp \cite{RMSProp} optimizer with momentum of $0.9$ and a mini-batch size of $128$. As with YOLO \cite{YOLO_RedmonDGF15}, our fine-tuned $pseudo-labeler$ takes $448 \times 448$ frames as input and regresses on category types and locations of possible objects at each one of $S \times S$ non-overlapping grid cells. For each grid cell, the model outputs class conditional probabilities as well as $B$ bounding boxes and their associated confidence scores. As in YOLO, we consider a \emph{responsible} bounding box for a grid cell to be the one among the $B$ boxes for which the predicted area and the ground truth area shares the maximum Intersection Over Union. During training, we simultaneously optimize classification and localization error (equation \ref{eqn:obj_det_loss}). For each grid cell, we minimize the localization error for the \emph{responsible} bounding box with respect to the ground truth only when an object appears in that cell. Next, we train a Recurrent Neural Network (RNN), with Gated Recurrent Units (GRUs) \cite{Cho14_GRU}. This net takes as input sequences of \emph{pseudo-labels}, optimizing an objective that encourages both accuracy on the target frame and consistency across consecutive frames. Given a series of \emph{pseudo-labels} $\mathbf{x}^{(1)}, ..., \mathbf{x}^{(T)}$, we train the RNN to generate improved predictions $\hat{\mathbf{y}}^{(1)}, ..., \hat{\mathbf{y}}^{(T)}$ with respect to the ground truth $\mathbf{y}^{(T)}$ available only at the final step in each sequence. Here, $t$ indexes sequence steps and $T$ denotes the length of the sequence. As output, we use a fully-connected layer with a linear activation function, as our problem is regression. In our final experiments, we use a $2$-layer GRU with $150$ nodes per layer, hyper-parameters determined on validation data. The following equations define the forward pass through a GRU layer, where $\mathbf{h}^{(t)}_l$ denotes the layer's output at the current time step, and $\mathbf{h}^{(t)}_{l-1}$ denotes the previous layer's output at the same sequence step: \begin{equation} \label{eqn:GRU} \begin{aligned} \mathbf{r}^{(t)}_l &= \sigma(\mathbf{h}^{(t)}_{l-1}W^{xr}_l + \mathbf{h}^{(t-1)}_lW^{hr}_l + \mathbf{b}^r_l)\\ \mathbf{u}^{(t)}_l &= \sigma(\mathbf{h}^{(t)}_{l-1}W^{xu}_l + \mathbf{h}^{(t-1)}_lW^{hu}_l + \mathbf{b}^u_l)\\ \mathbf{c}^{(t)}_l &= \sigma(\mathbf{h}^{(t)}_{l-1}W^{xc}_l + r_t \odot(\mathbf{h}^{(t-1)}_lW^{hc}_l) + \mathbf{b}^c_l)\\ \mathbf{h}^{(t)}_l &= (1-\mathbf{u}^{(t)}_l)\odot \mathbf{h}^{(t-1)}_l + \mathbf{u}^{(t)}_l\odot \mathbf{c}^{(t)}_l \end{aligned} \end{equation} Here, $\sigma$ denotes an element-wise logistic function and $\odot$ is the (element-wise) Hadamard product. The reset gate, update gate, and candidate hidden state are denoted by $\textbf{r}$, $\textbf{u}$, and $\textbf{c}$ respectively. For $S = 7$ and $B=2$, the pseudo-labels $\mathbf{x}^{(t)}$ and prediction $\hat{\mathbf{y}}^{(t)}$ both lie in $\mathbb{R}^{1470}$. \vspace{-2.5mm} \subsection{Training} We design an objective function (Equation \ref{eqn:objective}) that accounts for both accuracy at the target frame and consistency of predictions across adjacent time steps in the following ways: \begin{equation} \label{eqn:objective} \mbox{loss} = \mbox{d\_loss} + \alpha \cdot \mbox{s\_loss} + \beta \cdot \mbox{c\_loss} + \gamma \cdot \mbox{pc\_loss} \end{equation} Here, d\_loss, s\_loss, c\_loss and pc\_loss stand for detection\_loss, similarity\_loss, category\_loss and prediction\_consistency\_loss described in the following sections. The values of the hyper-parameters $\alpha=0.2$, $\beta=0.2$ and $\gamma=0.1$ are chosen based on the detection performance on the validation set. The training converges in 80 epochs for parameter updates using RMSProp \cite{RMSProp} and momentum $0.9$. During training we use a mini-batch size of $128$ and sequences of length $30$. \subsubsection{Strong Supervision at Target Frame} On the final output, for which the ground truth classification and localization is available, we apply a multi-part object detection loss as described in YOLO \cite{YOLO_RedmonDGF15}. \vspace{-2.5mm} \begin{equation} \label{eqn:obj_det_loss} \begin{aligned} \mbox{detection\_loss} &= \lambda_{coord}\sum^{S^2}_{i=0}\sum^{B}_{j=0}\mathbbm{1}^{obj}_{ij}\big(\mathit{x}^{(T)}_i - \hat{\mathit{x}}^{(T)}_i\big)^2 + \big(\mathit{y}^{(T)}_i - \hat{\mathit{y}}^{(T)}_i\big)^2 \\ & + \lambda_{coord}\sum^{S^2}_{i=0}\sum^{B}_{j=0}\mathbbm{1}^{obj}_{ij}\big(\sqrt{w_i}^{(T)} - \sqrt{\hat{w}^{(T)}_i}\big)^2 + \big (\sqrt{h_i}^{(T)} - \sqrt{\hat{h}^{(T)}_i} \big)^2 \\ & + \sum^{S^2}_{i=0}\sum^{B}_{j=0}\mathbbm{1}^{obj}_{ij}(\mathit{C}_i - \hat{\mathit{C}_i})^2 \\ & + \lambda_{noobj}\sum^{S^2}_{i=0}\sum^{B}_{j=0}\mathbbm{1}^{noobj}_{ij}\big(\mathit{C}^{(T)}_i - \hat{\mathit{C}}^{(T)}_i\big)^2 \\ & + \sum^{S^2}_{i=0}\mathbbm{1}^{obj}_{i}\sum_{c \in classes}\big(p_i^{(T)}(c) - \hat{p_i}^{(T)}(c)\big)^2 \end{aligned} \end{equation} where $\mathbbm{1}^{obj}_{i}$ denotes if the object appears in cell $i$ and $\mathbbm{1}^{obj}_{ij}$ denotes that $j$th bounding box predictor in cell $i$ is \emph{responsible} for that prediction. The loss function penalizes classification and localization error differently based on presence or absence of an object in that grid cell. $x_i, y_i, w_i, h_i$ corresponds to the ground truth bounding box center coordinates, width and height for objects in grid cell (if it exists) and $\hat{x_i}, \hat{y_i}, \hat{w_i}, \hat{h_i}$ stand for the corresponding predictions. $C_i$ and $\hat{C_i}$ denote confidence score of \emph{objectness} at grid cell $i$ for ground truth and prediction. $p_i(c)$ and $\hat{p_i}(c)$ stand for conditional probability for object class $c$ at cell index $i$ for ground truth and prediction respectively. We use similar settings for YOLO's object detection loss minimization and use values of $\lambda_{coord} = 5$ and $\lambda_{noobj} = 0.5$. \vspace{-2.5mm} \subsubsection{Similarity between \emph{Pseudo-labels} and Predictions} Our objective function also includes a regularizer that penalizes the dissimilarity between \emph{pseudo-labels} and the prediction at each time frame $t$. \vspace{-2.5mm} \begin{equation} \label{auto_enc_loss} \mbox{similarity\_loss} = \sum^T_{t=0}\sum^{S^2}_{i=0}\hat{C}^{(t)}_i\Big(\mathbf{x}^{(t)}_i - \hat{\mathbf{y}_i}^{(t)} \Big)^2 \end{equation} Here, $\mathbf{x}^{(t)}_i$ and $\hat{\mathbf{y}_i}^{(t)}$ denote the \emph{pseudo-labels} and predictions corresponding to the $i$-th grid cell at $t$-th time step respectively. We perform minimization of the square loss weighted by the predicted confidence score at the corresponding cell. \subsubsection{Object Category-level Weak-Supervision} Replication of the static target at each sequential step has been shown to be effective in \cite{LiptonKEW15, yue2015beyond, dai2015semi}. Of course, with video data, different objects may move in different directions and speeds. Yet, within a short time duration, we could expect all objects to be present. Thus we employ target replication for classification but not localization objectives. We minimize the square loss between the categories aggregated over all grid cells in the ground truth $\mathbf{y}^{(T)}$ at final time step $T$ and predictions $\hat{\mathbf{y}}^{(t)}$ at all time steps $t$. Aggregated category from the ground truth considers only the cell indices where an object is present. For predictions, contribution of cell $i$ is weighted by its predicted confidence score $\hat{C}^{(t)}_i$. Note that cell indices with positive detection are sparse. Thus, we consider the confidence score of each cell while minimizing the aggregated category loss. \vspace{-2.5mm} \begin{equation} \label{category_supervision} \mbox{category\_loss} = \sum^T_{t=0}\bigg(\sum_{c \in classes} \Big(\sum^{S^2}_{i=0} \hat{C}^{(t)}_i\big(\hat{p}^{(t)}_i(c)\big) - \sum^{S^2}_{i=0}\mathbbm{1}^{obj^{(T)}}_i \big(p_i^{(T)}(c)\big)\Big) \bigg)^2 \end{equation} \subsubsection{Consecutive Prediction Smoothness} Additionally, we regularize the model by encouraging smoothness of predictions across consecutive time-steps. This makes sense intuitively because we assume that objects rarely move rapidly from one frame to another. \vspace{-2.5mm} \begin{equation} \label{prediction_smoothness} \mbox{prediction\_consistency\_loss} = \sum^{T-1}_{t=0}\Big(\hat{\mathbf{y}_i}^{(t)} - \hat{\mathbf{y}_i}^{(t+1)} \Big)^2 \end{equation} \vspace{-2.5mm} \subsection{Inference} The recurrent neural network predicts output at every time-step. The network predicts $98$ bounding boxes per video frame and class probabilities for each of the $49$ grid cells. We note that for every cell, the net predicts class conditional probabilities for each one of the $C$ categories and $B$ bounding boxes. Each one of the $B$ predicted bounding boxes per cell has an associated \emph{objectness} confidence score. The predicted confidence score at that grid is the maximum among the boxes. The bounding box with the highest score becomes the \emph{responsible} prediction for that grid cell $i$. The product of class conditional probability $\hat{p}^{(t)}_i(c)$ for category type $c$ and \emph{objectness} confidence score $\hat{C}^{(t)}_i$ at grid cell $i$, if above a threshold, infers a detection. In order for an object of category type $c$ to be detected for $i$-th cell at time-step $t$, both the class conditional probability $\hat{p}^{(t)}_i(c)$ and \emph{objectness score} $\hat{C}^{(t)}_i$ must be reasonably high. Additionally, we employ Non-Maximum Suppression (NMS) to winnow multiple high scoring bounding boxes around an object instance and produce a single detection for an instance. By virtue of YOLO-style prediction, NMS is not critical. \section{Experimental Results} \label{sec:results} In this section, we empirically evaluate our model on the popular \textbf{Youtube-Objects} dataset, providing both quantitative results (as measured by mean Average Precision) and subjective evaluations of the model's performance, considering both successful predictions and failure cases. The \textbf{Youtube-Objects} dataset\cite{youtube-Objects} is composed of videos collected from Youtube by querying for the names of 10 object classes of the PASCAL VOC Challenge. It contains 155 videos in total and between 9 and 24 videos for each class. The duration of each video varies between 30 seconds and 3 minutes. However, only $6087$ frames are annotated with $6975$ bounding-box instances. The training and test split is provided. \subsection{Experimental Setup} We implement the domain-adaption of YOLO and the proposed RNN model using Theano \cite{Theano2016arXiv160502688short}. Our best performing RNN model uses two GRU layers of $150$ hidden units each and dropout of probability $0.5$ between layers, significantly outperforming domain-adapted YOLO alone. While we can only objectively evaluate prediction quality on the labeled frames, we present subjective evaluations on sequences. \subsection{Objective Evaluation} We compare our approach with other methods evaluated on the Youtube-Objects dataset. As shown in Table \ref{table:per_category_results} and Table \ref{table:final_mAP}, Deformable Parts Model (DPM) \cite{FelzenszwalbMR_CVPR_2008})-based detector reports \cite{KalogeitonFS15} mean average precision below $30$, with especially poor performance in some categories such as \emph{cat}. The method of Tripathi \emph{et al}\bmvaOneDot (VPO) \cite{Tripathi_WACV16} uses consistent video object proposals followed by a domain-adapted AlexNet classifier (5 convolutional layer, 3 fully connected) \cite{AlexNet12} in an R-CNN \cite{RCNN_girshick14CVPR}-like framework, achieving mAP of $37.41$. We also compare against YOLO ($24$ convolutional layers, 2 fully connected layers), which unifies the classification and localization tasks, and achieves mean Average Precision over $55$. In our method, we adapt YOLO to generate \emph{pseudo-labels} for all video frames, feeding them as inputs to the refinement RNN. We choose YOLO as the \emph{pseudo-labeler} because it is the most accurate among feasibly fast image-level detectors. The domain-adaptation improves YOLO's performance, achieving mAP of $61.66$. Our model with RNN-based prediction refinement, achieves superior aggregate mAP to all baselines. The RNN refinement model using both input-output similarity, category-level weak-supervision, and prediction smoothness performs best, achieving $\mbox{68.73}$ mAP. This amounts to a relative improvement of $\mbox{11.5\%}$ over the best baselines. Additionally, the RNN improves detection accuracy on most individual categories (Table \ref{table:per_category_results}). \begin{table} \label{table:per_category_results} \centering \footnotesize \begin{tabular}{lllllllllll} \multicolumn{11}{c}{\textbf{Average Precision on 10-categories}} \\ \midrule Methods & airplane & bird & boat & car & cat & cow & dog & horse & mbike & train \\ \midrule DPM\cite{FelzenszwalbMR_CVPR_2008} & 28.42 & 48.14 & 25.50 & 48.99 & 1.69 & 19.24 & 15.84 & 35.10 & 31.61 & 39.58 \\ VOP\cite{Tripathi_WACV16} & 29.77 & 28.82 & 35.34 & 41.00 & 33.7 & 57.56 & 34.42 & 54.52 & 29.77 & 29.23 \\ YOLO\cite{YOLO_RedmonDGF15} & 76.67 & 89.51 & 57.66 & 65.52 & 43.03 & 53.48 & 55.81 & 36.96 & 24.62 & 62.03 \\ DA YOLO & \textbf{83.89} & \textbf{91.98} & 59.91 & 81.95 & 46.67 & 56.78 & 53.49 & 42.53 & 32.31 & 67.09 \\ \midrule RNN-IOS & 82.78 & 89.51 & 68.02 & \textbf{82.67} & 47.88 & 70.33 & 52.33 & 61.52 & 27.69 & \textbf{67.72} \\ RNN-WS & 77.78 & 89.51 & \textbf{69.40} & 78.16 & 51.52 & \textbf{78.39} & 47.09 & 81.52 & 36.92 & 62.03 \\ RNN-PS & 76.11 & 87.65 & 62.16 & 80.69 & \textbf{62.42} & 78.02 & \textbf{58.72} & \textbf{81.77} & \textbf{41.54} & 58.23 \\ \bottomrule \end{tabular} \caption{Per-category object detection results for the Deformable Parts Model (DPM), Video Object Proposal based AlexNet (VOP), image-trained YOLO (YOLO), domain-adapted YOLO (DA-YOLO). RNN-IOS regularizes on input-output similarity, to which RNN-WS adds category-level weak-supervision, to which RNN-PS adds a regularizer encouraging prediction smoothness.} \end{table} \begin{table}[h] \label{table:final_mAP} \centering \begin{tabular}{llllllll} \multicolumn{8}{c}{\textbf{mean Average Precision on all categories}} \\ \midrule Methods & DPM & VOP & YOLO & DA YOLO & RNN-IOS & RNN-WS & RNN-PS\\ \midrule mAP & 29.41 & 37.41 & 56.53 & \textbf{61.66} & 65.04 & 67.23 & \textcolor{blue}{\textbf{68.73}}\\ \bottomrule \end{tabular} \caption{Overall detection results on Youtube-Objects dataset. Our best model (RNN-PS) provides $7\%$ improvements over DA-YOLO baseline.} \end{table} \vspace{-2.5mm} \vspace{-2.5mm} \subsection{Subjective Evaluation} We provide a subjective evaluation of the proposed RNN model in Figure \ref{fig:subjective1}. Top and bottom rows in every pair of sequences correspond to \emph{pseudo-labels} and results from our approach respectively. While only the last frame in each sequence has associated ground truth, we can observe that the RNN produces more accurate and more consistent predictions across time frames. The predictions are consistent with respect to classification, localization and confidence scores. In the first example, the RNN consistently detects the \emph{dog} throughout the sequence, even though the \emph{pseudo-labels} for the first two frames were wrong (\emph{bird}). In the second example, \emph{pseudo-labels} were \emph{motorbike}, \emph{person}, \emph{bicycle} and even \emph{none} at different time-steps. However, our approach consistently predicted \emph{motorbike}. The third example shows that the RNN consistently predicts both of the cars while the \emph{pseudo-labeler} detects only the smaller car in two frames within the sequence. The last two examples show how the RNN increases its confidence scores, bringing out the positive detection for \emph{cat} and \emph{car} respectively both of which fell below the detection threshold of the \emph{pseudo-labeler}. \begin{figure*} \begin{center} \includegraphics[scale=0.75]{result2_category_consistency-eps-converted-to.pdf} \includegraphics[scale=0.75]{result3_category_consistency-eps-converted-to.pdf} \includegraphics[scale=0.75]{result1_localizations-eps-converted-to.pdf} \includegraphics[scale=0.75]{result8_detection_through_consistency-eps-converted-to.pdf} \includegraphics[scale=0.75]{result16_detection_through_consistency-eps-converted-to.pdf} \end{center} \caption{ Object detection results from the final eight frames of five different test-set sequences. In each pair of rows, the top row shows the \emph{pseudo-labeler} and the bottom row shows the RNN. In the first two examples, the RNN consistently predicts correct categories \emph{dog} and \emph{motorbike}, in contrast to the inconsistent baseline. In the third sequence, the RNN correctly predicts multiple instances while the \emph{pseudo-labeler} misses one. For the last two sequences, the RNN increases the confidence score, detecting objects missed by the baseline. } \label{fig:subjective1} \end{figure*} \subsection{Areas For Improvement} The YOLO scheme for unifying classification and localization \cite{YOLO_RedmonDGF15} imposes strong spatial constraints on bounding box predictions since each grid cell can have only one class. This restricts the set of possible predictions, which may be undesirable in the case where many objects are in close proximity. Additionally, the rigidity of the YOLO model may present problems for the refinement RNN, which encourages smoothness of predictions across the sequence of frames. Consider, for example, an object which moves slightly but transits from one grid cell to another. Here smoothness of predictions seems undesirable. \begin{figure*} \begin{center} \includegraphics[scale=0.75]{failure_cases-eps-converted-to.pdf} \end{center} \caption{Failure cases for the proposed model. Left: the RNN cannot recover from incorrect \emph{pseudo-labels}. Right: RNN localization performs worse than \emph{pseudo-labels} possibly owing to multiple instances of the same object. } \label{fig:failure_cases} \vspace{-2.5mm} \end{figure*} Figure \ref{fig:failure_cases} shows some failure cases. In the first case, the \emph{pseudo-labeler} classifies the instances as \emph{dogs} and even as \emph{birds} in two frames whereas the ground truth instances are \emph{horses}. The RNN cannot recover from the incorrect pseudo-labels. Strangely, the model increases the confidence score marginally for a different wrong category \emph{cow}. In the second case, possibly owing to motion and close proximity of multiple instances of the same object category, the RNN predicts the correct category but fails on localization. These point to future work to make the framework robust to motion. The category-level weak supervision in the current scheme assumes the presence of all objects in nearby frames. While for short snippets of video this assumption generally holds, it may be violated in case of occlusions, or sudden arrival or departure of objects. In addition, our assumptions regarding the desirability of prediction smoothness can be violated in the case of rapidly moving objects. \vspace{-2.5mm} \section{Related Work} \label{sec:prior-art} Our work builds upon a rich literature in both image-level object detection,video analysis, and recurrent neural networks. Several papers propose ways of using deep convolutional networks for detecting objects \cite{RCNN_girshick14CVPR,fast_RCNN_15,Faster_RCNN_RenHG015, YOLO_RedmonDGF15, SzegedyREA14, Inside_Outside_Net_BellZBG15, DeepID-Net_2015_CVPR, Overfeat_SermanetEZMFL13, CRAFTCVPR16, Gidaris_2015_ICCV}. Some approaches classify the proposal regions \cite{RCNN_girshick14CVPR,fast_RCNN_15} into object categories and some other recent methods \cite{Faster_RCNN_RenHG015, YOLO_RedmonDGF15} unify the localization and classification stages. Kalogeiton \emph{et al}\bmvaOneDot \cite{KalogeitonFS15} identifies domain shift factors between still images and videos, necessitating video-specific object detectors. To deal with shift factors and sparse object-level annotations in video, researchers have proposed several strategies. Recently, \cite{Tripathi_WACV16} proposed both transfer learning from the image domain to video frames and optimizing for temporally consistent object proposals. Their approach is capable of detecting both moving and static objects. However, the object proposal generation step that precedes classification is slow. Prest \emph{et al}\bmvaOneDot \cite{Weak_obj_from_videoPrestLCSF12}, utilize weak supervision for object detection in videos via category-level annotations of frames, absent localization ground truth. This method assumes that the target object is moving, outputting a spatio-temporal tube that captures this most salient moving object. This paper, however, does not consider context within video for detecting multiple objects. A few recent papers \cite{DeepID-Net_2015_CVPR, Inside_Outside_Net_BellZBG15} identify the important role of context in visual recognition. For object detection in images, Bell \emph{et al}\bmvaOneDot \cite{Inside_Outside_Net_BellZBG15} use spatial RNNs to harness contextual information, showing large improvements on PASCAL VOC \cite{PASCAL_VOC} and Microsoft COCO \cite{COCOLinMBHPRDZ14} object detection datasets. Their approach adopts proposal generation followed by classification framework. This paper exploits spatial, but not temporal context. Recently, Kang \emph{et al}\bmvaOneDot \cite{KangCVPR16} introduced tubelets with convolutional neural networks (T-CNN) for detecting objects in video. T-CNN uses spatio-temporal tubelet proposal generation followed by the classification and re-scoring, incorporating temporal and contextual information from tubelets obtained in videos. T-CNN won the recently introduced ImageNet object-detection-from-video (VID) task with provided densely annotated video clips. Although the method is effective for densely annotated training data, it's behavior for sparsely labeled data is not evaluated. By modeling video as a time series, especially via GRU \cite{Cho14_GRU} or LSTM RNNs\cite{LSTM_Hochreiter_97}, several papers demonstrate improvement on visual tasks including video classification \cite{yue2015beyond}, activity recognition \cite{LongTermRecurrentDonahueHGRVSD14}, and human dynamics \cite{Fragkiadaki_2015_ICCV}. These models generally aggregate CNN features over tens of seconds, which forms the input to an RNN. They perform well for global description tasks such as classification \cite{yue2015beyond,LongTermRecurrentDonahueHGRVSD14} but require large annotated datasets. Yet, detecting multiple generic objects by explicitly modeling video as an ordered sequence remains less explored. Our work differs from the prior art in a few distinct ways. First, this work is the first, to our knowledge, to demonstrate the capacity of RNNs to improve localized object detection in videos. The approach may also be the first to refine the object predictions of frame-level models. Notably, our model produces significant improvements even on a small dataset with sparse annotations. \vspace{-2.5mm} \vspace{-2.5mm} \section{Conclusion} We introduce a framework for refining object detection in video. Our approach extracts contextual information from neighboring frames, generating predictions with state of the art accuracy that are also temporally consistent. Importantly, our model benefits from context frames even when they lack ground truth annotations. For the recurrent model, we demonstrate an efficient and effective training strategy that simultaneously employs localization-level strong supervision, category-level weak-supervision, and a penalty encouraging smoothness of predictions across adjacent frames. On a video dataset with sparse object-level annotation, our framework proves effective, as validated by extensive experiments. A subjective analysis of failure cases suggests that the current approach may struggle most on cases when multiple rapidly moving objects are in close proximity. Likely, the sequential smoothness penalty is not optimal for such complex dynamics. Our results point to several promising directions for future work. First, recent state of the art results for video classification show that longer sequences help in global inference. However, the use of longer sequences for localization remains unexplored. We also plan to explore methods to better model local motion information with the goal of improving localization of multiple objects in close proximity. Another promising direction, we would like to experiment with loss functions to incorporate specialized handling of classification and localization objectives.
{'timestamp': '2016-07-20T02:04:30', 'yymm': '1607', 'arxiv_id': '1607.04648', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04648'}
arxiv
\section{Introduction} The concept of synchronistion is based on the adjustment of rhythms of oscillating systems due to their interaction \cite{pikovsky01}. Synchronisation phenomenon was recognised by Huygens in the 17th century, time when he performed experiments to understand this phenomenon \cite{bennett02}. To date, several kinds of synchronisation among coupled systems were reported, such as complete \cite{li16}, phase \cite{pereira07,batista10}, lag \cite{huang14}, and collective almost synchronisation \cite{baptista12}. Neuronal synchronous rhythms have been observed in a wide range of researches about cognitive functions \cite{wang10,hutcheon00}. Electroencephalography and magnetoencephalography studies have been suggested that neuronal synchronization in the gamma frequency plays a functional role for memories in humans \cite{axmacher06,fell11}. Steinmetz et al. \cite{steinmetz00} investigated the synchronous behaviour of pairs of neurons in the secondary somatosensory cortex of monkey. They found that attention modulates oscillatory neuronal synchronisation in the somatosensory cortex. Moreover, in the literature it has been proposed that there is a relationship between conscious perception and synchronisation of neuronal activity \cite{hipp11}. We study spiking and bursting synchronisation betwe\-en neuron in a neuronal network model. A spike refers to the action potential generated by a neuron that rapidly rises and falls \cite{lange08}, while bursting refers to a sequence of spikes that are followed by a quiescent time \cite{wu12}. It was demonstrated that spiking synchronisation is relevant to olfactory bulb \cite{davison01} and is involved in motor cortical functions \cite{riehle97}. The characteristics and mechanisms of bursting synchronisation were studied in cultured cortical neurons by means of planar electrode array \cite{maeda95}. Jefferys $\&$ Haas discovered synchronised bursting of CA1 hippocampal pyramidal cells \cite{jefferys82}. There is a wide range of mathematical models used to describe neuronal activity, such as the cellular automaton \cite{viana14}, the Rulkov map \cite{rulkov01}, and differential equations \cite{hodgkin52,hindmarsh84}. One of the simplest mathematical models and that is widely used to depict neuronal behaviour is the integrate-and-fire \cite{lapicque07}, which is governed by a linear differential equation. A more realistic version of it is the adaptive exponential integrate-and-fire (aEIF) model which we consider in this work as the local neuronal activity of neurons in the network. The aEIF is a two-dimensional integrate-and-fire model introduced by Brette $\&$ Gerstner \cite{brette05}. This model has an exponential spike mechanism with an adaptation current. Touboul $\&$ Brette \cite{touboul08} studied the bifurcation diagram of the aEIF. They showed the existence of the Andronov-Hopf bifurcation and saddle-node bifurcations. The aEIF model can generate multiple firing patterns depending on the parameter and which fit experimental data from cortical neurons under current stimulation \cite{naud08}. In this work, we focus on the synchronisation phenomenon in a randomly connected network. This kind of network, also called Erd\"os-R\'enyi network \cite{erdos59}, has nodes where each pair is connected according to a probability. The random neuronal network was utilised to study oscillations in cortico-thalamic circuits \cite{gelenbe98} and dynamics of network with synaptic depression \cite{senn96}. We built a random neuronal network with unidirectional connections that represent chemical synapses. We show that there are clearly separated ranges of parameters that lead to spiking or bursting synchronisation. In addition, we analyse the robustness to external perturbation of the synchronisation. We verify that bursting synchronisation is more robustness than spiking synchronisation. However, bursting synchronisation requires larger chemical synaptic strengths, and larger voltage potential relaxation reset to appear than those required for spiking synchronisation. This paper is organised as follows: in Section II we present the adaptive exponential integrate-and-fire model. In Section III, we introduce the neuronal network with random features. In Section IV, we analyse the behaviour of spiking and bursting synchronisation. In the last Section, we draw our conclusions. \section{Adaptive exponential integrate-and-fire} As a local dynamics of the neuronal network, we consider the adaptive exponential integrate-and-fire (aEIF) model that consists of a system of two differential equations \cite{brette05} given by \begin{eqnarray}\label{eqIF} C \frac{d V}{d t} & = & - g_L (V - E_L) + {\Delta}_T \exp \left(\frac{V - V_T}{{\Delta}_T} \right) \nonumber \\ & & +I-w , \nonumber \\ \tau_w \frac{d w}{d t} & = & a (V - E_L) - w, \end{eqnarray} where $V(t)$ is the membrane potential when a current $I(t)$ is injected, $C$ is the membrane capacitance, $g_L$ is the leak conductance, $E_L$ is the resting potential, $\Delta_T$ is the slope factor, $V_T$ is the threshold potential, $w$ is an adaptation variable, $\tau_w$ is the time constant, and $a$ is the level of subthreshold adaptation. If $V(t)$ reaches the threshold $V_{\rm{peak}}$, a reset condition is applied: $V\rightarrow V_r$ and $w\rightarrow w_r=w+b$. In our simulations, we consider $C=200.0$pF, $g_L=12.0$nS, $E_L=-70.0$mV, ${\Delta}_T=2.0$mV, $V_T=-50.0$mV, $I=509.7$pA, $\tau_w=300.0$ms, $a=2.0$nS, and $V_{\rm{peak}}=20.0$mV \cite{naud08}. The firing pattern depends on the reset parameters $V_r$ and $b$. Table \ref{table1} exhibits some values that generate five different firing patterns (Fig. \ref{fig1}). In Fig. \ref{fig1} we represent each firing pattern with a different colour in the parameter space $b\times V_r$: adaptation in red, tonic spiking in blue, initial bursting in green, regular bursting in yellow, and irregular in black. In Figs. \ref{fig1}a, \ref{fig1}b, and \ref{fig1}c we observe adaptation, tonic spiking, and initial burst pattern, respectively, due to a step current stimulation. Adaptation pattern has increasing inter-spike interval during a sustained stimulus, tonic spiking pattern is the simplest regular discharge of the action potential, and the initial bursting pattern starts with a group of spikes presenting a frequency larger than the steady state frequency. The membrane potential evolution with regular bursting is showed in Fig. \ref{fig1}d, while Fig. \ref{fig1}e displays irregular pattern. \begin{table}[htbp] \caption{Reset parameters.} \centering \begin{tabular}{c c c c c} \hline Firing patterns & Fig. & b (pA) & $V_r$ (mV) & Layout \\ \hline adaptation &\ref{fig1}(a) & 60.0 & -68.0 & red \\ tonic spiking & \ref{fig1}(b) & 5.0 & -65.0 & blue\\ initial burst & \ref{fig1}(c) & 35.0 & -48.8 & green \\ regular bursting & \ref{fig1}(d) & 40.0 & -45.0 & yellow\\ irregular & \ref{fig1}(e) & 41.2 & -47.4 & black \\ \hline \end{tabular} \label{table1} \end{table} \begin{figure}[hbt] \centering \includegraphics[height=7cm,width=10cm]{fig1.eps} \caption{(Colour online) Parameter space for the firing patterns as a function of the reset parameters $V_r$ and $b$. (a) Adaptation in red, (b) tonic spiking in blue, (c) initial bursting in green, (d) regular bursting in yellow, and (e) irregular in black.} \label{fig1} \end{figure} As we have interest in spiking and bursting synchronisation, we separate the parameter space into a region with spike and another with bursting patterns (Fig. \ref{fig2}). To identify these two regions of interest, we use the coefficient of variation (CV) of the neuronal inter-spike interval (ISI), that is given by \begin{eqnarray}\label{CV} {\rm CV}=\frac{{\sigma}_{\rm{ISI}}}{\rm{\overline{ISI}}}, \end{eqnarray} where ${\sigma}_{\rm{ISI}}$ is the standard deviation of the ISI normalised by the mean $\bar{\rm ISI}$ \cite{gabbiani98}. Spiking patterns produce $\rm{CV}<0.5$. Parameter regions that represent the neurons firing with spiking pattern are denoted by gray colour in Fig. \ref{fig2}. Whereas, the black region represents the bursting patterns, which results in $\rm{CV} \geq 0.5$. \begin{figure}[hbt] \centering \includegraphics[height=7cm,width=9cm]{fig2.eps} \caption{Parameter space for the firing patterns as a function of the reset parameters $V_r$ and $b$. Spike pattern in region I ($\rm{CV}<0.5$) and bursting pattern in region II ($\rm{CV}\geq 0.5$) are separated by white circles.} \label{fig2} \end{figure} \section{Spiking or bursting synchronisation} In this work, we constructed a network where the neurons are randomly connected \cite{erdos59}. Our network is given by \begin{eqnarray}\label{eqIFrede} C \frac{d V_i}{d t} & = & - g_L (V_i - E_L) + {\Delta}_T \; \rm{exp} \left(\frac{V_i - V_T}{{\Delta}_T} \right) \nonumber \\ & + & I_i - w_i + g_{\rm{ex}} (V_{\rm{ex}} - V_i) \sum_{j=1}^N A_{ij} s_j + \Gamma_i, \nonumber \\ \tau_w \frac{d w_i}{d t} & = & a_i (V_i - E_L) - w_i, \nonumber \\ \tau_{\rm{ex}} \frac{d s_i}{d t} & = & - s_i. \end{eqnarray} where $V_i$ is the membrane potential of the neuron $i$, $g_{\rm{ex}}$ is the synaptic conductance, $V_{\rm{ex}}$ is the synaptic reversal potential, $\tau_{\rm{ex}}$ is the synaptic time constant, $s_i$ is the synaptic weight, $A_{ij}$ is the adjacency matrix, $\Gamma_i$ is the external perturbation, and $a_i$ is randomly distributed in the interval $[1.9,2.1]$. The schematic representation of the neuronal network that we have considered is illustrated in Fig \ref{fig3}. Each neuron is randomly linked to other neurons with a probability $p$ by means of directed connections. When $p$ is equal to 1, the neuronal network becames an all-to-all network. A network with this topology was used by Borges et al. \cite{borges16} to study the effects of the spike timing-dependent plasticity on the synchronisation in a Hodgkin-Huxley neuronal network. \begin{figure}[hbt] \centering \includegraphics[height=6cm,width=9cm]{fig3.eps} \caption{Schematic representation of the neuronal network where the neurons are connected according to a probability $p$.} \label{fig3} \end{figure} A useful diagnostic tool to determine synchronous behaviour is the complex phase order parameter defined as \cite{kuramoto03} \begin{equation} z(t)=R(t)\exp({\rm i}\Phi(t))\equiv\frac{1}{N}\sum_{j=1}^{N}\exp({\rm i}\psi_{j}), \end{equation} where $R$ and $\Phi$ are the amplitude and angle of a centroid phase vector, respectively, and the phase is given by \begin{equation} \psi_{j}(t)=2\pi m+2\pi\frac{t-t_{j,m}}{t_{j,m+1}-t_{j,m}}, \end{equation} where $t_{j,m}$ corresponds to the time when a spike $m$ ($m=0,1,2,\dots$) of a neuron $j$ happens ($t_{j,m}< t < t_{j,m+1}$). We have considered the beginning of the spike when $V_j>-20$mV. The value of the order parameter magnitude goes to 1 in a totally synchronised state. To study the neuronal synchronisation of the network, we have calculated the time-average order-parameter, that is given by \begin{equation} \overline{R}=\frac{1}{t_{\rm fin}-{t_{\rm ini}}}\sum_{t_{\rm ini}}^{t_{\rm fin}}R(t), \end{equation} where $t_{\rm fin}-t_{\rm ini}$ is the time window for calculating $\bar{R}$. Figs. \ref{fig4}a, \ref{fig4}b, and \ref{fig4}c show the raster plots for $g_{\rm ex}=0.02$nS, $g_{\rm ex}=0.19$nS, and $g_{\rm ex}=0.45$nS, respectively, considering $V_r=-58$mV, $p=0.5$, and $b=70$pA, where the dots correspond to the spiking activities generated by neurons. For $g_{\rm ex}=0.02$nS (Fig. \ref{fig4}a) the network displays a desynchonised state, and as a result, the order parameter values are very small (black line in Fig. \ref{fig4}d). Increasing the synaptic conductance for $g_{\rm ex}=0.19$nS, the neuronal network exhibits spike synchronisation (Fig. \ref{fig4}b) and the order parameter values are near unity (red line in Fig. \ref{fig4}d). When the network presents bursting synchronisation (Fig. \ref{fig4}c), the order parameter values vary between $R\approx 1$ and $R\ll 1$ (blue line in Fig. \ref{fig4}d). $R\ll 1$ to the time when the neuron are firing. \begin{figure}[hbt] \centering \includegraphics[height=11cm,width=10cm]{fig4.eps} \caption{(Colour online) Raster plot for (a) $g_{\rm ex}=0.02$nS, (b) $g_{\rm ex}=0.19$nS, and (c) $g_{\rm ex}=0.45$nS, considering $V_r = -58$mV, $p=0.5$, and $b=70$pA. In (d) the order parameter is computed for $g_{\rm ex}=0.02$nS (black line), $g_{\rm ex}=0.19$nS (red line), and $g_{\rm ex}=0.19$nS (blue line).} \label{fig4} \end{figure} In Fig. \ref{fig5}a we show ${\bar R}$ as a function of $g_{\rm ex}$ for $p=0.5$, $b=50$pA (black line), $b=60$pA (red line), and $b=70$pA (blue line). The three results exhibit strong synchronous behaviour (${\bar R}>0.9$) for many values of $g_{\rm ex}$ when $g_{\rm ex}\gtrsim 0.4$nS . However, for $g_{\rm ex}\lesssim 0.4$nS, it is possible to see synchronous behaviour only for $b=70$pA in the range $0.15{\rm nS}<g_{\rm ex}<0.25{\rm nS}$. In addition, we calculate the coefficient of variation (CV) to determine the range in $g_{\rm ex}$ where the neurons of the network have spiking or bursting behaviour (Fig. \ref{fig5}b). We consider that for CV$<0.5$ (black dashed line) the neurons exhibit spiking behaviour, while for CV$\geq 0.5$ the neurons present bursting behaviour. We observe that in the range $0.15{\rm nS}<g_{\rm ex}<0.25{\rm nS}$ for $b=70$pA there is spiking sychronisation, and bursting synchronisation for $g_{\rm ex}\gtrsim 0.4$nS. \begin{figure}[hbt] \centering \includegraphics[height=7cm,width=9cm]{fig5.eps} \caption{(Colour online) (a) Time-average order parameter and (b) CV for $V_r=-58$mV, $p=0.5$, $b=50$pA (black line), $b=60$pA (red line), and $b=70$pA (blue line).} \label{fig5} \end{figure} \section{Parameter space of synchronisation} The synchronous behaviour depends on the synaptic conductance and the probability of connections. Fig. \ref{fig6} exhibits the time-averaged order parameter in colour scale as a function of $g_{\rm ex}$ and $p$. We verify a large parameter region where spiking and bursting synchronisation is strong, characterised by ${\bar R}>0.9$. The regions I and II correspond to spiking and bursting patterns, respectively, and these regions are separated by a white line with circles. We obtain the regions by means of the coefficient of variation (CV). There is a transition between region I and region II, where neurons initially synchronous in the spike, loose spiking synchronicity to give place to a neuronal network with a regime of bursting synchronisation. \begin{figure}[hbt] \centering \includegraphics[height=6cm,width=9cm]{fig6.eps} \caption{(Colour online) $g_{\rm ex} \times p$ for $V_r=-58$mV and $b=70$pA, where the colour bar represents the time-average order parameter. The regions I (spike patterns) and II (bursting patterns) are separated by the white line with circles.} \label{fig6} \end{figure} We investigate the dependence of spiking and bursting synchronisation on the control parameters $b$ and $V_r$. To do that, we use the time average order parameter and the coefficient of variation. Figure \ref{fig7} shows that the spike patterns region (region I) decreases when $g_{\rm ex}$ increases. This way, the region I for $b<100$pA and $V_r=-49$mV of parameters leading to no synchronous behaviour (Fig. \ref{fig7}a), becomes a region of parameters that promote synchronised bursting (Fig. \ref{fig7}b and \ref{fig7}c). However, a large region of desynchronised bursting appears for $g_{\rm ex}=0.25$nS about $V_r=-45$mV and $b>100$pA in the region II (Fig. \ref{fig7}b). For $g_{\rm ex}=0.5$nS, we see, in Fig. \ref{fig7}c, three regions of desynchronous behaviour, one in the region I for $b<100$pA, other in region II for $b<200$pA, and another one is located around the border (white line with circles) between regions I and II for $b>200$pA. \begin{figure}[hbt] \centering \includegraphics[height=12cm,width=7cm]{fig7.eps} \caption{(Colour online) Parameter space $b \times V_r$ for $p=0.5$, $\gamma=0$ (a) $g_{\rm ex}=0.05$nS, (b) $g_{\rm ex}=0.25$nS, and (c) $g_{\rm ex}=0.5$nS, where the colour bar represents the time-average order parameter. The regions I (spike patterns) and II (bursting patterns) are separated by white circles.} \label{fig7} \end{figure} It has been found that external perturbations on neuronal networks not only can induce synchronous behaviour \cite{baptista06,zhang15}, but also can suppress synchronisation \cite{lameu16}. Aiming to study the robustness to perturbations of the synchronous behaviour, we consider an external perturbation $\Gamma_i$ (\ref{eqIFrede}). It is applied on each neuron $i$ with an average time interval of about $10$ms and with a constant intensity $\gamma$ during $1$ms. Figure \ref{fig8} shows the plots $g_{\rm ex} \times p$ for $\gamma>0$, where the regions I and II correspond to spiking and bursting patterns, respectively, separated by white line with circles, and the colour bar indicates the time-average order parameter values. In this Figure, we consider $V_r=-58$mV, $b=70$pA, (a) $\gamma=250$pA, (b) $\gamma=500$pA, and (c) $\gamma=1000$pA. For $\gamma=250$pA (Fig. \ref{fig8}a) the perturbation does not suppress spike synchronisation, whereas for $\gamma=500$pA the synchronisation is completely suppressed in region I (Fig. \ref{fig8}b). In Fig. \ref{fig8}c, we see that increasing further the constant intensity for $\gamma=1000$pA, the external perturbation suppresses also bursting synchronisation in region II. Therefore,the synchronous behavior in region II is more robustness to perturbations than in the region I, due to the fact that the region II is in a range with high $g_{\rm ex}$ and $p$ values, namely strong coupling and high connectivity. \begin{figure}[hbt] \centering \includegraphics[height=12cm,width=7cm]{fig8.eps} \caption{(Colour online) $g_{\rm ex} \times p$ for $V_r=-58$mV, $b=70$pA, (a) $\gamma=250$pA, (b) $\gamma=500$pA, and (c) $\gamma=1000$pA.} \label{fig8} \end{figure} In order to understand the perturbation effect on the spike and bursting patterns, we consider the same values of $g_{\rm ex}$ and $p$ as Fig. \ref{fig7}a. Figure \ref{fig9} exhibits the space parameter $b\times V_r$, where $\gamma$ is equal to $500$pA. The external perturbation suppresses synchronisation in the region I, whereas we observe synchronisation in region II. The synchronous behaviour in region II can be suppressed if the constant intensity $\gamma$ is increased. Therefore, bursting synchronisation is more robustness to perturbations than spike synchronisation. \begin{figure}[hbt] \centering \includegraphics[height=5cm,width=7cm]{fig9.eps} \caption{(Colour online) $b \times V_r$ for $g_{\rm ex}=0.05$nS, $p=0.5$, and $\gamma=500$pA, where the colour bar represents the time-average order parameter. The regions I (spike patterns) and II (bursting patterns) are separated by white line with circles.} \label{fig9} \end{figure} \section{Conclusion} In this paper, we studied the spiking and bursting synchronous behaviour in a random neuronal network where the local dynamics of the neurons is given by the adaptive exponential integrate-and-fire (aEIF) model. The aEIF model can exhibit different firing patterns, such as adaptation, tonic spiking, initial burst, regular bursting, and irregular bursting. In our network, the neurons are randomly connected according to a probability. The larger the probability of connection, and the strength of the synaptic connection, the more likely is to find bursting synchronisation. It is possible to suppress synchronous behaviour by means of an external perturbation. However, synchronous behaviour with higher values of $g_{\rm ex}$ and $p$, which typically promotes bursting synchronisation, are more robust to perturbations, then spike synchronous behaviour appearing for smaller values of these parameters. We concluded that bursting synchronisation provides a good environment to transmit information when neurons are stron\-gly perturbed (large $\Gamma$). \section*{Acknowledgements} This study was possible by partial financial support from the following Brazilian government agencies: CNPq, CAPES, and FAPESP (2011/19296-1 and 2015/07311-7). We also wish thank Newton Fund and COFAP.
{'timestamp': '2016-07-18T02:09:37', 'yymm': '1607', 'arxiv_id': '1607.04618', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04618'}
arxiv
\section{Introduction} To write high-quality program code for a Multi-Processor System-on-Chip (MPSoC), software developers must fully understand how their code will be executed on-chip. Debugging and tracing tools can help developers to gain this understanding. They are a keyhole through which developers can peek and observe the software execution. Today, and even more in the future, this keyhole narrows as MPSoCs integrate more functionalities, while at the same time the amount of software increases dramatically. Furthermore, concurrency and deep interaction of software with hardware components beyond the instruction set architecture (ISA) boundary are on the rise. Therefore more, not less, insight into the system is needed to keep up or even increase developer productivity. Many of today's MPSoCs are executing concurrent code on multiple cores, interact with the physical environment (cyber-physical systems), or must finish execution in a bounded amount of time (hard real-time). In these scenarios, a non-intrusive observation of the software execution is required, like it is provided by tracing. Instead of stopping the system for observation, as done in run-control debugging, the observed data is transferred off-chip for analysis. Unfortunately, observing a full system execution would generate data streams in the range of petabits per second~\cite[p.~16]{vermeulen_debugging_2014}. This is the most significant drawback of tracing: the system insight is limited by the off-chip bottleneck. Today's tracing systems, like ARM CoreSight~\cite{CoreSightWebsite} or NEXUS 5001~\cite{_nexus_2003} are designed to efficiently capture the operation of a functional unit (like a CPU) as compressed trace stream. With filters and triggers it is possible to configure which and when a functional unit is traced (observed). The trace streams (or short, traces) are then transported across an off-chip interface (and possibly other intermediate devices) to a host PC. Upon arrival the compressed trace streams are first decompressed (reconstructed) using the program binary and other static information which was removed before. The reconstructed trace streams are then fed to a data analysis application, which extracts information out of the data. This information can then be presented to a developer or it can be used by other tools, e.g. for runtime verification. \medskip The \textbf{main idea} in this work is to move the data analysis (at least partially) from the host PC into the chip. Bringing the computation closer to the data sources reduces the off-chip bandwidth requirements, and ultimately increases insight into software execution. To realize this idea, we introduce \emph{DiaSys}, a replacement for the tracing system in an MPSoC. DiaSys does not stream full execution traces off-chip for analysis. Instead, it first creates events from observations on the chip. Events can signal any interesting state change of the observed system, like the execution of a function in the program code, a change in interconnect load beyond a threshold, or the read of a data word from a certain memory address. A \emph{diagnosis application} then processes the observed events to give them ``meaning.'' Given an appropriate diagnosis application, a software developer might not be presented with any more a sequence of events like ``a read/write request was issued'', but with the more meaningful output of the diagnosis application ``a race condition bug was observed.'' Analyzing the data on-chip is not only beneficial to reduce the off-chip bandwidth requirements, but also enables new use cases in the future, such as self-adapting or self-healing systems. However, doing all this processing on-chip would, in some cases (and markets), be too costly in terms of chip area. Therefore, we describe the diagnosis applications so that they can be transparently split into multiple parts: one part executing on-chip in dedicated, distributed hardware components close to the data source, and another part running on a host PC. In summary, our \textbf{key contributions} are: \begin{itemize} \item an architecture and component library of on-chip infrastructure to collect and analyze diagnosis data created during the software execution, and \item a model of computation which allows developers to describe data analysis tasks (the ``diagnosis application'') in a way which is independent of the specific hardware implementation of the diagnosis system. \end{itemize} Combining these two contributions, we show that \begin{itemize} \item DiaSys is a viable alternative to tracing systems in the two major fields where tracing is employed today: hypothesis testing (debugging) and the collection of runtime statistics. Two case studies explore these use cases (Section~\ref{sec:usage}). \item the diagnosis applications introduced by DiaSys are a beneficial representation of a data analysis task: they abstract from the implementation through a clearly defined model of computation to foster re-use and portability (Section~\ref{sec:method:diagnosis_applications}). \item DiaSys is implementable in hardware with reasonable system cost (Section~\ref{sec:hwimpl}). \end{itemize} In the following, we explore our diagnosis system in depth. We start with a thorough analysis of the state of the art in tracing systems in Section~\ref{sec:related_work}, based on which we developed our concept of the diagnosis system presented in Section~\ref{sec:method}. We include a detailed model of a diagnosis application and a discussion of its semantics in Section~\ref{sec:method:diagnosis_applications}. The architecture of our diagnosis system is presented next in Section~\ref{sec:arch}, followed by a discussion of its possible limitations. In Section~\ref{sec:hwimpl} we present our hardware implementation. Combining all parts, we show two usage examples in Section~\ref{sec:usage}, one to find a multi-core race condition bug, and one to create an application profile. \paragraph{A word on terminology} We use the terms ``diagnosis'' and ``diagnosis system'' to stress the fact that we integrate the on-chip observation of the software execution with the data analysis. We use ``tracing'' to refer to the method of obtaining insight into the SoC by transferring a stream of observations from a functional unit off-chip. ``Debugging'' is used as a synonym for ``hypothesis testing,'' the process of (usually manually) checking (by various means) if the software behaves as expected. \section{Background and Related Work} \label{sec:related_work} Our approach touches and integrates two usually separated topics: obtaining a software execution trace from a SoC, and processing the obtained information in order to generate useful information. In this section we present background and related work on both topics. \subsection{Gaining Insight into SoCs} \label{sec:related_work:insight} \begin{figure} \centering \includesvgnolatex{img/diagnosis_applications_existing} \caption{A schematic view of a common tracing system like ARM CoreSight or NEXUS 5001.} \label{fig:diagnosis_applications_existing} \end{figure} Today's tracing solutions for SoCs are designed to capture and transfer as much as possible of the SoC's internal state to an external observer. They are generally structured as shown in Figure~\ref{fig:diagnosis_applications_existing}. First, trace data streams are obtained from the observation of various functional units in the system, like CPUs, buses and memories. Then, this data is spatially and temporally reduced through the use of filters and triggers. Finally, the redundancy in the data is removed by the use of compression algorithms. The resulting trace data stream is then transferred off-chip (live or delayed through an on-chip memory buffer). On a host PC, the original trace streams are reconstructed using information from the program binary and other static information, which was discarded as part of the compression process. All major commercial SoC vendors offer tracing solutions based on this template. ARM provides its licensees the CoreSight intellectual property (IP) blocks~\cite{CoreSightWebsite}. They are used in SoCs from Texas Instruments, Samsung and STMicroelectronics, among others. Vendors such as Qualcomm (formerly Freescale) include tracing solutions based on the IEEE-ISTO~5001 (Nexus) standard~\cite{_nexus_2003}, while Infineon integrates the Multi-Core Debug Solution (MCDS) into its automotive microcontrollers~\cite{ipextreme_infineon_2008}. Since 2015 Intel also includes a tracing solution in their desktop, server and embedded processors called Intel Processor Trace (PT)~\cite{_intel_2015}. The main differentiator between the solutions is the configurability of the filter and trigger blocks. Driven by the off-chip bottleneck, a major research focus are lossless trace compression schemes. Program trace compression available in commercial solutions typically requires 1 to 4~bit per executed instruction~\cite{hopkins_debug_2006, orme_debug_2008}, while solutions proposed in academia claim compression ratios down to $0.036$~bit per instruction~\cite{uzelac_real-time_2010}. Even though data traces contain in general no redundancy, in practice compression rates of about 4:1 have been achieved \cite{hopkins_debug_2006}. \subsection{Analyzing System Behavior} \label{sec:related_work:analysis} A human is easily overwhelmed when asked to analyze multiple gigabits of trace data each second. Instead, automated analysis tools are used to extract useful information out of the vast amount of trace data. Such tools have one common goal: to help a developer better understand the software execution on the target system. The means to achieve this goal, however, vary widely. Diagnosis applications which analyze non-functional issues such as performance bugs often generate results in the form of ordered lists. They list for example applications which consume most processing or memory resources, or which generate most I/O traffic. This report can then be a starting point for a more fine-grained analysis of the problem. Diagnosis applications which target functional bugs are usually more specialized; in many cases, a diagnosis application is created just to confirm or negate one single hypothesis about the software execution on the chip. For example, a developer might want to confirm that a certain variable stays within defined bounds, e.g. to check if an array overflow occurred. Most analysis tools for SoCs are not stand-alone applications, but part of debugging and tracing software packages from vendors like Lauterbach, Green Hills or ARM. They are usually controlled through a graphical user interface. Of course, analysis applications used to understand software execution are not only developed for SoCs and other embedded systems. Most tools in this domains are intrusive: they run as part of the analyzed system and obtain the required system state through instrumentation. However, the general concepts are also relevant for the diagnosis of SoCs. This is especially true for scriptable or programmable debugging, which applies the concept of event-driven programming to debugging. Whenever a defined \emph{probe point} is hit, an event is triggered and an \emph{event handler} executes. Common probe points are the execution of a specific part of the program (like entering a certain program function), or the access to a given memory location. The best-known current implementations of this concept are DTrace and SystemTap, which run on, or are part of, BSDs, Linux, and macOS (where DTrace is integrated into the ``Apple Instruments'' product) \cite{cantrill_dynamic_2004,eigler_architecture_2005}. The concept, however, is much older. Dalek~\cite{olsson_dataflow_1991} is built on top of the GNU Debugger (GDB) and uses a dataflow approach to combine events and generate higher-level events out of primitive events. Marceau et al. extend the dataflow approach and apply it to the debugging of Java applications~\cite{marceau_dataflow_2004}. Coca~\cite{ducasse_coca_1999}, on the other hand, uses a language based on Prolog to define conditional breakpoints as a sequence of events described through predicates for debugging C programs. In a work targeting early multi-processor systems, but otherwise closely related to our approach, Lumpp et. al. present a debugging system which is based on an event/action model~\cite{lumpp_specification_1990}. A specification language is used to describe events in the system trigger which an action, and hardware units can be used to identify these events. None of the presented works directly tackle the observability problem in SoCs by moving the data analysis partially on-chip. However, they form a strong foundation of ideas, which inspired us in the design of the diagnosis system. It is presented in the following sections. \section{DiaSys, Our Diagnosis System} \label{sec:method} We have designed our diagnosis system to address the shortcomings of today's tracing systems. Based on a set of requirements, we discuss the design of the diagnosis system in depth, followed by a hardware/software architecture implementing the diagnosis system. First, however, we define some terms used in the following discussion. \subsection{Definitions} \paragraph{Observed system} The part of the SoC which is observed or monitored by the diagnosis system. In other works, the term ``target system'' is used. \paragraph{Functional unit} A subset of the observed system which forms a logical unit to provide a certain functionality. Examples for functional units are CPUs, memories, or interconnect resources such as a bus or NoC routers. \paragraph{State} The state of a system is the unity of all stored information in that system at a given point in time which is necessary to explain its future behavior.~\cite[p.~103]{harris_digital_2012} In a sequential circuit, the state is equal to the memory contents of the system. \subsection{Design Requirements for the Diagnosis System} \label{sec:method:requirements} A set of requirements guides the design of the diagnosis system. \paragraph{Distributed} The diagnosis system must be able to reduce the amount of observation data as close to the source, i.e. the functional units, as possible. Since the data sources are distributed across the chip, the diagnosis system must also be distributed appropriately. \paragraph{Non-Intrusive} The diagnosis system must be non-intrusive (passive). Non-intrusive observation preserves the event ordering and temporal relationships in concurrent executions, a requirement for debugging multi-core, real-time, or cyber-physical systems~\cite{fidge_fundamentals_1996}. Non-intrusiveness also gives a developer the confidence that he or she is observing a bug in the program code, not chasing a problem caused by the observation (a phenomenon often called ``Heisenbug''~\cite{gray_why_1986}). \paragraph{Flexible On-Chip/Off-Chip Cost Split} The diagnosis system must be flexible to implement. The implementation of the diagnosis system involves a trade-off between the provided level of observability and the system cost. The two main cost contributions are the off-chip interface and the chip area spent on diagnosis extensions. The diagnosis system concept must be flexible enough to give the chip designer the freedom to configure the amount of chip resources, the off-chip bandwidth and the pin count in a way that fits the chip's target market. At the same time, to provide flexibility on the observation, the system must be able to adapt to a wide range of bugs. \paragraph{Relaxed Timing Constraints} The diagnosis system must not assume a defined timing relationship between the individual distributed components. Today's larger SoCs are designed as globally asynchronous, locally synchronous (GALS) systems with different power and clock domains, where no fixed time relationship between components can be given. \subsection{The Concept of the Diagnosis System} \label{sec:method:concept} \begin{figure} \centering \includesvgnolatex{img/diasys_model} \caption{A schematic view of the diagnosis system.} \label{fig:diasys_model} \end{figure} Based on the discussed requirements this section gives an overview on the diagnosis system as shown in Figure~\ref{fig:diasys_model}. The \textit{input} to the diagnosis system is the state of the observed system over time, the \textit{output} are the diagnosis results, which can be represented in various forms. With respect to the input and output interfaces, the diagnosis system is identical to a traditional tracing system. The difference lies in the components which generate the output from the input. Three main components are responsible for this processing: the event generators, the diagnosis application together with its execution platform, and the event sinks. Between these components, data is exchanged as diagnosis events. \textit{Diagnosis events are the container for data} exchanged in the diagnosis system. In the general case, an event consists of a type identifier and a payload. Events are self-contained, i.e. they can be decoded without the help from previous or subsequent events. \textit{Event generators produce} primary events based on state changes in the observed system. They continuously compare the state of the observed system with a \emph{trigger condition}. If this condition holds, they \emph{trigger} the generation of a primary event. A \emph{primary event} is a specialized diagnosis event in which the type identifier is equal to a unique identifier describing the event generator. The payload contains a partial snapshot of the state of the observed system at the same instant in time as the event was triggered. Which parts of the state are attached to the event is specified by the event generator. For example, a CPU event generator might produce primary events when it observes a function call and attach the current value of a CPU register as payload. A primary event answers two questions: why was the event generated, and in which state was the observed system at this moment in time. \textit{The diagnosis application analyzes} the software execution on the observed system. It is modeled as transformational dataflow application, which transforms primary events into output events. The goal of this transformation is to interpret the state changes represented in primary events in a way that yields useful information for a developer or an automated tool. We describe diagnosis applications in more detail in Section~\ref{sec:method:diagnosis_applications}. \textit{The diagnosis application execution platform} executes diagnosis applications. The execution platform can span (transparent to the diagnosis application developer) across the chip boundary. On the chip, it consists of specialized hardware blocks which are able to execute (parts of) the diagnosis application. On the host PC, a software runtime environment enables execution of the remaining parts of the diagnosis application. The on- and off-chip part of the execution platform are connected through the off-chip interface. This split design of the execution platform allows hardware designers to trade off chip area with the bandwidth provided for the off-chip interface, while retaining the same level of processing power, and in consequence, system observability. \textit{Event sinks consume} output events produced by the diagnosis application. Their purpose is to present the data either to a human user in a suitable form (e.g. as a simple log of events, or as visualization), or to format the events in a way that makes them suitable for consumption by an automated tool, or possibly even for usage by an on-chip component. An example usage scenario for an automated off-chip user is runtime validation, in which data collected during the runtime of the program is used to verify properties of the software. Together, event generators, the diagnosis application and the event sink build a processing chain which provides a powerful way to distill information out of observations in the SoC. \subsection{Diagnosis Applications} \label{sec:method:diagnosis_applications} Diagnosis applications are the heart of the diagnosis system, as they perform the ``actual work'' of interpreting what happens on the observed system during the software execution. Diagnosis applications are transformational dataflow applications. We chose this model to enable the transparent mapping of the diagnosis application to an execution platform spanning across the chip boundary. Our goal is that the developer of the diagnosis application does not need to explicitly partition the diagnosis application into an on-chip and an off-chip part; instead, this mapping could be performed in an automated way. (Currently, however, we do not perform an automated mapping.) No matter how the diagnosis application is mapped onto the execution platform, the behavior of the application follows identical rules, i.e. the semantics of the application stay the same. The diagnosis application is a \emph{transformational application}, in contrast to reactive or interactive applications~\cite{halbwachs_synchronous_1991}. This means, starting from a given set of inputs, the application \emph{eventually} produces an output. The application code only describes the functional relationship between the input and the output, not the timing when the output is generated. The application also does not influence or interact in another way with the observed system from which its inputs are derived. The diagnosis application is structured as \emph{dataflow application}. Its computation is represented by a directed graph, in which the nodes model the computation, and the edges model communication links. In diagnosis applications we call the graph nodes \emph{transformation actors}, and the graph edges \emph{channels}. \begin{figure} \centering \includesvgnolatex{img/transformation_actor} \caption{A transformation actor with $n=3$ input channels and $m = 2$ output channels.} \label{fig:transformation_actor} \end{figure} Each transformation actor reads events from $n \in \mathbb{N}_0$ input channels, and writes events to $m \in \mathbb{N}_0$ output channels, as shown in Figure~\ref{fig:transformation_actor}. A transformation actor starts its processing, it ``fires,'' if a \emph{sufficient} number of events are available at its inputs. The definition of ``sufficient'' depends on the individual transformation actor. For example, one transformation actor might always read one event from each input before starting the processing, while another one might always read two events from input 1 and one event from input 2. When firing, the transformation actor applies an arbitrary transformation function $f$ to the input events. The generated output depends on \begin{itemize} \item the read input events, \item the ordering of the input events, and \item the internal state of the transformation actor. \end{itemize} Transformation actors may communicate only through the input and output channels, but not through additional side channels (e.g. shared variables). Diagnosis applications built out of such transformation actors are \emph{nondeterministic}, as defined by Kahn~\cite{kahn_semantics_1974,lee_dataflow_1995}. This means, the output not only depends on the history of inputs (i.e. the current input and the state of the actor), but also on the relative timing (the ordering) of events. Nondeterministic behavior of diagnosis applications is, in most cases, the expected and wanted behavior; it gives its authors much needed flexibility. An example of nondeterministic diagnosis applications are applications which aggregate data over time, like the lock contention profiling presented in Section~\ref{sec:usage:lockprofiling}. These applications consume an unspecified amount of input events and store an aggregate of these inputs. After a certain amount of time, they send a summary of the observations to an output channel. But at the same time, nondeterministic diagnosis applications prevent the static analysis of event rates, bandwidth and processing requirements. If wanted, application authors can therefore create deterministic diagnosis applications, if they restrict themselves to \begin{itemize} \item always reading the input channels in the same order without testing for data availability first (instead, block and wait until the data arrives), \item connecting one channel to exactly one input and one output of an actor, and \item using only transformation functions which are deterministic themselves. \end{itemize} Note that we only describe the diagnosis application itself as nondeterministic. Its execution, after being mapped to an execution platform, can be deterministic, i.e. multiple identical runs produce the same diagnosis result. \subsection{Diagnosis System Architecture} \label{sec:arch} \begin{figure} \includesvgnolatex{img/diasys_hwarch} \caption{The architecture of our diagnosis system implementation. Event generators (EG) observe the functional units (FU). They connect via an interconnect to different processing nodes (PN) and an off-chip interface. On a host PC processing nodes implemented in software further process the events. Finally, event sinks prepare the data for developers or automation. A diagnosis application can be mapped flexibly on the execution platform; a sample mapping is shown.} \label{fig:diasys_hwarch} \end{figure} In the previous sections we presented the diagnosis system from a functional perspective. We continue now by presenting an implementation architecture of the diagnosis system. It consists of extensions to the SoC, as well as software on a host PC; an exemplary architecture is shown in Figure~\ref{fig:diasys_hwarch}. In the SoC, different functional units (FU) can be observed, like a CPU, a memory, or a bus. Each functional unit can be attached to one or multiple event generators (EG). The resulting events are transmitted over a diagnosis interconnect to on-chip processing nodes. The processing nodes form the execution platform for the diagnosis application; they will be discussed in depth in Section~\ref{sec:arch:execution_platform}. Invisible to the diagnosis application, the execution platform spans across the chip boundary. Through an I/O interface, a host PC is connected to the SoC. The PC contains a software runtime environment to provide further processing nodes as part of the diagnosis application execution platform. If all processing has been accomplished, the output events are sent to an event sink application on the host PC, which formats the output events for developers or automation. Depending on the features and computational power provided by the processing nodes, a diagnosis application can be mapped to the execution platform in a flexible way. \subsection{Diagnosis Application Execution Platform} \label{sec:arch:execution_platform} The heart of the diagnosis system are the diagnosis applications, which are executed on the diagnosis application execution platform. As discussed before, this platform spans across the SoC and the host PC. On the SoC, it consists of processing nodes of different types which are connected by a shared interconnect (such as a NoC or a bus). Each processing node has an input and output interface to receive and send out events on the interconnect. Different types of processing nodes can offer different degrees of flexibility regarding their computation. Some might be able to perform only a single functionality specified at hardware design time, like a counter or a statistical aggregator, while others might be freely programmable. As an example, we present in Section~\ref{sec:arch:diagnosis_processor} the Diagnosis Processor, a programmable general-purpose processing node. As the chip area (economically) available for on-chip diagnosis processing is limited, the diagnosis application execution platform extends to the host PC. Connected through an arbitrary off-chip interface, a runtime layer in software provides a virtually unlimited number of ``soft'' processing nodes. Such PNs are implemented in software on the host PC and accept, like their on-chip counterpart, events as input and produce events as output. By being executed on a host PC, they provide more compute and memory resources. \medskip The transformation or computation in a diagnosis application is represented by transformation actors. For execution, they are mapped to the available processing nodes, as shown exemplary in Figure~\ref{fig:diasys_hwarch}. An $n$:1 mapping of transformation actors to processing nodes is possible, if the combined transformation of all $n$ transformation actors can be executed by the processing node. To achieve the greatest possible reduction in off-chip traffic, as much computation as possible should be mapped to on-chip processing nodes. The remainder of processing is then mapped to processing nodes on a host PC, where significantly more processing power is available. \subsubsection{The Diagnosis Processor: A Multi-Purpose Processing Node} \label{sec:arch:diagnosis_processor} The diagnosis processor is a freely programmable general-purpose processing node. Like any processor design, it sacrifices computational density for flexibility. Its design is inspired by existing scriptable debugging solutions, like SystemTap or DTrace, which have shown to provide a very useful tool for software developers in a growingly complex execution environment. The usage scenario for this processing node are custom or one-off data analysis tasks. This scenario is very common when searching for a bug in software. First, a hypothesis is formed by the developer why a problem might have occurred. Then, this hypothesis must be validated in the running system. For this validation, a custom data analysis script must be written, which is highly specific to the problem (or the system state is manually inspected). This process is repeated multiple times, until the root cause of the problem is found. As this process is approached differently by every developer (and often also influenced by experience and luck), a very flexible processing node is required. We present the hardware design of our diagnosis processor implementation in Section~\ref{sec:hwimpl:diagnosis_processor}. We envision the programming of the diagnosis processor being done through scripts similar to the ones used by SystemTap or DTrace. They allow to write trace analysis tasks on a similar level of abstraction as the analyzed software itself, leading to good developer productivity. \subsection{Discussion} The presented diagnosis system is designed to fulfill the requirements outlined in Section~\ref{sec:method:requirements}. In the following, we discuss the consequences of the design decisions, which can limit the applicability of the diagnosis system approach in some cases. By transforming the observed system state close to the source into denser information, the off-chip bottleneck can be circumvented. As a downside, this lossy transformation thwarts a usage scenario of today's tracing systems. In many of these systems, it is possible to capture a trace once, store it, and run different analysis tasks on it. If major parts of the captured data are dismissed early, this is not possible any more. Instead, the analysis task must be defined (as diagnosis application) before the system is run. If the problem hypothesis changes and a different diagnosis application is required, the system must be run again. The severity of this limitation strongly depends on how hard it is to reproduce a bug or behavior across runs. Another feature present in many of today's tracing systems, which is explicitly not supported by the diagnosis system, are cross-triggers. Cross-triggers are a mechanism in the tracing system to start or stop the observation, or to observe different components, based on another observation in the system. For example, memory accesses could be traced only after a CPU executed a certain program counter. Cross-triggers are most useful if their timing behavior is predictable. For example, memory accesses are traced ``in the next cycle'' after the specified program counter was executed. In GALS SoCs, such timing guarantees cannot be given; for a diagnosis application spanning across a SoC and a host PC, it is equally impossible to give (reasonably low bounded) timing guarantees. We make this property explicit by modeling the diagnosis system as a transformational system, not a reactive system. The commercially available tracing systems today are less specific about this. For example, ARM CoreSight uses a handshaking protocol for cross-triggers delivered across clock boundaries, which guarantees save delivery of the signal, but does not guarantee any latency. Instead of relying on cross-triggers to collect data from different sources at the same instant in time, we capture this data already when creating primary events through event generators. The payload of primary events is the only way to pass multiple state observations with a defined timing relation to the diagnosis system. For example, an event generator attached to a CPU can trigger an event based on a program counter value, and attach current contents of certain CPU registers or stack contents to it. Using this method, it is possible to generate for example an event which informs about a function being called, and which function arguments (stored in CPU registers or on the stack) have been passed to it. We show an example of such an event generator as part of our hardware implementation. Finally, we discuss the system behavior in overload situations, i.e. if more input data is received than the diagnosis system can process. Given the generally unknown input data, and the generally nondeterministic behavior of the diagnosis application, it is not possible to statically dimension the diagnosis system to be able to handle all possible input sequences. Therefore, overload situations are unavoidable in the general (and most common) case. If an overload situation is detected, the diagnosis system can react in multiple ways. First, it could temporarily stall the observed system. This gives the diagnosis system time to process outstanding events without new events being produced. This approach is only feasible in a synchronous non-realtime system. A more common approach is to discard incoming data until further processing resources are available. Depending on the diagnosis application, a recovery strategy needs to be formulated. Some applications can deal easily with incomplete input data, e.g. diagnosis applications creating statistics. Others are not able to work with an incomplete input sequence and in consequence fail to be executed properly. \medskip This ends the discussion of DiaSys in general. In the following, we present a hardware implementation of our approach, and then continue then with two usage examples how DiaSys can be put to work. \section{Implementing DiaSys in Hardware} \label{sec:hwimpl} \begin{figure} \centering \scriptsize \includesvgnolatex{img/prototype_sys} \caption{Block diagram of the prototype implementation. The diagnosis extensions added to the $2\times2$ multi-core system are drawn in blue.} \label{fig:prototype_sys} \end{figure} DiaSys, as presented in the previous section, can be implemented in various ways in hardware. Our implementation, which we present in the following, is one such implementation. It was created to answer two questions: first, to show that DiaSys can be implemented in hardware, and second, to give resource usage numbers for one specific implementation. As dimensioning and optimization for speed or area usage strongly depends on how DiaSys is used, a general answer to this question must remain out of scope for this work. \medskip The diagnosis system extends a $2 \times 2$ tiled multi-core system as shown in Figure~\ref{fig:prototype_sys}. Our implementation runs on an FPGA and uses the OpTiMSoC framework~\cite{wallentowitz_open_2013}. The observed system consists of four mor1kx CPU cores (an implementation of the OR1K or ``OpenRISC'' ISA), each connected to a distributed memory and a mesh NoC interconnect (components with white background). This system is representative of the multi- and many-core architecture template currently in research and available early products, such as the Intel SCC or the Mellanox (formerly Tilera and EZchip) Tile processors. The diagnosis system, depicted in blue, consists of the following components. \begin{itemize} \item Four event generators attached to the CPUs (marked ``EG''). \item A single diagnosis processor. \item A 16~bit wide, unidirectional ring NoC, the ``diagnosis NoC,'' to connect the components of the diagnosis system. It carries both the event packets as well as the configuration and control information for the event generators and processing nodes. \item A USB~2.0 off-chip interface. \item Software support on the host PC to control the diagnosis system, and to display the results. \end{itemize} All components connected to the diagnosis NoC follow a common template to increase reusability. Common parts are the NoC interface and a configuration module, which exposes readable and writable configuration registers over the NoC. In the following, we explain the implementation of the main components in detail. \subsection{CPU Event Generator} \label{sec:hwimpl:implementation:eventgen_cpu} \begin{figure} \centering \scriptsize \includesvgnolatex{img/eventgen_cpu} \caption{Block diagram of the CPU event generator.} \label{fig:eventgen_cpu} \end{figure} The CPU event generator is attached to a single CPU core. Its main functionality is implemented in the trigger and the state capture modules. The trigger unit of the CPU event generator triggers on two types of conditions: either the value of the program counter (PC), or the return from a function call (the jump back to the caller). At each point in time, 12 independent trigger conditions can be monitored. The number of monitored trigger conditions is proportional to the used hardware resources. Our dimensioning was determined by statistical analysis of large collections of SystemTap and DTrace scripts: $\leq 9$ concurrent probes are used in 95~\% of SystemTap scripts, and $\leq 12$ concurrent probes cover 92~\% of the DTrace scripts. The partial system state snapshot can be configured to contain the CPU register contents and the function arguments passed to the function. A block diagram of the CPU event generator is shown in Figure~\ref{fig:eventgen_cpu}. The PC trigger is implemented as simple comparator. The ``function return'' trigger requires a special implementation, because no unique point in the program flow, i.e. no single PC value, describes the return from a function (a function can have multiple call sites and can return to the caller from different points in the function body). Instead, we use the following method: \begin{enumerate} \item A PC trigger is set to the first instruction of the called function. \item If the trigger fires, the link (a.k.a. return) address is pushed to a memory structure inside the return monitor, the ``return address stack.'' The link address is the program counter to jump to if the function has finished its execution and the execution returns to the caller. On OR1K (as common on RISC architectures, including ARM and MIPS) the link address is stored in a CPU register. On other architectures and calling conventions (such as x86 and x86\_64), the link address is pushed to the stack. \item Now the system monitors the program flow for the topmost PC value in the return address stack. If this PC is executed, a function returned to its caller and the function return monitor triggers the generation of a primary event. \end{enumerate} To capture the values inside CPU registers, the register writeback signal of the mor1kx CPU is observed, and a copy of the register file is created. This copy can then be included in the event packet if a trigger fires. The passing of function arguments to functions depends on the calling convention. On OR1K, the first six data words passed to a function are available in CPU registers, all other arguments are pushed to the stack before calling the function. This is common for RISC architectures; other architectures and calling conventions might pass almost all arguments on the stack (such as x86). To record the function arguments as part of the primary event we therefore need to create a copy of the stack memory that can be accessed non-intrusively. We do this by observing CPU writes to the stack memory location. In our implementation for the mor1kx CPU we create a copy of the stack memory by monitoring the instruction stream for a store word (\texttt{l.sw}) instruction with a target address \texttt{rA} equal to the stack pointer \texttt{R1}. The data in the source register \texttt{(rB)}, together with a write offset \texttt{I} (with $\texttt{I} \geq 0$, i.e. targeting the previous stack frame) can be then used to recreate the stack frame.% \footnote{In theory, data can be written to the stack in a different way. However, the described way is common across compilers and used by the default GCC compiler for OR1K.} \subsection{Diagnosis Processor} \label{sec:hwimpl:diagnosis_processor} \begin{figure} \centering \includesvgnolatex{img/dbg_coprocessor} \caption{Block diagram of the diagnosis processor, a freely programmable processing node.} \label{fig:diagnosis_processor} \end{figure} The diagnosis processor design is extended from a standard processor template like it is used in the observed system. The main components, shown in Figure~\ref{fig:diagnosis_processor}, are a single mor1kx CPU core and an SRAM block as program and data memory. This system is extended with components to reduce the runtime overhead of processing event packets. First, the network adapter, which connects the CPU to the diagnosis NoC, directly stores the incoming event packets in the memory through a DMA engine. All event packets are processed in a run-to-completion fashion. We can therefore avoid interrupting the CPU and instead store the address of the event to be processed next in a hardware ``run queue.'' A ``discard queue'' signals the hardware scheduler which events have been processed and can be purged from memory. \subsection{Resource Usage} \begin{table} \centering \footnotesize \begin{tabulary}{\linewidth}{lLrrr} \toprule \multicolumn{2}{l}{\textbf{Module}} &\textbf{LUTS} & \textbf{REGS} & \textbf{RAMS}\\ \midrule \multicolumn{2}{l}{observed system} & 40625 & 29638 & 80 \\ & 1 compute tile (system contains 4)& $\sim 7232$ & $\sim$ 4763 & 20\\ & $2\times2$ mesh NoC & 10791 & 9964 & 0\\ & support infrastructure (DRAM if, clock/reset mgr) & 904 & 623 & 0\\ \midrule \multicolumn{2}{l}{diagnosis extensions} & 19556 & 19140 & 147\\ & 1 CPU Event Generator (fully featured)& 3603 & 6521 & 2 \\ & 1 CPU Event Generator (reduced CoreSight-like functionality) & 1365 & 1594 & 0 \\ & 1 Diagnosis Processor & 8614 & 4549 & 145\\ & diagnosis NoC & 2520 & 2926 & 0\\ \bottomrule \end{tabulary} \medskip \caption{The resource usage of a CPU diagnosis unit. Either the fully-featured or the reduced-functionality CPU Event Generator can be used.} \label{tab:resourceusage} \end{table} The prototype of the tiled MPSoC with the diagnosis extensions was synthesized for a ZTEX~1.15d board with a Xilinx Spartan-6 XC6SLX150 FPGA. The relevant hardware utilization numbers as obtained from a Synplify Premier FPGA synthesis are given in Table~\ref{tab:resourceusage}. The functional system, even though it consists of four CPU cores, is relatively small, as the used mor1kx CPU cores are lightweight (comparable to small ARM Cortex M cores). The functional system contains no memory, but uses an external DDR memory. In this scenario, the full diagnosis system is rather large. We have implemented two types of CPU event generators. A ``lite'' variant of the event generator can trigger only on a program counter value, and not on the return from a function call. This reduced functionality makes the event generator comparable to the feature set of the ARM CoreSight ETM trace unit, which is said to use $\sim$~7,000 NAND gate equivalents~\cite{orme_debug_2008}, making it similarly sized as our event generator. The possibility to trigger also on the return from a function call significantly increases the size of the event generator, mostly due to additional memory. The diagnosis processor is about 20~percent larger than a regular compute tile, as it contains an additional DMA engine and the packet queues. It also contains 30~kByte of SRAM as program and data memory, which is not present in a regular compute tile. In summary, the resource usage of the diagnosis system is acceptable, especially if used in larger functional systems with more powerful CPU cores. At the same time, the implementation still contains many opportunities for optimization, which we plan to explore in the future. Also, a full system optimization to determine a suitable number of diagnosis processors and other processing nodes for a given number of CPU cores is future work. \section{Usage Examples} \label{sec:usage} We designed DiaSys as general-purpose approach to gain insight into SoCs, similar to today's tracing systems. Unfortunately, no benchmarks exist to evaluate such systems in a standardized way. We therefore rely on two spotlight usage examples to highlight important aspects of our approach. The first example is a hypothesis testing or ``debugging'' scenario which could also be performed using a trace-based debugger. We included this example as a demonstration of the flexibility of our approach: the process of debugging is usually a one-time effort, and the debugger is used as a tool to observe the program execution at various places in order to validate an hypothesis in a developer's head. In the second example we show how to create a lock contention profile with DiaSys. This example is taken from the area of runtime analysis, the other major area in which tracing is employed today. While the analysis tasks in this area are more standardized (thus need a less flexible diagnosis system), they usually require the long-time observation of the whole program execution, therefore producing large data rates in todays implementations. The creation of a lock contention profile therefore serves as a good example for the data reduction capabilities of DiaSys. \subsection{Hypothesis Testing: Finding a Race Condition} \label{sec:usage:racecondition} Hypothesis testing, or simply ``debugging,'' is the most common scenario in which software developers need to get insight into the software execution. While in many cases an intrusive debugging tool is sufficient, the more tricky bugs are related to timing, and thus require non-intrusive system insight. Today, developers use trace-based debugging for this task. In this example we show that DiaSys is equally suitable for such a scenario. In the following we discuss the debugging of a race condition which occurs in an application distributed over three compute tiles. We implement this example on our hardware implementation of DiaSys, as discussed in Section~\ref{sec:hwimpl}. \subsubsection{Problem Description} The application in this usage example consists of three tasks, running on three different processors concurrently. Core 0 runs the task \texttt{bank}, which is holds a variable \texttt{balance}. The other two cores 1 and 2 run the tasks \texttt{atm0} and \texttt{atm1}, respectively. All communication is handled through message passing. A message \texttt{get\_balance} reads the value of \texttt{balance} from core 0, and \texttt{set\_balance} writes it back. The tasks \texttt{atm0} and \texttt{atm1} periodically wait for a random amount of time, then get \texttt{balance}, decrement it by 1, and write it back. When running the application, we notice that sometimes $n$ calls to \texttt{set\_balance} do not, as expected, decrement \texttt{balance} by $n$, but by $m < n$. \subsubsection{Debugging Approach I: Observe exchanged messages} \begin{figure} \footnotesize \begin{sequencediagram} \newthread{atm1}{:atm0 (core 1)} \newinst[1.5]{bank}{:bank (core 0)} \newinst[1.5]{atm2}{:atm1 (core 2)} \stepcounter{threadnum} \node[below of=inst\theinstnum,node distance=0.8cm] (thread\thethreadnum) {}; \tikzstyle{threadcolor\thethreadnum}=[fill=gray!30] \tikzstyle{instcoloratm2}=[fill=gray!30] \begin{call}{atm1}{\shortstack{get\_balance\_req}}{bank}{\shortstack{get\_balance\_resp}} \end{call} \begin{call}{atm2}{\shortstack{get\_balance\_req}}{bank}{\shortstack{get\_balance\_resp}} \end{call} \begin{messcall}{atm1}{\shortstack{set\_balance}}{bank} \end{messcall} \begin{messcall}{atm2}{\shortstack{set\_balance}}{bank} \end{messcall} \end{sequencediagram} \caption{Sequence diagram showing the race condition in the first case study.} \label{fig:evaluation:racecondition_msc} \end{figure} Initially, we don't know where the problem is located. However, we assume that something in the exchange of messages goes wrong. We therefore use DiaSys to print out all incoming and outgoing messages at task \texttt{bank} for manual analysis. We start by configuring the CPU event generator at core 0 (running the task \texttt{bank}) to generate types of primary events: \begin{enumerate} \item One event if the message passing send function is called. As payload we capture the identifier of the destination core and the type of the message (e.g. \texttt{get\_balance\_resp}) \item Another event if the message passing receive function is called. As payload we capture the identifier of the source core and the type of the message. \end{enumerate} To create an event log, all events are sent directly to the host PC, where they are displayed to the developer in the form of a text log. For the purpose of easier understanding in this paper, Figure~\ref{fig:evaluation:racecondition_msc} presents the interesting section of this text log in the form of a sequence diagram. Looking at this diagram, experienced developers will notice the bug: two read-modify-write sequences are interleaved, causing the value written by \texttt{atm0} to be overwritten by \texttt{atm1}. Such behavior is a textbook example of a race condition. \subsubsection{Debugging Approach II: Transaction checking} The first debugging approach used DiaSys only to gather data, not to analyze it. The less often the race condition occurs, the more trace data is generated in the first approach, which must be transferred and manually checked. In our second approach, we also automate this checking. As result, the developer is only informed if an actual race condition occurred. In the correct scenario, the sequence of getting the balance, modifying it, and writing it back is an atomic transaction. We therefore form the hypothesis ``the read-modify-write sequence is atomic,'' and use DiaSys to check it. If the hypothesis does not hold, we have found a race condition. We first configure the event generator at core 0 (running the task \texttt{bank}) to create two primary events: \begin{itemize} \item An event \texttt{EV\_GET\_BALANCE\_CALL} when entering the function \texttt{get\_balance()} on core 0. This function is called if a \texttt{get\_balance\_req} message is received. \item Another event \texttt{EV\_SET\_BALANCE\_RETURN} when returning from the function \texttt{set\_balance()}. This function returns when the \texttt{set\_balance} message has been fully processed. \end{itemize} For both events, the source of the message (i.e. \texttt{atm0} or \texttt{atm1}) is included as payload. Furthermore, we program the diagnosis processor to execute a transformation actor shown in pseudo code in Listing~\ref{lst:tn_check_transaction}. (In our hardware implementation, we programmed the diagnosis processor in C with an equivalent program.) \begin{lstlisting}[label=lst:tn_check_transaction, caption={Pseudo code of the transformation actor checking the balance updating transaction.},float] TA_CHECK_BALANCE_TRANS { bool in_transaction = false; bool transaction_owner = NULL; event = wait(EV_GET_BALANCE_CALL or EV_SET_BALANCE_RETURN); // get_balance(src) and set_balance(src) // are both passed the source of the request // message as first function argument msg_src = event.data.args['src']; if (in_transacation && transaction_owner != msg_src) { // race condition found event_type = EV_RACE_DETECTED; event_data = {}; return new Event(event_type, event_data); } if (event.type == EV_GET_BALANCE_CALL) { // start of new transaction in_transacation = true; transaction_owner = msg_src; return; } if (event.type == EV_SET_BALANCE_RETURN && in_transacation && transaction_owner != msg_src) { // race condition found event_type = EV_RACE_DETECTED; event_data = {}; return new Event(event_type, event_data); } } \end{lstlisting} The two primary events are now routed from core 0 to the diagnosis processor, which checks the hypothesis that all transactions are atomic. If a violation, i.e. a race condition, is found, a new event \texttt{EV\_RACE\_DETECTED} is generated. This event is sent to the host PC and displayed as an event log to the developer. \subsubsection{Event and Data Rates} The most significant benefit from automating the hypothesis checking, as shown in the previous section, is the increase in productivity for the developer: even in long-running programs, testing the hypothesis becomes straightforward. At the same time, the automation also reduces the required trace bandwidth. The first approach of creating events for all received and transmitted messages for manual inspection required a trace bandwidth of 57.09~KBit/s. When automating the checking in the second approach, the bandwidth was reduced to 5.66~KBit/s, a reduction by $10.1\times$. The bandwidth requirements are heavily dependent on the program characteristics. In the program executions on our hardware platform running at 50~MHz, we observed 44~\% of transactions were interleaved, i.e. a race condition. Doing the same analysis in a tracing system would require an instruction and a data trace to be captured. Even though our evaluation platform is not able to produce such traces, we can estimate the required trace bandwidth by measuring the number of executed instructions and data memory accesses. Assuming an instruction trace compressed to 2~bit/instruction and a data trace compressed to 16 bit/access (for data and address, following \cite{hopkins_debug_2006}), we get a total trace stream of 246.31~MBit/s. It must be noted, however, that this number is an upper bound on the required bandwidth for a tracing system. Depending on the used tracing system implementation (such as CoreSight), not a full instruction or data trace is captured, but filters and triggers can be used to reduce this stream to just relevant parts, similar to what our event generators do. \subsubsection{Outlook: Programming DiaSys} In our first case study, we have shown how to use DiaSys to obtain data for manual analysis from the SoC, and how to automate the manual checking as hypothesis test running on-chip on the diagnosis processor. In this example, we wrote the transformation actor manually as C program, which is called upon receiving events. In the future, we envision also other means to describe the diagnosis application executed by DiaSys. In this example, a description of the desired system behavior as linear temporal logic (LTL) expression could be applied, as it commonly done in runtime validation systems. Using such LTL expressions for the validation of the correct hardware configuration by the software has been presented in \cite{li_rule-based_2016}. \subsection{Runtime Analysis: Creating a Lock Contention Profile} \label{sec:usage:lockprofiling} In our second usage example, we present a diagnosis application which generates a ``profile,'' a statistic about some software behavior. Examples for such commonly used profiles are the various \texttt{*top} Linux commands which present an ordered list of processes or threads with the highest usage of CPU, I/O, memory, or other resources. We include this usage example as it represents, next to debugging, the second large motivation to use a tracing tool today: runtime analysis. Other examples from this category of applications are code coverage and runtime profiling. Most runtime analysis tasks today require a full (instruction) trace to be recorded, which requires a high off-chip bandwidth. Using DiaSys, we can show how this trace bandwidth can be reduced by on-chip processing. To give meaningful insight into data rates generated when analyzing large real-life applications, we use in this example not a self-created example application, but an application from the PARSEC benchmark suite. \subsubsection{Evaluation Prototype} \label{sec:usage:lockprofiling:software_prototype} \begin{figure} \includesvgnolatex{img/software_prototype} \caption{The software prototype of the diagnosis system. All calls in the observed application are recorded in an event log file by an preloaded library. The event log file is read by the diagnosis system implemented as Python application. The figure shows the monitoring of all \texttt{pthread\_mutex\_lock()} calls and returns as used by the usage example in Section~\ref{sec:usage:lockprofiling}.} \label{fig:software_prototype} \end{figure} The hardware implementation prototype of DiaSys presented in Section~\ref{sec:hwimpl} is only able to run a very limited set of applications, as it only provides bare-metal programming support (comparable to a microcontroller without operating system), and no full POSIX environment as it can be found on Linux for example. To run larger applications, such as standard benchmarks, we therefore created a software prototype of the diagnosis system. It runs purely in software on a Linux PC and is best suited for an evaluation of event rates inside the diagnosis system, as well as the design of new diagnosis applications. Since no hardware extensions are used, its operation is intrusive, i.e. the timing of the observed application is slightly changed. The prototypical event generators can only trigger on the call of and return from a C library function, and the function arguments can be included in the event as data items. The software prototype consists of two parts, which are shown in Figure~\ref{fig:software_prototype}. The first part is a ``preload library.'' It is a small software library written in C which is able to monitor all calls to C library functions and write them into an event log file. This event log file is then used by a prototype of the diagnosis system implemented in Python. It consists of event generators, which read the event log file. A set of Python functions connected by channel objects represent the transformation actors. (We assume a one-to-one mapping of transformation actors to processing nodes in this prototype.) The output of the diagnosis application is directly printed to a console, as specialized event sinks are not necessary for our evaluations. We now use this software prototype to create the lock contention profile. \subsubsection{Problem Description} A \emph{lock contention} occurs in concurrent programs if multiple threads try to acquire a mutex lock at the same time~\cite[p. 147]{herlihy_art_2008}. In this case, all but one threads have to wait for the lock to be released before they can continue processing. Therefore, the lock acquisition time is a good metric for program efficiency: the less time it takes, the earlier the thread is done with its work. In order for a developer to get insight into the lock contention behavior of the program, a contention profile can be created. It lists all acquired locks, together with the summarized and averaged times the acquisition took. Such a profile can be generated in an intrusive way with tools like Intel VTune Amplifier or mutrace\footnote{\url{http://0pointer.de/blog/projects/mutrace.html}}, and is traditionally formatted as shown in Listing~\ref{lst:lockprofile_output}. \subsubsection{Measurement Approach} The lock acquisition time can be measured by obtaining the time the mutex lock function took to execute. In applications using pthreads, as it is the case for almost all applications running on Linux, macOS or BSD, the mutex lock function is named \verb|pthread_mutex_lock()|. \begin{lstlisting}[label=lst:mutex_lock, caption={A sketch of the \texttt{pthread\_mutex\_lock()} function. This function must be executed atomically, i.e. without interruption.}] int pthread_mutex_lock(pthread_mutex_t *mutex) { blocking_wait_until_mutex_is_free(mutex); lock_mutex(mutex); return 0 /* success */; } \end{lstlisting} As shown in the simplified code sketch in Listing~\ref{lst:mutex_lock}, the function blocks for an indefinite amount of time until a lock is available. If it is available, it acquires the lock and returns. To create a lock contention profile, we need to measure the execution times of all \verb|pthread_mutex_lock()| function calls in all threads. We then group this measurement by lock, given by the argument \verb|mutex| of the lock function, to obtain the number of times a lock was acquired, how long all lock acquisitions took in summary, and on average. \subsubsection{Diagnosis Application} \begin{figure} \includesvgnolatex{img/evaluation_lockprofile_appmodel} \caption{A diagnosis application to create a lock contention profile.} \label{fig:evaluation_lockprofile_appmodel} \end{figure} To perform the analysis outlined in the previous section, we configure the diagnosis system as shown in Figure~\ref{fig:evaluation_lockprofile_appmodel}. First, we attach two event generators to each CPU in the observed system. We configure them to generate two primary events which together measure the execution time of the lock acquisition function \texttt{pthread\_mutex\_lock()}. \begin{itemize} \item One primary event \texttt{EV\_LOCK\_CALL} is triggered if the CPU \emph{enters (calls)} the \texttt{pthread\_mutex\_lock()} function. The first function argument to \texttt{pthread\_\-mutex\_\-lock}, the \texttt{mutex}, is attached to the event as data item, together with a timestamp containing the current time. \item Another primary event \texttt{EV\_LOCK\_RETURN} is triggered if the CPU \emph{returns} from the \texttt{pthread\_mutex\_lock()} function. For this event, only a timestamp is attached as event data. \end{itemize} To calculate the execution time of the function \texttt{pthread\_\-mutex\_\-lock()}, we create a transformation actor \texttt{TA\_DIFF}, the pseudo code of which is shown in Listing~\ref{lst:tn_time_diff}. \begin{lstlisting}[label=lst:tn_time_diff, caption={Pseudo code of the transformation actor calculating the lock acquisition time.},float] TA_DIFF { lock_call = wait(EV_LOCK_CALL); lock_return = wait(EV_LOCK_RETURN); uint16_t time = lock_return.data.timestamp - lock_call.data.timestamp; uint16_t mutex_hash = hash(lock_call.data.args['mutex']); event_type = lock_acq_time; event_data = { time: time, lock: mutex_hash }; return new Event(event_type, event_data); } \end{lstlisting} It waits for both primary events \texttt{EV\_\-LOCK\_\-CALL} and \texttt{EV\_\-LOCK\_\-RETURN}, calculates the difference between the timestamps, and creates a new event \texttt{EV\_LOCK\_ACQ\_TIME} with two data items, the lock acquisition time and a hash of the \texttt{mutex} argument to reduce the data size. As last step in the processing, all \texttt{EV\_LOCK\_ACQ\_TIME} events are aggregated by another transformation actor called \texttt{TA\_STAT}. Again, a pseudo code implementation is given in Listing~\ref{lst:tn_stat}. \begin{lstlisting}[label=lst:tn_stat, caption={Pseudo code showing the functionality of the transformation actor creating a lock profile.},float] TA_STAT { event = wait(EV_LOCK_ACQ_TIME or EV_SEND_LOCK_PROFILE); // aggregate if (event.type == EV_LOCK_ACQ_TIME) { m = event.data.mutex; stat[m]['cnt']++; stat[m]['t_sum'] += event.data.time; return; } // send statistics output to host PC if (event.type == EV_SEND_LOCK_PROFILE) { event_type = EV_LOCK_PROFILE; event_data = {stat: stat}; return new Event(event_type, event_data); } } \end{lstlisting} If an event of type \texttt{EV\_LOCK\_ACQ\_TIME} is received, the timestamp is added to a hash data structure which records, grouped by the mutex, the number of calls to the lock function and the total time these calls took. After the program run, on request of the developer running the diagnosis, or in regular time intervals, a \texttt{EV\_SEND\_LOCK\_PROFILE} is generated. If this event is received, the aggregated statistics are sent to the event sink, which then presents the aggregated results to the developer. \subsubsection{Evaluation of the Diagnosis Application} In the evaluation of this usage example we focus on the event and data rates between the event generators and transformation nodes. In order to provide realistic inputs, we profiled the \emph{dedup} application from the PARSEC~3.0 Benchmark Suite with the large input data sets~\cite{bienia11benchmarking}. As PARSEC does not run on our custom-built prototype MPSoC platform, we used the software prototype described in Section~\ref{sec:usage:lockprofiling:software_prototype}. All transformation actors were implemented in Python code equivalent to the pseudo code listings presented in Listings~\ref{lst:tn_time_diff} and~\ref{lst:tn_stat}. \paragraph{Output of the Diagnosis Application} Before we analyze the diagnosis application itself, we discuss the output it generates, i.e. the lock contention profile shown in Listing~\ref{lst:lockprofile_output}. PARSEC was instructed to use at least 4 threads; ultimately 16 threads were spawned by the dedup application. (There is no option in PARSEC to specify the exact number of threads used.) The execution of the observed application took 2.68~s. \begin{lstlisting}[label=lst:lockprofile_output, caption={Output of the lock contention profile diagnosis application observing the PARSEC dedup application.}] mutex # acq. sum [ns] avg [ns] (01) 0x7fd9ac018988 47785 8835387 184.90 (02) 0x7fd9d1ed2978 47784 226012031 4729.87 (03) 0x1c36500 9426 53724035 5699.56 (04) 0x1c36660 9423 21904608 2324.59 (05) 0x1c36710 4638 12528702 2701.32 (06) 0x1c365b0 105 46999 447.61 (07) 0x7fd9d2091430 8 1974 246.75 (08) 0x7fd9b41948f8 8 2277 284.62 (09) 0x7fd9b42b9ad8 8 2560 320.00 (10) 0x7fd9d20f8928 8 2215 276.88 \end{lstlisting} The output shows the top ten most acquired mutexes, together with the total and averaged lock acquisition time. Notable in this profile are mutexes 2 to 5, which take on average significantly longer to acquire: these locks are called to be ``contended.'' A profile helps to understand the program behavior and serves as a starting point to fix possible bugs or inefficiencies. If lock contention is observed (and performance goals of the application are not met), it is common to replace coarse-grained locks with more fine-grained locks, i.e. locks which protect a shorter critical section. However, fixing a bug is not in the scope of this work. Instead, we now turn our discussion to the event and data rates generated when executing the diagnosis application that generated the profile as shown. \paragraph{Event and Data Rates} We designed the diagnosis system to reduce the off-chip traffic by moving the data analysis partially into the SoC. To evaluate if the data rates are in fact reduced, we analyze event rates within the diagnosis application. We use the following event sizes: \begin{itemize} \item An \texttt{EV\_LOCK\_CALL} event requires 14 bytes: two bytes for the event type identifier, four bytes for the timestamp, and eight bytes for the \texttt{mutex} argument. \item An \texttt{EV\_LOCK\_RETURN} event requires six bytes: two bytes for the event type identifier and four bytes for the timestamp. \item An \texttt{EV\_LOCK\_ACQ\_TIME} event requires six bytes: two bytes for the event type identifier, two bytes for the lock acquisition time, and two bytes for the hashed \texttt{mutex} argument. \end{itemize} Over the whole program run, the event generators attached to the 16 CPUs generate a total of 516,254 events, which equals 4.9~MByte of transmitted data or, over the program runtime, an average data rate of 14.7~MBit/s. The \texttt{TA\_DIFF} transformation actors half the number of events, resulting in a data rate of 4.4~MBit/s, or a reduction to 30~\%. Finally, after being aggregated by \texttt{TA\_STAT}, the full result can be transferred off-chip with roughly 204~bytes \medskip A direct comparison of our results to existing tracing systems is challenging. For our analysis we need access to the \texttt{mutex} function argument through a data trace, which is not supported by higher-speed tracing implementations such as CoreSight PTM and Intel PT. However, as a first lower-bound estimation of the data rate generated by a state-of-the-art tracing system, we created a full instruction trace using Intel PT. The same PARSEC dedup application created a trace file of 1.82~GB, which corresponds to 5.4~GBit/s over the program runtime. In summary, DiaSys was able to reduce the required trace bandwidth compared to an Intel PT instruction trace significantly due to on-chip analysis. When transferring data off-chip after processing in the \texttt{TA\_DIFF} processing nodes, the bandwidth is reduced from more than 5.4~GBit/s to 4.4~MBit/s, a reduction by $1233 \times$. \paragraph{Discussion} Depending on the feature set and timestamp granularity of the various tracing implementations, the bandwidth reduction that DiaSys is able to achieve can vary. However, a general observation holds: the most significant bandwidth savings result from the fact that we very precisely capture only data in the event generators which is relevant to our problem. The subsequent processing step \texttt{TA\_DIFF} of calculating the time difference between two events is further able to discard roughly $\nicefrac{2}{3}$ of the data. Both operations are simple enough to be implemented even in resource-constraint on-chip environments. The final step \texttt{TA\_STAT} is again able to give large percentage-wise reductions in data rate, however the absolute savings might not justify an on-chip processing any more. This last step could therefore be executed on the host PC -- without changing the diagnosis application. \section{Conclusions} \label{sec:conclusion} In this paper we introduced DiaSys, a diagnosis system which aims to replace tracing systems in MPSoCs, where software observability is limited by the off-chip bottleneck. To avoid this bottleneck, we move parts of the data analysis into the chip and closer to the data source. The diagnosis system consists of event generators, which observe the functional units executing software on the SoC, the diagnosis application and event sinks. Diagnosis applications describe the data analysis task in a way that is understandable for the developer and portable across different SoCs. In detail we discussed their properties and semantics. Diagnosis applications are portable by design, because components of the application can be freely mapped to distributed diagnosis extensions inside the SoC, or to a runtime environment on the host PC. The implementation of such a mapping tool is future work. In our evaluation we showed on two prototypes that the implementation of the required diagnosis extensions is feasible with reasonable hardware overhead. We also showed in two usage examples from different domains that the envisioned reduction in off-chip bandwidth requirements can be achieved. In the future, we plan to extend this system with more specialized processing nodes, which are suited for common analysis tasks. We also investigate how machine-learning approaches can be used to dynamically adjust the analysis tasks during runtime. \subsection*{Acknowledgments} This work was funded by the Bayerisches Staatsministerium für Wirtschaft und Medien, Energie und Technologie (StMWi) as part of the project ``SoC Doctor,'' and by the German Research Foundation (DFG) as part of the Transregional Collaborative Research Centre ``Invasive Computing'' (SFB/TR 89). The responsibility for the content remains with the authors. We would like to thank Ignacio Alonso and Markus Göhrle for their contributions to the implementation of the evaluation platform. We especially thank Stefan Wallentowitz for the creation and ongoing support of OpTiMSoC. \bibliographystyle{elsarticle-num}
{'timestamp': '2017-01-19T02:06:50', 'yymm': '1607', 'arxiv_id': '1607.04549', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04549'}
arxiv
\section{Introduction} Spectral embedding methods are based on analyzing Markov chains on a high-dimensional data set $\left\{x_i\right\}_{i=1}^{n} \subset \mathbb{R}^d$. There are a variety of different methods, see e.g. Belkin \& Niyogi \cite{belk}, Coifman \& Lafon \cite{coif1}, Coifman \& Maggioni \cite{coif2}, Donoho \& Grimes \cite{donoho}, Roweis \& Saul \cite{rs}, Tenenbaum, de Silva \& Langford \cite{ten}, and Sahai, Speranzon \& Banaszuk \cite{sahai}. A canonical choice for the weights of the graph is declare that the probability $p_{ij}$ to move from point $x_j$ to $x_i$ to be $$ p_{ij} = \frac{ \exp\left(-\frac{1}{\varepsilon}\|x_i - x_j\|^2_{\ell^2(\mathbb{R}^d)}\right)}{\sum_{k=1}^{n}{ \exp\left(-\frac{1}{\varepsilon}\|x_k - x_j\|^2_{\ell^2(\mathbb{R}^d)}\right)}},$$ where $\varepsilon > 0$ is a parameter that needs to be suitably chosen. This Markov chain can also be interpreted as a weighted graph that arises as the natural discretization of the underlying 'data-manifold'. Seminal results of Jones, Maggioni \& Schul \cite{jones} justify considering the solutions of $$ -\Delta \phi_n = \lambda_n^2 \phi_n$$ as measuring the intrinsic geometry of the weighted graph. Here we always assume Neumann-boundary conditions whenever such a graph approximates a manifold. \begin{figure}[h!] \begin{tikzpicture}[scale=0.2\textwidth, node distance=1.2cm,semithick] \node[origVertex] (0) {}; \node[origVertex] (1) [right of=0] {}; \node[origVertex] (2) [above of=0] {}; \node[origVertex] (3) [above of=1] {}; \node[origVertex] (4) [above of=2] {}; \path (0) edge[origEdge, out=-45, in=-135] node[newVertex] (m0) {} (1) edge[origEdge, out= 45, in= 135] node[newVertex] (m1) {} (1) edge[origEdge] node[newVertex] (m2) {} (2) (1) edge[origEdge] node[newVertex] (m3) {} (3) (2) edge[origEdge] node[newVertex] (m4) {} (3) edge[origEdge] node[newVertex] (m5) {} (4) (3) edge[origEdge, out=125, in= 55, looseness=30] node[newVertex] (m6) {} (3); \path (m0) edge[newEdge, out= 135, in=-135] (m1) edge[newEdge, out= 45, in= -45] (m1) edge[newEdge, out=-145, in=-135, looseness=1.7] (m2) edge[newEdge, out= -35, in= -45, looseness=1.7] (m3) (m1) edge[newEdge] (m2) edge[newEdge] (m3) (m2) edge[newEdge] (m4) edge[newEdge, out= 135, in=-135] (m5) (m3) edge[newEdge] (m4) edge[newEdge, out= 45, in= 15] (m6) (m4) edge[newEdge] (m5) edge[newEdge, out= 90, in= 165] (m6) ; \draw [thick, xshift=0.006cm,yshift=0.005cm] plot [smooth, tension=1] coordinates { (0.03,0.01) (0.04,-0.01) (0.06,0.01) (0.055,0.02) (0.05, 0.01) (0.04, 0.01) (0.035, 0.01) (0.03, 0.02) (0.03,0.01) }; \end{tikzpicture} \caption{Graphs that approximate smooth manifolds.} \end{figure} The cornerstone of spectral embedding is the realization that the map \begin{align*} \Phi: \left\{x_i\right\}_{i=1}^{n} &\rightarrow \mathbb{R}^k \\ x &\rightarrow (\phi_1(x), \phi_2(x), \dots, \phi_k(x)). \end{align*} can be used as an effective way of reducing the dimensionality. One useful explanation that is often given is to observe that the Feynman-Kac formula establishes a link between random walks on the weighted graph and the evolution of the heat equation. We observe that random walks have a tendency to be trapped in clusters and are unlikely to cross over bottlenecks and, simultaneously, that the evolution of the heat equation can be explicitely given as $$ \left[e^{t \Delta} f\right](x) = \sum_{n=1}^{\infty}{e^{-\lambda_n^2 t} \left\langle f, \phi_n \right\rangle \phi_n(x)}.$$ The exponential decay $e^{-\lambda_n^2 t}$ implies that the long-time dynamics is really governed by the low-lying eigenfunctions who then have to be able to somehow reconstruct the random walks' inclination for getting trapped in clusters and should thus be able to reconstruct the cluster. We believe this intuition to be useful and our further exposition will be based on this. \section{The Wave equation} \subsection{Introduction.} Once the eigenfunctions of the Laplacian have been understood, they imply complete control over the Cauchy problem for the wave equation \begin{align*} (\partial_t^2 - \Delta)u(x,t) = 0 \\ u(x,0) = f(x) \\ \partial_t u(x,0) = g(x) \end{align*} given by the eigenfunction expansion $$ u(t,x) = \sum_{n = 1}^{\infty}{ \left[ \cos{(\lambda_ n t)} \left\langle f, \phi_n \right\rangle + \sin{(\lambda_ n t)} \left\langle g, \phi_n \right\rangle \right] \phi_n(x) }.$$ Throughout the rest of the paper, we will understand a solution of a wave equation as an operator of that form, which is meaningful on both smooth, compact manifolds equipped with the Laplace-Beltrami operator $\Delta_g$ as well as on discrete weighted graphs equipped with the Graph Laplacian $\mathcal{L}$. A notable difference is the lack of decay associated with the contribution coming from higher eigenfunctions -- this is closely related to the fact that the heat equation is highly smoothing while the wave equation merely preserves regularity. In one dimension, this is is easily seen using $$ (\partial_t^2 - \partial_x^2) = (\partial_t - \partial_x)( \partial_t + \partial_x)$$ implying that translations $u(x,t) = f(x+t)$ and $u(x,t) = f(x-t)$ are particular solutions of the wave equation which preserve their initial roughness). However, the dynamics is still controlled by low-lying eigenfunctions in a time-averaged sense: note that $$ \frac{1}{b-a}\int_{a}^{b}{u(t,x) dt} = \sum_{n = 1}^{\infty}{ \left[ \left( \frac{1}{b-a} \int_{a}^{b}{\cos{(\lambda_ n t)} dt}\right) \left\langle f, \phi_n \right\rangle + \left( \frac{1}{b-a} \int_{a}^{b}{ \sin{(\lambda_ n t)} dt}\right) \left\langle g, \phi_n \right\rangle \right] \phi_n(x) }$$ where the integrals decay as soon as $\lambda_n^{-1} \lesssim b-a$ since $$ \frac{1}{b-a} \int_{a}^{b}{ \sin{(\lambda_ n t)} dt} \lesssim \min \left( 1, \frac{1}{\lambda_n} \frac{1}{b-a} \right).$$ Put differently, the average behavior over a certain time interval is much smoother than the instantenous behavior. We will now prove that 'average' considerations within the framework of the wave equation allow us to reconstruct the classical distance used in spectral embedding: then, after seeing that 'average' considerations recover the known framework, we will investigate the behavior on shorter time-scales and use that as a way of deriving a finer approximation of the underlying geometry of the given data. \subsection{Recovering the spectral distance.} We start by defining the usual spectral distance between two elements $x_0, y_0 \in \mathcal{M}$ w.r.t. the first $N$ eigenfunctions as $$ d_N(x_0, y_0)^2 = \sum_{n=1}^{N}{(\phi_n(x_0) - \phi_n(y_0))^2}.$$ Equivalently, this may be understood as the Euclidean distance of the embedding $$ d_N(x_0, y_0)^2 = \|\Phi_N(x_0) - \Phi_N(y_0)\|_{\ell^2(\mathbb{R}^N)}^2.$$ Given the dynamical setup of a wave equation, there is another natural way of measuring distances. Given a point $z \in \mathcal{M}$, we define $u_{z}(x,t)$ as the solution of \begin{align*} (\partial_t^2 - \Delta)u_{z}(x,t) &= 0 \\ u_{z}(x,0) &= \delta_{z} \\ \partial_t u_{z}(x,0) &= 0, \end{align*} where $\delta_z$ is the Dirac $\delta-$function in the point $z$. The solution starts out being centered at $z$ and then evolves naturally according to the heat equation. Since we are mainly interested in computational aspects, we will use $u_{z,N}$ to denote the projection of $u_z$ onto the first $N$ Laplacian eigenfunctions. It is natural to assume that if $x_0, y_0 \in \mathcal{M}$ are close, then $u_{x_0}(x,t)$ and $u_{y_0}(x,t)$ should be fairly similar on most points of the domain for most of the time. \begin{figure}[h!] \minipage{0.5\textwidth} \begin{center} \includegraphics[width=0.9\textwidth]{realwave.pdf} \end{center} \endminipage\hfill \minipage{0.45\textwidth} \begin{center} \begin{tikzpicture}[scale=1.2] \draw [ultra thick] (0,0) circle (0.02cm); \draw [ultra thick] (0,0) circle (0.2cm); \draw [ultra thick] (0,0) circle (0.4cm); \draw [ultra thick] (0,0) circle (0.6cm); \draw [ultra thick] (0,0) circle (0.8cm); \draw [ultra thick] (0,0) circle (1cm); \draw [ultra thick] (0,0) circle (1.2cm); \draw [ultra thick] (0,0) circle (1.4cm); \draw [ultra thick] (1.3,0) circle (0.02cm); \draw [ultra thick] (1.3,0) circle (0.2cm); \draw [ultra thick] (1.3,0) circle (0.4cm); \draw [ultra thick] (1.3,0) circle (0.6cm); \draw [ultra thick] (1.3,0) circle (0.8cm); \draw [ultra thick] (1.3,0) circle (1cm); \draw [ultra thick] (1.3,0) circle (1.2cm); \draw [ultra thick] (1.3,0) circle (1.4cm); \end{tikzpicture} \end{center} \endminipage\hfill \captionsetup{width=0.9\textwidth} \caption{An evolving Dirac $\delta-$function and the overlap between two solutions.} \end{figure} We will now prove the Main Theorem stating that this notion fully recovers the spectral distance. \begin{thm}[Wave equation can recover spectral distance.] Assume $\mathcal{M}$ is connected (in the sense of $\lambda_1 > 0$). Then the average $L^2-$distance of the wave equation arising from Dirac measures placed in $x_0, y_0$ allows to reconstruct the spectral distance $d_N(x_0,y_0)$ via $$ \lim_{T \rightarrow \infty}{\frac{1}{T} \int_{0}^{T}{ \int_{\Omega}{(u_{x_0,N}(x,t) - u_{x_0,N}(x,t))^2 dx} dt}} = \frac{1}{2} d_N(x_0, y_0)^2.$$ \end{thm} \begin{proof} By definition, we have that $$ u_{N,x_0}(x,t) = \sum_{n = 0}^{N}{\cos{(\lambda_ n t)} \left\langle \phi_n, \delta_{x_0} \right\rangle \phi_n(x) } \quad \mbox{and} \quad u_{N,y_0}(x,t) = \sum_{n = 0}^{N}{\cos{(\lambda_ n t)} \left\langle \phi_n, \delta_{y_0} \right\rangle \phi_n(x) } $$ We explicitly have that $$ \phi_0(x) = \frac{1}{\sqrt{|\mathcal{M}|}} \qquad \mbox{and} \quad \left\langle \phi_n, \delta_{z} \right\rangle = \phi_n(z).$$ Since the $\phi_n$ are orthonormal in $L^2(\Omega)$, the Pythagorean theorem applies and \begin{align*} \int_{\Omega}{(u_N(x,t) - w_N(x,t))^2 dx} &= \int_{\Omega}{ \left( \sum_{n = 1}^{N}{ \cos{(\lambda_ n t)} (\phi_n(x_0) - \phi_n(y_0)) \phi_n(x) } \right)^2 dx}\\ &= \sum_{n=1}^{N}{\cos{(\lambda_ n t)}^2 (\phi_n(x_0) - \phi_n(y_0))^2 \int_{\Omega}{\phi_n(x)^2 dx}}\\ &= \sum_{n=1}^{N}{\cos{(\lambda_ n t)}^2 (\phi_n(x_0) - \phi_n(y_0))^2} \end{align*} and, since $\lambda_k \geq \lambda_1 > 0$, we easily see that $$ \lim_{T \rightarrow \infty}{\frac{1}{T} \int_{0}^{T}{\cos{(\lambda_n z)}^2dz}} = \frac{1}{2}$$ and therefore $$ \lim_{T \rightarrow \infty}{\frac{1}{T} \int_{0}^{T}{ \sum_{n=1}^{N}{\cos{(\lambda_ n t)}^2 (\phi_n(x_0) - \phi_n(y_0))^2} dt}} = \frac{1}{2} \sum_{n=1}^{N}{ (\phi_n(x_0) - \phi_n(y_0))^2}.$$ \end{proof} \textit{Remark.} If $\mathcal{M}$ is not connected but has multiple connected components, then the argument shows $$ \frac{1}{2} d_N(x_0, y_0)^2 \leq \lim_{T \rightarrow \infty}{\frac{1}{T} \int_{0}^{T}{ \int_{\Omega}{(u_{x_0,N}(x,t) - u_{x_0,N}(x,t))^2 dx} dt}} \leq d_N(x_0, y_0)^2.$$ \section{The Algorithm} \begin{flushright} \textit{If you want to see something, you send waves in its general direction, you don't throw heat at it.}\\ -- attributed to Peter Lax \end{flushright} \subsection{Spectral Echolocation.} The Theorem discussed in the preceeding section suggests that we lose no information when using distances induced by the wave equation. The main underlying idea of our approach is that we naturally obtain \textit{additional} information. We emphasize that the algorithm we describe here is \textit{not} a dimension-reduction algorithm -- instead, it can be regarded as a natural pre-processing step to enhance the effectiveness of spectral methods. Furthermore, it is more appropriate to speak of an entire family of algorithms: there are a variety of parameters and norms one could define and the optimal choice is not a priori clear.\\ \begin{mdframed} \textbf{Spectral Echolocation Algorithm.} \begin{quote} \begin{enumerate} \item \textbf{Input.}~A weighted graph $G = (V,E,w)$. \item Compute the first $N$ Laplacian eigenfunctions $\left\{\phi_1, \phi_2, \dots, \phi_N\right\}$. \item Pick $k$ random points $v_1, v_2, \dots, v_k \in V$. \item Define $k$ functions $f_1, \dots, f_k: V \rightarrow \mathbb{R}$ as 'mollifications' of the indicator functions associated to the $k$ points. We propose taking the existing affinities given by the weights $$ f_i(x) = w_{i,x}. $$ \item Pick $\varepsilon > 0$. The projection of the solution of the attenuated wave equation with $f_i$ as initial datum onto the first $N$ eigenfunctions is $$ u_i(t,x) = \sum_{n=1}^{N}{ \cos{(\lambda_k t)} e^{-\varepsilon \lambda_k t} \left\langle f_i, \phi_n\right\rangle\phi_n(x)}$$ \item Define a new weight between any two points $v_1, v_2 \in V$ given by $$ d_i(v_1, v_2) =\| u_i(t,v_1) - u_i(t,v_2)\|^{\alpha}_{X} + \| (u_i)_t(t,v_1) - (u_i)_t(t,v_2)\|^{\beta}_{Y},$$ where $u_t$ is the derivative in time and $X,Y$ are any norms on the space of continuous functions $C[0,T]$ and $\alpha, \beta > 0$. \item \textbf{Output.} A distance $d:V \times V \rightarrow \mathbb{R}_{+}$ synthesized out of $d_1, \dots, d_k$, examples being $$d(v_1,v_2) = \min_{1 \leq i \leq k}{ d_i(v_1, v_2)} \quad \mbox{and} \quad d(v_1,v_2) = \frac{1}{k}\sum_{i=1}^{k}{ d_i(v_1, v_2)}.$$ \end{enumerate} \end{quote} \end{mdframed} \vspace{10pt} The underlying idea is quite simple: we start with various initial distributions of 'water' at rest. We want these initial configurations to be relatively smooth so as to avoid drastic shocks. Given this initial configuration, we follow the evolution of the wave equation at our desired level of resolution (given by restricting to $N$ eigenfunctions). Points that are nearby should always have comparable levels of water and comparable levels of change in water level and this is measured by the integral norm. The exponentially decaying term $\exp(-\varepsilon \lambda_k t)$ in the evolution of the solution $$ u_i(t,x) = \sum_{n=1}^{N}{ \cos{(\lambda_k t)} e^{-\varepsilon \lambda_k t} \left\langle f_i, \phi_n\right\rangle \phi_n(x)}$$ comes from actually solving for the attenuated wave equation which further reduces high-frequency shocks and increases stability. As described above, setting $X = L^2$, $\varepsilon = 0$, squaring the norm, ignoring the derivative term completely and letting $T \rightarrow \infty$ recovers the original weights of the graph completely. In practice, we have found that $T = 1, \varepsilon = \lambda_1^{-1}$, $X = Y = L^1[0,1]$ and $\alpha=\beta=1$ yield the best results, however, this is a purely experimental finding -- identifying the best parameters and giving a theoretical justification for their success is still an open problem. \section{Examples of Noisy Clustering} \subsection{Parameters} We always consider $N=50$ eigenfunctions and $k=10$ randomly chosen initial spots from which to send out waves. The attenuation factor is always chosen as $\varepsilon = \lambda_1^{-1}$ and time is chosen so that the first eigenfunction performs one oscillation $T=\lambda_1^{-1}$. Further parameters are $X = L^1[0,T] = Y$ and $\alpha = 1 = \beta$. This uniquely defines the $1 \leq i \leq k$ individually induced distances, we always condense them into one distance using either $$d(v_1,v_2) = \min_{1 \leq i \leq k}{ d_i(v_1, v_2)} \qquad \mbox{or} \qquad d(v_1,v_2) = \frac{1}{k}\sum_{i=1}^{k}{ d_i(v_1, v_2)}.$$ Generally, continuous geometries benefit from taking the minimum because of increased smoothness whereas clustering problems are better treated using the second type of combined distance. \subsection{Geometric Clusters with Erroneous Edges}\label{geomClusterErroneousEdge} A benefit of the refined wave echolocation metric is that, unlike heat, the transmission between two clusters does not simply depend on the number of edges but also their topology. We consider two clusters in $\mathbb{R}^2$ each of which consists of a 1000 points arranged in a unit disk and the two unit disks are well-separated -- the obstruction comes from a large number of random edges; specifically, every point is randomly connected to 4\% in the other cluster. Heat diffuses quickly between these two clusters due to the large number of intra cluster connections. For this reason, the heat embedding of the fails to separate the clusters (however, it is does preserve some aspects of the topology, see Fig. \ref{fig:randErrorEmbeddings}). In contrast, however, the wave echolocation metric manages a clear separation of objects. \begin{figure}[h!] \begin{tabular}{cc} \includegraphics[width=.48\textwidth]{laplacianEmbedding2cluster.png} & \includegraphics[width=.48\textwidth]{waveEmbedding_affStart2.png} \end{tabular} \caption{Heat kernel embedding (left) and embedding of the wave echolocation metric (right). We used averaging across 10 starting positions.}\label{fig:randErrorEmbeddings} \end{figure} \subsection{Social Networks} Social networks are a natural application of spectral methods, and mirror the synthetic example in Section \ref{geomClusterErroneousEdge}. We examine spectral echolocation on the Facebook social circles dataset from \cite{facebookNetwork}, which consists of 4039 people in 10 friend groups. While there exist clear friend groups, edges within the clusters are still somewhat sparse, and there exist erroneous edges between clusters. One goal is to propagate friendship throughout the network and emphasize clusters. Figure \ref{fig:socialNetworkAffinity} shows the original affinity matrix, sorted by cluster number. We also compute the diffusion distance and spectral echolocation distance, and display the affinity matrix $W_{i,j} = exp(-d(v_i, v_j)^2)$ for both. Spectral echolocation not only compresses the inter cluster distances, it also discovers weak similarity between different clusters that share a number of connections. \begin{figure}[!h] \begin{tabular}{ccc} \includegraphics[width=.32\textwidth]{orginialAffinity.png} & \includegraphics[width=.32\textwidth]{laplacianAffinity.png} & \includegraphics[width=.32\textwidth]{waveEmbedding.png} \\ \includegraphics[width=.32\textwidth]{orginialAffinity_zoomed.png} & \includegraphics[width=.32\textwidth]{laplacianAffinity_zoomed.png} & \includegraphics[width=.32\textwidth]{waveEmbeddingAffinity_zoomed2.png} \\ \end{tabular} \captionsetup{width=0.95\textwidth} \caption{Original Facebook affinity matrix (left), heat kernel embedding affinity (center), and wave embedding affinity (right). Bottom is zoomed in version of the top.}\label{fig:socialNetworkAffinity} \end{figure} \textit{Substructures.} Another natural goal is to detect small ``friendship circles'' within the larger network. These circles are based off of the features that brought the group together (e.g. same university, same work, etc). Overall there are 193 circles, though many only contain two or three people, and many of the larger circles are nowhere close to a dense network. We compare the average affinity within the 100 largest circles across several techniques. For both the standard heat kernel embedding as well as the wave embedding, we build a new graph between people based on whether two people are ``10-times closer than chance'', which is defined as \begin{eqnarray*} \{x,y\}\in E \iff e^{-d(x,y)^2/\epsilon} > 10\cdot \mathbb{E}_{x'}\mathbb{E}_{y'} [e^{-d(x',y')^2/\epsilon}]. \end{eqnarray*} We now compare the typical number of edges in each circle for the original data as well as the two embeddings -- we observe a dramatic improvement. The results are displayed in Figure \ref{fig:circles}. \begin{figure}[h!] \begin{tabular}{ccc} \includegraphics[width=.32\textwidth]{origAffinityInCircle.png} & \includegraphics[width=.32\textwidth]{lapAffinityInCircle.png} & \includegraphics[width=.32\textwidth]{waveAffinityInCircle.png} \end{tabular} \caption{Number of friendship edges in original network (left), heat kernel embedding network (center), wave embedding network (right).}\label{fig:circles} \end{figure} \section{Examples with Heterogeneous Dimensionality} \subsection{Plane with Holes} We examine the behavior of waves in a porous medium. Figure \ref{fig:planeWithHoles} shows that the wave equation travels more quickly through the bridges (the wave speeds up while in a bottleneck), and gets caught in the intersections. preserves the topology of the data and emphasizes the holes. \begin{figure}[!h] \begin{tabular}{ccc} \includegraphics[height=.25\textwidth]{originalData2.png} & \includegraphics[height=.25\textwidth]{laplacianEmbedding2.png} & \includegraphics[height=.25\textwidth]{waveEmbedding3.png} \end{tabular} \captionsetup{width=0.95\textwidth} \caption{Original Data (left), heat kernel Embedding (center), and Wave Embedding (right). We used the minimum distance across 10 starting positions.}\label{fig:planeWithHoles} \end{figure} \subsection{Union of Manifolds} Another interesting property of the wave equation is that the change in position $u_t$ undergoes a dramatic change whenever the dimensionality of the manifold changes: waves are suddenly forced into a very narrow channel or -- going the other direction -- are suddenly evolving in many different directions. We demonstrate this first in Figure \ref{fig:6D1D}. The data consists of two six-dimensional spheres, connected by a one-dimensional line. The low frequency eigenfunctions of the heat kernel travel from one end to the other without much recognition of the varying dimensionality. However, the wave embedding creates a gap between the bridge and the two spheres, with the variation of the first non-trivial eigenfunction being supported almost entirely on the bridge. \begin{figure}[!h] \begin{tabular}{ccc} \includegraphics[width=.33\textwidth]{6DSpheres1DBridge2.png} & \includegraphics[width=.33\textwidth]{6DSpheres1DBridge_laplacianEmbedding2.png} & \includegraphics[width=.33\textwidth]{6DSpheres1DBridge_waveEmbedding2.png} \end{tabular} \caption{6D spheres with 1D bridge (left), heat kernel embedding (center), and wave embedding (right). For this problem, we use the min distance across 10 starting positions.}\label{fig:6D1D} \end{figure} \subsection{Union of Manifolds with different dimensions} We also consider the same problem with spheres of different dimensions as in Figure \ref{fig:6D3D1D}. The data consists of a six-dimensional sphere and a three-dimensional sphere connected by a one-dimensional line. The figure displays the affinity matrices of the points, with the first block representing the six-dimensional sphere, the second block representing the three-dimensional sphere, and the third small block for the bridge. Notice that, in the heat kernel affinity, the bridge has affinity to more points in the lower dimensional sphere than the higher dimensional sphere. Also notice that the wave embedding separates the six-dimensional sphere much further from the bridge than the three-dimensional sphere.\\ \begin{figure}[!h] \begin{tabular}{cc} \includegraphics[width=.48\textwidth]{6D3D1DBridge2.png} & \includegraphics[width=.48\textwidth]{6D3D1D_waveEmbeddingSorted2.png} \\ \includegraphics[width=.48\textwidth]{6D3D1D_lapAffinitySorted.png} & \includegraphics[width=.48\textwidth]{6D3D1D_waveAffinitySorted.png} \end{tabular} \captionsetup{width=0.95\textwidth} \caption{6D sphere in cluster 1 and 3D sphere in cluster 2 with 1D bridge (top left), wave embedding (top right), heat kernel affinity matrix (bottom left), and wave affinity matrix (bottom right). For this problem, we use the min distance across 10 starting positions.}\label{fig:6D3D1D} \end{figure} Finally, we consider two six-dimensional spheres connected via a two-dimensional bridge in Figure \ref{fig:6D2D}. Specifically, we examine the local affinities of several points on the bridge. Notice that, for the wave equation, the affinities of points on the bridge are far from isotropic and clearly distinguish the direction the wave is traveling between the two spheres. Moveover, points on the bridge near the spheres have much lower affinity to points on the sphere than their heat kernel counterparts. \begin{figure}[!h] \begin{tabular}{cc} \includegraphics[width=.48\textwidth]{waveAff1.png} & \includegraphics[width=.48\textwidth]{waveAff2.png} \\ \includegraphics[width=.48\textwidth]{lapAff1.png} & \includegraphics[width=.48\textwidth]{lapAff2.png} \end{tabular} \captionsetup{width=0.95\textwidth} \caption{Neighborhoods of chosen points in 6D spheres--2D bridge example for wave embedding using averaging across 10 starting positions (top) and heat kernel affinity (bottom).}\label{fig:6D2D} \end{figure} \section{Comments and Remarks} \subsection{Other partial differential equations} Spectral echolocation has two novel components: \begin{enumerate} \item the evolution of a dynamical system on an existing weighted graph \item and the construction of a refined metric using information coming from the behavior of the dynamical system. \end{enumerate} Our current presentation had its focus mainly on the case where the dynamical system is given by the wave equation, however, it is not restricted to that. Let us quickly consider a general linear partial differential equation of the type $$ \frac{\partial}{\partial t} u(t,x) = D u(t,x) \qquad \mbox{on}~\mathbb{R},$$ where $D$ is an arbitrary differential operator. The Fourier transform in the space variable yields a separation of frequencies $$ \frac{\partial}{\partial t} \widehat{u}(t,\xi) = i p(D, \xi) \widehat{u}(t, \xi),$$ where $p(D,\xi)$ is the symbol of the differential operator at frequency $\xi$. This is a simple ordinary differential equation whose solution can be written down explicitly as $$ \widehat{u}(t, \xi) = e^{i t p(D, \xi)} \widehat{u}(0, \xi)$$ and taking the Fourier transform again allows us to write the solution as $$ u(t,x) = \int_{\mathbb{R}}{ e^{i x \cdot \xi + i t p(D, \xi)} \widehat{u}(0, \xi) d\xi}.$$ Differential equations for which this scheme is applicable include the classical heat equation ($D = \Delta$) but also variants that include convolution with a sufficiently nice potential ($Du = \Delta u + V * u$), the Airy equation ($D = \partial_{xxx}$) and, more generally, any sufficiently regular pseudo-differential operator (for example $\sqrt{-\Delta + c^2}$). The crucial insight is that the abstract formulation via the Fourier transform has a direct analogue on weighted graphs: more precisely, given eigenfunctions $\phi_1, \dots, \phi_N$ associated to eigenvalues $\lambda_1, \dots, \lambda_N$, the natural `frequency' associated to $\phi_k$ is, of course, $\lambda_k$ and we may define the solution of $$ \frac{\partial}{\partial t} u(t,x) = D u(t,x)$$ in the same way via $$ u(t,x) = \sum_{k=1}^{N}{ e^{ p(\lambda) t} \left\langle u(0,x), \phi_k \right\rangle_{L^2} \phi_k(x)}.$$ \begin{figure}[h!] \begin{tabular}{ccc} \includegraphics[width=.32\textwidth]{waveAff12.png} & \includegraphics[width=.32\textwidth]{waveAff22.png} & \includegraphics[width=.32\textwidth]{waveAff3.png} \\ \includegraphics[width=.32\textwidth]{heatAff1.png} & \includegraphics[width=.32\textwidth]{heatAff2.png} & \includegraphics[width=.32\textwidth]{heatAff3.png} \\ \includegraphics[width=.32\textwidth]{airyAff1.png} & \includegraphics[width=.32\textwidth]{airyAff2.png} & \includegraphics[width=.32\textwidth]{airyAff3.png} \\ \includegraphics[width=.32\textwidth]{schrodAff1.png} & \includegraphics[width=.32\textwidth]{schrodAff2.png} & \includegraphics[width=.32\textwidth]{schrodAff3.png} \end{tabular} \caption{Wave (top), Heat ($2^{nd}$ row), Airy ($3^{rd}$ row), and Schrodinger (bottom).} \end{figure} Natural `symbols' include heat $p(\lambda) = - \lambda^2$, Airy $p(\lambda) = i \lambda^3$ or Schrodinger $p(\lambda) = i \lambda$. Naturally, the same analysis goes through for equations of the type $u_{tt} = Du$ and our analysis of the attenuated wave equation above follows that scheme. The analysis of partial differential equations on graphs is still in its infancy and our original motivation for using the wave equation is a number of desirable properties that seem uniquely suited for the task at hand: no dissipation of energy and finite speed of propagation. Numerical examples show that different symbols $p(\lambda)$ can induce very similar neighborhoods: we believe that this merits further study; in particular, a thorough theoretical analysis of the proposed family of algorithms is highly desired. \subsection{Special case: Heat equation} We want to emphasize that our approach is novel even when we chose to emulate the classical heat propagation. This method can outperform the classical (unrefined) embedding via Laplacian eigenmaps even in relatively simple toy examples: we consider the classical 2D dumbbell example in Figure \ref{fig:dumbbell2}. \begin{figure}[h!] \begin{tabular}{c} \includegraphics[width=.5\textwidth]{dumbbellData.png} \end{tabular} \caption{The dumbbell domain in our experiment.}\label{fig:dumbbell2} \end{figure} This example has a small Cheeger constant due to the bottleneck, which means the first non-trivial eigenfunction will be essentially constant on the boxes and change rapidly on the bottleneck. This classical examples illustrates well how the first nontrivial eigenfunction can be used as a classifier and the classical Laplacian eigenmap works spectacularly well without any further modifications. \begin{figure}[h!] \begin{tabular}{c} \includegraphics[width=.6\textwidth]{dumbbellEigenfunctions.png} \end{tabular} \caption{The values of the first eigenfunction for classical Laplacian eigenmaps (blue) vs. the refined heat metric (blue).}\label{fig:dumbbell} \end{figure} Figure \ref{fig:dumbbell} compares the eigenfunction $\phi_1$ of the Laplacian compared to the first non-trivial eigenfunction of the heat equation distance matrix. We observe that the refined heat metric is a much better approximation to the function \[f(x) = \begin{cases} -1 & x_1\leq -0.5 \\ 2x & -0.5< x_1< 0.5 \\ 1 & x_1\geq 0.5 \end{cases} \] than $\phi_1$ and allows for a more accurate reconstruction of the bridge. We also observe that the nontrivial eigenfunction is essentially and to a remarkable degree constant on the two clusters which further increases its value as a classifier. \section{Conclusions} \textit{Summary.} We have presented a new pre-processing technique for classical dimensionality reduction techniques based on spectral methods. The underlying new idea comes in three parts: (1) if one computes eigenfunctions of the Laplacian, then one might just as well use them so simulate the evolution of a partial differential equation on the existing weighted graph, (2) especially for physically meaningful dynamical systems such as the wave equation one would expect points with high affinity to behave similarly throughout time and (3) this motivates the construction of a refined metric extracting information coming from the behavior of the dynamical system. \\ \textit{The wave equation.} We were originally motivated by a series of desirable properties of the wave equation on $\mathbb{R}^n$: preservation of regularity and finite speed of propagation. Recall that one of the fundamental differences between the heat equation and the wave equation is that solutions of the heat equation experience an instanteneous gain in smoothness while the wave equation merely preserves the smoothness of the initial datum (and sometimes not even that). Our main point is to show that this is not arbitrary but due to physical phenomena whose counterparts in the world of data can provide a refined measurement: \textit{the lack of regularity can be helpful}! However, as we have shown, there are similar effects for most other partial differential equations and theoretical justifications on a precise enough level that they would distinguish between various dynamical systems are still missing -- we believe this to be a fascinating open problem.\\ \textit{Refined metrics.} Similarily, our way of refining metrics, either by taking the minimum or by compiling an average, is motivated by considerations (see also \cite{stein}) that are not specifically tuned to our use of partial differential equations -- another fascinating open question is whether there is a more natural and attuned way of extracting information.\\ \textbf{Acknowledgement.} The authors are grateful to Raphy Coifman for a series of fruitful discussions and helpful suggestions. A.C. is supported by an NSF Postdoctoral Fellowship \#1402254, S.S. is supported by an AMS Simons Travel Grant and INET Grant \#INO15-00038.
{'timestamp': '2016-07-18T02:08:18', 'yymm': '1607', 'arxiv_id': '1607.04566', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04566'}
arxiv
\section{Introduction} \blfootnote{ % % % % \hspace{-0.65cm} This work is licensed under a Creative Commons Attribution 4.0 International License. License details: \url{http://creativecommons.org/licenses/by/4.0/} } Argumentation mining is a relatively new challenge in corpus-based discourse analysis that involves automatically identifying argumentative structures within a corpus. Many tasks in argumentation mining~\cite{argumentsurvey2015} and debating technologies~\cite{colingdemo2014} involve categorizing a sequence in the context of another sequence. For example, in \emph{context dependent claim detection}~\cite{cdcd2014}, given a sentence, one task is to identify whether the sentence contains a claim relevant to a particular debatable topic (generally given as a context sentence). Similarly in \emph{context dependent evidence detection}~\cite{evidence2015}, given a sequence (possibly multiple sentences), one task is to detect if the sequence contains an evidence relevant to a particular topic. We refer to such class of problems in computational argumentation as \emph{bi-sequence classification} problems---given two sequences $s$ and $c$ we want to predict the label for the target sequence $s$ in the context of another sequence $c$\footnote{In this paper, we shall ignore the subtle distinction between sentence and sequence and both will mean just a text segment composed of words.}. Apart from the debating tasks, several other natural language inference tasks fall under the same paradigm of having a pair of sequences. For example, \emph{recognizing textual entailment}~\cite{snli2015}, where the task is to predict if the meaning of a sentence can be inferred from the meaning of another sentence. Another class of problems originated from question-answering systems also known as \emph{answer selection}, where given a question, a candidate answer needs to be classified as an answer to the question at hand or not. Recently, deep learning approaches have obtained very high performance across many different natural language processing tasks. These models can often be trained in an end-to-end fashion and do not require traditional, task-specific feature engineering. For many single sequence classification tasks, the state-of-the-art approaches are based on recurrent neural networks (RNN variants like Long Short-Term Memory (LSTM)~\cite{lstm97} and Gated Recurrent Unit (GRU)~\cite{cho14}) and convolution neural network based models (CNN)~\cite{Kim14}. Whereas for bi-sequence classification, the context sentence $c$ has to be explicitly taken into account when performing the classification for the target sentence $s$. The context can be incorporated into the RNN and CNN based models in various ways. However there is not much understanding in current literature as to the best way to handle context in these deep learning based models. In this paper, we empirically evaluate(see Section ~\ref{sec:experiments}) the performance of five different ways of handling context in conjunction with target sentence(see Section~\ref{sec:models}) for multiple bi-sequence classification tasks(see Section~\ref{sec:tasks}) using architectures composed of RNNs and(/or) CNNs. In a nutshell, this paper makes the two major novel contributions: \begin{enumerate} \item We establish the first deep learning based baselines for three bi-sequence classification tasks relevant to argumentation mining with zero feature engineering. \item We empirically compare the performance of several ways handling context for bi-sequence classification problems in RNN and CNN based models. While some of these variants are used in various other tasks, there has been no formal comparison of different variants and this is the first attempt to actually list all the variants and compare them on several publicly available benchmark datasets. \end{enumerate} \section{Bi-Sequence classification tasks}\label{sec:tasks} In this section, we will briefly mention the various bi-sequence tasks of interest in the literature of argumentation mining and in the broader natural language inference domain. \subsection{Argumentation Mining} We mainly consider two prominent tasks in argumentation mining, namely, detecting the claims~\cite{cdcd2014} and evidences~\cite{evidence2015}, within a given corpus, which are related to a pre–specified topic. These two tasks together helps to automatically construct persuasive arguments out of a given corpora. We will define the following four concepts: \noindent \textbf{Motion} - The topic under debate, typically a short phrase that frames the discussion. \noindent \textbf{Claim} - A general, typically concise statement that directly supports or contests the motion. \noindent\textbf{Motion text} - A document/article/discourse that contain claims with high probability. \noindent \textbf{Evidence} - A set of statements that directly supports the claim for a given motion. \subsubsection{Context Dependent Claim Detection (CDCD)} \label{sec:cdcd} \emph{Given a sentence in a motion text the task is to identify whether the sentence contains a claim relevant to the motion or not}. This is the claim sentence task introduced by ~\newcite{cdcd2014}. For example, each of the following sentences includes a claim, marked in italic, for the motion topic in brackets. \begin{enumerate} \item \small (\textbf{the sale of violent video games to minors}) Recent research has suggested that some \emph{violent video games may actually have a pro-social effect in some contexts, for example, team play}. \item (\textbf{the right to bear arms}) Some gun control organizations say that \emph{increased gun ownership leads to higher levels of crime, suicide and other negative outcomes}. \end{enumerate} \subsubsection{Context Dependent Evidence Detection (CDED)} \label{sec:cded} \emph{Given a segment in a motion text the task is to identify whether the segment contains an evidence relevant to the motion or not}~\cite{evidence2015}. We consider evidences of two types in this paper, \emph{Study} and \emph{Expert}. Evidences of type study are generally results of a quantitative analysis of data given as numbers, or as conclusions. The following are two examples for study evidence relevant to the motion topic in brackets. \begin{itemize} \item \small (\textbf{the sale of violent video games to minors}) A 2001 study found that exposure to violent video games causes at least a temporary increase in aggression and that this exposure correlates with aggression in the real world. \item (\textbf{the right to bear arms}) In the South region where there is the highest number of legal guns per citizen only $59\%$ of all murders were caused by firearms in contrast to $70\%$ in the Northeast where there is the lowest number of legal firearms per citizen. \end{itemize} Evidence of type expert is a testimony by a person/group/commitee/organization with some known expertise/authority on the topic. The following are two examples for expert evidence relevant to the motion topic in brackets. \begin{enumerate} \item \small (\textbf{the sale of violent video games to minors}) This was also the conclusion of a meta-analysis by psychologist Jonathan Freedman, who reviewed over 200 published studies and found that the majority did not find a causal link. \item (\textbf{the right to bear arms}) University of Chicago economist Steven Levitt argues that available data indicate that neither stricter gun control laws nor more liberal concealed carry laws have had any significant effect on the decline in crime in the 1990s. \end{enumerate} \subsection{Textual Entailment (TE)} This task \cite{snli2015} corresponds to a multiclass setting, where given a pair of sentences (\emph{premise} and \emph{hypothesis}), the task is to identify whether one of them (\emph{premise}) entails, contradicts or is neutral with respect to the other sentence (\emph{hypothesis}). Unlike the other debating tasks seen previously, we cannot call these pair of sentences as context and target as these are more symmetric in nature. Typical examples\footnote{\url{http://nlp.stanford.edu/projects/snli/}} are the following (premise followed by hypothesis): \begin{itemize} \item \small Entailment: A soccer game with multiple males playing - Some men are playing a sport. \item Contradiction: A black race car starts up in front of a crowd of people - A man is driving down a lonely road. \item Neutral: A smiling costumed woman is holding an umbrella - A happy woman in a fairy costume holds an umbrella. \end{itemize} \subsection{Answer Selection for Questions} Question Answering (QA) System is a natural extension to the traditional commercial search engines as it is concerned with fetching answers to natural language queries and returning the information accurately in natural human language. A QA system can be either closed-domain or open-domain, the former being restricted to a particular domain while the latter is not. \emph{Answer sentence selection is a crucial subtask of the open-domain question answering problem, with the goal of extracting answers from a set of pre-selected sentences} \cite{wikiqa}. This is again bi-sequence classification task where the pair of sequences being a question and a candidate answer to be selected. \section{Deep Learning models for sequence pairs}\label{sec:models} All the tasks described in the previous section can be formulated as bi-sequence classification problems where we have to predict the label for the given pair of sequences. For simpler single sequence text classification tasks, RNN or CNN based architectures have become standard baselines. In this section, we will briefly introduce RNN and CNN and then subsequently describe RNN and CNN based architectures for bi-sequence classification tasks. Specifically, we talk about five different ways of handling context along with the target sentence. \subsection{Continuous Bag of Words (CBOW)}\label{sec:cbow} One of the simplest forms of sequence representation is the CBOW model, where every word in the sequence produces some word embedding (say, based on word2vec \cite{word2vec13}) and the average of the word embedding vectors over the words produces the representation of the sequence. As is evident, this form of representation totally disregards the word order of the sequence. \subsection{Recurrent neural networks (RNNs)} The RNN model provides a framework for conditioning on the entire history of the sequence without resorting to the Markov assumption traditionally used for modelling sequences. Unlike CBOW, RNNs encode arbitrary length sequences as fixed size vectors without disregarding the word order. Given an ordered list of $n$ input vectors $\textbf{x}_1,...,\textbf{x}_n$ and an initial state vector $\textbf{s}_0$, a RNN generates an ordered list of $n$ state vectors $\textbf{s}_0,...,\textbf{s}_n$ and an ordered list of $n$ output vectors $\textbf{y}_1,...,\textbf{y}_n$, that is, $RNN(\textbf{s}_0,\textbf{x}_1,...,\textbf{x}_n)=\textbf{s}_1,...,\textbf{s}_n,\textbf{y}_1,...,\textbf{y}_n$. The input vectors $\textbf{x}_i$ (which corresponds to a fixed dimensional representation for each word in the sequence) are presented to the RNN in a sequential fashion and $\textbf{s}_i$ represents the state of the RNN after observing the inputs $\textbf{x}_1,...,\textbf{x}_i$. The output vector $\textbf{y}_i$ is a function of the corresponding state vector $\textbf{s}_i$ and is then used for further prediction. An RNN is given by the following update equations: \begin{eqnarray} \textbf{s}_i &=& R(\textbf{x}_i,\textbf{s}_{i-1}) \\ \textbf{y}_i &=& O(\textbf{s}_{i}) \end{eqnarray} The recursively defined function $R$ takes as input the previous state vector $\textbf{s}_{i-1} $ and the current input vector $\textbf{x}_i \in \mathbb{R}^{d_{x}}$ and results in an updated state vector $\textbf{s}_i \in \mathbb{R}^{d_{s}}$. An additional function $O$ maps the state vector $\textbf{s}_i$ to an output vector $\textbf{y}_i \in \mathbb{R}^{d_{y}}$. Different instantiations of $R$ and $O$ will result in the different network structures (Simple RNN, LSTM~\cite{lstm97}, GRU~\cite{cho14}, etc.). The final state vector $\textbf{s}_n$ can be thought of as encoding the entire input sequence into a fixed size vector, which can be passed to a softmax layer to produce class probabilities. \subsection{Convolutional Neural Networks (CNNs)} CNNs are built on the premise of locality and parameter sharing which has proven to produce very effective feature representation for images. Following the groundbreaking work by \newcite{Kim14}, there has been a lot of interest shown by the text community towards applying CNNs for modelling text representation. As in case of RNNs defined above, an $n$-word sentence consists of embedding vectors $\textbf{x}_1,...,\textbf{x}_n \in \mathbb{R}^{d_{x}}$, one for each word in the sentence. Let $\textbf{x}_{i:i+j}$ denote the concatenation of words $\textbf{x}_i,\textbf{x}_{i+1},...,\textbf{x}_{i+j}$. A convolution operation defined by a non-linear function $f$ applies a filter $\textbf{w} \in \mathbb{R}^{h d_{x}}$ to a window of $h$ words to produce a single feature value as given below: \begin{eqnarray} c_i = f (\textbf{w} . \textbf{x}_{i:i+h-1} + b) \\ \textbf{c} = [c_1,c_2,...,c_{n-h+1}] \end{eqnarray} In the next step, max-pooling is applied which essentially produces a single feature value $\hat{c} = max\{\textbf{c}\}$, corresponding to one filter that has been used. The model can have multiple feature values, one for each applied filter, thus producing a feature representation for the input sentence, which can again be passed to a softmax layer to produce class probabilities. \subsection{Bi-Sequence RNN models} \label{sec:biseq-rnn} For bi-sequence classification tasks we use two RNNs, one RNN to encode the context sentence (\emph{context RNN}) and another separate RNN encode the target sentence (\emph{target RNN}). We define the following five different variants of combining these two RNNs for bi-sequence classification tasks (see Figure~\ref{fig:models} for illustration of these variants). \begin{enumerate} \item \small \textbf{conditional-state}: The final state of the context RNN is fed as the initial state of the target RNN. This way of handling context for RNNs has been previously used in conversational systems~\cite{Vinyals:15}, image description~\cite{vinyals2015show} and image question answering~\cite{Mengye:15} systems. \item \textbf{conditional-input}: The final state of the context RNN is fed as auxiliary input (concatenated with every input) for the target RNN. This way of handling context has been previously used in machine translation tasks~\cite{sutskever2014sequence}. \item \textbf{conditional-state-input}: The final state of the context RNN is fed as the initial state of the target RNN and also fed as input for target RNN concatenated with every input. \item \textbf{concat}: The final states of both the context and the target RNN are concatenated and then fed to a softmax layer for the label prediction. \item \textbf{bi-linear}: The final states of both the context and the target RNN are combined using a bi-linear form ($\textbf{x}^{\top}\textbf{W}\textbf{y}$) with a softmax function for the final prediction. There are different $\textbf{W}$ for different classes under consideration. \end{enumerate} From here on, we would refer to architecture types 1, 2 and 3 as \emph{conditional} variants while the others will be addressed as is. In addition, we consider another baseline variant \textbf{concat-sentence}, in which we concatenate the context and the sentence with a special separator token and feed the entire concatenated sequence to a single RNN. For all these variants we use a common embedding layer. Also note that the conditional variants require a common RNN size for both the context and the target RNNs. Even though that restriction is not there for other variants, we choose the same RNN size anyways for convenience. \begin{figure*}[t] \centering \subfigure[conditional-state]{\includegraphics[width=0.32\textwidth]{figs/conditional_state}} \subfigure[conditional-input]{\includegraphics[width=0.32\textwidth]{figs/conditional_input}} \subfigure[conditional-state-input]{\includegraphics[width=0.32\textwidth]{figs/conditional_input_state}} \subfigure[concat]{\includegraphics[width=0.32\textwidth]{figs/concat}} \subfigure[bilinear]{\includegraphics[width=0.32\textwidth]{figs/bilinear}} \subfigure[concat-sentence]{\includegraphics[width=0.32\textwidth]{figs/concat_sentence}} \caption{RNN based Architectures for bi-sequence classification.}\label{fig:models} \end{figure*} \begin{figure*}[t] \centering \subfigure[concat-bilinear-all-combinations]{\label{fig:models11}\includegraphics[width=0.45\textwidth]{figs/concat-bilinear}} \subfigure[conditional-all-combinations]{\label{fig:models12}\includegraphics[width=0.45\textwidth]{figs/cond-all}} \caption{Multiple model variants for bi-sequence classification.}\label{fig:models1} \end{figure*} \subsection{Bi-Sequence model variants} \label{sec:biseq-all} In this paper, we consider multiple ways of extending the bi-sequence architectures mentioned in section ~\ref{sec:biseq-rnn}, by replacing RNN with CBOW or CNN either for context or target or both. For the variations \emph{concat} and \emph{bi-linear} (see Fig. ~\ref{fig:models11}), we have considered CBOW, RNN and CNN for context representation whereas we have RNN and CNN for target representation. In tasks where context has very few words (say debating tasks or question-answering), a simple representation like CBOW may work for context. However, we haven't considered modelling target using CBOW as targets are usually of larger length. For the \emph{conditional} variants (see Fig. ~\ref{fig:models12}), we haven't considered CBOW due to their limited modelling capacity and there is no softmax layer directly on top of context representation to compensate for it (even though softmax is only on top of target RNN). Moreover, target can only be RNN as there is no concept of hidden state for CNNs. Hence, we use CNN and RNN for context whereas RNN for target. In addition, we consider the concat-sentence (mentioned in section ~\ref{sec:biseq-rnn}) as a baseline. This leads to 19 architectures for empirical comparison (12 from Fig. ~\ref{fig:models11} and 6 from Fig. ~\ref{fig:models12} and the baseline). \section{Experiments} \label{sec:experiments} We have carried out extensive evaluation of the above architecture variants over a wide range of datasets related to argumentation mining as well as datasets appealing to the larger natural language community like textual entailment and question answering data. We consider data with class imbalance problem as well as balanced and we do not restrict ourselves to binary classification by working with multiclass dataset as well. As can be found in the Table~\ref{debater-data}, we consider the following tasks related to the domain of argumentation mining\cite{aharoni14}, which is available here \footnote{\url{https://www.research.ibm.com/haifa/dept/vst/mlta_data.shtml}} : \begin{itemize} \item \small Claim Sentence : This is the dataset for the CDCD task defined in section ~\ref{sec:cdcd}. This is the current benchmark dataset for the Claim Detection task. There are a total 47183 canditate claims distributed among 33 motions. \item EXPERT Evidence : This is corresponding to the CDED task defined in section ~\ref{sec:cded} for evidence type EXPERT. There are 56985 labelled candidates for 57 different motion topics. \item STUDY Evidence : For evidence type STUDY, the dataset consists of 33534 labelled candidates for 49 motion topics. \end{itemize} Table~\ref{debater-data} summarizes all of the datasets above. Interesting point to be noted here is that all the datasets above have very low number of positives and the architectures we are evaluating need to be resilient to the class imbalance problem for these datasets. Other than the debating datasets listed above, we also consider two datasets related to more popular problems in the natural language processing community: \begin{itemize} \item \small Textual Entailment (TE) \footnote{\url{http://nlp.stanford.edu/projects/snli/}} \cite{snli2015} :This dataset consist of around 500K instances evenly distributed across all three classes. So, here we have a multiclass problem in a balanced setting. \item{WikiQA \footnote{\url{http://aka.ms/WikiQA}} \cite{wikiqa} : There are around 29K labelled question/answer pairs at our disposal.} \end{itemize} \begin{table}[!h] \small \parbox{.4\linewidth}{ \centering \begin{tabular}{|l|l|l|l|} \hline \bf \small{Task} & \bf \small{Motions} & \bf \small{Data Size} & \bf \small{Positives} \\ \hline \small{Claim Sentence} & 33 & 47183 & 2.77\% \\ \small{EXPERT Evidence} & 57 & 56985 & 4.56\% \\ \small{STUDY Evidence} & 49 & 33534 & 3.74\% \\ \hline \end{tabular} \caption{\label{debater-data} Argument Mining Datasets.} } \hfill \parbox{.5\linewidth}{ \centering \begin{tabular}{|l|r|l|l|l|l|} \hline \bf \small{Task} & \bf \small{Train} & \bf \small{Dev} & \bf \small{Test} & \bf \small{Problem} & \bf \small{Class} \\ \hline \small{TE} & \small{549367} & \small{9842} & \small{9824} & \small{Multiclass}& \small{Balance} \\ \small{WikiQA} & \small{20360} & \small{2733} & \small{6165} & \small{Binary} & \small{Imbalance} \\ \hline \end{tabular} \caption{\label{public-data} More Datasets.} } \end{table} \subsection{Experimental Setup} For each of the architectures mentioned in section ~\ref{sec:biseq-all}, we choose the best configuration of hyperparameters based on the validation portion of the particular dataset (For Claim and Evidence datasets, we consider a train:valid:test split of 60:10:30 while for the TE and WikiQA datasets we consider their corresponding given split). Performance of the best performing configuration for every architecture is reported on the test data using the appropriate metric. As the claim and expert and study Evidences had similar data characteristics (in terms of data size and context and target lengths), we did extensive hyperparam tuning only on the claim dataset and applied the best configurations without further tuning to the expert and study datasets. Exhaustive hyperparam tuning was done on the TE dataset as well because its data characteristics are very different from other datasets. In addition to reporting the test metrics for argumentation datasets, we carried out Leave-One-Out(leaving one motion out for testing) Mode training and evaluation which is more appropriate for this problem setting as it is crucial that we generalize well to totally unseen motion topics. In this case, we report the macro-average metrics over all motions. \subsection{Hyperparameter Tuning} Considering the number of variations of combinations of architectures we have considered, we have a huge hyperparameter space to deal with. Hence, we decided to fix insignificant hyperparameters and focus only on the relevant ones. We have decided to use word2vec \cite{word2vec13} pretrained models for initializing the word embeddings across CBOW, CNN and RNNs and made them trainable specific to task at hand. In addition we have found through minimal tuning that the Adam \cite{adam14} optimizer seems to work best. We have also found that a learning rate of 0.001 works best in most scenarios except when the parameter space in some architectures (for ex, \emph{bi-linear}) is large, in which case lower learning rates of 0.0001 or 0.00001 worked well. Rather than tuning the maximum sequence length for context and target sentence, we tried to fix it by getting reasonable values by plotting histogram of sequence lengths and had a cut-off at around 98-99 percentile. The max lengths turned out to be 14 for context and 60 for target for Claim, Evidence and WikiQA datasets while for textual entailment, they turned out to be 30 in both due to the symmetrical nature between premise and hypothesis. We tuned the following hyperparameters:\\ \small \textbf{RNN Model} : GRU or LSTM.\\ \textbf{RNN Size} : 50,100,200,300,400,500,1000.\\ \textbf{CNN Filter Sizes} : 3,3+4,3+4+5,2+3+4+5.\\ \textbf{CNN Number of Filters} : 10,20,40,64,128.\\ \textbf{L2 Reg coeff for CNN} : 0, 0.01, 0.001, 0.0001.\\ \normalsize For every architecture type, we carried out the optimization of the relevant hyperparams from the above list over the whole grid. One point to note is that for certain architectures like conditional-state, as output of context is fed in to the hidden state of target RNN, there are some restrictions in the allowable context RNN/CNN hyperparam configurations based on the target RNN settings as the output dimension of the context RNN/CNN needs to match the hidden state dimension of the target RNN. \subsection{Evaluation Metrics} For the datasets Claim, Expert, Study Evidence and WikiQA datasets, we have used standard evaluation measures like Average Precision (Area under Precision Recall Curve) and AUC to choose best hyperparam configurations based on validation data as well as report test metrics. For argument mining specific tasks, we have reported other additional metrics like P@200, R@200, F1@200, P@50, R@50 and F1@50 \cite{cdcd2014} in addition to reporting AUC and Average Precision. Please note for leave-one-out mode, the reported metrics are macro-average over all motion topics. For Textual entailment, since it is a more balanced dataset, reporting valid and test accuracies are standard in the literature and we have done the same. \begin{table*}[!ht] \scriptsize \centering \begin{tabular}{|l|l|l|l|r|} \hline \bf Task &\bf Context & \bf Target & \bf Architecture & \bf Test AVGP\\ \hline \multirow{3}{*}{Claim Sentence} & RNN & CNN & \bf Concat & \bf 0.307 \\ \cline{2-5} & CNN & CNN & Concat & 0.304 \\ \cline{2-5} & \multicolumn{3}{l|}{Concat-Sentence baseline} & 0.17 \\ \hline \hline \multirow{3}{*}{EXPERT Evidence} & RNN & RNN & \bf Conditional-State-Input & \bf 0.257 \\ \cline{2-5} & CNN & CNN & Concat & 0.254 \\ \cline{2-5} & \multicolumn{3}{l|}{Concat-Sentence baseline} & 0.225 \\ \hline \hline \multirow{3}{*}{STUDY Evidence} & CNN & CNN & \bf Concat & \bf 0.297 \\ \cline{2-5} & RNN & CNN & Concat & 0.29 \\ \cline{2-5} & \multicolumn{3}{l|}{Concat-Sentence baseline} & 0.236 \\ \hline \hline \multirow{2}{*}{WikiQA} & CBOW & RNN & \bf Concat & \bf 0.187 \\ \cline{2-5} & CNN & RNN & Conditional-State-Input & 0.186 \\ \hline \end{tabular} \caption{Empirical evaluation based on Average Precision on assymetric datasets.} \label{table-avgp-summary} \end{table*} \begin{table*}[!ht] \scriptsize \centering \begin{tabular}{|l|l|l|l|r|} \hline \bf Task &\bf Context & \bf Target & \bf Architecture & \bf Test AUC\\ \hline \multirow{3}{*}{Claim Sentence} & CNN & CNN & \bf Concat & \bf 0.873 \\ \cline{2-5} & CNN & RNN & Conditional-State & 0.873 \\ \cline{2-5} & \multicolumn{3}{l|}{Concat-Sentence baseline} & 0.831 \\ \hline \hline \multirow{3}{*}{EXPERT Evidence} & RNN & RNN & \bf Conditional-State & \bf 0.832 \\ \cline{2-5} & RNN & RNN & Conditional-State-Input & 0.823 \\ \cline{2-5} & \multicolumn{3}{l|}{Concat-Sentence baseline} & 0.805 \\ \hline \hline \multirow{3}{*}{STUDY Evidence} & CNN & CNN & \bf Concat & \bf 0.87 \\ \cline{2-5} & CBOW & CNN & Concat & 0.864 \\ \cline{2-5} & \multicolumn{3}{l|}{Concat-Sentence baseline} & 0.844 \\ \hline \hline \multirow{2}{*}{WikiQA} & CNN & CNN & \bf Concat & \bf 0.74 \\ \cline{2-5} & CBOW & RNN & Concat & 0.74 \\ \hline \end{tabular} \caption{Empirical evaluation based on AUC on assymetric datasets.} \label{table-auc-summary} \end{table*} \begin{table*}[!ht] \centering \resizebox{\textwidth}{!}{\begin{tabular}{|l|l|r|r|} \hline \bf Method &\bf Model & \bf TrainAcc(\%) & \bf TestAcc(\%) \\ \hline \cite{snli2015} & Use of features incl unigrams and bigrams & 99.7 & 78.2\\ \cite{vendrov15} & 1024D GRU encoders w/ unsupervised 'skip-thoughts' pre-training & 98.8 & 81.4\\ \cite{mou15} & 300D Tree-based CNN encoders & 83.3 & 82.1 \\ \hline \cite{cheng16} & 450D LSTMN with deep attention fusion & 88.5 & 86.3\\ \cite{parikh16} & 200D decomposable attention model with intra-sentence attention & 90.5 & \bf 86.8\\ \hline \small{\bf Conditional-State-RNN-RNN} & Simple architecture with RNNs without attention & 89.97 & 82.36 \\ \hline \end{tabular}} \caption{Comparison with the state-of-the-art in Textual Entailment dataset.} \label{table-te} \end{table*} \begin{table*}[!ht] \small \centering \resizebox{\textwidth}{!}{\begin{tabular}{|l|r|r|r|r|r|r|r|r|} \hline \bf Method &\bf P@200 & \bf R@200 & \bf F1@200 & \bf P@50 & \bf R@50 & \bf F1@50 & \bf AVGP & \bf AUC \\ \hline CDCD \cite{cdcd2014}** & 9.0 & \bf 73.0 & - & 18.0 & 40.0 & - & - & - \\ BoW \cite{lippi2015} & 8.2 & 51.7 & 14.2 & - & - & - & 0.117 & 0.771\\ TK \cite{lippi2015} & 9.8 & 58.7 & 16.8 & - & - & - & 0.161 & 0.808\\ TK+Topic \cite{lippi2015} & \bf 10.5 & 62.9 & \bf 18.0 & - & - & - & 0.178 & 0.823\\ \hline \bf Concat-CNN-CNN & 9.64 & 61.5 & 15.8 & 17.1 & 27.7 & 19.2 & 0.173 & 0.812 \\ Conditional-State-Input-RNN-RNN & 9.56 & 60.0 & 15.6 & 16.6 & 26.9 & 18.5 & 0.162 & 0.801 \\ \hline \end{tabular}} \caption{\small Results in Leave-One-Motion-Out mode for Claim Sentence Task. **\newcite{cdcd2014} used a smaller version of the dataset consisting of only 32 motions and also less number of claims. For fair comparison, we also use the same version of dataset as in CDCD and report the results in Appendix ~\ref{sec:supp}. } \label{table-lomo-claim} \end{table*} \begin{table*}[!ht] \small \centering \resizebox{\textwidth}{!}{\begin{tabular}{|l|r|r|r|r|r|r|r|r|r|r|r|} \hline \bf Task &\bf P@200 & \bf R@200 & \bf F1@200 & \bf P@50 & \bf R@50 & \bf F1@50 & \bf P@20 & \bf P@10 & \bf P@5 & \bf AVGP & \bf AUC \\ \hline Claim Sentence Task & 9.64 & 61.5 & 15.8 & 17.1 & 27.7 & 19.2 & 22.4 & 27.9 & 28.5 & 0.173 & 0.812\\ EXPERT Evidence Task & 9.53 & 64.0 & 14.5& 14.5 & 35.0 & 15.7& 18.6 & 21.1 & 22.5 & 0.160 & 0.750\\ STUDY Evidence Task & 8.33 & 79.5 & 13.5 & 15.5 & 53.9 & 18.9 & 20.8 & 25.3 & 31.8 & 0.298 & 0.836\\ \hline \end{tabular}} \caption{Numbers in Leave-One-Motion-Out mode for all three debating tasks using our approach.} \label{table-lomo-all} \end{table*} \subsection{Results and Discussion} Tables ~\ref{table-avgp-summary} and ~\ref{table-auc-summary} report the two top ranking architectures for four datasets based on Test AUC and Test Avg Precision. We find that \textbf{Concat} is the winning architecture variant across majority of the datasets considered. Moreover, the runner-up architecture type \textbf{Conditional-State-Input} is also similar to 'Concat' in the sense that concatenation of context representation is done at the input of the sentence RNN. Now the four datasets we considered are asymmetric in nature as there are significantly fewer contexts (motions or questions) than the targets. Hence the context model does not see enough data for learning and hence, if the learnt context model is fed directly to the hidden state of the target RNN, the improperly learnt context model can play a big role. In contrast if a Concat kind of architecture is used, the linear plus softmax layer can decide on how much importance to give to the context model. Hence, Concat is doing better in this case. From Textual entailment dataset(which is symmetric in nature), we found that conditional type of architectures are doing better at the Test accuracies. In fact, the winning architecture was \textbf{Conditional-State} with RNN-RNN combo, which did better in terms of test accuracy than the feature based models \cite{snli2015} and one tree-based model \cite{mou15}. However, it came close to the state-of-the-art attention based model \cite{parikh16}. In our work we are empirically evaluating simple architectures for bisequence classification without using more sophisticated tree-based or attention-based models. It is possible that adding attention on top of this will improve the results further. The \emph{bi-linear} model, is supposed to capture the interaction between the context and target reps via a quadratic form (section ~\ref{sec:biseq-rnn}). For the asymmetric datasets, this is not doing well again due to insufficient data for context. Whereas, it does well for the TE data. However, due to the huge parameter space for bi-linear, training times are considerably higher and requires lower learning rate than other architecture types. The runtimes are comparable for the other architecture variants. From Table ~\ref{table-lomo-claim}, the main takeaway is that we are the only deep learning based method with zero feature engineering and we have come very close to the state-of-the-art systems \cite{cdcd2014} and \cite{lippi2015}, which are heavily feature-engineered. Here again the winner is a 'Concat' based combination of architecture. Moreover, Tables ~\ref{table-lomo-claim} and ~\ref{table-lomo-all} are the first deep learning zero feature engineered baselines for all argument mining datasets. Appendix ~\ref{sec:supp} contains the details of the exhaustive experiments on all architectures on the different datasets in terms of the best hyperparameters used. \section{Conclusion} In this work, we have considered taking up multiple architectures for bisequence classification tasks, for which not much understanding is there in the current literature. In addition to suggesting winning architecture recipes for different kinds of datasets, we have established deep learning based baselines for argument mining tasks with zero feature engineering. As future work, it remains to be seen how adding attention on top of winning simple architectures fare in terms of benchmark performance. \small \section{Acknowledgements} We would like to thank Mitesh M. Khapra for the multiple discussions that we had with him leading to this paper. In addition, we are also grateful to our colleagues at IBM Debating Technologies for the numerous suggestions and feedback at different points of time. \bibliographystyle{acl}
{'timestamp': '2016-10-04T02:07:07', 'yymm': '1607', 'arxiv_id': '1607.04853', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04853'}
arxiv
\section{Introduction}\label{sec:intro} The constraint satisfaction problem (CSP) provides a framework in which it is possible to express, in a natural way, many combinatorial problems encountered in computer science and AI~\cite{Cohen06:handbook,Creignou01:book,Feder98:monotone}. An instance of the CSP consists of a set of variables, a domain of values, and a set of constraints on combinations of values that can be taken by certain subsets of variables. The basic aim is then to find an assignment of values to the variables that satisfies the constraints (decision version) or that satisfies the maximum number of constraints (optimization version). Since CSP-related algorithmic tasks are usually hard in full generality, a major line of research in CSP studies how possible algorithmic solutions depend on the set of relations allowed to specify constraints, the so-called {\em constraint language}, (see, e.g.~\cite{Bulatov??:classifying,Cohen06:handbook,Creignou01:book,Feder98:monotone,Krokhin17:book}). The constraint language is denoted by $\Gamma$ and the corresponding CSP by $\CSP\Gamma$. For example, when one is interested in polynomial-time solvability (to optimality, for the optimization case), the ultimate sort of results are dichotomy results~\cite{Bulatov17:dichotomy,Bulatov??:classifying,Feder98:monotone,Kolmogorov17:complexity,Thapper16:finite,Zhuk17:dichotomy}, pioneered by~\cite{Schaefer78:complexity}, which characterise the tractable restrictions and show that the rest are NP-hard. Classifications with respect to other complexity classes or specific algorithms are also of interest (e.g.~\cite{Barto14:jacm,Barto12:NU,Kolmogorov15:power,Larose09:universal}). When approximating (optimization) CSPs, the goal is to improve, as much as possible, the quality of approximation that can be achieved in polynomial time, see e.g. surveys~\cite{Khot10:UGCsurvey,MM17:cspsurvey}. Throughout the paper we assume that P$\ne$NP. The study of {\em almost satisfiable} CSP instances features prominently in the approximability literature. On the hardness side, the notion of approximation resistance (which, intuitively, means that a problem cannot be approximated better than by just picking a random assignment, even on almost satisfiable instances) was much studied recently, e.g.~\cite{Austrin13:usefulness,Chan13:resist,Hastad14:maxnot2,Khot14:strong}. Many exciting developments in approximability in the last decade were driven by the {\em Unique Games Conjecture} (UGC) of Khot, see survey~\cite{Khot10:UGCsurvey}. The UGC states that it is NP-hard to tell almost satisfiable instances of $\CSP\Gamma$ from those where only a small fraction of constraints can be satisfied, where $\Gamma$ is the constraint language consisting of all graphs of permutations over a large enough domain. This conjecture (if true) is known to imply optimal inapproximability results for many classical optimization problems~\cite{Khot10:UGCsurvey}. Moreover, if the UGC is true then a simple algorithm based on semidefinite programming (SDP) provides the best possible approximation for all optimization problems $\CSP\Gamma$~\cite{Prasad08:optimal}, though the exact quality of this approximation is unknown. On the positive side, Zwick~\cite{Zwick98:finding} initiated the systematic study of approximation algorithms which, given an almost satisfiable instance, find an almost satisfying assignment. Formally, call a polynomial-time algorithm for CSP {\em robust} if, for every $\eps>0$ and every $(1-\eps)$-satisfiable instance (i.e. at most a $\eps$-fraction of constraints can be removed to make the instance satisfiable), it outputs a $(1-g(\eps))$-satisfying assignment (i.e. that fails to satisfy at most a $g(\eps)$-fraction of constraints). Here, the {\em loss} function $g$ must be such that $g(\eps)\rightarrow 0$ as $\eps\rightarrow 0$. Note that one can without loss of generality assume that $g(0)=0$, that is, a robust algorithm must return a satisfying assignment for any satisfiable instance. The running time of the algorithm should not depend on $\eps$ (which is unknown when the algorithm is run). Which problems $\CSP\Gamma$ admit robust algorithms? When such algorithms exist, how does the best possible loss $g$ depend on $\Gamma$? \subsection*{Related Work} In~\cite{Zwick98:finding}, Zwick gave an SDP-based robust algorithm with $g(\eps)=O(\eps^{1/3})$ for {\sc 2-Sat} and an LP-based robust algorithm with $g(\eps)=O(1/\log(1/\eps))$ for {\sc Horn $k$-Sat}. Robust algorithms with $g(\eps)=O(\sqrt{\eps})$ were given in~\cite{Charikar09:near} for {\sc 2-Sat}, and in~\cite{Charikar06:near} for {\sc Unique Games($q$)} where $q$ denotes the size of the domain. For {\sc Horn-2-Sat}, a robust algorithm with $g(\eps)=2\eps$ was given in~\cite{Guruswami12:tight}. These bounds for {\sc Horn $k$-Sat} ($k\ge 3$), {\sc Horn $2$-Sat}, {\sc 2-Sat}, and {\sc Unique Games($q$)} are known to be optimal~\cite{Guruswami12:tight,Khot02:power,Khot07:optimal}, assuming the UGC. The algebraic approach to CSP~\cite{Bulatov??:classifying,Cohen06:handbook,Jeavons97:closure} has played a significant role in the recent massive progress in understanding the landscape of complexity of CSPs. The key to this approach is the notion of a {\em polymorphism}, which is an $n$-ary operation (on the domain) that preserves the constraint relations. Intuitively, a polymorphism provides a uniform way to combine $n$ solutions to a system of constraints (say, part of an instance) into a new solution by applying the operation component-wise. The intention is that the new solution improves on the initial solutions in some problem-specific way. Many classifications of CSPs with respect to some algorithmic property of interest begin by proving an algebraic classification stating that every constraint language either can simulate (in a specific way, via gadgets, -- see e.g.~\cite{Barto16:robust,Dalmau13:robust,Larose09:universal} for details) one of a few specific basic CSPs failing the property of interest or else has polymorphisms having certain nice properties (say, satisfying nice equations). Such polymorphisms are then used to obtain positive results, e.g. to design and analyze algorithms. Getting such a positive result in full generality in one step is usually hard, so (typically) progress is made through a series of intermediate steps where the result is obtained for increasingly weaker algebraic conditions. The algebraic approach was originally developed for the decision CSP~\cite{Bulatov??:classifying,Jeavons97:closure}, and it was adapted for robust satisfiability in~\cite{Dalmau13:robust}. One such algebraic classification result~\cite{Larose09:ability} gives an algebraic condition (referred to as $\mathrm{SD}(\wedge)$ or ``omitting types \textbf{1} and \textbf{2}'' -- see~\cite{Barto14:jacm,Kozik15:maltsev,Larose09:ability} for details) equivalent to the \underline{in}ability to simulate {\sc Lin-$p$} -- systems of linear equations over $Z_p$, $p$ prime, with 3 variable per equation. H\aa stad's celebrated result~\cite{Hastad01:optimal} implies that {\sc Lin-$p$} does not admit a robust algorithm (for any $g$). This result carries over to all constraint languages that can simulate (some) {\sc Lin-$p$}~\cite{Dalmau13:robust}. The remaining languages are precisely those that have the logico-combinatorial property of CSPs called ``{\em bounded width}'' or ``{\em bounded treewidth duality}''~\cite{Barto14:jacm,Bulatov09:bounded,Larose06:bounded}. This property says, roughly, that all unsatisfiable instances can be refuted via local propagation -- see~\cite{Bulatov08:duality} for a survey on dualities for CSP. Barto and Kozik used $\mathrm{SD}(\wedge)$ in~\cite{Barto14:jacm}, and then in~\cite{Barto16:robust} they used their techniques from~\cite{Barto14:jacm} to prove the Guruswami-Zhou conjecture~\cite{Guruswami12:tight} that each bounded width CSP admits a robust algorithm. The general bound on the loss in~\cite{Barto16:robust} is $g(\eps)=O((\log\log(1/\eps))/\log(1/\eps))$. It is natural to ask when a better loss can be achieved. In particular, the problems of characterizing CSPs where linear loss $g(\eps)=O(\eps)$ or polynomial loss $g(\eps)=O(\eps^{1/k})$ (for constant $k$) can be achieved have been posed in~\cite{Dalmau13:robust}. Partial results on these problems appeared in~\cite{Dalmau13:robust,Dalmau15:towards,Kun12:robust}. For the Boolean case, i.e. when the domain is $\{0,1\}$, the dependence of loss on $\Gamma$ is fully classified in~\cite{Dalmau13:robust}. \subsection*{Our Contribution} We study CSPs that admit a robust algorithm with polynomial loss. As explained above, the bounded width property is necessary for admitting any robust algorithm. {\sc Horn 3-Sat} has bounded width, but does not admit a robust algorithm with polynomial loss (unless the UGC fails)~\cite{Guruswami12:tight}. The algebraic condition that separates {\sc Lin-$p$} and {\sc Horn 3-Sat} from the CSPs that can potentially be shown to admit a robust algorithm with polynomial loss is known as $\mathrm{SD}(\vee)$ or ``omitting types \textbf{1}, \textbf{2} and \textbf{5}''~\cite{Dalmau13:robust}, see Section~\ref{sec:algebra} for the description of $\mathrm{SD}(\vee)$ in terms of polymorphisms. The condition $\mathrm{SD}(\vee)$ is also a necessary condition for the logico-combinatorial property of CSPs called ``{\em bounded pathwidth duality}'' (which says, roughly, that all unsatisfiable instances can be refuted via local propagation in a linear fashion), and possibly a sufficient condition for it too~\cite{Larose09:universal}. It seems very hard to obtain a robust algorithm with polynomial loss for every CSP satisfying $\mathrm{SD}(\vee)$ all in one step. From the algebraic perspective, the most general natural condition that is (slightly) stronger than $\mathrm{SD}(\vee)$ is the {\em near-unanimity (NU)} condition~\cite{Baker75:chinese-remainder}. CSPs with a constraint language having an NU polymorphism received a lot of attention in the literature (e.g.~\cite{Feder98:monotone,Jeavons98:consist,Barto12:NU}). Bounded pathwidth duality for CSPs admitting an NU polymorphism was established in a series of papers~\cite{Dalmau05:linear,Dalmau08:majority,Barto12:NU}, and we use some ideas from~\cite{Dalmau08:majority,Barto12:NU} in this paper. We prove that any CSP with a constraint language having an NU polymorphism admits a randomized robust algorithm with loss $O(\eps^{1/k})$, where $k$ depends on the size of the domain. It is an open question whether this dependence on the size of the domain is necessary. We prove that, for the special case of a ternary NU polymorphism known as {\em dual discriminator} (the corresponding CSP is a common generalisation of {\sc Unique Games} with a fixed domain and {\sc 2-Sat}), we can always choose $k=2$. Our algorithms use the standard SDP relaxation for CSPs. The algorithm for the general NU case follows the same general scheme as~\cite{Barto16:robust,Kun12:robust}: \begin{enumerate} \item Solve the LP/SDP relaxation for a $(1-\eps)$-satisfiable instance $\inst I$. \item Use the LP/SDP solution to remove certain constraints in $\inst I$ with total weight $O(g(\eps))$ (in our case, $O(\eps^{1/k})$) so that the remaining instance satisfies a certain consistency condition. \item Use the appropriate polymorphism (in our case, NU) to show that any instance of $\CSP\Gamma$ with this consistency condition is satisfiable. \end{enumerate} Steps 1 and 2 in this scheme can be applied to any CSP instance, and this is where essentially all work of the approximation algorithm happens. Polymorphisms are not used in the algorithm, they are used in Step 3 only to prove the correctness. While the above general scheme is rather simple, applying it is typically quite challenging. Obviously, Step 2 prefers weaker conditions (achievable by removing not too many constraints), while Step 3 prefers stronger conditions (so that they can guarantee satisfiability), so reaching the balance between them is the main (and typically significant) technical challenge in any application of this scheme. Our algorithm is somewhat inspired by~\cite{Barto16:robust}, but it is also quite different from the algorithm there. That algorithm is designed so that Steps 1 and 2 establish a consistency condition that, in particular, includes the 1-minimality condition, and establishing 1-minimality alone requires removing constraints with total weight $O(1/\log{(1/\eps)})$~\cite{Guruswami12:tight}, unless UGC fails. To get the right dependency on $\eps$ we introduce a new consistency condition somewhat inspired by~\cite{Barto12:NU,Kozik16:circles}. The proof that the new consistency condition satisfies the requirements of Steps 2 and 3 of the above scheme is one of the main technical contributions of our paper. \subsubsection*{Organization of the paper} After some preliminaries, we formulate the two main results of this paper in Section \ref{sec:main}. Section \ref{sec:SDP} then contains a~description of SDP relaxations that we will use further on. Sections \ref{sec:overview1} and \ref{sec:overview-thm2} contain the description of the algorithms for constraint languages compatible with NU polymorphism and dual discriminator, respectively; the following chapters prove the correctness of the two algorithms. \section{Preliminaries} \subsection{CSPs} Throughout the paper, let $D$ be a {\em fixed finite} set, sometimes called the {\em domain}. An {\em instance} of the $\csp$ is a pair $\inst I=(V,{\mathcal C})$ with $V$ a finite set of {\em variables} and ${\mathcal C}$ is a finite set of constraints. Each constraint is a pair $(\overline{x},R)$ where $\overline{x}$ is a tuple of variables (say, of length $r>0$), called the {\em scope} of $C$ and $R$ an $r$-ary relation on $D$ called the {\em constraint relation} of $C$. The arity of a constraint is defined to be the arity of its constraint relation. In the weighted optimization version, which we consider in this paper, every constraint $C\in{\mathcal C}$ has an associated {\em weight} $w_C\geq 0$. Unless otherwise stated we shall assume that every instance satisfies $\sum_{C\in{\mathcal C}} w_C=1$. An {\em assignment} for $\inst I$ is a mapping $s:V\rightarrow D$. We say that $s$ satisfies a constraint $((x_1,\dots,x_r),R)$ if $(s(x_1),\dots,s(x_r))\in R$. For $0\leq \beta\leq 1$ we say that assignment $s$ $\beta$-satisfies $\inst I$ if the total weight of the constraints satisfied by $s$ is at least $\beta$. In this case we say that $\inst I$ is $\beta$-satisfiable. The best possible $\beta$ for $\inst I$ is denoted by $\mathrm{Opt}(\inst I)$. A {\em constraint language} on $D$ is a {\em finite} set $\Gamma$ of relations on $D$. The problem $\csp(\Gamma)$ consists of all instances of the CSP where all the constraint relations are from $\Gamma$. Problems {\sc $k$-Sat}, {\sc Horn $k$-Sat}, {\sc Lin-$p$}, {\sc Graph $H$-colouring}, and {\sc Unique Games$(|D|)$} are all of the form $\CSP\Gamma$. The {\em decision problem} for $\csp(\Gamma)$ asks whether an input instance $\inst I$ of $\csp(\Gamma)$ has an assignment satisfying all constraints in $\inst I$. The {\em optimization problem} for $\csp(\Gamma)$ asks to find an assignment $s$ where the weight of the constraints satisfied by $s$ is as large as possible. Optimization problems are often hard to solve to optimality, motivating the study of {\em approximation} algorithms. \subsection{Algebra}\label{sec:algebra} An $n$-ary operation $f$ on $D$ is a map from $D^n$ to $D$. We say that $f$ {\em preserves} (or is a {\em polymorphism} of) an $r$-ary relation $R$ on $D$ if for all $n$ (not necessarily distinct) tuples $(a^i_1,\dots,a_r^i)\in R$, $1\leq i\leq n$, the tuple $(f(a_1^1,\dots,a_n^1),\dots,f(a_1^r,\dots,a_n^r))$ belongs to $R$ as well. Say, if $R$ is the edge relation of a digraph $H$, then $f$ is a polymorphism of $R$ if and only if, for any list of $n$ (not necessarily distinct) edges $(a_1,b_1),\ldots,(a_n,b_n)$ of $H$, there is an edge in $H$ from $f(a_1,\ldots,a_n)$ to $f(b_1,\ldots,b_n)$. If $f$ is a polymorphism of every relation in a constraint language $\Gamma$ then $f$ is called a polymorphism of $\Gamma$. Many algorithmic properties of $\CSP\Gamma$ depend only on the polymorphisms of $\Gamma$, see survey~\cite{Barto17:poly}, also~\cite{Bulatov??:classifying,Dalmau13:robust,Jeavons97:closure,Larose09:universal}. An $(n+1)$-ary ($n\ge 2$) operation $f$ is a {\em near-unanimity (NU)} operation if, for all $x,y\in D$, it satisfies \begin{multline*} f(x,x,\ldots,x,x,y)=f(x,x,\ldots,x,y,x)=\dots =f(y,x,\ldots,x,x,x)=x. \end{multline*} Note that the behaviour of $f$ on other tuples of arguments is not restricted. An NU operation of arity 3 is called a {\em majority} operation. We mentioned in the introduction that (modulo UGC) only constraint languages satisfying condition $\mathrm{SD}(\vee)$ can admit robust algorithms with polynomial loss. The condition $\mathrm{SD}(\vee)$ can be expressed in many equivalent ways: for example, as the existence of ternary polymorphisms $d_0,\ldots, d_t$, $t\ge 2$, satisfying the following equations~\cite{Hobby88:structure}: \begin{align} d_0(x,y,z) &= x,\quad d_t(x,y,z) = z, \\ d_i(x,y,x) &= d_{i+1}(x,y,x) \text{ for all even $i<t$}, \label{sdjoin3}\\ d_i(x,y,y) &= d_{i+1}(x,y,y) \text{ for all even $i<t$},\\ d_i(x,x,y) &= d_{i+1}(x,x,y) \text{ for all odd $i<t$}. \end{align} If line (\ref{sdjoin3}) is strengthened to $d_i(x,y,x)=x$ for all $i$, then, for any constraint language, having such polymorphisms would be equivalent to having an NU polymorphism of some arity~\cite{Barto13:NU} (this is true only when constraint languages are assumed to be finite). NU polymorphisms appeared many times in the CSP literature. For example, they characterize the so-called ``bounded strict width'' property~\cite{Feder98:monotone,Jeavons98:consist}, which says, roughly, that, after establishing local consistency in an instance, one can always construct a solution in a greedy way, by picking values for variables in any order so that constraints are not violated. \begin{theorem}\cite{Feder98:monotone,Jeavons98:consist} \label{the:maj} \label{the:nu} Let $\Gamma$ be a constraint language with an NU polymorphism of some arity. There is a polynomial-time algorithm that, given an instance of $\csp(\Gamma)$, finds a satisfying assignment or reports that none exists. \end{theorem} Every relation with an $(n+1)$-ary NU polymorphism is {\em $n$-decomposable} (and in some sense the converse also holds)~\cite{Baker75:chinese-remainder}. We give a formal definition only for the majority case $n=2$. Let $R$ be a $r$-ary ($r\ge 2$) relation. For every $i,j\in\{1,\dots,r\}$, let $\pr_{i,j} R$ be the binary relation $\{(a_i,a_j)\mid (a_1,\dots,a_r)\in R\}$. Then $R$ is called $2$-{\em decomposable} if the following holds: a tuple $(a_1,\dots,a_r)\in D^r$ belongs to $R$ if and only if $(a_i,a_j)\in \pr_{i,j} R$ for every $i,j\in\{1,\dots,r\}$. The {\em dual discriminator} is a majority operation $f$ such that $f(x,y,z)=x$ whenever $x,y,z$ are pairwise distinct. Binary relations preserved by the dual discriminator are known as {\em implicational}~\cite{Bibel88:deductive} or {\em 0/1/all}~\cite{Cooper94:characterising} relations. Every such relation is of one of the four following types: \begin{enumerate} \item $(\{a\}\times D)\cup (D\times\{b\})$ for $a,b\in D$, \item $\{(\pi(a),a)\mid a\in D\}$ where $\pi$ is a permutation on $D$, \item $P\times Q$ where $P,Q\subseteq D$, \item a intersection of a relation of type 1 or 2 with a relation of type 3. \end{enumerate} The relations of the first kind, when $D=\{0,1\}$, are exactly the relations allowed in {\sc 2-Sat}, while the relations of the second kind are precisely the relations allowed in {\sc Unique Games $(|D|)$}. We remark that having such an explicit description of relations having a given polymorphism is rare beyond the Boolean case. \section{Main result} \label{sec:main} \begin{theorem} \label{the:main} Let $\Gamma$ be a constraint language on $D$. \begin{enumerate} \item If $\Gamma$ has a near-unanimity polymorphism then $\CSP\Gamma$ admits a randomized polynomial-time robust algorithm with loss $O(\eps^{1/k})$ for $k = 6|D|^r +7$ where $r$ is the maximal arity of a~relation in $\Gamma$. Moreover, if $\Gamma$ contains only binary relations then one can choose $k=6|D|+7$. \item If $\Gamma$ has the dual discriminator polymorphism then $\CSP\Gamma$ admits a randomized polynomial-time robust algorithm with loss $O(\sqrt{\eps})$. \end{enumerate} \end{theorem} It was stated as an open problem in~\cite{Dalmau13:robust} whether every CSP that admits a robust algorithm with loss $O(\eps^{1/k})$ admits one where $k$ is bounded by an absolute constant (that does not dependent on $D$). In the context of the above theorem, the problem can be made more specific: is dependence of $k$ on $|D|$ in this theorem avoidable or there is a strict hierarchy of possible degrees there? The case of a majority polymorphism is a good starting point when trying to answer this question. As mentioned in the introduction, robust algorithms with polynomial loss and bounded pathwidth duality for CSPs seem to be somehow related, at least in terms of algebraic conditions. The condition $\mathrm{SD}(\vee)$ is the common necessary condition for them, albeit it is conditional on UGC for the former and unconditional for the latter. Having an NU polymorphism is a sufficient condition for both. Another family of problems $\CSP\Gamma$ with bounded pathwidth duality was shown to admit robust algorithms with polynomial loss in~\cite{Dalmau13:robust}, where the parameter $k$ depends on the pathwidth duality bound (and appears in the algebraic description of this family). This family includes languages not having an NU polymorphism of any arity -- see~\cite{Carvalho10:caterpillar,Carvalho11:lattice}. It is unclear how far connections between the two directions go, but consistency notions seem to be the common theme. Returning to the discussion of a possible hierarchy of degrees in polynomial loss in robust algorithms -- there was a similar question about a hierarchy of bounds for pathwidth duality, and the hierarchy was shown to be strict~\cite{Dalmau08:majority}, even in the presence of a majority polymorphism. \section{SDP relaxation}\label{sec:SDP} Associated to every instance $\inst I=(V,{\mathcal C})$ of CSP there is a standard SDP relaxation. It comes in two versions: maximizing the number of satisfied constraints and minimizing the number of unsatisfied constraints. We use the latter. We define it assuming that all constraints are binary, this will be sufficient for our purposes. The SDP has a variable $\mathbf{x}_a$ for every $x\in V$ and $a\in D$. It also contains a special unit vector $\mathbf{v}_0$. The goal is to assign $(|V\|D|)$-dimensional real vectors to its variables minimizing the following objective function: \begin{equation} \sum_{C=((x,y),R)\in {\mathcal C}} w_C\sum_{(a,b)\not\in R} \mathbf{x}_a\mathbf{y}_b \label{sdpobj} \end{equation} subject to: \begin{align} &\mathbf{x}_a\mathbf{y}_b\geq 0 & x,y\in V, a,b\in D \label{sdp1} \\ &\mathbf{x}_a\mathbf{x}_b= 0 & x\in V, a,b\in D, a\neq b \label{sdp2} \\ &\textstyle\sum_{a\in D} \mathbf{x}_a=\mathbf{v}_0 & x\in V \label{sdp3} \\ &\|\mathbf{v}_0\|=1 & \label{sdp4} \end{align} In the intended integral solution, $x=a$ if $\mathbf{x}_a=\mathbf{v}_0$. In the fractional solution, we informally interpret $\|\mathbf{x}_a\|^2$ as the probability of $x=a$ according to the SDP (the constraints of the SDP ensure that $\sum_{a\in D} \|\mathbf{x}_a\|^2 =1$). If $C=((x,y),R)$ is a constraint and $a,b\in D$, one can think of $\mathbf{x}_a\mathbf{y}_b$ as the probability given by the solution of the SDP to the pair $(a,b)$ in $C$. The optimal SDP solution, then, gives as little probability as possible to pairs that are not in the constraint relation. For a constraint $C=((x,y),R)$, conditions (\ref{sdp3}) and (\ref{sdp4}) imply that $\sum_{(a,b)\in R} \mathbf{x}_a\mathbf{y}_b$ is at most $1$. Let $\loss(C)=\sum_{(a,b)\not\in R} \mathbf{x}_a\mathbf{y}_b$. For a subset $A\subseteq D$, let $\mathbf{x}_A=\sum_{a\in A} \mathbf{x}_a$. Note that $\mathbf{x}_D=\mathbf{y}_D(=\mathbf{v}_0)$ for all $x,y\in D$. Let $\mathrm{SDPOpt}(\inst I)$ be the optimum value of (\ref{sdpobj}). It is clear that, for any instance $\inst I$, we have $\mathrm{Opt}(\inst I)\ge \mathrm{SDPOpt}(\inst I)\ge 0$. There are algorithms ~\cite{Vandenberghe96:semidefinite} that, given an SDP instance $\inst I$ and some additive error $\delta>0$, produce in time $\operatorname{\textit{poly}}\, (|\inst I|, \log(1/\delta))$ an output vector solution whose value is at most $\mathrm{SDPOpt}(\inst I)+\delta$. There are several ways to deal with the error $\delta$. In this paper we deal with it by introducing a preprocessing step which will also be needed to argue that the algorithm described in the proof of Theorem~\ref{the:main}(1) runs in polynomial time. {\bf Preprocessing step 1.}\quad Assume that ${\mathcal C}=\{C_1,\dots,C_m\}$ and that $w_{C_1}\ge w_{C_2}\ge \ldots \ge w_{C_m}$. Using the algorithm from Theorem~\ref{the:nu}, find the largest $j$ such that the subinstance $\inst I_j=(V,\{C_1,\dots,C_j\})$ is satisfiable. If the total weight of the constraints in $\inst I_j$ is at least $1-1/m$ then return the assignment $s$ satisfying $\inst I_j$ and stop. \begin{lemma} \label{lem:prep1} \label{le:prep1} Assume that $\inst I$ is $(1-\eps)$-satisfiable. If $\epsilon\leq 1/m^2$ then preprocessing step 1 returns an assignment that $(1-\sqrt{\epsilon})$-satisfies~$\inst I$. \end{lemma} \begin{proof} Assume $\eps\leq 1/m^2$. Let $i$ be maximum with the property that $w_{C_i}>\eps$. It follows that the instance $\inst I_i=(V,\{C_1,\dots,C_i\})$ is satisfiable since the assignment $(1-\eps)$-satisfying $\inst I$ must satisfy every constraint with weight larger than $\eps$. It follows that $i\leq j$ and, hence, the value of the assignment satisfying $\inst I_j$ is at least $1-w_{C_{i+1}}-\cdots -w_{C_m}\geq 1-mw_{C_{i+1}}\geq 1-m\eps\geq 1-\sqrt{\eps}$. \end{proof} If the preprocessing step returns an assignment then we are done. So assume that it did not return an assignment. Then we know that $\epsilon\ge 1/m^2$. We then solve the SDP relaxation with $\delta=1/m^2$ obtaining a solution with objective value at most $2\epsilon$ which is good enough for our purposes. \section{Overview of the proof of Theorem \ref{the:main}(1)} \label{sec:overview1} We assume throughout that $\Gamma$ has a near-unanimity polymorphism of arity $n+1$ ($n\ge 2$). It is sufficient to prove Theorem \ref{the:main}(1) for the case when $\Gamma$ consists of binary relations and $k=6|D|+7$. The rest will follow by Proposition~4.1 of~\cite{Barto16:robust} (see also Theorem~24 in~\cite{Barto17:poly}), which shows how to reduce the general case to constraint languages consisting of unary and binary relations in such a way that the domain size increases from $|D|$ to $|D|^r$ where $r$ is the maximal arity of a~relation in $\Gamma$. Note that every unary constraint $(x,R)$ can be replaced by the binary constraint $((x,x),R')$ where $R'=\{(a,a)\mid a\in R\}$. Throughout the rest of this section, let $\inst I=(V,{\mathcal C})$ be a $(1-\eps)$-satisfiable instance of $\CSP\Gamma$. \subsection{Patterns and realizations}\label{sect:pattern} A~\emph{pattern in $\inst I$} is defined as a~directed multigraph $p$ whose vertices are labeled by variables of $\inst I$ and edges are labeled by constraints of $\inst I$ in such a way that the beginning of an edge labeled by $((x,y),R)$ is labeled by $x$ and the end by $y$. Two of the vertices in $p$ can be distinguished as the \emph{beginning} and the \emph{end} of~$p$. If these two vertices are labeled by variables $x$ and $y$, respectively, then we say that $p$ is a~pattern is from $x$ to $y$. For two patterns $p$ and $q$ such that the end of $p$ and the beginning of $q$ are labeled by the same variable, we define $p+q$ to be the pattern which is obtained from the disjoint union of $p$ and $q$ by identifying the end of $p$ with the beginning of $q$ and choosing the beginning of $p+q$ to be the beginning of $p$ and the end of $p+q$ to be the end of $q$. We also define $jp$ to be $p + \dots + p$ where $p$ appears $j$ times. A~pattern is said to be a~\emph{path pattern} if the underlying graph is an~oriented path with the beginning and the end being the two end vertices of the path, and is said to be an~\emph{$n$-tree pattern} if the underlying graph is an orientation of a tree with at most $n$ leaves, and both the beginning and the end are leaves. A~\emph{path of $n$-trees pattern} is then any pattern of the form $t_1+\dots+t_j$ for some $n$-tree patterns $t_1,\dots,t_j$. A~\emph{realization of a~pattern} $p$ is a~mapping $r$ from the set of vertices of $p$ to $D$ such that if $(v_x,v_y)$ is an edge labeled by $((x,y),R)$ then $(r(v_x),r(v_y)) \in R$. Note that $r$ does not have to map different vertices of $p$ labeled with same variable to the same element in $D$. A~\emph{propagation} of a~set $A\subseteq D$ along a pattern $p$ whose beginning vertex is $b$ and ending vertex is $e$ is defined as follows. For $A\subseteq D$, define $A + p=\{r(e) \mid \text{ $r$ is a realization of $p$ with $r(b) \in A$}\}$. Also for a~binary relation $R$ we put $A+R=\{b\mid (a,b)\in R \mbox{ and } a\in A\}$. Observe that we have $(A+p)+q = A+(p+q)$. Further, assume that we have non-empty sets $D_x^\ell$ where $1\leq \ell\leq |D|+1$ and $x$ runs through all variables in an instance $\inst I$. Let $p$ be a pattern in $\inst I$ with beginning $b$ and end $e$. We call a realization $r$ of $p$ an \emph{$\ell$-realization} (with respect to the family $\{D_x^\ell\}$) if, for any vertex $v$ of $p$ labeled by a~variable $x$, we have $r(v)\in D_x^{\ell+1}$. For $A\subseteq D$, define $A +^\ell p=\{r(e) \mid r \text{ is an $\ell$-realization of $p$ with $r(b) \in A$}\}$. Also, for a constraint $((x,y),R)$ or $((y,x),R^{-1})$ and sets $A,B\subseteq D$, we write $B=A+^\ell (x,R,y)$ if $B=\{b\in D_y^{\ell+1} \mid (a,b)\in R \mbox{ for some } a\in A\cap D_x^{\ell+1}\}$. \subsection{The consistency notion} Recall that we assume that $\Gamma$ contains only binary relations. Before we formally introduce the new consistency notion, which is the key to our result, as we explained in the introduction, we give an example of a similar simpler condition. We mentioned before that {\sc 2-Sat} is a special case of a CSP that admits an NU polymorphism (actually, the only majority operation on $\{0,1\}$). There is a textbook consistency condition characterizing satisfiable {\sc 2-Sat} instances, which can be expressed in our notation as follows: for each variable $x$ in a {\sc 2-Sat} instance $\inst I$, there is a value $a_x$ such that, for any path pattern $p$ in $\inst I$ from $x$ to $x$, we have $a_x\in \{a_x\}+p$. Let $\inst I$ be an instance of $\CSP\Gamma$ over a set $V$ of variables. We say that $\inst I$ satisfies condition \IPQ{n} if the following holds: \begin{description} \item{\IPQ{n}} For every $y\in V$, there exist non-empty sets $D_y^1 \subseteq \ldots \subseteq D_y^{|D|} \subseteq D_y^{|D|+1}=D$ such that for any $x\in V$, any $\ell \leq |D|$, any $a\in D_x^\ell$, and any two patterns $p,q$ which are paths of $n$-trees in $\inst I$ from $x$ to $x$, there exists $j$ such that \[ a \in \{a\} +^{\ell} (j(p+q) + p). \] \end{description} Note that $+$ between $p$ and $q$ is the pattern addition and thus independent of $\ell$. Note also that $a$ in the above condition belongs to $D_x^\ell$, while propagation is performed by using $\ell$-realizations, i.e., inside sets $D_y^{\ell+1}$. The following theorem states that this consistency notion satisfies the requirements of Step~3 of the general scheme (for designing robust approximation algorithms) discussed in the introduction. \begin{theorem}\label{thm:nicelevels} Let $\Gamma$ be a constraint language containing only binary relations such that $\Gamma$ has an $(n+1)$-ary NU polymorphism. If an instance $\inst I$ of $\CSP\Gamma$ satisfies \IPQ{n}, then $\inst I$ is satisfiable. \end{theorem} \subsection{The algorithm} Let $k = 6|D| + 7$. We provide an algorithm which, given a~$(1-\epsilon)$-satisfiable instance $\inst I$ of $\CSP\Gamma$, removes $O(\epsilon^{1/k})$ constraints from it to obtain a~subinstance $\inst I'$ satisfying condition (IPQ)$_n$. It then follows from Theorem~\ref{thm:nicelevels} that $\inst I'$ is satisfiable, and we can find a satisfying assignment by Theorem~\ref{the:nu}. \subsubsection{More preprocessing} \label{sec:preprocessing} By Lemma \ref{lem:prep1} we can assume that $\epsilon\geq 1/m^2$. We solve the SDP relaxation with error $\delta=1/m^2$ and obtain an solution $\{\vec x_a\}$ $(x\in V,a\in D)$ whose objective value $\epsilon'$ is at most $2\epsilon$. Let us define $\alpha$ to be $\max\{\epsilon',1/m^2\}$. It is clear that $\alpha=O(\epsilon)$. Furthermore, this gives us that $1/\alpha\le m^2$. This will be needed to argue that the main part of the algorithm runs in polynomial time. Let $\kappa=1/k$ (we will often use $\kappa$ to avoid overloading formulas). {\bf Preprocessing step 2.}\quad For each $x\in V$ and $1\leq \ell\leq |D|+1$, compute sets $D_x^{\ell}\subseteq D$ as follows. Set $D_x^{|D|+1}=D$ and, for $1\leq \ell\leq |D|$, set $D_x^{\ell}=\{a\in D\mid \|\vec x_a\|\ge r_{x,\ell}\}$ where $r_{x,\ell}$ is the smallest number of the form $r=\alpha^{3\ell \kappa}(2|D|)^{i/2}$, $i\ge 0$ integer, with $\{b\in D\mid r(2|D|)^{-1/2}\le \|\vec x_b\|< r\}=\emptyset$. It is easy to check that $r_{x,\ell}$ is obtained with $i\le |D|$. It is clear that the sets $D_x^{\ell}\subseteq D$, $x\in V$, $1\leq \ell\leq |D|$, can be computed in polynomial time. The sets $D_x^\ell$ are chosen such that $D_x^\ell$ contains relatively ``heavy'' elements ($a$'s such that $\|\vec x_a\|^2$ is large). The thresholds are chosen so that there is a~big gap (at least by a~factor of $2|D|$) between ``heaviness'' of an element in $D_x^\ell$ and outside. \subsubsection{Main part} \label{sec:algorithm} Given the preprocessing is done, we have that $1/\alpha \leq m^2$, and we precomputed sets $D_x^\ell$ for all $x\in V$ and $1\leq \ell \leq |D|+1$. The description below uses the number $n$, where $n+1$ is the arity of the NU polymorphism of $\Gamma$. \textbf{Step 0.}\quad Remove every constraint $C$ with $\loss(C) > \alpha^{1-\kappa}$. \textbf{Step 1.}\quad For every $ 1 \leq \ell \leq |D| $ do the following. Pick a~value $r_\ell \in (0,\alpha^{(6\ell +4)\kappa})$ uniformly at random. Here we need some notation: for $x,y \in V$ and $A,B\subseteq D$, we write $\vec x_A \preceq^\ell \vec y_B$ to indicate that there is \textbf{no} integer $j$ such that \( \| \vec y_B \|^2 < r_\ell +j\alpha^{(6\ell +4)\kappa} \leq \| \vec x_A \|^2. \) Then, remove all constraints $((x,y),R)$ such that there are sets $A,B \subseteq D$ with $B = A +^\ell (x,R,y)$ and $\vec x_A \not\preceq^\ell \vec y_B$, or with $B = A +^\ell (y,R^{-1},x)$ and $\vec y_A \not\preceq^\ell \vec x_B$. \textbf{Step 2.}\quad For every $1 \leq \ell \leq |D|$ do the following. Let $m_0 = \lfloor \alpha^{-2\kappa} \rfloor$. Pick a~value $s_\ell \in \{0,\dots, m_0-1\}$ uniformly at random. We define $\vec x_A \preceq^{\ell}_w \vec y_B$ to mean that there is \textbf{no} integer $j$ such that \( \|\vec y_B\|^2 < r_\ell + (s_\ell +jm_0)\alpha^{(6\ell +4)\kappa} \leq \|\vec x_A\|^2. \) Obviously, if $\vec x_A \preceq^{\ell} \vec y_B$ then $\vec x_A \preceq^{\ell}_w \vec y_B$. Now, if $A\subseteq B \subseteq D_x^{\ell+1}$ are such that $\|\vec x_B - \vec x_A\|^2 \leq (2n-3)\alpha^{(6\ell +4)\kappa}$ and $\vec x_B \not\preceq^{\ell}_w \vec x_A$, then remove all the constraints in which $x$ participates. \textbf{Step 3.}\quad For every $1\leq \ell \leq |D|$ do the following. Pick $m_\ell = \lceil \alpha ^ {-(3\ell +1)\kappa} \rceil$ unit vectors independently uniformly at random. For $x,y\in V$ and $A,B \subseteq D$, say that $\vec x_A$ and $\vec y_B$ are \emph{cut} by a vector $\vec u$ if the signs of $\vec u \cdot (\vec x_A - \vec x_{D\setminus A})$ and $\vec u \cdot (\vec y_B - \vec y_{D\setminus B})$ differ. Furthermore, we say that $\vec x_A$ and $\vec y_B$ are $\ell$-cut if there are cut by at least one of the chosen $m_\ell$ vectors. For every variable $x$, if there exist subsets $A,B \subseteq D$ such that $A \cap D_x^\ell \neq B \cap D_x^\ell$ and the vectors $\vec x_A$ and $\vec x_B$ are not $\ell$-cut, then remove all the constraints in which $x$ participates. \textbf{Step 4.}\quad For every $1 \leq \ell \leq |D|$, remove every constraint $((x,y),R)$ such that there are sets $A,B \subseteq D$ with $B = A +^\ell (x,R,y)$, and $\vec x_A$ and $\vec y_B$ are $\ell$-cut, or with $B = A +^\ell (y,R^{-1},x)$, and $\vec y_A$ and $\vec x_B$ are $\ell$-cut. \textbf{Step 5.}\quad For every $1 \leq \ell \leq |D|$ do the following. For every variable $x$, If $A,B\subseteq D_x^{\ell +1}$ such that $\| \vec x_B - \vec x_A \|^2 \leq (2n-3)\alpha^{(6\ell+4)\kappa}$ and $\vec x_A$ and $\vec x_B$ are $\ell$-cut, remove all constraints in which $x$ participates. \textbf{Step 6.}\quad By Proposition~\ref{prop:consistence} and Theorem~\ref{thm:nicelevels}, the remaining instance $\inst I'$ is satisfiable. Use the algorithm given by Theorem \ref{the:nu} to find a~satisfying assignment for $\inst I'$. Assign all variables in $\inst I$ that do not appear in $\inst I'$ arbitrarily and return the obtained assignment for $\inst I$. \bigskip Note that we chose to define the cut condition based on $\mathbf{x}_A-\mathbf{x}_{D\setminus A}$, rather than on $ \mathbf{x}_A$, because the former choice has the advantage that $\|\mathbf{x}_A-\mathbf{x}_{D\setminus A}\|=1$, which helps in some calculations. In Step~0 we remove constraints such that, according to the SDP solution, have a high probability to be violated. Intuitively, steps 1 and 2 ensure that the loss in $\|\vec x_A\|$ after propagating $A$ by a~path of $n$-trees is not too big. This is achieved first by ensuring that by following a~path we do not lose too much (step~1) which also gives a~bound on how much we can lose by following an~$n$-tree pattern (see Lemma \ref{lem:tree-loss}). Together with the removal of constraints in step 2, this guarantees that following a~path of $n$-trees we do not lose too much. This ensures that $\{a\} +^\ell (j(p+q) + p)$ is non-vanishing as $j$ increases. Steps 3--5 ensure that if $A$ and $B$ are connected by paths of $n$-trees in both directions (i.e. $\vec x_A = \vec x_B +^{\ell} p_1$ and $\vec x_B = \vec x_A +^{\ell} p_2$), then $\vec x_A$ and $\vec x_B$ do not differ too much (i.e. $A \cap D_x^\ell = B \cap D_x^\ell$). This is achieved by separating the space into cones by cutting it using the $m_\ell$ chosen vectors, removing the variables which have two different sets that are not $\ell$-cut (step 3), and then ensuring that if we follow an edge (step 4), or if we drop elements that do not extend to an~$n$-tree (step 5) we do not cross a~border to another cone. This gives us both that the sequence $A_j = \{a\} +^\ell (j(p+q) +p)$ stabilizes and that, after it stabilizes, $A_j$ contains $a$. This provides condition \IPQ{n} for the remaining instance $\inst I'$. The algorithm runs in polynomial time. Since $D$ is fixed, it is clear that the steps 0--2 can be performed in polynomial time. For steps 3--5, we also need that $m_\ell$ is bounded by a polynomial in $m$, which holds because $\alpha \geq 1/m^2$. The correctness of the algorithm is given by (Theorem~\ref{thm:nicelevels} and) the two following propositions whose proof can be found in Section \ref{sec:correctness-of-algorithm}. These propositions show that our new consistency notion satisfies the requirements of Step~2 of the general scheme for designing robust approximation algorithms discussed in the introduction. \begin{proposition} \label{prop:expected-lost-weight} The expected total weight of constraints removed by the algorithm is $O(\alpha^\kappa)$. \end{proposition} \begin{proposition} \label{prop:consistence} The instance $\inst I'$ obtained after steps 0--5 satisfies the condition \IPQ{n} (with the sets $D_x^\ell$ computed by preprocessing step 2 in Section \ref{sec:preprocessing}). \end{proposition} \section{Overview of the proof of Theorem~\ref{the:main}(2)}\label{sec:overview-thm2} Since the~dual discriminator is a~majority operation, every relation in $\Gamma$ is 2-decomposable. Therefore, it follows, e.g.\ from Lemma 3.2 in~\cite{Dalmau13:robust}, that to prove that $\CSP\Gamma$ admits a robust algorithm with loss $O(\sqrt\eps)$, it suffices to prove this for the case when $\Gamma$ consists of all unary and binary relations preserved by the dual discriminator. Such binary constraints are of one of the four kinds described in Section~\ref{sec:algebra}. Using this description, it follows from Lemma~3.2 of~\cite{Dalmau13:robust} that it suffices to consider the following three types of constraints: \begin{enumerate} \item Disjunction constraints of the form $x= a \vee y = b$, where $a,b\in D$; \item Unique game (UG) constraints of the form $x = \pi(y)$, where $\pi$ is any permutation on~$D$; \item Unary constraints of the form $x \in P$, where $P$ is an arbitrary non-empty subset of $D$. \end{enumerate} We present an algorithm that, given a $(1-\eps)$-satisfiable instance $\inst I=(V,{\mathcal C})$ of the problem, finds a solution satisfying constraints with expected total weight $1- O(\sqrt{\eps\log{|D|}})$ (the hidden constant in the $O$-notation does not depend on $\eps$ and $|D|$). We now give an informal and somewhat imprecise sketch of the algorithm and its analysis. We present details in Section~\ref{sec:thm2}. We use the SDP relaxation from Section~\ref{sec:SDP}. Let us call the value $\|\mathbf{x}_a\|^2$ the SDP weight of the value $a$ for variable $x$. \subsubsection*{Variable Partitioning Step} The algorithm first solves the SDP relaxation. Then, it partitions all variables into three groups $\VV{0}$, $\VV{1}$, and $\VV{2}$ using a threshold rounding algorithm with a random threshold. If most of the SDP weight for $x$ is concentrated on one value $a\in D$, then the algorithm puts $x$ in the set $\VV{0}$ and assigns $x$ the value $a$. If most of the SDP weight for $x$ is concentrated on two values $a,b\in D$, then the algorithm puts $x$ in the set $\VV{1}$ and restricts the domain of $x$ to the set $D_x = \{a,b\}$ (thus we guarantee that the algorithm will eventually assign one of the values $a$ or $b$ to $x$). Finally, if the SDP weight for $x$ is spread among 3 or more values, then we put $x$ in the set $\VV{2}$; we do not restrict the domain for such $x$. After we assign values to $x\in \VV{0}$ and restrict the domain of $x\in \VV{1}$ to $D_x$, some constraints are guaranteed to be satisfied (say, the constraint $(x=a)\vee (y=b)$ is satisfied if we assign $x$ the value $a$ and the constraint $x\in P$ is satisfied if $D_x\subseteq P$). Denote the set of such constraints by ${\cal C}_s$ and let ${\mathcal C}'={\mathcal C}\setminus{\mathcal C}_s$. We then identify a set ${\cal C}_v\subseteq {\mathcal C}'$ of constraints that we conservatively label as violated. This set includes all constraints in ${\mathcal C}'$ except those belonging to one of the following 4 groups: \begin{enumerate} \item disjunction constraints $(x = a) \vee (y = b)$ with $x, y \in {\cal V}_1$ and $a\in D_x$, $b\in D_y$; \item UG constraints $x = \pi (y)$ with $x, y \in {\cal V}_1$ and $D_x = \pi(D_y)$; \item UG constraints $x = \pi (y)$ with $x, y \in {\cal V}_2$; \item unary constraints $x \in P$ with $x\in{\cal V}_2$. \end{enumerate} Our construction of sets $\VV{0}$, $\VV{1}$, and $\VV{2}$, which is based on randomized threshold rounding, ensures that the expected total weight of constraints in ${\cal C}_v$ is $O(\eps)$ (see Lemma~\ref{lem:preproc-violated}). The constraints from the 4 groups above naturally form two disjoint sub-instances of $\inst I$: $\inst I_1$ (groups 1 and 2) on the set of variables $\VV{1}$, and $\inst I_2$ (groups 3 and 4) on $\VV{2}$. We treat these instances independently as described below. \subsubsection*{Solving Instance $\inst I_1$} The instance $\inst I_1$ with the domain of each $x$ restricted to $D_x$ is effectively an instance of Boolean 2-CSP (i.e. each variable has a 2-element domain and all constraints are binary). A robust algorithm with quadratic loss for this problem was given by Charikar et al.~\cite{Charikar09:near}. This algorithm finds a solution violating an $O(\sqrt{\varepsilon})$ fraction of all constraints if the optimal solution violates at most $\varepsilon$ fraction of all constraints or $\mathrm{SDPOpt}(\inst I_1)\leq \eps$. However, we cannot apply this algorithm to the instance $\inst I_1$ as is. The problem is that the weight of violated constraints in the optimal solution for $\inst I_1$ may be greater than $\omega(\varepsilon)$. Note that the unknown optimal solution for the original instance $\inst I$ may assign values to variables $x$ outside of the restricted domain $D_x$, and hence it is not a feasible solution for $\inst I_1$. Furthermore, we do not have a feasible SDP solution for the instance $\inst I_1$, since the original SDP solution (restricted to the variables in $\VV{1}$) is not a feasible solution for the Boolean 2-CSP problem (because $\sum_{a\in D_x}\mathbf{x}_a$ is not necessarily equal to $\mathbf{v}_0$ and, consequently, $\sum_{a\in D_x}\|\mathbf{x}_a\|^2$ may be less than 1). Thus, our algorithm first transforms the SDP solution to obtain a feasible solution for $\inst I_1$. To this end, it partitions the set of vectors $\{\mathbf{x}_a: x\in \VV{1}, a\in D_x\}$ into two sets $H$ and $\bar{H}$ using a modification of the hyperplane rounding algorithm by Goemans and Williamson~\cite{Goemans95:improved}. In this partitioning, for every variable $x$, one of the two vectors $\{\mathbf{x}_a: a\in D_x\}$ belongs to $H$ and the other belongs to $\bar H$. Label the elements of each $D_x$ as $\alpha_x$ and $\beta_x$ so that so that $\mathbf{x}_{\alpha_x}$ is the vector in $H$ and $\mathbf{x}_{\beta_x}$ is the vector in $\bar H$. For every $x$, we define two new vectors $\mathbf{\tilde{x}}_{\alpha_x} = \mathbf{x}_{\alpha_x}$ and $\mathbf{\tilde{x}}_{\beta_x} = \mathbf{v}_0-\mathbf{x}_{\alpha_x}$. It is not hard to verify that the set of vectors $\{\mathbf{\tilde{x}}_{a}: x\in\VV{1}, a\in D_x\}$ forms a feasible SDP solution for the instance $\inst I_1$. We show that for each disjunction constraint $C$ in the instance $\inst I_1$, the cost of $C$ in the new SDP solution is not greater than the cost of $C$ in the original SDP solution (see Lemma~\ref{lem:new-SDP-feasible}). The same is true for all but $O(\sqrt{\eps})$ fraction of UG constraints. Thus, after removing UG constraints for which the SDP value has increased, we get an SDP solution of cost $O(\varepsilon)$. Using the algorithm~\cite{Charikar09:near} for Boolean 2-CSP, we obtain a solution for $\inst I_1$ that violates constraints of total weight at most $O(\sqrt{\eps})$. \subsubsection*{Solving Instance $\inst I_2$} The instance $\inst I_2$ may contain only unary and UG constraints as all disjunction constraints are removed from $\inst I_2$ at the variable partitioning step. We run the approximation algorithm for Unique Games by Charikar et al.~\cite{Charikar06:near} on $\inst I_2$ using the original SDP solution restricted to vectors $\{\mathbf{x}_a: x\in \VV{2}, a\in D\}$. This is a valid SDP relaxation because in the instance $\inst I_2$, unlike the instance $\inst I_1$, we do not restrict the domain of variables $x$ to $D_x$. The cost of this SDP solution is at most $\eps$. As shown in~\cite{Charikar06:near}, the weight of constraints violated by the algorithm~\cite{Charikar06:near} is at most $O(\sqrt{\eps\log |D|})$. We get the solution for $\inst I$ by combining solutions for $\inst I_1$ and $\inst I_2$, and assigning values chosen at the variable partitioning step to the variables from the set $\VV{0}$. \section{Proof of Theorem~\ref{thm:nicelevels}}\label{sect:proofof3} In this section we prove Theorem~\ref{thm:nicelevels}. The proof will use constraint languages with relations of arity greater than two. In order to talk about such instances we need to extend the definition of a pattern. Note that patterns~(in the sense of Section~\ref{sect:pattern}) are instances~ (with some added structure) and the realizations of patterns are solutions. We use the pattern/instance and solution/realization duality to generalize the notion of a pattern. Moreover we often treat patterns as instances and~(whenever it makes sense) instances as patterns. We will often talk about path/tree instances; they are defined using the {\em incidence multigraph}. The incidence multigraph of an instance $\inst J$ is bipartite, its the vertex set consists of variables and constraints of $\inst J$ (which form the two parts), and if a variable $x$ appears $j$ times in a constraint $C$ then the vertices corresponding to $x$ and $C$ have $j$ edges between them. An instance is {\em connected} if its incidence multigraph is connected; an~instance is a~\emph{tree instance} if it is connected and its incidence multigraph has no multiple edges and no cycles. A~\emph{leaf variable} in a tree instance is a~variable which corresponds to a~leaf in the incidence multigraph, and we say that two variables are \emph{neighbours} if they appear together in a~scope of some constraint (i.e., the corresponding vertices are connected by a~path of length 2 in the incidence multigraph). Note that the incidence multigraph of a path pattern in a binary instance~(treated as an instance, as described in the first paragraph of this section) is a path, and of an $n$-tree pattern is a tree with $n$ leaves. The next definition captures, among other things, the connection between the pattern~(treated as an instance) and the instance in which the pattern is defined. Let $\inst J_1$ and $\inst J_2$ be two instances over the same constraint language. An~\emph{(instance) homomorphism} $e\colon \inst J_1 \to \inst J_2$ is a~mapping that maps each variable of $\inst J_1$ to a variable of $\inst J_2$ and each constraint of $\inst J_1$ to constraint of $\inst J_2$ in such a~way that every constraint $((y_1,\dots,y_k),R)$ in $\inst J_1$ is mapped to $((e(y_1),\dots,e(y_k)),R)$. Using these new notions, a path pattern in an instance $\inst I$ (see the definition in Section~\ref{sect:pattern}) can alternatively be defined as an instance, with beginning and end chosen among the leaf variables, whose incidence graph is a path from beginning to end, together with a homomorphism into $\inst I$. Similarly we define a {\em path pattern} in a (not necessarily binary) instance $\inst I$ as an instance $\inst J$, with chosen beginning/end leaf variables, whose incidence graph, after removing all the other vertices of degree one, is a path from beginning to end, together with a homomorphism $e\colon \inst J\rightarrow\inst I$. Addition of path patterns and propagation are defined in an analogous way as for patterns with binary constraints~(see Section~\ref{sect:pattern}). For a $k$-ary relation $R$, let $\pr_i(R)=\{a_i\mid (a_1,\ldots,a_i,\ldots,a_k)\in R\}$. A CSP instance $\inst J$ is called {\em arc-consistent} in sets $D_x$~($x$ ranges over variables of $\inst J$) if, for any variable $x$ and any constraint $((x_1,\ldots,x_k),R)$ in $\inst J$, if $x_i=x$ then $\pr_i(R)=D_x$. We say that a~CSP instance $\inst J$ satisfies condition {\em (PQ)} in sets $D_x$ if \begin{enumerate} \item $\inst J$ is arc-consistent in these sets and \label{cond:pqac} \item for any variable $x$, \label{cond:pqpq} any path patterns $p,q$ from $x$ to $x$, and any $a\in D_x$ there exists $j$ such that \( a\in \{a\} + (j(p+q) + p) \). \end{enumerate} Note that if the instance $\inst J$ is binary then (PQ) implies \IPQ{n} for all $n$~ (setting $D_x^i=D$ if $i=|D|+1$ and $D_x^i=D_x$ if $i<|D|+1$). The following fact, a special case of Theorem A.2 in~\cite{Kozik16:circles}, provides solutions for (PQ) instances. \begin{theorem} \label{thm:nice} If $\Gamma'$ is a~constraint language with a near-unanimity polymorphism, then every instance of $\CSP{\Gamma'}$ satisfying condition (PQ) is satisfiable. \end{theorem} Finally, a standard algebraic notion has not been defined yet: having fixed $\Gamma$ over a set $D$, a subset $A\subseteq D$ is a {\em subuniverse} if, for any polymorphism $g$ of $\Gamma$, we have $g(a_1,a_2,\ldots)\in A$ whenever $a_1,a_2,\ldots \in A$. For any $S\subseteq D$, the subuniverse {\em generated by} $S$ is defined as \[ \{g(a_1,\ldots,a_r)\mid r\ge 1, a_1,\ldots,a_r\in S, \text{$g$ is an $r$-ary polymorphism of $\Gamma$} \} \] \subsection{Into the proof} We begin the proof of Theorem~\ref{thm:nicelevels}. We fix a binary language $\Gamma$ compatible with a $(n+1)$-ary NU polymorphism and an instance $\inst I$ of in $\CSP\Gamma$ which satisfies $\IPQ{n}$ with sets $D_x^\ell$. Note that we can assume that all $D_x^\ell$'s are subuniverses. If this is not the case, we replace each $D_x^\ell$ with the subuniverse generated by it. It is easy to check that~(after the change) the instance $\inst I$ still satisfies $\IPQ{n}$ with such enlarged $D_x^\ell$'s. For each variable $x$, choose and fix an arbitrary index $i$ such that $D_x^i=D_x^{i+1}$ and call it the {\em level} of $x$. Note that each variable has a level~ (since the sets $D_x^\ell$ are non-empty and $\ell$ ranges from 1 to $|D|+1$). Let $V^i$ denote the set of variables of level $i$ and $V^{< i}, V^{\le i},\dots$ be defined in the natural way. Our proof of Theorem~\ref{thm:nicelevels} will proceed by applying Theorem~\ref{thm:nice} to $\inst I$ restricted to $V^1$, then to $V^2$ and so on. However, in order to obtain compatible solutions, we will add constraints to the restricted instances. \subsection{The instances in levels} Let $\inst I^i$~(for $i\leq |D|$) be an instance such that: \begin{enumerate} \item $V^i$ is the set of variables of $\inst I^i$; \item $\inst I^i$ contains, for every every $n$-tree pattern $t$ of $\inst I$, the constraint $((x_1,\dots,x_k),R)$ defined in the following way: \label{enum:newconstraints} let $v_1,\dotsc,v_k$ be all the vertices of $t$ labeled by variables from $V^i$, then $x_1,\dots,x_k$ are the labels of $v_1,\dots,v_k$ respectively and \[ R = \{ (r(v_1),\dots,r(v_k)) \mid r \text{ is a $i$-realization of $t$ (i.e. inside sets $D_x^{i+1}$)} \}. \] \end{enumerate} This definition has a number of immediate consequences: First, every binary constraint between two variables from $V^i$ is present in $\inst I^i$~ (as it defines a two-element $n$-tree). Second, note that if for some $n$-tree contains a vertex $v_j$ in $V^i$ which is not a leaf then by splitting the tree $t$ at $v_j$~(with $v_j$ included in both parts) we obtain two trees defining constraints which together are equivalent to the constraint defined by $t$. This implies that by including only the constraints defined by $n$-trees $t$ such that only the leaves can be from $V^i$, we obtain an equivalent~(i.e. having the same set of solutions) instance. Throughout most of the proof we will be working with such a restricted instance. In this instance the arity of constraints is bounded by $n$. Since the arity of a constraint in $\inst I^i$ is bounded and the size of the universe is fixed, $\inst I^i$ is a finite instance, even though some constraints in it can be defined via infinitely many $n$-tree patterns. It is easy to see that all the relations in the constraints are preserved by all the polymorphisms of $\Gamma$. The instance $\inst I^i$ is arc-consistent with sets $D_x^i(=D_x^{i+1})$: Let $((x_1,\dotsc,x_k),R)$ be a constraint defined by $v_1,\dotsc, v_k$ in $t$ and let $a\in D_{x_j}^i$. By \IPQ{n} there is a realization of $t$ in $D_x^{i+1}$ mapping $v_j$ to $a$ and thus $D_{x_j}^i\subseteq \pr_j R$. On the other hand, as $D_{x_j}^i=D_{x_j}^{i+1}$ and every tuple in $R$ comes from a realization inside the sets $D_x^{i+1}$'s, we get $\pr_j R\subseteq D_{x_j}^i$. Next we show that $\inst I^i$ has property (PQ). Part \ref{cond:pqac} of the definition was established in the paragraph above. For part \ref{cond:pqpq}, let $p$ and $q$ to be arbitrary path patterns from $x$ to $x$ in $\inst I^i$. Define $p'$ and $q'$ to be the paths of trees in $\inst I$ obtained, from $p$ and $q$, respectively, by replacing (in the natural way) each constraint in $p$ and $q$ with the~tree that defines it (we use the fact that each constraint is defined by leaves of a tree). We apply property \IPQ{n} for $\inst I$ with $\ell=i$ and patterns $p'$ and $q'$ to get that, for any $x\in V^i$ and any $a\in D_x^i$, there is a number $j$ such that $a\in \{a\}+^i(j(p'+q')+p')$. The property (PQ) follows immediately. Since $\inst I^i$ has the property (PQ) then, by Theorem~\ref{thm:nice}, it has a solution. The solution to $\inst I$ will be obtained by taking the union of appropriately chosen solutions to $\inst I^1,\dotsc, \inst I^{|D|}$. \subsection{Invariant of the iterative construction} A global solution, denoted $\sol\colon V\to D$, is constructed in steps. At the start, we define it for the variables in $V^1$ by choosing an arbitrary solution to $\inst I^1$. In step $i$ we extend the definition of $\sol$ from $V^{<i}$ to $V^{\le i}$, using a carefully chosen solution to $\inst I^i$. Our construction will maintain the following condition: \begin{description} \item{($E_i$)} every $n$-tree pattern in $\inst I$ has a realization inside the sets $D_x^{i+1}$ which agrees with $\sol$ on $V^{\le i}$. \end{description} Note that, after the first step, the condition $(E_1)$ is guaranteed by the constraints of $\inst I^1$. Assume that we are in step $i$: we have already defined $\sol$ on $V^{<i}$ and condition $(E_{i-1})$ holds. Our goal is to extend $\sol$ by a~solution of $\inst I^i$ in such a~way that $(E_{i})$ holds. The remainder of Section~\ref{sect:proofof3} is devoted to proving that such a solution exists. Once we accomplish that, we are done with the proof: Condition $(E_{i})$ implies that $\sol$ is defined on $V^{\le i}$, and for every constraint $((x,y),R)$ between $x,y\in V^{\le i}$ the pattern from $x$ to $y$ containing a~single edge labeled by $((x,y),R)$ is an~$n$-tree. This implies that $\sol$ satisfies $((x,y),R)$ i.e. it is a solution on $V^{\le i}$. After establishing $(E_{|D|})$ we obtain a solution to $\inst I$. \subsection{Restricting \texorpdfstring{$\inst I^i$}{the instance in level i}} We begin by defining a new instance $\inst K^i$: it is defined almost identically to $\inst I^i$, but in part~\ref{enum:newconstraints} of the definition we require that the realization $r$ sends vertices from $V^{<i}$ according to $\sol$. As in the case of $\inst I^i$ we can assume that all the constraints are defined by leaves of the tree. Thus every $n$-tree pattern with no internal vertices in $V^{i}$ defines one constraint in $\inst I^i$ and another in $\inst K^i$. Just like $\inst I^i$, the instance $\inst K^i$ is finite. Note that we yet need to establish that constraints of $\inst K^i$ are non-empty, but the following claim, where $f$ is the fixed $(n+1)$-ary near unanimity polymorphism, holds independently. \begin{claim}\label{claim:absorbing} Let $((x_1,\dotsc,x_k),R)$ and $((x_1,\dotsc,x_k),R')$ be constraints defined by the same tree $t$ in $\inst I^i$ and $\inst K^i$~(respectively). If $\tuple a_1,\dotsc,\tuple a_{n+1}\in R'$, $\tuple a\in R$, and $j\in \{1,\dots,n+1 \}$ then $f(\tuple a_1,\dotsc,\tuple a_{j-1},\tuple a,\tuple a_{j+1},\dotsc,\tuple a_{n+1})$~ belongs to $R'$. \end{claim} \begin{proof} Let $r_i$ be a realization of $t$ defining $\tuple a^i$; this realization sends all the vertices of $t$ labeled by variables from $V^{<i}$ according to $\sol$. Let $r$ be a realization of $t$ defining $\tuple a$. Fix a function, from vertices of $t$ into $D$, sending vertex $v$ to \[ f(r_1(v),\dotsc,r(v),\dotsc,r_{n+1}(v) \] (where $r(v)$ is in position $j$). This is clearly a realization, and if $v$ is labeled by $x\in V^{<i}$ it sends $v$ according to $\sol$~ (since $f$ is a near-unanimity operation). The new realization witnesses that $f(\tuple a_1,\dotsc,\tuple a_{j-1},\tuple a,\tuple a_{j+1},\dotsc,\tuple a_{n+1})$ belongs to $R'$. \end{proof} In order to proceed we need to show that the instance $\inst K^i$ contains a non-empty, arc-consistent subinstance, i.e. an arc-consistent instance (in some non-empty sets $D_x$) obtained from $\inst K^i$ by restricting every constraint in it so that each coordinate can take value only in the appropriate set $D_x$. A proof of this claim is the subject of the next section. \subsection{Arc-consistent subinstance of~$\inst K^i$} In order to proceed with the proof we need an additional definition. Let $e\colon \inst J_1 \to \inst J_2$ be an instance homomorphism. If for any variable $y$ of $\inst J_1$ and any constraint $((x_1,\dots,x_k),R)$ of $\inst J_2$ with $e(y) = x_i$~(for some $i$) the constraint $((x_1,\dots,x_k),R)$ has exactly one preimage $((y_1,\dots,y_k),R)$ with $y = y_i$, we say that $e$ is a~\emph{covering}. A~\emph{universal covering tree instance} $\uct(\inst J)$ of a connected instance $\inst J$ is a~(possibly countably infinite) tree instance $\inst T$ together with a~covering $e\colon\inst T\to \inst J$ satisfying some additional properties. If $\inst J$ is a tree instance, then one can take $\uct(\inst J)=\inst J$, otherwise $\uct(\inst J)$ is always infinite. If an instance $\inst J$ is disconnected then $\uct(\inst J)$ is a disjoint union of universal covering tree instances for connected components of $\inst J$. Several equivalent (precise) definitions of $\UCT$ can be found in Section 5.4 of~\cite{Kozik16:circles} or Section 4 of~\cite{Kun12:robust}. For our purposes, it is enough to mention that, for any $\inst J$, the instance $\uct(\inst J)$~(with covering $e$) has the following two properties. For any two variables $v,v'$ satisfying $e(v)=e(v')$ there exists an endomorphism $h$ of $\uct(\inst I)$~ (i.e a~homomorphism into itself) sending $v$ to $v'$ and such that $e\circ h =e$. Similarly for constraints $C$ and $C'$ if $e(C)=e(C')$ then there is an endomorphism $h$ such that $h(C)=C'$ and $e\circ h = e$. It is well known that $\UCT(\inst J)$ has a solution if and only if $\inst J$ has an arc-consistent subinstance. Consider $\UCT(\inst K^i)$ and fix a covering $e': \UCT(\inst K^i) \rightarrow \inst K^i$. Let $\mathcal{T}^i$ be an instance obtained from $\UCT(\inst K^i)$ by replacing each constraint $C$ in it by a~tree that defines $e'(C)$, each time introducing a~fresh set of variables for the internal vertices of the trees. Let $e$ be the instance homomorphism from $\mathcal{T}^i$ to $\inst I$ defined in the natural way. We call a solution~(or a partial solution) to $\mathcal{T}^i$ {\em nice} if it maps each $v$ into $D_{e(v)}^{i+1}$ and moreover if $e(v)\in V^{<i}$ then $v$ is mapped to $\sol(e(v))$. It should be clear that nice solutions to $\mathcal{T}^i$ correspond to solutions of $\UCT(\inst K^i)$~ (although the correspondence is not one-to-one). \begin{claim}\label{claim:almostAC} There exists a~nice solution of $\mathcal{T}^i$. \end{claim} \begin{proof} If $\mathcal{T}^i$ is not connected, we consider each connected component separately and then take the union of nice solutions. Henceforth we assume that $\mathcal{T}^i$ is connected. By a standard compactness argument, it suffices to find a nice solution for every finite subtree of $\mathcal{T}^i$. Suppose, for a contradiction, that $\inst T$ is a minimal finite subtree of $\mathcal{T}^i$ without nice solutions. First, only the leaf vertices of $\inst T$ can be mapped, by $e$, into variables from $V^{<i}$. Indeed, if an internal vertex is mapped to a variable in $V^{<i}$, we can split the tree at this vertex into two parts, obtain~(from the minimality of $\inst T$) nice solutions to both parts~(which need to map the splitting vertex according to $\sol$, i.e., to the same element) and merge these solutions to obtain a nice solution to $\inst T$. This is a contradiction. Second we show that $\inst T$ has more than $n$ leaves mapped by $e$ into $V^{<i}$. Assume that $\inst T$ has $n$ or fewer leaves mapped to $V^{<i}$ and let $\inst T'$ be the smallest subtree of $\inst T$ with these leaves. Then $\inst T'$ is an $n$-tree and by $(E_{i-1})$ we obtain a solution $s$ to $\inst T'$ in $D^i_x$'s which sends leaves of $\inst T'$ according to $\sol$. It remains to extend $s$ to a solution of $\inst T$ in $D^{i+1}_x$'s. This extension is done in a sequence of steps. In each step $s$ is defined for increasingly larger subtrees of $\inst T$. Furthermore, at each step the following condition (*) is satisfied by $s$: if a vertex $v$ has a value assigned by $s$ and a neighbour without such value then $s(v)$ belongs to $D^i_{e(v)}$. Clearly, this condition holds in the beginning. At each step we pick a~constraint $C$ on a~vertex $v$ with an assigned value and a~vertex $v'$ without such a value. (Note that the constraints of $\inst T^i$, and consequently of $\inst T$, are binary.) $C$ has been added to $\inst T^i$ by replacing a constraint of $\uct(\inst K^i)$ with an $n$-tree ${\inst T_C}$ that defines it. Let $\inst S$ be a~maximal subtree of ${\inst T}$ such that it contains $C$, it has $v$ as a leaf, and all other nodes in $\inst S$ have not been assigned by $s$ and belong to ${\inst T_C}$. Since ${\inst T_C}$ is a $n$-tree, $\inst S$ is also an $n$-tree, and we can use $\IPQ{n}$ to derive that there exists a solution, $s'$, of ${\inst S}$ in $D_x^{i+1}$'s that sends $v$ to $s(v)\in D^i_{e(v)}$. More specifically, we apply $\IPQ{n}$ with $x=v$, $a=s(v)$, and both $p$ and $q$ being the same pattern $t_1+t_2$ such that $t_1$ is $\inst S$ with beginning $v$ and end being any other leaf of $\inst S$, and $t_2$ is $t_1$ with beginning and end swapped. This solution $s'$ can be added to $s$ (as the values on $v$ are the same). It remains to see that condition (*) is preserved after extending $s$ with $s'$. Indeed, let $u$ be any vertex such that after adding solution $s'$ has a neighbour $u'$ that has not yet been assigned. We can assume that $u$ is one of the new variables assigned by $s'$. If $e(u)\in V^i$ then the claim follows from the fact that $D^{i+1}_{e(u)}=D^i_{e(u)}$ so we can assume that $e(u)\not\in V^i$. However, in this case, all neighbours of $u$ in $\inst T$ must be in $\inst T_C$, so the constraint in ${\mathcal T}$ containing both $u$ and $u'$ must be also in ${\inst T_C}$ contradicting the maximality of ${\inst S}$. So the counterexample $\inst T$ must have at least $n+1$ leaves mapped into $V^{<i}$. Fix any $n+1$ of such leaves $v_1,\dotsc,v_{n+1}$ and let $\inst T_i$ denote a~subinstance of $\inst T$ obtained by removing, $v_i$ together with the single constraint containing $v_i$ : $((v_i,v'_i),R_i)$ from $\inst T$. Clearly $v'_i$ is not a leaf~(as it would make our $\inst T$ a two-element instance) and by the fact that only leaves can be mapped into $V^{<i}$ we get that $e(v'_i) \in V^{i}$ or $e(v'_i)\in V^{>i}$ and, in the last case, $i\neq|D|$. By minimality each $\inst T_i$ has a nice realization, say $s_i$. Now either $e(v'_i)\in V^i$ and $s_i(v'_i)\in D_{e(v'_i)}^i = D_{e(v'_i)}^{i+1}$ or $e(v'_i)\in V^{>i}, s_i(v'_i)\in D_{e(v'_i)}^{i+1}$ and $i+1\neq |D|+1$. In both cases $s_i(v'_i)\in D_{e(v'_i)}^j$ for $j\leq |D|$ and thus, by \IPQ{n}, there exists $a_i\in D$ such that $(s_i(v'_i),a_i)\in R_i$. We let $s'_i$ be the realization of $\inst T$ obtained by extending $s_i$ by mapping $v_i$ to $a_i$. The last step is to apply the $n+1$-ary near unanimity operation coordinatewise to $s'_i$'s~ (in a way identical to the one in the proof of Claim~\ref{claim:absorbing}). The application produces a nice realization of $\inst T$. This contradiction finishes the proof of the claim. \end{proof} We will denote the arc-consistent subinstance of $\inst K^i$~ (which is about to be constructed) by $\inst L^i$. The variables of $\inst L^i$ and $\inst K^i$~(or indeed $\inst I^i$) are the same. For every constraint $(\tuple x, R)$ in $\inst K^i$ we introduce a constraint $(\tuple x, R')$ into $\inst L^i$ where \begin{equation*} R' = \{\tuple{a}\colon \tuple a = s(\tuple y) \text{ where $s$ is a solution to $\UCT(\inst K^i)$ and $e'((\tuple y,R)) = (\tuple x, R)$}\} \end{equation*} where $e'$ is an instance homomorphism mapping $\UCT(\inst K^i)$ to $\inst K^i$. In other words we restrict a relation in a constraint of $\inst K^i$ by allowing only the tuples which appear in a solution of the $\UCT(\inst K^i)$~ (at this constraint). All the relations of $\inst L^i$ are preserved by all the polymorphisms of $\Gamma$, and are non-empty~(by Claim 2). The fact that $\inst L^i$ is arc-consistent is an easy consequence of the endomorphism structure of universal covering trees. Finally Claim~\ref{claim:absorbing} holds for $\inst L^i$: \begin{claim}\label{claim:absorbingL} Let $((x_1,\dotsc,x_k),R)$ and $((x_1,\dotsc,x_k),R')$ be constraints defined by the same tree $t$ in $\inst I^i$ and $\inst L^i$, respectively. Let $\tuple a_1,\dotsc,\tuple a_{n+1}\in R'$ and $\tuple a\in R$, then $f(\tuple a_1,\dotsc,\tuple a,\dotsc,\tuple a_{n+1})$, where $f$ is the $n+1$-ary near unanimity operation and $\tuple a$ is in position $j$, belongs to $R'$. \end{claim} \begin{proof} By Claim~\ref{claim:absorbing} the tuple $f(\tuple a_1,\dotsc,\tuple a,\dotsc,\tuple a_{n+1})$ belongs to the relation in the corresponding constraint in $\inst K^i$. Thus if it extends to a solution of $\UCT(\inst K^i)$ it belongs to $R'$. However each $\tuple a^i$ extends to a solution of $\UCT(\inst K^i)$ and $\tuple a$ extends to a solution of $\UCT(\inst I^i)$. By applying the near-unanimity operation $f$ to these extensions~(coordinatewise), we obtain the required evaluation. \end{proof} \subsection{A solution to $\inst K^i$} In order to find a solution to $\inst L^i$, we will use Corollary B.2 from~\cite{Kozik16:circles}. We state it here in a~simplified form using the following notation: for subuniverses $A'\subseteq A$, we say that $A'$ {\em nu-absorbs} $A$ if, for some NU polymorphism $f$, $f(a_1,\ldots,a_n)\in A'$ whenever $a_1,\ldots,a_n\in A$ and at most one $a_i$ is in $A\setminus A'$. Similarly, if $R'\subseteq R$ are relations preserved by all polymorphisms of $\Gamma$ we say $R'$ nu-absorbs $R$, if for some near-unanimity operation $f$ taking all arguments from $R'$ except for one which comes from $R$ produces a result in $R'$. \begin{corollary}[Corollary B.2 from~\cite{Kozik16:circles}] Let $\inst I$ satisfy (PQ) condition in sets $A_x$. Let $\inst I'$ be an arc-consistent instance in sets $A'_x$ on the same set of variables as $\inst I$ such that: \begin{enumerate} \item for every variable $x$ the subuniverse $A'_x$ nu-absorbs $A_x$, and \item for every constraint $((x_1,\dotsc,x_n),R')$ in $\inst I'$ there is a corresponding constraint $((x_1,\dotsc,x_n),R)$ in $\inst I$ such that $R'$ nu-absorbs $R$~(and both respect the NU operation). \end{enumerate} Then there are subuniverses $A_x''$ of $A_x'$~(for every $x$) such that the instance $\inst I''$ obtained from $\inst I'$ by restricting the domain of each variable to $A''_x$ and by restricting the constraint relations accordingly satisfies the condition (PQ). \end{corollary} We will apply the corollary above using $\inst I^i$ for $\inst I$ and $\inst L^i$ for $\inst I'$. By our construction, $\inst I^i$ satisfies condition (PQ), and the sets $D_x^i$~ (which play the role of $A_x$) are subuniverses of $D$. On the other hand $\inst L^i$ is arc-consistent and all the relations involved in it are closed under the polymorphisms of $\Gamma$. Claim~\ref{claim:absorbingL} shows that each relation $R'$ nu-absorbs the corresponding $R$. By arc-consistency, the projection of $R'$ on a variable $x$ is the same for each constraint $((x_1,\ldots,x_n),R')$ containing $x$, call the corresponding sets $A'_x$. Since each $R'$ nu-absorbs $R$, it follows that each $A'_x$ nu-absorbs the corresponding $A_x$. The corollary implies that we can restrict the instance $\inst L^i$ to obtain an instance satisfying (PQ). By Theorem~\ref{thm:nice} such an instance, and thus both $\inst K^i$ and $\inst L^i$, has a solution. \subsection{Finishing the proof} We choose any solution to $\inst K^i$ and extend the global solution $\sol$ to $V^i$ according to it. There exists a solution on $V^{\le i}$, because every constraint between two variables from this set is either in $V^{<i}$ or defines a two-variable $n$-tree which was used to define a constraint in $\inst K^i$. It remains to prove that, with such an extension, condition $(E_{i})$ holds. Let $t$ be an $n$-tree pattern in $\inst I$. If it has no variables mapped to $V^{i}$, then $(E_i)$ follows from $(E_{i-1})$. Assume that it has such variables. By splitting $t$ at internal vertices mapped to $V^i$, it is enough to consider the case when only leaves of $t$ are mapped to $V^i$. Then $t$ defines a constraint $(\tuple x,R)$ in $\inst K^i$. The solution to $\inst K^i$ mapping $\tuple x$ to $\tuple a\in R$ and the evaluation of $t$ witnessing that $\tuple a$ belongs to $R$ can be taken to satisfy $(E_i)$ for $t$. Theorem~\ref{thm:nicelevels} is proved. \section{Full proof of Theorem \ref{the:main}(1)} \label{sec:correctness-of-algorithm} In this subsection we prove Propositions \ref{prop:expected-lost-weight} and~\ref{prop:consistence}. The following equalities, which can be directly verified, are used repeatedly in this section: for any subsets $A,B$ of $D$ and any feasible solution $\{\mathbf{x}_a\}$ of the SDP relaxation of $\inst I$ it holds that $\|\mathbf{x}_A\|^2=\mathbf{x}_A\mathbf{y}_D$ and $\|\mathbf{y}_B-\mathbf{x}_A\|^2=\mathbf{x}_{D\setminus A}\mathbf{y}_B+\mathbf{x}_A\mathbf{y}_{D\setminus B}$. \subsection{Analysis of Preprocessing step 2}\label{sec:preproc} In some of the proofs it will be required that $\alpha\leq c_0$ for some constant $c_0$ depending only on $|D|$. This can be assumed without loss of generality, since we can adjust constants in $O$-notation in Theorem~\ref{the:main}(1) to ensure that $\eps\le c_0$ (and we know that $\alpha\le \eps$). We will specify the requirements on the choice of $c_0$ as we go along. \begin{lemma} \label{le:defH} \label{lem:maj2} There exists a constant $c>0$ that depends only on $|D|$ such that the sets $D_x^{\ell}\subseteq D$, $x\in V$, $1\leq \ell\leq |D|$, obtained in Preprocessing step 2, are non-empty and satisfy the following conditions: \begin{enumerate} \item for every $a\in D_x^{\ell}$, $\|\mathbf{x}_a\|\geq \alpha^{3\ell \kappa}$, \item for every $a\not\in D_x^{\ell}$, $\|\mathbf{x}_a\|\leq c\alpha^{3\ell \kappa}$. \item for every $a\in D_x^{\ell}$, $\|\mathbf{x}_a\|^2\geq 2 \|\mathbf{x}_{D\setminus{D_x^{\ell}}}\|^2$ \item $D_x^{\ell}\subseteq D_x^{\ell+1}$ (with $D_x^{|D|+1}=D$) \end{enumerate} \end{lemma} \begin{proof} Let $c=(2|D|)^{(|D|/2)}$. It is straightforward to verify that conditions (1)--(3) are satisfied. Let us show condition (4). Since $c$ only depends on $|D|$ we can choose $c_0$ (an upper bound on $\alpha$) so that $c\alpha^{3\kappa}<1$. It follows that $c\alpha^{3(\ell+1)\kappa}<\alpha^{3\ell \kappa}$. It follows from conditions (1) and (2) that $D_x^{\ell}\subseteq D_x^{\ell+1}$. Finally, let us show that $D_x^{\ell}$ is non-empty. By condition (4) we only need to take care of case $\ell=1$. We have by condition (2) that \[ \sum_{a\in {D\setminus D_x^1}} \|\mathbf{x}_a\|^2\leq |D|c^2\alpha^{6\kappa} \] Note that we can adjust $c_0$ to also satisfy $|D|c^2\alpha^{6\kappa}<1$ because, again, $c$ only depends on $|D|$. \end{proof} \subsection{Proof of Proposition \ref{prop:expected-lost-weight}} We will prove that the total weight of constraints removed in each step 0-5 of the algorithm in Section~\ref{sec:algorithm} is $O(\alpha^\kappa)$. \begin{lemma} \label{le:step0} The total weight of the constraints removed at step $0$ is at most $\alpha^{\kappa}$. \end{lemma} \begin{proof} We have \[ \alpha\geq \sum_{C\in{\mathcal C}} w_C \loss(C)\geq \sum_{\substack{C\in{\mathcal C} \\ \loss(C)\geq\alpha^{1-\kappa}}} w_C \alpha^{1-\kappa}, \] from which the lemma follows. \end{proof} \begin{lemma} \label{le:path-loss} Let $((x,y),R)$ be a constraint not removed at step $0$, and let $A,B$ be such that $B=A+^{\ell}(x,R,y)$. Then $\|\mathbf{y}_B\|^2\geq \|\mathbf{x}_A\|^2-c\alpha^{(6\ell+6)\kappa}$ for some constant $c>0$ depending only on $|D|$. The same is also true for a~constraint $((y,x),R)$ and $A = B+^\ell (y,R^{-1},x)$. \end{lemma} \begin{proof} Consider the first case, i.e., a~constraint $((x,y),R)$ and $B = A+^\ell (x,R,y)$. We have \[ \mathbf{x}_A\mathbf{y}_{D\setminus B} = \sum_{\substack{a\in A, b\in D\setminus B \\ (a,b)\not\in R}} \mathbf{x}_a\mathbf{y}_b + \sum_{\substack{a\in A, b\in D\setminus B \\ (a,b)\in R}} \mathbf{x}_a\mathbf{y}_b. \] The first term is bounded from above by the loss of constraint $((x,y),R)$, and hence is at most $\alpha^{1-\kappa}$, since the constraint has not been removed at step $0$. Since $B=A+^{\ell}(x,R,y)$ it follows that for every $(a,b)\in R$ such that $a\in A$ and $b\in D\setminus{B}$ we have that $a\not\in D_x^{\ell+1}$ or $b\not\in D_y^{\ell+1}$. Hence, the second term is at most \[ \mathbf{x}_{D\setminus D_x^{\ell+1}}\mathbf{y}_D+\mathbf{x}_D\mathbf{y}_{D\setminus D_y^{\ell+1}}=\|\mathbf{x}_{D\setminus D_x^{\ell+1}}\|^2+\|\mathbf{y}_{D\setminus D_y^{\ell+1}}\|^2 \] which, by Lemma~\ref{le:defH}(2), is bounded from above by $d\alpha^{(6\ell+6)\kappa}$ for some constant $d>0$. From the definition of $\kappa$ it follows that $(6\ell+6)\kappa\leq 1-\kappa$, and hence we conclude that $\mathbf{x}_A\mathbf{y}_{D\setminus B}\leq (d+1)\alpha^{(6\ell+6)\kappa}$. Then, we have that $$ \|\mathbf{y}_B\|^2 = \mathbf{x}_A\mathbf{y}_B+\mathbf{x}_{D\setminus A}\mathbf{y}_B \geq \mathbf{x}_A\mathbf{y}_B = \mathbf{x}_A\mathbf{y}_D-\mathbf{x}_A\mathbf{y}_{D\setminus B} \geq \|\mathbf{x}_A\|^2-(d+1)\alpha^{(6\ell+6)\kappa}. $$ \end{proof} \begin{lemma} \label{le:step1} The expected weight of the constraints removed at step $1$ is $O(\alpha^{\kappa})$. \end{lemma} \begin{proof} Let $((x,y),R)$ be a constraint not removed at step $0$. We shall see that the probability that it is removed at step $1$ is at most $c \alpha^{\kappa}$ where $c>0$ is a constant. Let $A,B$ be such that $B=A+^{\ell} (x,R,y)$. It follows from Lemma \ref{le:path-loss} that $\|\mathbf{y}_B\|^2\geq \|\mathbf{x}_A\|^2-d\alpha^{(6\ell+6)\kappa}$ for some constant $d>0$. Hence, the probability that a value $r_\ell$ in step $1$ makes that $\mathbf{y}_B\not\preceq^{\ell} \mathbf{x}_A$ is at most \[ \frac{d\alpha^{(6\ell+6)\kappa}}{\alpha^{(6\ell+4)\kappa}} = d\alpha^{2\kappa}\leq d \alpha^{\kappa}. \] We obtain the same bound if we switch $x$ and $y$, and consider sets $A,B$ such that $A=B+^{\ell} R^{-1}$. Taking the union bound for all sets $A,B$ and all values of $\ell$ we obtain the desired bound. \end{proof} \begin{lemma} \label{lem:removing-variable} If there exists a~constant $c>0$ depending only on $|D|$ such that for every variable $x$, the probability that all constraints involving $x$ are removed in Step~2, Step~3, or Step~5 is at most $c\alpha^\kappa$, then the total expected weight of constraints removed this way in the corresponding is at most $2c\alpha^\kappa$. \end{lemma} \begin{proof} Let $w_x$ denote the total weight of the constraints in which $x$ participates. The expected weight of constraints removed is at most \[ \sum_{x\in V} w_x c \alpha^{\kappa} = (\sum_{x\in V} w_x) c\alpha^{\kappa} = 2 c\alpha^{\kappa} \] and the lemma is proved. \end{proof} \begin{lemma} The expected weight of the constraints removed at step 2 is $O(\alpha^\kappa)$. \end{lemma} \begin{proof} Let $x$ be a~variable. According to Lemma~\ref{lem:removing-variable} it is enough to prove that the probability that we remove all constraints involving $x$ at step 2 is at most $c\alpha^\kappa$ for some constant $c>0$. Suppose that $A\subseteq B$ are such that $\| \vec x_B \|^2 - \| \vec x_A \|^2 = \|\vec x_B - \vec x_A \|^2 \leq (2n -3) \alpha^{(6\ell+4)\kappa}$. Then the probability that one of the bounds of the form $r_\ell + (s_\ell +jm_0)\alpha^{(6\ell +4)\kappa}$ separates $\| \vec x_B \|^2$ and $\| \vec x_A \|^2$ is at most \[ {(2n-3)}/{m_0} \leq (2n-3)/ (\alpha ^{-2\kappa} - 1) \] which is at most $c\alpha^\kappa$ for some constant $c>0$ whenever $\alpha^\kappa < 1/2$. Taking the union bound for all sets $A,B$ and all values of $\ell$ we obtain the desired bound. \end{proof} \begin{lemma} \label{le:cut} There exist constants $c,d>0$ depending only on $|D|$ such that for every pair of variables $x$ and $y$ and every $A,B\subseteq D$, the probability, $p$, that a unit vector $\mathbf{u}$ chosen uniformly at random cuts $\mathbf{x}_A$ and $\mathbf{y}_B$ satisfies \[ c\cdot \| \mathbf{y}_B-\mathbf{x}_A \| \leq p\leq d\cdot \|\mathbf{y}_B-\mathbf{x}_A \|. \] \end{lemma} \begin{proof} Let $0\leq x\leq 1$ and let $0\le \theta\le \pi$ be an angle such that $x=\cos(\theta)$. There exist constants $a,b>0$ such that $$a\cdot \sqrt{1-x}\leq \theta\leq b\cdot \sqrt{1-x}.$$ Now, if $\theta$ is the angle between $\mathbf{x}_A-\mathbf{x}_{D\setminus A}$ and $\mathbf{y}_B-\mathbf{y}_{D\setminus B}$ then \begin{multline*} 1-\cos(\theta) = 1-(\mathbf{x}_A-\mathbf{x}_{D\setminus A})(\mathbf{y}_B-\mathbf{y}_{D\setminus B}) \\ = 2(\mathbf{x}_{D\setminus A}\mathbf{y}_B+\mathbf{x}_A\mathbf{y}_{D\setminus B}) = 2\|\mathbf{y}_B-\mathbf{x}_A \|^2 \end{multline*} Since $p=\theta/\pi$, the result follows. \end{proof} \begin{lemma} \label{le:maj-step3} \label{le:step4} The expected weight of the constraints removed at step 3 is $O(\alpha^{\kappa})$. \end{lemma} \begin{proof} According to Lemma \ref{lem:removing-variable}, it is enough to prove that the probability that we remove all constraints involving $x$ at step 3 is at most $c\alpha^{\kappa}$ for some constant $c$. Let $A$ and $B$ such that $A\cap D_x^{\ell}\neq B\cap D_x^{\ell}$. Let $a$ be an element in symmetric difference $(A\cap D_x^{\ell})\triangle (B\cap D_x^{\ell})$. Then we have $\|\mathbf{x}_B-\mathbf{x}_A \|=\sqrt{\mathbf{x}_{D\setminus A}\mathbf{x}_B+\mathbf{x}_A\mathbf{x}_{D\setminus B}}\geq \|\mathbf{x}_a\|\geq \alpha^{3\ell \kappa}$, where the last inequality is by Lemma~\ref{le:defH}(1). Then by Lemma \ref{le:cut} the probability that $\mathbf{x}_A$ and $\mathbf{x}_B$ are not $\ell$-cut is at most \[ (1-c\alpha^{3\kappa\ell})^{m_{\ell}} \leq \frac{1}{\exp(c\alpha^{3\kappa\ell}m_{\ell})} \leq \frac{1}{\exp(c\alpha^{-\kappa})} \leq c\alpha^{\kappa}. \] where $c$ is the constant given in Lemma \ref{le:cut}. Taking the union bound for all sets $A,B$ and all values of $\ell$ we obtain the desired bound. \end{proof} \begin{lemma} \label{le:maj-step2} \label{le:step3} The expected weight of the constraints removed at step~4 is $O(\alpha^{\kappa})$. \end{lemma} \begin{proof} Let $((x,y),R)$ be a constraint not removed at steps $0$ and $1$. We shall prove that the probability that it is removed at step 4 is at most $c\alpha^{\kappa}$ for some constant $c>0$. Fix $\ell$ and $A,B$ such that $B=A+^{\ell}(x,R,y)$. Since the constraint has not been removed at step 1, we have $\mathbf{y}_B\preceq^{\ell} \mathbf{x}_A$. Since $B=A+^{\ell} p$ we have that $\mathbf{x}_A \mathbf{y}_{D\setminus B}\leq c_1\alpha^{(6\ell+6)\kappa}$, as shown in the proof of Lemma~\ref{le:path-loss}. Since $\|\mathbf{x}_A\|^2=\mathbf{x}_A(\mathbf{y}_B+ \mathbf{y}_{D\setminus B})$, it follows that $\mathbf{x}_A \mathbf{y}_B\geq \|\mathbf{x}_A\|^2-c_1\alpha^{(6\ell+6)\kappa}$. Also, we have $\|\mathbf{y}_B\|^2=(\mathbf{x}_A\mathbf{y}_B+\mathbf{x}_{D\setminus A}\mathbf{y}_B)$ is at most $\|\mathbf{x}_A\|^2+\alpha^{(6\ell+4)\kappa}$ because $\mathbf{y}_B\preceq^{\ell} \mathbf{x}_A$. Using the bound on $\mathbf{x}_A \mathbf{y}_B$ obtained above, it follows that $\mathbf{x}_{D\setminus A}\mathbf{y}_B$ is at most $\alpha^{(6\ell+4)\kappa}+c_1\alpha^{(6\ell+6)\kappa}\leq (c_1+1)\alpha^{(6\ell+4)\kappa}$. Putting the bounds together, we have that \begin{multline*} \|\mathbf{y}_B-\mathbf{x}_A \| = \sqrt{\mathbf{x}_{D\setminus A}\mathbf{y}_B + \mathbf{x}_A\mathbf{y}_{D\setminus B}} \leq \\ \sqrt{c_1\alpha^{(6\ell+6)\kappa} + (c_1+1)\alpha^{(6\ell+4)\kappa}} \leq c_2 \alpha^{(3\ell+2)\kappa} \end{multline*} for some constant $c_2>0$. Applying the union bound and Lemma \ref{le:cut} we have that the probability that $\mathbf{x}_A$ and $\mathbf{y}_B$ are $\ell$-cut is at most $m_{\ell} dc_2\alpha^{(3\ell+2)\kappa}=O(\alpha^{\kappa})$. We obtain the same bound if we switch $x$ and $y$, and take $R^{-1}$ instead of~$R$. Taking the union bound for all sets $A,B$ and all values of $\ell$ we obtain the desired bound. \end{proof} \begin{lemma} The expected weight of the constraints removed at step 5 is $O(\alpha^\kappa)$. \end{lemma} \begin{proof} Again, according to Lemma \ref{lem:removing-variable}, it is enough to prove that the probability that we remove all constraints involving $x$ at step~5 is at most $c_1\alpha^{\kappa}$ for some constant $c_1$. Suppose that $A$, $B$ are such that $\| \vec x_A - \vec x_B \|^2 \leq (2n-3)\alpha^{(6\ell+4)\kappa}$. Hence, by Lemma \ref{le:cut} and the union bound the probability that $\vec x_A$ and $\vec x_B$ are $\ell$-cut is at most \[ m_\ell d(2n-3)^{1/2}\alpha^{(3\ell+2)\kappa} \leq d(2n-3)^{1/2}\alpha^ \kappa \] where $d$ is the constant from Lemma \ref{le:cut}. Taking the union bound for all sets $A$, $B$ and all values of $\ell$, we obtain the desired bound. \end{proof} \subsection{Proof of Proposition \ref{prop:consistence}} All patterns appearing in this subsection are in $\inst I'$. The following notion will be used several times in our proofs: Let $t$ be a tree and let $y$ be one of its nodes. We say that a subtree $t'$ of $t$ is {\em separated by vertex $y$} if $t'$ is maximal among all the subtrees of $t$ that contain $y$ as a leaf. \begin{lemma} \label{le:notdecreasing} \label{lem:maj18} \label{lem:path-loss} Let $1\leq \ell\leq |D|$, let $p$ be a~path pattern from $x$ to $y$, and let $A,B$ be such that $B=A+^{\ell} p$. Then $\mathbf{x}_A\preceq^{\ell} \mathbf{y}_B$, and in particular, $\|\mathbf{x}_A \| \leq \|\mathbf{y}_B \| + \alpha^{(6\ell+4)\kappa}$. \end{lemma} \begin{proof} Since the relation $\preceq^\ell$ is transitive, it is enough to prove the lemma for path patterns containing only one constraint. But this is true, since all the constraints $((x,y),R)$ or $((y,x),R)$ which would invalidate the lemma have been removed in step 1. \end{proof} \begin{lemma} \label{lem:lost-on-a-tree} If $p$ is a~tree pattern with at most $j+1$ leaves starting at $x$, and $A \subseteq D_x^{\ell+1}$ is such that $A +^\ell p = \emptyset$ then \( \| \vec x_A \|^2 \leq (2j-1) \alpha^{(6\ell +4) \kappa} \). \end{lemma} \begin{proof} We will prove the statement by induction on the number of leaves. For $j=1$ this follows from Lemma \ref{lem:maj18}. Suppose then that $p$ is a~tree pattern with $j+1>2$ leaves and the statement is true for any tree pattern with at most $j$ leaves. Choose $y$ to be the first branching vertex in the unique path in $p$ from $x$ to the end of $p$, and let $p_0,t_1,\dots,t_h$ be all subtrees of $p$ separated by $y$ where $p_0$ is the subtree containing $x$. We turn $p_0$ into a pattern by choosing $x$ as beginning and $y$ as end. Similarly, we turn every $t_i$ into a pattern by choosing $y$ as beginning and any other arbitrary leaf as end. Since $y$ is a~branching vertex, we have that $h \geq 2$, every $t_i$ has $j_i + 1 < j + 1$ leaves, and $\sum_{i=1}^h{j_i} = j$. Now, let $B_i$ denote the set $\{ a\in D_y^{\ell +1} : a +^\ell t_i = \emptyset \}$. Since $j_i < j$, we know that $\| \vec y_{B_i} \|^2 \leq (2j_i -1) \alpha^{(6\ell + 4)\kappa}$. Further, for $B = \bigcup_{i=1}^h B_i$, we have, using inductive assumption, that \begin{multline*} \|\vec y_B\|^2 \leq \sum_{i=1}^h \|\vec y_{B_i}\|^2 \leq \sum_{i=1}^h (2j_i -1) \alpha^{(6\ell + 4)\kappa} \\ = (2j - h) \alpha^{(6\ell + 4)\kappa} \leq (2j - 2) \alpha^{(6\ell +4)\kappa}. \end{multline*} Finally, since $A +^\ell p = \emptyset$ then $A +^\ell p_0 \subseteq B$, and the claim follows from Lemma~\ref{lem:maj18}. \end{proof} \begin{lemma} \label{lem:tree-loss} Let $1\leq \ell \leq |D|$, let $p$ be a pattern from $x$ to $y$ which is a~path of $n$-trees. If $A,B\subseteq D$ are such that $B +^\ell p = A$, then \( \|\vec y_{A}\|^2 \geq \|\vec x_B\|^2 - \alpha^{(6\ell +2)\kappa} \). \end{lemma} \begin{proof} We claim that for any $n$-tree pattern $t$ and $A,B$ with $B+^\ell t = A$, we have $\vec x_B \preceq_w^\ell \vec y_A$. Since the relation $\preceq_w^\ell$ is transitive, the lemma is then a~direct consequence. For a~contradiction, suppose that $t$ is a~smallest (by inclusion) $n$-tree that does not satisfy the claim. Observe that $t$ is not a~path, due to Lemma~\ref{lem:path-loss} and the fact that $\vec x_B\preceq^\ell \vec y_A$ implies $\vec x_B\preceq_w^\ell \vec y_A$. Let $v_x$ and $v_y$ denote the beginning and the end vertex of $t$, respectively; and let $v_z$ be the last branching vertex that appears on the path connecting $v_x$ and $v_y$, and let it be labeled by $z$. Let $t_1,t_2,p_1,\dots,p_j$ be all subtrees of $t$ separated by $v_z$, where $t_1$ and $t_2$ are the subtrees containing $v_x$ and $v_y$ respectively. Let us turn $p_1,\dots,p_j$ into patterns by choosing $v_j$ as beginning and any other leaf as end. Furthermore, choose $x$ and $z$ to be the beginning and end, respectively, of $t_1$ and $z$ and $y$ to be the beginning and end, respectively, of $t_2$. Note that $t_2$ is a~path. Further, we know that for $C = B +^\ell t_1$ we have $\vec x_B \preceq_w^\ell \vec z_C$ by minimality of $t$. Now, let $C_i = \{ a \in D_z^{\ell +1} : a+^\ell p_i = \emptyset \}$. Then by Lemma \ref{lem:lost-on-a-tree}, we get that $\|\vec z_{C_i} \|^2 \leq (2j_i -1)\alpha^{(6\ell +4)\kappa}$ where $j_i+1$ is the number of leaves of $p_i$, therefore for $C' = \bigcup C_i$ we have $\| \vec z_{C'} \|^2 \leq \sum\| \vec z_{C_i} \|^2\le (2n - 3) \alpha^{(6\ell +4)\kappa}$. This implies that $\| \vec z_{C \setminus C'} \|^2 \geq \| \vec z_C \|^2 - (2n - 3) \alpha^{(6\ell +4)\kappa}$, and consequently $\vec z_C \preceq_w^\ell \vec z_{C \setminus C'}$ as otherwise all constraints containing $z$ would have been removed at step 2. Finally, observe that $A = (C\setminus C') +^\ell t_2$, and therefore $\vec z_{C \setminus C'} \preceq^\ell \vec y_A$ and, hence, $\vec z_{C \setminus C'} \preceq_w^\ell \vec y_A$. Putting this together with all other derived $\preceq^\ell_w$-relations, we get the required claim. \end{proof} \begin{lemma} \label{lem:maj19} Let $1 \leq \ell \leq |D|$, let $p$ be a pattern from $x$ to $x$ which is a path of $n$-trees, and let $A,B$ be such that $B +^\ell p = A$. If $A \cap D_x^\ell \subseteq B \cap D_x^\ell$ then $A \cap D_x^\ell = B \cap D_x^\ell$. \end{lemma} \begin{proof} For a~contradiction, suppose that there is an~element $a \in (D_x^\ell \cap B) \setminus A$. From Lemma~\ref{lem:maj2} we get that \( \| \vec x_{B\setminus A} \|^2 \geq \|\vec x_a \|^2 \geq 2 \|\vec x_{D\setminus D_x^\ell} \|^2 \geq 2 \|\vec x_{A\setminus B} \|^2. \) Therefore, we have \begin{multline*} \|\vec x_A\|^2 = \|\vec x_B\|^2 - \|\vec x_{B\setminus A}\|^2 + \|\vec x_{A\setminus B}\|^2 \leq \|\vec x_B \|^2 - \| \vec x_a \|^2 + (1/2)\| \vec x_a \|^2 = \\ \|\vec x_B\|^2-(1/2)\|\vec x_a\|^2 \leq \|\vec x_B\|^2-(1/2)\alpha^{6\ell \kappa}. \end{multline*} On the other hand, since $p$ is a~path of $n$-trees, we get from the previous lemma that \( \|\vec x_A\|^2 \geq \|\vec x_B\|^2 - \alpha^{(6\ell +2)\kappa} \). If we adjust constant $c_0$ from Section~\ref{sec:preproc} so that $1/2> \alpha^{2\kappa}$, the above inequalities give a~contradiction. \end{proof} \begin{lemma}\label{lem:consist} Let $x$ be a~variable, let $p$ and $q$ be two patterns from $x$ to $x$ which are paths of $n$-trees, let $1 \leq \ell \leq |D|$, and let $A\subseteq D_x^\ell$. Then there exists some $j$ such that $A \subseteq A +^\ell (j(p + q) + p)$. \end{lemma} \begin{proof} For every $A$, define $A_0,A_1,\dots$ in the following way. If $i = 2j$ is even then $A_i = A +^\ell (j(p+q))$. Otherwise, if $i = 2j+1$ is odd then $A_i = A +^\ell (j(p+q) + p)$. We claim that for every sufficiently large $u$, we have $A_u \cap D_x^\ell = A_{u+1} \cap D_x^\ell$. From the finiteness of $D$, we get that for every sufficiently large $u$ there is $u' > u$ such that $A_u = A_{u'}$. It follows that there exists some path of $n$-trees pattern $p'$ starting and ending in $x$ such that $A_u = A_{u+1} +^\ell p'$. To prove the claim we will show that $\vec x_{A_u}$ and $\vec x_{A_{u+1}}$ are not $\ell$-cut. Then the claim follows as otherwise we would have removed all constraints involving $x$ at step 3. Consider the path $x_1,\dots,x_u$ in $p'$ which connects the beginning and end vertices. Further, let $R_i = R$ if the $i$-th edge of the path is labeled by $((x_i,x_{i+1}),R)$, and let $R_i = R^{-1}$ if the $i$-th edge is labeled by $((x_{i+1},x_i),R)$. Now define a~sequence $B_1,B_2',B_2,\dots,B_m$ inductively by setting $B_1 = A_{u+1}$, $B'_{i+1} = B_i +^\ell (x_i,R_i,x_{i+1})$. Further, if $x_{i+1}$ is not a~branching vertex, put $B_{i+1} = B_{i+1}'$. If $x_{i+1}$ is a~branching vertex, then let $\Phi_i$ be the set of all subtrees separated by $x_{i+1}$ in $p'$, excluding the two such subtrees containing the beginning and the end of $p'$. Then, turn each subtree in $\Phi_i$ into a pattern by choosing $x_{i+1}$ as beginning and any other leaf as end, and define \( B_{i+1} = \{ b\in B_{i+1}' : b +^\ell t \neq \emptyset \mbox{ for all } t \in \Phi_i \}. \) Since $p'$ is a~path of $n$-trees, we know that the sum of the numbers of leaves of the trees from $\Phi_i$ that are also leaves of $p'$ is strictly less than $n-1$. Finally, if $\vec x_{A_u}$ are $\vec x_{A_{u+1}}$ are $\ell$-cut then, for some $i$, vectors ${\vec x_i}_{B_i}$ and ${\vec x_{i+1}}_{B'_{i+1}}$ are $\ell$-cut, or vectors ${\vec x_i}_{B_i}$ and ${\vec x_i}_{B_i'}$ are $\ell$-cut. The former case is impossible since $B'_{i+1} = B_i +^\ell (x_i,R_i,x_{i+1})$, and hence if $\vec x_{B'_{i+1}}$ and $\vec x_{B_i}$ are $\ell$-cut, then either of the constraints $((x_i,x_{i+1}), R_i)$ or $((x_{i+1},x_i),R^{-1})$ would have been removed at step 4. We now show that the latter case is impossible either. Clearly, in this case $x_i$ is a branching vertex. For $t\in \Phi_i$, let $C_t =\{ b \in B_i' : b +^\ell t = \emptyset \}$ and let $j_t$ be the number of leaves of $t$. By Lemma~\ref{lem:lost-on-a-tree} we get \( \| {\vec x_i}_{C_t} \|^2 \leq (2j_t -1) \alpha^{(6\ell + 4)\kappa} \) for any $t \in \Phi_i$, and consequently, \[ \| {\vec x_i}_{B_i'} - {\vec x_i}_{B_i} \|^2 \leq \sum_{t\in \Phi_i} \| {\vec x_i}_{C_t} \|^2 \leq \sum_{t\in \Phi_i} (2j_t - 1) \alpha^{(6\ell +4)\kappa} \leq (2n - 3) \alpha^{(6\ell +4)\kappa}. \] Therefore, if ${\vec x_i}_{B_i}$ and ${\vec x_i}_{B_i'}$ were $\ell$-cut, then all constraints that include $x_i$ would have been removed at step 5. We conclude that indeed we have $A_u \cap D_x^\ell = A_{u+1} \cap D_x^\ell$ for all sufficiently large $u$. Now, take $u = 2j+1$ large enough. We have that \( (A \cup A_{u+1}) +^\ell (j(p+q) + p) = A_u \cup A_{2u+1}. \) And also $(A_u \cup A_{2u+1}) \cap D_x^\ell = A_{u+1} \cap D_x^\ell \subseteq (A \cup A_{u+1})\cap D_x^\ell$, hence by Lemma \ref{lem:maj19} we get that \( (A \cup A_{u+1}) \cap D_x^\ell = A_{u+1} \cap D_x^\ell \). Since $A\subseteq D_x^\ell$ by assumption of the lemma, we have \( A \subseteq A_{u+1} \cap D_x^\ell \subseteq A_{u} = A +^\ell (j(p+q) + p) \). \end{proof} Finally, setting $A=\{a\}$ in Lemma~\ref{lem:consist} gives Proposition~\ref{prop:consistence}. \section{Full proof of Theorem~\ref{the:main}(2)}\label{sec:thm2} In this section, we prove Theorem~\ref{the:main}(2). A brief outline of the proof is given in Section~\ref{sec:overview-thm2}. Throughout this section, $\inst I=(V,{\mathcal C})$ is a $(1-\eps)$-satisfiable instance of $\CSP\Gamma$ where $\Gamma$ consists of implicational constraints. \subsection{SDP Relaxation}\label{sec:thm2:SDP} We use SDP relaxation (\ref{sdpobj})--(\ref{sdp4}) from Section~\ref{sec:SDP}. For convinience, we write the SDP objective function as follows. \begin{multline} \sum_{C \in {\mathcal C}\text{ equals } (x = a) \vee (y = b)} w_C \vprod{(\mathbf{v}_0 - \mathbf{x}_{a})}{(\mathbf{v}_0 - \mathbf{y}_{b})} \\ {}+\frac{1}{2}\sum_{C \in {\mathcal C}\text{ equals } x = \pi(y)} \,\sum_{a\in D} w_C \| \mathbf{x}_{\pi(a)} - \mathbf{y}_{a}\|^2 \\ {}+ \sum_{C \in {\mathcal C}\text{ equals }x \in P} w_C \left(\sum_{a\in D\setminus P} \|\mathbf{x}_{a}\|^2 \right). \label{SDP} \end{multline} This expression equals (\ref{sdpobj}) because of SDP constraint~(\ref{sdp3}). \iffalse Minimize \begin{multline} \sum_{C \in {\mathcal C}\text{ equals } (x = a) \vee (y = b)} w_C \vprod{(\mathbf{v}_0 - \mathbf{x}_{a})}{(\mathbf{v}_0 - \mathbf{y}_{b})} \\ {}+\frac{1}{2}\sum_{C \in {\mathcal C}\text{ equals } x = \pi(y)} \,\sum_{a\in D} w_C \| \mathbf{x}_{\pi(a)} - \mathbf{y}_{a}\|^2 \\ {}+ \sum_{C \in {\mathcal C}\text{ equals }x \in P} w_C \left(\sum_{a\in D\setminus P} \|\mathbf{x}_{a}\|^2 \right) \label{SDP} \end{multline} subject to \begin{align} &\vprod{ \mathbf{x}_{a}}{ \mathbf{y}_{b}} \geq 0 & x,y\in V,\ a,b\in D \label{sdp:pos} \\ &\vprod{ \mathbf{x}_{a}}{ \mathbf{x}_{b}} = 0 & x\in V,\ a,b\in D,\ a\neq b \\ &\sum_{a\in D} \mathbf{x}_{a} = \mathbf{v}_0 & x\in V \label{sdp:sum-to-one}\\ &\|\mathbf{x}_{a} - \mathbf{z}_{c}\|^2 \leq \|\mathbf{x}_{a} - \mathbf{y}_{b}\|^2 + \|\mathbf{y}_{b} - \mathbf{z}_{c}\|^2 \hskip-8em\label{sdp:triangle-ineq}\\ && x,y,z\in V,\ a,b,c\in D\notag\\ &\|\mathbf{v}_0\|^2 = 1.\label{sdp:unitnorm} \end{align} This SDP and the SDP we presented in Section~\ref{sec:SDP} are almost identical. Their objective functions are equal, because of constraints~(\ref{sdp3}) and~(\ref{sdp:sum-to-one}). For convinience, we write the objective function differently in SDP (\ref{SDP})--(\ref{sdp:unitnorm}). The only difference between the SDPs is the presence of the ``triangle inequalities'' (\ref{sdp:triangle-ineq}). We introduce them, because we use the algorithm from~\cite{Charikar06:near} for Unique Games, which assumes that the SDP has triangle inequalities. \fi As discussed before (Lemma \ref{le:prep1}) we can assume that $\eps\geq 1/m^2$ where $m$ is the number of constraints. We solve SDP with error $\delta=1/m^2$ obtaining a solution, denoted $\mathsf{SDP}$, with objective value $O(\epsilon)$. Note that every feasible SDP solution satisfies the following conditions. \begin{align} &\| \mathbf{x}_{a} \|^2 = \vproddot{ \mathbf{x}_{a}}{\bigl(\mathbf{v}_0 - \sum_{b\neq a} \mathbf{x}_{b}\bigr)} = \vproddot{ \mathbf{x}_{a}}{\mathbf{v}_0}-\sum_{b\neq a}\vproddot{\mathbf{x}_a}{\mathbf{x}_b} = \vprod{ \mathbf{x}_{a}}{ \mathbf{v}_0 },\label{eq:length}\\[1mm] &\vprod{ \mathbf{x}_{a} }{ \mathbf{y}_{b}} = \vproddot{ \mathbf{x}_{a}}{(\mathbf{v}_0 - \sum_{b'\neq b}\mathbf{y}_{b'})} \label{eq:2SATrequirement} = \|\mathbf{x}_{a}\|^2 - \sum_{b'\neq b} \vprod{ \mathbf{x}_{a}}{ \mathbf{y}_{b'}} \leq \|\mathbf{x}_{a}\|^2, \\[1mm] & \|\mathbf{x}_{a}\|^2 - \|\mathbf{y}_{b}\|^2 = \|\mathbf{x}_{a} - \mathbf{y}_{b}\|^2 + 2(\vprod{\mathbf{x}_{a}}{\mathbf{y}_{b}} - \|\mathbf{y}_{b}\|^2) \leq \|\mathbf{x}_{a} - \mathbf{y}_{b}\|^2, \label{eq:triangle}\\[1mm] & \vprod{(\mathbf{v}_0 - \mathbf{x}_{a})}{( \mathbf{v}_0 - \mathbf{y}_{b})} = \vprod{ \sum_{a'\neq a} \mathbf{x}_{a'}} {\sum_{b'\neq b} \mathbf{y}_{b'}} \geq 0.\label{eq:positivity} \end{align} \subsection{Variable Partitioning Step}\label{sec:2pre} In this section, we describe the first step of our algorithm. In this step, we assign values to some variables, partition all variables into three groups ${\cal V}_0$, ${\cal V}_1$ and ${\cal V}_2$, and then split the instance into two sub-instances ${\cal I}_1$ and ${\cal I}_2$. \paragraph{Vertex Partitioning Procedure.} \noindent Choose a number $r \in (0, 1/6)$ uniformly at random. Do the following for every variable $x$. \begin{enumerate} \item Let $D_x = \{a: 1/2 -r < \vprod{ \mathbf{x}_{a}}{ \mathbf{v}_0}\}$. \item Depending on the size of $D_x$ do the following: \begin{enumerate} \item If $|D_x| = 1$, add $x$ to ${\cal V}_0$ and assign $x = a$, where $a$ is the single element of $D_x$. \item If $|D_x| > 1$, add $x$ to ${\cal V}_1$ and restrict $x$ to $D_x$ (see below for details). \item If $D_x = \varnothing$, add $x$ to ${\cal V}_2$. \end{enumerate} \end{enumerate} Note that each variable in ${\cal V}_0$ is assigned a value; each variable $x$ in ${\cal V}_1$ is restricted to a set $D_x$; each variable in ${\cal V}_2$ is not restricted. \begin{lemma} (i) If $\vprod{ \mathbf{x}_{a}}{ \mathbf{v}_0} > \frac{1}{2} + r$ then $x\in {\cal V}_0$. (ii) For every $x\in {\cal V}_1$, $|D_x| = 2$. \end{lemma} \begin{proof} (i) Note that for every $b\neq a$, we have $\vprod{ \mathbf{x}_{a}}{ \mathbf{v}_0} + \vprod{ \mathbf{x}_{b}}{ \mathbf{v}_0} \leq 1$ and, therefore, $\vprod{\mathbf{x}_{b}}{\mathbf{v}_0} < 1/2 -r$. Hence, $b\notin D_x$. We conclude that $D_x = \{a\}$ and $x\in {\cal V}_0$. \smallskip \noindent(ii) Now consider $x \in {\cal V}_1$. We have, $$ |D_x| < 3(1/2 -r) |D_x| = 3\sum_{a\in D_x} (1/2 -r) \leq 3\sum_{a\in D_x} \vprod{ \mathbf{x}_{a}}{ \mathbf{v}_0} \leq 3. $$ Therefore, $|D_x| \leq 2$. Since $x \in {\cal V}_1$, $|D_x| > 1$. Hence $|D_x| = 2$. \end{proof} We say that an assignment is admissible if it assigns a value in $D_x$ to every $x \in {\cal V}_1$ and it is consistent with the partial assignment to variables in ${\cal V}_0$. From now on we restrict our attention only to admissible assignments. We remove those constraints that are satisfied by every admissible assignment (our algorithm will satisfy all of them). Specifically, we remove the following constraints: \begin{enumerate} \item UG constraints $x=\pi(y)$ with $x, y \in {\cal V}_0$ that are satisfied by the partial assignment; \item disjunction constraints $(x = a) \vee (y = b)$ such that either $x \in {\cal V}_0$ and $x$ is assigned value $a$, or $y \in {\cal V}_0$ and $y$ is assigned value $b$; \item unary constraints $x \in P$ such that either $x \in {\cal V}_0$ and the value assigned to $x$ is in $P$, or $x \in {\cal V}_1$ and $D_x \subseteq P$. \end{enumerate} We denote the set of satisfied constraints by ${\cal C}_s$. Let ${\cal C}'={\cal C}\setminus {\cal C}_s$ be the set of remaining constraints. We now define a set of \textit{violated} constraints --- those constraints that we conservatively assume will not be satisfied by our algorithm (even though some of them might be satisfied by the algorithm). We say that a constraint $C\in {\cal C}'$ is violated if at least one of the following conditions holds: \begin{enumerate} \item $C$ is a unary constraint on a variable $x \in {\cal V}_0 \cup {\cal V}_1$. \item $C$ is a disjunction constraint $(x = a) \vee (y = b)$ and either $x \notin {\cal V}_1$, or $y \notin {\cal V}_1$ (or both). \item $C$ is a disjunction constraint $(x = a) \vee (y = b)$, and $x, y \in {\cal V}_1$, and either $a\notin D_x$, or $b\notin D_y$ (or both). \item $C$ is a UG constraint $x = \pi(y)$, and at least one of the variables $x$, $y$ is in ${\cal V}_0$. \item $C$ is a UG constraint $x = \pi(y)$, and one of the variables $x$, $y$ is in ${\cal V}_1$ and the other is in ${\cal V}_2$. \item $C$ is a UG constraint $x = \pi(y)$, $x, y\in {\cal V}_1$ but $D_x \neq \pi(D_y)$. \end{enumerate} We denote the set of violated constraints by ${\cal C}_v$ and let ${\cal C}'' = {\cal C}'\setminus {\cal C}_v$. \begin{lemma}\label{lem:preproc-violated} $\mathbb{E}[w({\mathcal C}_v)] = O(\eps)$. \end{lemma} \begin{proof} We analyze separately constraints of each type in ${\mathcal C}_v$. \subsubsection*{Unary constraints} A unary constraint $x \in P$ in $\cal C$ is violated if and only if $x \in {\cal V}_0 \cup {\cal V}_1$ and $D_x \not\subseteq P$ (if $D_x \subseteq P$ then $C\in {\cal C}_s$ and thus $C$ is not violated). Thus the SDP contribution of each violated constraint $C$ of the form $x \in P$ is at least $$ w_C\sum_{a\in D\setminus P} \|\mathbf{x}_{a}\|^2 \geq w_C\sum_{a\in D_x\setminus P}\|\mathbf{x}_{a}\|^2 = w_C\sum_{a\in D_x\setminus P} \vproddot{ \mathbf{x}_{a}}{ \mathbf{v}_0} \geq w_C\Bigl(\frac{1}{2} - r\Bigr)\geq \frac{w_C}{3}. $$ The last two inequalities hold because the set $D_x\setminus P$ is nonempty; $\mathbf{x}_{a} \mathbf{v}_0 \geq 1/2-r$ for all $a\in D_x$ by the construction; and $r\leq 1/6$. Therefore, the expected total weight of violated unary constraints is at most $3\,\mathsf{SDP}= O(\eps)$. \subsubsection*{Disjunction constraints} Consider a disjunction constraint $(x = a) \vee (y = b)$. Denote it by $C$. Assume without loss of generality that $\vprod{ \mathbf{x}_{a}}{ \mathbf{v}_0 } \geq \vprod{ \mathbf{y}_{b}}{ \mathbf{v}_0}$. Consider several cases. If $\vprod{ \mathbf{x}_{a}}{ \mathbf{v}_0 } > 1/2 +r$ then $x \in {\cal V}_0$ and $x$ is assigned value $a$. Thus, $C$ is satisfied. If $\vprod{ \mathbf{x}_{a}}{ \mathbf{v}_0 } \leq 1/2 +r$ and $\vprod{ \mathbf{y}_{b}}{ \mathbf{v}_0} > 1/2 -r$ then we also have $\vprod{ \mathbf{x}_{a}}{ \mathbf{v}_0} > 1/2 - r$ and hence $x, y\in {\cal V}_0 \cup {\cal V}_1$ and $a\in D_x$, $b\in D_y$. Thus, $C$ is not violated (if at least one of the variables $x$ and $y$ is in ${\cal V}_0$, then $C\in {\cal C}_s$; otherwise, $C \in {\cal C}'$). Therefore, $C$ is violated only if $$\vprod{ \mathbf{x}_{a}}{ \mathbf{v}_0 } \leq 1/2 +r \text{ and } \vprod{ \mathbf{y}_{b}}{ \mathbf{v}_0} \leq 1/2 -r ,$$ or equivalently, \begin{equation} \vprod{ \mathbf{x}_{a}}{ \mathbf{v}_0 } - 1/2 \leq r \leq 1/2 - \vprod{ \mathbf{y}_{b}}{ \mathbf{v}_0}.\label{eq:bad-event} \end{equation} Since we choose $r$ uniformly at random in $(0,1/6)$, the probability density of the random variable $r$ is 6 on $(0,1/6)$. Thus the probability of event (\ref{eq:bad-event}) is at most \begin{multline*} 6 \max\Bigl(\bigl(( 1/2 - \vprod{ \mathbf{y}_{b}}{ \mathbf{v}_0}\bigr)- \bigl(\vprod{ \mathbf{x}_{a}}{ \mathbf{v}_0 } - 1/2)\bigr),0\Bigr) = 6\max\Bigl( \vprod{(\mathbf{v}_0 - \mathbf{x}_{a})}{(\mathbf{v}_0 - \mathbf{y}_{b})} -\vprod{\mathbf{x}_{a}}{\mathbf{y}_{b}},0\Bigr)\\ {}\stackrel{\text{by (\ref{sdp1}) and (\ref{eq:positivity})}}{\leq} 6\vprod{(\mathbf{v}_0 - \mathbf{x}_{a})}{(\mathbf{v}_0 - \mathbf{y}_{b})}. \end{multline*} The expected weight of violated constraints is at most, $$ \sum_{\substack{C\in{\mathcal C} \text{ equals }\\(x = a) \vee (y = b)}} 6w_C\vprod{(\mathbf{v}_0 - \mathbf{x}_{a})}{(\mathbf{v}_0 - \mathbf{y}_{b})} \leq 6\,\mathsf{SDP} = O(\eps). $$ \subsubsection*{UG constraints} Consider a UG constraint $x = \pi(y)$. Assume that it is violated. Then $D_x \neq \pi(D_y)$ (note that if $x$ and $y$ do not lie in the same set ${\cal V}_t$ then $|D_x| \neq |D_y|$ and necessarily $D_x \neq \pi(D_y)$). Thus, at least one of the sets $\pi(D_y) \setminus D_x$ or $D_x \setminus \pi(D_y)$ is not empty. If $\pi(D_y) \setminus D_x\neq \varnothing$, there exists $c \in \pi(D_y) \setminus D_x$. We have, \begin{align*} \Prob{c \in \pi(D_y) \setminus D_x} &\leq \Prob{\|\mathbf{y}_{\pi^{-1}(c)}\|^2 > 1/2 - r \text{ and } \|\mathbf{x}_{c}\|^2 \leq 1/2 - r} \\ &= \Prob{1/2 - \|\mathbf{y}_{\pi^{-1}(c)}\|^2 < r \leq 1/2 -\|\mathbf{x}_{c}\|^2} \\ &\leq 6\max(\|\mathbf{y}_{\pi^{-1}(c)}\|^2 - \|\mathbf{x}_{c}\|^2, 0) \\ &\stackrel{\text{by (\ref{eq:triangle})}}{\leq} 6\|\mathbf{y}_{\pi^{-1}(c)} - \mathbf{x}_{c}\|^2. \end{align*} By the union bound, the probability that there is $c \in \pi(D_y) \setminus D_x$ is at most $6\sum_{c\in D}\|\mathbf{y}_{\pi^{-1}(c)} - \mathbf{x}_{c}\|^2=6\sum_{b\in D}\|\mathbf{y}_{b} - \mathbf{x}_{\pi(b)}\|^2$. Similarly, the probability that there is $b \in D_x \setminus \pi(D_y)$ is at most $6\sum_{b\in D}\|\mathbf{y}_{b} - \mathbf{x}_{\pi(b)}\|^2$. Therefore, the probability that the constraint $x=\pi(y)$ is violated is upper bounded by $12\sum_{b\in D}\|\mathbf{y}_{b} - \mathbf{x}_{\pi(b)}\|^2$. Consequently, the total expected weight of all violated UG constraints is at most \begin{multline*}\sum_{C \in {\mathcal C}\text{ equals } x = \pi(y)} w_C \left(12 \,\sum_{b\in D} \| \mathbf{x}_{\pi(b)} - \mathbf{y}_{b}\|^2\right) \\ = 24 \times \left(\frac12 \sum_{C \in {\mathcal C}\text{ equals } x = \pi(y)} w_C \,\sum_{b\in D} \| \mathbf{x}_{\pi(b)} - \mathbf{y}_{b}\|^2\right) \leq 24\,\mathsf{SDP} = O(\eps), \end{multline*} here we bound the value of the SDP by the second term of the objective function~(\ref{SDP}). \end{proof} \noindent We restrict our attention to the set ${\cal C}''$. There are four types of constraints in ${\cal C}''$. \begin{enumerate} \item disjunction constraints $(x = a) \vee (y = b)$ with $x, y \in {\cal V}_1$ and $a\in D_x$, $b\in D_y$; \item UG constraints $x = \pi (y)$ with $x, y \in {\cal V}_1$ and $D_x = \pi(D_y)$; \item UG constraints $x = \pi (y)$ with $x, y \in {\cal V}_2$; \item unary constraints $x \in P$ with $x\in{\cal V}_2$. \end{enumerate} Denote the set of type 1 and 2 constraints by ${\cal C}_1$, and type 3 and 4 constraints by ${\cal C}_2$. Let ${\cal I}_1$ be the sub-instance of ${\cal I}$ on variables ${\cal V}_1$ with constraints ${\cal C}_1$ in which every variable $x$ is restricted to $D_x$, and ${\cal I}_2$ be the sub-instance of ${\cal I}$ on variables ${\cal V}_2$ with constraints ${\cal C}_2$. In Sections~\ref{solve-i1} and~\ref{solve-i2}, we show how to solve ${\cal I}_1$ and ${\cal I}_2$, respectively. The total weight of constraints violated by our solution for ${\cal I}_1$ will be at most $O(\sqrt{\eps})$; The total weight of constraints violated by our solution for ${\cal I}_2$ will be at most $O(\sqrt{\eps\log{|D|} })$. Thus the combined solution will satisfy a subset of the constraints of weight at least $1 - O(\sqrt{\eps \log{|D|}})$. \subsection{Solving Instance \texorpdfstring{${\cal I}_1$}{I1}}\label{solve-i1} In this section, we present an algorithm that solves instance ${\cal I}_1$. The algorithm assigns values to variables in ${\cal V}_1$ so that the total weight of violated constraints is at most $O(\sqrt{\eps})$. \begin{lemma}\label{lem:consistentUG} There is a randomized algorithm that, given instance ${\cal I}_1$ and the SDP solution $\{\mathbf{x}_a\}$ for ${\cal I}$, finds a set of UG constraints ${\cal C}_{bad}\subseteq {\cal C}_1$ and values $\alpha_x,\beta_x \in D_x$ for every $x\in {\cal V}_1$ such that the following conditions hold. \begin{itemize} \item $D_x = \{\alpha_x, \beta_x\}$. \item for each UG constraint $x=\pi(y)$ in ${\cal C}_1\setminus {\cal C}_{bad}$, we have $\alpha_x =\pi(\alpha_y)$ and $\beta_x =\pi(\beta_y)$. \item The expected weight of ${\cal C}_{bad}$ is $O(\sqrt{\eps}).$ \end{itemize} \end{lemma} \begin{proof} We use the algorithm of Goemans and Williamson for Min Uncut~\cite{Goemans95:improved} to find values~$\alpha_x$, $\beta_x$. Recall that in the Min Uncut problem (also known as Min 2CNF$\equiv$ deletion) we are given a set of Boolean variables and a set of constraints of the form $(x = a) \leftrightarrow (y = b)$. Our goal is to find an assignment that minimizes the weight of unsatisfied constraints. Consider the set of UG constraints in ${\cal C}_1$. Since $|D_x| = 2$ for every variable $x \in {\cal V}_1$, each constraint $x = \pi(y)$ is equivalent to the Min Uncut constraint $(x =\pi(a)) \leftrightarrow (y =a)$ where $a$ is an element of $D_y$ (it does not matter which of the two elements of $D_y$ we choose). We define an SDP solution for the Goemans---Williamson relaxation of Min Uncut as follows. Consider $x \in {\cal V}_1$. Denote the elements of $D_x$ by $a$ and $b$ (in any order). Let $$\mathbf{x}^*_{a} = \frac{\mathbf{x}_{a}-\mathbf{x}_{b}}{\|\mathbf{x}_{a}-\mathbf{x}_{b}\|} \quad\text{and}\quad \mathbf{x}^*_{b} = - \mathbf{x}^*_{a} = \frac{\mathbf{x}_{b}-\mathbf{x}_{a}}{\|\mathbf{x}_{a}-\mathbf{x}_{b}\|}.$$ Note that the vectors $\mathbf{x}_a$ and $\mathbf{x}_b$ are nonzero orthogonal vectors, and, thus, $\|\mathbf{x}_a - \mathbf{x}_b\|$ is nonzero. The vectors $\mathbf{x}^*_{a}$ and $\mathbf{x}^*_{b}$ are unit vectors. Now we apply the random hyperplane rounding scheme of Goemans and Williamson: We choose a random hyperplane and let $H$ be one of the half-spaces the hyperplane divides the space into. Note that for every $x$ exactly one of the two antipodal vectors in $\{\mathbf{x}^*_{a}:a\in D_x\}$ lies in $H$ (almost surely). Define $\alpha_x$ and $\beta_x$ so that $\mathbf{x}^*_{\alpha_x}\in H$ and $\mathbf{x}^*_{\beta_x}\notin H$. Let ${\cal C}_{bad}$ be the set of UG constraints such that $\alpha_x \neq \pi(\alpha_y)$, or equivalently $\mathbf{x}_{\pi(\alpha_y)}^* \notin H$. Values $\alpha_x$ and $\beta_x$ satisfy the first condition. If a UG constraint $x=\pi(y)$ is in ${\cal C}_1\setminus {\cal C}_{bad}$, then $\alpha_x = \pi(\alpha_y)$; also since $D_x = \pi(D_y)$, $\beta_x = \pi(\beta_y)$. So the second condition holds. Finally, we verify the last condition. Consider a constraint $x = \pi(y)$. Let $\mathbf{A} = \mathbf{x}_{\pi(\alpha_y)} - \mathbf{x}_{\pi(\beta_y)}$ and $\mathbf{B} = \mathbf{y}_{\alpha_y} - \mathbf{y}_{\beta_y}$. Since $x\in {\cal V}_1$, we have $\|\mathbf{x}_{\pi(\alpha_y)}\|^2 > 1/2 -r > 1/3$ and $\strut\|\mathbf{x}_{\pi(\beta_y)}\|^2 > 1/3$. Hence $\|\mathbf{A}\|^2 = \|\mathbf{x}_{\pi(\alpha_y)}\|^2 + \|\mathbf{x}_{\pi(\beta_y)}\|^2 > 2/3$. Similarly, $\|\mathbf{B}\|^2> 2/3$. Assume first that $\|\mathbf{A}\| \geq \|\mathbf{B}|$. Then, \begin{align*} \|\mathbf{x}^*_{\pi(\alpha_y)} - \mathbf{y}^*_{\alpha_y}\|^2 &= \left\|\frac{\mathbf{A}}{\|\mathbf{A}\|} - \frac{\mathbf{B}}{\|\mathbf{B}\|}\right\|^2 = 2 - \frac{2\vprod{\mathbf{A}}{\mathbf{B}}}{\|\mathbf{A}\| \|\mathbf{B}\|} \\ &=\frac{2}{\|\mathbf{B}\|^2} \times \left( \|\mathbf{B}\|^2 - \frac{\|\mathbf{B}\|}{\|\mathbf{A}\|} \, \vprod{\mathbf{A}}{\mathbf{B}}\right). \end{align*} We have $2\Bigl(\|\mathbf{B}\|^2 - \frac{\|\mathbf{B}\|}{\|\mathbf{A}\|}\,\vprod{\mathbf{A}}{\mathbf{B}} \Bigr) \leq \|\mathbf{A} -\mathbf{B}\|^2$, since $$ \|\mathbf{A} -\mathbf{B}\|^2 - 2\Bigl(\|\mathbf{B}\|^2 - \frac{\|\mathbf{B}\|}{\|\mathbf{A}\|}\,\vprod{\mathbf{A}}{\mathbf{B}} \Bigr) = \Bigl(\|\mathbf{A}\|-\|\mathbf{B}\|\Bigr)\Bigl(\|\mathbf{A}\|+\|\mathbf{B}\| - \frac{2 \vprod{\mathbf{A}}{\mathbf{B}}}{\|\mathbf{A}\|}\Bigr) \geq 0, $$ because $\|\mathbf{A}\| \geq \vprod{\mathbf{A}}{\mathbf{B}}/\|\mathbf{A}\|$ and $\|\mathbf{B}\| \geq \vprod{\mathbf{A}}{\mathbf{B}}/\|\mathbf{A}\|$. We conclude that \begin{align*} \|\mathbf{x}^*_{\pi(\alpha_y)} &- \mathbf{y}^*_{\alpha_y}\|^2 \leq \frac{\|\mathbf{A}-\mathbf{B}\|^2}{\|\mathbf{B}\|^2} \leq \frac{3}{2}\|\mathbf{A}-\mathbf{B}\|^2\\ &= \frac{3}{2}\, \|(\mathbf{x}_{\pi(\alpha_y)} -\mathbf{y}_{\alpha_y}) - (\mathbf{x}_{\pi(\beta_y)} - \mathbf{y}_{\beta_y}) \|^2 \\ &\leq 3\, \|\mathbf{x}_{\pi(\alpha_y)} -\mathbf{y}_{\alpha_y}\|^2 + 3\, \|\mathbf{x}_{\pi(\beta_y)} - \mathbf{y}_{\beta_y}\|^2. \end{align*} If $\|\mathbf{A}\|\leq \|\mathbf{B}\|$, we get the same bound on $\|\mathbf{x}^*_{\pi(\alpha_y)} - \mathbf{y}^*_{\alpha_y}\|^2$ by swapping $\mathbf{A}$ and $\mathbf{B}$ in the formulas above. Therefore, \[ \sum_{\substack{C\in{\cal C}_1 \\ \text{ is of the form } \\ x = \pi(y)}} w_C\|\mathbf{x}^*_{\pi(\alpha_y)} - \mathbf{y}^*_{\alpha_y}\|^2\leq 3\, \mathsf{SDP} = O(\eps). \] The analysis by Goemans and Williamson shows that the expected total weight of the constraints of the form $x = \pi(y)$ such that $$\mathbf{x}^*_{\pi(\alpha_y)}\notin H \text{ and } \mathbf{y}^*_{\alpha_y}\in H$$ is at most $O(\sqrt{\eps})$, see Section 3 in~\cite{Goemans95:improved} for the original analysis or Section 2 in survey~\cite{MM17:cspsurvey} for presentation more closely aligned with our notation. Therefore, the expected total weight of ${\cal C}_{bad}$ is $O(\sqrt{\eps})$. \end{proof} We remove all constraints ${\cal C}_{bad}$ from ${\cal I}_1$ and obtain an instance ${\cal I}_1'$ (with the domain for each variable $x$ now restricted to $D_x$). We construct an SDP solution $\{\mathbf{\tilde x}_{a}\}$ for ${\cal I}_1'$. We let $$\mathbf{\tilde x}_{\alpha_x} = \mathbf{x}_{\alpha_x} \quad\text{and}\quad \mathbf{\tilde x}_{\beta_x} = \mathbf{v}_0 - \mathbf{x}_{\alpha_x}.$$ We define $S_{x\alpha_x} = \{\alpha_x\}$ and $S_{x\beta_x} = D\setminus S_{x\alpha_x}$. Since $\mathbf{\mathbf{\tilde x}}_{\beta_x} = \mathbf{v}_0 - \mathbf{x}_{\alpha_x} = \mathbf{x}_{S_{x\beta_x}}$, we have, \begin{equation} \mathbf{\tilde x}_{a} = \mathbf{x}_{S_{xa}} \quad \text{for every } a\in D_x.\label{eq:redef-x-a} \end{equation} Note that $a\in S_{xa}$ for every $a\in D_x$. \begin{lemma}\label{lem:new-SDP-feasible} The solution $\{\mathbf{\tilde x}_{a}\}$ is a feasible solution for SDP relaxation (\ref{sdpobj})--(\ref{sdp4}) for ${\cal I}'_1$. Its cost is $O(\eps)$. \end{lemma} \begin{proof} We verify that the SDP solution is feasible. First, we have $\sum_{a\in D_x} \mathbf{\tilde x}_{a} = \mathbf{v}_0$ and $$\vprod{ \mathbf{\tilde x}_{\alpha_x}}{ \mathbf{\tilde x}_{\beta_x}} = \vproddot{ \mathbf{x}_{\alpha_x}}{ (\mathbf{v}_0 - \mathbf{x}_{\alpha_x})} = \vprod{ \mathbf{x}_{\alpha_x}}{ \mathbf{v}_0 } - \|\mathbf{x}_{\alpha_x}\|^2 = 0.$$ Then for $a\in D_x$ and $b\in D_y$, we have $\vprod{ \mathbf{\tilde x}_{a}}{ \mathbf{\tilde y}_{b}} = \sum_{a'\in S_{xa}, b'\in S_{yb}} \vprod{ \mathbf{x}_{a'}}{ \mathbf{y}_{b'}} \geq 0$. We now show that the SDP cost is $O(\eps)$. First, we consider disjunction constraints. We prove that the contribution of each constraint $(x = a) \vee (y =b)$ to the SDP for ${\cal I}_1'$ is at most its contribution to the SDP for $\cal I$. That is, \begin{equation} \vprod{(\mathbf{v}_0 - \mathbf{\tilde x}_{a})}{(\mathbf{v}_0 - \mathbf{\tilde y}_{b})} \leq \vprod{ (\mathbf{v}_0 - \mathbf{x}_{a})}{(\mathbf{v}_0 - \mathbf{y}_{b})}. \label{ineq:SDP} \end{equation} Observe that $(\mathbf{v}_0 - \mathbf{\tilde x}_{a}) = \mathbf{x}_{D\setminus S_{xa}}$, $(\mathbf{v}_0 - \mathbf{\tilde y}_{b}) = \mathbf{y}_{D\setminus S_{yb}}$, $(\mathbf{v}_0 - \mathbf{x}_{a}) = \mathbf{x}_{D\setminus \{a\}}$, and $(\mathbf{v}_0 - \mathbf{y}_{b}) = \mathbf{y}_{D\setminus \{b\}}$. Then, $D\setminus S_{xa}\subseteq D\setminus\{a\}$ and $D\setminus S_{yb}\subseteq D\setminus\{b\}$. Therefore, by (\ref{sdp1}), \begin{multline*} \vprod{(\mathbf{v}_0 - \mathbf{\tilde x}_{a})}{(\mathbf{v}_0 - \mathbf{\tilde y}_{b})} = \sum_{(a',b')\in (D\setminus S_{xa})\times (D\setminus S_{yb})} \vprod{\mathbf{x}_{a'}}{\mathbf{y}_{b'}} \leq \\ \leq \sum_{(a',b')\in (D\setminus \{a\})\times (D\setminus \{b\})}\vprod{\mathbf{x}_{a'}}{\mathbf{y}_{b'}} = \vprod{ (\mathbf{v}_0 - \mathbf{x}_{a})}{(\mathbf{v}_0 - \mathbf{y}_{b})}. \end{multline*} \iffalse Observe that \begin{multline*} \vprod{(\mathbf{v}_0 - \mathbf{x}_{a})}{(\mathbf{v}_0 - \mathbf{y}_{b})} - \vprod{(\mathbf{v}_0 - \mathbf{\tilde x}_{a})}{(\mathbf{v}_0 - \mathbf{\tilde y}_{b})} = \\ \vprod{(\mathbf{v}_0 - \mathbf{\tilde x}_{a})}{(\mathbf{\tilde y}_{b} - \mathbf{y}_{b})} + \vprod{{(\mathbf{\tilde x}_{a}- \mathbf{x}_{a})}(\mathbf{v}_0 - \mathbf{\tilde y}_{b})} \\ {}+ \vprod{(\mathbf{\tilde x}_a - \mathbf{x}_{a})}{(\mathbf{\tilde y}_b - \mathbf{y}_{b})} . \end{multline*} We prove that all terms on the right hand side are nonnegative, and thus inequality (\ref{ineq:SDP}) holds. Using the identities (\ref{eq:redef-x-a}) and $\sum_{a'\in D} \mathbf{x}_{a'} = \mathbf{v}_{0}$ as well as the inequality $\mathbf{x}_{a'}\mathbf{y}_{b'}\geq 0$ (for all $a',b'\in D$), we get $$ \vprod{(\mathbf{v}_0 - \mathbf{\tilde x}_{a})}{(\mathbf{\tilde y}_{b} - \mathbf{y}_{b})} = \sum_{\substack{a'\in D\setminus S_{xa}\\b'\in S_{yb}\setminus \{b\}}} \mathbf{x}_{a'}\mathbf{y}_{b'} \geq 0. $$ Similarly, $\vprod{{(\mathbf{\tilde x}_{a}- \mathbf{x}_{a})}(\mathbf{v}_0 - \mathbf{\tilde y}_{b})}\geq 0$, and $$ \vprod{(\mathbf{\tilde x}_a - \mathbf{x}_{a})}{(\mathbf{\tilde y}_b - \mathbf{y}_{b})}= \sum_{\substack{a'\in S_{xa}\setminus \{a\}\\b'\in S_{yb}\setminus \{b\}}} \mathbf{x}_{a'}\mathbf{y}_{b'} \geq 0. $$ \fi Now we consider UG constraints. The contribution of a UG constraint $x = \pi(y)$ in ${\cal C}_1 \setminus {\cal C}_{bad}$ to the SDP for ${\cal I}_1'$ equals the weight of the constraint times the following expression. \begin{multline*} \|\mathbf{\tilde x}_{\pi(\alpha_y)} - \mathbf{\tilde y}_{\alpha_y}\|^2 + \|\mathbf{\tilde x}_{\pi(\beta_y)} - \mathbf{\tilde y}_{\beta_y}\|^2 \\ = \|\mathbf{\tilde x}_{\alpha_x} - \mathbf{\tilde y}_{\alpha_y}\|^2 + \|\mathbf{\tilde x}_{\beta_x} - \mathbf{\tilde y}_{\beta_y}\|^2 \\ = \|\mathbf{x}_{\alpha_x} - \mathbf{y}_{\alpha_y}\|^2 + \|(\mathbf{v}_0 - \mathbf{x}_{\alpha_x}) - (\mathbf{v}_0-\mathbf{y}_{\alpha_y})\|^2 \\ = 2 \|\mathbf{x}_{\alpha_x} - \mathbf{y}_{\alpha_y}\|^2 = 2 \|\mathbf{x}_{\pi(\alpha_y)} - \mathbf{y}_{\alpha_y}\|^2. \end{multline*} Thus, by the choice of $\alpha_x$ and $\alpha_y$ (Lemma \ref{lem:consistentUG}) the contribution is at most twice the contribution of the constraint to the SDP for ${\cal I}$. We conclude that the SDP contribution of all the constraints in ${\cal C}_1 \setminus {\cal C}_{bad}$ is at most $2\,\mathsf{SDP} = O(\eps)$. \end{proof} Finally, we note that ${\cal I}_1'$ is a Boolean 2-CSP instance. We round solution $\{\mathbf{\tilde x}_{a}\}$ using the rounding procedure by Charikar et al. for Boolean 2-CSP~\cite{Charikar09:near} (when $|D| = 2$, the SDP relaxation used in~\cite{Charikar09:near} is equivalent to SDP (\ref{sdpobj})--(\ref{sdp4})). We get an assignment of variables in ${\cal V}_1$. The weight of constraints in ${\cal C}_{1}\setminus {\cal C}_{bad}$ violated by this assignment is at most $O(\sqrt{\eps})$. Since $w({\cal C}_{bad}) = O(\sqrt{\eps})$, the weight of constraints in ${\cal C}_{1}$ violated by the assignment is at most $O(\sqrt{\eps})$. \subsection{Solving Instance \texorpdfstring{${\cal I}_2$}{I2}}\label{solve-i2} Instance ${\cal I}_2$ is a unique games instance with additional unary constraints. We restrict the SDP solution for $\cal I$ to variables $x \in {\cal V}_2$ and get a solution for the unique game instance ${\cal I}_2$. Note that since we do not restrict the domain of variables $x\in \VV{2}$ to $D_x$, the SDP solution we obtain is feasible. The SDP cost of this solution is at most $\mathsf{SDP}$. We round this SDP solution using a variant of the algorithm by Charikar et al.~\cite{Charikar06:near} that is presented in Section 3 of the survey~\cite{MM17:cspsurvey}; this variant of the algorithm does not need $\ell_2^2$-triangle-inequality SDP constraints. Given a $(1-\eps)$-satisfiable instance of Unique Games, the algorithm finds a solution with the weight of violated constraints at most $O(\sqrt{\eps \log{|D|}})$. We remark that paper~\cite{Charikar06:near} considers only unique game instances. However, in~\cite{Charikar06:near}, we can restrict the domain of any variable $x$ to a set $S_x$ by setting $\mathbf{x}_a = 0$ for $a\in D\setminus S_x$. Hence, we can model unary constraints as follows. For every unary constraint $x\in P$, we introduce a dummy variable $z_{x,P}$ and restrict its domain to the set $P$. Then we replace each constraint $x\in P$ with the equivalent constraint $x = z_{x,P}$. The weight of the constraints violated by the obtained solution is at most $O(\sqrt{\eps \log{|D|}})$. \medskip \noindent Finally, we combine results proved in Sections~\ref{sec:2pre}, \ref{solve-i1}, and~\ref{solve-i1} and obtain Theorem~\ref{the:main}(2).
{'timestamp': '2018-01-09T02:13:26', 'yymm': '1607', 'arxiv_id': '1607.04787', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04787'}
arxiv
\section{Introduction} \label{sec:intro} Policy search algorithms based on supervised learning from a computational or human ``teacher'' have gained prominence in recent years due to their ability to optimize complex policies for autonomous flight \cite{rmswd-lmruc-13}, video game playing \cite{rgb-rilsp-11,gsllw-amcts-14}, and bipedal locomotion \cite{mlapt-icdcc-15}. Among these methods, guided policy search algorithms \cite{levine2015end} are particularly appealing due to their ability to adapt the teacher to produce data that is best suited for training the final policy with supervised learning. Such algorithms have been used to train complex deep neural network policies for vision-based robotic manipulation \cite{levine2015end}, as well as a variety of other tasks \cite{zkla-ldcpa-15,mlapt-icdcc-15}. However, convergence results for these methods typically follow by construction from their formulation as a constrained optimization, where the teacher is gradually constrained to match the learned policy, and guarantees on the performance of the final policy only hold at convergence if the constraint is enforced exactly. This is problematic in practical applications, where such algorithms are typically executed for a small number of iterations. In this paper, we show that guided policy search algorithms can be interpreted as approximate variants of mirror descent under constraints imposed by the policy parameterization, with supervised learning corresponding to a projection onto the constraint manifold. Based on this interpretation, we can derive a new, simplified variant of guided policy search, which corresponds exactly to mirror descent under linear dynamics and convex policy spaces. When these convexity and linearity assumptions do not hold, we can show that the projection step is approximate, up to a bound that depends on the step size of the algorithm, which suggests that for a small enough step size, we can achieve continuous improvement. The form of this bound provides us with intuition about how to adjust the step size in practice, so as to obtain a simple algorithm with a small number of hyperparameters. The main contribution of this paper is a simple new guided policy search algorithm that can train complex, high-dimensional policies by alternating between trajectory-centric reinforcement learning and supervised learning, as well as a connection between guided policy search methods and mirror descent. We also extend previous work on bounding policy cost in terms of KL divergence \cite{rgb-rilsp-11,slmja-trpo-15} to derive a bound on the cost of the policy at each iteration, which provides guidance on how to adjust the step size of the method. We provide empirical results on several simulated robotic navigation and manipulation tasks that show that our method is stable and achieves similar or better performance when compared to prior guided policy search methods, with a simpler formulation and fewer hyperparameters. \section{Guided Policy Search Algorithms} \label{sec:gps} We first review guided policy search methods and background. Policy search algorithms aim to optimize a parameterized policy $\pi_\theta(\action_t|\state_t)$ over actions $\action_t$ conditioned on the state $\state_t$. Given stochastic dynamics $p(\mathbf{x}_{t+1}|\state_t,\action_t)$ and cost $\ell(\state_t,\action_t)$, the goal is to minimize the expected cost under the policy's trajectory distribution, given by \mbox{$J(\theta) = \sum_{t=1}^T E_{\pi_\theta(\state_t,\action_t)} [\ell(\state_t,\action_t)]$}, where we overload notation to use $\pi_\theta(\state_t,\action_t)$ to denote the marginals of $\pi_\theta(\tau) = p(\mathbf{x}_1)\prod_{t=1}^T p(\mathbf{x}_{t+1}|\state_t,\action_t) \pi_\theta(\action_t|\state_t)$, where $\tau =\{\mathbf{x}_1,\mathbf{u}_1,\dots,\mathbf{x}_T,\mathbf{u}_T\}$ denotes a trajectory. A standard reinforcement learning (RL) approach to policy search is to compute the gradient $\nabla_\theta J(\theta)$ and use it to improve $J(\theta)$ \cite{w-ssgfa-92,ps-rlmsp-08}. The gradient is typically estimated using samples obtained from the real physical system being controlled, and recent work has shown that such methods can be applied to very complex, high-dimensional policies such as deep neural networks \cite{slmja-trpo-15,lhphe-ccdrl-16}. However, for complex, high-dimensional policies, such methods tend to be inefficient, and practical real-world applications of such model-free policy search techniques are typically limited to policies with about one hundred parameters \cite{dnp-spsr-13}. Instead of directly optimizing $J(\theta)$, guided policy search algorithms split the optimization into a ``control phase'' (which we'll call the C-step) that finds multiple simple local policies $p_i(\action_t|\state_t)$ that can solve the task from different initial states $\mathbf{x}_1^i \sim p(\mathbf{x}_1)$, and a ``supervised phase'' (S-step) that optimizes the global policy $\pi_\theta(\action_t|\state_t)$ to match all of these local policies using standard supervised learning. In fact, a variational formulation of guided policy search \cite{lk-vpsto-13} corresponds to the EM algorithm, where the C-step is actually the E-step, and the S-step is the M-step. The benefit of this approach is that the local policies $p_i(\action_t|\state_t)$ can be optimized separately using domain-specific local methods. Trajectory optimization might be used when the dynamics are known \cite{zkla-ldcpa-15,mlapt-icdcc-15}, while local RL methods might be used with unknown dynamics \cite{la-lnnpg-14,levine2015end}, which still requires samples from the real system, though substantially fewer than the direct approach, due to the simplicity of the local policies. This sample efficiency is the main advantage of guided policy search, which can train policies with nearly a hundred thousand parameters for vision-based control using under 200 episodes \cite{levine2015end}, in contrast to direct deep RL methods that might require orders of magnitude more experience \cite{slmja-trpo-15,lhphe-ccdrl-16}. \begin{algorithm}[t] \caption{Generic guided policy search method \label{alg:gps}} \begin{algorithmic}[1] \FOR{iteration $k \in \{1, \dots, K\}$} \STATE C-step: improve each $p_i(\action_t|\state_t)$ based on surrogate cost $\tilde{\ell}_i(\state_t,\action_t)$, return samples $\mathcal{D}_i$ \label{algline:gps_local} \STATE S-step: train $\pi_\theta(\action_t|\state_t)$ with supervised learning on the dataset $\mathcal{D} = \cup_i \mathcal{D}_i$ \label{algline:gps_global} \STATE Modify $\tilde{\ell}_i(\state_t,\action_t)$ to enforce agreement between $\pi_\theta(\action_t|\state_t)$ and each $p(\action_t|\state_t)$ \label{algline:gps_dual} \ENDFOR \end{algorithmic} \end{algorithm} A generic guided policy search method is shown in Algorithm~\ref{alg:gps}. The C-step invokes a local policy optimizer (trajectory optimization or local RL) for each $p_i(\action_t|\state_t)$ on line~\ref{algline:gps_local}, and the S-step uses supervised learning to optimize the global policy $\pi_\theta(\action_t|\state_t)$ on line~\ref{algline:gps_global} using samples from each $p_i(\action_t|\state_t)$, which are generated during the C-step. On line~\ref{algline:gps_dual}, the surrogate cost $\tilde{\ell}_i(\state_t,\action_t)$ for each $p_i(\action_t|\state_t)$ is adjusted to ensure convergence. This step is crucial, because supervised learning does not in general guarantee that $\pi_\theta(\action_t|\state_t)$ will achieve similar long-horizon performance to $p_i(\action_t|\state_t)$ \cite{rgb-rilsp-11}. The local policies might not even be reproducible by a single global policy in general. To address this issue, most guided policy search methods have some mechanism to force the local policies to agree with the global policy, typically by framing the entire algorithm as a constrained optimization that seeks at convergence to enforce equality between $\pi_\theta(\action_t|\state_t)$ and each $p_i(\action_t|\state_t)$. The form of the overall optimization problem resembles dual decomposition, and usually looks something like this: \begin{align} \min_{\theta,p_1,\dots,p_N} \sum_{i=1}^N \sum_{t=1}^T E_{p_i(\state_t,\action_t)}[\ell(\state_t,\action_t)] \text{ such that } p_i(\action_t|\state_t) = \pi_\theta(\action_t|\state_t) \,\,\,\forall \state_t, \action_t, t, i. \label{eqn:gps} \end{align} Since $\mathbf{x}_1^i \sim p(\mathbf{x}_1)$, we have $J(\theta) \approx \sum_{i=1}^N \sum_{t=1}^T E_{p_i(\state_t,\action_t)}[\ell(\state_t,\action_t)]$ when the constraints are enforced exactly. The particular form of the constraint varies depending on the method: prior works have used dual gradient descent \cite{lwa-lnnpg-15}, penalty methods \cite{mlapt-icdcc-15}, ADMM \cite{mt-cbfat-14}, and Bregman ADMM \cite{levine2015end}. We omit the derivation of these prior variants due to space constraints. \subsection{Efficiently Optimizing Local Policies} A common and simple choice for the local policies $p_i(\action_t|\state_t)$ is to use time-varying linear-Gaussian controllers of the form $p_i(\action_t|\state_t) = \mathcal{N}(\mathbf{K}_t\state_t + \mathbf{k}_t, \mathbf{C}_t)$, though other options are also possible \cite{mt-cbfat-14,mlapt-icdcc-15,zkla-ldcpa-15}. Linear-Gaussian controllers represent individual trajectories with linear stabilization and Gaussian noise, and are convenient in domains where each local policy can be trained from a different (but consistent) initial state $\mathbf{x}_1^i \sim p(\mathbf{x}_1)$. This represents an additional assumption beyond standard RL, but allows for an extremely efficient and convenient local model-based RL algorithm based on iterative LQR \cite{lt-ilqr-04}. The algorithm proceeds by generating $N$ samples on the real physical system from each local policy $p_i(\action_t|\state_t)$ during the C-step, using these samples to fit local linear-Gaussian dynamics for each local policy of the form $p_i(\mathbf{x}_{t+1}|\state_t,\action_t) = \mathcal{N}(f_{\state t}\state_t + f_{\action t}\action_t + f_{c t},\mathbf{F}_t)$ using linear regression, and then using these fitted dynamics to improve the linear-Gaussian controller via a modified LQR algorithm \cite{la-lnnpg-14}. This modified LQR method solves the following optimization problem: \begin{equation} \min_{\mathbf{K}_t,\mathbf{k}_t,\mathbf{C}_t} \sum_{t=1}^T E_{p_i(\state_t,\action_t)}[\tilde{\ell}_i(\state_t,\action_t)] \text{ such that } D_\text{KL}(p_i(\tau) \| \bar{p}_i(\tau)) \leq \epsilon,\label{eqn:lqrkl} \end{equation} where we again use $p_i(\tau)$ to denote the trajectory distribution induced by $p_i(\action_t|\state_t)$ and the fitted dynamics $p_i(\mathbf{x}_{t+1}|\state_t,\action_t)$. Here, $\bar{p}_i(\action_t|\state_t)$ denotes the previous local policy, and the constraint ensures that the change in the local policy is bounded, as proposed also in prior works \cite{bs-cps-03,ps-rlmsp-08,pma-reps-10}. This is particularly important when using linearized dynamics fitted to local samples, since these dynamics are not valid outside of a small region around the current controller. In the case of linear-Gaussian dynamics and policies, the KL-divergence constraint $D_\text{KL}(p_i(\tau) \| \bar{p}_i(\tau)) \leq \epsilon$ can be shown to simplify, as shown in prior work~\cite{la-lnnpg-14} and Appendix~\ref{app:kldiv}: \[ D_\text{KL}(p_i(\tau) \| \bar{p}_i(\tau)) \!=\! \sum_{t=1}^T D_\text{KL}(p_i(\action_t|\state_t) \| \bar{p}_i(\action_t|\state_t) ) \!=\! \sum_{t=1}^T \!-\! E_{p_i(\state_t,\action_t)} [ \log \bar{p}_i(\action_t|\state_t) ] - \mathcal{H}(p_i(\action_t|\state_t)), \] and the resulting Lagrangian of the problem in Equation~(\ref{eqn:lqrkl}) can be optimized with respect to the primal variables using the standard LQR algorithm, which suggests a simple method for solving the problem in Equation~(\ref{eqn:lqrkl}) using dual gradient descent~\cite{la-lnnpg-14}. The surrogate objective $\tilde{\ell}_i(\state_t,\action_t) = \ell(\state_t,\action_t) + \phi_i(\theta)$ typically includes some term $\phi_i(\theta)$ that encourages the local policy $p_i(\action_t|\state_t)$ to stay close to the global policy $\pi_\theta(\action_t|\state_t)$, such as a KL-divergence of the form $D_\text{KL}(p_i(\action_t|\state_t) \| \pi_\theta(\action_t|\state_t))$. \subsection{Prior Convergence Results} Prior work on guided policy search typically shows convergence by construction, by framing the C-step and S-step as block coordinate ascent on the (augmented) Lagrangian of the problem in Equation~(\ref{eqn:gps}), with the surrogate cost $\tilde{\ell}_i(\state_t,\action_t)$ for the local policies corresponding to the (augmented) Lagrangian, and the overall algorithm being an instance of dual gradient descent \cite{lwa-lnnpg-15}, ADMM \cite{mt-cbfat-14}, or Bregman ADMM \cite{levine2015end}. Since these methods enforce the constraint $p_i(\action_t|\state_t) = \pi_\theta(\action_t|\state_t)$ at convergence (up to linearization or sampling error, depending on the method), we know that $\frac{1}{N}\sum_{i=1}^N E_{p_i(\state_t,\action_t)}[\ell(\state_t,\action_t)] \approx E_{\pi_\theta(\state_t,\action_t)}[\ell(\state_t,\action_t)]$ at convergence.\footnote{As mentioned previously, the initial state $\mathbf{x}_1^i$ of each local policy $p_i(\action_t|\state_t)$ is assumed to be drawn from $p(\mathbf{x}_1)$, hence the outer sum corresponds to Monte Carlo integration of the expectation under $p(\mathbf{x}_1)$.} However, prior work does not say anything about $\pi_\theta(\action_t|\state_t)$ at intermediate iterations, and the constraints of policy search in the real world might often preclude running the method to full convergence. We propose a simplified variant of guided policy search, and present an analysis that sheds light on the performance of both the new algorithm and prior guided policy search methods. \section{Mirror Descent Guided Policy Search} \label{sec:md} \vspace{-0.1in} \begin{algorithm}[t] \caption{Mirror descent guided policy search (MDGPS): convex linear variant \label{alg:mdgps}} \begin{algorithmic}[1] \FOR{iteration $k \in \{1, \dots, K\}$} \STATE C-step: $p_i \leftarrow \arg\min_{p_i} E_{p_i(\tau)}\left[\sum_{t=1}^T \ell(\state_t,\action_t)\right] \text{ such that } D_\text{KL}(p_i(\tau) \| \pi_\theta(\tau)) \leq \epsilon$ \STATE S-step: $\pi_\theta \leftarrow \arg\min_\theta \sum_i D_\text{KL}(p_i(\tau) \| \pi_\theta(\tau))$ (via supervised learning) \ENDFOR \end{algorithmic} \end{algorithm} In this section, we propose our new simplified guided policy search, which we term mirror descent guided policy search (MDGPS). This algorithm uses the constrained LQR optimization in Equation~(\ref{eqn:lqrkl}) to optimize each of the local policies, but instead of constraining each local policy $p_i(\action_t|\state_t)$ against the previous local policy $\bar{p}_i(\action_t|\state_t)$, we instead constraint it directly against the global policy $\pi_\theta(\action_t|\state_t)$, and simply set the surrogate cost to be the true cost, such that $\tilde{\ell}_i(\state_t,\action_t) = \ell(\state_t,\action_t)$. The method is summarized in Algorithm~\ref{alg:mdgps}. In the case of linear dynamics and a quadratic cost (i.e. the LQR setting), and assuming that supervised learning can globally solve a convex optimization problem, we can show that this method corresponds to an instance of mirror descent \cite{bt-mdnps-03} on the objective $J(\theta)$. In this formulation, the optimization is performed on the space of trajectory distributions, with a constraint that the policy must lie on the manifold of policies with the chosen parameterization. Let $\Pi_\Theta$ be the set of all possible policies $\pi_\theta$ for a given parameterization, where we overload notation to also let $\Pi_\Theta$ denote the set of trajectory distributions that are possible under the chosen parameterization. The return $J(\theta)$ can be optimized according to $\pi_\theta \leftarrow \arg\min_{\pi \in \Pi_\Theta} E_{\pi(\tau)}[\sum_{t=1}^T \ell(\state_t,\action_t)]$. Mirror descent solves this optimization by alternating between two steps at each iteration $k$: \vspace{-0.05in} \begin{align*} p^k \leftarrow \arg\min_p E_{p(\tau)}\left[\sum_{t=1}^T \ell(\state_t,\action_t) \right] \text{ s. t. } D\left(p,\pi^k\right) \leq \epsilon ,\hspace{0.4in} \pi^{k + 1} \leftarrow \arg\min_{\pi \in \Pi_\Theta} D\left(p^k, \pi\right). \end{align*} The first step finds a new distribution $p^k$ that minimizes the cost and is close to the previous policy $\pi^k$ in terms of the divergence $D\left(p,\pi^k\right)$, while the second step projects this distribution onto the constraint set $\Pi_\Theta$, with respect to the divergence $D(p^k, \pi)$. In the linear-quadratic case with a convex supervised learning phase, this corresponds exactly to Algorithm~\ref{alg:mdgps}: the C-step optimizes $p^k$, while the S-step is the projection. Monotonic improvement of the global policy $\pi_\theta$ follows from the monotonic improvement of mirror descent \cite{bt-mdnps-03}. In the case of linear-Gaussian dynamics and policies, the S-step, which minimizes KL-divergence between trajectory distributions, in fact only requires minimizing the KL-divergence between policies. Using the identity in Appendix~\ref{app:kldiv}, we know that \begin{equation} \vspace{-0.05in} D_\text{KL}(p_i(\tau) \| \pi_\theta(\tau)) = \sum_{t=1}^T E_{p_i(\state_t)}\left[D_\text{KL}(p_i(\action_t|\state_t) \| \pi_\theta(\action_t|\state_t))\right]. \label{eqn:mirrorkl} \end{equation} \subsection{Implementation for Nonlinear Global Policies and Unknown Dynamics} \label{sec:implementation} \vspace{-0.05in} In practice, we aim to optimize complex policies for nonlinear systems with unknown dynamics. This requires a few practical considerations. The C-step requires a local quadratic cost function, which can be obtained via Taylor expansion, as well as local linear-Gaussian dynamics $p(\mathbf{x}_{t+1}|\state_t,\action_t) = \mathcal{N}(f_{\state t}\state_t + f_{\action t}\action_t + f_{c t},\mathbf{F}_t)$, which we can fit to samples as in prior work \cite{la-lnnpg-14}. We also need a local time-varying linear-Gaussian approximation to the global policy $\pi_\theta(\action_t|\state_t)$, denoted $\bar{\pi}_{\theta i}(\action_t|\state_t)$. This can be obtained either by analytically differentiating the policy, or by using the same linear regression method that we use to estimate $p(\mathbf{x}_{t+1}|\state_t,\action_t)$, which is the approach in our implementation. In both cases, we get a different global policy linearization around each local policy. Following prior work \cite{la-lnnpg-14}, we use a Gaussian mixture model prior for both the dynamics and global policy fit. \begin{algorithm}[t] \caption{Mirror descent guided policy search (MDGPS): unknown nonlinear dynamics \label{alg:mdgpsfull}} \begin{algorithmic}[1] \FOR{iteration $k \in \{1, \dots, K\}$} \STATE Generate samples $\mathcal{D}_i = \{\tau_{i,j}\}$ by running either $p_i$ or $\pi_{\theta i}$ \STATE Fit linear-Gaussian dynamics $p_i(\mathbf{x}_{t+1}|\state_t,\action_t)$ using samples in $\mathcal{D}_i$ \STATE Fit linearized global policy $\bar{\pi}_{\theta i}(\action_t|\state_t)$ using samples in $\mathcal{D}_i$ \STATE C-step: $p_i \leftarrow \arg\min_{p_i} E_{p_i(\tau)}[\sum_{t=1}^T \ell(\state_t,\action_t)] \text{ such that } D_\text{KL}(p_i(\tau) \| \bar{\pi}_{\theta i}(\tau)) \leq \epsilon$ \STATE S-step: $\pi_\theta \leftarrow \arg\min_\theta \sum_{t,i,j} D_\text{KL}(\pi_\theta(\action_t|\mathbf{x}_{t,i,j}) \| p_i(\action_t|\mathbf{x}_{t,i,j}))$ (via supervised learning) \STATE Adjust $\epsilon$ (see Section~\ref{sec:step}) \ENDFOR \end{algorithmic} \end{algorithm} The S-step can be performed approximately in the nonlinear case by using the samples collected for dynamics fitting to also train the global policy. Following prior work \cite{levine2015end}, our S-step minimizes\footnote{Note that we flip the KL-divergence inside the expectation, following~\cite{levine2015end}. We found that this produced better results. The intuition behind this is that, because $\log p_i(\action_t|\state_t)$ is proportional to the Q-function of $p_i(\action_t|\state_t)$ (see Appendix~\ref{app:cstep}), $D_\text{KL}(\pi_\theta(\action_t|\mathbf{x}_{t,i,j}) \| p_i(\action_t|\mathbf{x}_{t,i,j})$ minimizes the cost-to-go under $p_i(\action_t|\state_t)$ with respect to $\pi_\theta(\action_t|\state_t)$, which provides for a more informative objective than the unweighted likelihood in Equation~(\ref{eqn:mirrorkl}).} \[ \sum_{i,t} E_{p_i(\state_t)}\left[D_\text{KL}(\pi_\theta(\action_t|\state_t) \| p_i(\action_t|\state_t)) \right] \approx \frac{1}{|\mathcal{D}_i|}\sum_{i,t,j} D_\text{KL}(\pi_\theta(\action_t|\mathbf{x}_{t,i,j}) \| p_i(\action_t|\mathbf{x}_{t,i,j})), \] \noindent where $\mathbf{x}_{t,i,j}$ is the $j^\text{th}$ sample from $p_i(\state_t)$ obtained by running $p_i(\action_t|\state_t)$ on the real system. For linear-Gaussian $p_i(\action_t|\state_t)$ and (nonlinear) conditionally Gaussian $\pi_\theta(\action_t|\state_t) = \mathcal{N}(\mu^\policy(\state_t),\Sigma^\policy(\state_t))$, where $\mu^\policy$ and $\Sigma^\policy$ can be any function (such as a deep neural network), the KL-divergence $D_\text{KL}(\pi_\theta(\action_t|\mathbf{x}_{t,i,j}) \| p_i(\action_t|\mathbf{x}_{t,i,j}))$ can easily be evaluated and differentiated in closed form~\cite{levine2015end}. However, in the nonlinear setting, minimizing this objective no longer minimizes the KL-divergence between trajectory distributions $D_\text{KL}(\pi_\theta(\tau) \| p_i(\tau))$ exactly, which means that MDGPS does not correspond exactly to mirror descent: although the C-step can still be evaluated exactly, the S-step now corresponds to an approximate projection onto the constraint manifold. In the next section, we discuss how we can bound the error in this projection. A summary of the nonlinear MDGPS method is provided in Algorithm~\ref{alg:mdgpsfull}, and additional details are in Appendix~\ref{app:mdgpsdetails}. The samples for linearizing the dynamics and policy can be obtained by running either the last local policy $p_i(\action_t|\state_t)$, or the last global policy $\pi_\theta(\action_t|\state_t)$. Both variants produce good results, and we compare them in Section~\ref{sec:experiments}. \subsection{Analysis of Prior Guided Policy Search Methods as Approximate Mirror Descent} The main distinction between the proposed method and prior guided policy search methods is that the constraint $D_\text{KL}(p_i(\tau) \| \bar{\pi}_{\theta i}(\tau)) \leq \epsilon$ is enforced on the local policies at each iteration, while in prior methods, this constraint is iteratively enforced via a dual descent procedure over multiple iterations. This means that the prior methods perform approximate mirror descent with step sizes that are adapted (by adjusting the Lagrange multipliers) but not constrained exactly. In our empirical evaluation, we show that our approach is somewhat more stable, though sometimes slower than these prior methods. This empirical observation agrees with our intuition: prior methods can sometimes be faster, because they do not exactly constrain the step size, but our method is simpler, requires less tuning, and always takes bounded steps on the global policy in trajectory space. \section{Analysis in the Nonlinear Case} Although the S-step under nonlinear dynamics is not an optimal projection onto the constraint manifold, we can bound the additional cost incurred by this projection in terms of the KL-divergence between $p_i(\action_t|\state_t)$ and $\pi_\theta(\action_t|\state_t)$. This analysis also reveals why prior guided policy search algorithms, which only have asymptotic convergence guarantees, still attain good performance in practice even after a small number of iterations. We will drop the subscript $i$ from $p_i(\action_t|\state_t)$ in this section for conciseness, though the same analysis can be repeated for multiple local policies $p_i(\action_t|\state_t)$. \subsection{Bounding the Global Policy Cost} \label{sec:bounding} The analysis in this section is based on the following lemma, which we prove in Appendix~\ref{app:distro_bound}, building off of earlier results by Ross et al.~\cite{rgb-rilsp-11} and Schulman et al.~\cite{slmja-trpo-15}: \begin{lemma} \label{lemma:distro_bound} Let $\epsilon_t = \max_{\state_t} D_\text{KL}(p(\action_t|\state_t) \| \pi_\theta(\action_t|\state_t)$. Then $D_\text{TV}(p(\state_t)\| \pi_\theta(\state_t)) \leq 2 \sum_{t=1}^T \sqrt{2\epsilon_t}$. \end{lemma} This means that if we can bound the KL-divergence between the policies, then the total variation divergence between their state marginals (given by $D_\text{TV}(p(\state_t)\| \pi_\theta(\state_t)) = \frac{1}{2}\|p(\state_t) - \pi_\theta(\state_t)\|_1$) will also be bounded. This bound allows us in turn to relate the total expected costs of the two policies to each other according to the following lemma, which we prove in Appendix~\ref{app:cost_bound}: \begin{lemma} \label{lemma:cost_bound} If $D_\text{TV}(p(\state_t)\| \pi_\theta(\state_t)) \leq 2 \sum_{t=1}^T \sqrt{2\epsilon_t}$, then we can bound the total cost of $\pi_\theta$ as \[ \sum_{t=1}^T E_{\pi_\theta(\state_t,\action_t)}[\ell(\state_t,\action_t)] \leq \sum_{t=1}^T \left[ E_{p(\state_t,\action_t)}[\ell(\state_t,\action_t)] + \sqrt{2\epsilon_t} \max_{\state_t, \action_t} \ell(\state_t, \action_t) + 2\sqrt{2\epsilon_t} Q_{\text{max},t} \right] \] where $Q_{\text{max},t} = \sum_{t^\prime=t}^T \max_{\mathbf{x}_{t^\prime},\mathbf{u}_{t^\prime}}\ell(\mathbf{x}_{t^\prime},\mathbf{u}_{t^\prime})$, the maximum total cost from time $t$ to $T$. \end{lemma} This bound on the cost of $\pi_\theta(\action_t|\state_t)$ tells us that if we update $p(\action_t|\state_t)$ so as to decrease its total cost or decrease its KL-divergence against $\pi_\theta(\action_t|\state_t)$, we will eventually reduce the cost of $\pi_\theta(\action_t|\state_t)$. For the MDGPS algorithm, this bound suggests that we can ensure improvement of the global policy within a small number of iterations by appropriately choosing the constraint $\epsilon$ during the C-step. Recall that the C-step constrains $\sum_{t=1}^T \epsilon_t \leq \epsilon$, so if we choose $\epsilon$ to be small enough, we can close the gap between the local and global policies. Optimizing the bound directly turns out to produce very slow learning in practice, because the bound is very loose. However, it tells us that we can either decrease $\epsilon$ toward the end of the optimization process or if we observe the global policy performing much worse than the local policies. We discuss how this idea can be put into action in the next section. \subsection{Step Size Selection} \label{sec:step} In prior work \cite{lwa-lnnpg-15}, the step size $\epsilon$ in the local policy optimization is adjusted by considering the difference between the predicted change in the cost of the local policy $p(\action_t|\state_t)$ under the fitted dynamics, and the actual cost obtained when sampling from that policy. The intuition is that, because the linearized dynamics are local, we incur a larger cost the further we deviate from the previous policy. We can adjust the step size by estimating the rate at which the additional cost is incurred and choose the optimal tradeoff. Let $\ell_{k-1}^{k-1}$ denote the expected cost under the previous local policy $\bar{p}(\action_t|\state_t)$, $\ell_{k-1}^k$ the cost under the current local policy $p(\action_t|\state_t)$ and the previous fitted dynamics (which were estimated using samples from $\bar{p}(\action_t|\state_t)$ and used to optimize $p(\action_t|\state_t)$), and $\ell_k^k$ the cost of the current local policy under the dynamics estimated using samples from $p(\action_t|\state_t)$ itself. Each of these can be computed analytically under the linearized dynamics. We can view the difference $\ell_k^k - \ell_{k-1}^k$ as the additional cost we incur from imperfect dynamics estimation. Previous work suggested modeling the change in cost as a function of $\epsilon$ as following: $\ell_k^k - \ell_{k-1}^{k-1} = a\epsilon^2 + b\epsilon$, where $b$ is the change in cost per unit of KL-divergence, and $a$ is additional cost incurred due to inaccurate dynamics \cite{lwa-lnnpg-15}. This model is reasonable because the integral of a quadratic cost under a linear-Gaussian system changes roughly linearly with KL-divergence. The additional cost due to dynamics errors is assumes to scale superlinearly, allowing us to solve for $b$ by looking at the difference $\ell_k^k - \ell_{k-1}^k$ and then solving for a new optimal $\epsilon^\prime$ according to $\epsilon^\prime = -b/2a$, resulting in the update $\epsilon^\prime = \epsilon (\ell_{k-1}^k - \ell_{k-1}^{k-1}) / 2(\ell_{k-1}^k - \ell_k^k)$. In MDGPS, we propose to use two step size adjustment rules. The first rule simply adapts the previous method to the case where we constrain the new local policy $p(\action_t|\state_t)$ against the global policy $\pi_\theta(\action_t|\state_t)$, instead of the previous local policy $\bar{p}(\action_t|\state_t)$. In this case, we simply replace $\ell_{k-1}^{k-1}$ with the expected cost under the previous global policy, given by $\ell_{k-1}^{k-1,\pi}$, obtained using its linearization $\bar{\pi}_\theta(\action_t|\state_t)$. We call this the ``classic'' step size: $\epsilon^\prime = \epsilon (\ell_{k-1}^{k} - \ell_{k-1}^{k-1,\pi}) / 2(\ell_{k-1}^k - \ell_k^k)$. However, we can also incorporate intuition from the bound in the previous section to obtain a more conservative step adjustment that reduces $\epsilon$ not only when the obtained local policy improvement doesn't meet expectations, but also when we detect that the global policy is unable to reproduce the behavior of the local policy. In this case, reducing $\epsilon$ reduces the KL-divergence between the global and local policies which, as shown in the previous section, tightens the bound on the global policy return. As mentioned previously, directly optimizing the bound tends to perform poorly because the bound is quite loose. However, if we estimate the cost of the global policy using its linearization, we can instead adjust the step size based on a simple model of \emph{global} policy cost. We use the same model for the change in cost, given by $\ell_k^{k,\pi} - \ell_{k-1}^{k-1,\pi} = a\epsilon^2 + b\epsilon$. However, for the term $\ell_k^k$, which reflects the actual cost of the new policy, we instead use the cost of the new global policy $\ell_k^{k,\pi}$, so that $a$ now models the additional loss due to \emph{both} inaccurate dynamics and inaccurate projection: if $\ell_k^{k,\pi}$ is much worse than $\ell_{k-1}^{k}$, then either the dynamics were too local, or S-step failed to match the performance of the local policies. In either case, we decrease the step size.\footnote{Although we showed before that the discrepancy depends on $\sum_{t=1}^T \sqrt{2\epsilon}_t$, here we use $\epsilon^2$. This is a simplification, but the net result is the same: when the global policy is worse than expected, $\epsilon$ is reduced.} As before, we can solve for the new step size $\epsilon^\prime$ according to $\epsilon^\prime = \epsilon (\ell_{k-1}^{k} - \ell_{k-1}^{k-1,\pi}) / 2(\ell_{k-1}^{k} - \ell_k^{k,\pi})$. We call this the ``global'' step size. Details of how each quantity in this equation is computed are provided in Appendix~\ref{app:step}. \section{Relation to Prior Work} \label{sec:prior_work} While we've discussed the connections between MDGPS and prior guided policy search methods, in this section we'll also discuss the connections between our method and other policy search methods. One popular supervised policy learning methods is DAGGER~\cite{rgb-rilsp-11}, which also trains the policy using supervised learning, but does not attempt to adapt the teacher to provide better training data. MDGPS removes the assumption in DAGGER that the supervised learning stage has bounded error against an arbitrary teacher policy. MDGPS does not need to make this assumption, since the teacher can be adapted to the limitations of the global policy learning. This is particularly important when the global policy has computational or observational limitations, such as when learning to use camera images for partially observed control tasks or, as shown in our evaluation, blind peg insertion. When we sample from the global policy $\pi_\theta(\action_t|\state_t)$, our method resembles policy gradient methods with KL-divergence constraints \cite{ps-rlmsp-08,pma-reps-10,slmja-trpo-15}. However, policy gradient methods update the policy $\pi_\theta(\action_t|\state_t)$ at each iteration by linearizing with respect to the policy parameters, which often requires small steps for complex, nonlinear policies, such as neural networks. In contrast, we linearize in the space of time-varying linear dynamics, while the policy is optimized at each iteration with many steps of supervised learning (e.g. stochastic gradient descent). This makes MDGPS much better suited for quickly and efficiently training highly nonlinear, high-dimensional policies. \section{Experimental Evaluation} \label{sec:experiments} We compare several variants of MDGPS and a prior guided policy search method based on Bregman ADMM (BADMM) \cite{levine2015end}. We evaluate all methods on one simulated robotic navigation task and two manipulation tasks. Guided policy search code, including BADMM and MDGPS methods, is available at \texttt{https://www.github.com/cbfinn/gps}. \begin{wrapfigure}{r}{0.25\textwidth} \vspace{-0.18in} \includegraphics[width=0.24\textwidth]{tasks.png} \vspace{-0.30in} \end{wrapfigure} \vspace{-0.12in} \paragraph{Obstacle Navigation.} In this task, a 2D point mass (grey) must navigate around obstacles to reach a target (shown in green), using velocities and positions relative to the target. We use $N=5$ initial states, with 5 samples per initial state per iteration. The target and obstacles are fixed, but the starting position varies. \vspace{-0.12in} \paragraph{Peg Insertion.} This task, which is more complex, requires controlling a 7 DoF 3D arm to insert a tight-fitting peg into a hole. The hole can be in different positions, and the state consists of joint angles, velocities, and end-effector positions relative to the target. This task is substantially more challenging physically. We use $N=9$ different hole positions, with 5 samples per initial state per iteration. \vspace{-0.12in} \paragraph{Blind Peg Insertion.} The last task is a blind variant of the peg insertion task, where the target-relative end effector positions are provided to the local policies, but not to the global policy $\pi_\theta(\action_t|\state_t)$. This requires the global policy to search for the hole, since no input to the global policy can distinguish between the different initial state $\mathbf{x}_1^i$. This makes it much more challenging to adapt the global and local policies to each other, and makes it impossible for the global learner to succeed without adaptation of the local policies. We use $N=4$ different hole positions, with 5 samples per initial state per iteration. The global policy for each task consists of a fully connected neural network with two hidden layers with $40$ rectified linear units. The same settings are used for MDGPS and the prior BADMM-based method, except for the difference in surrogate costs, constraints, and step size adjustment methods discussed in the paper. Results are presented in Figure~\ref{fig:results}. On the easier point mass and peg tasks, all of the methods achieve similar performance. However, the MDGPS methods are all substantially easier to apply to these tasks, since they have very few free hyperparameters. An initial step size must be selected, but the adaptive step size adjustment rules make this choice less important. In contrast, the BADMM method requires choosing an initial weight on the augmented Lagrangian term, an adjustment schedule for this term, a step size on the dual variables, and a step size for local policies, all of which have a substantial impact on the final performance of the method (the reported results are for the best setting of these parameters, identified with a hyperparameter sweep). On the harder blind peg task, MDGPS consistently outperforms BADMM when sampling from the local policies (``off policy''), with both the classic and global step sizes. This is particularly apparent in the success rates in Table~\ref{tbl:success}, which shows that the MDGPS policies succeed at actually inserting the peg into the hole more often and on more conditions. This suggests that our method is better able to improve global policies particularly in situations where informational or representational constraints make na\"{i}ve imitation of the local policies insufficient to solve the task. On-policy sampling tends to learn slower, since the approximate projection causes the global policy to lag behind the local policy in performance, but this method is still able to consistently improve the global policies. Sampling from the global policies may be desirable in practice, since the global policies can directly use observations at runtime instead of requiring access to the state \cite{levine2015end}. The global step size also tends to be more conservative, but produces more consistent and monotonic improvement. \begin{figure} \centering \includegraphics[width=\textwidth]{results.png} \caption{Results for MDGPS variants and BADMM on each task. MDGPS is tested with local policy (``off policy'') and global policy (``on policy'') sampling (see Section~\ref{sec:implementation}), and both the ``classic'' and ``global'' step sizes (see Section~\ref{sec:step}). The vertical axis for the obstacle task shows the average distance between the point mass and the target. The vertical axis for the peg tasks shows the average distance between the bottom of the peg and the hole. Distances above 0.1, which is the depth of the hole (shown as a dotted line) indicate failure. All experiments are repeated three times, with the average performance and standard deviation shown in the plots.} \label{fig:results} \vspace{-0.1in} \end{figure} \begin{table} {\footnotesize \begin{tabular}{| c | c | c | c | c | c | c |} \hline & Iteration &BADMM & Off Pol., Classic & Off Pol., Global & On Pol., Classic & On Pol., Global\\ \hline \multirow{4}{*}{\rotatebox{90}{\scriptsize{Peg}}} & 3 & 0.00~\% & 0.00~\% & 0.00~\% & 0.00~\% & 0.00~\% \\ & 6 & 51.85~\% & \textbf{62.96~\%} & 22.22~\% & 48.15~\% & 33.33~\% \\ & 9 & 51.85~\% & 77.78~\% & 74.07~\% & 77.78~\% & \textbf{81.48~\%} \\ & 12 & 77.78~\% & 70.73~\% & \textbf{92.59~\%} & \textbf{92.59~\%} & 85.19~\% \\ \hline \hline \multirow{4}{*}{\rotatebox{90}{\scriptsize{Blind Peg}}} & 3& 0.00~\% & 0.00~\% & 0.00~\% & 0.00~\% & 0.00~\% \\ & 6& 50.00~\% & \textbf{58.33~\%} & 25.00~\% & 33.33~\% & 25.00~\% \\ & 9& 58.33~\% & \textbf{75.00~\%} & 50.00~\% & 58.33~\% & 33.33~\% \\ & 12& 75.00~\% & 83.33~\% & \textbf{91.67~\%} & 58.33~\% & 58.33~\% \\ \hline \end{tabular} } \vspace{0.1in} \caption{ Success rates of each method on each peg insertion task. Success is defined as inserting the peg into the hole with a final distance of less than 0.06. Results are averaged over three runs.} \label{tbl:success} \vspace{-0.3in} \end{table} \section{Discussion and Future Work} \label{sec:discussion} We presented a new guided policy search method that corresponds to mirror descent under linearity and convexity assumptions, and showed how prior guided policy search methods can be seen as approximating mirror descent. We provide a bound on the return of the global policy in the nonlinear case, and argue that an appropriate step size can provide improvement of the global policy in this case also. Our analysis provides us with the intuition to design an automated step size adjustment rule, and we illustrate empirically that our method achieves good results on a complex simulated robotic manipulation task while requiring substantially less tuning and hyperparameter optimization than prior guided policy search methods. Manual tuning and hyperparameter searches are a major challenge across a range of deep reinforcement learning algorithms, and developing scalable policy search methods that are simple and reliable is vital to enable further progress. As discussed in Section~\ref{sec:prior_work}, MDGPS has interesting connections to other policy search methods. Like DAGGER \cite{rgb-rilsp-11}, MDGPS uses supervised learning to train the policy, but unlike DAGGER, MDGPS does not assume that the learner is able to reproduce an arbitrary teacher's behavior with bounded error, which makes it very appealing for tasks with partial observability or other limits on information, such as learning to use camera images for robotic manipulation \cite{levine2015end}. When sampling directly from the global policy, MDGPS also has close connections to policy gradient methods that take steps of fixed KL-divergence \cite{ps-rlmsp-08,slmja-trpo-15}, but with the steps taken in the space of trajectories rather than policy parameters, followed by a projection step. In future work, it would be interesting to explore this connection further, so as to develop new model-free policy gradient methods. \bibliographystyle{plain}
{'timestamp': '2016-07-18T02:09:29', 'yymm': '1607', 'arxiv_id': '1607.04614', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04614'}
arxiv
\section{Introduction} Spatio--temporal models are widely used by practitioners. Explaining economic, environmental, social, or biological phenomena, such as peer influence, neighbourhood effects, contagion, epidemics, interdependent preferences, climate change, and so on, are only some of the interesting applications of such models. A widely used spatio--temporal model is the spatial dynamic panel data model (SDPD) proposed and analysed by \cite{LeeYu10a}. See \cite{LeeYu10b} for a survey. To improve adaptivity of SDPD models, \cite{DouAlt15} recently proposed a generalized model that assigns different coefficients to varied locations and assumes heteroskedastic and spatially correlated errors. The model is \begin{equation}\label{eqn1} {\mathbf y}_t = D(\boldsymbol{\lambda}_0){\mathbf W}{\mathbf y}_t + D({\boldsymbol{\lambda}_1}){\mathbf y}_{t-1} + D(\boldsymbol{\lambda}_2){\mathbf W}{\mathbf y}_{t-1} + \mbox{\boldmath$\varepsilon$}_t, \end{equation} where the vector ${\mathbf y}_t$ is of order $p$ and contains the observations at time $t$ from $p$ different locations; the errors $\mbox{\boldmath$\varepsilon$}_t$ are serially uncorrelated; the \emph{spatial matrix} ${\mathbf W}$ is a weight matrix with zero main diagonal and is assumed to be known; $D(\boldsymbol{\lambda}_j)$ with $j=0,1,2$ are diagonal matrices, and $\boldsymbol{\lambda}_j$ are the vectors with the spatial coefficients $\lambda_{ji}$ for $i=1,\ldots,p$. The \emph{generalized SDPD} model in (\ref{eqn1}) guarantees adaptivity by means of its $3p$ parameters. It is characterized by the sum of three terms: the \emph{spatial component}, driven by matrix ${\mathbf W}$ and the spatial parameter $\boldsymbol{\lambda}_0$; the \emph{dynamic component}, driven by the autoregressive parameter $\boldsymbol{\lambda}_1$; and the \emph{spatial--dynamic component}, driven by matrix ${\mathbf W}$ and the spatial--autoregressive parameter $\boldsymbol{\lambda}_2$. If the vectors $\boldsymbol{\lambda}_j$ are scalars for all $j$, then model (\ref{eqn1}) reduces to the classic SDPD of \cite{LeeYu10a}. The errors $\mbox{\boldmath$\varepsilon$}_t$ in model (\ref{eqn1}) are serially uncorrelated and may show heteroskedasticity and cross-correlation over space, so that $\mathop{var}(\mbox{\boldmath$\varepsilon$}_t)$ is a full matrix. This is a novelty compared with the \emph{SDPD} model of \cite{LeeYu10a}, where the errors must be cross-uncorrelated and homoskedastic in order to get consistency of the estimators. A setup similar to ours for the errors has been also considered by \cite{KelPru10} and \cite{Su12}, but not for panel models. However, their estimators are generally based on the instrumental variables technique, in order to overcome the endogeneity of the \emph{zero-lag} regressor. For the \emph{generalized SDPD} model, instead, \cite{DouAlt15} propose a new estimation procedure based on a generalized Yule--Walker approach. They show the consistency of the estimators under regularity assumptions. They also derive the convergence rate and the conditions under which the estimation procedure does not suffer for high-dimensional setups, notwithstanding the large number of parameters to be estimated (which become infinite with the dimension $p$). In real data applications, it is important to check the validity of the assumptions required for the consistency of the estimation procedure. See, for example, the assumptions and asymptotic analysis in \cite{LeeYu10a} and \cite{DouAlt15} as well as the references therein. Checking such assumptions on real data is often not easy; at times, they are clearly violated. Moreover, the spatial matrix ${\mathbf W}$ is assumed to be known, but in many cases, this is not true, and it must be estimated. For example, the spatial weights can be associated with ``similarities'' between spatial units and measured by estimated correlations. Another example is when the spatial weights are zeroes/ones, depending on the ``relationships'' between the spatial units, but the neighbourhood structure of ${\mathbf W}$ is unknown (\emph{i.e.}, it is not known where the ones must be allocated). In such cases, the performance of the \emph{SDPD} models needs to be investigated. Readers are advised to refer to recent papers on spatial matrix estimation (see, among others, \cite{LamSou16}). Motivated by the above considerations, we propose a new version of the \emph{ SDPD} model obtained by adding a constraint to the spatial parameters of the \emph{generalized SDPD} of \cite{DouAlt15}. New estimators of the parameters are proposed and investigated theoretically and empirically. The new model is called \emph{stationary SDPD} and has several advantages. First, the structure of the model and the interpretation of the parameters are simpler than the \emph{generalized SDPD} model, with the consequence that the assumptions underlying the theoretical results are clearer and can be checked easily with real data. Moreover, the estimation procedure is fast and simple to implement. Second, the proposed estimators of the parameters are always unbiased and reach the $\sqrt{T}$ convergence rate (where $T$ is the temporal length of the time series) even in the high-dimensional case, although the number of parameters tends to infinity with the dimension $p$. Last, but not least, our model allows wider application than the classic \emph{SDPD} model, and it is general enough to represent a wide range of multivariate linear processes that can be implicitly interpreted (when they are not explicitly interpretable) as spatio--temporal processes, with respect to a ``latent spatial matrix,'' which needs to be estimated. A big implication of this is that our model is not necessarily confined to the representation of strict spatio--temporal processes (where the spatial matrix is known), but it can also be considered as a valid alternative to the general \emph{VAR} models (where there is no spatial matrix), with two relevant advantages: i) more efficient estimation of the model and ii) the possibility of estimating the model even when $p>T$, thus avoiding the \emph{curse of dimensionality} that characterizes the \emph{VAR} models. Surprisingly, the simulation results show the remarkably better performance of our model and the new estimation procedure compared with the standard VAR model and the standard estimation procedure, even when the spatial matrix is latent and, therefore, to be estimated (see section \ref{matrixA}). The rest of the paper is organized as follows. Section \ref{sdpd} presents the new model and discusses the issue of identifiability. Section \ref{est_alg} describes the estimation procedure. The theoretical results are shown in section \ref{asymptotic}. The empirical performance of the estimation procedure is investigated in section \ref{simulazioni}. Finally, all the proofs are provided in the Appendix. \section{A constrained spatio--temporal model: the stationary SDPD}\label{sdpd} In the sequel, we assume that ${\mathbf y}_1, \cdots, {\mathbf y}_T$ are the observations from a stationary process defined by (\ref{eqn3}). The transpose of a matrix ${\mathbf A}$ is denoted with ${\mathbf A}^T$. We assume that the process has mean zero and denote with $\boldsymbol{\Sigma}_j=\mathop{cov}({\mathbf y}_t,{\mathbf y}_{t-j})=E({\mathbf y}_t{\mathbf y}_{t-j}^T)$ the covariance matrix of the process at the lag $j$. The \emph{generalized SDPD} model in (\ref{eqn1}) can be reformulated as follows. \begin{equation} \left[{\mathbf I}_p-D(\boldsymbol{\lambda}_0){\mathbf W}\right]{\mathbf y}_t = D({\boldsymbol{\lambda}_1})\left[{\mathbf I}_p - D(\boldsymbol{\lambda}^+_2){\mathbf W}\right]{\mathbf y}_{t-1} + \mbox{\boldmath$\varepsilon$}_t, \label{eqn3} \end{equation} where $\boldsymbol{\lambda}^+_2$ is a vector obtained by dividing the elements of $\boldsymbol{\lambda}_2$ by the corresponding elements of $\boldsymbol{\lambda}_1$ (assuming, for now, that all the coefficients in $\boldsymbol{\lambda}_1$ are different from zero). Note that model (\ref{eqn3}) is equivalent to a multivariate (auto)regression between a linear combination of ${\mathbf y}_t$ and a linear combination of the lag ${\mathbf y}_{t-1}$, where the weights of the two linear combinations depend on ${\mathbf W}$ and the coefficients $\boldsymbol{\lambda}_0$ and $\boldsymbol{\lambda}^+_2$, respectively. \begin{equation}\label{zeta} {\mathbf z}_t^{(\boldsymbol{\lambda}_0,{\mathbf W})} = D({\boldsymbol{\lambda}_1}){\mathbf z}_{t-1}^{(\boldsymbol{\lambda}^+_2,{\mathbf W})} + \mbox{\boldmath$\varepsilon$}_t. \end{equation} Some special cases may arise from model (\ref{eqn3}) by adding restrictions on the parameters $\boldsymbol{\lambda}_{j}$. First, if we assume that the spatial parameters are constant over space, that is, $\boldsymbol{\lambda}_{j}$ is scalar for $j=0,1,2$, then we obtain the classic \emph{SDPD} model of \cite{LeeYu10a}. Another constrained model, proposed and analysed in this paper, may be derived by assuming that $\boldsymbol{\lambda}_0=\boldsymbol{\lambda}^+_2$. The reason underlying the choice of this constraint is a generalized assumption of stationarity. In time series analysis, stationarity means that the dependence structure of the process is constant (in some sense) over time. In particular, second-order stationarity assumes that correlations between the observations $({\mathbf y}_t,{\mathbf y}_{t-j})$ depend on the lag $j$ but not on $t$, implying that $\mathop{var}({\mathbf y}_t)$ is constant for all $t$. However, in spatio--temporal time series, there are two kinds of correlations: \emph{temporal correlations}, involving observations at different time points, and \emph{spatial correlations}, involving observations at different spatial units. As we refer to stationarity, it makes sense to assume that spatial correlations are also time-invariant, which means that the weights in (\ref{zeta}) must not change over time, thus, $\left[{\mathbf I}_p-D(\boldsymbol{\lambda}_0){\mathbf W}\right]=\left[{\mathbf I}_p-D(\boldsymbol{\lambda}^+_2){\mathbf W}\right]$, also implying that $\mathop{var}({\mathbf z}_t)$ is the same for all $t$. Therefore, we add the constraint $\boldsymbol{\lambda}_0=\boldsymbol{\lambda}^+_2$, and the model becomes \begin{equation} \label{b1} \left[{\mathbf I}_p-D(\boldsymbol{\lambda}_0){\mathbf W}\right]{\mathbf y}_t = D(\boldsymbol{\lambda}_1)\left[{\mathbf I}_p-D(\boldsymbol{\lambda}_0){\mathbf W}\right]{\mathbf y}_{t-1} + \mbox{\boldmath$\varepsilon$}_t. \end{equation} We denote the model as \emph{stationary SDPD}. Model (\ref{b1}) has several advantages that will be shown in the following sections. Above all, imposing spatio--temporal stationarity helps gain efficiency while still preserving the spatial adaptability that characterizes the \emph{generalized SDPD} model of \cite{DouAlt15}. Moreover, our model allows representation of a wide range of multivariate processes by means of a simple model subject to few assumptions that can be easily checked using real data. Finally, it is worthwhile to stress the difference between the \emph{SDPD} model of \cite{LeeYu10a}, the \emph{generalized SDPD} model of \cite{DouAlt15}, and the \emph{stationary SDPD} model proposed here. The first model imposes that the spatial relationships be the same for all units, since the coefficients $\lambda_j$ (with $j=0,1,2$) do not change with $i=1,\ldots,p$. Instead, the \emph{stationary SDPD} model in (\ref{b1}) allows varied coefficients for different spatial units, as in the \emph{generalized SDPD} of \cite{DouAlt15}, but they are assumed to be time-invariant thanks to a constraint on the time-lagged parameters. Of course, the estimation procedures vary for the three cases in terms of the convergence rates. The constrained model underlying our \emph{stationary SDPD} allows the estimation procedure to reach the $\sqrt{T}$ convergence rate and to guarantee unbiased estimators, whatever the dimension $p$ and even when $p\rightarrow\infty$ at any rate. This is a big improvement with respect to the other two models. In fact, for the classic \emph{SDPD} model, the estimators are characterized by a $\sqrt{Tp}$ convergence rate (which is faster than that of our model, since they have only three parameters to estimate instead of $2p$), but a bias of order $T^{-1}$ exists, and it does not vanish when $p/T\rightarrow\infty$ (see Theorem 3 of \cite{LeeYu10a}). On the other hand, the convergence rates of the estimators in the \emph{generalized SDPD} model are slower than those of our model and deteriorate when $p\rightarrow\infty$ at a rate faster than $\sqrt{T}$ (see Theorem 2 of \cite{DouAlt15}). \subsection{Identification of parameters in the case of cross-uncorrelated errors} In this section, we assume, for simplicity, that the matrix $\boldsymbol{\Sigma}_0^{\varepsilon}=\mathop{var}(\mbox{\boldmath$\varepsilon$}_t)$ is diagonal (\emph{i.e.}, there is heteroskedasticity but no cross-correlation in the error process) and discuss the identifiability of the model. In the next section, we generalize the problem by also adding some cross-correlations in the error process. Defining ${\mathbf z}_t^{(0)}=\left[{\mathbf I}_p-D(\boldsymbol{\lambda}_0){\mathbf W}\right]{\mathbf y}_t$, model (\ref{b1}) can be reformulated as \begin{eqnarray} {\mathbf z}_t^{(0)} &=& D(\boldsymbol{\lambda}_1){\mathbf z}_{t-1}^{(0)} + \mbox{\boldmath$\varepsilon$}_t, \label{b1ter} \end{eqnarray} which is a transformed \emph{VAR} process with uncorrelated components, since $D(\boldsymbol{\lambda}_1)$ is diagonal. Given that we assume that $\boldsymbol{\Sigma}_0^{\varepsilon}$ is also diagonal, the coefficients $\lambda_{1i}$ for $i=1,\ldots,p$, represent the slopes of $p$ univariate autoregressive models with respect to the latent variables $z_{it}^{(0)}$. Therefore, $\lambda_{1i}\equiv\mathop{cor}(z_{it}^{(0)}, z_{i,t-1}^{(0)})$. From (\ref{b1}), it follows that \begin{equation} \left[{\mathbf I}_p-D(\boldsymbol{\lambda}_0){\mathbf W}\right]\boldsymbol{\Sigma}_1 = D(\boldsymbol{\lambda}_1)\left[{\mathbf I}_p-D(\boldsymbol{\lambda}_0){\mathbf W}\right]\boldsymbol{\Sigma}_0 \label{seconda}\\ \end{equation} and for the $i$-th equation, \begin{equation}\label{vincolo} ({\mathbf e}^T_i-\lambda_{0i}{\mathbf w}^T_i)\boldsymbol{\Sigma}_{1}=\lambda_{1i}({\mathbf e}^T_i-\lambda_{0i}{\mathbf w}^T_i)\boldsymbol{\Sigma}_0, \end{equation} where ${\mathbf e}_i$ is the column vector with its $i$-th component equal to one and all the others equal to zero, while ${\mathbf w}_i$ is the column vector containing the $i$-th row of matrix ${\mathbf W}$. Under general assumptions, (\ref{vincolo}) admits only one solution with respect to $\lambda_{0i}$ and $\lambda_{1i}$ (see Theorem \ref{theorem1}), which can be found among the extreme points of $\lambda_{1i}=\mathop{cor}(z_{it}^{(0)}, z_{i,t-1}^{(0)})$ as a function of $\lambda_{0i}$. To provide insight into this, the first two plots of figure \ref{figure2} show two examples based on model 1 used in the simulation study. Denote with ($\lambda_{0i}^*,\lambda_{1i}^*)$ the true values of the coefficients used in model 1 for a given location $i$ (in particular, in figure \ref{figure2}, the first two plots refer to locations $i=6$ and $i=8$). The solid line shows $\lambda_{1i}=\mathop{cor}(z_{it}^{(0)}, z_{i,t-1}^{(0)})$ as a function of $\lambda_{0i}$. The two dots show the points of this function where the first derivative is zero. The vertical and horizontal dashed lines identify which one of the two points satisfies the sufficient condition in (\ref{vincolo}). As expected, it coincides with the true values ($\lambda_{0i}^*,\lambda_{1i}^*)$ used to generate the time series. Theorem \ref{theorem1}, shown in the Appendix, formalizes this result. \begin{theorem}\label{theorem1} Consider model (\ref{b1}) for a stationary process ${\mathbf y}_t$ with mean zero, and assume that the error process $\mbox{\boldmath$\varepsilon$}_t$ is such that $\boldsymbol{\Sigma}^0_\varepsilon=\mathop{var}(\mbox{\boldmath$\varepsilon$}_t)$ is diagonal (\emph{i.e.}, there is heteroskedasticity but no cross-correlation in the errors). Under assumptions $A1-A4$ in section \ref{asymptotic}, the following results hold: \begin{enumerate} \item There exist a unique couple of values $(\lambda_{0i}^*,\lambda_{1i}^*)$ satisfying the following system of equations: \begin{equation}\label{vinc} ({\mathbf e}^T_i-\lambda_{0i}{\mathbf w}^T_i)\boldsymbol{\Sigma}_{1}-\lambda_{1i}({\mathbf e}^T_i-\lambda_{0i}{\mathbf w}^T_i)\boldsymbol{\Sigma}_0={\bf 0}^T, \qquad\qquad i=1,\ldots,p, \end{equation} where ${\mathbf e}_i$ is the $i$-th unit vector, and ${\mathbf w}_i$ contains the $i$-th row of the spatial matrix ${\mathbf W}$. \item Such a point, $(\lambda_{0i}^*,\lambda_{1i}^*)$, is also the solution of the following second-order polynomial equation: \begin{eqnarray} \label{nec_cond} \left.\frac{\partial\mathop{cov}(z_{it}^{(0)}, z_{i,t-1}^{(0)})}{\partial\lambda_{0i}}\right|_{\lambda_{0i}=\lambda_{0i}^*}- \lambda_{1i}^*\left.\frac{\partial\mathop{var}(z_{i,t-1}^{(0)})}{\partial\lambda_{0i}}\right|_{\lambda_{0i}=\lambda_{0i}^*} &=& 0. \end{eqnarray} \end{enumerate} \end{theorem} \noindent\textbf{Remark 1:} Theorem \ref{theorem1} not only shows that the \emph{stationary SDPD} model is well identified, because there is a unique solution for $(\boldsymbol{\lambda}_0,\boldsymbol{\lambda}_1)$, but it also suggests a way to estimate such parameters. In fact, we can find all the solutions to equation (\ref{nec_cond}) and then check which one satisfies the sufficient condition in (\ref{vincolo}). This estimation procedure is described in section \ref{est_alg}. \subsection{Identification of parameters in the case of cross-correlated errors} Now, we relax the assumption on the error $\mbox{\boldmath$\varepsilon$}_t$ by letting $\boldsymbol{\Sigma}_0^\varepsilon$ be a full matrix (i.e., there is heteroskedasticity and cross-correlation in the error process). This setup allows the process ${\mathbf y}_t$ to include some {spurious cross-correlation} not explained by ${\mathbf W}$. In this case, the coefficients $\lambda_{i1}$ still give the correlations between the latent variables $z_{i,t}^{(0)}$ and $z_{i,t-1}^{(0)}$, but now, the $p$ equations in model (\ref{b1ter}) are correlated. The main consequence of this is that the true values $(\lambda_{0i}^*, \lambda_{1i}^*)$ do not identify an extreme point of the correlation function (see case $i=2$ in figure \ref{figure2}). Anyway, the sufficient condition in (\ref{vincolo}) is still valid, and the true coefficients $(\lambda_{0i}^*, \lambda_{1i}^*)$ can be identified by introducing a ``constrained'' condition. \begin{theorem}\label{theorem1bis} Consider model (\ref{b1}) for a stationary process ${\mathbf y}_t$ with mean zero, and assume that the error process $\mbox{\boldmath$\varepsilon$}_t$ is such that $\boldsymbol{\Sigma}^0_\varepsilon=\mathop{var}(\mbox{\boldmath$\varepsilon$}_t)$ is a full matrix (\emph{i.e.}, there is heteroskedasticity and cross-correlation in the errors). Under assumptions $A1-A4$ in section \ref{asymptotic}, the following results hold: \begin{enumerate} \item There exist a unique couple of values $(\lambda_{0i}^*,\lambda_{1i}^*)$ satisfying the following system of equations \[ ({\mathbf e}^T_i-\lambda_{0i}{\mathbf w}^T_i)\boldsymbol{\Sigma}_{1}-\lambda_{1i}({\mathbf e}^T_i-\lambda_{0i}{\mathbf w}^T_i)\boldsymbol{\Sigma}_0={\bf 0}^T, \qquad\qquad i=1,\ldots,p, \] where ${\mathbf e}_i$ is the $i$-th unit vector, and ${\mathbf w}_i$ contains the $i$-th row of the spatial matrix ${\mathbf W}$; \item such a point, $(\lambda_{0i}^*,\lambda_{1i}^*)$, is also the solution of the following second-order polynomial equation. \begin{eqnarray*} \left.\frac{\partial\mathop{cov}(z_{it}^{(0)}, z_{i,t-1}^{(0)})}{\partial\lambda_{0i}}\right|_{\lambda_{0i}=\lambda_{0i}^*}- \lambda_{1i}^*\left.\frac{\partial\mathop{var}(z_{i,t-1}^{(0)})}{\partial\lambda_{0i}}\right|_{\lambda_{0i}=\lambda_{0i}^*} &=& ({\mathbf e}_i^T-\lambda_{0i}^*{\mathbf w}^T_i)(\boldsymbol{\Sigma}_1^T-\boldsymbol{\Sigma}_1){\mathbf w}_i. \end{eqnarray*} \end{enumerate} \end{theorem} \noindent\textbf{Remark 2:} When the errors $\mbox{\boldmath$\varepsilon$}_t$ are not cross-correlated, the matrix $\boldsymbol{\Sigma}_1$ is symmetric by Lemma \ref{lemma1} in the Appendix, so that point 2 in Theorem \ref{theorem1bis} becomes the same as in Theorem \ref{theorem1}. Therefore, Theorem \ref{theorem1bis} includes Theorem \ref{theorem1} as a special case. \section{Estimation procedure}\label{est_alg} We present here a simple algorithm for the estimation of the parameters $(\lambda_{0i},\lambda_{1i})$ for $i=1,\ldots,p$. First, estimate the matrices $\boldsymbol{\Sigma}_1$ and $\boldsymbol{\Sigma}_0$ through some consistent estimators $\hat\boldsymbol{\Sigma}_0$ and $\hat\boldsymbol{\Sigma}_1$. For example, $\hat\boldsymbol{\Sigma}_0=(n-1)^{-1}{\mathbf Y}_0{\mathbf Y}_0^T$ and $\hat\boldsymbol{\Sigma}_1=(n-2)^{-1}{\mathbf Y}_0{\mathbf Y}_1^T$, where ${\mathbf Y}_l=({\mathbf y}_{1+l}, \cdots, {\mathbf y}_{n-l})$. Alternatively, the threshold estimator analyzed in \cite{CheAlt13} can be considered in the high dimensional setup. Then, for each location $i=1,\ldots,p$, implement the following steps. \begin{enumerate} \item Define ${\mathbf e}_i$ as the $i$-th unit vector and ${\mathbf w}^T_i={\mathbf e}^T_i{\mathbf W}$, then compute: \begin{eqnarray*} \hat a_{0i} &=& {\mathbf e}_i^T\hat\boldsymbol{\Sigma}_0{\mathbf e}_i, \quad \hat a_{1i} = {\mathbf e}_i^T\hat\boldsymbol{\Sigma}_1 {\mathbf e}_i, \quad \hat a_{2i} = {\mathbf e}_i^T(\hat\boldsymbol{\Sigma}_1^T-\hat\boldsymbol{\Sigma}_1){\mathbf w}_i, \\ \hat b_{0i} &=& -2{\mathbf e}_i^T\hat\boldsymbol{\Sigma}_0{\mathbf w}_i, \quad \hat b_{1i} = -{\mathbf e}^T_i(\hat\boldsymbol{\Sigma}_1+\hat\boldsymbol{\Sigma}_1^T){\mathbf w}_i, \\ \hat c_{0i} &=& {\mathbf w}^T_i\hat\boldsymbol{\Sigma}_0{\mathbf w}_i,\quad \hat c_{1i} = {\mathbf w}^T_i\hat\boldsymbol{\Sigma}_1{\mathbf w}_i. \end{eqnarray*} \item Find the two roots $\lambda_{0i}^{(1)}$ and $\lambda_{0i}^{(2)}$ of the following two-order polynomial equation. \begin{equation}\label{eqq} \hat t_{0i} + \hat t_{1i}\lambda_{i0} + \hat t_{2i}\lambda_{i0}^2 =0, \end{equation} where $\hat t_{0i} = \hat b_{1i}\hat a_{0i}-\hat b_{0i}\hat a_{1i}+\hat a_{0i}\hat a_{2i}$, $\hat t_{1i} = 2(\hat a_{0i}\hat c_{1i}-\hat c_{0i}\hat a_{1i})+\hat a_{2i}\hat b_{0i}$, and $\hat t_{2i} = \hat c_{1i}\hat b_{0i}-\hat c_{0i}\hat b_{1i}+\hat a_{2i}\hat c_{0i}$. \item Estimate $\lambda_{0i}$ and $\lambda_{1i}$ by \begin{eqnarray}\label{stimatore0} \hat\lambda_{0i}&=&\arg\min_{j=1,2}{\mathbf v}_{ij}^T{\mathbf v}_{ij}, \\ \hat\lambda_{1i}&=&\frac{({\mathbf e}_i^T-\hat\lambda_{0i}{\mathbf w}^T_i)\hat\boldsymbol{\Sigma}_1({\mathbf e}_i-\hat\lambda_{0i}{\mathbf w}_i)}{({\mathbf e}_i^T-\hat\lambda_{0i}{\mathbf w}^T_i)\hat\boldsymbol{\Sigma}_0({\mathbf e}_i-\hat\lambda_{0i}{\mathbf w}_i)}, \label{stimatore1} \end{eqnarray} where $ {\mathbf v}^T_{ij} = ({\mathbf e}_i^T-\lambda_{0i}^{(j)}{\mathbf w}^T_i)\hat\boldsymbol{\Sigma}_1-\lambda_{1i}^{(j)}({\mathbf e}_i^T-\lambda_{0i}^{(j)}{\mathbf w}^T_i)\hat\boldsymbol{\Sigma}_0, $, and $\lambda_{1i}^{(j)} = ({\mathbf e}_i^T-\lambda_{0i}^{(j)}{\mathbf w}^T_i)\hat\boldsymbol{\Sigma}_1({\mathbf e}_i-\lambda_{0i}^{(j)}{\mathbf w}_i)/({\mathbf e}_i^T-\lambda_{0i}^{(j)}{\mathbf w}^T_i)\hat\boldsymbol{\Sigma}_0({\mathbf e}_i-\lambda_{0i}^{(j)}{\mathbf w}_i)$. \end{enumerate} \vspace{10pt}\noindent\textbf{Remark 3:} Assumption $A2$ in section \ref{asymptotic} guarantees that matrix $\left[{\mathbf I}_p-D(\boldsymbol{\lambda}_0){\mathbf W}\right]$ has full rank. However, the above estimation procedure may suffer for some locations if matrix $\left[{\mathbf I}_p-D(\boldsymbol{\lambda}_0){\mathbf W}\right]$ is near singularity. Such a case may come about because of the presence of some almost linearly dependent rows in the matrix, which may cause the quantity ${\mathbf w}_i^T[\boldsymbol{\Sigma}_1-\lambda_{1i}\boldsymbol{\Sigma}_0]{\mathbf w}_i$ to be almost zero for those rows (see Lemma \ref{lemma2}). As a result, the procedure loose efficiency for the estimation of $\lambda_{i0}$ for those locations (but it still works for $\lambda_{1i}$). Something similar may happen if there are some (almost) zero rows in ${\mathbf W}$, which is excluded by assumption $A4$. Anyway, it is worthwhile to stress that the estimation procedure works efficiently for all the other locations. In fact, the procedure does not require the inversion of matrix $\left[{\mathbf I}_p-D(\boldsymbol{\lambda}_0){\mathbf W}\right]$, so it is able to isolate and separate the effects of ``collinear'' locations (or uncorrelated locations) from the other locations and to guarantee consistent and efficient estimations for the last locations. \section{Theoretical results}\label{asymptotic} In this section, we show the theoretical foundations of our proposal. In particular, we present the assumptions and show the consistency and the asymptotic normality of the estimators, for the cases of finite dimension and high dimension. Moreover, we show that the \emph{stationary SDPD} model can be used to represent a wide range of multivariate linear processes with respect to a ``latent spatial matrix,'' and therefore, it is of wider application than classic spatio--temporal contexts. The reduced form of model (\ref{b1}) is \begin{equation}\label{b1bis} {\mathbf y}_t={\mathbf A}^*{\mathbf y}_{t-1}+\mbox{\boldmath$\varepsilon$}_t^*, \end{equation} where $\mbox{\boldmath$\varepsilon$}_t^*=\left[{\mathbf I}_p-D(\boldsymbol{\lambda}_0){\mathbf W}\right]^{-1}\mbox{\boldmath$\varepsilon$}_t$ and \begin{equation}\label{diagonalize} {\mathbf A}^*=\left[{\mathbf I}_p-D(\boldsymbol{\lambda}_0){\mathbf W}\right]^{-1}D(\boldsymbol{\lambda}_1)\left[{\mathbf I}_p-D(\boldsymbol{\lambda}_0){\mathbf W}\right]. \end{equation} Note that the errors $\mbox{\boldmath$\varepsilon$}_t^*$ have mean zero and are serially uncorrelated. Model (\ref{b1bis}) has a \emph{VAR} representation, so it is stationary when all the eigenvalues of matrix ${\mathbf A}^*$ are smaller than one in absolute value. From (\ref{diagonalize}), we can note that $\boldsymbol{\lambda}_1$ contains the eigenvalues of ${\mathbf A}^*$ whereas $\boldsymbol{\lambda}_0$ only affects its eigenvectors (see the proof of Theorem \ref{theorem1}). Therefore, we must consider the following assumptions: \begin{itemize} \item[A1)] $\lambda_{1i}\in\mathbb{R}$ and $|\lambda_{1i}|<1$, for all $i$, and vector $\boldsymbol{\lambda}_1$ is not scalar; \item[A2)] $\lambda_{0i}\in\mathbb{R}$ for all $i$ and vector $\boldsymbol{\lambda}_0$ is such that matrix $\left[{\mathbf I}_p-D(\boldsymbol{\lambda}_0){\mathbf W}\right]$ has full rank; \item[A3)] the errors $\varepsilon_{it}$ are serially independent and such that $E(\varepsilon_{it})=0$ and $E|\varepsilon_{it}|^\delta<\infty$ for all $i,t$, for some $\delta>4$; \item[A4)] the spatial matrix ${\mathbf W}$ is nonsingular and has zero main diagonal. \end{itemize} Assumption $A1$ implies stationarity. Moreover, it guarantees that there are at least two distinct values in vector $\boldsymbol{\lambda}_1$ so that model (\ref{b1}) is identifiable, as shown in Theorem \ref{theorem1}. Assumption $A2$ is clearly necessary to assure that matrix $\left[{\mathbf I}_p-D(\boldsymbol{\lambda}_0){\mathbf W}\right]$ can be inverted so that the reduced model in (\ref{b1bis}) is well defined (Remark 3 indicates what happens when this assumption is not satisfied). Incidentally, it is worthwhile to note that our setup automatically solves the problem concerning the parameter space of $\boldsymbol{\lambda}_0$, highlighted at the end of section 2.2 by \cite{KelPru10}. So, in the empirical applications of our model, it is possible to use any kind of normalization for ${\mathbf W}$ (\emph{i.e.}, row-factor normalization or single-factor normalization), since the vector $\boldsymbol{\lambda}_0$ would automatically rescale accordingly (see section \ref{high} for more details on this aspect). This means that the coefficients $\lambda_{0i}$ can also take values outside the classic interval $[-1,1]$. Assumption $A3$ assures that the results in \cite{Han76} can be applied to show the asymptotic normality of the estimators. Assumption $A4$ is classic in spatio--temporal models and guarantees that the model is well defined and identifiable with respect to all the parameters, also for $p\rightarrow\infty$ (see Lemma \ref{lemma2} and Theorem \ref{theorem4}). Under assumptions $A1-A4$, it is immediately evident that the estimators $\hat\boldsymbol{\lambda}_{0}$ and $\hat\boldsymbol{\lambda}_{1}$, presented in section \ref{est_alg}, are both consistent following Theorem 11.2.1 in \cite{BroDav86}. For asymptotic normality, the following theorem can be stated. \begin{theorem}\label{theorem3} Consider $\hat\lambda_{0i}$ and $\hat\lambda_{1i}$, the estimators obtained by the algorithm in section \ref{est_alg}. Under assumptions $A1-A4$, we have for finite $p$ \begin{equation} \sqrt{T}(\hat\lambda_{ji}-\lambda_{ji}) \stackrel{d}{\longrightarrow}N(0,{\mathbf D}_{ji}^T{\mathbf V}_{ji}{\mathbf D}_{ji}) \nonumber\qquad\qquad j=0,1;\quad i=1,\ldots,p, \end{equation} where ${\mathbf D}_{ji}$ are the $K_i\times 1$ vectors, and ${\mathbf V}_{ji}$ are the matrices of order $K_i$ with $K_i \le 2p^2$ (see the proof). \end{theorem} Note that the estimators $\widehat\lambda_{ji}$ are unbiased for all $i,j$ and for all $p$. In the high dimension, we have infinite parameters to estimate ($2p$ in total, where $p\rightarrow\infty$). Therefore, we must assure that the consistency of the estimators is still valid in such a case. As expected, the properties of matrix ${\mathbf W}$ influence the consistency and the convergence rates of the estimators $\hat\lambda_{ij}$ when $p\rightarrow\infty$. For example, denote with $k_i$ the number of nonzero elements in vector ${\mathbf w}_i$. If $k_i=O(1)$ as $p\rightarrow\infty$, for all $i$, then the effective dimension of model (\ref{b1}) is finite and Theorem \ref{theorem3} can still be applied for the consistency and the asymptotic normality of the estimators $\hat\lambda_{ji}$, even if $p\rightarrow\infty$. The following Theorem \ref{theorem4}, instead, shows the consistency of the estimators under more general vectors ${\mathbf w}_i$, with $k_i\rightarrow\infty$ as $p\rightarrow\infty$. \subsection{Asymptotics for high dimensional setups}\label{high} In model (\ref{b1}), the spatial correlation between a given location $i$-th and the other locations is summarized by $\lambda_{0i}{\mathbf w}_i$. If the vector ${\mathbf w}_i$ is rescaled by a factor $\delta_i$, then we can have an equivalent model by rescaling the spatial coefficient $\lambda_{0i}$ by the inverse of the same factor, since $\lambda_{0i}{\mathbf w}_i=\delta_i^{-1}\lambda_{0i}{\mathbf w}_i\delta_i=\lambda_{0i,\delta}{\mathbf w}_{i,\delta}$. In such a way, we may consider irrelevant a row-normalization of matrix ${\mathbf W}$ if we let the coefficients in $D(\boldsymbol{\lambda}_{0})$ rescale accordingly. Such an approach is not new and follows the idea of \cite{KelPru10}. We use this approach here in order to simplify the analysis and the interpretation of the \emph{stationary SDPD} model in the high dimensional setup. In fact, when $p\rightarrow\infty$ and $k_i=O(p)$, the vectors ${\mathbf w}_i$ may change with $p$ and this may have an influence on the scale order of the process. This happens, for example, if we consider a row-normalized spatial matrix ${\mathbf W}$, since the weights become infinitely small for infinitely large $p$. Looking at the (\ref{diagonalize}), model (\ref{b1}) appears to become spatially uncorrelated for $p\rightarrow\infty$ because matrix ${\mathbf W}$ tends to be asymptotically diagonal (for $p\rightarrow\infty$ and $T$ given). As a consequence, the model appears to become not identifiable in the high dimension with respect to the parameters $\lambda_{0i}$. To avoid this, we assume here that also the coefficients $\lambda_{0i}$ may depend on the dimension $p$, borrowing the idea of \cite{KelPru10}. In such a way, we can derive the conditions for the identifiability of the model in the high dimension and better convergence rates for the estimators. This is shown by the following theorem. \begin{theorem}\label{theorem4} Consider $\hat\lambda_{0i}$ and $\hat\lambda_{1i}$, the estimators obtained by the algorithm in section \ref{est_alg}. Assume that the number of nonzero values in ${\mathbf w}_i$ is $k_i=O(p)$ for all $i=1,\ldots,p$. Under assumptions $A1-A4$, for $p\rightarrow\infty$ we have the following cases: \begin{itemize} \item[(i)] if the vectors ${\mathbf w}_i$ are normalized by $L_1$ norm then \[ \left|\hat\lambda_{ji}-\lambda_{ji}\right| =O_p(T^{-1/2}) \nonumber\qquad\qquad {\rm for\ } j=0,1;i=1,\ldots,p, \] provided that $\lambda_{0i}=O(p)$; \item[(ii)] if the vectors ${\mathbf w}_i$ are normalized by $L_2$ norm and $\lambda_{0i}=O(1)$ then \[ \left|\hat\lambda_{ji}-\lambda_{ji}\right| =O_p(T^{-1/2}) \nonumber\qquad\qquad {\rm for\ } j=0,1;i=1,\ldots,p; \] \item[(iii)] for generic (not normalized but bounded) vectors ${\mathbf w}_i$ and $\lambda_{0i}=O(1)$ we have \[ \left|\hat\lambda_{ji}-\lambda_{ji}\right| =O_p(pT^{-1/2}) \nonumber\qquad\qquad {\rm for\ } j=0,1;i=1,\ldots,p. \] \end{itemize} \end{theorem} As shown by Theorem \ref{theorem4}, cases (i) and (ii), if we consider a row-normalized spatial matrix ${\mathbf W}$, our estimation procedure is consistent for any value of $p$ and with $p\rightarrow\infty$ at any rate. In other words, the convergence rate is not affected by the dimension $p$. However, there are some differences between the two cases of $L_1$ and $L_2$ normalization. In the first case, we need to impose that the spatial coefficients $\lambda_{0i}$ increases in the order $O(p)$ as $p\rightarrow\infty$ (otherwise the model becomes not identifiable in the high dimension), whereas in the last case of $L_2$ norm they can remain constant for $p\rightarrow\infty$. In case (iii), which is more general because it is valid for any ${\mathbf W}$, we need to impose $k_i=o(T^{1/2})$ in order to guarantee the consistency of the estimators. To complete this section, we want to show the class of processes that can be analysed by our \emph{stationary SDPD} model. Under assumption $A2$, any \emph{stationary SDPD} model can be equivalently represented as a VAR process as in (\ref{b1bis}), with respect to an autoregressive matrix coefficient ${\mathbf A}^*$ defined in (\ref{diagonalize}). Now, by exploiting the simple structure of our model, we can show the conditions under which the opposite is true. The following corollary derives from standard results. \begin{corollary}\label{corollary1} Given a stationary multivariate process ${\mathbf y}_t={\mathbf A}^*{\mathbf y}_{t-1}+\mbox{\boldmath$\varepsilon$}_t^*$, with $\mbox{\boldmath$\varepsilon$}_t^*$ satisfying assumption $A3$, a necessary and sufficient condition to represent the process ${\mathbf y}_t$ by a stationary SDPD model is that matrix ${\mathbf A}^*$ is diagonalizable. Therefore, matrix ${\mathbf A}^*$ must have $p$ linearly independent eigenvectors. This is (alternatively) assured by one of the following sufficient conditions: \begin{itemize} \item the eigenvalues $\lambda_{11},\ldots,\lambda_{1p}$ of matrix ${\mathbf A}^*$ are all distinct, or \item the eigenvalues $\lambda_{11},\ldots,\lambda_{1p}$ of matrix ${\mathbf A}^*$ consist of $h$ distinct values $\mu_1,\ldots,\mu_h$ having geometric multiplicities $r_1,\ldots,r_h$, such that $r_1+\ldots+r_h=p$. \end{itemize} \end{corollary} By corollary \ref{corollary1} and assumptions $A1-A4$, the VAR processes that cannot be represented and consistently estimated by our \emph{stationary SDPD} model are those characterized by a matrix ${\mathbf A}^*$ with linear dependent eigenvectors (i.e., those with algebraic multiplicities) or those with complex eigenvalues. In order to apply our model to those cases also, we should generalize the estimation procedure using the Jordan decomposition of matrix ${\mathbf A}^*$. However, we leave this topic to future study. \section{Simulation study}\label{simulazioni} This section contains the results of a simulation study implemented to evaluate the performance of the proposed estimation procedure. In section 5.1, we describe the settings and check the validity of the assumptions for the simulated models. Then, in section 5.2, we evaluate the consistency of the estimation procedure and the convergence rate for the estimators using a known spatial matrix. Finally, section 5.3, we analyse the case when the spatial matrix ${\mathbf W}$ is unknown, and therefore, to be estimated. \subsection{Settings} We consider three different spatial matrices. In the first, we randomly generate a matrix of order $p\times p$, and we post-multiply this matrix by its transpose in order to force symmetry. The resulting spatial matrix is denoted with ${\mathbf W}_1$. Note that such a matrix is \emph{full}, and it may have positive and negative elements. In the other two cases, the spatial matrix is \emph{sparse} and has only positive entries: ${\mathbf W}_2$ is generated by setting to one only four values in each row while ${\mathbf W}_3$ is generated by setting to one $2\sqrt{p}$ elements in each row. For all three cases, we check the rank to guarantee that the spatial matrix has $p$ linearly independent rows. Moreover, we set to zero the main diagonal, and we rescale the elements so that each row has norm equal to one ($L_2$ row-normalization). For the error process, we generate $p$ independent Gaussian series $e_{ti}$ with mean zero and standard error ${\sigma}_i$, where the values ${\sigma}_i$ are generated randomly from a uniform distribution $U(0.5, 1.5)$ for $i=1,\ldots,p$. Then, we define the cross-correlated error process $\mbox{\boldmath$\varepsilon$}_t=\{\varepsilon_{it},t=1,\ldots,T\}$, where \[ \left\{ \begin{array}{ll} \varepsilon_{ti} = e_{ti} -0.7*e_{t2} & \mbox{for }i=3,\ldots,p, \\ \varepsilon_{ti} = e_{ti} & \mbox{otherwise}. \\ \end{array} \right. \] We generate all $\lambda_{ji}$ from a uniform distribution $U(-0.7, 0.7)$. The settings above guarantee that assumptions $A1-A4$ hold. We generate different models with dimensions $p = (10, 50, 100, 500)$ and sample sizes $T = (50, 100, 500, 1000)$. Note that we may have $T<<p$. For each configuration of settings, we generate 500 Monte Carlo replications of the model and report the estimation results. All the analyses have been made in R. \subsection{Empirical performance of the estimators when ${\mathbf W}$ is known} Figure \ref{figure5} shows the box plots of the estimations for increasing sample sizes $T = (50, 100, 500, 1000)$ and fixed dimension $p = 100$. The four plots at the top refer to the estimation of $\lambda_{0i}$ while the four plots at the bottom refer to that of $\lambda_{1i}$. Each plot focuses on a different {location} $i$, where $i = 97,\ldots,100$. The true values of the coefficients $\lambda_{ji}$ are shown through the horizontal lines. Note that we have $T\leq p$ for the first two box plots in each plot, since $p = 100$ for this model. The box plots are centred on the true value of the parameters, and the variance reduces for increasing values of $T$, showing consistency of the estimators and a good performance for small $T$/large $p$ also. To evaluate the estimation error, for each realized time series, we compute the average error $AE$ and the average squared error $ASE$ using the equations below. \begin{equation}\label{mse} AE(\widehat\boldsymbol{\lambda}_j) = \frac{1}{p}\sum_{i=1}^p{(\hat\lambda_{ji}-\lambda_{ji})}, \qquad ASE(\widehat\boldsymbol{\lambda}_j) = \frac{1}{p}\sum_{i=1}^p{(\hat\lambda_{ji}-\lambda_{ji})^2}, \qquad j=1,2. \end{equation} Table \ref{tabella1} reports the mean values of $ASE(\widehat\boldsymbol{\lambda}_j)$ (with the standard deviations in brackets) computed over 500 simulated time series for different values of $T$ and $p$. As shown in the table, the estimation error decreases when the sample size $T$ increases. It is interesting to note that the estimation error does not increase for increasing values of the dimension $p$. This is more evident from figure \ref{increasing_p_global}, which shows the box plots of the average errors $AE(\boldsymbol{\lambda}_0)$ (at the top) and $AE(\boldsymbol{\lambda}_1)$ (at the bottom) computed for 500 replications of the model, with varying values of $p$, sample sizes $T$, and spatial matrix ${\mathbf W}_1$. We can note from the figure that $\hat\boldsymbol{\lambda}_0$ and $\hat\boldsymbol{\lambda}_1$ are unbiased for all $n$ and $p$. Moreover, the variability of the box plots decreases for $p\rightarrow\infty$ and fixed $T$: this is a consequence of averaging the absolute error over the $p$ locations using equation (\ref{mse}). \subsection{Estimation results when the spatial matrix is unknown}\label{matrixA} In this section, we evaluate the performance of the proposed estimation procedure when the spatial matrix ${\mathbf W}$ is unknown and needs to be estimated. In this case, the estimation error has to be evaluated with respect to matrix ${\mathbf A}^*$ in order to include the effects of both $\hat\boldsymbol{\lambda}_{j}$ and $\hat{\mathbf W}$ on the final estimations. So, using (\ref{diagonalize}), we define the two estimators \begin{eqnarray} \hat{\mathbf A}_{SDPD}^*({\mathbf W}) &=& \left[{\mathbf I}_p-D(\hat\boldsymbol{\lambda}_0){\mathbf W}\right]^{-1}D(\hat\boldsymbol{\lambda}_1)\left[{\mathbf I}_p-D(\hat\boldsymbol{\lambda}_0){\mathbf W}\right] and \label{AW}\\ \hat{\mathbf A}_{SDPD}^*(\hat{\mathbf W}) &=& \left[{\mathbf I}_p-D(\hat\boldsymbol{\lambda}_0)\hat{\mathbf W}\right]^{-1}D(\hat\boldsymbol{\lambda}_1)\left[{\mathbf I}_p-D(\hat\boldsymbol{\lambda}_0)\hat{\mathbf W}\right],\label{AWhat} \end{eqnarray} where matrix ${\mathbf W}$ is assumed to be known in the first case and unknown in the second. When ${\mathbf W}$ is unknown, we estimate it by the (row-normalized) correlation matrix at lag zero, but other more efficient estimators of ${\mathbf W}$ can be considered alternatively. For the sake of comparison, remembering the \emph{VAR} representation of our model in (\ref{b1bis}), we also estimate matrix ${\mathbf A}^*$ using the classic Yule--Walker estimator of the VAR model $\hat{\mathbf A}_{VAR}^*=\hat\boldsymbol{\Sigma}_0^{-1}\hat\boldsymbol{\Sigma}_1$. To give a measure of the estimation error, we define \begin{equation}\label{mse2} ASE({\mathbf A}^*_{(1)})= \frac{1}{p}\sum_{i=1}^p{(\hat A^*_{1i}-A^*_{1i})^2}, \end{equation} where $A^*_{1i}$ for $i=1,\ldots,p$ are the true coefficients in the first row of matrix ${\mathbf A}^*$, and $\hat A^*_{1i}$ are their estimated values. The box plots in figure \ref{figure6} summarize the results of the estimations from 500 replications of the model with $p=100$ (at the top) and $p=500$ (at the bottom). We report the average squared error computed by (\ref{mse2}) in three different cases: the classic Yule--Walker estimator of the VAR model $\hat{\mathbf A}_{VAR}^*$ on the left, our estimator $\hat{\mathbf A}_{SDPD}^*({\mathbf W})$ proposed in (\ref{AW}) with the known spatial matrix in the middle, and our estimator $\hat{\mathbf A}_{SDPD}^*(\hat{\mathbf W})$ proposed in (\ref{AWhat}) with the estimated spatial matrix on the right. Figure \ref{figure6} shows interesting results. First, note that the classic estimator $\hat{\mathbf A}_{VAR}^*$ cannot be applied when $T\leq p$, and this is a serious drawback of the classic VAR models. On the other hand, the \emph{stationary SDPD} model is equivalently used to represent the same process but it can always generate an estimation result for all values of $T$ and $p$ regardless of whether ${\mathbf W}$ is known or unknown. Moreover, if we compare the box plots, we can note that both the median and the variability of the estimators $\hat{\mathbf A}_{SDPD}^*({\mathbf W})$ and $\hat{\mathbf A}_{SDPD}^*(\hat{\mathbf W})$ are remarkably lower than those relative to the classic estimator $\hat{\mathbf A}_{VAR}^*$ (when available) for all sample sizes $T$ and dimensions $p$. This deserves a further remark: while it is expected that the estimator $\hat{\mathbf A}_{SDPD}^*({\mathbf W})$ performs better than $\hat{\mathbf A}_{VAR}^*$ (given that it exploits the knowledge of the true spatial matrix ${\mathbf W}$), it is surprising to also see that the estimator $\hat{\mathbf A}_{SDPD}^*(\hat{\mathbf W})$ outperforms the classic estimator $\hat{\mathbf A}_{VAR}^*$, notwithstanding the fact that they function under the same conditions (only the time series ${\mathbf y}_t$ is observed and no spatial matrix is known). Of course, the ASE of the estimator $\hat{\mathbf A}_{SDPD}^*(\hat{\mathbf W})$ slightly increases compared to that of the estimator $\hat{\mathbf A}_{SDPD}^*(\hat{\mathbf W})$, but its variability remains more or less the same.
{'timestamp': '2016-07-18T02:07:32', 'yymm': '1607', 'arxiv_id': '1607.04522', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04522'}
arxiv
\section{Introduction} Many problems, particularly in combinatorics, reduce to asking whether some graph with a given property exists, or alternatively, asking how many such non-isomorphic graphs exist. Such graph search and graph enumeration problems are notoriously difficult, in no small part due to the extremely large number of symmetries in graphs. In practical problem solving, it is often advantageous to eliminate these symmetries which arise naturally due to graph isomorphism: typically, if a graph $G$ is a solution then so is any other graph $G'$ that is isomorphic to $G$. General approaches to graph search problems typically involve either: \emph{generate and test}, explicitly enumerating all (non-isomorphic) graphs and checking each for the given property, or \emph{constrain and generate}, encoding the problem for some general-purpose discrete satisfiability solver (i.e. SAT, integer programming, constraint programming), which does the enumeration implicitly. % In the explicit approach, one typically iterates, repeatedly applying an extend and reduce approach: First \emph{extend} the set of all non-isomorphic graphs with $n$ vertices, in all possible ways, to graphs with $n+1$ vertices; and then \emph{reduce} the extensions to their non-isomorphic (canonical) representatives. % In the constraint based approach, one typically first encodes the problem and then applies a constraint solver in order to produce solutions. The (unknown) graph is represented in terms of Boolean variables describing it as an adjacency matrix $A$. The encoding is a conjunction of constraints that constitute a model, $\varphi_A$, such that any satisfying assignment to $\varphi_A$ is a solution to the graph search problem. Typically, symmetry breaking constraints~\cite{Crawford96,CodishMPS13} are added to the model to reduce the number of isomorphic solutions, while maintaining the correctness of the model. It remains unknown whether a polynomial time algorithm exists to decide the graph isomorphism problem. Nevertheless, finding good graph isomorphism algorithms is critical when exploring graph search and enumeration problems. Recently an algorithm was published by \citeN{Babai15} which runs in time $O\left( {\exp \left( log^c(n) \right) } \right)$, for some constant $c>1$, and solves the graph isomorphism problem. Nevertheless, top of the line graph isomorphism tools use different methods, which are, in practice, faster. \citeN{nauty} introduces an algorithm for graph canonization, and its implementation, called \texttt{nauty}\ (which stands for \emph{no automorphisms, yes?}), is described in \cite{nauty_impl}. % In contrast to earlier works, where the canonical representation of a graph was typically defined to be the smallest graph isomorphic to it (in the lexicographic order), \texttt{nauty}\ introduced a notion which takes structural properties of the graph into account. For details on how \texttt{nauty}~defines canonicity and for the inner workings of the \texttt{nauty}\ algorithm see~\cite{nauty,nauty_impl,hartke_nauty,nautyII}. % In recent years \texttt{nauty}~has gained a great deal of popularity and success. Other, similar tools, are \textsf{bliss}~\cite{bliss} and \textsf{saucy}~\cite{saucy}. The \texttt{nauty}\ graph automorphism tool consists of two main components. (1) a C library, \texttt{nauty}, which may be linked to at runtime, that contains functions applicable to find the canonical labeling of a graph, and (2) a collection of applications, \texttt{gtools}, that implement an assortment of common tasks that \texttt{nauty}\ is typically applied to. % When downloading the tool both components are included. During compilation static library files are created for the C library. These files may be linked to at runtime, and header files are provided which may be included in foreign C code. During compilation, the applications of \texttt{gtools}\ are compiled into a set of command line applications. This paper presents a lightweight Prolog interface to both components of \texttt{nauty}\ which we term \texttt{pl-nauty}\ and \texttt{pl-gtools}. % The implementation of \texttt{pl-nauty}\ is by direct use of Prolog's foreign language interface. The implementation of \texttt{pl-gtools}\ is slightly more complex. Each \texttt{gtools}\ application is run as a child process with the input and output controlled via unix pipes. The \texttt{pl-gtools}\ framework provides a set of general predicates to support this type of application integration. The integration of \texttt{nauty}\ into Prolog facilitates programming with the strengths of the two paradigms: logic programming for solving graph search problems on the one hand, and efficient pruning of (intermediate) solutions modulo graph isomorphism, on the other. % It enables Prolog programs which address graph search problems to apply \texttt{nauty}~natively, through Prolog, in the process of graph search and enumeration. Graphs may be generated non-deterministically and may be canonized deterministically. % It also facilitates the interaction with various graph representations: those used in \texttt{nauty}, and those more natural for use with Prolog. The interface for \texttt{nauty}\ from within Prolog combines well also with other tools and techniques typically applied when addressing graph search problems, such as constraint and SAT based programming. % For example, recent work~\cite{Codish2016}, presents a computer-based proof that the Ramsey number $R(4,3,3)=30$, thus closing a long open problem concerning the value of $R(4,3,3)$. That paper made extensive use of SAT solvers, symmetry breaking techniques, and the \texttt{nauty}\ library. It was this experience that led us to implement \texttt{pl-nauty}. The remaining sections of this paper are organized in the following manner: Section~(\ref{sec:prelim}) introduces the definitions used throughout the paper, as well as the running example of Ramsey graphs. Section~(\ref{sec:pln}) introduces the core of the \texttt{pl-nauty}\ library by examples. Section~(\ref{sec:plg}) details the \texttt{pl-gtools}\ framework, and details the template used to integrate \texttt{gtools}\ applications with Prolog. Section~(\ref{sec:tech}) closes some technical loose ends, including details of supported platforms, package availability, and additional references to source code. Finally, Section~\ref{sec:conclude} concludes. \section{Preliminaries} \label{sec:prelim} A graph $G=(V,E)$ consists of a set of vertices $V=[n]=\set{1,\ldots,n}$ and a set of edges $E\subseteq V \times V$. In the examples presented in this paper graphs are always simple. Meaning that they are undirected, there are no self loops, and no multiple edges. % The tools we present allow also directed graphs and support vertex-coloring. % Two graphs $G=([n],E)$ and $G'=([n],E')$ are said to be isomorphic if the vertices of one graph may be permuted to obtain the other. Namely, if there exists a permutation $\pi\colon[n]\to[n]$ such that $(u,v) \in E \iff (\pi(u),\pi(v)) \in E'$. % % Graph isomorphism is an equivalence relation. As such, it induces equivalence classes on any set of graphs, wherein graphs $G$, $G'$ are in the same equivalence class if $G$ and $G'$ are isomorphic. % The canonical representation of a graph $G$ is some fixed value $can(G)$ such that for every graph $G'$ isomorphic to $G$ we have $can(G) = can(G')$. The running example we use throughout this paper concerns the generation of Ramsey graphs: A $R(s,t;n)$ Ramsey graph, where $s,t,n\in\mathbb{N}$, is a graph $G$ with $n$ vertices such that $G$ contains no clique of size $s$ nor an independent set of size $t$. We denote by ${\cal R}(s,t;n)$ the set of all non-isomorphic Ramsey $R(s,t;n)$ graphs. The Ramsey number $R(s,t)$ is the smallest natural number $n$ for which no $R(s,t;n)$ graph exist. \section{Interfacing Prolog with \texttt{nauty}'s C library} \label{sec:pln} The \texttt{pl-nauty}\ interface is implemented using the foreign language interface of SWI-Prolog~\cite{swipl}. The \texttt{nauty}\ C library is linked with corresponding C code written for Prolog, which involves four low-level Prolog predicates: (1)~\texttt{densenauty/8}, (2)~\texttt{canonic\_graph/6}, (3)~\texttt{isomorphic\_graphs/6}, and (4)~\texttt{graph\_convert/5}. % The experienced \texttt{nauty}\ user will find \texttt{densenauty/8} to be a direct interface to the corresponding C function in \texttt{nauty}. The \texttt{canonic\_graph/6} predicate performs graph canonization only. The \texttt{isomorphic\_graphs/6} predicate tests two graphs for isomorphism, and \texttt{graph\_convert/5} converts between the supported graph formats such as between the \texttt{graph6}~\cite{graph6} format often used in \texttt{nauty}\ and the Boolean adjacency matrices natural in logic programming. We present several examples of the \texttt{pl-nauty}\ library in Prolog. The first two examples revolve around enumerating Ramsey graphs modulo isomorphism. The rest are simple demonstrations of the core \texttt{pl-nauty}\ predicates in various cases. % In the first example we apply a straightforward iterative approach to enumerate all solutions modulo isomorphism. % The second example illustrates how \texttt{nauty}~ integrates into an existing tool-chain, all specified as part of the Prolog process. Here we first construct a constraint model, infused with a partial symmetry breaking predicate. Then, apply the finite domain constraint compiler \textsf{BEE}~\cite{BEE,jair2013} (written in Prolog) to obtain a CNF model, apply a SAT solver (through its Prolog interface), and then generate all solutions of constraint model. At the end of each iteration we apply predicates from the \texttt{pl-nauty}\ library to remove isomorphic solutions. % The core of the code, with an emphasis on using the \texttt{pl-nauty}~library is presented below. The complete code is available for download as part of the \texttt{pl-nauty}~library, in the \verb|examples| directory. \subsection{The First Example: Generate and Test} In the code below, % the predicate \verb!genRamseyGT(S, T, N, Graphs)! iterates starting from the empty graph to generate in \verb!Graphs!, the set of all canonical Ramsey $(S,T;N)$ colorings. We represent graphs as Boolean adjacency matrices: a list of \verb!N! length-\verb!N! lists. % At iteration \verb!I! it takes, \verb!Acc!, the canonical set of Ramsey $(S,T;I)$ colorings computed thus far and calls the predicate \verb!extendRamsey(S, T, I, Acc, NewAcc)! to obtain, \verb!NewAcc!, the canonical set of Ramsey $(S,T;I+1)$ colorings. % {\scriptsize \begin{verbatim} genRamseyGT(S, T, N, Graphs) :- genRamsey(0, S, T, N, [[]], Graphs). genRamsey(I, S, T, N, Acc, Graphs) :- I < N, !, I1 is I+1, extendRamsey(S, T, I, Acc, NewAcc), genRamsey(I1, S, T, N, NewAcc, Graphs). genRamsey(N, _, _, N, Graphs, Graphs). \end{verbatim} } The predicate \verb!extendRamsey(S, T, N, Graphs, NewGraphs)! takes a list, \verb!Graphs! of (canonical) Ramsey $(S,T;N)$ graphs. Then, a new vertex is added in all possible ways to each graph in \verb!Graphs! and those new graphs that are Ramsey $(S,T;N+1)$ colorings are canonized. Finally, the resulting graphs are sorted to remove duplicates, resulting in \verb!NewGraphs!. It is the call to \verb!canonic_graph/3! that interfaces to our Prolog integration of the \texttt{nauty}\ tool. % {\scriptsize \begin{verbatim} extendRamsey(S, T, N, Graphs, NewGraphs) :- N1 is N+1, findall(Canonic, (member(Graph, Graphs), addVertex(Graph, NewGraph), isRamsey(S,T,N1,NewGraph), /* #1 (test)*/ canonic_graph(N1, NewGraph, Canonic) /* #2 (reduce)*/ ), GraphsTmp), sort(GraphsTmp, NewGraphs). \end{verbatim} } The predicate \verb!addVertex(Matrix,ExtendedMatrix)! extends non-deterministically an adjacency \verb!Matrix! with a new vertex by adding a new first row and equal first column. % {\scriptsize \begin{verbatim} addVertex(Matrix,[NewRow|NewRows]) :- NewRow = [0|Xs], addFirstCol(Matrix,Xs,NewRows). addFirstCol([],[],[]). addFirstCol([Row|Rows],[X|Xs],[[X|Row]|NewRows]) :- member(X,[0,1]), addFirstCol(Rows,Xs,NewRows). \end{verbatim} } To complete the example, we illustrate the test predicate \verb!isRamsey(S,T,N,Graph)! which succeeds if the given \verb!Graph! is a Ramsey $(S,T;N)$ coloring. This is so if it is not possible to \verb!choose! \verb!S! vertices from the graph, the edges between which are all ``colored'' 0, or \verb!T! vertices from the graph, the edges between which are all ``colored'' 1. % {\scriptsize \begin{verbatim} isRamsey(S,T,N,Graph) :- forall( choose(N, S, Vs), mono(0, Vs, Graph) ), forall( choose(N, T, Vs), mono(1, Vs, Graph) ). mono(Color, Vs, Graph) :- cliqeEdges(Vs,Graph,Es), maplist(==(Color), Es). cliqeEdges([],_,[]). choose(N,K,C) :- cliqeEdges([I|Is],Graph,Es) :- numlist(1,N,Ns), cliqeEdges(I, Is, Graph, Es0), length(C,K), cliqeEdges(Is, Graph, Es). choose(C,Ns). cliqeEdges(_,[],_,[]). choose([],[]). cliqeEdges(I,[J|Js], Graph, [E|Es]) :- choose([I|Is],[I|Js]) :- nth1(I, Graph, Gi), choose(Is,Js). nth1(J, Gi, E), choose(Is,[_|Js]) :- cliqeEdges(I,Js,Graph,Es). choose(Is,Js). \end{verbatim} } We first demonstrate the application of the \verb!genRamseyGT! to the so called, ``party problem''. What is the smallest number of people that must be invited to a party so that at least three know each other, or at least three do not know each other. This is the smallest $N$ for which there is no $(3,3;N)$ coloring. The following two calls illustrate that there is a single canonical coloring when $N=5$ and none when $N=6$. So, the answer to the party problem (as well-known) is 6. {\scriptsize \begin{verbatim} ?- genRamseyGT(3,3,5,Gs). Gs = [ [[0,1,1,0,0], [1,0,0,1,0], [1,0,0,0,1], [0,1,0,0,1], [0,0,1,1,0]]]. ?- genRamseyGT(3,3,6,Gs). Gs = []. \end{verbatim} } We make three observations regarding the generation of graphs in this example. Consider the predicate \verb!extendRamsey/5!. \begin{enumerate} \item If the call \verb!canonic_graph(N1, NewGraph, Canonic)!, at the line marked \verb!/* #2 */!, is replaced by the line \verb!Canonic = NewGraph!, then all solutions are found, not just the canonical ones. For example, when $N=5$ there are 12 solutions, all of them isomorphic. {\scriptsize \begin{verbatim} ?- genRamseyGT(3,3,5,Gs), length(Gs,M). M = 12. \end{verbatim} } \item If the call to \verb!isRamsey(S,T,N1,NewGraph)!, at the line marked \verb!/* #1 */!, is removed then we generate all non-isomorphic graphs on \verb!N! vertices. For example, {\scriptsize \begin{verbatim} ?- genRamseyGT(3,3,5,Gs), length(Gs,M). M = 34. \end{verbatim} } \item If both changes are made, then we generate all graphs on \verb!N! vertices. {\scriptsize \begin{verbatim} ?- genRamseyGT(3,3,5,Gs), length(Gs,M). M = 1024. \end{verbatim} } \end{enumerate} We now demonstrate the application of the \verb!genRamseyGT! to generate incrementally all non-isomorphic $(3,5;N)$ Ramsey colorings. It is known \cite{Rad2014} that $R(3,5) = 14$. Table~(\ref{tab:35n}) summarizes the enumeration of all non-isomorphic $(3,5;N)$ colorings graphs. The first row indicates the number of (non-isomorphic) colorings generated. The next rows detail the time (in seconds) to compute these colorings and the time spent in the calls to \verb!canonic_graph!. It is notable that the time spent to reduce solutions modulo isomorphism using \texttt{nauty}\ is negligible. \begin{table}[t] \centering {\tiny \begin{tabular}{c|cccccccccccccc} $n$ & $1$ & $2$ & $3$ & $4$ & $5$ & $6$ & $7$ & $8$ & $9$ & $10$ & $11$ & $12$ & $13$ & $14$ \\ \hline $|{\cal R}(3,5;n)|$ & 1 & 2 & 3 & 7 & 13 & 32 & 71 & 179 & 290 & 313 & 105 & 12 & 1 & 0 \\ time (sec) & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.03 & 0.20 & 0.90 & 4.66 & 16.61 & 39.24 & 52.72 & 55.75 & 56.20 \\ nauty (sec) & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.01 & 0.02 & 0.06 & 0.09 & 0.11 & 0.11 & 0.11 & 0.11 \end{tabular} } \caption{Enumerating $R(3,5;n)$ graphs: Generate, Test \& Reduce.} \label{tab:35n} \end{table} To summarize this section, we stress that this is a toy application with the intention to illustrate an application of the integration of Prolog with the \texttt{nauty}\ package. % A more elaborate solution of this problem would, for example, combine the calls {\scriptsize \begin{verbatim} addVertex(Graph, NewGraph), isRamsey(S,T,N1,NewGraph) \end{verbatim} } in \verb!extendRamsey! to add edges connecting the new vertex to the rest of the graph incrementally so as not to violate the \verb!isRamsey! condition. This combination could also perform various propagation based optimizations. \subsection{The Second Example: Constrain and Generate} In the code below, % the predicate \verb!genRamseyCG(S, T, N, Graphs)! encodes an instance \verb!ramsey(S,T,N)! to a finite domain constraint model. We adopt \textsf{BEE}\ ~\cite{BEE,jair2013} for this purpose. The call to \verb!encode/3! generates a constraint model, \verb!Constraints! and the $\mathtt{N\times N}$ \verb!Matrix! of Boolean (Prolog) variables. The \verb!Matrix! structure serves as a mapping between the instance variables, which talks about the search for Ramsey colorings, and the \verb!Constraints! variables. It specifies the connection between variables in the constraint model and edges in the unknown graph we are searching for. The call to \verb!bCompile/2! compiles the constraints to a corresponding \verb!CNF!. The call to \verb!solveAll/3! iterates with the underlying SAT solver to provide all satisfying \verb!Assignments! of the \verb!CNF! (modulo the variables of interest in the list \verb!Booleans!). Satisfying assignments are then decoded back to the world of graphs in the call to \verb!decode/3!, and finally it is here that we call on the predicate \verb!canonic_graph/3! from the \texttt{pl-nauty}\ interface to restrict solutions to their canonical forms and remove isomorphic solutions by sorting these. {\scriptsize \begin{verbatim} genRamseyCG(S, T, N, Graphs) :- encode(ramsey(S,T,N), Matrix, Constraints), bCompile(Constraints,CNF), projectVariables(Matrix, Booleans), solveAll(CNF,Booleans,Assignments), decode(Assignments,Matrix,Graphs0), maplist(canonic_graph(N), Graphs0, Graphs1), sort(Graphs1, Graphs). \end{verbatim} } The predicate \verb!encode/3! is presented below. It first creates an $\mathtt{N\times N}$ adjacency \verb!Matrix! with Boolean variables representing the object of the search for a Ramsey(S,T;N) graph. It then imposes three sets of constraints: (1) the call to \verb!lex_star/2! constrains the rows of \verb!Matrix! to be pairwise lexicographically ordered. This implements the symmetry break described in~\cite{CodishMPS13}; (2) the first call to \verb!no_clique/4! constrains the graph represented by \verb!Matrix! to contain no independent set of size \texttt{S}, and (3) the second call to \verb!no_clique/4! constrains the graph represented by \verb!Matrix! to contain no clique of size \texttt{T}. The full details of the example are available for download as part of the \texttt{pl-nauty}~library, in the \verb|examples| directory. {\scriptsize \begin{verbatim} encode(ramsey(S,T,N), map(Matrix), Constraints) :- adj_matrix_create(N, Matrix), lex_star(Matrix, Cs1-Cs2), /* #1 */ no_clique(0, S, Matrix, Cs2-Cs3), /* #2 */ no_clique(1, T, Matrix, Cs3-Cs4), /* #3 */ Cs4 = [], Constraints = Cs1. \end{verbatim} } The following illustrates the \textsf{BEE}\ constraint model, with the associated adjacency matrix, produced by a call to the \texttt{encode/3} predicate for a Ramsey $R(3,3;5)$ instance. Note that the elements on the diagonal of the matrix are $-1$ which is how \textit{false} is represented in \textsf{BEE}. The constraint model consists of three types of constraints corresponding to the three annotated calls in \verb!encode/3!. {\scriptsize \begin{verbatim} [[-1,A,B,C,D], [A,-1,E,F,G], [B,E,-1,H,I], [C,F,H,-1,J], [D,G,I,J,-1]] bool_arrays_lex([B,C,D],[E,F,G]), bool_array_or([A,B,E]), bool_array_or([-A,-B,-E]), bool_arrays_lex([A,B,D],[F,H,J]), bool_array_or([A,C,F]), bool_array_or([-A,-C,-F]), bool_arrays_lex([A,F,G],[B,H,I]), bool_array_or([A,D,G]), bool_array_or([-A,-D,-G]), bool_arrays_lex([A,E,F],[D,I,J]), bool_array_or([B,C,H]), bool_array_or([-B,-C,-H]), bool_arrays_lex([B,E,I],[C,F,J]), bool_array_or([B,D,I]), bool_array_or([-B,-D,-I]), bool_arrays_lex([C,F,H],[D,G,I]), bool_array_or([C,D,J]), bool_array_or([-C,-D,-J]), bool_array_or([E,F,H]), bool_array_or([-E,-F,-H]), bool_array_or([E,G,I]), bool_array_or([-E,-G,-I]), bool_array_or([F,G,J]), bool_array_or([-F,-G,-J]), bool_array_or([H,I,J]), bool_array_or([-H,-I,-J]) \end{verbatim} } Table~(\ref{tab:35n_sat}) summarizes the enumeration of all non-isomorphic $(3,5;N)$ colorings graphs using the constrain and generate approach. The first row indicates the number of (non-isomorphic) colorings generated. The second row indicates the number of colorings found when solving the constraint model (with the partial symmetry break). The next rows detail the time (in seconds) to compute these colorings and the time spent in the calls to \verb!canonic_graph!. It is notable that the time spent to reduce solutions modulo isomorphism using \texttt{nauty}\ is negligible. \begin{table}[h] \centering {\tiny \begin{tabular}{ c|cccccccccccccc} $n$ & $1$ & $2$ & $3$ & $4$ & $5$ & $6$ & $7$ & $8$ & $9$ & $10$ & $11$ & $12$ & $13$ & $14$ \\ \hline $|{\cal R}(3,5;n)|$ & 1 & 2 & 3 & 7 & 13 & 32 & 71 & 179 & 290 & 313 & 105 & 12 & 1 & 0 \\ $\#SAT$ & 1 & 2 & 3 & 7 & 18 & 63 & 255 & 1100 & 3912 & 7319 & 3806 & 272 & 2 & 0 \\ time (sec) & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.02 & 0.02 & 0.12 & 0.74 & 1.97 & 1.16 & 1.15 & 0.07 \\%$< 3$ sec \\ nauty (sec) & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.01 & 0.05 & 0.16 & 0.05 & 0.00 & 0.00 & 0.00 \end{tabular} } \caption{Enumerating $R(3,5;n)$ graphs: Constrain, Generate \& Reduce.} \label{tab:35n_sat} \end{table} \subsection{The \texttt{graph\char`_convert/5} predicate} The \texttt{graph\char`_convert/5} predicate performs conversions between the different graph formats that are supported by \texttt{pl-nauty}. Supported formats include: adjacency matrices, adjacency lists, edge lists, and the \texttt{graph6} format. % As an example, to convert a graph, or a list of graphs, from the \texttt{graph6} format, to Prolog's adjacency matrix format: {\scriptsize \begin{verbatim} ?- Graph = `DqK', graph_convert(5, graph6_atom, adj_matrix, Graph, AdjMatrix). Graph = `DqK', AdjMatrix = [[0,1,1,0,0], [1,0,0,1,0], [1,0,0,0,1], [0,1,0,0,1], [0,0,1,1,0]] \end{verbatim} } % {\scriptsize \begin{verbatim} ?- Graphs = [`DRo',`Dbg',`DdW',`DLo',`D[S',`DpS',`DYc',`DqK',`DMg',`DkK',`Dhc',`DUW'], maplist(graph_convert(5, graph6_atom, adj_matrix), Graphs, AdjMatrices). Graphs = [`DRo',`Dbg',`DdW',`DLo',`D[S',`DpS',`DYc',`DqK',`DMg',`DkK',`Dhc',`DUW'], AdjMatrices = [[[0,0,1,0,1],[0,0,0,1,1],[1,0,0,1,0],[0,1,1,0,0],[1,1,0,0,0]], [[0,1,0,0,1],[1,0,0,1,0],[0,0,0,1,1],[0,1,1,0,0],[1,0,1,0,0]], [[0,1,0,1,0],[1,0,0,0,1],[0,0,0,1,1],[1,0,1,0,0],[0,1,1,0,0]], [[0,0,0,1,1],[0,0,1,0,1],[0,1,0,1,0],[1,0,1,0,0],[1,1,0,0,0]], [[0,0,1,1,0],[0,0,1,0,1],[1,1,0,0,0],[1,0,0,0,1],[0,1,0,1,0]], [[0,1,1,0,0],[1,0,0,0,1],[1,0,0,1,0],[0,0,1,0,1],[0,1,0,1,0]], [[0,0,1,0,1],[0,0,1,1,0],[1,1,0,0,0],[0,1,0,0,1],[1,0,0,1,0]], [[0,1,1,0,0],[1,0,0,1,0],[1,0,0,0,1],[0,1,0,0,1],[0,0,1,1,0]], [[0,0,0,1,1],[0,0,1,1,0],[0,1,0,0,1],[1,1,0,0,0],[1,0,1,0,0]], [[0,1,0,1,0],[1,0,1,0,0],[0,1,0,0,1],[1,0,0,0,1],[0,0,1,1,0]], [[0,1,0,0,1],[1,0,1,0,0],[0,1,0,1,0],[0,0,1,0,1],[1,0,0,1,0]], [[0,0,1,1,0],[0,0,0,1,1],[1,0,0,0,1],[1,1,0,0,0],[0,1,1,0,0]]] \end{verbatim} } \subsection{The \texttt{canonic\_graph/6} predicate} The \texttt{canonic\_graph/6} predicate performs graph canonization and it takes the form \texttt{canonic\_graph(N, InputFmt, OutputFmt, Graph, Perm, Canonic)} where \texttt{InputFmt} is the format of the \texttt{N} vertex input graph (\texttt{Graph}), \texttt{OutputFmt} is the format of the canonical graph (\texttt{Canonic}), and \texttt{Perm} is the permutation whose application to the input graph renders the canonical representative. For example: {\scriptsize \begin{verbatim} ?- N = 5, Graph = [[0,1,0,0,0], [1,0,1,0,1], [0,1,0,1,0], [0,0,1,0,1], [0,1,0,1,0]], canonic_graph(N,adj_matrix,adj_matrix,Graph,Perm,Canonic). N = 5, Graph = [[0,1,0,0,0],[1,0,1,0,1],[0,1,0,1,0],[0,0,1,0,1],[0,1,0,1,0]], Canonic = [[0,0,0,0,1],[0,0,0,1,1],[0,0,0,1,1],[0,1,1,0,0],[1,1,1,0,0]], Perm = [1, 5, 2, 4, 3] \end{verbatim} } A compact version of \texttt{canonic\_graph/6} is also included in \texttt{pl-nauty}\ in the form of the predicate \texttt{canonic\char`_graph/3}. The predicate \texttt{canonic\char`_graph/3} takes the form \texttt{canonic\char`_graph(NVert, Graph, Canonic)} and it is equivalent to \texttt{canonic\char`_graph(NVert, adj\char`_matrix, adj\char`_matrix, Graph, \char`_, Canonic)}. For example: {\scriptsize \begin{verbatim} ?- N = 5, Graph = [[0,1,0,0,0], [1,0,1,0,1], [0,1,0,1,0], [0,0,1,0,1], [0,1,0,1,0]], canonic_graph(N,Graph,Canonic). N = 5, Graph = [[0,1,0,0,0],[1,0,1,0,1],[0,1,0,1,0],[0,0,1,0,1],[0,1,0,1,0]], Canonic = [[0,0,0,0,1],[0,0,0,1,1],[0,0,0,1,1],[0,1,1,0,0],[1,1,1,0,0]] \end{verbatim} } \subsection{The \texttt{isomorphic\char`_graphs/6} predicate} The \texttt{isomorphic\char`_graphs/6} predicate tests for graph isomorphism. It takes the form: \texttt{isomorphic\char`_graphs(N, Graph1, Graph2, Perm, Canonic, Opts)} and tests if the two \texttt{N} vertex input graphs, \texttt{Graph1} and \texttt{Graph2} are isomorphic via a permutation \texttt{Perm}. If they are then \texttt{Canonic} is the canonical form they share. The predicate takes a list \texttt{Opts} of options to customize the behavior of this predicate. Options include any of the following: \texttt{fmt1(Fmt1)} the format of \texttt{Graph1}, \texttt{fmt2(Fmt2)} the format of \texttt{Graph2}, \texttt{cgfmt(CgFmt)} the format of \texttt{Canonic}. % In the case where \texttt{Graph1} and \texttt{Graph2} are not isomorphic the predicate will fail silently. % For example: {\scriptsize \begin{verbatim} ?- N = 5, Graph1 = [[0,1,0,1,1], [1,0,1,0,0], [0,1,0,1,0], [1,0,1,0,1], [1,0,0,1,0]], Graph2 = [[0,1,0,1,1], [1,0,1,0,0], [0,1,0,0,1], [1,0,0,0,1], [1,0,1,1,0]], isomorphic_graphs(N, Graph1, Graph2, Perm, Canonic, []). N = 5, Graph1 = [[0,1,0,1,1],[1,0,1,0,0],[0,1,0,1,0],[1,0,1,0,1],[1,0,0,1,0]], Graph2 = [[0,1,0,1,1],[1,0,1,0,0],[0,1,0,0,1],[1,0,0,0,1],[1,0,1,1,0]], Perm = [1,2,3,5,4], Canonic = [[0,1,0,1,0],[1,0,0,0,1],[0,0,0,1,1],[1,0,1,0,1],[0,1,1,1,0]] ?- N = 5, Graph1 = [[0,1,1,0,1],[1,0,0,0,1],[1,0,0,0,0],[0,0,0,0,0],[1,1,0,0,0]], Graph2 = [[0,1,0,0,1],[1,0,1,1,0],[0,1,0,0,1],[0,1,0,0,1],[1,0,1,1,0]], isomorphic_graphs(N, Graph1, Graph2, Perm, Canonic, []). false. \end{verbatim} } \subsection{The \texttt{densenauty/8} predicate} Most of the core predicates of \texttt{pl-nauty}\, and many of the examples described above are based on the \texttt{densenauty/8} predicate. The \texttt{densenauty/8} predicate is a direct interface to the \texttt{nauty}\ C library function of the same name. The predicate is called in a similar fashion to its counterpart in the \texttt{nauty}\ C library. A complete documentation of \texttt{densenauty/8} may be found in the source code provided with \texttt{pl-nauty}, and in the \texttt{nauty}\ user guide \cite{nauty_guide}. Briefly, the predicate \texttt{densenauty/8} takes the following form: \begin{verbatim} densenauty(NVert, Graph, Labeling, Partition, Permutation, Orbits, Canonic, Opts) \end{verbatim} where \texttt{NVert} is the number of vertices in the input graph, \texttt{Graph} is the input graph, \texttt{Labeling}, \texttt{Partition} and \texttt{Orbits} are the labeling, partition and orbits of the input graph, as described in the \texttt{nauty}\ user guide \cite{nauty_guide}, \texttt{Canonic} is the canonical form of the input graph, and \texttt{Permutation} is the permutation of the nodes of the input graph which may be applied to obtain the Canonic representative. The last argument, \texttt{Opts} is used to modify the behavior of \texttt{densenauty}. For example, it may be used to control the format of the input graph, and Canonic representative. \section{Interfacing Prolog and \texttt{gtools}} \label{sec:plg} The \texttt{nauty}\ graph automorphism tool comes with a collection of applications called \texttt{gtools}, that implement an assortment of common tasks that \texttt{nauty}\ is typically applied to. During installation (of \texttt{nauty}) these are compiled into a set of command line applications. % These applications cannot simply be loaded using the foreign language interface. Each application is like a black box. We do not wish to access its source code. % One straightforward approach to integrate \texttt{gtools}\ with Prolog is to run each such application from within Prolog, write its output to a temporary file, and then to read the file, and continue with the task that the Prolog program is addressing. A more elegant solution makes use of unix pipes to skip that intermediate step of writing and reading from files. The output is directly read/written via Prolog. The voodoo is using pipes (which are like in-memory files). We have implemented a Prolog library called \texttt{pl-gtools}, which provides a framework for calling the applications in \texttt{gtools}\ using unix pipes. % The \texttt{pl-gtools}\ framework supports two types of \texttt{gtools}\ applications which take any number of command line arguments and write their output to standard output. The first type does not require any input, and the second requires some form of input (from standard input). % We present a general template to support the two ``sides'' of the pipe: a child predicate (which typically executes a \texttt{gtools}\ command), and a parent predicate (which typically reads the output of the child). The framework includes predicates: % \verb!gtools_exec/6! and \verb!gtools_fetch/2!, and two additional predicates for applications which respectively require uni- and bi-directional communication: \verb!gtools_fork_exec/2! and \verb!gtools_fork_exec_bidi/2!. % For uni-directional communication, a call to \verb!gtools_fork_exec(Parent, Child)! will fork and execute the \texttt{Parent} goal as the parent process and the \texttt{Child} goal as the child process. It assumes that both \texttt{Parent} and \texttt{Child} take an additional argument which is unified with the corresponding input/output streams (to support communication from child to parent). % For bi-directional communication, a call to \verb!gtools_fork_exec_bidi(Parent, Child)! is exactly the same, except that the \texttt{Parent} and \texttt{Child} take two additional arguments to support two way communication. The predicate \verb!gtools_fetch/2! reads the next line from the output stream of the child and converts it to an atom. When the end of the stream is reached then the predicate fails. % A call to \verb!gtools_exec/6! takes the form {\small \texttt{gtools\_exec(NautyDir, Cmd, Args, InputStream, OutputStream, ErrorStream)} } where: \verb!NautyDir! is the directory in the file system which contains the \texttt{gtools}\ applications, \verb!Cmd! is the name of the \texttt{gtools}\ command that we which to execute, and \verb!Args! is its argument list. The final three arguments specify the standard input, output and error streams. % The call to \verb!gtools_exec/6! invokes the \texttt{exec/1} predicate of SWI-Prolog, replacing the current process image with \texttt{Cmd} and its \texttt{Args}. We present two example uses of \texttt{pl-gtools}. The first, calls \texttt{geng} from \texttt{gtools}, which iterates over all non-isomorphic graphs with a given number of vertices. The second, calls \texttt{shortg} from \texttt{gtools}, which reduces a set of graphs to non-isomorphic members. \subsection{Example 1: \texttt{geng}} \label{sec:geng} This example illustrates how the framework is applied for an application which reads no input. % The \texttt{gtools}\ application \texttt{geng} receives an argument \texttt{n} and outputs one line for each non-isomorphic graph with $n$ vertices. % Its Prolog implementation consists of three predicates: \texttt{geng/2}, \texttt{parent\_geng/2} and \texttt{child\_geng/2}. The predicate \texttt{geng/2} is the main predicate which backtracks over all results of the \texttt{gtools}\ application. The predicates \texttt{parent\_geng/2} and \texttt{child\_geng/2} implement respectively the parent and child sides of the pipe. {\scriptsize \begin{verbatim} geng(N, Graph) :- gtools_fork_exec(geng:parent_geng(Graph), geng:child_geng(N)). parent_geng(Graph,Read) :- gtools_fetch(Read, Graph). child_geng(N,Stream) :- gtools_exec(`nauty26r3', geng, [`-q', N], _, Stream, _). \end{verbatim} } \subsection{Example 2: \texttt{shortg}} This example illustrates how the framework is applied for an application which reads from standard input. % The \texttt{shortg} application reads a list of graphs in the \texttt{graph6} format~\cite{graph6} from standard input, and removes all isomorphic duplicates, writing to standard output. It can be applied as follows: After integrating \texttt{shortg} with \texttt{pl-gtools}\ it could be called from Prolog like so: {\scriptsize \begin{verbatim} ?- InputGraphs = [`DRo',`Dbg',`DdW', `DLo',`D[S',`DpS', `DYc',`DqK',`DMg', `DkK',`Dhc',`DUW'], shortg(InputGraphs, OutputGraphs). InputGraphs = [`DRo',`Dbg',`DdW',`DLo',`D[S',`DpS', `DYc',`DqK' | ... ], OutputGraphs = [`DqK']. \end{verbatim} } The implementation of \texttt{shortg} in Prolog consists of three predicates and is very similar to that for \texttt{geng} except that communication between the child and parent processes is bi-directional. {\scriptsize \begin{verbatim} shortg(In, Out) :- gtools_fork_exec_bidi(shortg:parent_shortg(In, Out), shortg:child_shortg). parent_shortg(In, Out, PRead, PWrite) :- maplist(writeln(PWrite), In), flush_output(PWrite), close(PWrite), findall(O, gtools_fetch(PRead, O), Out), close(PRead). child_shortg(CRead, CWrite) :- gtools_exec(`nauty26r3', shortg, [`-q'], CRead, CWrite, _). \end{verbatim} } In this example, \texttt{shortg/2} takes two arguments: \texttt{In} a list of input graphs in the \texttt{graph6} format, to be reduced modulo isomorphism, and \texttt{Out} will be unified with the set of reduced graphs. The predicate calls the \texttt{gtools\_fork\_exec\_bidi/2} predicate. Pipes are opened to setup two way communication between the parent and child. Two additional predicates are implemented: one for the parent process and one for the child process. Each predicate takes, as its last two arguments the read and write ends of the pipes, so communication may be established. In our case, the parent writes the set of input graphs to the write end of the pipe, and then reads the results from the read end of the child's pipe. The child calls \texttt{gtools\_exec/6}, and executes \texttt{shortg/2}. \section{Technical Details} \label{sec:tech} A short overview of some technical details regarding \texttt{pl-nauty}\ and \texttt{pl-gtools}\ follows. The package containing \texttt{pl-nauty}\ and \texttt{pl-gtools}\ is available for download from the \texttt{pl-nauty}\ homepage at: \url{http://www.cs.bgu.ac.il/~frankm/plnauty}. The package contains a \texttt{README} file, which contains usage and installation instructions, as well as an \texttt{examples} directory containing the examples discussed in this paper. The C code for \texttt{pl-nauty}\ may be found in the \texttt{src} directory. Also in the \texttt{src} directory are the two module files for \texttt{pl-nauty}\ and \texttt{pl-gtools}. Both \texttt{pl-nauty}\ and \texttt{pl-gtools}\ were compiled and tested on Debian Linux and Ubuntu Linux using the 7.x.x branch of SWI-Prolog. It is important to mention that both \texttt{pl-nauty}\ and \texttt{pl-gtools}\ contain Linux specific features, and are oriented towards SWI-Prolog. It should also be noted that \texttt{pl-nauty}\ is not thread-safe, for reasons of performance. If you require a thread-safe version of \texttt{pl-nauty}\ you should synchronize calls to the predicates of the \texttt{pl-nauty}\ module. \section{Conclusion} \label{sec:conclude} We have presented, and made available, a Prolog interface to the core components of the \texttt{nauty}~graph-automorphism tool~\cite{nauty} which is often cited as ``The world's fastest isomorphism testing program'' (see for example {\small\url{http://www3.cs.stonybrook.edu/~algorith/implement/nauty/implement.shtml}}). The contribution of the paper is in the utility of the tool which we expect to be widely used. The tool facilitates programming with the strengths of two paradigms: logic programming for solving graph search problems on the one hand, and efficient pruning of (intermediate) solutions modulo graph isomorphism, on the other. % It enables Prolog programs which address graph search problems to apply \texttt{nauty}~natively, through Prolog, in the process of graph search and enumeration. Graphs may be generated non-deterministically and may be canonized deterministically. %
{'timestamp': '2016-08-02T02:11:05', 'yymm': '1607', 'arxiv_id': '1607.04829', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04829'}
arxiv
\section{Handling batch insertions} In this section, we study the dynamic DFS tree problem in the batch insertion setting. The goal of this section is to prove Theorem \ref{batch-ins}. Our algorithm basically follows the same framework for fully dynamic DFS proposed in \cite{baswana2016dynamic}. Since we are only interested in the dynamic DFS tree problem in the batch insertion setting, the algorithms \textsf{BatchInsert} and \textsf{DFS} presented below is a moderate simplification of the original algorithm in \cite{baswana2016dynamic}, by directly pruning those details unrelated to insertions. \begin{algorithm}[H] \caption{\textsf{BatchInsert}} \KwData{a DFS tree $T$ of $G$, set of insertions $U$} \KwResult{a DFS tree $T^*$ of $G + U$} Add each inserted vertex $v$ into $T$, set $\mathit{par}(v) = r$\; Initialize $L(v)$ to be $\emptyset$ for each $v$\; Add each inserted edge $(u, v)$ to $L(u)$ and $L(v)$\; Call $\mathrm{\textsf{DFS}}(r)$\; \end{algorithm} \begin{algorithm}[H] \caption{\textsf{DFS}} \KwData{a DFS tree $T$ of $G$, the entering vertex $v$} \KwResult{a partial DFS tree} Let $u = v$\; \While{$\mathit{par}(u)$ is not visited} { Let $u = \mathit{par}(u)$\; } Mark $\mathit{path}(u, v)$ to be visited\; Let $(w_1, \dots, w_t) = \mathit{path}(u, v)$\; \For{$i \in [t]$} { \If{$i \ne t$} { Let $\mathit{par}^*(w_i) = w_{i + 1}$\; } \For{child $x$ of $w_i$ in $T$ except $w_{i + 1}$} { Let $(y, z) = Q(T(x), u, v)$, where $y \in \mathit{path}(u, v)$\; Add $z$ into $L(y)$\; } } \For{$i \in [t]$} { \For{$x \in L(w_i)$} { \If{$x$ is not visited} { Let $\mathit{par}^*(x) = w_i$\; Call $\mathrm{\textsf{DFS}}(x)$\; } } } \end{algorithm} In Algorithm \textsf{BatchInsert}, we first attach each inserted vertex to the super root $r$, and pretend it has been there since the very beginning. Then only edge insertions are to be considered. All inserted edges are added into the reduced adjacency lists of corresponding vertices. We then use \textsf{DFS}{} to traverse the graph starting from $r$ based on $T$, $L$, and build the new DFS tree while traversing the entire graph and updating the reduced adjacency lists. In Algorithm \textsf{DFS}, the new DFS tree is built in a recursive fashion. Every time we enter an untouched subtree, say $T(u)$, from vertex $v \in T(u)$, we change the root of $T(u)$ to $v$ and go through $\mathit{path}(v, u)$; i.e., we wish to reverse the order of $\mathit{path}(u, v)$ in $T^*$. One crucial step behind this operation is that we need to find a new root for each subtree $T(w)$ originally hanging on $\mathit{path}(u, v)$. The following lemma tells us where the $T(w)$ should be rerooted on $\mathit{path}(u, v)$ in $T^*$. \begin{lemma}[\cite{baswana2016dynamic}] \label{feasible_edge} Let $T^*$ be a partially constructed DFS tree, $v$ the current vertex being visited, $w$ an (not necessarily proper) ancestor of $v$ in tree $T^*$, and $C$ a connected component of the subgraph induced by unvisited vertices. If there are two edges $e$ and $e'$ from $C$ incident on $v$ and $w$, then it is sufficient to consider only $e$ during the rest of the DFS traversal. \end{lemma} Let $Q(T(w), u, v)$ be the edge between the highest vertex on $\mathit{path}(u, v)$ incident to a vertex in subtree $T(w)$, and the corresponding vertex in $T(w)$. $Q(T(w), u, v)$ is defined to be $\mathsf{Null}$ if such an edge does not exist. By Lemma \ref{feasible_edge}, it suffices to ignore all other edges but just keep the edge returned by $Q(T(w), u, v)$; this is because we have reversed the order of $\mathit{path}(u, v)$ in $T^*$ and thus $Q(T(w), u, v)$ connects to the lowest possible position in $T^*$. Hence $T(w)$ should be rerooted at $Q(T(w), u, v)$. Denote $(x, y)$ to be the edge returned by $Q(T(w), u, v)$ where $x \in \mathit{path}(u, v)$, and then we add $y$ into $L(x)$. After finding an appropriate entering edge for each hanging subtree, we process each vertex $v \in \mathit{path}(u, v)$ in ascending order of depth (with respect to tree $T$). For every unvisited $w \in L(v)$, we set $\mathit{par}^*(w) = v$, and recursively call $\mathrm{\textsf{DFS}}(w)$. \begin{theorem} \textsf{BatchInsert}{} correctly reports a feasible DFS tree $T^*$ of graph $G + U$. \end{theorem} \begin{proof} We argue that in a single call $\mathrm{\textsf{DFS}}(v)$, where $u$ is the highest unvisited ancestor of $v$, every unvisited (at the moment of being enumerated) subtree $T(w)$ hanging from $\mathit{path}(u, v)$, as well as every vertex on $\mathit{path}(u, v)$ except $v$, will be assigned an appropriate parent such that these parent-child relationships constitute a DFS tree of $G$ at the termination of \textsf{BatchInsert}{}. When the traversal reaches $v$, the entire $T(u)$ is untouched, or else $u$ would have been marked by a previous visit to some vertex in $T(u)$. We could therefore choose to go through $\mathit{path}(v, u)$ to reach $u$ first. By Lemma~\ref{feasible_edge}, if a subtree $T(w)$ is reached from some vertex on $\mathit{path}(u, v)$, it suffices to consider only the edge $Q(T(w), u, v)$. After adding the query results of all hanging subtrees into the adjacency lists of vertices on $\mathit{path}(u, v)$, every hanging subtree visited from some vertex $x$ on $\mathit{path}(u, v)$ should be visited in a correct way through edges in $L(x)$ solely. Since every vertex will eventually be assigned a parent, \textsf{BatchInsert}{} does report a feasible DFS tree of graph $G + U$. \end{proof} For now we have not discussed how to implement $Q(T(w), u, v)$ and the above algorithm only assumes blackbox queries to $Q(T(\cdot), \cdot, \cdot)$. The remaining problem is to devise a data structure $\mathcal{D}$ to answer all the queries demanded by Algorithm \textsf{DFS} in $O(n)$ total time. We will show in the next section that there exists a data structure $\mathcal{D}$ with the desired performance, which is stated as the following lemma. \begin{lemma} \label{query_time} There exists a data structure $\mathcal{D}$ with preprocessing time $O\left(\min\{m \log n, n^2\}\right)$ time and space complexity $O\left( \min \{ m \log n, n^2 \} \right)$ that can answer all queries $Q(T(w), x, y)$ in a single run of \textsf{BatchInsert}{} in $O(n)$ time. \end{lemma} \begin{proof}[Proof of Theorem \ref{batch-ins}] By Lemma~\ref{query_time}, the total time required to answer queries is $O(n)$. The total size of reduced adjacency lists is bounded by $O(n + |U|)$, composed by $O(|U|)$ edges added in \textsf{BatchInsert}{} and $O(n)$ added during DFS. Thus, the total time complexity of $\textsf{BatchInsert}$ is $O(n + |U|)$. During preprocessing, we use depth first search on $G$ to get the initial DFS tree $T$, and build $\mathcal{D}$ in time $O\left( \min \{ m \log n, n^2 \} \right)$. The total time for preprocessing is $O\left( \min \{ m \log n, n^2 \} \right)$. \end{proof} \section{Introduction} Depth First Search (DFS) is one of the most renowned graph traversal techniques. After Tarjan's seminal work~\cite{tarjan1972depth}, it demonstrates its power by leading to efficient algorithms to many fundamental graph problems, e.g., biconnected components, strongly connected components, topological sorting, bipartite matching, dominators in directed graph and planarity testing. Real world applications often deal with graphs that keep changing with time. Therefore it is natural to study the dynamic version of graph problems, where there is an online sequence of updates on the graph, and the algorithm aims to maintain the solution of the studied graph problem efficiently after seeing each update. The last two decades have witnessed a surge of research in this area, like connectivity~\cite{eppstein1997sparsification,henzinger1999randomized,holm2001poly,kapron2013dynamic}, reachability~\cite{roditty2008improved,sankowski2004dynamic}, shortest path~\cite{demetrescu2004new,roditty2012dynamic}, bipartite matching~\cite{baswana2011fully,neiman2016simple}, and min-cut~\cite{thorup2001fully}. We consider the dynamic maintenance of DFS trees in undirected graphs. As observed by Baswana et al.~\cite{baswana2016dynamic} and Nakamura and Sadakane~\cite{nakamura2017space}, the {\em incremental} setting, where edges/vertices are added but never deleted from the graph, is arguably easier than the {\em fully dynamic} setting where both kinds of updates can happen --- in fact, they provide algorithms for incremental DFS with $\tilde{O}(n)$ worst case update time, which is close to the trivial $\Omega(n)$ lower bound when it is required to explicitly report a DFS tree after each update. {\bf\em So, is there an algorithm that requires nearly linear preprocessing time and space, and reports a DFS tree after each incremental update in $O(n)$ time?} In this paper, we study the problem of maintaining a DFS tree in the incremental setting, and give an affirmative answer to this question. \subsection{Previous works on dynamic DFS} Despite the significant role of DFS tree in static algorithms, there is limited progress on maintaining a DFS tree in the {\em dynamic} setting. Many previous works focus on the {\em total time} of the algorithm for any arbitrary updates. Franciosa et al.~\cite{franciosa1997incremental} designed an incremental algorithm for maintaining a DFS tree in a DAG from a given source, with $O(mn)$ total time for an arbitrary sequence of edge insertions; Baswana and Choudhary~\cite{baswana2015dynamic} designed a decremental algorithm for maintaining a DFS tree in a DAG with expected $O(mn\log n)$ total time. For undirected graphs, Baswana and Khan~\cite{baswana2014incremental} designed an incremental algorithm for maintaining a DFS tree with $O(n^2)$ total time. These algorithms used to be the only results known for the dynamic DFS tree problem. However, none of these existing algorithms, despite that they are designed for only a partially dynamic environment, achieves a worst case bound of $o(m)$ on the update time. That barrier is overcome in the recent breakthrough work of Baswana et al.~\cite{baswana2016dynamic}, they provide, for undirected graphs, a fully dynamic algorithm with worst case $O(\sqrt{mn} \log^{2.5} n)$ update time, and an incremental algorithm with worst case $O(n \log^{3} n)$ update time. Due to the rich information in a DFS tree, their results directly imply faster worst case fully dynamic algorithms for subgraph connectivity, biconnectivity and 2-edge connectivity. The results of Baswana et al.~\cite{baswana2016dynamic} suggest a promising way to further improve the worst case update time or space consumption for those fully dynamic algorithms by designing better dynamic algorithms for maintaining a DFS tree. In particular, based on the framework by Baswana et al.~\cite{baswana2016dynamic}, Nakamura and Sadakane~\cite{nakamura2017space} propose an algorithm which takes $O(\sqrt{mn} \log^{1.75} n / \sqrt{\log \log n})$ time per update in the fully dynamic setting and $O(n \log n)$ time in the incremental setting, and $O(m \log n)$ bits of space. \subsection{Our results} In this paper, following the approach of~\cite{baswana2016dynamic}, we improve the update time for the incremental setting, also studied in~\cite{baswana2016dynamic}, by combining a better data structure, a novel tree-partition lemma by Duan and Zhang~\cite{duan2016improved} and the fractional-cascading technique by Chazelle and Guibas~\cite{chazelle1986fractional,chazelle1986fractional2}. For any set $U$ of incremental updates (insertion of a vertex/an edge), we let $G + U$ denote the graph obtained by applying the updates in $U$ to the graph $G$. Our results build on the following main theorem. \begin{theorem}\label{batch-ins} There is a data structure with $O(\min\{m \log n, n^2\})$ size, and can be built in $O(\min\{m \log n, n^2\})$ time, such that given a set $U$ of $k$ insertions, a DFS tree of $G + U$ can be reported in $O(n+k)$ time. \end{theorem} By the above theorem combined with a de-amortization trick in~\cite{baswana2016dynamic}, we establish the following corollary for maintaining a DFS tree in an undirected graph with incremental updates. \begin{corollary}[\textbf{Incremental DFS tree}]\label{cor-incre-dfs} Given a sequence of online edge/vertex insertions, a DFS tree can be maintained in $O(n)$ worst case time per insertion. \end{corollary} \subsection{Organization of the Paper} In Section~2 we introduce frequently used notations and review two building blocks of our algorithm --- the tree partition structure \cite{duan2016improved} and the fractional cascading technique \cite{chazelle1986fractional,chazelle1986fractional2}. In Section~3, we consider a batched version of the incremental setting, where all incremental updates are given at once, after which a single DFS tree is to be reported. Given an efficient scheme to answer queries of form $Q(T(\cdot), \cdot, \cdot)$, we prove Theorem~\ref{batch-ins}, which essentially says there is an efficient algorithm, which we call \textsf{BatchInsert}{}, for the batched incremental setting. In Section~4, we elaborate on the implementation of the central query subroutine $Q(T(\cdot), \cdot, \cdot)$ used in the batched incremental algorithm. We first review a standard de-amortization technique, applying which our algorithm for the batched setting directly implies the efficient algorithm for the incremental setting stated in Corollary~\ref{cor-incre-dfs}. We then, in Sections~\ref{sec:logn}~and~\ref{sec:nsquare} respectively, introduce (1) an optimized data structure that takes $O(m \log n)$ time for preprocessing and answers each query in $O(\log n)$ time, and (2) a relatively simple data structure that takes $O(n^2)$ time for preprocessing and answers each query in $O(1)$ time. One of these two structures, depending on whether $m \log n > n^2$ or not, is then used in Section~\ref{sec:mlogn} to implement a scheme that answers each query in amortized $O(1)$ time. This is straightforward when the $(n^2, 1)$ structure is used. When instead the $(m \log n, \log n)$ structure is used, we apply a nontrivial combination of the tree partition structure and the fractional cascading technique to bundle queries together, and answer each bundle using a single call to the $(m \log n, \log n)$ structure. We show that the number of such bundles from queries made by \textsf{BatchInsert}{} cannot exceed $O(n / \log n)$, so the total time needed for queries is $O(n)$. This finishes the proof of Theorem~\ref{batch-ins} and Corollary~\ref{cor-incre-dfs} and concludes the paper. \section{Preliminaries} Let $G = (V, E)$ denote the original graph, $T$ a corresponding DFS tree, and $U$ a set of inserted vertices and edges. We first introduce necessary notations. \begin{itemize} \item $T(x)$: The subtree of $T$ rooted at $x$. \item $\mathit{path}(x, y)$: The path from $x$ to $y$ in $T$. \item $\mathit{par}(v)$: The parent of $v$ in $T$. \item $N(x)$: The adjacency list of $x$ in $G$. \item $L(x)$: The reduced adjacency list for vertex $x$, which is maintained during the algorithm. \item $T^*$: The newly generated DFS tree. \item $\mathit{par}^*(v)$: The parent of $v$ in $T^*$. \end{itemize} Our result uses a tree partition lemma in \cite{duan2016improved} and the famous fractional cascading structure in \cite{chazelle1986fractional,chazelle1986fractional2}, which are summarized as the following two lemmas. \begin{lemma}[Tree partition structure \cite{duan2016improved}] \label{tree_partition_lem} Given a rooted tree $T$ and any integer parameter $k$ such that $2 \le k \le n = |V(T)|$, there exists a subset of vertices $M \subseteq V(T)$, $|M|\le 3n/k-5$, such that after removing all vertices in $M$, the tree $T$ is partitioned into sub-trees of size at most $k$. We call every $v \in M$ an $M$-marked vertex, and $M$ a marked set. Also, such $M$ can be computed in $O(n \log n)$ time. \end{lemma} \begin{lemma}[Fractional cascading \cite{chazelle1986fractional,chazelle1986fractional2}] \label{fractional_cascading} Given $k$ sorted arrays $\{A_i\}_{i \in [k]}$ of integers with total size $\sum_{i=1}^k |A_i| = m$. There exists a data structure which can be built in $O(m)$ time and using $O(m)$ space, such that for any integer $x$, the successors of $x$ in all $A_i$'s can be found in $O(k + \log m)$ time. \end{lemma} \section{Dealing with queries in \textsf{BatchInsert}} In this section we prove Lemma~\ref{query_time}. Once this goal is achieved, the overall time complexity of batch insertion taken by Algorithm~\textsf{BatchInsert}{} would be $O(n + |U|)$. In the following part of this section, we will first devise a data structure in Section \ref{sec:logn}, that answers any single query $Q(T(w), u, v)$ in $O(\log n)$ time, which would be useful in other parts of the algorithm. We will then present another simple data structure in Section \ref{sec:nsquare}, which requires $O(n^2)$ preprocessing time and $O(n^2)$ space and answers each query in $O(1)$ time. Finally, we propose a more sophisticated data structure in Section \ref{sec:mlogn}, which requires $O(m\log n)$ preprocessing time and $O(m \log n)$ space and answer all queries $Q(T(w), x, y)$ in a single run of \textsf{BatchInsert}{} in $O(n)$ time. Hence, we can always have an algorithm that handles a batch insertion $U$ in $O(n + |U|)$ time using $O(\min\{m\log n, n^2\})$ preprocessing time and $O(\min\{m\log n, n^2\})$ space, thus proving Theorem \ref{batch-ins}. We can then prove Corollary \ref{cor-incre-dfs} using the following standard de-amortization argument. \begin{lemma}{(Lemma 6.1 in \cite{baswana2016dynamic})} \label{deamortization} Let $\mathcal{D}$ be a data structure that can be used to report the solution of a graph problem after a set of $U$ updates on an input graph $G$. If $\mathcal{D}$ can be initialized in $O(f)$ time and the solution for graph $G + U$ can be reported in $O(h + |U| \times g)$ time, then $\mathcal{D}$ can be modified to report the solution after every update in worst-case $O\left(\sqrt{fg} + h\right)$ update time after spending $O(f)$ time in initialization, given that $\sqrt{f / g} \le n$. \end{lemma} \begin{proof}[Proof of Corollary \ref{cor-incre-dfs}] Taking $f = \min\{m\log n, n^2 \}$, $g = 1$, $h = n$ and directly applying the above lemma will yield the desired result. \end{proof} \subsection{Answering a single query in $O(\log n)$ time} \label{sec:logn} We show in this subsection that the query $Q(T(\cdot), \cdot, \cdot)$ can be reduced efficiently to the range successor query (see, e.g., \cite{nekrich2012sorted}, for the definition of range successor query), and show how to answer the range successor query, and thus any individual query $Q(T(\cdot), \cdot, \cdot)$, in $O(\log n)$ time. To deal with a query $Q(T(w), x, y)$, first note that since $T$ is a DFS tree, all edges not in $T$ but in the original graph $G$ must be ancestor-descendant edges. Querying edges between $T(w)$ and $\mathit{path}(x, y)$ where $x$ is an ancestor of $y$ and $T(w)$ is hanging from $\mathit{path}(x, y)$ is therefore equivalent to querying edges between $T(w)$ and $\mathit{path}(x, \mathit{par}(w))$, i.e., $Q(T(w), x, y) = Q(T(w), x, \mathit{par}(w))$. From now on, we will consider queries of the latter form only. Consider the DFS sequence of $T$, where the $i$-th element is the $i$-th vertex reached during the DFS on $T$. Note that every subtree $T(w)$ corresponds to an interval in the DFS sequence. Denote the index of vertex $v$ in the DFS sequence by $\mathit{first}(v)$, and the index of the last vertex in $T(v)$ by $\mathit{last}(v)$. During the preprocessing, we build a 2D point set $S$. For each edge $(u, v) \in E$, we add a point $p = (\mathit{first}(u), \mathit{first}(v))$ into $S$. Notice that for each point $p \in S$, there exists exactly one edge $(u, v)$ associated with $p$. Finally we build a 2D range tree on point set $S$ with $O(m\log n)$ space and $O(m\log n)$ preprocessing time. To answer an arbitrary query $Q(T(w), x, \mathit{par}(w))$, we query the point with minimum $x$-coordinate lying in the rectangle $\Omega = [\mathit{first}(x), \mathit{first}(w) - 1] \times [\mathit{first}(w), \mathit{last}(w)]$. If no such point exists, we return \textsf{Null} for $Q(T(w), x, \mathit{par}(w))$. Otherwise we return the edge corresponding to the point with minimum $x$-coordinate. Now we prove the correctness of our approach. \begin{itemize} \item If our method returns \textsf{Null}, $Q(T(w), x, \mathit{par}(w))$ must equal \textsf{Null}. Otherwise, suppose $Q(T(w), x, \mathit{par}(w)) = (u, v)$. Noticing that $(\mathit{first}(u), \mathit{first}(v))$ is in $\Omega$, it means our method will not return \textsf{Null} in that case. \item If our method does not return \textsf{Null}, denote $(u', v')$ to be the edge returned by our method. We can deduce from the query rectangle that $u' \in T(x) \backslash T(w)$ and $v' \in T(w)$. Thus, $Q(T(w), x, \mathit{par}(w)) \neq \textsf{Null}$. Suppose $Q(T(w), x, \mathit{par}(w)) = (u, v)$. Notice that $(\mathit{first}(u), \mathit{first}(v))$ is in $\Omega$, which means $\mathit{first}(u') \le \mathit{first}(u)$. If $u' = u$, then our method returns a feasible solution. Otherwise, from the fact that $\mathit{first}(u') < \mathit{first}(u)$, we know that $u'$ is an ancestor of $u$, which contradicts the definition of $Q(T(w), x, \mathit{par}(w))$. \end{itemize} \subsection{An $O(n^2)$-space data structure}\label{sec:nsquare} \label{pre_all} In this subsection we propose a data structure with quadratic preprocessing time and space complexity that answers any $Q(T(\cdot), \cdot, \cdot)$ in constant time. Since we allow quadratic space, it suffices to precompute and store answers to all possible queries $Q(T(w), u, \mathit{par}(w))$. For preprocessing, we enumerate each subtree $T(w)$, and fix the lower end of the path to be $v = \mathit{par}(w)$ while we let the upper end $u$ go upward from $v$ by one vertex at a time to calculate $Q(T(w), u, v)$ incrementally, in order to get of the form $Q(T(w), \cdot, \cdot)$ in $O(n)$ total time. As $u$ goes up, we check whether there is an edge from $T(w)$ to the new upper end $u$ in $O(1)$ time; for this task we build an array (based on the DFS sequence of $T$) for each vertex, and insert an 1 into the appropriate array for each edge, and apply the standard prefix summation trick to check whether there is an 1 in the range corresponding to $T(w)$. To be precise, let $A_u: [n] \rightarrow \{0, 1\}$ denote the array for vertex $u$. Recall that $\mathit{first}(v)$ denotes the index of vertex $v$ in the DFS sequence, and $\mathit{last}(v)$ the index of the last vertex in $T(v)$. For a vertex $u$, we set $A_u[\mathit{first}(v)]$ to be 1 if and only if there is an edge $(u, v)$ where $u$ is the higher end. Now say, we have the answer to $Q(T(w), u, v)$ already, and want to get $Q(T(w), u', v)$ in $O(1)$ time, where $u' = \mathit{par}(u)$. If there is an edge between $T(w)$ and $u'$, then it will be the answer. Or else the answer to $Q(T(w), u', v)$ will be the same as to $Q(T(w), u, v)$. In order to know whether there is an edge between $T(w)$ and $u'$, we check the range $[\mathit{first}(w), \mathit{last}(w)]$ in $A_{u'}$, and see if there is an $1$ in $O(1)$ time using the prefix summation trick. \begin{lemma} \label{preprocess_all} The preprocessing time and query time of the above data structure are $O(n^2)$ and $O(1)$ respectively. \end{lemma} \begin{proof} The array $A_u$ and its prefix sum can be computed for each vertex $u$ in total time $O(n^2)$. For each subtree $T(w)$, we go up the path from $w$ to the root $r$, and spend $O(1)$ time for each vertex $u$ on $\mathit{path}(r, w)$ to get the answer for $Q(T(w), u, \mathit{par}(w))$. There are at most $n$ vertices on $\mathit{path}(r, w)$, so the time needed for a single subtree is $O(n)$, and that needed for all subtrees is $n \cdot O(n) = O(n^2)$ in total. On the other hand, for each query, we simply look it up and answer in $O(1)$ time. Hence we conclude that the preprocessing time and query time are $O(n^2)$ and $O(1)$ respectively. \end{proof} \subsection{An $O(m\log n)$-space data structure}\label{sec:mlogn} Observe that in \textsf{BatchInsert}{} (and \textsf{DFS}), a bunch of queries $\{Q(T(w_i), x, y)\}$ are always made simultaneously, where $\{T(w_i)\}$ is the set of subtrees hanging from $\mathit{path}(x, y)$. We may therefore answer all queries for a path in one pass, instead of answering them one by one. By doing so we confront two types of hard queries. First consider an example where the original DFS tree $T$ is a chain $L$ where $a_1$ is the root of $L$ and for $1 \le i \le n - 1$, $a_{i+1}$ is the unique child of $a_i$. When we invoke $\textsf{DFS}(a_1)$ on $L$, $path(u, v)$ is the single node $a_1$. Thus, we will call $Q(T(a_2), a_1, a_1)$ and add the returned edge into $L(a_1)$. Supposing there are no back-edges in this graph, the answer of $Q(T(a_2), a_1, a_1)$ will be the edge $(a_1, a_2)$. Therefore, we will recursively call the $\textsf{DFS}(a_2)$ on the chain $(a_2, a_n)$. Following further steps of \textsf{DFS}, we can see that we will call the query $Q(T(w), x, y)$ for $\Omega(n)$ times. For the rest of this subsection, we will show that we can deal with this example in linear time. The idea is to answer queries involving short paths in constant time. For instance, in the example shown above, $path(u, v)$ always has constant length. We show that when the length of $path(u, v)$ is smaller than $2\log n$, it is affordable to preprocess all the answers to queries of this kind in $O(m\log n)$ time and $O(n \log n)$ space \begin{figure}[!ht] \centering \includegraphics[width=0.6\linewidth]{many_children} \captionsetup{justification=centering} \caption{In this example, if we stick to the 2D-range-based data structure introduced before, then computing all $Q(T(a_i), r, r^\prime)$ would take as much as $O(n\log n)$ time.} \label{fig:heavy} \end{figure} The second example we considered is given as Figure \ref{fig:heavy}. In this tree, the original root is $r$. Suppose the distance between $r$ and $r'$ is $n / 2$. When we invoke $\textsf{DFS}(r')$, $path(u, v)$ the path from $r$ to $r'$. Thus, we will call $T(a_1, r, r')$, $T(a_2, r, r')$, $\ldots$, $T(a_{n - 2}, r, r')$, which means we make $\Omega(n)$ queries. In order to deal with this example in linear time, the main idea is using fractional cascading to answer all queries $Q(T(w), x, y)$ with a fixed $path(u, v)$, for all subtrees $T(w)$ with small size. In the examples shown above, all subtrees cut off $path(u, v)$ have constant size and thus the total time complexity for this example is $O(n)$. We will finally show that, by combining the two techniques mentioned above, it is enough to answer all queries $Q(T(w), x, y)$ in linear time, thus proving Lemma~\ref{query_time}. \subsection*{Data structure} The data structure consists of the following parts. \begin{enumerate}[(\romannumeral1)] \item Build the 2D-range successor data structure that answers any $Q(T(\cdot), \cdot, \cdot)$ in $O(\log n)$ time. \item For each ancestor-descendent pair $(u, v)$ such that $u$ is at most $2\log n$ hops above $v$, precompute and store the value of $Q(T(v), u, \mathit{par}(v))$. \item Apply Lemma \ref{tree_partition_lem} with parameter $k = \log n$ and obtain a marked set of size $O(n / \log n)$. Let $M$ be the set of all marked vertices $x$ such that $|T(x)| \geq \log n$. For every $v\notin M$, let $\mathit{anc}_v\in M$ be the nearest ancestor of $v$ in set $M$. Next we build a fractional cascading data structure for each $u\in M$ in the following way. Let $M_u$ be the set of all vertices in $T(u)$ whose tree paths to $u$ do not intersect any other vertices $u^\prime \neq u$ from $M$, namely $M_u = \{v\mid \mathit{anc}_v = u \}$; see Figure \ref{ds} for an example. Then, apply Lemma \ref{fractional_cascading} on all $N(v), v\in M_u$ where $N(v)$ is treated as sorted array in an ascending order with respect to depth of the edge endpoint opposite to $v$; this would build a fractional cascading data structure that, for any query encoded as a $w\in V$, answers for every $v\in M_u$ its highest neighbour below vertex $w$ in total time $O(|M_u| + \log n)$. \end{enumerate} Here is a structural property of $M$ that will be used when answering queries. \begin{lemma}\label{struct-marked} For any ancestor-descendent pair $(u, v)$, if $\mathit{path}(u, v)\cap M = \emptyset$, then $\mathit{path}(u, v)$ has $\leq 2\log n$ hops. \end{lemma} \begin{proof} Suppose otherwise. By definition of marked vertices there exists a marked vertex $w\in \mathit{path}(u, v)$ that is $\leq \log n$ hops below $u$. Then since $\mathit{path}(u, v)$ has $>2\log n$ many hops, it must be $T(w)\geq \log n$ which leads to $w\in M$, contradicting $\mathit{path}(u, v)\cap M = \emptyset$. \end{proof} \begin{center} \begin{figure} \begin{subfigure}{0.5\textwidth} \includegraphics[width=3in, height=2.4in]{ds} \caption{In this example, each blue node represents a vertex $v_i (1\leq i\leq 4)$ from set $M$, and $M_{v_i}$'s are drawn as yellow triangles. For each triangle, a fractional cascading data structure is built on adjacency lists of all vertices inside.} \label{ds} \end{subfigure} \quad \begin{subfigure}{0.5\textwidth} \includegraphics[width=3.3in, height=2.5in]{qry} \caption{In this picture, sets $M$ and $X\cup \{r\}$ are drawn as blue nodes and black nodes respectively, and each yellow triangle is a subtree rooted at a leaf of $T[X]$, which has size $\geq \log n$. Note that every ancestor-descendent tree path between two black nodes contains a blue node.} \label{qry} \end{subfigure} \end{figure} \end{center} \subsection*{Preprocessing time} First of all, for part (\romannumeral1), as discussed in a previous subsection, 2D-range successor data structure takes time $O(m\log n)$ to initialize. Secondly, for part (\romannumeral3), on the one hand by Lemma \ref{tree_partition_lem} computing a tree partition takes time $O(n\log n)$; on the other hand, by Lemma \ref{fractional_cascading}, initializing the fractional cascading with respect to $u\in M$ costs $O(\sum_{v\in M_u}|N(v)|)$ time. Since, by definition of $M_u$, each $v\in V$ is contained in at most one $M_u, u\in M$, the overall time induced by this part would be $O(\sum_{u\in M}\sum_{v\in M_u}|N(v)|) = O(m)$. Preprocessing part (\romannumeral2) requires a bit of cautions. The procedure consists of two steps. \begin{enumerate}[(1)] \item For every ancestor-descendent pair $(u, v)$ such that $u$ is at most $2\log n$ hops above $v$, we mark $(u, v)$ if $u$ is incident to $T(v)$. Here goes the algorithm: for every edge $(u, w)\in E$ ($u$ being the ancestor), let $z\in \mathit{path}(u, w)$ be the vertex which is $2\log n$ hops below $u$ (if $\mathit{path}(u, w)$ has less than $2\log n$ hops, then simply let $z = w$); note that this $z$ can be found in constant time using the level-ancestor data structure \cite{bender2000lca} which can be initialized in $O(n)$ time. Then, for every vertex $v\in \mathit{path}(u, z)$, we mark the pair $(u, v)$. The total running time of this procedure is $O(m\log n)$ since each edge $(u, w)$ takes up $O(\log n)$ time. \item Next, for each $v\in V$, we compute all entries $Q(T(v), u, \mathit{par}(v))$ required by (\romannumeral2) in an incremental manner. Let $u_1, u_2, \cdots, u_{2\log n}$ be the nearest $2\log n$ ancestors of $v$ sorted in descending order with respect to depth, and then we directly solve the recursion $Q(T(v), u_{i+1}, \mathit{par}(v)) = \begin{cases} Q(T(v), u_{i}, \mathit{par}(v)) & (u_{i+1}, v)\text{ is not marked}\\ u_{i+1} & i=0\text{ or }(u_{i+1}, v)\text{ is marked}\\ \end{cases}$ for all $0\leq i < 2\log n$ in $O(\log n)$ time. The total running time would thus be $O(n\log n)$. \end{enumerate} Summing up (\romannumeral1)(\romannumeral2)(\romannumeral3), the preprocessing time is bounded by $O(m\log n)$. \subsection*{Query algorithm and total running time} We show how to utilize the above data structures (\romannumeral1)(\romannumeral2)(\romannumeral3) to implement $Q(T(\cdot), \cdot, \cdot)$ on line 9-11 in Algorithm \textsf{DFS} such that the overall time complexity induced by this part throughout a single execution of Algorithm \textsf{BatchInsert}{} is bounded by $O(n)$. Let us say we are given $(w_1, w_2, \cdots, w_t) = \mathit{path}(u, v)$ and we need to compute $Q(T(x), u, v)$ for every subtree $T(x)$ that is hanging on $\mathit{path}(u, v)$. There are three cases to discuss. \begin{enumerate}[(1)] \item If $\mathit{path}(u, v)\cap M = \emptyset$, by Lemma \ref{struct-marked} we claim $\mathit{path}(u, v)$ has at most $2\log n$ hops, and then we can directly retrieve the answer of $Q(T(x), u, v)$ from precomputed entries of (\romannumeral2), each taking constant query time. \item Second, consider the case where $\mathit{path}(u, v)\cap M \neq \emptyset$. Let $s_1, s_2, \cdots, s_l, l\geq 1$ be the consecutive sequence (in ascending order with respect to depth in tree $T$) of all vertices from $M$ that are on $\mathit{path}(u, v)$. For those subtrees $T(x)$ that are hanging on $\mathit{path}(u, \mathit{par}(s_1))$, we can directly retrieve the value of $Q(T(x), u, \mathit{par}(x))$ from (\romannumeral2) in constant time, as by Lemma~\ref{struct-marked} $\mathit{path}(u, \mathit{par}(s_1))$ has at most $2\log n$ hops. \item Third, we turn to study the value of $Q(T(x), u, \mathit{par}(x))$ when $\mathit{par}(x)$ belongs to a $\mathit{path}(s_i, \mathit{par}(s_{i+1})), i<l$ or $\mathit{path}(s_l, v)$. The algorithm is two-fold. \begin{enumerate}[(a)] \item First, we make a query of $u$ to the fractional cascading data structure built at vertex $s_i$ ($1\leq i\leq l$), namely part (\romannumeral3), which would give us, for every descendent $y\in M_{s_i}$, the highest neighbour of $y$ below $u$. Using this information we are able to derive the result of $Q(T(x), u, v)$ if $|T(x)| < \log n$, since in this case $T(x)\cap M = \emptyset$ and thus $T(x)\subseteq M_{s_i}$. By Lemma \ref{fractional_cascading} the total time of this procedure is $O(|M_{s_i}| + \log n)$. \item We are left to deal with cases where $|T(x)| \geq \log n$. In this case, we directly compute $Q(T(x), u, v)$ using the 2D-range successor built in (\romannumeral1) which takes $O(\log n)$ time. \end{enumerate} \end{enumerate} Correctness of the query algorithm is self-evident by the algorithm. The total query time is analysed as following. Throughout an execution of Algorithm \textsf{BatchInsert}, (1) and (2) contribute at most $O(n)$ time since each $T(x)$ is involved in at most one such query $Q(T(x), u, v)$ which takes constant time. As for (3)(a), since each marked vertex $s\in M$ lies in at most one such path $(w_1, w_2, \cdots, w_t) = \mathit{path}(u, v)$, the fractional cascading data structure associated with $M_s$ is queried for at most once. Hence the total time of (3)(a) is $O(\sum_{s\in M}(|M_s| + \log n)) = O(n + |M|\log n) = O(n)$; the last equality holds by $|M|\leq O(n / \log n)$ due to Lemma \ref{tree_partition_lem}. Finally we analyse the total time taken by (3)(b). It suffices to upper-bound by $O(n / \log n)$ the total number of such $x$ with the property that $|T(x)| \geq \log n$ and $\mathit{path}(u, \mathit{par}(x))\cap M \neq \emptyset$. Let $X$ be the set of all such $x$'s. \begin{lemma}\label{struct-large-tree} Suppose $x_1, x_2\in X$ and $x_1$ is an ancestor of $x_2$ in tree $T$. Then $\mathit{path}(x_1, x_2)\cap M \neq \emptyset$. \end{lemma} \begin{proof} Suppose otherwise $\mathit{path}(x_1, x_2)\cap M = \emptyset$. Consider the time when query $Q(T(x_2), u, v)$ is made and let $\mathit{path}(u, v)$ be the path being visited by then. As $x_2\in X$, by definition it must be $\mathit{path}(u, \mathit{par}(x_2))\cap M\neq \emptyset$. Therefore, $\mathit{path}(u, x_2)$ is a strict extension of $\mathit{path}(x_1, x_2)$, and thus $x_1, \mathit{par}(x_1)\in \mathit{path}(u, x_2)$, which means $x_1$ and $\mathit{par}(x_1)$ become visited in the same invocation of Algorithm \textsf{DFS}. This is a contradiction since for any query of form $Q(T(x_1), \cdot, \cdot)$ to be made, by then $\mathit{par}(x_1)$ should be tagged ``visited'' while $x_1$ is not. \end{proof} Now we prove $|X| = O(n / \log n)$. Build a tree $T[X]$ on vertices $X\cup \{r\}$ in the natural way: for each $x\in X$, let its parent in $T[X]$ be $x$'s nearest ancestor in $X\cup \{r\}$. Because of $$|X| < 2\#\text{leaves of }T[X] + \#\text{vertices with a unique child in }T[X]$$ it suffices to bound the two terms on the right-hand side: on the one hand, the number of leaves of $T[X]$ is at most $n / \log n$ since for each leave $x$ it has $|T(x)|\geq \log n$; on the other hand, for each $x\in T[X]$ with a unique child $y\in T[X]$, by Lemma \ref{struct-large-tree} $\mathit{path}(x, y)\cap M \neq \emptyset$, and so we can charge this $x$ to an arbitrary vertex in $\mathit{path}(x, y)\cap M$, which immediately bounds the total number of such $x$'s by $|M| = O(n / \log n)$; see Figure \ref{qry} for an illustration. Overall, $|X| \leq O(n / \log n)$.
{'timestamp': '2018-02-21T02:08:14', 'yymm': '1607', 'arxiv_id': '1607.04913', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04913'}
arxiv
\section{Introduction} Optical remote sensing has made significant advances in recent years. Among these has been the deployment and wide-spread use of hyperspectral imagery on a variety of platforms (including manned and unmanned aircraft and satellites) for a wide variety of applications, ranging from environmental monitoring, ecological forecasting, disaster relief to applications pertaining to national security. With rapid advancements in sensor technology, and the resulting reduction of size, weight and power requirements of the imagers, it is also now common to deploy multiple sensors on the same platform for multi-sensor imaging. As a specific example, it is appealing for a variety of remote sensing applications to acquire hyperspectral imagery and Light Detection and Ranging (LiDAR) data simultaneously --- hyperspectral imagery offers a rich characterization of object specific properties, while LiDAR provides topographic information that complements Hyperspectral imagery \cite{dalponte2008fusion,YP2015,brennan2006object,shimoni2011detection,pedergnana2011fusion}. Modern LiDAR systems provide the ability to record entire waveforms for every return signal as opposed to providing just the point cloud. This enables a richer representation of surface topography. While feature reduction is an important preprocessing to analysis of single-sensor high dimensional passive optical imagery (particularly hyperspectral imagery), it becomes particularly important with multi-sensor data where each sensor contributes to high dimensional raw features. A variety of feature projection approaches have been used for feature reduction, including classical approaches such as Principal Component Analysis (PCA), Linear Discriminant Analysis (LDA) and their many variants, manifold learning approaches such as Supervised and Unsupervised Locality Preserving Projections \cite{lunga2014manifold}. Several of these methods are implemented in both the input (raw) feature space and the Reproducible Kernel Hilbert Space (RKHS) for data that are nonlinearly separable. Further, most traditional approaches to feature extraction are designed for single-sensor data --- a unique problem with multi-sensor data is that feature spaces corresponding to each sensor often have different statistical properties, and a single feature projection may hence be sub-optimal. It is hence desired to have a projection for feature reduction that preserves the underlying information from each sensor in a lower dimensional subspace. More recently, we developed a feature projection approach, referred to as Angular Discriminant Analysis (ADA) \cite{CP2015_ADA_JSTSP,PC2013Asilomar_Sparse,PrasadCuiICASSP2013}, that was optimized for hyperspectral imagery and demonstrated robustness to spectral variability. Specifically, the approach sought a lower dimensional subspace where classes were maximally separated in an angular sense, preserving important spectral shape related characteristics. We also developed a local variant of the algorithm (LADA) that preserved angular locality in the subspace. In this paper, we propose a composite kernel implementation of this framework and demonstrate for the purpose of feature projection in multi-sensor frameworks. Specifically, by utilizing a composite kernel (a dedicated kernel for each sensor), and ADA (or LADA) for each sensor, the resulting projection is highly suitable for classification. The proposed approach serves as a very effective feature reduction algorithm for sensor fusion --- it optimally fuses multi-sensor data and projects it to a lower dimensional subspace. A traditional classifier can be employed following this, for supervised learning. We validate the method with the University of Houston multi-sensor dataset comprising of Hyperspectral and LiDAR data and show that the proposed method significantly outperforms other approaches to feature fusion. The outline of the remainder of this paper is as follows. In sec. \ref{sec:related}, we review related work. In sec. \ref{sec:proposed}, we describe the proposed approach for multi-sensor feature extraction. In sec. \ref{sec:results}, we describe the experimental setup and present results with the proposed method, comparing it to several state-of-the-art techniques to feature fusion. \section{Related Work} \label{sec:related} Traditional approaches to feature projection based dimensionality reduction such as PCA, LDA and their variants largely rely on Euclidean measures. Manifold learning approaches \cite{lunga2014manifold} also seek to preserve manifold structures and neighborhood locality through projections that preserve such structures. Other projection based approaches to feature reduction, such as Locality Preserving Projections (LPP), Local Fisher's Discriminant Analysis (LFDA) \cite{lunga2014manifold,prasad2014SMoG,MPWB2013} etc. integrate ideas of local neighborhoods through affinity matrices, into classical projection based analysis approaches such as PCA, LDA etc. As a general feature extraction approach, Euclidean distance is a reasonable choice, including for remotely sensed image analysis. However, by noting the well understood benefits of spectral angle for hyperspectral image analysis, in previous work, we developed an alternate feature projection paradigm that worked with angular distance measures instead of euclidean distance measures \cite{CP2015_ADA_JSTSP,PC2013Asilomar_Sparse,PrasadCuiICASSP2013} --- we demonstrated that when projecting hyperspectral data through this class of transformations, the resulting subspaces were very effective for downstream classification and significantly outperformed their Euclidean distance counterparts. In addition to benefits with classification, we also demonstrated other benefits of this class of methods, including robustness to illumination differences --- something that is very important for remote sensing. In other previous work, it has been shown that a reproducible kernel Hilbert space (RKHS) generated by composite kernels (a weighted linear combination of basis kernels) is very effective for multi-source fusion \cite{YP2015,wang2013multiple,tuia2010multisource,camps2006composite}. Here, we briefly review the developments related to angular discriminant analysis. This will provide a context and motivation for the proposed work in this paper that seeks to demonstrate the benefits of composite kernel angular discriminant analysis for multi-source image analysis. \subsection{Angular Discriminant Analysis} Here, we briefly review Angular Discriminant Analysis (ADA) and its locality preserving counterpart, Local Angular Discriminant Analysis (LADA). Consider a $d$-dimensional feature space (e.g. hyperspectral imagery with $d$ spectral channels). Let $\{{x}_{i} \in \mathbb{R}^{d}, y_i \in \{1,2, \ldots, c\}\}$ be the $i$-th training sample with an associated class label $y_i$, where $c$ is the number of classes. The total number of training samples in the library is $n = \sum_{l=1}^{c}{n_{l}}$, where $n_{l}$ denotes the number of training samples from class $l$. Let ${\mathit{T}} \in \mathbb{R}^{d \times r}$ be the desired projection matrix, where $r$ denotes the reduced dimensionality. We also denote symbols having unit norm with a \emph{tilde} --- this will be useful where we normalize the data to a unit norm to focus on angular separability. \subsubsection{ADA} Traditional LDA seeks to find a subspace that maximizes between-class scatter while minimizing within-class scatter, where the scatter is measured using Euclidean distances. While similar in philosophy, ADA is an entirely new approach to subspace learning that is based on \emph{angular} scatter --- it seeks a subspace where within-class angular scatter is maximized, and the between-class angular scatter is maximized. Just like LDA, the ADA optimization problem can be posed as a generalized eigenvalue problem. Specifically, ADA seeks to find a projection where the ratio of between-class inner product to within-class inner product of data samples is minimized. The within-class outer product matrix ${\mathit{O}}^{(\text{w})}$ and between-class outer product matrix ${\mathit{O}}^{(\text{b})}$ are defined as \begin{align} {\mathit{O}}^{(\text{w})} &= \sum^{c}_{l=1}\sum^{}_{i:y_i=l} \tilde{{\mu}}_{l}\tilde{{x}}_{i}^{t}, \label{eq:Ow} \\ {\mathit{O}}^{(\text{b})} &= \sum^{c}_{l=1}n_l\tilde{{\mu}}\tilde{{\mu}}_{l}^{t}. \label{eq:Ob} \end{align} {where $\tilde{{\mu}}_{l} = \frac{1}{n_l}\sum_{i:y_i=l}^{}{\tilde{{x}}_{i}}$ is the normalized mean of $l$-th class samples, and $\tilde{{\mu}} = \frac{1}{n}\sum_{i=1}^{n}{\tilde{{x}}_{i}}$ is defined as the normalized total mean.} It was shown in \cite{CP2015_ADA_JSTSP} that the projection matrix ${\mathit{T}}_{\textit{ADA}}$ of ADA can be approximated as the solution to the following trace ratio problem \begin{align} {\mathit{T}}_{\textit{ADA}} &\approx \operatornamewithlimits{argmin}_{{\mathit{T}}\in \mathbb{R}^{d \times r}}\left[\operatorname{tr}\big(({\mathit{T}}^{t}{\mathit{O}}^{(\text{w})}{\mathit{T}})^{-1}{\mathit{T}}^{t}{\mathit{O}}^{(\text{b})}{\mathit{T}}\big)\right]. \label{eq:ada2} \end{align} The projection matrix ${\mathit{T}}_{\textit{ADA}}$ can be obtained by solving the generalized eigenvalue problem involving ${\mathit{O}}^{(\text{w})}$ and ${\mathit{O}}^{(\text{b})}$. \subsubsection{LADA} Similar to LDA, ADA is a ``global'' projection in that it does not specifically promote preservation of local (neighborhood) angular relationships under the projection. We hence developed LADA in \cite{CP2015_ADA_JSTSP}, which is a local variant of ADA. The within and between-class outer product matrices of LADA are obtained as follows \begin{align} {\mathit{O}}^{(\text{lw})} &= \sum_{i,j=1}^{n}\mathit{\tilde{W}}_{ij}^{(\text{lw})}\tilde{{x}}_{i}\tilde{{x}}_{j}^{t}, \label{eq:lada_ow} \\ {\mathit{O}}^{(\text{lb})} &= \sum_{i,j=1}^{n}\mathit{\tilde{W}}_{ij}^{(\text{lb})}\tilde{{x}}_{i}\tilde{{x}}_{j}^{t}, \label{eq:lada_ob} \end{align} where the normalized weight matrices are defined as \begin{align} \mathit{\tilde{W}}^{(\text{lw})}_{ij}&= \begin{cases} \mathit{\tilde{A}}_{ij}/n_l, & \text{if $y_i,y_j=l$}, \\ 0, & \text{if $y_i\ne y_j$}, \end{cases} \label{eq:lada_w} \\ \mathit{\tilde{W}}^{(\text{lb})}_{ij}&= \begin{cases} \mathit{\tilde{A}}_{ij}(1/n-1/n_l), & \text{if $y_i,y_j=l$}, \\ 1/n, & \text{if $y_i\ne y_j$}. \end{cases} \label{eq:lada_b} \end{align} The normalized affinity matrix $\mathit{\tilde{A}}_{ij}\in [0,1]$ between $\tilde{{x}}_i$ and $\tilde{{x}}_j$ is defined as \begin{equation} \mathit{\tilde{A}}_{ij}=\exp\left(-\frac{( 2-2\tilde{{x}}_i^{t}\tilde{{x}}_j)}{\tilde{\gamma}_i\tilde{\gamma}_j}\right) , \label{eq:aff} \end{equation} where $\tilde{\gamma}_{i}= \sqrt{2-2\tilde{{x}}_i^{t}\tilde{{x}}^{(\text{knn})}_i}$ denotes the \emph{local angular scaling} of data samples in the angular neighborhood of $\tilde{{x}}_i$, and $\tilde{{x}}^{(\text{knn})}_i$ is the \emph{K}-th nearest neighbors of $\tilde{{x}}_i$. Similar to ADA, the projection matrix of LADA can be defined as \begin{align} {\mathit{T}}_{\textit{LADA}} &= \operatornamewithlimits{argmin}_{{\mathit{T}}\in \mathbb{R}^{d \times r}}\left[\operatorname{tr}\big(({\mathit{T}}^{t}{\mathit{O}}^{(\text{lw})}{\mathit{T}})^{-1}{\mathit{T}}^{t}{\mathit{O}}^{(\text{lb})}{\mathit{T}}\big)\right]. \label{eq:lada} \end{align} \section{Composite Kernel Angular Discriminant Analysis for Image Fusion} \label{sec:proposed} In this section, we develop and describe the proposed approach to multi-source feature extraction --- composite kernel angular discriminant analysis (CKADA) and its locality preserving counterpart (CKLADA). Our underlying hypothesis with this work is that even when angular information is important for optical image analysis, in a multi-source (e.g. multi-sensor scenario), having dedicated kernels (specific to each source) would result in a superior projection that addresses source-specific nonlinearities. With that goal, we extend our previous work with angular discriminant analysis by implementing it in a composite kernel reproducible kernel Hilbert space and demonstrate for a specific application of multi-sensor image analysis that the resulting subspace is highly discriminative and outperforms other subspace learning approaches. Consider a nonlinear mapping $\Phi(\cdot)$ from the input space to a RKHS $\mathcal{H}$ as follows: \begin{equation} {\Phi}: \mathbb{R}^d \rightarrow \mathcal{H}, {x} \rightarrow {\Phi}({x}). \end{equation} \noindent and a kernel function ${K}$ defined as: \begin{equation} {K}({{{x}}_i},{{{x}}_j}) = \left\langle {\Phi ({{{x}}_i}),\Phi ({{{x}}_j})} \right\rangle, \end{equation} where $\left\langle {\cdot,\cdot} \right\rangle$ is the inner product of two vectors. Consider next a set of $M$ co-registered multi-source images resulting in the following $M$-Tuple of feature vectors from co-registered images for every geolocation (co-registered pixels): $\{{x}^1, {x}^2, \hdots, {x}^M\}$, where ${x}^m \in \mathbb{R}^{d_m}$. Associated with every pixel (geolocation) for which ground truth is available, there is a class label $y \in \{1, 2, \hdots, c\}$. A composite kernel RKHS can then be constructed as \begin{equation} {K}({x}_i, {x}_j) = \sum_{m=1}^M \alpha_m {K}_m ({x}^m_i, {x}^m_j) \label{eq:kernelmix} \end{equation} \noindent where $K_m$ is a basis kernel for the $m$'th source, formed by any valid Mercer's kernel. To implement Composite Kernel ADA (CKADA), note that ${\mathit{O}}^{(\text{w})}$ and ${\mathit{O}}^{(\text{b})}$ can be reformulated as \begin{align} {\mathit{O}}^{(\text{w})} &= {\mathit{X}}{\mathit{W}}^{(\text{w})}{\mathit{X}}^{t}, \\ {\mathit{O}}^{(\text{b})} &= {\mathit{X}}{\mathit{W}}^{(\text{b})}{\mathit{X}}^{t}. \end{align} \noindent where ${\mathit{W}}^{(\text{w})}$ is given as \begin{align} \mathit{W}_{ij}^{(\text{w})}&= \begin{cases} 1/n_{l}, & \text{if $y_i,y_j=l$}, \\ 0, & \text{if $y_i\ne y_j$}. \end{cases} \label{eq:ww2} \end{align} \noindent and ${\mathit{W}}^{(\text{b})}$ is given as \begin{align} \mathit{W}_{ij}^{(\text{b})}&= \begin{cases} 1/n-1/n_l, & \text{if $y_i,y_j=l$}, \\ 1/n, & \text{if $y_i\ne y_j$}. \end{cases} \label{eq:wb2} \end{align} ADA can hence be re-expressed as the solution to the following generalized eigenvalue problem \begin{align} {\mathit{X}}{\mathit{W}}^{(\text{b})}{\mathit{X}}^{t}{\nu} = \lambda{\mathit{X}}{\mathit{W}}^{(\text{w})}{\mathit{X}}^{t}{\nu}. \label{eq:keig} \end{align} Since ${\nu}$ can be represented as a linear combination of columns of ${\mathit{X}}$, it can be formulated using a vector ${\varphi} \in \mathbb{R}^{n}$ as \begin{align} {\mathit{X}}^{t}{\nu} = {\mathit{X}}^{t}{\mathit{X}}{\varphi} = {\mathit{K}}{\varphi}, \end{align} where ${\mathit{K}}$ is a $n \times n$ symmetric kernel (Gram) matrix. Here $\mathit{K}_{ij} = \kappa({x}_{i},{x}_{j}) = \langle {x}_{i}, {x}_{j} \rangle$ represents a simple inner product kernel, but can be replaced by \eqref{eq:kernelmix} by utilizing the kernel trick. Multiplying ${\mathit{X}}^{t}$ on both sides of \eqref{eq:keig}, results in the following generalized eigenvalue problem. \begin{align} {\mathit{K}}{\mathit{W}}^{(\text{b})}{\mathit{K}}{\varphi} &= \lambda{\mathit{K}}{\mathit{W}}^{(\text{w})}{\mathit{K}}{\varphi}. \label{eq:kgen} \end{align} Let ${\Psi}=\{{\varphi}_{k}\}_{k=1}^{r}$ be the $r$ generalized eigenvectors associated with the $r$ smallest eigenvalues $\lambda_{1} \le \lambda_{2}, \ldots, \le \lambda_{r}$. A test sample ${x}_{\textit{test}}$ can be embedded in $\mathcal{H}$ via \begin{align} ({\mathit{X}}{\Psi})^{t}{x}_{\textit{test}} = {\Psi}^{t}{\mathit{X}}^{t}{x}_{\textit{test}} = {\Psi}^{t}{\mathit{K}}_{{\mathit{X}},{x}_{\textit{test}}}, \label{eq:ckladaeig} \end{align} where ${\mathit{K}}_{{\mathit{X}},{x}_{\textit{test}}}$ is a $n \times 1$ vector. Composite Kernel Local ADA (CKLADA) can likewise be implemented by replacing the weight matrices (${\mathit{W}}^{(\text{w})}$ and ${\mathit{W}}^{(\text{b})}$) above with their local counterparts defined in \eqref{eq:lada_w} and \eqref{eq:lada_b}. We note that in the proposed approach, the empirical kernel (Gram) matrix from \eqref{eq:kernelmix} that is formed as a weighted linear combination over all sources is used in the generalized eigenvalue problem for CKLADA \eqref{eq:ckladaeig}. The algorithm projects the data from $M$ sources onto a \emph{unified RKHS} through a bank of kernels individually optimized for each source. The final embedding seeks to optimally separate (in an angular sense) data in the RKHS. The linear mixture of kernel enables us to optimize each kernel (for example the kernel parameters) for each source instead of applying a single kernel for all sources, and to specify source importance (via mixing weights) to the overall analysis task at hand. \emph{Practical Considerations:} We note the following free parameters in the overall embedding that affect the subspace that is generated: Embedding dimension, $r$, mixture weights used in the composite kernel, $\{\alpha_m\}_{m=1}^M$, choice of kernel and related kernel parameters. We note that unlike some other embedding techniques such as LDA and its variants where the embedding dimension is upper bounded due to rank deficiency of the between class scatter, with composite kernel local ADA, the between class angular scatter is not rank limited, and as a result, the projection matrix resulting from the solution to the generalized eigenvalue problem does not enforce an upper bound on the embedding dimension. Hence, $r$ is a free parameter that represents the \emph{unified subspace} generated by all $M$ sources. The choice of $r$ should hence be governed by the information content (as quantified for example in the eigenspectra of the decomposition). The choice of weights can be made through cross validation or techniques such as kernel alignment --- in our experience, there is often a very wide plateau over a range of values of the weights, and hence we chose to use simple cross validation to learn weights from our training data. We utilized a standard radial basis function (RBF) kernel for each source ($K_m$), but the kernel parameter (width of the RBF kernel) is optimized for each source individually via cross validation. \emph{Classification:} We note that following a CKLADA projection, a simple classifier can be utilized for down-stream analysis. This follows from the observation that applying kernel projections while simultaneously ensuring preservation of angular locality will result in subspaces where class-specific data are compactly clustered. We validate and measure the efficacy of subspaces resulting from CKLADA by utilizing the following classifiers: (1) A K Nearest neighbor (KNN) classifier, (2) A Gaussian maximum-likelihood (ML) classifier, and a (3) sparse representation based classifier (SRC) \cite{PAMI2009_SRC}. While the choice of KNN and ML are obvious for subspaces formed by Kernel projections as noted in \cite{YP2015}, we make a remark on choice of SRC as an additional classifier to measure efficacy of subspaces --- this choice is motivated not only by the observation that SRC has emerged as a powerful classification approach for high dimensional remote sensing data \cite{Cui2014,yuan2012visual,chen2011hyperspectral,Nasser2011SRC,zhang2011sparse} and that it exploits the inherent sparsity when representing samples using training dictionaries, but also because popular solvers used (e.g. Orthogonal Matching Pursuit, OMP) are driven by inner products to learn the sparse representation and hence they essentially exploit angular information. They implicitly seek a representation where a test sample is represented sparsely in a dictionary of training data such that the atoms that eventually contribute (have non-zero, significant representation coefficients) to the representation are angularly similar to the test data samples. We hence contend that CKLADA is particularly well suited for SRC and its variants. \section{Experimental Setup and Results} \label{sec:results} \subsection{Dataset} The dataset we utilize represents a sensor fusion scenario, comprising of LiDAR pseudo-waveforms, and a hyperspectral image cube, and is popular in the remote sensing community as a benchmark. The data were acquired over the University of Houston campus and the neighboring urban area. All the images are at the same spatial resolution of 2.5 m and have the same spatial size of $349 \times 1340$. The hyperspectral image was acquired with the ITRES CASI sensor, containing 144 spectral bands, ranging from 380 nm to 1050 nm. The LiDAR DSM data was acquired by an Optech Gemini sensor and then co-registered to the hyperspectral image. The laser pulse wavelength and repetition rate were 1064 nm and 167 kHz, respectively. The instrument can make up to 4 range measurements. The total number of ground reference samples is 2832, covering 15 classes of interest, with approximately 200 samples for each class --- these were determined by photo-interpretation of high resolution optical imagery.. The groundtruth map is overlaid with the gray scale image showing one channel of the hyperspectral image in Fig. \ref{fig:img_uh} \begin{figure*}[ht] \centering \includegraphics[width=15cm]{uh_casi.png} \\ \includegraphics[width=17cm]{gt_img.jpg} \\ \includegraphics[width=15cm]{color_bar.jpg} \caption{ True color image of hyperspectral University of Houston data, and the ground truth.} \label{fig:img_uh} \end{figure*} From the dense LiDAR point cloud, a pseudo-waveform was generated for each geolocation, that is co-registered with the hyperspectral image. The pseudo-waveform was generated by quantizing the elevation into uniform sized bins, and determining the average intensity of points as a function of elevation bins. This provides us with a co-registered cube of waveform-like LiDAR data that is coregistered with our hyperspectral image. We note that like spectral reflectance profiles that have unique shapes depending on the material in the pixel, shapes of pseudo-waveform also correlate with the material and topographic properties in the image. Hence, angular measures (such as provided by CKLADA) would be appropriate for such analysis compared to Euclidean measures. \subsection{Baselines} To validate the efficacy of the subspaces generated by CKLADA and CKADA, we setup classification experiments using the University of Houston multi-sensor dataset. We used popular and commonly employed embeddings as baselines to compare against, including CKLFDA and KPCA. Each of these embeddings was used with 3 classifiers: KNN, ML and SRC. We note that CKLFDA is a composite kernel counterpart of LFDA based on Euclidean distance measures, and is the best possible multi-source embedding that can be compared with CKLADA --- a comparison of CKLFDA vs. CKLADA provides a direct understanding of the benefits of angular information for multi-source embeddings, and of the resulting algorithmic framework proposed in sec. \ref{sec:proposed}. With CKLFDA, CKADA and CKLADA, we treat each sensor (hyperspectral imagery and pseudo-waveform LiDAR) as a source, each getting its dedicated base kernel. With a single kernel KPCA, we stack features from the two sensors and project them via a single transformation based on these methods. In all cases, we use RBF kernels as our base kernels, and the width of the kernel is determined via cross validation. Other free parameters including sparsity level used in SRC, number of nearest neighbors in $K-NN$ are also determined empirically from the training data via cross-validation. \subsection{Visualization of Embeddings} To provide a visual demonstration on the power of composite kernel angular discriminant analysis for geospatial image analysis, we provide visualization of composite kernel projections CKLADA, CKADA (both angular discriminant analysis) and CKLFDA. These results are depicted in fig. \ref{fig:img_vis}. The figure depicts false color images generated by projecting the multi-sensor data onto the first three most significant eigenvectors learned from CKLADA, CKADA and CKLFDA respectively. It can be clearly seen that CKLADA (and CKADA to some degree) preserve object specific properties throughout the image (for example, the highly textured objects such as urban vegetation, residential areas etc. have their spatial context significantly preserved in the lower dimensional subspace). On the contrary, CKLFDA, which can be considered as the closest benchmark/baseline competitor does not perform as well. Further, towards the right corner of the image, we point the reader to the substantial benefit of CKLADA under cloud shadows - spatial structures under cloud shadows are visible under CKLADA (and CKADA to some extent), but not when using CKLFDA. \begin{figure*}[ht] \centering \begin{subfigure}{\linewidth} \centering \includegraphics[height=4cm]{cklada.jpg} \\ \caption{CKLADA (Proposed)} \end{subfigure} \begin{subfigure}{\linewidth} \centering \includegraphics[height=4cm]{ckada.jpg} \\ \caption{CKADA (Proposed)} \end{subfigure} \begin{subfigure}{\linewidth} \centering \includegraphics[height=4cm]{cklfda.jpg} \caption{CKLFDA \cite{YP2015}} \end{subfigure} \caption{Visualizing the projections as false color images resulting from projecting the multi-sensor data onto the first 3 significant eigenvectors using (a) CKLADA (proposed); (b) CKADA (proposed); and (c) CKLFDA.} \label{fig:img_vis} \end{figure*} \subsection{Comparative Results} Experimental results comparing performance of CKADA and CKLADA with baseline embeddings are provided. As mentioned previously, free parameters were determined empirically via cross-validation. Tab. \ref{tab:res_ss} depicts overall accuracy as a function of training sample size, ranging from a small to a sufficiently large value for the proposed and baseline embeddings with various classifiers. We notice that the proposed composite kernel angular discriminant analysis approaches (CKADA and CKLADA) provide anywhere from $5-10\%$ improvement in performance compared to state of the art (CKLFDA), and provide even higher accuracies compared to a traditional single-kernel baseline, KPCA. We note that even when using very limited training data, CKLADA is able to substantially outperform other composite kernel and single-kernel methods (using just 10 samples per class, we obtain as much as a $10\%$ gain in performance with CKLADA). Even when using a sufficiently large training sample set (e.g. 50 samples per class), CKLADA and CKADA outperform other methods. In Tab. {\ref{tab:res_src}, Tab. \ref{tab:res_ml}, and Tab. \ref{tab:res_knn},} we depict class specific accuracies, overall and average accuracies using the proposed methods and baselines using SRC, ML and KNN classifiers respectively. Once again, it is clear that CKADA and CKLADA consistently provide robust classification, particularly for the ``difficult'' classes (such as residential buildings, commercial buildings, roads, parking lots etc.). We also provide classification maps in fig. \ref{fig:map_uh} using the proposed method (CKLADA) and its closest competitor, CKLFDA, using the SRC classifier. We note that CKLADA results in a map with very little noise and misclassifications, and is particularly robust under the very challenging area in the right corner of the image that is under a cloud shadow (for e.g., when using CKLFDA, the area under a cloud shadow get systematically misclassified as water --- something that is visibly remedied by CKLADA). The improvements to misclassifications occurring over difficult classes is even more apparent with these ground cover classification maps. \begin{table*}[ht] \centering \caption{Comparison of various feature embedding algorithms for multi-sensor image analysis as a function of training sample size} \begin{tabular}{c c c c c c} \hline \multirow{2}{*}{Method} & \multicolumn{5}{c}{Number of training samples per class} \\ & 10 & 20 & 30 & 40 & 50\\ \hline CKLADA-SRC & 73.2$\pm$3.8 & 87.1$\pm$1.1 & 90.4$\pm$1.1 & 92.3$\pm$0.9 & 93.3$\pm$0.9 \\ CKADA-SRC & 74.5$\pm$2.3 & 85.8$\pm$1.2 & 89.2$\pm$1.2 & 91.2$\pm$1.1 & 92.3$\pm$0.8 \\ CKLFDA-SRC & 66.6$\pm$2.5 & 81.6$\pm$1.6 & 86.2$\pm$1.3 & 87.8$\pm$1.0 & 88.9$\pm$1.0 \\ KPCA-SRC & 67.9$\pm$1.4 & 79.3$\pm$1.3 & 84.1$\pm$1.1 & 86.7$\pm$0.8 & 88.5$\pm$0.9 \\ CKLADA-ML & 74.33$\pm$2.4 & 85.7$\pm$1.6 & 91.1$\pm$1.2 & 93.3$\pm$1.0 & 94.3$\pm$0.7 \\ CKADA-ML & 77.2$\pm$2.7 & 86.7$\pm$1.6 & 91.6$\pm$1.2 & 93.0$\pm$1.0 & 94.0$\pm$0.8 \\ CKLFDA-ML & 70.4$\pm$2.4 & 81.2$\pm$1.7 & 86.7$\pm$1.6 & 88.9$\pm$1.1 & 90.2$\pm$1.0 \\ KPCA-ML & 72.15$\pm$2.7 & 85.1$\pm$1.9 & 91.2$\pm$1.2 & 93.3$\pm$1.0 & 94.3$\pm$0.8 \\ CKLADA-KNN & 80.3$\pm$1.7 & 88.1$\pm$1.3 & 91.4$\pm$1.0 & 93.0$\pm$0.9 & 93.9$\pm$0.7 \\ CKADA-KNN & 80.3$\pm$1.6 & 87.0$\pm$1.2 & 90.1$\pm$1.0 & 91.4$\pm$0.9 & 92.4$\pm$0.8 \\ CKLFDA-KNN & 70.7$\pm$2.2 & 82.5$\pm$1.6 & 86.5$\pm$1.2 & 88.1$\pm$1.0 & 89.3$\pm$0.9 \\ KPCA-KNN & 69.7$\pm$1.6 & 79.2$\pm$1.1 & 83.7$\pm$1.3 & 86.4$\pm$0.9 & 87.8$\pm$0.9 \\ \hline \end{tabular} \label{tab:res_ss} \end{table*} \begin{table*}[ht] \centering \caption{Using proposed and baseline feature embeddings with SRC} \begin{tabular}{c||c|c||c c c c} \hline \hline \multirow{2}{*}{Class} & \multicolumn{2}{c||}{Samples} & \multicolumn{4}{c}{Methods} \\ &Train & Test & CKLADA & CKADA & CKLFDA & KPCA \\ \hline \hline Grass-healthy & 30 & 168 & 99.4$\pm$1.0 & 99.0$\pm$2.0 & 98.6$\pm$1.7 & 98.0$\pm$1.8 \\ \cline{2-3} Grass-stressed & 30 & 160 & 97.7$\pm$1.4 & 96.0$\pm$1.6 & 98.0$\pm$1.2 & 95.9$\pm$3.1 \\ \cline{2-3 Grass-synthetic & 30 & 162 & 99.7$\pm$0.5 & 99.7$\pm$0.4 & 95.8$\pm$2.5 & 98.3$\pm$1.3 \\ \cline{2-3 Tree & 30 & 158 & 98.1$\pm$1.2 & 95.9$\pm$2.7 & 98.8$\pm$1.2 & 99.5$\pm$0.5 \\ \cline{2-3 Soil & 30 & 156 & 99.8$\pm$0.3 & 98.6$\pm$0.9 & 98.5$\pm$1.7 & 97.3$\pm$2.4 \\ \cline{2-3 Water & 30 & 152 & 98.7$\pm$2.3 & 95.1$\pm$3.0 & 97.0$\pm$2.3 & 96.9$\pm$2.3 \\ \cline{2-3 Residential & 30 & 166 & 85.8$\pm$5.5 & 81.3$\pm$5.0 & 80.3$\pm$4.6 & 77.1$\pm$6.1 \\ \cline{2-3 Commercial & 30 & 161 & 86.8$\pm$5.5 & 82.9$\pm$6.4 & 77.2$\pm$6.4 & 79.5$\pm$5.6 \\ \cline{2-3 Road & 30 & 163 & 80.2$\pm$5.7 & 78.5$\pm$6.1 & 73.7$\pm$5.5 & 64.4$\pm$5.1 \\ \cline{2-3 Highway & 30 & 161 & 90.9$\pm$3.2 & 90.8$\pm$3.7 & 86.9$\pm$3.9 & 77.9$\pm$5.2 \\ \cline{2-3 Railway & 30 & 151 & 88.5$\pm$3.9 & 86.2$\pm$4.5 & 82.6$\pm$4.1 & 76.1$\pm$5.8 \\ \cline{2-3 Parking Lot 1 & 30 & 162 & 75.2$\pm$5.7 & 74.2$\pm$6.3 & 67.8$\pm$6.4 & 62.3$\pm$5.0 \\ \cline{2-3 Parking Lot 2 & 30 & 154 & 65.5$\pm$4.7 & 74.5$\pm$4.5 & 58.4$\pm$6.8 & 50.7$\pm$5.7 \\ \cline{2-3 Tennis Court & 30 & 151 & 99.5$\pm$0.5 & 98.5$\pm$1.1 & 98.6$\pm$2.0 & 96.6$\pm$2.2 \\ \cline{2-3 Running Track & 30 & 157 & 98.9$\pm$0.5 & 98.7$\pm$0.7 & 98.4$\pm$0.9 & 99.8$\pm$0.4 \\ \cline{2-3 \hline \hline OA & -- & -- & 91.0$\pm$1.0 & 89.9$\pm$0.9 & 87.3$\pm$1.2 & 84.7$\pm$1.1 \\%& 81.4$\pm$1.8 & 72.6$\pm$7.7 \\ AA & -- & -- & 91.0$\pm$2.8 & 90.0$\pm$3.2 & 87.4$\pm$3.4 & 84.7$\pm$3.5 \\%& 81.5$\pm$4.5 & 72.7$\pm$10.8 \\ \hline \end{tabular} \label{tab:res_src} \end{table*} \begin{table*}[ht] \centering \caption{Using proposed and baseline feature embeddings with Gaussian ML} \begin{tabular}{c||c|c||c c c c} \hline \hline \multirow{2}{*}{Class} & \multicolumn{2}{c||}{Samples} & \multicolumn{4}{c}{Methods} \\ &Train & Test & CKLADA & CKADA & CKLFDA & KPCA \\ \hline \hline Grass-healthy & 30 & 168 & 94.9$\pm$5.4 & 95.1$\pm$4.1 & 92.6$\pm$5.2 & 95.9$\pm$4.4 \\ \cline{2-3} Grass-stressed & 30 & 160 & 99.4$\pm$0.8 & 97.8$\pm$1.9 & 99.8$\pm$0.3 & 98.6$\pm$1.9 \\ \cline{2-3} Grass-synthetic & 30 & 162 & 96.5$\pm$0.3 & 96.8$\pm$2.7 & 88.2$\pm$4.8 & 96.7$\pm$2.7 \\ \cline{2-3} Tree & 30 & 158 & 99.7$\pm$0.8 & 99.5$\pm$0.8 & 98.9$\pm$1.7 & 99.9$\pm$0.3 \\ \cline{2-3} Soil & 30 & 156 & 97.6$\pm$2.7 & 93.2$\pm$4.4 & 95.0$\pm$4.4 & 97.4$\pm$2.5 \\ \cline{2-3} Water & 30 & 152 & 95.1$\pm$2.9 & 92.6$\pm$4.0 & 94.0$\pm$3.5 & 96.0$\pm$2.8 \\ \cline{2-3} Residential & 30 & 166 & 86.1$\pm$6.9 & 80.8$\pm$6.9 & 82.4$\pm$7.9 & 82.2$\pm$7.8 \\ \cline{2-3} Commercial & 30 & 161 & 86.1$\pm$8.3 & 91.3$\pm$6.6 & 73.5$\pm$11.8 & 86.5$\pm$9.7 \\ \cline{2-3} Road & 30 & 163 & 83.5$\pm$8.6 & 87.8$\pm$6.8 & 76.8$\pm$7.2 & 82.6$\pm$8.9 \\ \cline{2-3} Highway & 30 & 161 & 82.8$\pm$8.3 & 83.9$\pm$6.9 & 76.7$\pm$7.8 & 83.4$\pm$8.3 \\ \cline{2-3} Railway & 30 & 151 & 84.5$\pm$7.7 & 81.8$\pm$7.6 & 80.6$\pm$8.0 & 83.6$\pm$8.6 \\ \cline{2-3} Parking Lot 1 & 30 & 162 & 71.7$\pm$8.7 & 49.8$\pm$11.6 & 64.5$\pm$7.6 & 71.8$\pm$10.2 \\ \cline{2-3} Parking Lot 2 & 30 & 154 & 92.2$\pm$3.3 & 96.7$\pm$1.5 & 84.8$\pm$6.7 & 92.5$\pm$4.3 \\ \cline{2-3} Tennis Court & 30 & 151 & 98.0$\pm$2.0 & 96.7$\pm$3.4 & 95.5$\pm$2.8 & 98.5$\pm$1.9 \\ \cline{2-3} Running Track & 30 & 157 & 96.6$\pm$2.0 & 97.1$\pm$1.9 & 94.9$\pm$2.9 & 97.9$\pm$1.5 \\ \cline{2-3} \hline \hline OA & -- & -- & 90.9$\pm$1.2 & 89.3$\pm$1.3 & 86.5$\pm$1.3 & 84.6$\pm$1.6 \\ AA & -- & -- & 91.0$\pm$4.7 & 89.4$\pm$4.7 & 86.6$\pm$5.5 & 90.9$\pm$5.0 \\ \hline \end{tabular} \label{tab:res_ml} \end{table*} \begin{table*}[ht] \centering \caption{Using proposed and baseline feature embeddings with KNN} \begin{tabular}{c||c|c||c c c c} \hline \hline \multirow{2}{*}{Class} & \multicolumn{2}{c||}{Samples} & \multicolumn{4}{c}{Methods} \\ &Train & Test & CKLADA & CKADA & CKLFDA & KPCA \\ \hline \hline Grass-healthy & 30 & 168 & 98.6$\pm$3.0 & 99.4$\pm$2.3 & 97.4$\pm$2.9 & 98.2$\pm$2.8 \\ \cline{2-3} Grass-stressed & 30 & 160 & 97.5$\pm$1.5 & 96.9$\pm$1.4 & 97.3$\pm$2.0 & 97.2$\pm$2.6 \\ \cline{2-3} Grass-synthetic & 30 & 162 & 99.5$\pm$0.8 & 99.7$\pm$0.4 & 96.9$\pm$1.9 & 97.9$\pm$1.6 \\ \cline{2-3} Tree & 30 & 158 & 98.1$\pm$1.8 & 96.0$\pm$2.7 & 96.9$\pm$2.9 & 99.7$\pm$0.4 \\ \cline{2-3} Soil & 30 & 156 & 99.7$\pm$0.5 & 98.5$\pm$0.8 & 98.1$\pm$2.6 & 98.1$\pm$1.1 \\ \cline{2-3} Water & 30 & 152 & 98.4$\pm$2.4 & 94.8$\pm$2.4 & 97.3$\pm$2.2 & 96.4$\pm$1.7 \\ \cline{2-3} Residential & 30 & 166 & 84.6$\pm$5.2 & 79.6$\pm$6.3 & 73.8$\pm$6.0 & 64.4$\pm$6.7 \\ \cline{2-3} Commercial & 30 & 161 & 82.1$\pm$8.1 & 76.4$\pm$8.2 & 77.5$\pm$7.8 & 79.2$\pm$6.7 \\ \cline{2-3} Road & 30 & 163 & 83.1$\pm$4.9 & 78.7$\pm$5.1 & 74.0$\pm$5.8 & 64.3$\pm$5.3 \\ \cline{2-3} Highway & 30 & 161 & 94.3$\pm$2.7 & 93.3$\pm$3.2 & 89.0$\pm$3.4 & 80.8$\pm$3.8 \\ \cline{2-3} Railway & 30 & 151 & 93.4$\pm$3.2 & 90.3$\pm$4.2 & 83.9$\pm$5.3 & 76.0$\pm$6.3 \\ \cline{2-3} Parking Lot 1 & 30 & 162 & 78.8$\pm$5.9 & 76.6$\pm$6.4 & 70.7$\pm$6.5 & 67.8$\pm$6.5 \\ \cline{2-3} Parking Lot 2 & 30 & 154 & 65.4$\pm$5.0 & 69.6$\pm$4.1 & 54.2$\pm$4.9 & 41.0$\pm$4.7 \\ \cline{2-3} Tennis Court & 30 & 151 & 99.6$\pm$0.5 & 99.2$\pm$0.8 & 98.3$\pm$1.7 & 99.3$\pm$0.7 \\ \cline{2-3} Running Track & 30 & 157 & 99.1$\pm$0.4 & 98.8$\pm$0.6 & 97.7$\pm$1.0 & 99.2$\pm$0.7 \\ \cline{2-3} \hline \hline OA & -- & -- & 91.5$\pm$1.1 & 89.8$\pm$1.0 & 86.8$\pm$1.1 & 83.9$\pm$1.1 \\ AA & -- & -- & 91.5$\pm$3.1 & 89.8$\pm$3.3 & 86.7$\pm$3.8 & 84.0$\pm$3.4 \\ \hline \end{tabular} \label{tab:res_knn} \end{table*} \begin{figure*}[ht] \centering \begin{subfigure}{\linewidth} \centering \includegraphics[width=16.4cm]{cklada_src_20.png} \\ \caption{Classification map generated using CKLADA (Proposed) with 20 training samples per class.} \end{subfigure} \begin{subfigure}{\linewidth} \centering \includegraphics[width=16.2cm]{cklfda_src_20.png} \\ \caption{Classification map generated using CKLFDA \cite{YP2015} with 20 training samples per class.} \vspace{12pt} \includegraphics[width=15cm]{color_bar.jpg} \end{subfigure} \caption{Classification maps obtained from the multi-source (hyperspectral and pseudo-waveform LiDAR) dataset using (a) the proposed CKLADA embedding and (b) a CKLFDA (bottom) embedding, both with an SRC classifier following the embedding, and with 20 samples per class for training.} \label{fig:map_uh} \end{figure*} \section{Conclusions \label{sec:Conclusions} We presented a composite kernel variant of angular discriminant analysis and local angular discriminant analysis. Angular discriminant analysis was previously shown to be very beneficial for high dimensional hyperspectral classification. In this paper, we expanded those developments via a composite kernel and demonstrated that this paradigm can be a very useful feature embedding algorithm in multi-source scenarios, such as when fusing multiple geospatial images. We validated our results with a popular multi-sensor benchmark and demonstrated that composite kernel angular discriminant analysis consistently outperforms other feature embeddings. \bibliographystyle{IEEEtran}
{'timestamp': '2016-07-19T02:09:45', 'yymm': '1607', 'arxiv_id': '1607.04939', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04939'}
arxiv
\section*{\refname}% \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}% \list{\@biblabel{\@arabic\c@enumiv}}% {\settowidth\labelwidth{\@biblabel{#1}}% \leftmargin\labelwidth \advance\leftmargin\labelsep \@openbib@code \usecounter{enumiv}% \let\p@enumiv\@empty \itemsep=0pt \parsep=0pt \leftmargin=\parindent \itemindent=-\parindent \renewcommand\theenumiv{\@arabic\c@enumiv}}% \sloppy \clubpenalty4000 \@clubpenalty \clubpenalty \widowpenalty4000% \sfcode`\.\@m} {\def\@noitemerr {\@latex@warning{Empty `thebibliography' environment}}% \endlist} \makeatother \begin{document} \graphicspath{{Figs/}} \maketitle \begin{abstract} \noindent We propose a flexible means of estimating vector autoregressions with time-varying parameters (TVP-VARs) by introducing a latent threshold process that is driven by the absolute size of parameter changes. This enables us to dynamically detect whether a given regression coefficient is constant or time-varying. When applied to a medium-scale macroeconomic US dataset our model yields precise density and turning point predictions, especially during economic downturns, and provides new insights on the changing effects of increases in short-term interest rates over time. \end{abstract} \textbf{\small Keywords:} {\small Change point model, Threshold mixture innovations, Structural breaks, Shrinkage, Bayesian statistics, Monetary policy.}\\[-1em] \textbf{\small JEL Codes}: C11, C32, C52, E42.\\[-1em] \newpage \section{Introduction} \label{sec:intro} In the last few years, economists in policy institutions and central banks were criticized for their failure to foresee the recent financial crisis that engulfed the world economy and led to a sharp drop in economic activity. Critics argued that economists failed to predict the crisis because models commonly utilized at policy institutions back then were too simplistic. For instance, the majority of forecasting models adopted were (and possibly still are) linear and low dimensional. The former implies that the underlying structural mechanisms and the volatility of economic shocks are assumed to remain constant over time -- a rather restrictive assumption. The latter implies that only little information is exploited which may be detrimental for obtaining reliable predictions. In light of this criticism, practitioners started to develop more complex models that are capable of capturing salient features of time series commonly observed in macroeconomics and finance. Recent research \citep{stock1996evidence,cogley2002evolving,cogley2005drifts,primiceri2005time,sims2006were} suggests that, at least for US data, there is considerable evidence that the influence of certain variables appears to be time-varying. This raises additional issues related to model specification and estimation. For instance, do all regression parameters vary over time? Or is time variation just limited to a specific subset of the parameter space? Moreover, as is the case with virtually any modeling problem, the question whether a given variable should be included in the model in the first place naturally arises. Apart from deciding whether parameters are changing over time, the nature of the process that drives the dynamics of the coefficients also proves to be an important modeling decision. In a recent contribution, \cite{fruhwirth2010stochastic} focus on model specification issues within the general framework of state space models. Exploiting a non-centered parametrization of the model allows them to rewrite the model in terms of a constant parameter specification, effectively capturing the steady state of the process along with deviations thereof. The non-centered parameterization is subsequently used to search for appropriate model specifications, imposing shrinkage on the steady state part and the corresponding deviations. Recent research aims to discriminate between inclusion/exclusion of elements of different variables and whether the associated regression coefficient is constant or time-varying \citep{belmonte2014hierarchical, eisenstat2016stochastic,koop2012forecasting,koop2013large, kalli2014time}. Another strand of the literature asks whether coefficients are constant or time-varying by assuming that the innovation variance in the state equation is characterized by a change point process \citep{mcculloch1993bayesian,gerlach2000efficient, koop2009evolution, giordani2012efficient}. However, the main drawback of this modeling approach is the severe computational burden originating from the need to simulate additional latent states for each parameter. This renders estimation of large dimensional models like vector autoregressions (VARs) unfeasible. To circumvent such problems, \cite{koop2009evolution} estimate a single Bernoulli random variable to discriminate between time constancy and parameter variation for the autoregressive coefficients, the covariances, and the log-volatilities, respectively. This assumption, however, implies that either all autoregressive parameters change over a given time frame, or none of them. Along these lines, \cite{mah-son:eff} allow for independent breaks in regression coefficients and the volatility parameters. However, they show that their multivariate approach is inferior to univariate change point models when out-of-sample forecasts are considered and conclude that allowing for independent breaks in each series is important. In the present paper, we introduce a method that can be applied to a highly parameterized VAR model by combining ideas from the literature of latent threshold models \citep{nee-dun:bay, nakajima2013bayesian,nakajima2013dynamic,zhou2014bayesian,kimura2016identifying} and mixture innovation models. Specifically, we introduce a set of latent thresholds that controls the degree of time-variation separately for each parameter and for each point in time. This is achieved by estimating variable-specific thresholds that allow for movements in the autoregressive parameters if the proposed change of the parameter is large enough. We show that this can be achieved by assuming that the innovations of the state equation follow a threshold model that discriminates between a situation where the innovation variance is large and a case with an innovation variance set (very close) to zero. The proposed framework nests a wide variety of competing models, most notably the standard time-varying parameter model, a change-point model with an unknown number of regimes, mixtures between different models, and finally the simple constant parameter model. To assess systematically, in a data-driven fashion, which predictors should be included in the model, we impose a set of Normal-Gamma priors \citep{griffin2010inference} in the spirit of \cite{bitto2015achieving} on the initial state of the system. We illustrate the empirical merits of our approach by carrying out an extensive forecasting exercise based on a medium-scale US dataset. Our proposed framework is benchmarked against two constant parameter Bayesian VAR models with stochastic volatility and hierarchical shrinkage priors. The findings indicate that the threshold time-varying parameter VAR excels in crisis periods while being only slightly inferior during ``normal'' periods in terms of one-step-ahead log predictive likelihoods. Considering turning point predictions for GDP growth, our model outperforms the constant parameter benchmarks when upward turning points are considered while yielding similar forecasts for downward turning points. In the second part of the application, we provide evidence on the degree of time-variation of the underlying causal mechanisms for the USA. Considering the determinant of the time-varying variance-covariance matrix of the state innovations as a global measure for the strength of parameter movements, we find that those movements reach a maximum in the beginning of the 1980s while displaying only relatively modest movements before and after that period. Consequently, we investigate the effects of a monetary policy shock for the pre- and post-1980 periods separately. This exercise reveals a considerable prize puzzle in the 1960s which starts disappearing in the early 1980s. Moreover, considering the most recent part of our sample period, we find evidence for increased effectiveness of monetary policy. This is especially pronounced during the aftermath of the global financial crisis in 2008/09. The paper is structured as follows. Section~\ref{sec:framework} introduces the modeling approach, the prior setup and the corresponding MCMC algorithm for posterior simulation. Section~\ref{sec:illustration} illustrates the behavior of the model by showcasing scenarios with few, moderately many, and many jumps in the state equation. In Section~\ref{sec:application}, we apply the model to a medium-scale US macroeconomic dataset and assess its predictive capabilities against a range of competing models in terms of density and turning point predictions. Moreover, we investigate during which periods VAR coefficients display the largest amount of time-variation and consider the associated implications on dynamic responses with respect to a monetary policy shock. Finally, Section~\ref{sec:conclusion} concludes. \section{Econometric framework} \label{sec:framework} We begin by specifying a flexible model that is capable of discriminating between constant and time-varying parameters at each point in time. \subsection{A threshold mixture innovation model} \label{sec:model} Consider the following dynamic regression model, \begin{equation} y_t = \boldsymbol{x}_t' \boldsymbol{\beta}_t + u_t, ~u_t \sim \mathcal{N}(0, \sigma_t^2)\label{eq:obs}, \end{equation} where $\boldsymbol{x}_t$ is a $K$-dimensional vector of explanatory variables and $\boldsymbol{\beta}_t =(\beta_{1t},\dots,\beta_{Kt})'$ a vector of regression coefficients. The error term $u_t$ is assumed to be independently normally distributed with (potentially) time-varying variance. This model assumes that the relationship between elements of $\boldsymbol{x}_t$ and $y_t$ is not necessarily constant over time, but changes subject to some law of motion for $\boldsymbol{\beta}_t$. Typically, researchers assume that the $j$th element of $\boldsymbol{\beta}_t$ ($j = 1,\dots,K)$ follows a random walk process, \begin{equation} \beta_{jt} = \beta_{j,t-1}+e_{jt},~e_{jt} \sim \mathcal{N}(0,\vartheta_j), \label{eq:states1} \end{equation} with $\vartheta_j$ denoting the innovation variance of the latent states. \autoref{eq:states1} implies that parameters evolve gradually over time, ruling out abrupt changes. While being conceptually flexible, in the presence of only a few breaks in the parameters, this model generates spurious movements in the coefficients that could be detrimental for the empirical performance of the model \citep{d2013macroeconomic}. Thus, we deviate from \autoref{eq:states1} by specifying the innovations of the state equation $e_{jt}$ to be a mixture distribution. More concretely, let \begin{align} e_{jt} &\sim \mathcal{N}(0, \theta_{jt}),\\ \label{eq:threshold_1} \theta_{jt} &=s_{jt} \vartheta_{j1}+(1-s_{jt}) \vartheta_{j0}, \end{align} where $s_{jt}$ is an indicator variable with an unconditional Bernoulli distribution. This mechanism is closely related to an absolutely continuous spike-and-slab prior where the slab has variance $\vartheta_{j1}$ and the spike has variance $\vartheta_{j0}$ with $\vartheta_{j1} \gg \vartheta_{j0}$ \citep[see e.g.,][for an excellent survey on this class of priors]{mal-wag:com}. In the present framework we assume that the conditional distribution $p(s_{jt}|\Delta \beta_t)$ follows a threshold process, \begin{equation} s_{jt} = \begin{cases} 1 ~\text{ if }~ |\Delta \beta_{jt}|>d_j, \\ 0 ~\text{ if } ~ |\Delta \beta_{jt}|\le d_j, \end{cases} \label{eq:threshold_2} \end{equation} where $d_j$ is a coefficient-specific threshold to be estimated and $\Delta \beta_{jt} := \beta_{jt}-\beta_{j,t-1}$. Equations (\ref{eq:threshold_1}) and (\ref{eq:threshold_2}) state that if the absolute period-on-period change of $\beta_{jt}$ exceeds a threshold $d_j$, we assume that the change in $\beta_{jt}$ is normally distributed with zero mean and variance $\vartheta_{j1}$. On the contrary, if the change in the parameter is too small, the innovation variance is set close to zero, effectively implying that $\beta_{jt} \approx \beta_{j,t-1}$, i.e.,~almost no change from period $(t-1)$ to $t$. This modeling approach provides a great deal of flexibility, nesting a plethora of simpler model specifications. The interesting cases are characterized by situations where $s_{jt}$ equals unity only for some $t$. For instance, it could be the case that parameters tend to exhibit strong movements at given points in time but stay constant for the majority of the time. An unrestricted time-varying parameter model would imply that the parameters are gradually changing over time, depending on the innovation variance in \autoref{eq:states1}. Another prominent case would be a structural break model with an unknown number of breaks \citep[for a recent Bayesian exposition, see][]{koop2007estimation}. The mixture innovation component in \autoref{eq:threshold_1} implies that we discriminate between two regimes. The first regime assumes that changes in the parameters tend to be large and important to predict $y_t$ whereas in the second regime, these changes can be safely regarded as zero, thus effectively leading to a constant parameter model over a given period of time. Compared to a standard mixture innovation model that postulates $s_{jt}$ as a sequence of independent Bernoulli variables, our approach assumes that regime shifts are governed by a (conditionally) deterministic law of motion. The main advantage of our approach relative to mixture innovation models is that instead of having to estimate a full sequence of $s_{jt}$ for all $j$, the threshold mixture innovation model only relies on a single additional parameter per coefficient. This renders estimation of high dimensional models such as vector autoregressions (VARs) feasible. The additional computational burden turns out to be negligible relative to an unrestricted TVP-VAR, see Section~\ref{sec:mcmc} for more information. Our model is also closely related to the latent thresholding approach put forward in \cite{nakajima2013bayesian} within the time series context. While in their model latent thresholding discriminates between the inclusion or exclusion of a given covariate at time $t$, our model detects whether the associated regression coefficient is constant or time-varying. \subsection{The threshold mixture innovation TTVP-VAR model} The model proposed in the previous subsection can be straightforwardly generalized to the VAR case with stochastic volatility (SV) by assuming that $\boldsymbol{y}_t$ is an $m$-dimensional response vector. In this case, \autoref{eq:obs} becomes, \begin{equation} \boldsymbol{y}_t = \boldsymbol{x}_t' \boldsymbol{\beta}_t+\boldsymbol{u}_t, \end{equation} with $\boldsymbol{x}'_t = \{\boldsymbol{I}_M \otimes \boldsymbol{z}'_t\}$, where $\boldsymbol{z}_t = (\boldsymbol{y}'_{t-1}, \dots, \boldsymbol{y}'_{t-P})'$ includes the $P$ lags of the endogenous variables.\footnote{In the empirical application, we also include an intercept term which we omit here for simplicity.} The vector $\boldsymbol{\beta}_t$ now contains the dynamic autoregressive coefficients with dimension $K=M^2p$ where each element follows the state equation given by Eqs. (\ref{eq:states1}) to (\ref{eq:threshold_2}). The vector of white noise shocks $\boldsymbol{u}_t$ is distributed as \begin{equation} \boldsymbol{u}_t \sim \mathcal{N}(\boldsymbol{0}_m, \boldsymbol{\Sigma}_t). \end{equation} Hereby, $\boldsymbol{0}_m$ denotes an $m$-variate zero vector and $\boldsymbol{\Sigma}_t = \boldsymbol{V}_t \boldsymbol{H}_t \boldsymbol{V}_t'$ is a time-varying variance-covariance matrix. The matrix $\boldsymbol{V}_t$ is a lower triangular matrix with unit diagonal and $\boldsymbol{H}_t = \text{diag}(e^{h_{1t}},\dots,e^{h_{mt}})$. We assume that the logarithm of the variances evolves according to \begin{equation} h_{it} = \mu_i + \rho_i (h_{i,t-1}+\mu_i) + \nu_{it},~\text{ for }~i=1,\dots,m, \end{equation} with $\mu_i$ and $\rho_i$ being equation-specific mean and persistence parameters and $\nu_{it} \sim \mathcal{N}(0,\zeta_i)$ is an equation-specific white noise error with variance $\zeta_i$. For the covariances in $\boldsymbol{V}_t$ we impose the random walk state equation with error variances given by \autoref{eq:threshold_1}. Conditional on the ordering of the variables it is straightforward to estimate the TTVP model on an equation-by-equation basis, augmenting the $i$th equation with the contemporaneous values of the preceding $(i-1)$ equations (for $i>1$), leading to a Cholesky-type decomposition of the variance-covariance matrix. Thus, the $i$th equation (for $i=2,\dots,m$) is given by \begin{equation} y_{it} = \tilde{\boldsymbol{z}}'_{it} \tilde{\boldsymbol{\beta}}_{it}+ u_{it}. \label{eq: vareqspecific} \end{equation} We let $\tilde{\boldsymbol{z}}_{it}= (\boldsymbol{z}'_t, y_{1t},\dots, y_{i-1, t})'$, and $\tilde{\boldsymbol{\beta}}_{it}=(\boldsymbol{\beta}_{it}', \tilde{v}_{i1, t}, \dots, \tilde{v}_{i i-1, t})'$ is a vector of latent states with dimension $K_i= Mp+i-1$. Here, $\tilde{v}_{ij, t}$ denotes the dynamic regression coefficients on the $j$th (for $j<i$) contemporaneous value showing up in the $i$th equation. Note that for the first equation we have $\tilde{\boldsymbol{z}}_{1t}= \boldsymbol{z}_t$ and $\tilde{\boldsymbol{\beta}}_{1t}=\boldsymbol{\beta}_{1t}$. The law of motion of the $j$th element of $\tilde{\boldsymbol{\beta}}_{it}$ reads \begin{equation} \tilde{\beta}_{ij,t} = \tilde{\beta}_{ij,t-1}+\sqrt{\theta_{ij,t}} r_t, ~ r_t \sim \mathcal{N}(0,1). \end{equation} Hereby, $\theta_{ij,t}$ is defined similarly to \autoref{eq:threshold_1}. In what follows, it proves to be convenient to stack the states of all equations in a $K$-dimensional vector $\tilde{\boldsymbol{\beta}}_t = (\boldsymbol{\beta}'_{1t},\dots, \tilde{\boldsymbol{\beta}}'_{Mt})'$ and let $\tilde{\beta}_{jt}$ denote the $j$th element of $\tilde{\boldsymbol{\beta}}_t$. While being clearly not order-invariant, this specific way of stating the model yields two significant computational gains. First, the matrix operations involved in estimating the latent state vector become computationally less cumbersome. Second, we can exploit parallel computing and estimate each equation simultaneously on a grid. \subsection{Prior specification} \label{sec:priors} Since our approach to estimation and inference is Bayesian, we have to specify suitable prior distributions for all parameters of the model. We impose a Normal-Gamma prior \citep{griffin2010inference} on each element of $\tilde{\boldsymbol{\beta}}_{i0}$, the initial state of the $i$th equation, \begin{equation} \tilde{\beta}_{0i,j}|\tau_{j} \sim \mathcal{N}\left(0, \frac{2}{\lambda_i^2} \tau^2_{ij}\right),~\tau^2_{ij} \sim \mathcal{G}(a_{i},a_{i}), \end{equation} for $i=1,\dots,m; j=1,\dots, K_i$. Hereby, $\lambda_i^2$ and $a_{i}$ are hyperparameters and $\tau^2_{ij}$ denotes an idiosyncratic scaling parameter that applies an individual degree of shrinkage on each element of $\tilde{\boldsymbol{\beta}}_{i0}$. The hyperparameter $\lambda_i^2$ serves as an equation-specific shrinkage parameter that shrinks all elements of $\tilde{\boldsymbol{\beta}}_{i0}$ that belong to the $i$th equation towards zero while the local shrinkage parameters $\tau_{ij}$ provide enough flexibility to also allow for non-zero values of $\tilde{\beta}_{0i, j}$ in the presence of a tight global prior specification. For the equation-specific scaling parameter $\lambda_i^2$ we impose a Gamma prior, $ \lambda_i^2 \sim \mathcal{G}(b_0,b_1), $ with $b_0$ and $b_1$ being hyperparameters chosen by the researcher. In typical applications we specify $b_0$ and $b_1$ to render this prior effectively non-influential. If the innovation variances of the observation equation are assumed to be constant over time, we impose a Gamma prior on $\sigma_i^{-2}$ with hyperparameters $c_0$ and $c_1$, i.e.,~$\sigma_i^{-2} \sim \mathcal{G}(c_0, c_1)$. By contrast, if stochastic volatility is introduced we follow \cite{kastner2014ancillarity} and impose a normally distributed prior on $\mu_i$ with mean zero and variance $100$, a Beta prior on $\rho_i$ with $(\rho_i+1)/2\sim \mathcal{B}(a_\rho,b_\rho)$, and a Gamma distributed prior on $\zeta_i \sim \mathcal{G}(1/2, 1/(2B_\zeta))$. In principle, the spike variance $\vartheta_{ij,0}$ could be estimated from the data and a suitable shrinkage prior could be employed to push $\vartheta_{ij,0}$ towards zero. However, we follow a simpler approach and estimate the slab variance $\vartheta_{ij, 1}$ only while setting $\vartheta_{ij,0} = \xi \times \hat{\vartheta}_{ij}$. Here, $\hat{\vartheta}_{ij}$ denotes the variance of the OLS estimate for automatic scaling which we treat as a constant specified a priori. The multiplier $\xi$ is set to a fixed constant close to zero, effectively turning off any time-variation in the parameters. As long as $\vartheta_{ij,0}$ is not chosen too large, the specific value of the spike variance proves to be rather non-influential in the empirical applications that follow. We use a Gamma distributed prior on the inverse of the innovation variances in the state specification in \autoref{eq:states1}, i.e.,~$ \vartheta_{ij,1}^{-1} \sim \mathcal{G}(r_{ij,0}, r_{ij, 1})$ for $i=1,\dots,m; j=1,\dots,K_i$.\footnote{Of course, it would also be possible to use a (restricted) Gamma prior on $\vartheta_{ij,1}$ in the spirit of \cite{fruhwirth2010stochastic}. However, we have encountered some issues with such a prior if the number of observations in the regime associated with $s_{ij,t}=1$ is small. This stems from the fact that the corresponding conditional posterior distribution is generalized inverse Gaussian, a distribution that is heavy tailed and under certain conditions leads to excessively large draws of $\vartheta_{ij,1}$.} Again, $r_{ij, 0}$ and $r_{ij, 1}$ denote scalar hyperparameters. This choice implies that we artificially bound $\vartheta_{ij,1}$ away from zero, implying that in the upper regime we do not exert strong shrinkage. This is in contrast to a standard time-varying parameter model, where this prior is usually set rather tight to control the degree of time variation in the parameters \citep[see, e.g.,][]{primiceri2005time}. Note that in our model the degree of time variation is governed by the thresholding mechanism instead. Finally, the prior specification of the baseline model is completed by imposing a uniform distributed prior on the thresholds, \begin{equation} d_{ij} \sim \mathcal{U}(\pi_{ij,0}, \pi_{ij,1}) \text{ for } j=1,\dots,K_i. \label{eq:priorthresholds} \end{equation} Here, $\pi_{ij,0}$ and $\pi_{ij,1}$ denote the boundaries of the prior that have to be specified carefully. In our examples, we use $\pi_{0i,j} = 0.1 \times \sqrt{\vartheta_{ij,1}}$ and $\pi_{ij,1} = 1.5 \times \sqrt{\vartheta_{ij,1}}$. This prior bounds the thresholds away from zero, implying that a certain amount of shrinkage is always imposed on the autoregressive coefficients. Setting $\pi_{ij,0}=0$ for all $i,j$ would also be a feasible option but we found in simulations that being slightly informative on the presence of a threshold improves the empirical performance of the proposed model markedly. It is worth noting that even under the assumption that $\pi_{0j}>0$, our framework performs well in simulations where the data is obtained from a non-thresholded version of our model. This stems from the fact that in a situation where parameters are expected to evolve smoothly over time, the average period-on-period change of $\beta_{ij,t}$ is small, implying that $0.1 \times \sqrt{\vartheta_{ij,1}}$ is close to zero and the model effectively shrinks small parameter movements to zero. \subsection{Posterior simulation} \label{sec:mcmc} We sample from the joint posterior distribution of the model parameters by utilizing a Markov chain Monte Carlo (MCMC) algorithm. Conditional on the thresholds $d_{ij}$, the remaining parameters can be simulated in a straightforward fashion. After initializing the parameters using suitable starting values we iterate between the following six steps. \begin{enumerate} \item We start with equation-by-equation simulation of the full history $\{\tilde{\boldsymbol{\beta}}_{it}\}_{t=0,1,\dots,T}$ by means of a standard forward filtering backward sampling algorithm \citep{carter1994gibbs, fruhwirth1994data} while conditioning on the remaining parameters of the model \item The inverse of the innovation variances of \autoref{eq:states1}, $\vartheta^{-1}_{ij},~i=1,\dots,m; j=1,\dots,K_i$ have conditional density \[ p(\vartheta^{-1}_{ij}|\bullet)=p(\vartheta^{-1}_{ij}|d_{ij},\boldsymbol{\beta}) \propto p(\boldsymbol{\beta}|\vartheta^{-1}_{ij},d_{ij})p(d_{ij}|\vartheta^{-1}_{ij})p(\vartheta^{-1}_{ij}), \] which turns out to be a Gamma distribution, i.e., \begin{equation} \vartheta^{-1}_{ij}|\bullet \sim \mathcal{G}\left(r_{ij,0} + \frac{T_{ij,1}}{2} + \frac{1}{2},r_{ij,1}+\frac{\sum_{t=1}^{T}s_{ij,t}(\tilde{\beta}_{ij,t}-\tilde{\beta}_{ij,t-1})^2}{2}\right), \end{equation} with $T_{ij,t}=\sum_{t=1}^T s_{ij, t}$ denoting the number of time periods that feature time variation in the $j$th parameter and the $i$th equation. \item Combining the Gamma prior on $\tau_{ij}^2$ with the Gaussian likelihood yields a Generalized Inverted Gaussian (GIG) distribution \begin{equation} \tau_{ij}^2|\bullet \sim \mathcal{GIG}\left(a_{ij}-\frac{1}{2}, \tilde{\beta}_{ij, 0}^2, a_{ij} \lambda_i^2\right), \end{equation} where the density of the GIG$(\kappa, \chi,\psi)$ distribution is proportional to \begin{equation} z^{\kappa-1} \exp\left\lbrace - \frac{1}{2}\left( \frac{\chi}{z}+\psi z\right)\right\rbrace. \end{equation} To sample from this distribution, we use the R package GIGrvg \citep{GIGrvg} implementing the efficient rejection sampler proposed by \cite{hoermann2013generating}. \item The global shrinkage parameter $\lambda_i^2$ is sampled from a Gamma distribution given by \begin{equation} \lambda_i^2| \bullet \sim \mathcal{G}\left(b_0+a_i K_i, b_1+\frac{a_i}{2}\sum_{j=1}^{K_i} \tau^2_{ij}\right). \end{equation} \item We update the thresholds by applying $K_i$ Griddy Gibbs steps \citep{ritter1992facilitating} per equation. Due to the structure of the model, the conditional distribution of $\tilde{\boldsymbol{\beta}}_{ij,1:T} = (\beta_{ij,1},\dots,\beta_{ij,T})'$ is \begin{equation} p\left(\tilde{\boldsymbol{\beta}}_{ij,1:T} | d_{ij}, \vartheta_{ij}\right) \propto \prod_{t=1}^T \frac{1}{\sqrt{2 \pi \theta_{ij, t} }} \exp \left\lbrace -\frac{(\tilde{\beta}_{ijt}-\tilde{\beta}_{ij,t-1})^2}{2 \theta_{ij, t}}\right\rbrace. \end{equation} This expression can be straightforwardly combined with the prior in \autoref{eq:priorthresholds} to evaluate the conditional posterior of $d_{ij}$ at a given candidate point. The procedure is repeated over a fine grid of values that is determined by the prior and an approximation to the inverse cumulative distribution function of the posterior is constructed. Finally, this approximation is used to perform inverse transform sampling. \item The coefficients of the log-volatility equation and the corresponding history of the log-volatilities are sampled by means of the algorithm brought forward by \cite{kastner2014ancillarity} which is efficiently implemented in the R package \texttt{stochvol} \citep{kastner2016dealing}. Under homoscedasticity, $\sigma_i^{-2}$ is simulated from $\sigma_i^{-2}|\bullet \sim \mathcal{G}\left(c_0+T/2, c_1+{\sum_{t=1}^T (y_{it}-\boldsymbol{z}_{it}' \tilde{\boldsymbol{\beta}}_{it})^2}/{2}\right).$ \end{enumerate} After obtaining an appropriate number of draws, we discard the first $N$ as burn-in and base our inference on the remaining draws from the joint posterior. In comparison with standard TVP-VARs, Step (5) is the only additional MCMC step needed to estimate the proposed TTVP model. Moreover, note that this update is computationally cheap, increasing the amount of time needed to carry out the analysis conducted in Section~\ref{sec:application} by around five percent. For larger models (i.e.,\ with $m$ being around $15$) this step becomes slightly more intensive but, relative to the additional computational burden introduced by applying the FFBS algorithm in Step (1), its costs are still comparably small relative to the overall computation time needed. We found that mixing and convergence properties of our proposed algorithm are similar to standard Bayesian TVP-VAR estimators. In other words, the sampling of the thresholds does not seem to substantially increase the autocorrelation of the MCMC draws. The TTVP algorithm is bundled into the R package \texttt{threshtvp} which is available from the authors upon request. \section{An illustrative example} \label{sec:illustration} In this section we illustrate our approach by means of a rather stylized example that emphasizes how well the mixture innovation component for the state innovations performs when used to approximate different data generating processes (DGPs). For demonstration purposes it proves to be convenient to start with the following simple DGP with $K=1$: \begin{align*} y_t &= x_{1t}' \beta_{1t} + u_t, ~u_t \sim \mathcal{N}(0, 0.01^2), \\ \beta_{1t} &= \beta_{1t-1} + e_{1t}, ~e_{1t} \sim \mathcal{N}(0,s_{1t} \times 0.15^2), \end{align*} where $s_{1t} \in \{0,1\}$ is chosen at random to yield paths which are characterized by many, moderately many, and few breaks. Finally, independently for all $t$, we generate $x_{1t} \sim \mathcal{U}(-1,1)$ and set $\beta_{1,0}=0$. \autoref{fig:examples} shows three possible realizations of $\beta_{1t}$ and the corresponding estimates obtained from a standard TVP model and our TTVP model. To ease comparison between the models we impose a similar prior setup for both models. Specifically, for $\sigma^{-2}$ we set $c_0=0.01$ and $c_1=0.01$, implying a rather vague prior. For the shrinkage part on $\beta_{1,0}$ we set $\lambda^2 \sim \mathcal{G}(0.01,0.01)$ and $a_1 = 0.1$, effectively applying heavy shrinkage on the initial state of the system. The prior on $\vartheta_1$ is specified as in \cite{nakajima2013bayesian}, i.e., $\vartheta^{-1}_1 \sim \mathcal{G}(3,0.03)$. To complete the prior setup for the TTVP model we set $\pi_{1,0}=0.1\times \sqrt{\vartheta_1}$ and $\pi_{1,1}=1.5\times \sqrt{\vartheta_1}$. \begin{figure}[p] \includegraphics[width=.98\textwidth, trim=30 35 25 50, clip=true]{beta_2.pdf}\\ \includegraphics[width=.98\textwidth, trim=30 35 25 50, clip=true]{beta_2_5.pdf}\\ \includegraphics[width=.98\textwidth, trim=30 35 25 50, clip=true]{beta_3.pdf} \caption{Left: Evolution of the actual state vector (dotted black) along with the posterior medians of the TVP model (dashed blue) and the TTVP model (solid red). The TTVP posterior moving probability is indicated by areas shaded in gray. Right: Demeaned posterior distribution of the TVP model (90\% credible intervals in shaded blue) and the TTVP model (90\% credible intervals in red).} \label{fig:examples} \end{figure} The left panel of \autoref{fig:examples} displays the evolution of the posterior median of a standard TVP model (in dotted blue) and of the TTVP model (in solid red) along with the actual evolution of the state vector (in dotted black). In addition, the areas shaded in gray depict the probability that a given coefficient moves over a certain time frame (henceforth labeled as posterior moving probability, PMP). The right panel shows de-meaned 90\% credible intervals of the coefficients from the TVP model (blue shaded area) and the TTVP model (solid red lines). At least two interesting findings emerge. First, note that in all three cases, our approach detects parameter movements rather well, with the PMP reaching unity in virtually all time points that feature a structural break of the corresponding parameter. The TVP model also tracks the actual movement of the states well but does so with much more high frequency variation. This is a direct consequence of the inverted Gamma prior on the state innovation variances that bound $\vartheta_1$ artificially away from zero, irrespective of the information contained in the likelihood \citep[see][for a general discussion of this issue]{fruhwirth2010stochastic}. Second, looking at the uncertainty surrounding the median estimate (right panel of \autoref{fig:examples}) reveals that our approach succeeds in shrinking the posterior variance. This is due to the fact that in periods where the true value of $\beta_{1t}$ is constant, our model successfully assumes that the estimate of the coefficient at time $t$ is also constant, whereas the TVP model imposes a certain amount of time variation. This generates additional uncertainty that inflates the posterior variance, possibly leading to imprecise inference. Thus, the TTVP model detects change points in the parameters in situations where the actual number of breaks is small, moderate and large. In situations where the DGP suggests that the actual threshold equals zero, our approach still captures most of medium to low frequency noise but shrinks small movements that might, in any case, be less relevant for econometric inference. \section{Empirical application: Macroeconomic forecasting and structural change} \label{sec:application} \subsection{Model specification and data} We use an extended version of the US macroeconomic data set employed in \cite{smets2007shocks}, \cite{geweke2012prediction} and \cite{amisano2017prediction}. Data are on a quarterly basis, span the period from 1947Q2 to 2014Q4, and comprise the log differences of consumption, investment, real GDP, hours worked, consumer prices and real wages. Last, and as a policy variable, we include the Federal Funds Rate (FFR) in levels. In the next subsections we investigate structural breaks in macroeconomic relationships by means of forecasting and impulse response analysis. Following \cite{primiceri2005time}, we include $p=2$ lags of the endogenous variables. The prior setup is similar to the one adopted in the previous sections, except that now all hyperparameters are equation-specific and feature an additional index $i=1,\dots,m$. More specifically, for all applicable $i$ and $j$, we use the following values for the hyperparameters. For the shrinkage part on the initial state of the system, we again set $\lambda_i^2 \sim \mathcal{G}(0.01,0.01)$ and $a_i = 0.1$, and the prior on $\vartheta_{ij}$ is specified to be informative with $\vartheta^{-1}_{ij} \sim \mathcal{G}(3,0.03)$. For the parameters of the log-volatility equation we use $\mu_i \sim \mathcal{N}(0, 10^2), \frac{\rho_i+1}{2} \sim \mathcal{B}(25,5)$, and $\zeta_i \sim \mathcal{G}(1/2, 1/2)$. The last ingredient missing is the prior on the thresholds where we set $\pi_{ij, 0}=0.1 \times \sqrt{\vartheta_{ij,1}}$ and $\pi_{ij, 1}=1.5 \times \sqrt{\vartheta_{ij,1}}$. For the seven-variable VAR we draw $500\,000$ samples from the joint posterior and discard the first $400\,000$ draws as burn-in. Finally, we use thinning such that inference is based on $5000$ draws out of $100\,000$ retained draws. \subsection{Forecasting evidence} We start with a simple forecasting exercise of one-step-ahead predictions. For that purpose we use an expanding window and a hold-out sample of 100 quarters. Forecasts are evaluated using log-predictive Bayes factors, which are defined as the difference of log predictive scores (LPS) of a specification of interest and a benchmark model. The log-predictive score is a widely used metric to measure density forecast accuracy \citep[see e.g.,][]{geweke2010comparing}. As the benchmark model, we use a TVP-VAR with relatively little shrinkage. This amounts to setting the thresholds equal to zero and specify the prior on $\vartheta_{ij}^{-1}\sim\mathcal{G}(3,0.03)$. We, moreover, include two additional constant parameter competitors, namely a Minne\-sota-type VAR \citep{Doan1984} and a Normal-Gamma (NG) VAR \citep{Huber2017}. All models feature stochastic volatility. In order to assess the impact of different prior hyperparameters on $\vartheta_{ij}$ and the impact of $\xi$, we estimate the TTVP model over a grid of meaningful values. \autoref{tab:LPS_1} depicts the LPS differences between a given model and the benchmark model. First, we see that all models outperform the no-shrinkage time-varying parameter VAR as indicated by positive values of the log-predictive Bayes factors. Second, constant parameter VARs with shrinkage turn out to be hard to beat. Especially the hierarchical Minnesota prior does a good job with respect to one-quarter-ahead forecasts. For the TTVP model we see that forecast performance also varies with the prior specification. More specifically, the results show that increasing $\xi$, which implies more time variation in the lower regime a-priori, deteriorates the forecasting performance. This is especially true if a large value for $\xi$ is coupled with small values of $r_{ij,0}$ and $r_{ij,1}$ -- the latter referring to the a priori belief of large swings of coefficients in the upper regime of the model. \begin{table}[t] \centering \begin{tabular}{lcrr} &$ \begin{aligned} r_{ij,0}&=3 \\ r_{ij,1}&=0.03 \end{aligned}$ & $ \begin{aligned} r_{ij,0}&=1.5 \\ r_{ij,1}&=1 \end{aligned}$ & $ \begin{aligned} r_{ij,0}&=0.001 \\ r_{ij,1}&=0.001 \end{aligned}$ \\\midrule $\xi=\xi_1 = 10^{-6}$ & 169.06 & 168.75 & 169.16 \\ $\xi = \xi_2= 10^{-5}$& 170.80 & 170.60 & 173.87 \\ $\xi =\xi_3 = 10^{-4}$ & 170.95 & 172.31 & 158.44 \\ $\xi = \xi_4 = 10^{-3}$ & 130.45 & 163.78 & 137.53 \\ \midrule & NG & Minnesota & \\ BVAR & 173.77 & 177.20 & \\ \bottomrule \end{tabular} \caption{Log predictive Bayes factors relative to a time-varying parameter VAR without shrinkage for different key parameters of the model. The final row refers to the log predictive Bayes factor of a BVAR equipped with a Normal-Gamma (NG) shrinkage prior and a hierarchical Minnesota prior. All models estimated with stochastic volatility. Numbers greater than zero indicate that a given model outperforms the benchmark.} \label{tab:LPS_1} \end{table} To investigate the predictive performance of the different model specifications further, \autoref{fig:lps_a} shows the log predictive Bayes factors relative to the benchmark model over time. The plot shows that the specifications with $\xi_1$ and $\xi_2$ excel during most of the sample period, irrespective of the prior on $\vartheta_{ij}$. The constant parameter models, by contrast, dominate only during two very distinct periods of our sample, namely at the beginning and at the end of the time span covered. In both periods, no severe up or downswings in economic activity occur and the constant parameter models with SV display excellent predictive capabilities. By contrast, during volatile periods -- such as the global financial crisis -- our modeling approach seems to pay off in terms of predictive accuracy. To investigate this in more detail, we focus on the forecasting performance of the different model specifications during the period from 2006Q1 to 2010Q1 in \autoref{fig:lps_b}. Here we see that TTVP specifications with $\xi_j$ for $j<4$ outperform all remaining competitors. This additional, and more detailed, look at the forecasting performance during turbulent times thus reveals that the TTVP model is a valuable alternative to simpler models. Put differently, we observe that during more volatile periods the TTVP model can severely outperform constant parameter models, while in tranquil times its forecasts are never far off. \begin{figure}[p] \centering \begin{subfigure}{\textwidth} \includegraphics[width=\textwidth, clip, trim = 30 45 20 40]{LPS_benchmarks.pdf} \caption{Full evaluation period (1995Q1 to 2014Q4).}\label{fig:lps_a} \end{subfigure}\\ \begin{subfigure}{\textwidth} \includegraphics[width=\textwidth, clip, trim = 30 45 25 40]{LPS_benchmark_crisis.pdf} \caption{Crisis period only (2006Q1 to 2010Q1).}\label{fig:lps_b} \end{subfigure} \caption{Log predictive Bayes factor relative to a TVP-VAR-SV model.}\label{fig:lps} \end{figure} Next, we examine turning point forecasts, since the detection of structural breaks might be a further useful application of the TTVP framework. We focus on turning points in real GDP growth and follow \cite{canova2004forecasting} to label time point $(t+1)$ a \emph{downward turning point} -- conditional on the information up to time $t$ -- if $S_{t+1}$, the growth rate of real GDP at time $(t+1)$, satisfies that $S_{t-2} < S_t$, $S_{t-1} < S_{t}$, and $S_t > S_{t+1}$. Analogously, the time point $(t+1)$ is labeled an \emph{upward turning point} if $S_{t-2} > S_t$, $S_{t-1}>S_{t}$, and $S_t < S_{t+1}$. Equipped with these definitions, we then can split the total number of turning points up into upturns and downturns and compute the quadratic probability (QPS) scores as an accuracy measure of upturn and downturn probability forecasts. The results are provided in \autoref{tab:QPS}. \begin{table}[t] \centering \resizebox{\columnwidth}{!}{% \begin{tabular}{lccccccc} &\multicolumn{3}{c}{Downturns} & & \multicolumn{3}{c}{Upturns}\\ &$ \begin{aligned} r_{ij,0}&=3 \\ r_{ij,1}&=0.03 \end{aligned}$ & $ \begin{aligned} r_{ij,0}&=1.5 \\ r_{ij,1}&=1 \end{aligned}$ & $ \begin{aligned} r_{ij,0}&=0.001 \\ r_{ij,1}&=0.001 \end{aligned}$ & & $ \begin{aligned} r_{ij,0}&=3 \\ r_{ij,1}&=0.03 \end{aligned}$ & $ \begin{aligned} r_{ij,0}&=1.5 \\ r_{ij,1}&=1 \end{aligned}$ & $ \begin{aligned} r_{ij,0}&=0.001 \\ r_{ij,1}&=0.001 \end{aligned}$ \\ \midrule $\xi=\xi_1 = 10^{-6}$ & 0.66 & 0.67 & 0.67 & & 0.84 & 0.83 & 0.83 \\ $\xi=\xi_2 = 10^{-5}$ & 0.66 & 0.66 & 0.67 & & 0.83 & 0.83 & 0.81 \\ $\xi=\xi_3 = 10^{-4}$ & 0.64 & 0.65 & 0.68 & & 0.83 & 0.84 & 0.80 \\ $\xi=\xi_4 = 10^{-3}$ & 0.87 & 0.67 & 0.78 & & 0.81 & 0.83 & 0.78 \\ \midrule & NG & Minnesota & & & NG & Minnesota& \\ BVAR &0.62&0.62 & & & 0.84 & 0.93 & \\ \bottomrule \end{tabular}} \caption{QPS scores relative to a time-varying parameter VAR without shrinkage for different key parameters of the model. The final row refers to the QPS score of a BVAR equipped with a Normal-Gamma (NG) shrinkage prior and a hierarchical Minnesota prior. All models estimated with stochastic volatility. Numbers below unity indicate that a given model outperforms the benchmark.} \label{tab:QPS} \end{table} The picture that arises is similar to that of the density forecasting exercise: all variants of the TTVP model beat the no-shrinkage time-varying parameter VAR model. Turning point forecasts deteriorate for larger values of $\xi$ and especially so if they are coupled with small choices for $r_{ij}$, yielding a relatively uninformative prior on $\vartheta_{ij}$ and consequently little shrinkage. Forecast gains relative to the benchmark model are more sizable for downward than for upward turning points. In comparison to the two constant parameter competitors, the TTVP model excels in predicting upward turning points (for which there are more observations in the sample), while forecast performance is slightly inferior for downward forecasts. Also note that for downward predictions, penalizing time-variation seems to be essential and consequently the strongest performance among TTVP specifications is achieved for small values of $\xi$. The opposite is the case for upward turning points where reasonable predictions can be also achieved with a rather loose prior. \subsection{Detecting structural breaks in US data} In this section we aim to have a closer and more systematic look at changes in the joint dynamics of our seven variable TTVP-VAR model for the US economy. To that end, we examine the posterior mean of the determinant of the time-varying variance-covariance matrix of the innovations in the state equation \citep{cogley2005drifts}. For each draw of $\boldsymbol{\Omega}_{it} = \text{diag}(\theta_{i1,t },\dots,\theta_{K_i1,t})$ we compute its log-determinant and subtract the mean across time. Large values of this measure point towards a pronounced degree of time-variation in the autoregressive coefficients of the corresponding equations. The results are provided in \autoref{fig:concovtrace} for each equation and the full system. \begin{figure}[p] \begin{subfigure}{.327\textwidth} \includegraphics[width=\textwidth, clip, trim = 30 40 30 40]{concovtrace.pdf} \caption{Consumption}\label{fig:2a} \end{subfigure} \begin{subfigure}{.327\textwidth} \includegraphics[width=\textwidth, clip, trim = 30 40 30 40]{invcovtrace.pdf} \caption{Investment}\label{fig:2b} \end{subfigure} \begin{subfigure}{.327\textwidth} \includegraphics[width=\textwidth, clip, trim = 30 40 30 40]{outcovtrace.pdf} \caption{Output}\label{fig:2c} \end{subfigure}\\[.7em] \begin{subfigure}{.327\textwidth} \includegraphics[width=\textwidth, clip, trim = 30 40 30 40]{houcovtrace.pdf} \caption{Hours worked}\label{fig:2d} \end{subfigure} \begin{subfigure}{.327\textwidth} \includegraphics[width=\textwidth, clip, trim = 30 40 30 40]{infcovtrace.pdf} \caption{Inflation}\label{fig:2e} \end{subfigure} \begin{subfigure}{.327\textwidth} \includegraphics[width=\textwidth, clip, trim = 30 40 30 40]{reacovtrace.pdf} \caption{Real wages}\label{fig:2f} \end{subfigure}\\[.7em] \centering \begin{subfigure}{.327\textwidth} \includegraphics[width=\textwidth, clip, trim = 30 40 30 40]{intcovtrace.pdf} \caption{FFR}\label{fig:2g} \end{subfigure} \begin{subfigure}{.327\textwidth} \includegraphics[width=\textwidth, clip, trim = 30 40 30 40]{det_overall.pdf} \caption{Overall}\label{fig:2h} \end{subfigure} \caption{Posterior mean of the determinant of time-varying variance-covariance matrix of the innovations to the state equation from 1947Q2 to 2014Q4. Values are obtained by taking the exponential of the demeaned log-determinant across equations. Gray shaded areas refer to US recessions dated by the NBER business cycle dating committee.} \label{fig:concovtrace} \end{figure} For all variables we see at least one prominent spike during the sample period indicating a structural break. Most spikes in the determinant occur around 1980, when then Fed chairman Paul Volcker sharply increased short-term interest rates to fight inflation. Other breaks relate to the dot-com bubble in the early 2000s (consumption), the oil price crisis and stock market crash in the early 1970s (hours worked) and another oil price related crisis in the early 1990s. Also, the transition from positive interest rates to the zero lower bound in the midst of the global financial crisis is indicated by a spike in the determinant. That we can relate spikes to historical episodes of financial and economic distress lends further confidence in the modeling approach. Among these periods, the early 1980s seem to have constituted by far the most severe rupture for the US economy. \subsection{Impulse responses to a monetary policy shock} In this section we examine the dynamic responses of a set of macroeconomic variables to a contractionary monetary policy shock. The monetary policy shock is calibrated as a 100 basis point (bp) increase in the FFR and identified using a Cholesky ordering with the variables appearing in exactly the same order as mentioned above. This ordering is in the spirit of \cite{christiano2005} and has been subsequently used in the literature \citep[see][for an excellent survey]{Coibion2012}. Drawing on the results of the previous section, we focus on two sub-sets of the sample, namely the pre-Volcker period from 1947Q4 to 1979Q1 and the rest of the sample.\footnote{The split into two sub-sets is conducted for interpretation purposes only. For estimation, the entire sample has been used.} The time-varying impulse responses -- as functions of horizons -- are displayed in \autoref{fig:irf_volcker}. Additionally, we also include impulse responses for different horizons -- as functions of time -- over the full sample period in \autoref{fig:irf1} and \autoref{fig:irf2}. \begin{figure}[p] \begin{minipage}{1\linewidth}~\\ \centering \textbf{1947Q4 to 1979Q1} \end{minipage}\\[.5em] \begin{minipage}[b]{0.246\linewidth} \centering \includegraphics[clip, trim=20 45 20 50, width=\linewidth]{pre_volcker_consumption.pdf} Consumption \end{minipage}% \begin{minipage}[b]{0.246\linewidth} \centering \includegraphics[clip, trim=20 45 20 50, width=\linewidth]{pre_volcker_investment.pdf} Investment \end{minipage} \begin{minipage}[b]{0.246\linewidth} \centering \includegraphics[clip, trim=20 45 20 50, width=\linewidth]{pre_volcker_output.pdf} Output \end{minipage} \begin{minipage}[b]{0.246\linewidth} \centering \includegraphics[clip, trim=20 45 20 50, width=\linewidth]{pre_volcker_hours.pdf} Hours worked \end{minipage} \vspace{-.5em} \centering \begin{minipage}[b]{0.246\linewidth} \centering \includegraphics[clip, trim=20 45 20 50, width=\linewidth]{pre_volcker_inflation.pdf} Inflation \end{minipage} \begin{minipage}[b]{0.246\linewidth} \centering \includegraphics[clip, trim=20 45 20 50, width=\linewidth]{pre_volcker_real_wage.pdf} Real wages \end{minipage} \begin{minipage}[b]{0.246\linewidth} \centering \includegraphics[clip, trim=20 45 20 50, width=\linewidth]{pre_volcker_interest_rate.pdf} FFR \end{minipage}\\ \vspace{2em} \begin{minipage}{1\linewidth}~\\ \centering \textbf{1979Q2 to 2014Q4} \end{minipage}\\[.5em] \begin{minipage}[b]{0.246\linewidth} \centering \includegraphics[clip, trim=20 45 20 50, width=\linewidth]{post_volcker_consumption.pdf} Consumption \end{minipage}% \begin{minipage}[b]{0.246\linewidth} \centering \includegraphics[clip, trim=20 45 20 50, width=\linewidth]{post_volcker_investment.pdf} Investment \end{minipage} \begin{minipage}[b]{0.246\linewidth} \centering \includegraphics[clip, trim=20 45 20 50, width=\linewidth]{post_volcker_output.pdf} Output \end{minipage} \begin{minipage}[b]{0.246\linewidth} \centering \includegraphics[clip, trim=20 45 20 50, width=\linewidth]{post_volcker_hours.pdf} Hours worked \end{minipage} \vspace{.5em} \centering \begin{minipage}[b]{0.246\linewidth} \centering \includegraphics[clip, trim=20 45 20 50, width=\linewidth]{post_volcker_inflation.pdf} Inflation \end{minipage} \begin{minipage}[b]{0.246\linewidth} \centering \includegraphics[clip, trim=20 45 20 50, width=\linewidth]{post_volcker_real_wage.pdf} Real wages \end{minipage} \begin{minipage}[b]{0.246\linewidth} \centering \includegraphics[clip, trim=20 45 20 50, width=\linewidth]{post_volcker_interest_rate.pdf} FFR \end{minipage} \caption{Posterior median impulse response functions over two sample splits, namely the pre-Volcker period (1947Q4 to 1979Q1) and the rest of the sample period (1979Q2 to 2014Q4). The coloring of the impulse responses refer to their timing: light yellow stands for the beginning of the sample split, dark red stands for the end of sample split. For reference, 68\% credible intervals over the average of the sample period provided (dotted black lines).}\label{fig:irf_volcker} \end{figure} \begin{sidewaysfigure}[p] \includegraphics[width=\textwidth]{RA.pdf} \caption{Posterior median responses to a $+100$ bp monetary policy shock, after 4 (top panels), 8 (middle panels) and 12 (bottom panels) quarters. Shaded areas correspond to 90\% (dark red) and 68\% (light red) credible sets.}\label{fig:irf1} \end{sidewaysfigure} \begin{sidewaysfigure}[p] \includegraphics[width=\textwidth]{supply.pdf} \caption{Posterior median responses to a $+100$ bp monetary policy shock, after 4 (top panels), 8 (middle panels) and 12 (bottom panels) quarters. Shaded areas correspond to 90\% (dark red) and 68\% (light red) credible sets.}\label{fig:irf2} \end{sidewaysfigure} In \autoref{fig:irf_volcker} we investigate whether the size and the shape of responses varies between and within the two sub-samples. For that purpose we show median responses over the first sample split in the top row and for the second part of the sample in the bottom row of \autoref{fig:irf_volcker}. Impulse responses that belong to the beginning of a sample split are depicted in light yellow, those that belong to the end of the sample period in dark red. To fix ideas, if the size of a response increases continuously over time we should see a smooth darkening of the corresponding impulse from light yellow to dark red. Considering, for instance, hours worked, this phenomenon can clearly be seen in in the second sample period from 1979Q2 to 2014Q4, where the median response changes gradually from slightly negative to substantially negative. On the other hand, abrupt changes are also clearly visible, see e.g.,\ the drastic change of the inflation response from 1979Q1 (the last quarter in the first sample) to 1979Q2 (the first quarter in the second sampler), dropping from substantially positive to just above zero within one quarter (see also \autoref{fig:irf1}). Considering the dynamic responses across different angles, we find three regularities which are worth emphasizing. The first concerns the overall effects of the monetary policy shock. Note that an unexpected rate increase deters investment growth, hours worked and consequently overall output growth for both sample splits. These results are reasonable from an economic perspective. Also, estimated effects on output growth and inflation are comparable to those of \citet{Baumeister2013} who use a TVP-VAR framework and US data. Responses of consumption growth tend to be accompanied by wide credible sets. The same applies to inflation and real wages. Second, we examine changes in responses over time for the first sub-period. One of the variables that shows a great deal of variation in magnitudes is the response of inflation. Here, effects become increasingly positive the further one moves from 1947Q4 to 1979Q1 and the shades of the responses turn continuously darker. These results imply a severe ``price puzzle''. While overall credible sets for the sub-sample are wide, positive responses for inflation and thus the price puzzle are estimated over the period from the mid-1960s to the beginning of the 1980s (see also \autoref{fig:irf1}). A similar picture arises when looking at consumption growth. During the first sample split, effects become increasingly more negative, but responses are only precisely estimated for the period from the mid-1960s to the beginning of the 1980s. This might be explained by the fact that the monetary policy driven increase in inflation spurs consumption since saving becomes less attractive. Third, we focus on the results over the more recent second sample split from 1979Q2 to 2014Q4. Paul Volcker's fight against inflation had some bearings on overall macroeconomic dynamics in the USA. With the onset of the 1980s, the aforementioned price puzzle starts to disappear (in the sense that effects are surrounded by wide credible sets and medium responses increasingly negative). There is also a great deal of time variation evident in other responses, mostly becoming increasingly negative. Put differently, the effectiveness of monetary policy seems to be higher in the more recent sample period than before. This can be seen by effects on hours worked, investment growth and output growth. That the effects of a hypothetical monetary policy shock on output growth are particular strong after the crisis corroborates findings of \citet{Baumeister2013} and \citet{Feldkircher2016}. The latter argue that this is related to the zero lower bound period: after a prolonged period of unaltered interest rates, a deviation from the (long-run) interest rate mean can exert considerable effects on the macroeconomy. \section{Closing remarks} \label{sec:conclusion} This paper puts forth a novel approach to estimate time-varying parameter models in a Bayesian framework. We assume that the state innovations are following a threshold model where the threshold variable is the absolute period-on-period change of the corresponding states. This implies that if the (proposed) change is sufficiently large, the corresponding variance is set to a value greater than zero. Otherwise, it is set close to zero which implies that the states remained virtually constant from $(t-1)$ to $t$. Our framework is capable of discriminating between a plethora of competing specifications, most notably models that feature many, moderately many, and few structural breaks in the regression parameters We also propose a generalization of our model to the VAR framework with stochastic volatility. In an application to the US macroeconomy, we examine the usefulness of the TTVP-VAR in terms of forecasting, turning point prediction, and structural impulse response analysis. Our results show that the model yields precise forecasts, especially so during more volatile times such as witnessed in 2008. For that period, the forecast gain over simpler constant parameter models is particularly high. We then proceed by investigating turning point predictions, and observe excellent performance of the TTVP model, in particular for upturn predictions. Finally, we examine impulse responses to a $+100$ basis points contractionary monetary policy shock focusing on two sub-periods of our sample span, the pre-Volcker period and the rest of the sample. Our results reveal significant evidence for a severe price puzzle during episodes of the pre-Volcker period. The positive effect of the rate increase in inflation disappears in the second half of our sample. Modeling changes in responses over the two sub-periods only, such as in a regime switching model, however, would be too simplistic, as we do find also a lot of time variation within each sub-period. For example, we find increasing effectiveness of monetary policy in terms of output, investment growth, and hours worked in the more recent sub-period. This is especially true for the period after the global financial crisis in which the Federal Funds Rate has been tied to zero. For that period, a hypothetical deviation from the zero lower bound would create pronounced effects on the wider macroeconomy \section{Acknowledgments} We sincerely thank the participants of the WU Brown Bag Seminar of the Institute of Statistics and Mathematics, the 3rd Vienna Workshop on High-Dimensional Time Series in Macroeconomics and Finance 2017, the NBP Workshop on Forecasting 2017, and in particular Sylvia Fr\"uhwirth-Schnatter, for many helpful comments and suggestions that improved the paper significantly. \singlespacing \bibliographystyle{./bibtex/econometrica}
{'timestamp': '2018-01-15T02:09:57', 'yymm': '1607', 'arxiv_id': '1607.04532', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04532'}
arxiv
\section{Introduction} Cell-Free massive multiple-input multiple-output (MIMO) refers to a massive MIMO system \cite{MarzettaNonCooperative} where the base station antennas are geographically distributed \cite{NgoCF,MarzettaCF,Truong}. These antennas, called access points (APs) herein, simultaneously serve many users in the same frequency band. The distinction between cell-free massive MIMO and conventional distributed MIMO \cite{ZhouWCS} is the number of antennas involved in coherently serving a given user. In canonical cell-free massive MIMO, every antenna serves every user. Compared to co-located massive MIMO, cell-free massive MIMO has the potential to improve coverage and energy efficiency, due to increased macro-diversity gain. By operating in time-division duplex (TDD) mode, cell-free massive MIMO exploits the channel reciprocity property, according to which the channel responses are the same in both uplink and downlink. Reciprocity calibration, to the required accuracy, can be achieved in practice using off-the-shelf methods \cite{Lund}. Channel reciprocity allows the APs to acquire channel state information (CSI) from pilot sequences transmitted by the users in the uplink, and this CSI is then automatically valid also for the downlink. By virtue of the law of large numbers, the effective scalar channel gain seen by each user is close to a deterministic constant. This is called \textit{channel hardening}. Thanks to the channel hardening, the users can reliably decode the downlink data using only statistical CSI. This is the reason for why most previous studies on massive MIMO assumed that the users do not acquire CSI and that there are no pilots in the downlink \cite{MarzettaNonCooperative,DebbahULDL,BjornsonHowMany}. In co-located massive MIMO, transmission of downlink pilots and the associated channel estimation by the users yields rather modest performance improvements, owing to the high degree of channel hardening \cite{NgoDlPilots,Khansefid,Zuo}. In contrast, in cell-free massive MIMO, the large number of APs is distributed over a wide area, and many APs are very far from a given user; hence, each user is effectively served by a smaller number of APs. As a result, the channel hardening is less pronounced than in co-located massive MIMO, and potentially the gain from using downlink pilots is larger. \textbf{Contributions:} We propose a downlink training scheme for cell-free massive MIMO, and provide an (approximate) achievable downlink rate for conjugate beamforming processing, valid for finite numbers of APs and users, which takes channel estimation errors and power control into account. This rate expression facilitates a performance comparison between cell-free massive MIMO with downlink pilots, and cell-free massive MIMO without downlink pilots, where only statistical CSI is exploited by the users. The study is restricted to the case of mutually orthogonal pilots, leaving the general case with pilot reuse for future work. \textit{Notation:} Column vectors are denoted by boldface letters. The superscripts $()^*$, $()^T$, and $()^H$ stand for the conjugate, transpose, and conjugate-transpose, respectively. The Euclidean norm and the expectation operators are denoted by $\Vert\cdot\Vert$ and $\mathbb{E}\{\cdot\}$, respectively. Finally, we use $z\sim\mathcal{CN}(0,\sigma^2)$ to denote a circularly symmetric complex Gaussian random variable (RV) $z$ with zero mean and variance $\sigma^2$, and use $z\sim\mathcal{N}(0,\sigma^2)$ to denote a real-valued Gaussian RV. \section{System Model and Notation} Let us consider $M$ single-antenna APs\footnote{We are considering the conjugate beamforming scheme which is implemented in a distributed manner, and hence, an $N$-antenna APs can be treated as $N$ single-antenna APs.}, randomly spread out in a large area without boundaries, which simultaneously serve $K$ single-antenna users, $M>K$, by operating in TDD mode. All APs cooperate via a backhaul network exchanging information with a central processing unit (CPU). Only payload data and power control coefficients are exchanged. Each AP locally acquires CSI and precodes data signals without sharing CSI with the other APs. The time-frequency resources are divided into coherence intervals of length $\tau$ symbols (which are equal to the coherence time times the coherence bandwidth). The channel is assumed to be static within a coherence interval, and it varies independently between every coherence interval. Let $g_{mk}$ denote the channel coefficient between the $k$th user and the $m$th AP, defined as \begin{equation} \label{eq:channelmodel} g_{mk} = \sqrt{\beta_{mk}}h_{mk}, \end{equation} where $h_{mk}$ is the small-scale fading, and $\beta_{mk}$ represents the large-scale fading. Since the APs are not co-located, the large-scale fading coefficients $\{\beta_{mk}\}$ depend on both $m$ and $k$. We assume that $h_{mk}$, $m=1,..., M$, $k=1,..., K$, are i.i.d.\ $\mathcal{CN}(0,1)$ RVs, i.e. Rayleigh fading. Furthermore, $\beta_{mk}$ is constant with respect to frequency and is known, a-priori, whenever required. Lastly, we consider moderate and low user mobility, thus viewing $\{\beta_{mk}\}$ coefficients as constants. The TDD coherence interval is divided into four phases: uplink training, uplink payload data transmission, downlink training, and downlink payload data transmission. In the uplink training phase, users send pilot sequences to the APs and each AP estimates the channels to all users. The channel estimates are used by the APs to perform the uplink signal detection, and to beamform pilots and data during the downlink training and the downlink data transmission phase, respectively. Here, we focus on the the downlink performance. The analysis on the uplink payload data transmission phase is omitted, since it does not affect on the downlink performance. \subsection{Uplink Training} Let $\tau_\textrm{u,p}$ be the uplink training duration per coherence interval such that $\tau_\textrm{u,p}<\tau$. Let $\sqrt{\tau_\textrm{u,p}}\bm{\varphi}_k \in \mathbb{C}^{\tau_\textrm{u,p}\times1}$, be the pilot sequence of length $\tau_\textrm{u,p}$ samples sent by the $k$th user, $k=1,...,K$. We assume that users transmit pilot sequences with full power, and all the uplink pilot sequences are mutually orthonormal, i.e., $\bm{\varphi}_k^H\bm{\varphi}_{k'} = 0$ for $k' \neq k$, and $\Vert\bm{\varphi}_k\Vert^2=1$. This requires that $\tau_\textrm{u,p} \geq K$, i.e., $\tau_\textrm{u,p} = K$ is the smallest number of samples required to generate $K$ orthogonal vectors. The $m$th AP receives a $ \tau_\textrm{u,p}\times1 $ vector of $K$ uplink pilots linearly combined as \begin{equation} \label{eq:receiveduplinkpilot} \textbf{y}_{\textrm{up},m} = \sqrt{\tau_\textrm{u,p}\rho_\textrm{u,p}}\sum^K_{k=1} g_{mk}\bm{\varphi}_k + \textbf{w}_{\textrm{up},m}, \end{equation} where $\rho_\textrm{u,p}$ is the normalized transmit signal-to-noise ratio (SNR) related to the pilot symbol and $\textbf{w}_{\textrm{up},m}$ is the additive noise vector, whose elements are i.i.d. $\mathcal{CN}(0,1)$ RVs. The $m$th AP processes the received pilot signal as follows \begin{equation} \label{eq:receiveduplinkpilotprojection} \check{y}_{\textrm{up},mk} = \bm{\varphi}^H_k\textbf{y}_{\textrm{up},m} = \sqrt{\tau_\textrm{u,p}\rho_\textrm{u,p}} \ g_{mk}+ \bm{\varphi}^H_k\textbf{w}_{\textrm{up},m}, \end{equation} and estimates the channel $g_{mk}$, $k=1,...,K$ by performing MMSE estimation of $g_{mk}$ given $\check{y}_{\textrm{up},mk}$, which is given by \begin{equation} \label{eq:APchannelestimation} \hat{g}_{mk} = \frac{\mathbb{E}\{\check{y}^*_{\textrm{up},mk}g_{mk}\}}{\mathbb{E}\{\vert\check{y}_{\textrm{up},mk}\vert^2\}}\check{y}_{\textrm{up},mk} = c_{mk}\check{y}_{\textrm{up},mk}, \end{equation} where \begin{equation} \label{eq:cmk} c_{mk} \triangleq \frac{\sqrt{\tau_\textrm{u,p}\rho_\textrm{u,p}}\beta_{mk}}{\tau_\textrm{u,p}\rho_\textrm{u,p}\beta_{mk}+1}. \end{equation} The corresponding channel estimation error is denoted by $\tilde{g}_{mk} \triangleq g_{mk} - \hat{g}_{mk}$ which is independent of $\hat{g}_{mk}$. \subsection{Downlink Payload Data Transmission} During the downlink data transmission phase, the APs exploit the estimated CSI to precode the signals to be transmitted to the $K$ users. Assuming conjugate beamforming, the transmitted signal from the $m$th AP is given by \begin{equation} \label{eq:APtransmittedsignal} x_m = \sqrt{\rho_\textrm{d}}\sum^K_{k=1} \sqrt{\eta_{mk}} \ \hat{g}^*_{mk} q_k, \end{equation} where $q_k$ is the data symbol intended for the $k$th user, which satisfies $\mathbb{E}\{\vert q_k \vert^2\}=1$, and $\rho_\textrm{d}$ is the normalized transmit SNR related to the data symbol. Lastly, $\eta_{mk}$, $m=1,...,M$, $k=1,...,K$, are power control coefficients chosen to satisfy the following average power constraint at each AP: \begin{equation} \label{eq:pwConstraint} \mathbb{E}\{|x_m|^2\}\leq\rho_\textrm{d}. \end{equation} Substituting (\ref{eq:APtransmittedsignal}) into (\ref{eq:pwConstraint}), the power constraint above can be rewritten as \begin{equation} \label{eq:pwConstraintGamma} \sum \limits_{k=1}^K \eta_{mk} \gamma_{mk} \leq 1, \ \text{for all}\ m, \end{equation} where \begin{equation} \label{eq:defGamma} \gamma_{mk} \triangleq \mathbb{E}\{{|\hat{g}_{mk}|}^2\} = \sqrt{\tau_\textrm{u,p}\rho_\textrm{u,p}} \beta_{mk} c_{mk} \end{equation} represents the variance of the channel estimate. The $k$th user receives a linear combination of the data signals transmitted by all the APs. It is given by \begin{align} \label{eq:receiveddownlinksignal} r_{\textrm{d},k} &= \sum^M_{m=1} g_{mk} x_m + w_{\textrm{d},k} = \sqrt{\rho_\textrm{d}} \sum^K_{k'=1} a_{kk'} q_{k'} + w_{\textrm{d},k}, \end{align} where \begin{align}\label{eq:akkdef} a_{kk'} \triangleq \sum^M_{m=1} \sqrt{\eta_{mk'}} {g}_{mk} \hat{g}^*_{mk'}, ~ k'=1,...,K, \end{align} and $ w_{\textrm{d},k} $ is additive $\mathcal{CN}(0,1)$ noise at the $k$th user. In order to reliably detect the data symbol $q_k$, the $k$th user must have a sufficient knowledge of the effective channel gain, $a_{kk}$. \begin{figure*}[!t] \normalsize \setcounter{MYtempeqncnt}{\value{equation}} \setcounter{equation}{\ccounter} \begin{equation} \label{eq:genericDLrate} R_k = \mathbb{E}\left\{\log_2\left(1+\frac{\rho_\textrm{d} \left| \mathbb{E}\left\{a_{kk} \mathrel{\big|} \hat{a}_{kk} \right\} \right|^2}{\rho_\textrm{d} \sum\limits^K_{k'=1} \mathbb{E}\left\{{|a_{kk'}|^2 \mathrel{\big|} \hat{a}_{kk}}\right\}-\rho_\textrm{d} \left| \mathbb{E}\left\{a_{kk} \mathrel{\big|} \hat{a}_{kk} \right\} \right|^2 +1} \right)\right\}. \end{equation} \setcounter{equation}{\value{MYtempeqncnt}} \hrulefill \vspace*{4pt} \end{figure*} \subsection{Downlink Training} While the model given so far is identical to that in \cite{NgoCF}, we now depart from that by the introduction of downlink pilots. Specifically, we adopt the Beamforming Training scheme proposed in \cite{NgoDlPilots}, where pilots are beamformed to the users. This scheme is scalable in that it does not require any information exchange among APs, and its channel estimation overhead is independent of $M$. Let $\tau_\textrm{d,p}$ be the length (in symbols) of the downlink training duration per coherence interval such that $\tau_\textrm{d,p}<\tau - \tau_\textrm{u,p}$. The $m$th AP precodes the pilot sequences $\bm{\psi}_{k'} \in \mathbb{C}^{\tau_\textrm{d,p}\times1}$, $k'=1,...,K$, by using the channel estimates $\{\hat{g}_{mk'}\}$, and beamforms it to all the users. The $\tau_\textrm{d,p} \times 1$ pilot vector $\bm{x}_{m,\textrm{p}}$ transmitted from the $m$th AP is given by \begin{equation} \label{eq:DLpilot} \bm{x}_{m,\textrm{p}} = \sqrt{\tau_\textrm{d,p}\rho_\textrm{d,p}}\sum^K_{k'=1} \sqrt{\eta_{mk'}} \hat{g}^*_{mk'} \bm\psi_{k'}, \end{equation} where $\rho_\textrm{d,p}$ is the normalized transmit SNR per downlink pilot symbol, and $\{\bm\psi_{k}\}$ are mutually orthonormal, i.e. $\bm{\psi}^H_k\bm{\psi}_{k'} = 0$, for $k' \neq k$, and $\Vert\bm{\psi}_k\Vert^2=1$. This requires that $\tau_\textrm{d,p} \geq K$. The $k$th user receives a corresponding $ \tau_\textrm{d,p}\times 1 $ pilot vector: \begin{equation} \label{eq:receivedDLpilot} \textbf{y}_{\textrm{dp},k} = \sqrt{\tau_\textrm{d,p}\rho_\textrm{d,p}} \sum^K_{k'=1} a_{kk'} \bm\psi_{k'} + \textbf{w}_{\textrm{dp},k}, \end{equation} where $\textbf{w}_{\textrm{dp},k}$ is a vector of additive noise at the $k$th user, whose elements are i.i.d. $\mathcal{CN}(0,1)$ RVs. In order to estimate the effective channel gain $a_{kk}$, $k=1,...,K$, the $k$th user first processes the received pilot as \begin{align} \label{eq:receivedDLpilotprojection} \check{y}_{\textrm{dp},k} &= \bm{\psi}^H_{k} \textbf{y}_{\textrm{dp},k} = \sqrt{\tau_\textrm{d,p}\rho_\textrm{d,p}} \ a_{kk} + \bm\psi^H_{k} \textbf{w}_{\textrm{dp},k} \nonumber \\ &= \sqrt{\tau_\textrm{d,p} \rho_\textrm{d,p}} \ a_{kk} + n_{\textrm{p},k}, \end{align} where $n_{\textrm{p},k} \triangleq \bm{\psi}^H_k\textbf{w}_{\textrm{dp},k} \sim \mathcal{CN}(0,1)$, and then performs linear MMSE estimation of $a_{kk}$ given $\check{y}_{\textrm{dp},k}$, which is, according to \cite{SMKay}, equal to \begin{align} \label{eq:a_kk} \hat{a}_{kk} &= \mathbb{E}\{a_{kk}\} + \nonumber \\ &+ \frac{\sqrt{\tau_\textrm{d,p}\rho_\textrm{d,p}} \ \mathrm{Var}\{a_{kk}\}}{\tau_\textrm{d,p} \rho_\textrm{d,p} \mathrm{Var}\{a_{kk}\} + 1}(\check{y}_{\textrm{dp},k} - \sqrt{\tau_\textrm{d,p}\rho_\textrm{d,p}} \ \mathbb{E}\{a_{kk}\}). \end{align} \textit{Proposition 1:} With conjugate beamforming, the linear MMSE estimate of the effective channel gain formed by the $k$th user, see (\ref{eq:a_kk}), is \begin{align} \label{eq:a_kk2} \hat{a}_{kk} = \frac{\sqrt{\tau_\textrm{d,p}\rho_\textrm{d,p}}\ \varsigma_{kk} \ \check{y}_{\textrm{dp},k} + \sum \limits_{m=1}^M \sqrt{\eta_{mk}} \ \gamma_{mk}}{\tau_\textrm{d,p}\rho_\textrm{d,p}\ \varsigma_{kk} + 1}, \end{align} where $\varsigma_{kk} \triangleq \sum_{m=1}^M \eta_{mk} \beta_{mk} \gamma_{mk}$. \begin{IEEEproof} See Appendix A. \end{IEEEproof} \begin{figure*}[!t] \normalsize \setcounter{MYtempeqncnt}{\value{equation}} \setcounter{equation}{23} \begin{align} \label{eq:rateComparison} R_k = \begin{cases} \log_2 \left( 1 + \frac{\rho_\textrm{d}\left(\sum\limits^M_{m=1} \sqrt{\eta_{mk}}\gamma_{mk}\right)^2}{\rho_\textrm{d} \sum\limits^K_{k'=1} \sum\limits^M_{m=1} \eta_{mk'} \beta_{mk} \gamma_{mk'} + 1}\right)&\text{for statistical CSI,} \\ (\ref{eq:DLrateApprox2})&\text{for Beamforming Training,}\\ \mathbb{E} \left\{ \log_2 \left( 1 + \frac{\rho_\textrm{d}|a_{kk}|^2}{\rho_\textrm{d} \sum\limits^K_{k' \neq k} |a_{kk'}|^2 + 1} \right)\right\}&\text{for perfect CSI.} \end{cases} \end{align} \setcounter{equation}{\value{MYtempeqncnt}} \hrulefill \vspace*{4pt} \end{figure*} \section{Achievable Downlink Rate} In this section we derive an achievable downlink rate for conjugate beamforming precoding, using downlink pilots via Beamforming Training. An achievable downlink rate for the $k$th user is obtained by evaluating the mutual information between the observed signal $r_{\textrm{d},k}$ given by (\ref{eq:receiveddownlinksignal}), the known channel estimate $\hat{a}_{kk}$ given by (\ref{eq:a_kk2}) and the unknown transmitted signal $q_k$: $I(q_k;r_{\textrm{d},k},\hat{a}_{kk})$, for a permissible choice of input signal distribution. Letting $\tilde{a}_{kk}$ be the channel estimation error, the effective channel gain $a_{kk}$ can be decomposed as \begin{equation} \label{eq:ChEstErr} a_{kk} = \hat{a}_{kk}+\tilde{a}_{kk}. \end{equation} Note that, since we use the linear MMSE estimation, the estimate $\hat{a}_{kk}$ and the estimation error $\tilde{a}_{kk}$ are uncorrelated, but not independent. The received signal at the $k$th user described in (\ref{eq:receiveddownlinksignal}) can be rewritten as \begin{align} r_{\textrm{d},k} = \sqrt{\rho_\textrm{d}}\ {a}_{kk} q_{k} + \tilde{w}_{\textrm{d},k}, \end{align} where $ \tilde{w}_{\textrm{d},k} \triangleq \sqrt{\rho_\textrm{d}}\ \sum^K_{k' \neq k} a_{kk'} q_{k'} + w_{\textrm{d},k} $ is the effective noise, which satisfies $\mathbb{E}\left\{\tilde{w}_{\textrm{d},k} \mathrel{\big|} \hat{a}_{kk} \right\}=\mathbb{E}\left\{q_k^\ast\tilde{w}_{\textrm{d},k} \mathrel{\big|} \hat{a}_{kk} \right\}=\mathbb{E}\left\{a_{kk}^\ast q_k^\ast\tilde{w}_{\textrm{d},k} \mathrel{\big|} \hat{a}_{kk} \right\} = 0$. Therefore, following a similar methodology as in \cite{Medard}, we obtain an achievable downlink rate of the transmission from the APs to the $k$th user, which is given by (\ref{eq:genericDLrate}) at the top of the page. The expression given in (\ref{eq:genericDLrate}) can be simplified by making the approximation that $a_{kk'}$, $k'=1,...,K$, are Gaussian RVs. Indeed, according to the Cram\'{e}r central limit theorem\footnote{Cram\'{e}r central limit theorem: Let $X_1, X_2, ..., X_n$ are independent circularly symmetric complex RVs. Assume that $X_i$ has zero mean and variance $\sigma^2_i$. If $s^2_n = \sum^n_{i=1} \sigma^2_i \rightarrow \infty$ and $\sigma_i/s_n \rightarrow 0$, as $n\rightarrow \infty$, then $\frac{\sum^n_{i=1} X_i}{s_n} \xrightarrow{d} \mathcal{CN}(0,1), \ \text{as } n \rightarrow \infty$.}, we have \setcounter{equation}{19} \begin{align} \label{eq:approxAk1} &a_{kk'} = \sum^M_{m=1} \sqrt{\eta_{mk'}} \ {g}_{mk} \hat{g}^*_{mk'} \xrightarrow{d} \mathcal{CN}\left(0, \varsigma_{kk'} \right), \text{ as } M \rightarrow \infty, \\ \label{eq:approxAkk} &a_{kk} = \sum^M_{m=1} \sqrt{\eta_{mk}} |\hat{g}_{mk}|^2 + \sum^M_{m=1} \sqrt{\eta_{mk}} \tilde{g}_{mk} \hat{g}^*_{mk} \nonumber \\ &\approx \sum^M_{m=1} \sqrt{\eta_{mk}} |\hat{g}_{mk}|^2 \xrightarrow{d} \mathcal{N}\left(\sum^M_{m=1} \sqrt{\eta_{mk}} \gamma_{mk},\sum^M_{m=1} \eta_{mk} \gamma_{mk}^2 \right), \nonumber \\ &\text{as } M \rightarrow \infty, \end{align} where $\varsigma_{kk'} \triangleq \sum_{m=1}^M \eta_{mk'} \beta_{mk} \gamma_{mk'}$, and $\xrightarrow{d}$ denotes convergence in distribution. The Gaussian approximations (\ref{eq:approxAk1}) and (\ref{eq:approxAkk}) can be verified by numerical results, as shown in Figure \ref{pdfplot}. The pdfs show a close match between the empirical and the Gaussian distribution even for small $M$. Furthermore, with high probability the imaginary part of $a_{kk}$ is much smaller than the real part so it can be reasonably neglected. \begin{figure}[!t] \centering \includegraphics[width=3.3in]{pdfplotlog} \caption{The approximate (Gaussian) and the true (empirical) pdfs of $a_{kk}$ and $a_{kk'}$ for a given $\beta_{mk}$ realization (the large-scale fading model is discussed in detail in Section \ref{NumericalResults}). Here, $M = 20$ and $K = 5$.} \label{pdfplot} \end{figure} Under the assumption that $a_{kk}$ is Gaussian distributed, $\hat{a}_{kk}$ in (\ref{eq:a_kk2}) becomes the MMSE estimate of $a_{kk}$. As a consequence, $\hat{a}_{kk}$ and $\tilde{a}_{kk}$ are independent. In addition, by following a similar methodology as in \eqref{eq:approxAk1} and \eqref{eq:approxAkk}, we can show that any linear combination of $a_{kk}$ and $a_{kk'}$ are asymptotically (for large $M$) Gaussian distributed, and hence $a_{kk}$ and $a_{kk'}$ are asymptotically jointly Gaussian distributed. Furthermore, $a_{kk}$ and $a_{kk'}$ are uncorrelated so they are independent. Hence, the achievable downlink rate (\ref{eq:genericDLrate}) is reduced to\footnote{ A formula similar to \eqref{eq:DLrateApprox} but for co-located massive MIMO systems, was given in \cite{NgoDlPilots,Khansefid} with equality between the left and right hand sides. Those expressions were not rigorously correct capacity lower bounds (although very good approximations), as $a_{kk}$ is non-Gaussian in general. } \begin{equation} \label{eq:DLrateApprox} R_k \!\approx\! \mathbb{E}\! \left\{\! \log_2 \!\left( \!1 \!+\! \frac{\rho_\textrm{d}|\hat{a}_{kk}|^2}{\rho_\textrm{d} \mathbb{E}\{|\tilde{a}_{kk}|^2\} + \rho_\textrm{d} \sum\limits^K_{k' \neq k} \mathbb{E}\{|a_{kk'}|^2\} + 1} \!\right) \!\right\}. \end{equation} \textit{Proposition 2:} With conjugate beamforming, an achievable rate of the transmission from the APs to the $k$th user is \begin{align} \label{eq:DLrateApprox2} R_k \approx \mathbb{E} \left\{ \log_2 \left( 1 + \frac{\rho_\textrm{d}|\hat{a}_{kk}|^2}{\rho_\textrm{d}\frac{\varsigma_{kk}}{\tau_\textrm{d,p}\rho_\textrm{d,p}\varsigma_{kk}+1} + \rho_\textrm{d} \sum\limits^K_{k' \neq k} \varsigma_{kk'} + 1} \right) \right\}. \end{align} \begin{IEEEproof} See Appendix B. \end{IEEEproof} \section{Numerical Results} \label{NumericalResults} We compare the performance of cell-free massive MIMO for three different assumptions on CSI: \textit{(i)} Statistical CSI, without downlink pilots and users exploiting only statistical knowledge of the channel gain \cite{NgoCF}; \textit{(ii)} Beamforming Training, transmitting downlink pilots and users estimating the gain from those pilots; \textit{(iii)} Perfect CSI, where the users know the effective channel gain. The latter represents an upper bound (genie) on performance, and is not realizable in practice. The gross spectral efficiencies for these cases are given by (\ref{eq:rateComparison}) at the top of the page. Taking into account the performance loss due to the downlink and uplink pilots, the \textit{per-user net throughput} (bit/s) is \setcounter{equation}{24} \begin{equation} \mathcal{S}_k = B \frac{1-\tau_{\textrm{oh}}/\tau}{2} R_k, \end{equation} where $B$ is the bandwidth, $\tau$ is the length of the coherence interval in samples, and $\tau_{\textrm{oh}}$ is the pilots overhead, i.e., the number of samples per coherence interval spent for the training phases. We further examine the performance improvement by using the \textit{max-min fairness power control} algorithm in \cite{NgoCF}, which provides equal and hence uniformly good service to all users for the Statistical CSI case. When using this algorithm for the Beamforming Training case (and for the Perfect CSI bound), we use the power control coefficients computed for the Statistical CSI case. This is, strictly speaking, not optimal but was done for computational reasons, as the rate expressions with user CSI are not in closed form. \subsection{Simulation Scenario} Consider $M$ APs and $K$ users uniformly randomly distributed within a square of size $1 \text{ km}^2$. The large-scale fading coefficient $\beta_{mk}$ is modeled as \begin{equation} \label{eq:beta} \beta_{mk} = \text{PL}_{mk} \cdot 10^{\frac{\sigma_{sh}z_{mk}}{10}} \end{equation} where $\text{PL}_{mk}$ represents the path loss, and $10^{\frac{\sigma_{sh}z_{mk}}{10}}$ is the shadowing with standard deviation $\sigma_{sh}$ and $z_{mk}\sim\mathcal{N}(0,1)$. We consider the three-slope model for the path loss as in \cite{NgoCF} and uncorrelated shadowing. We adopt the following parameters: the carrier frequency is 1.9 GHz, the bandwidth is 20 MHz, the shadowing standard deviation is 8 dB, and the noise figure (uplink and downlink) is 9 dB. In all examples (except for Figures~\ref{cdfM50K10hpw} and \ref{cdfM50K10dpw}) the radiated power (data and pilot) is 200 mW for APs and 100 mW for users. The corresponding normalized transmit SNRs can be computed by dividing radiated powers by the noise power, which is given by \begin{align*} \text{noise power} = \text{bandwidth} \times k_B \times T_0 \times \text{noise figure} \text{ (W)}, \end{align*} where $k_B$ is the Boltzmann constant, and $T_0 = 290$ (Kelvin) is the noise temperature. The AP and user antenna height is 15 m, 1.65 m, respectively. The antenna gains are $0$ dBi. Lastly, we take $\tau_{\textrm{d,p}} = \tau_{\textrm{u,p}} = K$, and $\tau = 200$ samples which corresponds to a coherence bandwidth of 200 kHz and a coherence time of 1 ms. To avoid cell-edge effects, and to imitate a network with an infinite area, we performed a wrap-around technique, in which the simulation area is wrapped around such that the nominal area has eight neighbors. \subsection{Performance Evaluation} We focus first on the performance gain, over the conventional scheme, provided by jointly using Beamforming Training scheme and max-min fairness power control in the downlink. We consider two scenarios, with different network densities. \begin{figure}[!t] \centering \includegraphics[width=3.3in]{cdfM50K10} \caption{The cumulative distribution of the per-user downlink net throughput with and without max-min power control (PC), for the case of statistical, imperfect and perfect CSI knowledge at the user, $M = 50$ and $K = 10$.} \label{cdfM50K10} \end{figure} Figure \ref{cdfM50K10} shows the cumulative distribution function (cdf) of the per-user net throughput for the three cases, with $M=50$, $K=10$. In such a low density scenario, the channel hardening is less pronounced and performing the Beamforming Training scheme yields high performance gain over the statistical CSI case. Moreover, the Beamforming Training curve approaches the upper bound. Combining max-min power control with Beamforming Training scheme, gains can be further improved. For instance, Beamforming Training provides a performance improvement of $18\%$ over the statistical CSI case in terms of 95\%-likely per-user net throughput, and $29\%$ in terms of median per-user net throughput. By contrast, for higher network densities the gap between statistical and Beamforming Training tends to be reduced due to two factors: $(i)$ as $M$ increases, the statistical CSI knowledge at the user side is good enough for reliable downlink detection due to the channel hardening; $(ii)$ as $K$ increases, the pilot overhead becomes significant. In Figure \ref{cdfM100K20} the scenario with $M=100$, $K=20$ is illustrated. Here, the 95\%-likely and the median per-user net throughput of the Beamforming Training improves of $4\%$ and $13\%$, respectively, the performance of the statistical CSI case. \begin{figure}[!t] \centering \includegraphics[width=3.3in]{cdfM100K20} \caption{The cumulative distribution of the per-user downlink net throughput with and without max-min power control (PC), for the case of statistical, imperfect and perfect CSI knowledge at the user, $M = 100$ and $K = 20$.} \label{cdfM100K20} \end{figure} Max-min fairness power control maximizes the rate of the worst user. This philosophy leads to two noticeable consequences: $(i)$ the curves describing with power control are more concentrated around their medians; $(ii)$ as $K$ increases, performing power control has less impact on the system performance, since the probability to have users experiencing poor channel conditions increases. Finally, we compare the performance provided by the two schemes by setting different values for the radiated powers. In Figure \ref{cdfM50K10hpw}, the radiated power is set to 50 mW and 20 mW for the downlink and the uplink, respectively, with $M=50$ and $K=10$. In low SNR regime, with max-min fairness power control, Beamforming Training scheme outperforms the statistical CSI case of about $26\%$ in terms of 95\%-likely per-user net throughput, and about $34\%$ in terms of median per-user net throughput. \begin{figure}[!t] \centering \includegraphics[width=3.3in]{cdfM50K10hpw} \caption{The same as Figure \ref{cdfM50K10}, but the radiated power for data and pilot is 50 mW for APs and 20 mW for users.} \label{cdfM50K10hpw} \end{figure} Similar performance gaps are obtained by increasing the radiated power to 400 mW for the downlink and 200 mW for the uplink, as shown in Figure \ref{cdfM50K10dpw}. \begin{figure}[!t] \centering \includegraphics[width=3.3in]{cdfM50K10dpw} \caption{The same as Figure \ref{cdfM50K10}, but the radiated power for data and pilot is 400 mW for APs and 200 mW for users.} \label{cdfM50K10dpw} \end{figure} \section{Conclusion} Co-located massive MIMO systems do not need downlink training since by virtue of channel hardening, the effective channel gain seen by each user fluctuates only slightly around its mean. In contrast, in cell-free massive MIMO, only a small number of APs may substantially contribute, in terms of transmitted power, to serving a given user, resulting in less channel hardening. We showed that by transmitting downlink pilots, and performing Beamforming Training together with max-min fairness power control, performance of cell-free massive MIMO can be substantially improved. We restricted our study to the case of mutually orthogonal pilots. The general case with non-orthogonal pilots may be included in future work. Further work may also include pilot assignment algorithms, optimal power control, and the analysis of zero-forcing precoding technique. \section*{Appendix} \subsection{Proof of Proposition 1} \begin{itemize} \item Compute $\mathbb{E}\{a_{kk'}\}$: From \eqref{eq:akkdef}, and by using $g_{mk}\triangleq\hat{g}_{mk}+\tilde{g}_{mk}$, we have \begin{align} \label{eq:ChEstWithErr} & a_{kk'} = \sum^M_{m=1} \sqrt{\eta_{mk'}} \hat{g}_{mk} \hat{g}^*_{mk'} + \sum^M_{m=1} \sqrt{\eta_{mk'}} \tilde{g}_{mk} \hat{g}^*_{mk'}. \end{align} Owing to the properties of MMSE estimation, $\tilde{g}_{mk}$ and $\hat{g}_{mk}$ are independent, $k=1, \ldots, K$. Therefore, \begin{align} \label{eq:Eakk} \mathbb{E}\{a_{kk'}\} &= \mathbb{E}\left\{\sum^M_{m=1} \sqrt{\eta_{mk'}} \hat{g}_{mk} \hat{g}^*_{mk'}\right\} \nonumber \\ &= \begin{cases} 0 & \quad \text{if } k' \neq k\\ \sum\limits^M_{m=1} \sqrt{\eta_{mk}} \ \gamma_{mk} & \quad \text{if } k' = k.\\ \end{cases} \end{align} \item Compute $\mathrm{Var}\{a_{kk}\}$: \begin{equation} \label{eq:Varakk} \mathrm{Var}\{a_{kk}\} = \mathbb{E}\{{|a_{kk}|}^2\} - {|\mathbb{E}\{a_{kk}\}|}^2. \end{equation} According to (\ref{eq:ChEstWithErr}), we get \begin{align} \label{eq:EakkSq} & \mathbb{E}\{{|a_{kk}|}^2\} = \mathbb{E} \left\{\left| \sum\limits^M_{m=1} \sqrt{\eta_{mk}} |\hat{g}_{mk}|^2 \right|^2\right\} \nonumber \\ &\qquad\qquad\qquad\qquad {} + \mathbb{E} \left\{\left| \sum\limits^M_{m=1} \sqrt{\eta_{mk}} \tilde{g}_{mk} \hat{g}^*_{mk} \right|^2 \right\} \nonumber \\ &\stackrel{(a)}{=} \mathbb{E} \left\{ \sum\limits^M_{m=1} \sum\limits^M_{m'=1} \sqrt{\eta_{mk}} |\hat{g}_{mk}|^2 \sqrt{\eta_{m'k}} |\hat{g}_{m'k}|^2 \right\} \nonumber \\ &\qquad\qquad {} + \sum\limits^M_{m=1} \eta_{mk}(\beta_{mk} - \gamma_{mk})\gamma_{mk} \nonumber \\ &= \sum\limits^M_{m=1} \sum\limits^M_{m'=1} \sqrt{\eta_{mk} \eta_{m'k}} \ \mathbb{E} \left\{ |\hat{g}_{mk}|^2 |\hat{g}_{m'k}|^2 \right\} + \nonumber \\ &\qquad\qquad {} + \sum\limits^M_{m=1} \eta_{mk}(\beta_{mk} - \gamma_{mk})\gamma_{mk} \nonumber \\ &= \sum\limits^M_{m=1} \eta_{mk}(\beta_{mk} - \gamma_{mk})\gamma_{mk} + \sum\limits^M_{m=1} \eta_{mk} \ \mathbb{E} \left\{ |\hat{g}_{mk}|^4 \right\} \nonumber \\ &\qquad\qquad {} + \sum\limits^M_{m=1} \sum\limits^M_{m' \neq m} \sqrt{\eta_{mk} \eta_{m'k}} \ \mathbb{E} \left\{ |\hat{g}_{mk}|^2 |\hat{g}_{m'k}|^2 \right\} \nonumber \\ &\stackrel{(b)}{=} \sum\limits^M_{m=1} \eta_{mk}(\beta_{mk} - \gamma_{mk})\gamma_{mk} + 2 \sum\limits^M_{m=1} \eta_{mk} \gamma_{mk}^2 \nonumber \\ &\qquad\qquad {} + \sum\limits^M_{m=1} \sum\limits^M_{m' \neq m} \sqrt{\eta_{mk} \eta_{m'k}} \ \gamma_{mk} \gamma_{m'k}, \end{align} where $(a)$ follows from the fact that $\mathbb{E}\{{|\tilde{g}_{mk}|}^2\} = \beta_{mk} - \gamma_{mk}$, and $(b)$ from $\mathbb{E}\left\{{\left|\hat{g}_{mk} \right|}^4\right\} = 2 \gamma^2_{mk}$. From (\ref{eq:Eakk}), we have \begin{align} \label{eq:sqEakk} & {|\mathbb{E}\{a_{kk}\}|}^2 = \left| \sum\limits^M_{m=1} \sqrt{\eta_{mk}} \gamma_{mk} \right|^2 \nonumber \\ &= \sum\limits^M_{m=1} \sum\limits^M_{m'=1} \sqrt{\eta_{mk} \eta_{m'k}} \ \gamma_{mk} \gamma_{m'k} \nonumber \\ &= \sum\limits^M_{m=1} \eta_{mk} \gamma_{mk}^2 + \sum\limits^M_{m=1} \sum\limits^M_{m' \neq m} \sqrt{\eta_{mk} \eta_{m'k}} \ \gamma_{mk} \gamma_{m'k} . \end{align} Substituting (\ref{eq:EakkSq}) and (\ref{eq:sqEakk}) into (\ref{eq:Varakk}), we obtain \begin{equation} \label{eq:VarakkVal} \mathrm{Var}\{a_{kk}\} = \sum\limits^M_{m=1} \eta_{mk} \beta_{mk} \gamma_{mk} = \varsigma_{kk}. \end{equation} Substituting (\ref{eq:Eakk}) and (\ref{eq:VarakkVal}) into (\ref{eq:a_kk}), we get (\ref{eq:a_kk2}). \end{itemize} \subsection{Proof of Proposition 2} \begin{itemize} \item Compute $\mathbb{E}\{{|a_{kk'}|}^2\}$ for $k' \neq k$: From (\ref{eq:ChEstWithErr}) and (\ref{eq:Eakk}), we have \begin{align} \label{eq:Varaki} &\mathbb{E}\{{|a_{kk'}|}^2\} = \mathrm{Var}\{a_{kk'}\} \nonumber \\ &= \mathbb{E}\left\{{\left|\sum\limits^M_{m=1} \sqrt{\eta_{mk'}} \hat{g}_{mk} \hat{g}^*_{mk'}\right|}^2\right\} \nonumber \\ &\qquad\qquad\qquad\qquad {} + \mathbb{E}\left\{{\left|\sum\limits^M_{m=1} \sqrt{\eta_{mk'}} \tilde{g}_{mk} \hat{g}^*_{mk'}\right|}^2\right\} \nonumber \\ &= \sum\limits^M_{m=1} \eta_{mk'} \mathbb{E}\left\{{\left|\hat{g}_{mk} \hat{g}^*_{mk'}\right|}^2\right\} + \sum\limits^M_{m=1} \eta_{mk'} \mathbb{E}\left\{{\left|\tilde{g}_{mk} \hat{g}^*_{mk'}\right|}^2\right\} \nonumber \\ &\stackrel{(a)}{=} \sum\limits^M_{m=1} \eta_{mk'} \gamma_{mk} \gamma_{mk'} + \sum\limits^M_{m=1} \eta_{mk'}(\beta_{mk} - \gamma_{mk})\gamma_{mk'} \nonumber \\ &= \sum\limits^M_{m=1} \eta_{mk'} \beta_{mk} \gamma_{mk'} = \varsigma_{kk'}, \end{align} where $(a)$ is obtained by using (\ref{eq:defGamma}) and the fact that $\tilde{g}_{mk}$ has zero mean and is independent of $\hat{g}_{mk}$. Moreover, we have that $\mathbb{E}\{{|\tilde{g}_{mk}|}^2\} = \beta_{mk} - \gamma_{mk}$. \item Compute $\mathbb{E}\{{|\tilde{a}_{kk}|}^2\}$: From (\ref{eq:a_kk2}) and (\ref{eq:ChEstErr}), we have \begin{align} \label{eq:ekk2} & \mathbb{E}\{{|\tilde{a}_{kk}|}^2\} = \mathbb{E}\{{|a_{kk}-\hat{a}_{kk}|}^2\} \nonumber \\ &= \mathbb{E}\left\{\left|a_{kk} - \frac{\sqrt{\tau_\textrm{d,p}\rho_\textrm{d,p}} \varsigma_{kk} \check{y}_{\textrm{dp},k}}{\tau_\textrm{d,p}\rho_\textrm{d,p}\varsigma_{kk} + 1} - \frac{\sum_{m=1}^M \sqrt{\eta_{mk}} \gamma_{mk}}{\tau_\textrm{d,p}\rho_\textrm{d,p} \varsigma_{kk} + 1} \right|^2\right\} \nonumber \\ &\stackrel{(a)}{=} \mathbb{E}\left\{\left|a_{kk} \left(1- \frac{\tau_\textrm{d,p}\rho_\textrm{d,p} \varsigma_{kk}}{\tau_\textrm{d,p}\rho_\textrm{d,p}\varsigma_{kk} + 1}\right) - \frac{\sum_{m=1}^M \sqrt{\eta_{mk}} \gamma_{mk}}{\tau_\textrm{d,p}\rho_\textrm{d,p} \varsigma_{kk} + 1} \right. \right. \nonumber \\ &\quad\quad \left. \left. - \frac{\sqrt{\tau_\textrm{d,p}\rho_\textrm{d,p}} \varsigma_{kk} n_{\textrm{p},k}}{\tau_\textrm{d,p}\rho_\textrm{d,p}\varsigma_{kk} + 1} \right|^2\right\} \nonumber \\ &= \mathbb{E}\left\{\left|\frac{a_{kk} - \sum_{m=1}^M \sqrt{\eta_{mk}} \gamma_{mk} - \sqrt{\tau_\textrm{d,p}\rho_\textrm{d,p}} \varsigma_{kk} n_{\textrm{p},k}}{\tau_\textrm{d,p}\rho_\textrm{d,p}\varsigma_{kk} + 1} \right|^2\right\} \nonumber \\ &\stackrel{(b)}{=} \frac{\mathbb{E}\left\{\left|a_{kk} - \mathbb{E}\{a_{kk}\} - \sqrt{\tau_\textrm{d,p}\rho_\textrm{d,p}}\ \varsigma_{kk} n_{\textrm{p},k} \right|^2\right\}}{\left(\tau_\textrm{d,p}\rho_\textrm{d,p} \varsigma_{kk}+1\right)^2} \nonumber \\ &\stackrel{(c)}{=} \frac{\mathrm{Var}\{a_{kk}\} + \tau_\textrm{d,p}\rho_\textrm{d,p} \varsigma^2_{kk}}{\left(\tau_\textrm{d,p}\rho_\textrm{d,p} \varsigma_{kk}+1\right)^2} \nonumber \\ &= \frac{\varsigma_{kk} + \tau_\textrm{d,p}\rho_\textrm{d,p} \varsigma^2_{kk}}{\left(\tau_\textrm{d,p}\rho_\textrm{d,p} \varsigma_{kk}+1\right)^2} \nonumber \\ &= \frac{\varsigma_{kk}}{\tau_\textrm{d,p}\rho_\textrm{d,p} \varsigma_{kk}+1}, \end{align} where $(a)$ is obtained by using (\ref{eq:receivedDLpilotprojection}), and $(b)$ by using (\ref{eq:Eakk}). Instead, $(c)$ follows from the fact that $a_{kk} - \mathbb{E}\left\{a_{kk}\right\}$, $n_{\textrm{p},k}$ are independent and zero-mean RVs. Moreover, $n_{\textrm{p},k}$ has unitary variance. Substituting (\ref{eq:Varaki}) and (\ref{eq:ekk2}) in (\ref{eq:DLrateApprox}), we arrive at the result in Proposition 2. \end{itemize} \bibliographystyle{IEEEtran}
{'timestamp': '2016-09-14T02:06:27', 'yymm': '1607', 'arxiv_id': '1607.04753', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04753'}
arxiv
\section{Introduction} Artificial neural networks are currently considered the state of the art in applications ranging from image classification, to speech recognition and even machine translation. However, little is understood about the process by which they are trained for supervised learning tasks. The problem of optimizing their parameters is an active area both practical and theoretical research. Despite considerable sensitivity to initialization and choice of hyperparameters, neural networks often achieve compelling results after optimization by gradient descent methods. Due to the nonconvexity and massive parameter space of these functions, it is poorly understood how these sub-optimal methods have proven so successful. Indeed, training a certain kind of neural network is known to be NP-Complete, making it difficult to provide any worst-case training guarantees \cite{Blum:1992:OCT:148433.148441}. Much recent work has attempted to reconcile these differences between theory and practice \cite{Kawaguchi:2016:WithoutPoorLocalMinima,Soudry:2016:NoBadLocalMinima}. This article attempts a modest step towards understanding the dynamics of the training procedure. We establish three main convexity results for a certain class of neural network, which is the current the state of the art. First, that the objective is piecewise convex as a function of the input data, with parameters fixed, which corresponds to the behavior at test time. Second, that the objective is again piecewise convex as a function of the parameters of a single layer, with the input data and all other parameters held constant. Third, that the training objective function, for which all parameters are variable but the input data is fixed, is piecewise multi-convex. That is, it is a continuous function which can be represented by a finite number of multi-convex functions, each active on a multi-convex parameter set. This generalizes the notion of biconvexity found in the optimization literature to piecewise functions and arbitrary index sets \cite{Gorski:2007:BiConvex}. To prove these results, we require two main restrictions on the definition of a neural network: that its layers are piecewise affine functions, and that its objective function is convex and continuously differentiable. Our definition includes many contemporary use cases, such as least squares or logistic regression on a convolutional neural network with rectified linear unit (ReLU) activation functions and either max- or mean-pooling. In recent years these networks have mostly supplanted the classic sigmoid type, except in the case of recurrent networks \cite{Glorot:2011:ReluNetworks}. We make no assumptions about the training data, so our results apply to the current state of the art in many practical scenarios. Piecewise multi-convexity allows us to characterize the extrema of the training objective. As in the case of biconvex functions, stationary points and local minima are guaranteed optimality on larger sets than we would have for general smooth functions. Specifically, these points are partial minima when restricted to the relevant piece. That is, they are points for which no decrease can be made in the training objective without simultaneously varying the parameters across multiple layers, or crossing the boundary into a different piece of the function. Unlike global minima, we show that partial minima are reliably found by the optimization algorithms used in current practice. Finally, we provide some guarantees for solving general multi-convex optimization problems by various algorithms. First we analyze gradient descent, proving necessary convergence conditions. We show that every point to which gradient descent converges is a piecewise partial minimum, excepting some boundary conditions. To prove stronger results, we define a different optimization procedure breaking each parameter update into a number of convex sub-problems. For this procedure, we show both necessary and sufficient conditions for convergence to a piecewise partial minimum. Interestingly, adding regularization to the training objective is all that is needed to prove necessary conditions. Similar results have been independently established for many kinds of optimization problems, including bilinear and biconvex optimization, and in machine learning the special case of linear autoencoders \cite{Wendell:1976:Bilinear,Gorski:2007:BiConvex,Baldi:2012:ComplexValuedAutoencoders}. Our analysis extends existing results on alternating convex optimization to the case of arbitrary index sets, and general multi-convex point sets, which is needed for neural networks. We admit biconvex problems, and therefore linear autoencoders, as a special case. Despite these results, we find that it is difficult to pass from partial to global optimality results. Unlike the encouraging case of linear autoencoders, we show that a single rectifier neuron, under the squared error objective, admits arbitrarily poor local minima. This suggests that much work remains to be done in understanding how sub-optimal methods can succeed with neural networks. Still, piecewise multi-convex functions are in some senses easier to minimize than the general class of smooth functions, for which none of our previous guarantees can be made. We hope that our characterization of neural networks could contribute to a better understanding of these important machine learning systems. \section{Preliminary material} We begin with some preliminary definitions and basic results concerning continuous piecewise functions. \begin{definition}\label{def:piecewise_affine} Let $g_{1},g_{2},...,g_{N}$ be continuous functions from $\mathbb{R}^{n}\rightarrow\mathbb{R}$. A \textbf{continuous piecewise} function $f$ has a finite number of closed, connected sets $S_{1},S_{2},...,S_{M}$ covering $\mathbb{R}^{n}$ such that for each $k$ we have $f(\boldsymbol{x})=g_{k}(\boldsymbol{x})$ for all $\boldsymbol{x}\in S_{k}$. The set $S_{k}$ is called a \textbf{piece }of $f$, and the function $g_{k}$ is called \textbf{active} on $S_{k}$. More specific definitions follow by restricting the functions $g$. A \textbf{continuous piecewise affine }function has $g_{k}(\boldsymbol{x})=\boldsymbol{a}^{T}\boldsymbol{x}+b$ where $\boldsymbol{a}\in\mathbb{R}^{n}$ and $b\in\mathbb{R}$. A \textbf{continuous piecewise convex} function has $g_{k}$ convex, with $S_{k}$ convex as well. \end{definition} Note that this definition of piecewise convexity differs from that found in the convex optimization literature, which focuses on \textit{convex} piecewise convex functions, i.e.~maxima of convex functions \cite{Tsevendorj:2001:PiecewiseConvex}. Note also that we do not claim a unique representation in terms of active functions $g_{k}$ and pieces $S_{k}$, only that there exists at least one such representation. Before proceeding, we shall extend definition \ref{def:piecewise_affine} to functions of multidimensional codomain for the affine case. \begin{definition}\label{def:piecewise_affine_onto_Rn} A function $f:\mathbb{R}^{m}\rightarrow\mathbb{R}^{n}$, and let $f_{k}:\mathbb{R}^{m}\rightarrow\mathbb{R}$ denote the $k^{th}$ component of $f$. Then $f$ is\textbf{ continuous piecewise affine} if each $f_{k}$ is. Choose some piece $S_{k}$ from each $f_{k}$ and let $S=\cap_{k=1}^{n}S_{k}$, with $S\ne\emptyset$. Then $S$ is a piece of $f$, on which we have $f(\boldsymbol{x})=A\boldsymbol{x}+\boldsymbol{b}$ for some $A\in\mathbb{R}^{n\times m}$ and $\boldsymbol{b}\in\mathbb{R}^{n}$. \end{definition} First, we prove an intuitive statement about the geometry of the pieces of continuous piecewise affine functions. \begin{theorem}\label{theorem:convex_polytope} Let $f:\mathbb{R}^{m}\rightarrow\mathbb{R}^{n}$ be continuous piecewise affine. Then $f$ admits a representation in which every piece is a convex polytope. \end{theorem} \begin{proof} Let $f_{k}:\mathbb{R}^{m}\rightarrow\mathbb{R}$ denote the $k^{th}$ component of $f$. Now, $f_{k}$ can be written in closed form as a max-min polynomial \cite{Ovchinnikov:2002:pwl_max_min}. That is, $f_{k}$ is the maximum of minima of its active functions. Now, for the minimum of two affine functions we have \[ \min(g_{i},g_{j})=\min(\boldsymbol{a}_{i}^{T}\boldsymbol{x}+b_{i},\boldsymbol{a}_{j}^{T}\boldsymbol{x}+b_{j}). \] This function has two pieces divided by the hyperplane $(\boldsymbol{a}_{i}^{T}-\boldsymbol{a}_{j}^{T})\boldsymbol{x}+b_{i}-b_{j}=0$. The same can be said of $\max(g_{i},g_{j})$. Thus the pieces of $f_{k}$ are intersections of half-spaces, which are just convex polytopes. Since the pieces of $f$ are intersections of the pieces of $f_{k}$, they are convex polytopes as well. \end{proof} See figure \ref{fig:bad_local_minimum} in section \ref{sec:Local-minima} for an example of this result on a specific neural network. Our next result concerns the composition of piecewise functions, which is essential for the later sections. \begin{theorem}\label{theorem:composition_piecewise_affine} Let $g:\mathbb{R}^{m}\rightarrow\mathbb{R}^{n}$ and $f:\mathbb{R}^{n}\rightarrow\mathbb{R}$ be continuous piecewise affine. Then so is $f\circ g$. \end{theorem} \begin{proof} To establish continuity, note that the composition of continuous functions is continuous. Let $S$ be a piece of $g$ and $T$ a piece of $f$ such that $S\cap g^{-1}(T)\ne\emptyset$, where $g^{-1}(T)$ denotes the inverse image of $T$. By theorem \ref{theorem:convex_polytope}, we can choose $S$ and $T$ to be convex polytopes. Since $g$ is affine, $g^{-1}(T)$ is closed and convex \cite{Boyd:2004:ConvexOptimization}. Thus $S\cap g^{-1}(T)$ is a closed, convex set on which we can write \begin{align} f(\boldsymbol{x}) & =\boldsymbol{a}^{T}\boldsymbol{x}+b\label{eq:pwa1}\\ g(\boldsymbol{x}) & =C\boldsymbol{x}+\boldsymbol{d}.\nonumber \end{align} Thus \begin{align} f\circ g(\boldsymbol{x}) & =\boldsymbol{a}^{T}C\boldsymbol{x}+\boldsymbol{a}^{T}\boldsymbol{d}+b\label{eq:pwa2} \end{align} which is an affine function. Now, consider the finite set of all such pieces $S\cap g^{-1}(T)$. The union of $g^{-1}(T)$ over all pieces $T$ is just $\mathbb{R}^{n}$, as is the union of all pieces $S$. Thus we have \begin{align*} \cup_{S}\cup_{T}\left(S\cap g^{-1}(T)\right) & =\cup_{S}\left(S\cap\cup_{T}g^{-1}(T)\right)\\ & =\cup_{S}\left(S\cap\mathbb{R}^{n}\right)\\ & =\mathbb{R}^{n}. \end{align*} Thus $f\circ g$ is piecewise affine on $\mathbb{R}^{n}$. \end{proof} We now turn to continuous piecewise convex functions, of which continuous piecewise affine functions are a subset. \begin{theorem}\label{theorem:covex_piecewise} Let $g:\mathbb{R}^{m}\rightarrow\mathbb{R}^{n}$ be a continuous piecewise affine function, and $h:\mathbb{R}^{n}\rightarrow\mathbb{R}$ a convex function. Then $f=h\circ g$ is continuous piecewise convex. \end{theorem} \begin{proof} On each piece $S$ of $g$ we can write \[ f(\boldsymbol{x})=h(A\boldsymbol{x}+\boldsymbol{b}). \] This function is convex, as it is the composition of a convex and an affine function \cite{Boyd:2004:ConvexOptimization}. Furthermore, $S$ is convex by theorem \ref{theorem:convex_polytope}. This establishes piecewise convexity by the proof of theorem \ref{theorem:composition_piecewise_affine}. \end{proof} Our final theorem concerns the arithmetic mean of continuous piecewise convex functions, which is essential for the analysis of neural networks. \begin{theorem}\label{theorem:mean_piecewise_convex} Let $f_{1},f_{2},...,f_{N}$ be continuous piecewise convex functions. Then so is their arithmetic mean $(1/N)\sum_{i=1}^{N}f_{i}(\boldsymbol{x})$. \end{theorem} The proof takes the form of two lemmas. \begin{lemma}\label{lemma:sum_piecewise_convex} Let $f_{1}$ and $f_{2}$ be a pair of continuous piecewise convex functions on $\mathbb{R}^{n}$. Then so is $f_{1}+f_{2}$. \end{lemma} \begin{proof} Let $S_{1}$ be a piece of $f_{1}$, and $S_{2}$ a piece of $f_{2}$, with $S_{1}\cap S_{2}\ne\emptyset$. Note that the sum of convex functions is convex \cite{Rockafellar:1970:ConvexAnalysis}. Thus $f_{1}+f_{2}$ is convex on $S_{1}\cap S_{2}$. Furthermore, $S_{1}\cap S_{2}$ is convex because it is an intersection of convex sets \cite{Rockafellar:1970:ConvexAnalysis}. Since this holds for all pieces of $f_{1}$ and $f_{2}$, we have that $f_{1}+f_{2}$ is continuous piecewise convex on $\mathbb{R}^{n}$. \end{proof} \begin{lemma} Let $\alpha>0$, and let $f$ be a continuous piecewise convex function. Then so is $\alpha f$. \end{lemma} \begin{proof} The continuous function $\alpha f$ is convex on every piece of $f$. \end{proof} Having established that continuous piecewise convexity is closed under addition and positive scalar multiplication, we can see that it is closed under the arithmetic mean, which is just the composition of these two operations. \section{Neural networks\label{sec:Neural-networks}} In this work, we define a neural network to be a composition of functions of two kinds: a convex continuously differentiable objective (or loss) function $h$, and continuous piecewise affine functions $g_{1},g_{2},...,g_{N}$, constituting the $N$ layers. Furthermore, the outermost function must be $h$, so that we have \[ f=h\circ g_{N}\circ g_{N-1}\circ...\circ g_{1} \] where $f$ denotes the entire network. This definition is not as restrictive as it may seem upon first glance. For example, it is easily verified that the rectified linear unit (ReLU) neuron is continuous piecewise affine, as we have \[ g(\boldsymbol{x})=\max(\boldsymbol{0},A\boldsymbol{x}+\boldsymbol{b}), \] where the maximum is taken pointwise. It can be shown that maxima and minima of affine functions are piecewise affine \cite{Ovchinnikov:2002:pwl_max_min}. This includes the convolutional variant, in which $A$ is a Toeplitz matrix. Similarly, max pooling is continuous piecewise linear, while mean pooling is simply linear. Furthermore, many of the objective functions commonly seen in machine learning are convex and continuously differentiable, as in least squares and logistic regression. Thus this seemingly restrictive class of neural networks actually encompasses the current state of the art. By theorem \ref{theorem:composition_piecewise_affine}, the composition of all layers $g=g_{N}\circ g_{N-1}\circ...\circ g_{1}$ is continuous piecewise affine. Therefore, a neural network is ultimately the composition of a continuous convex function with a single continuous piecewise affine function. Thus by theorem \ref{theorem:covex_piecewise} the network is continuous piecewise convex. Figure \ref{fig:network} provides a visualization of this result for the example network \begin{equation} f(x,y)=\left(2-\left[\left[x-y\right]_{+}-\left[x+y\right]_{+}+1\right]_{+}\right)^{2},\label{eq:example_network} \end{equation} where $\left[x\right]_{+}=\max(x,0)$. For clarity, this is just the two-layer ReLU network \[ f(x,y,z)=\left(z-\left[a_{5}\left[a_{1}x+a_{2}y\right]_{+}+a_{6}\left[a_{3}x+a_{4}y\right]_{+}+b_{1}\right]_{+}\right)^{2} \] with the squared error objective and a single data point $((x,y),z)$, setting $z=2$ and $a_{2}=a_{6}=-1$, with all other parameters set to $1$. \begin{figure} \begin{centering} \includegraphics[scale=0.5]{network} \par\end{centering} \centering{}\caption{The neural network of equation \ref{eq:example_network}, on the unit square. Although $f$ is not convex on $\mathbb{R}^{2}$, it is convex in each piece, and each piece is a convex set.} \label{fig:network} \end{figure} Before proceeding further, we must define a special kind of differentiability for piecewise continuous functions, and show that this holds for neural networks. \begin{definition} Let $f$ be piecewise continuous. We say that $f$ is \textbf{piecewise continuously differentiable} if each active function $g$ is continuously differentiable. \end{definition} To see that neural networks are piecewise continuously differentiable, note that the objective $h$ is continuously differentiable, as are the affine active functions of the layers. Thus their composition is continuously differentiable. It follows that non-differentiable points are found only on the boundaries between pieces. \section{Network parameters of a single layer\label{sec:Network-parameters-of-single-layer}} In the previous section we have defined neural networks as functions of labeled data. These are the functions relevant during testing, where parameters are constant and data is variable. In this section, we extend these results to the case where data is constant and parameters are variable, which is the function to optimized during training. For example, consider the familiar equation \[ f=(ax+b-y)^{2} \] with parameters $(a,b)$ and data $(x,y$). During testing, we hold $(a,b)$ constant, and consider $f$ as a function of the data $(x,y)$. During training, we hold $(x,y)$ constant and consider $f$ as a function of the parameters $(a,b)$. This is what we mean when we say that a network is being ``considered as a function of its parameters\footnote{This is made rigorous by taking cross-sections of point sets in section \ref{sec:Network-parameters-of-multiple-layers}. }.'' This leads us to an additional stipulation on our definition of a neural network. That is, each layer must be piecewise affine \textit{as a function of its parameters} as well. This is easily verified for all of the layer types previously mentioned. For example, with the ReLU neuron we have \begin{equation} f(A,\boldsymbol{b})=\left[A\boldsymbol{x}+\boldsymbol{b}\right]_{+}\label{eq:ReLU} \end{equation} so for $\left(A\boldsymbol{x}+\boldsymbol{b}\right)_{k}\ge0$ we have that the $k^{th}$ component of $f$ is linear in $(A,\boldsymbol{b})$, while for $\left(A\boldsymbol{x}+\boldsymbol{b}\right)_{k}<0$ it is constant. To see this, we can re-arrange the elements of $A$ into a column vector $\boldsymbol{a}$, in row-major order, so that we have \begin{align} A\boldsymbol{x}+\boldsymbol{b} & =\begin{pmatrix}\boldsymbol{x^{T}} & \boldsymbol{0^{T}} & ... & ... & \boldsymbol{0^{T}} & \boldsymbol{1}^{T}\\ \boldsymbol{0^{T}} & \boldsymbol{x^{T}} & \boldsymbol{0}^{T} & ... & \boldsymbol{0}^{T} & \boldsymbol{1}^{T}\\ ... & ... & ... & ... & ... & ...\\ \boldsymbol{0}^{T} & ... & ... & \boldsymbol{0}^{T} & \boldsymbol{x}^{T} & \boldsymbol{1}^{T} \end{pmatrix}\begin{pmatrix}\boldsymbol{a}\\ \boldsymbol{b} \end{pmatrix}.\label{eq:ReLU_expanded} \end{align} In section \ref{sec:Neural-networks} we have said that a neural network, considered as a function of its input data, is convex and continuously differentiable on each piece. Now, a neural network need \textit{not}\textbf{ }be piecewise convex as a function of the entirety of its parameters\footnote{To see this, consider the following two-layer network: $h(x)=x$, $g_{2}(x)=ax$, and $g_{1}(x)=bx$. For $f=h\circ g_{2}\circ g_{1}$ we have $f(x)=abx$. Now fix the input as $x=1$. Considered as a function of its parameters, this is $f(a,b)=ab$, which is decidedly not convex.}. However, we can regain piecewise convexity by considering it only as a function of the parameters in a single layer, all others held constant. \begin{theorem}\label{theorem:neural_network_single_layer} A neural network $f$ is continuous piecewise convex and piecewise continuously differentiable as a function of the parameters in a single layer. \end{theorem} \begin{proof} For the time being, assume the input data consists of a single point $\boldsymbol{x}$. By definition $f$ is the composition of a convex objective $h$ and layers $g_{1},g_{2},...,g_{N}$, with $g_{1}$ a function of $\boldsymbol{x}$. Let $f_{m}(\boldsymbol{x})$ denote the network $f$ considered as a function of the parameters of layer $g_{m}$, all others held constant. Now, the layers $g_{m-1}\circ g_{m-2}\circ...\circ g_{1}$ are constant with respect to the parameters of $g_{m}$, so we can write $\boldsymbol{y}=g_{m-1}\circ g_{m-2}\circ...\circ g_{1}(\boldsymbol{x})$. Thus on each piece of $g_{m}$ we have \[ g_{m}=A\boldsymbol{y}+\boldsymbol{b}. \] By definition $g_{m}$ is a continuous piecewise affine function of its parameters. Since $\boldsymbol{y}$ is constant, we have that $\tilde{g}_{m}=g_{m}\circ g_{m-1}\circ...\circ g_{1}$ is a continuous piecewise affine function of the parameters of $g_{m}$. Now, by theorem \ref{theorem:composition_piecewise_affine} we have that $g=g_{N}\circ g_{N-1}\circ...\circ\tilde{g}_{m}$ is a continuous piecewise affine function of the parameters of $g_{m}$. Thus by theorem \ref{theorem:covex_piecewise}, $f_{m}$ is continuous piecewise convex. To establish piecewise continuous differentiability, recall that affine functions are continuously differentiable, as is $h$. Having established the theorem for the case of a single data point, consider the case where we have multiple data points, denoted $\{\boldsymbol{x}_{k}\}_{k=1}^{M}$. Now, by theorem \ref{theorem:mean_piecewise_convex} the arithmetic mean $(1/M)\sum_{k=1}^{M}f_{m}(\boldsymbol{x}_{k})$ is continuous piecewise convex. Furthermore, the arithmetic mean preserves piecewise continuous differentiability. Thus these results hold for the mean value of the network over the dataset. \end{proof} We conclude this section with a simple remark which will be useful in later sections. Let $f_{m}$ be a neural network, considered as a function of the parameters of the $m^{th}$ layer, and let $S$ be a piece of $f_{m}$. Then the optimization problem \begin{align} \mbox{minimize } & f_{m}(\boldsymbol{x})\nonumber \\ \mbox{subject to } & \boldsymbol{x}\in S\label{eq:convex_single_layer} \end{align} is convex. \section{Network parameters of multiple layers\label{sec:Network-parameters-of-multiple-layers}} In the previous section we analyzed the convexity properties of neural networks when optimizing the parameters of a single layer, all others held constant. Now we are ready to extend these results to the ultimate goal of simultaneously optimizing all network parameters. Although not convex, the problem has a special convex substructure that we can exploit in proving future results. We begin by defining this substructure for point sets and functions. \begin{definition} Let $S\subseteq\mathbb{R}^{n}$, let $I\subset\{1,2,...,n\}$, and let $\boldsymbol{x}\in S$. The set \[ S_{I}(\boldsymbol{x})=\{\boldsymbol{y}\in S:(\boldsymbol{y}_{k}=\boldsymbol{x}_{k})_{k\notin I}\} \] is the \textbf{cross-section} of $S$ intersecting $\boldsymbol{x}$ with respect to $I$. \end{definition} In other words, $S_{I}(\boldsymbol{x})$ is the subset of $S$ for which every point is equal to $\boldsymbol{x}$ in the components not indexed by $I$. Note that this differs from the typical definition, which is the intersection of a set with a hyperplane. For example, $\mathbb{R}_{\{1\}}^{3}(\boldsymbol{0})$ is the $x$-axis, whereas $\mathbb{R}_{\{1,2\}}^{3}(\boldsymbol{0})$ is the $xy$-plane. Note also that cross-sections are not unique, for example $\mathbb{R}_{\{1,2\}}^{3}(0,0,0)=\mathbb{R}_{\{1,2\}}^{3}(1,2,0)$. In this case the first two components of the cross section are irrelevant, but we will maintain them for notational convenience. We can now apply this concept to functions on $\mathbb{R}^{n}$. \begin{definition} Let $S\subseteq\mathbb{R}^{n}$, let $f:S\rightarrow\mathbb{R}$ and let $\mathcal{I}$ be a collection of sets covering $\{1,2,...,n\}$. We say that $f$ is \textbf{multi-convex} with respect to $\mathcal{I}$ if $f$ is convex when restricted to the cross section $S_{I}(\boldsymbol{x})$, for all $\boldsymbol{x}\in S$ and $I\in\mathcal{I}$. \end{definition} This formalizes the notion of restricting a non-convex function to a variable subset on which it is convex, as in section \ref{sec:Network-parameters-of-single-layer} when a neural network was restricted to the parameters of a single layer. For example, let $f(x,y,z)=xy+z$, and let $I_{1}=\{1,3\}$, and $I_{2}=\{2,3\}$. Then $f_{1}(x,y_{0},z)$ is a convex function of $(x,z)$ with $y$ fixed at $y_{0}$. Similarly, $f_{2}(x_{0},y,z)$ is a convex function of $(y,z)$ with $x$ fixed at $x_{0}$. Thus $f$ is multi-convex with respect to $\mathcal{I}=\{I_{1},I_{2}\}$. To fully define a multi-convex optimization problem, we introduce a similar concept for point sets. \begin{definition} Let $S\subseteq\mathbb{R}^{n}$ and let $\mathcal{I}$ be a collection of sets covering $\{1,2,...,n\}$. We say that $S$ is \textbf{multi-convex }with respect to $\mathcal{I}$ if the cross-section $S_{I}(\boldsymbol{x})$ is convex for all $\boldsymbol{x}\in S$ and $I\in\mathcal{I}$. \end{definition} This generalizes the notion of biconvexity found in the optimization literature \cite{Gorski:2007:BiConvex}. From here, we can extend definition \ref{def:piecewise_affine} to multi-convex functions. However, we will drop the topological restrictions on the pieces of our function, since multi-convex sets need not be connected. \begin{definition} Let $f:\mathbb{R}^{n}\rightarrow\mathbb{R}$ be a continuous function. We say that $f$ is \textbf{continuous piecewise multi-convex} if each there exists a collection of multi-convex functions $g_{1},g_{2},...,g_{N}$ and multi-convex sets $S_{1},S_{2},...,S_{N}$ covering $\mathbb{R}^{n}$ such that for each $k$ we have $f(\boldsymbol{x})=g_{k}(\boldsymbol{x})$ for all $\boldsymbol{x}\in S_{k}$. Next, let $h:\mathbb{R}^{m}\rightarrow\mathbb{R}^{n}$. Then, $h$ is continuous piecewise multi-convex so long as each component is, as in definition \ref{def:piecewise_affine_onto_Rn}. \end{definition} From this definition, it is easily verified that a continuous piecewise multi-convex function $f:\mathbb{R}^{m}\rightarrow\mathbb{R}^{n}$ admits a representation where all pieces are multi-convex, as in the proof of theorem \ref{theorem:convex_polytope}. Before we can extend the results of section \ref{sec:Network-parameters-of-single-layer} to multiple layers, we must add one final constraint on the definition of a neural network. That is, each of the layers must be continuous piecewise multi-convex, considered as functions of both the parameters \textit{and} the input. Again, this is easily verified for the all of the layer types previously mentioned. We have already shown they are piecewise convex on each cross-section, taking our index sets to separate the parameters from the input data. It only remains to show that the number of pieces is finite. The only layer which merits consideration is the ReLU, which we can see from equation \ref{eq:ReLU} consists of two pieces for each component: the ``dead'' or constant region, with $(A\boldsymbol{x})_{j}+b_{j}<0$, and its compliment. With $n$ components we have at most $2^{n}$ pieces, corresponding to binary assignments of ``dead'' or ``alive'' for each component. Having said that each layer is continuous piecewise multi-convex, we can extend these results to the whole network. \begin{theorem} Let $f$ be a neural network, and let $\mathcal{I}$ be a collection of index sets, one for the parameters of each layer of $f$. Then $f$ is continuous piecewise multi-convex with respect to $\mathcal{I}$. \end{theorem} We begin the proof with a lemma for more general multi-convex functions. \begin{lemma}\label{lemma:composition_multi_convex} Let $X\subseteq\mathbb{R}^{n}$, $Y\subseteq\mathbb{R}^{m}$, and let $g:X\rightarrow Z$ and $f:Z\times Y\rightarrow\mathbb{R}^{n}$ be continuous piecewise multi-convex, $g$ with respect to a collection of index sets $\mathcal{G}$, and $f$ with respect to $\mathcal{F}=\{I_{Z},I_{Y}\}$, where $I_{Z}$ indexes the variables in $Z$, and $I_{Y}$ the variables in $Y$. Then $h(\boldsymbol{x},\boldsymbol{y})=f(g(\boldsymbol{x}),\boldsymbol{y})$ is continuous piecewise multi-convex with respect to $\mathcal{H}=\mathcal{G}\cup\{I_{Y}\}$. \end{lemma} \begin{proof} Let $G$ be a piece of $g$, let $F$ be a piece of $f$ and let $H=\{(\boldsymbol{x},\boldsymbol{y}):\boldsymbol{x}\in G,\,(g(\boldsymbol{x}),\boldsymbol{y})\in F\}$, with $F$ chosen so that $H\ne\emptyset$. Clearly $h$ is multi-convex on $H$ with respect to $\mathcal{H}$. It remains to show that $H$ is a multi-convex set. Now, let $(\boldsymbol{x},\boldsymbol{y})\in H$ and we shall show that the cross-sections are convex. First, for any $I_{X}\in\mathcal{G}$ we have $H_{I_{X}}(\boldsymbol{x},\boldsymbol{y})=G_{I_{X}}(\boldsymbol{x})\times\{\boldsymbol{y}\}$. Similarly, we have $H_{I_{Y}}(\boldsymbol{x},\boldsymbol{y})=\{\boldsymbol{x}\}\times\{\boldsymbol{y}:(\boldsymbol{z},\boldsymbol{y})\in F_{I_{Y}}(g(\boldsymbol{x}),\boldsymbol{y})\}$. These sets are convex, as they are the Cartesian products of convex sets \cite{Rockafellar:1970:ConvexAnalysis}. Finally, as in the proof of theorem \ref{theorem:composition_piecewise_affine}, we can cover $X\times Y$ with the finite collection of all such pieces $H$, taken over all $G$ and $F$. \end{proof} Our next lemma extends theorem \ref{theorem:mean_piecewise_convex} to multi-convex functions. \begin{lemma}\label{lemma:sum_piecewise_multi_convex} Let $\mathcal{I}$ be a collection of sets covering $\{1,2,...,n\}$, and let $f:\mathbb{R}^{n}\rightarrow\mathbb{R}$ and $g:\mathbb{R}^{n}\rightarrow\mathbb{R}$ be continuous piecewise multi-convex with respect to $\mathcal{I}$. Then so is $f+g$. \end{lemma} \begin{proof} Let $F$ be a piece of $f$ and $G$ be a piece of $g$ with $\boldsymbol{x}\in F\cap G$. Then for all $I\in\mathcal{I}$, $\left(F\cap G\right)_{I}(\boldsymbol{x})=F_{I}(\boldsymbol{x})\cap G_{I}(\boldsymbol{x})$, a convex set on which $f+g$ is convex. Thus $f+g$ is continuous piecewise multi-convex, where the pieces of $f+g$ are the intersections of pieces of $f$ and $g$. \end{proof} We can now prove the theorem. \begin{proof} For the moment, assume we have only a single data point. Now, let $g_{1}$ and $g_{2}$ denote layers of $f$, with parameters $\boldsymbol{\theta}_{1}\in\mathbb{R}^{m},\,\boldsymbol{\theta}_{2}\in\mathbb{R}^{n}$. Since $g_{1}$ and $g_{2}$ are continuous piecewise multi-convex functions of their parameters and input, we can write the two-layer sub-network as $h=f(g_{1}(\boldsymbol{\theta}_{1}),\boldsymbol{\theta}_{2})$. By repeatedly applying lemma \ref{lemma:composition_multi_convex}, the whole network is multi-convex on a finite number of sets covering the input and parameter space. Now we extend the theorem to the whole dataset, where each data point defines a continuous piecewise multi-convex function $f_{k}$. By lemma \ref{lemma:sum_piecewise_multi_convex}, the arithmetic mean $(1/N)\sum_{k=1}^{N}f_{k}$ is continuous piecewise multi-convex. \end{proof} In the coming sections, we shall see that multi-convexity allows us to give certain guarantees about the convergence of various optimization algorithms. But first, we shall prove some basic results independent of the optimization procedure. These results were summarized by Gorksi et al\@.~for the case of biconvex differentiable functions \cite{Gorski:2007:BiConvex}. Here we extend them to piecewise functions and arbitrary index sets. First we define a special type of minimum relevant for multi-convex functions. \begin{definition} Let $f:S\rightarrow\mathbb{R}$ and let $\mathcal{I}$ be a collection of sets covering $\{1,2,...,n\}$. We say that $\boldsymbol{x}_{0}$ is a \textbf{partial minimum} of $f$ with respect to $\mathcal{I}$ if $f(\boldsymbol{x}_{0})\le f(\boldsymbol{x})$ for all $\boldsymbol{x}\in\cup_{I\in\mathcal{I}}S_{I}(\boldsymbol{x}_{0})$. \end{definition} In other words, $\boldsymbol{x}_{0}$ is a partial minimum of $f$ with respect to $\mathcal{I}$ if it minimizes $f$ on every cross-section of $S$ intersecting $\boldsymbol{x}_{0}$, as shown in figure \ref{fig:cross_section}. By convexity, these points are intimately related to the stationary points of $f$. \begin{figure} \begin{centering} \includegraphics[scale=0.7]{cross_section} \par\end{centering} \caption{Cross-sections of a biconvex set.} \label{fig:cross_section} \end{figure} \begin{theorem}\label{theorem:multi_convex_partial_minimum} Let $\mathcal{I}=\{I_{1},I_{2},...,I_{m}\}$ be a collection of sets covering $\{1,2,...,n\}$, let $f:\mathbb{R}^{n}\rightarrow\mathbb{R}$ be continuous piecewise multi-convex with respect to $\mathcal{I}$, and let $\nabla f(\boldsymbol{x}_{0})=\boldsymbol{0}$. Then $\boldsymbol{x}_{0}$ is a partial minimum of $f$ on every piece containing $\boldsymbol{x}_{0}$. \end{theorem} \begin{proof} Let $S$ be a piece of $f$ containing \textbf{$\boldsymbol{x}_{0}$}, let $I\in\mathcal{I}$ , and let $S_{I}(\boldsymbol{x}_{0})$ denote the relevant cross-section of $S$. We know $f$ is convex on $S_{I}(\boldsymbol{x}_{0})$, and since $\nabla f(\boldsymbol{x}_{0})=\boldsymbol{0}$, we have that $\boldsymbol{x}_{0}$ minimizes $f$ on this convex set. Since this holds for all $I\in\mathcal{I}$, $\boldsymbol{x}_{0}$ is a partial minimum of $f$ on $S$. \end{proof} It is clear that multi-convexity provides a wealth of results concerning partial minima, while piecewise multi-convexity restricts those results to a subset of the domain. Less obvious is that partial minima of smooth multi-convex functions need not be local minima. An example was pointed out by a reviewer of this work, that the biconvex function $f(x,y)=xy$ has a partial minimum at the origin which is not a local minimum. However, the converse is easily verified, even in the absence of differentiability. \begin{theorem} Let $\mathcal{I}$ be a collection of sets covering $\{1,2,...,n\}$, let $f:\mathbb{R}^{n}\rightarrow\mathbb{R}$ be continuous piecewise multi-convex with respect to $\mathcal{I}$, and let $\boldsymbol{x}_{0}$ be a local minimum on some piece $S$ of $f$. Then $\boldsymbol{x}_{0}$ is a partial minimum on $S$. \end{theorem} \begin{proof} The proof is essentially the same as that of theorem \ref{theorem:multi_convex_partial_minimum}. \end{proof} We have seen that for multi-convex functions there is a close relationship between stationary points, local minima and partial minima. For these functions, infinitesimal results concerning derivatives and local minima can be extended to larger sets. However, we make no guarantees about global minima. The good news is that, unlike global minima, we shall see that we can easily solve for partial minima. \section{Gradient descent\label{sec:Optimization-and-convergence}} In the realm of non-convex optimization, also called global optimization, methods can be divided into two groups: those which can certifiably find a global minimum, and those which cannot. In the former group we sacrifice speed, in the latter correctness. This work focuses on algorithms of the latter kind, called local or sub-optimal methods, as only this type is used in practice for deep neural networks. In particular, the most common methods are variants of gradient descent, where the gradient of the network with respect its parameters is computed by a procedure called backpropagation. Since its explanation is often obscured by jargon, we shall provide a simple summary here. Backpropagation is nothing but the chain rule applied to the layers of a network. Splitting the network into two functions $f=u\circ v$, where $u:\mathbb{R}^{n}\rightarrow\mathbb{R}$, and $v:\mathbb{R}^{m}\rightarrow\mathbb{R}^{n}$, we have \[ \nabla f=\nabla u\mathcal{D}v \] where $\mathcal{D}$ denotes the Jacobian operator. Note that here the parameters of $u$ are considered fixed, whereas the parameters of $v$ are variable and the input data is fixed. Thus $\nabla f$ is the gradient of $f$ with respect to the parameters of $v$, if it exists. The special observation is that we can proceed from the top layer of the neural network $g_{N}$ to the bottom $g_{1}$, with $u=g_{N}\circ g_{N-1}\circ...\circ g_{m+1}$, and $v=g_{m}$, each time computing the gradient of $f$ with respect to the parameters of $g_{m}$. In this way, we need only store the vector $\nabla u$ and the matrix $\mathcal{D}v$ can be forgotten at each step. This is known as the ``backward pass,'' which allows for efficient computation of the gradient of a neural network with respect to its parameters. A similar algorithm computes the value of $g_{m-1}\circ g_{m-2}\circ...\circ g_{1}$ as a function of the input data, which is often needed to evaluate $\mathcal{D}v$. First we compute and store $g_{1}$ as a function of the input data, then $g_{2}\circ g_{1}$, and so on until we have $f$. This is known as the ``forward pass.'' After one forward and one backward pass, we have computed $\nabla f$ with respect to all the network parameters. Having computed $\nabla f$, we can update the parameters by gradient descent, defined as follows. \begin{definition} Let $S\subset\mathbb{R}^{n}$, and $f:S\rightarrow\mathbb{R}$ be partial differentiable, with $\boldsymbol{x}_{0}\in S$. Then \textbf{gradient descent} on $f$ is the sequence $\{\boldsymbol{x}_{k}\}_{k=0}^{\infty}$ defined by \[ \boldsymbol{x}_{k+1}=\boldsymbol{x}_{k}-\alpha_{k}\nabla f(\boldsymbol{x}_{k}) \] where $\alpha_{k}>0$ is called the \textbf{step size} or ``learning rate.'' In this work we shall make the additional assumption that $\sum_{k=0}^{\infty}a_{k}=\infty$. \end{definition} Variants of this basic procedure are preferred in practice because their computational cost scales well with the number of network parameters. There are many different ways to choose the step size, but our assumption that $\sum_{k=0}^{\infty}a_{k}=\infty$ covers what is usually done with deep neural networks. Note that we have not defined what happens if $\boldsymbol{x}_{k}\notin S$. Since we are ultimately interested in neural networks on $\mathbb{R}^{n}$, we can ignore this case and say that the sequence diverges. Gradient descent is not guaranteed to converge to a global minimum for all differentiable functions. However, it is natural to ask to which points it can converge. This brings us to a basic but important result. \begin{theorem}\label{theorem:gradient_descent} Let $f:\mathbb{R}^{n}\rightarrow\mathbb{R}$, and let $\{\boldsymbol{x}_{k}\}_{k=0}^{\infty}$ result from gradient descent on $f$ with $\lim_{k\rightarrow\infty}\boldsymbol{x}_{k}=\boldsymbol{x}^{*}$, and $f$ continuously differentiable at $\boldsymbol{x}^{*}$. Then $\nabla f(\boldsymbol{x}^{*})=\boldsymbol{0}$. \end{theorem} \begin{proof} First, we have \[ \boldsymbol{x}^{*}=\boldsymbol{x}_{0}-\sum_{k=0}^{\infty}\alpha_{k}\nabla f(\boldsymbol{x}_{k}). \] Assume for the sake of contradiction that for the $j^{th}$ partial derivative we have $|\partial f(\boldsymbol{x}^{*})/\partial(\boldsymbol{x})_{j}|>0$. Now, pick some $\varepsilon$ such that $0<\varepsilon<|\partial f(\boldsymbol{x}^{*})/\partial(\boldsymbol{x})_{j}|$, and by continuous differentiability, there is some $\delta>0$ such that for all $\boldsymbol{x}$, $\|\boldsymbol{x}^{*}-\boldsymbol{x}\|_{2}<\delta$ implies $\|\nabla f(\boldsymbol{x}^{*})-\nabla f(\boldsymbol{x})\|_{2}<\varepsilon$. Now, there must be some $K$ such that for all $k\ge K$ we have $\|\boldsymbol{x}^{*}-\boldsymbol{x}_{k}\|_{2}<\delta$, so that $\partial f(\boldsymbol{x}_{k})/\partial(\boldsymbol{x})_{j}$ does not change sign. Then we can write \begin{align*} \left|\sum_{k=K}^{\infty}\alpha_{k}\frac{\partial f(\boldsymbol{x}_{k})}{\partial\left(\boldsymbol{x}\right)_{j}}\right| & =\sum_{k=K}^{\infty}\alpha_{k}\left|\frac{\partial f(\boldsymbol{x}_{k})}{\partial\left(\boldsymbol{x}\right)_{j}}\right|\\ & \ge\sum_{k=K}^{\infty}\alpha_{k}\left(\left|\frac{\partial f(\boldsymbol{x}^{*})}{\partial\left(\boldsymbol{x}\right)_{j}}\right|-\varepsilon\right)\\ & =\infty. \end{align*} But this contradicts the fact that $\boldsymbol{x}_{k}$ converges. Thus $\nabla f(\boldsymbol{x}^{*})=\boldsymbol{0}$. \end{proof} In the convex optimization literature, this simple result is sometimes stated in connection with Zangwill's much more general convergence theorem \cite{Zangwill:1969:Optimization,Iusem:2003:subgradientConvergence}. Note, however, that unlike Zangwill we state necessary, rather than sufficient conditions for convergence. While many similar results are known, it is difficult to strictly weaken the conditions of theorem \ref{theorem:gradient_descent}. For example, if we relax the condition that $\alpha_{k}$ is not summable, and take $f(x)=x$, then $x_{k}$ will always converge to a non-stationary point. Similarly, if we relax the constraint that $f$ is continuously differentiable, taking $f(x)=|x|$ and $a_{k}$ decreasing monotonically to zero, we will always converge to the origin, which is not differentiable. Furthermore, if we have $f(x)=|x|$ with $\alpha_{k}$ constant, then $x_{k}$ will not converge for almost all $x_{0}$. It is possible to prove much stronger necessary and sufficient conditions for gradient descent, but these results require additional assumptions about the step size policy as well as the function to be minimized, and possibly even the initialization $\boldsymbol{x}_{0}$ \cite{Nesterov:2004:ConvexBook}. It is worth discussing $f(x)=|x|$ in greater detail, since this is a piecewise affine function and thus of interest in our investigation of neural networks. While we have said its only convergence point is not differentiable, it remains subdifferentiable, and convergence results are known for subgradient descent \cite{Iusem:2003:subgradientConvergence}. In this work we shall not make use of subgradients, instead considering descent on a piecewise continuously differentiable function, where the pieces are $x\le0$ and $x\ge0$. Although theorem \ref{theorem:gradient_descent} does not apply to this function, the relevant results hold anyways. That is, $x=0$ is minimal on some piece of $f$, a result which extends to any continuous piecewise convex function, as any saddle point is guaranteed to minimize some piece. Here we should note one way in which this analysis fails in practice. So far we have assumed the gradient $\nabla f$ is precisely known. In practice, it is often prohibitively expensive to compute the average gradient over large datasets. Instead we take random subsamples, in a procedure known as \textit{stochastic }gradient descent. We will not analyze its properties here, as current results on the topic impose additional restrictions on the objective function and step size, or require different definitions of convergence \cite{Bertsekas:2010:IncrementalGradient,Bach:2011:sgd,Ge:2015:sgdSaddle}. Restricting ourselves to the true gradient $\nabla f$ allows us to provide simple proofs applying to an extensive class of neural networks. We are now ready to generalize these results to neural networks. There is a slight ambiguity in that the boundary points between pieces need not be differentiable, nor even sub-differentiable. Since we are interested only in necessary conditions, we will say that gradient descent diverges when $\nabla f(\boldsymbol{x}_{k})$ does not exist. However, our next theorem can at least handle non-differentiable limit points. \begin{theorem}\label{theorem:multi_convex_gradient_descent} Let $\mathcal{I}=\{I_{1},I_{2},...,I_{m}\}$ be a collection of sets covering $\{1,2,...,n\}$, let $f:\mathbb{R}^{n}\rightarrow\mathbb{R}$ be continuous piecewise multi-convex with respect to $\mathcal{I}$, and piecewise continuously differentiable. Then, let $\{\boldsymbol{x}_{k}\}_{k=0}^{\infty}$ result from gradient descent on $f$ , with $\lim_{k\rightarrow\infty}\boldsymbol{x}_{k}=\boldsymbol{x}^{*}$, such that either \begin{enumerate} \item $f$ is continuously differentiable at $\boldsymbol{x}^{*}$, or \item there is some piece $S$ of $f$ and some $K>0$ such that $\boldsymbol{x}_{k}\in\interior S$ for all $k\ge K$. \end{enumerate} Then $\boldsymbol{x}^{*}$ is a partial minimum of $f$ on every piece containing $\boldsymbol{x}^{*}$. \end{theorem} \begin{proof} If the first condition holds, the result follows directly from theorems \ref{theorem:gradient_descent} and \ref{theorem:multi_convex_partial_minimum}. If the second condition holds, then $\{\boldsymbol{x}_{k}\}_{k=K}^{\infty}$ is a convergent gradient descent sequence on $g$, the active function of $f$ on $S$. Since $g$ is continuously differentiable on $\mathbb{R}^{n}$, the first condition holds for $g$. Since $f|_{S}=g|_{S}$, $\boldsymbol{x}^{*}$ is a partial minimum of $f|_{S}$ as well. \end{proof} The first condition of theorem \ref{theorem:multi_convex_gradient_descent} holds for every point in the interior of a piece, and some boundary points. The second condition extends these results to non-differentiable boundary points so long as gradient descent is eventually confined to a single piece of the function\@. For example, consider the continuous piecewise convex function $f(x)=\min(x,x^{4})$ as shown in figure \ref{fig:convergence}. When we converge to $x=0$ from the piece $[0,1]$, it is as if we were converging on the smooth function $g(x)=x^{4}$. This example also illustrates an important caveat regarding boundary points: although $x=0$ is an extremum of $f$ on $[0,1]$, it is not an extremum on $\mathbb{R}$. \begin{figure} \begin{centering} \includegraphics[scale=0.4]{convergence} \par\end{centering} \centering{}\caption{Example of a piecewise convex function. The point $x=0$ minimizes the function on the piece $[0,1]$.} \label{fig:convergence} \end{figure} \section{Iterated convex optimization} Although the previous section contained some powerful results, theorem \ref{theorem:multi_convex_gradient_descent} suffers from two main weaknesses, that it is a necessary condition and that it requires extra care at non-differentiable points. It is difficult to overcome these limitations with gradient descent. Instead, we shall define a different optimization technique, from which necessary and sufficient convergence results follow, regardless of differentiability. Iterated convex optimization splits a non-convex optimization problem into a number of convex sub-problems, solving the sub-problems in each iteration. For a neural network, we have shown that the problem of optimizing the parameters of a single layer, all others held constant, is piecewise convex. Thus, restricting ourselves to a given piece yields a convex optimization problem. In this section, we show that these convex sub-problems can be solved repeatedly, converging to a piecewise partial optimum. \begin{definition} Let $\mathcal{I}=\{I_{1},I_{2},...,I_{m}\}$ be a collection of sets covering $\{1,2,...,n\}$, and let $S\subseteq\mathbb{R}^{n}$ and $f:S\rightarrow\mathbb{R}$ be multi-convex with respect to $\mathcal{I}$. Then \textbf{iterated convex optimization }is any sequence where $\boldsymbol{x}_{k}$ is a solution to the optimization problem \begin{align} \mbox{minimize } & f(\boldsymbol{y})\label{eq:iterated_convex}\\ \mbox{subject to } & \boldsymbol{y}\in\cup_{I\in\mathcal{I}}S_{I}(\boldsymbol{x}_{k-1})\nonumber \end{align} with \textbf{$\boldsymbol{x}_{0}\in S$.} \end{definition} We call this iterated convex optimization because problem \ref{eq:iterated_convex} can be divided into convex sub-problems \begin{align} \mbox{minimize } & f(\boldsymbol{y})\label{eq:convex_subproblem}\\ \mbox{subject to } & \boldsymbol{y}\in S_{I}(\boldsymbol{x}_{k-1}).\nonumber \end{align} for each $I\in\mathcal{I}$. In this work, we assume the convex sub-problems are solvable, without delving into specific solution techniques. Methods for alternating between solvable sub-problems have been studied by many authors, for many different types of sub-problems \cite{Wendell:1976:Bilinear}. In the context of machine learning, the same results have been developed for the special case of linear autoencoders \cite{Baldi:2012:ComplexValuedAutoencoders}. Still, extra care must be taken in extending these results to arbitrary index sets. The key is that $\boldsymbol{x}_{k}$ is not updated until all sub-problems have been solved, so that each iteration consists of solving $m$ convex sub-problems. This is equivalent to the usual alternating convex optimization for biconvex functions, where $\mathcal{I}$ consists of two sets, but not for general multi-convex functions. Some basic convergence results follow immediately from the solvability of problem \ref{eq:iterated_convex}. First, note that $\boldsymbol{x}_{k-1}$ is a feasible point, so we have $f(\boldsymbol{x}_{k})\le f(\boldsymbol{x}_{k-1})$. This implies that $\lim_{k\rightarrow\infty}f(\boldsymbol{x}_{k})$ exists, so long as $f$ is bounded below. However, this does not imply the existence of $\lim_{k\rightarrow\infty}\boldsymbol{x}_{k}$. See Gorski et al.~for an example of a biconvex function on which $\boldsymbol{x}_{k}$ diverges \cite{Gorski:2007:BiConvex}. To prove stronger convergence results, we introduce regularization to the objective. \begin{theorem}\label{theorem:regularization} Let $\mathcal{I}$ be a collection of sets covering $\{1,2,...,n\}$, and let $S\subseteq\mathbb{R}^{n}$ and $f:S\rightarrow\mathbb{R}$ be multi-convex with respect to $\mathcal{I}$. Next, let $\inf f>-\infty$, and let $g(\boldsymbol{x})=f(\boldsymbol{x})+\lambda\|\boldsymbol{x}\|$, where $\lambda>0$ and $\|\boldsymbol{x}\|$ is a convex norm. Finally, let $\{\boldsymbol{x}_{k}\}_{k=0}^{\infty}$ result from iterated convex optimization of $g$. Then $\boldsymbol{x}_{k}$ has at least one convergent subsequence, in the topology induced by the metric $d(\boldsymbol{x},\boldsymbol{y})=\|\boldsymbol{x}-\boldsymbol{y}\|$. \end{theorem} \begin{proof} From lemma \ref{lemma:sum_piecewise_convex}, $g$ is multi-convex, so we are allowed iterated convex optimization. Now, if $\inf f+\lambda\|\boldsymbol{x}\|>g(\boldsymbol{x}_{0})$ we have that $g(\boldsymbol{x})>g(\boldsymbol{x}_{0})$. Thus $g(\boldsymbol{x})>g(\boldsymbol{x}_{0})$ whenever $\|\boldsymbol{x}\|>\left(g(\boldsymbol{x}_{0})-\inf f\right)/\lambda$. Since $g(\boldsymbol{x}_{k})$ is a non-increasing sequence, we have that $\|\boldsymbol{x}_{k}\|\le\left(g(\boldsymbol{x}_{0})-\inf f\right)/\lambda$. Equivalently, $\boldsymbol{x}_{k}$ lies in the set $A=\{\boldsymbol{x}:\|\boldsymbol{x}\|\le\left(g(\boldsymbol{x}_{0})-\inf f\right)/\lambda\}$. Since $\|\boldsymbol{x}\|$ is continuous, $A$ is closed and bounded, and thus it is compact. Then, by the Bolzano-Weierstrauss theorem, $\boldsymbol{x}_{k}$ has at least one convergent subsequence \cite{Johnsonbaugh:1970:RealAnalysis}. \end{proof} In theorem \ref{theorem:regularization}, the function $g$ is called the \textbf{regularized} version of $f$. In practice, regularization often makes a non-convex optimization problem easier to solve, and can reduce over-fitting. The theorem shows that iterated convex optimization on a regularized function always has at least one convergent subsequence. Next, we shall establish some rather strong properties of the limits of these subsequences. \begin{theorem}\label{theorem:sequential_convex_optimization_convergence} Let $\mathcal{I}$ be a collection of sets covering $\{1,2,...,n\}$, and let $S\subseteq\mathbb{R}^{n}$ and $f:S\rightarrow\mathbb{R}$ be multi-convex with respect to $\mathcal{I}$. Next, let $\{\boldsymbol{x}_{k}\}_{k=0}^{\infty}$ result from iterated convex optimization of $f$. Then the limit of every convergent subsequence is a partial minimum on $\interior S$ with respect to $\mathcal{I}$, in the topology induced by the metric $d(\boldsymbol{x},\boldsymbol{y})=\|\boldsymbol{x}-\boldsymbol{y}\|$ for some norm $\|\boldsymbol{x}\|$. Furthermore, if $\{\boldsymbol{x}_{m_{k}}\}_{k=1}^{\infty}$ and $\{\boldsymbol{x}_{n_{k}}\}_{k=1}^{\infty}$ are convergent subsequences, then $\lim_{k\rightarrow\infty}f(\boldsymbol{x}_{m_{k}})=\lim_{k\rightarrow\infty}f(\boldsymbol{x}_{n_{k}})$. \end{theorem} \begin{proof} Let $\boldsymbol{x}_{n_{k}}$ denote a subsequence of $\boldsymbol{x}_{k}$ with $\boldsymbol{x}^{*}=\lim_{n\rightarrow\infty}\boldsymbol{x}_{n_{k}}$. Now, assume for the sake of contradiction that $\boldsymbol{x}^{*}$ is not a partial minimum on $\mbox{int}S$ with respect to $\mathcal{I}$. Then there is some $I\in\mathcal{I}$ and some $\boldsymbol{x}^{\prime}\in S_{I}(\boldsymbol{x}^{*})$ with $\boldsymbol{x}^{\prime}\in\interior S$ such that $f(\boldsymbol{x}^{\prime})<f(\boldsymbol{x}^{*})$. Now, $f$ is continuous at $\boldsymbol{x}^{\prime}$, so there must be some $\delta>0$ such that for all $\boldsymbol{x}\in S$, $\|\boldsymbol{x}-\boldsymbol{x}^{\prime}\|<\delta$ implies $|f(\boldsymbol{x})-f(\boldsymbol{x}^{\prime})|<f(\boldsymbol{x}^{*})-f(\boldsymbol{x}^{\prime})$. Furthermore, since $\boldsymbol{x}^{\prime}$ is an interior point, there must be some open ball $B\subset S$ of radius $r$ centered at $\boldsymbol{x}^{\prime}$, as shown in figure \ref{fig:proof_iterated_convex_convergence}. Now, there must be some $K$ such that $\|\boldsymbol{x}_{n_{K}}-\boldsymbol{x}^{*}\|<\min(\delta,r)$. Then, let $\tilde{\boldsymbol{x}}=\boldsymbol{x}_{n_{K}}+\boldsymbol{x}^{\prime}-\boldsymbol{x}^{*}$, and since $\|\tilde{\boldsymbol{x}}-\boldsymbol{x}^{\prime}\|<r$, we know that $\tilde{\boldsymbol{x}}\in B$, and thus $\tilde{\boldsymbol{x}}\in S_{I}(\boldsymbol{x}_{n_{K}})$. Finally, $\|\tilde{\boldsymbol{x}}-\boldsymbol{x}^{\prime}\|<\delta$, so we have $f(\tilde{\boldsymbol{x}})<f(\boldsymbol{x}^{*})\le f(\boldsymbol{x}_{n_{K}+1})$, which contradicts the fact that $\boldsymbol{x}_{n_{K}+1}$ minimizes $g$ over a set containing $\tilde{\boldsymbol{x}}$. Thus $\boldsymbol{x}^{*}$ is a partial minimum on $\interior S$ with respect to $\mathcal{I}$. Finally, let $\{\boldsymbol{x}_{m_{k}}\}_{k=1}^{\infty}$ and $\{\boldsymbol{x}_{n_{k}}\}_{k=1}^{\infty}$ be two convergent subsequences of $\boldsymbol{x}_{k}$, with $\lim_{k\rightarrow\infty}\{\boldsymbol{x}_{m_{k}}\}=\boldsymbol{x}_{m}^{*}$ and $\lim_{k\rightarrow\infty}\{\boldsymbol{x}_{n_{k}}\}=\boldsymbol{x}_{n}^{*}$, and assume for the sake of contradiction that $f(\boldsymbol{x}_{m}^{*})>f(\boldsymbol{x}_{n}^{*})$. Then by continuity, there is some $K$ such that $f(\boldsymbol{x}_{n_{K}})<f(\boldsymbol{x}_{m}^{*})$. But this contradicts the fact that $f(\boldsymbol{x}_{k})$ is non-increasing. Thus $f(\boldsymbol{x}_{m}^{*})=f(\boldsymbol{x}_{n}^{*})$. \end{proof} \begin{figure} \begin{centering} \includegraphics[scale=0.5]{biconvex} \par\end{centering} \caption{Illustration of the proof of theorem \ref{theorem:sequential_convex_optimization_convergence}. Note the cross-sections of the biconvex set $S$.} \label{fig:proof_iterated_convex_convergence} \end{figure} The previous theorem is an extension of results reviewed in Gorski et al.~to arbitrary index sets \cite{Gorski:2007:BiConvex}. While Gorski et al.~explicitly constrain the domain to a compact biconvex set, we show that regularization guarantees $\boldsymbol{x}_{k}$ cannot escape a certain compact set, establishing the necessary condition for convergence. Furthermore, our results hold for general multi-convex sets, while the earlier result is restricted to Cartesian products of compact sets. These results for iterated convex optimization are considerably stronger than what we have shown for gradient descent. While any bounded sequence in $\mathbb{R}^{n}$ has a convergent subsequence, and we can guarantee boundedness for some variants of gradient descent, we cannot normally say much about the limits of subsequences. For iterated convex optimization, we have shown that the limit of any subsequence is a partial minimum, and all limits of subsequences are equal in objective value. For all practical purposes, this is just as good as saying that the original sequence converges to partial minimum. \section{Global optimization\label{sec:Local-minima}} Although we have provided necessary and sufficient conditions for convergence of various optimization algorithms on neural networks, the points of convergence need only minimize cross-sections of pieces of the domain. Of course we would prefer results relating the points of convergence to global minima of the training objective. In this section we illustrate the difficulty of establishing such results, even for the simplest of neural networks. In recent years much work has been devoted to providing theoretical explanations for the empirical success of deep neural networks, a full accounting of which is beyond the scope of this article. In order to simplify the problem, many authors have studied \textit{linear} neural networks, in which the layers have the form $g(\boldsymbol{x})=A\boldsymbol{x}$, where $A$ is the parameter matrix. With multiple layers this is clearly a linear function of the output, but not of the parameters. As a special case of piecewise affine functions, our previous results suffice to show that these networks are multi-convex as functions of their parameters. This was proven for the special case of linear autoencoders by Baldi and Lu \cite{Baldi:2012:ComplexValuedAutoencoders}. Many authors have claimed that linear neural networks contain no ``bad'' local minima, i.e.~every local minimum is a global minimum \cite{Kawaguchi:2016:WithoutPoorLocalMinima,Soudry:2016:NoBadLocalMinima}. This is especially evident in the study of linear autoencoders, which were shown to admit many points of inflection, but only a single strict minimum \cite{Baldi:2012:ComplexValuedAutoencoders}. While powerful, this claim does not apply to the networks seen in practice. To see this, consider the dataset $D=\{(0,1/2),(-1,\alpha),(1,2\alpha)\}$ consisting of three $(x,y)$ pairs, parameterized by $\alpha>1$. Note that the dataset has zero mean and unit variance in the $x$ variable, which is common practice in machine learning. However, we do not take zero mean in the $y$ variable, as the model we shall adopt is non-negative. Next, consider the simple neural network \begin{align} f(a,b) & =\sum_{(x,y)\in D}\left(y-\left[ax+b\right]_{+}\right)^{2}\label{eq:single_layer_objective}\\ & =\left(\frac{1}{2}-\left[b\right]_{+}\right)^{2}+\left(\alpha-\left[b-a\right]_{+}\right)^{2}+\left(2\alpha-\left[b+a\right]_{+}\right)^{2}.\nonumber \end{align} This is the squared error of a single ReLU neuron, parameterized by $(a,b)\in\mathbb{R}^{2}$. We have chosen this simplest of all networks because we can solve for the local minima in closed form, and show they are indeed very bad. First, note that $f$ is a continuous piecewise convex function of six pieces, realized by dividing the plane along the line $ax+b=0$ for each $x\in D$, as shown in figure \ref{fig:bad_local_minimum}. Now, for all but one of the pieces, the ReLU is ``dead'' for at least one of the three data points, i.e.~$ax+b<0$. On these pieces, at least one of the three terms of equation \ref{eq:single_layer_objective} is constant. The remaining terms are minimized when $y=ax+b$, represented by the three dashed lines in figure \ref{fig:bad_local_minimum}. There are exactly three points where two of these lines intersect, and we can easily show that two of them are strict local minima. Specifically, the point $(a_{1},b_{1})=(1/2-\alpha,1/2)$ minimizes the first two terms of equation \ref{eq:single_layer_objective}, while $(a_{2},b_{2})=(2\alpha-1/2,1/2)$ minimizes the first and last term. In each case, the remaining term is constant over the piece containing the point of intersection. Thus these points are strict global minima on their respective pieces, and strict local minima on $\mathbb{R}^{2}$. Furthermore, we can compute $f(a_{1},b_{1})=4\alpha^{2}$ and $f(a_{2},b_{2})=\alpha^{2}$. This gives \begin{align*} \lim_{\alpha\rightarrow\infty}a_{1} & =-\infty,\\ \lim_{\alpha\rightarrow\infty}a_{2} & =+\infty, \end{align*} and \[ \lim_{\alpha\rightarrow\infty}\left(f(a_{1},b_{1})-f(a_{2},b_{2})\right)=\infty. \] Now, it might be objected that we are not permitted to take $\alpha\rightarrow\infty$ if we require that the $y$ variable has unit variance. However, these same limits can be achieved with variance tending to unity by adding $\left\lfloor \alpha\right\rfloor $ instances of the point $(1,2\alpha)$ to our dataset. Thus even under fairly stringent requirements we can construct a dataset yielding arbitrarily bad local minima, both in the parameter space and the objective value. This provides some weak justification for the empirical observation that success in deep learning depends greatly on the data at hand. We have shown that the results concerning local minima in linear networks do not extend to the nonlinear case. Ultimately this should not be a surprise, as with linear networks the problem can be relaxed to linear regression on a convex objective. That is, the composition of all linear layers $g(\boldsymbol{x})=A_{1}A_{2}...A_{n}\boldsymbol{x}$ is equivalent to the function $f(\boldsymbol{x})=A\boldsymbol{x}$ for some matrix $A$, and under our previous assumptions the problem of finding the optimal $A$ is convex. Furthermore, it is easily shown that the number of parameters in the relaxed problem is polynomial in the number of original parameters. Since the relaxed problem fits the data at least as well as the original, it is not surprising that the original problem is computationally tractable. \begin{figure} \begin{centering} \includegraphics[scale=0.5]{single_neuron} \par\end{centering} \caption{Parameter space of the neural network from equation \ref{eq:single_layer_objective}, with pieces divided by the bold black lines. The points $(a_{1},b_{1})$ and $(a_{2},b_{2})$ are local minima, which can be made arbitrarily far apart by varying the dataset.} \label{fig:bad_local_minimum} \end{figure} This simple example was merely meant to illustrate the difficulty of establishing results for \textit{every} local minimum of \textit{every} neural network. Since training a certain kind of network is known to be NP-Complete, it is difficult to give any guarantees about worst-case global behavior \cite{Blum:1992:OCT:148433.148441}. We have made no claims, however, about probabilistic behavior on the average practical dataset, nor have we ruled out the effects of more specialized networks, such as very deep ones. \section{Conclusion} We showed that a common class of neural networks is piecewise convex in each layer, with all other parameters fixed. We extended this to a theory of a piecewise multi-convex functions, showing that the training objective function can be represented by a finite number of multi-convex functions, each active on a multi-convex parameter set. From here we derived various results concerning the extrema and stationary points of piecewise multi-convex functions. We established convergence conditions for both gradient descent and iterated convex optimization on this class of functions, showing they converge to piecewise partial minima. Similar results are likely to hold for a variety of other optimization algorithms, especially those guaranteed to converge at stationary points or local minima. We have witnessed the utility of multi-convexity in proving convergence results for various optimization algorithms. However, this property may be of practical use as well. Better understanding of the training objective could lead to the development of faster or more reliable optimization methods, heuristic or otherwise. These results may provide some insight into the practical success of sub-optimal algorithms on neural networks. However, we have also seen that local optimality results do not extend to global optimality as they do for linear autoencoders. Clearly there is much left to discover about how, or even if we can optimize deep, nonlinear neural networks. \section*{Acknowledgments} The author would like to thank Mihir Mongia for his helpful comments in preparing this manuscript. \section*{Funding} This research did not receive any specific grant from funding agencies in the public, commercial, or not-for-profit sectors. \bibliographystyle{elsarticle-num}
{'timestamp': '2016-12-30T02:01:59', 'yymm': '1607', 'arxiv_id': '1607.04917', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04917'}
arxiv
\section{Introduction} \label{intro} Suitable models for the theory of computation and approximation are certain (quasi-)ordered sets, whose elements represent states of computation, knowledge or information, while the order abstractly describes refinement, improvement or temporal sequence. Let us briefly record the relevant order-theoretical terminology. A {\em quasi-ordered set} or {\em qoset} is a pair $Q = (X,\leq)$ with a reflexive and transitive relation $\leq$ on $X$. The dual order is denoted by $\geq$, and the dual qoset $(X,\geq)$ by $\widetilde{Q}$.\\ If $\,\leq\,$ is antisymmetric, we speak of a {\em (partial) order} and an {\em ordered set} or a {\em poset}.\\ A {\em lower set}, {\em downset} or {\em decreasing set} is a subset $Y$ that coincides with its\,\,{\em down-closure}\,\,${\downarrow\! Y}$, consisting of all $x \!\in\! X$ with $x \!\leq\! y$ for at least one $y \!\in\! Y$. The {\em up-closure} ${\uparrow\! Y}$ and {\em upper sets (upsets, increasing sets)} are defined dually. The upper\,sets form the\,{\em upper Alexandroff topology}\,\,$\alpha Q$, and the lower sets the {\em lower Alexandroff topology}\,\,$\alpha \widetilde{Q}$. A set $D\subseteq Q$ is {\em (up-)directed}, resp.\ {\em filtered} or {\em down-directed}, if every finite subset of $D$ has an upper, resp.\ lower bound in\,$D$; in particular, $D$ cannot be empty. An {\em ideal} of $D$ is a directed lower set, and a {\em filter} is a filtered upper set; for $x \!\in\! X$, the set ${\downarrow\!x} \!=\! {\downarrow\!\{ x\}}$ is the {\em principal ideal}, and ${\uparrow\!x} \!=\! {\uparrow\!\{ x\}}$ is the {\em principal filter} generated by $x$. A poset $P$ is called {\em up-complete}, {\em directed complete}, a {\em dcpo}, or a {\em cpo} if each directed subset $D$ or, equivalently, each ideal has a join, that is, a least upper bound ({\em supremum}), denoted by $\bigvee\! D$. The {\em (ideal) up-completion} of a qoset $Q$ is ${\cal I} Q$, the set of all ideals, ordered by inclusion. The {\em Scott topology} $\sigma P$ of a poset $P$ consists of all upper sets $U$ that meet any directed set having a join in\,\,$U$. Both in the mathematical and in the computer-theoretically oriented literature (see e.g.\ \cite{AJ}, \cite{Edom}, \cite{CLD}, \cite{SLG}, \cite{V}), the word {\em `domain'} represents quite diverse structures, and in order-theoretical contexts, its meaning ranges from rather general notions like dcpos to quite specific kinds of posets like $\omega$-algebraic dcpos, sometimes with additional properties. Here, we adopt the convention to call arbitrary up-complete posets {\em domains} and to speak of a {\em continuous poset} if for each element $x$ there is a least ideal having a join above\,\,$x$. Notice that our {\em continuous domains} are the {\em continuous posets} in \cite{Com} and \cite{Hoff2}, but they are the {\em domains} in \cite{CLD}, whereas our continuous posets and those in \cite{CLD} need not be up-complete. Although continuous domains usually are defined in order-theoretical terms, there exist also topological descriptions of them, for example, as sober locally super\-compact spaces (Ern\'e \cite{EABC, Emin}, Hoffmann \cite{Hoff2}, Lawson \cite{CLD, Lss}). It is one of our main purposes in the subsequent investigations to drop the completeness or sobriety hypotheses without loosing relevant results applicable to domain theory. The term {\em space} always means {\em topological space}, but extensions to arbitrary closure spaces are possible (see \cite{EABC} and \cite{Eclo}). Several classes of spaces may be characterized by certain infinite distribution laws for their lattices of open sets \cite{Eweb}. Recall that a {\em frame} or {\em locale} \cite{Jo} is a complete lattice $L$ satisfying the identity \vspace{-.5ex} $$ \textstyle{ {\rm (d)} \ x\wedge \bigvee Y = \bigvee \{ x\wedge y : y\in Y \} \vspace{-.5ex}} $$ for all $x\in L$ and $Y \subseteq L$; the dual of (d) characterizes {\em coframes}. The identity \vspace{-.5ex} $$ \textstyle{{\rm (D)} \ \bigwedge \,\{ \bigvee Y : Y \!\in {\cal Y}\} = \bigvee\bigcap {\cal Y}} \vspace{-.5ex} $$ for all collections ${\cal Y}$ of lower sets, defining {\em complete distributivity}, is much stronger. However, frames may also be defined by the identity (D) for all {\em finite} collections ${\cal Y}$ of lower sets. An up-complete meet-semilattice satisfying (d) for all directed sets (or ideals) $Y$ is called {\em meet-continuous}. Similarly, the {\em continuous lattices} in the sense of Scott \cite{Com}, \cite{Sco} are the complete lattices enjoying the identity (D) for ideals instead of lower sets. Therefore, completely distributive lattices are also called {\em super\-continuous}; alternative descriptions of complete distributivity by equations involving choice functions are equivalent to the Axiom of Choice\,\,(see\,\,\cite{Herr}). A complete lattice satisfying (D) for all collections of finitely generated lower sets is called {\em ${\cal F}$-distributive} or a {\em wide coframe}, and its dual a {\em quasitopology} or a {\em wide frame} (cf.\ \cite{Eweb}). A lattice is {\em spatial} iff it is isomorphic to a topology. All spatial lattices are wide frames. For any space $(X,{\cal S})$, the frame of open sets is ${\cal S}$, and the coframe of closed sets is denoted by ${\cal S}^c$. The closure of a subset $Y$ is denoted by $cl_{{\cal S}}Y$ or $Y^-\!$, and the interior by $int_{{\cal S}}Y\!$ or $Y^{\circ}$. The {\em specialization order} is given by \vspace{-1ex} $$ x\leq y \ \Leftrightarrow \ x\leq_{{\cal S}} y \ \Leftrightarrow \ x\in \{ y\}^- \ \Leftrightarrow \ \forall\,U\! \in {\cal S}\ (x\in U \,\Rightarrow \, y\in U). $$ It is antisymmetric iff $(X,{\cal S})$ is T$_0$, but we speak of a specialization order also in the non--T$_0$ setting. The {\em saturation} of a subset $Y$ is the intersection of all its neighborhoods, and this is the up-closure of $Y$ relative to the specialization order. In the {\em specialization qoset} $\Sigma^{-\!} (X,{\cal S}) = (X,\leq_{{\cal S}})$, the principal ideals are the point closures, and the principal filters are the cores, where the {\em core} of a point $x$ is the saturation of the singleton $\{ x\}$; the lower sets are the unions of cores, or of arbitrary closed sets, and the upper sets are the saturated sets. A topology ${\cal S}$ on $X$ is {\em compatible} with a quasi-order $\leq$ if $Q = (X,\leq)$ is the specialization qoset of $(X,{\cal S})$ or, equivalently, $\upsilon Q \subseteq {\cal S} \subseteq \alpha Q$, where $\upsilon Q$ is the {\em weak upper topology}, generated by the complements of principal ideals; the {\em weak lower topology} of $Q$ is the weak upper topology $\upsilon \widetilde{Q}$ of the order-dual $\widetilde{Q}$. Of course, in other contexts, compatibility of a topology with an order relation may have a different meaning (cf.\ \cite[VI]{CLD}). In \cite{Eweb}, we have introduced three classes of spaces that might be useful for the mathematical foundation of communication and information theory (order-theoretical notions refer to the specialization order): \begin{itemize} \item[--] {\em web spaces} have neighborhood bases of webs at each point $x$, i.e.\ unions of filtered sets each of which contains $x$, \item[--] {\em wide web spaces} have neighborhood bases of filtered sets at each point, \item[--] {\em worldwide web spaces} or {\em core spaces} have neighborhood bases of principal filters (cores) at each point. \end{itemize} As shown in \cite{Eweb}, each of these three classes of spaces may be described by an infinite distribution law for their topologies: a space is a \vspace{-1ex} \begin{itemize} \item[--] web space iff its topology is a coframe, \item[--] wide web space iff its topology is a wide coframe, \item[--] worldwide web space iff its topology is completely distributive. \end{itemize} In Section \ref{convex}, we briefly review the construction of patch spaces and some applications to web spaces, as developed in \cite{Epatch}. The patch spaces of a given space are obtained by joining its topology with a {\em cotopology} (in \cite{Lss}: \mbox{{\em complementary topology}),} that is, a topology having the dual specialization order. Useful for patch constructions are so-called {\em coselections} $\zeta$, which choose for any topology ${\cal S}$ a subbase $\zeta {\cal S}$ of a cotopology $\tau_{\zeta}{\cal S}$. The topology ${\cal S}^{\zeta}$ generated by ${\cal S} \cup \zeta {\cal S}$ is then a patch topology, and the corresponding (quasi-ordered!) {\em $\zeta$-patch space} is ${\rm P}_{\zeta}(X,{\cal S}) = (X, \leq_{{\cal S}} ,{\cal S}^{\zeta})$. As demonstrated in \cite{Epatch}, web spaces may be characterized by the property that their open sets are exactly the up-closures of the open sets in any patch space. For us, compactness does {\em not} include the Hausdorff separation axiom T$_2$. Locally compact spaces undoubtedly form one of the most important classes of topological spaces. In the non-Hausdorff setting, one has to require whole bases of compact neighborhoods at each point, because one compact neighborhood for each point would not be enough for an efficient theory. In certain concrete cases, one observes that each point of the space under consideration has even a neighborhood base consisting of {\em supercompact} sets, i.e.\ sets each open cover of which has already one member that contains them. Such spaces occur, sometimes unexpectedly, in diverse fields of mathematics\,--\,not only topological but also algebraic ones\,--\,and in theoretical computer science. Section \ref{CDS} is devoted to a closer look at such {\em locally supercompact spaces}; they are nothing but the core spaces, because the supercompact saturated sets are just the cores. These spaces have been introduced in \cite{EABC}, where the name {\em core spaces} referred to the larger class of closure spaces, and discussed further in \cite{Emin} and \cite{Eweb}; core spaces are also called {\em C-spaces} (in \cite{KL}: {\em c-spaces}), but that term has a different meaning in other contexts (e.g.\ in \cite{Kue} and \cite{Pri}). The core spaces are exactly the locally compact wide web spaces, but also the locally hypercompact web spaces, where a set is {\em hyper\-compact} if its saturation is finitely generated; while the interior operator of a web space preserves {\em finite} unions of saturated sets, the interior operator of a core space preserves {\em arbitrary} unions of saturated sets \cite{Eweb}. Moreover, the category of core spaces has a strong order-theoretical feature, being concretely isomorphic to a category of generalized quasi-ordered sets (see \cite{EABC} and Section \ref{CDS} for precise definitions and results). Core spaces share useful properties with the more restricted {\em basic spaces} or {\em B-spaces} (having a least base, which then necessarily consists of all open cores) and with the still more limited {\em Alexandroff-discrete spaces} or {\em A-spaces} (in which all cores are open) \cite{Alex}, \cite{EABC}, \cite{Emin}; but, in contrast to A- and B-spaces, core spaces are general enough to cover important examples of classical analysis. For instance, the Euclidean topology on ${\mathbb R}^n$ (which, ordered componentwise, is a continuous poset but not a domain!) is the weak(est) patch topology of the Scott topology, which makes ${\mathbb R}^n$ a core space. In Section \ref{sectorspaces}, we characterize the patch spaces of core spaces as {\em sector spaces}. These are {\em ${\uparrow}$-stable semi-qospaces} (meaning that up-closures of open sets are open, and principal ideals and principal filters are closed) with neighborhood bases of so-called {\em sectors}, a special kind of webs having least elements. The restriction of the patch functor ${\rm P}_{\zeta}$ to the category of core spaces yields a concrete isomorphism to the category of {\em $\zeta$-sector spaces}, which fulfil strong convexity and separation axioms. In particular, the {\em weak patch functor} ${\rm P}_{\upsilon}$ induces a concrete \mbox{categorical} isomorphism between core spaces and {\em fan spaces}, i.e.\ ${\uparrow}$-stable semi-qospaces in which each point has a neighborhood base of {\em fans} ${\uparrow\!u}\setminus{\uparrow\!F}$ with finite sets\,\,$F$. In Section \ref{fanspaces}, such fan spaces are investigated and characterized by diverse order-topological properties. Our considerations have useful consequences for topological aspects of domain theory, as the continuous domains, equipped with the Scott topology, are nothing but the sober core spaces, and these correspond to fan spaces that carry the {\em Lawson topology}, the weak patch topology of the Scott topology. We find alternative descriptions of such ordered spaces, including convexity properties, separation axioms and conditions on the interior operator. This enables us to generalize the characterization of continuous lattices as meet-continuous lattices whose Lawson topology is Hausdorff \cite[III--2.11]{CLD} and the Fundamental Theorem of Compact Semilattices \cite[VI--3]{CLD} to non-complete situations. Crucial is the fact that a semilattice with a compatible topology is semitopological iff it is a web space, and (locally compact) topological with small semilattices iff it is a (world) wide webspace. The category of T$_0$ core spaces and that of ordered fan spaces are not only equivalent to the category C-ordered sets, but also to the category of {\em based domains}, i.e.\ pairs consisting of a continuous domain and a basis of it (in the sense of \cite{CLD}). In the last section, we study weight and density of the spaces under consideration, using the order-theoretical description of core spaces \cite{EABC}. For example, the weight of a core space is equal to the density of any of its patch spaces, but also to the weight of the lattice of {\em closed} sets. This leads to the conclusion that the weight of a completely distributive lattice is always equal to the weight of the dual lattice. If not otherwise stated, all results are derived in a choice-free set-theoretical environment; i.e., we work in {\sf ZF} or {\sf NBG} (Zermelo--Fraenkel or Neumann--Bernays--G\"odel set theory) but not in {\sf ZFC} (i.e.\ {\sf ZF} plus Axiom of Choice). For basic categorical concepts, in particular, concrete categories, functors and isomorphisms, see Ad\'amek, Herrlich and Strecker \cite{AHS}. For relevant order-theoretical and topological definitions and facts, refer to the monograph {\it Continuous Lattices and Domains} by G.\ Gierz, K.\,H.\ Hofmann, K.\ Keimel, J.\,D.\ Lawson, M.\ Mislove, and D.\,S.\ Scott\,\,\cite{CLD}. \newpage \section{Patch spaces and web spaces} \label{convex} A {\em (quasi-)\-ordered space} is a (quasi-)\-ordered set equipped with a topology. In this elementary definition, no separation properties and no relationship between order and topology are required. However, some classical separation axioms extend to the ordered case as follows. A quasi-ordered space is a {\em lower semi-qospace} if all principal ideals are closed, an {\em upper qospace} if all principal filters are closed, and a {\em semi-qospace} if both conditions hold (these conditions mean that the quasi\-order is {\em lower semiclosed}, {\em upper semiclosed} or {\em semiclosed}, respectively, in the sense of \cite[VI-1]{CLD}). An ordered semi-qospace is a {\em semi-pospace} or {\em T$_1$-ordered\,}. A space equipped with a closed quasi-order $\leq$ (regarded as a subset of the square of the space) is called a {\em qospace}, and a {\em pospace} in case $\leq$ is a (partial) order \cite{CLD}. Alternatively, qospaces may be characterized by the condition that for $x\not\leq y$, there are open $U$ and $V$ with $x \!\in\! U$, $y \!\in\! V$, and ${\uparrow\!U} \mathop{\cap} {\downarrow\! V} = \emptyset$. Similarly, we define {\em T$_2$-ordered spaces} to be ordered spaces in which for $x \not\leq y$ there are an open upper set containing $x$ and a disjoint open lower set containing $y$; some authors call such spaces {\em strongly $T_2$-ordered} and mean by a {\em T$_2$-ordered space} a pospace (cf.\ K\"unzi\,\,\cite{Kue}, McCartan\,\,\cite{McC}). A quasi-ordered space is said to be {\em upper regular} if for each open upper set $O$ containing a point $x$, there is an open upper set $U$ and an closed upper set $B$ such that $x\in U \subseteq B \subseteq O$, or equivalently, for each closed lower set $A$ and each $x$ not in $A$, there is an open upper set $U$ and a disjoint open lower set $V$ with $x\in U$ and $A\subseteq V$. An upper regular T$_1$-ordered space is said to be {\em upper T$_3$-ordered}. {\em Lower regular} spaces are defined dually. Note the following irreversible implications: {\em compact qospace $\Rightarrow$ upper regular semi-qospace $\Rightarrow$ qospace $\Rightarrow$ semi-qospace,}\\ \indent {\em compact pospace $\,\Rightarrow$ upper\,T$_3$-ordered $\Rightarrow$\,T$_2$-ordered $\Rightarrow$ pospace $\Rightarrow$\,T$_1$-ordered$\,+T_2$.} \vspace{.5ex} \noindent For any quasi-ordered space $T = (Q,{\cal T}) = (X,\leq,{\cal T})$, \vspace{.5ex} ${\cal T}^{\,\leq} = {\cal T} \cap \alpha Q\ $ is the topology of all open upper sets (also denoted by ${\cal T}^{\,\sharp}$),\\ \indent ${\cal T}^{\,\geq} = {\cal T} \cap \alpha \widetilde{Q}\ $ is the topology of all open lower sets \hspace{.6ex}(also denoted by ${\cal T}^{\,\flat}$). We call ${\rm U} T = (X,{\cal T}^{\leq})$ the {\em upper space} and ${\rm L} T = (X, {\cal T}^{\geq})$ the {\em lower space} of\,\,$T$. A basic observation is that for lower semi-qospaces, the specialization order of ${\cal T}^{\leq}$ is $\leq$, while for upper semi-qospaces, the specialization order of ${\cal T}^{\geq}$ is $\geq$. Recall that a subset $Y$ of a qoset $Q$ is {\em (order) convex} iff it is the intersection of an upper and a lower set. A quasi-ordered space is {\em locally convex} if the convex open subsets form a base, {\em strongly convex} if its topology ${\cal T}$ is generated by ${\cal T}^{\leq} \cup {\cal T}^{\geq}$, and {\em $\zeta$-convex} if ${\cal T}$ is generated by ${\cal T}^{\leq} \mathop{\cup} \zeta ({\cal T}^{\leq})$, where $\zeta$ is a coselection (see the introduction). Specifically, $\upsilon$-convex quasi-ordered spaces are called {\em hyperconvex}. Thus, hyperconvexity means that the sets $U\setminus {\uparrow\!F}$ with $U\in {\cal T}^{\leq}$ and $F$ finite form a base. Observe that $\zeta$-convexity implies strong convexity, which in turn implies local convexity, but not conversely (counterexamples are given in\,\,\cite{Epatch}). Let $\zeta$ be any coselection. A space $(X,{\cal S})$ is said to be {\em $\zeta$-determined} if $\,{\cal S}^{\,\zeta\leq} = {\cal S}$. A map between spaces is called {\em $\zeta$-proper} if it is continuous and preimages of closed sets relative to the $\zeta$-cotopology are $\zeta$-patch closed (whence such a map is $\zeta$-patch continuous); and a map between quasi-ordered spaces is {\em lower semicontinuous} if preimages of closed lower sets are closed. In \cite{Epatch}, many examples and counterexamples concerning these notions are discussed, and the following facts are established: \vspace{-.5ex} \begin{lemma} \label{pat} The strongly convex semi-qospaces are exactly the patch spaces (of their upper spaces). The patch functor ${\rm P}_{\zeta}$ associated with a coselection $\zeta$ induces a concrete functorial isomorphism between the category of $\zeta$-determined spaces with continuous (resp.\ $\zeta$-proper) maps and that of $\zeta$-convex semi-qospaces with isotone lower semicontinuous (resp.\ continuous) maps; the inverse isomorphism is induced by the concrete upper space functor ${\rm U}$, sending a semi-qospace $(X,\leq, {\cal T})$ to $(X,{\cal T}^{\leq})$. \end{lemma} \vspace{-.5ex} Any {\em upset selection} $\zeta$, assigning to each qoset $Q$ a collection $\zeta Q$ of upper sets such that ${\uparrow\!x} = \bigcap\,\{ V\in \zeta Q : x\in V\}$ for all $x$ in $Q$, gives rise to a coselection by putting $\zeta {\cal S} = \zeta \widetilde {Q}$ for any space $(X,{\cal S} )$ with specialization qoset $Q$. If each $\zeta Q$ is a topology, we call $\zeta$ a {\em topological (upset) selection}; the largest one is $\alpha$, while the smallest one is\,\,$\upsilon$. By Lemma \ref{pat}, the {\em weak patch functor} ${\rm P}_{\upsilon}$ induces an isomorphism between the category of $\upsilon$-determined spaces and that of hyperconvex semi-qospaces. An important intermediate topological selection is $\sigma$, where $\sigma Q$ is the {\em Scott topology}, consisting of all upper sets $U$ that meet every directed subset having a least upper bound that belongs to\,\,$U$ (in arbitrary qosets, $y$ is a least upper bound of $D$ iff $D\subseteq {\downarrow\! z} \Leftrightarrow y\leq z$). The weak patch topology of $\sigma Q$ is the {\em Lawson topology} $\lambda Q = \sigma Q ^{\,\upsilon}$. We denote by $\Sigma Q$ the {\em Scott space} $(X,\sigma Q )$ and by $\Lambda Q$ the (quasi-ordered) {\em Lawson space} $(Q,\lambda Q )$, whose upper space in turn is $\Sigma Q$. Thus, all Scott spaces are $\upsilon$-determined, and all Lawson spaces are hyperconvex semi-qospaces. A quasi-ordered space $(Q,{\cal T})$ is said to be {\em upwards stable} or {\em ${\uparrow}$-stable} if it satisfies the following equivalent conditions: \vspace{-.5ex} \begin{itemize} \item[{\rm (u1)}] $O\in {\cal T}$ implies ${\uparrow\!O}\in {\cal T}$. \item[{\rm (u2)}] ${\cal T}^{\leq} = \{ {\uparrow\! O} : O\in {\cal T}\}$. \item[{\rm (u3)}] The interior of each upper set is an upper set: $int_{{\cal T}} Y\! = int_{{\cal T}^{\leq}}Y$ if $Y \!= {\uparrow\!Y}$. \item[{\rm (u4)}] The closure of each lower set is a lower set: $cl_{{\cal T}} Y\! = cl_{{\cal T}^{\leq}}Y$ if $Y \!= {\downarrow\!Y}$. \end{itemize} A {\em web} around a point $x$ in a qoset is a subset containing $x$ and with each point $y$ a common lower bound of $x$ and $y$; if $\leq$ is a specialization order, that condition means that the closures of $x$ and $y$ have a common point in the web. By a {\em web-(quasi-)ordered space} we mean an ${\uparrow}$-stable (quasi-)ordered space in which every point has a neighborhood base of webs around it. In the case of a space equipped with its specialization order, this is simply the definition of a {\em web space}. Many characteristic properties of web spaces and of web-quasi-ordered spaces are given in \cite{Eweb} and \cite{Epatch}. Note that the {\em meet-continuous dcpos} in the sense of \cite{CLD} are just those domains whose Scott space is a web space \cite{Eweb}. The following result from \cite{Epatch} underscores the relevance of web spaces for patch constructions: \begin{proposition} \label{webpatch} A space $S$ is a web space iff all its patch spaces are web-quasi-or\-dered and have the upper\,space\,\,$S$. Conversely, the strongly convex web-quasi-ordered semi-qospaces are the patch spaces of their upper spaces, and these are web spaces. For any coselection $\zeta$, the patch functor ${\rm P}_{\zeta}$ induces a concrete isomorphism between the category of web spaces and that of $\zeta$-convex, web-quasi-ordered semi-qospaces. \end{proposition} We now are going to derive an analogous result for wide web spaces; the case of worldwide web spaces (core spaces) is deferred to the next section. The notion of wide web spaces is a bit subtle: while in a web space every point has a neighborhood base consisting of {\em open} webs around it \cite{Eweb}, in a wide web space it need not be the case that any point has a neighborhood base consisting of {\em open} filtered sets; the spaces with the latter property are those which have a `dual' (Hoffmann \cite{Hoff1}), that is, whose topology is dually isomorphic to another topology; see \cite{Eweb} for an investigation of such spaces and a separating counterexample. Note the implications \vspace{.5ex} {\em completely distributive $\,\Rightarrow\,\ $ dually spatial $\,\ \ \Rightarrow\ $ wide coframe $\hspace{1.8ex}\Rightarrow\, $ coframe} \vspace{.5ex} \noindent and the corresponding (irreversible) implications for spaces: \vspace{.5ex} {\em worldwide web space $\ \ \ \Rightarrow\ $ space with dual $\,\Rightarrow\, $ wide web space $\,\Rightarrow\, $ web space.} \vspace{.5ex} \noindent It is now obvious to introduce an ordered version of wide web spaces by calling a quasi-ordered space {\em locally filtered} if each point has a base of filtered neighborhoods. \begin{theorem} \label{wideweb} A space $S$ is a wide web space iff all its patch\,spaces\,are\,locally fil\-tered and\,up\-stable with\,upper\,space\,$S$.\,The strongly\,convex, locally filtered\,\,${\uparrow}$-stable semi\-qospaces are the patch spaces of their upper spaces, and these are are wide\,web\,spaces. Each patch functor ${\rm P}_{\zeta}$ induces a concrete isomorphism between the category of wide web spaces and that of $\zeta$-convex, locally filtered, ${\uparrow}$-stable semi-qospaces. \end{theorem} \noindent {\it Proof.} Let $S \!=\! (X,{\cal S} )$ be a wide web space and $T \!=\! (X,\leq, {\cal T} )$ a patch space of\,\,$S$. By Proposition \ref{webpatch}, $T$ is ${\uparrow}$-stable, and $S$ is the upper space of $T$, i.e., ${\cal S} = {\cal T}^{\leq}$. Given $x \!\in\! O \!\in\! {\cal T}$, find $U \!\in\! {\cal S}$ and $V \!\in\! {\cal T}^{\geq}$ with $x \in U \cap V \subseteq O$, and a filtered set $D$ with $x \in W = int_{{\cal S}} D \subseteq D \subseteq U$. Then, $D\cap V$ is filtered (since $V = {\downarrow\!V}$) with $x\in W\cap V \subseteq D\cap V \subseteq U \cap V \subseteq O$, and $W\cap V \in {\cal T}$. Thus, $T$ is locally filtered. Conversely, let $T = (X, \leq, {\cal T} )$ be a strongly convex, locally filtered and ${\uparrow}$-stable semi-qospace. Then $T$ is web-quasi-ordered and, by Proposition \ref{webpatch}, a patch space of the web space $(X,{\cal T}^{\leq})$. For $x \in O \in {\cal T}^{\leq}$, there is a filtered $D\subseteq O$ with $x \in int_{{\cal T}}D$. Then ${\uparrow\!D}$ is filtered, $x \in W = {\uparrow\! int_{{\cal T}} D} \subseteq {\uparrow\!D} \!\subseteq\! O$, and by ${\uparrow}$-stability, $W \in {\cal T}^{\leq}$; thus, $(X,{\cal T}^{\leq})$ is a wide web space. The rest follows from Proposition \ref{pat}. \EP \begin{corollary} \label{webco} The strongly convex, locally filtered and ${\uparrow}$-stable T$_1$-ordered spaces are exactly the patch spaces of T$_0$ wide web spaces. \end{corollary} \section{Core spaces and C-quasi-ordered sets} \label{CDS} Strengthening the notion of compactness, we call a subset $C$ of a space {\em super\-compact} if every open cover of $C$ has a member that contains $C$; and {\em local supercompactness} means the existence of supercompact neighborhood bases at each point. As mentioned in the introduction, an equivalent condition is that each point has a neighborhood base of cores (possibly of different points!)\,--\,in other words, that we have a {\em core space}. Under the assumption of the Ultrafilter Theorem (a consequence of the Axiom of Choice), many properties of locally super\-compact spaces are shared by the more general {\em locally hypercompact spaces}, where a subset is called {\em hypercompact} if its saturation is generated by a finite subset. In view of the next proposition, proven choice-freely in \cite{EABC} and \cite{Eweb}, core spaces may be viewed as an infinitary analogue of web spaces (whence the name {\em `worldwide web spaces'}\,). \begin{proposition} \label{supertop} For a space $S = (X,{\cal S})$, the following conditions are equivalent: \vspace{-.5ex} \begin{itemize} \item[{\rm (1)}] $S$ is a core space. \item[{\rm (2)}] $S$ is locally supercompact. \item[{\rm (3)}] The lattice of open sets is supercontinuous (completely distributive). \item[{\rm (4)}] The lattice of closed sets is supercontinuous. \item[{\rm (5)}] The lattice of closed sets is continuous. \item[{\rm (6)}] The interior operator preserves arbitrary unions of upper sets. \item[{\rm (7)}] The closure operator preserves arbitrary intersections of lower sets. \item[{\rm (8)}] $S$ is a locally hypercompact web space. \item[{\rm (9)}] $S$ is a locally compact wide web space. \end{itemize} \end{proposition} Core\,spaces have pleasant properties. For example, on account of (6) resp.\,(7), the interior resp.\ closure operator of a core space induces a complete homomorphism from the completely distributive lattice of upper resp.\,lower sets onto the lattice of open resp.\,closed sets. In \cite{BrE}, it is shown that a nonempty product of spaces is a core space iff all factors are core spaces and all but a finite number of them are supercompact. Similarly, a nonempty product of spaces is a (wide) web space iff all factors are (wide) web spaces and all but a finite number are filtered. Assuming the Principle of Dependent Choices (another consequence of the Axiom of Choice), one can show that all core spaces have a dual (a base of filtered open sets; see \cite{Eweb}). Computationally convenient is the fact that core spaces are in bijective correspondence to so-called {\em idempotent ideal relations} or {\em C-quasi-orders}. These are not really quasi-orders but idempotent relations $R$ (satisfying $x\,R\,z \Leftrightarrow \exists\, y \,(x\,R\,y\,R\,z)$) on a set $X$ so that the sets \vspace{-1ex} $$R y = \{ x \in X : x \,R\, y\} \ \ (y\in X) $$ are ideals with respect to the {\em lower quasi-order} $\leq_{R}$ defined by \vspace{-.5ex} $$ x\leq_{R} y \ \Leftrightarrow R x \subseteq R y. $$ And $R$ is called a {\em C-order} if, moreover, $\leq_{R}$ is an order, i.e., $R y \!=\! R z$ implies $y \!=\! z$. The pair $(X,R )$ is referred to as a {\em C-(quasi-)ordered set} \cite{EABC}. Any C-order $R$ is an {\em approximating auxiliary relation} for the poset $(X,\leq_{R})$ in the sense of \cite{CLD}. For an arbitrary relation $R$ on a set $X$ and any subset $Y$ of $X$, put $$R\, Y = \{ x\in X : \exists\,y\in Y\, (x\,R\,y)\} , \ YR = \{ x\in X : \exists\,y\in Y\, (y\,R\,x)\},\vspace{-.5ex} $$ $$\ _{R}{\cal O} = \{ \,R\,Y : Y\subseteq X\} , \ {\cal O}_{R} = \{ YR : Y\subseteq X\}. \ $$ $_{R}{\cal O} $ and ${\cal O}_{R}$ are closed under arbitrary unions, and in case $R$ is an ideal relation, ${\cal O}_{R}$ is even a topology. On the other hand, if $R$ is idempotent then $_{R}{\cal O}$ consists of all rounded subsets, where a subset $Y$ is said to be {\em round(ed)} if $Y = R Y$ \cite{GK}, \cite{Lri}. Typical examples of C-orders are the {\em way-below relations} $\ll$ of {\em continuous posets} $P$, in which for any element $y$ the set \vspace{-.5ex} $$\textstyle{\ll\! y = \{ x\in P : x \ll y\} = \bigcap \,\{ D\in {\cal I} P : \bigvee\! D \mbox{ exists and } y\leq \bigvee\! D\}} $$ is an ideal (called the {\em way-below ideal of} $y$) with join $y$ (recall that ${\cal I} P$ is the set of all ideals). The next result, borrowed from \cite{EHab}, leans on the {\em interpolation property} of continuous posets, saying that their way-below relation is idempotent. \begin{lemma} \label{conti} For every continuous poset, the way-below relation is a C-order $R$ such that for directed subsets $D$ (relative to $\leq_{R}$), $y = \bigvee\! D$ is equivalent to $R y = R D$; and any C-order with that property is the way-below relation of a continuous poset. \end{lemma} \begin{example} \label{Exnotcon} {\rm The following sublattice $L$ of the plane $\mathbb{R}^2$ has a unique compatible topology $\alpha L = \upsilon L$, and the interval topology $\iota L$ is discrete \cite{Epatch}. \begin{picture}(250,150) \put(-10,120){$L = \{ a_n,\,b_n,\,c_n: n\in \omega\}$} \put(-10,100){with} \put(-10,80){$a_n = (0,-2^{-n}),$} \put(-10,60){$b_n =(2^{-n},0),$} \put(-10,40){$c_n = (2^{-n},2^{-n}).$} \put(110,0) { \begin{picture}(200,150) \put(70,42){$L$} \put(15,10){$a_0$} \put(78,80){$b_0$} \put(78,130){$c_0$} \put(74,77){\line(0,1){59}} \put(10,10){\circle{4}} \put(10,12){\line(0,1){29}} \put(10,43){\circle{4}} \put(10,45){\line(0,1){13}} \put(10,60){\circle{4}} \put(10,66){\circle{1}} \put(10,69){\circle{1}} \put(10,72){\circle{1}} \put(10,75){\circle{1}} \put(13,75){\circle{1}} \put(16,75){\circle{1}} \put(19,75){\circle{1}} \put(13,78){\circle{1}} \put(16,81){\circle{1}} \put(19,84){\circle{1}} \put(24,75){\circle{4}} \put(26,75){\line(1,0){13}} \put(24,77){\line(0,1){9}} \put(41,75){\circle{4}} \put(41,77){\line(0,1){26}} \put(43,75){\line(1,0){29}} \put(24,88){\circle{4}} \put(26,90){\line(1,1){13}} \put(41,105){\circle{4}} \put(43,107){\line(1,1){29}} \put(74,75){\circle{4}} \put(74,138){\circle{4}} \end{picture} } \put(240,0) { \begin{picture}(100,147) \put(70,42){$\widetilde{L}$} \put(55,135){$a_0$} \put(-8,71){$b_0$} \put(-8,12){$c_0$} \put(6,73){\line(0,-1){59}} \put(70,140){\circle{4}} \put(70,138){\line(0,-1){29}} \put(70,107){\circle{4}} \put(70,105){\line(0,-1){13}} \put(70,90){\circle{4}} \put(70,84){\circle{1}} \put(70,81){\circle{1}} \put(70,78){\circle{1}} \put(70,75){\circle{1}} \put(67,75){\circle{1}} \put(64,75){\circle{1}} \put(61,75){\circle{1}} \put(67,72){\circle{1}} \put(64,69){\circle{1}} \put(61,66){\circle{1}} \put(56,75){\circle{4}} \put(54,75){\line(-1,0){13}} \put(56,73){\line(0,-1){9}} \put(39,75){\circle{4}} \put(39,73){\line(0,-1){26}} \put(37,75){\line(-1,0){29}} \put(56,62){\circle{4}} \put(54,60){\line(-1,-1){13}} \put(39,45){\circle{4}} \put(37,43){\line(-1,-1){29}} \put(6,75){\circle{4}} \put(6,12){\circle{4}} \end{picture} } \end{picture} \vspace{-1.5ex} \noindent $L$ and its dual $\widetilde{L}$ are trivially continuous, having no non-principal ideals possessing a join, so that the way-below relation is the order relation in these lattices. But, being incomplete, they are not continuous lattices in the sense of Scott \cite{Com}, \cite{Sco}. The completion of $L$ by one `middle' point $(0,0)$ is a continuous but not super\-continuous frame, while the completion of $\widetilde{L}$ is not even meet-continuous. } \end{example} The aforementioned one-to-one correspondence between core spaces and C-quasi\-orders is based on the following remark and definition: every space $(X,{\cal S})$ carries a transitive (but only for A-spaces reflexive) {\em interior relation} $R_{{\cal S}}$, given by \vspace{-.5ex} $$ x \,R_{{\cal S}}\,y \, \Leftrightarrow \, y \in ({\uparrow\!x})^{\circ} = int_{{\cal S}} ({\uparrow\!x}), \vspace{-.5ex} $$ where ${\uparrow\!x} = \bigcap\, \{ U \in {\cal S} : x \in U\}$ is the core of $x$. Note that for any subset $A$ of $X$,\\ $R_{{\cal S}}A$ is a lower set in $(X, \leq_{{\cal S}})$, as $\,x \!\leq\! y\,R_{{\cal S}} \, z$ entails $z\in ({\uparrow\!y})^{\circ} \!\subseteq\! ({\uparrow\!x})^{\circ}$, hence $x \, R_{{\cal S}} \,z$.\\ A map $f$ between C-quasi-ordered sets $(X,R)$ and $(X',R')$ {\em interpolates} if for all $y \!\in\! X$ and $x' \!\in\! X'$ with $x' R\, f(y)$ there is an $x \in X$ with $x' R' f(x)$ and $x \,R\, y$, and $f$ is {\em isotone} (preserve the lower quasi-orders) iff $x\leq_{R} y$ implies $f(x) \leq_{R '}\! f(y)$. \begin{theorem} \label{Cspace} {\rm (1)} $(X,{\cal S})$ is a core space iff there is a C-quasi-order $R$ with ${\cal S} = {\cal O}_{R}$. In that case, $R$ is the interior relation $R_{{\cal S}}$, and $\leq_{R}\!$ is the specialization order $\leq_{{\cal S}}$. {\rm (2)} By passing from $(X,{\cal S})$ to $(X,R_{{\cal S}})$, and in the opposite direction from $(X,R)$ to $(X,{\cal O}_{R})$, the category of core spaces with continuous maps is concretely isomorphic to the category of C-quasi-ordered sets with interpolating isotone maps. {\rm (3)} For each closed set $A$ in a core space $(X,{\cal S})$, the set $R_{{\cal S}}A$ is the least lower set with closure $A$. The closure operator induces an isomorphism between the super\-continuous lattice $_{R}{\cal O}$ of all rounded sets and that of all closed sets, while ${\cal O}_{R}$ is the supercontinuous lattice of all open sets. {\rm (4)} The irreducible closed subsets of a core space are exactly the closures of directed sets (in the specialization qoset). For an irreducible closed set\,$A$, the set $R_{{\cal S}}A$ is the least ideal with closure $A$.\,The closure operator induces an iso\-morphism between the continuous domain of rounded ideals and that of irreducible closed sets. {\rm (5)} The topology of a core space $(X,{\cal S})$ is always finer than the Scott topology on its specialization qoset. {\rm (6)} The cocompact topology of a core space $(X,{\cal S})$ is the weak lower topology of the specialization qoset. The patch topology ${\cal S}^{\pi}$ agrees with the weak patch topology\,\,${\cal S}^{\upsilon}$. \end{theorem} \noindent {\it Proof.} (1) and (2) have been established in \cite{EABC}. There are several reasonable alternative choices for the morphisms. For example, the {\em quasiopen} maps (for which the saturations of images of open sets are open) between core spaces are the relation preserving isotone maps between the associated C-quasi-ordered sets (cf.\ \cite{EABC}, \cite{HM}). (3) Let $R$ be the interior relation and $\leq$ the specialization order $\leq_{R}$. We prove the identity $(R A)^- = A^-$, using idempotency of $R$ in the equivalence * below: $y\in (R A)^- \ \Leftrightarrow \ \forall\, U\in {\cal O}_{R}\ (y\in U \Rightarrow U\cap R A \neq \emptyset)$ $\Leftrightarrow \ \forall \, x\in X\ (x \,R \,y \,\Rightarrow\, xR \cap R A \neq \emptyset) \ \stackrel{*}{\Leftrightarrow} \ \forall \, x\in X\ (x \,R \,y \Rightarrow xR \cap A \neq \emptyset)$ $\Leftrightarrow \ \forall\, U\in {\cal O}_{R}\ (y\in U \Rightarrow U\cap A \neq \emptyset) \ \Leftrightarrow \ y\in A^-.$ \noindent In particular, $(R A)^- = A$ in case $A$ is closed. On the other hand, any rounded set $Y$ satisfies the identity $Y = R Y = R (Y^-)$: since each $xR$ is an open set, we have $x\in R Y \ \Leftrightarrow \ xR \cap Y \neq \emptyset \ \Leftrightarrow \ xR \cap Y^- \neq \emptyset \ \Leftrightarrow \ x\in R (Y^-).$ \noindent And if $Y$ is any lower set with $Y^-\! = A$ then $R A = R (Y^-) = R Y \subseteq {\downarrow\!Y} = Y.$ (4) Recall that a subset $A$ is irreducible iff it is nonempty and $A \subseteq B\cup C$ implies $A \subseteq B$ or $A \subseteq C$ for any closed sets $B,C$. Directed subsets and their closures are irreducible. The rounded ideals of a C-quasi-ordered set (or a core space) form a domain ${\cal I}_{R} = \{ I\in {\cal I} (X,\leq_{R}): I = R I\}$, being closed under directed unions. It is easy to see that $I \ll J$ holds in ${\cal I}_{R}$ iff there is an $ x\in J$ with $I\subseteq {\downarrow\!x}$, and that the join of the ideal $\ll \!J = {\downarrow_{{\cal I}_{R}}} \{ R x : x\in J\}$ is $J$. Thus, ${\cal I}_{R}$ is continuous (cf.\ \cite{GK},\,\cite{Lss}). For the isomorphism claim, observe that the coprime rounded sets are the rounded ideals, the coprime closed sets are the irreducible ones, and a lattice isomorphism preserves coprimes (an element $q$ is {\em coprime} iff the complement of ${\uparrow\!q}$ is an ideal). (5) By (4), $I = R_{{\cal S}} y$ is an ideal with ${\downarrow\! y} = I^-$, so $y$ is a least upper bound of $I$; now, $y \in U \in \sigma (X,\leq)$ implies $U\cap R_{{\cal S}} y \not = \emptyset$, i.e.\ $y\in UR_{{\cal S}}$. Thus, $U = UR_{{\cal S}}\in {\cal S}$. (6) Let $C$ be a compact saturated set (i.e.\ $C \!\in\! \pi {\cal S}$) and $y \!\in\! X\setminus C$. There is an open neighborhood $U$ of $C$ not containing $y$. By local supercompactness\,of\,\,$(X,{\cal S})$, we have $U = \bigcup\, \{ int_{{\cal S}}({\uparrow\! x}) : x\in U\}$, and by compactness of $C$, we find a finite $F \subseteq U$ with $C \!\subseteq \bigcup\, \{ int_{{\cal S}} ({\uparrow\! x}) : x \!\in\! F\} \!\subseteq\! {\uparrow\! F} \!\subseteq\! U$. For $Q = (X,\leq)$, ${\uparrow\! F}$ is $\upsilon\widetilde{Q}$-closed and does not contain $y$. Thus, $C$ is $\upsilon\widetilde{Q}$-closed, and $\pi {\cal S}$ is contained in $\upsilon \widetilde{Q}$; the reverse inclusion is obvious, since cores (principal filters) are compact and saturated. \EP Recall that a {\em sober} space is a T$_0$-space whose only irreducible closed sets are the point closures; and a {\em monotone convergence space} ({\em mc-space}) or {\em d-space} is a T$_0$ space in which the closure of any directed subset is the closure of a singleton (see \cite{Emin}, \cite{CLD}, \cite{Wy}). Now, from Theorem \ref{Cspace}, one deduces (cf.\ \cite{EABC}, \cite{Hoff2}, \cite{Law}, \cite{Lss}): \begin{corollary} \label{contdom} The following conditions on a space $S$ are equivalent: \vspace{-.5ex} \begin{itemize} \item[{\rm (1)}] $S$ is a sober core space. \item[{\rm (2)}] $S$ is a locally supercompact monotone convergence space (d-space). \item[{\rm (3)}] $S$ is the Scott space of a (unique) continuous domain. \end{itemize} \vspace{-.5ex} The category of sober core spaces and the concretely isomorphic category of continuous domains are dual to the category of supercontinuous spatial frames. \end{corollary} \vspace{-.5ex} For the case of continuous posets that are not necessarily domains, see \cite{EScon}, \cite{Emin}. Afficionados of domain theory might remark that continuous frames are automatically spatial (see \cite{CLD}, \cite{HL}). But that `automatism' requires choice principles, which we wanted to avoid in the present discussion. However, it seems to be open whether the spatiality of {\em supercontinuous} frames may be proved in a choice-free manner. Since a T$_0$-space and its sobrification have isomorphic open set frames, it follows from Corollary \ref{contdom} that a T$_0$-space is a core space iff its sobrification is the Scott space of a continuous domain. This completion process is reflected, via Theorem \ref{Cspace}, by the fact that the rounded ideal completion of a C-ordered set is a continuous domain, and the C-order is extended to its completion, meaning that $x\,R\,y$ is equivalent to $R x \ll R y$ in the completion (cf. \cite{Emin}, \cite{CLD}, \cite{GK}, \cite{Lss}). \section{Core stable spaces and sector spaces} \label{sectorspaces} As every core space is a web space, it is equal to the upper spaces of its patch spaces and therefore $\zeta$-determined for any coselection $\zeta$ (see Proposition \ref{webpatch}). We now are going to determine explicitly these patch spaces, which turn out to have very good separation properties, whereas the only T$_1$ core spaces (in fact, the only T$_1$ web spaces) are the discrete ones. For alternative characterizations of such patch spaces, we need further properties of the interior operators. Call a quasi-ordered space $(Q, {\cal T} )$ {\em core stable} or {\em c-stable} if $$ \textstyle{{\uparrow\!O} = \bigcup \,\{ \,int_{{\cal T}}({\uparrow\!u}) : u\in O\} \ \mbox{ for each }O \in {\cal T}, } $$ and {\em d-stable} if for any filtered (i.e.\ down-directed) subset $D$ of $Q$, $$ \textstyle{int_{{\cal T}}D \subseteq \bigcup\,\{ int_{{\cal T}} \, ({\uparrow\!u}): u\in cl_{{\cal T}^{\geq}} D\}.} $$ While core stability is a rather strong property, d-stability is a rather weak one (trivially fulfilled if all filters are principal). The terminology is justified by \begin{lemma} \label{cstable} Let $T = (X,\leq, {\cal T})$ be a semi-qospace. {\rm (1)} $T$ is d-stable whenever its lower space ${\rm L} T$ is a d-space. {\rm (2)} $T$ is core stable iff $\,{\rm U}T = (X,\{ {\uparrow\!O} : O \in {\mathcal T}\})$ is a core space. {\rm (3)} $T$ is core stable iff it is upper regular, locally filtered, ${\uparrow}$-stable and d-stable. \end{lemma} \noindent {\it Proof.} (1) If the lower space $\,{\rm L}T = (X,{\cal T}^{\geq})$ is a d-space then for any filtered set $D$ in $(X,\leq)$ there is a $u$ with ${\uparrow\!u} = cl_{{\cal T}^{\geq}} D$ and $\,int_{{\cal T}} D \subseteq int_{{\cal T}} ({\uparrow\!u})$. Without proof, we note that ${\rm L}T$ is a d-space whenever $T$ is hyperconvex and $(X,\geq)$ is a domain. (2) Clearly, a core stable semi-qospace $(X,\leq ,{\cal T})$ is ${\uparrow}$-stable, whence ${\mathcal T}^{\leq} = \{ {\uparrow\!O} : O \in {\mathcal T}\}$. For $U\in {\cal T}^{\leq}$ and $x\in U$ there exists a $u\in U$ with $x\in int_{{\cal T}} ({\uparrow\!u})$. Then $W = {\uparrow int_{{\cal T}}({\uparrow\!u})}\in {\cal T}^{\leq}$ (by ${\uparrow}$-stability) and $x\in W\subseteq {\uparrow\!u} \subseteq {\uparrow\!U} = U$. Since $\leq$ is the specialization order of ${\cal T}^{\leq}$, this ensures that $(X,{\cal T}^{\leq})$ is a core space. Conversely, suppose $(X,{\cal T}^{\leq}) = (X, \{ {\uparrow\!O} : O \in {\mathcal T}\})$ is a core space. For $O\in {\mathcal T}$ and $y \in {\uparrow\!O}$, there is an $x\in {\uparrow\!O}$ and a $U\in {\cal T}^{\leq} \subseteq {\cal T}$ with $y\in U\subseteq {\uparrow\!x}$. Now, pick a $u\in O$ with $x\in {\uparrow\!u}$; then $y\in U \subseteq {\uparrow\!x} \subseteq {\uparrow\!u}$, whence ${\uparrow\!O} \subseteq \bigcup \,\{ \,int_{{\cal T}}({\uparrow\!u}) : u\in O\}$. (3) Let $T = (X,\leq, {\cal T} )$ be a core stable semi-qospace. For $x\in O\in {\cal T}^{\leq}$, there is a $u\in O$ with $x\in U = int_{{\cal T}} ({\uparrow\!u}) \subseteq {\uparrow\!u} \subseteq O$. By ${\uparrow}$-stability, we have $U\in {\cal T}^{\leq}$, and since $T$ is a semi-qospace, ${\uparrow\!u}$ is a closed upper set. Hence, $T$ is upper regular. In order to check local filteredness, pick for $x\in O\in {\cal T}$ an element $u\in O$ with $x\in int_{{\cal T}} ({\uparrow\!u}) \mathop{\cap} O \subseteq {\uparrow\!u} \mathop{\cap} O\,$; this is a filtered set, possessing the least element\,\,$u$. Moreover, $T$ is not only ${\uparrow}$-stable (see (2)) but also d-stable, since for any subset $D$ and any $x\in O = int_{{\cal T}} D$, there is a $u \in O \subseteq D \subseteq cl_{{\cal T}^{\geq}} D$ with $x\in int_{{\cal T}}({\uparrow\!u})$. Conversely, suppose that $T$ is an upper regular, locally filtered, ${\uparrow}$-stable and d-stable semi-qospace. Then, for $O\in {\cal T}$ and $x\in {\uparrow\!O}$, we have: $x\in {\uparrow\!O} \in {\cal T}^{\leq}$ \hfill (by ${\uparrow}$-stability), there are $U\in {\cal T}^{\leq}$ and $B\in {\cal T}^{\geq c}$ with $x\in U \subseteq B \subseteq {\uparrow\!O}$ \hfill (by upper regularity), a filtered $D$ with $x\in int_{{\cal T}} D \subseteq D \subseteq U$ \hfill (by local filteredness), and an element $y\in cl_{{\cal T}^{\geq}} D$ with $x \in int_{{\cal T}} ({\uparrow\!y})$ \hfill (by d-stability). \noindent It follows that $y \in cl_{{\cal T}^{\geq}} D \subseteq cl_{{\cal T}^{\geq}} U \subseteq B \subseteq {\uparrow\!O}$. Now, choose a $u\in O$ with $u\leq y$, hence ${\uparrow\!y} \subseteq {\uparrow\!u}$, to obtain $x\in int_{{\cal T}} ({\uparrow\!u})$. Thus, ${\uparrow\!O} \subseteq \bigcup\,\{ int_{{\cal T}} ({\uparrow\!u}) : u\in O\}$, showing that $T$ is core stable. \EP By Lemma \ref{cstable}, every core stable semi-qospace is a qospace (being upper regular); in fact, core stability of a semi-qospace splits into the four properties (c1) {\em upper regular} \ \ (c2) {\em locally filtered} \ \ (c3) {\em ${\uparrow}$-stable} \ \ (c4) {\em d-stable}. \noindent These properties are independent: none of them follows from the other three. \begin{example} \label{Ex31} {\rm Let $L$ be a non-continuous wide frame (for example, a T$_2$ topology that is not locally compact, like the Euclidean topology on ${\mathbb Q}$). As shown in \cite{Eweak}, $(L, \upsilon L)$ is a wide web space whose meet operation is continuous in the weak upper topology $\upsilon L$ and in the weak lower topology $\upsilon \widetilde{L}$, hence also in the interval topology $\iota L = \upsilon L\,^{\upsilon}$; and ${\rm I}L = (L,\iota L )$ is a topological meet-semilattice with small subsemilattices (see Section \ref{semi}). Thus, it is locally filtered, ${\uparrow}$-stable and d-stable, since the lower space $(\widetilde{L},\upsilon \widetilde{L})$ is a d-space (for any complete lattice $L$). But the semi-pospace ${\rm I}L$ can be upper regular only if it is a pospace, hence T$_2$, which happens only if $L$ is a continuous lattice \cite{CLD}. Thus, ${\rm I}L$ satisfies (c2), (c3) and (c4), but not (c1). } \end{example} \begin{example} \label{Ex32} {\rm For $0 < s < 1$, consider the non-compact subspace $S = [\,0, s\,[ \, \mathop{\cup}\, \{ 1\}$ of the Euclidean space ${\mathbb R}$, ordered by $x\sqsubseteq y \Leftrightarrow x = y$ or $x = 0$ or $y=1$. As $\{ 1\}$ is clopen, it is easy to check that $S$ satisfies (c1), (c3) and (c4) (all filters are principal), but not (c2): no point except $1$ has a filtered neighborhood not containing 0. } \end{example} \begin{example} \label{Ex33} {\rm In Example 4.1 of \cite{Epatch} it is shown that the set \begin{picture}(300,55) \put(10,40){$X = \{ a,\top\} \cup \{ b_n : n\in \omega\}$, ordered by} \put(10,20){$x\leq y \ \Leftrightarrow x = y \mbox{ or } x = b_0 \mbox{ or } y = \!\top $} \put(81,0){or $x = b_i, y = b_j, i < j,$} \put(260,30){\circle{5}} \put(250,28){$a$} \put(262,32){\line(3,2){40}} \put(262,28){\line(3,-2){40}} \put(305,36){\circle{5}} \put(305,20){\circle{5}} \put(305,33){\line(0,-1){10}} \put(305,18){\line(0,-1){15}} \put(305,39){\line(0,1){5}} \put(305,47){\circle{1}} \put(305,51){\circle{1}} \put(305,55){\circle{1}} \put(305,60){\circle{5}} \put(310,58){$\top$} \put(305,0){\circle{5}} \put(310,31){$b_2$} \put(310,14){$b_1$} \put(310,-4){$b_0$} \end{picture} \vspace{1ex} \noindent is a complete but not meet-continuous lattice and a compact pospace when equipped with the Lawson topology. It satisfies (c1), (c2) and (c4) (because all filters are principal). However, (c3) is violated, since $\{ a \}$ is open, while ${\uparrow\!a} = \{ a, \top\}$ is not. } \end{example} \begin{example} \label{Ex34} {\rm For infinite $I$, the function space ${\mathbb R}^I$ with the coordinatewise order and the Lawson topology satisfies (c1), (c2) and (c3), but its upper space $\Sigma ({\mathbb R}^I)$ is not a core space: otherwise, in view of the fact that bounded directed subsets converge to their suprema, ${\mathbb R}^I$ would have to be a continuous poset (see \cite{Emin}), which holds only for finite $I$ (see \cite{EScon}). Hence, by Lemma \ref{cstable}, (c4) must be violated. } \end{example} Given a quasi-ordered space $(X,\leq,{\cal T})$, we call any nonempty set of the form ${\uparrow\!u}\mathop{\cap} V$ with $V \!\in \!{\cal T}^{\,\geq}\!$ a {\em sector}, and a {\em $\zeta$-sector} if $V\in \zeta ({\cal T}^{\leq})$ for a coselection $\zeta$. Hence, $u$ is the least element of the sector, and every sector is obviously a web around any point it contains. By a ($\zeta$-){\em sector space} we mean an ${\uparrow}$-stable semi-qospace in which each point $x$ has a base of ($\zeta$-)sector neighborhoods ${\uparrow\!u}\cap V$ (but the point $x$ need not be the minimum $u$ of such a sector). \begin{theorem} \label{sectors} The sector spaces are exactly the \vspace{-.5ex} \begin{itemize} \item[{\rm (1)}] patch spaces of core spaces, \item[{\rm (2)}] strongly convex, core stable (semi-)qospaces, \item[{\rm (3)}] strongly convex, upper regular, locally filtered, ${\uparrow}$-stable and d-stable qospaces. \end{itemize} In particular, all ordered sector spaces are T$_3$-ordered, a fortiori T$_2$-ordered. \noindent Specifically, for any coselection $\zeta$, the $\zeta$-sector spaces are exactly the \vspace{-.5ex} \begin{itemize} \item[{\rm (1$\zeta$)}] $\zeta$-patch spaces of core spaces, \item[{\rm (2$\zeta$)}] $\zeta$-convex, core stable (semi-)qospaces, \item[{\rm (3$\zeta$)}] $\zeta$-convex, upper regular, locally filtered, ${\uparrow}$-stable and d-stable qospaces. \end{itemize} \end{theorem} \noindent {\it Proof.} (1) and (2): Let $T = (X,\leq,{\cal T})$ be a sector space. For $x\in O\in {\cal T}$, there are $u \!\in\! X$ and $V \!\in\! {\cal T}^{\,\geq}$ such that $x\in int_{{\cal T}} ({\uparrow\!u} \mathop{\cap} V) = int_{{\cal T}} ({\uparrow\!u})\cap V \subseteq {\uparrow\!u} \mathop{\cap} V \subseteq O$. Then $u\in {\uparrow\!u}\cap V \subseteq O$ and $x \in int_{{\cal T}}({\uparrow\!u})$, whence $O \subseteq \bigcup \,\{ int_{{\cal T}}({\uparrow\!u}) : u \!\in\! O\}$. Using ${\uparrow}$-stability and applying the previous argument to ${\uparrow\!O}$ instead of $O$, one concludes that $T$ is core stable. Again by ${\uparrow}$-stability, $U = {\uparrow int_{{\cal T}}}({\uparrow\!u}\,\cap V)$ belongs to ${\cal T}^{\,\leq}$, and the above reasoning yields $x\in U\cap V \subseteq {\uparrow\!u}\cap V\subseteq O$, proving strong convexity. Now, let $(X,\leq,{\cal T})$ be any strongly convex core stable semi-qospace. Then, by Lemma \ref{cstable}, $(X,{\cal T}^{\leq})$ is a core space with specialization order $\leq$, while ${\cal T}^{\geq}$ has the dual specialization order. By strong convexity, ${\cal T}$ is the patch topology ${\cal T}^{\leq} \vee {\cal T}^{\geq}$. On the other hand, by Proposition \ref{pat}, any patch space $(X,\leq, {\cal T} )$ of a core (or web) space $(X,{\cal S} )$ is a web-quasi-ordered space, in particular ${\uparrow}$-stable. For $x\in U \cap V$ with $U\in {\cal S}$ and $V\in {\cal T}^{\geq}$, there are $u\in U$ and $W\in {\cal S}$ with $x\in W \subseteq {\uparrow\!u}$; it follows that $x\in W \mathop{\cap} V \subseteq {\uparrow\!u} \mathop{\cap} V \subseteq U \mathop{\cap} V$. Thus, $(X,\leq, {\cal T} )$ is a sector space. (3) follows from (2) and Lemma \ref{cstable}. Any upper regular semi-qospace is a qospace. \noindent The modified claims involving coselections $\zeta$ are now easily derived from Proposition\,\,\ref{pat} and Lemma \ref{webpatch}, using the fact that core spaces are web spaces. \EP We are ready to establish a categorical equivalence between core spaces and $\zeta$-sector spaces. As explained in \cite{Epatch}, the right choice of morphisms is a bit delicate. Continuous maps would be the obvious morphisms between core spaces. On the other hand, one would like to have as morphisms between quasi-ordered spaces the isotone continuous maps. But, as simple examples in \cite{Epatch} show, a continuous map between two core spaces need not be continuous as a map between the associated $\zeta$-sector spaces, and a continuous isotone map between $\zeta$-sector spaces need not be continuous for the weak lower topologies (consider the map $f$ on the lattice $L$ in Example \ref{Exnotcon} with $f(a_n)=f(b_n) =a_0$, $f(c_n)=c_0$). Therefore, we take the $\zeta$-proper maps (see Section \ref{convex}) as morphisms between core spaces in order to save the isomorphism theorem. Let us summarize the previous results. \begin{proposition} \label{sectorcat} For any coselection $\zeta$, the patch functor ${\rm P}_{\zeta}$ induces a concrete iso\-mor\-phism between the category {\bf CS\hspace{.1ex}} (resp.\ {\bf CS}\hspace{.1ex}{\boldmath $\zeta$}) of core spaces with continuous (resp.\ $\zeta$-proper) maps and the category {\boldmath $\zeta$}{\bf S\hspace{.2ex}l} (resp.\ {\boldmath $\zeta$}{\bf S\hspace{.1ex}c}) of $\zeta$-sector spaces with isotone lower semicontinuous (resp.\ continuous) maps. The inverse isomorphism is induced by the functor ${\rm U}$, sending a sector space $T$ to the core space ${\rm U}T$. \end{proposition} A related class of morphisms is formed by the {\em core continuous maps}, i.e.\ continuous maps for which preimages of cores are cores. In terms of the specialization orders, the latter condition means that these maps are residual (preimages of principal filters are principal filters), or equivalently, that they have lower adjoints (cf.\ \cite{Eclo} and \cite[0--1]{CLD}). Core continuous maps are $\alpha$-, $\sigma$- and $\upsilon$-proper, but not conversely. The following facts are established in \cite{EABC} (see also \cite{HM}): \begin{corollary} \label{qopen} Passing to lower adjoints yields a duality between the category {\bf CSc} of core spaces with core continuous maps and the category {\bf CSq} of core spaces with quasiopen maps (saturations of images of open sets are open) that are residuated (preimages of point closures are point closures). The full subcategory {\bf SCSc} of sober core spaces is equivalent to the category {\bf CDjm} of completely distributive spatial frames with maps preserving arbitrary joins and meets, which in turn is dual (via adjunction) to the category {\bf CDjw} of completely distributive spatial frames with maps preserving joins and the relation $\triangleleft$, where $x \triangleleft\, y \,\Leftrightarrow\, x\in \bigcap\,\{ \,{\downarrow\!A} : y\leq \bigvee\! A\}$. \end{corollary} \begin{picture}(300,70) \put(-2,60){\bf CDjm} \put(-2,2){\bf CDjw} \put(10,50){\vector(0,-1){30}} \put(16,20){\vector(0,1){30}} \put(67,66){\vector(-1,0){30}} \put(37,60){\vector(1,0){30}} \put(67,8){\vector(-1,0){30}} \put(37,2){\vector(1,0){30}} \put(80,60){\bf SCSc} \put(80,2){\bf SCSq} \put(90,50){\vector(0,-1){30}} \put(96,20){\vector(0,1){30}} \put(120,61){$\subset$} \put(123,61){\vector(1,0){30}} \put(120,3){$\subset$} \put(123,3){\vector(1,0){30}} \put(164,60){\bf CSc} \put(164,2){\bf CSq} \put(170,50){\vector(0,-1){30}} \put(176,20){\vector(0,1){30}} \put(197,61){$\subset$} \put(220,61){\vector(1,0){10}} \put(206,60.5){$\dots$} \put(193,47){\small $\zeta = \alpha,\sigma,\upsilon$} \put(241,60){{\bf CS}\hspace{.1ex}{\boldmath $\zeta$}} \put(244,2){{\boldmath $\zeta$}{\bf S\hspace{.1ex}c}} \put(250,50){\vector(0,-1){30}} \put(256,20){\vector(0,1){30}} \put(274,61){$\subset$} \put(277,61){\vector(1,0){30}} \put(274,3){$\subset$} \put(277,3){\vector(1,0){30}} \put(320,60){\bf CS} \put(318,2){{\boldmath $\zeta$}{\bf S\hspace{.2ex}l}} \put(327,50){\vector(0,-1){30}} \put(333,20){\vector(0,1){30}} \end{picture} \vspace{2ex} In contrast to locally supercompact spaces (core spaces), locally hypercompact spaces need not be $\zeta$-determined, and the categorical equivalence between core spaces (i.e.\ locally hypercompact web spaces) and $\zeta$-sector spaces does not extend to locally hypercompact spaces without additional restrictions. The lattice $\widetilde{L}$ in Example \ref{Exnotcon} is locally hypercompact but not locally supercompact in the weak upper topology; in fact, it fails to be a web space: the points $b_n$ have no small web neighborhoods. Since $\widetilde{L}$ is not $\zeta$-determined unless $\zeta \widetilde{L} \!=\! \alpha \widetilde{L}$, Lemma \ref{pat} does not apply to that case. For the complete lattice $M = (X,\leq)$ in Example \ref{Ex33}, the Scott space $\Sigma M$ is locally hypercompact and $\upsilon$-determined, but its weak patch space $\Lambda M = {\rm P}_{\upsilon}\Sigma M$ is not ${\uparrow}$-stable: while $\{ a\}$ is open, ${\uparrow\!a}$ is not. \newpage \section{Fan spaces} \label{fanspaces} We have seen that, by virtue of the weak patch functor ${\rm P}_{\upsilon}$, the core spaces bijectively correspond to the $\upsilon$-sector spaces. We shall now give some effective descriptions of these specific qospaces. By a {\em fan} we mean a nonempty set of the form ${\uparrow\!u}\setminus {\uparrow\!F}$ for some finite $F$. In case $(X,\leq,{\cal T})$ is an upper semi-qospace, each fan is a sector, in fact, a $\upsilon$-sector. An ${\uparrow}$-stable semi-qospace space with a base of fans will be called a {\em fan space}. A nonempty product of quasi-ordered spaces is a fan space iff all factors are fan spaces and all but a finite number have a least element. \begin{example} \label{Ex72} {\rm The Euclidean spaces $\Lambda (\mathbb{Q}^n) = (\Lambda \mathbb{Q})^n$ and $\Lambda (\mathbb{R}^n) = (\Lambda \mathbb{R})^n$ are metrizable fan spaces. In contrast to $\Lambda (\mathbb{R}^n)$, the rational space $\Lambda (\mathbb{Q}^n)$ is not locally compact, whereas the upper spaces $\Sigma (\mathbb{Q}^n)$ and $\Sigma (\mathbb{R}^n)$ are locally super\-compact. But neither $\Sigma (\mathbb{Q}^n)$ nor $\Sigma (\mathbb{R}^n)$ is sober, since $\mathbb{Q}^n$ and $\mathbb{R}^n$ fail to be up-complete. } \end{example} \begin{example} \label{Ex41} {\rm An open web, a sector, and a fan in the Euclidean plane $\Lambda \,{\mathbb R}^2$ \begin{picture}(300,85) \put(10,0){ \begin{picture}(100,85) \multiput(-6,79)(0,-2){22}{.} \multiput(-6,79)(2,0){10}{.} \multiput(-6,35)(2,0){18}{.} \multiput(30,35)(0,-2){18}{.} \multiput(30,-1)(2,0){22}{.} \multiput(74,-1)(0,2){10}{.} \multiput(48,19)(2,0){14}{.} \multiput(48,19)(0,2){17}{.} \multiput(48,53)(-2,0){17}{.} \multiput(14,53)(0,2){14}{.} \put(39.5,44){\circle*{3}} \put(5,44){\line(1,0){34}} \put(4.5,44){\circle{2}} \put(4.5,45){\line(0,1){28}} \put(4.5,74){\circle{2}} \put(39.5,43){\line(0,-1){34}} \put(39.5,8.5){\circle{2}} \put(40,8.5){\line(1,0){30}} \put(70.5,8.5){\circle{2}} \put(-10,-15){\em open web, not sector} \end{picture} } \put(130,0){ \begin{picture}(100,90) \put(5,-15){\em sector, not fan} \put(0,0){\line(0,1){80}} \put(0,0){\line(1,0){80}} \multiput(0,79)(2,0){7}{.} \multiput(14,78)(2,-1){13}{.} \multiput(40,64)(1.5,-1.5){8}{.} \multiput(52,51)(1,-2){13}{.} \multiput(65,25)(1,-1.5){9}{.} \multiput(74,11)(.7,-2){6}{.} \end{picture} } \put(255,0){ \begin{picture}(100,90) \put(30,-15){\em fan} \put(0,0){\line(0,1){78}} \put(0,0){\line(1,6){13}} \put(0,0){\line(1,5){13.5}} \put(0,0){\line(2,5){27}} \put(0,0){\line(1,2){27.5}} \put(0,0){\line(3,4){41}} \put(0,0){\line(1,1){41}} \put(0,0){\line(4,3){55}} \put(0,-.3){\line(2,1){55}} \put(0,-.3){\line(5,2){69}} \put(0,-.3){\line(5,1){69}} \put(0,0){\line(6,1){80}} \put(0,0){\line(1,0){80}} \multiput(0,78)(2,0){7}{.} \multiput(12,77)(0,-2){6}{.} \multiput(12,67)(2,0){7}{.} \multiput(26,67)(0,-2){7}{.} \multiput(26,55)(2,0){8}{.} \multiput(40,55)(0,-2){8}{.} \multiput(40,41)(2,0){8}{.} \multiput(54,41)(0,-2){8}{.} \multiput(54,27)(2,0){8}{.} \multiput(68,27)(0,-2){8}{.} \multiput(68,13)(2,0){6}{.} \multiput(78,13)(0,-2){7}{.} \end{picture} } \end{picture} } \end{example} \vspace{3.5ex} In order to see that hyperconvex upper regular semi-qospaces are regular, it suffices to guarantee the separation of points from subbasic closed sets. For closed lower sets, this is possible by upper regularity. For subbasic closed sets ${\uparrow\!x}$ and points $y\in X\setminus {\uparrow\!x}$, one finds an open upper set $U$ and a closed upper set $B$ with ${\uparrow\!x} \subseteq U \subseteq B \subseteq X\setminus{\downarrow\!y}$; then $X\setminus B$ is an open set disjoint from $U$ and containing\,\,$y$. Now, from Theorem \ref{sectors} and Proposition \ref{sectorcat}, we infer for the case $\zeta = \upsilon$: \begin{theorem} \label{fans} The fan spaces are exactly the \vspace{-1ex} \begin{itemize} \item[{\rm (1$\upsilon$)}] weak patch spaces of core spaces, \item[{\rm (2$\upsilon$)}] hyperconvex core stable (semi-)qospaces, \item[{\rm (3$\upsilon$)}] hyperconvex, upper regular, locally filtered, up- and d-stable qospaces. \end{itemize} The category of core spaces with continuous (resp.\ $\upsilon$-proper) maps is isomorphic to that of fan spaces and lower semicontinuous (resp.\ continuous) isotone maps. All fan spaces are not only upper regular but also regular. Moreover, they are uniformizable, and so completely regular in the presence of the Axiom of Choice. \end{theorem} Let us make the last statement in Theorem \ref{fans} more precise. For the definition of {\em quasi-uniformities} and a study of their relationships to (quasi-)ordered spaces, refer to Fletcher and Lindgren \cite{FL} or Nachbin \cite{Na}. For a quasi-uniformity ${\cal Q}$, the dual ${\cal Q}^{-1}$ is obtained by exchanging first and second coordinate, and ${\cal Q}^*$ is the uniformity generated by ${\cal Q} \cup {\cal Q}^{-1}$. The topology $\tau ({\cal Q})$ generated by ${\cal Q}$ consists of all subsets $O$ such that for $x \!\in\! O$ there is a $\,U\!\in\! {\cal Q}$ with $xU = \{ y : (x,y) \in U\} \!\subseteq\! O$. The following results are due to Br\"ummer and K\"unzi \cite{KB} and Lawson \cite{Lss}. \begin{lemma} \label{localunif} If $(X,{\cal S} )$ is a locally compact space then there is a coarsest quasi-uniformity ${\cal Q}$ with $\tau ({\cal Q}) = {\cal S}$, and ${\cal Q}$ is generated by the sets $\hspace{4ex} U'\!\rightarrow\! U =\{ (x,y) \in X\times X : x\in U' \Rightarrow y\in U\} = (X\setminus U')\!\times\! X \, \cup \, X\!\times\!U$ \noindent with $\,U,U'\in {\cal S}$ and $U\ll U'$ in the continuous frame ${\cal S}$. Specifically, {\rm (1)} If ${\cal B}$ is a subbase for ${\cal S}$ such that $B = \bigcup\,\{ B'\in {\cal B} : B'\ll B\}$ for all $B\in {\cal B}$, \hspace{4ex}then the sets $B'\!\rightarrow\! B$ with $B,B'\in {\cal B}$ and $B\ll B'$ generate ${\cal Q}$, {\rm (2)} $\tau ({\cal Q}^{-1})$ is the cocompact topology $\tau_{\pi} {\cal S}$, {\rm (3)} $\tau({\cal Q}^*)$ is the patch topology ${\cal S}^{\pi}$. \end{lemma} For core spaces, these conclusions may be strengthened as follows. \begin{proposition} \label{superunif} Let $(X,{\cal S} )$ be a core space with specialization qoset $Q = (X,\leq )$ and interior relation $R$.\,Then there is a coarsest quasi-uniformity ${\cal Q}$ with $\tau ({\cal Q}) \!= {\cal S}$,\,and {\rm (1)} ${\cal Q}$ is generated by the sets $x'\!R \!\rightarrow\! y'R = \{ (x,y) : x' R\, x \Rightarrow y'R\, y\}$ with $y' R \, x'$, {\rm (2)} $\tau (Q^{-1})$ is the weak lower topology $\upsilon \widetilde{Q}$, {\rm (3)} the fan space $(X,\leq, {\cal S}^{\upsilon})$ is determined by ${\cal Q}$, i.e.\ $\leq \,= \bigcap {\cal Q}$ and ${\cal S}^{\upsilon} = \tau ({\cal Q}^*)$. \end{proposition} \noindent {\it Proof.} \mbox{We apply Lemma \ref{localunif} to the base ${\cal B} = \{ xR : x\!\in\! X\}$ of ${\cal O}_{R} = {\cal S}$ (Theorem \ref{Cspace}).} By idempotency, $x\,R\, y$ implies $x\,R\, x'R\, y$ for some $x'$, hence $x'R \ll xR$. This yields the equation $xR = \bigcup \,\{ x'\!R \in {\cal B} : x'\!R \ll xR\}$, and then (1) follows from Lemma \ref{localunif}. Now, Theorem \ref{Cspace}\,(6) and Lemma \ref{localunif}\,(2) give $\tau ({\cal Q}^{-1}) = \tau_{\pi}{\cal S} = \upsilon \widetilde{Q}$. Finally, $\bigcap {\cal Q}$ is the specialization order of $\tau ({\cal Q})$, and ${\cal S}^{\upsilon} = {\cal S}^{\pi} = \tau ({\cal Q}^*)$, by Lemma \ref{localunif}\,(3). It is also easy to check the equations ${\cal S} = \tau ({\cal Q})$ and $\upsilon \widetilde{Q} = \tau ({\cal Q}^{-1})$ directly: For $U = x'\!R \!\rightarrow\! y'R$, the set $xU$ is equal to $y'R$ if $x'R\, x$, and to $X$ otherwise, while the set $Uy$ is equal to $X\setminus x'R$ if $y'\!\!\not\!R\, y$, and to $X$ otherwise. \noindent In case $y'R\,x'$ but not $y'R\, y$, the inclusion $y\in X\setminus y'R \subseteq X\setminus {\uparrow\!y'} \subseteq x'R = Uy$ shows that each $Uy$ is a neighborhood of $y$ in the weak lower topology. \EP \vspace{1ex} In \cite{FL} (see also \cite{Kue}, \cite{Lss}, \cite{Na}), it is shown that in {\sf ZFC} a pospace \mbox{$T = (X,\leq,{\cal T})$} is determined by a quasi-uniformity ${\cal Q}$, i.e.\ $\leq \ = \bigcap {\cal Q}$ and ${\cal T} = \tau ({\cal Q}^*)$, iff it has a (greatest) order compactification, which in turn is equivalent to saying that $T$ is {\em completely regular(ly) ordered}, i.e., a pospace such that for $x \!\in\! U \!\in\! {\cal T}$, there are continuous $f,g: X \rightarrow [0,1]$ with $f$ isotone and $g$ antitone, $f(x) = g(x) = 1$, and $f(y) = 0$ or $g(y) = 0$ for $y\in X\setminus U$. Dropping the antisymmetry, we arrive at \begin{corollary} \label{complreg} In {\sf ZFC}, every fan space is completely regularly quasi-ordered. \end{corollary} \newpage \section{Continuous domains as pospaces} \label{domain} We now are going to establish a representation of continuous domains by certain pospaces, generalizing the famous characterization of continuous lattices as meet-continuous lattices whose Lawson topology is Hausdorff (see \cite[III--2.11]{CLD}). In contrast to the situation of complete lattices, we require at most up-completeness. For our purposes, we need a further definition. Given an upset selection $\zeta$ (see Section \ref{convex}), a quasi-ordered space $(Q,{\cal T}) = (X,\leq,{\cal T} )$ or its topology is said to be {\em $\zeta$-stable} if the interior operator $^{\circ}$ of the upper topology ${\cal T}^{\leq}$ satisfies the equation \vspace{-.5ex} $$ \textstyle{ Y^{\circ} = \bigcup\,\{ ({\uparrow\!y})^{\circ} : y\in Y\}} \ \mbox{ for all } Y \!\in \! \zeta Q. $$ If $(Q,{\cal T})$ is ${\uparrow}$-stable, the operator $^\circ$ may be replaced by the interior operator of the original topology ${\cal T}$. For instance, {\em core stable} means {\em $\alpha$-stable plus ${\uparrow}$-stable}.\\ We denote by $\curlyvee Q$ and $\curlywedge Q$ the set of all finite unions (incl.\ $\emptyset \!= \bigcup \emptyset$) resp.\ intersections (incl.\,$X \!= \bigcap \emptyset$) of principal filters, i.e., the unital join- resp.\ meet-sub\-semi\-lattice they generate in the lattice $\alpha Q$ of all upper sets. Further, we denote by $\diamondsuit Q$ the sublattice of $\alpha Q$ generated by the principal filters and containing $\emptyset$ and $X$. \begin{lemma} \label{stable} Let $T = (Q,{\cal T} )$ be any quasi-ordered space. \vspace{-.5ex} \begin{itemize} \item[{\rm (1)}] $T$ is $\curlywedge$-stable iff the sets $R y = \{ x : y\in ({\uparrow\!x})^{\circ}\}$ are directed (ideals). \item[{\rm (2)}] $T$ is $\diamondsuit$-stable iff it is $\curlyvee$-stable and $\curlywedge$-stable. \item[{\rm (3)}] $T$ is $\curlyvee$-stable if its upper space ${\rm U}T$ is a web space. \item[{\rm (4)}] $T$ is $\curlywedge$-stable if $Q$ is a join-semilattice with least element. \item[{\rm (5)}] $T$ is $\diamondsuit$-stable if it is a lattice with $0$ and continuous unary $\wedge$-operations. \item[{\rm (6)}] $T$ is a $\curlyvee$-stable lower semi-qospace with locally hypercompact upper space ${\rm U}T$ iff the latter is a core space with specialization qoset $Q$. \end{itemize} \end{lemma} \noindent {\it Proof.} (1) Suppose $T$ is $\curlywedge$-stable. For finite $F\!\subseteq\! R y$, the set \mbox{$F^{\uparrow\!} = \bigcap \, \{{\uparrow\! x} : x\in F\}$} is a member of $\curlywedge Q$, whence $y\in \bigcap \, \{ ({\uparrow\! x})^{\circ} : x\in F\} = (F^{\uparrow})^{\circ} = \bigcup\,\{ ({\uparrow\! u})^{\circ} : u\!\in\! F^{\uparrow\!}\}$, i.e., $F^{\uparrow}\cap R y \neq \emptyset$. In other words, $R y$ is directed (and always a lower set). Conversely, if that is the case then, for each finite subset $F$ of $Q$, one deduces from $y\in (F^{\uparrow})^{\circ}$ that $F$ is contained in $R y$, whence there is an upper bound $u$ of $F$ in $R y$; thus, $y\in \bigcup\,\{ ({\uparrow\!u})^{\circ}\! : u \!\in\! F^{\uparrow}\}$. The reverse inclusion $\bigcup\,\{ ({\uparrow\!u})^{\circ}\! : u \!\in\! F^{\uparrow}\} \!\subseteq\! (F^{\uparrow})^{\circ}$ is clear. (2) Obviously, $\diamondsuit$-stable quasi-ordered spaces are $\curlyvee$- and $\curlywedge$-stable. Conversely, suppose $T$ is $\curlyvee$-and $\curlywedge$-stable. Any $Y\in \diamondsuit Q$ is of the form $Y = \bigcap \,\{ {\uparrow\!F_i} : i \! < \! n\}$ where each of the finitely many sets $F_i$ is finite. Hence, $Y^{\circ} = \bigcap \,\{ ({\uparrow\!F_i})^{\circ} : i < n \} =$ \hfill { ($\curlyvee$-stability)} $\bigcap \,\{ \,\bigcup \,\{ ({\uparrow\!x})^{\circ} : x\in F_i \} : i < n \} =$ \hfill (set distributivity) $\bigcup \,\{ \,\bigcap\,\{ ({\uparrow\!\chi_i})^{\circ}\! : i \!<\! n \} : \chi \in \prod_{i<n}\! F_i \} =$ \hfill { ($\curlywedge$-stability)} $\bigcup\,\{ ({\uparrow\!y})^{\circ}\! : y\in \bigcap\,\{{\uparrow\!\chi_i} : i<n\}, \,\chi \in \prod_{i<n}\! F_i \} =$ \hfill (set distributivity) $\bigcup\,\{ ({\uparrow\!y})^{\circ} : y\in \bigcap\,\{ {\uparrow\!F_i} : i<n\} = Y \}.$ (3) If ${\rm U}T$ is a web space then its interior operator preserves finite unions \cite{Eweb}; in particular, for finite $F$, one has $({\uparrow\!F})^{\circ}\! = \bigcup \,\{ ({\uparrow\!y})^{\circ}\! : y\in F\} = \bigcup \,\{ ({\uparrow\!z})^{\circ}\! : z\in {\uparrow\!F}\}$ (as $y\leq z$ implies ${\uparrow\!z}\subseteq {\uparrow\!y}$). (4) In a join-semilattice $Q$ with least element, $\curlywedge Q$ is the set of all principal filters. (5) If $Q$ is a lattice with least element and ${\cal T}$-continuous unary meet-operations $\wedge_x : y \mapsto x\wedge y$, then ${\rm U}T$ is a web space \cite{Epatch}; hence, $T$ is $\curlyvee$-stable by (3). Furthermore, $T$ is $\curlywedge$-stable by (4), and finally $\diamondsuit$-stable by (2). (6) Let $T =(X,\leq,{\cal T} )$ be a lower semi-qospace. Then $\leq$ is the specialization order of ${\cal T}^{\leq}$. The upper space ${\rm U} T = (X,{\cal T}^{\leq})$ is a core space iff $U \!= \bigcup\,\{ ({\uparrow\!y})^{\circ}\! : y \!\in\! U\}$ for all $U \!\in\! {\cal T}^{\leq}$, which is equivalent to requiring that $T$ is $\curlyvee$-stable and satisfies the equation $U = \bigcup\,\{ ({\uparrow\!F})^{\circ} : F\subseteq U, \, F \mbox{ finite}\}$ for all $U\in {\cal T}^{\leq}$. But the latter condition means that the upper space is locally hypercompact. \EP By an {\em mc-ordered space} we mean an ordered space such that every monotone net in the space or, equivalently, every directed subset of the space, regarded as a net, has a supremum to which it converges. It is shown in \cite{Epatch} that the strongly convex mc-ordered semi-pospaces are exactly the patch spaces of monotone convergence spaces (d-spaces), and that the Lawson spaces of domains are just the hyper\-convex, mc-ordered and upper m-determined semi-pospaces, where an ordered space is {\em upper m-determined} iff every upper set $U$ intersecting all directed sets whose closure meets $U$ is open. We are prepared for the main result in this section, characterizing the Lawson spaces of continuous domains in various ways. \begin{theorem} \label{pospace} For an ordered space $T$, the following conditions are equivalent: \vspace{-.5ex} \begin{itemize} \item[{\rm (1)}] $T$ is the Lawson space of a continuous domain. \item[{\rm (2)}] $T$ is a fan space whose upper space is sober (or a d-space). \item[{\rm (3)}] $T$ is the Lawson space of a meet-continuous domain, $\curlywedge$-stable and T$_2$. \item[{\rm (4)}] $T$ is a hyperconvex, mc-ordered and core stable (semi-)pospace. \item[{\rm (5)}] $T$ is hyperconvex, mc-ordered, ${\uparrow}$-stable, $\diamondsuit$-stable, and T$_2$. \end{itemize} \vspace{-.5ex} Moreover, `T$_2$' may be replaced by `T$_2$-ordered', by 'upper T$_3$-ordered', and by `T$_3$'. \end{theorem} \noindent {\it Proof.} (1)$\,\Rightarrow\,$(2): Let $P$ be a continuous domain with $T = \Lambda P$. By Corollary \ref{Cspace}, its upper space $\Sigma P$ is a sober core space, and by Theorem \ref{fans}, $\Lambda P$ is a fan space. (2)$\,\Rightarrow\,$(3): By Theorem\,\ref{fans}, $T =(P,{\cal T} )$ is regular, upper regular and T$_1$, i.e., T$_3$ and upper T$_3$-ordered, {\it a fortiori} T$_2$-ordered; the upper space ${\rm U} T$ is a core space and a d-space. By Corollary\,\,\ref{Cspace}, $P$ is a continuous, hence meet-continuous domain, ${\cal T}^{\leq}$ is its Scott topology $\sigma P$, and ${\cal T} \!=\! {\cal T}^{\leq \upsilon}$ is the Lawson topology $\lambda P$. Since ${\rm U} T$ is a core space, $T$ is $\curlywedge$-stable, by Theorem \ref{Cspace}\,(1) and Lemma\,\ref{stable}\,(1). (2)$\,\Rightarrow\,$(4): By Theorem \ref{fans}, ordered fan spaces are hyperconvex core stable pospaces, and such spaces are mc-ordered if their upper space is a d-space. (3)$\,\Rightarrow\,$(5): If $P$ is a meet-continuous domain then $\Sigma P$ is a web space, so its weak patch space, the Lawson space $\Lambda P$, is web-ordered, hence ${\uparrow}$-stable (Proposition\,\ref{webpatch}); it is a hyperconvex semi-pospace, and mc-ordered since $\Sigma P$ is a d-space. By Lemma \ref{stable}\,(3), $T$ is $\curlyvee$-stable, and if it is $\curlywedge$-stable, it is $\diamondsuit$-stable by Lemma \ref{stable}\,(2). (4)$\,\Rightarrow\,$(5): Core stable semi-pospaces are ${\uparrow}$-stable, $\diamondsuit$-stable and T$_2$ (Lemma\,\ref{cstable}). (5)$\,\Rightarrow\,$(1): By Lemma \ref{stable}\,(1), the sets $R y = \{ x: y\!\in\! ({\uparrow\! x})^{\circ}\}$ are directed. As $T$ is mc-ordered, $R y$ has a join $x \!=\! \bigvee R y$. Assume $x \!<\! y$ and choose disjoint sets $V,W\in {\cal T}$ with $x\in V$ and $y\in W$. By hyperconvexity, there is a $U \in {\cal T}^{\leq}$ and a finite set $F$ with $x\in U\setminus {\uparrow\! F}\subseteq V$. Then $y\in U\cap W\subseteq {\uparrow\! F}$ (as $x < y$ and $V\cap W = \emptyset$), and $U\cap W\in {\cal T}$ yields ${\uparrow\!(U\cap W)}\in {\cal T}^{\leq}$ by ${\uparrow}$-stability. Thus, $y\in ({\uparrow\! F})^{\circ} = \bigcup\,\{ ({\uparrow\! u})^{\circ}\! : u\!\in\! F\}$ by $\curlyvee$-stability, and so $u\in R y$ for some $u\in F$, which leads to the contradiction $u\leq \bigvee \! R y = x\in U\setminus {\uparrow\! F}$. Hence, $y$ is the directed join of\,\,$R y$. Since $T =(P,{\cal T} )$ is mc-ordered, ${\cal T}^{\leq}$ is coarser than $\sigma P$. It follows that $R y$ coincides with the way-below ideal $\ll\! y$ (indeed, $x \ll y$ implies $x\,R\,y$, since $R y$ is an ideal with join $y$; and $x\,R\, y$ implies $x \!\ll\! y$, since for directed $D$, $x \,R \, y = \bigvee\! D$ entails $y\in int_{{\cal T}^{\leq}} {\uparrow\!x} \subseteq int_{\sigma P} {\uparrow\!x} \subseteq x\!\!\ll$). Therefore, $P$ is continuous, ${\cal T}^{\leq} = \sigma P$ (as the base $\{ xR : x\in P\}$ of $\sigma P$ is contained in ${\cal T}^{\leq}$), and finally, ${\cal T} = {\cal T}^{\leq \upsilon} = \lambda P$. \EP Since all topologies on join-semilattices with 0 are $\curlywedge$-stable, we obtain at once: \begin{corollary} \label{complete} A complete\,lattice\,$L$ is continuous iff $\Sigma L$ is a web space and $\Lambda L$\,is\,T$_2$. In that case, $\Lambda L$ is an (upper) regular pospace (and in {\sf ZFC}, it is even compact). \end{corollary} In categorical terminology, parts of Corollary \ref{contdom} and Theorem \ref{pospace} read as follows: \begin{proposition} \label{iso} The category {\bf CD} of continuous domains and maps preserving directed joins is concretely isomorphic, by virtue of the Scott functor $\Sigma$, to the category {\bf SCS} of sober core spaces, and by virtue of the Lawson functor $\Lambda$, to the category {\bf MFS} of mc-ordered fan spaces with isotone lower semicontinuous maps. The inverse isomorphism $\Lambda^-$ is induced by the forgetful functor $(P,{\cal T}) \mapsto P$. \end{proposition} \begin{picture}(300,60)(-80,0) \put(82,51){{\bf CD}} \put(35,10){{\bf SCS}} \put(119,10){{\bf MFS}} \put(78,45){\vector(-1,-1){20}} \put(58,35){$\Sigma$} \put(63,25){\vector(1,1){20}} \put(77,29){$\Sigma^{\!-}$} \put(102,45){\vector(1,-1){20}} \put(117,35){$\Lambda$} \put(117,25){\vector(-1,1){20}} \put(93,29){$\Lambda^{\!-}$} \put(65,11){\vector(1,0){46}} \put(110,14){\vector(-1,0){46}} \put(85,17){${\rm U}$} \put(83,0){${\rm P}_{\upsilon}$} \end{picture} \vspace{1ex} Suitable examples show that the properties in Theorem \ref{pospace}\,(5) are independent; that is, none of them follows from the combination of the other four properties. \begin{example} \label{Ex51} {\rm For ${\mathbb I} = \,]\,0,1\,] \subseteq {\mathbb R}$, the left half-open interval topology ${\cal T} = \upsilon \hspace{.2ex}{\mathbb I}\,^{\alpha}$ makes ${\mathbb I}$ a pospace with all the properties in (5) except hyper- resp.\ strong convexity: for any interval $]\,0,y\,]$ with $0 \!<\! y \!<\! 1$ and any upper set $U$, there is no lower set $V = \,]\,0,\,z\,[$ with $y\in U \cap V \subseteq \ ]\,0,y\,]$, because any $x\in \ ]\,y,z\,[$ belongs to $U\cap V$. } \end{example} \begin{example} \label{Ex52} {\rm All finite products of chains are continuous posets; but they are domains only if all nonempty subsets have joins. The pospaces $\Lambda \,{\mathbb Q}^n$ and $\Lambda \,{\mathbb R}^n$ have all properties in (5) except of being mc-ordered, as neither ${\mathbb Q}$ nor ${\mathbb R}$ has a join. } \end{example} \begin{example} \label{Ex53} {\rm Consider the subset $X = \{ 0\} \cup \, [ \,1,2\, ] \, \cup \{ 3 \}$ of ${\mathbb R}$, equipped with the Euclidean topology inherited from ${\mathbb R}$, and the order $\sqsubseteq $ defined by $$x \sqsubseteq y \ \Leftrightarrow \ x = y \mbox{ or } x = 0 \mbox{ or } y = 1 \mbox{ or } (x = 2 \mbox{ and } y \in \,]\,1,2\,[\,).$$ \vspace{-1.5ex} \begin{picture}(200,70)(-130,0) \put(90,30){\circle{5}} \put(95,27){$3$} \put(87.5,32){\line(-3,2){40}} \put(87.5,28){\line(-3,-2){40}} \put(45,15){\circle{5}} \put(45,13){\line(0,-1){10}} \put(45,60){\circle{5}} \put(35,58){$1$} \put(45,0){\circle{5}} \put(33,34){$]\,1,2\,[$} \put(35,10){$2$} \put(35,-4){$0$} \put(43,17){\line(-2,3){8}} \put(47,17){\line(2,3){8}} \put(43,57.5){\line(-2,-3){8}} \put(47,57.5){\line(2,-3){8}} \end{picture} \vspace{2ex} \noindent This is a compact pospace, hence mc-ordered \cite[VI-1]{CLD} and T$_2$. It is $\curlyvee$-stable, since $({\uparrow\!F})^{\circ} = {\uparrow (F\cap \{ 0,2\})} \cup (F\cap \{ 3\}) = \bigcup \{ ({\uparrow\!x})^{\circ}: x\in F\}$ for all finite subsets\,\,$F$. It is $\curlywedge$-stable (because $(X,\sqsubseteq )$ is a complete lattice), and therefore $\diamondsuit$-stable (Lemma \ref{stable}\,(2)). Furthermore, it is hyperconvex, in view of the equations $\{ 0\} = X\setminus {\uparrow\!\{ 2,3\}}$, $\{ 3 \} = (X\setminus \{ 0\} )\setminus {\uparrow\!2}$, and $U = {\uparrow\!U}\setminus {\uparrow\!1}$ for $U \subseteq \ ]1,2\,]$. \noindent But this pospace fails to be ${\uparrow}$-stable, since $\{ 3\}$ is open, while $\{ 1,3\} = {\uparrow\!3}$ is not. } \end{example} \begin{example} \label{Ex54} {\rm If $(X,{\cal T} )$ is a nonempty T$_2$-space whose finite subsets have empty interior (e.g.\ ${\cal T} = \lambda \,{\mathbb R}$) then the pospace $(X, =, {\cal T} )$ is trivially up- and $\curlyvee$-stable, hyperconvex and mc-ordered, and it is almost $\curlywedge$-stable: for finite subsets $F$ with at least two elements, one has $F^{\uparrow} = \emptyset$, hence $(F^{\uparrow})^{\circ} = \bigcup \,\{ ({\uparrow\!y})^{\circ} :y\in F^{\uparrow}\} = \emptyset$. But, ``by the skin of its teeth'', such a pospace fails to be $\curlywedge$-stable, because for $F = \emptyset$, $F^{\uparrow}$ is the whole ground set $X$, whence $(F^{\uparrow})^{\circ} = X \neq \emptyset = \bigcup \,\{ ({\uparrow\!y})^{\circ} :y\in F^{\uparrow}\! = X\}.$ } \end{example} \begin{example} \label{Ex55} {\rm The completed open real square $S \!= \,]\,0,1\,[^2 \,\mathop{\cup}\, \{ (0,0),(1,1) \}$ endowed with the interval topology is an irreducible, ${\uparrow}$-stable compact semi-pospace, but not T$_2$ (cf.\ Example 3.5 in \cite{Epatch}). However, it is hyperconvex, mc-ordered, $\curlyvee$- and $\curlywedge$-stable, and so $\diamondsuit$-stable (Lemma \ref{stable}\,(2)). But this space heavily fails to be web-ordered, since the only web neighborhood of any point is the whole space. } \end{example} \noindent {\bf Note.} The basic results about core spaces and fan spaces are more than 30 years old; they have been reported by the author at the Annual Meeting of the\,\,DMV, Dortmund 1980\,\cite{Evdt} and at the Summer School on Ordered Sets and Universal Algebra, Donovaly 1985 but have not been published in a systematic treatise until now. A common theory of web spaces and core spaces is possible by introducing so-called {\em $\kappa$-web spaces}, where $\kappa$ is a cardinal parameter; that approach was initiated in \cite{Eweb}. A comprehensive theory of so-called {\em $\zeta$-domains} and their topological manifestation, providing common generalizations of continuous, hypercontinuous, algebraic and many other variants of domains or posets, is presented in \cite{Edom}. \section{Semitopological and topological semilattices} \label{semi} Let us now apply some of the previous results to the situation of {\em semilattices}, by which we always mean {\em meet-semilattices}. A {\em semilattice-ordered space} is an ordered space $S$ whose underlying poset is a semilattice; by slight abuse of language, we call it {\em compatible} if the topology is compatible with the semilattice order, and we call a semilattice- and T$_1$-ordered space a T$_1${\em -semilattice}. A {\em semitopological semilattice} is a semilattice-ordered\,\,space whose unary meet operations \mbox{$\wedge_x \!: y \mapsto x\wedge y$} are continuous, while in a {\em topological semilattice} the binary meet operation is continuous. \vspace{-.5ex} \begin{lemma} \label{top} A semilattice-ordered space $S =(X,\leq,{\cal T})$ is a topological semilattice whenever one of the following conditions is fulfilled: \vspace{-.5ex} \begin{itemize} \item[{\rm (1)}] $S$ is compatible and locally filtered (a wide web space). \item[{\rm (2)}] $S$ has a subbase of sets whose complements are filtered. \item[{\rm (3)}] $S$ carries the weak lower topology: ${\cal T} = \upsilon (X,\geq)$. \item[{\rm (4)}] $S$ is a hyperconvex, locally filtered and ${\uparrow}$-stable semi-pospace. \end{itemize} \end{lemma} \vspace{-.5ex} \noindent {\it Proof.} (1) For $x,y\in X$ and a filtered neighborhood $D$ of $x\wedge y$ with $D\subseteq U \in {\cal T} = {\cal T}^{\leq}$, the up-closure $F = {\uparrow\!D}$ is a filter still contained in $U$. For $W = int_{{\cal T}} F$, we obtain $W\wedge W \subseteq F\wedge F \subseteq F \subseteq U$ and $x,y\in W$, as $x\wedge y \in W = {\uparrow\!W}$. (2) Let $V$ be a subbasic open set such that $F = X\setminus V$ is a filter. If $x,y\in X$ satisfy $x\wedge y\in V$ then $x\in V$ or $y\in V$ (otherwise $x\wedge y \in F$). Hence, $(x,y)$ lies in $W = (V \!\times\! X)\cup (X \!\times\! V)$, and that is an open set in $S^2$ with $\wedge\, [W] \subseteq V$ (indeed, $(u,v)\in W$ implies $u\in V$ or $v\in V$, and so $u\wedge v\in V$, since $V$ is a lower set). (3) follows from (2), because $\upsilon (X,\geq )$ has a closed subbase of principal filters. (4) The ordered space $(X,\leq,{\cal T}^{\leq})$ is compatible and locally filtered: for \mbox{$x \!\in\! U \!\in\! {\cal T}^{\leq}$,} find a filtered $D\subseteq U$ with $x\in W = int_{{\cal T}}D$; then ${\uparrow\!D}$ is a filter with $x \!\in\! W \!\subseteq\! {\uparrow\!D} \!\subseteq\! U$, and ${\uparrow\!W}$ is ${\cal T}^{\leq}$-open by ${\uparrow}$-stability. By (1), the operation $\wedge$ is ${\cal T}^{\leq}$-continuous; by (3), it is $\upsilon (X,\geq)$-continuous, and then, by hyperconvexity, it is ${\cal T}$-continuous. \EP We find it convenient to call a topological semilattice {\em s-topological} (resp.\ {\em sc-topological}) if it has small semilattices (resp.\ small convex semilattices), that is, each point has a neighborhood base consisting of (convex) subsemilattices (cf.\ \cite[VI-3]{CLD}). We are ready for the characterization of hyperconvex semitopological, resp.\ s-topological T$_1$-semilattices as certain specific web-ordered spaces. \begin{theorem} \label{topsemi} Let $S$ be a hyperconvex T$_1$-semilattice or, equivalently, the weak patch space of a compatible semilattice-ordered space. \noindent {\rm (1)} The following three conditions are equivalent: \vspace{-.5ex} \begin{itemize} \item[{\rm (w11)}] $S$ is the weak patch space of a web space. \item[{\rm (w12)}] $S$ is a web-ordered space. \item[{\rm (w13)}] $S$ is a semitopological semilattice. \end{itemize} \noindent {\rm (2)} The following three conditions are equivalent: \vspace{-.5ex} \begin{itemize} \item[{\rm (w21)}] $S$ is the weak patch space of a wide web space. \item[{\rm (w22)}] $S$ is a locally filtered and ${\uparrow}$-stable ordered space. \item[{\rm (w23)}] $S$ is an s(c)-topological semilattice. \end{itemize} \noindent {\rm (3)} The following three conditions are equivalent: \vspace{-.5ex} \begin{itemize} \item[{\rm (w31)}] $S$ is the weak patch space of a worldwide web space (a core space). \item[{\rm (w32)}] $S$ is a core stable pospace (a fan space). \item[{\rm (w33)}] $S$ is an s(c)-topological semilattice, and ${\rm U}S$ is locally compact. \end{itemize} \end{theorem} \noindent {\it Proof.} Notice that hyperconvexity ensures closedness of all principal filters, so it suffices to assume that $S$ is a hyperconvex semilattice-ordered lower semi-pospace. (w11)$\,\Leftrightarrow \,$(w12): Apply Proposition \ref{webpatch} to $\zeta = \upsilon$. (w12)$\,\Rightarrow \,$(w13): By Proposition \ref{webpatch}, the upper space $(X,{\cal T}^{\leq})$ of $S = (X,\leq, {\cal T})$ is a web space, and $S$ is its weak patch space. Therefore, as remarked in \cite{Eweb} and \cite{Epatch}, the unary meet operations $\wedge_x$ are ${\cal T}^{\leq}$-continuous; by Lemma \ref{top}\,(3), they are $\upsilon (X,\geq)$-continuous, and by hyperconvexity, they are also ${\cal T}$-continuous. (w13)$\,\Rightarrow \,$(w12): This was shown in \cite{Eweb}. (w21)$\,\Leftrightarrow \,$(w22): Apply Theorem \ref{wideweb} to $\zeta = \upsilon$. (w22)$\,\Rightarrow \,$(w23): By Lemma \ref{top}\,(4), $S$ is a topological semilattice. Given $x \!\in\! O \!\in\! {\cal T}$, use hyperconvexity and local filteredness in order to find a $U\in {\cal T}^{\leq}$, a finite set $F$, and a filtered set $D$ such that $x\in int_{{\cal T}} D \subseteq D \subseteq U \setminus {\uparrow\!F} \subseteq O$. Then ${\uparrow\!D}\setminus {\uparrow\!F}$ is a convex subsemilattice with $x\in int_{{\cal T}} D \subseteq {\uparrow\!D}\setminus {\uparrow\!F} \subseteq U\setminus {\uparrow\!F} \subseteq O$, which shows that $S$ has small convex semilattices. (w23)$\,\Rightarrow \,$(w22): By continuity of the unary operations $\wedge_x$, $S$ is ${\uparrow}$-stable: indeed, $O\in {\cal T}$ implies ${\uparrow\!O} = \bigcup\,\{ \wedge_x^{-1}[O] : x\in O\} \in {\cal T}$. Clearly, subsemilattices are filtered. The equivalence of (w31), (w32) and (w33) is now easily verified with the help of (2), Theorem \ref{fans} and Proposition \ref{supertop}, which says, among other things, that the core spaces are exactly the locally compact web spaces (cf.\ \cite[VI--3.3]{CLD}). \EP \vspace{1ex} Combining Theorem \ref{pospace} with Theorem \ref{topsemi}, we arrive at \begin{corollary} \label{contsemi} For a semilattice-ordered space $S$, the following are equivalent: \vspace{-.5ex} \begin{itemize} \item[{\rm (w41)}] $S$ is the weak patch space of a (unique) sober core space. \item[{\rm (w42)}] $S$ is an mc-ordered fan space. \item[{\rm (w43)}] $S$ is a hyperconvex, mc-ordered, s-topological T$_1$-semilattice with locally compact upper space ${\rm U}S$. \item[{\rm (w44)}] $S$ is the Lawson space of a continuous semilattice. \end{itemize} The weak patch functor ${\rm P}_{\upsilon}$ induces concrete isomorphisms between \vspace{-.5ex} \begin{itemize} \item[{\rm (1)}] the category of compatible semitopological semilattices,\,i.e.\,semilattice-ordered web spaces, and that of hyperconvex semitopological T$_1$-semilattices, \item[{\rm (2)}] the category of compatible s-topological semilattices,\,i.e.\,semilattice-ordered wide web spaces, and that of hyperconvex s-topological T$_1$-semilattices, \item[{\rm (3)}] the category of locally compact compatible s-topological semilattices,\,i.e.\,semi\-lattice-ordered core spaces, and that of topological semilattice fan spaces, \item[{\rm (4)}] the category of Scott\,spaces of continuous\,semilattices,\,i.e.\ semilattice-ordered sober core spaces, and that of Lawson spaces of continuous\,semilattices,\,i.e.\ mc-ordered topological semilattices that are fan spaces. \end{itemize} \end{corollary} \noindent Of course, most elegant results are available for compact pospaces. From \cite[IV--1]{FL} or \cite[VI--1]{CLD}, we learn the following facts: every compact pospace is \vspace{-.5ex} \begin{itemize} \item[--] mc-ordered and dually mc-ordered, \item[--] monotone normal, in particular upper and lower regular, \item[--] strongly convex. \end{itemize} For any closed subset $C$ of a compact pospace $T$, the sets ${\uparrow\!C}$ and ${\downarrow\!C}$ are closed, but $T$ need neither be ${\uparrow}$-stable nor locally filtered: see Examples \ref{Ex33} and \ref{Ex53}. A semilattice is said to be {\em complete} if all directed subsets have suprema and all nonempty subsets have infima (this together with the existence of a top element defines a complete lattice). Recall from \cite[IV--3]{CLD} the famous \vspace{1ex} \noindent {\bf Fundamental Theorem of Compact Semilattices}\\ {\em The Lawson spaces of complete continuous semilattices are exactly the compact T$_2$ s-topological semilattices. } \vspace{1ex} This is now a rather easy consequence of the previous facts, the Ultrafilter Theorem (giving compactness of $\Lambda L$ \cite{EPS}) and the following ``non-complete'' version: \begin{proposition} \label{compact} The compact Lawson spaces of continuous domains are exactly the locally filtered, ${\uparrow}$-stable compact pospaces. \end{proposition} \noindent {\it Proof.} If $P$ is a continuous domain then, by Theorems \ref{fans} and \ref{pospace}, the Lawson space $\Lambda P$ is a fan space, hence a locally filtered ${\uparrow}$-stable pospace. Conversely, if $T = (X,\leq,{\cal T})$ is any locally filtered, ${\uparrow}$-stable compact pospace then $T$ is upper regular, mc-ordered and dually mc-ordered; by Lemma \ref{cstable}, it is d-stable, and its upper space is a core space and a d-space (because $T$ is mc-ordered); hence, by Corollary \ref{contdom}, it is the Scott space of the continuous domain $P =(X,\leq)$. It follows that the Lawson topology $\lambda P = \sigma P \vee \upsilon \widetilde{P}$ is contained in ${\cal T} = {\cal T}^{\leq}\vee {\cal T}^{\geq}$ (as $T$ is strongly convex). Now, $\lambda P$ is T$_2$ and ${\cal T}$ is compact, so both topologies must coincide. \EP In \cite[III--5]{CLD}, one finds a whole collection of various equivalent characterizations of continuous domains that are compact in their Lawson topology. For a detailed study of joint and separate continuity of operations in posets and lattices, see \cite{EG}. \newpage \section{Domain bases and core bases} Following \cite{CLD}, we mean by a {\em basis} of a domain $P$ a subset $B$ such that for each $y\in P$, the set $\{ b \in\! B: b \ll y\}$ is directed with join $y$. The pair $(P,B)$ is then referred to as a {\em based domain}. Note that $P$ is continuous iff it has at least one basis. By a {\em core basis} for a space $(X,{\cal S})$, we mean a subset $B$ of $X$ such that for all $U\in {\cal S}$ and all $y\in U$, the set $R_{{\cal S}}y$ meets $B\cap U$; i.e., $y\in int_{{\cal S}}({\uparrow\!x}) \subseteq {\uparrow\!x} \subseteq U$ for some $x\in B$; in other words, all points have neighborhood bases formed by cores of elements of $B$. (To avoid ambiguities, we use the word {\em basis} for subsets of $X$ and the word {\em base} for subsets of the power set of $X$.) Thus, a space is a core space iff it has a core basis. By a {\em core based space} we mean a pair consisting of a (core) space and a core basis of it. The following extension of Corollary \ref{contdom} is straightforward: \begin{lemma} \label{basis} The bases of a domain are the core bases of its Scott space. Hence, via the Scott functor $\Sigma$, the based domains correspond to the core based sober spaces. \end{lemma} \begin{proposition} \label{Cbasis} The C-ordered sets are exactly the pairs $(B,\ll\!\!|_B)$ where $B$ is a basis of a domain (which is uniquely determind up to isomorphism by $(B,\ll\!\!|_B)$). \end{proposition} \noindent {\it Proof.} That, for any basis $B$ of a domain, the pair $(B,\ll\!\!|_B)$ is a C-ordered set follows easily from the interpolation property of $\ll$ (cf.\ Lemma \ref{conti}). Conversely, any C-ordered set $(X,R )$ is isomorphic to $({\cal B}_{R}, \ll\!\!|_{{\cal B}_{R}})$, where ${\cal B}_{R} = \{ R x : x\in X\}$ is a basis of the continuous domain ${\cal I}_{R}$ of rounded ideals (see Theorem \ref{Cspace}\,(4)). \EP \begin{corollary} \label{Cor} The T$_0$ core spaces are exactly the core bases of sober core spaces, equipped with the induced topology. \end{corollary} On the pointfree side, we define a {\em based supercontinuous lattice} to be a pair consisting of a supercontinuous (i.e.\ completely distributive) lattice $L$ and a {\em (coprime) basis} of $L$, that is, a join-dense subset of coprime elements. We are ready for six different descriptions of C-ordered sets: \begin{theorem} \label{Cequiv} The following six categories are mutually equivalent: \vspace{1ex} \begin{tabular}{|l|l|} \hline objects & morphisms\\ \hline \hline C-ordered sets & interpolating isotone maps\\ \hline T$_0$ core spaces & continuous maps\\ \hline fan ordered spaces & lower semicontinuous isotone maps\\ \hline based domains & maps preserving the bases and directed joins\\ \hline core based sober spaces & continuous maps preserving the core bases\\ \hline based supercontinuous lattices & maps preserving the bases and joins\\ \hline \end{tabular} \end{theorem} \vspace{1ex} \noindent On the object level, these equivalences easily follow from Theorem \ref{Cspace}, Corollary\,\ref{contdom}, Theorem \ref{fans}, Lemma \ref{Cbasis}, Proposition \ref{Cequiv} and Corollary \ref{Cor}. The verification of the claimed correspondences between the morphisms is left as an exercise. \newpage \section{Density and weight} \label{Cbases} We now are looking for characterizations of core bases in terms of the interior relation. Recall that the lower quasi-order $\leq_{R}$ of an arbitrary relation $R$ on a set $X$ is given by $x \leq_{R} y \,\Leftrightarrow\, R x \subseteq R y$. Now, we say a subset $B$ of $X$ is \begin{itemize} \item[--] {\em $R$-dense} if $x\,R\,y$ implies $x\,R\,b$ and $b\,R\,y$ for some $b\in B$, \item[--] {\em $R$-cofinal} if $x\,R\,y$ implies $x\!\leq_{R}\!b$ and $b\,R\,y$ for some $b\in B$. \end{itemize} It is straightforward to see that $B$ is $R$-dense and $R$ is transitive iff $B$ is $R$-cofinal and $R$ is idempotent. Note that the {\em strong patch topology} ${\cal S}^{\alpha} = {\cal S} \vee \alpha (X,\geq)$ of a space $(X,{\cal S} )$ concides with the {\em Skula topology} generated by ${\cal S} \cup {\cal S}^c$ \cite{Sk}. Hence, the sets $C\setminus D$ with $C,D\in {\cal S}^c$ form a base for ${\cal S}^{\alpha}$. \begin{proposition} \label{corebase} Let $(X,{\cal S})$ be a core space and $R$ the corresponding interior relation. For a subset $B$ of $X$, the following conditions are equivalent: \begin{itemize} \item[{\rm (1)}] $B$ is $R$-dense in $X$. \item[{\rm (2)}] $B$ is $R$-cofinal in $X$. \item[{\rm (3)}] $B$ is a core basis for $(X,{\cal S})$. \item[{\rm (4)}] $B$ is dense in $(X,{\cal S}^{\alpha})$ and so in any patch space of $(X,{\cal S} )$. \item[{\rm (5)}] $\{ {\downarrow\!b} : b\in B\}$ is join-dense in the coframe ${\cal S}^c$ of closed sets. \end{itemize} \end{proposition} \noindent {\it Proof.} (1)$\,\Leftrightarrow\,$(2): The above remark applies, as $R$ is idempotent by Theorem \ref{Cspace}\,(1). (1)$\,\Rightarrow\,$(3): $y\in U\in {\cal S}$ means $U = UR$ and $x\,R\,y$ for some $x\in U$. Choose $b\in B$ with $x\,R\, b \, R \, y$. Then, $b\in R y$ and, by transitivity, $b\in xR \subseteq x\!\leq_{R} \ = {\uparrow\!x} \subseteq U$. (3)$\,\Rightarrow\,$(4): If $C,D$ are ${\cal S}$-closed sets with $C \!\not\subseteq\! D$, pick an $x\in C\setminus D$ and find a $b\in B$ with $x\in int_{{\cal S}}({\uparrow\!b}) \subseteq {\uparrow\!b} \subseteq X\setminus D$. It follows that $b\in C$, since $b\leq x \in C = {\downarrow\!C}$. Thus, $b\in B\cap (C\setminus D)$. This proves density of $B$ in ${\cal S}^{\alpha} = {\cal S} \vee {\cal S}^c$. (4)$\,\Leftrightarrow\,$(5) holds for arbitrary spaces. Recall that ${\downarrow\!x}$ is the closure of the singleton $\{ x\}$ in $(X,{\cal S})$. Now, \mbox{$\{ {\downarrow\!b} : b\in B\}$} is join-dense in ${\cal S}^c$ iff for $C,D\in {\cal S}^c$ with $C\not\subseteq D$ there is a $b\in B$ with ${\downarrow\!b}\subseteq C$ but not ${\downarrow\!b}\subseteq D$, i.e.\ $b\in C\setminus D$ (as $C$ and $D$ are lower sets). But the latter means that $B$ meets every nonempty open set in ${\cal S}^{\alpha} = {\cal S} \vee {\cal S}^c$. (4)$\,\Rightarrow\,$(1): Suppose $x\,R\, y$ and choose a $z$ with $x\,R\, z \, R\, y$. Then $xR \in {\cal O}_{R} = {\cal S}$ and therefore $z \in xR \cap {\downarrow\!z} \in {\cal S}^{\alpha}$. Hence, there is a $b \in B \cap xR \cap {\downarrow\!z}$, and it follows that $x \, R \, b \, R \, y$, since $R y$ is a lower set containing $z$ and so $b$. \EP From now on, we assume the validity of the Axiom of Choice. Hence, each set $X$ has a cardinality, represented by the smallest ordinal number equipotent to\,\,$X$. The {\em weight} $w({\cal S})$ resp.\ {\em density} $d({\cal S})$ of a space or its topology ${\cal S}$ is the least possible cardinality of bases resp.\ dense subsets. The weight of a core space is at most the cardinality of any core basis $B$, since $B$ gives rise to a base $\{ bR = int_{{\cal S}}({\uparrow\!b}) : b \in B\}$. \begin{lemma} \label{cardbase} Every core basis of a core space $(X,{\cal S})$ contains a core basis of cardinality $w({\cal S})$. Hence, $w({\cal S})$ is the minimal cardinality of core bases for $(X,{\cal S})$. \end{lemma} \noindent {\it Proof.} Let ${\cal B}$ be an arbitrary base and $B$ a core basis for $(X,{\cal S})$. The Axiom of Choice gives a function picking an element $b_{\,U,V}$\,from each nonempty set of the form $$ B_{\,U,V} = \{ b \in B : U \subseteq {\uparrow\!b} \subseteq V \} \ \ (U,V\in {\cal B} ). $$ Then $ B_0 = \{ b_{\,U,V} : U,V\in {\cal B}, \ B_{\,U,V} \not = \emptyset\} $ is a subset of $B$ and still a core basis; in fact, $x\in V \in {\cal B}$ implies \mbox{$x\in U \subseteq {\uparrow\!b} \subseteq V$} for suitable $b\in B$ and $U\in {\cal B}$, and it follows that $x \in U \subseteq {\uparrow\!b_{\,U,V}} \subseteq V$. If ${\cal S}$ is infinite then so is ${\cal B}$, and consequently $|B_0| \leq |{\cal B}|^2 = |{\cal B}|$. Thus, we get $|B_0| \leq w({\cal S})$, and the remark before yields equality. If ${\cal S}$ is finite then the cores form the least base $\{ {\uparrow\!x} : x\in X\}$, and choosing a set of representatives from these cores, one obtains a core basis of cardinality $w({\cal S})$. \EP \begin{example} \label{Ex62} {\rm Consider the ordinal space $C = \omega \!+\! 2 = \{ 0, 1, ..., \omega, \omega\!+\!1\}$ with the upper (Scott) topology. While $\omega \cup \{ \omega\!+\!1\} = C\setminus \{ \omega \}$ is a core basis, the set $B = \omega\!+\!1 = \omega \cup \{ \omega\}$ is {\em not} a core basis: $U \!= \{ \omega\!+\!1\}$ is $\upsilon$-open but disjoint from $B$. Nevertheless, $\upsilon C \setminus \{ \emptyset\} = \{ bR : b \in B\}$ is a base (note $xR ={\uparrow\!x}$ for $x\neq \omega$). } \end{example} Generalizing the weight of topologies, one defines the {\em weight} $w(L)$ of a lattice $L$ as the least possible cardinality of join-dense subsets of $L$. For any relation $R$ on a set $X$, we define the {\em $R$-cofinality}, denoted by $c(X,R)$, to be the minimal cardinality of $R$-cofinal subsets of $X$. If $R$ is idempotent then $c(X,R)$ is also the {\em $R$-density}, the least cardinality of $R$-dense subsets. From Proposition \ref{corebase} and Lemma \ref{cardbase} we infer: \begin{theorem} \label{w} For a core space $(X,{\cal S})$ with interior relation $R$ and any patch topology ${\cal T}$ of ${\cal S}$, the density of $(X,{\cal T})$ is equal to each of the following cardinal invariants: \vspace{-.5ex} $$ c(X,R) = w({\cal S}) = w({\cal S}^c) = w({\cal S}^{\upsilon}). $$ \end{theorem} Indeed, if $B$ is a core basis for $(X,{\cal S})$ then ${\cal B} = \{ bR \setminus {\uparrow\!F} : b\in B,\, F \!\subseteq\! B, \, F \,\mbox{finite}\}$ is a base for ${\cal S}^{\upsilon}$, and if $B$ is infinite, ${\cal B}$ and $B$ have the same cardinality. If $B$ is finite, \mbox{the base $\{ {\uparrow\!b} : b \in B\}$ of ${\cal S}$ is equipotent to the base $\{ {\uparrow\!b}\cap {\downarrow\!b} : b \in B\}$ of ${\cal S}^{\upsilon} = {\cal S}^{\alpha}$.} Since in {\sf ZCF} any supercontinuous lattice is isomorphic to the topology of a core space \cite{EABC}, Theorem \ref{w} entails a fact that was shown choice-freely in \cite{ECD}: \begin{corollary} The weight of a supercontinuous (i.e.\ completely distributive) lattice is equal to the weight of the dual lattice. \end{corollary} \begin{example} \label{Ex61} {\rm On the real line with the upper (Scott) topology ${\cal S}$, the interior relation is the usual $<\,$. The rationals form a core basis ${\mathbb Q}$, being $<$-dense in ${\mathbb R}$. Hence, \vspace{-1ex} $$\omega = c({\mathbb R},<) = w({\cal S}) = w({\cal S}^c) = w({\cal S}^{\upsilon}) \neq w({\cal S}^{\alpha}) $$ because the half-open interval topology ${\cal S}^{\alpha}$ has no countable base. } \end{example} \newpage
{'timestamp': '2016-07-19T02:03:30', 'yymm': '1607', 'arxiv_id': '1607.04721', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04721'}
arxiv
\section{Introduction} \label{sec:introduction} Bioinformaticians define the $k$th-order de Bruijn graph for a string or set of strings to be the directed graph whose nodes are the distinct $k$-tuples in those strings and in which there is an edge from $u$ to $v$ if there is a \((k + 1)\)-tuple somewhere in those strings whose prefix of length $k$ is $u$ and whose suffix of length $k$ is $v$.\footnote{An alternative definition, which our data structure can be made to handle but which we do not consider in this paper, has an edge from $u$ to $v$ whenever both nodes are in the graph.} These graphs have many uses in bioinformatics, including {\it de novo\/} assembly~\cite{zerbino2008velvet}, read correction~\cite{DBLP:journals/bioinformatics/SalmelaR14} and pan-genomics~\cite{siren2014indexing}. The datasets in these applications are massive and the graphs can be even larger, however, so pointer-based implementations are impractical. Researchers have suggested several approaches to representing de Bruijn graphs compactly, the two most popular of which are based on Bloom filters~\cite{wabi,cascading} and the Burrows-Wheeler Transform~\cite{bowe2012succinct,boucher2015variable,belazzougui2016bidirectional}, respectively. In this paper we describe a new approach, based on minimal perfect hash functions~\cite{mehlhorn1982program}, that is similar to that using Bloom filters but has better theoretical bounds when the number of connected components in the graph is small, and is fully dynamic: i.e., we can both insert and delete nodes and edges efficiently, whereas implementations based on Bloom filters are usually semi-dynamic and support only insertions. We also show how to modify our implementation to support, e.g., jumbled pattern matching~\cite{BCFL12} with fixed-length patterns. Our data structure is based on a combination of Karp-Rabin hashing~\cite{KR87} and minimal perfect hashing, which we will describe in the full version of this paper and which we summarize for now with the following technical lemmas: \begin{lemma} \label{lem:static} Given a static set $N$ of $n$ $k$-tuples over an alphabet $\Sigma$ of size $\sigma$, with high probability in $O(kn)$ expected time we can build a function \(f : \Sigma^k \rightarrow \{0, \ldots, n - 1\}\) with the following properties: \begin{itemize} \item when its domain is restricted to $N$, $f$ is bijective; \item we can store $f$ in $O(n + \log k+\log\sigma)$ bits; \item given a $k$-tuple $v$, we can compute \(f (v)\) in $\Oh{k}$ time; \item given $u$ and $v$ such that the suffix of $u$ of length \(k - 1\) is the prefix of $v$ of length \(k - 1\), or vice versa, if we have already computed \(f (u)\) then we can compute \(f (v)\) in $\Oh{1}$ time. \end{itemize} \end{lemma} \begin{lemma} \label{lem:dynamic} If $N$ is dynamic then we can maintain a function $f$ as described in Lemma~\ref{lem:static} except that:\ \begin{itemize} \item the range of $f$ becomes \(\{0, \ldots, 3 n - 1\}\); \item when its domain is restricted to $N$, $f$ is injective; \item our space bound for $f$ is $\Oh{n (\log \log n + \log \log \sigma)}$ bits with high probability; \item insertions and deletions take $\Oh{k}$ amortized expected time. \item the data structure may work incorrectly with very low probability (inversely polynomial in $n$). \end{itemize} \end{lemma} Suppose $N$ is the node-set of a de Bruijn graph. In Section~\ref{sec:static} we show how we can store $\Oh{n \sigma}$ more bits than Lemma~\ref{lem:static} such that, given a pair of $k$-tuples $u$ and $v$ of which at least one is in $N$, we can check whether the edge \((u, v)\) is in the graph. This means that, if we start with a $k$-tuple in $N$, then we can explore the entire connected component containing that $k$-tuple in the underlying undirected graph. On the other hand, if we start with a $k$-tuple not in $N$, then we will learn that fact as soon as we try to cross an edge to a $k$-tuple that is in $N$. To deal with the possibility that we never try to cross such an edge, however --- i.e.,\@\xspace that our encoding as described so far is consistent with a graph containing a connected component disjoint from $N$ --- we cover the vertices with a forest of shallow rooted trees. We store each root as a $k$-tuple, and for each other node we store \(1 + \lg \sigma\) bits indicating which of its incident edges leads to its parent. To verify that a $k$-tuple we are considering is indeed in the graph, we ascend to the root of the tree that contains it and check that $k$-tuple is what we expect. The main challenge for making our representation dynamic with Lemma~\ref{lem:dynamic} is updating the covering forest. In Section~\ref{sec:dynamic} how we can do this efficiently while maintaining our depth and size invariants. Finally, in Section~\ref{sec:jumbled} we observe that our representation can be easily modified for other applications by replacing the Karp-Rabin hash function by other kinds of hash functions. To support jumbled pattern matching with fixed-length patterns, for example, we hash the histograms indicating the characters' frequencies in the $k$-tuples. \section{Static de Bruijn Graphs} \label{sec:static} Let \(G\) be a de Bruijn graph of order \(k\), let \(N = \{v_0, \ldots, v_{n-1}\}\) be the set of its nodes, and let \(E = \{a_0, \ldots, a_{e-1}\}\) be the set of its edges. We call each \(v_i\) either a node or a \(k\)-tuple, using interchangeably the two terms since there is a one-to-one correspondence between nodes and labels. We maintain the structure of \(G\) by storing two binary matrices, \IN and \OUT, of size \(n \times \sigma\). For each node, the former represents its incoming edges whereas the latter represents its outgoing edges. In particular, for each \(k\)-tuple \(v_x = c_1 c_2 \ldots c_{k-1} a\), the former stores a row of length \(\sigma\) such that, if there exists another \(k\)-tuple \(v_y = b c_1 c_2 \ldots c_{k-1}\) and an edge from \(v_y\) to \(v_x\), then the position indexed by \(b\) of such row is set to \TRUE. Similarly, \OUT contains a row for \(v_y\) and the position indexed by \(a\) is set to \TRUE. As previously stated, each \(k\)-tuple is uniquely mapped to a value between \(0\) and \(n-1\) by \(f\), where $f$ is as defined in Lemma~\ref{lem:static}, and therefore we can use these values as indices for the rows of the matrices \IN and \OUT, i.e.,\@\xspace in the previous example the values of \(\IN[f(v_x)][b]\) and \(\OUT[f(v_y)][a]\) are set to \TRUE. We note that, e.g., the SPAdes assembler~\cite{Ban12} also uses such matrices. Suppose we want to check whether there is an edge from \(b X\) to \(X a\). Letting \(f(b X) = i\) and \(f(X a) = j\), we first assume \(b X\) is in \(G\) and check the values of \(\OUT [i] [a] \) and \( \IN [j] [b]\). If both values are \TRUE, we report that the edge is present and we say that the edge is \emph{confirmed} by \IN and \OUT; otherwise, if any of the two values is \FALSE, we report that the edge is absent. Moreover, note that if \(b X\) is in \(G\) and \(\OUT [i] [a] = \TRUE\), then \(X a\) is in \(G\) as well. Symmetrically, if \(X a\) is in \(G\) and \(\IN [j] [b] = \TRUE\), then \(b X\) is in \(G\) as well. Therefore, if \(\OUT [i] [a] = \IN [j] [b] = \TRUE\), then \(b X\) is in \(G\) if and only if \(X a\) is. This means that, if we have a path \(P\) and if all the edges in \(P\) are confirmed by \IN and \OUT, then either all the nodes touched by \(P\) are in \(G\) or none of them is. We now focus on detecting false positives in our data structure maintaining a reasonable memory usage. Our strategy is to sample a subset of nodes for which we store the plain-text \(k\)-tuple and connect all the unsampled nodes to the sampled ones. More precisely, we partition nodes in the undirected graph \(G^\prime\) underlying \(G\) into a forest of rooted trees of height at least \(k \lg \sigma \) and at most \(3 k \lg \sigma\). For each node we store a pointer to its parent in the tree, which takes \(1 + \lg \sigma\) bits per node, and we sample the \(k\)-mer at the root of such tree. We allow a tree to have height smaller than \(k \lg \sigma\) when necessary, e.g., if it covers a connected component. Figure~\ref{fig:trees} shows an illustration of this idea. \begin{figure}[t!] \begin{center} \includegraphics[width=\textwidth]{trees.pdf} \caption{Given a de Bruijn graph (left), we cover the underlying undirected graph with a forest of rooted trees of height at most \(3 k \lg \sigma\) (center). The roots are shown as filled nodes, and parent pointers are shown as arrows; notice that the directions of the arrows in our forest are not related to the edges' directions in the original de Bruijn graph. We sample the $k$-tuples at the roots so that, starting at a node we think is in the graph, we can verify its presence by finding the root of its tree and checking its label in $\Oh{k \log \sigma}$ time. The most complicated kind of update (right) is adding an edge between a node $u$ in a small connected component to a node $v$ in a large one, $v$'s depth is more than \(2 k \lg \sigma\) in its tree. We re-orient the parent pointers in $u$'s tree to make $u$ the temporary root, then make $u$ point to $v$. We ascend \(k \lg \sigma\) steps from $v$, then delete the parent pointer $e$ of the node $w$ we reach, making $w$ a new root. (To keep this figure reasonably small, some distances in this example are smaller than prescribed by our formulas.)} \label{fig:trees} \end{center} \end{figure} We can therefore check whether a given node \(v_x\) is in \(G\) by first computing \(f(v_x)\) and then checking and ascending at most \(3 k \lg \sigma\) edges, updating \(v_x\) and \(f(v_x)\) as we go. Once we reach the root of the tree we can compare the resulting \(k\)-tuple with the one sampled to check if \(v_x\) is in the graph. This procedure requires \Oh{k \lg \sigma} time since computing the first value of \(f(v_x)\) requires \Oh{k}, ascending the tree requires constant time per edge, and comparing the \(k\)-tuples requires \Oh{k}. We now describe a Las Vegas algorithm for the construction of this data structure that requires, with high probability, \Oh{kn + n\sigma} expected time. We recall that \(N\) is the set of input nodes of size \(n\). We first select a function \(f\) and construct bitvector \(B\) of size \(n\) initialized with all its elements set to \FALSE. For each elements \(v_x\) of \(N\) we compute \(f(v_x) = i\) and check the value of \(B[i]\). If this value is \FALSE we set it to \TRUE and proceed with the next element in \(N\), if it is already set to \TRUE, we reset \(B\), select a different function \(f\), and restart the procedure from the first element in \(N\). Once we finish this procedure --- i.e.,\@\xspace we found that \(f\) do not produces collisions when applied to \(N\) --- we store \(f\) and proceed to initialize \IN and \OUT correctly. This procedure requires with high probability \Oh{kn} expected time for constructing \(f\) and \Oh{n\sigma} time for computing \IN and \OUT. Notice that if \(N\) is the set of \(k\)-tuples of a single text sorted by their starting position in the text, each \(f(v_x)\) can be computed in constant time from \(f(v_{x-1})\) except for \(f(v_0)\) that still requires \Oh{k}. More generally, if \(N\) is the set of \(k\)-tuples of \(t\) texts sorted by their initial position, we can compute \(n - t\) values of the function \(f(v_x)\) in constant time from \(f(v_{x-1})\) and the remaining in \Oh{k}. We will explain how to build the forest in the full version of this paper. In this case the construction requires, with high probability, \(\Oh{kt + n + n\sigma} = \Oh{kt + n\sigma}\) expected time. Combining our forest with Lemma~\ref{lem:static}, we can summarize our static data structure in the following theorem: \begin{theorem} \label{thm:static} Given a static $\sigma$-ary $k$th-order de Bruijn graph $G$ with $n$ nodes, with high probability in $\Oh{k n + n \sigma}$ expected time we can store $G$ in $\Oh{\sigma n}$ bits plus $\Oh{k \log \sigma}$ bits for each connected component in the underlying undirected graph, such that checking whether a node is in $G$ takes $\Oh{k \log \sigma}$ time, listing the edges incident to a node we are visiting takes $\Oh{\sigma}$ time, and crossing an edge takes $\Oh{1}$ time. \end{theorem} In the full version we will show how to use monotone minimal perfect hashing~\cite{BBPV09} to reduce the space to $(2+\epsilon)n\sigma$ bits of space (for any constant $\epsilon>0$). We will also show how to reduce the time to list the edges incident to a node of degree $d$ to $O(d)$, and the time to check whether a node is in $G$ to $\Oh{k}$. We note that the obtained space and query times are both optimal up to constant factors, which is unlike previous methods which have additional factor(s) depending on $k$ and/or $\sigma$ in space and/or time. \section{Dynamic de Bruijn Graphs} \label{sec:dynamic} In the previous section we presented a static representation of de Buijn graphs, we now present how we can make this data structure dynamic. In particular, we will show how we can insert and remove edges and nodes and that updating the graph reduces to managing the covering forest over \(G\). In this section, when we refer to $f$ we mean the function defined in Lemma~\ref{lem:dynamic}. We first show how to add or remove an edge in the graph and will later describe how to add or remove a node in it. The updates must maintain the following invariant: any tree must have size at least $k\log\sigma$ and height at most $3k\log\sigma$ except when the tree covers (all nodes in) a connected component of size at most $k\log\sigma$. Let \(v_x\) and \(v_y\) be two nodes in \(G\), \(e = (v_x, v_y)\) be an edge in \(G\), and let \(f(v_x) = i\) and \(f(v_y) = j\). Suppose we want to add \(e\) to \(G\). First, we set to \TRUE the values of \(\OUT[i][a]\) and \(\IN[j][b]\) in constant time. We then check whether \(v_x\) or \(v_y\) are in different components of size less than \(k \lg \sigma\) in \Oh{k \lg \sigma} time for each node. If both components have size greater than \(k \lg \sigma\) we do not have to proceed further since the trees will not change. If both connected components have size less than \(k \lg \sigma\) we merge their trees in \Oh{k \lg \sigma} time by traversing both trees and switching the orientation of the edges in them, discarding the samples at the roots of the old trees and sampling the new root in \Oh{k} time. If only one of the two connected components has size greater than \(k \lg \sigma\) we select it and perform a tree traversal to check whether the depth of the node is less than \(2 k \lg \sigma\). If it is, we connect the two trees as in the previous case. If it is not, we traverse the tree in the bigger components upwards for \(k \lg \sigma\) steps, we delete the edge pointing to the parent of the node we reached creating a new tree, and merge it with the smaller one. This procedure requires \Oh{k \lg \sigma} time since deleting the edge pointing to the parent in the tree requires \Oh{1} time, i.e.,\@\xspace we have to reset the pointer to the parent in only one node. Suppose now that we want to remove \(e\) from \(G\). First we set to \FALSE the values of \(\OUT[i][a]\) and \(\IN[j][b]\) in constant time. Then, we check in \Oh{k} time whether \(e\) is an edge in some tree by computing \(f(v_x)\) and \(f(v_y)\) checking for each node if that edge is the one that points to their parent. If \(e\) is not in any tree we do not have to proceed further whereas if it is we check the size of each tree in which \(v_x\) and \(v_y\) are. If any of the two trees is small (i.e.,\@\xspace if it has fewer than \(k \lg \sigma\) elements) we search any outgoing edge from the tree that connects it to some other tree. If such an edge is not found we conclude that we are in a small connected component that is covered by the current tree and we sample a node in the tree as a root and switch directions of some edges if necessary. If such an edge is found, we merge the small tree with the bigger one by adding the edge and switch the direction of some edges originating from the small tree if necessary. Finally if the height of the new tree exceeds $3k\log\sigma$, we traverse the tree upwards from the deepest node in the tree (which was necessarily a node in the smaller tree before the merger) for \(2k \lg \sigma\) steps, delete the edge pointing to the parent of the reached node, creating a new tree. This procedure requires $\Oh{k \lg \sigma}$ since the number of nodes traversed is at most \(O(k \lg \sigma)\) and the number of changes to the data structures is also at most \(O(k \lg \sigma)\) with each change taking expected constant time. It is clear that the insertion and deletion algorithms will maintain the invariant on the tree sizes. It is also clear that the invariant implies that the number of sampled nodes is $O(n/(k\log\sigma))$ plus the number of connected components. We now show how to add and remove a node from the graph. Adding a node is trivial since it will not have any edge connecting it to any other node. Therefore adding a node reduces to modify the function \(f\) and requires \Oh{k} amortized expected time. When we want to remove a node, we first remove all its edges one by one and, once the node is isolated from the graph, we remove it by updating the function \(f\). Since a node will have at most \(\sigma\) edges and updating \(f\) requires \Oh{k} amortized expected time, the amortized expected time complexity of this procedure is $\Oh{\sigma k\lg \sigma+ k}$. Combining these techniques for updating our forest with Lemma~\ref{lem:dynamic}, we can summarize our dynamic data structure in the following theorem: \begin{theorem} \label{thm:dynamic} We can maintain a $\sigma$-ary $k$th-order de Bruijn graph $G$ with $n$ nodes that is fully dynamic (i.e., supporting node and edge insertions and deletions) in $\Oh{n (\log \log n + \sigma)}$ bits (plus $\Oh{k \log \sigma}$ bits for each connected component) with high probability, such that we can add or remove an edge in expected \Oh{k\lg\sigma} time, add a node in expected \Oh{k+\sigma} time, and remove a node in expected \Oh{\sigma k\lg \sigma} time, and queries have the same time bounds as in Theorem~\ref{thm:static}. The data structure may work incorrectly with very low probability (inversely polynomial in $n$). \end{theorem} \section{Jumbled Pattern Matching} \label{sec:jumbled} Karp-Rabin hash functions implicitly divide their domain into equivalence classes --- i.e., subsets in which the elements hash to the same value. In this paper we have chosen Karp-Rabin hash functions such that each equivalence class contains only one $k$-tuple in the graph. Most of our efforts have gone into being able, given a $k$-tuple and a hash value, to determine whether that $k$-tuple is the unique element of its equivalence class in the graph. In some sense, therefore, we have treated the equivalence relation induced by our hash functions as a necessary evil, useful for space-efficiency but otherwise an obstacle to be overcome. For some applications, however --- e.g., parameterized pattern matching, circular pattern matching or jumbled pattern matching --- we are given an interesting equivalence relation on strings and asked to preprocess a text such that later, given a pattern, we can determine whether any substrings of the text are in the same equivalence class as the pattern. We can modify our data structure for some of these applications by replacing the Karp-Rabin hash function by other kinds of hash functions. For indexed jumbled pattern matching~\cite{BCFL12,KRR13,ACLL14} we are asked to pre-process a text such that later, given a pattern, we can determine quickly whether any substring of the text consists of exactly the same multiset of characters in the pattern. Consider fixed-length jumbled pattern matching, when the length of the patterns is fixed at pre-processing time. If we modify Lemmas~\ref{lem:static} and~\ref{lem:dynamic} so that, instead of using Karp-Rabin hashes in the definition of the function $f$, we use a hash function on the histograms of characters' frequencies in $k$-tuples, our function $f$ will map all permutations of a $k$-tuple to the same value. The rest of our implementation stays the same, but now the nodes of our graph are multisets of characters of size $k$ and there is an edge between two nodes $u$ and $v$ if it is possible to replace an element of $u$ and obtain $v$. If we build our graph for the multisets of characters in $k$-tuples in a string $S$, then our process for checking whether a node is in the graph tells us whether there is a jumbled match in $S$ for a pattern of length $k$. If we build a tree in which the root is a graph for all of $S$, the left and right children of the root are graphs for the first and second halves of $S$, etc., as described by Gagie et al.~\cite{GHLW15}, then we increase the space by a logarithmic factor but we can return the locations of all matches quickly. \begin{theorem} \label{thm:jumbled} Given a string \(S [1..n]\) over an alphabet of size $\sigma$ and a length $k \ll n$, with high probability in $\Oh{k n + n \sigma}$ expected time we can store \((2n \log \sigma)(1+o(1))\) bits such that later we can determine in $\Oh{k \log \sigma}$ time if a pattern of length $k$ has a jumbled match in $S$. \end{theorem} \section*{Acknowledgements} Many thanks to Rayan Chikhi and the anonymous reviewers for their comments. \bibliographystyle{splncs03}
{'timestamp': '2016-07-21T02:01:17', 'yymm': '1607', 'arxiv_id': '1607.04909', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04909'}
arxiv
\section{Preliminaries and Problem Formulation} \label{sec:prelims} \label{sec2} \paragraph{Bipartite Graphs} A \textbf{bipartite graph} $G=(\mathcal{M},\mathcal{B},E)$ is a graph such that the vertices $\mathcal{M}\cup \mathcal{B}$ can be divided into two disjoint subsets, $\mathcal{M}$ and $\mathcal{B}$, and there are no edges connecting vertices in the same subset, $E\subseteq \mathcal{M}\times \mathcal{B}$. Such a graph is \textbf{balanced} if $|\mathcal{M}| = |\mathcal{B}|$, i.e., if the two subsets have the same cardinality. A \textbf{perfect matching} in a balanced bipartite graph $G=(\mathcal{M},\mathcal{B},E)$ is a subset of edges $E_{pm} \subseteq E$ such that every vertex in $G$ is incident upon exactly one edge of the matching. We denote the neighbors of a set of vertices $S$ by $N(S)$, where $N(S)\triangleq \{j\in \mathcal{B}: \exists i \in S~\text{s.t.}~(i,j) \in E\}$ when $ S \subseteq \mathcal{M}$ and $N(S) \triangleq \{j\in \mathcal{M}: \exists i \in S~\text{s.t.}~(j,i) \in E\}$ when $ S \subseteq \mathcal{B}$. \begin{dfn} A set $S \subseteq \mathcal{M}$ or $S \subseteq \mathcal{B}$ in a bipartite graph $G=(\mathcal{M},\mathcal{B},E)$ is called a \textbf{constricted set} if $|S|>|N(S)|$. More precisely, we call $S$ a \textbf{constricted good set} if $S \subset \mathcal{M}$ or a \textbf{constricted buyer set} if $S \subset \mathcal{B}$. \end{dfn} \begin{thm*}[\textbf{Hall's marriage theorem}~\cite{hall}] For a balanced bipartite graph $G=(\mathcal{M},\mathcal{B},E)$, $G$ contains no perfect matching if and only if $G$ contains a constricted set. \end{thm*} \paragraph{Matching Market} We consider a matching market with a set $\mathcal{B}$ of buyers, and a set $\mathcal{M}$ heterogeneous merchandise with exactly one copy of each type of good. Each buyer $i\in \mathcal{B}$ has a non-negative valuation $v_{ij}\geq 0$ for good $j\in M$, and desires at most one good (e.g. they are unit-demand buyers). We denote the $|\mathcal{B}|\times |\mathcal{M}|$ valuation matrix by $\mathbf{V}$. Our assumption that $|\mathcal{B}|=|\mathcal{M}|=m$ is without loss of generality because we can always add dummy goods or dummy buyers for balance. Given a price vector $\mathbf{P}=[P_1 \, P_2 \, ...\, P_m]$, we assume a quasi-linear utilities for the buyers, i.e., buyer $i$ receiving good $j$ has utility $U_{i,j}=v_{i,j}-P_j$. Since each buyer is unit-demand, we define $U^*_i$ be the maximum (non-negative) payoff of buyer $i \in \mathcal{B}$, i.e., $U^*_i=\max \big\{0,\underset{j\in \mathcal{M}}{\max}~v_{i,j}-P_j\big\}$. Since buyers can opt out of the market and obtain zero, we insist on the payoff being non-negative. \begin{dfn} \label{def:pgset} Under a price vector $\mathbf{P}$, the \textbf{preferred-good set} of buyer $i\in \mathcal{B}$ is a set of goods $L_i\subseteq \mathcal{M}$ such that getting each good in $L_i$ maximizes buyer $i$'s payoff, $L_i=\{j\in \mathcal{M}|v_{i,j}-P_j=U^*_i\}$. \end{dfn} \noindent Note that the preferred goods set of a buyer is empty if its payoff for all the goods is negative. \begin{dfn} By connecting each buyer with its preferred goods and recalling the assumption of $|M|=|B|$, we can construct a balanced bipartite graph which we call the \textbf{preference graph}, i.e., $G_{\mathrm{pref}}=(\mathcal{M},\mathcal{B},E_{\mathrm{pref}})$ where $E_{\mathrm{pref}}=\{(j,i): i \in \mathcal{B}$ and $j\in L_i\}$. \end{dfn} \noindent To avoid any confusion, we always place goods on the left-hand side and buyers on the right-hand side of the preference graphs. \begin{dfn} The set of goods $M$ is over-demanded in $G_{\mathrm{pref}}$ if it's a union of preferred-good sets of a set of buyers $B$, where $|B|>|M|$. Given a particular preference graph $G_{\mathrm{pref}}$ that doesn't contain a perfect matching and a constricted buyer set $B$, an over-demanded set of goods coincides with the neighbor set of $B$, i.e., $N(B)$, where the neighbor set is determined in $G_{\mathrm{pref}}$. Similarly, the under-demanded set of goods $M$ coincides with a constricted good set. \end{dfn} Given a specific price vector, if the preference graph $G_{\mathrm{pref}}$ contains a perfect matching $E_{pm}\subseteq E_{\mathrm{pref}}$, then we can allocate to each buyer exactly one of the goods it prefers and also sell all the goods. A price vector that leads to a perfect matching in the realized preference graph is called a \textbf{market-clearing price (MCP)} (also called a Walrasian price). Given any valuation $V$, it is well known that the set of MCPs is non-empty and bounded \cite{core}. Boundedness is obvious from the finiteness of the valuations. Non-emptiness is established either using the characterization in \cite{core}, using a constructive ascending price algorithm \cite{constructMCP} that starts from all the prices being $0$, or by using the VCG mechanism price (see Chap 15 in \cite{textbook}). Furthermore, the set of MCPs has a lattice structure \cite{core}, so that given any two different MCP vectors, the element-wise maximum of the vectors and the element-wise minimum of the vectors are also MCPs. This guarantees the existence of the maximum and the minimum MCPs. \paragraph{Complexity of Algorithms} An algorithm runs in \textbf{strongly polynomial time} if the number of operations and the space used are bounded by a polynomial in the number of input parameters, i.e., $O(\text{polynomial of }|M|)$, but both do not depend on the size of the parameters (assuming unit time for basic mathematical operations). If this does not hold but the number of operations is still bounded by a polynomial in the number of input parameters where the coefficients depend on the size of the parameters, then we say that the algorithm runs in \textbf{weakly polynomial time}. \section{Related Work} \label{sec:related} While sponsored search auctions are a recent motivation to study matching markets, there is a vast history to the problem. The term ``matching market" can be traced back to the seminal paper ``College Admissions and the Stability of Marriage" work by Gale and Shapley \cite{gale1962}. In matching markets, the necessary and sufficient condition for the existence of an efficient matching using Hall's marriage theorem~\cite{hall} has been proved \cite{gale1960theory} and a widely used mathematical model of two-sided matching markets was introduced in ``The Assignment Game I: The Core" \cite{core} by Shapley and Shubik. In \cite{core}, the set of MCPs is further shown to be solutions of a linear programming (LP) problem and the lattice property is also established. Despite this the study of this problem goes back at least to the well-known strongly polynomial-time Hungarian algorithm \cite{kuhn1955} for finding the maximum weight matching in a weighted bipartite graph, which in fact can also be used to find the minimum MCP. Furthermore, several auction algorithms enhancing the run-time efficiency in markets with specific properties have been presented in \cite{bertsekas1992forward,bertsekas1993reverse}. Leonard \cite{Truth-LP} considered mechanisms with sealed-bids and proved that charging the minimum competitive equilibrium price from bidders will result in an incentive compatible mechanism, and also that MCP coincides with the VCG price. Soon after, an ascending-price-based auction~\cite{krishna} algorithm was presented by Demange, Gale, and Sotomayor (DGS) in \cite{constructMCP}, which starts at the zero-price vector and then increases the posted price for any of the minimal over-demanded sets \cite{gale1960theory} of goods to obtain the minimum MCP. Thereafter, plenty of ascending-price-based auction mechanisms have been studied under different assumptions in \cite{bikhchandani2006, gul2000english, ausubel2004}. We pause here to remind the reader that the DGS ascending price algorithm is only known to be weakly polynomial-time. On the other hand, there has only been a limited study of descending-price auction algorithms to obtain the maximum MCP. Mishra and Parkes present a descending price auction called the Vickrey-Dutch auction to generate the VCG price in equilibrium \cite{mishramulti}. To aim for a higher revenue for sellers, Mishra and Garg generalized the Dutch auction to provide a descending-price-based approximation algorithm in \cite{mishragarg}. As mentioned in Section \ref{sec:intro}, Mishra and Garg's algorithm yields an approximation to the maximum MCP via a weak polynomial-time algorithm, and furthermore, there is no analysis of the strategic bidding in their work. We remark again that the sequential LP approach in \cite{Truth-LP} can be used to obtain the maximum MCP via a weakly polynomial-time algorithm. Finally, there is a body of literature that attempts to raise the revenue of sellers in equilibrium in related problems, such as sponsored search auctions and combinatorial auctions. In sponsored search markets, Ghosh and Sayedi considered a two-dimensional bid on advertisers' valuations according to exclusive and nonexclusive display \cite{ghosh2010expressive}, then run a GSP-like auction to determine the allocation that maximizes the search engine's revenue. With this small variation, efficiency does not hold for GSP, and hence the revenue will be different from the VCG mechanism. Additionally, in combinatorial auctions, it is well-known that designing a revenue maximizing auction mechanism is still an open problem. To achieve a higher expected revenue of sellers, Likhodedov and Sandholm presented a class of auctions, called virtual valuations combinatorial auctions \cite{likhodedov2004methods}, to maximize the sum of a pre-determined weighted valuation and an evaluation function of allocation rather than maximizing the total valuations as in the VCG mechanism to get a higher revenue. \section{Design of Descending Price Algorithm} \label{sec3} The problem considered in our work, as mentioned earlier, is to find the generalization of the Dutch auction\footnote{Despite a similar sounding name, what we seek to implement is completely different from the generalized first price (GFP) auction as in \cite{hoy2013dynamic, Expressiveness}.} to matching markets. Specifically, we seek a descending price auction that always converges to the maximum MCP. Like the DGS mechanism, our mechanism will choose a particular constricted good set to ensure the convergence. Specifically, we will define a dual to the ``minimal over-demanded set" which we call the \textit{maximally skewed set}. Unlike minimal over-demanded sets, the maximally skewed set is unique, and an example of failure to achieve the maximum MCP if this set is not chosen will be discussed in Section \ref{sec6.1}. \subsection{Framework of Descending Price Algorithms}~\label{sec:framework} We design a descending auction, which is the analogue of the ascending auction, in a straightforward framework. We start from a high enough initial price, iteratively pick a constricted good set to decrement prices, and terminate the algorithm when there exists a perfect matching. Clearly, this framework does not guarantee the termination in finite time, let alone strongly polynomial time. In order to make the algorithm run in strongly polynomial time, we will exploit the combinatorial structure of the preference graph, and make the evolution of the preference graph in the run of the algorithm be such that any specific bipartite graph appears at most once. To achieve this goal, we will specify a particular initial configuration, and a particular price reduction to be carried out in each step of the algorithm. \paragraph{Initial Price Choice:} A perfect matching requires every good be preferred by some buyers. Then a reasonable starting point should guarantee that the preferred-buyer set of every good is non-empty, otherwise it cannot be an MCP for any valuation matrix. Thus, the natural candidate for the initial price is $P_j =\max_{i \in \mathcal{M}}v_{i,j}$ for good $j$, which is (element-wise) greater than or equal to any MCP but ensures that every good is preferred by at least one buyer from the very outset. \paragraph{Price Reduction:} In computing the price reduction for a given constricted set $S$, we need to reduce the price by a large enough amount to trigger a change in the preference graph (otherwise we still have a constricting set and the same set of goods can be chosen again), but we should also avoid reducing the price of any good below its price in the maximum MCP. In other words, we want to find the minimum value to compensate the buyers not in the $N(S)$ to make at least one buyer indifferent between one of the goods in $S$ and the good(s) she prefers initially; the buyer in question may have an empty preferred goods set, in which case it is sufficient to ensure that one of the goods in $S$ has a non-negative utility with the price reduction. Lemma \ref{lemA} formally states the price reduction to be used in the proposed family of descending price algorithms. \begin{lem} \label{lemA} Given a constricted good set $S$ and a price vector $\mathbf{P}$, the minimum price reduction of all goods in this set $S$ guaranteeing to add at least a new buyer to the set $N(S)$ is \begin{equation} \underset{i \in B \setminus N(S),l\in S}{\min} \{\underset{k \in M \setminus S}{\max}(v_{i,k}-P_k)- (v_{i,l}-P_l) \}. \end{equation} \end{lem} \begin{figure}[t] \centering \includegraphics[width=0.8\textwidth,height=1in]{./Figures/skewness.pdf} \vspace{-12pt}\caption{Criteria for choosing constricted good sets} \label{fig:skewness} \end{figure} \subsection{Choice of Constricted Good Sets and The Skewness Function} \label{skewfunc} Since different choices of constricted good sets could generate different MCPs when the algorithm terminates, pinpointing the right constricted good sets iteratively has a pivotal role when designing the algorithm for finding the maximum MCP\footnote{Appendix \ref{sec6.1} provides an example where a different choice fails to obtain the maximum MCP.}. Before detailing the selection criterion, we use Figure~\ref{fig:skewness} to provide some quick intuition. On one hand, we prefer choosing the constricted good set in LL to LR because we want to choose the largest good set given the same set of neighbors (buyers). On the other hand, we prefer RL to RR because we do not include any subgraph (set of good-buyer pairs) that already has a perfect matching. With this intuition in mind, we present the following formal criteria for choosing constricted-good sets: \begin{enumerate} \item Pick the constricted goods sets $S$ with the largest difference $|S|-|N(S)|$. \item If there are multiple sets with the same $|S|-|N(S)|$, choose the one with the smallest size. \end{enumerate} The first criterion ensures that at each step the algorithm (simultaneously) reduces the price of the most critical set of goods. The proof that our algorithm returns the maximum MCP will not hold without this property. As an added bonus it also positively impacts the speed of convergence. The second criterion excludes any subset of goods $S'\subset S$ which is already perfectly matched to a subset of buyers, i.e., $|N(S')\setminus N(S)|\geq |S'|$. Jointly the criteria imply that we are searching for the most ``skewed" constricted good set in the preference graph. To formulate this mathematically, we define a function to measure the skewness of a set. \begin{dfn} \label{dfn:skew} The skewness of a set of goods $S$ is defined by function $f:2^\mathcal{M}\setminus {\emptyset} \mapsto R$ with $f(S)=|S|-|N(S)|+\frac{1}{|S|}$ for all $S\subseteq \mathcal{M}$ with $S\neq \emptyset$, where $2^\mathcal{M}$ is the power set of $\mathcal{M}$. \end{dfn} With this skewness function, the criteria described earlier are equivalent to choosing the constricted goods set with the maximal skewness. To formally make this statement we need to show two properties. The first one is the uniqueness of the maximally skewed set when the preference graph has no perfect matching; and the second one is that the maximally skewed set is a constricted goods set when the preference graph has no perfect matching. Lemma~\ref{lem2} proves these. \begin{lem} \label{lem2} Given a bipartite graph with no perfect matching, the maximally skewed set is unique and coincides with the constricted goods set with the maximal skewness. \end{lem} With Lemma \ref{lem2} in place, it easily follows that the two rules we imposed are equivalent to finding the maximally skewed set at every iteration (as we already know that a perfect matching doesn't exist). With the proper initial price vector choice, specified price reduction per round, and the unique choice of the maximally skewed set, the complete algorithm is described in Algorithm \ref{alg:alg1}. Note that the DGS algorithm, which searches for over-demanded sets to increase the price, has a dual structure to our algorithm. Thus, it is not surprising that the minimally over-demanded sets of items in the DGS algorithm, denoted as DGS sets below, have a relationship with the skewness function $f(\cdot)$. They are ones that obtain the minimum positive value of the function $|N(S)|-|S|-\frac{1}{|N(S)|}$ when the algorithm starts with initial price 0. We highlight the fact that the DGS sets may not be unique as there can be multiple sets of goods that yield the same minimum positive value for the function $|N(S)|-|S|-\frac{1}{|N(S)|}$. In contrast to our algorithm, the lack of uniqueness in the DGS algorithm is not as critical because different choices of DGS sets lead to the same minimum MCP. Understanding this contrast better is for future work. \begin{algorithm}[h] \caption{Skewed-set Aided Descending Price Auction} \begin{algorithmic}[1] \Require A $|\mathcal{B}| \times |\mathcal{M}|$ valuation matrix $\mathbf{V}$. \Ensure MCP $\mathbf{P}$. \State Initialization, set the price of good $j$, $P_j=\max_{i \in \mathcal{B}} v_{i,j}$. \State Construct the preference graph. \While{There exists a constricted good set} \State Find the maximally skewed set $\mathbf{S}$. \State For all $j \in \mathbf{S}$, reduce $P_j$ by $\min_{i \in \mathcal{B} \setminus N(\mathbf{S}),l\in \mathbf{S}} \{\max_{k \in \mathcal{M} \setminus \mathbf{S}}(v_{i,k}-P_k)- (v_{i,l}-P_l) \}$. \State Construct the preference graph. \EndWhile \State Return $\mathbf{P}$. \end{algorithmic} \label{alg:alg1} \end{algorithm} \vspace{-12pt} \section{Price Attained, Convergence Rate, and Complexity}\label{correctness} First, we demonstrate that the proposed skewed-set aided descending price auction algorithm returns the maximum MCP. We achieve this by performing a check by adding a fictitious dummy good to the preference bipartite graph at termination. Second, we use the potential function to prove the finite time convergence of the algorithm. Finally, we analyze the complexity of the algorithm by presenting algorithms to find the maximally skewed set. \subsection{Attaining Maximum Market-Clearing Price} In advance of analyzing the relationship between the skew-aided algorithm and the maximum MCPs, we have to precisely characterize the extremal nature of the maximum MCP. Wearing an optimization hat and using the idea of feasible directions, one would expect that checking whether the MCP of any good can be increased or not is straightforward\footnote{There is a history of such variational characterizations in the stable matching literature \cite{immorlica2005marriage,hatfield2005matching} where agents are assumed to have ordinal preferences.}. However, this logic misses the underlying matching problem and the Marriage theorem. Additionally, since the skewed-set aided algorithm is built on the combinatorial structure of the problem, to bridge the maximum MCP to our algorithm requires a combinatorial characterization of the maximum MCP. The combinatorial characterization requires adding a fictitious dummy good to preserve the property. Hence, we have to provide the following definition before stating the variational and combinatorial characterizations of the maximum MCP in Theorem \ref{lem4.1}. \begin{dfn}Given a bipartite graph $G$, let $N_G^D(B)$ be the neighbor set of the buyer set $B$ after adding a dummy good---a good for which every buyer has value 0. If the graph $G$ is clear from the context, we will also simplify the notation further to $N^D(B)$ after adding a dummy good. \end{dfn} \begin{thm} \label{lem4.1} An MCP $P^*$ is the maximum if and only if for any subset of goods, increasing the price of all goods in the set will change the preference graph such that no perfect matching exists. Equivalently, by adding a dummy good, $P^*$ is the maximum if and only if any subset of buyers $B$ has a cardinality strictly less than the cardinality of the set of buyers' neighbors $N^D(B)$. \end{thm} For further clarification, any buyer who has zero surplus at the maximum MCP (by definition of the maximum there will exist at least one such buyer) will be indifferent between the matched good and the dummy good. Hence, for every buyer set $B$ containing a zero-surplus buyer, the dummy good $D$ will be in the neighbor set of this set, $D\in N^D(B)$. We also show a dual property to VCG prices of the maximum MCP in Section~\ref{sec:externality}. With Theorem \ref{lem4.1} in hand, we will now establish the correctness of the algorithm, assuming that it halts (in finite-time). Since the skew-aided algorithm continually changes the preference graph, it is necessary to label the bipartite graph in each round of our algorithm before starting any analysis. Let $G_0$ be the initial bipartite graph, in the running of our algorithm, we obtain a bipartite graph $G_t$ at $t^{th}$ round. Then, we'll need to check whether the terminal condition holds. To avoid cumbersome notation, we will use $N_t^D(B)$ instead of $N_{G_t}^D(B)$. With Theorem \ref{lem4.1}, the proof of Theorem \ref{thm2} followings by checking that the preference graphs at termination coincides has the combinatorial characterization outlined above. \begin{thm} \label{thm2} The skewed-set aided descending-price algorithm always returns the maximum MCP. \end{thm} \subsection{Preference Graphs Converge Quadratically in the Number of Goods} \label{sec4.2} The Algorithm \ref{alg:alg1} changes the preference graph in each round to obtain the bipartite graph with combinatorial structure of MCP at termination. We will now show that the algorithm terminates in at most $m^2$ rounds. Given a specific preference graph $G$, we can define the skewness of the graph $W(G)$ to equal the skewness of the maximally skewed set. Therefore, by defining a sequence $W(G_t)=\max_{S \in \mathcal{M}, S \neq \emptyset} f_t(S)$, where $G_t$ is the preference graph obtained at the $t^{\mathrm{th}}$ iteration of Algorithm \ref{alg:alg1}, we show the convergence of the algorithm in finite rounds by proving that $W(G_t)$ strictly decreases with the decrease at least some positive constant. Thus, $W(\cdot)$ is a potential function that will be shown to strictly decrease in every iteration of the algorithm in the proof of Lemma~\ref{lem:conv}. \begin{lem} \label{lem:conv} For any unit demand matching market with $m>1$ the sequence $\{W(G_t)\}_{t\geq 0}$ of the skewness value of the maximally skewed set in each round of Algorithm \ref{alg:alg1} is strictly decreasing with minimum decrement $\tfrac{1}{m^2-m}$. \end{lem} Given the minimum decrement in Lemma \ref{lem:conv}, it is straightforward that the preference graphs converge to the bipartite graph with combinatorial structure of MCP in time upper bounded by $m^3$ because $W(G)<m$. However, as there are only $m^2$ positive distinct feasible values of $W(G)$ \footnote{Since there are only $m$ possible values of $|S|-|N(S)|$ and $m$ possible values of $\frac{1}{|S|}$.}, we are ensured convergence in time at most $m^2$. \subsection{Complexity of the Algorithm} Based on the results thus far determining the complexity of our algorithm depends only on the run-time of finding the maximally skewed set. We now discuss two approaches for this. \subsubsection{Algorithm design in search of the maximally skewed set} Given the uniqueness, we can always perform a brute-force search to get the maximally skewed set. Since there are $2^m-1$ non-empty subsets of $\mathcal{M}$, the complexity is $O(2^m)$, which doesn't meet our goal. We will exploit the combinatorial structure of the preference graph to scale down the complexity of finding the maximally skewed set. For this we design a graph coloring algorithm to color the preference graphs in Algorithm \ref{alg:alg3}. \begin{dfn} A colored preference graph $G(\mathcal{M},\mathcal{B}, E)$ is an undirected graph that colors each vertex (goods and buyers) in three colors either red, green, or blue; and each edge is colored red or blue. Denote $X_c, X=\{\mathcal{M},\mathcal{B}\}, c=\{r,g,b\}$ to be the set of goods/buyers colored red, green or blue. $E^{gb}_{rb}$ denotes edges connecting goods in $\mathcal{M}_g \cup \mathcal{M}_b$ and buyers in $\mathcal{B}_r \cup \mathcal{B}_b$. \end{dfn} In any colored preference graphs, we want red edges to represent edges connecting matched pairs of good-buyer in a maximum matching, and blue edges to represent the rest of the edges. Hence, each vertex has at most one red edge. Additionally, we want the set of red goods $\mathcal{M}_r$ to represent the set of goods not in the maximally skewed set, the set of blue goods $\mathcal{M}_b$ to be goods in the maximally skewed set but ones that do not have matched pairs to buyers in this maximum matching (because of the nature of constricted good set), and the set of green goods $\mathcal{M}_g$ are the rest of the goods. On the buyer side, the buyers that are neighbors of the maximally skewed set should be colored green, the buyers that are not the neighbors of the maximally skewed set but have a matched good should be colored red, and the rest of the buyers should be colored blue. Given the object we seek, we now present an algorithm to color vertices/edges properly in strongly polynomial-time complexity. The steps will include an initial coloring and followed by an update of the preference graph. Before detailing the initial coloring, we define various depth-first search and breadth-first search procedures relevant to the algorithm. \begin{dfn} A rb-DFS in $G(\mathcal{M},\mathcal{B},E)$ is a depth-first search (DFS) only using red edges from $\mathcal{M}$ to $\mathcal{B}$ and only using blue edges from $\mathcal{B}$ to $\mathcal{M}$. Similarly, a br-BFS in $G(\mathcal{M},\mathcal{B},E)$ is a breadth-first search (BFS) only using blue edges from $\mathcal{M}$ to $\mathcal{B}$ and only using red edges from $\mathcal{B}$ to $\mathcal{M}$. The set of nodes obtained at the end of the procedure will be called the reachable set $Rch(\cdot)$. \end{dfn} \paragraph{Initial Coloring} First, we find a maximum matching using the Hopcroft-Karp algorithm and color edges linked matched pairs red, and other edges blue. After that, we start from the set of good without matched buyer in this maximum matching, color them blue, run the br-BFS algorithm starting from the set of blue goods. When the br-BFS algorithm terminates, color the set of reachable goods $Rch(\mathcal{M}_b)\cap \mathcal{M}$ with matched buyers green, color the rest set of goods red. Then, color the matched buyers of red goods red, color the buyers in the $Rch(\mathcal{M}_b)\cap \mathcal{B}$ green (they are the neighbors of the most skewed set), and color the rest of buyer blue. Finally, the following lemma states that we get the maximally skewed set from the initial coloring. \begin{lem} \label{lem:colorMSS} After the initial coloring, $\{\mathcal{M}_g \cup \mathcal{M}_b\}$ is the maximally skewed set. \end{lem} Given that the Hopcroft-Karp algorithm has complexity $O(m^{2.5})$ and the br-BFS has complexity upper-bounded by $O(m^2)$, we learn the initial coloring has the complexity $O(m^{2.5})$. Note that the initial coloring does not rely on the initial price, our first algorithm, say \textbf{\textit{initial coloring based decreasing price auction}}, will use this in every iteration to get the maximally skewed set. This algorithm has complexity $O(m^2\times m^{2.5})=O(m^{4.5})$, which is already strongly polynomial. \begin{lem} \label{lem:alg2} Given a bipartite graph with no perfect matching, initial coloring returns the maximally skewed set of this bipartite graph in a strongly polynomial run time of $O(m^{2.5})$. \end{lem} \paragraph{Update the preference graph} We further scale down the complexity of the \textbf{\textit{initial coloring based decreasing price auction}} algorithm by exploiting and updating the colored preference graph colored in previous round without completely coloring the whole graph. This is detailed in Algorithm \ref{alg:alg3}. Since the procedure in Algorithm \ref{alg:alg3} is elaborate, we will highlight some facts of perfect matching and give the sketch of how we use them in the Algorithm \ref{alg:alg3}. First, we know that if there is a perfect matching, no vertex should be colored blue otherwise we fail to get a maximum matching. Furthermore, the following Lemma \ref{lem:color} states that we will never need to change a vertex from red or green to blue. \begin{lem} \label{lem:color} If we have to change the color of a vertex from red or green to blue based on interpretation given to the colors, one of the following is true: a) The coloring of previous preference graph is incorrect; b) The price reduction is not optimal; c) One of the updates from the previous preference graph to current graph is wrong. \end{lem} Given the property of a proper coloring stated in Lemma \ref{lem:color}, we know that the set of blue buyers in round $t$, denoted as $\mathcal{B}_b^t$, is a decreasing set. Therefore, the key idea of designing Algorithm \ref{alg:alg3} is to restrict operations irrelevant to reducing the set of blue buyers to some constant number of $O(m^2)$ operations, and to allow the complexity of operations reducing the set of blue buyers to be upper-bounded by $O(m^3)$. To achieve this, we observe that the set of buyers at round $t$ that are willing to get goods in previous maximally skewed set, denoted by $A_t$, only contains red and blue buyers, i.e., $A_t\subseteq \mathcal{B}_r^t \cup\mathcal{B}_b^t$. Then, we know that if $A_t \subseteq \mathcal{B}_r$ and we cannot reach any blue buyers from $A_t$ without passing green or blue goods, then the current matching is maximized, and all we need to do for updating colors is to run rb-BFS from the set of $\mathcal{M}_b$ with complexity $O(m^2)$ as we did in initial coloring. In other cases, we need to find the new maximum matching with number of matched pairs increased by at least 1, which can be achieved by at least $O(m^{2.5})$ using the Hopcroft-Karp algorithm, and at least one blue buyer will be recolored. Since the maximum number of matched pairs is $m$, the complexity of the whole algorithm attaining the maximum MCP will be upper-bounded by the \{(complexity of updating process not recoloring blue buyers)$+$(complexity of computing price reduction)\}$\times$ (convergence rate of the preference graph)$+$(complexity of updating process increasing maximum matched pairs)$\times$ (maximum number of blue buyers)$=O((m^2+m^2)\times m^2+m^{2.5}\times m)=O(m^4)$. \begin{thm} \label{thm1} The skewed-aided descending price algorithm has a strongly polynomial run time of $O(m^4)$ by using Algorithm \ref{alg:alg3} to search the maximally skewed set. \end{thm} \section{Introduction} \label{sec:intro} Online Advertising is an over \$70 billion busines with double-digit growth in consecutive years over a period of many years. Since nearly all of the ads are sold via auction mechanisms, auction-based algorithm design, which focuses on the online advertising, has become an important class of mechanism design to study. Among all online advertising auctions, the sponsored search auction, also known as a keyword auction, is the one that most captures researchers' attention. In a typical sponsored search auction, the auctioneer has a set of web slots to sell and every advertiser has different valuations on different web slots. Problems in sponsored search auctions are usually modeled as problems in (cardinal-preference) matching markets, and prices are used to clear the market. The key assumption of sponsored search auctions is that every advertiser shares the identical ordinal preference on web slots. Under this assumption, the celebrated Vickrey-Clarke-Groves (VCG) mechanism \cite{VCG_V,VCG_C,VCG_G}, which makes truthful bidding by the advertisers as (weakly) dominant strategies but yields low revenue to the auctioneer, is adopted by some web giants such as Facebook\footnote{Facebook Ad Auction: See https://www.facebook.com/business/help/163066663757985.}, and is also a robust option in scenarios where the revenue equivalence theorem~\cite{krishna} holds. However, as the revenue equivalence theorem does not hold in multi-good auctions~\cite{bayes}, auctioneers can look for greater expected revenue than the value obtained by VCG mechanism by using even different efficient and market-clearing auction mechanisms. The most popular auction among these mechanisms is the Generalized Second Price (GSP) auction employed by Google. Since the GSP is not incentive compatible, its equilibrium behavior needs to be analyzed \cite{bayes,caragiannis2015bounding,edelmanstrategic}, and there are some Bayesian Nash equilibria (BNE) \cite{krishna} that have greater expected revenue than the expected revenue of the VCG mechanism. It should also be noted that designing (revenue) optimal mechanisms \cite{myerson1981optimal} is intractable~\cite{cai2012optimal,daskalakis2014complexity} even in the context of matching markets when there is more than one good. Thus, the possibility of higher expected revenue coupled with the ease of implementing the GSP auction and the intractability of optimal mechanisms has lead to the popularity of the GSP mechanism. Unlike a decade ago where there were only statically-listed ads, websites now serve a variety of ads simultaneously, including sidebar images, pop-ups, embedded animations, product recommendations, etc. With this in mind, and the growing heterogeneity in both advertisers and consumers, it is clear that the ``shared ordinal preference'' assumption is untenable in the context of market design. Search engines and ad-serving platforms will be faced with a growing need to implement general unit-demand matching markets~\cite{gale1962}, and such market settings are the focus of our work. We refer to the prices that efficiently allocate the set of goods to the bidders according to their private valuations as a vector of \emph{market-clearing prices} (MCP). An ascending price auction algorithm that generalizes the English auction was presented by Demange, Gale and Sotomayor \cite{constructMCP}. This ascending price algorithm (DGS algorithm) obtains the element-wise minimum MCP, that coincides with the VCG price. DGS is thus incentive compatible yet obtains low expected revenue for the mechanism. Of course, simultaneously maximizing revenue and maintaining incentive compatibility is computationally intractable once we have more than one good for sale, but we should still hope to obtain better than the \emph{minimum} MCP within efficient mechanisms. In the present paper we design a family of mechanisms that seek to elicit the \emph{maximum} MCP from the participants without sacrificing computational efficiency. Here we focus explicitly on how we can efficiently compute the maximum MCP given some representation of the bidder utilities, and defer the general\footnote{Several illustrative instances of Bayesian equilibrium of strategic buyers are discussed in the full version \cite{fullver}. One particular instance explicitly demonstrates an example where our mechanism yields greater expected revenue when compared to the expected revenue of the VCG mechanism.} analysis of strategic behavior to future work. Critical to our paper would be answering whether there exists a strongly polynomial-time algorithm to obtain the maximum MCP exactly. Before discussing the literature for the maximum MCP, we discuss the state of the art for the minimum MCP. The intuitively appealing DGS ascending price algorithm that attains the minimum MCP is only weakly polynomial time: the potential function used to show convergence depends on the valuations; and its value decrements by at least a constant independent of the valuations in each step. In fact, it is the well-known strongly polynomial-time Hungarian algorithm \cite{kuhn1955} for finding the maximum weight matching in a weighted bipartite graph, that yields a strongly polynomial time algorithm for finding the minimum MCP, $O(m^4)$ in the original implementation that can then be reduced to $O(m^3)$~\cite{edmonds1972theoretical}. This will be the aspirational goal of this work. Using the method outlined in \cite{Truth-LP}, where one computes the solution of two linear programs, it is possible to determine the maximum MCP. Note, however, that this is at best a weakly polynomial-time algorithm, and is neither a combinatorial nor an auction algorithm. Given that the DGS ascending price mechanism returns the minimum MCP, it is also intuitive to study descending price mechanisms to obtain the maximum MCP, i.e., generalize the Dutch auction to multiple goods. The first attempt to obtain the maximum MCP through descending price auction is in the work by Mishra and Garg \cite{mishragarg}, where they provide a descending-price-based auction algorithm that yields an approximation algorithm. The algorithm doesn't require agents to bid their whole valuation but still yields a price-vector in weakly polynomial-time\footnote{Again, as the number of iterations depends on both $\epsilon$ and the input valuation matrix.} that is within $\epsilon$ in $l_\infty$ norm of the maximum MCP\footnote{Even though the final price may not be market clearing, decreasing it further by $\epsilon$ and then running the DGS algorithm, it is possible to obtain a market-clearing price that is within $2\epsilon$ of the maximum MCP.}. Therefore, in this work, one of main goals is to develop a strongly polynomial-time combinatorial/auction algorithm using descending prices for the \textit{exact} computation of the maximum MCP. Note that based on the analysis in \cite{position} choosing the maximum MCP in sponsored search markets has exactly the same complexity as the VCG, GSP and Generalized first-price (GFP) mechanisms: The web-slots are sold from best to the worst and in decreasing order of the bids of the agents, with the only difference being the price that's ascribed to each good. Once the computational problem is solved, setting the maximum MCP is a viable option for general unit-demand markets, and is an alternate efficient mechanism. \subsection{Our contribution} By judiciously exploiting the combinatorial structure in matching markets, we propose a strongly polynomial-time\footnote{See Section~\ref{sec:prelims} for a definition of strongly and weakly polynomial-time complexity.} descending price auction algorithm that obtains the maximum MCPs in time $O(m^4)$ with $m$ goods (and bidders). Critical to the algorithm is determining the set of under-demanded goods (to be defined precisely later on) for which we reduce the prices simultaneously in each step of the algorithm. This we accomplish by choosing the subset of goods that maximize a skewness function, which is obtained by proposed graph coloring algorithm a simple combinatorial algorithm to keep updating the bipartite graph and the collection under-demanded goods set. We start by discussing an intuitively appealing algorithm to solve this problem that uses the Hopcraft-Karp~\cite{hopcroft} algorithm and Breadth-First-Search (BFS). This procedure will only yield a complexity of $O(m^{4.5})$. We will then present a refinement that cleverly exploits past computations and the structure of the problem to reduce the complexity to $O(m^4)$. \section{Appendix-Details of Algorithms} \begin{algorithm}[H] \caption{Algorithm in search of the maximally skewed set by coloring preference graph} \begin{algorithmic}[1] \Require A colored preference graph, a set of buyers $A$ would be added to the neighbor of the previous maximally skewed set \Ensure An updated colored preference graph \If {Input preference graph is not colored} \State Run the algorithm for initial coloring \Else \State Update the colored preference graph by removing all edges connecting red goods and green buyers and adding corresponding blue edges connecting goods and buyers in $A$ \While {$\{A\cap\mathcal{B}_b\} \neq \emptyset$} \State Pick an element $a$ in $\{A\cap\mathcal{B}_b\}$ \If {$|N(a) \cap \mathcal{M}_b|>1$} \State Pick arbitrary $x \in \{N(a)\cap \mathcal{M}_b\}$, color $(a,x) \in E$ red and color $a,x$ green. \ElsIf {$|\{N(a) \cap \mathcal{M}_b\}|=1$} \State Let $x$ be the unique good in $\{N(a)\cap \mathcal{M}_b\}$, color $(a,x) \in E$ red and color $a,x$ green. \If{$\{N(a)\cap \mathcal{M}_g\}\neq \emptyset$} \State Run the rb-DFS starting from $x$ in $G(\mathcal{M}_g \cup \mathcal{M}_b,\mathcal{B}_g, E^{gb}_{gb})$ to get a reachable set $Rch(x)$, then color vertice in $Rch(S)$ red if $Rch(x)\cap \mathcal{M}_b = \{x\}$ \Else \State Run the br-DFS starting from $a$ in $G(\mathcal{M}_g \cup \mathcal{M}_b,\mathcal{B}_g, E^{gb}_{gb})$ to get a reachable set $Rch(a)$, then color vertice in $Rch(S)$ red if $Rch(a)\cap \mathcal{M}_b = \{x\}$ \EndIf \ElsIf {$\{N(a) \cap \mathcal{M}_g\} \neq \emptyset$} \State Run the rb-DFS starting from $a$ in $G(\mathcal{M}_g\cup \mathcal{M}_b,\mathcal{B}_g, E^{gb}_{gb})$ till find the first $x \in \mathcal{M}_b$ \State Color $a,x$ green and switch the color of every edge used in a path from $a$ to $x$. \State Start a br-BFS from $\mathcal{M}_b$ in $G(\mathcal{M}_g\cup \mathcal{M}_b,\mathcal{B}_g, E^{gb}_{g})$ to get $Rch(\mathcal{M}_b)$. \State Color every vertex in $\{\mathcal{M}_g \cup \mathcal{B}_g\}\setminus Rch(\mathcal{M}_b)$ red \EndIf \State Remove $a$ from $A$ \EndWhile \State Run the br-BFS starting from $\{\mathcal{M}_g\}$ in $G(\mathcal{M},\mathcal{B}, E)$ to get a reachable set $Rch(S^*)$ \If {$\{Rch(S^*) \cap \mathcal{B}_b\}=\emptyset$} \State Color all vertice in $Rch(S)\setminus \mathcal{M}_b$ green \Else \While{$\{Rch(S^*) \cap \mathcal{B}_b\}\neq\emptyset$} \State Pick $a \in Rch(S^*) \cap \mathcal{B}_b$ and run rb-DFS starting from $a$ to get $Rch(a)$ \If {$\exists x\in Rch(a), x \in \mathcal{M}_b$} \State Color $a,x$ green; switch the color of every edge used in a path from $a$ to $x$ \State Start a br-BFS from $\mathcal{M}_b$ in $G(\mathcal{M}_g\cup \mathcal{M}_b,\mathcal{B}_g, E^{gb}_{g})$ to get $Rch(\mathcal{M}_b)$. \State Color every vertex in $\{\mathcal{M}_g \cup \mathcal{B}_g\}\setminus Rch(\mathcal{M}_b)$ red \EndIf \EndWhile \State Run the br-BFS starting from $\{\mathcal{M}_b\}$ in $G(\mathcal{M},\mathcal{B}_g, E)$ to get $Rch(\mathcal{M}_b)$ \State Color all vertice in $\{\mathcal{M}_g\cup \mathcal{B}_g\}\setminus Rch(\mathcal{M}_b)$ red \EndIf \EndIf \end{algorithmic} \label{alg:alg3} \end{algorithm} \begin{algorithm}[h] \caption{Algorithm for initial coloring} \begin{algorithmic}[1] \Require A preference graph with no perfect matching \Ensure Colored preference graph, the maximally skewed set \State Find a maximum matching by Hopcroft-Karp algorithm \State Color every edges connecting a matched pair red and all other edges blue, Color every vertex in a matched pair red and all other vertice blue \State Starting from $\mathcal{M}_b$, run the rb-BFS to get a reachable set $Rch(\mathcal{M}_b)$ \State Color $Rch(\mathcal{M}_b)\setminus \mathcal{M}_b$ green \end{algorithmic} \label{alg:alg2} \end{algorithm} \section{Appendix-Discussion} \subsection{Importance of Maximally Skewed Set} \label{sec6.1} To highlight the importance of choosing the maximally skewed set in our algorithm, we are starting to ask a natural question: if we run the algorithm twice but choose different constricted good sets at some iterations such that the preference graph produced in every round of these two executions are the same, will we get the same MCP vector? Unfortunately, the answer is no. The choice of the same initial price vector, the same price reduction rule, and the emergence of the same bipartite graph in every round are not enough to guarantee the same returned MCPs. A counterexample is provided in Fig. \ref{fig4}. \begin{figure}[h] \centering \includegraphics[width=0.4\textwidth]{./Figures/constricted.pdf} \caption{Counterexample of same bipartite graph but different set MCPs} \label{fig4} \end{figure} In Fig. \ref{fig4}, the bipartite graphs A-1, B-1 have the same preference graph. Though the chosen constricted good sets in A, B are different, they add the same buyer to the constricted graph. Therefore, the preference graphs in A-2, B-2 are still the same. However, the updated price vector of A-2, B-2 must be different. If A, B choose the same constricted goods set in every round, the returned sets of MCPs of A, B must be different. This example shows that just the bipartite graphs in every round cannot uniquely determine the MCP vector obtained at the termination of the algorithm. Then, we state a stronger claim in Lemma \ref{lem:multicon} that if an algorithm wants to get the maximum MCP, the law of choosing the constricted good set must pick the maximally skewed set at the round before termination. \begin{lem} \label{lem:multicon} Given a descending price algorithm with a specific law of choosing the constricted good set, and assuming this algorithm terminates at round $T_V$ when giving valuation matrix $V$m, if this law may not pick the most skewed set at round $T_V-1$, this algorithm not always return the maximum MCP. \end{lem} However, if a law of choosing the constricted good set pick the maximally skewed on in the last round before termination, the answer of whether it returns the maximum MCP will be case by case. Since Fig. \ref{fig4} provide an example of not achieving the maximum MCP, we now provide an example which still gets the maximum MCP in Fig.~\ref{fig5}. \begin{figure}[h] \centering \includegraphics[width=0.6\textwidth]{./Figures/counterexample.pdf} \caption{Choosing non-maximally skewed set in the middle but get maximum MCP} \label{fig5} \end{figure} In Fig.~\ref{fig5}, the algorithm in upper flow runs the algorithm we proposed and choose maximally skewed set in each round. We pick $\{A,B\}$ in the first iteration and then pick $\{A,B,C\}$ in the second iteration; and the algorithm terminates at $P=[1,1,2]$. The algorithm in lower flow does not choose the maximally skewed set in the first round, but the algorithm is forced to choose the maximally skewed set in the second round because it is the only constricted good set. It picked $\{A,B,C\}$ and lower the price to $[2,2,2]$; and pick $\{A,B\}$ to get a MCP at $[1,1,2]$. As shown in the figure, these two algorithm both return the maximal MCP. Therefore, the space of sets we can choose which guaranteeing to get the maximum MCP is still an open problem. \subsection{Interpretation of the Maximum MCP Using Buyers' Externalities,} Since the minimum posted price derived from DGS algorithm corresponds to the personalized VCG price given by the Clarke pivot rule \cite{VCG_C}, it is not surprising that there is an analogous structure between the posted price and the personalized price also for the maximum MCP. The Clarke pivot rule determines the VCG payment of buyer $i$ using the externality that a buyer imposes on the others by her/his presence, i.e., payment of buyer $i=$ (social welfare\footnote{Social welfare is defined as the sum of buyers' surplus plus the sum of goods' prices, which is the same as the sum of each buyer's value on her matched good.} of others if buyer $i$ were absent) - (social welfare of others when buyer $i$ is present). Using the combinatorial characterization of the maximum MCP, we obtain an exact analogue of the Clarke pivot rule when viewing the maximum MCP as the personalized price in Theorem~\ref{thm:externality}. In the theorem below we can use any perfect matching to determine the good matched to buyer $i$. \begin{thm} \label{thm:externality} Under the maximum MCP, the price that buyer $i$ pays is (social welfare of the current market adding a duplicate pair of buyer $i$ and its matched good) - (social welfare of the current market adding a duplicate buyer $i$). This price is the same as the decrease in social welfare that results by removing the good matched to buyer $i$. \end{thm} \section{Appendix-Preliminary Analysis of Strategic Buyers and\\ Bayesian-Nash Equilibrium} \label{sec5} As mentioned in the introduction, the proposed descending price algorithm is not incentive compatible so that we need to explore Bayesian Nash equilibrium (BNE) to predict buyers' strategic behaviors. From the messaging viewpoint we will assume that we have a direct mechanism where the buyers bid their valuation: a scalar in sponsored search markets, and a vector in the general matching market. Algorithm \ref{alg:alg1} is then applied as a black-box to the inputs to produce a price on each good and a perfect matching. Although the strategic behavior of buyers is not the main subject of this work, with expected revenue being an important concern, we provide an instance achieving higher expected revenue than VCG mechanism in a BNE with asymmetric distributions of buyers' valuations. Furthermore, we analyze the BNE in two simple cases with symmetric buyers and the associated bidding strategy of the buyers. \subsection{An Instance Achieving higher expected revenue than VCG}\label{sec:greatRev} Given the proposed algorithm, it is important to check if there exists a scenario that our algorithm can achieve a higher revenue than the VCG mechanism. It is well-known that the revenue equivalence theorem holds with an assumption that valuation of every player is drawn from a path-connected space in Chap. 9.6.3 of \cite{SSMbook}\footnote{Two other assumptions are (1) both mechanisms implement the same social welfare function; (2) for every player $i$, there exists a type that the expected payments are the same in both mechanisms}. Furthermore, there's a large body of literature that has discussed the failure of getting the VCG revenue under asymmetric distribution of buyers' valuations, e.g., see \cite{VCGfailure}. With this knowledge, we demonstrate a $3\times 3$ matching market where our mechanism achieves higher than VCG revenue, where the buyers have asymmetric distributions of their valuations. Consider three advertisers named Alice, Bob, and Carol, and three different types of ads called listing ads, sidebar ads, and pop-ups. The realized valuation is only known to the advertiser (equivalently buyer), but the distribution of an advertisers' valuation is known to other advertisers but not the auctioneer. In other words, the auctioneer can only calculate the price according to the bids submitted by the advertisers. The minimum increment of the submitted bids is $\epsilon$, which is a positive infinitesimal, and the valuation matrix of advertisers is displayed in Table \ref{tbl:1}. \begin{table}[h] \centering \caption{Valuation matrix of advertisers} \label{tbl:1} \begin{tabular}{|l|l|l|l|} \hline & Listing & Sidebar & Pop-ups \\ \hline Alice & w & 0 & 0 \\ \hline Bob & x & 0 & 0.5 \\ \hline Carol & y & z & 2 \\ \hline \end{tabular} \\ \begin{tabular}{|ll|} \hline Probability density function of $w,x,y,z$ &\\ \hline $f_w(w)=\begin{cases} \frac{2}{3} &~w\in [0,1) \\ \frac{1}{3} &~w\in (2,3] \\ 0 &~\text{o/w} \end{cases} $ & $f_x(x)=\begin{cases} \frac{2}{3} &~x\in [1.5,2.5] \\ \frac{1}{3} &~x\in (2.5,3.5] \\ 0 &~\text{o/w} \end{cases}$ \\ $f_y(y)=\begin{cases} 2 &~y\in [3.5,4] \\ 0 &~\text{o/w} \end{cases}$ &$f_z(z)=\begin{cases} 1 &~z\in [3,4] \\ 0 &~\text{o/w} \end{cases} $ \\ \hline \end{tabular} \end{table} Now, we give an asymmetric BNE\footnote{There need not be a unique equilibrium.} in this matching market and provide a detailed verification in the Appendix \ref{asymBNE}. First, consider Alice always bids 0 on sidebar ads and pop-ups, and bids $\max \{1-\epsilon, \frac{w}{2}\}$ on listing ads. The best response of Bob is to bid 0 on both sidebar ads and pop-ups, and to bid $\max \{1, \frac{x-0.5}{2}\}$ on listing ads for any realized $x$. Now, given Bob's bidding function as above, one of Alice's best responses is to follow her original bidding function. Last, consider the bidding function of Alice and Bob mentioned above, a best response of Carol is to bid 0 on listing ads and pop-ups, and to bid $\epsilon$ on sidebar ads regardless of the outcomes of $y$ and $z$. \footnote{The $\epsilon$ is designed to avoid complex tie-breaking rules.}, even if $y>z$. This is because Carol will never win listing ads for any bids less than $1$ as the probability $\text{Pr}\{y-z \geq 1\}=0$. Now, given Carol's bidding strategy, Alice and Bob will not change their bidding functions. Therefore, the strategy $\{\beta_{Alice}(w,0,0), \beta_{Bob}(x,0,0.5),\beta_{Carol}(y,z,2)\}=\{(\max \{1-\epsilon, \frac{w}{2}\},0,0), (\max \{1, \frac{2x-1}{4}\},0,0),(0,\epsilon,0)\}$ can be verified as an asymmetric BNE. With the asymmetric BNE in hand, we want to calculate the expected revenue of the auctioneers and compare it with the expected revenue of the VCG mechanism. Since Carol always wins the sidebar ads and both Alice and Bob bid 0 on that, Carol will pay $\epsilon$. Additionally, in the asymmetric BNE, Alice and Bob compete on the listing ads and both bid 0 on sidebar ads and pop-ups, resulting in the payment of listing ads to be the same as the payment in the first price auction. Next, let's calculate the expected revenue of auctioneers, which is given by \begin{eqnarray} &&\epsilon+\frac{4}{9}\int_0^1\int_{1.5}^{2.5} 1 dxdw+\frac{2}{9}\int_2^3\int_{1.5}^{2.5} \frac{w}{2} dxdw+\frac{2}{9}\int_1^2\int_{2.5}^{3.5} \frac{2x-1}{4} dxdw \nonumber \\&+&\frac{1}{9}\int_2^3\int_{2.5}^{w+0.5} \frac{w}{2} dxdw+\frac{1}{9}\int_{2.5}^{3.5}\int_2^{x-0.5} \frac{2x-1}{4} dwdx =\dfrac{31}{27}+\epsilon \end{eqnarray} The last step is to calculate the expected revenue of the VCG mechanism, which is given by \begin{eqnarray} &&\frac{2}{3}\int_0^1\int_{1.5}^{2.5} w dxdw+\frac{2}{9}\int_2^3\int_{1.5}^{2.5} (x-0.5) dxdw+\frac{1}{9}\int_{2.5}^{3.5}\int_2^{x-0.5} w dwdx \nonumber \\&+&\frac{1}{9}\int_2^3\int_{2.5}^{w+0.5} (x-0.5) dxdw =\dfrac{1}{3}+\dfrac{2}{9}\times \dfrac{3}{2}+\dfrac{1}{9}\times \dfrac{7}{6}++\dfrac{1}{9}\times \dfrac{7}{6}=\dfrac{25}{27} \end{eqnarray} Even if we set $\epsilon$ to 0, it is obvious that the expected revenue derived under our descending price auction algorithm is strictly greater than the expected revenue of the VCG mechanism. This shows that in some instances the proposed descending price algorithm is preferred to the (DGS) ascending price algorithm, even taking the strategic behavior of buyers into account. \subsection{Symmetric Bayesian Nash Equilibrium in $2\times 2$ Sponsored Search Market} Now we focus on the analysis of symmetric distributions of buyers. Next we will detail the analysis of two cases for a market with two goods and two buyers, one in the following paragraphs and another one in the next subsection. Since the primary application of our algorithm is in online advertising auctions, it is useful for us to analyze the strategic behavior under the conventional assumptions made in the sponsored search market setting. The sponsored search market assumes every buyer's (advertiser's) value on goods (web slots) can be determined by a product of the buyer's private weight and a common click-through rate. Now, we consider a $2 \times 2$ case in sponsored search market with settings detailed below. There are two web slots with click-through rates $c_1$ and $c_2$, with $c_1\geq c_2$, and two advertisers with private weights $w_1, w_2$. We assume that $w_j$ is an \emph{i.i.d.} non-negative random variable with PDF $f_{w_j}(\cdot)$, and the private value for getting web slots $j$ is $w_ic_j$. Each advertiser knows his/her true weight but only knows the distribution of another advertiser's value, and both know that it is a sponsored search market. Under our descending price auction algorithm, they each have to effectively place a one-dimensional bid, denoted by $b_i$, according to their bidding function $\beta_j(w_j,f_{w_{-j}}(\cdot))$, where ${-j}$ denotes the other advertiser(s). To simplify the analysis, we assume weights $w_1, w_2$ are uniformly distributed in $[0,1]$. Extensions to other symmetric distributions, asymmetric distribution/knowledge space and more web slots are all for future work. \subsubsection{Payment of advertisers} If $c_2=0$, the descending price algorithm terminates at the initial point. At this point, the advertiser $j$ wins the first web slots pays $c_1w_j$ and another advertiser pays $0$. This is, equivalent, to the single good case, which has been carefully studied before. When $c_2 \neq 0$, the descending price algorithm makes the advertiser indifferent between two slots if he/she bid truthfully. Therefore, if advertiser $i$ wins the first slot, the payment will be $(c_1-c_2)b_i+c_2b_{-i}$, if he/she gets the second slot, the payment will be $c_2b_i$. \subsubsection{Analysis of strategic behavior} Before deriving the bidding function, we show that the bidding function is a monotonic increasing function of the weight. Since the outcome of this auction is exactly the same as what the VCG mechanism provides, this monotonicity leads us to expect revenue equivalence to hold in this case. Exploring the generality of this result is for future work. \begin{lem} \label{lem:mono} The bidding function is monotonically increasing in the $2\times 2$ sponsored search market. \end{lem} \begin{proof} See Appendix \ref{pf:lem:mono}. \end{proof} This monotonicity property of bidding functions can be generalized to all sponsored search markets when every advertiser's private weight follows the same uniform distributions. \begin{cor} \label{cor:mono} In sponsored search markets with a symmetric uniform distribution of every advertiser's weight, the bidding function is monotonic and the allocation is always efficient. \end{cor} \begin{proof} See Appendix \ref{pf:cor:mono}. \end{proof} Without loss of generality, we now derive the bidding function of advertiser 1. Since the optimal bidding function is monotonic in the private value, the surplus function of advertiser 1 can be written using an integral form. Advertiser 1 wants to maximize the following surplus function\footnote{In this two advertisers case, for advertiser 1, $f_{w_{-1}}(\cdot)=f(w_2)(\cdot)$ and $\beta_{-1}(\cdot)=\beta_{2}(\cdot)$.}: \begin{eqnarray} \int_0^{\beta_2^{-1}(b_1)}(c_1w_1-[(c_1-c_2)b_1 +c_2\beta_2(x)])f_{w_2}(x)dx +c_2(w_1-b_1)[1-\int_0^{\beta_2^{-1}(b_1)}f_{w_2}(x)dx] \end{eqnarray} With detailed analysis presented in Appendix \ref{apdx:analysis}, the bidding function $\beta_1(w_1)$ is \begin{eqnarray} \begin{cases} e^{-w_1}+w_1-1 \qquad \qquad \qquad \qquad \qquad \qquad ~~~c_1=2c_2 \\ w_1-(2-w_1)\ln(1-0.5w_1) \qquad \qquad \qquad ~~~~c_1=1.5c_2 \\ \dfrac{c_2}{2c_1-3c_2}\Big[(c_1-c_2)w_1+\big(\dfrac{c_2}{c_2+(c_1-2c_2)w_1}\big)^{\tfrac{c_1-c_2}{c_1-2c_2}}-1\Big] \\ \nonumber \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \text{otherwise} \nonumber \end{cases} \end{eqnarray} Without loss of generality, we can let $c_1=1$ and $c_2 \in [0,1]$, Figure \ref{fig5} displays the optimal bidding bid corresponds to the buyer's private weight and the ratio of click-through rates. \begin{figure}[h] \centering \includegraphics[width=0.6\textwidth]{./Figures/weight-bid.jpg} \caption{Optimal bidding function of the symmetric BNE in $2 \times 2$ sponsored search markets} \label{fig5} \end{figure} Then, the expected revenue of the search engine is \begin{eqnarray} &&2\bigg\{\int_0^1\int_0^{w_1}([(c_1-c_2) \beta_1(w_1)+c_2 \beta_1(w_2)])dw_2dw_1 +\int_0^1\int_0^{w_2}c_2\beta_1(w_2)dw_1dw_2 \bigg\} \nonumber\\ &=& 2\bigg\{(c_1-c_2)\int\limits_0^1 w_1\beta_1(w_1)dw_1+2c_2\int\limits_0^1\int\limits_0^{w_1}\beta_1(x)dxdw_1 \bigg\} =\begin{cases} \frac{c_2}{3}&~c_1=2c_2 \\ \frac{c_2}{6}&~c_1=1.5c_2 \\ \frac{c_1-c_2}{3} &~\text{otherwise} \nonumber \end{cases} \end{eqnarray} It is well known that in the VCG mechanism, the expected VCG revenue is $\dfrac{c_1-c_2}{3}$. Therefore, in this $2\times 2$ case, the proposed algorithm has the same expected revenue as the VCG mechanism after taking the strategic behavior into consideration. \subsection{Symmetric Bayesian Nash Equilibrium in $2\times 2$ General Unit-demand Matching Markets} Theoretically, the same method we used to studied the $2\times 2$ case of a sponsored search market can be used to solve the $2\times 2$ case for a general matching market when valuations are assumed to be \emph{i.i.d.}. However, that method requires us to consider two variables simultaneously, and we cannot avoid solving the resulting partial differential equations. Hence, before directly solving the general $2\times 2$ cases, we present the following lemmas to simplify the analysis afterward. \begin{lem} \label{lem_2g1} In a general $2\times 2$ matching market, any strategy placing non-zero bids on both goods is a weakly-dominated strategy of a rational buyer with non-zero valuation on goods. \end{lem} \begin{proof} Please see Appendix \ref{sec:lem_2g1}. \end{proof} \begin{lem} \label{lem_2g2} If $v_{i1}>v_{i2}$, any bidding strategy of buyer $i$ with $b_{i1}<b_{i2}$ is a weakly dominated strategy. \end{lem} \begin{proof} Please see Appendix \ref{sec:lem_2g2}. \end{proof} With the above two lemmas, the following corollary is straightforward. \begin{cor} Consider a rational buyer $i$, any bidding strategy putting non-zero bid on the good with private value lower than another good is a weakly-dominated strategy. \end{cor} Now, we can get rid of all weakly-dominated strategies to analyze the buyer's strategic behavior to find a symmetric Bayesian Nash Equilibrium. It is worth to note that weakly-dominated strategies can still be rationalizable strategies, our approach (analyzing Bayesian Nash equilibrium(BNE) without taking weakly-dominated strategies into consideration) may miss some BNEs. Our current goal is not to find all BNEs but just one. Therefore, we can continue to find a BNE with restricted strategy space. First, assume $v_{i1}\geq v_{i2}$ without loss of generality, a rational buyer $i$ will bid 0 on the good 2, and bid no more than $v_{11}-v_{12}$ on good 1. Then, we can compute the equilibrium in symmetric bidding strategies. Assume the symmetric bidding function is $\beta(\cdot,\cdot)$ for the good with higher value and 0 for the other one, buyer $i$ bids $b$ on good 1 and the CDF of buyer $-i$'s valuation on good $j$ is $F_{-ij}(\cdot)$, the objective function is \begin{eqnarray} \max_b E_{(v_{-i1},v_{-i2})} [u_i(b,0,\beta\mathbf{1}_{\{v_{-i1}>v_{-i2}\}},\beta\mathbf{1}_{\{v_{-i1}\leq v_{-i2}\}})], \end{eqnarray} where $\beta$ denotes $\beta(v_{-i1},v_{-i2})$. Now, we need Lemma \ref{pro1} to simplify our analysis. \begin{lem} \label{pro1} Denote $v_{ih}$ to be the buyer $i$'s value of the good that has higher value and $v_{il}$ be the buyer $i$'s value of good that has lower value, an optimal bidding function of the higher good $\beta(v_{ih},v_{il})$ is monotonic in $v_{ih}-v_{il}$. \end{lem} \begin{proof} Please see Appendix \ref{sec:pro1}. \end{proof} With Lemma \ref{pro1}, we can revise and simplify the bidding function $\beta(v_{ih},v_{il})$ to be $\beta_{r}(v_{ih}-v_{il})$. Define the joint CDF of $v_{-i1}-v_{-i2}$ to be $F_{-i}(\cdot)$. Then the expected surplus of buyer $i$ for a specific bid $b$ of good 1 is: \begin{eqnarray} (v_{i1}-b)F_{-i}(\beta_r^{-1}(b))+v_{i2}(1-F_{-i}(\beta_r^{-1}(b))) =v_{i2}+(v_{i1}-v_{i2}-b_{i1})F_{-i}(\beta_r^{-1}(b)) \end{eqnarray} Therefore, determining the objective function is equivalent to solving the following optimization problem: \begin{eqnarray} \max_b ~(v_{i1}-v_{i2}-b)F_{-i}(\beta_r^{-1}(b)). \end{eqnarray} To simplify our problem, let's assume the distributions of private value on goods of two buyers are i.i.d. uniformly distributed on $[0,1]$. Then assume that the bidding function is differentiable and denote $x=v_{i1}-v_{i2}$. Using the same technique we used to solve the symmetric BNE in sponsored search market. With the analysis in Appendix \ref{apdx:analysis2}, the bidding function $\beta_r(x)$ is \begin{eqnarray} \beta_r(x)= \dfrac{1}{2-(1-x)^2}\int_0^{x} 2\tau(1-\tau)d\tau =\dfrac{x^2(1-\tfrac{2x}{3})}{2-(1-x)^2} \end{eqnarray} Then, the expected revenue is \begin{eqnarray} 4\int_0^1 \beta_r(x)(1-x)(\frac{1}{2}+x-\frac{x^2}{2}) dx =2\int_0^1 x^2(1-\tfrac{2x}{3})(1-x) dx = 2(\dfrac{1}{3} - \dfrac{5}{12} + \dfrac{2}{15})= \dfrac{1}{10} \end{eqnarray} Finally, computing the expected revenue with VCG price yields: \begin{eqnarray} 4\int_0^1 (1-x)\int_0^x y(1-y) dydx = 4\int_0^1 (1-x)(\dfrac{x^2}{2}-\dfrac{x^3}{3}) dx = 4 ( \dfrac{1}{6}- \dfrac{5}{24}+\dfrac{1}{15}) = \dfrac{1}{10} \end{eqnarray} It is shown here that the revenue equivalence theorem continues to hold in this case. \section{Appendix-Proofs} \subsection{Proof of Lemma \ref{lemA}}\label{pf:lem1} First, we will show that given a constricted good set $S$, reducing price of every good in $S$ with the amount specified in the statement will increase the size of its neighbor, i.e., $N(S)$. Given a constricted good set $S$ under a specific price vector $\mathbf{P}$. Consider another price vector $\mathbf{P'}$, $P'_j=\begin{cases} P_j , & j \notin S \\ P_j-c, & j \in S \end{cases} $ , where $c:=\min_{i \in \mathcal{B} \setminus N(S),l\in S} \{\max_{k \in \mathcal{M} \setminus S}(v_{i,k}-P_k)- (v_{i,l}-P_l) \}$. For some $j \in S$, there must exists an $i\in \mathcal{B} \setminus N(S)$ satisfying $v_{i,j}-P_j'= \max_{k \in \mathcal{M} \setminus S} v_{i,k}-P_k$. Now, by an abuse of notation to denote $N'(S)$ as the neighbor of $S$ under $P'$, $i \in N'(S)$. For those $l \in N(S)$, $\max_{j \in S}v_{l,j}-P'_j>\max_{j \in S}v_{l,j}-P_j\geq \max_{j \in \mathcal{M}\setminus S}v_{l,j}-P_j$ implies $l \in N'(S)$. Therefore, $|N(S)|<|N'(S)|$. Then, we need to prove that $c$ is the minimum decrement. Consider another price vector Consider another price vector $\mathbf{P''}$, $P'_j=\begin{cases} P_j , & j \notin S \\ P_j-d, & j \in S \end{cases} $, where $d<c$. It is straightforward that for all $i \in \mathcal{B} \setminus N(S)$, $v_{i,j}-P''_j< v_{i,j}-P_j+c \le \max_k (v_{i,k}-P_k)$. Hence, no buyers will be added to the $N(S)$. Now, it is clear that $\min_{i \in \mathcal{B} \setminus N(S),l\in S} \{\max_{k \in \mathcal{M} \setminus S}(v_{i,k}-P_k)- (v_{i,l}-P_l) \}$ is the minimum price reduction which guarantees to add at least a new buyer to the $N(S)$. \subsection{Proof of Lemma \ref{lem2}}\label{pf:lem2} In order to prove the statement, we start from showing the most skewed set is always a constricted good set when there is no perfect matching. Then, we prove the uniqueness of the most skewed set by contradiction. When there is no perfect matching, there must exists a constricted good set. By definition, the constricted good set $S$ has the property $|S|>|N(S)|$. Since $|S|$, $|N(S)|$ are integers, the skewness of a constricted good set \begin{equation} \label{eq1} f(S)=|S|-|N(S)|+\frac{1}{|S|} \geq 1+\frac{1}{|S|} >1. \end{equation} Then, for any non-constricted good set $S'$, $|S'| \leq |N(S')|$. The skewness of $S'$ is \begin{equation} \label{eq2} f(S')=|S'|-|N(S')|+\frac{1}{|S'|} \leq 0+\frac{1}{|S'|} \leq 1. \end{equation} With equation (\ref{eq1}), (\ref{eq2}), the skewness of a constricted good set is always greater than any non-constricted good sets. Therefore, if a preference graph exists a constricted good set, the most skewed set is always a constricted good set. Then, we start to prove the uniqueness of the most skewed set. Suppose there exists two disjoint sets $S_1$, $S_2$ and both sets are the most skewed sets, i.e., $f(S_1)=f(S_2)= \max_{S \subset \mathcal{M}, S \neq \emptyset} f(S)$. Consider the skewness of the union of $S_1$ and $S_2$. \begin{eqnarray} &&f(S_1 \cup S_2) \\ &=& |S_1 \cup S_2|- |N(S_1 \cup S_2)|+ \frac{1}{|S_1 \cup S_2|} \\ &=& |S_1|+ |S_2| - |N(S_1) \cup N(S_2)|+ \frac{1}{|S_1 \cup S_2|} \\ &\geq & |S_1|+ |S_2| - |N(S_1)|- |N(S_2)|+ \frac{1}{|S_1 \cup S_2|} \\ &=& f(S_1)+ |S_2|- |N(S_2)| -\frac{1}{|S_1|}+\frac{1}{|S_1 \cup S_2|} \label{eq3}\\ &\geq & f(S_1) +1 -\frac{1}{|S_1|}+\frac{1}{|S_1 \cup S_2|} > f(S_1) \label{eq4} \end{eqnarray} From (\ref{eq3}) to (\ref{eq4}) is true because $S_2$ is a constricted good set. (\ref{eq4}) contradicts our assumption that $S_1$, $S_2$ are the most skewed set. Therefore, we know that if there exists multiple sets share the same highest skewness value, these sets are not disjoint. Now, suppose there exists two sets $S_1$, $S_2$ satisfying that $S_1 \cup S_2 \neq \emptyset$ and both sets are the most skewed sets, the following two inequalities must hold: \begin{eqnarray} f(S_1)-f(S_1 \cup S_2) \geq 0 \\ f(S_2)-f(S_1 \cap S_2) \geq 0 \end{eqnarray} Let's sum up the two inequalities and represent the formula in twelve terms. \begin{eqnarray} &&f(S_1)+f(S_2) - f(S_1 \cup S_2)-f(S_1 \cap S_2) \\ &=& |S_1|+|S_2|-|S_1 \cup S_2|-|S_1 \cap S_2| \nonumber \\ && +|N(S_1 \cup S_2)|+ |N(S_1 \cap S_2)|- |N(S_1)|-|N(S_2)| \nonumber \\ && +\dfrac{1}{|S_1|}+\dfrac{1}{|S_2|}-\dfrac{1}{|S_1 \cup S_2|}-\dfrac{1}{|S_1 \cap S_2|} \end{eqnarray} The first four terms $|S_1|+|S_2|-|S_1 \cup S_2|-|S_1 \cap S_2|=0$. Using the similar argument, $|N(S_1)|+|N(S_2)|=|N(S_1) \cap N(S_2)|+|N(S_1) \cup N(S_2)|$. \begin{eqnarray} |N(S_1 \cup S_2)|=|N(S_1) \cup N(S_2)| \\ |N(S_1 \cap S_2)| \leq |N(S_1) \cap N(S_2)| \label{eq5} \end{eqnarray} Equation (\ref{eq5}) is true because there may exist some elements in $S_1 \setminus S_2$ and $S_2 \setminus S_1$ but have common neighbors. Thus, the second four terms are smaller than or equal to $0$. To check the last four terms, let $|S_1|=a$, $|S_2|=b$, and $|S_1 \cap S_2|=c$, where $c<\min\{a,b\}$ because $S_1,S_2$ are not disjoint. The last four terms are \begin{eqnarray} &&\dfrac{1}{|S_1|}+\dfrac{1}{|S_2|}-\dfrac{1}{|S_1 \cup S_2|}-\dfrac{1}{|S_1 \cap S_2|} \\ &=& \dfrac{1}{a}+\dfrac{1}{b}-\dfrac{1}{a+b-c}-\dfrac{1}{c} \\ &=& \dfrac{a+b}{ab}-\dfrac{a+b}{(a+b-c)c} \\ &=& \dfrac{a+b}{abc(a+b-c)}(ac+bc-c^2-ab) \\ &=&-\dfrac{(a+b)(a-c)(b-c)}{abc(a+b-c)}<0 \end{eqnarray} To conclude, the first four terms are $0$, the second four terms are smaller than or equal to $0$, and the last four terms are strictly negative make \begin{eqnarray} f(S_1)+f(S_2) - f(S_1 \cup S_2)-f(S_1 \cap S_2)<0. \end{eqnarray} Therefore, at least one of set $S_1 \cup S_2$, $S_1 \cap S_2$ has the skewness value greater than $f(S_1)=f(S_2)$, which leads to a contradiction that $S_1$ and $S_2$ are the most skewed set. Finally, we can claim that the most skewed set is unique when there is no perfect matching. \subsection{Proof of Lemma \ref{lem:conv}}\label{pf:lem:conv} First, we prove that the algorithm terminates in finite (at most $|\mathcal{M}|^3$) rounds by investigating the relationship of the most skewed sets in the consecutive rounds, $S^*_t$, $S^*_{t+1}$. The relationship of $S^*_t$, $S^*_{t+1}$ has four cases. \begin{enumerate} \item $S^*_t=S^*_{t+1}$ \item $S^*_t \subset S^*_{t+1}$ \item $S^*_t \supset S^*_{t+1}$ \item $S^*_t \nsubseteq S^*_{t+1}$ and $S^*_t \nsupseteq S^*_{t+1}$ \end{enumerate} Recall that $W(G)$ is the skewness of the graph $G$ and $N_t(S)$ is the neighbor of $S$ based on the preference graph at round $k$. \\ In case 1, $W(G_t)-W(G_{t+1})=f_t(S^*_t)-f_{t+1}(S^*_{t+1})=f_t(S^*_t)-f_{t+1}(S^*_t)\geq 1$. \\ In case 2, define $S'=S^*_{t+1}\setminus S^*_t$, and it is trivial that $S^*_t \subset S^*_{t+1}$ implies $1>\frac{1}{|S^*_t|}-\frac{1}{|S^*_{t+1}|}>0$. \begin{eqnarray} &&W(G_t)-W(G_{t+1})=f_t(S^*_t)-f_{t+1}(S^*_{t+1})\\ &=&|S^*_t|-|N_t(S^*_t)|-|S^*_{t+1}|+|N_{t+1}(S^*_{t+1})| +\dfrac{1}{|S^*_t|}-\dfrac{1}{|S^*_{t+1}|} \label{eq6}\\ &\geq &|S^*_{t+1}|-|N_t(S^*_{t+1})|-|S^*_{t+1}|+|N_{t+1}(S^*_{t+1})|+\dfrac{1}{|S^*_t|}-\dfrac{1}{|S^*_{t+1}|} \label{eq7}\\ &=&|N_{t+1}(S^*_t \cup S')|-|N_t(S^*_{t+1})|+\frac{|S^*_{t+1}|-|S^*_t|}{|S^*_t||S^*_{t+1}|} \nonumber \\ &\geq &|N_{t+1}(S^*_t \cup S')|-|N_t(S^*_{t+1})| + \dfrac{1}{|\mathcal{M}|(|\mathcal{M}|-1)} \label{eq8}\\ &=&|N_{t+1}(S^*_t)|+|N_{t+1}(S')\cap N_{t+1}(S^*_t)^c| -|N_t(S^*_{t+1})|+ \dfrac{1}{|\mathcal{M}|^2-|\mathcal{M}|} \label{eq9}\\ &=&|N_t(S^*_t)|+|N_{t+1}(S_t)\setminus N_t(S^*_t)|- |N_t(S^*_{t+1})| +|N_{t+1}(S')\cap N_{t+1}(S^*_t)^c|+ \tfrac{1}{|\mathcal{M}|^2-|\mathcal{M}|} \label{eq10} \end{eqnarray} Before going to further steps, we have to briefly explain the logic behind the above equations. (\ref{eq6}) to (\ref{eq7}) is true because $N_t(S^*_t) \subseteq N_t(S^*_{t+1})$. (\ref{eq8}) to (\ref{eq9}) is to expand $|N_{t+1}(S^*_t \cup S')|$ to $|N_{t+1}(S^*_t)|+|N_{t+1}(S')\cap N_{t+1}(S^*_t)^c|$. (\ref{eq9}) to (\ref{eq10}) is to expand $|N_{t+1}(S^*_t)|$ to $|N_t(S^*_t)|+|N_{t+1}(S_t)\setminus N_t(S^*_t)|$. Since $|N_{t+1}(S')\cap N_{t+1}(S^*_t)^c|=|N_{t+1}(S')\cap N_{k}(S^*_t)^c|-|N_{t+1}(S')\cap (N_{t+1}(S_t)\setminus N_t(S^*_t))|$, and $|N_{t+1}(S_t)\setminus N_t(S^*_t)|\geq |N_{t+1}(S')\cap (N_{t+1}(S_t)\setminus N_t(S^*_t))|$, we can further summarize the first four terms in (\ref{eq10}). \begin{eqnarray} &&|N_t(S^*_t)|+|N_{t+1}(S_t)\setminus N_t(S^*_t)| +|N_{t+1}(S')\cap N_{t+1}(S^*_t)^c| - |N_t(S^*_{t+1})| \\ &\geq & |N_t(S^*_t)|+|N_{t+1}(S')\cap N_{k}(S^*_t)^c| -|N_t(S^*_{t+1})|\\ &=& |N_t(S^*_t)|+|N_{t+1}(S')\cap N_t(S^*_t)^c| -|N_t(S^*_t)|-|N_t(S')\cap N_t(S^*_t)^c| \\ &=& |N_{t+1}(S')\cap N_t(S^*_t)^c|-|N_t(S')\cap N_t(S^*_t)^c| \label{eq32} \\ &=& |N_t(S')\cap N_t(S^*_t)^c|-|N_t(S')\cap N_t(S^*_t)^c|=0 \label{eq33} \end{eqnarray} (\ref{eq32}) to (\ref{eq33}) is true because $S'$ is not in $S^*_t$, the neighbor of $S'$ not in the neighbor of $S^*_t$ remains the same from $k$ to $t+1$ round. With equation (\ref{eq10}) and (\ref{eq33}), we can conclude that $W(G_t)-W(G_{t+1})\geq \frac{1}{|\mathcal{M}|^2-|\mathcal{M}|}$ in case 2.\\ \\ In case 3, since every elements in $S^*_t$ belongs to $S^*_t$, $f_t(S^*_{t+1}) \geq f_{t+1}(S^*_{t+1})$. Given that $\dfrac{1}{|S^*_t|}<\dfrac{1}{|S^*_{t+1}|}$ and $f_t(S^*_t)-f_t(S^*_{t+1})>0$ by definition, $|S^*_t|-|S^*_{t+1}|+|N_t(S^*_t)|-|N_t(S^*_{t+1})|\geq 1$. With the knowledge that $S^*_t$ and $S^*_t$ are non-empty set, it is obvious that $f_t(S^*_t)-f_t(S^*_{t+1})$ is lower-bounded by $\tfrac{1}{2}$. Therefore, we can conclude that $W(G)_t-W(G_{t+1})=f_t(S^*_t)-f_{t+1}(S^*_{t+1}) \geq f_t(S^*_t)-f_t(S^*_{t+1}) \geq \frac{1}{2}$ in case 3.\\ \\ In case 4, define $S'=S^*_{t+1} \setminus S^*_t$, $S''=S^*_t \setminus S^*_{t+1}$, and $T=S^*_t \cap S^*_{t+1}$. \begin{eqnarray} && W(G_t)-W(G_{t+1}) \\ &=&f_t(S^*_t)-f_{t+1}(S^*_{t+1}) \\ &=& |T|+|S''|-|N_t(T)|-|N_t(S'')\setminus N_t(T)|+\frac{1}{|S^*_t|} - |T|-|S'|+|N_{t+1}(S^*_{t+1})|-\frac{1}{|S^*_{t+1}|} \\ &=& |S''|-|N_t(S'')\setminus N_t(T)|+\frac{1}{|S^*_t|}-\frac{1}{|S^*_{t+1}|} +|N_{t+1}(S^*_{t+1})|-|N_t(T)|-|S'| \\ &\geq & 1+\frac{1}{|S^*_t|}-\frac{1}{|S^*_{t+1}|}+|N_{t+1}(S^*_{t+1})| -|N_t(T)|-|S'| \\ &\geq & 1+\frac{1}{|\mathcal{M}|}-1+|N_{t+1}(T))|-|N_t(T)|+|N_{t+1}(S')\setminus N_{t+1}(T)|-|S'| \\ &= & \frac{1}{|\mathcal{M}|}+|N_{t+1}(T))|-|N_t(T)| +|N_{t+1}(S')\setminus N_{t+1}(T)|-|S'| \label{eq11}\\ &\geq & \frac{1}{|\mathcal{M}|}+|N_{t+1}(S')\setminus N_{k}(T)|-|S'| \geq \frac{1}{|\mathcal{M}|} \label{eq12}\\ \end{eqnarray} Most of the equations in case 4 are straight-forward except from (\ref{eq11}) to (\ref{eq12}). (\ref{eq11}) to (\ref{eq12}) is true because of the following inequalities: \begin{eqnarray} &&|N_{t+1}(S')\setminus N_{t+1}(T)|+|N_{t+1}(T))|-|N_t(T)| \nonumber \\ &=&|N_{t+1}(S')\setminus N_t(T)|+|N_{t+1}(T))|-|N_t(T)|-| \{N_{t+1}(S') \cap N_{t+1}(T) \}\setminus N_t(T)| \\ &\geq & |N_{t+1}(S')\setminus N_t(T)|-| N_{t+1}(T)\setminus N_t(T)| +|N_{t+1}(T))|-|N_t(T)| \\ &=& |N_{t+1}(S')\setminus N_t(T)| \end{eqnarray} Combine these four cases, we know that \begin{eqnarray} W(G_t)-W(G_{t+1}) \geq \dfrac{1}{ |\mathcal{M}|^2-|\mathcal{M}|}. \end{eqnarray} Therefore, we can conclude that the proposed algorithm terminates in finite rounds. (At most $|\mathcal{M}|^3$ rounds because $W(G)<|\mathcal{M}|$ and minimum decrement is greater than $\tfrac{1}{|\mathcal{M}|^3}$). \subsection{Proof of Lemma \ref{lem:colorMSS}} First, we want to show that suppose $\mathcal{M}_g \cup\mathcal{M}_b$ is a constricted good set, we can not include any good colored red to increase the skewness of the set. For any set of good colored red $S_r$ being added to $\mathcal{M}_g \cup\mathcal{M}_b$, at least the same size of buyers being matched pairs of those red goods are join to $N(\mathcal{M}_g \cup\mathcal{M}_b \cup S_r)$. Since we know that $|N(S_r)\setminus N(\mathcal{M}_g \cup\mathcal{M}_b)|\geq |S_r|$, including any set of red goods will decrease the skewness of the set $\mathcal{M}_g \cup\mathcal{M}_b$. Then, we want to show remove any subset of goods $S\subseteq \mathcal{M}_g \cup\mathcal{M}_b$ will also reduce the skewness of the set. Clearly, removing any subset of blue good will not reduce $N(\mathcal{M}_g \cup\mathcal{M}_b)$, hence blue goods are definitely included in the maximally skewed set. Therefore, we only need to consider the impact of removing set of green goods $S \subseteq \mathcal{M}_g$. Since for any $S \subseteq \mathcal{M}_g$, there has has at least one red edge connecting $S$ and $N(\mathcal{M}_g \cup\mathcal{M}_b\setminus S)$ according to the algorithm, Hence, $|N(\mathcal{M}_g \cup\mathcal{M}_b)|-|N(\mathcal{M}_g \cup\mathcal{M}_b\setminus S)|<|S|$, which implies that removing any $S \subset \mathcal{M}_g$ will only increase the skewness of the set. With these facts and the uniqueness property of the maximally skewed set, we can conclude that $\mathcal{M}_g \cup\mathcal{M}_b$ is the maximally skewed set. \subsection{Proof of Lemma \ref{lem:alg2}}\label{pf:lemalg2} We will prove Algorithm \ref{alg:alg2} always return the most skewed set by contradiction.\\ Since every untraversed good upon termination can be matched with an untraversed buyer without repetition. Therefore, adding any set of runtraversed goods $S_U$ to the set $S$ will always reduce the skewness of $S$ (because the increase of cardinality in neighbor of $S$, $|N(S_U)|-|N(S)|$ is always greater than or equal to the increase of cardinality of $S$, $|S_U|-|S|$). Hence, the most skewed set will never contain any untraversed good. Suppose there exists a set $S'$ is the most skewed set, with a higher skewness than the set $S$ return by Algorithm \ref{alg:alg2}, $S'$ must be a subset of $S$ because there's no untraversed good in the most skewed set and $f(S')>f(S)$. Let $S^*=S\setminus S'$, $f(S')>f(S)$ and $S' \subset S$ implies $|N(S^*)\setminus N(S')|-|S^*|>0$. If this happens, there must be a non-empty set of matching pairs match nodes from $S^*$ to $N(S^*)\setminus N(S')$ without repetition. Since $N(S^*)\setminus N(S')$ is not in $N(S')$ under the directed graph, nodes in $S^*$ will not be traversed in the algorithm contradicts that $S^* \subset S$. \subsection{Proof of Theorem \ref{lem4.1}}\label{pf:lem4.1} First, let's begin with the proof of the first half statement of the theorem, which is a variational characterization of MCPs. ($\Rightarrow$) This direction is obvious, otherwise the MCP is not the maximum by definition. ($\Leftarrow$) Recall that $\mathcal{M}$ is the set of goods. Suppose there exists an MCP $P^1$ satisfying the conditions but it is not the maximum MCP. Then there must exist a set of goods $S_1$ such that for all $i \in S_1$, $P^1_i<P^*_i$, and for all $i \in \mathcal{M}-S_1$, $P^1_i \geq P^*_i$; $\mathcal{M}-S_1$ can be an empty set. Let $P^2_i= P^1_i$ for all $i \in \mathcal{M}-S_1$, and $P^2_i= P^*_i$ for all $i \in S_1$. We will verify that $P^2$ is an MCP. WLOG, we can assume $P^1$ and $P^*$ have the same allocation; this is true as every MCP supports all efficient matchings. Then, consider any buyer who is assigned a good in $S_1$ under $P^*$. When the price vector changes from $P^*$ to $P^2$, the buyer has no profitable deviation from his/her assigned good because $P^2_i \geq P^*_i$ for all $i$ and $P^2_j= P^*_j$ for all $j \in S_1$. Similarly, when the price vector changes from $P^1$ to $P^2$, the buyer who is assigned a good in $\mathcal{M} \setminus S_1$ under $P^1$ has no profitable deviation because $P^2_i=P^1_i$ for all $i \in \mathcal{M} \setminus S_1$ and $P^2_j>P^1_j$ for all $j \in S_1$. Finally, since $P^1$ and $P^*$ have the same allocation, no buyer will deviate if we assign this allocation to buyers under $P^2$. Since all buyers have non-negative surpluses under $P^2$, it follows that $P^2$ is an MCP. Given $P^1$, there exists a set of goods $S_1$ whose price we can increase and still get market clearing because both $P^1$ and $P^2$ are MCPs. This contradicts the assumption that $P^1$ satisfies the stated conditions, and the proof of the variational characterization follows. For the second half part, which is a combinatorial characterization of MCPs, let's try to prove the statement using the result of the variational characterization. Given that we cannot increase the price for any subset of goods, it implies that for any subset of goods $S$, the set of corresponding matched buyer, either there exists at least one buyer has an edge connected to a good not in this subset or there exists at least one buyer with surplus zero. In the former case, it is obvious that $B<N(B)$ for such corresponding buyer set $B$. In the later case, $B\leq N(B)$ and $D\in N^D(B)$ guarantees $B < N^D(B)$. For the opposite direction, if every set of buyer with $B < N^D(B)$ under the current MCP, increasing the price for any set of good will make at least one corresponding buyer deviate from the matched good and cause no perfect matching. Therefore, the condition in variational characterization holds if and only if the condition in the combinatorial characterization holds. \subsection{Proof of Theorem \ref{thm2}}\label{pf:thm2} As mentioned earlier, showing the algorithm returns the maximum MCP is equivalent to show that when the algorithm terminates, the bipartite structure guarantees that we can not increase the price of any subset of good with the result in Theorem \ref{lem4.1}. It implies that after adding a dummy good with zero price, the support of any subset of goods has a size less than the size of the subset of goods, i.e., $|B|< |N^D_T(B)|$. Therefore, the proof of the theorem can be transformed to prove that the algorithm satisfies $|B|< |N^D_T(B)|$ for any non-empty set of buyer $B$ on termination. Let's start the proof with several claims. \begin{claim} \label{cl1} For any subset of buyer $B$, $B\neq \emptyset$, $|B|\leq |N^D_T(B)|$, where $T$ is the terminating time of our algorithm. \end{claim} Since our algorithm returns an MCP vector, if $|B|> |N^D_T(B)|$, there does not exist a perfect matching because of the existence of constricted buyer set. \begin{claim} \label{cl2} There does not exists a subset of buyer $B\subseteq \mathcal{B}$, $B\neq \emptyset$, $|B|= |N^D_T(B)|$ and $D\in N^D_T(B)$, where $T$ is the terminating time of our algorithm. \end{claim} $|B|= |N^D_T(B)|$ and $D\in N^D_T(B)$, imply $|B|> |N_T(B)|$. The preference graph has constricted sets and has no perfect matching. \begin{claim} \label{cl3} There does not exists a subset of buyer $B\subseteq \mathcal{B}$, $B\neq \emptyset$, $|B|= |N_T(B)|$, where $T$ is the terminating time of our algorithm. \end{claim} \begin{proof} With Claim \ref{cl1}, \ref{cl2}, it is equivalent to show $|B|<|N_T(B)|$. At time $t$, we denote the maximum non-negative surplus of buyer $b$ by $u^*_t(b)$ and the most skewed set by $S^*_t$; and $\mathscr{B}^s_t$ is the set of buyers with positive surplus at time $t$, i.e., $\mathscr{B}^s_t=\{b|u^*_t(b)>0, b\in\mathcal{B}\}$. It is obvious that $\mathscr{B}^s_i \subseteq \mathscr{B}^s_j$ for all $i<j$. Then, we want to prove the claim by mathematical induction. Prior to the proof, we need to introduce another claim. \begin{claim} \label{cl4} $\forall B\subseteq N_t(S^*_t), 0\leq t<T$, $|B|<|N_t(B) \cap S^*_t)|=|N_{t+1}(B)|$ \end{claim} \begin{proof} If the left inequality does not hold, we can remove all the goods contained in $N_t(B) \cap S^*_t$ from $S^*_t$ to get a more skewed set, which violates that $S^*_t$ is the most skewed one. Since we reduce the price in $S^*_t$, buyers in $B$ will not prefer any good outside of $S^*_t$. Therefore, $N_t(B) \cap S^*_t$ and $N_{t+1}(B)$ are identical. Hence $|N_t(B) \cap S^*_t|=|N_{t+1}(B)|$ is absolutely true. \end{proof} Now, we can prove Claim \ref{cl3} by induction. At t=0, $\mathscr{B}^s_0=\emptyset$. At t=1, $\mathscr{B}^s_1=\mathcal{N_0}(S^*_0)$. With Claim \ref{cl4}, $|B|<|N_1(B)|~~\forall B\subseteq \mathscr{B}^s_1$ and $B \neq \emptyset$. At a finite time $t$, suppose for all $B\subseteq \mathscr{B}^s_t$, $B \neq \emptyset$ satisfy $|B|<|N_t(B)|$, consider at time $t+1$: Since $\mathscr{B}^s_t \subseteq \mathscr{B}^s_{t+1}$, $\mathscr{B}^s_{t+1}$ contains three disjoint components: \begin{equation} \mathscr{B}^s_{t+1}= \{\mathscr{B}^s_t \cap {N_t(S^*_t)}^c \} \cup \{\mathscr{B}^s_t \cap N_t(S^*_t) \} \cup \{{\mathscr{B}^s_t}^c \cap N_t(S^*_t) \} \end{equation} Buyers in the first two parts are originally with positive utilities. Buyers in the last part have zero utilities at time $t$ but have positive utilities at time $t+1$. Consider the subset of buyers $B_{\alpha} \subseteq \{ \mathscr{B}^s_t \cap {N_t(S^*_t)}^c \}$. Since every $b \in B_{\alpha}$ does not prefer any good in $S^*_t$, the price reduction in $S^*_t$ will never remove any edges between $\{ \mathscr{B}^s_t \cap {N_t(S^*_t)}^c \}$ and $N_t(\{ \mathscr{B}^s_t \cap {N_t(S^*_t)}^c \})$. Therefore, for any non-empty set of buyers $B_{\alpha}$, $|B_{\alpha}|< |N_t(B_{\alpha})|\leq |N_{t+1}(B_{\alpha})|$. Then, consider the second and the third parts. Since $\{\mathscr{B}^s_t \cap N_t(S^*_t) \} \cup \{{\mathscr{B}^s_t}^c \cap N_t(S^*_t) \}=N_t(S^*_t)$, every non-empty set of buyers $B_{\beta} \subseteq N_t(S^*_t)$ satisfies $|B_{\beta}|<|N_{t+1}(B_{\beta})|$ by Claim \ref{cl4}. At the last step, consider $B_{\gamma}=B_{\gamma_1} \cup B_{\gamma_2}$, where $B_{\gamma_1} \subseteq \{\mathscr{B}^s_t \cap {N_t(S^*_t)}^c \}$, $B_{\gamma_2} \subseteq N_t(S^*_t)$ and $B_{\gamma_1},B_{\gamma_2} \neq \emptyset$. \begin{eqnarray} |N_{t+1}(B_{\gamma})| &=&|N_{t+1}(B_{\gamma_1}) \cup N_{t+1}(B_{\gamma_2})| \\ &=& |N_{t+1}(B_{\gamma_1})|+|N_{t+1} (B_{\gamma_2})|-|N_{t+1}(B_{\gamma_1}) \cap N_{t+1}(B_{\gamma_2})| \\ &=& |N_{t+1}(B_{\gamma_1})|-|N_{t+1}(B_{\gamma_1}) \cap N_{t+1}(B_{\gamma_2})|+|N_{t+1} (B_{\gamma_2})| \\ &=& |N_{t+1}(B_{\gamma_1}) \cap {N_{t+1}(B_{\gamma_2})}^c|+|N_{t+1} (B_{\gamma_2})| \\ &\geq& |N_{t+1}(B_{\gamma_1}) \cap {N_{t+1}(N_t(S^*_t))}^c|+|N_{t+1} (B_{\gamma_2})| \label{eqx1} \\ &=& |N_{t+1}(B_{\gamma_1}) \cap {S^*_t}^c|+|N_{t+1} (B_{\gamma_2})| \label{eqx2}\\ &=& |N_t(B_{\gamma_1})|+|N_{t+1} (B_{\gamma_2})| \label{eqx3}\\ &>& |B_{\gamma_1})|+|B_{\gamma_2}|=|B_{\gamma}| \end{eqnarray} From (\ref{eqx1}) to (\ref{eqx2}) is true because after price reduction at time $t$, buyer belongs to the neighbor of constricted good set $S^*_t$ will only prefer goods in $S^*_t$, therefore $N_{t+1}(N_t(S^*_t))=S^*_t$. From (\ref{eqx2}) to (\ref{eqx3}) is true because $N_t(B_{\gamma_1}) \cap S^*_t = \emptyset$ (by definition). Then, we have discussed before that the price reduction in $S^*_t$ will never remove any edges between $\{ \mathscr{B}^s_t \cap {N_t(S^*_t)}^c \}$ and $N_t(\{ \mathscr{B}^s_t \cap {N_t(S^*_t)}^c \})$. Since goods not in the most skewed set at time $t$ will not add new buyers to their neighbor, the equivalence between $N_{t+1}(B_{\gamma_1}) \cap {S^*_t}^c$ and $N_t(B_{\gamma_1})$ holds. Therefore, for every non empty set of buyers $B\subseteq \mathscr{B}^s_{t+1}$, $|B|<|N_{t+1}(B)|$. The mathematical induction works for all $k \in \mathbb{N}$. Since our algorithm terminates in finite round, $|B|< |N_T(B)|$, Q.E.D. \end{proof} With Claim \ref{cl1}, \ref{cl2}, \ref{cl3}, the skew-aided algorithm satisfies $|B|<|N^D_t(B)|$ for any non-empty set of buyer $B$ on termination. \subsection{Proof of Theorem \ref{thm1}}\label{pf:thm1} First, we know from Section 5.2 that the preference graph changes at most $m^2$ times in Algorithm \ref{alg:alg1}. Second, we analyze the initial step first. In Algorithm \ref{alg:alg2}, the Hopcroft-Karp algorithm runs in time $O(|\mathcal{M}|^{2.5})$, and the complexity of the BFS algorithm is $O(m+|\text{number of edges}|)$. Since the number of directed edges is upper-bounded by $m^2$, the complexity of Algorithm \ref{alg:alg2} is $O(m^{2.5}+m^2)=O(m^{2.5})$. Then, for each $a \in A$ colored blue, we run at most twice of BFS/DFS algorithm, which has complexity upper-bounded by $O(m+|\text{number of edges}|)\geq O(m^2)$. After that, we do things similar to find the maximum matching if we can add at least one blue buyer to the maximum matching, and run at most twice BFS/DFS. Therefore, the complexity should be upper-bounded by $O(m^{2.5}+2\times m^2)=O(m^{2.5})$. If we know that there is no blue buyers going to be added in this round, we do not need to find a new maximum matching. Therefore, the total complexity of the algorithm attaining the maximum MCP will be upper-bounded by the \{(complexity of updating process not recoloring blue buyers)$+$(complexity of computing price reduction)\}$\times$ (convergence rate of the preference graph)$+$(complexity of updating process increasing maximum matched pairs)$\times$ (maximum number of blue buyers)$=O((m^2+m^2)\times m^2+m^{2.5}\times m)=O(m^4)$ \subsection{Proof of Lemma \ref{lem:multicon}} Suppose the picked set which is not the most skewed one, this set must contain a pair of good-buyer $(x,y)$ not in the maximally skewed set. Since we know that algorithm terminates at round $T$, reducing the price of the good $x$ make the price vector lower than the maximum MCP at round $T$. (Because if we pick another set excluding good $x$, reducing the same amount of price as we did in this algorithm will also terminate at $T$.) Therefore, we know that the constricted good set we pick should not include any good not in the maximally skewed set. Now, we want to claim that the picked set is a subset of the maximally skewed set will never happen. If such a set $S$ exists and can terminate the algorithm at round $T$, then the most skewed set $S^*$ contains a set of goods $S^*\setminus S$ is already perfectly matched to a set of buyers outside $N(S)$, and the skewness of $S$ must be greater than $S^*$, which contradicts that $S^*$ is the most skewed set. Because of the above claims, we can conclude that any choice of constricted good set which is not the maximally skewed set at round $T$ will never return the maximum MCP at round $T$. \subsection{Proof of Theorem \ref{thm:externality}}\label{pf:thm:externality} First, it is obvious that the current market adding a duplicate pair of buyer buyer $i$ and its matched good $j$ is still market clearing and the social welfare will be the $\text{(the current social welfare)}+U^*_i+P_j$. Hence, what we need to show is the current market adding a duplicate buyer buyer $i$ has the social welfare: $\text{(the current social welfare)}+U^*_i$. Since adding a dummy good will not change the social welfare, we can transfer our problem to prove that the current market adding a duplicate buyer buyer $i$ and a dummy good has the social welfare $\text{(the current social welfare)}+U^*_i+0$. It is equivalent to show that the current market adding a duplicate buyer buyer $i$ and a dummy good is still market clearing. Using the combinatorial characterization of the maximum MCP, we know that $|B|<|N^D(B)|$ for any subset of B in the current market. Denote the buyer set of current market as $\mathcal{B}$ and the duplicate buyer $i$ as $\hat{i}$ , what we want to show is that $|B|\leq |N^D(B)|$ for any $B \in \{\mathcal{B}\cup\hat{i}\}$. If at least one of $i, \hat{i}$ not in $B$, it is straightforward that $|B|<|N^D(B)|$. If both $i, \hat{i}\in B$, $|B|=|B\setminus \hat{i}|+1 \leq |N^D(B\setminus \hat{i})-1|+1=|N^D(B\setminus \hat{i})|\leq |N^D(B)|)$. Using the Hall's marriage theorem, the inequality guaranteed that the current market adding a duplicate buyer buyer $i$ and a dummy good is market clearing, and the proof stands here. \subsection{Verification of Asymmetric BNE in a $3\times 3$ matching market}\label{asymBNE} Given the valuation matrix described in Table \ref{tbl:1}, we want to verify that if the strategy profile $\{\beta_{Alice}(w,0,0), \beta_{Bob}(x,0,0.5),\beta_{Carol}(y,z,2)\}=\{(\max \{1-\epsilon, \frac{w}{2}\},0,0), (\max \{1, \frac{2x-1}{4}\},0,0),(0,\epsilon,0)\}$, where $\epsilon$ is an infinitesimal is a BNE. First, consider Alice's best response according to Bob's strategy $(\max \{1, \frac{2x-1}{4}\},0,0)$ and Carol's strategy $(0,\epsilon,0)$. When Alice has valuation between $[0,1]$ on the listing ads, any bidding strategy $(b,0,0)$ is a best response for all $b<1$ because Alice will always get the Pop-ups at price zero. Then, when Alice has valuation $w$ between $(2,3]$ on the listing ads. The bidding function maximizes Alice's expected payoff is \begin{eqnarray} &&\max_b \int_{1.5}^{3.5} (w-b)\mathbf{1}_{\{b>\max \{1, (2x-1)/4\}\}} f_x(x) dx \\ &=& \max_b \Big\{ \frac{2}{3}(w-b)+ \frac{1}{3}\int_{2.5}^{3.5} (w-b)\mathbf{1}_{\{b>\max \{1, (2x-1)/4\}\}} dx \Big\} \\ &=& \max_b \frac{2}{3}(w-b)+ \frac{1}{3}(w-b)\times 2(b-1) \end{eqnarray} Now, it is easy to solve the optimal bid of Alice is \begin{eqnarray} &&\text{arg}\max_b \frac{2}{3}(w-b)+ \frac{1}{3}(w-b)\times 2(b-1) \\ &=& \text{arg}\max_b (w-b)+(w-b)(b-1)=\frac{w}{2} \end{eqnarray} Since $\frac{w}{2}<1$ for all $w \in [0,1)$ and $\frac{w}{2}>1$ for all $w \in (2,3]$ , we can conclude that $(\max \{1-\epsilon, \frac{w}{2}\},0,0)$ is a best response of Alice under $\{\beta_{Bob}(x,0,0.5),\beta_{Carol}(y,z,2)\}=\{(\max \{1, \frac{2x-1}{4}\},0,0),(0,\epsilon,0)\}$. Second, we use the similar technique to get Bob's best response. Given the strategy of Alice and Carol as mentioned, Bob can always get the Pop-ups with price $0$. Therefore, the bidding function maximizes Bob's expected payoff is \begin{eqnarray} &&\max_b 0.5+\int_{0}^{3} (w-b-0.5)\mathbf{1}_{\{b>\max \{1, \frac{w}{2}\}\}} f_w(w) dw \\ &=& 0.5+\max_b \Big\{ \frac{2}{3}(w-b-0.5)\mathbf{1}_{\{b\geq 1 \}}+ \frac{1}{3}\int_{2}^{3} (w-b-0.5)\mathbf{1}_{\{b>\max \{1, \frac{w}{2}\}\}} dw \Big\} \\ &=& 0.5+\max_b \frac{2}{3}(w-b-0.5)\mathbf{1}_{\{b\geq 1 \}}+ \frac{2}{3}(w-b-0.5)(b-1) \end{eqnarray} The optimal bid of Bob is \begin{eqnarray} &&\text{arg}\max_b \frac{2}{3}(w-b-0.5)\mathbf{1}_{\{b\geq 1 \}}+ \frac{2}{3}(w-b-0.5)(b-1) \\ &=& \text{arg}\max_b (w-b-0.5)(b-1+\mathbf{1}_{\{b\geq 1 \}})=\max \{1, \frac{2x-1}{4}\} \end{eqnarray} Last, we have to verify the Carol's best response given $\{\beta_{Alice}(w,0,0), \beta_{Bob}(x,0,0.5)\}=\{(\max \{1-\epsilon, \frac{w}{2}\},0,0), (\max \{1, \frac{2x-1}{4}\},0,0)\}$. To against any tie-breaking rule not in favor of Carol, the strategy $(0,\epsilon,0)$ is the minimum bid to ensure getting the sidebar ads. Now, we complete the verification that $\{\beta_{Alice}(w,0,0), \beta_{Bob}(x,0,0.5),\beta_{Carol}(y,z,2)\}=\{(\max \{1-\epsilon, \frac{w}{2}\},0,0), (\max \{1, \frac{2x-1}{4}\},0,0),(0,\epsilon,0)\}$ is an (asymmetric) BNE in this $3 \times 3$ matching market. \subsection{Proof of Lemma \ref{lem:mono}}\label{pf:lem:mono} We prove the monotonicity by contradiction. Suppose there exists two weight $x>y$ such that $\beta(x)<\beta(y)$, where $\beta (\cdot)$ is the optimal bidding function. It guarantees that the expected surplus of bidding $\beta(x)$ is never worse than bidding $\beta(y)$ given the private weight $x$. (Otherwise it is not the optimal bidding function.) Similarly, it also has to satisfy that the expected surplus of bidding $\beta(y)$ will be never worse than bidding $\beta(x)$ given the private weight $y$. Mathematically, the following two inequality should hold. \begin{eqnarray} \label{eqn:x>y} \int_0^1(c_1x-[(c_1-c_2)\beta(x) +c_2\beta(u)])f_{w}(u)\mathbf{1}_{\{\beta(x)>\beta(u)\}} du +\int_0^1 c_2(x-\beta(x))f_{w}(u)\mathbf{1}_{\{\beta(x)\leq \beta(u)\}}du \nonumber \\ \geq \int_0^1(c_1x-[(c_1-c_2)\beta(y) +c_2\beta(u)])f_{w}(u)\mathbf{1}_{\{\beta(y)>\beta(u)\}} du +\int_0^1 c_2(x-\beta(y))f_{w}(u)\mathbf{1}_{\{\beta(y)\leq \beta(u)\}}du \end{eqnarray} \begin{eqnarray} \label{eqn:y>x} \int_0^1(c_1y-[(c_1-c_2)\beta(y) +c_2\beta(u)])f_{w}(u)\mathbf{1}_{\{\beta(y)>\beta(u)\}} du +\int_0^1 c_2(y-\beta(y))f_{w}(u)\mathbf{1}_{\{\beta(y)\leq \beta(u)\}}du \nonumber \\ \geq \int_0^1(c_1y-[(c_1-c_2)\beta(x) +c_2\beta(u)])f_{w}(u)\mathbf{1}_{\{\beta(x)>\beta(u)\}} du +\int_0^1 c_2(y-\beta(x))f_{w}(u)\mathbf{1}_{\{\beta(x)\leq \beta(u)\}}du \end{eqnarray} Now, let us sum up and summarize the inequalities (\ref{eqn:x>y}), (\ref{eqn:y>x}). \begin{eqnarray} \int_0^1c_1(x-y)f_{w}(u)\mathbf{1}_{\{\beta(x)>\beta(u)\}} du +\int_0^1 c_2(x-y)f_{w}(u)\mathbf{1}_{\{\beta(x)\leq \beta(u)\}}du \nonumber \\ \geq \int_0^1c_1(x-y)f_{w}(u)\mathbf{1}_{\{\beta(y)>\beta(u)\}} du +\int_0^1 c_2(x-y)f_{w}(u)\mathbf{1}_{\{\beta(y)\leq \beta(u)\}}du \end{eqnarray} Then, the inequality can be further simplified to the following: \begin{eqnarray} \label{eqn:xy>yx} (x-y) \int_0^1(c_1-c_2)f_{w}(u)(\mathbf{1}_{\{\beta(x)>\beta(u)\}}-\mathbf{1}_{\{\beta(y)>\beta(u)\}})du\geq 0 \end{eqnarray} Since $x>y$ and $\beta(x)<\beta(y)$, $(x-y) \int_0^1(c_1-c_2)f_{w}(u)(\mathbf{1}_{\{\beta(x)>\beta(u)\}}-\mathbf{1}_{\{\beta(y)>\beta(u)\}})du<0$ holds given that the private weight $w$ is uniformly distributed from [0,1], which contradicts inequality \ref{eqn:xy>yx} and the proof stands here. \subsection{Proof of Corollary \ref{cor:mono}}\label{pf:cor:mono} Using the same technique as we used in the proof of Lemma \ref{lem:mono}, we can use induction to generalized to a finite-slots sponsored search markets. Consider the advertisers' private weight are symmetrical distributed from a distribution $D$. Suppose there exists two weight $x>y$ such that $\beta(x)<\beta(y)$, where $\beta (\cdot)$ is the optimal bidding function. Suppose there are $n$ slots and let $u_i$ be other advertiser $i$'s private weight, assuming $\beta(u_i)\geq \beta(u_j)~\forall i>j$ without loss of generality. Define the space $A=\{(u_1,u_2,...,u_{n-1})|\beta(u_i)\geq \beta(u_j)~\forall i<j\}$, $\beta(u_0)=+\infty$, and $c_{n+1}=0$, the two inequalities that the optimal bidding function have to satisfy are as follows: \begin{eqnarray} &&\sum_{i=1}^{n-1} \tbinom{n-1}{k} \oint_A \bigg\{c_ix-\beta(x)(c_i-c_{i+1})-\sum_{j=i+1}^n \beta(u_{j-1})(c_j-c_{j+1})\bigg\}\mathbf{1}_{\{\beta(u_{i-1})\geq \beta(x)>\beta(u_i)\}} \prod_{k=i}^{n-1}f_D(u_k)du_k \nonumber \\ &\geq& \sum_{i=1}^{n-1} \tbinom{n-1}{k} \oint_A \bigg\{c_ix-\beta(y)(c_i-c_{i+1})-\sum_{j=i+1}^n \beta(u_{j-1})(c_j-c_{j+1})\bigg\}\mathbf{1}_{\{\beta(u_{i-1})\geq \beta(y)>\beta(u_i)\}} \prod_{k=i}^{n-1}f_D(u_k)du_k \nonumber \end{eqnarray} \begin{eqnarray} &&\sum_{i=1}^{n-1} \tbinom{n-1}{k} \oint_A \bigg\{c_iy-\beta(y)(c_i-c_{i+1})-\sum_{j=i+1}^n \beta(u_{j-1})(c_j-c_{j+1})\bigg\}\mathbf{1}_{\{\beta(u_{i-1})\geq \beta(y)>\beta(u_i)\}} \prod_{k=i}^{n-1}f_D(u_k)du_k \nonumber \\ &\geq& \sum_{i=1}^{n-1} \tbinom{n-1}{k} \oint_A \bigg\{c_iy-\beta(x)(c_i-c_{i+1})-\sum_{j=i+1}^n \beta(u_{j-1})(c_j-c_{j+1})\bigg\}\mathbf{1}_{\{\beta(u_{i-1})\geq \beta(x)>\beta(u_i)\}} \prod_{k=i}^{n-1}f_D(u_k)du_k \nonumber \end{eqnarray} Now, we have to sum up the two inequalities above and cancel terms exist in both sides. \begin{eqnarray} \label{eqn:mono} &&\sum_{i=1}^{n-1} \tbinom{n-1}{k} \oint_A c_i(x-y)\mathbf{1}_{\{\beta(u_{i-1})\geq \beta(x)>\beta(u_i)\}} \prod_{k=i}^{n-1}f_D(u_k)du_k \nonumber \\ &\geq& \sum_{i=1}^{n-1} \tbinom{n-1}{k} \oint_A c_i(y-x)\mathbf{1}_{\{\beta(u_{i-1})\geq \beta(y)>\beta(u_i)\}} \prod_{k=i}^{n-1}f_D(u_k)du_k \end{eqnarray} We can further simplify the inequality (\ref{eqn:mono}) to be the following inequality: \begin{eqnarray} (x-y)\sum_{i=1}^{n-1} \tbinom{n-1}{k} \oint_A c_i\{\mathbf{1}_{\{\beta(u_{i-1})\geq \beta(x)>\beta(u_i)\}}-\mathbf{1}_{\{\beta(u_{i-1})\geq \beta(y)>\beta(u_i)\}}\}\prod_{k=i}^{n-1}f_D(u_k)du_k \geq 0 \end{eqnarray} Given that $c_i\geq c_j$ for all $i<j$, $x>y$ and $\beta(x)<\beta(y)$, the above inequality is always $\leq 0$ and the equality holds when $F_D(x)-F_D(y)=0$. Therefore, we can claim that the optimal bidding function in sponsored search markets with symmetric advertisers are monotonic increasing with the advertiser's private weight. \subsection{Proof of Lemma \ref{lem_2g1}}\label{sec:lem_2g1} Consider buyer i's bid $b_{i1}$, $b_{i2}$ on good 1 and 2. WLOG, suppose $b_{11},b_{12}\neq 0$. If $b_{11}+b_{22}\geq b_{12}+b_{21}$ (the scenario that player 1 will win good 1). The price of good 1 is $P_1=b_{11}-(b_{12}-b_{22})\mathbf{1}_{\{b_{11}\geq b_{21},b_{12}\geq b_{22}\}}$. Similarly, if $b_{11}+b_{22}< b_{12}+b_{21}$ (the scenario that player 1 will win good 2). The price of good 2 at this time is $P_1=b_{12}-(b_{11}-b_{21})\mathbf{1}_{\{b_{11}\geq b_{21},b_{12}\geq b_{22}\}}$. The buyer 1's surplus is \begin{eqnarray} &&u_1(b_{11},b_{12},b_{21},b_{22})\nonumber \\ &=&(v_{11}-b_{11})\mathbf{1}_{\{b_{11}+b_{22}\geq b_{12}+b_{21}\}} + (v_{12}-b_{12})(1-\mathbf{1}_{\{b_{11}+b_{22}\geq b_{12}+b_{21}\}})\nonumber\\ &&+\mathbf{1}_{\{b_{11}\geq b_{21},b_{12}\geq b_{22}\}}\big[(b_{12}-b_{22})\mathbf{1}_{\{b_{11}+b_{22}\geq b_{12}+b_{21}\}}+(b_{11}-b_{21})(1-\mathbf{1}_{\{b_{11}+b_{22}\geq b_{12}+b_{21}\}})\big] \nonumber \end{eqnarray} Now, define $c=\min \{b_{11},b_{12}\}$ and consider another bidding strategy $(b^*_{11} , b^*_{12})$ that $(b_{11}^*=b_{11}-c$, $(b_{12}^*=b_{12}-c$. Since reducing same amount of bids on both goods reduces the same amount on $b_{11}+b_{22}$ and $b_{12}+b_{21}$, this new bidding strategy will not change the probability of buyer 1 to win good 1 or 2. Therefore, we can calculate the difference of surplus between these two bidding strategy: \begin{eqnarray} &&u_1(b^*_{11},b^*_{12},b_{21},b_{22})-u_1(b_{11},b_{12},b_{21},b_{22}) \\ &=&(b_{11}-b^*_{11})\mathbf{1}_{\{b_{11}+b_{22}\geq b_{12}+b_{21}\}} + (b_{12}-b^*_{12})(1-\mathbf{1}_{\{b_{11}+b_{22}\geq b_{12}+b_{21}\}})\nonumber\\ &&-\mathbf{1}_{\{b_{11}\geq b_{21},b_{12}\geq b_{22}\}}\big[(b_{12}-b_{22})\mathbf{1}_{\{b_{11}+b_{22}\geq b_{12}+b_{21}\}}+(b_{11}-b_{21})(1-\mathbf{1}_{\{b_{11}+b_{22}\geq b_{12}+b_{21}\}})\big] \nonumber \\ &=& c[\mathbf{1}_{\{b_{11}+b_{22}\geq b_{12}+b_{21}\}} +(1-\mathbf{1}_{\{b_{11}+b_{22}\geq b_{12}+b_{21}\}})] \nonumber \\ &&-\mathbf{1}_{\{b_{11}\geq b_{21},b_{12}\geq b_{22}\}}\big[(b_{12}-b_{22})\mathbf{1}_{\{b_{11}+b_{22}\geq b_{12}+b_{21}\}}+(b_{11}-b_{21})(1-\mathbf{1}_{\{b_{11}+b_{22}\geq b_{12}+b_{21}\}})\big] \label{eqn12} \\ &\geq & c- \mathbf{1}_{\{b_{11}\geq b_{21},b_{12}\geq b_{22}\}}\big[c\mathbf{1}_{\{b_{11}+b_{22}\geq b_{12}+b_{21}\}}+c(1-\mathbf{1}_{\{b_{11}+b_{22}\geq b_{12}+b_{21}\}})\big] \label{eqn13} \\ &=& c- c\mathbf{1}_{\{b_{11}\geq b_{21},b_{12}\geq b_{22}\}} \geq 0 \label{eqn14} \end{eqnarray} The most critical part is from (\ref{eqn12}) to (\ref{eqn13}). When $b_{11}+b_{22}\geq b_{12}+b_{21}, b_{11}\geq b_{21}$, and $b_{12}\geq b_{22}$, they imply that $b_{12}\geq b_{22}\leq \min\{b_{11},b_{12}\}=c$. Similarly, $b_{11}+b_{22}\leq b_{12}+b_{21}, b_{11}\geq b_{21}$, and $b_{12}\geq b_{22}$ imply $b_{11}\geq b_{21}\leq \min\{b_{11},b_{12}\}=c$. With Equation (\ref{eqn14}), we can conclude that any strategy placing non-zero bids on both goods is a weakly-dominated strategy. \subsection{Proof of Lemma \ref{lem_2g2}}\label{sec:lem_2g2} If a strategy bid $b_{i1}, b_{i2}$ satisfying $b_{i1}<b_{i2}$ when $v_{i1}>v_{i2}$, consider another strategy bid $b^*_{i1}, b^*_{i2}$ as follows: \begin{eqnarray} &&b^*_{i1}=b_{i1} \nonumber\\ &&b^*_{i2}= \begin{cases} b_{i1}~~~~ \text{if~} v_{i1}>v_{i2} \\ b_{i2}~~~~ \text{otherwise} \end{cases} \end{eqnarray} With Lemma \ref{lem_2g1}, we can assume $b_{i1}=0$. Used the similar technique to compare the buyer's surplus when $v_{i1}>v_{i2}$. \begin{eqnarray} &&u_i(b^*_{i1},b^*_{i2},b_{-i1},b_{-i2})-u_i(b_{i1},b_{i2},b_{-i1},b_{-i2}) = u_i(0,0,b_{-i1},b_{-i2})-u_i(0,b_{i2},b_{-i1},b_{-i2}) \nonumber \\ &=&v_{i1}\mathbf{1}_{\{b_{-i2}\geq b_{-i1}\}} + v_{i2}(1-\mathbf{1}_{\{b_{-i2}\geq b_{-i1}\}})- v_{i1}\mathbf{1}_{\{b_{-i2}\geq b_{i2}+ b_{-i1}\}} - (v_{i2}-b_{i2})(1-\mathbf{1}_{\{b_{-i2}\geq b_{i2}+b_{-i1}\}})\nonumber \\ &=& b_{i2}(1-\mathbf{1}_{\{b_{-i2}\geq b_{i2}+b_{-i1}\}})+(v_{i1}-v_{i2})\mathbf{1}_{\{b_{-i1}+b_{i2}\geq b_{-i2}\geq b_{-i1}\}} \geq 0 \label{eqn16} \end{eqnarray} Since equation (\ref{eqn16}) is non-negative. The lemma is proved. \subsection{Proof of Lemma \ref{pro1}}\label{sec:pro1} Suppose $\beta(v_{ih},v_{il})=b^*>b'=\beta(v_{ih}',v_{il}')$ but $v_{ih}-v_{il}<v_{ih}'-v_{il}'$, consider another bidding function $\beta'$ exchanges the bid between these two pair of valuations and bids the same as $\beta$ otherwise. Suppose the original bidding function is optimal, the following two inequality holds: \begin{eqnarray} &&[(v_{ih}-\beta(v_{ih},v_{il}))\text{Pr(win higher valued good with bid $\beta(v_{ih},v_{il}$))} \nonumber \\ &+&v_{il}\text{Pr(win lower valued good with bid $\beta(v_{ih},v_{il}$))}] \nonumber \\ &-&(v_{ih}-\beta'(v_{ih},v_{il}))\text{Pr(win higher valued good with bid $\beta'(v_{ih},v_{il}$))} \nonumber \\ &-&v_{il}\text{Pr(win lower valued good with bid $\beta'(v_{ih},v_{il}$))} \geq 0 \end{eqnarray} \begin{eqnarray} &&[(v_{ih}'-\beta(v_{ih}',v_{il}'))\text{Pr(win higher valued good with bid $\beta(v_{ih}',v_{il}'$))} \nonumber \\ &+&v_{il}'\text{Pr(win lower valued good with bid $\beta(v_{ih}',v_{il}'$))}] \nonumber \\ &-&(v_{ih}'-\beta'(v_{ih}',v_{il}'))\text{Pr(win higher valued good with bid $\beta'(v_{ih}',v_{il}'$))} \nonumber \\ &-&v_{il}'\text{Pr(win lower valued good with bid $\beta'(v_{ih}',v_{il}'$))} \geq 0 \end{eqnarray} Sum up the above two inequality and we know that $\text{Pr(win higher valued good with bid $\beta'(v_{ih}',v_{il}'$))}=\text{Pr(win higher valued good with bid $\beta(v_{ih},v_{il}$))}$ We will get \begin{eqnarray} && [(v_{ih}-v_{il})-(v_{ih}'-v_{il}')][\text{Pr(win higher valued good with bid $b^*$)} \nonumber\\ &-&\text{Pr(win higher valued good with bid b')}]\geq 0 \end{eqnarray} However, we know $v_{ih}-v_{il})<(v_{ih}'-v_{il}')$ and $b^*>b'$. there's a contradiction. Hence, the optimal bidding function of the higher good $\beta(v_{ih},v_{il})$ is monotonic to $v_{ih}-v_{il}$. \section{Appendix} \subsection{Choice of Constricted Goods Set} \label{sec6.1} Suppose we do not choose the most skewed set in our algorithm, then it follows that we may obtain different MCP vectors. However, a natural question to ask is the following: if we run the algorithm two times and choose different constricted good sets at some iterations such that the bipartite graph produced in every round of these two executions are the same, will we get the same MCP vector? Unfortunately, the choice of the same initial price vector, the same price reduction rule, and the emergence of the same bipartite graph in every round are not enough to guarantee the same returned MCPs. A counterexample is provided in Fig. \ref{fig4}. \begin{figure}[h] \centering \includegraphics[width=0.4\textwidth]{./Figures/constricted.pdf} \caption{Counterexample of same bipartite graph but different set MCPs} \label{fig4} \end{figure} In Fig. \ref{fig4}, the bipartite graphs A-1, B-1 have the same preference graph. Though the chosen constricted good sets in A, B are different, they add the same buyer to the constricted graph. Therefore, the preference graphs in A-2, B-2 are still the same. However, the updated price vector of A-2, B-2 must be different. If A, B choose the same constricted goods set in every round, the returned sets of MCPs of A, B must be different. This example shows that just the bipartite graphs in every round cannot uniquely determine the MCP vector obtained at the termination of the algorithm. \subsection{Proof of Lemma \ref{lemA}}\label{pf:lem1} First, we will show that given a constricted good set $S$, reducing price of every good in $S$ with the amount specified in the statement will increase the size of its neighbor, i.e., $N(S)$. Given a constricted good set $S$ under a specific price vector $\mathbf{P}$. Consider another price vector $\mathbf{P'}$, $P'_j=\begin{cases} P_j , & j \notin S \\ P_j-c, & j \in S \end{cases} $ , where $c:=\min_{i \in \mathcal{B} \setminus N(S),l\in S} \{\max_{k \in \mathcal{M} \setminus S}(v_{i,k}-P_k)- (v_{i,l}-P_l) \}$. For some $j \in S$, there must exists an $i\in \mathcal{B} \setminus N(S)$ satisfying $v_{i,j}-P_j'= \max_{k \in \mathcal{M} \setminus S} v_{i,k}-P_k$. Now, by an abuse of notation to denote $N'(S)$ as the neighbor of $S$ under $P'$, $i \in N'(S)$. For those $l \in N(S)$, $\max_{j \in S}v_{l,j}-P'_j>\max_{j \in S}v_{l,j}-P_j\geq \max_{j \in \mathcal{M}\setminus S}v_{l,j}-P_j$ implies $l \in N'(S)$. Therefore, $|N(S)|<|N'(S)|$. Then, we need to prove that $c$ is the minimum decrement. Consider another price vector Consider another price vector $\mathbf{P''}$, $P'_j=\begin{cases} P_j , & j \notin S \\ P_j-d, & j \in S \end{cases} $, where $d<c$. It is straightforward that for all $i \in \mathcal{B} \setminus N(S)$, $v_{i,j}-P''_j< v_{i,j}-P_j+c \le \max_k (v_{i,k}-P_k)$. Hence, no buyers will be added to the $N(S)$. Now, it is clear that $\min_{i \in \mathcal{B} \setminus N(S),l\in S} \{\max_{k \in \mathcal{M} \setminus S}(v_{i,k}-P_k)- (v_{i,l}-P_l) \}$ is the minimum price reduction which guarantees to add at least a new buyer to the $N(S)$. \subsection{Proof of Lemma \ref{lem2}}\label{pf:lem2} In order to prove the statement, we start from showing the most skewed set is always a constricted good set when there is no perfect matching. Then, we prove the uniqueness of the most skewed set by contradiction. When there is no perfect matching, there must exists a constricted good set. By definition, the constricted good set $S$ has the property $|S|>|N(S)|$. Since $|S|$, $|N(S)|$ are integers, the skewness of a constricted good set \begin{equation} \label{eq1} f(S)=|S|-|N(S)|+\frac{1}{|S|} \geq 1+\frac{1}{|S|} >1. \end{equation} Then, for any non-constricted good set $S'$, $|S'| \leq |N(S')|$. The skewness of $S'$ is \begin{equation} \label{eq2} f(S')=|S'|-|N(S')|+\frac{1}{|S'|} \leq 0+\frac{1}{|S'|} \leq 1. \end{equation} With equation (\ref{eq1}), (\ref{eq2}), the skewness of a constricted good set is always greater than any non-constricted good sets. Therefore, if a preference graph exists a constricted good set, the most skewed set is always a constricted good set. Then, we start to prove the uniqueness of the most skewed set. Suppose there exists two disjoint sets $S_1$, $S_2$ and both sets are the most skewed sets, i.e., $f(S_1)=f(S_2)= \max_{S \subset \mathcal{M}, S \neq \emptyset} f(S)$. Consider the skewness of the union of $S_1$ and $S_2$. \begin{eqnarray} &&f(S_1 \cup S_2) \\ &=& |S_1 \cup S_2|- |N(S_1 \cup S_2)|+ \frac{1}{|S_1 \cup S_2|} \\ &=& |S_1|+ |S_2| - |N(S_1) \cup N(S_2)|+ \frac{1}{|S_1 \cup S_2|} \\ &\geq & |S_1|+ |S_2| - |N(S_1)|- |N(S_2)|+ \frac{1}{|S_1 \cup S_2|} \\ &=& f(S_1)+ |S_2|- |N(S_2)| -\frac{1}{|S_1|}+\frac{1}{|S_1 \cup S_2|} \label{eq3}\\ &\geq & f(S_1) +1 -\frac{1}{|S_1|}+\frac{1}{|S_1 \cup S_2|} > f(S_1) \label{eq4} \end{eqnarray} From (\ref{eq3}) to (\ref{eq4}) is true because $S_2$ is a constricted good set. (\ref{eq4}) contradicts our assumption that $S_1$, $S_2$ are the most skewed set. Therefore, we know that if there exists multiple sets share the same highest skewness value, these sets are not disjoint. Now, suppose there exists two sets $S_1$, $S_2$ satisfying that $S_1 \cup S_2 \neq \emptyset$ and both sets are the most skewed sets, the following two inequalities must hold: \begin{eqnarray} f(S_1)-f(S_1 \cup S_2) \geq 0 \\ f(S_2)-f(S_1 \cap S_2) \geq 0 \end{eqnarray} Let's sum up the two inequalities and represent the formula in twelve terms. \begin{eqnarray} &&f(S_1)+f(S_2) - f(S_1 \cup S_2)-f(S_1 \cap S_2) \\ &=& |S_1|+|S_2|-|S_1 \cup S_2|-|S_1 \cap S_2| \nonumber \\ && +|N(S_1 \cup S_2)|+ |N(S_1 \cap S_2)|- |N(S_1)|-|N(S_2)| \nonumber \\ && +\dfrac{1}{|S_1|}+\dfrac{1}{|S_2|}-\dfrac{1}{|S_1 \cup S_2|}-\dfrac{1}{|S_1 \cap S_2|} \end{eqnarray} The first four terms $|S_1|+|S_2|-|S_1 \cup S_2|-|S_1 \cap S_2|=0$. Using the similar argument, $|N(S_1)|+|N(S_2)|=|N(S_1) \cap N(S_2)|+|N(S_1) \cup N(S_2)|$. \begin{eqnarray} |N(S_1 \cup S_2)|=|N(S_1) \cup N(S_2)| \\ |N(S_1 \cap S_2)| \leq |N(S_1) \cap N(S_2)| \label{eq5} \end{eqnarray} Equation (\ref{eq5}) is true because there may exist some elements in $S_1 \setminus S_2$ and $S_2 \setminus S_1$ but have common neighbors. Thus, the second four terms are smaller than or equal to $0$. To check the last four terms, let $|S_1|=a$, $|S_2|=b$, and $|S_1 \cap S_2|=c$, where $c<\min\{a,b\}$ because $S_1,S_2$ are not disjoint. The last four terms are \begin{eqnarray} &&\dfrac{1}{|S_1|}+\dfrac{1}{|S_2|}-\dfrac{1}{|S_1 \cup S_2|}-\dfrac{1}{|S_1 \cap S_2|} \\ &=& \dfrac{1}{a}+\dfrac{1}{b}-\dfrac{1}{a+b-c}-\dfrac{1}{c} \\ &=& \dfrac{a+b}{ab}-\dfrac{a+b}{(a+b-c)c} \\ &=& \dfrac{a+b}{abc(a+b-c)}(ac+bc-c^2-ab) \\ &=&-\dfrac{(a+b)(a-c)(b-c)}{abc(a+b-c)}<0 \end{eqnarray} To conclude, the first four terms are $0$, the second four terms are smaller than or equal to $0$, and the last four terms are strictly negative make \begin{eqnarray} f(S_1)+f(S_2) - f(S_1 \cup S_2)-f(S_1 \cap S_2)<0. \end{eqnarray} Therefore, at least one of set $S_1 \cup S_2$, $S_1 \cap S_2$ has the skewness value greater than $f(S_1)=f(S_2)$, which leads to a contradiction that $S_1$ and $S_2$ are the most skewed set. Finally, we can claim that the most skewed set is unique when there is no perfect matching. \subsection{Proof of Theorem \ref{lem4.1}}\label{pf:lem4.1} First, let's begin with the proof of the first half statement of the theorem, which is a variational characterization of MCPs. ($\Rightarrow$) This direction is obvious, otherwise the MCP is not the maximum by definition. ($\Leftarrow$) Recall that $\mathcal{M}$ is the set of goods. Suppose there exists an MCP $P^1$ satisfying the conditions but it is not the maximum MCP. Then there must exist a set of goods $S_1$ such that for all $i \in S_1$, $P^1_i<P^*_i$, and for all $i \in \mathcal{M}-S_1$, $P^1_i \geq P^*_i$; $\mathcal{M}-S_1$ can be an empty set. Let $P^2_i= P^1_i$ for all $i \in \mathcal{M}-S_1$, and $P^2_i= P^*_i$ for all $i \in S_1$. We will verify that $P^2$ is an MCP. WLOG, we can assume $P^1$ and $P^*$ have the same allocation; this is true as every MCP supports all efficient matchings. Then, consider any buyer who is assigned a good in $S_1$ under $P^*$. When the price vector changes from $P^*$ to $P^2$, the buyer has no profitable deviation from his/her assigned good because $P^2_i \geq P^*_i$ for all $i$ and $P^2_j= P^*_j$ for all $j \in S_1$. Similarly, when the price vector changes from $P^1$ to $P^2$, the buyer who is assigned a good in $\mathcal{M} \setminus S_1$ under $P^1$ has no profitable deviation because $P^2_i=P^1_i$ for all $i \in \mathcal{M} \setminus S_1$ and $P^2_j>P^1_j$ for all $j \in S_1$. Finally, since $P^1$ and $P^*$ have the same allocation, no buyer will deviate if we assign this allocation to buyers under $P^2$. Since all buyers have non-negative surpluses under $P^2$, it follows that $P^2$ is an MCP. Given $P^1$, there exists a set of goods $S_1$ whose price we can increase and still get market clearing because both $P^1$ and $P^2$ are MCPs. This contradicts the assumption that $P^1$ satisfies the stated conditions, and the proof of the variational characterization follows. For the second half part, which is a combinatorial characterization of MCPs, let's try to prove the statement using the result of the variational characterization. Given that we cannot increase the price for any subset of goods, it implies that for any subset of goods $S$, the set of corresponding matched buyer, either there exists at least one buyer has an edge connected to a good not in this subset or there exists at least one buyer with surplus zero. In the former case, it is obvious that $B<N(B)$ for such corresponding buyer set $B$. In the later case, $B\leq N(B)$ and $D\in N^D(B)$ guarantees $B < N^D(B)$. For the opposite direction, if every set of buyer with $B < N^D(B)$ under the current MCP, increasing the price for any set of good will make at least one corresponding buyer deviate from the matched good and cause no perfect matching. Therefore, the condition in variational characterization holds if and only if the condition in the combinatorial characterization holds. \subsection{Proof of Theorem \ref{thm:externality}}\label{pf:thm:externality} First, it is obvious that the current market adding a duplicate pair of buyer buyer $i$ and its matched good $j$ is still market clearing and the social welfare will be the $\text{(the current social welfare)}+U^*_i+P_j$. Hence, what we need to show is the current market adding a duplicate buyer buyer $i$ has the social welfare: $\text{(the current social welfare)}+U^*_i$. Since adding a dummy good will not change the social welfare, we can transfer our problem to prove that the current market adding a duplicate buyer buyer $i$ and a dummy good has the social welfare $\text{(the current social welfare)}+U^*_i+0$. It is equivalent to show that the current market adding a duplicate buyer buyer $i$ and a dummy good is still market clearing. Using the combinatorial characterization of the maximum MCP, we know that $|B|<|N^D(B)|$ for any subset of B in the current market. Denote the buyer set of current market as $\mathcal{B}$ and the duplicate buyer $i$ as $\hat{i}$ , what we want to show is that $|B|\leq |N^D(B)|$ for any $B \in \{\mathcal{B}\cup\hat{i}\}$. If at least one of $i, \hat{i}$ not in $B$, it is straightforward that $|B|<|N^D(B)|$. If both $i, \hat{i}\in B$, $|B|=|B\setminus \hat{i}|+1 \leq |N^D(B\setminus \hat{i})-1|+1=|N^D(B\setminus \hat{i})|\leq |N^D(B)|)$. Using the Hall's marriage theorem, the inequality guaranteed that the current market adding a duplicate buyer buyer $i$ and a dummy good is market clearing, and the proof stands here. \subsection{Proof of Theorem \ref{thm2}}\label{pf:thm2} As mentioned earlier, showing the algorithm returns the maximum MCP is equivalent to show that when the algorithm terminates, the bipartite structure guarantees that we can not increase the price of any subset of good with the result in Theorem \ref{lem4.1}. It implies that after adding a dummy good with zero price, the support of any subset of goods has a size less than the size of the subset of goods, i.e., $|B|< |N^D_T(B)|$. Therefore, the proof of the theorem can be transformed to prove that the algorithm satisfies $|B|< |N^D_T(B)|$ for any non-empty set of buyer $B$ on termination. Let's start the proof with several claims. \begin{claim} \label{cl1} For any subset of buyer $B$, $B\neq \emptyset$, $|B|\leq |N^D_T(B)|$, where $T$ is the terminating time of our algorithm. \end{claim} Since our algorithm returns an MCP vector, if $|B|> |N^D_T(B)|$, there does not exist a perfect matching because of the existence of constricted buyer set. \begin{claim} \label{cl2} There does not exists a subset of buyer $B\subseteq \mathcal{B}$, $B\neq \emptyset$, $|B|= |N^D_T(B)|$ and $D\in N^D_T(B)$, where $T$ is the terminating time of our algorithm. \end{claim} $|B|= |N^D_T(B)|$ and $D\in N^D_T(B)$, imply $|B|> |N_T(B)|$. The preference graph has constricted sets and has no perfect matching. \begin{claim} \label{cl3} There does not exists a subset of buyer $B\subseteq \mathcal{B}$, $B\neq \emptyset$, $|B|= |N_T(B)|$, where $T$ is the terminating time of our algorithm. \end{claim} \begin{proof} With Claim \ref{cl1}, \ref{cl2}, it is equivalent to show $|B|<|N_T(B)|$. At time $t$, we denote the maximum non-negative surplus of buyer $b$ by $u^*_t(b)$ and the most skewed set by $S^*_t$; and $\mathscr{B}^s_t$ is the set of buyers with positive surplus at time $t$, i.e., $\mathscr{B}^s_t=\{b|u^*_t(b)>0, b\in\mathcal{B}\}$. It is obvious that $\mathscr{B}^s_i \subseteq \mathscr{B}^s_j$ for all $i<j$. Then, we want to prove the claim by mathematical induction. Prior to the proof, we need to introduce another claim. \begin{claim} \label{cl4} $\forall B\subseteq N_t(S^*_t), 0\leq t<T$, $|B|<|N_t(B) \cap S^*_t)|=|N_{t+1}(B)|$ \end{claim} \begin{proof} If the left inequality does not hold, we can remove all the goods contained in $N_t(B) \cap S^*_t$ from $S^*_t$ to get a more skewed set, which violates that $S^*_t$ is the most skewed one. Since we reduce the price in $S^*_t$, buyers in $B$ will not prefer any good outside of $S^*_t$. Therefore, $N_t(B) \cap S^*_t$ and $N_{t+1}(B)$ are identical. Hence $|N_t(B) \cap S^*_t|=|N_{t+1}(B)|$ is absolutely true. \end{proof} Now, we can prove Claim \ref{cl3} by induction. At t=0, $\mathscr{B}^s_0=\emptyset$. At t=1, $\mathscr{B}^s_1=\mathcal{N_0}(S^*_0)$. With Claim \ref{cl4}, $|B|<|N_1(B)|~~\forall B\subseteq \mathscr{B}^s_1$ and $B \neq \emptyset$. At a finite time $t$, suppose for all $B\subseteq \mathscr{B}^s_t$, $B \neq \emptyset$ satisfy $|B|<|N_t(B)|$, consider at time $t+1$: Since $\mathscr{B}^s_t \subseteq \mathscr{B}^s_{t+1}$, $\mathscr{B}^s_{t+1}$ contains three disjoint components: \begin{equation} \mathscr{B}^s_{t+1}= \{\mathscr{B}^s_t \cap {N_t(S^*_t)}^c \} \cup \{\mathscr{B}^s_t \cap N_t(S^*_t) \} \cup \{{\mathscr{B}^s_t}^c \cap N_t(S^*_t) \} \end{equation} Buyers in the first two parts are originally with positive utilities. Buyers in the last part have zero utilities at time $t$ but have positive utilities at time $t+1$. Consider the subset of buyers $B_{\alpha} \subseteq \{ \mathscr{B}^s_t \cap {N_t(S^*_t)}^c \}$. Since every $b \in B_{\alpha}$ does not prefer any good in $S^*_t$, the price reduction in $S^*_t$ will never remove any edges between $\{ \mathscr{B}^s_t \cap {N_t(S^*_t)}^c \}$ and $N_t(\{ \mathscr{B}^s_t \cap {N_t(S^*_t)}^c \})$. Therefore, for any non-empty set of buyers $B_{\alpha}$, $|B_{\alpha}|< |N_t(B_{\alpha})|\leq |N_{t+1}(B_{\alpha})|$. Then, consider the second and the third parts. Since $\{\mathscr{B}^s_t \cap N_t(S^*_t) \} \cup \{{\mathscr{B}^s_t}^c \cap N_t(S^*_t) \}=N_t(S^*_t)$, every non-empty set of buyers $B_{\beta} \subseteq N_t(S^*_t)$ satisfies $|B_{\beta}|<|N_{t+1}(B_{\beta})|$ by Claim \ref{cl4}. At the last step, consider $B_{\gamma}=B_{\gamma_1} \cup B_{\gamma_2}$, where $B_{\gamma_1} \subseteq \{\mathscr{B}^s_t \cap {N_t(S^*_t)}^c \}$, $B_{\gamma_2} \subseteq N_t(S^*_t)$ and $B_{\gamma_1},B_{\gamma_2} \neq \emptyset$. \begin{eqnarray} |N_{t+1}(B_{\gamma})| &=&|N_{t+1}(B_{\gamma_1}) \cup N_{t+1}(B_{\gamma_2})| \\ &=& |N_{t+1}(B_{\gamma_1})|+|N_{t+1} (B_{\gamma_2})|-|N_{t+1}(B_{\gamma_1}) \cap N_{t+1}(B_{\gamma_2})| \\ &=& |N_{t+1}(B_{\gamma_1})|-|N_{t+1}(B_{\gamma_1}) \cap N_{t+1}(B_{\gamma_2})|+|N_{t+1} (B_{\gamma_2})| \\ &=& |N_{t+1}(B_{\gamma_1}) \cap {N_{t+1}(B_{\gamma_2})}^c|+|N_{t+1} (B_{\gamma_2})| \\ &\geq& |N_{t+1}(B_{\gamma_1}) \cap {N_{t+1}(N_t(S^*_t))}^c|+|N_{t+1} (B_{\gamma_2})| \label{eqx1} \\ &=& |N_{t+1}(B_{\gamma_1}) \cap {S^*_t}^c|+|N_{t+1} (B_{\gamma_2})| \label{eqx2}\\ &=& |N_t(B_{\gamma_1})|+|N_{t+1} (B_{\gamma_2})| \label{eqx3}\\ &>& |B_{\gamma_1})|+|B_{\gamma_2}|=|B_{\gamma}| \end{eqnarray} From (\ref{eqx1}) to (\ref{eqx2}) is true because after price reduction at time $t$, buyer belongs to the neighbor of constricted good set $S^*_t$ will only prefer goods in $S^*_t$, therefore $N_{t+1}(N_t(S^*_t))=S^*_t$. From (\ref{eqx2}) to (\ref{eqx3}) is true because $N_t(B_{\gamma_1}) \cap S^*_t = \emptyset$ (by definition). Then, we have discussed before that the price reduction in $S^*_t$ will never remove any edges between $\{ \mathscr{B}^s_t \cap {N_t(S^*_t)}^c \}$ and $N_t(\{ \mathscr{B}^s_t \cap {N_t(S^*_t)}^c \})$. Since goods not in the most skewed set at time $t$ will not add new buyers to their neighbor, the equivalence between $N_{t+1}(B_{\gamma_1}) \cap {S^*_t}^c$ and $N_t(B_{\gamma_1})$ holds. Therefore, for every non empty set of buyers $B\subseteq \mathscr{B}^s_{t+1}$, $|B|<|N_{t+1}(B)|$. The mathematical induction works for all $k \in \mathbb{N}$. Since our algorithm terminates in finite round, $|B|< |N_T(B)|$, Q.E.D. \end{proof} With Claim \ref{cl1}, \ref{cl2}, \ref{cl3}, the skew-aided algorithm satisfies $|B|<|N^D_t(B)|$ for any non-empty set of buyer $B$ on termination. \subsection{Proof of Lemma \ref{lem:conv}}\label{pf:lem:conv} First, we prove that the algorithm terminates in finite (at most $|\mathcal{M}|^3$) rounds by investigating the relationship of the most skewed sets in the consecutive rounds, $S^*_t$, $S^*_{t+1}$. The relationship of $S^*_t$, $S^*_{t+1}$ has four cases. \begin{enumerate} \item $S^*_t=S^*_{t+1}$ \item $S^*_t \subset S^*_{t+1}$ \item $S^*_t \supset S^*_{t+1}$ \item $S^*_t \nsubseteq S^*_{t+1}$ and $S^*_t \nsupseteq S^*_{t+1}$ \end{enumerate} Recall that $W(G)$ is the skewness of the graph $G$ and $N_t(S)$ is the neighbor of $S$ based on the preference graph at round $k$. \\ In case 1, $W(G_t)-W(G_{t+1})=f_t(S^*_t)-f_{t+1}(S^*_{t+1})=f_t(S^*_t)-f_{t+1}(S^*_t)\geq 1$. \\ In case 2, define $S'=S^*_{t+1}\setminus S^*_t$, and it is trivial that $S^*_t \subset S^*_{t+1}$ implies $1>\frac{1}{|S^*_t|}-\frac{1}{|S^*_{t+1}|}>0$. \begin{eqnarray} &&W(G_t)-W(G_{t+1})=f_t(S^*_t)-f_{t+1}(S^*_{t+1})\\ &=&|S^*_t|-|N_t(S^*_t)|-|S^*_{t+1}|+|N_{t+1}(S^*_{t+1})| +\dfrac{1}{|S^*_t|}-\dfrac{1}{|S^*_{t+1}|} \label{eq6}\\ &\geq &|S^*_{t+1}|-|N_t(S^*_{t+1})|-|S^*_{t+1}|+|N_{t+1}(S^*_{t+1})|+\dfrac{1}{|S^*_t|}-\dfrac{1}{|S^*_{t+1}|} \label{eq7}\\ &=&|N_{t+1}(S^*_t \cup S')|-|N_t(S^*_{t+1})|+\frac{|S^*_{t+1}|-|S^*_t|}{|S^*_t||S^*_{t+1}|} \nonumber \\ &\geq &|N_{t+1}(S^*_t \cup S')|-|N_t(S^*_{t+1})| + \dfrac{1}{|\mathcal{M}|(|\mathcal{M}|-1)} \label{eq8}\\ &=&|N_{t+1}(S^*_t)|+|N_{t+1}(S')\cap N_{t+1}(S^*_t)^c| -|N_t(S^*_{t+1})|+ \dfrac{1}{|\mathcal{M}|^2-|\mathcal{M}|} \label{eq9}\\ &=&|N_t(S^*_t)|+|N_{t+1}(S_t)\setminus N_t(S^*_t)|- |N_t(S^*_{t+1})| +|N_{t+1}(S')\cap N_{t+1}(S^*_t)^c|+ \tfrac{1}{|\mathcal{M}|^2-|\mathcal{M}|} \label{eq10} \end{eqnarray} Before going to further steps, we have to briefly explain the logic behind the above equations. (\ref{eq6}) to (\ref{eq7}) is true because $N_t(S^*_t) \subseteq N_t(S^*_{t+1})$. (\ref{eq8}) to (\ref{eq9}) is to expand $|N_{t+1}(S^*_t \cup S')|$ to $|N_{t+1}(S^*_t)|+|N_{t+1}(S')\cap N_{t+1}(S^*_t)^c|$. (\ref{eq9}) to (\ref{eq10}) is to expand $|N_{t+1}(S^*_t)|$ to $|N_t(S^*_t)|+|N_{t+1}(S_t)\setminus N_t(S^*_t)|$. Since $|N_{t+1}(S')\cap N_{t+1}(S^*_t)^c|=|N_{t+1}(S')\cap N_{k}(S^*_t)^c|-|N_{t+1}(S')\cap (N_{t+1}(S_t)\setminus N_t(S^*_t))|$, and $|N_{t+1}(S_t)\setminus N_t(S^*_t)|\geq |N_{t+1}(S')\cap (N_{t+1}(S_t)\setminus N_t(S^*_t))|$, we can further summarize the first four terms in (\ref{eq10}). \begin{eqnarray} &&|N_t(S^*_t)|+|N_{t+1}(S_t)\setminus N_t(S^*_t)| +|N_{t+1}(S')\cap N_{t+1}(S^*_t)^c| - |N_t(S^*_{t+1})| \\ &\geq & |N_t(S^*_t)|+|N_{t+1}(S')\cap N_{k}(S^*_t)^c| -|N_t(S^*_{t+1})|\\ &=& |N_t(S^*_t)|+|N_{t+1}(S')\cap N_t(S^*_t)^c| -|N_t(S^*_t)|-|N_t(S')\cap N_t(S^*_t)^c| \\ &=& |N_{t+1}(S')\cap N_t(S^*_t)^c|-|N_t(S')\cap N_t(S^*_t)^c| \label{eq32} \\ &=& |N_t(S')\cap N_t(S^*_t)^c|-|N_t(S')\cap N_t(S^*_t)^c|=0 \label{eq33} \end{eqnarray} (\ref{eq32}) to (\ref{eq33}) is true because $S'$ is not in $S^*_t$, the neighbor of $S'$ not in the neighbor of $S^*_t$ remains the same from $k$ to $t+1$ round. With equation (\ref{eq10}) and (\ref{eq33}), we can conclude that $W(G_t)-W(G_{t+1})\geq \frac{1}{|\mathcal{M}|^2-|\mathcal{M}|}$ in case 2.\\ \\ In case 3, since every elements in $S^*_t$ belongs to $S^*_t$, $f_t(S^*_{t+1}) \geq f_{t+1}(S^*_{t+1})$. Given that $\dfrac{1}{|S^*_t|}<\dfrac{1}{|S^*_{t+1}|}$ and $f_t(S^*_t)-f_t(S^*_{t+1})>0$ by definition, $|S^*_t|-|S^*_{t+1}|+|N_t(S^*_t)|-|N_t(S^*_{t+1})|\geq 1$. With the knowledge that $S^*_t$ and $S^*_t$ are non-empty set, it is obvious that $f_t(S^*_t)-f_t(S^*_{t+1})$ is lower-bounded by $\tfrac{1}{2}$. Therefore, we can conclude that $W(G)_t-W(G_{t+1})=f_t(S^*_t)-f_{t+1}(S^*_{t+1}) \geq f_t(S^*_t)-f_t(S^*_{t+1}) \geq \frac{1}{2}$ in case 3.\\ \\ In case 4, define $S'=S^*_{t+1} \setminus S^*_t$, $S''=S^*_t \setminus S^*_{t+1}$, and $T=S^*_t \cap S^*_{t+1}$. \begin{eqnarray} && W(G_t)-W(G_{t+1}) \\ &=&f_t(S^*_t)-f_{t+1}(S^*_{t+1}) \\ &=& |T|+|S''|-|N_t(T)|-|N_t(S'')\setminus N_t(T)|+\frac{1}{|S^*_t|} - |T|-|S'|+|N_{t+1}(S^*_{t+1})|-\frac{1}{|S^*_{t+1}|} \\ &=& |S''|-|N_t(S'')\setminus N_t(T)|+\frac{1}{|S^*_t|}-\frac{1}{|S^*_{t+1}|} +|N_{t+1}(S^*_{t+1})|-|N_t(T)|-|S'| \\ &\geq & 1+\frac{1}{|S^*_t|}-\frac{1}{|S^*_{t+1}|}+|N_{t+1}(S^*_{t+1})| -|N_t(T)|-|S'| \\ &\geq & 1+\frac{1}{|\mathcal{M}|}-1+|N_{t+1}(T))|-|N_t(T)|+|N_{t+1}(S')\setminus N_{t+1}(T)|-|S'| \\ &= & \frac{1}{|\mathcal{M}|}+|N_{t+1}(T))|-|N_t(T)| +|N_{t+1}(S')\setminus N_{t+1}(T)|-|S'| \label{eq11}\\ &\geq & \frac{1}{|\mathcal{M}|}+|N_{t+1}(S')\setminus N_{k}(T)|-|S'| \geq \frac{1}{|\mathcal{M}|} \label{eq12}\\ \end{eqnarray} Most of the equations in case 4 are straight-forward except from (\ref{eq11}) to (\ref{eq12}). (\ref{eq11}) to (\ref{eq12}) is true because of the following inequalities: \begin{eqnarray} &&|N_{t+1}(S')\setminus N_{t+1}(T)|+|N_{t+1}(T))|-|N_t(T)| \nonumber \\ &=&|N_{t+1}(S')\setminus N_t(T)|+|N_{t+1}(T))|-|N_t(T)|-| \{N_{t+1}(S') \cap N_{t+1}(T) \}\setminus N_t(T)| \\ &\geq & |N_{t+1}(S')\setminus N_t(T)|-| N_{t+1}(T)\setminus N_t(T)| +|N_{t+1}(T))|-|N_t(T)| \\ &=& |N_{t+1}(S')\setminus N_t(T)| \end{eqnarray} Combine these four cases, we know that \begin{eqnarray} W(G_t)-W(G_{t+1}) \geq \dfrac{1}{ |\mathcal{M}|^2-|\mathcal{M}|}. \end{eqnarray} Therefore, we can conclude that the proposed algorithm terminates in finite rounds. (At most $|\mathcal{M}|^3$ rounds because $W(G)<|\mathcal{M}|$ and minimum decrement is greater than $\tfrac{1}{|\mathcal{M}|^3}$). \subsection{Proof of Lemma \ref{lem:alg2}}\label{pf:lemalg2} We will prove Algorithm \ref{alg:alg2} always return the most skewed set by contradiction.\\ Since every untraversed good upon termination can be matched with an untraversed buyer without repetition. Therefore, adding any set of runtraversed goods $S_U$ to the set $S$ will always reduce the skewness of $S$ (because the increase of cardinality in neighbor of $S$, $|N(S_U)|-|N(S)|$ is always greater than or equal to the increase of cardinality of $S$, $|S_U|-|S|$). Hence, the most skewed set will never contain any untraversed good. Suppose there exists a set $S'$ is the most skewed set, with a higher skewness than the set $S$ return by Algorithm \ref{alg:alg2}, $S'$ must be a subset of $S$ because there's no untraversed good in the most skewed set and $f(S')>f(S)$. Let $S^*=S\setminus S'$, $f(S')>f(S)$ and $S' \subset S$ implies $|N(S^*)\setminus N(S')|-|S^*|>0$. If this happens, there must be a non-empty set of matching pairs match nodes from $S^*$ to $N(S^*)\setminus N(S')$ without repetition. Since $N(S^*)\setminus N(S')$ is not in $N(S')$ under the directed graph, nodes in $S^*$ will not be traversed in the algorithm contradicts that $S^* \subset S$. \subsection{Proof of Theorem \ref{thm1}}\label{pf:thm1} First, it is straightforward that the algorithm terminates in at most $|\mathcal{M}|^3$ rounds (because $W(G)<|\mathcal{M}|$ and minimum decrement is greater than $\tfrac{1}{|\mathcal{M}|^3}$). However, only $|\mathcal{M}|^2$ positive distinct values of $W(G)$ are feasible because there are only $|\mathcal{M}|$ possible values on $|S^*_t|-|N(S^*_t)|$ and $|\mathcal{M}|$ possible values on $\frac{1}{|S^*_t|}$. Given that the sequence $W(G_t)$ is strictly decreasing w.r.t. $t$, there are at most $|\mathcal{M}|^2$ rounds of iteration in Algorithm \ref{alg:alg1}. Second, in Algorithm \ref{alg:alg2}, the Hopcroft-Karp algorithm runs in time $O(|\mathcal{M}|^{2.5})$, and the complexity of the BFS algorithm is $O(|\mathcal{M}|+|\text{number of directed edges}|)$. Since the number of directed edges is upper-bounded by $|\mathcal{M}|^2$, the complexity of Algorithm \ref{alg:alg2} is $O(|\mathcal{M}|^{2.5}+|\mathcal{M}|^2)=O(|\mathcal{M}|^{2.5})$. Therefore, Algorithm \ref{alg:alg1} has complexity upper-bounded by $O(|\mathcal{M}|^{2.5}\times|\mathcal{M}|^2)=O(|\mathcal{M}|^{4.5})$. \begin{algorithm}[H] \caption{Algorithm in search of the maximally skewed set by coloring preference graph} \begin{algorithmic}[1] \Require A colored preference graph, a set of buyers $A$ would be added to the neighbor of the previous maximally skewed set \Ensure An updated colored preference graph \If {Input preference graph is not colored} \State Run Hopcroft-Karp algorithm to find a maximum matching \State Color every edges connecting a matched pair red and all other edges blue, Color every vertex in a matched pair red and all other vertice blue \State Starting from $\mathcal{M}_b$, run the rb-BFS to get a reachable set $R(\mathcal{M}_b)$ \State Color $R(\mathcal{M}_b)\setminus \mathcal{M}_b$ green \Else \State Update the colored preference graph by removing all edges connecting red goods and green buyers and adding corresponding blue edges connecting goods and buyers in $A$ \While {$\{A\cap\mathcal{B}_b\} \neq \emptyset$} \State Pick an element $a$ in $\{A\cap\mathcal{B}_b\}$ \If {$|N(a) \cap \mathcal{M}_b|>1$} \State Pick arbitrary $x \in \{N(a)\cap \mathcal{M}_b\}$, color $(a,x) \in E$ red and color $a,x$ green. \ElsIf {$|\{N(a) \cap \mathcal{M}_b\}|=1$} \State Let $x$ be the unique good in $\{N(a)\cap \mathcal{M}_b\}$, color $(a,x) \in E$ red and color $a,x$ green. \If{$\{N(a)\cap \mathcal{M}_g\}\neq \emptyset$} \State Run the rb-DFS starting from $x$ in $G(\mathcal{M}_g \cup \mathcal{M}_b,\mathcal{B}_g, E^{gb}_{gb})$ to get a reachable set $R(x)$, then color vertice in $R(S)$ red if $R(x)\cap \mathcal{M}_b = \{x\}$ \Else \State Run the br-DFS starting from $a$ in $G(\mathcal{M}_g \cup \mathcal{M}_b,\mathcal{B}_g, E^{gb}_{gb})$ to get a reachable set $R(x)$, then color vertice in $R(S)$ red if $R(x)\cap \mathcal{M}_b = \{x\}$ \EndIf \ElsIf {$\{N(a) \cap \mathcal{M}_g\} \neq \emptyset$} \State Run the rb-DFS starting from $a$ in $G(\mathcal{M}_g\cup \mathcal{M}_b,\mathcal{B}_g, E^{gb}_{gb})$ till find the first $x \in \mathcal{M}_b$ \State Color $a,x$ green and switch the color of every edge used in a path from $a$ to $x$. \State Start a br-BFS from $\mathcal{M}_b$ in $G(\mathcal{M}_g\cup \mathcal{M}_b,\mathcal{B}_g, E^{gb}_{g})$ to get a reachable set $R(\mathcal{M}_b)$. \State Color every vertex in $\{\mathcal{M}_g \cup \mathcal{B}_g\}\setminus R(\mathcal{M}_b)$ red \EndIf \State Remove $a$ from $A$ \EndWhile \If {$A \neq \emptyset$} \State Run the br-BFS starting from $\{\mathcal{M}_g\}$ in $G(\mathcal{M},\mathcal{B}, E)$ to get a reachable set $R(S^*)$ \If {$\{R(S^*) \cap \mathcal{B}_b\}=\emptyset$} \State Color all vertice in $R(S)\setminus \mathcal{M}_b$ green \Else \While{$\{R(S^*) \cap \mathcal{B}_b\}\neq\emptyset$} \State Pick $a \in R(S^*) \cap \mathcal{B}_b$ and run rb-DFS starting from $a$ to get the reachable set $R(a)$ \If {$\exists x\in R(a), x \in \mathcal{M}_b$} \State Color $a,x$ green; switch the color of every edge used in a path from $a$ to $x$ \State Start a br-BFS from $\mathcal{M}_b$ in $G(\mathcal{M}_g\cup \mathcal{M}_b,\mathcal{B}_g, E^{gb}_{g})$ to get a reachable set $R(\mathcal{M}_b)$. \State Color every vertex in $\{\mathcal{M}_g \cup \mathcal{B}_g\}\setminus R(\mathcal{M}_b)$ red \EndIf \EndWhile \State Run the br-BFS starting from $\{\mathcal{M}_b\}$ in $G(\mathcal{M},\mathcal{B}_g, E)$ to get a reachable set $R(\mathcal{M}_b)$ \State Color all vertice in $\{\mathcal{M}_g\cup \mathcal{B}_g\}\setminus R(\mathcal{M}_b)$ red \EndIf \EndIf \EndIf \end{algorithmic} \label{alg:alg3} \end{algorithm} \section{Conclusions and Future Work} \label{sec7} In this paper, we proposed a descending price algorithm in search of sets of the maximum MCPs by exploiting the combinatorial structure of bipartite graphs in matching markets. The algorithm terminates in at most $m^2$ rounds for any non-negative valuation matrix with runtime $O(m^4)$. There are three main avenues for future work. First, we would like to determine whether one can reduce the complexity further to $O(m^3)$ mirroring the Hungarian algorithm. Second, as incentive compatibility does not hold with the maximum MCP, we would like to determine the equilibrium bidding strategy in a Bayesian Nash equilibrium given the proposed mechanism. This will be necessary for expected revenue computation, and for a comparisons with the VCG mechanism, GSP and laddered auction proposed in \cite{GSP,ladder}, and also other mechanisms such as the GFP auction. Finally, many real-world applications of matching markets outside of the online advertising setting are not unit-demand~\cite{oviedo2005theory} and obtaining a combinatorial version of the descending price auction returning the maximum MCP is a challenging open problem for future work. \section{Discussions} \label{sec6} We now discuss some interesting points of the choices made in our algorithm, some nuances in terms of the final bipartite graphs, and a few comments on the non-monotonicity of bidding with strategic concerns. \subsection{Choice of Constricted Goods Set} \label{sec6.1} Suppose we do not choose the most skewed set in our algorithm, then it follows that we may obtain different MCP vectors. However, a natural question to ask is the following: if we run the algorithm two times and choose different constricted good sets at some iterations such that the bipartite graph produced in every round of these two executions are the same, will we get the same MCP vector? Unfortunately, the choice of the same initial price vector, the same price reduction rule, and the emergence of the same bipartite graph in every round are not enough to guarantee the same returned MCPs. A counterexample is provided in Fig. \ref{fig4}. \begin{figure}[h] \centering \includegraphics[width=0.4\textwidth]{./Figures/constricted.pdf} \caption{Counterexample of same bipartite graph but different set MCPs} \label{fig4} \end{figure} In Fig. \ref{fig4}, the bipartite graphs A-1, B-1 have the same preference graph. Though the chosen constricted good sets in A, B are different, they add the same buyer to the constricted graph. Therefore, the preference graphs in A-2, B-2 are still the same. However, the updated price vector of A-2, B-2 must be different. If A, B choose the same constricted goods set in every round, the returned sets of MCPs of A, B must be different. This example shows that just the bipartite graphs in every round cannot uniquely determine the MCP vector obtained at the termination of the algorithm. \subsection{Failure of Connectivity in Matching Markets} \label{sec6.3} In general matching markets, the set of goods in the bipartite graph is not always connected, even at the maximum MCP. A disconnected structure in bipartite graph implies a set of buyers' bids/values may play no role on another set of buyers' payment in the MCP. In other words, a set of buyers will be indifferent when another sets of buyers bids/values are within specific regions; this phenomenon happens when sets of buyers have greater affinity for some pre-determined types of goods, i.e., valuation of men and women on ties and high heels would satisfy such a property. In sponsored search markets, however, the set of goods in the initial bipartite graph is connected\footnote{Every good is preferred by the buyer with the highest bid.}. Furthermore, the following lemma shows that our skewed-set aided descending price algorithm will preserve the connectivity property in all iterations, and therefore also at termination. \begin{lem} \label{lem8} In sponsored search markets with the skewed-set aided descending price algorithm, any set of goods in every bipartite graph that is encountered during the execution of Algorithm \ref{alg:alg1} is connected. \end{lem} \begin{proof} Please see Appendix~\ref{sec:lem8}. \end{proof} In Lemma~\ref{lem8}, we addressed the connectivity property in sponsored search markets during the execution of our algorithm. Unfortunately, the connectivity does not always hold in general matching markets. Here we demonstrate this by a $4$-by-$4$ counter example below. To make this case as simple as possible, we just consider a realized valuation matrix \begin{eqnarray*} V= \begin{bmatrix} 5 & 4 & 1 & 1 \\ 3 & 3 & 2 & 2 \\ 2 & 2 & 3 & 3 \\ 1 & 1 & 4 & 5 \end{bmatrix}. \end{eqnarray*} Initially, the first two goods are preferred by buyer 1, and the last two goods are preferred by buyer buyer 4. In our algorithm, the most skewed set contains all goods, and price is reduced by one in the first round. After that, the MCP vector $\mathbf{P}=[4,3,3,4]$ and the bipartite graphs of initial and final steps are in Fig. \ref{fig:connectivity}. \begin{figure}[h] \centering \includegraphics[width=0.4\textwidth]{./Figures/connectivity.pdf} \caption{An example where both initial and final bipartite graphs are disconnected} \label{fig:connectivity} \end{figure} Fig. \ref{fig:connectivity} demonstrates that both the initial and final bipartite graphs are disconnected in our algorithm as there are two components. Therefore, preserving the connectivity property in the running of our algorithm holds in sponsored search markets, and may not otherwise. \subsection{Further Comments on Strategic Bidding} Unlike most of the non-incentive compatible auction mechanisms that overbidding above buyers' actual value is always irrational, a buyer may benefit from bidding higher than her actual value to enjoy a lower price under the proposed algorithm in some scenarios. We can show this by a simple example below. First, we present two valuations matrices that will yield the same matching but different prices with the difference in the matrices only being the valuations of one buyer. These are \begin{eqnarray*} V_1= \begin{bmatrix} 4 & 5 & 5 & 6 \\ 2 & 4 & 5 & 5 \\ 1 & 2 & 4 & 5 \\ 0 & 1 & 2 & 4 \end{bmatrix}, \quad V_2 = \begin{bmatrix} 4 & 5.9 & 5.9 & 6.9 \\ 2 & 4 & 5 & 5 \\ 1 & 2 & 4 & 5 \\ 0 & 1 & 2 & 4 \end{bmatrix}. \end{eqnarray*} The maximum MCPs are $P_1=[1, 2, 3, 4]$ and $P_2=[0.1,2,3,4]$, respectively, and in both cases buyer $i$ gets matched to good $i$ for all $i\in \{1,\dotsc,4\}$. Now if we assume that the true valuations of all the buyers is given by matrix $V_1$, then by unilaterally deviating to a higher bid, buyer $1$ is able to dramatically increase her payoff without impacting any other buyers. While this is only an example, we believe that this will occur with non-zero probability and will necessitate an alternate means of determining the equilibrium bidding behavior. \section{Preliminary Analysis of Strategic Buyers and Bayesian-Nash Equilibrium} \label{sec5} As mentioned in the introduction, the proposed descending price algorithm is not incentive compatible, and so we need to explore Bayesian Nash equilibrium (BNE) to predict buyers' strategic behaviors. From the messaging viewpoint we will assume that we have a direct mechanism where the buyers bid their valuation: a scalar in sponsored search markets, and a vector in the general matching market. Algorithm \ref{alg:alg1} is then applied as a black-box to the inputs to produce a price on each good and a perfect matching. With expected revenue being an important concern, we provide an instance achieving higher expected revenue than VCG mechanism in an asymmetric BNE. Furthermore, a case provided to show the possibility of overbidding. Additional analyses of BNE in two simple cases with symmetric buyers and the associated bidding strategy of the buyers are provided in Appendices \ref{apdx:analysis} and \ref{apdx:analysis2}. \subsection{An Instance Achieving higher expected revenue than VCG}\label{sec:greatRev} Given the proposed algorithm, it is important to check if there exists a scenario that our algorithm obtain a higher expected revenue than the VCG mechanism. There is a large body of literature discussing the failure of getting the VCG revenue under asymmetric distribution of buyers' valuations, e.g., see \cite{VCGfailure}. Additionally, the well-known revenue equivalence theorem holds with an assumption that valuation of every player is drawn from a path-connected space in Chap. 9.6.3 of \cite{SSMbook}\footnote{Two other assumptions are (1) both mechanisms implement the same social welfare function; (2) for every player $i$, there exists a type that the expected payments are the same in both mechanisms}. With this knowledge, we demonstrate a $3\times 3$ matching market, where the buyers have asymmetric distributions of their valuations, for which our mechanism achieves higher than VCG revenue. Consider three advertisers named Alice, Bob, and Carol, and three different types of ads called listing ads, sidebar ads, and pop-ups. The realized valuation is only known to the advertiser (equivalently buyer), but the distribution of an advertisers' valuation is known to other advertisers but not the auctioneer. In other words, the auctioneer can only calculate the price according to the bids submitted by the advertisers. The minimum increment of the submitted bids is $\epsilon$, which is a positive infinitesimal, and the valuation matrix of advertisers is displayed in Table \ref{tbl:1}. \begin{table}[h] \centering \caption{Valuation matrix of advertisers} \label{tbl:1} \begin{tabular}{|l|l|l|l|} \hline & Listing & Sidebar & Pop-ups \\ \hline Alice & W & 0 & 0 \\ \hline Bob & X & 0 & 0.5 \\ \hline Carol & Y & Z & 2 \\ \hline \end{tabular} \\ \begin{tabular}{|ll|} \hline Probability density function of $W,X,Y,Z$ &\\ \hline $f_W(w)=\begin{cases} \frac{2}{3} &~w\in [0,1) \\ \frac{1}{3} &~w\in (2,3] \\ 0 &~\text{o/w} \end{cases} $ & $f_X(x)=\begin{cases} \frac{2}{3} &~x\in [1.5,2.5] \\ \frac{1}{3} &~x\in (2.5,3.5] \\ 0 &~\text{o/w} \end{cases}$ \\ $f_Y(y)=\begin{cases} 2 &~y\in [3.5,4] \\ 0 &~\text{o/w} \end{cases}$ &$f_Z(z)=\begin{cases} 1 &~z\in [3,4] \\ 0 &~\text{o/w} \end{cases} $ \\ \hline \end{tabular} \end{table} Now, we give an asymmetric BNE\footnote{Multiple equilibria may exist.} in this matching market, with a detailed verification in the Appendix \ref{asymBNE}. First, assume that Alice always bids 0 on sidebar ads and pop-ups, and bids $\max \{1-\epsilon, \frac{w}{2}\}$ on listing ads. The best response of Bob is to bid 0 on both sidebar ads and pop-ups, and to bid $\max \{1, \frac{x-0.5}{2}\}$ on listing ads for any realized $x$. Now, given Bob's bidding function as above, one of Alice's best responses is to follow her original bidding function. Last, consider the bidding function of Alice and Bob mentioned above, a best response of Carol is to bid 0 on listing ads and pop-ups, and to bid $\epsilon$ on sidebar ads regardless of the outcomes of $y$ and $z$. \footnote{The $\epsilon$ is designed to avoid complex tie-breaking rules.}, even if $y>z$. This is because Carol will never win listing ads for any bids less than $1$ as the probability $\text{Pr}\{y-z \geq 1\}=0$. Now, given Carol's bidding strategy, Alice and Bob will not change their bidding functions. Therefore, the strategy $\{\beta_{\mathrm{Alice}}(w,0,0), \beta_{\mathrm{Bob}}(x,0,0.5),\beta_{\mathrm{Carol}}(y,z,2)\}=\{(\max \{1-\epsilon, \frac{w}{2}\},0,0), (\max \{1, \frac{2x-1}{4}\},0,0),(0,\epsilon,0)\}$ can be verified to be an asymmetric BNE. With the asymmetric BNE in hand, we want to calculate the expected revenue of the auctioneer and compare it with the expected revenue of the VCG mechanism. Since Carol always wins the sidebar ads and both Alice and Bob bid 0 on that, Carol will pay $\epsilon$. Additionally, in the asymmetric BNE, Alice and Bob compete on the listing ads and both bid 0 on sidebar ads and pop-ups, resulting in the payment of listing ads to be the same as the payment in the first price auction. Using this the expected revenue of the auctioneers is given by \begin{eqnarray} &&\epsilon+\frac{4}{9}\int_0^1\int_{1.5}^{2.5} 1 dxdw+\frac{2}{9}\int_2^3\int_{1.5}^{2.5} \frac{w}{2} dxdw+\frac{2}{9}\int_1^2\int_{2.5}^{3.5} \frac{2x-1}{4} dxdw \nonumber \\&+&\frac{1}{9}\int_2^3\int_{2.5}^{w+0.5} \frac{w}{2} dxdw+\frac{1}{9}\int_{2.5}^{3.5}\int_2^{x-0.5} \frac{2x-1}{4} dwdx =\dfrac{31}{27}+\epsilon \end{eqnarray} The last step is to calculate the expected revenue of the VCG mechanism, which is given by \begin{eqnarray} &&\frac{2}{3}\int_0^1\int_{1.5}^{2.5} w dxdw+\frac{2}{9}\int_2^3\int_{1.5}^{2.5} (x-0.5) dxdw+\frac{1}{9}\int_{2.5}^{3.5}\int_2^{x-0.5} w dwdx \nonumber \\&+&\frac{1}{9}\int_2^3\int_{2.5}^{w+0.5} (x-0.5) dxdw =\dfrac{1}{3}+\dfrac{2}{9}\times \dfrac{3}{2}+\dfrac{1}{9}\times \dfrac{7}{6}++\dfrac{1}{9}\times \dfrac{7}{6}=\dfrac{25}{27} \end{eqnarray} Even if we set $\epsilon$ to 0, it is obvious that the expected revenue derived under our descending price auction algorithm is strictly greater than the expected revenue of the VCG mechanism. This shows that in some instances the proposed descending price algorithm is preferred to the (DGS) ascending price algorithm, even taking the strategic behavior of buyers into account. \subsection{Further Comments on Strategic Bidding} Unlike most of the non-incentive compatible auction mechanisms where overbidding above buyers' actual value is always irrational, in some scenarios a buyer may benefit from bidding higher than her actual value to enjoy a lower price in the proposed algorithm. We show this by a simple example below. First, we present two valuations matrices that will yield the same matching but different prices with the difference in the matrices only being the valuations of one buyer. These are \begin{eqnarray*} V_1= \begin{bmatrix} 4 & 5 & 5 & 6 \\ 2 & 4 & 5 & 5 \\ 1 & 2 & 4 & 5 \\ 0 & 1 & 2 & 4 \end{bmatrix}, \quad V_2 = \begin{bmatrix} 4 & 5.9 & 5.9 & 6.9 \\ 2 & 4 & 5 & 5 \\ 1 & 2 & 4 & 5 \\ 0 & 1 & 2 & 4 \end{bmatrix}. \end{eqnarray*} The maximum MCPs are $P_1=[1, 2, 3, 4]$ and $P_2=[0.1,2,3,4]$, respectively, and in both cases buyer $i$ gets matched to good $i$ for all $i\in \{1,\dotsc,4\}$. Now if we assume that the true valuations of all the buyers is given by matrix $V_1$, then by unilaterally deviating to a higher bid on three goods, buyer $1$ is able to dramatically increase her payoff without impacting any other buyer. While this is only an example, we believe that this will occur with non-zero probability and will necessitate an alternate means of determining the equilibrium bidding behavior.
{'timestamp': '2017-11-07T02:05:04', 'yymm': '1607', 'arxiv_id': '1607.04710', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04710'}
arxiv
\section{Introduction}\label{sc_intro} In this paper we discuss the application of a skewed-$t$ model suitable to capture skewness and kurtosis commonly present in insurance risks data. In particular, we introduce a Bayesian approach based on minimal informative prior distributions \citep{Villa:Walker:2014b} to estimate the parameters of the asymmetric Student-$t$ distribution (AST) introduced in \cite{Fernandez:Steel:1998} and re-proposed in \cite{Zhu:Galb:2010}. Insurance risks data, for example insurance losses, tend to present skewed behaviour \citep{Lane:2000, Vernic:2006} in almost any circumstance. Furthermore, losses related to catastrophes (e.g. earthquakes, exceptional floods, etc) are also better modelled by distributions with relatively heavy tails, as they quite often include extreme events. It is therefore appropriate to use a statistical model that can simultaneously account for data that is skewed and with values that may be extreme in behaviour. The generalised AST distribution, presented in Section \ref{sc_prelim}, includes a skewness parameter and allows to control the heaviness of both the left and right tails by means of a parameter representing the number of degrees of freedom. An obvious advantage of the AST, as it will be discussed, is that it allows to \textit{adjust} to the observed data, in the sense that can consider both skewed and non-skewed data and heavy-tailed data as well as observations that are suitable to be modelled by a distribution with tails like the one of the normal density. In other words, by estimating the parameter controlling the skewness of the distribution and the number of degrees of freedom, translates into a model selection scenario, where the competing models are: the normal distribution, the $t$ distribution, the skew normal and the skew $t$. It is often important to consider cases where the prior information about the true parameter values is minimal. There are circumstances where the prior information is not available or, for some reasons, it is not reliable or practical to be used. As such, we consider an inferential scenario where the prior distributions for the parameters of the model are set up according to objective Bayesian criteria. Note that here, the term ``objective'' is not intended to represent an actually objective set up, but simply to categorise the procedure followed to derive the prior distributions as one that provides an output in a sort of an automated fashion \citep{Berger:2006}. The choice of the objective prior for the skewness parameter is the Jeffreys' prior, while for the location and the scale parameters we will adopt the reference prior. For the number of degrees of freedom we adopt the truncated discrete prior proposed in \cite{Villa:Walker:2014a}. Although we do not discuss the possibility of using prior distributions elicited on the basis of reliable prior information, we still believe that it would be the most sensible way to proceed. Of course, the fact that inferential results can be effectively obtained by means of an objective Bayesian approach, it just strengthens the proposed model, as it allows to remove the (not always easy) task of translating prior information into prior probability distributions. \\ The paper is organised as follows. In Section \ref{sc_prelim} we introduce the asymmetric Student-$t$ distribution and discuss some of its properties. We also present the prior distributions used for the parameters and, in particular, the prior for the number of degrees of freedom, which we argue to have a support that is discrete and truncated. In Section \ref{sc_priors} we explicit the prior for the number of degrees of freedom and prove its independence from the skewness parameter. This result is key in motivating the prior for $\nu$ proposed by \cite{Villa:Walker:2014a}. Section \ref{sc_simul} is dedicated to present the results of a simulation study aimed to analyse the frequentist properties of the posterior distribution for the number of degrees of freedom. To complete the discussion of the proposed approach to model insurance loss data, in Section \ref{sc_real} we analyse two well known data sets. We are able to show the versatility of the model in a scenario of skewed data with extreme events and in a scenario where a symmetric normal distribution is sufficient to be used as a model. Final discussion points and conclusions are presented in Section \ref{sc_disc}. \section{Preliminaries}\label{sc_prelim} In this paper, we consider the asymmetric Student-$t$ (AST) distribution whose general density has the form \begin{equation}\label{eq_ast1} f(x|\alpha,\nu,\mu,\sigma) = \left\{ \begin{array}{l l} \dfrac{K(\nu)}{\sigma}\left[1+\dfrac{1}{\nu}\left(\dfrac{x-\mu}{2\alpha\sigma}\right)^2\right]^{-\frac{\nu+1}{2}} & \quad x\leq\mu\\ \dfrac{K(\nu)}{\sigma}\left[1+\dfrac{1}{\nu}\left(\dfrac{x-\mu}{2(1-\alpha)\sigma}\right)^2\right]^{-\frac{\nu+1}{2}} & \quad x>\mu \end{array} \right. \end{equation} where $\alpha\in(0,1)$ represents the skewness parameter, $\mu$ is the location parameter, $\sigma$ is the scale parameter, and $\nu$ represents the degrees of freedom, with $$K(\nu)\equiv\Gamma((\nu+1)/2)/[\sqrt{\pi\nu}\Gamma(\nu/2)],$$ see \cite{Fernandez:Steel:1998} and \cite{Zhu:Galb:2010} for a detailed discussion of the distribution and its properties. The usual Student-$t$ distribution can be recovered by setting $\alpha=1/2$ in \eqref{eq_ast1}, while the skewed Cauchy and the skewed normal distributions are special cases obtained when $\nu=1$ and $\nu=+\infty$, respectively. In the Bayesian framework, the inference about the parameter of a model is accomplished by combining the prior uncertainty about the true value of the parameters, expressed in the form of probability distributions, and the information contained in the observed sample. The latter is expressed by the likelihood function which, for the model in \eqref{eq_ast1}, has the form \begin{eqnarray}\label{eq_like1} L(\alpha,\nu,\mu,\sigma|x) &=& \prod_{i=1}^n f(x_i|\alpha,\nu,\mu,\sigma) \nonumber \\ &=& \prod_{x_i\leq\mu}\dfrac{K(\nu)}{\sigma}\left[1+\dfrac{1}{\nu}\left(\dfrac{x_i-\mu}{2\alpha\sigma}\right)^2\right]^{-\frac{\nu+1}{2}} \times \prod_{x_i>\mu}\dfrac{K(\nu)}{\sigma}\left[1+\dfrac{1}{\nu}\left(\dfrac{x_i-\mu}{2(1-\alpha)\sigma}\right)^2\right]^{-\frac{\nu+1}{2}}. \end{eqnarray} Thus, if we indicate the joint prior distribution for the parameters by $\pi(\alpha,\nu,\mu,\sigma)$, the posterior distribution is given by \begin{equation}\label{eq_prior_1} \pi(\alpha,\nu,\mu,\sigma) \propto L(\alpha,\nu,\mu,\sigma|x)\times\pi(\alpha,\nu,\mu,\sigma). \end{equation} The prior distributions will be discussed in Section \ref{sc_priors}. However, we believe it is useful to give an overview of the overall approach in this section. In this paper we adopt an objective Bayesian approach to make inference on the unknown parameters of the density in \eqref{eq_ast1}. To proceed, we assume that the tail parameter $\nu$ is discrete. That is, $\nu=1,2,\ldots$. The reason of choosing a discrete parameter space for $\nu$ is due to the close proximity of models with consecutive number of degrees of freedom. In line with what discussed for the $t$ density by \cite{Jacquier:2004} and \cite{Villa:Walker:2014a}, the amount of information from the observations (i.e. the sample size) will rarely be sufficient to discern between consecutive densities with a difference in the number of degrees of freedom smaller than one. As such, the choice of a discrete support for $\nu$, with intervals of size one, is sensible. It is still possible to define a discrete prior (with the same approach) over a more dense support; however, the choice has to be motivated by some prior evidence, such as the certainty of dealing with a very large sample size, and the resulting prior distribution will obviously be different as the amount of information would have changed. \section{The prior distributions for the parameters of the AST model}\label{sc_priors} In this section we outline the approach to derive the prior distributions for the parameters of the AST model. We dedicate most of this section to the prior for the number of degrees of freedom because, being a discrete parameter, presents some non-trivial challenges. We start by making the assumption that the parameters present, a priori, some degree of independence and, therefore, the prior has the form \begin{equation}\label{eq_prior.1} \pi(\alpha,\nu,\mu,\sigma) \propto \pi(\nu|\alpha,\mu,\sigma)\pi(\mu,\sigma)\pi(\alpha). \end{equation} As we will show in Section \ref{sc_nuprior}, the prior for the number of degrees of freedom does not depend on the skewness parameter, therefore $\pi(\nu|\alpha,\mu,\sigma)=\pi(\nu|\mu,\sigma)$. It has to be noted that, although objective methods aim to obtain prior distributions depending only on the chosen model, in practice there is always some degree of subjectivity involved. In this case, we make the assumption that the parameters are independent \emph{a priori}, noting that this is a common practice in objective Bayesian analysis. \subsection{Objective Bayes for discrete parameter spaces}\label{sc_intro_obj} One of the assumptions on which the model presented in this paper is based upon, is that the parameter representing the number of degrees of freedom ($\nu$) is considered as discrete. The specific reasons for this choice are presented in Section \ref{sc_nuprior}, but it is worthwhile to give an overview of the general idea behind the prior specific for $\nu$ here. Whilst there are several approaches to deal with continuous parameter spaces, such as Jeffreys' prior \citep{Jeffreys:1961} and reference prior \citep{BBS:2009}, discrete parameter spaces have always been dealt with on a case-by-case basis. Only recently general solutions for the discrete case have been put forward, with different degree of success. Among these, possibly the most noteworthy include \cite{Barger:Bunge:2008} and \cite{BBS:2012}. However, the former approach can be applied to a limited set of models, and the latter approach shows some deficiencies in terms of objectivity and generality. In this paper, we consider the method discussed in \cite{Villa:Walker:2014b}, which, as far as we know, is the sole objective approach that can be applied to any discrete parameter space without the necessity of being ``adjusted'' to the chosen model. The prior proposed in \cite{Villa:Walker:2014b} is based on the idea of assigning a \emph{worth} to each element $\theta$ of the discrete parameter space $\Theta$. The \emph{worth} is objectively measured by assessing what is lost if that parameter value is removed from $\Theta$, and it is the true one. Once the \emph{worth} has been determined, this will be linked to the prior probability by means of the self-information loss function \citep{Merhav:Feder:1998} $-\log\pi(\theta)$. A detailed illustration of the idea can be found in \cite{Villa:Walker:2014b}, but here is an overview. Let us indicate by $f(x;\theta)$ a distribution (either a mass function or a density) characterised by the unknown discrete parameter(s) $\theta$ and let $$D(f(x;\theta)\|f(x;\theta^\prime))=\int f(x;\theta)\log\left\{\frac{f(x;\theta)}{f(x;\theta')}\right\}\,dx$$ be the Kullback--Leibler divergence \citep{Kull:1951}. The utility (i.e. \emph{worth)} to be assigned to $f(x;\theta)$ is a function of the Kullback--Leibler divergence measured from the model to the nearest one; where the nearest model is the one defined by $\theta^\prime\neq \theta$ such that $D(f(x;\theta)\|f(x;\theta^\prime))$ is minimised. In fact (see \cite{Berk:1966}) $\theta^\prime$ is where the posterior asymptotically accumulates if the true value $\theta$ is excluded from $\Theta$. The objectivity of how the utility of $f(x;\theta)$ is measured is obvious, as it depends on the choice of the model only. Let us now write $u_1(\theta)=\log\pi(\theta)$ and let the minimum divergence from $f(x;\theta)$ be represented by $u_2(\theta)$. Note that $u_1(\theta)$ is the utility associated with the prior probability for model $f(x;\theta)$, and $u_2(\theta)$ is the utility in keeping $\theta$ in $\Theta$. We want $u_1(\theta)$ and $u_2(\theta)$ to be matching utility functions, as they are two different ways to measure the same utility in $\theta$. As it stands, $-\infty<u_1\leq0$ and $0\leq u_2<\infty$, while we actually want $u_1=-\infty$ when $u_2=0$. The scales are matched by taking exponential transformations; so $\exp(u_1)$ and $\exp(u_2)-1$ are on the same scale. Hence, we have \begin{equation}\label{eq1} e^{u_1(\theta)} = \pi(\theta) \propto e^{g\{u_2(\theta)\}}, \end{equation} where \begin{equation}\label{eq2} g(u) = \log(e^u-1). \end{equation} By setting the functional form of $g$ in \eqref{eq1}, as it is defined in \eqref{eq2}, we derive the proposed objective prior for the discrete parameter $\theta$ as follows \begin{equation}\label{eq3} \pi(\theta) \propto \exp \left\{ \min_{\theta\neq \theta^\prime \in\Theta} D(f(x;\theta)\|f(x;\theta^\prime)) \right\} - 1. \end{equation} We note that in this way the Bayesian approach is conceptually consistent, as we update a prior utility assigned to $\theta$, through the application of Bayes theorem, to obtain the resulting posterior utility expressed by $\log\pi(\theta\mid x)$. Indeed, there is an elegant procedure akin to the Bayes Theorem which works from a utility point of view, namely that $$\log\pi(\theta\mid x) = K + \log f(x\mid\theta) + \log\pi(\theta),$$ which has the interpretation of $$\text{Utility}(\theta\mid x,\pi) = K + \text{Utility}(\theta\mid x) + \text{Utility}(\theta\mid\pi),$$ where $K$ is a constant which does not depend on $\theta$. There is then a retention of meaning between the prior and the posterior information (here represented as utilities). This property is not shared by the usual interpretation of Bayes theorem when priors are objectively obtained; in fact, the prior would usually be improper, hence not representing probabilities, whilst the posterior is (and has to be) a proper probability distribution. \subsection{The prior for $\nu$}\label{sc_nuprior} In this Section we will show that the prior for $\nu$ introduced in \cite{Villa:Walker:2014a} can be used as prior for $\nu$ for the skewed Student-$t$ distribution. The prior for $\nu$ is based on similar arguments as the ones discussed in \cite{Villa:Walker:2014a}. In particular, we consider the following. First, the parameter is treated as discrete; that is, $\nu=1,2,\ldots$. The reason is that the amount of information provided from the data will rarely be sufficient to discern densities with $\nu$ separated by an interval smaller than one. In other words, in general, the sample size is not going to be sufficient to allow estimates more precise than size one. Whilst it is possible, in principle, to consider any continuous parameter as discrete, for this model we deem appropriate to limit the discretisation to $\nu$. Besides the above motivation, we note that considering $\nu$ as discrete has connection with an interpretation of a $t$-distributed random variable. In fact, a $t$ with $\nu$ degrees of freedom can be seen as the ratio of two independent random variables: a standard normal and the square root of a chi-square divided by its number of degrees of freedom $\nu$. While in principle it is possible to discretise any continuous parameter, such as $\mu$, $\sigma$ and $\alpha$, the procedure would carries a strong degree of subjectivity, namely the discretisation density. In fact, the above considerations made for $\nu$ cannot be applied to the remaining three parameters of the model. Hence, the choice to consider $\nu$ only as discrete. Second, the parameter space of $\nu$ has to be truncated. In \cite{Villa:Walker:2014a} this argument is motivated by the fact that, as the number of degrees of freedom ($\nu$) of a Student-$t$ goes to infinity, the density converges to a normal in distribution. As such, after a certain value of $\nu$, the model can be consider normal for any value of the parameter. A sensible choice is to set $\nu_{\max}=30$ to represent the normal model. Therefore, the inference problem reduces in choosing among $t$ densities with $\nu=1,\ldots,29$ and the normal density. As recalled in the introduction, a similar result holds for the skewed Student-$t$ distribution as well. Indeed, as $\nu$ goes to infinity, the model converges to a skewed normal distribution. This allows to apply the same truncation argument to the skewed Student-$t$ distribution. To derive the prior for $\nu$, we apply the approach introduced in Section \ref{sc_intro_obj}. Let us, at first, assume that $\nu=1,\ldots,30$ and $\alpha=0.5$. In this case, the density in \eqref{eq_ast1} represents a symmetrical $t$ distribution with $\nu$ degrees of freedom, and the prior for the parameter $\nu$ has the form as in \cite{Villa:Walker:2014a}. To simplify the notation, we indicate the $t$-density with parameters $\nu$, $\alpha$, $\mu$ and $\sigma$ by $f_{\nu}^{\alpha}$; therefore, the prior for $\nu$ is given by $$\pi(\nu|\alpha,\mu,\sigma) \propto \exp\left\{D(f_\nu^{\alpha}\|f_{\nu+1}^{\alpha})\right\}-1,$$ for $\nu<29$ and, for $\nu\geq29$ $$\pi(\nu|\alpha,\mu,\sigma) \propto \exp\left\{D(f_\nu^{\alpha}\|f_{\nu-1}^{\alpha})\right\}-1,$$ where $f_{30}^{\alpha}\sim \phi^{\alpha}$ is the skewed normal distribution with mean $\mu$ and standard deviation $\sigma$, i.e. \begin{equation}\label{eq_ast2} \phi^{\alpha}(x|\mu,\sigma) = \left\{ \begin{array}{l l} \dfrac{1}{\sigma\sqrt{2\pi}}\exp\left\lbrace -\left(\dfrac{x-\mu}{2\alpha\sigma}\right)^2\right\rbrace & \quad x\leq\mu\\ \dfrac{1}{\sigma\sqrt{2\pi}}\exp\left\lbrace -\left(\dfrac{x-\mu}{2(1-\alpha)\sigma}\right)^2\right\rbrace & \quad x>\mu \end{array} \right. \end{equation As recalled in the introduction, the choice of $\alpha=0.5$ corresponds to the usual Student-$t$ distribution and the prior above is the one introduced in \cite{Villa:Walker:2014a}. The following Theorem states a crucial result to set $\pi(\nu|\alpha,\mu,\sigma)$. \begin{theorem} Let $f_{\nu}^{\alpha}$ be the skewed Student-$t$ distribution with parameters $\mu$ and $\sigma$. Then $$D(f_{\nu}^{\alpha}\parallel f_{\nu+1}^{\alpha})=D(f_{\nu}^{0.5}\parallel f_{\nu+1}^{0.5}),$$ for every $\nu\geq 1$. \end{theorem} \begin{proof} Without loss of generality, we can consider $\mu=0$ and $\sigma=1$. Note that $$D(f_{\nu}^{\alpha}\parallel f_{\nu+1}^{\alpha})=D_{\leq}(f_{\nu}^{\alpha}\parallel f_{\nu+1}^{\alpha})+D_{>}(f_{\nu}^{\alpha}\parallel f_{\nu+1}^{\alpha}),$$ where \begin{equation*} \begin{split} D_{\leq}(f_{\nu}^{\alpha}\parallel f_{\nu+1}^{\alpha})&=\int_{-\infty}^{0}f_{\nu}^{\alpha}(y)\log\left\{\frac{f_{\nu}^{\alpha}(y)}{f_{\nu+1}^{\alpha}(y)}\right\}\,dy,\\ \end{split} \end{equation*} and \begin{equation*} \begin{split} D_{>}(f_{\nu}^{\alpha}\parallel f_{\nu+1}^{\alpha})&=\int_{0}^{+\infty}f_{\nu}^{\alpha}(y)\log\left\{\frac{f_{\nu}^{\alpha}(y)}{f_{\nu+1}^{\alpha}(y)}\right\}\,dy .\\ \end{split} \end{equation*} We focus on the first term \begin{equation*} \begin{split} D_{\leq}(f_{\nu}^{\alpha}\parallel f_{\nu+1}^{\alpha})&=\int_{-\infty}^0K(\nu)\left[1+\frac{1}{\nu}\left(\frac{y}{2\alpha}\right)^2\right]^{-\frac{\nu+1}{2}}\log\left\{\frac{K(\nu)\left[1+\frac{1}{\nu}\left(\frac{y}{2\alpha}\right)^2\right]^{-\frac{\nu+1}{2}}}{K(\nu+1)\left[1+\frac{1}{\nu+1}\left(\frac{y}{2\alpha}\right)^2\right]^{-\frac{\nu+2}{2}}}\right\}\,dy.\\ \end{split} \end{equation*} The change of variable $z={y}/{2\alpha}$ yields \begin{equation*} \begin{split} D_{\leq}(f_{\nu}^{\alpha}\parallel f_{\nu+1}^{\alpha}) &=2\alpha\int_{-\infty}^0 K(\nu)\left[1+\frac{z^2}{\nu}\right]^{-\frac{\nu+1}{2}}\log\left\{\frac{K(\nu)\left[1+\frac{z^2}{\nu}\right]^{-\frac{\nu+1}{2}}}{K(\nu+1)\left[1+\frac{z^2}{\nu+1}\right]^{-\frac{\nu+2}{2}}}\right\}\,dz\\ &=2\alpha D_{\leq}(f_{\nu}^{0.5}\parallel f_{\nu+1}^{0.5}). \end{split} \end{equation*} In a similar fashion $$D_{>}(f_{\nu}^{\alpha}\parallel f_{\nu+1}^{\alpha})=2(1-\alpha)D_{>}(f_{\nu}^{0.5}\parallel f_{\nu+1}^{0.5}).$$ The symmetry of the standard Student-$t$ distribution ensures that $$D_{\leq}(f_{\nu}^{0.5}\parallel f_{\nu+1}^{0.5})=D_{>}(f_{\nu}^{0.5}\parallel f_{\nu+1}^{0.5}).$$ Therefore $$2D_{\leq}(f_{\nu}^{0.5}\parallel f_{\nu+1}^{0.5})=2D_{>}(f_{\nu}^{0.5}\parallel f_{\nu+1}^{0.5})=D(f_{\nu}^{0.5}\parallel f_{\nu+1}^{0.5}),$$ and we can easily conclude \begin{equation*} \begin{split} D(f_{\nu}^{\alpha}\parallel f_{\nu+1}^{\alpha})&=D_{\leq}(f_{\nu}^{\alpha}\parallel f_{\nu+1}^{\alpha})+D_{>}(f_{\nu}^{\alpha}\parallel f_{\nu+1}^{\alpha})\\ &=2\alpha D_{\leq}(f_{\nu}^{0.5}\parallel f_{\nu+1}^{0.5})+2(1-\alpha)D_{>}(f_{\nu}^{0.5}\parallel f_{\nu+1}^{0.5})\\ &=\alpha D(f_{\nu}^{0.5}\parallel f_{\nu+1}^{0.5})+(1-\alpha)D(f_{\nu}^{0.5}\parallel f_{\nu+1}^{0.5})\\ &=D(f_{\nu}^{0.5}\parallel f_{\nu+1}^{0.5}). \end{split} \end{equation*} \end{proof} \noindent In a similar way, it can be proved that $$D(f_\nu^{\alpha}\|f_{\nu-1}^{\alpha})=D(f_\nu^{0.5}\|f_{\nu-1}^{0.5})$$ for every $\nu\geq 2$. The above result also holds when we assume that for $\nu=30$, $f_{\nu}^{\alpha}$ is the skewed normal distribution. These results lead to the following important considerations: \begin{enumerate} \item The objective prior distribution for $\nu$ doesn't depend by the skewness parameter $\alpha$; \item The objective prior distribution for $\nu$ for the skewed model is exactly the prior introduced in \cite{Villa:Walker:2014a}, i.e. $\pi(\nu|\mu,\sigma,\alpha)=\pi(\nu|0.5,\mu,\sigma)$. \end{enumerate} \subsection{Prior distributions for $\alpha$ and $(\mu,\sigma)$}\label{sc_prior_others} The derivation of non-informative priors for the remaining parameters of the AST is straightforward. A common assumption is that the parameters are independent a priori. Although this assumption can be relaxed, in the sense of limiting the independence to the one between the skewness parameter on one side and the location and scale parameters of the other side, the resulting overall prior is the same. In fact, if we consider $\mu$ independent from $\sigma$, the Jeffreys' independent prior will have the form $\pi(\mu,\sigma)=\pi(\mu)\pi(\sigma)$. Given that the Jeffreys' prior for a location parameter is proportional to 1, and the Jeffreys' prior for a scale parameter is proportional to the inverse of the parameter, we would have $\pi(\mu,\sigma)\propto 1/\sigma$ \citep{Jeffreys:1961}. However, the above prior coincides with the reference prior for the pair $(\mu,\sigma)$ \citep{BBS:2009}. Therefore, assuming or not assuming prior independence between the location parameter and the scale parameter does not make any practical difference from an inferential point of view. For the skewness parameter $\alpha$, we will use the Jeffreys' prior discussed in \cite{Rubio:Steel:2014}, which is a Beta distribution with both parameters equal to 1/2; that is $\pi(\alpha)\sim\mbox{Beta}(1/2,1/2)$. In fact, it can be seen in Theorem 3 and Corollary 3 of \cite{Rubio:Steel:2014} that the (independence) Jeffreys prior for $\alpha$, under the parameterisation in \eqref{eq_ast1}, is precisely a Beta distribution with both parameters equal to $1/2$. \section{Simulation study}\label{sc_simul} In this section we present a simulation study of the prior for $\nu$. Due to the objective nature of the prior considered it is appropriate to present the frequentist properties of the yielded marginal posterior for the number of degrees of freedom. In particular, we analyse the frequentist mean squared error (MSE) and the frequentist coverage of the $95\%$ credible intervals. The former represents a measure of the precision of the estimate, while the latter reports the proportion of times the true value is contained in the interval defined by the $2.5\%$ and the $97.5\%$ quantiles of the posterior in a repeated sampling scenario. The posterior distribution for $\nu$ tends to be skewed, as for example is shown in Figure \ref{fig:single_samp}; as such, an appropriate index of the posterior which summarises its centrality is the median. Furthermore, considering $\nu$ as discrete calls for an index which is discrete as well, i.e. the median. Therefore, the MSE is computed with respect to the median, and the precision of the estimate is defined by the relative square root of the mean squared error from the median: $\sqrt{\mbox{MSE}(\nu)}/\nu$. Given that the model converges to the normal distribution for $\nu\rightarrow\infty$, it is more difficult to discern between AST densities with large values of $\nu$. By considering the relative MSE, we somehow counterbalance an otherwise naturally increasing MSE and give a more interpretable information about the performance of the prior. The posterior distribution for $\nu$ is obtained by marginalising the full posterior $\pi(\alpha,\nu,\mu,\sigma)\propto L(\alpha,\nu,\mu,\sigma|x)\pi(\alpha,\nu,\mu,\sigma)$, where $\pi(\alpha,\nu,\mu,\sigma)$ is the prior defined in \eqref{eq_prior.1} and $L(\alpha,\nu,\mu,\sigma|x)$ is the likelihood function defined in \eqref{eq_like1}. As the posterior distribution is analytically intractable, we use Monte Carlo methods to obtain the marginal posterior distributions for each parameter. The algorithm employed is outlined in the Appendix. In this simulation study we consider the following scenarios. We noted that the location parameter and the scale parameter do not have any effect on the inferential results for the number of degrees of freedom, as such we have considered, without loss of generality, $\mu=0$ and $\sigma=1$. We have considered three different values of the skewness parameter, that is $\alpha=0.3$, $\alpha=0.5$ and $\alpha=0.8$. For each of the above three values we have performed repeated sampling with $\nu=1,\ldots,20$. We have run 100000 iterations of the MCMC algorithm for each case, and for a sequence of sample sizes $n=50$, $n=100$ and $n=1000$. The simulation has been done in R language and it took about 5.4 hours per case in a cluster of computers with i7 processors. Although the main fields of application of the asymmetrical $t$ density discussed in this paper call for relatively large sample sizes, we have also considered the possibility of applying the model to small numbers of observations. It is in fact for relatively small sample size that Bayesian analysis tends to give better pay-off compared to the frequentist approach. Therefore, beside considering $n=1000$, we have also analysed the frequentist properties for $n=100$ and $n=50$. The prior used for the parameters $\alpha$, $\mu$ and $\sigma$ are the objective priors outlined in Section \ref{sc_prelim} which, as shown in \cite{Rubio:Steel:2014} and the references therein, yield proper posterior distributions. \begin{figure}[h!] \centering \subfigure[]{% \includegraphics[scale=0.25]{MSE_n50.pdf} \label{fig:subfigure1}} \quad \subfigure[]{% \includegraphics[scale=0.25]{Coverage_n50.pdf} \label{fig:subfigure2}} \subfigure[]{% \includegraphics[scale=0.25]{MSE_n100.pdf} \label{fig:subfigure3}} \quad \subfigure[]{% \includegraphics[scale=0.25]{Coverage_n100.pdf} \label{fig:subfigure4}} \subfigure[]{% \includegraphics[scale=0.25]{MSE_n1000.pdf} \label{fig:subfigure5}} \quad \subfigure[]{% \includegraphics[scale=0.25]{Coverage_n1000.pdf} \label{fig:subfigure6}} \caption{Frequentist coverage of the $95\%$ credible intervals for $\nu$ (right) and square root of relative mean squared error of the estimator of $\nu$ (left). The simulations are for $\alpha=0.3$ (solid), $\alpha=0.5$ (dashed) and $\alpha=0.8$ (dotted), and for $n=50$ (top), $n=100$ (middle) and $n=1000$ (bottom).} \label{fig:figure1} \end{figure} The simulation results are summarised in Figure \ref{fig:figure1}. The left column, plots (a), (c) and (e), shows the square root of the relative mean squared error for the posterior medians of $\nu$. While there is a dependence on the accuracy of the estimate from the sample size, we do not appreciate any effect from the value of the skewness parameter $\alpha$. In fact, within each plot on the left-hand-side, the mean squared error curves have a similar behaviour, with a higher value towards the region of the parameter space where contiguous number of degrees of freedom characterise distributions relatively different. As $\nu$ increases, leading to $t$ densities which are more and more similar to each other, the relative mean squared error decreases. As expected, the mean squared error in higher for small sample sizes than for larger sample sizes, given that more information is carried by the observations via the likelihood function. This is easily seen by moving from the top to the bottom of the left column of Figure \ref{fig:figure1}, corresponding to sample sizes of, respectively, $n=50$, $n=100$ and $n=1000$. The right column of Figure \ref{fig:figure1} shows the frequentist coverage of the $95\%$ credible intervals for $n=50$ (top), $n=100$ (middle) and $n=1000$ (bottom). Although there is no apparent impact from different values of $\alpha$, we note more variable coverage values around the region of the parameter space associated with higher relative mean squared errors, compared to areas where the relative mean squared error is smaller. Although this behaviour is common to any sample size, we see a shifting of the more uncertain area towards higher number of degrees of freedom. This last result is common to other Bayesian objective methods to estimate $\nu$, such as in \cite{Fonseca:Ferreira:Migon:2008}, \cite{Villa:Walker:2014a} and the references therein. The above conclusion can also be drawn by inspecting the posterior median credible intervals for $\nu$, shown in Table \ref{tab:median_intervals}. In particular, the higher the value of the number of degrees of freedom, keeping the sample size fixed, the larger the interval. Alternatively, the higher the sample size, for the same value of $\nu$, the smaller the median credible interval. As expected, there is no appreciable difference in the median interval for different values of $\alpha$.\\ \begin{table}[] \centering \begin{tabular}{c|ccc|ccc|ccc} \hline & \multicolumn{3}{c|}{$n=50$} & \multicolumn{3}{c|}{$n=100$} & \multicolumn{3}{c}{$n=1000$} \\ \hline $\nu$ & $\alpha=0.3$ & $\alpha=0.5$ & $\alpha=0.8$ & $\alpha=0.3$ & $\alpha=0.5$ & $\alpha=0.8$ & $\alpha=0.3$ & $\alpha=0.5$ & $\alpha=0.8$ \\ \hline 1 & (1,1) & (1,1) & (1,1) & (1,1) & (1,1) & (1,1) & (1,1) & (1,1) & (1,1) \\ 2 & (2,4) & (1,5) & (2,3) & (1,2) & (2,3) & (2,3) & (2,2) & (2,2) & (2,2) \\ 3 & (2,6) & (2,8) & (2,7) & (2,3) & (2,4) & (2,6) & (3,3) & (3,3) & (3,3) \\ 4 & (2,7) & (2,7) & (2,6) & (3,9) & (2,5) & (3,7) & (4,5) & (4,5) & (4,5) \\ 5 & (4,8) & (3,8) & (2,8) & (4,14) & (3,10) & (4,14) & (4,5) & (4,5) & (4,5) \\ 6 & (2,25) & (3,7) & (3,20) & (4,15) & (4,12) & (4,17) & (5,6) & (5,6) & (5,7) \\ 7 & (3,29) & (5,29) & (5,30) & (3,10) & (4,15) & (4,14) & (5,7) & (6,8) & (5,8) \\ 8 & (2,26) & (3,29) & (3,26) & (3,28) & (5,27) & (5,29) & (6,10) & (6,9) & (6,10) \\ 9 & (5,30) & (3,30) & (5,30) & (3,22) & (4,24) & (4,23) & (7,11) & (7,11) & (7,12) \\ 10 & (3,26) & (4,30) & (4,29) & (7,30) & (5,28) & (5,28) & (7,12) & (9,16) & (7,12) \\ 11 & (5,30) & (5,30) & (3,27) & (5,29) & (5,28) & (4,27) & (9,18) & (8,13) & (8,14) \\ 12 & (4,27) & (6,29) & (6,30) & (8,30) & (6,29) & (4,24) & (8,13) & (9,17) & (9,16) \\ 13 & (5,30) & (3,30) & (6,30) & (7,30) & (5,28) & (7,30) & (9,15) & (10,18) & (10,20) \\ 14 & (4,30) & (8,27) & (6,30) & (5,27) & (6,29) & (6,30) & (12,29) & (9,19) & (9,19) \\ 15 & (6,30) & (3,29) & (4,29) & (5,29) & (6,30) & (7,30) & (9,18) & (9,18) & (9,17) \\ 16 & (5,30) & (3,30) & (6,30) & (5,28) & (8,30) & (7,30) & (13,29) & (11,25) & (11,22) \\ 17 & (4,29) & (7,29) & (5,30) & (6,30) & (5,27) & (5,26) & (9,19) & (10,21) & (11,24) \\ 18 & (5,30) & (4,30) & (7,30) & (7,30) & (6,29) & (7,30) & (13,30) & (11,24) & (13,29) \\ 19 & (5,30) & (4,30) & (4,30) & (7,30) & (6,30) & (6,29) & (11,23) & (12,29) & (13,29) \\ 20 & (4,29) & (2,29) & (5,29) & (7,30) & (6,30) & (7,30) & (15,30) & (13,29) & (13,29) \\ \hline \end{tabular} \caption{Median $95\%$ credible intervals of the posterior of $\nu$, for simulations with $\nu=1,\ldots,20$, $\alpha=0.3,0.5,0.8$ and $n=50,100,1000$.} \label{tab:median_intervals} \end{table} To have a feeling for the overall estimation procedure, we illustrate in detail the analysis of a single independent and identically distributed sample from a known model. We draw a sample of size $n=200$ from an AST distribution with parameters $\alpha=0.35$, $\mu=2$, $\sigma=1.5$ and $\nu=6$. The posterior distributions are obtained via Monte Carlo methods with 100000 iterations and a burn-in period of 5000 iterations and by considering the objective priors described in Section \ref{sc_priors}. In Figure \ref{fig:single_samp} we have reported, for each parameter, the chain samples and the histogram of the posterior distribution, \begin{figure}[h!] \centering \subfigure[]{% \includegraphics[scale=0.25]{SS_alpha_chain.pdf} \label{fig:sf1}} \quad \subfigure[]{% \includegraphics[scale=0.25]{SS_alpha_hist.pdf} \label{fig:sf2}} \subfigure[]{% \includegraphics[scale=0.25]{SS_mu_chain.pdf} \label{fig:sf3}} \quad \subfigure[]{% \includegraphics[scale=0.25]{SS_mu_hist.pdf} \label{fig:sf4}} \subfigure[]{% \includegraphics[scale=0.25]{SS_sigma_chain.pdf} \label{fig:sf5}} \quad \subfigure[]{% \includegraphics[scale=0.25]{SS_sigma_hist.pdf} \label{fig:sf6}} \subfigure[]{% \includegraphics[scale=0.25]{SS_nu_chain.pdf} \label{fig:sf7}} \quad \subfigure[]{% \includegraphics[scale=0.25]{SS_nu_hist.pdf} \label{fig:sf8}} \caption{Sample chains (left graphs) and histograms of the posterior distributions (right graphs) of the parameters for the simulated data from the AST with $\alpha=0.35$, $\mu=2$, $\sigma=1.5$ and $\nu=6$.} \label{fig:single_samp} \end{figure} while in Table \ref{tab:singlesample} we have the summary statistics of each posterior. In particular, we have computed the posterior mean, the posterior median and the $95\%$ credible interval of the posterior distribution. \begin{table} \centering \begin{tabular}{cccc} Parameter & Mean & Median & $95\%$ C.I. \\ \hline $\alpha$ & 0.36 & 0.36 & (0.25,0.49) \\ $\mu$ & 1.76 & 1.76 & (1.02,2.53) \\ $\sigma$ & 1.79 & 1.78 & (1.33,2.37) \\ $\nu$ & 6.24 & 6 & (3,13) \\ \hline \end{tabular} \caption{Summary statistics of the posterior distributions for the parameters of the simulated data from an AST with $\alpha=0.35$, $\mu=2$, $\sigma=1.5$ and $\nu=6$.} \label{tab:singlesample} \end{table} By inspecting the histograms and the summary statistics of the posterior distributions we can assess on the appropriateness of the inferential process. In particular, the mean (or the median for $\nu$) of the posteriors are very close to the true parameter values, which are well within the limits of the corresponding credible intervals. \section{Real data analysis}\label{sc_real} To show how the discussed model works in practice, we have chosen two well known data sets, both related to insurance loss. The first data set contains 2,167 individual losses each with a value of one million Danish Krone (DKK) or above, collected from January 1980 to December 1990 \citep{Mcneil:1997}. The second data set relates to 1,500 indemnity payments, in thousand of US dollars \citep{FreVal:1998}. \subsection{Danish fire losses}\label{sc_danish} The Danish fire loss data set contains losses due to fire with a single value of at least DKK 1 million. Table \ref{tab:danish_loss1} reports some descriptive statistics of the data, both in the nominal scale and in the log-scale. It is common practice, when analysing insurance data (and not only), to consider the logarithm of the data for modelling purposes as this results in a reduction of skewness \citep{Bolance:2008}. Although the skewness index is drastically reduced by the log-transform of the Danish loss data, as shown in Table \ref{tab:danish_loss1}, its value still indicates a significantly positive skewness. The above result is easily noticeable by inspecting the histograms of the data in Figure \ref{fig:Danish_hist}. \begin{table} \centering \begin{tabular}{lcc} & Danish & Danish (log-scale) \\ \hline Mean & 3.39 & 0.79 \\ Standard Deviation & 8.51 & 0.72 \\ Skewness & 18.75 & 1.76 \\ \hline \end{tabular} \caption{Descriptive statistics of the Danish loss data set in millions of Danish Krone (left) and in the log-scale (right).} \label{tab:danish_loss1} \end{table} Suitable statistical tests can be performed to support the conclusion of departure for normality, such as the Jarque--Bera test for normality \citep{JarBer:1980}, the D'agostino test for skewness \citep{Dago:1970} or the Anscombe-Glynn test of kurtosis \citep{AnsGly:1983}, for example (results not reported here). \begin{figure}[h!] \centering \subfigure[]{% \includegraphics[scale=0.30]{Danish_loss.pdf} \label{fig:sub1}} \quad \subfigure[]{% \includegraphics[scale=0.30]{Danish_loss_log.pdf} \label{fig:sub2}} \caption{Histograms of the Danish fire loss data (left) and of the same data set in the log-scale (right).} \label{fig:Danish_hist} \end{figure} The prior distributions used to analyse the Danish fire loss data set where in line with the overall objective approach discussed in the paper. In particular, we used the Jeffreys' prior for the skewness parameter $\alpha$, that is $\pi(\alpha)\sim \mbox{Beta}(1/2,1/2)$, the discrete truncated prior for the number of degrees of freedom $\nu$, and the reference prior for the pair location-scale parameters $(\mu,\sigma)$, that is $\pi(\mu,\sigma)\propto 1/\sigma$. \begin{figure}[h!] \centering \includegraphics[scale=0.30]{PredictiveDanishData.png} \caption{Real Data (dashed line) vs Posterior Predictive Distribution (dotted line) of the Danish Loss data. \label{fig:predDan}} \end{figure} The marginal posterior distributions for the parameters, as they are analytically intractable, have been obtained via Monte Carlo methods by applying the algorithm described in the Appendix. We have run multiple chains for each parameter, with different sparse starting points. In particular, we have run 500000 iterations and considered a burn in of 100000. The convergence has been assessed by computing the Gelman and Rubin's statistics \citep{BroGel:1998,GelRub:1992} and monitoring the posterior running means. \begin{figure}[h] \centering \subfigure[]{% \includegraphics[scale=0.30]{Danish_alpha_hist.pdf} \label{fig:dan_hist_sub1}} \quad \subfigure[]{% \includegraphics[scale=0.30]{Danish_mu_hist.pdf} \label{fig:dan_hist_sub2}} \subfigure[]{% \includegraphics[scale=0.30]{Danish_sigma_hist.pdf} \label{fig:dan_hist_sub3}} \quad \subfigure[]{% \includegraphics[scale=0.30]{Danish_nu_hist.pdf} \label{fig:dan_hist_sub4}} \caption{Histograms of the posterior distributions for $\alpha$, $\mu$, $\sigma$ and $\nu$ for the Danish fire loss data set (in the log-scale).} \label{fig:danish_post_hist} \end{figure} We have reported the histograms of the posterior marginal distributions for the parameters of the model in Figure \ref{fig:danish_post_hist}, and the corresponding summary statistics in Table \ref{tab:danish_post_summary}. \begin{table} \centering \begin{tabular}{cccc} \hline Parameter & Mean & Median & $95\%$ C.I. \\ \hline $\alpha$ & 0.0005 & 0.0003 & (0.0001,0.0020) \\ $\mu$ & 0.0042 & 0.0004 & (0.0000,0.0378) \\ $\sigma$ & 0.4142 & 0.4123 & (0.3906,0.4359) \\ $\nu$ & 9.4900 & 9 & (8,12) \\ \hline \end{tabular} \caption{Summary statistics of the posterior distribution of the Danish fire loss data set in the log-scale.} \label{tab:danish_post_summary} \end{table} As expected, the value of the skewness parameter is very close to zero. In fact, both from the data histogram and summary statistics, it is possible to deduce that the data has a strong positive skewness. The median of the posterior of the number of degrees of freedom $\nu$ indicates a heavy-tailed behaviour in the observations. Both the skewness and heavy-tail results are consistent with the expected behaviour of insurance loss data, even after the data has been log-transformed, in this case. Figure \ref{fig:predDan} shows the posterior predictive density against the real data. We note no substantial difference in the two curves. Finally, to compare the data statistics of Table \ref{tab:danish_loss1} with the MCMC estimation, we have computed the Monte Carlo estimates (in the log-scale) of the mean, the standard deviation and the skewness index, obtaining, respectively, the values 0.79, 0.72, 1.77. \subsection{US indemnity loss}\label{sc_US} The second data set we analyse is widely used in the literature and it contains US indemnity losses publicly available \citep{FreVal:1998}. It contains 1,500 liability claims each of which with an associated indemnity payment in thousands of US dollars (USD). \begin{table} \centering \begin{tabular}{lcc} & US & US (log-scale) \\ \hline Mean & 41.21 & 2.46 \\ Standard Deviation & 102.75 & 1.64 \\ Skewness & 9.16 & -0.15 \\ \hline \end{tabular} \caption{Descriptive statistics of the US loss data set in thousands of USD (left) and in the log-scale (right).} \label{tab:usloss1} \end{table} Table \ref{tab:usloss1} shows the descriptive statistics of the US loss data set, both in thousands of USD and in the log-scale. As we did for the Danish fire loss data, we perform the analysis on the log-transformation of the observed values. Figure \ref{fig:US_hist} shows the histogram of the US loss data (left plot) and of the same data in the log-scale (right plot). From the first histogram on the left it is possible to see the typical behaviour of this type of data, that is a relatively high number of losses with a small value and a few losses of large value. \begin{figure}[ht] \centering \subfigure[]{% \includegraphics[scale=0.30]{USloss_hist.pdf} \label{fig:subfigur1}} \quad \subfigure[]{% \includegraphics[scale=0.30]{USlogloss_hist.pdf} \label{fig:subfigur2}} \caption{Histograms of the US loss data (left) and of the same data set in the log-scale (right).} \label{fig:US_hist} \end{figure} The procedure followed to analyse the US loss data, in the log-scale, is analogous to the one employed to analyse the Danish fire loss data set in Section \ref{sc_danish}. The histograms of the posterior distributions of the parameters of the model are in Figure \ref{fig:US_post_hist}, with the corresponding summary statistics in Table \ref{tab:US_post_summary}. \begin{figure}[h] \centering \subfigure[]{% \includegraphics[scale=0.30]{US_alpha_hist.pdf} \label{fig:US_hist_sub1}} \quad \subfigure[]{% \includegraphics[scale=0.30]{US_mu_hist.pdf} \label{fig:US_hist_sub2}} \subfigure[]{% \includegraphics[scale=0.30]{US_sigma_hist.pdf} \label{fig:US_hist_sub3}} \quad \subfigure[]{% \includegraphics[scale=0.30]{US_nu_hist.pdf} \label{fig:US_hist_sub4}} \caption{Histograms of the posterior distributions for $\alpha$, $\mu$, $\sigma$ and $\nu$ for the US loss data set (in the log-scale).} \label{fig:US_post_hist} \end{figure} \begin{table} \centering \begin{tabular}{cccc} \hline Parameters & Mean & Median & $95\%$ C.I. \\ \hline $\alpha$ & 0.52 & 0.52 & (0.48,0.56) \\ $\mu$ & 2.47 & 2.48 & (2.01,2.65) \\ $\sigma$ & 1.52 & 1.52 & (1.44,1.59) \\ $\nu$ & 27.16 & 28 & (21,30) \\ \hline \end{tabular} \caption{Summary statistics of the posterior distribution of the US loss data set (in the log-scale).} \label{tab:US_post_summary} \end{table} We note the following two important results. First, the skewness parameter is estimated to be close to 0.5. This indicates that a symmetric model would be suitable for this data set. Second, the estimated number of degrees of freedom is very closed to the upper bound of the parameter space. This is a clear indication that the data could be represented by a $t$ density with a high number of degrees of freedom or, which is equivalent, by a normal density. For what it concerns the inferential results, we see that the credible intervals are relatively narrow, indicating a relatively strong posterior beliefs about the obtained estimates. Figure \ref{fig:predUS} shows the posterior predictive density against the real data, where again we do not see any substantial difference between the two curves. As done in Section \ref{sc_danish}, we have performed Monte Carlo estimates of the data statistics fro the US Loss data set. In particular, we have computed the mean, the standard deviation and the skewness index obtaining, respectively, 2.45, 1.64, -0.15. These values can be compared with the ones in Table \ref{tab:usloss1}. \begin{figure}[h!] \centering \includegraphics[scale=0.30]{PredictiveUSData.png} \caption{Real Data (dashed line) vs Posterior Predictive Distribution (dotted line) of the US Loss data. \label{fig:predUS}} \end{figure} \section{Discussion}\label{sc_disc} An important aspect in analysis insurance loss data is their tendency to follow a skewed distribution and, because extreme events are not uncommon, to exhibit heavy tails. However, in some circumstances, symmetrical models with either non-heavy tails, like for example the normal distribution, or heavy tails, such as the $t$ density, may be effectively employed. Usually, this type of modelling can be achieved by considering the data in the log-scale. Although competing models could be estimated and assessed for their inferential and predictive performances, it is appealing to be able to consider a single model which, on the basis of the estimated values of some of the parameters, ``adjusts'' itself, in a sort of an automated fashion, to the problem under consideration. The asymmetrical Student-$t$ considered in this paper to represent insurance loss data has the above flavour. In fact, the estimated value of the skewness parameter $\alpha$ would suggest a symmetrical or non-symmetrical scenario, and the number of degrees of freedom would indicate the fatness of the tails of the data. When dealing with a $t$ distribution, whether the usual symmetrical one or the one considered here, the estimation of the number of degrees of freedom has always been a challenge. It is not uncommon that the problem is somehow eluded by either setting $\nu$ on the basis of some appropriate theoretical results, or by consider different values and chose the most appropriate on the basis of some criteria. A Bayesian approach, and in particular an objective Bayesian approach, allows to obtain reliable estimates of the number of degrees of freedom with minimal initial input. We have here consider the number of degrees of freedom discrete and bounded above on the basis of the well known property of the $t$ density to converge to the normal distribution for sufficiently large $\nu$. With this consideration, we have been able to consider the objective prior for $\nu$ presented in \cite{Villa:Walker:2014a}. In addition, we prove here that the prior is not dependent on the value of the skewness parameter $\alpha$, therefore directly applicable to the model here considered. We have studied the frequentist properties of the posterior for $\nu$ yielded by the truncated objective prior. As expected from the analytical result discussed in Section \ref{sc_priors}, different values of the skewness parameter do not affect the performance of the prior, except regular small variations due to the randomness of the repeating sampling. As expected, the performance of the prior distribution, in terms of MSE, improves when the sample size increases. The above results are in line with the ones obtained in \cite{Villa:Walker:2014a}. We have then employed the discussed model to analyse real insurance loss data. The work has been carried out by using objective priors for each parameter of the model, to ensure a minimal information approach to the problem. In the first illustration we look to a well-known data set of losses due to fire in Denmark. The peculiarity of the data is to show strong (positive) skewness and to have extreme values. Even by considering the logarithmic transformation of the observations skewness and extremeness cannot be removed. The inferential procedure shows the model adjustment to the scenario by resulting in an $\alpha$ very close to zero and a number of degrees of freedom equal to 9. The same Bayesian model, i.e. sampling distribution and prior distribution, is applied to a different data set. This data set, which contains indemnity losses in the US market, shows skewness and extreme values as well, but these appear to be removed once the logarithm of the observations is considered. A posterior mean of $\alpha=0.5$ indicates a symmetrical distribution, and a posterior median of $\nu=28$ indicates a distribution that is not very different from a normal density. The above two results show how the same model can be applied to insurance loss data sets, without the need to change neither any of of its components nor the prior distributions for the parameters. To conclude, it is obvious that the same approach here illustrated can be adopted to other types of data, which exhibit similar characteristics of skewness. That is, the objective Bayesian analysis of data by means of the AST model, including both the distribution and the priors for the parameters, can be generalised and employed in other disciplines, such as finance, environmental sciences and engineering, for example. \section*{Acknowledgements} The authors are thankful to the Associate Editor and the anonymous reviewer for their useful comments which significantly improved the quality of the paper. The authors are very grateful to F. J. Rubio for all the stimulating discussions and suggestions. Fabrizio Leisen's research has been supported by the European Community's Seventh Framework Programme[FP7/2007-2013] under grant agreement no: 630677.
{'timestamp': '2016-07-19T02:05:24', 'yymm': '1607', 'arxiv_id': '1607.04796', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04796'}
arxiv
\section{Introduction} \label{sec.intro} Random linear network coding (RNLC) is the process of constructing coded packets, which are random linear combinations of source packets over a finite field \cite{Ho06}. If $k$ source packets are considered, decoding at a receiving node starts after $k$ linearly independent coded packets have been collected. The probability of recovering all of the $k$ source packets when at least $k$ coded packets have been received has been derived in \cite{Trullols-Cruces11}. However, the requirement for a large number of received coded packets before decoding can introduce undesirable delays at the receiving nodes. In an effort to alleviate this problem, \textit{rank-deficient} decoding was proposed in \cite{Yan2013} for the recovery of a subset of source packets when fewer than $k$ coded packets have been obtained. Whereas the literature on network coding defines \textit{decoding success} as the recovery of 100\% of the source packets with a certain probability, the authors of \cite{Yan2013} presented simulation results that measured the \textit{fraction of decoding success}, that is, the recovery of a percentage of the source packets with a certain probability. The fundamental problem that has motivated our work is the characterization of the probability of recovering some of the $k$ source packets when $n$ coded packets have been retrieved, where $n$ can be smaller than, equal to or greater than $k$. This idea was considered in~\cite{Gadouleau2011} for random network communications over a matroid framework. The authors show that partial decoding is highly unlikely. This problem has also been explored in the context of secure network coding, e.g., \cite{Bhattad2005,Lima2007}. Strict information-theoretic security can be achieved if and only if the mutual information between the packets available to an eavesdropper and the source packets is zero \cite{Cai2002}. When network coding is used, \textit{weak} security can be achieved if the eavesdropper cannot obtain $k$ linearly independent coded packets and, hence, cannot recover any meaningful information about the $k$ source packets \cite{Bhattad2005}. The authors of \cite{Bhattad2005} obtained bounds on the probability of RLNC being weakly secure and showed that the adoption of large finite fields improves security. A different setting but a similar problem was investigated in \cite{Lima2007}. Intermediate relay nodes between transmitting and receiving nodes were treated as potentially malicious, and criteria for characterizing the algebraic security of RLNC were defined. The authors demonstrated that the probability of an intermediate node recovering a strictly positive number of source packets tends to zero as the field size and the number of source packets go to infinity. This paper revisits the aforementioned problem and obtains an exact expression for the probability that a receiving node will recover at least $x$ of the $k$ source packets if $n$ coded packets are collected, for $x\leq n$. The derived expression can be seen as a generalization of \cite[eq. (7)]{Trullols-Cruces11}. The \mbox{paper also looks} at the impact of transmitting source packets along with coded packets, known as \textit{systematic} RLNC, as opposed to transmitting only coded packets, referred to as \textit{non-systematic} RLNC. In the remainder of the paper, Section~\ref{sec.System} formulates the problem, Section~\ref{sec.Analysis} obtains the probability of recovering a fraction of a network-coded message, Section~\ref{sec.results} presents results and Section~\ref{sec.conclusions} summarizes the conclusions of this work. \section{System model and problem formulation} \label{sec.System} We consider a receiving network node, which collects $n$ packets and attempts to reconstruct a message that consists of $k$ source packets. The $n$ packets could have been broadcast by a single transmitting node or could have been originated from multiple nodes that possess the same message. In the case of \textit{non-systematic} communication, transmitted packets are generated from the $k$ source packets using RLNC over $\mathbb{F}_q$ \cite{Ho06}, where $q$ is a prime power and $\mathbb{F}_q$ denotes the finite field of $q$ elements. In the case of \textit{systematic} RLNC, a sequence of $n_\mathrm{T}$ transmitted packets consists of the $k$ source packets and $n_\mathrm{T}-k$ coded packets that have been generated as in the non-systematic case. In both cases, a coding vector of length $k$, which contains the weighting coefficients used in the generation of a packet, is transmitted along with each packet. At the receiving node, the coding vectors of the $n$ successfully retrieved packets form the rows of a matrix $\mathbf{M}\in\mathbb{F}^{n\times k}_q$, where $\mathbb{F}_q^{n \times k}$ denotes the set of all $n \times k$ matrices over $\mathbb{F}_q$. The $k$ source packets can be recovered from the $n$ received packets if and only if $k$ of the $n$ coding vectors are linearly independent, implying that $\mathrm{rank}(\mathbf{M})=k$ for $n\geq k$. The probability that the $n\times k$ random matrix $\mathbf{M}$ has rank $k$ and, thus, the receiving node can reconstruct the entire message is given in \cite{Trullols-Cruces11} for non-systematic RLNC and \cite{Shrader09} for systematic RLNC. The objective of this paper is to derive the probability that a receiving node will reconstruct at least $x\leq k$ source packets upon reception of $n$ network-coded packets. To formulate this problem, let $\mathbf{e}_i$ denote the $i$-th unit vector of length $k$. A coding vector, or a row of $\mathbf{M}$, equal to $\mathbf{e}_i$ represents the $i$-th source packet. Let $X$ be the set of indices corresponding to the unit vectors contained in the rowspace of $\mathbf{M}$, denoted by $\Row(\mathbf{M})$, so that $X=\{i:\mathbf{e}_i \in \Row(\mathbf{M})\}$. We write $\lvert X\rvert$ to denote the cardinality of random variable $X$. Furthermore, we define random variables $R$ and $N$ to give the rank of $\mathbf{M}$ and the number of rows in $\mathbf{M}$, respectively. The considered problem has been decomposed into the following two tasks: \begin{enumerate} \item Obtain the probability of recovering at least $x$ source packets, provided that $r$ out of the $n$ received packets are linearly independent, for $x\leq r\leq k$. This is equivalent to finding the probability of $\Row(\mathbf{M})$ containing at least $x$ unit vectors, given $\mathbf{M}$ has $n$ rows and rank $r$. We denote this probability by $P(\lvert X\rvert\geq x\,\vert\,R=r,\,N=n)$. \item {Obtain the probability of recovering at least $x$ source packets, provided that $n\geq x$ packets have been collected.} We write $P(\lvert X\rvert\geq x\,\vert\,N=n)$ to refer to this probability. \end{enumerate} Derivation of $P(\lvert X\rvert\geq x\,\vert\,R=r,\,N=n)$ and \mbox{$P(\lvert X\rvert\geq x\,\vert\,N=n)$} is the focus of the following section. \section{Probability analysis} \label{sec.Analysis} The analysis presented in this section relies on the well- known Principle of Inclusion and Exclusion \cite[Prop. 5.2.2]{Cameron1994}, which is repeated below for clarity. \begin{lemma} \label{lemma.PIE} \textbf{Principle of inclusion and exclusion.} Given a set $A$, let $f$ be a real valued function defined for all sets $S,J\subseteq A$. If $g(S) = \sum_{J:J\supseteq S} f(J)$ then $f(S) = \sum_{J:J\supseteq S} (-1)^{\lvert J\setminus S\rvert} g(J)$. \end{lemma} For non-negative integers $m$ and $d$, we denote by $\binom{m}{d}$ the binomial coefficient, which gives the number of $d$-element sets of an $m$-element set. The $q$-analog of the binomial coefficient, known as the \textit{Gaussian binomial coefficient} and denoted by $\qbinom{m}{d}$, enumerates all $d$-dimensional subspaces of an $m$-dimensional space over $\mathbb{F}_q$ \cite[p. 125]{Cameron1994}. Given $\mathbf{M}$ has rank $r$, let $P(\lvert X\rvert=x\,\vert\,R=r,\,N=n)$ denote the probability of recovering \textit{exactly} $x \leq r$ source packets or, equivalently, the probability of $\Row(\mathbf{M})$ containing \textit{exactly} $x \leq r$ unit vectors. The following theorem obtains an expression for $P(\lvert X\rvert= x\,\vert\,R=r,\,N=n)$, which is then used in the derivation of $P(\lvert X\rvert\geq x\,\vert\,R=r,\,N=n)$. \begin{theorem} \label{thm.cond_exactly_x} Given a random $n \times k$ matrix $\mathbf{M}$ of rank $r$, the probability that the rowspace of $\mathbf{M}$ contains exactly $x \leq r$ unit vectors is given by \begin{equation} \label{eq.cond_exactly_x} P(\lvert X\rvert=x\,\vert\,R=r,\,N=n)=\frac{\binom{k}{x}}{\qbinom{\phantom{\widetilde k}\!\!\!k}{r}}% \displaystyle\sum_{j=0}^{k-x}(-1)^{j}\binom{k-x}{j}\!\genfrac{[}{]}{0pt}{}{\,k-x-j\,}{\,r-x-j\,}_{\!q}. \end{equation} \end{theorem} \begin{proof} For $S\!\subseteq\!J\subseteq\!\{1, \dots k \}$, let $g(S)$~be~the~probability that $\{ \mathbf{e}_i : i \in S \} \subseteq \Row(\mathbf{M})$, that is, the probability that $S \subseteq X$. This is just the probability that $\Row( \mathbf{M} )$ contains a fixed $\lvert S\rvert$-dimensional subspace, namely the space \mbox{$V=\Span\{\mathbf{e}_i:i \in S\}$}. We see that, by considering the quotient space $\mathbb{F}_q^k/V$, there is a direct correspondence between \mbox{$r$-dimensional} subspaces of $\mathbb{F}_q^k$ containing $V$, and $(r-\lvert S\rvert)$-dimensional subspaces of a \mbox{$(k-\lvert S\rvert)$-dimensional} space. Hence, there are $\qbinom{k-\lvert S \rvert}{r-\lvert S \rvert}$ $r$-dimensional subspaces of $\mathbb{F}_q^k$ containing $V$. The probability that $\Row(\mathbf{M})$ contains the space $V$ is equal to \begin{equation} \label{g(S)} g(S) = \frac{\qbinom{k-\lvert S \rvert}{r-\lvert S \rvert}}{\qbinom{\phantom{\widetilde k}\!\!\!k}{r}}. \end{equation} where the denominator in \eqref{g(S)} enumerates the $r$-dimensional subspaces of $\mathbb{F}_q^k$. Now, let $f(S)$ be the probability that $S=X$, that is, the probability that $\{ \mathbf{e}_i : i \in S \} \subseteq \Row( \mathbf{M})$ and $\mathbf{e}_i \notin \Row(\mathbf{M})$ for $i\notin S$. It follows that $g(S) = \sum_{J \supseteq S} f(J)$. Invoking the Principle of Inclusion and Exclusion (Lemma~\ref{lemma.PIE}) and using \eqref{g(S)}, we can write $f(S) = \sum_{J \supseteq S} (-1)^{|J\setminus S|} \cdot g(J)$ and expand it to \begin{align} f(S) \notag&= \sum_{J \supseteq S} (-1)^{|J\setminus S|} \cdot \frac{\qbinom{k-\lvert J \rvert}{r-\lvert J \rvert}}{\qbinom{k}{r}} \notag \\ &= \frac{1}{\qbinom{k}{r}} \sum_{J' \subseteq \{ 1, \dots , k \}\setminus S} (-1)^{\lvert J' \rvert} \qbinom{k-\lvert S\rvert-\lvert J'\rvert}{r-\lvert S\rvert-\lvert J'\rvert} \label{f(S):J'} \\ &= \frac{1}{\qbinom{k}{r}} \sum_{j=0}^{k-\lvert S\rvert} (-1)^{j} \binom{k-\lvert S\rvert}{j} \qbinom{k-\lvert S\rvert-j}{r-\lvert S\rvert-j} \label{f(S):j} \end{align} where \eqref{f(S):J'} follows by setting $J'=J\setminus S$, and \eqref{f(S):j} follows since there are $\binom{k-\lvert S\rvert}{j}$ sets $J'$ of size $j$. Considering that $f(S)$ is the probability that $X=S$, we can write \begin{equation} P(\lvert X\rvert=x\,\vert\,R=r,\,N=n) =\!\!\sum_{S: \lvert S \rvert =x}\!\!\!f(S) = \binom{k}{x} f(S') \label{eq:P(|X|=x)} \end{equation} where $S'$ is any subset of $\{1, \dots, k \}$ of size $x$. The second equality in \eqref{eq:P(|X|=x)} holds since there are $\binom{k}{x}$ sets \mbox{$S \subseteq \{1, \dots, k\}$} of size $x$. Substituting \eqref{f(S):j} in \eqref{eq:P(|X|=x)} gives the result. \end{proof} \begin{remark} Theorem~\ref{thm.cond_exactly_x} can be seen as a special case of~\cite[Proposition 6]{Gadouleau2011}. Whereas the proof in \cite{Gadouleau2011} uses elements of matroid theory, our paper proposes an alternative and more intuitive proof strategy. \end{remark} \begin{corollary} \label{cor.cond_atleast_x} Given a random $n \times k$ matrix $\mathbf{M}$ of rank $r$, the probability that the rowspace of $\mathbf{M}$ contains at least $x \leq r$ unit vectors is given by \begin{equation} \label{eq.cond_atleast_x} P(\lvert X\rvert\!\geq\! x\,\vert\,R\!=\!r,\,N\!=\!n) =\frac{1}{\qbinom{\phantom{\widetilde k}\!\!\!k}{r}}% \!\sum_{i=x}^{r}\!\binom{k}{i}\!\sum_{j=0}^{k-i}(-1)^{j}\binom{k-i}{j}\!\qbinom{k-i-j}{r-i-j}. \end{equation} \end{corollary} \begin{proof} By definition, the probability $P(\lvert X\rvert\geq x\,\vert\,R=r,\,N=n)$ is equal to $\sum_{i=x}^{r} P(\lvert X\rvert=i\,\vert\,R=r,\,N=n)$. Substituting in \eqref{eq.cond_exactly_x} gives the result. \end{proof} Note that, although $\mathbf{M}$ is an $n \times k$ matrix, the probabilities in \eqref{eq.cond_exactly_x} and \eqref{eq.cond_atleast_x} hold for any value of $n\!\geq\!r$. Having obtained an expression for the probability $P(\lvert X\rvert\!\geq\!x\,\vert\,R\!=\!r,\,N\!=\!n)$, we now proceed to the derivation of $P(\lvert X\rvert\!\geq\!x\,\vert\,N\!=\!n)$. This probability is denoted by $P_\mathrm{ns}(\lvert X\rvert\!\geq\!x\,\vert\,N\!=\!n)$ and $P_\mathrm{s}(\lvert X\rvert\!\geq\! x\,\vert\,N\!=\!n)$ for non-systematic and systematic RLNC, respectively. Expressions for each case are derived in the following two propositions. \begin{proposition} \label{prop.nonsys} If a receiving node collects $n$ random linear combinations of $k$ source packets, the probability that at least $x\leq k$ source packets will be recovered is \begin{align} \label{eq.prob_ns} &P_\mathrm{ns}(\lvert X\rvert \geq x \,\vert\,N=n)\nonumber\\% &=\frac{1}{q^{nk}} \displaystyle\sum_{r=x}^{\min(n,k)}\!% \Biggl(% \displaystyle\sum_{i=x}^{r}% \binom{k}{i}% \displaystyle\sum_{j=0}^{k-i}% \left(-1\right)^{j}% \binom{k-i}{j}\!% \genfrac{[}{]}{0pt}{}{\,k-i-j\,}{\,r-i-j\,}_{\!q\!}% \Biggr)\!% \displaystyle\prod_{\ell=0}^{r-1}(q^n-q^\ell).% \end{align} \end{proposition} \begin{proof} Let $P(R\!=\!r\,\vert\,N\!=\!n)$ denote the probability that the $n\times k$ matrix $\mathbf{M}$ has rank $r$. This is equivalent to the probability that $r$ out of the $n$ collected packets are linearly independent. The probability that at least $x$ of the $k$ source packets will be recovered can be obtained from \begin{align} \label{eq.ns_step1} &P_\mathrm{ns}(\lvert X\rvert\geq x \,\vert\,N=n)\nonumber\\ &=\!\!\!\sum_{r=x}^{\min(n,k)}\!\!P(R=r\,\vert\,N=n)\,P(\lvert X\rvert\geq x\,\vert\,R=r,N=n). \end{align} The probability $P(R=r\,\vert\,N\!=\!n)$ is equal to \cite[Sec. II.A]{Gadouleau2010} \begin{equation} \label{eq.ns_step3} P(R=r\,\vert\,N\!=\!n) = \frac{1}{q^{nk}}\qbinom{n}{r}% \prod_{\ell=0}^{r-1}\left(q^{k}-q^{\ell}\right).% \end{equation} Substituting \eqref{eq.cond_atleast_x} and \eqref{eq.ns_step3} into \eqref{eq.ns_step1} and taking into account that \begin{equation} \label{eq.ns_step4} \frac{\qbinom{n}{r}}{\qbinom{k}{r}}\prod_{\ell=0}^{r-1}(q^k-q^\ell)=\prod_{\ell=0}^{r-1}(q^n-q^\ell) \end{equation} leads to \eqref{eq.prob_ns}. \end{proof} \newpage \begin{proposition} \label{prop.sys} If $k$ source packets and $n_\mathrm{T}-k$ random linear combinations of those $k$ source packets are transmitted over single-hop links, the probability that a receiving node will recover at least $x\leq k$ source packets from $n\leq n_\mathrm{T}$ received packets is \begin{align} \label{eq.prob_s} &P_\mathrm{s}(\lvert X\rvert\geq x\,\vert\, N=n )% \nonumber% \\ &=\frac{1}{\binom{n_\mathrm{T}}{n}} \cdot\!\!\displaystyle\sum_{r=x}^{\min(n,k)}\!\!\!% \sum_{h=h_{\min}}^{r}\!\!\Biggl(% \binom{k}{h}\binom{n_\mathrm{T}-k}{n-h}% q^{-(n-h)(k-h)}% \!\!\prod_{\ell=0}^{r-h-1}% (q^{n-h}-q^\ell)% \cdot\nonumber% \\ &\quad\cdot\!\!\displaystyle\sum_{i=x_{\min}}^{r-h}% \!\!\!\binom{k-h}{i}% \!\sum_{j=0}^{k-h-i}% \left(-1\right)^{j}% \binom{k-h-i}{j}% \qbinom{k-h-i-j}{r-h-i-j}% \Biggr)% \end{align} where $h_{\min}\!=\!\max{(0,n\!\,-\!\,n_\mathrm{T}\!\,+\!\,k)}$ and $x_{\min}\!=\!\max(0,x\!-\!h)$. \end{proposition} \begin{proof} Let us assume that some or none of the $k$ transmitted source packets have been received and let $X^{\prime}\subseteq X$ be the set of indices of the remaining source packets that can be recovered from the received coded packets. If $n^{\prime}$ of the $n_\mathrm{T}-k$ coded packets have been received and $k^{\prime}$ source packets remain to be recovered, the respective coding vectors will form an $n^{\prime}\times k^{\prime}$ random matrix $\mathbf{M}^{\prime}$. The probability that $r^{\prime}\leq\min(k^{\prime}, n^{\prime})$ coding vectors are linearly independent and at least $x^{\prime}\leq r^{\prime}$ source packets can be recovered is given by \begin{multline} \label{eq.s_step1} P(\lvert X^{\prime}\rvert\geq x^{\prime}, R^{\prime}=r^{\prime}\,\vert\,N^{\prime}=n^{\prime})= \\ P(R^{\prime}=r^{\prime}\,\vert\,N^{\prime}=n^{\prime})\,% P(\lvert X^{\prime}\rvert\geq x^{\prime}\,\vert\, R^{\prime}=r^{\prime},\,N^{\prime}=n^{\prime}) \nonumber \end{multline} where the two terms of the product can be obtained from \eqref{eq.ns_step3} and \eqref{eq.cond_atleast_x}, respectively. The random variables $N'$ and $R'$ denote the number of received coded packets and the rank of matrix $\mathbf{M}^{\prime}$, respectively. If $n$ of the $n_\mathrm{T}$ transmitted packets are received, the probability that $h$ of them are source packets and the remaining $n-h$ are coded packets is \begin{equation} \label{eq.s_step2} P(N^{\prime}=n-h\,\vert\, N=n)=\frac{\binom{k}{h}\binom{n_\mathrm{T}-k}{n-h}}{\binom{n_\mathrm{T}}{n}}.% \end{equation} The coding vectors of the $n$ received packets compose a matrix of rank $r$, based on which $x$ or more source packets can be recovered when $h$ of the $n$ received packets are source packets. Parameters $x^{\prime}$, $r^\prime$, $k^{\prime}$ and $n^{\prime}$, which are concerned with the received \textit{coded} packets only, can be written as $x-h$, $r-h$, $k-h$ and $n-h$, respectively. The probability of recovering at least $x$ source packets for all valid values of $r$ and $h$ is \begin{align} \label{eq.s_step3} P&_\mathrm{s}(\lvert X\rvert\geq x \,\vert\, N=n)\nonumber \\ =&% \sum_{r=x}^{\min(n,k)}\!\!% \sum_{h=h_{\min}}^{r}\!\!% P(N^{\prime}=n-h\,\vert\, N=n)\,\cdot\nonumber% \\ &\cdot P\bigl(\lvert X^{\prime}\rvert \geq\max(0,\,x\!-\!h),R^{\prime}=r-h\,\vert\,N^{\prime}=n\!-\!h\bigr) \end{align} which expands into \eqref{eq.prob_s}. Note that $\max(0,\,x-h)$ ensures that the value of $\lvert X^{\prime}\rvert$ is a non-negative integer when $h>x$. \end{proof} \begin{remark} In systematic RLNC, if the receiving node attempts to recover source packets as soon as the transmission is initiated, i.e., $n_\mathrm{T}\!\leq\! k$, at least $x$ source packets will certainly be recovered when $n\!\geq\! x$ source packets are received, that is, \begin{equation} \label{eq.prob_s_less_than_k} P_\mathrm{s}(\lvert X\rvert\geq x\,\vert\, N=n)=\left\{% \begin{array}{ll} 1,&\mathrm{if}\;\; n_\mathrm{T}\leq k\;\;\mathrm{and}\;\;x \leq n\\ 0,&\mathrm{if}\;\; n_\mathrm{T}\leq k\;\;\mathrm{and}\;\;x > n.% \end{array}\right. \end{equation} \end{remark} \section{Results and discussion} \label{sec.results} \begin{figure}[t] \centering \includegraphics[width=0.95\columnwidth]{clari1.eps} \caption{{Simulation results and theoretical values for (a) non-systematic RLNC and (b) systematic RLNC. The probability of recovering at least $x$ source packets has been plotted for $q=2$, $k=20$, $x=1,5,10,20$ and $n_\mathrm{T}=30$.}} \label{fig.theory_vs_sims} \end{figure} In order to demonstrate the exactness of the derived expressions, simulations that generated 60000 realisations of an $n\times k$ random matrix $\mathbf{M}$ over $\mathbb{F}_2$ were carried out for $n=1,\dots,30$ and $k\!=\!20$. In each case, matrix $\mathbf{M}$ was converted into reduced row echelon form using Gaussian elimination. Then, the rows that correspond to unit vectors $\mathbf{e}_i$, which represent recoverable source packets, were counted and averaged over all realisations. Fig.~\ref{fig.theory_vs_sims}(a) and Fig.~\ref{fig.theory_vs_sims}(b) show that measurements obtained through simulations match the calculations obtained from \eqref{eq.prob_ns} and \eqref{eq.prob_s} for non-systematic RLNC and systematic RLNC, respectively. In general, simulation results match analytical predictions for any finite field $\mathbb{F}_q$ of order $q\geq 2$. Fig.~\ref{fig.study_both} considers the simple case of RLNC transmission over a broadcast erasure channel. If the transmission of $n_\mathrm{T}$ packets is modeled as a sequence of $n_\mathrm{T}$ Bernoulli trials whereby $\varepsilon$ signifies the probability that a transmitted packet will be erased, the probability that a receiving node shall recover \textit{at least} $x$ of the $k$ source packets can be expressed as \begin{equation} \label{eq.prob_BEC} P(\lvert X\rvert\!\geq\! x)\!=\!\displaystyle\sum_{n=x}^{n_\mathrm{T}}\!\displaystyle\binom{n_\mathrm{T}}{n}\!\left(1-\varepsilon\right)^{n}\varepsilon^{n_\mathrm{T}-n}\,P(\lvert X\rvert\!\geq\! x\,\vert\, N\!=\!n). \end{equation} The probability $P(\lvert X\rvert\geq x\,\vert\, N=n)$ is equal to \eqref{eq.prob_ns} for non-systematic RLNC {and \eqref{eq.prob_s} or \eqref{eq.prob_s_less_than_k}}, depending on the value of $n_\mathrm{T}$, for systematic RLNC. Fig.~\ref{fig.study_both}(a) focuses on non-systematic RLNC and depicts $P(\lvert X\rvert\geq x)$ in terms of $n_\mathrm{T}$ for $x\in\{2,4,10,16,20\}$ when $k\!=\!20$, and for $x\in\{3,6,15,24,30\}$ when $k\!=\!30$. Results have been obtained for $q\in\{2,8\}$ and $\varepsilon\!=\!0.2$. For $q\!=\!2$, the transmission of only a few additional coded packets can increase the fraction of the recovered message from at least $x/k=0.1$ to $x/k=1$. However, for $q$ as low as $8$, the range of $n_\mathrm{T}$ values for which a receiving node will proceed from recovering a small portion of the transmitted message to recovering the whole message gets very narrow. Furthermore, for $q\!=\!2$, segmentation of the message into $k\!=\!20$ source packets permits a receiving node to recover the same fraction ($x/k$) of the message with a higher probability than dividing the same message into $k\!=\!30$ source packets. Systematic RLNC is considered in Fig.~\ref{fig.study_both}(b). Besides the reduced decoding complexity \cite{Lucani12}, we observe that systematic RLNC enables a receiving node to gradually reveal an increasingly larger portion of the message as more packets are transmitted. However, a large number of source packets or a high order finite field impairs the progressive recovery of the message for $n_\mathrm{T}\!>\!k$. This is because source packets are transmitted for $n_\mathrm{T}\leq k$ but coded packets are sent for $n_\mathrm{T}\!>\!k$; the decoding behaviour of a receiving node changes at $n_\mathrm{T}\!=\!k$ and causes a change in the slope of $P(\lvert X\rvert\geq x)$ for $x/k\!=\!0.8$. The results show that, if information-theoretic security is required, non-systematic RLNC over finite fields of size 8 or larger can be used to segment each message into a large number of source packets. The number of transmitted packets can then be adjusted to the channel conditions to achieve a balance between the probability of legitimate nodes reconstructing the message and the probability of eavesdroppers being unable to decode even a portion of the message. If the objective of the system is to maximize the number of nodes that will recover at least a large part of a message, systematic RLNC over small finite fields can be used to divide data into source packets. If the receiving nodes do not suffer from limited computational capabilities, the size of the finite field can be increased to improve the probability of recovering the entire message. \begin{figure}[t] \captionsetup[subfigure]{labelformat=empty} \begin{subfigure}{0.492\columnwidth} \centering \includegraphics[height=2.4cm]{clari2_left_top.eps} \vspace{-3mm} \caption{\scriptsize $k=20$, $q=2$} \end{subfigure} \begin{subfigure}{0.492\columnwidth} \centering \includegraphics[height=2.4cm]{clari2_right_top.eps} \vspace{-3mm} \caption{\scriptsize $k=20$, $q=2$} \end{subfigure} \\ \begin{subfigure}{0.492\columnwidth} \vspace{1mm} \centering \includegraphics[height=2.4cm]{clari2_left_middle.eps} \vspace{-3mm} \caption{\scriptsize $k=30$, $q=2$} \end{subfigure} \begin{subfigure}{0.492\columnwidth} \vspace{1mm} \centering \includegraphics[height=2.4cm]{clari2_right_middle.eps} \vspace{-3mm} \caption{\scriptsize $k=30$, $q=2$} \end{subfigure} \\ \begin{subfigure}{0.492\columnwidth} \vspace{1mm} \centering \includegraphics[height=2.4cm]{clari2_left_bottom.eps} \vspace{-3mm} \caption{\scriptsize $k=30$, $q=8$} \end{subfigure} \begin{subfigure}{0.492\columnwidth} \vspace{1mm} \centering \includegraphics[height=2.4cm]{clari2_right_bottom.eps} \vspace{-3mm} \caption{\scriptsize $k=30$, $q=8$} \end{subfigure} \\ \begin{subfigure}{0.492\columnwidth} \vspace{2mm} \centering \caption{\scriptsize (a) Non-systematic RLNC} \end{subfigure} \begin{subfigure}{0.492\columnwidth} \vspace{2mm} \centering \caption{\scriptsize (b) Systematic RLNC} \end{subfigure} \vspace{-3mm} \caption{Depiction of the probability of recovering at least $x$ source packets when $n_\mathrm{T}$ packets have been transmitted over a packet erasure channel with $\varepsilon\!=\!0.2$ using (a) non-systematic RLNC and (b) systematic RLNC.} \label{fig.study_both} \vspace{-4mm} \end{figure} \section{Conclusions} \label{sec.conclusions} This paper derived exact expressions for the probability of decoding a fraction of a source message upon reception of an arbitrary number of network-coded packets. Results unveiled the potential of non-systematic network coding in offering weak information-theoretic security, even when operations are over small finite fields. On the other hand, systematic network coding allows for the progressive recovery of the source message as the number of received packets increases, especially when the size of the finite field is small. \section{Acknowledgments} \label{sec.ack} Jessica Claridge has been supported by an EPSRC PhD studentship. Both authors appreciate the support of the COST Action IC1104 and thank Simon R. Blackburn for his advice. \bibliographystyle{IEEEtran}
{'timestamp': '2017-05-11T02:05:48', 'yymm': '1607', 'arxiv_id': '1607.04725', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04725'}
arxiv
\section{Introduction} In robotics motion planning and control, one major challenge is to specify a high level task for a robot without specifying how to solve this task. For legged locomotion such a task include a goal position to reach or to manipulate an object without specifying gaits, contacts, balancing or other behaviors. Trajectory Optimization recently gained a lot of attention in robotics research since it promises to solve some of these problems. It could potentially solve complex motion planning tasks for robots with many degrees of freedom, leveraging the full dynamics of the system. Yet, there are two challenges of optimization optimization. Firstly, Trajectory Optimization problems are hard problems to solve, especially for robots with many degrees of freedom and for robots that make or break contact. Therefore, many approaches add heuristics or pre-specify contact points or sequences. However, this then defines again how the robot is supposed to solve the task, affecting optimality and generality. Secondly, Trajectory Optimization cannot be blindly applied to hardware but requires an accurate model as well as a good control and estimation framework. In this work, we are addressing both issues. In our Trajectory Optimization framework, we only specify high level tasks, allowing the solver to find the optimal solution to the problem, optimizing over the entire dynamics and automatically discovering the contact sequences and timings. Second, we also demonstrate how such a dynamic task can be generated online. This work does not present a general tracking controller suitable for all trajectories. However, we show the successful integration of our Trajectory Optimization with our estimation and control framework allowing for executing a selection of tasks even under disturbances. \begin{figure}[htbp] \centering \includegraphics[width=\columnwidth]{images/hardware.png} \caption{Sequence of images during execution of the rough manipulation task in hardware. The time series starts at the top left corner and time progresses line-wise. The motion shows how the shift of the main body, lift-off, push-over and return to default stance.} \label{fig:hw_sequence} \end{figure} Trajectory Optimization tries to solve a general, time-varying, non-linear optimal control problem. There are various forms of defining and solving the control problem. An overview can be found in \cite{betts1998survey}. With the increase of computational power, Trajectory Optimization can be applied to higher dimensional systems like legged robots. Thus, it has gained a lot of attention in recent years and impressive results have been demonstrated in simulation \cite{posa2014direct,mordatch2012discovery,tassa2012synthesis}. One of the conceptually closest related work is \cite{tassa2014control}. However, no gait discovery or very dynamic motions are shown and no hardware results are presented. Later work \cite{koenemann2015whole} includes hardware results but the planning horizon is short, the motions are quasi-static and contact changes are slow. In \cite{mastalli} Trajectory Optimization through contacts is demonstrated on hardware. While the results are promising, the approach is only tested on a low-dimensional, single leg platform and for very simple tasks. In general, work that demonstrates Trajectory Optimization through contacts applied to physical, legged systems is very rare. Automatically discovered gaits and dynamic motions demonstrated on quadruped hardware are presented in \cite{gehring2016}. The presented results are very convincing and they are also considering actuator dynamics. However, their approach differs in key areas to the presented work: Contact sequences are pre-specified and they optimize over control parameters for a fixed control structure rather than whole body trajectories and control inputs. Additionally, they are using black box optimization. However, the tracking controllers employed in both approaches are very similar. \subsection{Contributions} In this work, we apply Trajectory Optimization (TO) in form of Sequential Liner-Quadratic (SLQ) control \cite{slq} to the quadruped robot HyQ \cite{hyq}, both in simulation and on hardware. Our work is one of very few examples, where TO is used to plan dynamic whole body motions through contact changes and where some of these trajectories are applied to hardware. Furthermore, this is possibly the first time that a whole body TO approach is shown on quadruped hardware. In contrast to state-of-the-art approaches, neither contact switching times nor contact events nor contact points are defined a priory. Instead they are a direct outcome of the optimization. This allows us to generate a diverse set of motions and gaits using a single approach. By using an efficient formulation based on Differential Dynamic Programming and a customized, high-performance solver, optimization times for these tasks usually do not exceed a minute, even for complex trajectories. Thus, while the Trajectory Optimization is not performed in a control loop, it is still run online. Hence, this work is also one of the earliest examples of whole body TO fully integrated with a control, state estimation and ground estimation pipeline of a legged robotic system. \section{Trajectory Optimization} \subsection{Optimal Control Problem} In this work, we consider a general non-linear system of the following form \begin{align} \dot{\myvec{x}}(t) = f(\myvec{x}(t),\myvec{u}(t)) \label{eq:system_model} \end{align} where $x(t)$ and $u(t)$ denote state and input trajectories respectively. In Trajectory Optimization, we indirectly optimize these trajectories by altering a linear, time-varying feedback and feedforward controller of the form \begin{align} \myvec{u}(\myvec{x},t) = \myvec{u}_{ff}(t) + \mathcal{K}(t) \myvec{x}(t) \label{control_law} \end{align} where $\mathcal{K}(t)$ is a time-varying control gain matrix and $u_{ff}(t)$ a time-varying feedforward control action. Our Trajectory Optimization approach then tries to solve a finite-horizon optimal control problem which minimizes a given cost function of the following form \begin{align} J(\myvec{x},\myvec{u}) = h\left( \myvec{x}(t_f) \right) + \int_{t=0}^{t_f}l \left( \myvec{x}(t),\myvec{u}(t) \right) dt \label{eq:cost_function} \end{align} \subsection{Sequential Linear Quadratic Control} Sequential Linear Quadratic Control is an iterative optimal-control algorithm. SLQ first rolls out the system dynamics. Then, the non-linear system dynamics are linearized around the trajectory and a quadratic approximation of the cost function is computed. The resulting Linear-Quadratic Optimal Control problem is solved backwards. Since the solution to the Linear-Quadratic Optimal Control problem can be computed in closed form with Ricatti-like equations, SLQ is very efficient. Algorithm \ref{alg:slq} summarizes the algorithm. SLQ computes both, a feedforward control action as well as a time-varying linear-quadratic regulator that stabilizes the trajectory. \begin{algorithm}[tpb] \caption{SLQ Algorithm} \label{alg:slq} \begin{algorithmic} \scriptsize \STATE \textbf{Given} \STATE - System dynamics: $\myvec{x}(t+1)=\myvec{f}\left(\myvec{x}(t),\myvec{u}(t)\right)$ \STATE - Cost function $J = h\left( \myvec{x}(t_f) \right) + \sum\limits_{t=0}^{t_f-1}{l \left( \myvec{x}(t),\myvec{u}(t) \right)}$ \STATE - Initial stable control law, $\mathbf{\myvec{u}}(\myvec{x},t)$ \REPEAT \STATE - t(0) simulate the system dynamics: \STATE $\tau: \myvec{x}_n(0),\myvec{u}_n(0),\myvec{x}_n(1),\myvec{u}_n(1),\dots,\myvec{x}_n(t_f-1),\myvec{u}_n(t_f-1),\myvec{x}_n(t_f)$ \STATE - Linearize the system dynamics along the trajectory $\tau$: \STATE $\delta\myvec{x}(t+1) = \myvec{A}(t)\delta\myvec{x}(t)+\myvec{B}(t)\delta\myvec{u}(t)$ \STATE \qquad $\{ \myvec{A}(t) \}_{0}^{t_f-1}$, $\myvec{A}(t)=\frac{\partial\myvec{f}}{\partial \myvec{x}}|_{\myvec{x}(t),\myvec{u}(t)}$ \STATE \qquad $\{ \myvec{B}(t) \}_{0}^{t_f-1}$, $\myvec{B}(t)=\frac{\partial\myvec{f}}{\partial \myvec{u}}|_{\myvec{x}(t),\myvec{u}(t)}$ \STATE - Quadratize cost function along the trajectory $\tau$: \STATE $\tilde{J} \approx p(t)+\delta\myvec{x}^T(t_f)\myvec{p}(t_f)+\frac{1}{2}\delta\myvec{x}^T(t_f)\myvec{P}(t_f)\delta\myvec{x}(t_f) $ \STATE \quad \hspace{2ex} $+ \sum\limits_{t=0}^{t_f-1}q(t)+\delta\myvec{x}^T\myvec{q}(t)+\delta\myvec{u}^T\myvec{r}(t) $ \STATE \quad \hspace{2ex} $+ \frac{1}{2}\delta\myvec{x}^T\myvec{Q}(t)\delta\myvec{x}+\frac{1}{2}\delta\myvec{u}^T\myvec{R}(t)\delta\myvec{u}$ \STATE - Backwards solve the Riccati-like difference equations: \STATE \qquad $\myvec{P}(t) = \myvec{Q}(t)+\myvec{A}^T(t)\myvec{P}(t+1)\myvec{A}(t)+ $ \STATE \hspace{12ex} $\myvec{K}^T(t)\myvec{H}\myvec{K}(t) + \myvec{K}^T(t)\myvec{G}+\myvec{G}^T\myvec{K}(t)$ \STATE \qquad $\myvec{p}(t) = \myvec{q}+\myvec{A}^T(t)\myvec{p}(t+1)+\myvec{K}^T(t)\myvec{H}\myvec{l}(t)+\myvec{K}^T(t)\myvec{g}+\myvec{G}^T\myvec{l}(t)$ \STATE \qquad $\myvec{H} = \myvec{R}(t)+\myvec{B}^T(t)\myvec{P}(t+1)\myvec{B}(t)$ \STATE \qquad $\myvec{G} = \myvec{B}^T(t)\myvec{P}(t+1)\myvec{A}(t)$ \STATE \qquad $\myvec{g} = \myvec{r}(t)+\myvec{B}^T(t)\myvec{p}(t+1)$ \STATE \qquad $\myvec{K}(t)= -\myvec{H}^{-1}\myvec{G}$ \% feedback update \STATE \qquad $\myvec{l}(t)= -\myvec{H}^{-1}\myvec{g}$ \% feedforward increment \STATE \textbf{Line search} \STATE - Initialize $\alpha = 1$ \REPEAT \STATE - Update the control: \STATE $\mathbf{\myvec{u}}(\myvec{x},t) = \myvec{u}_n(t) + \alpha \myvec{l}(t) + \myvec{K}(t) \left(\myvec{x}(t)-\myvec{x}_n(t)\right)$ \STATE - Forward simulate the system dynamics: \STATE $\tau: \myvec{x}_n(0),\myvec{u}_n(0),\myvec{x}_n(1),\dots,\myvec{x}_n(t_f-1),\myvec{u}_n(t_f-1),\myvec{x}_n(t_f)$ \STATE - Compute new cost: \STATE $J = h\left(\myvec{x}(t_f) \right) + \sum_{t=0}^{t_f-1}{l \left( \myvec{x}(t),\myvec{u}(t) \right) dt}$ \STATE - decrease $\alpha$ by a constant $\alpha_{d}$: \STATE $\alpha = \alpha / \alpha_{d}$ \UNTIL{found lower cost or number of maximum line search steps reached} \UNTIL{maximum number of iterations or converged ($\myvec{l}(t) < l_t$)} \end{algorithmic} \end{algorithm} One drawback of SLQ is that it cannot handle hard state constraints. While one can add state constraints as soft constraints into the cost function, they can result in bad numerical behavior. Handling input constraints in these type of algorithms is possible, as shown in \cite{ilqg}, we are not considering them as of now. Even though we are not considering constraints in this work, most tasks result in constraint satisfactory trajectories within the joint position and torque limits. \subsection{Cost Function} While SLQ can handle non-quadratic cost functions, pure quadratic cost functions increase convergence and are often sufficient to obtain the desired behaviour. Therefore, in this work we assume our cost function to be of quadratic form \begin{align} J &= \bar{\myvec{x}}(t_f)^T \myvec{H} \bar{\myvec{x}}(t_f) + \int\limits_{t=0}^{t_f}{ \bar{\myvec{x}}(t)^T \myvec{Q} \bar{\myvec{x}}(t) + \bar{\myvec{u}}(t)^T \myvec{R} \bar{\myvec{u}}(t) } \nonumber \\ &+ W(\myvec{x},t) \, dt \label{eq:cost_function_experiments} \end{align} where $\bar{x}(t)$ and $\bar{u}(t)$ represent deviations of state and input from a desired state and input respectively. $H$, $Q$ and $R$ are the weightings for final cost, intermediate cost and input cost respectively. Additionally, we add intermediate state waypoints to guide the trajectory. These are weighted by the waypoint cost matrix $W(x,t)$ defined as \begin{align} W(\myvec{x},t) = \sum\limits_{n=0}^{N}{ \hat{\myvec{x}}(t)^T \myvec{W}_p \hat{\myvec{x}}(t) \sqrt{\frac{\rho_p}{2 \pi}} \exp{\left( - \frac{\rho_p}{2} (t - t_p)^2 \right)} } \label{eq:waypoint} \end{align} \section{System Model and Robot Description} For the experiments in this paper, we use the hydraulically actuated, quadrupedal robot HyQ \cite{hyq}. Each of the four legs on HyQ has three degrees of freedom, namely hip abduction/adduction (HAA), hip flexion/extension (HFE) and knee flexion/extension (KFE). Each of these joints is driven by a hydraulic actuator which is controlled by a hydraulic valve. The joint torque and position is measured via load cells and encoders respectively. A hydraulic force control loop is closed at joint level, providing joint torque reference tracking. \subsection{Rigid Body Dynamics} While it is a simplification, torque tracking performance on HyQ is sufficient for modeling it as a perfectly torque controlled robot. Thus, we assume HyQ to behave like a rigid body system defined as \begin{equation} \myvec{M}(\myvec{q})\ddot{\myvec{q}} + \myvec{C}(\myvec{q},\dot{\myvec{q}}) + \myvec{G}(\myvec{q}) = \myvec{J}^T_c \lambda(\myvec{q}, \dot{\myvec{q}}) + \myvec{S}^T \tau \label{eq:rbd} \end{equation} where $M$ denotes the inertia matrix, $C$ the centripetal and coriolis forces and $G$ gravity terms. $q$ is the state vector containing the 6 DoF base state as well as joint positions and velocities. External and contact forces $\lambda$ act on the system via the contact Jacobian $J_c$. Torques created by the actuation system $\tau$ are mapped to the states via the selection matrix $S$. To formulate our dynamics according to Equation \ref{eq:system_model}, we define our state as \begin{equation} \myvec{x} = [{}_{\mathcal{W}}\myvec{q}~{}_{\mathcal{L}}\dot{\myvec{q}}]^T = [{}_{\mathcal{W}}\myvec{q}_B~{}_{\mathcal{W}}\myvec{x}_B~\myvec{q}_J~{}_{\mathcal{L}}\omega_B~{}_{\mathcal{L}}\dot{\myvec{x}}_B~\dot{\myvec{q}}_J]^T \label{eq:coordinates} \end{equation} where ${}_{\mathcal{W}}\myvec{q}_B$ and ${}_{\mathcal{W}}\myvec{x}_B$ define base orientation and position respectively, which are expressed in a global inertial ``world'' frame $\mathcal{W}$. The base orientation is expressed in euler angles (roll-pitch-yaw). The base's angular and linear velocity are denoted as $\omega_B$ and $\dot{\myvec{x}_B}$ respectively and both quantities are expressed in a local body frame $\mathcal{L}$. Joint angles and velocities are expressed as $\myvec{q}_J$ and $\dot{\myvec{q}}_J$ respectively. Expressing base pose and twist in different frames allows for more intuitive tuning of the cost function weights. Using Equations \ref{eq:rbd} and \ref{eq:coordinates} our system dynamics in Equation \ref{eq:system_model} become \begin{align} \dot{\myvec{x}}(t) &= \begin{bmatrix} {}_{\mathcal{W}}\dot{\myvec{q}} \\ {}_{\mathcal{L}}\ddot{\myvec{q}} \end{bmatrix} \\ &= \begin{bmatrix} \myvec{R}_{\mathcal{W}\mathcal{L}}~{}_{\mathcal{L}}\dot{\myvec{q}} \\ \myvec{M}^{-1}(\myvec{q})(\myvec{S}^T\tau + \myvec{J}_c \lambda(\myvec{q},\dot{\myvec{q}}) - \myvec{C}(\myvec{q}, \dot{\myvec{q}}) - \myvec{G}(\myvec{q})) \end{bmatrix} \nonumber \label{eq:system_model} \end{align} where $\myvec{R}_{\mathcal{W}\mathcal{L}}$ defines the rotation between the local body frame $\mathcal{L}$ and the inertial ``world'' frame $\mathcal{W}$. While dropped in our notation for readability, $\myvec{R}_{\mathcal{W}\mathcal{L}}$ is a function of ${}_{\mathcal{W}}\myvec{q}$ which needs to be considered during linearization. For SLQ we need to linearize the system given in in Equation \ref{eq:system_model}. For the derivatives of the upper row with respect to the state $\myvec{x}$ as well as all derivatives with respect to $\tau$ we compute analytical derivatives. For the derivatives of the lower row in Equation \ref{eq:system_model} with respect to the state $\myvec{x}$, we use numerical differentiation. \subsection{Contact Model} Choosing or designing an appropriate contact model is critical for the performance of Trajectory Optimization. There are two main criteria defining the performance of a contact model: Physical accuracy and numeric stability. For Trajectory Optimization it is beneficial to use a smooth contact model which provides good gradients of the dynamics. Yet, this can lead to undesirable, unphysical defects like ground penetration. Therefore, there is a trade-off to be made. To mitigate this trade-off we are using a non-linear spring-damper contact model extending the model proposed in \cite{slq}. We consider two contact models: One collinear and one orthogonal to the surface normal. The normal contact model is defined as \begin{equation} \lambda_N = \begin{cases} 0 & p_n \leq 0 \\ (k_n + d_n \dot{p}_n) \frac{p_n^2}{2\alpha_c} \myvec{n}_s & 0 < p_n < \alpha_c \\ (k_n+d_n \dot{p}_n) (p_n - \frac{\alpha_c}{2}) \myvec{n}_s & p_n \geq \alpha_c \end{cases} \end{equation} while the tangential model is defined as \begin{equation} \lambda_t = \begin{cases} 0 & p_n \leq 0 \\ (k_t p_t \myvec{n}_{d} + d_t \dot{p}_t \myvec{n}_{v}) \frac{p_n^2}{2\alpha_c} & 0 < p_n < \alpha_c \\ (k_t p_t \myvec{n}_{d} + d_n \dot{p}_n \myvec{n}_{v}) (p_n - \frac{\alpha_c}{2}) & p_n \geq \alpha_c \end{cases} \end{equation} Both models include a proportional and derivative terms which can be imagined as springs with stiffnesses $k_n$ and $k_t$ and dampers with damping ratios $d_n$ and $d_t$ respectively. For the normal direction the spring displacement $p_n$ is defined as the ground penetration orthogonal to the surface normal $\myvec{n}_s$. In tangential direction, the offset $p_t$ is computed between the current contact location and the location where the contact has been established. This effectively creates additional states in our system. However, we treat these states as hidden states, such that the size of the SLQ problem remains constant. In case of the tangential model, the force vector $\lambda_t$ is composed of the spring force in tangential displacement direction $\myvec{n}_{d}$ and a damping force in displacement velocity direction $\myvec{n}_{v}$. Both, the normal and tangential contact models are visualized in Figure \ref{fig:contact_models}. \begin{table}[htbp] \centering \caption{Typical Values for Contact Model Parameters} \label{tbl:contact_parameters} \begin{tabular}{|c|c|c|c|c|} \hline $\alpha_c$ & $k_n$ & $d_n$ & $k_t$ & $d_t$ \\ \hline 0.01 & 8000 ... 90000 & 2000 ... 50000 & 0 ... 5000000 & 2000 ... 5000 \\ \hline \end{tabular} \end{table} To avoid discontinuities during contact changes, the models are non-linear towards zero ground penetration, i.e. for $p_n < \alpha$, where $\alpha_c$ is a smoothing coefficient. Typical values for the contact model are given in Table \ref{tbl:contact_parameters}. The parameters are task dependent to trade-off physical correctness and convergence. \begin{figure}[htbp] \centering \includegraphics[width=\columnwidth]{plots/contact_models.pdf} \caption{Visualization of the contact model. The left plot shows the contact force in surface normal direction as a function of penetration and its derivative. The right plot shows the force in tangential direction as a function of penetration and tangential displacement. Both contact models are smooth at impact, i.e. at penetration 0.} \label{fig:contact_models} \end{figure} Friction and friction limits are considered via friction cones. This allows the Trajectory Optimization algorithm to reason about possible slippage and contact force saturation. In this work, we assume that static and dynamic friction coefficients are the same. Therefore, the friction cone can be expressed as a contact force saturation \begin{equation} \myvec{F}_t = max(||\myvec{F}_t||, \mu F_n) \myvec{n}_s \end{equation} where $F_t$ is the contact force parallel to the surface, $F_n$ is the force normal to the surface, $\mu$ is the friction coefficient and $\myvec{n}_s$ is the surface normal. \section{State Estimation and Tracking Control} Our TO approach is fully integrated into our estimation and control framework, illustrated in Figure \ref{fig:control_overview}. Since SLQ assumes full state-feedback, joint position and velocity measurements are fused with IMU data to obtain a base estimate\cite{bloesch2013state}. Furthermore, since SLQ reasons about contacts with the environment, a ground estimator is added which estimates elevation and inclination of the ground. SLQ then optimizes a trajectory which is then fed to a task-space base controller and the joint controller. These control loops are closed at a rate of 200 Hz. The corrective output of both controllers is then added to the feedforward control signal as optimized by SLQ and sent to the robot. \begin{figure}[htbp] \centering \includegraphics[width=\columnwidth]{images/control_overview.pdf} \caption{Overview of the control and estimation pipeline. Base, stance and ground estimators provide information about the location and contact configuration of the robot. A joint controller and a base controller jointly control the robot's state.} \label{fig:control_overview} \end{figure} \subsection{State Estimation} SLQ assumes full state-feedback, i.e. all states are assumed to be known. While we can directly measure joint positions and velocities with the encoders on HyQ, the base state cannot be directly measured. Therefore, we use \cite{bloesch2013state} to estimate the base's pose and twist. The contact state is estimated by mapping joint torques to estimated ground reaction forces. If the normal component of the ground reaction force estimate is above a fixed threshold we assume the leg being in contact. In order to reason about the contact forces $\lambda$, we also have to know the elevation and contact surface normal at the contact points. In order for the algorithm to work online we cannot assume a perfectly leveled ground. Instead, we assume a ground plane which is fitted to the last contact point of each feet. This implementation allows for incorporating a ground map in the future. \subsection{Tracking Controller} SLQ does not only optimize feed-forward control action but also a feedback controller. While we have successfully applied theses feedback gains to robotic hardware \cite{mpc_quad}, we are not using the optimized feedback gains in this work for two reasons. First, the optimized feedback gains correspond to a time-varying, linear-qaudratic regulator (TVLQR). Therefore, the gains significantly depend on the linearization point. Especially due to the non-linearity of the contacts, the robot's state will drift from the linearization point during trajectory execution. Secondly, due to the usage of a single cost function, any regularization in the cost function will also effect the feedback gains which is undesirable. One solution is to recompute the gains online. However, we have found that the following tracking controller shows great performance at reduced complexity. Assuming a known, fixed stance configuration with no slippage and at least three stance legs, the stance legs as well as the torso can be described by a 6 degrees of freedom state. This means, the base state, consisting of pose and twist, is coupled with joint positions and velocities of the stance legs. Therefore, controlling either set of states, the joint states of the stance legs or the base state, will subsequently also track the other set. A base controller allows us to directly track the base state and tune feedback gains on these states intuitively. Yet, for swing legs, we still require a joint controller. Hence, to get best of both worlds, we are using a combination of a task space base controller and a joint space controller. The joint space controller tracks the desired position and desired velocity of all joints independently. Additionally, the base controller regulates the base state with a PD controller. This task space control can be imagined as virtual springs and dampers attached to the robot's trunk on one side and the optimized body trajectory on the other \cite{pratt2001virtual}. \begin{equation} \myvec{F}_{cog} = \myvec{P}_x (\myvec{x}_{cog}^* - \myvec{x}_{cog}) + \myvec{D}_x (\dot{\myvec{x}}_{cog}^* - \dot{\myvec{x}}_{cog}) \label{eq:virtual_model} \end{equation} The desired body wrench $\mathbf{F}_{cog}$ is applied to the robot by converting it to forces in the contact points $\boldsymbol{\lambda}_{c}$ and then mapping these to the joint torques through $\boldsymbol{\tau}_{fb} = \mathbf{J}_{c}^T \boldsymbol{\lambda}_{c}$. These torques are then added to the feedforward control action obtained from SLQ. This feedforward control action already includes torques that counteract gravity and thus, no gravity compensation term is added in Equation \ref{eq:virtual_model}. \section{Experiments} To evaluate the approach, we first show, how a galloping and a trotting gait with optimized contact switching sequences and timings can be obtained in simulation. Furthermore, we demonstrate a manipulation motion that includes contact switches and more complex base motions. To verify the applicability of our approach, we demonstrate hardware experiments for the last task. Finally, we show a highly under-actuated task where HyQ walks on its hind legs like a humanoid. For each task, the cost function is shown as a color code below the heading. The colors indicate the individual, relative weightings of the diagonal entries of each weighting matrix, ranging from lowest (green) to highest (red) on a logarithmic scale. No color means that the according value is zero and all off-diagonal elements are zero as well. The input cost matrix $\myvec{R}$ is set to identity in all experiments. All tasks are initialized with a simple PD feedback controller on all joints and no feedforward control. This leads to HyQ maintaining its initial state over the entire length of each trajectory. \subsection{Simulation} \begin{figure}[htbp] \centering \includegraphics[width=\columnwidth]{images/all_color.png} \caption{Time series of the optimized trajectories for each task. Poses are shown as a color gradient over time ranging from red (initial pose) to green (final pose). Intermediate poses are indicated in transparent white. All displayed motions contain contact switches during dynamic maneuvers. These contact switches result from optimization and are not pre-specified.} \label{fig:strips} \end{figure} \subsubsection{Galloping} \begin{center} \includegraphics[width=\columnwidth]{plots/costs/gallop.png} \end{center} The first gait we demonstrate is galloping. The galloping gait is a direct outcome of the optimization with a very simple cost function. The cost function consists of final costs on the base position and leg positions. Additionally, we add some regularization on the base and leg motion to prevent excessive motions of the body or the limbs. However, the cost function does not include any terms related to contact sequences or timings and no priors on a galloping gait. Also, we are not using any intermediate cost terms here. HyQ starts in its default stance and is supposed to reach its final position 2 m in front. The chosen time horizon is 3 seconds. As for all tasks, the initial controller is a simple joint PD controller which results in HyQ staying in place and maintaining its intial configuration. \begin{figure}[htbp] \centering \includegraphics[width=\columnwidth]{plots/gallop_base.pdf} \caption{Plots of base pose and base twist during galloping as optimized by SLQ. The robot takes in total 9 galloping steps. As expected, there is significant pitch motion during galloping. The desired final position at $x = 2.0$ m is reached with good accuracy. } \label{fig:gallop_base} \end{figure} \begin{figure}[htbp] \centering \includegraphics[width=\columnwidth]{plots/gallop_torques.pdf} \caption{Torque profiles of the different joints during a galloping motion. As the lower plots show, the hind legs and especially the HFE joints, contribute greatly to the acceleration. The front leg torques seem to contribute fairly evenly to the galloping motion throughout the trajectory.} \label{fig:gallop_torques} \end{figure} As the results in Figure \ref{fig:gallop_base} illustrates, we obtain a gallop motion with 9 steps which includes acceleration and deceleration. Finally, the robot reaches the desired position at $x=2.0$ m. As expected, we see significant pitch motion of the upper body. From Figure \ref{fig:gallop_torques} we can tell that the hind legs, especially the HFE joints, are used for acceleration. While our findings are not directly comparable to biology, we can see similar effects: In fast running animals, like leopards and horses, the rear legs also bear a larger load during running than the front legs, which explains the different sizing of legs and muscles between rear and front. Snapshots of the gallop are shown in Figure \ref{fig:strips} and the full motion is shown in the video\footnote{\label{video}\url{https://youtu.be/sILuqJBsyKs}}. \subsubsection{Trotting} \begin{center} \includegraphics[width=\columnwidth]{plots/costs/trot.png} \end{center} One hypothesis for the previous task resulting in a galloping behavior is the short time horizon and no penalty on the orientation. Now if we increase the time horizon to 8 seconds and penalyze the base motion, i.e. we give HyQ more time and encourage smoother base motions, we see that the optimization starts to prefer a trotting motion instead of the galloping. Interestingly enough, the weightings allow to blend between galloping and trotting. As a result, HyQ first gallops and then smoothly transitions to a trotting gait. Again, neither the contact sequence, nor the gait or the transition is given. The parameters influencing the gait are the diagonal elements of $\myvec{Q}$ and $\myvec{R}$ as in Equation \ref{eq:cost_function_experiments}. By increasing the base motion penalty, the trajectory results in a pure trot. The trot consists of 4 steps per diagonal leg pair with almost constant stride length. By setting the desired position to the side instead of the front, the resulting trajectory is a sidestepping motion. If only a desired yaw angle is set, the robot turns on the spot. Both trajectories are trotting variants where the diagonal leg pairs are moved together. Both motions are illustrated in Figure \ref{fig:strips} and included in the video\textsuperscript{\ref{video}}. \subsubsection{Squat Jump} \begin{center} \includegraphics[width=\columnwidth]{plots/costs/squat.png} \end{center} Next, we test if our Trajectory Optimization approach can leverage and reason about the dynamics of our system. Thus, we define a task with intermediate waypoint states that are not statically reachable. First, we add an intermediate waypoint cost term for the base position and orientation. For this waypoint, we choose a strong weighting for the base height and set the desired value of the base height to $z=0.8 m$. Furthermore, the waypoint costs contain low weighting on the base orientation to keep the base level. By adding a cost on the deviation from default joint position, we ensure HyQ cannot just try to straighten its legs to try to reach the base pose, but that it has to jump. After running our optimization, we obtain a near symmetric squat jump. The overall optimization spans the entire motion, e.g. preparation for lift-off from default pose, the lift-off itself, going to default pose in the air, landing and returning to the default pose. The apex waypoint is localized in time but contact switches and timings are optimized. Also, we are not directly specifying a squat jump. Therefore, simultaneous lift-off and landing of the legs is an optimization outcome rather than pre-specified. \begin{figure}[htbp] \centering \includegraphics[width=\columnwidth]{plots/squat_base.pdf} \caption{Plots of base pose and base twist during a squat jump as optimized by SLQ. The graphs show that the robot keeps its base stable while jumping. Also unnecessary base motion in x- and y-direction are minimized. Furthermore, we can see that the desired apex height of 0.8 m is reached (measured value 0.8004).} \label{fig:squat_base} \end{figure} Figure \ref{fig:squat_base} shows the optimized squat jump motion. We can see that unnecessary motions such as rotations or position changes in x- or y-direction are avoided. Also, the desired apex height of 0.8 m, despite being a soft constraint, is reached with sub-millimeter accuracy (measured 0.8004 m). The small pitch velocity results from an off-center mass and the optimization goal of low torques which promotes equal distribution of torques between legs as seen in Figure \ref{fig:squat_torques}. The same plot also shows that the largest torques appear in the KFE and HFE joints. Furthermore, the lower leg of HyQ weighs less than 1 kg compared to a total mass of about 80 kg. Therefore, the mass that the lower leg drives changes rapidly during contact changes occurring at around $t=0.55 s$ and $t=0.9 s$. Hence, the torques also change quickly. While the knee joint is still moved in the air to take the default angle and prepare for landing, the required torque is minimal. Again, both motions are shown as a snapshot series in Figure \ref{fig:strips} as well as in the video\textsuperscript{\ref{video}}. \begin{figure}[htbp] \centering \includegraphics[width=\columnwidth]{plots/squat_torques.pdf} \caption{Plots of the torque profiles during a squat jump. During stance phases the profiles are fairly flat. There are two distinct spikes which are the torques produced during take-off and landing. By including the torques in the optimization criterion of the squat jump task, the distribution is even between all legs.} \label{fig:squat_torques} \end{figure} \subsubsection{Rearing} \begin{center} \includegraphics[width=\columnwidth]{plots/costs/rear.png} \end{center} For the next task, we are using a similar cost function as the squat jump. Instead of penalizing the deviation from a neutral base pose, we penalize deviations from a 30$^\circ$ pitched base orientation and we lower the desired apex height to 0.7 m. Yet again, we do not specify contact/stance configurations. Therefore, the optimization algorithm is free to optimize the trajectory. The final trajectory represents a rearing motion, where HyQ lifts off with the front legs, reaches the apex position and finally returns to full contact as well as its default pose. A screenshot of the apex position is shown in Figure \ref{fig:strips}. The full motion is shown in the accompanying video\textsuperscript{\ref{video}}. \subsubsection{Diagonal Balance} \begin{center} \includegraphics[width=\columnwidth]{plots/costs/balance.png} \end{center} In order to demonstrate that the SLQ can also find statically unstable trajectories, we are demonstrating a diagonal balance task. Here, we use a waypoint term in our cost function again. This term penalizes the orientation and height of the base. Furthermore, it encourages the robot to pull up its legs by bending HFE and KFE of the left front and right hind leg. The final trajectory shows the expected balancing behavior. Again a screenshot at apex is shown in Figure \ref{fig:strips} and the video\textsuperscript{\ref{video}} shows the full motion. Interestingly, while we are using a single intermediate term with a single time point and absolutely symmetric costs, the lift-off and touch-down of the swing legs is not synchronous but the front left leg lifts-off later and touches down earlier. This asymmetry most likely stems from the asymmetric location of the CoG and assymmetric inertia of the robot's main body. \subsubsection{Humanoid Walk} \begin{center} \includegraphics[width=\columnwidth]{plots/costs/humanoid.png} \end{center} As a final test, we evaluate if our algorithm is capable of optimizing a behavior that allows HyQ to stand on its hind legs, similar to a humanoid robot, and then go to a target point in front. While standing on its hind legs exceeds the capabilities of the hardware, such a motion is physically possible. Compared to a humanoid with ankles, HyQ has point feet. This increases the level of difficulty since the absence of ankles makes HyQ highly under-actuated. This means that during a standing or walking task no torques can be applied to the ground but balance can only be maintained by moving the links. In this task, we again initialize HyQ in its default stance, requiring it to stand up in place first and then reach a goal point where it should stabilize for a second. The first waypoint has a very wide spread in time and penalizes deviations in base orientation and height. This cost ensures that HyQ stays upright during the entire task after getting up. We do not add this cost to the general intermediate cost, as it would encourage HyQ to stand up as fast as possible, rather than getting up in a controlled, efficient manner. The stand up motion is encouraged by the second waypoint cost penalizing base orientation, height and changes in forward position. We add a third waypoint one second before the end of the time horizon, defining the target pose and orientation. While the last waypoint and the final cost specify the same base pose, we separate them to demonstrate that HyQ can stay upright and stabilize in place for longer times without showing signs of falling. The resultant motion shows interesting, non-trivial behavior. Before getting up HyQ pulls its hind left leg in, moving the contact point more closely below the center of gravity. Also, it uses the front left leg (``left arm'') to get up, resulting in a very natural, coordinated, asymmetric motion. After getting into a two-leg standing phase, a forward motion is initiated by a short symmetric hopping but quickly changes to a coordinated stepping/walking pattern. While we penalize joint velocity, the front limbs are moved to support balance during the motion until they are retracted to a target pose at the end of the trajectory. The entire motion underlines once more the capabilities of the approach. Classic controllers and motion planners might not find such a complex motion. Additionally, by allowing optimization over contact points and sequences, we allow the Trajectory Optimization to find the best solution for the task. While a rearing motion, as demonstrated above, is feasible and can be found using our problem formulation, the optimizer prefers a less dynamic, coordinated motion here. \subsection{Hardware} \begin{center} \includegraphics[width=\columnwidth]{plots/costs/hardware.png} \end{center} To verify that the optimized trajectories can be applied to hardware, we run an example task on hardware. This task is a rough manipulation task where HyQ pushes over a pallet with its front left leg. The trajectory requires a sequence of motions such as shifting its CoG in the support polygon of the three stance legs, lifting off of the front left leg, executing the push motion, putting the foot back down and shifting the CoG back. While in classic approaches these motions would possibly all handcoded, they result from a single cost function with only one intermediate cost function term for the front left leg in our Trajectory Optimization approach. While this trajectory works perfectly fine in simulation, we have to slightly alter it for the hardware. Since our TO approach is deterministic and we penalize control input, the algorithm tries to minimize the shift of the CoG, leading to a very risky trajectory. Thus, small model inaccuracies or disturbances make the robot loose its balance. This is a general problem of all deterministic TO approaches and can only be fundamentally solved by using risk aware or stochastic approaches. While there is a risk-aware SLQ variant \cite{ileg2015}, here we apply a work-around by simply encouraging a larger CoG shift in our cost function. For visual purposes only, we add additional intermediate waypoints for the front left leg only, leading to a slower, more appealing push motion. While we could easily add the push contact to our optimization, we leave it unmodelled on purpose such that it becomes a disturbance to our controller, underlining its robustness. The pallet is a 1200 by 800 mm Euro pallet that weighs approximately 24 kg and thus requires a force of about 70 N at the point of contact of the leg to be pushed over. \begin{figure}[htbp] \centering \includegraphics[width=\columnwidth]{plots/hardware/base_tracking.pdf} \caption{Base pose and twist trajectories (solid) and their respective references (dashed) for the hardware test where HyQ is executing a rough manipulating task. The plots show that the planned and executed base trajectories are very similar. While the task space controller is tracking the base trajectory, it also gets indirectly tracked through the joint space controller.} \label{fig:hw_base_tracking} \end{figure} \begin{figure}[htbp] \centering \includegraphics[width=\columnwidth]{plots/hardware/joint_tracking.pdf} \caption{Planned (dashed) and executed (solid) joint trajectories during the hardware test where HyQ is executing a rough manipulation task. The joint tracking controller follows the reference very well and thus also contributes to tracking the base trajectory.} \label{fig:hw_joint_tracking} \end{figure} \begin{figure}[htbp] \centering \includegraphics[width=\columnwidth]{plots/hardware/torques.pdf} \caption{Joint torques during the hardware test where HyQ is executing a rough manipulation task. These joint torques are the sum of the feedforward torques of the TO algorithm and the task space controller output. These torques are given to the joint space controller which adds additional tracking torques.} \label{fig:hw_torques} \end{figure} To demonstrate that the algorithm is being run online we approach the pallet with a separate walking controller. Thus, the robot is faced with different initial conditions every time. Figure \ref{fig:strips} shows a sequence of images of the optimized motion while Figure \ref{fig:hw_sequence} shows a sequence of images taken during execution. The video\textsuperscript{\ref{video}} shows the entire motion as well as examples from our physics simulator, where initial conditions differ even more significantly. As can be seen in all examples, the motion is dynamic and lift-off and touch-down events of the front left leg partially overlap in time with the CoG shift. This underlines that static stability is not required in this task but the algorithm finds a dynamically stable trajectory. The base pose/twist tracking for this task during hardware experiments is shown in Figure \ref{fig:hw_base_tracking} and the joint position/velocity tracking in Figure \ref{fig:hw_joint_tracking}. We can see that the joint tracking is better than base tracking due to a more aggressive joint controller. However, the base pose and twist do not significantly deviate from their planned trajectories either. Figure \ref{fig:hw_torques} shows the combination of feedforward torques and task space control input. In the front left leg, we can nicely see the lift off and touch down events in between which joint torques are almost zero. This happens since this leg does not further contribute to sustaining the weight of the body. Subsequently, the other legs have to bear a higher load. Especially in the neighboring legs, i.e. the right front and left hind leg, we see an increase in torques. Yet, this increase is not very significant since the robot has already shifted its CoG towards the support polygon of the stance legs. \subsection{Runtime and Convergence} When running Trajectory Optimization online, runtime and convergence become a major concern since these measures define how long the robot ``thinks'' before executing a task. Especially in a dynamic environment or in presence of drifting estimates, we want to keep the optimization procedures short to be able to react to a given situation quickly. Even better than pre-optimizing a trajectory before execution, we reoptimize and adjust them during execution, forming a model-predictive control scheme. In this section, we will look at both the number of iterations for each task as well as the runtime of each iteration. This gives us an indicator of the complexity of a task and tells us how far we are from running our approach in an MPC fashion. \begin{figure}[!htbp] \centering \includegraphics[width=\columnwidth]{plots/convergence.pdf} \caption{Convergence rates for different tasks. The convergence rate seems to be influenced by the length and complexity of the task. The fastest convergence can be observed in the manipulation tasks since the complexity and duration is lower than in other tasks. The trotting behavior converges the slowest.} \label{fig:convergence} \end{figure} As a first test, we take a look at convergence rates across tasks. To obtain comparable results between different tasks, we initialize all tasks with a standing controller in form of a pure joint position controller and normalize the costs with the initial cost. The results of this test are shown in Figure \ref{fig:convergence}. The curves suggest that there is a relation between the time horizon and complexity of a task and the corresponding convergence rate. The trotting behavior is one of the most complex behaviors and also has the longest time horizon. The rearing task is relatively simple and well guided by the waypoint costs which is a possible explanation of the fast convergence rate. Most tasks converge within 10 and 40 iterations, which given the runtime per iteration, shown in Figure \ref{fig:runtime}, usually means an overall optimization time of less than 1 minute. \begin{figure}[!htbp] \centering \includegraphics[width=\columnwidth]{plots/runtime.pdf} \caption{Runtime per iteration for different tasks. From a theoretical point of view, the relation between number of time steps and the runtime per iteration should be linear. This plot nicely supports this hypothesis. As a result, SLQ scales well also for problems with large time horizons.} \label{fig:runtime} \end{figure} When it comes to runtime, SLQ has a major advantage over many other Trajectory Optimization approaches: It scales linear with discretization steps and thus with time horizon. Each SLQ step is fixed runtime which means the fewer steps we use, the faster the optimizer runs. Therefore, one would ideally increase step size but also shorten the trajectory length. Yet, there is a limit to both. Figure \ref{fig:runtime} underlines the linear relation between the number of trajectory points (or steps) and the runtime per iteration. The timings are measured on a standard quadcore laptop and averaged over multiple iterations. To achieve these runtimes we use a custom multi-threaded solver. Additionally, we use highly optimized, auto-generated code for the computation of forward dynamics, used for rollouts/line-search and linearization. This code is generated using RobCoGen \cite{robcogen}, a code-generator framework for rigid body kinematics and dynamics. \section{Discussion, Conclusion and Outlook} In this paper, we have presented a fully dynamic, whole-body Trajectory Optimization framework that is able to create motions which involve multiple contact changes. The approach does not require any priors or initial guesses on contact points, sequences or timings. We demonstrate the capabilities on various tasks including squat jumps, rearing, balancing and rough manipulation. Furthermore, our approach is able to discover gaits such as galloping, trotting and two legged walking. First hardware results show that the optimized trajectories can be transferred to hardware. While some motions might not be directly applicable to hardware, they can serve as an initialization for other algorithms and they could potentially provide insight into optimal gait parameters such as stepping frequencies or stride lengths. As with most optimal control approaches, a certain amount of cost function tuning is required. However, we use only one cost function per task and tried to stay away from complex terms that tune for numerical properties. Instead, we tuned for functionality and behavior and provide insight into the weightings used. While tuning cost functions is a manual procedure, most of the obtained motion would require a complex combination of different planners and controllers if implemented with state-of-the-art approaches, e.g. \cite{victor_trot,coros2011locomotion}. In contrast to these methods, whole body Trajectory Optimization is versatile and the structure of the approach is not task dependent. Also, the optimized trajectories leverage the full dynamics of the system and do not rely on heuristics or simplified models. Using our formulation and solvers, the optimized trajectory is usually available in less than one minute, even for complex tasks and despite not pre-specifying contacts. This compares favorable to reported results in literature where solving time can be several minutes or even hours. However, there are also some short comings of the approach. The solution space of the approach is huge, e.g. we can apply our approach to a broad variety of tasks despite limiting ourselves to a single cost function structure. While this generality is a strength of the approach, it also requires the user to ``choose'' a solution by modifying cost function weights or adding additional term. While this is a more or less intuitive approach, one would wish to further reduce the number of open parameters by applying some form of meta algorithm. Another drawback is that the optimized motions might not be very robust to model inaccuracies, disturbances or noise. Thus, alterations of the cost functions might be required to successfully execute these motions on hardware. This is a known issue of deterministic Trajectory Optimization approaches and can be tackled only by considering the stochasticity of the problem. Lastly, SLQ cannot handle state constraints, which can be a limiting factor for complex Trajectory Optimization problems. We believe that SLQ can be especially useful when applied as a shorter horizon MPC controller where its fast run-times are leveraged and complex state constraints are taken care of by a higher level planner/optimizer. While the run-time of SLQ seems far off from an MPC scenario, warm starting is an efficient measure to make the algorithm converge in only a few iterations. Also, run-time can be further reduced by limiting the time horizon. Thus, as a next step, we are planning to apply our approach in MPC fashion to HyQ, extending our work in \cite{mpc_quad}. Hopefully, SLQ-MPC will be able to act as a general stabilization and tracking controller as well as short horizon re-planner, allowing us to execute most tasks demonstrated in this work on hardware. One important step in this direction will be to include input constraints. \section*{Acknowledgment} This research has been funded through a Swiss National Science Foundation Professorship award to Jonas Buchli and the NCCR Robotics. \bibliographystyle{IEEEtran}
{'timestamp': '2016-07-18T02:07:44', 'yymm': '1607', 'arxiv_id': '1607.04537', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04537'}
arxiv
\section{Introduction} \label{sec:Intro} Wireless communication, by its inherent broadcast nature, is vulnerable to eavesdropping by illegitimate receivers within communication range of the source. Wyner in \cite{075wyner}, for the first time, information-theoretically addressed the problem of secure communication in the presence of an eavesdropper and showed that secure communication is possible if the eavesdropper channel is a degraded version of the destination channel. The rate at which information can be transferred from the source to the intended destination while ensuring complete equivocation at the eavesdropper is termed as \textit{secrecy rate} and its maximum over all input probability distributions is defined as the \textit{secrecy capacity} of channel. Later, \cite{078cheongHellman} extended Wyner's result to Gaussian channels. These results are further extended to various models such as multi-antenna systems \cite{105paradaBlahut, 110khistiWornell}, multiuser scenarios \cite{108liuMaric, 108khisti_thesis}, fading channels \cite{108liangPoorShamai, 108gopalaLaiGamal}. An interesting direction of work on secure communication in the presence of eavesdropper(s) is one in which the source communicates with the destination via relay nodes \cite{108laiGamal, 109dongHanPetropuluPoor, 110zhangGursoy, 113yangLiMaChing, 115sarmaAgnihotriKuri, 116sarmaAgnihotriKuri}. Such work has considered various scenarios such as different relaying schemes (\textit{amplify-and-forward} and \textit{decode-and-forward}), constraints on total or individual relay power consumption, one or more eavesdroppers. However, except for a few specific scenarios, such work does not provide tight characterization of secrecy capacity or even optimal secrecy rate achievable with the given relaying scheme. Further, all previous work only considered secure communication scenarios where the source communicates with the legitimate destination(s) in two hops, over so called \textit{diamond network} \cite{101schein}. We consider a multihop unicast communication over \textit{layered} network of relays in the presence of a single eavesdropper. The relays nodes are arranged in layers where all relays in a particular layer can communicate only with the relays in the next layer. The relay nodes, operating under individual power constraints, amplify-and-forward the signals received at their input. In this scenario, multiple relay nodes in each layer can cooperate to enhance the end-to-end achievable rate. Also, the signals transmitted simultaneously by the relays add in the air, thus providing an opportunity for the relays in the second layer onward to perform Analog Network Coding (ANC) on the received \textit{noisy sum} of these signals, where each relay merely amplifies and forwards this noisy sum \cite{107kattiGollakottaKatabi, 110maricGoldsmithMedard}. The eavesdropper can overhear the transmissions from the relay nodes of any of the layers depending on its location. The objective is to maximize the rate of secure transmission from the source to the destination by choosing the optimal set of scaling factors for the ANC-relays, irrespective of the relays that the eavesdropper listens to. However, so far, there exists no closed-form expression or polynomial time algorithm to exactly characterize the optimal AF secrecy rate even for general two-hop (diamond) relay networks, except for a few specific cases where eavesdropper's channel is a degraded or scaled version of destination channel \cite{116sarmaAgnihotriKuri} and characterizing the optimal AF secrecy rate for general layered network is an even harder problem than general diamond network. Thus, to get some insights into the nature of the optimal solution for such networks, we consider symmetric layered networks, where all channel gains between the nodes in two adjacent layers are equal, thus the nomenclature of these networks as \textit{``Equal Channel Gains between Adjacent Layers (ECGAL)''} networks \cite{112agnihotriJaggiChen}. We provide closed-form solutions for the optimal secure AF rate for such networks. We envision that these results may help us gain insight into the nature of the optimal solution and develop techniques which may further help in construction of low-complexity optimal schemes for general relay networks. The eavesdropper being a passive entity, a realistic eavesdropper scenario is the one where nothing about the eavesdropper's channel is known, neither its existence, nor its channel state information (CSI). However, the existing work on secrecy rate characterization assumes one of the following: (1) the transmitter has prefect knowledge of the eavesdropper channel states, (2) \textit{compound channel:} the transmitter knows that the eavesdropper channel can take values from a finite set \cite{109liangKramerPoorShamai, 109kobayashiLiangShamaiDebbah, 109ekremUlukus}, and (3) \textit{fading channel:} the transmitter only knows distribution of the eavesdropper channel \cite{108liangPoorShamai, 108gopalaLaiGamal}. In this paper, we assume that the CSI of the eavesdropper channel is known perfectly for the following two reasons. First, this provides an upper bound to the achievable secure ANC rate for the scenarios where we have imperfect knowledge of the eavesdropper channel. For example, the lower (upper) bound on the compound channel problem can be computed by solving the perfect CSI problem with the worst (best) channel gain from the corresponding finite set. Further, this also provides a benchmark to evaluate the performance of achievability schemes in such imperfect knowledge scenarios. Second, this assumption allows us to focus on the nature of the optimal solution and information flow, instead of on complexities arising out of imperfect channel models. The key contribution of this work is the computation of the globally optimal set of scaling factors for the nodes that maximizes the end-to-end secrecy rate for a class of layered networks. We also show that in the high-SNR regime, ANC achieves secrecy rates within an explicitly computed constant gap of the cutset upper bound on the secrecy capacity. To the best of our knowledge, this work offers the first characterization of the performance of secure ANC in multi-layered networks in the presence of an eavesdropper. \textit{Organization:} In Section~\ref{sec:sysMdl} we introduce the system model and formulate the problem of maximum secure ANC rate achievable in the proposed system model. In section~\ref{sec:OptBeta} we compute the optimal vector of scaling factors of the nodes of an ECGAL network when eavesdropper snoops on the transmissions of the nodes in any one of the $L$ layers. Then, in Section~\ref{sec:highSNRanalysis} we analyze the high-SNR behavior of the achievable secure ANC rate and show that it lies within a constant gap from the corresponding cutset upper bound on the secrecy capacity and Section~\ref{sec:numSim} we numerically validate these results. Finally, Section~\ref{sec:cnclsn} concludes the paper. \section{System Model} \label{sec:sysMdl} Consider a $(L+2)$-layer wireless network with directed links. The source $s$ is at layer `$0$', the destination $t$ is at layer `$L+1$' and the relays from the set $R$ are arranged in $L$ layers between them. The $l^{th}$ layer contains $n_l$ relay nodes, $\sum _{l-1}^{L} n_l = |R|$. The source $s$ transmits message signals to the destination $t$ via $L$ relay layers. However, the signals transmitted by the relays in a layer are also overheard by the eavesdropper $e$. An instance of such a network is given in Figure~\ref{fig:layrdNetExa}. Each node is assumed to have a single antenna and operate in full-duplex mode, \textit{e.g.} as in \cite{112agnihotriJaggiChen, 105gastparVetterli}. \begin{figure}[!t] \centering \includegraphics[width=3.5in]{layrdNetExa} \caption{An ECGAL network with 3 relay layers between the source $s$ and the destination $t$. Each layer contains two relay nodes. The eavesdropper overhears the transmissions from the relays in layer $2$.} \label{fig:layrdNetExa} \end{figure} At instant $n$, the channel output at node $i, i \in R \cup \{t, e\}$, is \begin{equation} \label{eqn:channelOut} y_i[n] = \sum_{j \in {\mathcal N}(i)} h_{ji} x_j[n] + z_i[n], \quad - \infty < n < \infty, \end{equation} where $x_j[n]$ is the channel input of node $j$ in neighbor set ${\mathcal N}(i)$ of node $i$. In \eqref{eqn:channelOut}, $h_{ji}$ is a real number representing the channel gain along the link from the node $j$ to the node $i$ and constant over time (as in \cite{112agnihotriJaggiChen}, for example) and known (even for the eavesdropper channels) throughout the network \cite{109dongHanPetropuluPoor,110zhangGursoy}. All channel gains between the nodes in two adjacent layers are assumed to be equal, thus the nomenclature of these networks as \textit{``Equal Channel Gains between Adjacent Layers (ECGAL)''} networks \cite{112agnihotriJaggiChen}. The source symbols $x_s[n], - \infty < n < \infty$, are i.i.d. Gaussian random variables with zero mean and variance $P_s$ that satisfy an average source power constraint, $x_s[n] \sim {\cal N}(0, P_s)$. Further, $\{z_i[n]\}$ is a sequence (in $n$) of i.i.d. Gaussian random variables with $z_i[n] \sim {\cal N}(0, \sigma^2)$. We assume that $z_i$ are independent of the input signal and of each other. We also assume that each relay's transmit power is constrained as: \begin{equation} \label{eqn:pwrConstraint} E[x_i^2[n]] \le P, \quad i \in R, - \infty < n < \infty \end{equation} In ANC, each relay node amplifies and forwards the noisy signal sum received at its input. More precisely, relay node $i, i \in R$, at instant $n+1$ transmits the scaled version of $y_i[n]$, its input at time instant $n$, as follows \begin{equation} \label{eqn:AFdef} x_i[n+1] = \beta_i y_i[n], \quad 0 \le \beta_i^2 \le \beta_{i,max}^2 = P/P_{R,i}, \end{equation} where $P_{R,i}$ is the received power at node $i$ and choice of scaling factor $\beta_i$ satisfies the power constraint \eqref{eqn:pwrConstraint}. Assuming equal delay along each path, for the network in Figure \ref{fig:layrdNetExa}, the copies of the source signal ($x_s[.]$) and noise signals ($z_i[.]$), respectively, arrive at the destination and the eavesdropper along multiple paths of the same delay. Therefore, the signals received at the destination and eavesdropper are free from intersymbol interference (ISI). Thus, we can omit the time indices and use equations \eqref{eqn:channelOut} and \eqref{eqn:AFdef} to write the input-output channel between the source $s$ and the destination $t$ as \begin{equation} \label{eqn:destchnl} y_t = \left[\sum\limits_{(i_1,...,i_L) \in K_{st}}\!\!\!\!\!\!\!\!\! h_{s,i_1}\beta_{i_1}h_{i_1, i_2}...h_{i_{L-1}, i_L}\beta_{i_L} h_{i_L, t}\right] x_s + \sum\limits_{l=1}^L \sum\limits_{j-1}^{n_l}\left[\sum\limits_{(i_1,...,i_{L-l}) \in K_{lj,t}} \!\!\!\!\!\!\!\!\!\beta_{lj} h_{lj,i_1}...\beta_{i_{L-l}} h_{i_{L-l},t}\right] z_{lj} + z_t \end{equation} where $K_{st}$ is the set of $L$-tuples of node indices corresponding to all paths from the source $s$ to the destination $t$ with path delay $L$. Similarly, $K_{lj,t}$ is the set of $L - l$- tuples of node indices corresponding to all paths from the $j^{th}$ relay of the $l^{th}$ layer to the destination with path delay $L - l + 1$. We introduce modified channel gains as follows. For all the paths between the source and the destination: \begin{equation} h_{st} = \sum\limits_{(i_1,...,i_L) \in K_s} h_{s,i_1}\beta_{i_1}h_{i_1, i_2}...h_{i_{L-1}, i_L}\beta_{i_L} h_{i_L, t} \end{equation} For all the paths between the $j^{th}$ relay of the $l^{th}$ layer to the destination $t$ with path delay $L - l + 1$: \begin{equation} h_{lj,t} = \sum\limits_{(i_1,...,i_{L-l}) \in K_{lj}} \beta_{lj} h_{lj,i_1}...\beta_{i_{L-l}} h_{i_{L-l},t} \end{equation} In terms of these modified channel gains, the source-destination channel in \eqref{eqn:destchnl} can be written as: \begin{equation} \label{eqn:destchnlmod} y_t = h_{st} x_s + \sum_{l=1}^{L} \sum_{j=1}^{n_l} h_{lj,t} z_{lj} + z_t, \end{equation} Similarly, assuming that the eavesdropper is overhearing the transmissions of the relays in the layer $E, 1\le E \le L$, the input-output channel between the source and the eavesdropper can be written as \begin{equation} \label{eqn:evechnlmod} y_e = h_{se} x_s + \sum_{l=1}^{E} \sum_{j=1}^{n_l} h_{lj,e} z_{lj} + z_t, \end{equation} The secrecy rate at the destination for such a network model can be written as \cite{075wyner}, $R_s(P_s)= [I(x_s;y_t)-I(x_s;y_e)]^+$, where $I(x_s;y)$ represents the mutual information between random variable $x_s$ and $y$ and $[u]^+=\max\{u,0\}$. The secrecy capacity is attained for the Gaussian channels with the Gaussian input $x_s \sim \mathcal{N}(0,P_s)$, where $\mathbf{E}[x_s^2] = P_s$, \cite{078cheongHellman}. Therefore, for a given network-wide scaling vector $\bm{\beta} = (\beta_{li})_{1 \le l \le L, 1 \le i \le n_l}$, the optimal secure ANC rate for the channels in \eqref{eqn:destchnlmod} and \eqref{eqn:evechnlmod} can be written as the following optimization problem. \begin{subequations} \label{eq:optSecrate} \begin{align} R_s(P_s) &= \max_{\bm{\beta}} \left[R_t(P_s,\bm{\beta}) - R_e(P_s,\boldsymbol{\beta})\right]\\ &= \max_{\boldsymbol{\beta}} \left[\frac{1}{2}\log\frac{1+SNR_t(P_s,\bm{\beta})}{1+SNR_e(P_s,\bm{\beta})}\right], \end{align} \end{subequations} where $SNR_t(P_s,\bm{\beta})$, the signal-to-noise ratio at the destination $t$ is: \begin{equation} \label{eqn:snrt} SNR_t(P_s,\bm{\beta}) = \frac{P_s}{\sigma^2}\frac{h_{st}^2}{1 + \sum_{l=1}^{L} \sum_{j=1}^{n_l} h_{lj,t}^2} \end{equation} and similarly, $SNR_e(P_s,\bm{\beta})$ is \begin{equation} \label{eqn:snre} SNR_e(P_s,\bm{\beta}) = \frac{P_s}{\sigma^2}\frac{h_{se}^2}{1 + \sum_{l=1}^{E} \sum_{j=1}^{n_l} h_{lj,e}^2} \end{equation} Given the monotonicity of the $\log(\cdot)$ function, we have \begin{align} \bm{\beta}_{opt} &= \operatornamewithlimits{argmax}_{\bm{\beta}} \left[R_t(P_s,\bm{\beta}) - R_e(P_s,\boldsymbol{\beta})\right] \nonumber\\ &= \operatornamewithlimits{argmax}_{\bm{\beta}} \frac{1+SNR_t(P_s,\bm{\beta})}{1+SNR_e(P_s,\bm{\beta})} \label{eqn:eqProb} \end{align} \section{The Optimal Secure ANC Rate Analysis} \label{sec:OptBeta} In this section, we analyze the optimal secure ANC rate problem in \eqref{eq:optSecrate} or \eqref{eqn:eqProb} first for diamond networks and then for ECGAL networks. \begin{figure}[!t] \centering \includegraphics[width=3.0in]{diamondNet} \caption{A symmetric $N$ relay diamond network with an eavesdropper.} \label{fig:diamondNet} \end{figure} \subsection{Symmetric Diamond Networks} \label{subsec:diamondNetOptBeta} Consider a symmetric diamond with $N$ relay nodes arranged in a layer between the source and the destination as shown in Figure~\ref{fig:diamondNet}. Using \eqref{eqn:snrt} and \eqref{eqn:snre}, the $SNR_t$ and $SNR_e$ in this case are: \begin{align*} SNR_t = \frac{P_s h_s^2 }{\sigma^2} \frac{(\sum_{i=1}^{N} \beta_i )^2 h_t^2}{1 + \left(\sum_{i=1}^{N} \beta_i^2 \right) h_t^2 } &&\mbox{ and }&& SNR_e = \frac{P_s h_s^2 }{\sigma^2} \frac{(\sum_{i=1}^{N} \beta_i )^2 h_e^2}{1 + \left(\sum_{i=1}^{N} \beta_i^2 \right) h_e^2 } \end{align*} \begin{pavikl} \label{lemma:diamondNetReducedBeta1} For symmetric diamond network, $\bm{\beta}_{opt}$ in \eqref{eqn:eqProb} is: \begin{align*} \beta_{1,opt},\cdots,\beta_{N,opt}=\beta_{opt}= \begin{cases} \min(\beta_{max}^2, \beta_{glb}^2), \quad \mbox{if } h_{t}>h_e,\\ 0, \quad \mbox{otherwise} \end{cases} \end{align*} where \begin{align*} \beta_{glb}^2 &= \sqrt{\frac{1}{N^2 h_t^2 h_e^2 \left(1+N\frac{P_s h_s^2}{\sigma^2} \right)}} \end{align*} \end{pavikl} \begin{IEEEproof} Please refer to Appendix~\ref{appndx:lemma0}. \end{IEEEproof} Here, it is assumed that the eavesdropper chooses to snoop on all the nodes of the layer which is an optimal strategy in the symmetric layered networks for the eavesdropper as we prove later. However, in general this may not be the case. The eavesdropper can choose to snoop on fewer nodes and still get higher rate compared to the case when it snoops on all the nodes of a layer as illustrated in the following example. \begin{pavike} Consider the relay network shown in Figure~\ref{fig:counterex}. Let $h_s=0.6,\ h_t=0.3,\ h_{1e}=0.2,\ h_{2e}=0.6,\ h_{3e}=0.4$. Let $P_s=P_1=P_2=P_3=5$ and noise variance $\sigma^2=1.0$ at each node. \begin{figure}[!t] \centering \includegraphics[width=2.5in]{counterexample.pdf} \caption{3 relay diamond network with eavesdropper overhearing the transmissions of all the relay nodes.} \label{fig:counterex} \end{figure} \textit{Case 1:} Eavesdropper chooses to snoop on all the relay nodes.\\ In this case we have the following secrecy rate maximization problem: \begin{align*} R_s &= \max_{\beta_1, \beta_2, \beta_3} \left\{ \frac{1}{2} \log\left(\!1\!\!+\!\!\frac{P_s h_s^2}{\sigma^2} \frac{\left(\beta_1\!+\!\beta_2\!+\!\beta_3\right)^2 h_t^2}{1\!+\!\left(\beta_1^2\!+\!\beta_2^2\!+\!\beta_3^2\right)h_t^2}\!\right) - \frac{1}{2} \log\left(1\!\!+\!\!\frac{P_s h_s^2}{\sigma^2} \frac{\left(\beta_1 h_{1e} \!+\! \beta_2 h_{2e} \!+\! \beta_3 h_{3e}\right)^2}{1\!+\!\beta_1^2 h_{1e}^2 \!+\! \beta_2^2 h_{2e}^2 \!+\! \beta_3^2 h_{3e}^2}\right)\right\}\\ &= \max_{\beta_1, \beta_2, \beta_3} \left\{ \frac{1}{2} \log\left(1\!+\! \frac{0.162\left(\beta_1\!+\!\beta_2\!+\!\beta_3\right)^2 }{1\!+\!\left(\beta_1^2\!+\!\beta_2^2\!+\!\beta_3^2\right)0.09}\right) - \frac{1}{2} \log\left(1\!+\! \frac{1.8\left(0.2 \beta_1 \!+\! 0.6 \beta_2 \!+\! 0.4 \beta_3\right)^2}{1\!+\!0.04 \beta_1^2 \!+\! 0.36 \beta_2^2 \!+\! 0.16 \beta_3^2 }\right)\right\} \end{align*} The optimal solution of this problem is $\beta_1=\beta_{1,max} = 1.3363, \ \beta_2 = 0.0, \ \beta_3 = 0.0$. For these optimum values of $\beta$'s, the rate achievable at the eavesdropper is: \begin{align*} R_e &= \frac{1}{2} \log\left(1+ \frac{1.8\left(0.2 \beta_1 + 0.6 \beta_2 + 0.4 \beta_3\right)^2}{1+0.04 \beta_1^2 + 0.36 \beta_2^2 + 0.16 \beta_3^2 }\right) = 0.081749 \mbox{ bits/s/Hz} \end{align*} \textit{Case 2:} Eavesdropper chooses to snoop on relay nodes $2$ and $3$. \\ In this case we have the following secrecy rate maximization problem: \begin{align*} R_s &= \max_{\beta_1, \beta_2, \beta_3} \left\{ \frac{1}{2} \log\left(1+\frac{P_s h_s^2}{\sigma^2} \frac{\left(\beta_1+\beta_2+\beta_3\right)^2 h_t^2}{1+\left(\beta_1^2+\beta_2^2+\beta_3^2\right)h_t^2}\right) - \frac{1}{2} \log\left(1+\frac{P_s h_s^2}{\sigma^2} \frac{\left(\beta_2 h_{2e} + \beta_3 h_{3e}\right)^2}{1+\beta_2^2 h_{2e}^2 + \beta_3^2 h_{3e}^2}\right)\right\}\\ &= \max_{\beta_1, \beta_2, \beta_3} \left\{ \frac{1}{2} \log\left(1+ \frac{0.162\left(\beta_1+\beta_2+\beta_3\right)^2 }{1+\left(\beta_1^2+\beta_2^2+\beta_3^2\right)0.09}\right)- \frac{1}{2} \log\left(1+ \frac{1.8\left( 0.6 \beta_2 + 0.4 \beta_3\right)^2}{1+ 0.36 \beta_2^2 + 0.16 \beta_3^2 }\right)\right\} \end{align*} The optimal solution of this problem is $\beta_1=\beta_{1,max} = 1.3363, \ \beta_2 = 0.0, \ \beta_3 = 0.7298$. For these optimum values of $\beta$'s, the rate achievable at the eavesdropper is: \begin{align*} R_e &= \frac{1}{2} \log\left(1+ \frac{1.8\left( 0.6 \beta_2 + 0.4 \beta_3\right)^2}{1+ 0.36 \beta_2^2 + 0.16 \beta_3^2 }\right) = 0.095368 \mbox{ bits/s/Hz} \end{align*} From above it is clear that in the asymmetric diamond networks, the eavesdropper achieves a higher rate when it chooses to snoop on two nodes ($2$ and $3$) compared to the case where eavesdropper snoops on all the three nodes.\hfill\IEEEQEDclosed \end{pavike} Although, for general layered networks it is very difficult to find which subset of relay nodes the eavesdropper chooses to snoop on so as to maximize its rate; for symmetric networks it can be easily verified that the rate at the eavesdropper is maximized when it snoops on all the nodes of a layer. For instance, consider the scenario where all the nodes transmitting at maximum power is optimum with respect to secrecy rate maximization. The SNR at the eavesdropper when it chooses to snoop on $k$ nodes is given as \begin{align} SNR_e^k & = \frac{P_s h_s^2}{\sigma^2} \frac{k^2 \beta_{max}^2 h_e^2}{1+ k \beta_{max}^2 h_e^2} \end{align} Similarly, SNR at the eavesdropper when it chooses to snoop on $k+1$ nodes is \begin{align} SNR_e^{k+1} & = \frac{P_s h_s^2}{\sigma^2} \frac{(k+1)^2 \beta_{max}^2 h_e^2}{1+ (k+1) \beta_{max}^2 h_e^2} \end{align} Clearly, \begin{align*} SNR_e^{k+1}-SNR_e^k & = \frac{P_s h_s^2}{\sigma^2} \frac{{\beta}^{2} h_e^2 \left( {\beta}^{2} h_e^2 {k}^{2}+{\beta}^{2} h_e^2 k+2 k+1\right)}{\left( {\beta}^{2} h_e^2 k+1\right) \left( {\beta}^{2} h_e^2 k+{\beta}^{2} h_e^2+1\right) } \geq 0, \end{align*} i.e., $SNR_e^{k+1} \geq SNR_e^k$. Thus, for such scenarios eavesdropper achieves a higher rate when it chooses to snoop on more number of nodes and eventually it will snoop on maximum possible number of nodes to maximize its rate. \begin{figure}[!t] \centering \includegraphics[width=4.5in]{3relay_diamond_net_Re_plot.pdf} \caption{Achievable rate at the eavesdropper when it snoops on different number of nodes of a symmetric diamond network of three relay nodes with $P=10.0,\ \sigma^2=1.0, \ h_s=0.278, \ h_t=0.379, \ h_e=0.073$.} \label{fig:3relayDiamondNetRePlot} \end{figure} Figure~\ref{fig:3relayDiamondNetRePlot} shows the rates achievable at the eavesdropper $(R_{e,i})$ when it chooses to snoop on $i,\ i \in \{1,2,3\}$ number of nodes of a 3 relay symmetric diamond network of the specified parameters with all the nodes transmitting at their corresponding optimum values so as to maximize the secrecy rate in each case. Here, again it can be seen that rate at the eavesdropper is increases when it snoops on all the nodes. \subsection{ECGAL Layered Networks} \label{subsec:lyrNetOptBeta} In this subsection, we consider the optimal secure ANC rate problem in \eqref{eq:optSecrate} for ECGAL networks where the source communicates with the destination via $L$ intermediate relay layers with all channel gains between two adjacent layers being equal. For the sake of ease of representation, let there be $N$ relays in each layer. The eavesdropper overhears the transmission from the nodes in relay layer $M, 1 \le M \le L$. An instance of such a network is given in Figure~\ref{fig:layrdNetExa}. Using \eqref{eqn:snrt} and \eqref{eqn:snre}, the $SNR_t$ and $SNR_e$ in this case are: \begin{align*} SNR_t &= \frac{P_s}{\sigma^2} \frac{h_s^2 H_{1,M-1}^2 \left(\sum_{n=1}^N \beta_{M,n}\right)^2 h_M^2 H_{M+1,L}^2}{\left[\left(\sum_{i=1}^{M-1} G_{i,M-1}^2\right)\left(\sum_{n=1}^N \beta_{M,n}\right)^2 h_M^2 +\left(\sum_{n=1}^N \beta_{M,n}^2\right)h_M^2\right] H_{M+1,L}^2 +\sum_{i=M+1}^L G_{i,L}^2+1}\\ SNR_e &= \frac{P_s}{\sigma^2} \frac{h_s^2 H_{1,M-1}^2 \left(\sum_{n=1}^N \beta_{M,n}\right)^2 h_e^2}{\left(\sum_{i=1}^{M-1} G_{i,M-1}^2\right)\left(\sum_{n=1}^N \beta_{M,n}\right)^2 h_e^2+\left(\sum_{n=1}^N \beta_{M,n}^2\right)\,h_e^2+1} \end{align*} where \begin{align*} H_{i,j}^2 &= \prod_{k=i}^j \left(\sum_{n=1}^N \beta_{k,n}\right)^2 h_k^2\\ G_{i,j}^2 &= \left(\sum_{n=1}^N \beta_{i,n}^2\right) h_i^2 \prod_{k=i+1}^{j} \left(\sum_{n=1}^N \beta_{k,n}\right)^2 h_k^2 \end{align*} \begin{pavikl} \label{lemma:lyrdNetReducedBeta1} For the ECGAL layered networks, $\bm{\beta}_{opt}$ in \eqref{eqn:eqProb} is: \begin{equation*} \bm{\beta}_{opt} = (\bm{\beta}_{1,opt}, \ldots, \bm{\beta}_{M,opt}, \bm{\beta}_{M+1,max}, \ldots, \bm{\beta}_{L,max}) \end{equation*} \end{pavikl} \begin{IEEEproof} Please refer to Appendix~\ref{appndx:lemma4}. \end{IEEEproof} Introduce the following parameters \begin{align*} E &= h_s^2 H_{1,M-1}^2 \\ F &= \sum_{i=1}^{M-1} G_{i,M-1}^2 \\ \alpha &= \prod_{i=M+1}^{L}\left(\sum_{n=1}^N\sqrt{P_{i,n}}\right)^2 h_i^2 \\ \lambda &= \sum_{i=M+1}^L \lambda_{i} \left(\sum_{n=1}^N P_{i+1,n}\right) \prod_{j=i+2}^{L}\left(\sum_{n=1}^N\sqrt{P_{i,n}}\right)^2 h_j^2 \\ \mu &= \prod_{i=M+1}^{L}\left(\sum_{n=1}^N\sqrt{P_{i,n}}\right)^2 h_i^2 + \sum_{i=M+1}^L \mu_{i} \left(\sum_{n=1}^N P_{i+1,n}\right) \prod_{j=i+2}^{L}\left(\sum_{n=1}^N\sqrt{P_{i,n}}\right)^2 h_j^2\\ &= \alpha + \sum_{i=M+1}^L \mu_{i} \left(\sum_{n=1}^N P_{i+1,n}\right) \prod_{j=i+2}^{L}\left(\sum_{n=1}^N\sqrt{P_{i,n}}\right)^2 h_j^2 \\ \nu &= \sum_{i=M}^L \nu_{i} \left(\sum_{n=1}^N P_{i+1,n}\right) \prod_{j=i+2}^{L}\left(\sum_{n=1}^N\sqrt{P_{i,n}}\right)^2 h_j^2, \quad \nu_M = 1, \end{align*} where \begin{align*} \lambda_{M+1} &= P_s (s_{M+1} + \sigma^2 n_{M+1}), \quad s_{M+1} = 1, n_{M+1} = 0 &\\ \lambda_{i} &= P_s\left[s_{i-1} \left(\left(\sum_{n=1}^N\!\!\sqrt{P_{i-1,n}}\right)^2\!\! h_{i-1}^2\!\!+\!\sigma^2\right)\!\! +\! \sigma^2 n_{i-1} \left(\left(\sum_{n=1}^N P_{i-1,n}\right) h_{i-1}^2 \!\!+\!\sigma^2 \right)\right], & i \in \{M+2, \ldots, L\}\\ \mu_{M+1} &= \sigma^2 (s_{M+1} + \sigma^2 n_{M+1}), \quad s_{M+1} = 1, n_{M+1} = 0 &\\ \mu_{i} &= \sigma^2 \left[s_{i-1} \left(\left(\sum_{n=1}^N\!\!\sqrt{P_{i-1,n}}\right)^2\!\! h_{i-1}^2\!\!+\!\sigma^2\right)\!\! +\! \sigma^2 n_{i-1} \left(\left(\sum_{n=1}^N P_{i-1,n}\right) h_{i-1}^2 \!\!+\!\sigma^2 \right)\right], & i \in \{M+2, \ldots, L\}\\ \nu_{M+1} &= (s_{M+1} + \sigma^2 n_{M+1}), \quad s_{M+1} = 0, n_{M+1} = 1&\\ \nu_{i} &= \sigma^2 \left[s_{i-1} \left(\left(\sum_{n=1}^N\!\!\sqrt{P_{i-1,n}}\right)^2\!\! h_{i-1}^2\!\!+\!\sigma^2\right)\!\! +\! \sigma^2 n_{i-1} \left(\left(\sum_{n=1}^N P_{i-1,n}\right) h_{i-1}^2 \!\!+\!\sigma^2 \right)\right], & i \in \{M+2, \ldots, L\} \end{align*} Using the preceding lemma and the above parameters, the problem \begin{equation*} \bm{\beta}_{opt} = \operatornamewithlimits{argmax}_{\bm{\beta}} \frac{1+SNR_t}{1+SNR_e} \end{equation*} is reduced to the following subproblem \begin{equation} \label{eqn:secRate4lemma2} (\bm{\beta}_{1,opt}, \ldots, \bm{\beta}_{M,opt}) = \operatornamewithlimits{argmax}_{(\bm{\beta}_{1}, \ldots, \bm{\beta}_{M})} \frac{1+SNR_t|_{\bm{\beta}_{M+1:L,max}}}{1+SNR_e}, \end{equation} where for a given network-wide vector of scaling factors $(\bm{\beta}_1, \ldots, \bm{\beta}_M, \bm{\beta}_{M+1,max}, \ldots, \bm{\beta}_{L,max})$, the received SNRs at the destination and the eavesdropper are, respectively \begin{align*} SNR_t|_{\bm{\beta}_{M+1:L,max}} &= \frac{P_s}{\sigma^2} \frac{A \left(\sum_{n=1}^N \beta_{M,n}\right)^2 h_M^2}{B \left(\sum_{n=1}^N \beta_{M,n}\right)^2 h_M^2 + C\left(\sum_{n=1}^N \beta_{M,n}^2\right) h_M^2 + D}\\ SNR_e &= \frac{P_s}{\sigma^2} \frac{E \left(\sum_{n=1}^N \beta_{M,n}\right)^2 h_e^2}{F \left(\sum_{n=1}^N \beta_{M,n}\right)^2 h_M^2 + \left(\sum_{n=1}^N \beta_{M,n}^2\right) h_M^2 + 1} \end{align*} with \begin{align*} A &= \alpha E\\ B &= \lambda E + \mu F\\ C &= \mu\\ D &= \nu \end{align*} \begin{pavikl} \label{lemma:lyrdNetReducedBeta2} For ECGAL layered networks, the subvector $(\beta_{M,1,opt}, \ldots, \beta_{M,N,opt})$ of the optimum scaling vectors for the nodes in the $M^{th}$ layers for given sub-vector $(\bm{\beta}_1, \ldots, \bm{\beta}_{M-1})$ is: \begin{equation*} \beta_{M,1,opt}^2 = \ldots = \beta_{M,N,opt}^2 = \beta_{M,opt}^2 = \begin{cases} \min(\beta_{M,max}^2, \beta_{M,glb}^2), \quad \mbox{if } (h_M^{2}\,\alpha-h_e^{2}\,\nu) > 0,\\ 0, \quad \mbox{otherwise} \end{cases} \end{equation*} where \begin{equation*} \beta_{M,glb}^2 = \frac{|{\mathcal B}|}{2\,|{\mathcal A}|}\left(\sqrt{1 + \frac{4\,|{\mathcal A}|\,{\mathcal C}}{{\mathcal B}^2}} - 1\right) \end{equation*} with \begin{align*} {\mathcal A} & = 4\,h_M^{2}\,h_e^{2}\bigg\{h_e^{2}\,\alpha\,\nu\,(2\,F+1)\,\left(2\,F+1+2\,\frac{P_s}{\sigma^2}\,E\right)\\ &\quad -h_M^{2}\,[2\,\lambda E +(2\,F+1)\mu]\,\left[(2\,F+1)\mu+2\,\left(\lambda +\alpha\,\frac{P_s}{\sigma^2}\right) E\,\right]\bigg\}\\ {\mathcal B} & = 4\,h_M^{2}\,h_e^{2}\,\nu\,[(\alpha-\mu)\,(2\,F+1)-2\,\lambda E]\\ {\mathcal C} & = \nu\,(h_M^{2}\,\alpha-h_e^{2}\,\nu) \end{align*} \end{pavikl} \begin{IEEEproof} Please refer to Appendix~\ref{appndx:lemma5}. \end{IEEEproof} \begin{pavikl} \label{lemma:lyrdNetReducedBeta3} For ECGAL layered networks, \begin{equation*} (\bm{\beta_{1,opt}}, \ldots, \bm{\beta_{M-1,opt}}) = (\bm{\beta_{1,max}}, \ldots, \bm{\beta_{M-1,max}}), \end{equation*} where \begin{align*} \beta_{1,n,max}^2 &= \frac{P_{1,n}}{P_{s} h_s^2 + \sigma^2}, n \in \{1, \ldots, N\}\\ \beta_{i,n,max}^2 &= \frac{P_{i,n}}{P_{R_x,i}}, \quad i \in \{2, \ldots, M-1\}, n \in \{1, \ldots, N\} \end{align*} with \begin{align*} P_{Rx,i} &= P_s h_s^2 H_{1,i-1}^2 +\left[\sum_{j=1}^{i-1} G_{j,i-1}^2+1\right] \sigma^2 \end{align*} \end{pavikl} \begin{IEEEproof} Please refer to Appendix~\ref{appndx:lemma6}. \end{IEEEproof} In short, Lemma~\ref{lemma:lyrdNetReducedBeta1}-\ref{lemma:lyrdNetReducedBeta3} together establish that for the \textit{ECGAL} layered networks with $L$ relays, the optimal vector of the scaling factors that maximizes the secure ANC rate is $\bm{\beta}_{opt} = (\bm{\beta}_{1,max}, \ldots, \bm{\beta}_{M,opt}, \bm{\beta}_{M+1,max}, \ldots, \bm{\beta}_{L,max})$, where $\beta_{M,opt}$ is given by Lemma~\ref{lemma:lyrdNetReducedBeta2}. \section{High-SNR Analysis of Achievable ANC Secrecy Rate in ECGAL Networks} \label{sec:highSNRanalysis} We define a wireless layered network to be in high SNR regime if \begin{equation*} \min_{i \in \{1, \ldots, L\}} SNR_i \ge \frac{1}{\delta} \end{equation*} for some small $\delta \ge 0$. Here, $SNR_i$ is the signal-to-noise ratio at the input of any of the relay nodes in the $i^{th}$ layer. Assume that each relay node in layer $i$ uses the amplification factor \begin{equation*} \beta_i^2 = \frac{P}{(1+\delta) P_{R_i,max}}, i \in \{1, \ldots, L\}, \end{equation*} where $P_{R_i,max}$ is the maximum received signal power at any relay node in the $i^{th}$ layer which in this case is equal to $N^2 P h_{i-1}^2$ as each relay node receives the transmissions from $N$ relay nodes in the previous layer with maximum transmit power constrained by $P$. It should be noted that $\beta_i$ is such that the maximum power constraint \eqref{eqn:pwrConstraint} is satisfied at each node as \begin{align*} \beta_{i,max}^2 = \frac{P}{P_{R_i}+P_{z_i}+\sigma^2} = \frac{P}{\left(1+\frac{1}{SNR_i}\right)P_{R_i}} \geq \frac{P}{(1+\delta)P_{R_i,max}} \quad [\mbox{Since }1/SNR_i \leq \delta, P_{R_i} \leq P_{R_i,max}] \end{align*} Here, $P_{R_i}$ and $P_{z_i}$ are the received signal and noise powers at the input of the node $i$, respectively. Note that as $\delta \rightarrow 0, \ \beta_i^2 \rightarrow \beta_{i,max}^2$. We now analyze the secrecy rate achievable with these scaling factors. However, before discussing the achievable secrecy rate, we discuss an upper bound on the secrecy capacity of such a network. For the source-destination(eavesdropper) path, an upper bound on the capacity is given by the capacity of the Gaussian multiple-access channel between the relays in the $L^{th}$ layer and the destination (the eavesdropper). This results in the following upper bound on the secrecy capacity of such networks: \begin{equation*} C_{cut} = \frac{1}{2}\log\left[\frac{1 + P_t/\sigma^2}{1 + P_e/\sigma^2}\right], \end{equation*} where $P_t = N^2 P_L h_t^2$ and $P_e = N^2 P_L h_e^2$. The power of the source signal reaching the destination $t$ is: \begin{align} P_{s,t} &= P_s h_s^2 \left(\prod_{i=1}^{L-1} N^2\beta_i^2 h_i^2\right) N^2 \beta_L^2 h_t^2 = \frac{N^2 P_L h_t^2}{(1+\delta)^L} \label{eqn:source_power_at_dstntn} \end{align} The total power of noise reaching the destination $t$ from all relay nodes: \begin{equation} P_{z,t} = \sum_{i=1}^L P_{z,t}^i = \sigma^2\left(\sum\limits_{i=1}^{L-1}N \beta_i^2 h_i^2 \left(\prod\limits_{j=i+1}^{L-1}(N \beta_j h_j)^2\right)N^2 \beta_L^2 h_t^2 + N \beta_L^2 h_t^2\right) \label{eqn:noise_power_at_dstntn} \end{equation} where $P_{z,t}^i$ is the noise power reaching the destination form nodes in $i^{th}$ layer. Now, \begin{align*} &&P_{z,t}^1 &= \sigma^2 N \beta_1^2 h_1^2 \left(\prod\limits_{j=2}^{L-1}N^2\beta_j^2 h_j^2\right) N^2 \beta_L^2 h_t^2 = \frac{\sigma^2}{P_s h_s^2} \frac{N P h_t^2}{(1+\delta)^L} \leq \frac{\delta}{(1+\delta)^L}N P h_t^2 &&\\ &&P_{z,t}^2 &= \sigma^2 N \beta_2^2 h_1^2 \left(\prod\limits_{j=3}^{L-1}N^2\beta_j^2 h_j^2\right) N^2 \beta_L^2 h_t^2 = \frac{\sigma^2}{N^2 P h_1^2} \frac{N P h_t^2}{(1+\delta)^{L-1}} \leq \frac{\delta}{(1+\delta)^{L-1}}N P h_t^2 &&\\ && \vdots & &&\\ &&P_{z,t}^i &= \sigma^2 N \beta_i^2 h_i^2 \left(\prod\limits_{j=i+1}^{L-1}N^2\beta_j^2 h_j^2\right) N^2 \beta_L^2 h_t^2 = \frac{\sigma^2}{N^2 P h_{i-1}^2} \frac{N P h_t^2}{(1+\delta)^{L-i+1}} \leq \frac{\delta}{(1+\delta)^{L-1}}N P h_t^2 &&\\ && \vdots & &&\\ &&P_{z,t}^L &= \sigma^2 N \beta_L^2 h_t^2 = \frac{\sigma^2}{N^2 P h_{L-1}^2} \frac{N P h_t^2}{(1+\delta)} \leq \frac{\delta}{(1+\delta)}N P h_t^2 && \end{align*} Therefore, \begin{align*} P_{z,t} &= \sum_{i=1}^L P_{z,t}^i \leq \sum_{i=1}^L \frac{\delta}{(1+\delta)^{L-i+1} NP h_t^2} \end{align*} or \begin{align} P_{z,t} & \leq NP h_t^2\left[1 - \frac{1}{(1+\delta)^L}\right] \label{eqn:uppr_bnd_noise} \end{align} The results in \eqref{eqn:source_power_at_dstntn} and \eqref{eqn:noise_power_at_dstntn} imply that we have the following for the achievable rate at the destination \begin{align*} R_t &= \frac{1}{2} \log\left[1 + \frac{1}{(1+\delta)^L} \frac{N^2 P_L h_t^2}{P_{z,t} + \sigma^2} \right] \end{align*} Similarly, the source and noise power reaching the eavesdropper $e$ respectively are: \begin{align*} P_{s,e} &= P_s h_s^2 \left(\prod_{i=1}^{L-1} N^2\beta_i^2 h_i^2\right) N^2 \beta_L^2 h_e^2= \frac{N^2 P_L h_e^2}{(1+\delta)^L}\\ P_{z,e} &= \sum_{i=1}^L P_{z,t}^i = \sum\limits_{i=1}^{L-1}N \beta_i^2 h_i^2 \left(\prod\limits_{j=i+1}^{L-1}(N \beta_j h_j)^2\right)N^2 \beta_L^2 h_e^2 + N \beta_L^2 h_e^2 = P_{z,t}\ h_e^2/h_t^2 \end{align*} and the achievable rate at the eavesdropper is: \begin{align*} R_e &= \frac{1}{2} \log\left[1 + \frac{1}{(1+\delta)^L} \frac{N^2 P_L h_e^2}{P_{z,t} h_e^2/h_t^2 + \sigma^2} \right] \end{align*} Therefore, the achievable secrecy rate is \begin{equation} \label{eqn:hghSNRsecRate} R_s = R_t - R_e = \frac{1}{2}\log\left[\frac{1 + \frac{1}{(1+\delta)^L} \frac{N^2 P_L h_t^2}{P_{z,t} + \sigma^2}}{1 + \frac{1}{(1+\delta)^L} \frac{N^2 P_L h_e^2}{P_{z,t} h_e^2/h_t^2 + \sigma^2}}\right] \end{equation} Thus, we have the following for the gap between the cutset upper-bound and the achievable secrecy rate \begin{align} C_{cut} - R_s &= \frac{1}{2}\log\left[\frac{1 + P_t/\sigma^2}{1 + P_e/\sigma^2}\right] - \frac{1}{2}\log\left[\frac{1 + \frac{1}{(1+\delta)^L} \frac{N^2 P_L h_t^2}{P_{z,t} + \sigma^2}}{1 + \frac{1}{(1+\delta)^L} \frac{N^2 P_L h_e^2}{P_{z,t} h_e^2/h_t^2 + \sigma^2}}\right] \label{eqn:actual_gap} \end{align} Here, R.H.S. is an increasing function of $P_{z,t}$. Thus, from \eqref{eqn:uppr_bnd_noise} and \eqref{eqn:actual_gap}, we have \begin{align} C_{cut} - R_s &\leq \frac{1}{2}\log\left[\frac{\left(1+\left(1-\frac{1}{(1+\delta)^L}\right) \frac{NP h_t^2}{\sigma^2}\right) \left(1+\frac{N^2 P h_t^2}{\sigma^2}\right) \left(1+\left(1-\frac{1}{(1+\delta)^L}\right)\frac{N P h_e^2}{\sigma^2} + \frac{N^2 P h_e^2}{(1+\delta)^L \sigma^2}\right)}{\left(1+\left(1-\frac{1}{(1+\delta)^L}\right) \frac{NP h_e^2}{\sigma^2}\right) \left(1+\frac{N^2 P h_e^2}{\sigma^2}\right) \left(1+\left(1-\frac{1}{(1+\delta)^L}\right)\frac{N P h_t^2}{\sigma^2} + \frac{N^2 P h_t^2}{(1+\delta)^L \sigma^2}\right)}\right] \nonumber\\ & \leq \frac{1}{2}\log\left[\!\frac{\left(1+L \delta\frac{N P h_t^2}{\sigma^2}\right)\left(1+\frac{N^2 P h_t^2}{\sigma^2}\right)\left(1+ L \delta\frac{N P h_e^2}{\sigma^2} + (1-L\delta) \frac{N^2 P h_e^2}{\sigma^2}\right)}{\left(1+L \delta\frac{N P h_e^2}{\sigma^2}\right)\left(1+\frac{N^2 P h_e^2}{\sigma^2}\right)\left(1+ L \delta\frac{N P h_t^2}{\sigma^2} + (1-L\delta) \frac{N^2 P h_t^2}{\sigma^2}\right)}\right] \quad\left[\mbox{as }{1}/{(1+\delta)^L} \ge 1-L \delta\right]\nonumber\\ &= \frac{1}{2}\log\left[\left.\frac{1+{N^2 P h_t^2}/{\sigma^2}}{1+\frac{(1-L\delta) NPh_t^2/\sigma^2}{1+L\delta P h_t^2/\sigma^2}}\middle/ \right. \frac{1+{N^2 P h_e^2}/{\sigma^2}}{1+\frac{(1-L\delta) NPh_e^2/\sigma^2}{1+L\delta P h_e^2/\sigma^2}}\right]\nonumber\\ &\leq \frac{1}{2}\log\left[\left(\left. \frac{1+L\delta NP h_t^2/\sigma^2}{(1-L\delta)}\right)\middle/ \right.\left(1+L\delta \frac{NPh_e^2}{\sigma^2}\right)\right]\nonumber\\ &=\frac{1}{2}\log\left[\frac{1}{(1-L\delta)} \frac{1+L\delta NP h_t^2/\sigma^2}{1+L\delta NP h_e^2/\sigma^2}\right] \label{eqn:gap_bnd} \end{align} Since, $R_{s,opt} \geq R_s, \ C_{cut}-R_{s,opt} \leq C_{cut}-R_{s}$. Note that as $\delta \rightarrow 0, \ C_{cut}-R_s \rightarrow 0$, i.e., secrecy rate approaches the cut-set bound. \section{Numerical Simulations} \label{sec:numSim} In this section, we present numerical results to evaluate the performance of the proposed high SNR approximation scheme. We consider a 2-layer network with two nodes in each layer and eavesdropper snooping on the transmissions of the nodes in the last layer. In Figure~\ref{fig:2lyrdNetSecRateHighSNRplot}, we plot the achievable secrecy rate when all the nodes transmit at their maximum power along with the corresponding cut-set as a function of source power for the specified system parameters. \begin{figure}[!t] \begin{subfigure}[b]{0.5\textwidth} \includegraphics[width=\textwidth]{2lyrHighSNRfinalPlot1} \caption{} \label{fig:2lyrdNetSecRateHighSNRplot1} \end{subfigure} \begin{subfigure}[b]{0.5\textwidth} \includegraphics[width=\textwidth]{2lyrHighSNRfinalPlot3} \caption{} \label{fig:2lyrdNetSecRateHighSNRplot2} \end{subfigure} \caption{Plot of achievable secrecy rate with all relays transmitting at maximum power against varying source power along with the cutset bound for $2$-layer network with $2$ nodes in each layer. $P=500,\ \sigma^2=1.0, \ \delta=0.005,\ $ (a)~$ h_s=0.689, \ h_1=0.603, \ h_t=0.203, \ h_e= 0.031,$ and (b)~$ h_s=0.260, \ h_1 = 0.925,\ h_t=0.113, \ h_e=0.012.$} \label{fig:2lyrdNetSecRateHighSNRplot} \end{figure} From the figure, it can be observed that at high SNR the achievable rate lies within a constant gap from the cut-set bound. In Figure~\ref{fig:2lyrdNetSecRateHighSNRplot1}, the actual gap between the cut-set bound and achievable rate is $0.05$ bits/sec/Hz while the upper bound on this gap as given by \eqref{eqn:gap_bnd} is $0.25$ bits/sec/Hz. Similarly, in Figure~\ref{fig:2lyrdNetSecRateHighSNRplot2}, the actual gap is $0.03$ bits/sec/Hz while the upper bound on this gap is $0.09$ bits/sec/Hz. Thus, it can be seen that \eqref{eqn:gap_bnd} tightly approximates the gap between achievable secrecy rate and the cut-set bound. \section{Conclusion and Future Work} \label{sec:cnclsn} We consider the problem of secure ANC rate maximization over a class of Gaussian layered networks where a source communicates with a destination through $L$ intermediate relay layers with $N$ nodes in each layer in the presence of a single eavesdropper which can overhear the transmissions of the nodes in any one layer. The key contribution of is the computation of the globally optimal set of scaling factors for the nodes that maximizes the end-to-end secrecy rate for a class of layered networks. We also show that in the high-SNR regime, ANC achieves secrecy rates within a constant gap of the cutset upper bound on the secrecy capacity and numerically validate this. In future, we plan to extend this work for more general layered networks.
{'timestamp': '2016-07-18T02:07:36', 'yymm': '1607', 'arxiv_id': '1607.04525', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04525'}
arxiv
\subsection{Logarithmic neural scales} Receptive fields that are evenly-spaced and of equal width on a logarithmic scale (Fig.~\ref{fig:FreeSimo}a, top) lead naturally to the Weber-Fechner perceptual law. A logarithmic scale implies several properties of the receptive fields (Fig.~\ref{fig:FreeSimo}a bottom). A logarithmic scale implies that there should be fewer receptive fields centered at high values of $x$, and receptors coding for higher values of $x$ should have wider receptive fields. These qualitative impressions can be refined to several quantitatively precise relationships. If the receptive fields are evenly-spaced on a logarithmic axis then the width of receptive fields centered on a value $x$ should go up proportional to $x$. More generally, if the $i$th receptor has a receptive field centered on $x_i$, then the shape of the receptive field should be constant for all receptors, but the width of the receptive field should scale with the value of $x_i$. If we denote the center of the $i$th cells receptive field as $x_i$ and define $\Delta_i \equiv x_i - x_{i-1}$, then a logarithmic scale implies that the ratio of adjacent receptors, $\Delta_{i+i}/\Delta_i$, is a constant for all values of $i$.\footnote{Note that while logarithmic scaling implies a constant ratio of adjacent receptor spacings, the converse is not true. For instance, if the ratio of receptor spacings was one, this would not lead to logarithmic scaling. Similarly, if we took a set of receptors on a logarithmic scale and added a constant to each one, the ratio $\Delta_{i+1}/\Delta_i$ would be unchanged and remain constant with respect to $i$ whereas $x_{i+1}/x_i$ would no longer be constant with respect to $i$.} Finally we note that because $\log 0$ is not finite, a logarithmic scale with a finite number of receptors cannot continue to $x=0$. In practice, this means that if the brain makes use of logarithmic scales, there must be some other consideration for values near zero. In fact, as we will see below, the brain appears to solve this problem in the visual system by including a region of approximately constant receptor spacing for small $x$ (note the flat region around zero in Fig.~\ref{fig:FreeSimo}b). \subsection{Logarithmic neural scales in the mammalian brain} There is strong evidence that the visual system in mammals obeys logarithmic scaling in representing \emph{extrafoveal} retinal position. In monkeys, both the spacing of receptive fields (the cortical magnification factor) \cite{DaniWhit61,HubeWies74,VanEEtal84,GattEtal88} and the width of receptive fields \cite{HubeWies74,GattEtal88,Schw77} obey the quantitative relationships specified by logarithmic scaling to a good degree of approximation outside of the fovea. Figure~\ref{fig:FreeSimo}b (reproduced from \citeNP{FreeSimo11}) shows receptive field width in the macaque across several cortical regions. The fovea is visible as a region of constant receptive field width, followed by a much larger region showing a linear relationship between field width and eccentricity, consistent with logarithmic scaling. If the curves obeyed logarithmic scaling precisely, the lines would continue to the origin rather than flattening out in the fovea. However, because the spacing between receptors would go to zero, this would require an infinite number of receptors. In the case of vision, logarithmic scaling can ultimately be attributed to the distributions of receptors along the surface of the retina. However, this logarithmic mapping may be more general, extending to other sensory \cite{MerzEtal73} and motor maps \cite{Schw77}. In addition, evidence suggests that logarithmic scaling holds for variables that are not associated with any sensory organ. Neural evidence from monkeys and humans \cite{NiedMill03,HarvEtal13} suggests that neural representations of non-verbal numerosity are arranged on a logarithmic scale, consistent with a broad range of behavioral studies of non-verbal mathematical cognition \cite{GallGelm92,FeigEtal04}. Behavioral and theoretical work \cite{BalsGall09,HowaEtal15} suggests that a similar form of logarithmic scaling could also apply to representations of time, which is qualitatively consistent with growing body of neurophysiological evidence from ``time cells'' in the hippocampus, entorhinal cortex, and striatum \cite{SalzEtal16,KrauEtal15,MellEtal15}. The neurophysiological evidence that these ``cognitive'' variables use logarithmic scaling is not nearly as well-quantified as visual receptive fields. \subsection{Overview} If a set of receptors was optimized under the expectation of a particular form of statistics in the world, it would be suboptimal, perhaps disastrous, if the organism encountered a state of the world with very different statistics. The next section (``Optimal receptor distribution\ldots'') considers the problem of optimally placing receptors to represent an unknown arbitrary function from a local perspective. The result of this section is that for all receptors to convey the same amount of information as their neighbors, receptor spacings should be in a constant ratio. The following section~(``Global function representation'') considers the amount of information conveyed by a set of receptors about a function controlled by some fixed, but unknown, scale. The global organization that leads to equivalent information for a wide range of scales has a region of constant spacing (ratio~1) followed by a region with constant ratio spacing (ratio~$>1$) which resembles the organization of the visual system with a closely-packed fovea surrounded by a logarithmic scale. \section{Optimal receptor distribution for representing arbitrary unknown functions} \label{sec:local} We want to represent a function in the world over some continuous real value $x$. Receptors sample the function in some neighborhood such that each receptor is ``centered'' on a particular value of $x$. The goal is to distribute the receptors to enable them to represent an arbitrary and unknown function $f(x)$. In order for this problem to be meaningful we must assume that there is a finite number of receptors. We assume here that the lower and upper bounds of the scale $x$ are physically constrained. At the lower bound, perhaps there is some minimal degree of resolution that can be achieved with the receptors. In some cases the upper bound may be given by the properties of the world or anatomy. For instance, in vision, ecccentricity cannot possibly be larger than $\pi$. Our question, then is how to distribute the location of the receptors within the range of $x$ values to be represented. Each additional receptor provides an additional benefit to the organism to the extent that it provides additional information about the function. Intuitively, if we clumped all of the receptors close together this would be suboptimal, because the receptors would all be conveying the same information and there would be no receptors to communicate information about other regions of the function. Naively, we might expect that the solution is trivial---perhaps receptors should be evenly-spaced along the $x$-axis. It will turn out that this is not in general the optimal solution. Rather, the spacing of each pair of receptors should be in a constant ratio to the spacing of the previous pair of receptors. Constant spacing corresponds to a ratio of~1; it will turn out that other ratios are admissable as well. In order to do the calculation we need to measure the redundancy between a pair of receptors. There are a number of measures of redundancy one might use. For instance, we might measure the mutual information between the output of two receptors after observing the world for some period of time. There are other measures that one might use. All things equal, we would expect the redundancy between two receptors to be higher for receptors that are placed close together rather than receptors that are placed far apart. The development below applies to any measure of redundancy that obeys some basic properties.\footnote{After the general derivation we include a worked example with a particularly tractable measure of redundancy.} The distribution of receptors is optimal if each receptor is expected to be as redundant with its predecessor as it is with its successor. If that was not the case, then we could move one of the receptors and get more non-redundant information out about the function. \subsection{Formulation of the problem} \begin{figure} \centering \begin{tabular}{lc} \textbf{a}\\ & \includegraphics[width=0.3\columnwidth]{xzeroxprexpostwide}\\ ~\\ \textbf{b}&\\ & \includegraphics[width=0.55\columnwidth]{discretize} \end{tabular} \caption{ \textbf{a.} Discretizing the function. After picking some small resolution (``jnd'' in the figure), we discretize the signal. This defines a variable $s(x)$ describing the distance (or scale) between $x$ and the next location where the function takes on a different discretized value. \textbf{b.} Schematic for notation. The derivation assumes that there are receptors at $\ensuremath{{x_{i-1}}}$ and $\ensuremath{{x_i}}$ separated by $\ensuremath{\Delta_{i}}$. The goal is to choose $\ensuremath{\Delta_{i+1}}$ (and thus $\ensuremath{{x_{i+1}}}$) such that the redundancy between the pairs of receptors is equated. \label{fig:xzeroschematic} } \end{figure} Suppose we have set of receptors with receptive fields centered on positions $x_1$, $x_2$, \ldots $x_N$. As before, let us denote the distance between the locations of receptor $\ensuremath{{x_{i-1}}}$ and $\ensuremath{{x_i}}$ as $\ensuremath{\Delta_{i}}$. Constant receptor spacing would imply that $\ensuremath{\Delta_{i}} = \ensuremath{\Delta_{i+1}}$ for all $i$. It will turn out that this is not the general solution to our problem. Rather, the solution is to space the receptors such that the ratio of adjacent receptor spacings is a constant across the scale. That is, the ratio $\ensuremath{\Delta_{i+1}}/\ensuremath{\Delta_{i}}$ takes the same value for all $i$. We assume that in the neighborhood of each $x_i$, the function is controlled by some scale $s_\ensuremath{{x_i}}$. To quantify this in an unambiguous way, assume that our receptors can only respond over a finite range with some non-zero resolution. Accordingly, we discretize the function to be represented to some degree of resolution (Figure~\ref{fig:xzeroschematic}a) so that at each value of $x$, $s_x$ gives the distance to the next value of $x$ where the discretized function would take a different value than the discretized $f(x)$. That is, for each $x$, the discretized function $f(x) = f(x')$ for each $x < x' < x + s_x$. Note that if we knew the scale $s_\ensuremath{{x_i}}$ at $\ensuremath{{x_i}}$, it would be straightforward to estimate the redundancy between the receptor at $\ensuremath{{x_i}}$ and the receptor at $\ensuremath{{x_{i+1}}}$. If we knew that the spacing between receptors $\ensuremath{\Delta_{i+1}}$ were much smaller than $s_\ensuremath{{x_i}}$, the receptors would measure the same value and we would expect the redundancy to be high. In contrast, if we knew that the spacing between the receptors were much smaller than $s_\ensuremath{{x_i}}$ then the value of the function would have changed at least once between $\ensuremath{{x_i}}$ and $\ensuremath{{x_{i+1}}}$ and we would expect the redundancy to be low. Let us denote the function relating the redundancy we would observe between receptors spaced by a particular value $\ensuremath{\Delta_{i}}$ if we knew the scale took a particular value $s$ as $\alphaspre$. We assume $\alphaspre$ to be a monotonically decreasing function of its argument. Note that we could choose any number of different ways to measure redundancy. For instance, we could treat mutual information as our measure of redundancy and this, coupled with knowledge of the properties of the receptors, would specify a specific form for $\alphaspre$. But we could just as well measure redundancy in other ways or assume different properties of our receptors, which would result in a different form for $\alphaspre$. The arguments below about optimal receptor spacing apply to any measure of redundancy that obeys some basic properties described below and does not depend critically on how one chooses to measure redundancy. Observing the redundancy between the receptors at $\ensuremath{{x_{i-1}}}$ and $\ensuremath{{x_i}}$ spaced by $\ensuremath{\Delta_{i}}$ allows us to infer the value of the scale at the first receptor $s_\ensuremath{{x_{i-1}}}$. For instance, if the redundancy is maximal, that implies that the function did not change between $\ensuremath{{x_{i-1}}}$ and $\ensuremath{{x_i}}$. In contrast, if the redundancy between the receptors at $\ensuremath{{x_{i-1}}}$ and $\ensuremath{{x_i}}$ is very small, that implies that the scale of the function at $\ensuremath{{x_{i-1}}}$, $s_\ensuremath{{x_{i-1}}}$ was smaller than $\ensuremath{\Delta_{i}}$. Knowing the scale at $\ensuremath{{x_{i-1}}}$ places constraints on the value at $\ensuremath{{x_i}}$. For instance, if we knew with certainty that $s_\ensuremath{{x_{i-1}}} = \ensuremath{\Delta_{i}} + C$, then we would know with certainty that $s_\ensuremath{{x_i}} = C$. So, if we knew the probability of each value of $s_\ensuremath{{x_{i-1}}}$ this constrains the probability distribution for $s_\ensuremath{{x_i}}$. Let us fix the spacing $\ensuremath{\Delta_{i}}$ between the receptors at $\ensuremath{{x_{i-1}}}$ and $\ensuremath{{x_i}}$, sample the world for some time (observing many values of the the receptor outputs in response to many samples from the function) and denote the average value of redundancy we observe as $\alphaobs$. Denoting the (unknown) probability of observing each possible value of $s_\ensuremath{{x_{i-1}}}$ as $\ppre{s}$, then the observed value of redundancy, $\alphaobs$, resulted from an integral: \begin{equation} \alphaobs = \int \ppre{s}\ \alphaspre\ ds \label{eq:alphaobs} \end{equation} This can be understood as an inference problem; observation of $\alphaobs$ leads us to some belief about the distribution $\ppre{s}$. Informed by this knowledge, we then place the third receptor at a spacing $\ensuremath{\Delta_{i+1}}$. If we knew the distribution of scales at $\ensuremath{{x_i}}$, $\ppost{s}$, then we would expect to observe a redundancy of \begin{equation} \alphapred = \int \ppost{s}\ \alphaspost\ ds \label{eq:alphapred} \end{equation} between the second pair of receptors. Our problem is to choose $\ensuremath{\Delta_{i+1}}$ such that we would expect $\alphapred = \alphaobs$. \subsection{Minimal assumptions about the statistical properties of the world} The actual value of $\ensuremath{\Delta_{i+1}}$ that makes $\alphapred=\alphaobs$ of course depends on the detailed properties of the receptors, the function $\alphas$ and the statistics of the world. We show, however, that for minimal assumptions about the world, this problem results in the solution that, whatever the value of $\alphaobs$ one finds that for some spacing $\ensuremath{\Delta_{i}}$, the choice of $\ensuremath{\Delta_{i+1}}$ is such that only $\ensuremath{\Delta_{i+1}}/\ensuremath{\Delta_{i}}$ is affected by the observed value $\alphaobs$. First, we make minimal assumptions about the function to be estimated. We assume an uninformative prior for $\ppre{s}$. We make the minimal assumptions that successive values of $s$ are independent, and that the value of the function past the $s_x$ is independent of the value at $x$. That is we assume that $f(x)$ and $f(x+s_x)$ are independent of one another, as are $s_x$ and $s_{x+s_x}$. \footnote{The critical point of these assumptions is that at no point to we introduce an assumption about the statistics of the world that would fix a scale for our receptors. For instance, the result of receptor spacings in a constant ratio would also hold if we assumed a power law prior for $\ppre{s}$ rather than a uniform prior because the power law is a scale-free distribution. Similarly, it is acceptable to relax the assumption of independence between $f(x)$ and $f(x+s_x)$ as long as doing so does not introduce a scale. \label{foot:power} } Second, we require that the receptors do not introduce a scale \emph{via} $\alphas$. In general, the function $\alphas$ will depend on how we choose to quantify redundancy and the properties of the receptors. However, as long as $\alphas$ rescales, such that it can be rewritten in a canonical form \begin{equation} \alphas = \alphahat(s/\Delta), \label{eq:alphahat} \end{equation} the conclusions in this section will hold. One can readily imagine idealized settings where Eq.~\ref{eq:alphahat} will hold. For instance, we could assume we have perfect receptors that sample the function at only one point and take our measure of redundancy to be one if the receptors observe the same value up to the resolution used to specify $s$ (Fig.~\ref{fig:xzeroschematic}b) and zero otherwise. More generally, for imperfect receptors that sample a range of values, Eq.~\ref{eq:alphahat} requires that the receptive fields scale up with $\Delta$. This assumption is necessary, but not sufficient to equate redundancy between receptors. Our third requirement is referred to as the Copernican principle. Because it is critical to the argument in this section, we discuss it in some detail in the next subsection. \subsection{The Copernican Principle} In addition to minimal assumptions about the statistics of the world and the properties of the receptors, we assume that the world's choice of $s_\ensuremath{{x_{i-1}}}$ is unaffected by our choice of $\ensuremath{\Delta_{i}}$. The belief that there is nothing privileged about one's point of observation is referred to as the Copernican principle. The Copernican principle was employed by \citeA{Gott93} to estimate a probability distribution for the duration of human civilization. Because this provides a concrete illustration of an important concept, it is worth explaining Gott's logic in some detail. Suppose we observe Fenway Park in 2017 and learn it has been standing for 103 years. Knowing nothing about construction techniques or the economics of baseball we want to estimate how much longer Fenway Park will stand. Because there is nothing special about our current viewpoint in 2017, our observation of Fenway should be uniformly distributed across its lifetime. That is, the observation at \ensuremath{t_\textnormal{now}}{} in 2017 ought to be uniformly distributed between $\ensuremath{t_\textnormal{start}}$ when Fenway Park was constructed (in 1914) and the unknown time of its destruction $\ensuremath{t_\textnormal{end}}$. Gott argued that we should expect $\ensuremath{t_\textnormal{now}}$ to be uniformly distributed between $\ensuremath{t_\textnormal{start}}$ and $\ensuremath{t_\textnormal{end}}$, such that we should expect $\ensuremath{t_\textnormal{end}} - \ensuremath{t_\textnormal{now}}$ to be longer than $\ensuremath{t_\textnormal{now}}-\ensuremath{t_\textnormal{start}}$ half the time. This means that the age of the structure (102 years) fixes the units of the distribution of $\ensuremath{t_\textnormal{end}} - \ensuremath{t_\textnormal{start}}$. If we observed an object that has been existing for 1030 years, or for 103 seconds, then our inference about its expected duration would have the same shape, but only differ in the choice of units. The Copernican argument also applies to our inference problem. Here the scale at the first receptor $s_\ensuremath{{x_{i-1}}}$ plays a role analogous to the duration of the object $\ensuremath{t_\textnormal{end}} - \ensuremath{t_\textnormal{start}}$. Suppose that we have a set of receptors with a known function $\alphas$ that obeys Eq.~\ref{eq:alphahat} and we encounter a world with some unknown statistics. In this first world we choose some $\ensuremath{\Delta_{i}}$, observe some measure of redundancy $\alphaobs$, use some method of inference to estimate $\ppre{s}$ and $\ppost{s}$ and then select the value of $\ensuremath{\Delta_{i+1}}$ to yield the expectation that $\alphapred=\alphaobs$. Let us refer to the distribution of $\ppost{s}$ that we inferred from fixing $\ensuremath{\Delta_{i}}$ to its particular value and observing $\alphaobs$ as $\palpha{s;\ensuremath{\Delta_{i}}}$. Now, suppose that we encounter another world with the same receptors. Assume further that we choose a different $\ensuremath{\Delta_{i}}$ but observe the \emph{same} value of $\alphaobs$. How should our inference about the distribution of $s_\ensuremath{{x_i}}$ be related to our inference from the first world? If Eq.~\ref{eq:alphahat} holds, the Copernican Principle requires that all of the distributions that can be inferred for a particular value of $\alphaobs$ must be related to one another \emph{via} a canonical form: \begin{equation} \palpha{s;\ensuremath{\Delta_{i}}} = \frac{1}{\ensuremath{\Delta_{i}}} \hat{p}_\alpha(s/\ensuremath{\Delta_{i}}). \label{eq:pcanon} \end{equation} If Equation~\ref{eq:pcanon} did not hold, it would imply that we can infer something about the world's choice of $s_\ensuremath{{x_i}}$ from our choice of $\ensuremath{\Delta_{i+1}}$ \emph{beyond} that communicated by the value of $\alphaobs$. As long as the receptors and our measure of redundancy scale with $\ensuremath{\Delta_{i}}$ as in Eq.~\ref{eq:alphahat} then any such effect would imply that the world's choice of $s$ and our choice of $\ensuremath{\Delta_{i}}$ are not independent and thus violate the Copernican Principle. \subsection{Ratio scaling results from minimal assumptions about the statistics of the world and the Copernican Principle} Equations~\ref{eq:alphahat}~and~\ref{eq:pcanon} imply that redundancy is equated for receptor spacings in some ratio. To see this, let us rewrite Eq.~\ref{eq:alphapred} and find \begin{eqnarray} \alphapred(\ensuremath{\Delta_{i+1}}) & = & \frac{1}{\ensuremath{\Delta_{i}}} \int_0^\infty \hat{p}_\alpha\left(s/\ensuremath{\Delta_{i}}\right) \ \alphahat(\ensuremath{\Delta_{i+1}}/s) \ ds \nonumber\\ & = & \int_0^\infty \hat{p}_\alpha(s') \ \alphahat(r/s') \ ds' \label{eq:canon} \end{eqnarray} In the second line $s' \equiv s/\ensuremath{\Delta_{i}}$ and we define the ratio $r \equiv \ensuremath{\Delta_{i+1}}/\ensuremath{\Delta_{i}}$. The right hand side of Equation~\ref{eq:canon} clearly does not depend on $\ensuremath{\Delta_{i+1}}$ directly, but only on the ratio. The finding, then, is that a principle of minimal assumptions about the statistics of the world coupled with the Copernican Principle implies that the optimal distribution of receptor locations is such that the ratio of successive receptor spacings is constant. Logarithmic neural scales also imply that the ratio of successive receptor spacings are constant. In this sense, logarithmic scales can be understood as a response to the demand that the receptor layout are expected to equalize redundancy across receptors in a world with unknown statistics. Because logarithmic scales do not uniquely predict constant ratio spacing this cannot be the entire story. We pursue additional constraints that imply logarithmic scales, with some important exceptions when $x$ approaches zero, in the next section. Before that, for concreteness we include a worked example for a idealized set of receptors and a specific choice for $\alphas$. \subsection{A worked example} The general development above provides a set of conditions that result in a constant ratio of spacing between receptors. In order to make this more concrete, we work out a specific example with specific choices for the properties of the receptors, the measure of redundancy and the method of inference. This example assumes that the receptors are perfect and the $i$th receptor samples the function only at the location $x_i$. For simplicity we define a measure of redundancy that gives $\alpha = 1$ if the two receptors observe the same value of $f$ and $\alpha=0$ otherwise. This lets us write out \[ \alphaspre = \begin{cases} 1, & \mbox{if} \ \ensuremath{\Delta_{i}} < s_\ensuremath{{x_{i-1}}}\\ 0, & \mbox{if}\ \ensuremath{\Delta_{i}} \ge s_\ensuremath{{x_{i-1}}} \end{cases} \] The same holds for $\alphaspost$, only comparing $\ensuremath{\Delta_{i+1}}$ to $s_\ensuremath{{x_i}}$. With our simplified definition of redundancy, any value of $\alphaobs$ that is not zero or one must have resulted from a mixture of those two cases with probability $\alphaobs$ and $1-\alphaobs$ respectively. Let us first consider the case where $\ensuremath{\Delta_{i}} < s_\ensuremath{{x_{i-1}}}$, as it aligns perfectly with the Gott argument. If $s_\ensuremath{{x_{i-1}}} > \ensuremath{\Delta_{i}}$, then $s_\ensuremath{{x_{i-1}}}$ plays the role of the unknown duration of the lifetime of an object such as Fenway Park, $\ensuremath{t_\textnormal{end}}-\ensuremath{t_\textnormal{start}}$. The difference between the two receptors $\ensuremath{\Delta_{i}}$ plays the role of the time of the current observation $\ensuremath{t_\textnormal{now}} - \ensuremath{t_\textnormal{start}}$ and the unknown $s_\ensuremath{{x_{i+1}}}$ is analogous to $\ensuremath{t_\textnormal{end}} - \ensuremath{t_\textnormal{now}}$. Gott's calculation defines the ratio $r=\left(\ensuremath{t_\textnormal{end}} - \ensuremath{t_\textnormal{now}}\right)/\left(\ensuremath{t_\textnormal{now}}-\ensuremath{t_\textnormal{start}}\right)$. The Copernican Principle leads to the belief that $\ensuremath{t_\textnormal{now}}$ ought to be uniformly distributed between $\ensuremath{t_\textnormal{start}}$ and $\ensuremath{t_\textnormal{end}}$. Thus the cumulative distribution of $r$ obeys: \begin{equation} P\left(r > Y\right) = \frac{1}{1+Y} \label{eq:Gott} \end{equation} Note that the elapsed duration $\ensuremath{t_\textnormal{now}} - \ensuremath{t_\textnormal{start}}$ only enters this expression \emph{via} the ratio. Similar arguments apply to the spacing of receptors. If we observe $\alphaobs=1$, then the posterior $\ppost{s}$ is controlled by Eq.~\ref{eq:Gott}, with $\ensuremath{\Delta_{i}}$ in place of $\ensuremath{t_\textnormal{now}} - \ensuremath{t_\textnormal{start}}$ and $\ensuremath{\Delta_{i+1}}$ in place of $\ensuremath{t_\textnormal{end}} - \ensuremath{t_\textnormal{now}}$.\footnote{That is, Eq.~\ref{eq:Gott} gives the cumulative of the posterior distribution.} In this toy problem, the value of $\alphapred$ is given by Eq.~\ref{eq:Gott} if $\alphaobs=1$. If instead of $\alphaobs = 1$, we observed $\alphaobs=0$, we would infer a uniform distribution of $s(\ensuremath{{x_i}})$.\footnote{One can argue for other ways to make the inference in this toy problem when $\alphaobs=0$. As long as those depend only on the ratio $\ensuremath{\Delta_{i+1}}/\ensuremath{\Delta_{i}}$ and not explictly on $\ensuremath{\Delta_{i+1}}$, the conditions of the general argument still hold.} If our prior on the distribution of $s_\ensuremath{{x_i}}$ is uniform, then $\alphapred$ will be one for any finite value of $\ensuremath{\Delta_{i+1}}$. After sampling the world for some period of time, if we observe $\alphaobs$ as a number between zero and one, then our posterior distribution of scales should be a mixture of the inference from the two cases and simplify Eq.~\ref{eq:alphapred} as: \begin{eqnarray} \alphapred(\ensuremath{\Delta_{i+1}}) = \alphaobs \frac{1}{1+\ensuremath{\Delta_{i+1}}/\ensuremath{\Delta_{i}}} + \left(1-\alphaobs\right) \label{eq:simpleequation} \end{eqnarray} It is clear that the right hand side is only a function of the ratio $r \equiv \ensuremath{\Delta_{i+1}}/\ensuremath{\Delta_{i}}$ so that the value of $\ensuremath{\Delta_{i+1}}$ that makes $\alphapred=\alphaobs$ depends only on the ratio.\footnote{In this simple example there is a solution for values of $\alphaobs > 1/2$. } For any value of $\alphaobs$, the same value of $r$ satisfies this equation for any choice of $\ensuremath{\Delta_{i}}$. In this simple problem we see that the choice of $\ensuremath{\Delta_{i}}$ can only affect the answer by fixing its units. This naturally results in the ratio of adjacent receptor spacings being constant, as implied by logarithmic receptor scales. \section{Global function representation} \label{sec:global} \begin{figure} \begin{tabular}{lclc} \textbf{a} & & \textbf{b}\\ &\includegraphics[width=0.4\columnwidth]{scalesbars-1-1.pdf} &&\includegraphics[width=0.4\columnwidth]{scalesbars-2-1.pdf}\\ \textbf{c} & & \textbf{d}\\ &\includegraphics[width=0.4\columnwidth]{scalesbars-2-3.pdf} &&\includegraphics[width=0.4\columnwidth]{scalesbars-3-3.pdf} \end{tabular} \caption{ { \bf Cartoon illustrating the interaction of receptor spacing and function scale.} In each panel, the top curve shows a specific function $f_s(x)$; the functions in the four panels differ only in their scale $s$. On the bottom of each panel, the vertical lines display receptor locations. {\bf a-b.} Constant spacing. When $c=0$, the receptors are evenly-spaced, fixing a scale to the receptors. If the function has the same scale as the receptors, as in \textbf{a}, each receptor captures a different value of the function, the veridical region runs the entire length of the receptor array and the information transmitted is maximal. However, if the scale of the function is larger than the constant spacing, as in \textbf{b}, the array of receptors conveys less information because there is less information in the function over that range. \textbf{c-d.} Ratio spacing. When $c > 0$, the receptors can extend over a much wider range of $x$ values than with constant spacing. The receptors carry information about the function over a veridical region where $\Delta_i < s$; the border of the veridical regions is shown (in cartoon form) as a vertical red line. As $s$ increases (from \textbf{c} to \textbf{d}), the size of the veridical region in $x$ changes, but as long as the border is covered by the receptors, the amount of nonredundant information in the veridical region is constant as a function of $s$. This property does not hold if the scale of the function approaches the minimum receptor spacing. \label{fig:adaptive}} \end{figure} The foregoing analysis conducted at the level of pairs of receptors showed that the optimal spacing in order to represent arbitrary functions places the receptors in constant ratio, but does not specify the value of the ratio. It is convenient to parameterize the ratio between adjacent receptors by a parameter $c$ such that $r \equiv \frac{\ensuremath{\Delta_{i+1}}}{\ensuremath{\Delta_{i}}} = 1+c$. If $c=0$, receptor spacing is constant; if $c>0$ the ratio is constant, as in a logarithmic scale. We consider the global coding properties of these two schemes as well as a hybrid scheme in which the first part of the axis has constant spacing ($c=0$) followed by a region with logarithmic spacing ($c>0$), analogous to the organization of the visual system, with the region of constant spacing corresponding roughly to the fovea (Fig.~\ref{fig:FreeSimo}b). \subsection{Formulating the problem} For simplicity, we assume that each receptor perfectly samples the value of a function in the world at a single perfectly-specified location and consider a simple class of functions $f_s(x)$, which consist of independently chosen values over the range 0~to~1 at a spacing of $s$ such that $f_s(x)$ and $f_s(x+s)$ are independent and $f_s(x)$ and $f_s(x+s - \epsilon)$ are identical for $\epsilon < s$. The information about a function contained in a given range by a particular instantiation of the function is just the number of entries specifying the values of the function over that range. Note that $s$ controls the density of information conveyed by $f_s$ over a given range of $x$. We assume that $f_s(x)$ is specified over the entire range of $x$ from zero to infinity so that the total amount of information that could be extracted from a function is infinite for every finite scale. Figure~\ref{fig:adaptive} shows several functions and choices of receptor scaling in cartoon form. A set of receptors can do a ``good'' job in representing a function $f_s(x)$ as long as the spacing between the receptors is less than or equal to $s$. With the simplifying assumptions used here, each of the non-redundant values of the function is captured by at least one receptor allowing reconstruction of the function with error in the $x$ location no worse than $s$. More generally, even with coarse-graining and noisy receptors it is clear that there is a qualitative difference between the ability of the receptors to measure the function when $\Delta < s$ compared to when $\Delta > s$. Let us define the veridical region of the function as the range of $x$ over which $\ensuremath{\Delta_{i}} < s$. We also assume there is some minimum possible receptor spacing $\Deltamin$. We measure the amount of veridical information $I$ conveyed by the set of receptors as the number of unique function values that the function has within the veridical region. \subsection{Constant receptor spacing, $c=0$} First, consider the implications of constant receptor spacing. If we knew the value of $s$ controlling $f_s(x)$, placing our receptors with constant separation $\Delta=s$ would be sufficient to convey all of the information in the function over the entire range of $x$ values covered by the receptors. $N$ receptors would be able to accurately represent the function over a veridical region of width $N\Delta $ and the amount of information conveyed about the function in that region is just $N$. However, our constant choice of spacing would have poor consequences if our choice of $\Delta$ did not correspond to the world's choice of $s$. If $s > \Delta$, the veridical region is still of length $N \Delta$, but the amount of information contained in that region is only $N\frac{\Delta}{s}$, decreasing dramatically as $s$ increases (curve labeled $c=0$ in Figure~\ref{fig:informationc}). With constant spacing, $c=0$, the amount of information conveyed by the receptors depends dramatically on $s$. \begin{figure} \centering \includegraphics[width=0.8\columnwidth]{IVfig4.pdf} \caption{\textbf{Information in the veridical region as a function of scale for three forms of receptor spacing.} The curve labeled $c=0$ shows the results for constant spacing. This falls off rapidly for scales larger than the scale set by the receptor spacing. Solid curves show results for ratio spacing ($c>0$) with a fovea; dashed curves show results for ratio spacing without a fovea. $N=100$ for all curves. See Figure~\ref{fig:schematicfovea}a for an intuitive explanation of why the information decreases for small values of $s$. The fovea has an additional $1/c$ receptors. Note that there is a region where the amount of information conveyed is approximately constant as a function of scale before falling off as the veridical region exhausts the number of receptors $N$. For $c=.05$, this region is off the scale of this figure. Note also the error at small scales for $c>0$ without a fovea. \label{fig:informationc} } \end{figure} \subsection{Constant receptor spacing ratio, $c>0$} If we set $c>0$ such that all receptors are placed in constant ratio the responsiveness to functions of different scales is very different. Let us place the zeroth receptor $x_0$ at $\xmin$, and the first receptor at $x_1 = \xmin + \Deltamin$. Continuing with $\Delta_i = \left(1+c\right) \Delta_{i-1}$, we find that the spacing of the $i$th receptor is given by \begin{equation} \Delta_i = \Deltamin \left(1+c\right)^{i-1} \label{eq:deltai} \end{equation} The position of the $i$th receptor is thus given by the geometric series \begin{eqnarray} x_i &=& \xmin + \frac{\Deltamin}{c}\left[\left(1+c\right)^{i} -1 \right] \label{eq:xi} \end{eqnarray} Equations~\ref{eq:deltai}~and~\ref{eq:xi} show that when $c>0$ the range of $x$ values and scales that can be represented with $N$ receptors goes up exponentially like $(1+c)^N$. For a function of scale $s$, the set of ratio-scaled receptors has a veridical region ranging from $\xmin$ to \begin{equation} \xcrit = \left\{ \begin{array}{lr} s\frac{1+c}{c} - \frac{\Deltamin}{c} + \xmin & s \leq \Delta_N \\ \\ \xmax & s > \Delta_N \end{array} \right. \end{equation} The amount of information present in the function in the veridical region is just $(\xcrit-\xmin)/s$, which is given by \begin{equation} I_{c>0} = \left\{ \begin{array}{lr} \frac{1+c}{c} - \frac{\Deltamin}{sc}& s \leq \Delta_N \\ \\ \frac{\xmax-\xmin}{s} & s > \Delta_N \end{array} \right. \label{eq:Icgreater0} \end{equation} The second expression, which happens when $s$ is larger than the largest spacing among the set of receptors, is closely analogous to the case with constant spacing ($c=0$), decreasing like $s^{-1}$. However, the first expression with $s \leq \Delta_N$ includes a term $(1+c)/c$ which is independent of $s$. The second term is small when $s$ is large, so that for large values of $s$ the information conveyed is approximately constant. However, when $s$ is small the second term is substantial and constant ratio spacing ($c>0$) fails to convey much information about the function in the veridical region. When $s=\Deltamin$ the veridical region includes only one value of the function (see Figure~\ref{fig:schematicfovea}a). The dashed line in Figure~\ref{fig:informationc} shows the analytic result when $c > 0$ and is constant across all receptors. \begin{figure} \begin{center} \begin{tabular}{lclc} \textbf{a} && \textbf{b}\\ &\includegraphics[width=0.4\columnwidth]{smallscalebars-2.pdf} &&\includegraphics[width=0.4\columnwidth]{smallscalebars-1.pdf}\\ \textbf{c}\\ &\multicolumn{3}{c}{\includegraphics[width=0.9\columnwidth]{cartoon.png}} \end{tabular} \end{center} \caption{ \textbf{Rationale for inclusion of a fovea.} \textbf{a-b.} Functions are shown with different scales, as in Figure~\ref{fig:adaptive} for logarithmically-spaced receptor locations. \textbf{a.} With a function scale that is much larger than $\Deltamin$, several values of the function can be represented (here $I=5$). \textbf{b.} When the scale goes to $\Deltamin$, then much less total information can be represented. Here only one function value fits into the veridical region. Note that the information conveyed by the same set of receptors decreases as $s$ decreases, as in the dashed lines in Figure~\ref{fig:informationc}. \textbf{c.} Schematic for notation for hybrid neural scaling. The first part of the scale, analogous to a fovea, has $n$ evenly spaced receptors from $0$ to $\xmin$. The second part of the scale region, from $\xmin$ to $\xmax$ has $N$ receptors spaced such that the ratio of adjacent differences is $1+c$. The derivation suggests $n$ should be fixed at $1/c$, whereas $N$ can in principle grow without bound. If $\xmin=\Deltamin/c$, the scale starts precisely at $x=0$. \label{fig:schematicfovea} } \end{figure} \subsection{A ``fovea'' surrounded by a logarithmic scale} Note that if the $\frac{\Deltamin}{sc}$ term in Eq.~\ref{eq:Icgreater0} were canceled out, the amount of information in the veridical region conveyed by the set of receptors would be precisely invariant with respect to $s$ over the central range. This can be accomplished by preceding the region of ratio spacing ($c>0$) with a region of constant spacing ($c=0$). In order to equalize the information carried at small scales, the region of constant spacing should have $n = \frac{1}{c}$ receptors each spaced by $\Deltamin$, as in Figure~\ref{fig:schematicfovea}b. Adding a set of constantly spaced receptors enables constant information transfer over a range of scales starting exactly at $\Deltamin$ (flat solid curves in Figure~\ref{fig:informationc}). When the region with ratio spacing starts at $\xmin=\frac{\Deltamin}{c}$, then the region of constant spacing starts at $x=0$. Note that the number of receptors in the fovea is controlled only by $c$ and is independent of the number of receptors in the region with ratio spacing. The ratio of adjacent receptor spacings is constant within each region and only fails to hold exactly at the transition between regions. \section{Discussion} Current technology is rapidly leading to a situation where we can design intelligent agents. The results in this paper point to a design choice that may have played out on an evolutionary time scale. To the extent neural representations of very different one-dimensional quantities all obey the same scaling laws, it suggests convergent evolution optimizing some design principle. One strategy that could be taken in designing receptor systems is to optimally adapt the organism to the behaviorally-relevant statistics of the environment. Evolution has certainly made this choice in a number of cases---the putative ``fly detectors'' in the frog's visual system are a famous example of this approach (\citeNP{LettEtal59,MatuEtal60}, see also \citeNP{HerzBarl92}). However, optimizing receptor arrays to a specific configuration of the world comes with a cost in terms of flexibility in responding to changes in the world. \subsection{Logarithmic receptor scales and natural statistics} In this paper, we have pursued the implications of a neural uncertainty principle---maintaining maximum ignorance about the statistics of the world---for the design of sensory receptors. Operationally, this means we have made only minimal assumptions about the statistics of the functions to be represented, limiting ourselves to uniform priors and the assumption of independence. Had we assumed a non-uniform distribution for the prior of $s$, this would have required us to estimate at least one parameter. Similarly, if the successive values of $s_x$ were not independent, we would have to have estimated at least one parameter to characterize the nature of the dependence. It can be shown that the arguments developed in the first section of this paper (``Optimal receptor distribution \ldots'') for uniform priors also generalize to scale-free (power law) priors (see footnote~\ref{foot:power}). Much empirical work has characterized statistical regularities in the world. For instance, power spectra in natural images tend to be distributed as a power law with exponent near $-2$ \cite{Fiel87,RudeBial94,SimoOlsh01}. Similarly, it has been argued that power spectra for auditory stimuli are distributed as a power law with exponent $-1$ \cite{VossClar75}. Perhaps it would be adaptive to design a set of receptors that is optimized for these naturally occurring statistics \cite<e.g.,>{WeiStoc12,Pian16}. Results showing power law spectra with similar exponents for natural images mask variability across orientations and categories of images \cite{TorrOliv03}. For instance, the exponent observed, and especially second-order statistics, vary widely across pictures of landscapes \emph{vs} pictures of office environments or pictures of roads. To the extent these statistics differ, if receptors were optimized for any one of these categories of images, they would be suboptimally configured for other environments \cite{WeiStoc12}. Moreover, because the eyes are constantly in motion, the statistics of natural images are not necessarily a good proxy for the statistics of light landing on the retina averaged by synaptic time constants. More concretely, the temporal variation due to fixational eye movements has the effect of whitening images with conventional power law spectra \cite{KuanEtal12,Rucc08}. In the time domain, it can be shown that in the presence of long-range correlated signals, logarithmic receptor spacing is optimal for predicting the next stimulus that will be presented \cite{ShanHowa13}. A derivation based on a uniform prior is more general than a belief that the statistics of the world should be power law. The former would apply across a range of environments and equally well apply to any world with some unknown statistics. Moreover, the development in the next section (entitled ``Global function representation''), which predicts the existence of a fovea under some circumstances, would be quite different if we had a strong prior belief about the probability of observing a particular scale $s$. If the goal was to maximize the information across states of the world, and if there was a non-uniform prior about the distribution of scales, we would not have obtained asymptotically logarithmic receptor spacing. \subsection{Specific predictions deriving from the approach in this paper} There have been a great many other approaches to understanding the ubiquity of logarithmic psychological scales and the more general problem of constructing psychological scales with well-behaved mathematical properties from continua in the world. These are briefly reviewed in the next subsection (entitled ``Placing this work in historical context'') with special attention to drawing contrasts with the present paper. However, to our knowledge, the predictions about the scaling of the foveal region are unique to the present approach. Asymptotically, a logarithmic neural scale enables a set of receptors to provide equivalent information about functions of a wide range of intrinsic scales, implementing the principle of neural equanimity. However, logarithmic neural scales are untenable as $\Delta$ goes to zero---the number of receptors necessary tends to infinity and the set of receptors conveys less information about functions with scale near the smallest receptor spacing (corresponding to the maximum resolution). In the absence of a fovea, there is a small-scale correction (dashed lines Fig.~\ref{fig:informationc}). A region of constant receptor spacing near zero---a fovea---solves this problem allowing the set of receptors to carry the same amount of non-redundant information about functions with every possible scale ranging from $\Deltamin$ to $\Delta_N$. Equalizing the information across scales results in a fixed number of receptors within the fovea. Critically, the number of receptors along a radius of the fovea, measured in units of $\Deltamin$, depends only on $c$. The value of $c$ can be estimated from noting the slope of the line relating receptor size to the center of the receptive field, as in Figure~\ref{fig:FreeSimo}b. \footnote{This prediction is at least roughly consistent with the trend of the hinged linear functions generated by \cite{FreeSimo11} shown in Fig.~\ref{fig:FreeSimo}b, but this visual impression should not be taken as strong quantitative evidence.} Note that the value of $c$ is estimated from receptive fields outside of the fovea, whereas $\Deltamin$ and the number of receptors along a radius are estimated from information about the fovea. As such, measurement of the two quantities ought to be completely independent. This quantitative relationship constitutes a specific prediction of this approach and can be evaluated across brain regions within the same modality, and even across modalities. \subsection{Placing this work in historical context} The present paper provides a rational basis for logarithmic neural scales and the presence of a ``fovea'' for values of $x$ near zero. It also adds to a long tradition of work in mathematical psychology organized along several themes. \subsubsection{Measurement theory} Researchers in mathematical psychology have long considered the form of psychological spaces. This work has concluded, \emph{contra} the present approach, that there is not a privileged status for logarithmic psychological scales. Fechner's \citeyear{Fech60} reasoning for logarithmic psychological scales started with the empirical observation of a constant Weber fraction and then made what was apparently a straightforward conclusion: integration of the Weber law results in logarithmic psychological scale. That is, the Weber law states that the change in the psychological discriminability $\Delta p$ due to a change in the magnitude of a physical stimulus $\Delta x$ goes like $\Delta p \propto \frac{\Delta x}{x}$. Taking the limit as $\Delta x$ goes to zero and integrating gives a logarithmic scale $p = \log x + C$. On its face this seems reasonable; surely the psychological distance between two stimuli should be the sum of the JNDs along the path between them. \citeA{LuceEdwa58} noted that Fechner's reasoning is not in general sound; the integration procedure is only valid if the empirical Weber fraction result holds. \citeA{Luce59} showed that a logarithmic psychological scale is one of a class of relationships that can map a physical scale with a natural zero (a ratio scale) onto an interval scale that is translation-invariant \cite{Stev46}. \citeA{DzhaColo99,DzhaColo01} developed a much more general framework for constructing multidimensional psychological spaces from local discriminability functions (see \citeNP{LuceSupp02} for an accessible introduction to the history of these questions) that also does not find any privileged status for logarithmic functions. And none of these approaches provides a natural account for the existence of a ``fovea''---a region of heightened discriminabiligy near $x=0$. To the extent that logarithmic neural scales are a general property of the brain, the neural considerations described in this paper provide a potentially important complement to measurement theory. \subsubsection{Recent approaches to Weber-Fechner scaling} More recently, investigators in mathematical psychology and related fields have also considered the rationale underlying the apparent ubiquity of the Weber-Fechner law. These approaches have in general taken a more restrictive approach than the quite general considerations in this paper. Moreover, they do not lead to the specific predictions regarding the fovea derived here. Some recent approaches have noted that if the psychological scale is designed to minimize a relative error measure \cite{SunEtal12,PortSvai11}, logarithmic scales naturally result. For instance, in stimulus quantization, the goal is to choose a discrete quantization of the stimulus space in order to minimize the expected value of some measure of reconstruction error between the true stimulus and the quantized stimulus. If one minimizes mean squared error, the optimal quantization is uniform. However, if one attempts to minimize relative error, and if the quantization is constrained to have a fixed entropy, it can be shown that the optimal quantization is on a logarithmic scale independent of the input stimulus statistics \cite{SunGoya11,SunEtal12}. \citeA{Wilk15} compared the suitability of various relative error measures from an evolutionary perspective. These approaches depend critically on the assumption of relative error measures, without explaining why those might be desirable (other than that they result in Weber-Fechner scales). Other recent approaches that result in Weber-Fechner spacing make specific assumption about the statistics of the world. For instance \citeA{ShouEtal13} described the variability in perception as due to the variability in spike count statistics from a neuron with some I/O function and Poisson variability. They concluded that the Weber law is optimal if the world has power law statistics. Similarly, \citeA{Pian16} derived a Weber-Fechner scale for numerosity under the assumption that the probability that each possible number will be utilized goes down like a power law. This builds on earlier work deriving a rational basis for power law forgetting on the probability of use of a memory a certain time in the past \cite{AndeScho91}. \citeA{WeiStoc12} argued that receptor spacings should be constructed so that each receptor carries the same amount of information about the world. This depends on the statistics of the world and a logarithmic neural scale results only if the world has power law statistics with exponent $-1$. To the extent the world has different statistics in different modalities and different environments, these approaches are limited in accounting for the ubiquity of Weber-Fechner neural scales. The approach in the present paper is more general in that it does not make any strong prior assumptions about the statistics of the world. \subsubsection{Universal exponential generalization} On its face, logarithmic neural scales seem to be closely related to Shepard's work on universal exponential generalization \cite{Shep87}. If the mapping between the physical world and the neural scale is logarithmic, one would expect that the mapping between the neural scale and the physical world is exponential. Indeed, the approach in the section ``Optimal receptor distribution \ldots'' was very much inspired by Shepard's pioneering approach to the structure of an abstract psychological space \cite{Shep87}. However, the results are actually quite distinct. \citeA{Shep87} studied the problem of generalization; if a particular stimulus $x$ leads to some response, what is the optimal way to generalize the response to other stimuli in the neighborhood of $x$? Shepard's derivation hypothesizes a consequential region of unknown size. Although the results depend on one's prior belief about the distribution of sizes, if one uses a Copernican principle like Gott to set the prior, one obtains an exponential generalization gradient. The size of the consequential region in Shepard's work plays a role analogous to the scale of the function in this paper. And an exponential gradient is analogous to a logarithmic scale. The value $1+c$ serves the role of the base of the logarithm in the scales derived here. This corresponds (roughly) to an exponential generalization gradient that goes like $(1+c)^x$. In Shepard's framework, the ``space constant'' of the exponential gradient is controlled by the expected size of the consequential region, which functions like a prior choice of scale. Note that the neural scales developed here would not lead to an exponential generalization gradient around any particular point $x$. The width of receptive fields (which is proportional to $\Delta$) provides a natural lower limit to generalization. We would not expect this generalization gradient to be symmetric in $x$ (see Fig.~\ref{fig:FreeSimo}a). Of course psychological generalization need not be solely a function of neural similarity and is more difficult to observe than receptive fields. \subsection{Neural scales for cognitive dimensions} The quantitative evidence for spacing of visual receptive fields is quite strong, due to intense empirical study for decades \cite{DaniWhit61,HubeWies74,VanEEtal84}. The derivation in this paper applies equally well to any one-dimensional quantity over which we want to represent a function. If the neural uncertainty principle is a design goal for the nervous system, it should be possible to observe similar scaling laws for representations of other dimensions. As discussed in the introduction, there is evidence that the brain maintains receptive fields for dimensions that do not correspond to sensory continua. In the visual system, a neuron's spatial receptive field is the contiguous region over visual space that causes the neuron to be activated. Cognitive continua can also show the same coding scheme. For instance, in a working memory task that required macaques to remember the number of stimuli presented over the delay, neurons in lateral prefrontal cortex responded to a circumscribed set of numbers to be remembered. That is, one neuron might be activated when the number of stimuli to be remembered is 3-5, but another neuron might be activated when the number to be remembered is 4-7. Time cells fire during a circumscribed period of time within a delay interval. Each time cell can be thought of as having a receptive field over past time. In much the same way that a neuron with a visually-sensitive receptive field fires when a stimulus is in the appropriate part of the visual field, so too the time cell fires when a relevant stimulus, here the beginning of the delay interval, enters its temporal receptive field. Because different time cells have different receptive fields, as the stimulus recedes into the past with the passage of time, a sequence of time cells fire. In this way, receptive fields tile time, a continuous dimension in much the same way that eccentricity or numerosity would be coded. Time and numerosity do not correspond to sensory receptors in the same way that, say, eccentricity in the visual system does. Nonetheless, the logic of the arguments in this paper apply equally well to time and numerosity. Do these ``cognitive'' receptive fields show logarithmic spacing? Although this is still an open empirical question, qualitative findings are consistent with logarithmic spacing. Logarithmic spacing would imply that the width of time fields should increase linearly with the time of peak firing within the delay. Although a precisely linear relationship has not been established, it is certain that the width of time fields increases with time of peak firing. This is true in the hippocampus \cite{MacDEtal11,SalzEtal16}, entorhinal cortex \cite{KrauEtal15}, striatum \cite{AkhlEtal16,MellEtal15,JinEtal09}, and medial prefrontal cortex \cite{TigaEtal16}. Similarly, logarithmic spacing implies that the number density of cells with a time field centered on time $\tau$ should go down like $\tau^{-1}$. While this quantitative relationship has not been established thus far, it is certain that the number density goes down with $\tau$. This qualitative pattern at least holds in all of the regions where time cells have been identified thus far. In addition to logarithmic spacing, the logic motivating the existence of a fovea would apply equally well to cognitive dimensions. This does not imply that foveal organization ought to be ubiquitous. We would expect the size of the fovea to be large when $c$ is small. The cost of choosing a small value of $c$ is that the range of scales that can be represented with a fixed $N$ goes down dramatically (Eq.~\ref{eq:deltai}). In domains where there is no natural upper limit to $x$, such as numerosity or (arguably) time, this concern may be quite serious. However, the cost of failing to represent arbitrarily large scales is perhaps not so high in cases where there is a natural upper bound on the function to be represented. In the case of vision, there is a natural upper bound to the value of eccentricity that could be observed. In the case of functions of numerosity, the subitizing range, the finding that small integers are represented with little error, may be analogous to the fovea. In the case of functions of time, the analog of a fovea would correspond to something like traditional notions of short-term memory. In any case, direct measurement of $c$, which can be estimated from the width of receptive fields as a function of their peak, would provide strong constraints on whether or not there ought to be a ``fovea'' for numerosity and/or time. \subsection{Constructing ratio scales for cognitive dimensions} Ultimately, one can understand the spacing of the retinal coordinate system, or other sensory domains, as the result of a developmental process that aligns receptors along the sensory organ. However, if these arguments apply as well to non-sensory dimensions such as number and time, then this naturally raises the question of how the brain constructs ``receptors'' for these entities. One recent hypothesis for constructing representations of time, space and number describes time cells---which have receptive fields for particular events in the past---as extracted from exponentially-decaying neurons with long time constants. The requirement for logarithmic neural scales amounts to the requirement that the time constants of exponentially-decaying cells should be organized such that ``adjacent'' cells, along some gradient, should have time constants in a constant ratio. There is now good evidence for long time constants in cortex both \emph{in vitro} \cite{EgorEtal02} and \emph{in vivo} \cite{LeitEtal16}. The long time constants can be implemented at the single cell level using known biophysical properties of cortical neurons \cite{TigaEtal15}. Noting that a set of exponentially-decaying cells encode the Laplace transform of the history, it has been proposed that time cells result from an approximate inversion of the Laplace transform \cite{ShanHowa13}. The inversion can be accomplished with, essentially, feedforward on-center/off-surround receptive fields. The mathematical basis of this approach is extremely powerful. It is straightfoward to show that the computational framework for a representation of time can be generalized to space and number \cite{HowaEtal14} or any variable for which the time derivative can be computed. Moreover, access to the Laplace domain means one can implement various computations, for instance implementing translation \cite{ShanEtal16} or comparison operators \cite{HowaEtal15}. To the extent that representations from different domains utilize the same scaling relationships, access to a set of canonical computations could lead to a general computational framework for cognition.
{'timestamp': '2017-04-04T02:10:17', 'yymm': '1607', 'arxiv_id': '1607.04886', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04886'}
arxiv
\section{Introduction} The handwritten signature is a widely accepted means of authentication in government, legal, and commercial transactions. Signature verification systems aim to confirm the identity of a person based on their signature \cite{jain_introduction_2004}, that is, they classify signature samples as ``genuine'' (created by the claimed individual) or ``forgery'' (created by an impostor). In offline (static) signature verification, the signatures are acquired after the signature writing process is completed, by scanning a document containing the signature. This is in contrast with online (dynamic) signature verification, where the signature is captured directly on a device (such as a pen tablet), and therefore the dynamic information of the signature is available, such as the velocity of the pen movements. The lack of dynamic information in the offline case makes it a challenging problem, and much of the effort in this field has been devoted to obtaining a good feature representation for signatures \cite{hafemann_offline_2015}. There are two main approaches for the problem in the literature: in a Writer-Dependent approach, for each user, a training set of genuine signatures of the user (and, often, genuine signatures from other users as negative samples) is used to train a binary classifier. In a Writer-Independent approach, a single global classifier is trained using a dissimilarity approach, by using a training set consisted of positive samples (a difference vector between two genuine signatures from the same author), and negative samples (a difference vector between a genuine signature and a forgery). At test time, a distance vector is calculated between the query signature and one or more reference signatures (known to be genuine signatures of the claimed individual), and then classified using the Writer-Independent classifier. For a comprehensive review on the problem, refer to \cite{impedovo_automatic_2008}, and for a recent review, see \cite{hafemann_offline_2015}. Recent work on the area explore a variety of different feature descriptors: Extended Shadow Code (ESC) and Directional-Probabilistic Density Function (DPDF) \cite{rivard_multi-feature_2013}, \cite{eskander_hybrid_2013}; Local Binary Patterns (LBP), Gray-Level Co-occurrence Matrix (GLCM) and Histogram of Oriented Gradients (HOG) \cite{yilmaz_offline_2015}, \cite{hu_offline_2013}; Curvelet transform \cite{guerbai_effective_2015}, among others. Instead of relying on hand-engineered feature extractors, we investigate feature learning algorithms applied to this task. In previous research \cite{hafemann_ijcnn_2016}, we have shown that we can learn useful features for offline signature verification, by learning Writer-Independent features from a development dataset (a set of users not enrolled in the system). Using this formulation, we obtained results close to the state-of-the-art in the GPDS dataset, when compared against models that rely on a single feature extractor technique. In the same vein, Ribeiro et al. \cite{ribeiro_deep_2011} used Restricted Boltzmann Machines (RBMs) for learning features from signature images. However, the authors considered only a small set of users (10), and did not use the features to actually classify signatures, only reporting a visual representation of the learned weights. Khalajzadeh \cite{khalajzadeh_persian_2012} used Convolutional Neural Networks for Persian signature verification, but did not considered skilled forgeries. In this paper, we further analyze the method introduced in \cite{hafemann_ijcnn_2016}, investigating the impact of the depth (number of layers) of the Deep Convolutional Neural Network (CNN), and the size of the embedding layer on learning good representations for signatures, as measured by the classification performance on a different set of users. Using better training techniques (in particular, using Batch Normalization \cite{ioffe2015batch} for training the network), we can improve performance significantly, achieving a state-of-the-art performance of 2.74\% Equal Error Rate (EER) on the GPDS-160 dataset, which surpasses all results in the literature, even comparing to results where model ensembles are used. We also perform an analysis on the errors committed by the model, and visualize the quality of the learned features with a 2D projection of the embedding space. Visual analysis suggests that the learned features capture the overall aspect of the signature, which is sufficient to perform well in separating genuine signatures from skilled forgeries in some cases: for users that have complex signatures, or that maintain very stable signatures (i.e. different genuine samples are very similar). We also notice that the learned features are particularly vulnerable to slowly-traced forgeries, where the overall signature shape is similar, but the line quality is poor. \section{Methodology} The central idea is to learn a feature representation (a function $\phi(.)$) for offline signature verification in a Writer-Independent format, use this function to extract features from signatures $\textbf{X}$ of the users enrolled in the system ($\phi(\textbf{X})$), and use the resulting feature vectors to train a binary classifier for each user. The rationale for learning the feature representation in a Writer-Independent format is two-fold: 1) learning feature representations directly for each user is impractical, given the low number of samples available for training (around 5-10 signatures); and 2) having a fixed representation useful for any user makes it straightforward to add new users to the system, by simply using the model to extract features for the new user's genuine signatures, and training a Writer-Dependent classifier. In order to learn features in a Writer-Independent format, we consider two separate sets of signatures: a development set $\mathcal{D}$, that contains signatures from users not enrolled in the system, and an exploitation set $\mathcal{E}$ that contains a disjoint set of users. The signatures from set $\mathcal{D}$ are only used for learning a feature representation for signatures, with the hypothesis that the features learned for this set of users will be relevant to discriminate signatures from other users. On the other hand, the set $\mathcal{E}$ represents the users enrolled to the system. We use the model trained on the set $\mathcal{D}$ to ``extract features'' for the signatures of these users, and train a binary classifier for each user. It is worth noting that we do not use skilled forgeries during training, since it is not practical to require forgeries for each new user enrolled in the system. Overall, the method consists in the following steps: \begin{itemize} \item Training a deep neural network on a Development set \item Using this network to obtain a new representation for signatures on $\mathcal{E}$ (i.e. obtain $\phi(X)$ for all signatures $X$) \item Training Writer-Dependent classifiers in the exploitation set, using the learned representation \end{itemize} Details of these steps are presented below. \subsection{Convolutional Neural Network training} As in \cite{hafemann_ijcnn_2016}, we learn a function $\phi(.)$ by training a Deep Convolutional Neural Network on a Development set, by learning to discriminate between different users. That is, we model the network to output $M$ units, that estimate $P(y|X)$ where $y$ is one of the $M$ users in the set $\mathcal{D}$, and $X$ is a signature image. In this work we investigate different architectures for learning feature representations. In particular, we evaluate the impact of depth, and the impact of the size of the embedding layer (the layer from which we obtain the representation of the signature). Multiple studies suggest that depth is important to address complex learning problems, with both theoretical arguments \cite{bengio_learning_2009}, and as shown empirically (e.g. \cite{simonyan2014very}). The size of the embedding layer is an important factor for practical considerations, since this is the size of the feature vectors that will be used for training classifiers for each new user of the system, as well as performing the final classification. In our experiments, we had difficulty to train deep networks, with more than 4 convolutional layers and 2 fully-connected layers, even using good initialization strategies such as recommended in \cite{glorot_understanding_2010}. Surprisingly, the issue was not that the network overfit the training set, but rather both the training and validation losses remained high, suggesting issues in the optimization problem. To address this issue, we used Batch Normalization \cite{ioffe2015batch}. This technique consists in normalizing the outputs of a layer, for each individual neuron, so that the values have zero mean and unit variance (in a mini-batch of training data), and showed to be fundamental in our experiments in obtaining good performance. Details of this technique can be found in \cite{ioffe2015batch}. In the experiments for this paper, we only report the results using Batch Normalization, since for most of the proposed architectures, we could not train the network without this technique (performance on a validation set remained the same as random chance). \begin{table} \ra{1.3} \centering \caption{CNN architectures evaluated in this paper} \label{tbl:architectures} \begin{tabular}{|c|c|c|c|} \hline AlexNet\_\textbf{N}\textsubscript{reduced}&AlexNet\_\textbf{N}& VGG\_\textbf{N}\textsubscript{reduced}&VGG\_\textbf{N} \\ \hline conv11-96-s4-p0 & conv11-96-s4-p0 & conv3-64 & conv3-64 \\ & & conv3-64 & conv3-64 \\ \hline pool3-s2-p0 & pool3-s2-p0 & pool3 & pool3 \\ \hline conv5-256-p2 & conv5-256-p2 & conv3-128 & conv3-128\\ & & conv3-128 & conv3-128 \\ \hline pool3-s2-p0 & pool3-s2-p0 & pool4 & pool3 \\ \hline conv3-384 & conv3-384 & conv3-256 & conv3-256 \\ conv3-256 & conv3-384 & conv3-256 & conv3-256 \\ & conv3-256 & conv3-256 & conv3-256 \\ & & conv3-256 & conv3-256 \\ \hline pool3-s2-p0 & pool3-s2-p0 & pool4 & pool3 \\ \hline & & & conv3-256 \\ & & & conv3-256 \\ & & & conv3-256 \\ & & & conv3-256 \\ \cline{4-4} & & & pool2 \\ \cline{4-4} & & & conv3-256 \\ & & & conv3-256 \\ & & & conv3-256 \\ & & & conv3-256 \\ \cline{4-4} & & & pool2 \\ \cline{4-4} & \textbf{FC1-N} & & \textbf{FC1-N} \\ \cline{2-2} \cline{4-4} \textbf{FC1-N} &\textbf{FC2-N} &\textbf{FC1-N} &\textbf{FC2-N} \\ \hline \multicolumn{4}{|c|}{FC-531 + softmax} \\ \hline \end{tabular} \end{table} Table \ref{tbl:architectures} shows the architectures we evaluated in this research. The models are based on AlexNet \cite{krizhevsky_imagenet_2012} and VGG \cite{simonyan2014very}, which are two architectures that perform remarkably well in Computer Vision problems. Each row specifies a layer of the network. For convolutional layers, we include first the filter-size, followed by number of convolutional filters. For pooling layers, we include the size of the pooling region. Unless otherwise indicated, we use stride 1 and padding 1. For instance, conv11-96-s4-p0 refers to a convolutional layer with 96 filters of size 11x11, with stride 4 and no padding. For the Fully Connected (FC) layers, we just indicate the name of the layer (that we refer later in the text), and the number of output units. For instance, FC1-N refers to a Fully connected layer named ``FC1'', with $N$ output units. The network AlexNet\_N\textsubscript{reduced} contains 9 layers: 6 layers with learnable parameters (convolutions and fully connected layers), plus 3 pooling layers, where the VGG\_N network contains 24 layers: 19 layers with learnable parameters plus 5 pooling layers. We used Batch Normalization for each learnable layer in the network, before applying the non-linearity (ReLU, except for the last layer, which uses softmax). We considered 4 types of networks: AlexNet: a network similar to the network proposed in \cite{krizhevsky_imagenet_2012}, but without Local Response Normalization and Dropout (which we found unnecessary when using Batch Normalization); AlexNet\textsubscript{reduced}: a similar network but with reduced number of layers; VGG: An architecture similar to \cite{simonyan2014very}; VGG\textsubscript{reduced}: a similar network but with reduced number of layers. For each network, we consider a different size $N$ for the embedding layer, $N \in \{512, 1024, 2048, 4096\}$. This is the size of the feature vectors that will be used for training the Writer-Dependent classifiers, and therefore they impact the cost of training classifiers for new users that are enrolled to the system, as well as the classification cost. Considering the different architectures, and size of the embedding layer, we tested in total 16 architectures. The images were pre-processed by: centralizing the signatures in a 840x1360 image according to their center of mass; removed the background using OTSU's algorithm; inverted the images so that the background pixels were zero valued; and finally resizing them to 170x242 pixels. More details on these preprocessing steps can be found in \cite{hafemann_ijcnn_2016}. \subsection{Training the Writer-Dependent classifiers} After training a Deep CNN on the development set $\mathcal{D}$, we use the network to extract feature representations for signatures from another set of users ($\mathcal{E}$) and train Writer-Dependent classifiers. To do so, we resize the images to 170x242 pixels, perform feedforward propagation until a fully-connect layer, and used the activations at that layer as the feature vector for the image. For the architectures marked as ``reduced'' (see table \ref{tbl:architectures}), that contained only two fully-connected layers, we consider only the last layer before softmax as the embedding layer (FC1). For the architectures with three fully-connected layers, we consider both layers FC1 and FC2, that is, the last two fully-connected layers before the softmax layer. For each user in the set $\mathcal{E}$, we build a training set consisted of $r$ genuine signatures from the user as positive samples, and 14 genuine signatures from users in $\mathcal{D}$ as negative samples. We train a Support Vector Machine (SVM) classifier on this dataset, considering both linear SVM, and SVM with an RBF kernel. Similarly to \cite{eskander_hybrid_2013}, we use different weights for the positive and negative class to account for the imbalance of having many more negative samples than positive. We do so by duplicating the positive samples, so that the dataset is roughly balanced. For testing, we use 10 genuine signatures from the user (not used for training), 10 random forgeries (signatures from other users in $\mathcal{E}$), and the 30 skilled forgeries made targeting the user's signature. \section{Experimental Protocol} We conducted experiments in the GPDS-960 dataset \cite{vargas_off-line_2007}, which is the largest publicly available dataset for offline signature verification. The dataset consists of 881 users, with 24 genuine samples per user, and 30 skilled forgeries. We divide the dataset into an exploitation set $\mathcal{E}$ consisting of the first 300 users, and a development set consisting of the remaining 581 users. Since in this work we evaluate many different architectures, we split the Development set into a training and validation set, using a disjoint set of users for each set. We use a subset of 531 users for training the CNN models, and a subset of 50 users for validation. We use the same protocol above to train Writer-Dependent classifiers for the validation set, to obtain an estimate of how well the features learned by the models generalize to other users. Finally, we use the best models to train WD classifiers for users in the exploitation set $\mathcal{E}$. We performed 10 runs, each time training a network with a different initialization, and using a random split of the genuine signatures used for training/testing, when training the Writer-Dependent classifiers. We report the mean and standard deviation of the errors across the 10 runs. To compare with previous work, we use as exploitation set the first 160 users (to compare with work that used the dataset GPDS-160), and the first 300 users (to compare with work that used GPDS-300). To assess the impact of the number of genuine signatures for each user in training, we ran experiments with 5 and 14 genuine signatures for training ($r \in \{5,14\}$). We evaluated the results in terms of False Rejection Rate (FRR - the fraction of genuine signatures misclassified as forgery), False Acceptance Rate (FAR - the fraction of forgeries misclassified as genuine signatures). For completeness, we show the FAR results for both random and skilled forgeries. We also report Equal Error Rates (EER), which is the error when FAR = FRR. In this case, we use only genuine signatures and skilled forgeries, to enable comparison with other work in the literature. We considered two forms of calculating the EER: EER\textsubscript{user-thresholds}: using user-specific decision thresholds; and EER\textsubscript{global threshold}: using a global decision threshold. Lastly, we also report the Mean Area Under the Curve (Mean AUC), by averaging the AUCs of Receiving Operating Curves (ROC curves) calculated for each user. For calculating FAR and FRR in the exploitation set, we used a decision threshold selected from the validation set (the threshold that achieved EER using a global decision threshold). \section{Results} \begin{figure} \centering \includegraphics[width=\columnwidth]{images/varying_n_linear} \caption{Equal Error Rates on the validation set, for WD models trained with a \textbf{Linear SVM}, using the representation space learned by different architectures (at the layer indicated in parenthesis), and different representation sizes (N)} \label{fig:varying_N_linear} \end{figure} \begin{figure} \centering \includegraphics[width=\columnwidth]{images/varying_n_rbf} \caption{Equal Error Rates on the validation set, for WD models trained with an SVM with \textbf{RBF kernel}, using the representation space learned by different architectures (at the layer indicated in parenthesis), and different representation sizes (N)} \label{fig:varying_N_rbf} \end{figure} We first consider the results of the experiments in the validation set, varying the depth of the networks, and the size of the embedding layer. In these experiments, we trained the CNN architectures defined in table \ref{tbl:architectures}, used them to extract features for the users in the validation set, and trained Writer-Dependent classifiers for these users, using 14 reference signatures. We then analyzed the impact in classification performance of the different architectures/sizes of the embedding layer, measuring the average Equal Error Rate of the classifiers. Figures \ref{fig:varying_N_linear} and \ref{fig:varying_N_rbf} show the classification results on the validation set using Linear SVMs and SVMs with an RBF kernel, respectively. The first thing we notice is that, contrary to empirical results in object recognition (ImageNet), we did not observe improved performance with very deep architectures. The best performing models were the AlexNet architecture (with 8 trainable layers) and the AlexNet\textsubscript{reduced} (with 6 trainable layers) when using the features to training linear SVMs and SVMs with RBF kernel, respectively. We also notice that the performance with a linear classifier is already quite good, demonstrating that the feature representations learned in a writer-independent way seems to generalize well to new users. \begin{figure} \centering \includegraphics[width=\columnwidth]{images/comparison_freq_euclid} \caption{Cumulative frequencies of pairs of signatures within a given distance. For the genuine-forgery pairs, the y axis shows the fraction of pairs that are \textit{closer} than a given euclidean distance. For genuine-genuine pairs the y axis shows the fraction of pairs that are \textit{further} than a given distance, to show the overlap with the genuine-forgery pairs.} \label{fig:distances} \end{figure} \begin{figure} \centering \includegraphics[scale=0.35]{images/50_genuine} \caption{2D t-SNE projection of the embedding space $\phi(.)$ for the genuines signatures of the 50 authors in the validation set. Each point refers to one signature, and different users are shown in different colors} \label{fig:tsne_genuine} \end{figure} \begin{figure} \centering \includegraphics[width=\columnwidth]{images/50_genuine_and_forg} \caption{2D t-SNE projection of the embedding space $\phi(.)$ for the genuine signatures and skilled forgeries of the 50 authors in the validation set. Points that refer to skilled forgeries are shown with a black border. The zoomed area on the left shows a region where three skilled forgeries (on the top-left) are close to four genuine signatures for user 394 in the GPDS dataset. The zoomed area on the right shows three skilled forgeries for the same user that are far from the genuine signatures in the embedding space} \label{fig:tsne_genuine_fogery} \end{figure} Another aspect that we investigated is how the signatures from the users in the validation set are represented in the embedding layer of the CNN. For this analysis, we took one of the models (AlexNet\_2048, at layer FC2), obtained the representations for signatures of all 50 users in the validation set, and analyzed this representation. We started by analyzing how well separated are the signatures from each user in this feature space, as well as compared to skilled forgeries targeted to the users. To do so, we measured the euclidean distance between genuine signatures of the same user, genuine signatures from different users (i.e. a genuine signature vs. a random forgery), and the distance between pairs of a genuine signature and a skilled forgery made for this user. Figure \ref{fig:distances} plots the cumulative frequency of pairs of signatures within a given distance, that is, the fraction of pairs that are closer than a given euclidean distance in the embedding space. For the genuine-genuine pairs, we show the inverse of the cumulative frequency (i.e. the fraction of pairs further than a given distance), to better show the overlap between the curves. For a particular distance, the y axis is the expected False Rejection Rate (on the genuine-genuine pairs) and False Acceptance Rate (on the genuine-forgery pairs) if we used a distance-based classifier, with a single genuine signature as reference. We can see that in the space projected by the CNN, the genuine signatures from different users very well separated: there is a very small overlap between the curves of genuine-genuine pairs and genuine-random forgery pairs. A similar behavior can be seem with the genuine-skilled forgeries pairs, although the curves overlap more in this case. To further analyze how the signatures are dispersed in this representation space, we used the t-SNE algorithm \cite{van2008visualizing} to project the samples from $\mathbb{R}^{2048}$ to $\mathbb{R}^{2}$. This allows us to inspect the local structure present in this higher dimensionality representation. Figure \ref{fig:tsne_genuine} shows the result of this projection of the genuine signatures of the 50 users in the validation set. Each point is a signature, and each color represent a different user. We can see that the signatures from different users are very well separated in this representation, even though no samples from these authors were used to train the CNN, which suggests that the learned representation is not specific to the writers in the training set, but generalize to other users. Figure \ref{fig:tsne_genuine_fogery} shows the projection of both the genuine signatures and skilled forgeries for these 50 users. We can see that the skilled forgeries are more scattered around, and for several users, the skilled forgeries are close to the representation of the genuine signatures. \begin{table*} \centering \caption{Detailed performance of the WD classifiers on the GPDS dataset (Errors and Standard deviations in \%)} \label{table:results} \resizebox{\textwidth}{!}{% \begin{tabular}{llllrrrrrr} \toprule Dataset& \begin{tabular}[x]{@{}c@{}}\#samples\\per user\end{tabular} & Model & Classifier & FRR & FAR\textsubscript{random} & FAR\textsubscript{skilled} & EER\textsubscript{global threshold} & EER\textsubscript{user-thresholds} & Mean AUC \\ \midrule GPDS-160 & 5 & AlexNet\_2048 & Linear SVM & 32.12 (+-1.21) & 0.01 (+-0.02) & 0.89 (+-0.13) & 8.24 (+-0.54) & 4.25 (+-0.37) & 0.9845 (+-0.0018) \\ & & AlexNet\_2048\textsubscript{reduced} & SVM (RBF) & 26.56 (+-1.01) & 0.00 (+-0.00) & 1.03 (+-0.14)& 6.99 (+-0.26) & 3.83 (+-0.33) & 0.9861 (+-0.0015) \\ & 14 & AlexNet\_2048 & Linear SVM & 10.41 (+-0.72) & 0.01 (+-0.02) & 2.77 (+-0.17) & 5.66 (+-0.22) & 3.37 (+-0.13) & 0.9894 (+-0.0008) \\ & & \textbf{AlexNet\_2048\textsubscript{reduced}} & \textbf{SVM (RBF)} & \textbf{6.75 (+-0.42)} & \textbf{0.00 (+-0.00)} & \textbf{3.46 (+-0.12)} & \textbf{4.85 (+-0.11)} & \textbf{2.74 (+-0.18)} & \textbf{0.9913 (+-0.0009)} \\ GPDS-300 & 5 & AlexNet\_2048 & Linear SVM & 31.48 (+-1.32) & 0.00 (+-0.00) & 1.87 (+-0.15) & 9.39 (+-0.44) & 5.41 (+-0.40) & 0.9760 (+-0.0017) \\ & & AlexNet\_2048\textsubscript{reduced} &SVM (RBF) & 26.33 (+-0.99) & 0.00 (+-0.00) & 1.74 (+-0.11) & 8.04 (+-0.20) & 4.53 (+-0.14) & 0.9817 (+-0.0008) \\ & 14 & AlexNet\_2048 &Linear SVM & 10.42 (+-0.58) & 0.00 (+-0.01) & 4.73 (+-0.19) & 7.00 (+-0.15) & 4.17 (+-0.25) & 0.9823 (+-0.0012) \\ & & \textbf{AlexNet\_2048\textsubscript{reduced}} &\textbf{SVM (RBF)} & \textbf{6.55 (+-0.25)} & \textbf{0.00 (+-0.01)} & \textbf{5.13 (+-0.20)} & \textbf{5.75 (+-0.19)}& \textbf{3.47 (+-0.16)} & \textbf{0.9871 (+-0.0007)}\\ \bottomrule \end{tabular} } \end{table*} \begin{table} \centering \caption{Comparison with state-of-the art on the GPDS dataset (errors and standard deviations in \%)} \label{table:soa_gpds} \resizebox{\columnwidth}{!}{% \begin{tabular}{llllr} \toprule Reference & Dataset& \begin{tabular}[x]{@{}c@{}}\#samples\\per user\end{tabular} &Features \& (Classifier) & EER\\ \midrule Vargas et al \cite{vargas_off-line_2010} &GPDS-100 & 5 &Wavelets (SVM) & 14.22 \\ Vargas et al \cite{vargas_off-line_2011} & GPDS-100 &10 &LBP, GLCM (SVM)& 9.02 \\ Hu and Chen \cite{hu_offline_2013}& GPDS-150 &10 &LBP, GLCM, HOG (Adaboost) & 7.66\\ Yilmaz \cite{yilmaz_offline_2015} & GPDS-160 &12&LBP (SVM) & 9.64\\ Yilmaz \cite{yilmaz_offline_2015} &GPDS-160 &12&LBP, HOG (Ensemble of SVMs)& 6.97\\ Hafemann et al \cite{hafemann_ijcnn_2016} & GPDS-160 & 14 & WI-learned with a CNN (SVM) & 10.70 \\ \midrule \textbf{Present work} &\textbf{GPDS-160} & \textbf{5} &\textbf{WI-learned with a CNN (SVM)}& \textbf{3.83 (+- 0.33)}\\ \textbf{Present work} &\textbf{GPDS-160} & \textbf{14} &\textbf{WI-learned with a CNN (SVM)}& \textbf{2.74 (+- 0.18)}\\ \textbf{Present work} &\textbf{GPDS-300} & \textbf{5} &\textbf{WI-learned with a CNN (SVM)}& \textbf{4.53 (+- 0.14)}\\ \textbf{Present work} &\textbf{GPDS-300} & \textbf{14} &\textbf{WI-learned with a CNN (SVM)}& \textbf{3.47 (+- 0.16)}\\ \bottomrule \end{tabular} } \end{table} \begin{figure} \centering \includegraphics[width=\columnwidth]{images/fine_comparison} \caption{Details of a genuine signature (top), and a skilled forgery (bottom) that are mapped close in the embedding space $\phi(.)$} \label{fig:closeup} \end{figure} The zoomed-in area in figure \ref{fig:tsne_genuine_fogery} shows skilled forgeries made for a particular user that were represented close to genuine signatures from this user. We can see that these forgeries have a close resemblance to the genuine signatures of the user in its overall shape. This is further examined in figure \ref{fig:closeup}, where we take a genuine signature and a skilled forgery from this user, that were close in the embedding space. We can notice that the overall shape of the skilled forgery is similar to the genuine signature, but looking in the details of the strokes we can see that the line quality of the skilled forgery is much worse. We have noticed the same behavior with other users / signatures. This suggests that the features learned by the network are useful in distinguishing the signatures in an ``overall shape'', but do not capture important properties of forgeries, such as the quality of the pen strokes, and therefore are particularly not discriminative to slowly-traced forgeries. Table \ref{table:results} shows the detailed result of the experiments in the exploitation set. We noticed that the performance was very good in terms of equal error rates, but that the global decision thresholds from the validation set are only effective in a few situations - in particular, when using the same number of samples as used in the validation set, where the threshold was selected. We also notice that the performance using a global threshold is significantly worse than using per-user thresholds. Note that the values of EER refer to the scenario where the decision threshold is optimally selected, which in itself is a hard task (given the low number of samples per user), and which we did not explore in this paper. Finally, table \ref{table:soa_gpds} compares our best results (using EER\textsubscript{user-thresholds}) with the state-of-the-art. We noticed a big drop in classification errors (as measured by Equal Error Rate) compared to the literature, even when using only 5 samples per user for the Writer-Dependent training. \section{Conclusions} In this work, we presented a detailed analysis of different architectures for learning representations for offline signature verification. We showed that features learned in a writer-independent format can be very effective for signature verification, achieving a large improvement of state-of-the-art performance in the GPDS-160 dataset, with 2.74\% Equal Error Rate compared to 6.97\% reported in the literature. We also showed that writer-dependent classifiers trained with these features can perform very well even with limited number of samples per user (e.g. 5 samples) and linear classifiers. Our analysis of the signature representations showed that the learned features are mostly useful to distinguish signatures on a ``general appearance'' instead of finer details. This make these features relevant for distinguishing random forgeries and skilled forgeries that are made with quick motion (but do not perfectly capture the overall aspect of the genuine signature). On the other hand, it makes these features less discriminant to slowly-traced skilled forgeries, where the forgery looks like a genuine signature in the overall shape, but has a poor line quality. Future work can investigate the combination of such features with features particularly targeted to discriminate the quality of pen strokes. \section*{Acknowledgment} This research has been supported by the CNPq grant \#206318/2014-6. \bibliographystyle{IEEEtran}
{'timestamp': '2016-08-29T02:04:15', 'yymm': '1607', 'arxiv_id': '1607.04573', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04573'}
arxiv
\section{Introduction}\label{sec:intro} A major challenge towards self-organizing networks (SON) is the joint optimization of multiple SON use cases by coordinately handling multiple configuration parameters. Widely studied SON use cases include coverage and capacity optimization (CCO), mobility load balancing (MLB) and mobility robustness optimization (MRO)\cite{3GPP36902}.\cosl{We need a reference here} However, most of these works study an isolated single use case and ignore the conflicts or interactions between the use cases \cite{giovanidis2012dist,razavi2010self}. In contrast, this paper considers a joint optimization of two strongly coupled use cases: CCO and MLB. The objective is to achieve a good trade-off between coverage and capacity performance, while ensuring a load-balanced network. The SON functionalities are usually implemented at the network management layer and are designed to deal with \lq\lq long-term\rq\rq \ network performance. Short-term optimization of individual users is left to lower layers of the protocol stack. To capture long-term global changes in a network, we consider a cluster-based network scenario, where users served by the same base station (BS) with similar SINR distribution are adaptively grouped into clusters. Our objective is to jointly optimizing the following variables: \begin{itemize} \item Cluster-based BS assignment and power allocation. \item BS-based antenna tilt optimization and power allocation. \end{itemize} The joint optimization of assignment, antenna tilts, and powers is an inherently challenging problem. The interference and the resulting performance measures depend on these variables in a complex and intertwined manner. Such a problem, to the best of the authors' knowledge, has been studied in only a few works. For example, in \cite{klessig2012improving} a problem of jointly optimizing antenna tilt and cell selection to improve the spectral and energy efficiency is stated, however, the solution derived by a structured searching algorithm may not be optimal. In this paper, we propose a robust algorithmic framework built on a utility model, which enables fast and near-optimal uplink solutions and sub-optimal downlink solutions\cosl{Do we know that this is near-optimal?} by exploiting three properties: 1) the monotonic property and fixed point of the monotone and strictly subhomogenoues (MSS) functions \footnote{Many literatures use the term {\it interference function} for the functions satisfy three condotions, positivity, monotonicity and scalability \cite{yates95}. Positivity is shown to be a consequence of the other two properties \cite{leung2004convergence}, and we use the term {\it strctly subhomogeneous} in place of scalable from a constraction mapping point of view in keeping with some related literature \cite{nuzman2007contraction}.}, 2) decoupled property of the antenna tilt and BS assignment optimization in the uplink network, and 3) uplink-downlink duality. The first property admits global optimal solution with fixed-point iteration for two specific problems: utility-constrained power minimization and power-constrained max-min utility balancing \cite{vucic2011fixed,stanczak2009fundamentals,schubert2012interference,yates95}. The second and third properties enable decomposition of the high-dimensional optimization problem, such as the joint beamforming and power control proposed in \cite{BocheDuality06,schubert2005iterative,huang2013joint,he2012multi}. Our distinct contributions in this work can be summarized as follows:\\ 1) We propose a max-min utility balancing algorithm for capacity-coverage trade-off optimization over a joint space of antenna tilts, BS assignments and powers. The utility defined as a convex combination of the average SINR and the worst-case SINR implies the balanced performance of capacity and coverage. Load balancing is improved as well due to a uniform distribution of the interference among the BSs.\\ 2) The proposed utility is formulated based on the MSS functions, which allows us to find the optimal solution by applying fixed-point iterations.\\ 3) Note that antenna tilts are BS-specific variables, while assignments are cluster-specific, we develop two optimization problems with the same objective functions, formulated either as a problem of per-cluster variables or as a problem of per-base variables. We propose a two-step optimization algorithm in the uplink to iteratively optimize the per BS variables (antenna tilts and BS power budgets) and the cluster-based variables (assignments and cluster power). Since both problems aim at optimizing the same objective function, the algorithm is shown to be convergent.\\ 4) The decoupled property of antenna tilt and assignment in the uplink decomposes the high-dimensional optimization problem and enables more efficient optimization algorithm. We then analyze the uplink-downlink duality by using the Perron-Frobenius theory\cite{meyer2000matrix}, and propose an efficient sub-optimal solution in the downlink by utilizing optimized variables in the dual uplink. \section{System Model}\label{sec:Model} We consider a multicell wireless network composed of a set of BSs $\set{N}:=\{1,\ldots, N\}$ and a set of users $\set{K}:=\{1,\ldots, K\}$. Using fuzzy C-means clustering algorithm \cite{bezdek1984fcm}, we group users with similar SINR distributions\footnote{We assume the Kullback-Leibler divergence as the distance metric.} and served by the same BS into clusters. The clustering algorithm is beyond the scope of this paper. Let the set of user clusters be denoted by $\set{C}:=\{1,\ldots,C\}$, and let $\bm{A}$ denote a $C\times K$ binary user/cluster assignment matrix whose columns sum to one. The BS/cluster assignment is defined by a $N\times C$ binary matrix $\bm{B}$ whose columns also sum to one. Throughout the paper, we assume a frequency flat channel. The average/long-term downlink path attenuation between $N$ BSs and $K$ users are collected in a channel gain matrix $\bm{H}\in {\field{R}}^{N\times K}$. We introduce the cross-link gain matrix $\bm{V}\in{\field{R}}^{K\times K}$, where the entry $v_{lk}(\theta_j)$ is the cross-link gain between user $l$ served by BS $j$, and user $k$ served by BS $i$, i.e., between the transmitter of the link $(j, l)$ and the receiver of the link $(i, k)$. Note that $v_{lk}(\theta_j)$ depends on the antenna downtilt $\theta_j$. Let the BS/user assignment matrix be denoted by $\bm{J}$ so that we have $\bm{J}:=\bm{B}\bm{A}\in\{0,1\}^{N\times K}$, and $\bm{V}:=\bm{J}^T\bm{H}$. We denote by $\bm{r}:=[r_1, \ldots, r_N]^T$, $\bm{q}:=[q_1, \ldots, q_C]^T$ and $\bm{p}:=[p_1, \ldots, p_K]^T$the BS transmission power budget, the cluster power allocation and the user power allocation, respectively. % \subsection{Inter-cluster and intra-cluster power sharing factors} \label{subsec:powFactor} We introduce the inter-cluster and intra-cluster power sharing factors to enable the transformation between two power vectors with different dimensions. Let $\bm{b}:=[b_1, \ldots, b_C]^T$ denote the serving BSs of clusters $\{1, \ldots, C\}$. We define the vector of the inter-cluster power sharing factors to be $\bm{\beta}:=[\beta_1, \ldots, \beta_C]^T$, where $\beta_c:=q_c/r_{b_c}$. With the BS/cluster assignment matrix $\bm{B}$, we have $\bm{q}:=\ma{B}_{\ve{\beta}}^T \bm{r}$, where $\ma{B}_{\ve{\beta}}:=\bm{B}\mathop{\mathrm{diag}}\{\bm{\beta}\}$. Since users belonging to the same cluster have similar SINR distribution, we allocate the cluster power uniformly to the users in the cluster. The intra-cluster sharing factors are represented by $\bm{\alpha}:=[\alpha_1, \ldots, \alpha_K]^T$ with $\alpha_k=1/|\set{K}_{c_k}|$ for $k\in\set{K}$, where $\set{K}_{c_k}$ denotes the set of users belonging to cluster $c_k$, while $c_k$ denotes the cluster with user $k$. We have $\bm{p}:=\ma{A}_{\ve{\alpha}}^T\bm{q}$, where $\ma{A}_{\ve{\alpha}}:=\bm{A}\mathop{\mathrm{diag}}\{\bm{\alpha}\}$. The transformation between BS power $\bm{r}$ and user power $\bm{p}$ is then $\bm{p}:=\bm{T}\bm{r}$ where the transformation matrix $\bm{T}:=\ma{A}_{\ve{\alpha}}^T\ma{B}_{\ve{\beta}}^T$. % \subsection{Signal-to-interference-plus-noise ratio}\label{subsec:SINR} Given the cross-link gain matrix $\bm{V}$, the downlink SINR of the $k$th user depends on all powers and is given by \begin{equation} \operator{SINR}_k^{(\text{d})}:=\frac{p_k \cdot v_{kk}(\theta_{n_k})}{\sum_{l\in\set{K}\setminus k} p_l \cdot v_{lk}(\theta_{n_l})+\sigma_k^2}, k\in\set{K} \label{eqn:DL_SINR} \end{equation} where $n_k$ denotes the serving BS of user $k$, $\sigma_k^2$ denotes the noise power received in user $k$. Likewise, the uplink SINR is \begin{equation} \operator{SINR}_k^{(\text{u})}:=\frac{p_k \cdot v_{kk}(\theta_{n_k})}{\sum_{l\in\set{K}\setminus k} p_l \cdot v_{kl}(\theta_{n_k})+\sigma_k^2}, k\in\set{K} \label{eqn:UL_SINR} \end{equation} % Assuming that there is no self-interference, the cross-talk terms can be collected in a matrix \begin{equation} [\tilde{\ma{V}}]_{lk}:= \begin{cases} v_{lk}(\theta_{n_l}), & l\neq k\\ 0, & l=k \end{cases}. \label{eqn:PsiMat} \end{equation} Thus the downlink interference received by user $k$ can be written as $I_k^{(\text{d})}:=[\tilde{\bm{V}}^T\bm{p}]_k$, while the uplink interference is given by $I_k^{(\text{u})}:=[\tilde{\bm{V}}\bm{p}]_k$. A crucial property is that the uplink SINR of user $k$ depends on the BS assignment $n_k$ and the single antenna tilt $\theta_{n_k}$ alone, while the downlink SINR depends on the BS assignment vector $\bm{n}:=[n_1,\ldots, n_K]^T$, and the antenna tilt vector $\bm{\theta}:=[\theta_1, \ldots, \theta_N]^T$. The decoupled property of uplink transmission has been widely exploited in the context of uplink and downlink multi-user beamforming \cite{BocheDuality06}\cosl{Reference} and provides a basis for the optimization algorithm in this paper. % The notation used in this paper is summarized in Table \ref{tab:CovCap_notation}. \begin{table}[t] \centering \caption{NOTATION SUMMARY} \begin{tabular}{|c|c|} \hline ${\emenge{N}}$ & set of BSs \\ ${\emenge{K}}$ & set of users \\ ${\emenge{C}}$ & set of user clusters\\ $\bm{A}$ & cluster/user assignment matrix\\ $\bm{B}$ & BS/cluster assignment matrix\\ $\bm{J}$ & BS/user assignment matrix\\ $c_k$ & cluster that user $k$ is subordinated to\\ ${\emenge{K}}_{c}$ & set of users subordinated to cluster $c$\\ $\bm{H}$ & channel gain matrix\\ $\bm{V}$ & interference coupling matrix\\ $\tilde{\bm{V}}$ & interference coupling matrix without intra-cell interference\\ $\tilde{\bm{V}}_{\bm{b}}$ & interference coupling matrix depending on BS assignments $\bm{b}$\\ $\tilde{\bm{V}}_{\bm{\theta}}$ & interference coupling matrix depending on antenna tilts $\bm{\theta}$\\ $\bm{r}$ & BS power budget vector\\ $\bm{q}$ & cluster power vector\\ $\bm{p}$ & user power vector\\ $\bm{\alpha}$ & intra-cluster power sharing factors\\ $\bm{\beta}$ & inter-cluster power sharing factors\\ $\bm{A}_{\bm{\alpha}}$ & transformation from $\bm{q}$ to $\bm{p}$, $\bm{p}:=\bm{A}_{\bm{\alpha}}^T\bm{q}$\\ $\bm{B}_{\bm{\beta}}$ & transformation from $\bm{r}$ to $\bm{q}$, $\bm{q}:=\bm{B}_{\bm{\beta}}^T\bm{r}$\\ $\bm{T}$ & transformation from $\bm{r}$ to $\bm{p}$, $\bm{p}:=\bm{T}\bm{r}$\\ $\bm{\theta}$ & BS antenna tilt vector\\ $\bm{b}$ & serving BSs of clusters\\ $b_c$ & serving BS of cluster $c$\\ $\bm{n}$ & serving BSs of the users\\ $n_k$ & serving BS of user $k$\\ $\bm{\sigma}$ & noise power vector\\ $P^{\text{max}}$ & sum power constraint\\ \hline \end{tabular} \label{tab:CovCap_notation} \end{table} \section{Utility Definition and Problem Formulation}\label{sec:ProbForm} As mentioned, the objective is a joint optimization of coverage, capacity and load balancing. We capture coverage by the worst-case SINR, while the average SINR is used to represent capacity. A cluster-based utility $U_c(\bm{\theta},\bm{r},\bm{q},\bm{b})$ is introduced as the combined function of the worst-case SINR and average SINR, depending on BS power allocation $\bm{r}$, antenna downtilt $\bm{\theta}$ , cluster power allocation $\bm{q}$ and BS/cluster assignment $\bm{b}$.\footnote{The reader should note that user-specific variables $(\bm{p},\bm{n})$ can be derived directly from cluster-specific variables $\bm{q}$ and $\bm{b}$, provided that cluster/user assignment $\bm{A}$ and intra-cluster power sharing factor $\bm{\alpha}$ are given.} To achieve the load balancing by distributing the clusters to the BSs such that their utility targets can be achieved \footnote {The assignment of clusters also distributes the interference among the BSs.}, we formulate the following objective $$\max_{(\bm{r},\bm{\theta},\bm{q},\bm{b})}\min_{c\in\set{C}} \frac{U_c(\bm{r},\bm{\theta},\bm{q},\bm{b})}{\gamma_c}$$ where $\gamma_c$ is the predefined utility target for cluster $c$. The BS variables $(\bm{r},\bm{\theta})$ and cluster variables $(\bm{q}, \bm{b})$ are optimized by iteratively solving\\ 1) Cluster-based BS assignment and power allocation $\max_{(\bm{q},\bm{b})}\max_{c\in\set{C}} U_c(\bm{q},\bm{b})/\gamma_c$ given the fixed $(\hat{\bm{r}},\hat{\bm{\theta}})$ \\ 2) BS-based antenna tilt optimization and power allocation $\max_{(\bm{r},\bm{\theta})}\max_{c\in\set{C}} U_c(\bm{r},\bm{\theta})/\gamma_c$ given the fixed $(\hat{\bm{q}},\hat{\bm{b}})$. In the following we introduce the utility definition and problem formulation for the cluster-based and the BS-based problems respectively. We start with the problem statement and algorithmic approaches for the uplink. We then discuss the downlink in Section \ref{sec:Duality}. % \subsection{Cluster-Based BS Assignment and Power Allocation}\label{subsec:clusterOpt} Assume the per-BS variables $(\hat{\bm{r}}, \hat{\bm{\theta}})$ are fixed, let the interference coupling matrix depending on BS assignment $\bm{b}$ in \eqref{eqn:PsiMat} be denoted by $\V_{\ve{b}}$. We first define two utility functions indicating capacity and coverage per cluster respectively, then we introduce the joint utility as a combination of the capacity and coverage utility. After that we define the cluster-based max-min utility balancing problem based on the joint utility. % \subsubsection{Average SINR Utility (Capacity)}\label{subsubsec:LB_A} With the intra-cluster power sharing factor introduced in Section \ref{subsec:powFactor}, we have $\bm{p}:=\ma{A}_{\ve{\alpha}}^T \bm{q}$. Define the noise vector $\bm{\sigma}:=[\sigma_1^2, \ldots, \sigma_K^2]^T$, the average SINR of all users in cluster $c$ is written as \begin{align} \bar{U}_c^{(\text{u},1)}&(\bm{q}, \bm{b}) := \frac{1}{|\set{K}_c|} \sum_{k\in\set{K}_c}\operator{SINR}_k^{(\text{u})}\nonumber\\ &= \frac{1}{|\set{K}_c|} \sum_{k\in\set{K}_c}\frac{q_c \alpha_k v_{kk}}{\left[\V_{\ve{b}} \ma{A}_{\ve{\alpha}}^T \bm{q}+\bm{\sigma}\right]_k}\nonumber\\ &\geq \frac{1}{|\set{K}_c|}\frac{q_c \sum_{k\in\set{K}_c} \alpha_k v_{kk}}{\sum_{k\in\set{K}_c} \left[\V_{\ve{b}} \ma{A}_{\ve{\alpha}}^T \bm{q}+\bm{\sigma}\right]_k} =U_c^{(\text{u},1)}(\bm{q}, \bm{b}) \label{eqn:CL_cap_1} \end{align} The uplink capacity utility of cluster $c$ denoted by $U_c^{(\text{u},1)}$ is measured by the ratio between the total useful power and the total interference power received in the uplink in the cluster. Utility $U_c^{(\text{u},1)}$ is used instead of $\bar{U}_c^{(\text{u},1)}$ because of two reasons: First, it is a lower bound for the average SINR. Second, it has certain monotonicity properties (introduced in Section \ref{sec:OPAlgor}) which are useful for optimization. Introducing the cluster coupling term $\overline{\ma{G}}_{\ve{b}}^{(\text{u})}:=\bm{\Psi}\bm{A}\V_{\ve{b}}\ma{A}_{\ve{\alpha}}^T$, where $\bm{\Psi}:=\mathop{\mathrm{diag}}\{|\set{K}_1|/g_1, \ldots, |\set{K}_c|/g_C\}$ and $g_c:=\sum_{k\in \set{K}_c}\alpha_k v_{kk}$ for $c\in\set{C}$; and the noise term $\overline{\bm{z}}:=\bm{\Psi}\bm{A}\bm{\sigma}$, the capacity utility is simplified as \begin{align} U_c^{(\text{u},1)}(\bm{q}, \bm{b})&:=\frac{q_c}{\set{J}_c^{(\text{u},1)}(\bm{q}, \bm{b})}\label{eqn:CL_cap_2}\\ \mbox{where } \set{J}_c^{(\text{u},1)}(\bm{q}, \bm{b})&:=\left[\overline{\ma{G}}_{\ve{b}}^{(\text{u})}\bm{q}+\overline{\bm{z}}\right]_c. \label{eqn:CL_cap_inter} \end{align} % \subsubsection{Worst-Case SINR Utility (Coverage)} Roughly speaking, the coverage problem arises when a certain number of the SINRs are lower than the predefined SINR threshold. Thus, improving the coverage performance is equivalent to maximizing the worst-case SINR such that the worst-case SINR achieves the desired SINR target. We then define the uplink coverage utility for each cluster as \begin{align} U_c^{(\text{u},2)}(\bm{q},\bm{b})&:=\min_{k\in\set{K}_c}\operator{SINR}_k^{(\text{u})}=\min_{k\in\set{K}_c} \frac{q_c\alpha_k v_{kk}}{\left[\V_{\ve{b}} \ma{A}_{\ve{\alpha}}^T \bm{q}+\bm{\sigma}\right]_k}\nonumber\\ &= \frac{q_c}{\max_{k\in\set{K}_c}\left[ \bm{\Phi}\V_{\ve{b}} \ma{A}_{\ve{\alpha}}^T \bm{q}+\bm{\Phi}\bm{\sigma}\right]_k} \label{eqn:CL_cov_1} \end{align} where $\bm{\Phi}:=\mathop{\mathrm{diag}}\{1/\alpha_1 v_{11}, \ldots, 1/\alpha_K v_{KK}\}$. We define a $C \times K$ matrix $\bm{X}:=[\bm{x}_1|\ldots|\bm{x}_C]^T$, where $\bm{x}_c:=\bm{e}^j_K$ and $\bm{e}^j_i$ denotes an $i$-dimensional binary vector which has exact one entry (the j-th entry) equal to 1. Introducing the term $\underline{\ma{G}}_{\ve{b}}^{(\text{u})}:=\bm{\Phi}\V_{\ve{b}} \ma{A}_{\ve{\alpha}}^T$, and the noise term $\underline{\bm{z}}:=\bm{\Phi}\bm{\sigma}$, the coverage utility is given by \begin{align} U_c^{(\text{u},2)}(\bm{q},\bm{b})&:=\frac{q_c}{\set{J}_c^{(\text{u},2)}(\bm{q}, \bm{b})}\label{eqn:CL_cov_2}\\ \mbox{where } \set{J}_c^{(\text{u},2)}(\bm{q}, \bm{b}) & := \max_{\bm{x}_c:=\bm{e}_K^j, j\in\set{K}_c} \left[\bm{X}\underline{\ma{G}}_{\ve{b}}^{(\text{u})}\bm{q}+\bm{X}\underline{\bm{z}}\right]_c. \label{eqn:CL_cov_inter} \end{align} % \subsubsection{Joint Utility and Cluster-Based Max-Min Utility Balancing}\label{eqn:LB_maxmin} The joint utility $U_c^{(\text{u})}(\bm{q}, \bm{b})$ is defined as \begin{align} U_c^{(\text{u})}(\bm{q}, \bm{b})&:=\frac{q_c}{\set{J}_c^{\ul}(\bm{q}, \bm{b})}\label{eqn:LB_utility_1}\\ \mbox{where }\set{J}_c^{\ul}(\bm{q}, \bm{b})&:= \mu\set{J}_c^{(\text{u},1)}(\bm{q}, \bm{b})+(1-\mu)\set{J}_c^{(\text{u},2)}(\bm{q}, \bm{b})\label{eqn:LB_utility_2}. \end{align} In other words, the joint interference function $\set{I}_c^{(\text{u})}$ is a convex combination of $\set{I}_c^{(\text{u},1)}$ in \eqref{eqn:CL_cap_inter} and $\set{I}_c^{(\text{u},2)}$ in \eqref{eqn:CL_cov_inter}. The cluster-based power-constrained max-min utility balancing problem in the uplink is then provided by \begin{problem}[Cluster-Based Utility Balancing] \begin{equation} C^{(\text{u})}(P^{\text{max}})=\max_{\bm{q}\geq 0, \bm{b}\in \set{N}^C} \min_{c\in\set{C}} \frac{U_c^{(\text{u})}(\bm{q}, \bm{b})}{\gamma_c}, \mbox{s.t. } \|\bm{q}\|\leq P^{\text{max}} \label{eqn:LB_OP} \end{equation} Here, $\|\cdot\|$ is an arbitrary monotone norm, i.e., $\bm{q}\leq\bm{q}'$ implies $\|\bm{q}\|\leq\|\bm{q}'\|$, $P^{\text{max}}$ denotes the total power constraint. According to the joint utility in \eqref{eqn:LB_utility_1},\eqref{eqn:LB_utility_2}, the algorithm optimizes the performance of capacity when we set the tuning parameter $\mu=1$ (utility is equivalent to the capacity utility in \eqref{eqn:CL_cap_2}), while with $\mu=0$ it optimizes the performance of coverage (utility equals to the coverage utility in \eqref{eqn:CL_cov_2}). By tuning $\mu$ properly, we can achieve a good trade-off between the performance of coverage and capacity. \label{prob:LB} \end{problem} % \subsection{BS-Based Antenna Tilt Optimization and Power Allocation}\label{subsec:AO} Given the fixed $(\hat{\bm{q}},\hat{\bm{b}})$, we compute the intra-cluster power allocation factor $\bm{\beta}$, given by $\beta_c:=\hat{q}_c/\sum_{c\in\set{C}_{b_c}}\hat{q}_c$ for $c\in\set{C}$. We denote the cross-link coupling matrix depending on $\bm{\theta}$ by $\V_{\ve{\theta}}$. In the following we formulate the BS-based max-min utility balancing problem such that it has the same physical meaning as the problem stated in \eqref{eqn:LB_OP}. We then introduce the BS-based joint utility interpreted by $(\bm{r}, \bm{\theta})$. \subsubsection{BS-Based Max-Min Utility Balancing}\label{subsubsec:AO_maxmin} To be consistent with our objective function $C^{(\text{u})}(P^{\text{max}})$ in \eqref{eqn:LB_OP}, we transform the cluster-based optimization problem to the BS-based optimization problem: % \begin{problem}[BS-Based Utility Balancing] \begin{align} C^{(u)}&(P^{\text{max}})=\max\limits_{\bm{r}\geq 0, \bm{\theta}\in\Theta^N} \min\limits_{c\in\set{C}} \frac{U_c^{(\text{u})}(\bm{r},\bm{\theta})}{\gamma_c}\nonumber\\ &=\max\limits_{\bm{r}\geq 0, \bm{\theta}\in\Theta^N} \min\limits_{n\in\set{N}}\left(\min\limits_{c\in\set{C}_n}\frac{U_c^{(\text{u})}(\bm{r},\bm{\theta})}{\gamma_c}\right)\nonumber\\ & = \max\limits_{\bm{r}\geq 0, \bm{\theta}\in\Theta^N} \min\limits_{n\in\set{N}} \widehat{U}_n^{(\text{u})}(\bm{r},\bm{\theta}), \mbox{ s.t. } \|\bm{r}\|\leq P^{\text{max}} \label{eqn:maxmin_AO} \end{align} \label{prob:AO} \end{problem} where $\Theta$ denotes the predefined space for antenna tilt configuration. \subsubsection{BS-Based Joint Utility}\label{subsubsec:AO_joinyUtility} It is shown in \eqref{eqn:maxmin_AO} that the cluster-based problem is transformed to the BS-based problem by defining \begin{align} \widehat{U}_n^{(\text{u})}(\bm{r},\bm{\theta})&:=\min_{c\in\set{C}_n}\frac{U_c^{(\text{u})}(\bm{r},\bm{\theta})}{\gamma_c}= \frac{r_n}{\widehat{\set{J}}_n^{\ul}(\bm{r}, \bm{\theta})}\label{eqn:AO_utility_1}\\ \widehat{\set{J}}_n^{\ul}(\bm{r}, \bm{\theta}) &:= \max_{c\in\set{C}_n} \frac{\gamma_c}{\beta_c} \set{J}_c^{\ul}(\bm{r}, \bm{\theta}), \label{eqn:AO_utility_2} \end{align} where $\set{J}_c^{\ul}(\bm{r}, \bm{\theta})$ is obtained from $\set{J}_c^{\ul}(\bm{q}, \bm{b})$ in \eqref{eqn:LB_utility_2} by substituting $\bm{q}$ with $\bm{q}:=\ma{B}_{\ve{\beta}}^T\bm{r}$, and $\tilde{\ma{V}}_{\bm{b}}$ with $\tilde{\ma{V}}_{\bm{\theta}}$. Note that \eqref{eqn:AO_utility_1} is derived by applying the inter-cluster sharing factor such that $r_n:=q_c/\beta_c$ for $n=b_c$. Due to lack of space we omit the details of the individual per BS capacity and coverage utilities corresponding to the cluster-based utilities \eqref{eqn:CL_cap_1} and \eqref{eqn:CL_cov_1}. % % % % \section{Optimization Algorithm}\label{sec:OPAlgor} We developed our optimization algorithm based on the fixed-point iteration algorithm proposed by Yates \cite{yates95}, by exploiting the properties of the monotone and strictly subhomogeneous functions. \subsection{MSS function and Fixed-Point Iteration}\label{subsec:contraction} The vector function $\bm{f}: {\field{R}}_+^K\mapsto {\field{R}}_+^K$ of interest has the following two properties: \begin{itemize} \item {\it Monotonicity}: $\bm{x}\leq \bm{y}$ implies $\bm{f}(\bm{x})\leq\bm{f}(\bm{y})$,. \item {\it Strict subhomogeneity}: for each $\alpha>1, \bm{f}(\alpha \bm{x})<\alpha\bm{f}(\bm{x})$. \end{itemize} A function satisfying the above two properties is referred to be {\it monotonic and strict subhomogeneous (MSS)}. When the strict inequality is relaxed to weak inequality, the function is said to be {\it monotonic and subhomogeneous (MS)}. \begin{theorem}\cite{nuzman2007contraction} Suppose that $\bm{f}: {\field{R}}_+^K\mapsto {\field{R}}_+^K$ is MSS and that $\bm{h}=\bm{x}/l(\bm{x})$, where $l:{\field{R}}_+^K \mapsto {\field{R}}_+$ is MS. For each $\theta>0$, there is exactly one eigenvector $\bm{v}$ and the associated eigenvalue $\lambda$ of $\bm{f}$ such that $l(\bm{v})=\theta$. Given an arbitrary $\theta$, the repeated iterations of the function \begin{equation} \bm{g}(\bm{x})=\theta \bm{f}(x)/l(\bm{f(x)}) \label{eqn:fixedpointiteration} \end{equation} converge to a unique fixed point such that $l(\bm{v})=\theta$. \label{Theoremmapping} \end{theorem} The fixed point iteration in \eqref{eqn:fixedpointiteration} is used to obtain the solution of the following max-min utility balancing problem \begin{equation} \max_{\bm{p}}\min_{k\in\set{K}} U_k(\bm{p}), \mbox{ s.t. } \|\bm{p}\|\leq P^{\text{max}} \label{eqn:prob_maxmin_1} \end{equation} where the utility function can be defined as $U_k(\bm{p}):= p_k/f_k(\bm{p})$. \subsection{Joint Optimization Algorithm}\label{subsec:JointOptAlgor} We aim on jointly optimizing both problems, by optimizing $(\bm{q}, \bm{b})$ in Problem \ref{prob:LB} and $(\bm{r},\bm{\theta})$ in Problem \ref{prob:AO} iteratively with the fixed-point iteration. In the following we present some properties that are required to solve the problem efficiently and to guarantee the convergence of the algorithm. \subsubsection{Decoupled Variables in Uplink} In uplink the variables $\bm{b}$ and $\bm{\theta}$ are decoupled in the interference functions \eqref{eqn:LB_utility_2} and \eqref{eqn:AO_utility_2}, i.e., $\set{J}_c^{\ul}(\bm{q}, \bm{b}):=\set{J}_c^{\ul}(\bm{q}, b_c)$ and $\widehat{\set{J}}_n^{\ul}(\bm{r}, \bm{\theta}):=\widehat{\set{J}}_n^{\ul}(\bm{r}, \theta_n)$. Thus, we can decompose the BS assignment (or tilt optimization) problem into sub-problems that can be independently solved in each cluster (or BS), and the interference functions can be modified as functions of the power allocation only: \begin{align} \set{J}_c^{\ul}(\bm{q})&:=\min_{b_c\in\set{N}} \set{J}_c^{\ul}(\bm{q}, b_c)\label{eqn:modi_inter_1}\\ \widehat{\set{J}}_n^{\ul}(\bm{r})&:=\min_{\theta_n\in\Theta} \widehat{\set{J}}_n^{\ul}(\bm{r}, \theta_n) \label{eqn:modi_inter_2} \end{align} \subsubsection{Standard Interference Function} The modified interference function \eqref{eqn:modi_inter_1} and \eqref{eqn:modi_inter_2} are \textit{standard}. Using the following three properties: 1) an affine function $\bm{\set{I}}(\bm{p}):=\bm{V}\bm{p}+\bm{\sigma}$ is standard, 2) if $\bm{\set{I}}(\bm{p})$ and $\bm{\set{I}}'(\bm{p})$ are standard, then $\beta\bm{\set{I}}(\bm{p})+(1-\beta)\bm{\set{I}}'(\bm{p})$ are standard, and 3) If $\bm{\set{I}}(\bm{p})$ and $\bm{\set{I}}'(\bm{p})$ are standard, then $\bm{\set{I}}^{\text{min}}(\bm{p})$ and $\bm{\set{I}}^{\text{max}}(\bm{p})$ are standard, where $\bm{\set{I}}^{\text{min}}(\bm{p})$ and $\bm{\set{I}}^{\text{max}}(\bm{p})$ are defined as $\set{I}_j^{\text{min}}(\bm{p}):=\min\{\set{I}_j(\bm{p}), \set{I}_j'(\bm{p})\}$ and $\set{I}_j^{\text{max}}(\bm{p}):=\max\{\set{I}_j(\bm{p}), \set{I}_j'(\bm{p})\}$ respectively \cite{yates95}, we can easily prove that \eqref{eqn:modi_inter_1} and \eqref{eqn:modi_inter_2} are standard interference functions. Substituting \eqref{eqn:modi_inter_1} and \eqref{eqn:modi_inter_2} in Problem \ref{prob:LB} and Problem \ref{prob:AO}, define $U_c^{(\text{u})}(\bm{q}):=q_c/\set{I}_c^{(\text{u})}(\bm{q})$ and $U_n^{(\text{u})}(\bm{r}):=r_n/\widehat{\set{J}}_n^{\ul}(\bm{r})$, we can write both problems in the general framework of the max-min fairness problem \eqref{eqn:prob_maxmin_1}: \begin{itemize} \item[]Problem 1. $\max_{\bm{q}\geq 0}\min_{c\in\set{C}} U_c^{(\text{u})}(\bm{q})/\gamma_c, \|\bm{q}\|\leq P^{\text{max}}$. \item[]Problem 2. $\max_{\bm{r}\geq 0}\min_{n\in\set{N}} U_n^{(\text{u})}(\bm{r}), \|\bm{r}\|\leq P^{\text{max}}$ \end{itemize} % The property of the decoupled variables in uplink and the property of utilities based on the standard interference functions enable us to solve each problem efficiently with two iterative steps: 1) find optimum variable $b_c$ (or $\theta_n$) for each cluster $c$ (or each BS $n$) independently, 2) solve the max-min balancing power allocation problem with fixed-point iteration. % \subsubsection{Connections between The Two Problems} Problem \ref{prob:LB} and Problem \ref{prob:AO} have the same objective $C^{(\text{u})}(P^{\text{max}})$ as stated in \eqref{eqn:LB_OP} and \eqref{eqn:maxmin_AO}, i.e., given the same variables $(\hat{\bm{q}}, \hat{\bm{b}}, \hat{\bm{r}}, \hat{\bm{\theta}})$, using \eqref{eqn:AO_utility_1}, we have $\min_{c\in\set{C}} U_c^{(\text{u})}/\gamma_c=\min_{n\in\set{N}} \widehat{U}_n^{(\text{u})}$. Both problems are under the same sum power constraint. However, the convergence of the two-step iteration requires two more properties: 1) the BS power budget $\bm{r}$ derived by solving Problem \ref{prob:AO} at the previous step should not be violated by the cluster power allocation $\bm{q}$ found by optimizing Problem \ref{prob:LB}, and 2) when optimizing Problem \ref{prob:AO}, the inter-cluster power sharing factor $\bm{\beta}$ should be consistent with the derived cluster power allocation $\bm{q}$ in Problem \ref{prob:LB}. To fulfill the first requirement, we introduce the per BS power constraint $P_n^{\text{max}}$ for Problem \ref{prob:AO} equivalent to the BS power budget $r_n$ in Problem \ref{prob:LB}. We also propose a scaled version of fixed point iteration similar to the one proposed in \cite{nuzman2007contraction} to iteratively scale the cluster power vector and achieve the max-min utility boundary under per BS power budget constraints, as stated below. \begin{equation} q_c^{(t+1)} =\frac{\gamma_c\set{I}_c^{(\text{u})}(\bm{q}^{(t)})}{\|\bm{B}\bm{\set{I}}^{(\text{u})}(\bm{q}^{(t)}) \oslash {\bm{P}^{\text{max}}}^{(t)}\|_{\infty}} \label{eqn:FP_LB} \end{equation} where $\oslash$ denote the element-wise division of vectors, $\|\cdot\|_{\infty}$ denotes the maximum norm, ${\bm{P}^{\text{max}}}^{(t)}:=\bm{r}^{(t)}$. To fulfill the second requirement, once $\bm{q}^{(n+1)}$ is derived, the power sharing factors $\bm{\beta}$ need to be updated for solving Problem \ref{prob:AO} at the next step, given by \begin{equation} \bm{\beta}^{(n+1)}:=\bm{Q}^{-1}\bm{B}^T\bm{r}^{(n)}, \mbox{where } \bm{Q}=\mathop{\mathrm{diag}}\{\bm{q}^{(n+1)}\} \label{eqn:FP_LB_beta} \end{equation} The scaled fixed-point iteration to optimize Problem \ref{prob:AO} is provided by \begin{equation} r_n^{(t+1)}= \frac{P^{\text{max}}}{\|\bm{\widehat{\set{I}}}^{(\text{u})}(\bm{r}^{(t)})\|}\cdot \widehat{\set{I}}_n^{(\text{u})}(\bm{r}^{(t)}) \label{eqn:FP_AO_1} \end{equation} % The joint optimization algorithm is given in Algorithm \ref{alg:optim-algor}. % \begin{algorithm}[t]\label{alg:optim-algor} \caption{Joint Optimization of Problem \ref{prob:LB} and \ref{prob:AO}} \begin{algorithmic}[1] \STATE broadcast the information required for computing $\bm{V}$, predefined constraint $P^{\text{max}}$ and thresholds $\epsilon_1,\epsilon_2,\epsilon_3$ \STATE arbitrary initial power vector $\bm{q}^{(t)}>0$ and iteration step $t:=0$ \REPEAT[joint optimization of Problem \ref{prob:LB} and \ref{prob:AO}] \REPEAT[fixed-point iteration for every cluster $c\in\set{C}$] \STATE broadcast $\bm{q}^{(t)}$ to all base stations \FOR{all assignment options $b_c \in \set{N}$} \STATE compute $\set{I}_c^{(\text{u})}(\bm{q}^{(t)}, b_c)$ with \eqref{eqn:LB_utility_2} \ENDFOR \STATE compute $\set{I}_c^{(\text{u})}(\bm{q}^{(t)})$ with \eqref{eqn:modi_inter_1} and update $b_c^{(t+1)}$ \STATE update $q_c^{(t+1)}$ with \eqref{eqn:FP_LB} \STATE $t := t+1$ \UNTIL{convergence: $\bigl| q_c^{(t+1)} - q_c^{(t)}\bigr| / q_c^{(t)} \leq \epsilon_1$} \STATE update $\bm{\beta}^{(t)}$ with \eqref{eqn:FP_LB_beta} % \REPEAT[fixed-point iteration for every BS $n\in\set{N}$] \STATE broadcast $\bm{r}^{(t)}$ to all base stations \FOR{all antenna tilt options $\theta_n \in \Theta$} \STATE compute $\widehat{\set{I}}_n^{(\text{u})}(\bm{r}^{(t)}, \theta_n)$ with \eqref{eqn:AO_utility_2} \ENDFOR \STATE compute $\widehat{\set{I}}_n^{(\text{u})}(\bm{r}^{(t)})$ with \eqref{eqn:modi_inter_2} and update $\theta_n^{(t+1)}$ \STATE update $r_c^{(n+1)}$ with \eqref{eqn:FP_AO_1} \STATE $t := t+1$ \UNTIL{convergence: $\bigl| r_n^{(t+1)} - r_n^{(t)}\bigr| / r_n^{(t)} \leq \epsilon_2$} \STATE update ${P_n^{\text{max}}}^{(t)}:=r_n^{(t)}$ \STATE compute $l^{(t+1)}:=\min_{n\in\set{N}} \widehat{U}^{(\text{u})}_n(\bm{r}^{(n+1)})$ \UNTIL{convergence: $|l^{(t+1)}-l^{(t)}|/l^{(t)}\leq\epsilon_3$} \end{algorithmic} \end{algorithm} % \section{Uplink-Downlink Duality}\label{sec:Duality} We state the joint optimization problem in uplink in Section \ref{sec:ProbForm} and propose an efficient solution in Section \ref{sec:OPAlgor} by exploiting the decoupled property of $\bm{V}$ over the variables $\bm{\theta}$ and $\bm{b}$. The downlink problem, due to the coupled structure of $\bm{V}^T$, is more difficult to solve. As extended discussion we want to address the relationship between the uplink and the downlink problem, and to propose a sub-optimal solution for downlink which can be possibly found through the uplink solution. Let us consider cluster-based max-min capacity utility balancing problem in Section \ref{subsubsec:LB_A} as an example. In the downlink the optimization problem is written as \begin{align} \vspace{-0.2em} \max_{\bm{q}, \bm{b}}\min_c &\frac{U_c^{(\text{d},1)}(\bm{q}, \bm{b})}{\gamma_c}, \mbox{s.t. } \|\bm{q}\|_1\leq P^{\text{max}}\nonumber\\ \mbox{where } & U_c^{(\text{d},1)} :=\frac{q_c}{[\bm{\Psi}\bm{A}\V_{\ve{b}}^T\ma{A}_{\ve{\alpha}}^T\bm{q}+\bm{\Psi}\bm{z}^{(\text{d})}]} \label{eqn:LB_dl} \vspace{-0.2em} \end{align} The cluster-based received noise is written as $\bm{z}^{(\text{d})}:=\bm{A}\bm{\sigma}^{(\text{d})}$. In the following we present a virtual dual uplink network in terms of the feasible utility region for the downlink network in \eqref{eqn:LB_dl} via Perron-Frobenius theory, such that the solution of problem \eqref{eqn:LB_dl} can be derived by solving the uplink problem \eqref{eqn:LB_ul} with the algorithm introduced in Section \ref{sec:OPAlgor}. % \begin{proposition} Define a virtual uplink network where the link gain matrix is modified as $\bm{W}_{\bm{b}}:=\mathop{\mathrm{diag}}\{\bm{\alpha}\}\V_{\ve{b}}\mathop{\mathrm{diag}}^{-1}\{\bm{\alpha}\}$, i.e., $w_{lk}:=v_{lk}\frac{\alpha_l}{\alpha_k}$, and the received uplink noise is denoted by $\bm{\sigma}^{(\text{u})}:=[{\sigma^2_1}^{(\text{u})}, \ldots, {\sigma^2_K}^{(\text{u})}]^T$, where ${\sigma_k^2}^{(\text{u})}:=\frac{\Sigma_{\text{tot}}}{|\set{K}_{c_k}|\cdot C}$ for $k\in\set{K}$, and assume $\Sigma_{\text{tot}}:=\|\bm{\sigma}^{(\text{u})}\|_1=\|\bm{\sigma}^{(\text{d})}\|_1$ (which means, the sum noise is equally distributed in clusters, while in each cluster the noise is equally distributed in the subordinate users). The dual uplink problem of problem \eqref{eqn:LB_dl} is given by \begin{align} \vspace{-0.2em} \max_{\bm{q},\bm{b}}\min_c & \frac{U_c^{(\text{u},1)}(\bm{q}, \bm{b})}{\gamma_c}, \mbox{s.t. } \|\bm{q}\|_1\leq P^{\text{max}}\nonumber\\ \mbox{where } & U_c^{(\text{u},1) }:=\frac{q_c}{[\bm{\Psi}\bm{A}\bm{W}_{\bm{b}}\ma{A}_{\ve{\alpha}}^T\bm{q}+\bm{\Psi}\bm{z}^{(\text{u})}]} \label{eqn:LB_ul} \vspace{-0.2em} \end{align} where $\bm{z}^{(\text{u})}:=\bm{A}\bm{\sigma}^{(\text{u})}$. \label{prop:Duality} \end{proposition} \begin{proof} The proof is given in the Appendix. \end{proof} Note that the optimizer $\bm{b}^{\ast}$ for BS assignment in downlink can be equivalently found by minimizing the spectral radius $\bm{\Lambda^{(u)}(\bm{b})}$ in the uplink. Once $\bm{b}^{\ast}$ is found, the associate optimizer for uplink power ${\bm{q}^{(\text{u})}}^{\ast}$ is given as the dominant right-hand eigenvector of matrix $\bm{\Lambda}^{(\text{u})}(\bm{b}^{\ast})$, while the associate optimizer for downlink power ${\bm{q}^{(\text{d})}}^{\ast}$ is given as the dominant right-hand eigenvector of matrix $\bm{\Lambda}^{(\text{d})}(\bm{b}^{\ast})$. Proposition \ref{prop:Duality} provides an efficient approach to solve the downlink problem with two iterative steps (as the one proposed in \cite{BocheDuality06}): 1) for a fixed power allocation $\hat{\bm{q}}$, solve the uplink problem and derive the assignment $\bm{b}^{\ast}$ that associated with the spectral radius of extend coupling matrix $\bm{\Lambda}^{(\text{u})}$, and 2) for a fixed assignment $\hat{\bm{b}}$, update the power $\bm{q}^{\ast}$ as the solution of \eqref{eqn:DL_matrixEqua}. Although we are able to find a dual uplink problem for the downlink problem in \eqref{eqn:LB_dl} with our proposed utility functions \emph{under sum power constraints}, \insl{we are not able to construct a dual network with decoupled properties for the modified problem \emph{under per BS power constraints} \eqref{eqn:FP_LB}. However, numerical experiments show that our approach to the downlink based on the proposed uplink solution does improve the network performance, although the duality does not exactly hold between the downlink problem and our proposed uplink problem under the per BS power constraints.} % % \section{Numerical Results}\label{sec:Simu} We consider a real-world urban scenario based on a pixel-based mobility model of realistic collection of BS locations and pathloss model for the city of Berlin. The data was assembled within the EU project MOMENTUM and is available at \cite{MOMENTUM}. We select 15 tri-sectored BS in the downtown area. Users are uniformly distributed and are clustered based on their SINR distributions as shown in Fig. \ref{fig:Berlin} (UEs assigned to each sector are clustered into groups and are depicted in distinct colors). The SINR threshold is defined as -6.5 dB and the power constraint per BS is 46dBm. The 3GPP antenna model defined in \cite{3GPP36942} is applied. Fig. \ref{fig:convergence} illustrates the convergence of the algorithm. Our algorithm achieves the max-min utility balancing, and improves the feasibility level $C^{(u)}(P^{\text{max}})$ by each iteration step. In Fig.\ref{fig:cov_cap_mu} we show that the trade-off between coverage and capacity can be adjusted by tuning parameter $\mu$. By increasing $\mu$ we give higher priority to capacity utility (which is proportional to the ratio between total useful power and total interference power), while for better coverage utility (defined as minimum of SINRs) we can use a small value of $\mu$ instead. Fig. \ref{fig:coverage}, \ref{fig:capacity} and \ref{fig:power} illustrate the improvement of coverage and capacity performance and decreasing of the energy consumption in both uplink and downlink systems by applying the proposed algorithm, when the average number of the users per BS is chosen from the set $\{15,20,25,30,35\}$. In Fig. \ref{fig:capacity} we show that the actual average SINR is also improved, although the capacity utility is defined as a lower bound of the average SINR. Fig. \ref{fig:power} illustrate that our algorithm is more energy efficient when comparing with the fixed BS power budget scenario. Compared to the near-optimal uplink solutions, less improvements are observed for the downlink solutions as shown in Fig. \ref{fig:coverage}, \ref{fig:capacity} and \ref{fig:power}. This is because we derive the downlink solution by exploiting an uplink problem which is not exactly its dual due to the individual power constraints (as described in Section \ref{sec:Duality}). However, the sub-optimal solutions still provide significant performance improvements. % % % % % \section{Conclusions and Further Research}\label{sec:con} We present an efficient and robust algorithmic optimization framework build on the utility model for joint optimization of the SON use cases coverage and capacity optimization and load balancing. The max-min utility balancing formulation is employed to enforce the fairness across clusters. We propose a two-step optimization algorithm in the uplink based on fixed-point iteration to iteratively optimize the per base station antenna tilt and power allocation as well as the cluster-based BS assignment and power allocation. We then analyze the network duality via Perron-Frobenius theory, and propose a sub-optimal solution in the downlink by exploiting the solution in the uplink. Simulation results show significant improvements in performance of coverage, capacity and load balancing in a power-efficient way, in both uplink and downlink. In our follow-up papers we will further propose a more complex interference coupling model and the optimization framework where frequency band assignment is taken into account. We will also examine the suboptimality under more general form of power constraints. \begin{figure}[t] \centering \includegraphics[width=.5\textwidth]{BerlinReceivedSignalStrengthMap_v2} \caption{Berlin Scenario.} \label{fig:Berlin} \end{figure} \begin{figure}[ht] \centering \includegraphics[width=.5\textwidth]{convergence} \caption{Algorithm convergence.} \label{fig:convergence} \end{figure} % \begin{figure}[ht] \centering \includegraphics[width=.5\textwidth]{cov_cap_mu} \vspace{-1em} \caption{Trade-off between utilities depending on $\mu$.} \label{fig:cov_cap_mu} \vspace{-1.5em} \end{figure} \begin{figure}[ht] \centering \includegraphics[width=.5\textwidth]{coverage} \caption{Performance of proposed algorithm: coverage.} \label{fig:coverage} \end{figure} \begin{figure}[ht] \centering \includegraphics[width=.43\textwidth]{capacity} \caption{Performance of proposed algorithm: capacity.} \label{fig:capacity} \end{figure} \begin{figure}[!ht] \centering \includegraphics[width=.43\textwidth]{power} \caption{Performance of proposed algorithm: per-BS power budget.} \label{fig:power} \end{figure} % \input{appendices} \subsection*{Acknowledgements} We would like to thank Dr. Martin Schubert and Dr. Carl J. Nuzman for their expert advice. \ifCLASSOPTIONcaptionsoff \newpage \fi % \bibliographystyle{IEEEtran}
{'timestamp': '2016-07-19T02:04:46', 'yymm': '1607', 'arxiv_id': '1607.04754', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04754'}
arxiv
\section{More details for section \ref{sec:2wst}} \label{app:2way} \begin{figure}[h] \tikzstyle{trans}=[-latex, rounded corners] \begin{center} \scalebox{0.7}{ \begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto, semithick,scale=.9] \tikzstyle{every state}=[fill=gold] \node[state] at (0,4) (A) {$p$} ; \node[state] at (3,4) (B) {$q$} ; \node[state,initial,initial where=left,initial text={}, accepting] at (-3,4) (C) {$t$} ; \path(A) edge[loop above] node {$\alpha\left|\begin{array}{lll} \alpha, -1 \end{array}\right.$} (A); \path(A) edge node[above] {$\# \left| \epsilon, +1 \right.$} node[below] {$\vdash \left| \epsilon, +1 \right.$} (B); \path(B) edge[loop above] node {$\alpha\left|\begin{array}{llllllll} \alpha, +1 \end{array}\right.$} (B); \path(B) edge [bend left=40] node {$\# \left| \epsilon, +1 \right.$} (C); \path(C) edge[loop above] node {$\neg \texttt{reach}_{\#}, \alpha\left|\begin{array}{llllllll} \alpha, +1 \end{array}\right.$} (C); \path(C) edge[loop below] node {$\texttt{reach}_{\#}, \alpha\left|\begin{array}{llllllll} \epsilon, +1 \end{array}\right.$} (C); \path(C) edge node {$\# \left| \epsilon, -1 \right.$} (A); \end{tikzpicture} } \end{center} \vspace{-1em} \caption{Transformation $f_1$ given as two-way transducers with look-ahead. Here symbol $\alpha$ stands for both symbols $a$ and $b$, and the predicate $\texttt{reach}_{\#}$ is the lookahead that checks whether string contains a $\#$ in future. $\{t\}$ is the only Muller set. \label{fig:2wst}} \vspace{-1em} \end{figure} First we give some examples of transition monoids for the \ensuremath{\mathsf{2WST}}{} in Figure \ref{fig:2wst}. Consider the string $ab\#$. The transition monoid is obtained by using all 4 behaviours as shown below. Note that on reading $ab \#$, on state $t$, when we reach symbol $\#$, the look-ahead $\neg reach_{\#}$ evaluates to true. \[ M^{\ell r}_{ab\#}=\begin{blockarray}{cccc} &\matindex{t} & \matindex{q} & \matindex{p} \\ \begin{block}{c(ccc)} \matindex{t} & (0) & \bot & \bot\\ \matindex{q} & (0) &\bot & \bot \\ \matindex{p} & \bot & \bot & \bot \\ \end{block} \end{blockarray},~ M^{r \ell}_{ab\#}=\begin{blockarray}{cccc} &\matindex{t} & \matindex{q} & \matindex{p} \\ \begin{block}{c(ccc)} \matindex{t} & \bot & \bot & (0)\\ \matindex{q} & \bot &\bot & \bot \\ \matindex{p} & \bot & \bot & \bot \\ \end{block} \end{blockarray} \] \[ M^{\ell \ell}_{ab\#}=\begin{blockarray}{cccc} &\matindex{t} & \matindex{q} & \matindex{p} \\ \begin{block}{c(ccc)} \matindex{t} & \bot & \bot & (0)\\ \matindex{q} & \bot &\bot & \bot \\ \matindex{p} & \bot & \bot & (0) \\ \end{block} \end{blockarray},~ M^{r r}_{ab\#}=\begin{blockarray}{cccc} &\matindex{t} & \matindex{q} & \matindex{p} \\ \begin{block}{c(ccc)} \matindex{t} & (0) & \bot & \bot\\ \matindex{q} & (0) &\bot & \bot \\ \matindex{p} & \bot & (0) & \bot \\ \end{block} \end{blockarray} \] If we consider the string $ab\#ab\#$, then we can compute for instance, $M^{\ell r}_{ab\#ab\#}$ using $M^{\ell r}_{ab\#}, M^{\ell \ell}_{ab\#}$ and $M^{rr}_{ab\#}$. It can be checked that we obtain $M^{\ell r}_{ab\#ab\#}$ same as $M^{\ell r}_{ab \#}$. The transition monoid of the two-way automaton is obtained by using all the four matrices $M^{xy}_s$ for a string $s$. In particular, given a string $s$, we consider the matrix \[ M_s=\left ( {\begin{array}{cc} M^{\ell \ell}(s) & M^{\ell r}(s)\\ M^{r \ell}(s) & M^{ r r}(s)\\ \end{array}} \right ) \] as the transition matrix of $s$ in the two-way automaton. The identity element is \small{$\left ( {\begin{array}{cc} $\textbf{1}$ & $\textbf{1}$\\ $\textbf{1}$ & $\textbf{1}$\\ \end{array}} \right )$} where $\textbf{1}$ is the $n \times n$ matrix whose diagonal entries are $(\emptyset, \emptyset, \ldots, \emptyset)$ and non-diagonal entries are all $\bot$'s. The matrix corresponding to the empty string $\epsilon$ is $\left ( {\begin{array}{cc} $\textbf{1}$ & $\textbf{1}$\\ $\textbf{1}$ & $\textbf{1}$\\ \end{array}} \right )$. Given a word $w \in \Sigma^*$, we can find a decomposition of $w$ into $w_1$ and $w_2$ such that we can write all behaviours of $w$ in terms of behaviours of $w_1$ and $w_2$, denoted by $M_{w_1 w_2}$. We enumerate the possibilities in each kind of traversal, for a successful decomposition. \begin{enumerate} \item For $w=w_1w_2$, and a left-left traversal, we can have $M^{\ell \ell}(w)=M^{\ell \ell}(w_1)$ or \\ $M^{\ell \ell}(w)=M^{\ell r}(w_1) \times (M^{\ell \ell}(w_2) \times M^{r r}(w_1))^* \times M^{\ell \ell}(w_2) \times M^{r \ell}(w_1)$. We denote these cases as $LL_1, LL_2$ respectively. \item For $w=w_1w_2$ and a left-right traversal, we have \\ $M^{\ell r}(w)=M^{\ell r}(w_1) \times (M^{\ell \ell}(w_2) \times M^{r r}(w_1))^* \times M^{\ell r}(w_2)$. We denote this case as $LR$. \item For $w=w_1w_2$ and a right-left traversal, we have \\ $M^{r \ell}(w)= M^{r \ell}(w_2) \times (M^{r r}(w_1) \times M^{\ell \ell}(w_2))^* \times M^{r \ell}(w_1)$. We denote this case as $RL$. \item For $w=w_1w_2$ and a right-right traversal, we have\\ $M^{r r}(w)=M^{r r}(w_2)$ or \\ $M^{r r}(w)=M^{r \ell}(w_2) \times (M^{r r}(w_1) \times M^{\ell \ell}(w_2))^* \times M^{r r}(w_1) \times M^{\ell r}(w_2)$. We denote these cases as $RR_1, RR_2$ respectively. \end{enumerate} With these, for a correct decomposition of $w$ as $w_1w_2$, $M_{w_1w_2}$ is one of the four matrices as given below for $i, j \in \{1,2\}$. \[M_{w_1w_2}=\left ( {\begin{array}{cc} LL_i & LR\\ RL & RR_j\end{array}} \right ) \] The multiplication of matrices $M^{xy}(w)$ using the $\times$ operator is as defined for DMA using the multiplication $\odot$ and addition $\oplus$ of elements in $(\{0,1\} \cup 2^Q)^n \cup \bot$. We define a new operation $\otimes$, which takes $M_{w_1}, M_{w_2}$, and for a ``correct'' decomposition of $w$ using $w_1,w_2$, denoted $w_1 \otimes w_2$, we obtain $M_{w_1} \otimes M_{w_2}=M_{w_1 \otimes w_2}$. It can be seen that with the $\otimes$ operation, the transition matrix of a string decomposed as $w_1.w_2$ correctly follows from the left-right behaviours of the strings $w_1, w_2$. Let $\mathcal{T}(\mathcal{A})$ be the transition monoid of the two-way automaton $\mathcal{A}$. Let $|Q|=n$, the number of states of $\mathcal{A}$, and let there be $m$ muller sets. For ease of notation, we do not include the states of the look-behind automaton and set of states of the look-ahead automaton in the transition monoid. Thus, $\mathcal{T}(\mathcal{A})$ contains matrices of the above form, with identity and the binary operation as defined above. It can be seen that recursively we can find decompositions of $w$ as $w_1$ followed by $w_2w_3$, and $w_1w_2$ followed by $w_3$ such that $M_{w}=M_{w_1} \otimes M_{w_2w_3}= M_{w_1w_2} \otimes M_{w_3}$. \begin{lemma} \label{app:lem1-conv} Let $\mathcal{A}$ be a two-way (aperiodic) Muller automaton. The mapping $h$ which maps any string $s$ to its transition monoid $\mathcal{T}(\mathcal{A})$ is a morphism that recognizes $L(\mathcal{A})$. The language $L(\mathcal{A})$ is then aperiodic. \end{lemma} \begin{proof} The proof of Lemma \ref{app:lem1-conv} is similar to Lemma \ref{lem:ap-rec}. As seen in the case of Lemma \ref{lem:ap-rec}, it can then be proved that $\mathcal{T}(\mathcal{A})$ is a monoid. To define a morphism from $\Sigma^*$ to $\mathcal{T}(\mathcal{A})$, we first define a mapping $h: (\Sigma^*, \cdot, \epsilon) \rightarrow (\Sigma^* \times \Sigma^*, R, (\epsilon, \epsilon))$ as $h(s) = (s_1, s_2)$ iff $s = s_1 \otimes s_2$ is a ``correct breakup''; that is, $M_s = M_{s_1} \otimes M_{s_2}$. The operator $R$ is defined as $(a_1, a_2) R (b_1, b_2) = (a_1 a_2 ,b_1 b_2)$, and $h(\epsilon) = (\epsilon, \epsilon).$ It is easy to see that $h$ is a morphism, and $(\Sigma^* \times \Sigma^*, R, (\epsilon, \epsilon))$ is a monoid. Next, we define another map $g$ which works on the range of $h$. $g: (\Sigma^* \times \Sigma^*, R, (\epsilon, \epsilon)) \rightarrow (T_\mathcal{A}, \otimes, \textbf{1})$ as $g((s_1, s_2))=M_{s_1 s_2}$, $g[(s_1,s_2) R (s_3,s_4)] = M_{s_1s_2} \otimes M_{s_3s_4}$, which by the correct breakup condition, will equal $M_{s_1s_2s_3s_4}$. Also, $g((\epsilon,\epsilon))=\textbf{1}$. Again, $(T_\mathcal{A}, \otimes, \textbf{1})$ is a monoid and the composition of $g$ and $h$ is a morphism from $(\Sigma^*, \cdot, \epsilon)$ to $\mathcal{T}(\mathcal{A})$. Further, one can show using a similar argument to Lemma \ref{lem:ap-rec} that $L(\mathcal{A})$ is recognized by the morphism $g\circ h$. It remains to show that $L(\mathcal{A})$ is aperiodic. By definition, we know that the languages $L^{xy}_{pq}$ are aperiodic. This means that there is some $m$ such that $w^m \in L^{xy}_{pq}$ iff $w^{m+1} \in L^{xy}_{pq}$ for all strings $w$. This implies that $M^{xy}(w^m)=M^{xy}(w^{m+1})$ for all strings $w$. This would in turn imply (since we have the result for all four quadrants) that we obtain for the matrices of $\mathcal{T}(\mathcal{A})$, $M^m_{w}=M_{w^m}=M_{w^{m+1}}=M^{m+1}_w$, where $M^m$ stands for the iterated product using $\otimes$ of matrix $M$ $m$ times. This implies that there is an $m$ such that for all matrices $M$ in $\mathcal{T}(\mathcal{A})$, $M^m=M^{m+1}$. Hence, $\mathcal{T}(\mathcal{A})$ is aperiodic. Since $h$ is a morphism to an aperiodic monoid recognizing $L(\mathcal{A})$, we obtain that $L(\mathcal{A})$ is aperiodic. \end{proof} \section{Proofs from Section \ref{sec:2wst-sst} : $\ensuremath{\mathsf{2WST}}_{\ensuremath{sf}} \subset \mathsf{SST}_{\ensuremath{sf}}$} \label{app-2wst-sst} In this section, we show that $\ensuremath{\mathsf{2WST}}_{\ensuremath{sf}} \subset \mathsf{SST}_{\ensuremath{sf}}$. Let the \ensuremath{\mathsf{2WST}}$_{\ensuremath{sf}}$ be $(T, A, B)$ with $T = (\Sigma, \Gamma, Q, q_0, \delta, F)$. We assume wlg that $L(A_p) \cap L(A_{p'})=\emptyset$ for all $p, p' \in Q_A$ and $L(A_r) \cap L(A_{r'})=\emptyset$ for all $r, r' \in Q_B$. Also, we assume that $F=2^Q$, and check particular accepting conditions in the look-ahead automaton $A$. The \sst$_{sf}$ we construct is $\mathcal{T}=((\Sigma, \Gamma, Q', q_0', \delta', X, \rho, F'), A, B)$ where $Q'=Q \times [Q \rightharpoonup Q]$ where $\rightharpoonup$ represents a partial function. $q'_0=(q_0, I)$ where $I$ is the identity. The set of variables $\mathcal{X}=\{X_q \mid q \in Q\} \cup \{O\}$, and $F': 2^{Q'} \rightarrow X^*$ is defined for all $P' \in F'$ as $F'(P')=O$. $\delta': Q' \times Q_B \times \Sigma \times Q_A \rightarrow Q'$ is defined as follows: $\delta'((q,f),r,a,p)=(f'(q),f')$ where $f'$ is defined as follows: \[ f'(q)=\left \{ \begin{array}{lll} & t & \mbox{if}~ \delta(q,r,a,p)=(t, \gamma, 1),\\ & f'(t) & \mbox{if}~ \delta(q,r,a,p)=(t, \gamma, 0),\\ & f'(f(t)) & \mbox{if}~ \delta(q,r,a,p)=(t, \gamma, -1) \end{array}\right. \] Thanks to the determinism of the \ensuremath{\mathsf{2WST}}$_{sf}$ and the restriction that the entire input be read, $f'$ is a well-defined, partial function. In each cell $i$, the state of the \sst$_{sf}$ will coincide with the state the \ensuremath{\mathsf{2WST}}$_{sf}$ is in, when reading cell $i$ for the first time. The variable update $\rho$ on each transition is defined as follows: for $\delta'((q,f),a)=(f'(q),f')$, the update $\rho((q,f),a)$ is defined as follows: \[ \rho((q,f),a)(Y)= \left \{ \begin{array}{ll} O\rho(X_q) & \mbox{if}~Y=O,\\ \gamma & \mbox{if}~Y=X_q~\mbox{and}~\delta(q,r,a,p)=(t, \gamma,1),\\ \gamma\rho(X_t) & \mbox{if}~Y=X_q~\mbox{and}~\delta(q,r,a,p)=(t, \gamma,0),\\ \gamma X_t \rho(X_{f(t)}) & \mbox{if}~Y=X_q~\mbox{and}~\delta(q,r,a,p)=(t, \gamma,-1)~\mbox{and}~f(t)~\mbox{is defined},\\ \epsilon & \mbox{otherwise}. \end{array}\right. \] At the moment, the \sst$_{sf}$ is not 1-bounded. One place where 1-boundedness is violated happens because it is possible to have $f(s_1)=f(s_2)=t$ for $s_1 \neq s_2$. In particular, assume $\delta(s_1,r,a,p)=\delta(s_2,r,a,p)=(t,\gamma,-1)$, and let $f(t)=q$. Then we have $X_{s_2}, X_{s_1}:=\gamma X_t \rho(X_q)$. This would mean that we visit the same cell in the same state $t$ twice, which would lead to non-determinism or not fully reading the input by the \ensuremath{\mathsf{2WST}}$_{sf}$. Thus, this cannot happen in an accepting run of the \ensuremath{\mathsf{2WST}}$_{sf}$. Hence, if we have $\delta'((q,f),r,a,p)=(f'(q), f')$ where $f'$ is a partial function which is not 1-1, we can safely replace it with a subset $f''$ of $f'$ which is 1-1. Since $f'(s_1)=f'(s_2)$ for $s_1 \neq s_2$ does not contribute to an accepting run, we can define $f''$ on those states which preserve the 1-1 property. The second place where 1-boundedness is violated is when the contents of $\rho(X_q)$ flows into $O$ as well as $X_q$. This can be fixed by composition with another \sst{} where on each transition, all variables other than $X_q$ are unchanged ($X:=X$ for $X \neq X_q$) and resetting $X_q$ ($X_q:=\epsilon$). Note that this does not affect the ouput since $O$ is the only variable that is responsible for the output, and $\rho(X_q)$ has faithfully been reflected into it. With these two fixes, we regain the 1-boundedness property. \subsection{Connecting runs of the \ensuremath{\mathsf{2WST}}$_{sf}$ and \sst$_{sf}$} \begin{lemma} Let $a_1a_2 \dots \in \Sigma^{\omega}$, and let $r=(q_0, i_0=0) \stackrel{r_1,s(i_0),p_1|z_1}{\rightarrow}(q_1,i_1)\stackrel{r_2,s(i_1),p_2|z_2}{\rightarrow}(q_2,i_2)\dots$ be an accepting run of the \ensuremath{\mathsf{2WST}}$_{sf}$. Let $j_n=min\{m \mid i_m=n\}$ be the index when cell $n$ is read for the first time. Let $r'=(q'_0, f_0) \stackrel{r'_1,a_1,p'_1}{\rightarrow} (q'_1, f_1) \stackrel{r'_2,a_2,p'_2}{\rightarrow}(q'_2, f_2) \dots$ be the corresponding run in the constructed \sst$_{sf}$. Then we have \begin{itemize} \item $q'_i=q_{j_i}, a_i=s(j_i), r'_i=r_{j_i}, p'_i=p_{j_i}$, \item the output $\sigma'(O)$ till position $i$ of the input is $z_1z_2 \dots z_{j_i}$ \item In short, if the $\ensuremath{\mathsf{2WST}}_{sf}$ reads $a_i$ with $r_i \in Q_B, p_i \in Q_A$, and state $q$, then the \ensuremath{\mathsf{2WST}}$_{sf}$ will be in state $f_i(q)$ when it next reads $a_{i+1}$, and produces $\sigma_{r', i}(X_q)$ as output. \end{itemize} \end{lemma} \begin{proof} The proof is by induction on the length of the prefixes of the run $r'$. Consider a prefix of length 1. In this case, we are at the first position of the input, in initial state $q'_0=q_0$, since the \ensuremath{\mathsf{2WST}}$_{sf}$ moves right. We also have the states $r'_1=r_1, p'_1=p_1$, and the output obtained as $O:=O \rho(X_{q_0})$, and $\rho(X_{q_0})=z_1$. Thus, for a prefix of length 1, the states coincide, and the output in $O$ coincides with the output produced so far. Assume that upto a prefix of length $k$, we obtain the conditions of the lemma, and consider a prefix of length $k+1$. \\ Let $r=(q_0, i_0=0) \stackrel{r_1,s(i_0),p_1|z_1}{\rightarrow}(q_1,i_1)\dots (q_{k-1},i_{k-1})\stackrel{r_{k},s(i_{k-1}),p_{k}|z_{k}}{\rightarrow}(q_k,i_k)\stackrel{r_{k+1},s(i_k),p_{k+1}|z_{k+1}}{\rightarrow}(q_{k+1},i_{k+1})\dots $ be a prefix of length $k+1$. The corresponding run $r'$ in the \sst$_{sf}$ is $r'=(q'_0, f_0) \stackrel{r'_1,a_1,p'_1}{\rightarrow} (q'_1, f_1) \dots (q'_{k-1}, f_{k-1}) \stackrel{r'_k,a_k,p'_k}{\rightarrow}(q'_k, f_k) \stackrel{r'_{k+1},a_{k+1},p'_{k+1}}{\rightarrow}(q'_{k+1},f_{k+1})\dots $, where by inductive hypothesis, we know that $q'_k=q_{j_k}, a_k=s_{j_k}, r'_k=r_{j_k}, p'_k=p_{j_k}$, and the output $\sigma'(O)$ till position $k$ of the input is $z_1z_2 \dots z_{j_k}$. $q'_k=q_{j_k}$ is the state the \ensuremath{\mathsf{2WST}}$_{sf}$ is in, when it moves to the right of cell $k$ containing $a_k$, for the first time, and reads $a_{k+1}$. By construction of the \sst$_{sf}$, $\delta'((q_{j_k}, f), r_{j_k}, p_{j_k})=(f'(q_{j_k}), f')$, where $f'$ is defined based on the transition in the \ensuremath{\mathsf{2WST}}$_{sf}$ from state $q_{j_k}$ on reading $a_{k+1}$. \begin{enumerate} \item If $\delta(q_{j_k},a,r_{j_k}, p_{j_k})=(t, \gamma,1)$, then by construction of the \sst$_{sf}$, we obtain $f'(q_{j_k})=t$ and $\rho((q_{j_k},f),a)(O)=O\rho(X_{q_{j_k}})=O\gamma$. By inductive hypothesis, the contents of $O$ agrees with the output till $k$ steps. By catenating $\gamma$, in this case also, we obtain the same situation. \item If $\delta(q_{j_k},a,r_{j_k}, p_{j_k})=(t, \gamma,0)$, then by construction of the \sst$_{sf}$, we obtain $f'(q_{j_k})=f'(t)$ and $\rho((q_{j_k},f),a)(O)=O\gamma\rho(X_t)$. Inducting on the number of steps it takes for the \ensuremath{\mathsf{2WST}}$_{sf}$ to move to the right of cell $k+1$, we can show that the condition in the lemma holds. \begin{itemize} \item If the \ensuremath{\mathsf{2WST}}$_{sf}$ moves to the right of cell $k+1$ in the next step (one step), in state $u=q'_{k+1}$, then we obtain $f'(t)=u$, where $\delta(t,a,r,p)=(u,\gamma',1)$, in which case we obtain $\rho((q_{j_k},f),a)(O)=O\gamma\gamma'$ ($O \rho(X_t)$, where the current contents of $O$ is the old contents of $O$ followed by $\gamma$ and $\rho(X_t)=\gamma'$) which indeed is the output obtained in the \ensuremath{\mathsf{2WST}}$_{sf}$ when it moves to the right of cell $k+1$. \item Assume as inductive hypothesis, that the result holds (that is, the output $O$ agrees with the output in the \ensuremath{\mathsf{2WST}}$_{sf}$ so far, and that the state of the $\sst_{sf}$ agrees with the state of the \ensuremath{\mathsf{2WST}}$_{sf}$) when it moves to the right of cell $k$ in $\leq m$ steps. Consider now the case when it moves to the right of cell $k+1$ in $m+1$ steps. At the end of $m$ steps, the \ensuremath{\mathsf{2WST}}$_{sf}$ is on cell $k+1$, in some state $q$, and in the constructed \sst$_{sf}$, by hypothesis, the contents of $O$ correctly reflect the output so far. By assumption, we have $\delta(q, a_{k+1}, r,p)=(q'', \gamma'',1)$ for some state $q''$. Then we obtain, by the inductive hypothesis applied to cell $k$ at the end of $m$ steps, and the construction of the \sst$_{sf}$, the \sst$_{sf}$ to be in state $(f'(q),f')$, where $f'(q)=q''$, and $\rho((q'',f),a_{k+1})(O)=O\gamma''$. Since $O$ is up-to-date with the output with respect to the \ensuremath{\mathsf{2WST}}$_{sf}$, catenating $\gamma''$ indeed keeps it up-to-date, and the state of the \sst$_{sf}$ $q'_{k+1}$ is indeed the state the \ensuremath{\mathsf{2WST}}$_{sf}$ is in, when it moves to the right of cell $k+1$ for the first time. \end{itemize} \item If $\delta(q_{j_k},a,r_{j_k}, p_{j_k})=(t, \gamma,-1)$, then by construction of the \sst$_{sf}$, we obtain $f'(q_{j_k})=f'(f(t))$ and $\rho((q_{j_k},f),a)(O)=O\gamma X_t \rho(X_{f(t)})$. The \ensuremath{\mathsf{2WST}}$_{sf}$ is in cell $k$ at this point of time. Inducting on the number of steps it takes for the \ensuremath{\mathsf{2WST}}$_{sf}$ to move to the right of cell $k+1$ as above, we can show that the condition in the lemma holds. \end{enumerate} \end{proof} \subsection{Aperiodicity of the \sst$_{sf}$} \label{app:aper-sst} Having constructed the \sst$_{sf}$, the next task is to argue that the \sst$_{sf}$ is aperiodic. \begin{lemma} The constructed \sst$_{sf}$ is aperiodic. \end{lemma} \begin{proof} We start with an aperiodic \ensuremath{\mathsf{2WST}}$_{sf}$ $\mathcal{A}$ and obtain the \sst$_{sf}$ $\mathcal{T}$. Since $\mathcal{A}$ is aperiodic, there exists an $m \in \mathbb N$ such that $u^m \in L_{pq}^{xy}$ iff $u^{m+1} \in L_{pq}^{xy}$ for all $p, q \in Q$ and $x, y \in \{\ell, r\}$. To show the aperiodicity of the \sst$_{sf}$, we have to show that the transition monoid which captures state and variable flow is aperiodic. Lets consider a string $u \in \Sigma^*$ and a run in the \sst$_{sf}$ $(q,f) \stackrel{u}{\rightarrow} (q',f')$. Based on the transitions of the \sst$_{sf}$, we make a basic observation on variable assignments as follows. We show a correspondence between the flow of states for each kind of traversal in the \ensuremath{\mathsf{2WST}}$_{sf}$, and the respective state and variable flow in the constructed \sst$_{sf}$. Using this information and the aperiodicity of the \ensuremath{\mathsf{2WST}}$_{sf}$, we prove the aperiodicity of the \sst$_{sf}$ by showing the state, variable flow to be identical for strings $w^m, w^{m+1}$, for some chosen $m \in \mathbb{N}$, and any $w$. We know already that if $u=a$, and if $\delta(q,r,a,p)=(\gamma, q', 1)$ in the \ensuremath{\mathsf{2WST}}$_{sf}$ $\mathcal{A}$, then in the \sst$_{sf}$ we have the variable update $\rho(X_q)=\gamma$. If $u=a$, and if $\delta(q,r,a,p)=(\gamma, q', -1)$ in the \ensuremath{\mathsf{2WST}}$_{sf}$ $\mathcal{A}$, then in the \sst{} we have the variable update $\rho(X_q)=\gamma X_{q'} \rho(X_{f(q')})$. We now generalize the above for any $u \in \Sigma^*$ as follows: \begin{itemize} \item[(a)] If the run of $u$ in the \ensuremath{\mathsf{2WST}}$_{sf}$ $\mathcal{A}$ starts at the rightmost letter of $u$ in state $q$, and leaves it at the right with output $\gamma$, then we have $\rho(X_q)=\gamma$. \item[(b)] Assume the run of $u$ in the \ensuremath{\mathsf{2WST}}$_{sf}$ $\mathcal{A}$ starts at the rightmost letter of $u$ in state $q$, and leaves it at the left in state $t_1$. Since the whole input is read, eventually the \ensuremath{\mathsf{2WST}}$_{sf}$ will leave $u$ at the right in state $f'(q)$. Then we have $\rho(X_q)=\gamma_0 X_{t_1} \gamma_1 X_{t_2} \dots \gamma_{n-1} X_{t_n} \gamma_n$ such that (i) $u \in L_{q,t_1}^{r\ell}$ with output $\gamma_0$, (ii) $u \in L_{f(t_1),t_2}^{\ell\ell}$ with output $\gamma_1$. In general, $u \in L_{f(t_i),t_{i+1}}^{\ell\ell}$ with output $\gamma_i$, and (iii) since $\mathcal{A}$ completely reads the input, at some point, $u \in L_{f(t_n),f'(q)}^{\ell,r}$ with output $\gamma_n$. Also, in state $t_i$, we move one position left from some cell $h$, the leftmost position of $u$, and in state $f(t_i)$ we move to the right of cell $h$ for the first time, and the output generated in the interim is obtained from $\rho(X_{t_i})$. \end{itemize} We will show the above (a), (b) by inducting on $u$. For the base case $u=a$, we already have the proof, by the construction of the updates in the \sst$_{sf}$. Let $p$ be any state. Consider the case when in the \ensuremath{\mathsf{2WST}}$_{sf}$ we start at the right of $ua$ in state $p$ and leave it on the right. \begin{itemize} \item If we start at state $p$ on $a$, and $\delta(p,a)=(\gamma, q, -1)$, then we are at the right of $u$ in state $q$. We will be back on $a$ in state $f(q)$. By inductive hypothesis on $u$, we have $\rho(X_q)$ as some string over $\Gamma^*$, since we will leave $u$ at the right starting in state $q$ in the right. Again, by inductive hypothesis for $a$, we have $\rho(X_p)=\gamma X_q \rho(X_{f(q)})$; by the inductive hypothesis on $u$, when we leave $u$ on the right starting in state $q$ on the rightmost symbol of $u$, we obtain $\rho(X_q)$ as a constant. We are now on $a$ in state $f(q)$. If we leave $a$ to the right starting at $f(q)$, then we have by inductive hypothesis, $\rho(X_{f(q)})$ is a constant, and then we obtain $\rho(X_p)$ as a constant, while considering moving to the right of $ua$ starting at $a$ in state $p$. This agrees with (a) above. \item If we start at state $p$ on $a$, and $\delta(p,a)=(\gamma, q, 0)$. By construction of the \sst$_{sf}$, we have $\rho(X_p)=\gamma \rho(X_q)$. As long as we stay in the same position, we continue obtaining the same situation. If we leave $a$ to the right eventually, then by inductive hypothesis, we obtain $\rho(X_p)$ as a string over $\Gamma^*$. If from some state $t$, while on $a$, we move one position to the left, (on the rightmost symbol of $u$), then by inductive hypothesis on $u$, we obtain $\rho(X_t)$ as a constant; finally, since we move to the right of $a$ starting in state $f(t)$, we obtain $\rho(X_{f(t)})$ as a string over $\Gamma^*$, and hence, $\rho(X_p)$ as well. Thus, the inductive hypothesis works since $f(p)=f(q)$. \item If we start at state $p$ on $a$, and $\delta(p,a)=(\gamma, q, 1)$, then we straightaway have $\rho(X_p)$ as a constant, and are done. \end{itemize} Now consider the case when we start at the right of $ua$ and leave it at the left. Let us start in state $p$ on $a$. \begin{itemize} \item If we start at state $p$ on $a$, and $\delta(p,a)=(\gamma, q, -1)$, then we are at the right of $u$ in state $q$. By inductive hypothesis for $a$ we also have $\rho(X_p)=\gamma X_q \rho(X_{f'(q)})$. If we leave $ua$ at the left in state $r$, then starting in the right of $u$ in state $q$, we leave it at the left in $r$. By inductive hypothesis on $u$, we have $\rho(X_q)=\gamma_0 X_{r} \dots X_{r'}\gamma'$, such that $u \in L_{f(r'),f'(q)}^{\ell r}$. Leaving $a$ on the right from state $f'(q)$ gives by inductive hypothesis $\rho(X_{f'(q)})$ as a constant string $\beta$. On $ua$ starting in state $q$ on the right, the content of $X_p$ is then $\gamma \gamma_0 X_r \dots X_{r'} \gamma' \rho(\rho(X_{f'(q)}))$ =$\gamma \gamma_0 X_r \dots X_{r'} \gamma' \beta$, which agrees with (b), since $r, \dots, r'$ are the states in which we leave $u$ at the left. \item If we start at state $p$ on $a$, and $\delta(p,a)=(\gamma, q, 0)$. Then the inductive hypothesis works since $f(p)=f(q)$. \item Lastly, the case $\delta(p,a)=(\gamma, q, 1)$ does not apply since we are leaving $ua$ at the left starting on $a$ in state $p$. \end{itemize} The aperiodicity of the \sst$_{sf}$ is now proved as follows. Since the \ensuremath{\mathsf{2WST}}$_{sf}$ is aperiodic, we know that there is an $m \in \mathbb{N}$ such that $u^m \in L_{pq}^{xy}$ iff $u^{m+1} \in L_{pq}^{xy}$. Moreover, we also know that the matrices of $u^m, u^{m+1}$ are identical in the \ensuremath{\mathsf{2WST}}$_{sf}$, which tells us that the sequence of states seen in the left, right traversals of $u^m, u^{m+1}$ are identical. If this is the case, then in the above argument, we obtain the variable substitutions and state, variable flow for $u^m$ and $u^{m+1}$ to be identical, since the state and variable flow of the \sst$_{sf}$ only depends on the state flow of the \ensuremath{\mathsf{2WST}}$_{sf}$. Then we obtain the transition monoids of $u^m, u^{m+1}$ to be the same in the \sst$_{sf}$. The states of the look-behind and look-ahead automata in the \sst$_{sf}$ also follow the same sequence of states of the look-behind and look-ahead automata in the \ensuremath{\mathsf{2WST}}$_{sf}$. Since the look-behind and look-ahead automata are aperiodic, we obtain $M_{u^m}=M_{u^{m+1}}$ in the \sst$_{sf}$. Hence the \sst$_{sf}$ is aperiodic. \end{proof} \section{Example of an Aperiodic Monoid Recognizing a Language} \label{app:example-aperiodic} The language $L=(ab)^{\omega}$ is aperiodic, since it is recognized by the morphism $h: \{a,b\}^* \rightarrow M$ where $M$ is an aperiodic monoid. $M=(\{1,2,3\}, ., 1)$ with 2.3=1, 3.2=3, 2.2=3, 3.3=3 and $x.1=1.x=x$ for all $x \in M$. Define $h(\epsilon)=1, h(a)=2, h(b)=3$. Then $M$ is aperiodic, as $x^n=x^{n+1}$ for all $x \in M$ and $n \geq 3$. It is clear that $h$ recognizes $L$. \section{First-Order Logic: Examples} \label{app:fo} We define the following useful FO-shorthands. \begin{itemize} \item $x \succ y \rmdef \neg (x \preceq y)$ and $x \prec y \rmdef (x \preceq y) \wedge \neg (x = y)$, \item $first(x)=\neg \exists y(y \prec x)$ \item \texttt{is\_string}{} is defined as \[ \forall x(~\texttt{u\_succ}(x) \wedge \texttt{u\_pred}(x))\wedge \exists y[\texttt{first}(y) \wedge \forall z[\texttt{first}(z) \rightarrow z=y]] \wedge \forall x \exists y [x \prec y \wedge x \neq y] \] where $\texttt{u\_succ}(x)=\{\exists y[x \prec y \wedge \neg \exists z[x \prec z \wedge z \prec y]] \wedge \exists y'[x \prec y' \wedge \neg \exists z[x \prec z \wedge z \prec y']] \rightarrow (y=y')\} \wedge \exists y[x \prec y \wedge \neg \exists z[x \prec z \wedge z \prec y]]$ and \\ $\texttt{u\_pred}(x)=\{\exists y[y \prec x \wedge \neg \exists z[y \prec z \wedge z \prec x]] \wedge \exists y'[y' \prec x \wedge \neg \exists z[y' \prec z \wedge z \prec x]] \rightarrow (y=y')\} \wedge \exists y[y \prec x \wedge \neg \exists z[y \prec z \wedge z \prec x]]$ characterize that the position $x$ has unique predecessor and successor. \end{itemize} It is easy to see that a structure satisfying $\texttt{is\_string}$ characterizes a string. \section{Proofs from Section \ref{ap-omega}} \subsection{Transition Monoid of Muller Automata} \label{app:basic-muller} We start with an example for a transition monoid. The Muller automaton given in figure \ref{fig:muller-ex1} has two Muller acceptance sets $\{q\}, \{r\}$. Consider the strings $ab$ and $bb$. The transition monoids are \[ M_{ab}=\begin{blockarray}{cccc} & \matindex{$q$} & \matindex{$r$} & \matindex{$t$} \\ \begin{block}{c(ccc)} \matindex{$q$} & \bot & (0,0) & \bot \\ \matindex{$r$} & \bot & \bot & (0,0) \\ \matindex{$t$} & (0,0) & \bot & \bot \\ \end{block} \end{blockarray} ~~M_{bb}=\begin{blockarray}{cccc} & \matindex{$q$} & \matindex{$r$} & \matindex{$t$} \\ \begin{block}{c(ccc)} \matindex{$q$} & (1,0) & \bot & \bot \\ \matindex{$r$} & \bot & (0,0) & \bot \\ \matindex{$t$} & \bot & \bot & (0,0) \\ \end{block} \end{blockarray} \] \input{muller-ex} \begin{lemma} $(M_T,\times,\textbf{1})$ is a monoid, where $\times$ is defined as matrix multiplication and the identity element $\textbf{1}$ is the matrix with diagonal elements $(\emptyset,\emptyset,\dots,\emptyset)$ and all non-diagonal elements being $\bot$. \end{lemma} \begin{proof} Consider any matrix $M_s$ where $s \in \Sigma^*$. Let there be $m$ states $\{p_1, \dots, p_m\}$ in the Muller automaton. Consider a row corresponding to some $p_i$. Only one entry can be different from $\bot$. Let this entry be $[p_i][p_j] = (\kappa_1, \dots, \kappa_n)$, where each $\kappa_h \in \{0,1,2^Q\}$, $1 \leq h \leq n$. Consider $M_s \times \textbf{1}$. The $[p_i][p_j]$ entry of the product are obtained from the $p_i$th row of $M_s$ and the $p_j$th column of $\textbf{1}$. The $p_j$th column of $\textbf{1}$ has exactly one entry $[p_j][p_j] = (\emptyset, \dots, \emptyset)$, while all other elements are $\bot$. Then the $[p_i][p_j]$ entry for the product matrix $M_s \times \textbf{1}$ is of the form $\bot \oplus \dots \oplus \bot \oplus (\kappa_1, \dots, \kappa_n) \odot (\emptyset, \dots, \emptyset) \oplus \bot \oplus \dots \oplus \bot$. Clearly, this is equal to $(\kappa_1, \dots, \kappa_n)$, since $\kappa \odot \emptyset=\kappa \cup \emptyset=\kappa$ and $\bot \oplus \kappa=\kappa$. Similarly, it can be shown that the $[p_i][p_j]$th entry of $M_s$ is preserved in $\textbf{1} \times M_s$ as well. Associativity of matrix multiplication follows easily. \end{proof} We exploit the following lemma, proved in \cite{dg08SIWT}, in our proofs. \begin{lemma} \label{lem-gd} Let $h: \Sigma^* \rightarrow M$ be a morphism to a finite monoid $M$ and let $w=u_0u_1\dots$ be an infinite word with $u_i \in \Sigma^+$ for $i \geq 0$. Then there exist $s, e \in M$ and an increasing sequence $0< p_1 < p_2 < \dots$ such that \begin{enumerate} \item $se=s$ and $e^2=e$ \item $h(u_0\dots u_{p_1-1})=s$ and $h(u_{p_i} \dots u_{p_j})=e$ for all $0 < i<j$. \end{enumerate} \end{lemma} Using Lemma \ref{lem-gd}, we prove the following lemma, which is used in the proof of Lemma \ref{lem-conv}. \begin{lemma} \label{lem:ap-rec} Let $\mathcal{A}$ be a DMA. The mapping $h$ which maps any string $s$ to its transition matrix $M_s$, is a morphism from $(\Sigma^*, ., \epsilon)$ to $(M_T, \times, \textbf{1})$. Hence, $h$ recognizes $L(\mathcal{A})$. \end{lemma} \begin{proof} It is easy to see that $h$ is a morphism : $h(s_1s_2)$ is by definition, $M_{s_1s_2}$. This is clearly equal to $M_{s_1}M_{s_2}=h(s_1)h(s_2)$. Let $w \in L(\mathcal{A})$ and let $w = w_1 w_2 w_3 w_4 \dots$ be a factorization of $w$, with $w_i \in \Sigma^+$ for all $i$. Consider another string $w' \in \Sigma^{\omega}$ with a factorization $w' = w'_1 w'_2 w'_3 w'_4 \dots$, such that $h(w_i) = h(w'_i)$ forall $i$. We have to show that $w' \in L(\mathcal{A})$. Since $w \in L(\mathcal{A})$ we know that after some position $i$, the run $r$ of $w$ will contain only and all states from some muller set $F_k$. Assume that the factorization of $w$ is such that, after the factor $w_i$ of $w$, the run visits only states from $F_k$. We can write $w$ as $u v_1 v_2 v_3 \dots$ such that $u = w_1 w_2 \dots w_i$, $v_1 = w_{i+1} w_{i+2} \dots w_{i+j_1}$, $v_2 = w_{i+j_1+1} w_{i+j_1+2} \dots w_{i+j_1+j_2}$ and so on, such that each of $v_1, v_2, \dots $ witness all states of $F_k$ in the run. Since $h(w_i) = h(w'_i)$ forall $i$, we know that $M_{w_i}=M_{w'_i}$ for all $i$. So we can factorize $w'$ as $u'v'_1v'_2 \dots$ such that $h(u)=h(u'), h(v_i)=h(v'_i)$ for all $i$. Hence, $w'$ also has a run that also witnesses the muller set $F_k$ from some point onwards. Hence, $w' \in L(\mathcal{A})$. Thus, $h$ recognizes $L(\mathcal{A})$ since $w \in L(\mathcal{A}) \rightarrow [w]_h \subseteq L(\mathcal{A})$. \end{proof} \subsection{Aperiodicty of DMA $\mathcal{A}$ $\equiv$ Aperiodicity of $L(\mathcal{A})$} \label{app:aper-equiv} Note that a result similar to Theorem \ref{muller-ap} (whose proof is below) has been proved for B\"uchi automata in \cite{dg08SIWT}, where aperiodicity of B\"uchi automata was defined using transition monoids. \begin{theorem} \label{muller-ap} A language $L \subseteq \Sigma^{\omega}$ is aperiodic iff there exists an aperiodic Muller automaton $\mathcal{A}$ such that $L = L(\mathcal{A})$. \end{theorem} \begin{proof} We obtain the proof of Theorem \ref{muller-ap} by proving the following two lemmas. \begin{lemma} \label{lem-forward} Let $L \subseteq \Sigma^{\omega}$ be an aperiodic language. Then there is an aperiodic Muller automaton accepting $L$. \end{lemma} \begin{proof} Let $L \subseteq \Sigma^{\omega}$ be an aperiodic language. Then by definition, $L$ is recognized by a morphism $h: \Sigma^* \rightarrow M$ where $M$ is a finite aperiodic monoid. We first show that we can construct a counter-free Muller automaton $\mathcal{A}$ such that $L=L(\mathcal{A})$. A counter-free automaton is one having the property that $u^m \in L_{pp} \rightarrow u \in L_{pp}$ for all $u \in \Sigma^*$, states $p$ and $m \geq 1$. It can be shown \cite{dg08SIWT} that the aperiodic language $L$ can be written as the finite union of languages $UV^{\omega}$ where $U, V$ are aperiodic languages of finite words. Moreover, for any $u_0u_1u_2 \dots \in \Sigma^{\omega}$, there is an increasing sequence $0<p_1<p_2 \dots$ of natural numbers such that for the morphism $h: \Sigma^* \rightarrow M$ recognizing $L$, we have $h(u_0\dots u_{p_1})=s \in M$ and $h(u_{p_i}\dots u_{p_j})=e \in M$ for all $0<i<j$. The $e \in M$ is an idempotent element in $M$. Then we have $h^{-1}(e)=V$ and $h^{-1}(s)=U$. Since $V$ is an aperiodic language $\subseteq \Sigma^*$, there is a minimal DFA $\mathcal{D}$ that accepts $V$. The initial state of this DFA is $[\epsilon]$, and the states are of the form $[x], x \in \Sigma^*$, such that $xw \in L$ iff there is a run from $[x]$ on $w$ to an accepting state. Accepting states have the form $[w]$ with $w \in V$ and the transition function is $\delta([x],a)=[xa]$. For all $x,y,v \in \Sigma^*$, ($xv \in V$ iff $yv \in V$) $\Rightarrow [x]=[y]$. We first show that $\mathcal{D}$ is counter-free. Since $V$ is aperiodic, there is a morphism $g: V \rightarrow M_V$ recognizing $V$, for an aperiodic monoid $M_V$. As $M_V$ is aperiodic, there exists some $m \geq 1$ such that for all $x \in M_V$, $x^m=x^{m+1}$. If $[u]=[uv^m]$ for some $u, v \in \Sigma^*$, then $g(u)=g(uv^m)=g(uv^{m+1})=g(uv^mv)=g(uv)$. If $[u] \neq [uv]$, then we can find some string $w$ such that $uw \in V$ but $uvw \notin V$ or viceversa. This contradicts the hypothesis that $V$ is recognized by a morphism $g: \Sigma^* \rightarrow M_V$, since $uw \in V$ and $g(uw)=g(uvw)$ implies either both $uw, uvw$ belong to $V$ or neither. Thus, $[u]=[uv^m]$ implies $[u]=[uv]$ for all $u, v \in \Sigma^*$. That is, whenever $\delta^*([u],v^m)=[uv^m]=[u]$, we have $\delta^*([u],v)=[uv]=[u]$ as well, which shows that the minimal DFA $\mathcal{D}$ for $V$ is counter-free. If we intepret $\mathcal{D}$ as a Buchi automaton, and consider $\alpha \in L(\mathcal{D})$, then $\alpha$ has infinitely many prefixes $v_1 < v_2 < \dots$ such that each $v_i \in V$. We have to show that $\alpha \in V^{\omega}$; that is we have to show that $\alpha=\alpha_1\alpha_2 \dots$ with $\alpha_i \in V$ for all $i$. We know $v_2=v_1v'_1$, $v_3=v_2v'_2 \dots$ with $v_1, v_2, \dots \in V$. Then $\alpha=v_1v'_1v'_2v'_3 \dots$. If $v'_i \in V$ for all $i$, we are done, since in that case, $\mathcal{D}$ will be a counter-free Buchi automaton for $V^{\omega}$. To obtain the infinitely many prefixes $v_1<v_2<v_3<\dots$ such that $v_{i+1}=v_iv'_i$ with $v_i, v'_i \in V$, we consider the language $W=V.Prefree(V)$ where $Prefree(V)$ is the set of all strings in $V$ which do not contain a proper prefix also lying in $V$. Since $V$ is aperiodic, $W$ is also aperiodic. Let $\mathcal{E}$ be the minimal counter free DFA accepting $W$. We intrepret $\mathcal{E}$ as a Buchi automaton, as we did for the case of $\mathcal{D}$, and show that $\mathcal{E}$ is a counter-free Buchi automaton accepting $V^{\omega}$. Clearly, $L(\mathcal{E})$ is the set of strings which has infinitely many prefixes from $W$. If $w \in V^{\omega}$, then $w \in L(\mathcal{E})$ since $w$ has infinitely many prefixes from $W$. Conversely, let $w \in \Sigma^{\omega}$ be such that infinitely many prefixes $w_1<w_2<w_3< \dots$ of $w$ are in $W$. Then we have to show that $w \in V^{\omega}$. Let $w_i=x_iy_i$ where $x_i \in V, y_i \in Prefree(V)$ for each $i$. Then we have $$x_1 < x_1y_1 < x_2 < x_2y_2 < x_3 < \dots$$ Note that if $w_1\neq w_2$ that is, $x_1y_1 \neq x_2y_2$ and $x_1=x_2$, then $y_1$ is a prefix of $y_2$. Since $y_1, y_2 \in Prefree(V)$, this is not possible. Thus, for any two $w_i \neq w_j$, we have $x_i < x_j$. Let $x_{i+1}=x_iy_iy'_i$ for some $y'_i$. Recall that, using the morphism $h: \Sigma^* \rightarrow M$ recognizing $L$, we have $h^{-1}(e)=V$ for some idempotent $e \in M$. $h(x_{i+1})= h(x_iy_iy'_i)=e.e.h(y'_i)=e.h(y'_i)=h(y_iy'_i)$. Hence we get $w=x_1y_1y'_1y_2y'_2y_3y'_3\dots=x_1x_2x_3\dots \in V^{\omega}$. Thus, $\mathcal{E}$ is a counter-free Buchi automaton accepting $V^{\omega}$. Let $\mathcal{E}'$ be the counter-free Muller automaton obtained from $\mathcal{E}$. Since $U \subseteq \Sigma^*$ is aperiodic, we can construct as for $V$, the minimal counter-free DFA $\mathcal{U}$ for $U$. The concatenation $\mathcal{U} \mathcal{E}'$ is then counter-free. The finite union of such automata are also counter-free. Finally we show that counter-free automata are aperiodic. Let $x^{n} \in L_{pq}$ for any two states $p,q$, for a large $n$. We can decompose $x^n$ as $x^{k+l+m}$ such that $x^k \in L_{ps}, x^l \in L_{ss}$ and $x^m \in L_{sq}$, with $l \geq 2$. Then we have $x \in L_{ss}$ by the counter-freeness. Then we obtain $x^{n-1}\in L_{pq}$. Similarly, we can show that $x^{n-1} \in L_{pq} \Rightarrow x^n \in L_{pq}$. This shows that we have an aperiodic Muller automata accepting the finite union $UV^{\omega}$ that represents $L$. Thus, starting from the assumption that $L$ is an aperiodic language, we have obtained an aperiodic Muller automaton that accepts $L$. \end{proof} \begin{lemma} \label{lem-conv} Let $\mathcal{A}$ be Muller automaton whose transition monoid is aperiodic. Then $L(\mathcal{A})$ is aperiodic. \end{lemma} \begin{proof} From Lemma \ref{lem:ap-rec}, we know that we can construct a morphism mapping $(\Sigma^*, ., \epsilon)$ to the transition monoid of $\mathcal{A}$ which recognizes $L(\mathcal{A})$. Hence, $L(\mathcal{A})$ is aperiodic. \end{proof} \end{proof} \section{Example of FOT} \label{app:fot-example} \begin{figure}[h] \tikzstyle{trans}=[-latex, rounded corners] \begin{center} \scalebox{0.9}{ \begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto, semithick,scale=.8] \tikzstyle{every state}=[fill=golden] \node[loc] at (-2, 0) (B) {$a$} ; \node[loc] at (0,0) (B0) {$b$} ; \node[loc] at (2,0) (B1) {$b$} ; \node[loc] at (4,0) (B2) {$b$} ; \node[loc] at (6,0) (B3) {$\#$} ; \node[loc] at (8,0) (B4) {$b$} ; \node[loc] at (10,0) (B5) {$a$} ; \node[loc] at (12,0) (B6) {$\#$} ; \node[loc,dashed] at (13.5,0) (B7) {$\{a,b\}^\omega$} ; \draw[trans] (B) -- (B0); \draw[trans] (B0) -- (B1); \draw[trans] (B1) -- (B2); \draw[trans] (B2) -- (B3); \draw[trans] (B3) -- (B4); \draw[trans] (B4) -- (B5); \draw[trans] (B5) -- (B6); \draw[trans] (B6) -- (B7); \node[loc] at (-2, -1) (C) {$a$} ; \node[loc] at (0,-1) (C0) {$b$} ; \node[loc] at (2,-1) (C1) {$b$} ; \node[loc] at (4,-1) (C2) {$b$} ; \node[loc] at (8,-1) (C4) {$b$} ; \node[loc] at (10,-1) (C5) {$a$} ; \node at (13.5,-1) (C7) {$~~~~~~$} ; \draw[trans] (C) -- (C0); \draw[trans] (C0) -- (C1); \draw[trans] (C1) -- (C2); \draw[trans] (C4) -- (C5); \node[loc] at (-2, -2) (D) {$a$} ; \node[loc] at (0,-2) (D0) {$b$} ; \node[loc] at (2,-2) (D1) {$b$} ; \node[loc] at (4,-2) (D2) {$b$} ; \node[loc] at (8,-2) (D4) {$b$} ; \node[loc] at (10,-2) (D5) {$a$} ; \node at (13.5,-2) (D7) {$~~~~~~$} ; \draw[trans] (D) -- (C); \draw[trans] (D2) -- (D1); \draw[trans] (D1) -- (D0); \draw[trans] (D0) -- (D); \draw[trans] (D5) -- (D4); \node at (-2,-3) (E) {$~~$} ; \node[loc] at (6,-3) (E3) {$\#$} ; \node[loc] at (12,-3) (E6) {$\#$} ; \node[loc,dashed] at (13.5,-3) (E7) {$\{a,b\}^\omega$} ; \draw[->,rounded corners] (C2) -- (6, -1) -- (E3); \draw[trans] (D4) -- (C4); \draw[->, rounded corners] (E3) -- (10, -3) -- (D5); \draw[->, rounded corners] (C5) -- (12, -1) -- (E6); \draw[trans] (E6) -- (E7); \begin{pgfonlayer}{background} \node at (-2.2, 0) [label=left:\texttt{input} :] {}; \node [background, fit=(C) (C7), label=left:\texttt{copy 1}:] {}; \node [background, fit=(D) (D7), label=left:\texttt{copy 2}:] {}; \node [background, fit=(E) (E7), label=left:\texttt{copy 3}:] {}; \end{pgfonlayer} \end{tikzpicture} } \end{center} \vspace{-1em} \caption{Transformation $f_1$ given as FO-definable transformation for the string $abbb\#ba\#\{a,b\}^\omega$. \label{fig:app-fo-example}} \vspace{-1em} \end{figure} We give the full list of $\phi^{c,d}$ here. Let $btw(x,y,z)=(y \prec z \prec x) \vee (x \prec z \prec y)$ be a shorthand that says that $z$ lies between $x, y$. Let $btw(x,y,\gamma)=\exists z(L_{\gamma}(z) \wedge btw(x,y,z))$ for $\gamma \in \Gamma$ and let $reach_{\#}(x)=\exists y(x \prec y \wedge L_{\#}(y))$ be a shorthand which says there is a $\#$ that is ahead of $x$. \begin{enumerate} \item $\phi_{dom}=\texttt{is\_string}_{\#}$, \item $\phi^1_{\gamma}(x) = \phi^2_{\gamma}(x) = L_{\gamma}(x) \wedge \neg L_{\#}(x) \wedge \texttt{reach}_{\#}(x)$, since we only keep the non $\#$ symbols that can ``reach'' a $\#$ in the input string in the first two copies. \item $\phi^3_{\gamma}(x) = L_{\#}(x) \vee (\neg L_{\#}(x) \wedge \neg \texttt{reach}_{\#}(x))$, since we only keep the $\#$'s, and the infinite suffix from where there are no $\#$'s. \end{enumerate} The transitive closure of the output successor relation is given by : \begin{enumerate} \item $\phi^{1,1}_{\prec}(x,y)=(x \prec y)=\phi^{3,3}_{\prec}(x,y)$, \item $\phi^{2,2}_{\prec}(x,y)= [\neg btw(x,y,\#) \rightarrow (y \prec x) ]$ $\wedge [btw(x,y,\#) \rightarrow (x \prec y)]$ since we are reversing the arrows within a $\#$-free block from which a $\#$ is reachable. \item $\phi^{1,3}_{\prec}(x,y)=L_{\#}(y) \wedge (x \prec y)=\phi^{2,3}_{\prec}(x,y) \item $\phi^{1,2}_{\prec}(x,y)=x \prec y \wedge btw(x,y,\#)$ since each position in a $\#$-free block is related to each position in a $\#$-free block that comes later. \item $\phi^{3,2}_{\prec}(x,y)$ and $\phi^{3,1}_{\prec}(x,y)$ are given by $L_{\#}(x) \wedge (x \prec y)$ \item $\phi^{2,1}_{\prec}(x,y)$ expresses that each position $x$ in the $i$-th $\#$-free block is related to position $y$ appearing in the $j$-th $\#$-free block, $j > i$. Within a \#-free block, the arrows are reversed. This translates simply to \\ $[x \prec y \wedge btw(x,y,\#)] \vee \{\neg btw(x,y,\#) \wedge [(y \prec x) \vee y=x]\}$. \end{enumerate} \input{app-2way.tex} \input{app-sst.tex} \input{app-fot-2wst.tex} \section{Proofs from Section \ref{sec:sst-fot}} \label{app:varflow} \begin{proposition}(FO-definability of variable flow) \label{prop:foflow} Let $T$ be an aperiodic,1-bounded \sst{} $T$ with set of variables $\mathcal{X}$. For all variables $X,Y\in \mathcal{X}$, there exists an FO-formula $\phi_{X\rightsquigarrow Y}(x,y)$ with two free variables such that, for all strings $s\in dom(T)$ and any two positions $i\leq j\in dom(s)$, $s\models \phi_{X\rightsquigarrow Y}(i,j)$ iff $(q_i,X)\rightsquigarrow^{s[i{+}1{:}j]}_1 (q_j,Y)$, where $q_0\dots q_n \dots$ is the accepting run of $T$ on $s$. \end{proposition} Let $X\in\mathcal{X}$, $s\in\mathrm{dom}(T)$, $i\in \mathrm{dom}(s)$. Let $P \in 2^Q$ be a Muller accepting set with output $F(P)=X_1 \dots X_n$. Let $r = q_0\dots q_{n}\dots$ be an accepting run of $T$ on $s$. Then there is a position $j$ such that $\forall k >j$, only states in $P$ are visited. On all transitions beyond $j$, $X_1, \dots, X_{n-1}$ remain unchanged, while $X_n$ is updated as $X_nu$ for some $u \in (\mathcal{X} \cup \Gamma)^*$. We say that the pair $(X,i)$ is \emph{useful} if the content of variable $X$ before reading $s[i]$ will be part of the output after reading the whole string $s$. Formally, for an accepting run $r = q_0\dots q_{j}q_{j+1}\dots$, such that only states from the Muller set $P$ are seen after position $j$, we say that $(X,i)$ is useful for $s$ if $(q_{i-1}, X)\rightsquigarrow^{s[i{:}j] }_1(q,X_k)$ for some variable $X_k \in F(P)$, $k \leq n$, or if $(q_{i-1}, X)\rightsquigarrow^{s[i{:}\ell] }_1(q,X_n)$, with $q \in P$ and $\ell >j$. Thanks to Proposition \ref{prop:foflow}, this property is FO-definable. \begin{proposition}\label{prop:contribution} For all $X\in\mathcal{X}$, there exists an FO-formula $\text{useful}_X(i)$ s.t. for all strings $s\in dom(T)$ and all positions $i\in \mathrm{dom}(s)$, $s\models \text{useful}_X(i)$ iff $(X,i)$ is useful for string $s$. \end{proposition} Proofs of propositions \ref{prop:foflow} and \ref{prop:contribution} are below. \subsection{Proof of Proposition \ref{prop:foflow}} First, we show that reachable states in accepting runs of aperiodic \sst{} are FO-definable: \begin{proposition} \label{prop:fostates} Let $T$ be an aperiodic \sst{} $T$. For all states $q$, there exists an FO-formula $\phi_q(x)$ such that for all strings $s\in \Sigma^{\omega}$, for all positions $i$, $s\models \phi_q(i)$ iff $s\in dom(T)$ and the state of the (unique) accepting run of $T$ before reading the $i$-th symbol of $s$ is $q$. \end{proposition} \begin{proof} Let $A$ be the underlying (deterministic) aperiodic, Muller automaton of the SST $T$. Since $T$ is aperiodic, so is $A$. For all states $q$, let $L_q$ be the set of strings $s \in \Sigma^+$ such that there exists a run of $T$ on string $s$ that ends in state $q$. Clearly, $L_q$ can be defined by some aperiodic finite state automaton $A_q$ obtained by setting the set of final states of $A$ to $\{q\}$. Here, $A_q$ is interpreted as a DFA. Therefore $L_q$ is definable by some FO-formula $\psi^L_q$. Let $L_{q,p}$ be the set of strings that have a run in $T$ from state $q$ to state $p$. This also is obtained from $T$ by considering $q$ as the start state and $p$ as the accepting state. Let $\psi^L_{q,p}$ be the FO formula which captures this. For $P \in 2^Q$, let $R_P$ be the set of strings $s \in \Sigma^{\omega}$ such that there exists a run of $T$ on $s$ from some state $p \in P$, which stays in the set of states $P$, and all states of $P$ are witnessed infinitely often. Clearly, $u\in dom(T)$ iff there exists $p\in P$ with $v_1\in L_q, v_2 \in L_{q,p}$ and $v_3\in R_P$ such that $u=v_1v_2v_3$. To capture $v_3$, we have the FO-formula $\psi^{Rec}_P$ $\bigvee_{p \in P} L_p(x) \wedge \forall y(y \geq x \rightarrow \bigvee_{q \in P} L_q(y)) \wedge \forall y \exists k_1 \dots \exists k_{|P|}(k_i \geq y \wedge \bigwedge_{i \neq j}(k_i \neq k_j) \wedge \bigwedge_{q_i \in P} L_{q_i}(k_i))$. Then, $\phi_q(x)$ is defined as $$ \phi_q(x) = [\psi^L_q]_{\prec x} \wedge [\psi^L_{q,p}]_{x \prec y} \wedge [L_p(y) \wedge \psi^{Rec}_P]_{y\preceq} $$ where $[\psi^L_q]_{\prec x}$ is the formula $\psi^L_q$ in which all quantifications of any variable $z$ is guarded by $z\prec x$, $[\psi^L_{q,p}]_{x \prec y}$ is the formula where all variables lie in between $x,y$, and finally, $[\psi^{Rec}_P]_{y\preceq}$ is the formula $\psi^{Rec}_P$ in which all quantifications of any variable $z$ is guarded by $y\preceq z$. Therefore, $s\models \phi_q(i)$ iff $s[1{:}i)\in L_q$, $s[i{:}j)\in L_{q,p}$ and $s[j{:}\infty]\in R_P$. % \end{proof} Now we start the proof of Proposition \ref{prop:foflow}. \begin{proof} For all states $p,q\in Q$, let $L_{(p,X)\rightsquigarrow (q,Y)}$ be the language of strings $u$ such that $(p,X)\rightsquigarrow_1^{u} (q,Y)$. We show that $L_{(p,X)\rightsquigarrow (q,Y)}$ is an aperiodic language. It is indeed definable by an aperiodic non-deterministic automaton $A$ that keeps track of flow information when reading $u$. It is constructed from $T$ as follows. Its state set $Q'$ are pairs $(r,Z)\in 2^{Q\times \mathcal{X}}$. Its initial state is $\{(p,X)\}$ and final states are all states $P$ such that $(q,Y)\in P$. There exists a transition $P\xrightarrow{a} P'$ in $A$ iff for all $(p_2,X_2)\in P'$, there exists $(p_1,X_1)\in P$ and a transition $p_1\xrightarrow{a|\rho} p_2$ in $T$ such that $\rho(X_2)$ contains an occurrence of $X_1$. Note that by definition of $A$, there exists a run from a state $P$ to a state $P'$ on some $s\in\Sigma^*$ iff for all $(p_2,X_2)\in P'$, there exists $(p_1,X_1)\in P$ such that $(p_1,X_1)\rightsquigarrow^{s}_1 (p_2,X_2)$ (Remark $\star$). Clearly, $L(A) = L_{(p,X)\rightsquigarrow (q,Y)}$. It remains to show that $A$ is aperiodic, i.e. its transition monoid $M_A$ is aperiodic. Since $T$ is aperiodic, there exists $m\geq 0$ such that for all matrices $M\in M_T$, $M^m = M^{m+1}$. For $s\in\Sigma^*$, let $\Phi_A(s) \in M_A$ (resp. $\Phi_T(s)$) the square matrix of dimension $|Q'|$ (resp. $|Q|$) associated with $s$ in $M_A$ (resp. in $M_T$). We show that $\Phi_A(s^m) = \Phi_A(s^{m+1})$, i.e. $(P,P')\in \Phi_A(s^m)$ iff $(P,P')\in\Phi_A(s^{m+1})$, for all $P,P'\in Q'$. First, suppose that $(P,P')\in \Phi_A(s^m)$, and let $(p_2,X_2)\in P'$. By definition of $A$, there exists $(p_1,X_1)\in P$ such that $(p_1,X_1)\rightsquigarrow^{s^m}_1 (p_2,X_2)$, and by aperiodicity of $T$, it implies that $(p_1,X_1)\rightsquigarrow^{s^{m+1}}_1 (p_2,X_2)$. Since it is true for all $(p_2,X_2)\in P'$, it implies by Remark $(\star)$ that there exists a run of $A$ from $P$ to $P'$ on $s^{m+1}$, i.e. $(P,P')\in \Phi_A(s^{m+1})$. The converse is proved similarly. We have just proved that $L_{(p,X)\rightsquigarrow (q,Y)}$ is aperiodic. Therefore it is definable by some FO-formula $\phi_{(p,X)\rightsquigarrow (q,Y)}$. To capture the variable flow in an accepting run, we also need to have some conditions on the states $p$ and $q$. $\phi_{X\rightsquigarrow Y}(x,y)$ is defined by $$ \phi_{X\rightsquigarrow Y}(x,y)\equiv x\preceq y \wedge \bigvee_{q,p\in Q}\{ [\phi_{(q,X)\rightsquigarrow (p,Y)}]^{x\preceq \cdot\preceq y} \wedge [\psi^L_q]_{\prec x} \wedge [\psi^L_{q,p}]_{x \prec y} \wedge \exists z.\{[\psi^L_{p,r}]_{y \prec z} \wedge [L_r(z) \wedge \psi^{Rec}_P]_{z\preceq}\} \}$$ where $[\psi^L_q]_{\prec x}, [\psi^L_{q,p}]_{x \prec y}, [\psi^R_p]_{y\preceq}$ were defined in Proposition \ref{prop:fostates} and $[\phi_{(p,X)\rightsquigarrow (q,Y)}]^{x\preceq \cdot\preceq y}$ is obtained from $\phi_{(p,X)\rightsquigarrow (q,Y)}$ by guarding all the quantifications of any variable by $x\preceq z'\preceq y$. The Muller set $P$ starts from some position $z$ ahead of $y$, in some state $r \in P$. In the case when $p \in P$, consider $r=p$ in the above formula. \end{proof} \subsection{Proof of Proposition \ref{prop:contribution}} \label{app:useful} \begin{proof} The formula $\text{useful}_X(x)$ is defined by $$ \begin{array}{llllllll} \text{useful}_X(x) & = & \exists y\cdot[ \bigvee_{P \in 2^Q}\psi_P^{Rec}(y) \wedge \bigvee_{p \in P}\psi^L_p(y) \wedge \bigvee_{\{X_1, \dots, X_n \mid F(P)=X_1 \dots X_n\}} \Phi_{X\rightsquigarrow X_i}(x,y)] \end{array} $$ where $\psi_P^{Rec}(y)$ defines a position $y$ from where the Muller set $P$ is visited continously. $\psi_P^{Rec}(y)$ is defined in proposition \ref{prop:fostates} and $\Phi_{X\rightsquigarrow Y}(x,y)$ in proposition \ref{prop:foflow}. \end{proof} \subsection{Definition of \sst-output graphs} \label{app:sst-output} \input{outputgraph-app.tex} Figure \ref{fig:outputgraph} gives an example of \sst-output structure. We show only the variable updates. Dashed arrows represent variable updates for useless variables, and therefore does not belong to the \sst-output structure. Initially the variable content of $Z$ is equal to $\epsilon$. It is represented by the $\epsilon$-edge from $(Z^{in}, 0)$ to $(Z^{out}, 0)$ in the first column. Then, variable $Z$ is updated to $Zc$. Therefore, the new content of $Z$ starts with $\epsilon$ (represented by the $\epsilon$-edge from $(Z^{in},1)$ to $(Z^{in},0)$, which is concatenated with the previous content of $Z$, and then concatenated with $c$ (it is represented by the $c$-edge from $(Z^{out},0)$ to $(Z^{out},1)$). Note that the invariant is satisfied. The content of variable $X$ at position 5 is given by the label of the path from $(X^{in},5)$ to $(X^{out},5)$, which is $c$. Also note that some edges are labelled by strings with several letters, but there are finitely many possible such strings. In particular, we denote by $O_T$ the set of all strings that appear in right-hand side of variable updates. Let $T = (Q, q_0, \Sigma, \Gamma, \mathcal{X}, \delta, \rho, Q_f)$ be an \sst{}. Let $u\in (\Gamma\cup X)^*$ and $s\in \Gamma^*$. The string $s$ is said to \emph{occur} in $u$ if $s$ is a factor of $u$. In particular, $\epsilon$ occurs in $u$ for all $u$. Let $O_T$ be the set of constant strings occurring in variable updates, i.e. $O_T = \{ s\in\Gamma^*\ |\ \exists t\in \delta,\ s\text{ occurs in } \rho(t)\}$. Note that $O_T$ is finite since $\delta$ is finite. Let $w \in dom(T)$. The \emph{\sst-output graph} of $w$ by $T$, denoted by $G_T(w)$, is defined as an infinite directed graph whose edges are labelled by elements of $O_T$. Formally, it is the graph $G_T(w) = (V,(E_\gamma)_{\gamma\in O_T})$ where $V = \{0,1,\dots,\}\times \mathcal{X}\times \{in,out\}$ is the set of vertices, $E := \bigcup_{\gamma\in O_T} E_\gamma \subseteq V\times V$ is the set of labelled edges defined as follows. Vertices $(i,X,d)\in V$ are denoted by $(X^d,i)$. Let $r = q_0\dots q_n \dots $ be an accepting run of $T$ on $w$. The set $E$ is defined as the smallest set such that for all $X\in \mathcal{X}$, \begin{enumerate} \item $((X^{in},0),(X^{out},0))\in E_\epsilon$ if $(X,0)$ is useful, \item for all $i$ and $X\in X$, if $(X,i)$ is useful and if $\rho(q_{i},w[i+1],q_{i+1})(X) = \gamma$, then $((X^{in},i+1),(X^{out},i+1))\in E_\gamma$, \item for all $i$ and $X\in X$, if $(X,i)$ is useful and if $\rho(q_{i},w[i+1],q_{i+1})(X) = \gamma_1X_1\dots \gamma_kX_{k}\gamma_{k+1}$ (with $k>1$), then \begin{itemize} \item $((X^{in},i+1), (X_1^{in},i))\in E_{\gamma_1}$ \item $((X_k^{out},i), (X^{out},i+1))\in E_{\gamma_{k+1}}$ \item for all $1\leq j< k$, $((X_j^{out},i), (X_{j+1}^{in},i))\in E_{\gamma_{j+1}}$ \end{itemize} \end{enumerate} Note that since the transition monoid of $T$ is $1$-bounded, it is never the case that two copies of any variable (say $X$) flows into a variable (say $Y$), therefore this graph is well-defined and there are \textbf{no} multiple edges between two nodes. We next show that the transformation that maps an $\omega$-string $s$ into its output structure is FO-definable, whenever the SST is 1-bounded and aperiodic. Using the fact that variable flow is FO-definable, we show that for any two variables $X,Y$, we can capture in FO, a path from $(X^d, i)$ to $(Y^e, j)$ for $d, e\in \{in, out\}$ in $G_T(s)$ and all positions $i, j$. We are in state $q_i$ at position $i$. For example, \begin{enumerate} \item There is a path from $(Z^{d},1)$ to $(Y^{out},5)$ for $d \in \{in,out\}$. This is because $Z$ at position 1 flows into $Z$ at position 4 (path $(Z^{in},4)$ to $(Z^{in},1)$, edge from and $(Z^{in},1)$ to $(Z^{out},1)$, path from $(Z^{out},1)$ to $(Z^{out},4)$) this value of $Z$ is used in updating $Y$ at position 5 as $Y:=bZc$. (edge from $(Z^{out},4)$ to $(Y^{out},5)$). \item There is a path from $(Y^{in},5)$ to $(Z^{d},2)$. This is because $Z$ at position 2 flows into $Y$ at position 5 by the update $Y:=YbZc$. (path from $(Z^{in},4)$ to $(Z^{in},2)$; path from $(Z^{in},2)$ to $(Z^{out},2)$ and path from $(Z^{out},2)$ to $(Z^{out},4)$; lastly, edge from $(Z^{out},4)$ to $(Y^{out},5)$. Also, note the edge from $(Y^{in},5)$ to $(Y^{in},4)$, and the path from $(Y^{in},4)$ to $(Y^{out},4)$, edge from $(Y^{out},4)$ to $(Z^{in},4)$). \item There is a path from $(X^{in},3)$ to $(Z^{in},1)$ in Figure \ref{fig:outputgraph}. However, $Z$ at position 1 does not flow into $X$ at position 3. Note that this is because of the update $X:=XY$ at position 6, and $Z$ at position 1 flows into $Y$ at position 5, (note the path from $(Z^{out},1)$ to $(Z^{out},4)$, and the edge from $(Z^{out},4)$ to $(Y^{out},5)$) and $X$ at position 3 flows into $X$ at position 5 (note the path from $(X^{out},3)$ to $(X^{out},5)$) and $X$ and $Y$ are catenated in order at position 5 (the edge from $(X^{out},5)$ to $(Y^{in},5)$) to define $X$ at position 6 (edge from $(Y^{out},5)$ to $(X^{out},6)$). \end{enumerate} Thus, the SST output graphs have a nice property, which connects a path from $(X^d,i)$ to $(Y^{d'},j)$ based on the variable flow, and the catenation of variables in updates. Formally, let $T$ be an \textbf{aperiodic,1-bounded} \sst{} $T$. Let $s\in dom(T)$, $G_T(s)$ its \sst-output structure and $r=q_0\dots q_n\dots$ the accepting run of $T$ on $s$. For all variables $X,Y\in \mathcal{X}$, all positions $i,j\in \mathrm{dom}(s)\cup\{0\}$, all $d,d'\in\{in,out\}$, there exists a path from node $(X^{d},i)$ to node $(Y^{d'},j)$ in $G_T(s)$ iff $(X,i)$ and $(Y,j)$ are both useful and one of the following conditions hold: either \begin{enumerate} \item $(q_i,X)\rightsquigarrow^{s[i{+}1{:}j]}_1 (q_j,Y)$ and $d' = out$, or \item $(q_j,Y)\rightsquigarrow^{s[j{+}1{:}i]}_1(q_i,X)$ and $d = in$, or \item there exists $k\geq max(i,j)$ and two variables $X',Y'$ such $(q_i,X)\rightsquigarrow^{s[i{{+}1:}k]}_1 (q_k,X')$, $(q_j,Y)\rightsquigarrow^{s[j{+}1{:}k]}_1 (q_k,Y')$ and $X'$ and $Y'$ are concatenated in this order\footnote{by concatenated we mean that there exists a variable update whose rhs is of the form $\dots X'\dots Y'\dots$} by $r$ when reading $s[k+1]$. \end{enumerate} \subsection{Proof of Lemma \ref{lem:fopath}} \label{app:fopath} Let $s\in dom(T)$, $G_T(s)$ its \sst-output structure and $r=q_0\dots q_n\dots$ the accepting run of $T$ on $s$. For all variables $X,Y\in \mathcal{X}$, all positions $i,j\in \mathrm{dom}(s)\cup\{0\}$, all $d,d'\in\{in,out\}$, there exists a path from node $(X^{d},i)$ to node $(Y^{d'},j)$ in $G_T(s)$ iff $(X,i)$ and $(Y,j)$ are both useful and one of the following conditions hold: either \begin{enumerate} \item $(q_i,X)\rightsquigarrow^{s[i{+}1{:}j]}_1 (q_j,Y)$ and $d' = out$, or \item $(q_j,Y)\rightsquigarrow^{s[j{+}1{:}i]}_1(q_i,X)$ and $d = in$, or \item there exists $k\geq max(i,j)$ and two variables $X',Y'$ such $(q_i,X)\rightsquigarrow^{s[i{{+}1:}k]}_1 (q_k,X')$, $(q_j,Y)\rightsquigarrow^{s[j{+}1{:}k]}_1 (q_k,Y')$ and $X'$ and $Y'$ are concatenated in this order\footnote{by concatenated we mean that there exists a variable update whose rhs is of the form $\dots X'\dots Y'\dots$} by $r$ when reading $s[k+1]$. \end{enumerate} For all variables $X,Y\in \mathcal{X}$, we denote by $Cat_{X,Y}$ the set of pairs $(p,q,a)\in Q^2\times \Sigma$ such that there exists a transition from $p$ to $q$ on $a$ whose variable update concatenates $X$ and $Y$ (in this order). Define a formula for condition $(3)$: $$ \Psi_3^{X,Y}(x,y) \ \equiv \ \exists z\cdot x\preceq z \wedge y\preceq z \wedge \bigvee_{X',Y'\in\mathcal{X}, (p,q,a)\in Cat_{X',Y'}}[ \\ L_a(z)\wedge \phi_{X\rightsquigarrow X'}(x,z) \wedge \phi_{Y\rightsquigarrow Y'}(y,z) \wedge \phi_p(z)\wedge \phi_q(z+1)] $$ Then, formula $\text{path}_{X,Y,d,d'}(x,y)$ is defined by $$ \begin{array}{llllllllll} \text{path}_{X,Y,in,in}(x,y) & \equiv & \phi_{Y\rightsquigarrow X}(y,x) \vee \Psi_3^{X,Y} \\ \text{path}_{X,Y,in,out}(x,y) & \equiv & \phi_{Y\rightsquigarrow X}(y,x) \vee \phi_{X\rightsquigarrow Y}(x,y) \vee \Psi_3^{X,Y} \\ \text{path}_{X,Y,out,in}(x,y) & \equiv & \text{false} \\ \text{path}_{X,Y,out,out}(x,y) & \equiv & \phi_{X\rightsquigarrow Y}(x,y) \vee \Psi_3^{X,Y} \\ \end{array} $$ \begin{enumerate} \item $\text{path}_{X,Y,in,in}(x,y)$ : Recall that a path from $(X^{in},x)$ to $(Y^{in},y)$ always passes through $(X^{out},y)$. Hence, $y \leq x$, (the $X^{in}$ arrows move on the left) and it must be that there is an edge from $(X^{out},y)$ to $(Y^{in},y)$, which happens when $X$ and $Y$ are concatenated in order. This is handled by $\Psi_3^{X,Y}$. The other possibility is when $Y$ occurs in the right side of $X$ at $x$; in this case, we have an edge from $(X^{in},x)$ to some $(Z^{in},x)$ ($Z$ could be $Y$), leading into a path to $(Y^{in},y)$, $y \leq x$. Clearly, here $Y$ flows into $X$ between $y$ and $x$. \item $\text{path}_{X,Y,in,out}(x,y)$ : One possibility is that there is a path from $(X^{in},x)$ to $(X^{in},z)$, with $x > z$, and $(X^{in},z)$ has an edge to $(X^{out},z)$. An edge from $(X^{out},z)$ to $(Y^{in}, z)$ happens if $X, Y$ are concatenated in order at $z$. A path from $(Y^{in}, z)$ to $(Y^{in}, y)$ and then $(Y^{out}, y)$, $z \geq y$ can happen. This is handled by $\Psi_3^{X,Y}$. A second case is similar to 1, where we have a path from $(X^{in},x)$ to $(Y^{in},y)$, where $Y$ flows into $X$ between $y$ and $x$, and then there is a path from $(Y^{in},y)$ to $(Y^{out},y)$. A third case is when $X$ occurs in the right of $Y$ at $y$; in this case, we have an edge from $(X^{out},y)$ to $(Y^{out},y)$. Also, there is a path from $(X^{in},y)$ to $(X^{out},y)$ which goes through $(X^{in},x)$, $x < y$. Clearly, $X$ flows into $Y$ between $x$ and $y$. \item Note that $\text{path}_{X,Y,out,in}(x,y)$ is false, since there is no path or edge from $X^{out}$ to $Y^{in}$ capturing flow; the edge from $X^{out}$ to $Y^{in}$ occurs only when a catenation of $X, Y$ happens in order. \item $\text{path}_{X,Y,out,out}(x,y)$ : One case is when $X,Y$ are catenated in order on the rightside of some variable $Z$. Then there is a path from $(X^{out},x)$ to $(Y^{out},y)$ (through $(Y^{in},y)$), as handled by $\Psi_3^{X,Y}$. The other case is when $X$ occurs on the right of $Y$ at $y$. Then there is an edge from $(X^{out},x)$ to $(Y^{out},y)$ ($x=y-1$) (may be through some $(Z^{in},x)$). \end{enumerate} \input{app-sst-fot.tex} \input{app-2wst-sst.tex} \input{app-sst-la.tex} \section{Proofs from Section \ref{sec:fot-2wst}} \label{app:fot-2wst} \begin{lemma} \label{cor-lem} The proof of Lemma \ref{app:lem1-conv} works when $\mathcal{A}$ is a two-way, aperiodic Muller automaton with star-free look-around. That is, $L(\mathcal{A})$ is aperiodic. \end{lemma} \begin{proof} When we allow star-free look-around, we also have aperiodic Muller look-ahead automaton $A$ and aperiodic look-behind automata $B$ along with $\mathcal{A}$. Consider a string in $w \in \Sigma^{\omega}$ with a factorization $w=w_1w_2w_3 \dots$. Whenever we consider $M_{w_i}$ for some $w_i$ in $\mathcal{T}(\mathcal{A})$ (recall this is the monoid for $\mathcal{A}$ without the look-around), we also consider the transition matrix of $w_1 \dots w_i$ with respect to $B$, and the matrices $M_{w_{j}}, j > i$ with respect to $A$. A string $w'=w'_1w'_2 \dots$ is then equivalent to $w$ if the respective matrices $M_{w_i}, M_{w'_i}$ match in $\mathcal{A}$, and so do the others (prefixes upto $w_i, w'_i$ for look-behind $B$ and $M_{w_j}, M_{w'_j}$ for look-ahead $A$). We know that the transition monoids of $A, B$ are aperiodic. That is, there exists $m_A, m_B \in \mathbb{N}$ such that for all strings $y$, and all pairs of states $p,q$ in ($A$ or $B$), $y^{m_x} \in L_{pq}$ iff $y^{m_x+1} \in L_{pq}$ for $x \in \{A,B\}$. In the presence of look-around, we keep track of the transition monoids in $A, \mathcal{A}$ and $B$ at the same time. It can be seen that for two infinite strings $w,w'$ as above, the map $h$ from $\Sigma^*$ to the transition monoids with respect to $B, \mathcal{A}, A$ will be a morphism : this is seen by considering the respective morphisms $h_1, h_2, h_3$ where $h_1$ is the morphism from $\Sigma^*$ to the transition monoid of $B$ (a DFA), $h_2$ is the morphism from $\Sigma^*$ to the transition monoid of $\mathcal{A}$ (the \ensuremath{\mathsf{2WST}}{}), and $h_3$ is the morphism from $\Sigma^*$ to the transition monoid of $A$ (a DMA). Clearly, equivalent strings $w, w'$ (equivalent with respect to $h$) are either both accepted or rejected by the $\ensuremath{\mathsf{2WST}}_{sf}$. The aperiodicity of the combined monoid follows from the aperiodicity of the respective monoids of $B, \mathcal{A}$ and $A$. Thus, $L(\mathcal{A})$ is recognized by a morphism to an aperiodic monoid, and hence is an aperiodic language. \end{proof} \subsection{Lemma \ref{fo-behav}} \label{app:fo-behav} \begin{proof} Lets look at the underlying two-way Muller automaton of the \ensuremath{\mathsf{2WST}}$_{sf}$ $\mathcal{A}$. Since $\mathcal{A}$ is aperiodic, so is the underlying automaton. Let $s=s[1 \dots x'-1]s[x' \dots y']s[y' \dots]$ be a decomposition of $s$. Let $x,y$ be any two positions in $s$. Depending on $x,y$, we have 4 cases. If $x=y$ then there is a substring $s_1$ of $s$ such that $s_1 \in L^{rr}_{qq'}$ or $s_1 \in L^{ll}_{qq'}$. Similarly, if $x<y$, then there is a substring $s_1$ of $s$ such that $s_1 \in L^{lr}_{qq'}$. Likewise if $x>y$, then there is a substring $s_2$ of $s$ such that $s_2 \in L^{rl}_{qq'}$. If we can characterize $L_{qq'}^{xy}$ in FO for all cases, we are done, since $\psi_{q,q'}(x,y)$ will then be the disjunction of all these formulae. Using lemma \ref{cor-lem}, the underlying input language $L(\mathcal{A})\subseteq \Sigma^{\omega}$ can be shown to be aperiodic, by constructing the morphism $h: \Sigma^* \rightarrow M$ recognizing $L(\mathcal{A})$, where $M$ is the aperiodic monoid described in lemma\ref{cor-lem}. It is known \cite{dg08SIWT} that every aperiodic language $\subseteq \Sigma^{\omega}$ is FO-definable. We now show that $h$ recognizes $L_{qq'}^{xy}$. Consider $w \in L_{qq'}^{xy}$. For the morphism $h: \Sigma^* \rightarrow M$ as above, let $w' \in \Sigma^+$ be such that $h(w)=h(w')$. Then it is easy to see that $w' \in L_{qq'}^{xy}$. Then $h$ is a morphism to a finite aperiodic monoid that recognizes $L_{qq'}^{xy}$. Hence, $L_{qq'}^{xy}$ is aperiodic and hence FO-definable. For each case, $x <y, x > y, x=y$, let $\exists x \exists y \psi_{q,q'}(x,y)$ be the FO formula that captures $L_{qq'}^{xy}$. For a particular assignment of positions $x, y$, it can be seen that all words $u$ which have a run starting at position $x$ in state $q$, to state $q'$ in position $y$ will satisfy $\psi_{q,q'}(x,y)$. \end{proof} \subsection{FOT $\subseteq$ Aperiodic \ensuremath{\mathsf{2WST}}$_{sf}$} \label{app:fo-wst} \begin{definition} A \ensuremath{\mathsf{2WST}}{} with FO instructions ($\ensuremath{\mathsf{2WST}}{}_{fo}$) is a tuple $\mathcal{A}=(\Sigma, \Gamma, Q, q_0, \delta, F)$ such that $\Sigma, \Gamma, Q, q_0$ and $F$ are as defined in section \ref{sec:2wst} and $\delta: Q \times \Sigma \times \phi_1 \rightarrow Q \times \Gamma \times \phi_2$ is the transition function where $\phi_1$ is a set of FO formulae over $\Sigma$ with one free variable defining the guard of the transition, and $\phi_2$ is a set of FO formulae over $\Sigma$ with two free variables defining the jump of the input head. Given a state $q$ and position $x$ of the input string $s$, the transition $\delta(q,\phi_1)=(q',b,\phi_2)$ is enabled if $s \models \phi_1(x)$, and as a result $b$ is written on the output, and the input head moves to position $y$ such that $s \models \phi_2(x,y)$. Note that the jump is deterministic, at each state $q$ and each position $x$, the formula $\phi_2(x,y)$ is such that there is a unique position $y$ to which the reading head will jump. A $\ensuremath{\mathsf{2WST}}{}_{fo}$ is aperiodic if the underlying input language accepted is aperiodic. \end{definition} As in the case of \ensuremath{\mathsf{2WST}}{}, we assume that the entire input is read by the $\ensuremath{\mathsf{2WST}}{}_{fo}$, failing which the output is not defined. \begin{lemma}(\fot{} $\subseteq$ \ensuremath{\mathsf{2WST}}$_{fo}$) \label{foi-2wst} Any $\omega$-transformation captured by an \fot{} is also captured by a \ensuremath{\mathsf{2WST}}$_{fo}$. \end{lemma} \begin{proof} Let $T=(\Sigma, \Gamma, \phi_{dom}, C, \phi_{pos}, \phi_{\prec})$ be a \fot{}. We define the \ensuremath{\mathsf{2WST}}$_{fo}$ $\mathcal{A}=(\Sigma, \Gamma, Q, q_0, \delta, F)$ such that $\inter{T}=\inter{\mathcal{A}}$. The states $Q$ of $\mathcal{A}$ correspond to the copies in $T$. So, $Q=C$. Given a state $q$ and a position $x$ of the input string, the transition that checks a guard at $x$, and decides the jump to position $y$, after writing a symbol $b$ on the output is obtained from the formulae $is\_string$, $\phi_{b}^q(x)$ and $\phi^{q,q'}(x,y)$. $is\_string$ describes the input string, $\phi_{b}^q(x)$ is an FO formula that captures the position $x$ in copy $q$ (and also asserts that the output is $b \in \Gamma$), $\phi^{q,q'}(x,y)$ is an FO formula that enables the $\prec$ relation between positions $x,y$ of copies $q,q'$ respectively. In $\mathcal{A}$, this amounts to evaluating the guard $\phi_b^q(x)$ at position $x$ in state $q$, outputting $b$, and jumping to position $y$ of the input in state $q'$ if the input string satisfies $\phi^{q,q'}(x,y)$. Thus, we write the transition as $\delta(q, a, \phi_b^q(x))=(q',b,\phi^{q,q'}(x,y))$. The initial state $q_0$ of $\mathcal{A}$ is the copy $c$ which has its first position $y$ such that $x \nprec y$ for all positions $y \neq x$. Since the \fot{} is string-to-string, we will have such a unique copy. Thus, $q_0=d$ where $d$ is a copy satisfying the formula $\exists y[first^d(y)]$. The set $F$ of Muller states of the constructed \ensuremath{\mathsf{2WST}}$_{fo}$ is all possible subsets of $Q$, since we have captured the transitions between copies (now states) correctly. Now we have to show that $\mathcal{A}$ is aperiodic. This amounts to showing that there exists some integer $n$ such that for all pairs of states $p,q,$ $v^n \in L_{pq}^{xy}$ iff $v^{n+1} \in L_{pq}^{xy}$ for all strings $v \in \Sigma^*$, and $x,y \in \{l,r\}$. Recall that the states of the automaton correspond to the copies of the \fot{}, and $v^n \in L_{pq}^{xy}$ means that $v^n \models \phi^{p,q}(x,y)$. Thus we have to show that $v^n \models \phi^{p,q}(x,y)$ iff $v^{n+1} \models \phi^{p,q}(x,y)$ for all strings $v \in \Sigma^*$. Note that since the domain of an \fot{} is aperiodic, for any strings $u,v,w$, there exists an integer $n$ such that $uv^nw$ is in the domain of $T$ iff $uv^{n+1}w$ is. In particular, for any pair of positions $x,y$ in $v,w$ respectively, and copies $p, q$, the formula $\varphi^{p,q}(x,y)$ which asserts the existence of a path from position $x$ of copy $p$ to position $y$ of copy $q$ is such that $uv^nw \models \varphi^{p,q}(x,y)$ iff $uv^{n+1}w \models \varphi^{p,q}(x,y)$ (note that this is true since these formulae evaluate in the same way for all strings in the domain, and the domain is aperiodic). This means that $uv^nw \in L_{pq}^{xy}$ iff $uv^{n+1}w \in L_{pq}^{xy}$ for all $u,v,w$. In particular, for $u=w=\epsilon$, we obtain $v^n \in L_{pq}^{xy}$ iff $v^{n+1} \in L_{pq}^{xy}$ for all strings $v \in \Sigma^*$, showing that $\mathcal{A}$ is aperiodic. \end{proof} Before we show \ensuremath{\mathsf{2WST}}$_{fo} \subseteq \ensuremath{\mathsf{2WST}}_{sf}$, we need the next two lemmas. \begin{lemma} \label{lem-int-1} Let $\Delta, \Delta'$ be disjoint subsets of $\Sigma$, and let $L \subseteq \Sigma^{\omega}$ be an aperiodic language such that each string in $L$ contains exactly one occurrence of a symbol from $\Delta$ and one occurrence of a symbol from $\Delta'$. Then $L$ can be written as the finite union of disjoint languages $R_{\ell}.a.R_{m}.b.R_{r}$ where $(a,b) \in (\Delta \times \Delta') \cup (\Delta' \times \Delta)$, $R_{\ell}, R_m \subseteq (\Sigma -\Delta -\Delta')^*$, and $R_r \subseteq (\Sigma -\Delta -\Delta')^{\omega}$. Moreover, $R_{\ell}, R_m$ and $R_r$ are aperiodic. \end{lemma} \begin{proof} Let $\mathcal{A}$ be a deterministic, aperiodic Muller automaton accepting $L$. From our assumption, it follows that each path in $\mathcal{A}$ from the initial state $q_0$ passes through exactly one transition labeled with a symbol from $\Delta$ and one transition labeled with a symbol from $\Delta'$. Let $(q,a,q') \in Q \times \Delta \times Q, (p, b, p') \in Q \times \Delta' \times Q$ be two such transitions. Let $R_{\ell}$ consist of all finite strings from $q_0$ to $q$, and let $R_m$ consist of all finite strings from $q'$ to $p$, and let $R_r$ be the set of all strings from $p'$ which continously witnesses some Muller set from some point onwards. Since the underlying automaton is aperiodic, it is easy to see that the restricted automata for $R_{\ell}, R_m, R_r$ are also aperiodic. Hence, $R_{\ell}, R_m$ are aperiodic languages $\subseteq \Sigma^*$ while $R_r$ is an aperiodic $\omega$-language. This breakup using $R_{\ell}, R_m$ and $R_r$ accounts for strings where the symbol from $\Delta$ occurs first, and the symbol from $\Delta'$ occurs later. Symmetrically, we can define $R'_{\ell}, R'_m$ and $R'_r$ to be the breakup for strings of $L$ where a symbol of $\Delta'$ is seen first, followed by a symbol of $\Delta$. Clearly, $L$ is the finite union of languages $R_{\ell}.a.R_{m}.b.R_{r}$ and $R'_{\ell}.a.R'_{m}.b.R'_{r}$, where $R_{\ell}, R'_{\ell}, R_{m}, R'_{m}, R_{r}$ and $R'_{r}$ are all aperiodic. \end{proof} \begin{lemma} \label{lem-int-2} Let $\Delta \subseteq \Sigma$, and let $L \subseteq \Sigma^{\omega}$ be an aperiodic language such that each string in $L$ contains exactly one occurrence of a symbol from $\Delta$. Then $L$ can be written as the finite union of disjoint languages $R_{\ell}.a.R_{r}$ where $a \in \Delta$, $R_{\ell} \subseteq (\Sigma -\Delta)^*$, and $R_r \subseteq (\Sigma -\Delta)^{\omega}$. Moreover, $R_{\ell}$ and $R_r$ are aperiodic. \end{lemma} The proof of Lemma \ref{lem-int-2} is similar to that of Lemma \ref{lem-int-1}. \begin{lemma}($\ensuremath{\mathsf{2WST}}_{fo} \subseteq \ensuremath{\mathsf{2WST}}_{sf}$) \label{2wstfo-2wst} An $\omega$-transformation captured by an aperiodic $\ensuremath{\mathsf{2WST}}_{fo}$ is also captured by an aperiodic $\ensuremath{\mathsf{2WST}}_{sf}$. \end{lemma} \begin{proof} To prove this, we show that Aperiodic $\ensuremath{\mathsf{2WST}}{}_{fo} \subseteq$ Aperiodic $\ensuremath{\mathsf{2WST}}{}_\ensuremath{sf}$. Let $\mathcal{T}=(\Sigma, \Gamma, Q, q_0, \delta, F)$ be an aperiodic $\ensuremath{\mathsf{2WST}}{}_{fo}$. We define an aperiodic $\ensuremath{\mathsf{2WST}}{}_{sf}$ (with star free look around) $(T, A, B)$ where $T=(\Sigma, \Gamma, Q, q_0, \delta, F)$ capturing the same transformation. A transition of the $\ensuremath{\mathsf{2WST}}{}_{fo}$ is of the form $\delta(q,a, \varphi_1)=(q', z, \varphi_2)$. $\varphi_1(x)$ is an FO formula that acts as the guard of the transition, while $\varphi_2(x,y)$ is an FO formula that deterministically decides the jump to a position $y$ from the current position $x$. The languages of these formulae, $L(\varphi_1)$ and $L(\varphi_2)$ are aperiodic, and one can construct aperiodic Muller automata accepting $L(\varphi_1)$ and $L(\varphi_2)$. From Lemma \ref{lem-int-2}, we can write $L(\varphi_1)$ as a finite union of disjoint languages $R'_{\ell}.(a,1).R'_{r}$ with $R'_{\ell} \subseteq [\Sigma \times \{0\}]^*$ and $R'_{r} \subseteq [\Sigma \times \{0\}]^{\omega}$. It is easy to see that one can construct aperiodic automata accepting $R_{\ell}$ and $R_{m}$, the projections of $R'_{\ell}$ and $R'_{m}$ on $\Sigma$. We have to now show how to simulate the jumps of $\varphi_2$ by moving one cell at a time. First we augment $\varphi_2(x,y)$ in such a way that we know whether $y< x$ or $y >x$ or $y=x$. This is done by rewriting $\varphi_2(x,y)$ as $\exists y (y \sim x\wedge \varphi_2(x,y))$ where $\sim \in \{<, =, >\}$. Clearly, the new formula is also FO, and the language of the formula is aperiodic. If $y < x$, by Lemma \ref{lem-int-1}, the language of $\varphi_2(x,y)$ can be written as $R'_{\ell}(a,1,0) R'_m (b,0,1) R'_r$, where $R'_{\ell}, R'_m \subseteq [\Sigma \times \{0\} \times \{0\}]^*$ and $R'_r \subseteq [\Sigma \times \{0\} \times \{0\}]^{\omega}$. Let $R_{\ell}, R_m$ and $R_r$ be the projections of $R'_{\ell}, R'_m$ and $R'_r$ to $\Sigma$. We can construct an aperiodic look-behind automata for $R_{\ell} a R_m b$ and an aperiodic look ahead Muller automaton for $R_r$. This is possible since $R_{\ell},R_m $ are aperiodic. To walk cell by cell, instead of jumping, the $\ensuremath{\mathsf{2WST}}_{sf}$ does the following. (1) construct the aperiodic automaton that accepts the reverse of $R_m$ (this is possible since the reverse of an aperiodic language is aperiodic), (2) simulate this reverse automaton on each transition, and remember the state reached in this automaton in the finite control, while moving left cell by cell each time, (3) when an accepting state is reached in the reverse automaton, check the look-behind $R_{\ell}$, and look-ahead $R_m b R_r$. Note that there is an aperiodic look-ahead Muller automaton for $R_m b R_r$. If indeed at the position where we are at an accepting state of the reverse of $R_m$ automaton, the look-ahead and look-behind are satisfied, then we can stop moving left. A similar construction works when $y>x$. Clearly, each transition of the aperiodic $\ensuremath{\mathsf{2WST}}_{fo}$ can be simulated by a $\ensuremath{\mathsf{2WST}}_{sf}$ with star-free look around. The aperiodicity of $\ensuremath{\mathsf{2WST}}_{sf}$ follows from the fact the input language accepted by the $\ensuremath{\mathsf{2WST}}_{sf}$ is same as that of the $\ensuremath{\mathsf{2WST}}_{fo}$, and is aperiodic. \end{proof} \subsection{Formal Construction of FOT from Aperiodic SST} \label{app-fot-cons} We describe the construction of the \fot{} from the 1-bounded, aperiodic \sst{}. In the case of finite strings, if the output function of the accepting state is $X_1 \dots X_n$, then $(X_1^{in}, |s|)$ is the start node, on reading string $s$. The path from $(X_1^{in}, |s|)$ to $(X_1^{out}, |s|)$, followed by the path from $(X_2^{in}, |s|)$ to $(X_2^{out}, |s|)$ and so on gives the output. Unlike the finite string case, one of the difficulties here, is to specify the start node of the \fot{} since the strings are infinite. The first thing we do, in order to specify the start node, is to identify the position where some Muller set starts, and the rest of the run stays in that set. This is done for instance, in Proposition \ref{prop:fostates} by the formula $\psi^{Rec}_P$. We can easily catch the first such position where $\psi^{Rec}_P$ holds. This position will be labeled in the \fot{} with a unique symbol $\perp$. Let $O \subseteq \Gamma^*$ be the finite set of output strings $\gamma_i$ that appear in the variable updates of the \sst{}. That is, $O=\{\gamma_i \mid \rho(q,a)(X)=\gamma_0X_1 \gamma_1 \dots \gamma_{n-1} X_n \gamma_n\}$. We build an \fot{} that marks the first position where $\psi^{Rec}_P$ evaluates to true as as $\perp$, outputs the contents of $X_1, \dots, X_{n-1}$ first till $\perp$, and then of $X_n$, where $F(P)=X_1\dots X_{n-1}X_n$ is the output function of the \sst{}. The \fot{} is defined as $(\Sigma, O \cup \{\perp\}, \phi_{dom}, C, \phi_{pos}, \phi_{\prec})$ where: \begin{itemize} \item $\phi_{dom}=is\_string \wedge \exists i\psi^{Rec}_P(i)$ where the FO formula $is\_string$ is a simple FO formula that says every position has a unique successor and predecessor. The conjunction with $\exists i\psi^{Rec}_P(i)$ says that there is a position $i$ of the string from where $\psi^{Rec}_P$ is true. \item $C=\mathcal{X} \times \{in, out\}$, \item $\phi_{pos}=\{\phi_{\gamma}^c(i) \mid c \in C, \gamma \in O \cup \{\perp\}\}$ is such that \begin{itemize} \item $\phi_{\perp}^{(X_1,in)}(i)=\bigvee_{\{P \in F \mid F(P)=X_1 \dots X_n\}}[\psi^{Rec}_P(i) \wedge \forall j(j \prec i \rightarrow \neg\psi^{Rec}_P(j))]$. $i$ is the first position from where a Muller set starts to hold continuosuly. \item for $\gamma \in O$, we define $\phi_{\gamma}^c(i)=\neg \phi_{\perp}^c(i) \wedge \psi_{\gamma}^c(i)$, where $\psi_{\gamma}^c(i)$ is \end{itemize} \begin{itemize} \item true, if $(i=0$), $c=(X,in)$ and $\gamma=\epsilon$, \item false, if $(i=0$), $c=(X,in)$ and $\gamma \neq \epsilon$, \item $\bigvee_{q \in Q, a \in \Sigma}\phi_q(i-1) \wedge L_a(i-1)$ if $c=(X,in)$, $i > 0$ and $\rho(q,a)(X)=\gamma Y_1\gamma_1 Y_2 \dots \gamma_n$. The formula $\phi_q(x)$ is defined in Proposition \ref{prop:fostates}. \item $\bigvee_{q \in Q, a \in \Sigma}\phi_q(i) \wedge L_a(i)$ if $c=(X,out)$, $i \geq 0$ and $\rho(q,a)(Y)=\gamma_0 Y_1\gamma_1 Y_2 \dots Y_k\gamma_k \dots \gamma_n$, for a unique $Y \in \mathcal{X}$, and $Y_k=X$ and $\gamma=\gamma_k$ for some $1 \leq k \leq n$. Note that $Y \in \mathcal{X}$ is unique since the \sst{} is 1-bounded (the \sst{} output-structure does not contain useless variables, and if $X$ appears in the rightside of two variables $Y,Z$ then one of them will be useless for the output) \item $\bigvee_{q \in Q, a \in \Sigma}\phi_q(i) \wedge L_a(i)$ if $c=(X,out)$, $i \geq 0$ and $\gamma=\epsilon$ if $X$ does not appear in the update of any variable in $\rho(q,a)$. \end{itemize} \item We next define $\phi^{c,d}(i,j)=\bigvee_{P \in F}[\psi^{Rec}_P \wedge \psi^{c,d}_P(i,j)] $, where $\psi^{c,d}_P(i,j)$ is defined as follows. Let $F(P)=X_1X_2 \dots X_{n-1}X_n$. Let $k$ be the earliest position where $\psi^{Rec}_P$ holds. Note that all these edges are defined only when a copy is useful, that is, it contributes to the output. The notion of usefulness has been defined in section \ref{sec:sst-fot}. \begin{itemize} \item $true \wedge useful_X(i)$, if $c=(X,in)$, $d=(X,out)$ for some variable $X$, and $i=j=0$. The formula $useful_X(i)$ is defined in Appendix \ref{app:useful}. \item $\phi_q(i-1) \wedge L_a(i-1) \wedge useful_X(i)$ if $c=(X,in), d=(X,out)$ $i=j>0$ and $\rho(q,a)(X)=\gamma$. \item $\phi_q(i) \wedge L_a(i) \wedge useful_X(i)$ if $c=(X,out)$, $d=(Y,in)$ for some variables $X,Y$, $i=j\geq 0$, and for some $Z$ we have $\rho(q,a)(Z)=\gamma_0 Z_1 \gamma_1 \dots Z_n \gamma_n$ with $Z_{\ell}=X$ and $Z_{\ell+1}=Y$ for some $1 \leq \ell \leq n$ \item $\phi_q(i-1) \wedge L_a(i-1) \wedge useful_X(i)$ if $C=(X,in)$, $d=(Y, in)$ for some variables $X,Y$, $i >0$, $j=i-1$, $\rho(q,a)(X)=\gamma Y \gamma_1 Y_2 \dots Y_n \gamma_n$ \item $\phi_q(i) \wedge L_a(i) \wedge useful_X(i)$ if $c=(X,out)$, $d=(Y,out)$ for some variables $X,Y$, $i+1=j$ and $\rho(q,a)(Y)=\gamma X_1 \dots X \gamma_n$. \item We do the above between copies upto position $k$, which influences the values of variables $X_1, \dots, X_{n-1}$, which produces the variable flow upto position $k$. Beyond position $k$, the contents of variables $X_1, \dots, X_{n-1}$ remain unchanged. Hence, for all $i \geq k$, and $1 \leq j \leq n-1$, we dont have any edges from $(X_j,out)$ at position $i$ to $(X_j,out)$ at position $i+1$, and from $(X_j,in)$ at position $i+1$ to $(X_j,in)$ at position $i$. We simply add a transition from $(X_j,out)$ to $(X_{j+1},in)$ at position $k$ to seamlessly catenate the contents of $X_1, \dots, X_{n-1}, X_n$ at position $k$. \item From $(X_n,in)$ at position $k$ onwards, we simply follow the edges as defined above, to obtain at each position, the correct output $X_1X_2 \dots X_n$. If at position $k$, $X_n:=X_n \gamma_0 Y_1 \dots \gamma_{n-1} Y_n \gamma_n$ then we have the connections from $(X_n, in)$ at position $k$ to $(X_n, in)$ at position $k-1$, which will eventually reach $(X_n, out)$ at position $k-1$. This is then connected to $(Y_1, in)$ at position $k-1$, and so on till we reach $(Y_n,out)$ at position $k-1$. This is then connected to $(X_n, out)$ at position $k$, rendering the correct output at position $k$. The same thing repeats for position $k+1$ and so on. \end{itemize} \end{itemize} Thanks to Lemma \ref{lem:fopath}, the transitive closure between some copy $(X,d)$ and $(Y,d')$ is FO-definable as $\phi^{(X,d),(Y,d')}_{\prec}=path_{X,Y,d,d'}(x,y)$. This completes the construction of the \fot{}. \section{Proofs from Section \ref{sec:2wst-sst} : $\sst_{\ensuremath{sf}} \subseteq \sst{}$} \label{app:starfree} We now show that we can eliminate the star-free look-around from the $\sst_{sf}$ $(T,A,B)$ without losing expressiveness. Eliminating the look behind is easy: $B$ can be simulated by computing for each state $p_B \in P_B$, the state $p_B'$ of $P_B$ reached by $B$ starting in $p_B$ on the current prefix, and whenever $p_B'$ is a final state of $B$, the transition is triggered. In order to remove the look-ahead, we need to keep track of $P_i \in2^{P_A}$ at every step. On processing a string $s=a_1 a_2 a_3 \ldots \in \Sigma^{\omega}$ in $T$ starting with $P_0=\emptyset$, we obtain successively $P_1, P_2, \dots$ where $P_{i+1}= P_{i+1}' \cup \{p_{i+1}\}$ such that $\delta(q_i, r_{i+1}, a_{i+1}, p_{i+1}) = q_{i+1}$, and for all $p\in P_i$, $\delta_A(p,a_{i+1})\in P_{i+1}'$. Thus, starting with $P_0=\emptyset$ and $\delta(q_0, r_{1}, a_{1}, p_{1}) = q_{1}$, we have $P_1=\{p_1\}$, $P_2=\delta_A(p_1, a_2) \cup \{p_2\}$ and so on. A configuration of the \sst$_{sf}$ is thus a tuple $(q, (r'_1, \dots, r'_n), 2^{P_A})$ where $r'_i$ is the state reached in $B$ on reading the current prefix from state $r_i$, assuming $P_B=\{r_1, \dots, r_n\}$, and $2^{P_A}$ is a set of states in $P_A$ obtained as explained above. We say that $\rho$ is an accepting run of $s$ if $(q_0,(r_1, \dots, r_n), P_0)$ is an initial configuration, i.e. $q_0\in Q_0, P_0=\emptyset$ and after some point, we only see all elements of exactly one Muller set $M_i$ repeating infinitely often in $Q$ as well as in $P_A$ i.e. $\Omega(\rho)_{1} = M_i$ from domain of $F$ and $\Omega(\rho)_2 = M_j$ from $P_f$. Also, $(q_i, (r'_1, \dots, r'_n), P_i) \stackrel{r_{k}, a, p_{i+1}}{\longrightarrow} (q'_i, (r''_1, \dots, r''_n), P_{i+1})$ iff $\delta(q_i,a,r_k,p_{i+1})=q'_i$, $P_{i+1}= \delta^*_A(P_{i},a) \cup \{p_{i+1}\}$ and $\delta_B(r'_j,a)=r''_j$ for $1 \leq j \leq n$ and the state $r''_k$ is an accepting state of $B$. A configuration in the \sst$_{sf}$ is said to be \emph{accessible} if it can be reached from an initial configuration, and \emph{co-accessible} if from it accepting configurations can be reached. It is \emph{useful} if it is both accessible and co-accessible. Note that from the mutual-exclusiveness of look-arounds and the determinism of $A,B$, it follows that for any input string, there is at most one run of the $\mathsf{SST}_{\ensuremath{sf}}$ from and to useful configurations, as shown in Appendix \ref{app:unique}. The concept of substitutions induced by a run can be naturally extended from $\mathsf{SST}$ to $\mathsf{SST}_{\ensuremath{sf}}$. Also, we can define the transformation implemented by an $\mathsf{SST}_{\ensuremath{sf}}$ in a straightforward manner. The transition monoid of an $\mathsf{SST}_{\ensuremath{sf}}$ is defined by matrices indexed by configurations $(q_i, (r_1, \dots, r_n), P_i)\in Q\times P_B^n \times 2^{P_A}$, using the notion of run defined before, and the definition of aperiodicity of $\mathsf{SST}_{\ensuremath{sf}}$ follows that of $\mathsf{SST}$. \subsection{Uniqueness of Accepting Runs in $\mathsf{SST}_{\ensuremath{sf}}$} \label{app:unique} Let $a_1a_2\dots \in \Sigma^{\omega}$ and $\rho: (q_0, (r_1, \dots, r_n), P_0) \stackrel{a_1}{\rightarrow}(q_1, (r_1^1, \dots, r_n^1), P_1)\stackrel{a_2}{\rightarrow}(q_2, (r_1^2, \dots, r_n^2), P_2) \dots$ be an accepting run in the $\mathsf{SST}_{\ensuremath{sf}}$. We show that $\rho$ as well as the sequences of transitions associated with $\rho$ are unique. Given a sequence of transitions of the $\mathsf{SST}_{\ensuremath{sf}}$, it is clear that there is exactly one run since both $A, B$ are deterministic. Lets assume that the sequence of transitions are not unique, that is there is another accepting run $\rho'$ for $a_1a_2 \dots$. Let $i$ be the smallest index where $\rho$ and $\rho'$ differ. The $(i-1)$th configuration is then some $(q_i, (r'_1, \dots, r'_n), P_i)$ in both $\rho, \rho'$. Let us assume that we have two transitions $\delta(q_i, r_j, a_i, p_i)=q_{i+1}$ and $\delta(q_i, r_k, a_i, p'_i)=q'_{i+1}$ enabled such that $r_j \neq r_k$ or $p_i \neq p'_i$ or $q_{i+1} \neq q'_{i+1}$. Assume $r_j \neq r_k$. Since both are trigerred, we have the prefix upto now is in $L(B_{r_j}) \cap L(B_{r_k})$ with $r_j \neq r_k$, which contradicts mutual exclusiveness of look-behind. If $p_i \neq p'_i$, then since both runs are accepting, we have the infinite suffix in $L(A_{p_i}) \cap L(A_{p'_i})$, which contradicts the mutual exclusiveness of look-ahead. If $r_j=r_k$ and $p_i=p'_i$, but $q_{i+1} \neq q'_{i+1}$, then $\delta$ is not a function, which is again a contradiction. \subsection*{Variable Flow and Transition Monoid of $\mathsf{SST}_{\ensuremath{sf}}$} \textbf{Variable Flow and Transition Monoid}. Let $P_A, P_B$ represent the states of the (deterministic) lookahead and look-behind automaton $A,B$, and $Q$ denote states of the $\mathsf{SST}_{\ensuremath{sf}}$. The transition monoid of an $\mathsf{SST}_{\ensuremath{sf}}$ depends on its configurations and variables. It extends the notion of transition monoid for $\mathsf{SST}$ with look-behind, look-ahead states components but is defined only on {\it useful} configurations $(q,(r'_1, \dots, r'_n), P)$. A configuration $(q,(r'_1, \dots, r'_n), P)$ is {\it useful} iff it is {\it accessible} and {\it co-accessible} : that is, $(q,(r'_1, \dots, r'_n), P)$ is reachable from the initial configuration $(q_0,(r_1, \dots, r_n),\varnothing)$ (here, $P_B=\{r_1, \dots, r_n\}$) and will reach a configuration $(q',(r''_1, \dots, r''_n),P')$ from where on, some muller subset of $Q$ is witnessed continuously, and some muller subset of $P_A$ is witnessed continuously. Note that given two useful configurations $(q,(r'_1, \dots, r'_n),P)$, $(q',(r''_1, \dots, r''_n), P')$ and a string $s\in\Sigma^*$, there exists \emph{at most} one run from $(q,(r'_1, \dots, r'_n),P)$ to $(q',(r''_1, \dots, r''_n), P')$ on $s$. Indeed, since $(q,(r'_1, \dots, r'_n), P)$ and $(q',(r''_1, \dots, r''_n), P')$ are both useful, there exists $s_1,s_2\in\Sigma^*$ such that $(q_0, (r_1, \dots, r_n),\varnothing)\rightsquigarrow^{s_1} (q,(r'_1, \dots, r'_n),P)$ and $(q',(r''_1, \dots, r''_n),P') \rightsquigarrow^{s_2} (q'', (r'''_1, \dots, r'''_n), P'')$ such that from $(q'', (r'''_1, \dots, r'''_n), P'')$, we settle in some Muller set of both $Q$ and $P_A$ reading some $w \in \Sigma^{\omega}$. If there are two runs from $(q,(r'_1, \dots, r'_n),P)$ to $(q',(r''_1, \dots, r''_n),P')$ on $s$, then there are two accepting runs for $s_1ss_2w$, which contradicts the fact that accepting runs are unique. We denote by $\textsf{useful}(T,A,B)$ the useful configurations of $(T,A,B)$. Thanks to the uniqueness of the sequence of transitions associated with the run of an $\mathsf{SST}_{\ensuremath{sf}}$ from and to useful configurations on a given string, one can extend the notion of variable flow naturally by considering, as for $\mathsf{SST}$, the composition of the variable updates along the run. Assume that $T$ has $j$ muller sets and $B$ has $k$ muller sets. A string $s\in \Sigma^*$ maps to a square matrix $M_s$ of dimension $|Q\times (P_B \times \dots \times P_B) \times 2^{P_A}|\cdot |\mathcal{X}|$ and is defined as \begin{itemize} \item $M_{s}[(q, (r'_1, \dots, r'_n),P), X][(q', (r''_1, \dots, r''_n), P'), X']=n, \alpha_1, \alpha_2$ if there exists a run $\rho$ from \\ $(q, (r'_1, \dots, r'_n), P)$ to $(q', (r''_1, \dots, r''_n), P')$ on $s$ such that $n$ copies of $X$ flows to $X'$ over the run $\rho$, and $(q, (r_1, \dots, r_n), P)$ and $(q', (r''_1, \dots, r''_n), P')$ are both useful (which implies that the sequence of transitions of $\rho$ from $(q, (r_1, \dots, r_n), P)$ to $(q', (r''_1, \dots, r''_n), P')$ is unique, as seen before), and \item $\alpha_1 \in \{0,1,\kappa\}^j$ and $\alpha_2 \in 2^{[\{0,1,\kappa\}^k]}$. $\alpha_1$ is a $j$-tuple keeping track for each of the $j$ muller sets of $T$, whether the set of states seen on reading a string $s$ is a muller set, a strict subset of it, or has seen a state outside of the muller set. Likewise, $\alpha_2$ is a set of $k$-tuples doing the same thing based on the transition from set $P$ to set $P'$. Note that since we keep a subset of states of $P_A$ in the configuration, we need to keep track of this information for each state in the set. Thus, $\alpha_1$ keeps track of the run from $q$ and whether it witnesses a full muller set (1), a partial muller set ($\kappa$), or goes outside of a muller set (0). Likewise, $\alpha_2$ keeps track of the same for each $p \in P_i$, the run from $p$. If a run is accepting, then $\alpha_2$ will eventually become the singleton $\{(0, \dots, 0, 1, 0, \dots, 0)\}$ corresponding to some muller set of $P_A$. \item $M_{s}[(q, (r'_1, \dots, r'_n),P), X][(q',(r''_1, \dots, r''_n),P'), X']=\bot$, otherwise. \end{itemize} \begin{lemma}\label{lem:aperiodicSSTLA} For all aperiodic 1-bounded $\mathsf{SST}_{\ensuremath{sf}}$ with star-free look-around, there exists an equivalent aperiodic 1-bounded SST. \end{lemma} \begin{proof} Let $(T,A,B)$ be an $\mathsf{SST}_{\ensuremath{sf}}$, with $A = (P_A, \Sigma, \delta_A, P_f)$ a deterministic lookahead muller automaton, $B=(P_B, \Sigma, \delta_B)$ be a deterministic look-behind automaton. Let $T = (\Sigma, \Gamma, Q, q_0,\delta, \mathcal{X}, \rho, F)$. Without loss of generality, we make the following \emph{unique successor} assumption \begin{itemize} \item For all states $q,q',q''\in Q$, and for all states $p, p' \in P_A$, and for all states $r, r' \in P_B$, and for any symbol $a \in \Sigma$, whenever $p \neq p'$ or $r \neq r'$, and if $\delta(q,r,a,p)=q'$, $\delta(q,r',a,p')=q''$, then $q'\neq q''$. \end{itemize} If this is not the case, say we have $p \neq p', r=r'$, and $q'=q''$. Then considering the state of $T$ as $(q,r)$, we obtain $\delta((q,r),a,p)=(q',r)=\delta((q,r),a,p')$. However, it is easy to define transitions $\delta((q,r),a,p)=(q',r)$, $\delta((q,r),a,p')=(q'',r)$ by duplicating the transitions of $q', q''$, without affecting anything else, especially the aperiodicity. The same argument can be given when $r \neq r'$ or both ($p \neq p'$ and $r \neq r'$). Thus, for our convenience, we assume the \emph{unique successor} assumption without loss of generality. \subsection{Elimination of look-around from $(T,A,B)$ : Construction of $T'$} We construct an aperiodic and 1-bounded \sst{} $T'$ equivalent to \sst$_{sf}$ $(T,A,B)$. As explained in definition of $\mathsf{SST}_{\ensuremath{sf}}$, the unique run of a string $s$ on $(T,A,B)$ is not only a sequence of $Q$-states, but also a collection of the look ahead states $2^{P_A}$, and maintains the reachable state from each state of $P_B$. At any time, the current state of $Q$, the $n$-tuple of reachable states of $P_B$, and the collection of look-ahead states $P \subseteq P_A$ is a configuration. For brevity of notation, let $\eta$ (we also use $\zeta, \eta'$ in the sequel) denote the $n$-tuple of $P_B$ states. A configuration $(q_1,\eta_1,P_1)$, on reading $a$, evolves into $(q_2,\eta_2,P_2 \cup\{p_2\})$, where $\delta(q_1,r_2,a,p_2)=q_2$ is a transition in the $\mathsf{SST}_{\ensuremath{sf}}$ and $\delta_A(P_1,a)=P_2$, where $\delta_A$ is the transition function of the look ahead automaton $A$, and the state reached from $r_2$ is an accepting state of $P_B$. Note that the transition monoid of the $\mathsf{SST}_{\ensuremath{sf}}$ is aperiodic and 1-bounded by assumption. We now show how to remove the look-around, resulting in an equivalent $\sst{}$ $T'$ whose transition monoid is aperiodic and 1-bounded. While defining $T'$, we put together all the states resulting from transitions of the form $(q,r,a,p,q')$ and $(q,r',a,p',q'')$ in the $\mathsf{SST}_{\ensuremath{sf}}$. We define $T'=(\Sigma, \Gamma,Q',q'_0, \delta', \mathcal{X}', \rho',Q_f')$ with: \begin{itemize} \item $Q' = 2^{\textsf{useful}(T,A,B)}$ where $\textsf{useful}(T,A,B)$ are the useful configurations of $(T,A,B)$ ;\\ (Note that we can pre-compute $\textsf{useful}(T,A,B)$ once we know $(T,A,B)$), \item $q'_0=\{(q_0,\eta,\emptyset)\}$ ($\eta=(r_1, \dots, r_n)$ where $P_B=\{r_1, \dots, r_n\}$. We assume wlog that, $(T,A,B)$ accepts at least one input. Therefore $(q_0,\eta,\emptyset)$ is useful), \item $Q'_f$, the set of muller sets of $T'$, is defined by the set of pairs $(S,R)$ where $S$ is any of the $j$ muller sets in $F$, and $R$ is any of the $k$ muller sets in $P_f$. \item $\mathcal{X}'=\{X_{q'} \mid X \in \mathcal{X}, q' \in \textsf{useful}(T,A,B)\}$, \item The transitions are defined as follows: $\delta'(S,a)=\bigcup_{(q,\eta,P)\in S}\Delta((q,\eta,P),a)$ where \\ $\Delta((q,\eta,P),a)=\{(q', \eta', P' \cup\{p'\}) \mid \delta(q,r,a,p') =q'$ and $\delta_A(P,a)=P'\}\cap \text{useful}(T,A,B)$. Each component of $\eta'$ is obtained from $\eta$ using $\delta_B$. \end{itemize} Before defining the update function, we first assume a total ordering $\preceq_{\text{useful}(T,A,B)}$ on $\text{useful}(T,A,B)$. For all $(p,\eta,P)$, we define the substitution $\sigma_{(p,\eta,P)}$ as $X \in \mathcal{X} \mapsto X_{(p,\eta, P)}$. Let $(S,a,S')$ be a transition of $T'$. Given a state $(q',\eta', P') \in S'$, there might be several predecessor states $(q_1, \eta_1, P_1),\dots,(q_k,\eta_k, P_k)$ in $S$ on reading $a$. The set $\{(q_1,\eta_1, P_1),\dots,(q_k, \eta_k, P_k)\} \subseteq S$ is denoted by $Pre_S((q',\eta',P'),a)$. Formally, it is defined by $\{ (q,\eta,P)\in S\ |\ (q',\eta',P')\in \Delta((q,\eta,P),a)\}$. We consider only the variable update of the transition from the minimal predecessor state. Indeed, since any string has at most one accepting run in the $\mathsf{SST}_{\ensuremath{sf}}$ $(T,A,B)$ (and at most one associated sequence of transitions), if two runs reach the same state at some point, they will anyway define the same output and therefore we can drop one of the variable update, as shown in \cite{FiliotTrivediLics12}. Formally, the variable update $\rho'(S,a,S')(X_{(q',\eta',P')})$, for all $X_{(q',\eta',P')}\in\mathcal{X}'$ is defined by $\epsilon$ if $(q',\eta',P') \notin S'$, and by $\sigma_{(q,\eta,P)}\circ \rho(q,r,a,p,q')(X)$, where $(q,\eta,P) = \text{min}\ \{ (t,\zeta,R)\in S\ |\ (q',\eta',P')\in \Delta((t,\zeta,R),a)\}$, and $\delta(q,r,a,p) = q'$ (by the \emph{unique successor} assumption the look-around states $p,r$ are unique). It is shown in \cite{FiliotTrivediLics12} that indeed $T'$ is equivalent to $T$. We show here that the transition monoid of $T'$ is aperiodic and $1$-bounded. For all $S\in Q'$, and $s \in \Sigma^*$, define $\Delta^*(S,s)=\{ (q',\eta',P') \mid \exists (q,\eta,P) \in S$ such that $(q,\eta,P) \rightsquigarrow^s_{T,A,B} (q',\eta',P')\}\cap\text{useful}(T,A,B)$. \subsection{Connecting Transition Monoids of $T'$ and $(T,A,B)$} \begin{lemma} \label{lem:int} Let $M_{T'}$ be the transition monoid of $T'$ and $M_{(T,A,B)}$ the transition monoid of $(T,A,B)$. Let $S_1,S_2\in Q'$, $X_{(q,\eta,P)},Y_{(q',\eta',P')}\in \mathcal{X}'$ and $s\in\Sigma^*$. \\ Then $M_{T',s}[S_1,X_{(q,\eta,P)}][S_2,Y_{(q',\eta',P')}]=i, \alpha_1, \alpha_2$ iff $S_2 = \Delta^*(S_1,s)$ and one of the following hold: \begin{enumerate} \item either $i=0$ and, $(q,\eta,P)\not\in S_1$ or $(q',\eta',P')\not\in S_2$, or \item $(q,\eta,P) \in S_1$, $(q',\eta',P')\in S_2$, $(q,\eta,P)$ is the minimal ancestor in $S_1$ of $(q',\eta',P')$ (i.e. $(q,\eta,P) = \text{min}\ \{ (t,\zeta,R)\in S_1\ |\ (q',\eta',P')\in \Delta^*((t,\zeta,R),s)\}$), and\\ $M_{(T,A,B),s}[(q,\eta,P),X][(q',\eta',P'),Y] = i, \alpha_1, \alpha_2$. \end{enumerate} \end{lemma} \begin{proof} It is easily shown that $M_{T',s}[S_1,X_{(q,\eta,P)}][S_2,Y_{(q',\eta',P')}]=i, \alpha_1, \alpha_2$ with $i \geq 0$ iff $S_2 = \Delta^*(S_1,s)$. Let us show the two other conditions. Assume that $M_{T',s}[S_1,X_{(q,\eta,P)}][S_2,Y_{(q',\eta',P')}] = i, \alpha_1, \alpha_2$. The variable update function is defined in $T'$ as follows: after reading string $s$, from state $S_1$, all the variables $Z_{(t,\zeta,R)}$ such that $(t,\zeta,R)\not\in S_2$ are reset to $\epsilon$ (and therefore no variable can flow from $S_1$ to them). In particular, if $(q',\eta', P')\not\in S_2$, then no variable can flow in $Y_{(q',\eta',P')}$ and $i=0$. Now, assume that $(q',\eta',P')\in S_2$, and consider the sequence of states $S_1,S'_1,S'_2,\dots,S'_k,S_2$ of $T'$ on reading $s$. By definition of the variable update, the variables that are used to update $Y_{(q',\eta',P')}$ on reading the last symbol of $s$ from $S'_k$ are copies of the form $Z_{(t,\zeta,R)}$ such that $(t,\zeta,R)$ is the minimal predecessor in $S'_k$ of $(q',\eta',P')$ (by $\Delta$). By induction, it is easily shown that if some variable $Z_{(t,\zeta,R)}$ flows to $Y_{(q',\eta',P')}$ from $S_1$ to $S_2$ on reading $s$, then $(t,\zeta,R)$ is necessarily the minimal ancestor (by $\Delta^*$) of $(q',\eta',P')$ on reading $s$. In particular if $(q,\eta,P)\not\in S_1$, then $i=0$. Finally, if $i>0$, then necessarily $(q,\eta,P)$ is the minimal ancestor in $S_1$ of $(q',\eta',P')$ on reading $s$, from $S_1$ to $S_2$, and since $T'$ mimics the variable update of $(T,A,B)$ on the copies, we get that $M_{(T,A,B),s}[(q,\eta,P),X][(q',\eta',P'),Y]=i, \alpha_1, \alpha_2$. The converse is shown similarly. \end{proof} \subsection{1-boundedness and aperiodicity of $T'$} 1-boundedness is an obvious consequence of the claim and the fact that $(T,A,B)$ is $1$-bounded. Let us show that $M_{T'}$ is aperiodic. We know that $M_{(T,A,B)}$ is aperiodic. Therefore there exists $n\in\mathbb{N}$ such that for all strings $s\in\Sigma^*$, $M_{(T,A,B),s}^n = M_{(T,A,B),s}^{n+1}$. We first show that $\forall$ $S_1,S_2\in Q'$, and all strings $s\in\Sigma^*$, $\Delta^*(S_1,s^n) = S_2$ iff $\Delta^*(S_1,s^{n+1}) = S_2$. Indeed, \begin{itemize} \item $S_2 = \Delta^*(S_1,s^n)$, iff $$S_2 = \{ (q',\eta', P')\in\textsf{useful}(T,A,B)\ |\ \exists (q,\eta,P)\in S_1,\ (q,\eta,P)\rightsquigarrow^{s^n}_{T,A,B},(q',\eta',P')\},$$ iff \item $S_2 = \{ (q',\eta',P')\in\textsf{useful}(T,A,B)\ |\ \exists (q,\eta,P)\in S_1,\ M_{(T,A,B),s}^n[(q,\eta,P),X][(q',\eta',P'),Y]=i, \alpha_1, \alpha_2$, $i \geq 0\text{ for some }X,Y\in\mathcal{X}\}$, iff \item by aperiodicity of $M_{(T,A,B)}$, $$S_2 = \{ (q',\eta',P')\in\textsf{useful}(T,A,B)\ |\ \exists (q,\eta,P)\in S_1,$$ $$~~~~~~M_{(T,A,B),s}^{n+1}[(q,\eta,P),X][(q',\eta',P'),Y]=i, \alpha_1, \alpha_2, i \geq 0 \\ \text{ for some }X,Y\in\mathcal{X}\}$$ iff \item $S_2 = \Delta^*(S_1,s^{n+1})$. \end{itemize} Let $S_1,S_2\in Q'$ and $X_{(q,\eta,P)}, Y_{(q',\eta',P')}\in \mathcal{X}$. Let also $s\in\Sigma^*$. We now show that the matrices corresponding to $s^n, s^{n+1}$ coincide, using Lemma \ref{lem:int}. By the first condition of Lemma \ref{lem:int}, we have \begin{quote} $M_{T',s}^n[S_1,X_{(q,\eta,P)}][S_2, Y_{(q',\eta',P')}] = i, \alpha_1, \alpha_2$ and condition $(1)$ of Lemma \ref{lem:int} holds, iff \\ $M_{T',s}^{n+1}[S_1,X_{(q,\eta,P)}][S_2, Y_{(q',\eta',P')}] = i, \alpha_1, \alpha_2$ and condition $(1)$ of Lemma \ref{lem:int} holds. \end{quote} \begin{itemize} \item Indeed, $M_{T',s}^n[S_1,X_{(q,\eta,P)}][S_2, Y_{(q',\eta',P')}] = 0, \alpha_1, \alpha_2$ and, $(q,\eta,P)\not\in S_1$ or $(q',\eta',P')\not\in S_2$ iff by Lemma \ref{lem:int}, $\Delta^*(S_1,s^n) = S_2$, and $(q,\eta,P)\not\in S_1$ or $(q',\eta',P')\not\in S_2$, iff \\ by what we just showed, $\Delta^*(S_1,s^{n+1}) = S_2$, and $(q,\eta,P)\not\in S_1$ or $(q',\eta',P')\not\in S_2$, iff by Lemma \ref{lem:int}, $M_{T',s}^{n+1}[S_1,X_{(q,\eta,P)}][S_2, Y_{(q',\eta',P')}] = 0, \alpha_1, \alpha_2$ and condition $(1)$ of Lemma \ref{lem:int} holds. \end{itemize} Let us now look at condition $(2)$ of Lemma \ref{lem:int}, and show that \begin{quote} $M_{T',s}^{n}[S_1,X_{(q,\eta,P)}][S_2, Y_{(q',\eta',P')}] = i, \alpha_1, \alpha_2$ and condition $(2)$ of Lemma \ref{lem:int} holds, iff \\ $M_{T',s}^{n+1}[S_1,X_{(q,\eta,P)}][S_2, Y_{(q',\eta',P')}] = i, \alpha_1, \alpha_2$ and condition $(2)$ of Lemma \ref{lem:int} holds. \end{quote} \begin{itemize} \item We only show one direction, the other being proved exactly similarly. Assume that \\ $M_{T',s}^{n}[S_1,X_{(q,\eta,P)}][S_2, Y_{(q',\eta',P')}] = i, \alpha_1, \alpha_2$ and $(q,\eta,P)\in S_1$, $(q',\eta',P')\in S_2$, and $(q,\eta,P)$ is the minimal ancestor in $S_1$ of $(q',\eta',P')$, and $M_{(T,A,B),s}^n[(q,\eta,P),X][(q',\eta',P'),Y] = i, \alpha_1, \alpha_2$. By Lemma \ref{lem:int}, we have $\Delta^*(S_1,s^n) = S_2$, and therefore $\Delta^*(S_1,s^{n+1}) = S_2$. Now, we have $(q,\eta,P) = \text{min}\ \{ (t,\zeta,R)\in S_1\ |\ (q',\eta',P')\in \Delta^*((t,\zeta, R),s^n)\}$. Since $\Delta^*((t,\zeta,R),s^n) = \Delta^*((t,\zeta,R),s^{n+1})$ for all $(t,\zeta,R)\in S_1$, we have $(q,\eta,P) = \text{min}\ \{ (t,\zeta,R)\in S_1\ |\ (q',\eta',P')\in \Delta^*((t,\zeta,R),s^{n+1})\}$. Finally, $M_{(T,A,B),s}^{n+1}[q,\eta,P,X][q',\eta',P',Y] = M_{(T,A,B),s}^{n}[q,\eta,P,X][q',\eta',P',Y]$ (by aperiodicity of $(T,A,B)$). By Lemma \ref{lem:int}, we obtain $M_{T',s}^{n+1}[S_1,X_{(q,\eta,P)}][S_2, Y_{(q',\eta',P')}] = i, \alpha_1, \alpha_2$ and hence condition $(2)$ of Lemma \ref{lem:int} is satisfied. \end{itemize} Using Lemma \ref{lem:int} and the aperiodicity of $M_{(T,A,B)}$, we obtain the aperiodicity of $M_{T'}$. \end{proof} \section{Proofs from Section \ref{subsec:sst}} \label{app:sst-basics} \subsection{Example of SST} \label{eg:sst} \begin{figure}[h] \tikzstyle{trans}=[-latex, rounded corners] \begin{center} \scalebox{0.9}{ \begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto, semithick,scale=.8] \tikzstyle{every state}=[fill=gold] \node[initial,state, initial text={}] at (6, 4) (A1) {$1$} ; \node[state] at (13,4) (B1) {$2$} ; \path (A1) edge [loop above] node {$\#\left|\begin{array}{llllllll}x:=x\#\\y:=\varepsilon\\z:=\varepsilon\end{array}\right.$} (A1); \path (A1) edge [bend left] node [above] {$\begin{array}{lllll} \vspace{-2mm}\\ \alpha|(x,y,z):=(x,\alpha y \alpha, z \alpha)\end{array}$} (B1); \path (B1) edge [loop above] node {$\alpha\left|\begin{array}{lllll} x:=x\\ y:=\alpha y \alpha \\ z := z\alpha \end{array}\right.$} (A1); \path (B1) edge [bend left] node [below] {$\begin{array}{l} \#|(x,y,z):=(xy\#,\varepsilon,\varepsilon) \\ \vspace{-2mm}\end{array}$} (A1); \end{tikzpicture} } \end{center} \vspace{-1em} \caption{Transformation $f_1$ given as streaming string transducers with $F(\set{2}) = x z$ is the output associated with Muller set $\set{2}$. $\alpha$ stands for $a,b$. \label{appfig:fo-example}} \vspace{-1em} \end{figure} \begin{example} The transformation $f_1$ introduced is definable by the \sst{} in Figure~\ref{appfig:fo-example}. Consider the successive valuations of $x, y,$ and $z$ upon reading the string $ab\#a^\omega$. \[ \begin{array}{r|cccccccccccccccccccccccccccccccccccccc} & & \!\!\!\!a\!\!\!\! & & \!\!\!\!b\!\!\!\! & & \!\!\!\!\#\!\!\!\! & & \!\!\!\!a\!\!\!\! & & \!\!\!\!a\!\!\!\! &\dots\\ \hline x & \varepsilon & & \varepsilon & & \varepsilon & & baab\# & & baab\# & & baab\# \\ y & \varepsilon & & aa & & baab & & \varepsilon & & aa & & aaaa \\ z & \varepsilon & & a & & ab & & \varepsilon & & a & & aa \\ \end{array} \] Notice that the limit of $x z$ exists and equals $baab\#a^\omega$. \end{example} \subsection{Transition Monoid for SSTs} \begin{lemma} \label{sst-monoid} $(M_T,\times,\textbf{1})$ is a monoid, where $\times$ is defined as matrix multiplication and the identity element $\textbf{1}$ is the matrix with diagonal elements $(\emptyset,\emptyset,\dots,\emptyset)$ and all non-diagonal elements being $\bot$. \end{lemma} \begin{proof} Consider any matrix $M_s$ where $s \in \Sigma^*$. Assume the \sst{} has $g$ variables $X_1, \dots, X_g$, and $m$ states $\{p_1, \dots, p_m\}$. Let there be an ordering $(p_i, X_j) < (p_i, X_l)$ for $j < l$ and $(p_i, X_j) < (p_k, X_j)$ for $i < k$ used in the transition monoid. Consider a row corresponding to some $(p,X_i)$. The only entries that are not $\perp$ in this row are of the form $[(p,X_i)(r,X_1)], \dots, [(p,X_i)(r,X_g)]$, for some state $r$, such that there is a run of $s$ from $p$ to $r$, $p, r \in \{p_1, \dots, p_m\}$. The $(x_1, \dots, x_n)$ component of all entries $[(p,X_i)(r,X_1)], \dots, [(p,X_i)(r,X_g)]$ are same. Let it be $(\kappa_1, \dots, \kappa_n)$. Let $[(p,X_i)(r,X_j)]=k_{ij}(\kappa_1, \dots, \kappa_n)$. Consider $M_s.\textbf{1}$. The $[(p,X)(r,-)]$ entries of the product are obtained from the $(p,X)$th row of $M_s$ and the $(r,-)$th column of $\textbf{1}$. The $(r,-)$th column of $\textbf{1}$ has exactly one $1(\emptyset, \dots, \emptyset)$, while all other elements are $\bot$. Let $p=p_c$ and $r=p_h$, with $c<h$ ($h<c$ is similar). Then the $[(p,X)(r,Y)]$ entry for $X=X_i, Y=X_j$ is of the form $\bot+ \dots + \bot + k_{ij}(\kappa_1, \dots, \kappa_n).1(\emptyset, \dots, \emptyset)+k_{i+1~j}(\kappa_1, \dots, \kappa_n).\bot$ $+ \dots +k_{gj}(\kappa_1, \dots, \kappa_n).\bot + \dots +\bot.$ Clearly, this is equal to $k_{ij}(\kappa_1, \dots, \kappa_n)$. Similarly, it can be shown that the $[(p,X_i)(r,X_j)]$th entry of $M_s$ is preserved in $\textbf{1}.M_s$. Associativity can also be checked easily. \end{proof} The mapping $M_{\bullet}$, which maps any string $s$ to its transition matrix $M_s$, is a morphism from $(\Sigma^*, ., \epsilon)$ to $(M_T, \times, \textbf{1})$. We say that the transition monoid $M_T$ of an \sst{} $T$ is $n$-bounded if in all entries $(j, (x_1, \dots,x_n))$ of the matrices of $M_T$, $j \leq n$. Clearly, any $n$-bounded transition monoid is finite. A streaming string transducer is \emph{aperiodic} if its transition monoid is aperiodic. An $\omega$-streaming string transducer with $n$ Muller acceptance sets is 1-bounded if its transition monoid is 1-bounded. That is, for all strings $s$, and all pairs $(p,Y)$, $(q,X)$, $M_s[p,Y][q,X] \in \{\bot\} \cup \{ (i, (x_1, \dots,x_n)) \mid i \leq 1\}$. \subsection{Example of Transition Monoid} \label{app-example} \begin{figure}[h] \begin{center} \begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=1cm, semithick,scale=0.9,every node/.style={scale=0.9}] \tikzstyle{every state}=[fill=gold,minimum size=1em] \node[state,fill=gold,accepting] at (8,-3) (C) {$q$} ; \node[state,fill=gold,accepting] at (2,-3) (B) {$r$} ; \node[state,initial, initial where=above,initial text={},fill=gold] at (5,-3) (D) {$t$} ; \path(B) edge[loop left] node {$a \mid X:=Xb$} (B); \path(C) edge[loop right] node {$b\mid Y:=YX$} (C); \path(B) edge[bend left] node {$b$} (D); \path(D) edge[bend left] node {$b\mid X:=bY$} (B); \path(C) edge[bend left] node {$a\mid X:=bX$} (D); \path(D) edge[bend left] node {$a\mid Y:=aX$} (C); \node[state,initial,initial text={},initial where=above,fill=gold,accepting] at (12,-3) (A1) {$u$} ; \node[state,fill=gold,accepting] at (15,-3) (B1) {$v$} ; \path(A1) edge[bend left] node {$a$} (B1); \path(B1) edge[bend left] node {$b$} (A1); \path(B1) edge[loop below] node {$a$} (B1); \path(A1) edge[loop below] node {$b$} (A1); \end{tikzpicture} \end{center} \caption{Muller accepting set of \sst{} on the left= $\{\{q\},\{r\}\}$. Also, $F(q)=XY$, $F(r)=X$. Muller accepting set for \sst{} on the right=$\{u,v\}$;$X:=X$ and $Y:=Y$ on all edges, $F(\{u,v\})=X$.} \label{fig:tm-ex1} \end{figure} In figure \ref{fig:tm-ex1} consider the strings $ab$ and $bb$ for the automaton on the left. The transition monoids are \[ M_{ab}=\begin{blockarray}{ccccccc} & \matindex{(t,X)} & \matindex{(t,Y)} & \matindex{(q,X)} & \matindex{(q,Y)} & \matindex{(r,X)} & \matindex{(r,Y)} \\ \begin{block}{c(cccccc)} \matindex{(t,X)} & \bot & \bot & 1,(0,0) & 2,(0,0) &\bot &\bot \\ \matindex{(t,Y)} & \bot & \bot & 0, (0,0) & 0, (0,0) & \bot & \bot \\ \matindex{(q,X)} & \bot & \bot & \bot & \bot & 0, (0,0) & 0, (0,0)\\ \matindex{(q,Y)} & \bot & \bot & \bot & \bot & 1, (0,0) &1, (0,0) \\ \matindex{(r,X)} & 1,(0,0) & 0, (0,0) & \bot & \bot & \bot & \bot\\ \matindex{(r,Y)} & 0,(0,0) & 1,(0,0) & \bot & \bot & \bot &\bot \\ \end{block} \end{blockarray} \] \[ M_{bb}=\begin{blockarray}{ccccccc} & \matindex{(t,X)} & \matindex{(t,Y)} & \matindex{(q,X)} & \matindex{(q,Y)} & \matindex{(r,X)} & \matindex{(r,Y)} \\ \begin{block}{c(cccccc)} \matindex{(t,X)} & 0,(0,0) & 0,(0,0) & \bot & \bot &\bot &\bot \\ \matindex{(t,Y)} & 1,(0,0) & 1,(0,0) & \bot & \bot & \bot & \bot \\ \matindex{(q,X)} & \bot & \bot & 1,(1,0) & 2, (1,0) &\bot & \bot\\ \matindex{(q,Y)} & \bot & \bot & 0,(1,0) & 1,(1,0) & \bot & \bot \\ \matindex{(r,X)} & \bot & \bot & \bot & \bot & 0,(0,0) & 0,(0,0)\\ \matindex{(r,Y)} & \bot & \bot & \bot & \bot & 1,(0,0) &1,(0,0) \\ \end{block} \end{blockarray} \] It can be checked that $M_{abbb}=M_{ab}M_{bb}$. Likewise, the transition monoid for $a,b$ for the automaton on the right is \[ M_{a}=\begin{blockarray}{ccccc} & \matindex{(u,X)} & \matindex{(u,Y)} & \matindex{(v,X)} & \matindex{(v,Y)} \\ \begin{block}{c(cccc)} \matindex{(u,X)} & \bot & \bot & 1(1) & 0(1) \\ \matindex{(u,Y)} & \bot & \bot & 0(1) & 1(1) \\ \matindex{(v,X)} & \bot & \bot & 1(v) & 0(v) \\ \matindex{(v,Y)} & \bot & \bot & 0(v) & 1(v) \\ \end{block} \end{blockarray} \] \[ M_{b}=\begin{blockarray}{ccccc} & \matindex{(u,X)} & \matindex{(u,Y)} & \matindex{(v,X)} & \matindex{(v,Y)} \\ \begin{block}{c(cccc)} \matindex{(u,X)} & 1(u) & 0(u) & \bot & \bot \\ \matindex{(u,Y)} & 0(u) & 1(u) & \bot & \bot \\ \matindex{(v,X)} & 1(1) & 0(1) & \bot & \bot \\ \matindex{(v,Y)} & 0(1) & 1(1) & \bot & \bot \\ \end{block} \end{blockarray} \] \begin{proposition}\label{prop:fodomain} The domain of an aperiodic \sst{} is FO-definable. \end{proposition} \begin{proof} Let $T = (\Sigma, \Gamma, Q, q_0, Q_f, \delta, \mathcal{X}, \rho, F)$ be an aperiodic SST and $M_T$ its (aperiodic) transition monoid. Let us define a function $\varphi$ which associates with each matrix $M\in M_T$, the $|Q|\times |Q|$ Boolean matrix $\varphi(M)$ defined by $\varphi(M)[p][q] =(x_1, \dots, x_n)$ iff there exist $X,Y\in\mathcal{X}$ such that $M_T[p,X][q,Y]=(k,(x_1, \dots,x_n))$, with $k \geq 0$. Clearly, $\varphi(M_T)$ is the transition monoid of the underlying input automaton of $T$ (ignoring the variable updates). The result follows, since the homomorphic image of an aperiodic monoid is aperiodic. \end{proof} \subsection{Aperiodic Streaming String Transducers} \section{Introduction} \label{sec:introduction} \input{introduction} \section{Preliminaries} \label{sec:prelims} \input{prelims} \section{Aperiodic Transformations} \label{sec:aperiodic} \input{model.tex} \section{FOTs $\equiv$ Aperiodic 2WST$_{sf}$ } \label{sec:fot-2wst} \input{fot-2wst.tex} \section{Aperiodic SST $\subset$ FOT} \label{sec:sst-fot} \label{sec:2wst-sst} \input{sst-fot-short} \vspace{-0.5em} \section{Conclusion} \vspace{-0.5em} We extended the notion of aperiodicity from finite string transformations to that on infinite strings. We have shown a way to generalize transition monoids for deterministic Muller automata to streaming string transducers and two-way finite state transducers that capture the FO definable global transformations. A interesting and natural next step is to investigate LTL-definable transformations, their connection with FO-definable transformations, and their practical applications in verification and synthesis. \subsection{First-Order Logic Definable Transformations} \label{subsec:fotrans} Courcelle~\cite{Cour94} initiated the study of structure transformations using MSO logic. His main idea was to define a transformation $(w, w') \in R$ by defining the string model of $w'$ using a finite number of copies of positions of the string model of $w$. The existence of positions, various edges, and position labels are then given as $\mathrm{MSO}(\Sigma)$ formulas. We study a restriction of his formalism to use first-order logic to express string transformations. \begin{definition} An \emph{FO string transducer} is a tuple $T {=} (\Sigma, \Gamma, \phi_{\mathrm{dom}}, C, \phi_{\mathrm{pos}}, \phi_{\preceq})$ where: \begin{itemize} \item $\Sigma$ and $\Gamma$ are finite sets of input and output alphabets; \item $\phi_\mathrm{dom}$ is a closed $\mathrm{FO}(\Sigma)$ formula characterizing the domain of the transformation; \item $C {=} \set{1, 2, \ldots, n}$ is a finite index set; \item $\phi_{\mathrm{pos}} {=} \set{ \phi^c_\gamma(x) : c \in C \text{ and } \gamma \in \Gamma}$ is a set of $\mathrm{FO}(\Sigma)$ formulae with a free variable $x$; \item $\phi_{\preceq} {=} \set{\phi^{c, d}_\preceq(x, y) : c, d \in C}$ is a set of $\mathrm{FO}(\Sigma)$ formulae with two free variables $x$ and $y$. \end{itemize} The transformation $\inter{T}$ defined by $T$ is as follows. A string $s$ with $\struc{s} = (\mathrm{dom}(s), \preceq, (L_a)_{a \in \Sigma})$ is in the domain of $\inter{T}$ if $s \models \phi_{\mathrm{dom}}$ and the output string $w$ with structure \\ $M = (D, \preceq^M, (L^M_\gamma)_{\gamma\in\Gamma})$ is such that \begin{itemize} \item $D = \set{ v^c \::\: v \in \mathrm{dom}(s), c \in C \text{ and } \phi^c(v)}$ is the set of positions where $\phi^c(v) \rmdef \lor_{\gamma \in \Gamma} \phi^c_\gamma(v)$; \item $\preceq^M {\subseteq} D {\times} D$ is the ordering relation between positions and it is such that for $v, u \in dom(s)$ and $c, d \in C$ we have that $v^c \preceq^M u^d$ if $w \models \phi^{c, d}_\preceq(v, u)$; and \item for all $v^c \in D$ we have that $L_\gamma^M(v^c)$ iff $\phi^c_\gamma(v)$. \end{itemize} \end{definition} Observe that the output is unique and therefore FO transducers implement functions. A string $s \in \Sigma^{\omega}$ can be represented by its string-graph with $dom(s)=\{i \in \mathbb{N}\}$, $\preceq=\{(i,j) \mid i \leq j\}$ and $L_a(i)$ iff $s[i] = a$ for all $i$. From now on, we denote the string-graph of $s$ as $s$ only. We say that an FO transducer is a \emph{string-to-string} transducer if its domain is restricted to string graphs and the output is also a string graph. We say that a string-to-string transformation is FO-definable if there exists an FO transducer implementing the transformation. We write $\fot{}$ for the set of FO-definable string-to-string $\omega$-transformations. \begin{example} Figure~\ref{fig:fo-example}(c) shows a transformation for an \fot{} that implements the transformation $f_1: \Sigma^* \{a,b\}^{\omega} \to \Sigma^{\omega}$, where $\Sigma=\{a,b, \#\}$, by replacing every maximal $\#$ free string $u$ into $\overline{u}u$. Let $\texttt{is\_string}_{\#}$ be an FO formula that defines a string that contains a $\#$, and let $\texttt{reach}_{\#}(x)$ be an FO formula that is true at a position which has a $\#$ at a later position. To define the \fot{} formally, we have $\phi_{dom}=\texttt{is\_string}_{\#}$, $\phi^1_{\gamma}(x) = \phi^2_{\gamma}(x) = L_{\gamma}(x) \wedge \neg L_{\#}(x) \wedge \texttt{reach}_{\#}(x)$, since we only keep the non $\#$ symbols that can ``reach'' a $\#$ in the input string in the first two copies. $\phi^3_{\gamma}(x) = L_{\#}(x) \vee (\neg L_{\#}(x) \wedge \neg \texttt{reach}_{\#}(x))$, since we only keep the $\#$'s, and the infinite suffix from where there are no $\#$'s. The full list of formulae $\phi^{i,j}$ can be seen in Appendix \ref{app:fot-example}. \end{example} \subsection{Two-way Transducers (\ensuremath{\mathsf{2WST}}{})} \label{sec:2wst} A \ensuremath{\mathsf{2WST}}{} is a tuple $T=(Q, \Sigma, \Gamma, q_0, \delta, F)$ where $\Sigma, \Gamma$ are respectively the input and output alphabet, $q_0$ is the initial state, $\delta$ is the transition function and $F \subseteq 2^Q$ is the acceptance set. The transition function is given by $\delta : Q \times \Sigma \rightarrow Q \times \Gamma^* \times \{1,0,-1\}$. A configuration of the \ensuremath{\mathsf{2WST}}{} is a pair $(q,i)$ where $q \in Q$ and $i \in \mathbb N$ is the current position of the input string. A run $r$ of a \ensuremath{\mathsf{2WST}}{} on a string $s \in \Sigma^{\omega}$ is a sequence of transitions $(q_0,i_0{=}0) \xrightarrow{a_1/c_1,dir} (q_1, i_1) \xrightarrow{a_2/c_2,dir} (q_2, i_2) \cdots$ where $a_i \in \Sigma$ is the input letter read and $c_i \in \Gamma^*$ is the output string produced during a transition and $i_j$s are the positions updated during a transition for all $j \in dom(s)$. $dir$ is the direction, $\{1,0,-1\}$. W.l.o.g. we can consider the outputs to be over $\Gamma \cup \{\epsilon\}$. The output $out(r)$ of a run $r$ is simply a concatenation of the individual outputs, i.e. $c_1c_2 \dots \in \Gamma^{\infty}$. We say that the transducer reads the whole string $s$ when $\sup \set{i_n \mid 0 \leq n <|r|} {=} \infty$. The output of $s$, denoted $T(s)$ is defined as $out(r)$ only if $\Omega(r) \in F$ and $r$ reads the whole string $s$. We write $\inter{T}$ for the transformation captured by $T$. \noindent{\bf Transition Monoid.} The transition monoid of a \ensuremath{\mathsf{2WST}}{} $T=(Q, \Sigma, \Gamma, q_0, \delta, \{F_1, \dots, F_n\})$ is the transition monoid of its underlying automaton. However, since the \ensuremath{\mathsf{2WST}}{} can read their input in both directions, the transition monoid definition must allow for reading the string starting from left side and leaving at the left (left-left) and similar other behaviors (left-right, right-left and right-right). Following~\cite{CD15}, we define the behaviors $\Bb_{xy}(w)$ of a string $w$ for $x, y \in \{\ell,r\}$. $\Bb_{\ell r}(w)$ is a set consisting of pairs $(p,q)$ of states such that starting in state $p$ in the left side of $w$ the transducer leaves $w$ in right side in state $q$. In the example in figure \ref{fig:fo-example}(a), we have $\Bb_{\ell r}(ab\#) = \set{(t,t), (p,t), (q,t)}$ and $\Bb_{r r}(ab\#) = \set{(q,t), (t,t), (p,q)}$. Two words $w_1, w_2$ are ``equivalent'' if their left-left, left-right, right-left and right-right behaviors are same. That is, $\Bb_{xy}(w_1)=\Bb_{xy}(w_2)$ for $x, y \in \{\ell,r\}$. The transition monoid of $T$ is the conjunction of the 4 behaviors, which also keeps track, in addition, the set of states witnessed in the run, as shown for the deterministic Muller automata earlier. For each string $w \in \Sigma^*$, $x, y \in \{\ell,r\}$, and states $p,q$, the entries of the matrix $M_{u}^{xy}[p][q]$ are of the form $\bot$, if there is no run from $p$ to $q$ on word $u$, starting from the side $x$ of $u$ and leaving it in side $y$, and is $(x_1,\ldots x_n)$ otherwise, where $x_i$ is defined exactly as in section \ref{ap-omega}. For equivalent words $u_1,u_2$, we have $M_{u_1}^{xy}[p][q]= M_{u_2}^{xy}[p][q]$ for all $x,y \in \{\ell, r\}$ and states $p,q$. Addition and multiplication of matrices are defined as in the case of Muller automata. See Appendix \ref{app:2way} for more details. Note that behavioral composition is quite complex, due to left-right movements. In particular, it can be seen from the example that $\Bb_{\ell r}(ab\#a\#)=\Bb_{\ell r}(ab\#)\Bb_{\ell \ell}(a\#)\Bb_{r r}(ab\#)\Bb_{\ell r}(a\#)$. Since we assume that the \ensuremath{\mathsf{2WST}}{} $T$ is deterministic and completely reads the input string $\alpha \in \Sigma^{\omega}$, we can find a unique factorization $\alpha= [\alpha_0\dots \alpha_{p_1}][\alpha_{p_1+1} \dots \alpha_{p_2}]\dots$ such that the run of $\mathcal{A}$ on each $\alpha$-block progresses from left to right, and each $\alpha$-block will be processed completely. That is, one can find a unique sequence of states $q_{p_1}, q_{p_2}, \dots$ such that the \ensuremath{\mathsf{2WST}}{} starting in initial state $q_0$ at the left of the block $\alpha_0\dots \alpha_{p_1}$ leaves it at the right in state $q_{p_1}$, starts the next block $\alpha_{p_1+1} \dots \alpha_{p_2}$ from the left in state $q_{p_1}$ and leaves it at the right in state $q_{p_2}$ and so on. We consider the languages $L^{xy}_{pq}$ for $x,y \in \{\ell,r\}$, where $\ell,r$ respectively stand for left and right. $L^{\ell \ell}_{pq}$ stands for all strings $w$ such that, starting at state $p$ at the left of $w$, one leaves the left of $w$ in state $q$. Similarly, $L^{r\ell}_{pq}$ stands for all strings $w$ such that starting at the right of $w$ in state $p$, one leaves the left of $w$ in state $q$. In figure \ref{fig:fo-example}(a), note that starting on the right of $ab\#$ in state $t$, we leave it on the right in state $t$, while we leave it on the left in state $p$. So $ab\# \in L^{r r}_{tt}, L^{r \ell}_{tp}$. Also, $ab \# \in L^{r r}_{pq}$. A \ensuremath{\mathsf{2WST}}{} is said to be \emph{aperiodic} iff for all strings $u \in \Sigma^*$, all states $p,q$ and $x,y \in \{l,r\}$, there exists some $m \geq 1$ such that $u^m \in L_{pq}^{xy}$ iff $u^{m+1} \in L_{pq}^{xy}$. \noindent{\bf Star-Free Lookaround.} We wish to introduce aperiodic \ensuremath{\mathsf{2WST}}{} that are capable of capturing FO-definable transformations. However, as we discussed earlier (see page \pageref{two-way} in the paragraph on two-way transducers) \ensuremath{\mathsf{2WST}}{} without look-ahead are strictly less expressive than MSO transducers. To remedy this we study aperiodic \ensuremath{\mathsf{2WST}}{}s enriched with star-free look-ahead (star-free look-back can be assumed for free). An aperiodic $\ensuremath{\mathsf{2WST}}{}$ with star-free look-around ($\ensuremath{\mathsf{2WST}}{}_{\ensuremath{sf}}$) is a tuple $(T, A, B)$ where $A$ is an aperiodic Muller look-ahead automaton and $B$ is an aperiodic look-behind automaton, resp., and $T = (\Sigma, \Gamma, Q, q_0, \delta, F)$ is an aperiodic \ensuremath{\mathsf{2WST}}{} as defined earlier except that the transition function $\delta: Q \times Q_B \times \Sigma \times Q_A \to Q \times \Gamma \times \set{-1, 0, +1}$ may consult look-ahead and look-behind automata to make its decisions. Let $s \in \Sigma^\omega$ be an input string, and $L(A, p)$ be the set of infinite strings accepted by $A$ starting in state $p$. Similarly, let $L(B,r)$ be the set of finite strings accepted by $B$ starting in state $r$. We assume that $\ensuremath{\mathsf{2WST}}_{\ensuremath{sf}}$ are \emph{deterministic} i.e. for every string $s \in \Sigma^\omega$ and every input position $i \leq |s|$, there is exactly one state $p \in Q_A$ and one state $r \in Q_B$ such that $s(i)s(i+1)\ldots \in L(A, p)$ and $s(0)s(1)\ldots s(i-1) \in L(B, r)$. If the current configuration is $(q, i)$ and $\delta(q, r, s(i), p) = (q', z, d)$ is a transition, such that the string $s(i)s(i+1)\ldots \in L(A, p) $ and $s(0)s(1)\ldots s(i-1) \in L(B, r)$, then $\ensuremath{\mathsf{2WST}}_{\ensuremath{sf}}$ writes $z \in \Gamma$ on the output tape and updates its configuration to $(q', i+d)$. Figure~\ref{fig:fo-example}(a) shows a \ensuremath{\mathsf{2WST}}{} with star-free look-ahead $\texttt{reach}_{\#}(x)$ capturing the transformation $f_1$ (details in App.~\ref{app:2way}). \subsection{Streaming $\omega$-String Transducers (SST)}\label{subsec:sst} Streaming string transducers(\sst{}s) manipulate a finite set of string variables to compute their output. In this section we introduce aperiodic \sst{}s for infinite strings. Let $\mathcal{X}$ be a finite set of variables and $\Gamma$ be a finite alphabet. A substitution $\sigma$ is defined as a mapping ${\sigma : \mathcal{X} \to (\Gamma \cup \mathcal{X})^*}$. A valuation is defined as a substitution $\sigma: \mathcal{X} \to \Gamma^*$. Let $\mathcal{S}_{\mathcal{X}, \Gamma}$ be the set of all substitutions $[\mathcal{X} \to (\Gamma \cup \mathcal{X})^*]$. Any substitution $\sigma$ can be extended to $\hat{\sigma}: (\Gamma \cup \mathcal{X})^* \to (\Gamma \cup \mathcal{X})^*$ in a straightforward manner. The composition $\sigma_1 \sigma_2$ of two substitutions $\sigma_1$ and $\sigma_2$ is defined as the standard function composition $\hat{\sigma_1} \sigma_2$, i.e. $\hat{\sigma_1}\sigma_2(x) = \hat{\sigma_1}(\sigma_2(x))$ for all $x \in \mathcal{X}$. We say that a string $u \in (\Gamma \cup \mathcal{X})^*$ is \emph{copyless{}} (or linear) if each $x \in \mathcal{X}$ occurs at most once in $u$. A substitution $\sigma$ is copyless{} if $\hat{\sigma}(u)$ is copyless{}, for all linear $u \in (\Gamma \cup \mathcal{X})^*$ . \begin{definition} A \emph{streaming $\omega$-string transducer} (\sst{}) is a tuple $T = (\Sigma, \Gamma, Q, q_0, \delta, \mathcal{X}, \rho, F)$ \begin{itemize} \item $\Sigma$ and $\Gamma$ are finite sets of input and output alphabets; \item $Q$ is a finite set of states with initial state $q_0$; \item $\delta:Q \times \Sigma \to Q$ is a transition function and $\mathcal{X}$ is a finite set of variables; \item $\rho : (Q \times \Sigma) \to \mathcal{S}_{\mathcal{X}, \Gamma}$ is a variable update function to copyless{} substitutions; \item $F: 2^Q \rightharpoonup \mathcal{X}^*$ is an output function such that for all $P \in \mathrm{dom}(F)$ the string $F(P)$ is copyless{} of form $x_1 \dots x_n$, and for $q, q' \in P$ and $a \in \Sigma$ s.t. $q' = \delta(q, a)$ we have \begin{itemize} \item $\rho(q, a)(x_i) = x_i$ for all $i < n$ and $\rho(q, a)(x_n) = x_n u$ for some $u \in (\Gamma \cup \mathcal{X})^*$. \end{itemize} \end{itemize} \end{definition} The concept of a run of an \sst{} is defined in an analogous manner to that of a Muller automaton. The sequence $\seq{\sigma_{r, i}}_{0 \leq i \leq |r|}$ of substitutions induced by a run $r = q_0 \xrightarrow{a_1} q_1 \xrightarrow{a_2} q_2 \ldots$ is defined inductively as the following: $\sigma_{r, i} {=} \sigma_{r, i{-}1} \rho(q_{i-1}, a_{i})$ for $0 < i \leq |r|$ and $\sigma_{r, 0} = x \in X \mapsto \varepsilon$. The output $T(r)$ of an infinite run $r$ of $T$ is defined only if $F(r)$ is defined and equals $T(r) \rmdef \lim_{i \to \infty} \seq{\sigma_{r, i}(F(r))}$, when the limit exists. If not, we pad $\bot^{\omega}$ to the obtained finite string to get $\lim_{i \to \infty} \seq{\sigma_{r, i}(F(r)) \bot^\omega}$ as the infinite output string. The assumptions on the output function $F$ in the definition of an \sst{} ensure that this limit always exist whenever $F(r)$ is defined. Indeed, when a run $r$ reaches a point from where it visits only states in $P$, these assumptions enforce the successive valuations of $F(P)$ to be an increasing sequence of strings by the prefix relation. The padding by unique letter $\bot$ ensures that the output is always an $\omega$-string. The output $T(s)$ of a string $s$ is then defined as the output $T(r)$ of its unique run $r$. The transformation $\inter{T}$ defined by an SST $T$ is the partial function $\set{(s, T(s)) \::\: T(s) \text{ is defined}}$. See Appendix \ref{eg:sst} for an example. We remark that for every \sst{} $T = (\Sigma, \Gamma, Q, q_0, \delta, \mathcal{X}, \rho, F)$, its domain is always an $\omega$-regular language defined by the Muller automaton $(\Sigma, Q, q_0, \delta, \mathrm{dom}(F))$, which can be constructed in linear time. However, the range of an \sst{} may not be $\omega$-regular. For instance, the range of the \sst-definable transformation $a^n\#^\omega \mapsto a^nb^n\#^\omega$ ($n\geq 0$) is not $\omega$-regular. \noindent{\bf Aperiodic Streaming String Transducers.} We define the notion of aperiodic \sst{}s by introducing an appropriate notion of transition monoid for transducers. The transition monoid of an \sst{} $T$ is based on the effect of a string $s$ on the states as well as on the variables. The effect on variables is characterized by, what we call, flow information that is given as a relation that describes the number of copies of the content of a given variable that contribute to another variable after reading a string $s$. Let $T = (\Sigma, \Gamma, Q, q_0, \delta, \mathcal{X}, \rho, F)$ be an \sst{}. Let $s$ be a string in $\Sigma^*$ and suppose that there exists a run $r$ of $T$ on $s$. Recall that this run induces a substitution $\sigma_r$ that maps each variable $X \in \mathcal{X}$ to a string $u \in (\Gamma \cup \mathcal{X})^*$. For string variables $X,Y\in \mathcal{X}$, states $p,q\in Q$, and $n \in \mathbb N$ we say that $n$ copies of $Y$ flow to $X$ from $p$ to $q$ if there exists a run $r$ on $s \in \Sigma^*$ from $p$ to $q$, and $Y$ occurs $n$ times in $\sigma_r(X)$. We extend the notion of transition monoid for the Muller automata as defined in Section~\ref{sec:prelims} for the transition monoid for SSTs to equip it with variables. Formally, the transition monoid $\mathcal{M}_T {=} (M_T, \times, \textbf{1})$ of an \sst{} $T = (\Sigma, \Gamma, Q, q_0, \delta, \mathcal{X}, \rho, \set{F_1, \ldots, F_n})$ is such that $M_T$ is a set of $|Q\times \mathcal{X}|\times|Q \times \mathcal{X}|$ square matrices over $(\mathbb N \times (\set{0, 1} \cup 2^Q)^n) \cup \set{\bot}$ along with matrix multiplication $\times$ defined for matrices in $M_T$ and identity element $\textbf{1} \in M_T$ is the matrix whose diagonal entries are $(1, (\emptyset, \emptyset, \ldots, \emptyset))$ and non-diagonal entries are all $\bot$'s. Formally $M_T {=} \set{M_s \::\: s \in \Sigma^*}$ is defined using matrices $M_s$ for strings $s\in \Sigma^*$ s.t. $M_s[(p, X)][(q, Y)] {=} \bot$ if there is no run from state $p$ to state $q$ over $s$ in $T$, otherwise $M_s[(p, X)][(q, Y)] = (k, (x_1, \dots, x_n)) \in (\mathbb N \times (\set{0, 1} \cup 2^Q)^n)$ where $x_i$ is defined exactly as in section \ref{ap-omega}, and $k$ copies of variable $X$ flow to variable $Y$ from state $p$ to state $q$ after reading $s$. We write $(p,X) \rightsquigarrow^u_{\alpha} (q,Y)$ for $M_u[(p, X)][(q, Y)] = \alpha$. It is easy to see that $M_\epsilon = \textbf{1}$. The operator $\times$ is simply matrix multiplication for matrices in $M_T$, however we need to define addition $\oplus$ and multiplication $\odot$ for elements $(\set{0, 1} \cup 2^Q)^n \cup \set{\bot}$ of the matrices. We have $\alpha_1 \odot \alpha_2 = \bot$ if $\alpha_1 = \bot$ or $\alpha_2 = \bot$, and if $\alpha_1 = (k_1, (x_1, \ldots, x_n))$ and $\alpha_2 = (k_2, (y_1, \ldots, y_n))$ then $\alpha_1 \odot \alpha_2 = (k_1\times k_2, (z_1, \ldots, z_n))$ s.t. for all $1 \leq i \leq n$ $z_i$ are defined as in~(\ref{eq1:product}) from Section~\ref{ap-omega}. Note that due to determinism of the \sst{}s we have that for every matrix $M_s$ and every state $p$ there is at most one state $q$ such that $M_s[p][q] \not = \bot$ and hence the only addition rules we need to introduce is $\alpha \oplus \bot = \bot \oplus \alpha = \alpha$, $0 \oplus 0=0$, $1 \oplus 1=1$ and $\kappa \oplus \kappa=\kappa$ for $\kappa \subseteq Q$. It is easy to see that $(M_T, \times, \textbf{1})$ is a monoid and we give a proof in Appendix~\ref{app:sst-basics}. We say that the transition monoid $M_T$ of an \sst{} $T$ is $1$-bounded if in all entries $(j, (x_1, \dots,x_n))$ of the matrices of $M_T$, $j \leq 1$. A streaming string transducer is \emph{aperiodic} if its transition monoid is aperiodic. \subsection{Aperiodic Monoids for $\omega$-String Languages} A monoid $\mathcal{M}$ is an algebraic structure $(M, \cdot, e)$ with a non-empty set $M$, a binary operation $\cdot$, and an identity element $e \in M$ such that for all $x, y, z \in M$ we have that $(x \cdot (y \cdot z)) {=} ((x \cdot y) \cdot z)$, and $x \cdot e = e \cdot x$ for all $x \in M$. We say that a monoid $(M, \cdot, e)$ is \emph{finite} if the set $M$ is finite. A monoid that we will use in this paper is the \emph{free} monoid, $(\Sigma^*,\cdot, \epsilon)$, which has a set of finite strings over some alphabet $\Sigma$ with the empty string $\epsilon$ as the identity. We define the notion of acceptance of a language via monoids. A morphism (or homomorphism) between two monoids $\mathcal{M} = (M, \cdot, e)$ and $\mathcal{M}' = (M', \times, e')$ is a mapping $h: M \rightarrow M'$ such that $h(e) = e'$ and $h(x \cdot y) = h(x) \times h(y)$. Let $h: \Sigma^* \rightarrow M,$ be a morphism from free monoid $(\Sigma^*, \cdot, \epsilon)$ to a finite monoid $(M, \cdot, e)$. Two strings $u, v \in \Sigma^{*}$ are said to be similar with respect to $h$ denoted $u \sim_h v$, if for some $n \in \mathbb{N} \cup \{\infty\}$, we can factorize $u, v$ as $u=u_1u_2 \dots u_n$ and $v=v_1 v_2 \dots v_n$ with $u_i, v_i \in \Sigma^+$ and $h(u_i)=h(v_i)$ for all $i$. Two $\omega$-strings are $h$-similar if we can find factorizations $u_1u_2 \dots$ and $v_1v_2 \dots$ such that $h(u_i) =h(v_i)$ for all $i$. Let $\cong$ be the transitive closure of $\sim_h$. $\cong$ is an equivalence relation. Note that since $M$ is finite, the equivalence relation $\cong$ is of finite index. For $w \in \Sigma^{\infty}$ we define $[w]_h$ as the set $\set{u \mid u \cong w}$. We say that a morphism $h$ accepts a language $L \subseteq \Sigma^{\infty}$ if $w \in L$ implies $[w]_h \subseteq L$ for all $w \in \Sigma^{\infty}$. We say that a monoid $(M, ., e)$ is \emph{aperiodic}~\cite{Strau94} if there exists $n \in \mathbb N$ such that for all $x \in M$, $x^n = x^{n+1}$. Note that for finite monoids, it is equivalent to require that for all $x\in M$, there exists $n\in \mathbb N$ such that $x^n= x^{n+1}$. A language $L \subseteq \Sigma^{\infty}$ is said to be aperiodic iff it is recognized by some morphism to a finite and aperiodic monoid (See Appendix~\ref{app:example-aperiodic}). \subsection{First-Order Logic for $\omega$-String Languages} A string $s \in \Sigma^{\omega}$ can be represented as a relational structure $\struc{s} {=} (\mathrm{dom}(s), \preceq^s, (L^s_a)_{a \in \Sigma})$, called the string model of $s$, where $\mathrm{dom}(s) = \set{1, 2, \ldots}$ is the set of positions in $s$, $\preceq^s$ is a binary relation over the positions in $s$ characterizing the natural order, i.e. $(x, y) \in \preceq^s$ if $x \leq y$; $L^s_a$, for all $a \in \Sigma$, are the unary predicates that hold for the positions in $s$ labeled with the alphabet $a$, i.e., $L^s_a(i)$ iff $s[i]=a$, for all $i\in \mathrm{dom}(s)$. When it is clear from context we will drop the superscript $s$ from the relations $\preceq^s$ and $L^s_a$. Properties of string models over the alphabet $\Sigma$ can be formalized by first-order logic denoted by $\mathrm{FO}(\Sigma)$. Formulas of $\mathrm{FO}(\Sigma)$ are built up from variables $x, y, \ldots$ ranging over positions of string models along with \emph{atomic formulae} of the form $x{=} y, x {\preceq} y$, and $L_a(x)$ for all $a \in \Sigma$ where formula $x{=}y$ states that variables $x$ and $y$ point to the same position, the formula $x \preceq y$ states that position corresponding to variable $x$ is not larger than that of $y$, and the formula $L_a(x)$ states that position $x$ has the label $a \in \Sigma$. Atomic formulae are connected with \emph{propositional connectives} $\neg$, $\wedge$, $\lor$, $\to$, and \emph{quantifiers} $\forall$ and $\exists$ that range over node variables and we use usual semantics for them. We say that a variable is \emph{free} in a formula if it does not occur in the scope of some quantifier. A \emph{sentence} is a formula with no free variables. We write $\phi(x_1, x_2, \ldots, x_k)$ to denote that at most the variables $x_1, \ldots, x_k$ occur free in $\phi$. For a string $s\in \Sigma^*$ and for positions $n_1, n_2, \ldots, n_k \in \mathrm{dom}(s)$ we say that $s$ with valuation $\nu = (n_1, n_2, \ldots, n_k)$ satisfies the formula $\phi(x_1, x_2, \ldots, x_k)$ and we write $(s, \nu) \models \phi(x_1, x_2, \ldots, x_k)$ or $s \models \phi(n_1, n_2, \ldots, n_k)$ if formula $\phi$ with $n_i$ as the interpretation of $x_i$ is satisfied in the string model $\struc{s}$. The language defined by an FO sentence $\phi$ is $L(\phi) \rmdef \set{s \in \Sigma^{\omega} \::\: \struc{s} \models \phi}$. We say that a language $L$ is FO-definable if there is an FO sentence $\phi$ such that $L = L(\phi)$. The following is a well known result. \begin{theorem}\cite{Strau94} \label{thm:fo-aperiodic} A language $L\subseteq \Sigma^*$ is \ensuremath{\mathrm{FO}}-definable iff it is aperiodic. \end{theorem} \subsection{Aperiodic Muller Automata for $\omega$-String Languages} \label{ap-omega} A deterministic Muller automaton (DMA) is a tuple $\mathcal{A} = (Q, q_0, \Sigma, \delta, F)$ where $Q$ is a finite set of states, $q_0 \in Q$ is the initial state, $\Sigma$ is an input alphabet, $\delta: Q \times \Sigma \to Q$ is a transition function, and $F \subseteq 2^Q$ are the accepting (Muller) sets. For states $q, q' \in Q$ and letter $a \in \Sigma$ we say that $(q, a, q')$ is a transition of the automaton $\mathcal{A}$ if $\delta(q,a ) = q'$ and we write $q \xrightarrow{a} q'$. We say that there is a run of $\mathcal{A}$ over a finite string $s = a_1 a_2 \ldots a_n \in \Sigma^*$ from state $p$ to state $q$ if there is a finite sequence of transitions $\seq{(p_0, a_1, p_1), (p_1, a_2, p_2), \ldots, (p_{n-1}, a_n, p_n)} \in (Q \times \Sigma \times Q)^*$ with $p = p_0$ and $q = p_n$. We write $L_{p, q}$ for the set of finite strings such that there is a run of $\mathcal{A}$ over $w$ from $p$ to $q$. We say that there is a run of $\mathcal{A}$ over an $\omega$-string $s = a_1 a_2 \ldots \in \Sigma^\omega$ if there is a sequence of transitions $\seq{(q_0, a_1, q_1), (q_1, a_2, q_2), \ldots} \in (Q \times \Sigma \times Q)^\omega$. For an infinite run $r$, we denote by $\Omega(r)$ the set of states that occur infinitely often in $r$. We say that an $\omega$-string $w$ is accepted by a Muller automaton $\mathcal{A}$ if the run of $\mathcal{A}$ on $w$ is such that $\Omega(r) \in F$ and we write $L(\mathcal{A})$ for the set of all $\omega$-strings accepted by $\mathcal{A}$. \\ A Muller automaton $\mathcal{A}$ is \emph{aperiodic} iff there exists some $m {\geq} 1$ s.t. $u^m {\in} L_{p,q}$ iff $u^{m+1} {\in} L_{p,q}$ for all $u \in \Sigma^*$ and $p, q \in Q$. Another equivalent way to define aperiodicity is using the transition monoid, which, to the best of our knowledge, has not been defined in the literature for Muller automata. Given a DMA $\mathcal{A} {=} (Q, q_0, \Sigma, \Delta, \set{F_1, \ldots, F_n})$, we define the transition monoid $\mathcal{M}_\mathcal{A} {=} (M_\mathcal{A}, \times, \textbf{1})$ of $\mathcal{A}$ as follows: $M_\mathcal{A}$ is a set of $|Q|\times|Q|$ square matrices over $(\set{0, 1} \cup 2^Q)^n \cup \set{\bot}$. Matrix multiplication $\times$ is defined for matrices in $M_\mathcal{A}$ with identity element $\textbf{1} \in M_\mathcal{A}$, where $\textbf{1}$ is the matrix whose diagonal entries are $(\emptyset, \emptyset, \ldots, \emptyset)$ and non-diagonal entries are all $\bot$'s. Formally, $M_\mathcal{A} {=} \set{M_s \::\: s \in \Sigma^*}$ is defined using matrices $M_s$ for strings $s\in \Sigma^*$ s.t. $M_s[p][q] {=} \bot$ if there is no run from $p$ to $q$ over $s$ in $\mathcal{A}$. Otherwise, let $P$ be the set of states (excluding $p$ and $q$) witnessed in the unique run from $p$ to $q$. Then $M_s[p][q] = (x_1, \dots, x_n) \in (\set{0, 1} \cup 2^Q)^n$ where (1) $x_i = 0$ iff $\exists r \in P \cup \{p,q\}$, $r \notin F_i$; (2) $x_i=1$ iff $P \cup \{p,q\}=F_i$, and (3) $x_i=P \cup \{p,q\}$ iff $P \cup \{p,q\} \subset F_i$. It is easy to see that $M_\epsilon = \textbf{1}$, since $\epsilon$ takes a state to itself and nowhere else. The operator $\times$ is simply matrix multiplication for matrices in $M_\mathcal{A}$, however we need to define addition $\oplus$ and multiplication $\odot$ for elements $(\set{0, 1} \cup 2^Q)^n \cup \set{\bot}$ of the matrices. We have $\alpha_1 \odot \alpha_2 = \bot$ if $\alpha_1 = \bot$ or $\alpha_2 = \bot$, and if $\alpha_1 = (x_1, \ldots, x_n)$ and $\alpha_2 = (y_1, \ldots, y_n)$ then $\alpha_1 \odot \alpha_2 = (z_1, \ldots, z_n)$ s.t.: \begin{equation} \resizebox{0.7 \textwidth}{!} { \tag{$\star$} \label{eq1:product} $z_i = \begin{cases} 0 & \text{if $x_i = 0$ or $y_i = 0$}\\ 1 & \text{if $(x_i = y_i = 1)$ or if $(x_i, y_i \subset F_i \text { and } x_i \cup y_i = F_i)$}\\ 1 & \text{if ($x_i = 1$ and $y_i \subset F_i$) or ($y_i = 1$ and $x_i \subset F_i$)} \\ x_i \cup y_i & \text{if $x_i, y_i \subset F_i$ and $x_i \cup y_i \subset F_i$} \end{cases} $ } \end{equation} Due to determinism, we have that for every matrix $M_s$ and every state $p$ there is at most one state $q$ such that $M_s[p][q] \not = \bot$ and hence the only addition rule we need to introduce is $\alpha \oplus \bot = \bot \oplus \alpha = \alpha$. It is easy to see that $(M_\mathcal{A}, \times, \textbf{1})$ is a monoid (a proof is deferred to the Appendix \ref{app:basic-muller}). It is straightforward to see that a Muller automaton is aperiodic if and only if its transition monoid is aperiodic. Appendix \ref{app:aper-equiv} gives a proof showing that a language $L \subseteq \Sigma^{\omega}$ is aperiodic iff there is an aperiodic DMA accepting it. \subsection{FO-definability of variable flow} To construct the \fot{}, we make use of the output structure for \sst{}. It is an intermediate representation of the output, and the transformation of any input string into its \sst-output structure will be shown to be FO-definable. For any \sst{} $T$ and string $s\in\mathrm{dom}(T)$, the \sst-output structure of $s$ is a relational structure $G_T(s)$ obtained by taking, for each variable $X\in\mathcal{X}$, two copies of $\mathrm{dom}(s)$, respectively denoted by $X^{in}$ and $X^{out}$. For notational convenience we assume that these structures are labeled on the edges. A pair $(X,i)$ is \emph{useful} if the content of variable $X$ before reading $s[i]$ will be part of the output after reading the whole string $s$. This structure satisfies the following \emph{invariants}: for all $i\in dom(s)$, $(1)$ the nodes $(X^{in}, i)$ and $(X^{out}, i)$ exist only if $(X,i)$ is useful, and $(2)$ there is a directed path from $(X^{in}, i)$ to $(X^{out}, i)$ whose labels are same as variable $X$ computed by $T$ after reading $s[i]$. \input{outputgraph.tex} \noindent We define \sst-output structures formally in Appendix \ref{app:sst-output}, however, the illustration above shows an \sst-output structure. We show only the variable updates. Dashed arrows represent variable updates for useless variables, and therefore does not belong the \sst-output structure. The path from $(X^{in},6)$ to $(X^{out},6)$ gives the contents of $X$ ($ceaaafbc$) after 6 steps. We write $O_T$ for the set of strings appearing in right-hand side of variable updates. We next show that the transformation that maps an $\omega$-string $s$ into its output structure is FO-definable, whenever the SST is 1-bounded and aperiodic. Using the fact that variable flow is FO-definable, we show that for any two variables $X,Y$, we can capture in FO, a path from $(X^d, i)$ to $(Y^e, j)$ for $d, e\in \{in, out\}$ in $G_T(s)$ and all positions $i, j$. \begin{lemma}\label{lem:fopath} Let $T$ be an \textbf{aperiodic,1-bounded} \sst{} $T$. For all $X,Y\in \mathcal{X}$ and all $d,d'\in \{in,out\}$, there exists an FO[$\Sigma$]-formula $\text{path}_{X,Y,d,d'}(x,y)$ with two free variables such that for all strings $s\in\mathrm{dom}(T)$ and all positions $i,j\in dom(s)$, $s\models \text{path}_{X,Y,d,d'}(i,j)$ iff there exists a path from $(X^d,i)$ to $(Y^{d'},j)$ in $G_T(s)$. \end{lemma} The proof of Lemma \ref{lem:fopath} is in Appendix \ref{app:fopath}. As seen in Appendix (in Proposition \ref{prop:fostates}) one can write a formula $\phi_q(x)$ (to capture the state $q$ reached) and formula $\psi^{Rec}_P$ (to capture the recurrence of a Muller set $P$) in an accepting run after reading a prefix. For each variable $X \in \mathcal{X}$, we have two copies $X^{in}$ and $X^{out}$ that serve as the copy set of the \fot{}. As given by the \sst{} output-structure, for each step $i$, state $q$ and symbol $a$, a copy is connected to copies in the previous step based on the updates $\rho(q,a)$. The full details of the \fot{} construction handling the Muller acceptance condition of the \sst{} are in Appendix \ref{app-fot-cons}. \section{Aperiodic $\ensuremath{\mathsf{2WST}}_{\ensuremath{sf}}$ $\subset$ Aperiodic SST} \label{sec:2wst-sst} \input{2wst-sst} \subsection{FO-definability of variable flow} \begin{proposition}\label{prop:foflow} Let $T$ be an aperiodic,1-bounded \sst{} $T$ with set of variables $\mathcal{X}$. For all variables $X,Y\in \mathcal{X}$, there exists an FO-formula $\phi_{X\rightsquigarrow Y}(x,y)$ with two free variables such that, for all strings $s\in dom(T)$ and any two positions $i\leq j\in dom(s)$, $s\models \phi_{X\rightsquigarrow Y}(i,j)$ iff $(q_i,X)\rightsquigarrow^{s[i{+}1{:}j]}_1 (q_j,Y)$, where $q_0\dots q_n \dots$ is the accepting run of $T$ on $s$. \end{proposition} Let $X\in\mathcal{X}$, $s\in\mathrm{dom}(T)$, $i\in \mathrm{dom}(s)$. Let $P \in 2^Q$ be a Muller accepting set with output $F(P)=X_1 \dots X_n$. Let $r = q_0\dots q_{n}\dots$ be an accepting run of $T$ on $s$. Then there is a position $j$ such that $\forall k >j$, only states in $P$ are visited. On all transitions beyond $j$, $X_1, \dots, X_{n-1}$ remain unchanged, while $X_n$ is updated as $X_nu$ for some $u \in (\mathcal{X} \cup \Gamma)^*$. We say that the pair $(X,i)$ is \emph{useful} if the content of variable $X$ before reading $s[i]$ will be part of the output after reading the whole string $s$. Formally, for an accepting run $r = q_0\dots q_{j}q_{j+1}\dots$, such that only states from the Muller set $P$ are seen after position $j$, we say that $(X,i)$ is useful for $s$ if $(q_{i-1}, X)\rightsquigarrow^{s[i{:}j] }_1(q,X_k)$ for some variable $X_k \in F(P)$, $k \leq n$, or if $(q_{i-1}, X)\rightsquigarrow^{s[i{:}\ell] }_1(q,X_n)$, with $q \in P$ and $\ell >j$. Thanks to Proposition \ref{prop:foflow}, this property is FO-definable (Proofs of propositions \ref{prop:foflow} and \ref{prop:contribution} are in Appendix \ref{app:varflow}). \begin{proposition}\label{prop:contribution} For all $X\in\mathcal{X}$, there exists an FO-formula $\text{useful}_X(i)$ s.t. for all strings $s\in dom(T)$ and all positions $i\in \mathrm{dom}(s)$, $s\models \text{useful}_X(i)$ iff $(X,i)$ is useful for string $s$. \end{proposition} The output structure for SSTs over finite words has been introduced in \cite{FKT14}. It is an intermediate representation of the output, and the transformation of any input string into its \sst-output structure will be shown to be FO-definable. For any \sst{} $T$ and string $s\in\mathrm{dom}(T)$, the \sst-output structure of $s$ is a relational structure $G_T(s)$ obtained by taking, for each variable $X\in\mathcal{X}$, two copies of $\mathrm{dom}(s)$, respectively denoted by $X^{in}$ and $X^{out}$. For notational convenience we assume that these structures are labeled on the edges. This structure satisfies the following \emph{invariants}: for all $i\in dom(s)$, $(1)$ the nodes $(X^{in}, i)$ and $(X^{out}, i)$ exist only if $(X,i)$ is useful, and $(2)$ there is a directed path from $(X^{in}, i)$ to $(X^{out}, i)$ whose sequence of labels is equal to the value of the variable $X$ computed by $T$ after reading $s[i]$. The condition on usefulness of nodes implies that \sst-output structures consist of a single directed component, and therefore they are edge-labeled string structures. \input{outputgraph} As an example of \sst-output structure consider Fig. \ref{fig:outputgraph}. We show only the variable updates. Dashed arrows represent variable updates for useless variables, and therefore does not belong the \sst-output structure. Initially the variable content of $Z$ is equal to $\epsilon$. It is represented by the $\epsilon$-edge from $(Z^{in}, 0)$ to $(Z^{out}, 0)$ in the first column. Then, variable $Z$ is updated to $Zc$. Therefore, the new content of $Z$ starts with $\epsilon$ (represented by the $\epsilon$-edge from $(Z^{in},1)$ to $(Z^{in},0)$, which is concatenated with the previous content of $Z$, and then concatenated with $c$ (it is represented by the $c$-edge from $(Z^{out},0)$ to $(Z^{out},1)$). Note that the invariant is satisfied. The content of variable $X$ at position 5 is given by the label of the path from $(X^{in},5)$ to $(X^{out},5)$, which is $c$. Also note that some edges are labelled by strings with several letters, but there are finitely many possible such strings. In particular, we denote by $O_T$ the set of all strings that appear in right-hand side of variable updates. \sst-output structures are defined formally in Appendix \ref{app:sst-output}. We next show that the transformation that maps an $\omega$-string $s$ into its output structure is FO-definable, whenever the SST is 1-bounded and aperiodic. Using the fact that variable flow is FO-definable, we show that for any two variables $X,Y$, we can capture in FO, a path from $(X^d, i)$ to $(Y^e, j)$ for $d, e\in \{in, out\}$ in $G_T(s)$ and all positions $i, j$. We are in state $q_i$ at position $i$. For example, there is a path from $(X^{in},3)$ to $(Z^{in},1)$ in Figure \ref{fig:outputgraph}. However, $Z$ at position 1 does not flow into $X$ at position 3. Note that this is because of the update $X:=XY$ at position 6, and $Z$ at position 1 flows into $Y$ at position 5, and $X$ at position 3 flows into $X$ at position 5, and $X$ and $Y$ are catenated in order at position 5 to define $X$ at position 6. Similarly, there is a path from $(Z^{d},1)$ to $(Y^{out},5)$ for $d \in \{in,out\}$. This is because $Z$ at position 1 flows into $Z$ at position 4, and this value of $Z$ is used in updating $Y$ at position 5 as $Y:=bZc$. Lastly, there is a path from $(Y^{in},5)$ to $(Z^{d},2)$. This is because $Z$ at position 2 flows into $Y$ at position 5 by the update $Y:=YbZc$. Thus, the SST output graphs have a nice property, which connects a path from $(X^d,i)$ to $(Y^{d'},j)$ based on the variable flow, and the catenation of variables in updates. Formally, let $T$ be an \textbf{aperiodic,1-bounded} \sst{} $T$. Let $s\in dom(T)$, $G_T(s)$ its \sst-output structure and $r=q_0\dots q_n\dots$ the accepting run of $T$ on $s$. For all variables $X,Y\in \mathcal{X}$, all positions $i,j\in \mathrm{dom}(s)\cup\{0\}$, all $d,d'\in\{in,out\}$, there exists a path from node $(X^{d},i)$ to node $(Y^{d'},j)$ in $G_T(s)$ iff $(X,i)$ and $(Y,j)$ are both useful and one of the following conditions hold: either \begin{enumerate} \item $(q_j,Y)\rightsquigarrow^{s[j{+}1{:}i]}_1(q_i,X)$ and $d = in$, or \item $(q_i,X)\rightsquigarrow^{s[i{+}1{:}j]}_1 (q_j,Y)$ and $d' = out$, or \item there exists $k\geq max(i,j)$ and two variables $X',Y'$ such $(q_i,X)\rightsquigarrow^{s[i{{+}1:}k]}_1 (q_k,X')$, $(q_j,Y)\rightsquigarrow^{s[j{+}1{:}k]}_1 (q_k,Y')$ and $X'$ and $Y'$ are concatenated in this order\footnote{by concatenated we mean that there exists a variable update whose rhs is of the form $\dots X'\dots Y'\dots$} by $r$ when reading $s[k+1]$. \end{enumerate} Using the fact that variable flow is FO-definable, we have \begin{lemma}\label{lem:fopath} Let $T$ be an \textbf{aperiodic,1-bounded} \sst{} $T$. For all $X,Y\in \mathcal{X}$ and all $d,d'\in \{in,out\}$, there exists an FO[$\Sigma$]-formula $\text{path}_{X,Y,d,d'}(x,y)$ with two free variables such that for all strings $s\in\mathrm{dom}(T)$ and all positions $i,j\in dom(s)$, $s\models \text{path}_{X,Y,d,d'}(i,j)$ iff there exists a path from $(X^d,i)$ to $(Y^{d'},j)$ in $G_T(s)$. \end{lemma} The proof of Lemma \ref{lem:fopath} is in Appendix \ref{app:fopath}. We can now formally construct an FOT given the 1-bounded, aperiodic, SST. The sequence of variable substitutions of an aperiodic, 1-bounded SST over a string can be represented as the copy set in FOTs. As seen in Appendix (in Proposition \ref{prop:fostates}) one can write a formula $\phi_q(x)$ to capture the state $q$ reached in an accepting run after reading a prefix. For each variable $X \in \mathcal{X}$, we have two copies $X^{in}$ and $X^{out}$ that serve as the copy set of the FOT. As given by the SST output-structure, for each step $i$, state $q$ and symbol $a$, a copy is connected to copies in the previous step based on the updates $\rho(q,a)$. In the following, we detail this in FO. Lemma \ref{lem:fopath} then captures a path in the FOT. The full details of the FOT construction can be found in Appendix \ref{app-fot-cons}. \end{proof}
{'timestamp': '2016-07-19T02:08:37', 'yymm': '1607', 'arxiv_id': '1607.04910', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04910'}
arxiv
\section{Introduction} While recurrent neural networks (RNNs) are seeing widespread success across many tasks, the fundamental architecture presents challenges to typical training algorithms. In particular, the problem of `vanishing/exploding gradients'~\cite{hochreiter1991untersuchungen} in gradient-based optimization persists, where gradients either vanish or diverge as one goes deeper into the network, resulting in slow training or numerical instability. The long short-term memory (LSTM) network~\cite{hochreiter1997long} was designed to overcome this issue. Recently, the use of norm-preserving operators in the transition matrix - the matrix of weights connecting subsequent \emph{internal} states - of the RNN have been explored~\cite{arjovsky2015unitary,mikolov2014learning,le2015simple}. Using operators with bounded eigenvalue spectrum should, as demonstrated by~\citeauthor{arjovsky2015unitary}~\shortcite{arjovsky2015unitary}, bound the norms of the gradients in the network, assuming an appropriate non-linearity is applied. Unitary matrices satisfy this requirement and are the focus of this work. Imposing unitarity (or orthogonality) on this transition matrix is however challenging for gradient-based optimization methods, as additive updates typically do not preserve unitarity. Solutions include \emph{re-unitarizing} after each batch, or using a \emph{parametrization} of unitary matrices closed under addition. In this work we propose a solution in the second category, using results from the theory of Lie algebras and Lie groups to define a general parametrization of unitary matrices in terms of skew-Hermitian matrices (elements of the Lie algebra associated to the Lie group of unitary matrices). As explained in more detail below, elements of this Lie algebra can be identified with unitary matrices, while the algebra is closed under addition, forming a vector space over real numbers. While we are motivated by the issues of RNNs, and we consider an application in RNNs, our primary focus here is on a core question: how can unitary matrices be learned? \emph{Assuming} the choice of a unitary transition matrix is an appropriate modelling choice, the gradients on this operator should ultimately guide it towards unitarity, if it is possible under the parametrization or learning scheme used. It is therefore useful to know which approach is best. We distil the problem into its simplest form (a learning task described in detail later), so that our findings cannot be confounded by other factors specific to the RNN long-term memory task, before demonstrating our parametrization in that setting. \subsection{Related work} We draw most inspiration from the recent work of~\citeauthor{arjovsky2015unitary}~\shortcite{arjovsky2015unitary}, who proposed a specific parametrization of unitary matrices and demonstrated its utility in standard long-term memory tasks for RNNs. We describe their parametrization here, as we use it later. Citing the difficulty of obtaining a general and efficient parametrization of unitary matrices, they use the fact that the unitary group is closed under matrix multiplication to form a composite operator: \begin{equation} U = \mathbf{D}_3 \mathbf{R}_2 \mathcal{F}^{-1} \mathbf{D}_2 \Pi \mathbf{R}_1 \mathcal{F} \mathbf{D}_1 \label{eqn:arjovsky} \end{equation} where each component is unitary and easily parametrized: \begin{itemize} \item $\mathbf{D}$ is a diagonal matrix with entries of the form $e^{i \alpha}$, $\alpha \in \mathbb{R}$ \item $\mathbf{R}$ is a complex reflection operator; $\mathbf{R} = \mathbb{I} - 2\frac{\mathbf{v}\mathbf{v}^{\dagger}}{\| \mathbf{v} \|^2}$ ($\dagger$ denotes Hermitian conjugate) \item $\mathcal{F}$ and $\mathcal{F}^{-1}$ are the Fourier and inverse Fourier transforms (or, in practice, their discrete matrix representations) \item $\Pi$ is a fixed permutation matrix \end{itemize} In total, this parametrization has $7n$ real learnable parameters ($2n$ for each reflection and $n$ for each diagonal operator), so describes a subspace of unitary matrices (which have $n^2$ real parameters). Nonetheless, they find that an RNN using this operator as its transition matrix outperforms LSTMs on the adding and memory tasks described first in~\citeauthor{hochreiter1997long}~\shortcite{hochreiter1997long}. This prompted us to consider other parametrizations of unitary matrices which might be more expressive or interpretable. \citeauthor{mikolov2014learning}~\shortcite{mikolov2014learning} constrain a part of the transition matrix to be close to the identity, acting as a form of long-term memory store, while \citeauthor{le2015simple}~\shortcite{le2015simple} \emph{initialize} it to the identity, and then use ReLUs as non-linearities. \citeauthor{henaff2016orthogonal}~\shortcite{henaff2016orthogonal} study analytic solutions to the long-term memory task, supporting observations and intuitions that orthogonal (or unitary) matrices would be appropriate as transition matrices for this task. They also study initializations to orthogonal and identity matrices, and consider experiments where an additional term in the loss function encourages an orthogonal solution to the transition matrix, without using an explicit parametrization. \citeauthor{saxe2013exact}~\shortcite{saxe2013exact} study exact solutions to learning dynamics in deep networks and find that orthogonal weight initializations at each layer lead to depth-independent learning (thus escaping the vanishing/exploding gradient problem). Interestingly, they attribute this to the eigenvalue spectrum of orthogonal matrices lying on the unit circle. They compare with weights initialized to random, scaled Gaussian values, which preserve norms in expectation (over values of the random matrix) and find orthogonal matrices superior. It therefore appears that preserving norms is \emph{not} sufficient to stabilize gradients over network depth, but that the eigenvalue spectrum must also be strictly controlled. In a related but separate vein, \citeauthor{krueger2015regularizing}~\shortcite{krueger2015regularizing} penalize the difference of difference of norms between subsequent hidden states in the network. This is \emph{not} equivalent to imposing orthogonality of the \emph{transition} matrix, as the norm of the hidden state may be influenced by the inputs and non-linearities, and their method directly addresses this norm. The theory of Lie groups and Lie algebras has seen most application in machine learning for its use in capturing notions of \emph{invariance}. For example, \citeauthor{miao2007learning}~\shortcite{miao2007learning}, learn infinitesimal Lie group generators (elements of the Lie algebra) associated with affine transformations of images, corresponding to visual perceptual invariances. This is different to our setting as our generators are already known (we assume the Lie group $U(n)$) and wish to learn the coefficients of a given transformation relative to that basis set of generators. However, our approach could be extended to the case where the basis of $\mathfrak{u}(n)$ is \emph{unknown}, and must be learned. As we find later (appendix B), the choice of basis can impact performance, and so may be an important consideration. \citeauthor{cohen2014learning}~\shortcite{cohen2014learning} learn commutative subgroups of $SO(n)$ (known as toroidal subgroups), motivated by learning the irreducible representations of the symmetry group corresponding to invariant properties of images. Their choice of group parametrization is equivalent to selecting a particular basis of the corresponding Lie algebra, as they describe, but primarily exploit the algebra to understand properties of toroidal subgroups. \citeauthor{tuzel2008learning}~\shortcite{tuzel2008learning} perform motion estimation by defining a regression function in terms of a function on the Lie algebra of affine transformations, and then learning this. This is similar to our approach in the sense that they do optimization in the Lie algebra, although as they consider two-dimensional affine transformations only, their parametrization of the Lie algebra is straight forward. Finally, \citeauthor{warmuthorthogonal}~\shortcite{warmuthorthogonal} describe an online learning algorithm for orthogonal matrices -- which are the real-valued equivalent to unitary matrices. They also claim that the approach is extends easily to unitary matrices. \subsection{Structure of this paper} We begin with an introduction to the relevant facts and definitions from the theory of Lie groups and Lie algebras, to properly situate this work in its mathematical context. Further exposition is beyond the scope of this paper, and we refer the interested reader to any of the comprehensive introductory texts on the matter. We explain our parametrization in detail and describe a method to calculate the derivative of the matrix exponential - a quantity otherwise computationally intractable. Then, we describe a simple but clear experiment designed to test our core question of learning unitary matrices. We compare to an approach using the parametrization of~\citeauthor{arjovsky2015unitary}~\shortcite{arjovsky2015unitary} and one using polar decomposition to `back-project' to the closest unitary matrix. We use this experimental set-up to probe aspects of our model, studying the importance of the choice of basis (appendix B), and the impact of the restricted parameter set used by one of the alternate approaches. We additionally implement our parametrization in a recurrent neural network as a `general unitary RNN', and evaluate its performance on standard long-memory tasks. \section{The Lie algebra $\mathfrak{u}(n)$} \label{section:lie} \subsection{Basics of Lie groups and Lie algebras} A Lie group is a group which is also a differentiable manifold, with elements of the group corresponding to points on the manifold. The group operations (multiplication and inversion) must be smooth maps (infinitely differentiable) back to the group. In this work we consider the group $U(n)$: the set of $n \times n$ unitary matrices, with matrix multiplication. These are the complex-valued analogue to orthogonal matrices, satisfying the property \begin{equation} U^{\dagger} U = U U^{\dagger} = \mathbb{I} \label{eqn:unitary} \end{equation} where $\dagger$ denotes the conjugate transpose (or Hermitian conjugate). Unitary matrices preserve matrix norms, and have eigenvalues lying on the (complex) unit circle, which is the desired property of the transition matrix in a RNN. The differentiable manifold property of Lie groups opens the door for the study of the Lie \emph{algebra}. This object is the \emph{tangent space} to the Lie group at the identity (the group must have an identity element). Consider a curve through the Lie group $U(n)$ - a one-dimensional subspace parametrized by a variable $t$, where $U(t=0) = \mathbb{I}$ (this is a matrix $U(t)$ in $U(n)$ parametrised by $t$, not a group). Consider the defining property of unitary matrices (Equation~\ref{eqn:unitary}), and take the derivative along this curve: \begin{equation} U(t)^{\dagger}U(t) = \mathbb{I} \rightarrow \dot{U}(t)^{\dagger} U(t) + U^{\dagger}(t) \dot{U}(t) = 0 \end{equation} Taking $t \rightarrow 0 $, $U(t) \rightarrow \mathbb{I}$, we have \begin{equation} \dot{U}(0)^{\dagger} \mathbb{I} + \mathbb{I}^{\dagger} \dot{U}(0) = 0 \Rightarrow \dot{U}(0)^{\dagger} = - \dot{U}(0) \label{eqn:alg} \end{equation} The elements $\dot{U}(0)$ belong to the Lie algebra. We refer to this Lie algebra as $\mathfrak{u}(n)$, and an arbitrary element as $L$. Then Equation~\ref{eqn:alg} defines the properites of these Lie algebra elements; they are $n \times n$ skew-Hermitian matrices: $L^{\dagger} = -L$. As vector spaces, Lie algebras are closed under addition. In particular $\mathfrak{u}(n)$ is a vector space over $\mathbb{R}$, so a \emph{real} linear combination of its elements is once again in $\mathfrak{u}(n)$ (this is also clear from the definition of skew-Hermitian). We exploit this fact later. Lie algebras are also endowed with an operation known as the \emph{Lie bracket}, which has many interesting properties, but is beyond the scope of this work. Lie algebras are interesting algebraic objects and have been studied deeply, but in this work we use $\mathfrak{u}(n)$ because of the \emph{exponential map}. Above, it was shown that elements of the algebra can be derived from the group (considering infinitesimal steps away from the identity). There is a \emph{reverse} operation, allowing elements of the group to be recovered from the algebra: this is the \emph{exponential map}. In the case of matrix groups, the exponential map is simply the \emph{matrix exponential}: \begin{equation} \exp(L) = \sum_{j = 0}^{\infty}\frac{L^j}{j!} \end{equation} Very simply, $L \in \mathfrak{u}(n)$, then $\exp(L) \in U(n)$. While this map is not in \emph{general} surjective, it so happens that $U(n)$ is a compact, connected group and so $\exp$ \emph{is} indeed surjective \cite{terrytao}. That is, for any $U \in U(n)$, there exists \emph{some} $L \in \mathfrak{u}(n)$ such that $\exp(L) = U$. Notably, while orthogonal matrices also form a Lie group $O(n)$, with associated Lie algebra $\mathfrak{o}(n)$ consisting of skew-symmetric matrices, $O(n)$ is \emph{not} connected, and so the exponential map can only produce \emph{special} orthogonal matrices - those with determinant one - $SO(n)$ being the component of $O(n)$ containing the identity. \subsection{Parametrization of $U(n)$ in terms of $\mathfrak{u}(n)$} The dimension of $\mathfrak{u}(n)$ as a real vector space is $n^2$. This is readily derived from noting that an arbitrary $n \times n$ complex matrix has $2n^2$ free real parameters, and the requirement of $L^{\dagger} = -L$ imposes $n^2$ constraints. So, a set of $n^2$ linearly-independent skew-Hermitian matrices defines a basis for the space; $\{ T_j \}_{j = \{1, \dots, n^2 \}}$. Then any element $L$ can be written as \begin{equation} L = \sum_{j=1}^{n^2} \lambda_j T_j \end{equation} where $\{\lambda_j\}_{j = 1, \dots, n^2}$ are $n^2$ real numbers; the coefficients of $L$ with respect to the basis. Using the exponential map, \begin{equation} U = \exp(L) = \exp\left(\sum_{j=1}^{n^2} \lambda_j T_j \right) \label{eqn:parametrization} \end{equation} we see that these $\{\lambda_j\}_{j = 1, \dots, n^2}$ suffice as \emph{parameters} of $U$ (given the basis $T_j$). This is the parametrization we propose. It has two attractive properties: \begin{enumerate} \item It is a fully general parametrization, as the exponential map is surjective \item Gradient updates on $\{\lambda_j\}_{j = 1, \dots, n^2}$ preserve unitarity automatically, as the algebra is closed under addition \end{enumerate} This parametrization means gradient steps are taken in the vector space of $\mathfrak{u}(n)$, rather than the manifold of $U(n)$, which \emph{may} provide a flatter cost landscape - although confirming this intuition would require further analysis. This work is intended to explore the use of this parametrization for learning arbitrary unitary matrices. There are many possible choices of basis for $\mathfrak{u}(n)$. We went for the following set of sparse matrices: \begin{enumerate} \item $n$ diagonal, imaginary matrices: $T_a$ is $i$ on the $a$-th diagonal, else zero. \item $\frac{n(n-1)}{2}$ symmetric, imaginary matrices with two non-zero elements, e.g., for $n=2$, $\left(\begin{matrix} 0 & i \\ i & 0 \end{matrix}\right)$ \item $\frac{n(n-1)}{2}$ anti-symmetric, real matrices with two non-zero elements, e.g., for $n=2$, $\left(\begin{matrix} 0 & 1 \\ -1 & 0 \end{matrix}\right)$ \end{enumerate} We explore the effects of choice of basis in appendix B. \subsection{Derivatives of the matrix exponential} The matrix exponential appearing in Equation~\ref{eqn:parametrization} poses an issue for gradient calculations. In general, the derivative of the matrix exponential does not have a closed-form expression, so computing gradients is intractable. In early stages of this work, we used the method of finite differences to approximate gradients, which would prohibit its use in larger-scale applications (such as RNNs). In the appendix we describe an investigation into using random projections to overcome this limitation, which while promising turned out to yield minimal benefit. We therefore sought mathematical solutions to this complexity issue, which we describe here and in further detail in the appendix. Exploiting the fact that $L$ is skew-Hermitian, we can derive an analytical expression for the derivative of $U$ with respect to each of its parameters, negating the need for finite differences. This expression takes the form: \begin{equation} \frac{\partial U}{\partial \lambda_a} = W V_a W^{\dagger} \label{eqn:twomat} \end{equation} where $W$ is a unitary matrix of eigenvectors obtained in the eigenvalue decomposition of $U$; $U = W D W^{\dagger}$, ($D$ = diag($d_1$, $\dots$, $d_{n^2}$); $d_i$ are the eigenvalues of $U$). Each $V_a$ is a matrix defined component-wise \begin{align} i = j:& V_{ii} =(W^{\dagger} T_a W)_{ii} e^{d_i}\label{eqn:vii}\\ i \neq j:& V_{ij} = (W^{\dagger} T_a W)_{ij} \left(\frac{e^{d_i} - e^{d_j}}{d_i - d_j}\right)\label{eqn:vij} \end{align} Where $T_a$ is the basis matrix of the Lie algebra in the $a$-th direction. We provide the derivation, based on work from~\citeauthor{kalbfleisch1985analysis}~\shortcite{kalbfleisch1985analysis} and~\citeauthor{jennrich1976fitting}~\shortcite{jennrich1976fitting} in Appendix A. We can simplify the expression $W^{\dagger} T_a W$ for each $T_a$, depending on the type of basis element. In these expressions, $\mathbf{w}_a$ refers to the $a$-th \emph{row} of W. \begin{enumerate} \item $T_a$ purely imaginary; $W^{\dagger} T_a W = i \cdot \mathrm{outer}(\mathbf{w}^*_a, \mathbf{w}_a)$ \item $T_a$ symmetric imaginary, nonzero in positions $(r, s)$ and $(s, r)$: $W^{\dagger} T_{rs} W = i \cdot (\mathrm{outer}(\mathbf{w}^*_s, \mathbf{w}_r) + \mathrm{outer}(\mathbf{w}^*_r, \mathbf{w}_s))$ \item $T_a$ antisymmetric real, nonzero in positions $(r, s)$ and $(s, r)$: $W^{\dagger} T_{rs} W = \mathrm{outer}(\mathbf{w}^*_r, \mathbf{w}_s) - \mathrm{outer}(\mathbf{w}^*_s, \mathbf{w}_r)$ \end{enumerate} These expressions follow from the sparsity of the basis and are derived in appendix A. Thus, we reduce the calculation of $W^{\dagger} T_a W$ from two matrix multplications to at most two vector outer products. Overall, we have reduced the cost of calculating gradients to a single eigenvalue decomposition, and for each parameter two matrix multiplications (equation~\ref{eqn:twomat}), one or two vector outer products, and element-wise multiplication of two matrices (equations~\ref{eqn:vii},~\ref{eqn:vij}). As we see in the RNN experiments, this actually makes our approach faster than the (restricted)uRNN of~\cite{arjovsky2015unitary} for roughly equivalent numbers of parameters. \section{Supervised Learning of Unitary Operators} \label{section:learning} We consider the supervised learning problem of learning the unitary matrix $U$ that generated a $\mathbf{y}$ from $\mathbf{x}$; $\mathbf{y} = U\mathbf{x}$, given examples of such $\mathbf{x}$s and $\mathbf{y}$s. This is the core learning problem that needs to be solved for the state-transformation matrix in RNNs. It is similar to the setting considered in \citeauthor{warmuthorthogonal}~\shortcite{warmuthorthogonal} (they consider an online learning problem). We compare a number of methods for learning $U$ at different values of $n$. We further consider the case where we have artificially restricted the number of learnable variables in our parametrization (for the sake of comparison), and generate a pathological change of basis to demonstrate the relevance of selecting a good basis (appendix B). \subsection{Task} The experimental setup is as follows: we create a $n \times n$ unitary matrix $U$ (the next section describes how this is done), then sample vectors $\mathbf{x} \in \mathbb{C}^n$ with normally-distributed coefficients. We create $\mathbf{y}_j = U \mathbf{x}_j + \epsilon_j$ where $\epsilon \sim \mathcal{N}(0, \sigma^2)$. The objective is to recover $U$ from the $\{\mathbf{x}_j, \mathbf{y}_j\}$ pairs by minimizing the squared Euclidean distance between predicted and true $\mathbf{y}$ values; \begin{equation} U = \mathop{\mathrm{argmin}}_U \frac{1}{N} \sum_j^N \| \hat{\mathbf{y_j}} - \mathbf{y_j} \|^2 = \mathop{\mathrm{argmin}}_U \frac{1}{N} \sum_j^N \| U \mathbf{x}_j - \mathbf{y_j} \|^2 \end{equation} While this problem is easily solved in the batch setting using least-squares, we wish to learn $U$ through mini-batch stochastic gradient descent, to emulate a deep learning scenario. For each experimental run (a single $U$), we generate one million training $\{\mathbf{x}_j, \mathbf{y}_j\}$ pairs, divided into batches of size 20. The test and validation sets both contain $100,000$ examples. In practice we set $\sigma^2 = 0.01$ and use a fixed learning rate of $0.001$. For larger dimensions, we run the model through the data for multiple epochs, shuffling and re-batching each time. All experiments were implemented in Python. The code is available here: \texttt{https://github.com/ratschlab/uRNN}. For the matrix exponential, we use the scipy builtin \texttt{expm}, which uses Pade approximation~\cite{al2009new}. We make use of the fact that $iL$ is Hermitian to use \texttt{eigh} (also in scipy) to perform eigenvalue decompositions. \subsection{Generating the ground-truth unitary matrix} \label{section:generating} The $U$ we wish to recover is generated by one of three methods: \begin{enumerate} \item QR decomposition: we create a $n \times n$ complex matrix with normally-distributed entries and then perform a QR decomposition, producing a unitary matrix $U$ and an upper triangular matrix (which is discarded). This approach is also used to sample orthogonal matrices in~\citeauthor{warmuthorthogonal}~\shortcite{warmuthorthogonal}, noting a result from~\citeauthor{stewart1980efficient}~\shortcite{stewart1980efficient} demonstrating that this is equivalent to sampling from the appropriate Haar measure. \item Lie algebra: given the standard basis of $\mathfrak{u}(n)$, we sample $n^2$ normally-distributed real $\lambda_j$ to produce $U = \exp{\left( \sum_j \lambda_j T_j\right)}$ \item Unitary composition: we compose parametrized unitary operators as in ~\citeauthor{arjovsky2015unitary}~\shortcite{arjovsky2015unitary} (Equation~\ref{eqn:arjovsky}). The parameters are sampled as follows: angles in $D$ come from $\mathcal{U}(-\pi, \pi)$. The complex reflection vectors in $\mathbf{R}$ come from $\mathcal{U}(-s, s)$ where $s = \sqrt{\frac{6}{2n}}$. \end{enumerate} We study the effects of this generation method on test-set loss in a later section. While we find no significant association between generation method and learning approach, in our experiments we nonetheless average over an equal number of experiments using each method, to compensate for possible unseen bias. \subsection{Approaches} We compare the following approaches for learning $U$: \begin{enumerate} \item \texttt{projection}: $U$ is represented as an unconstrained $n \times n$ complex matrix, but after each gradient update we \emph{project} it to the closest unitary matrix, using polar decomposition~\cite{keller1975closest}. This amounts to $2n^2$ real parameters. \item \texttt{arjovsky}: $U$ is parametrized as in Equation~\ref{eqn:arjovsky}, which comes to $7n$ real parameters. \item \texttt{lie\_algebra}: (we refer to this as $\mathfrak{u}(n)$) $U$ is parametrized by its $n^2$ real coefficients $\{ \lambda_j \}$ in the Lie algebra, as in Equation \ref{eqn:parametrization}. \end{enumerate} As baselines we use the \texttt{true} matrix $U$, and a \texttt{random} unitary matrix $U_R$ generated by the same method as $U$ (in that experimental run). We also implemented the algorithm described in~\citeauthor{warmuthorthogonal}~\shortcite{warmuthorthogonal} and considered both unitary and orthogonal learning tasks (our parametrization contains orthogonal matrices as a special case) but found it too numerically unstable and therefore excluded it from our analyses. \subsection{Comparison of Approaches} \label{section:results} \begin{table*} \small \begin{tabular}{ r || c | c c c | c} $n$ & \texttt{true} & \texttt{projection} & \texttt{arjovsky} & \texttt{lie algebra} & \texttt{rand} \\ \hline 3 & $6.004 \pm 0.005 \times 10^{-4}$ & 8 $\pm$ 1 & $\mathbf{6.005 \pm 0.003 \times 10^{-4}}$ & $\mathbf{6.003 \pm 0.003 \times 10^{-4}}$ & $12.5 \pm 0.4$ \\ 6 & $\sim$ 0.001 & $15 \pm 1$ & $0.09 \pm 0.01 $ & $\mathbf{0.03 \pm 0.01}$ & 24 $\pm$ 1 \\ 8 & $\sim$ 0.002 & $14 \pm 1$ & $1.17 \pm 0.06$ & $\mathbf{0.014 \pm 0.006}$ & $31.6 \pm 0.6$ \\ 14 & $\sim$ 0.003 & $24 \pm 4$ & $10.8 \pm 0.3$ & $\mathbf{0.07 \pm 0.02}$ & $52 \pm 1$ \\ 20 & $\sim$ 0.004 & $38 \pm 3$ & $29.0 \pm 0.5$ & $\mathbf{0.47 \pm 0.03}$ & $81 \pm 2$ \end{tabular} \caption{Loss (mean $l_2$-norm between $\hat{y}_i$ and $y_i$) on the test set for the different approaches as the dimension of the unitary matrix changes. \texttt{true} refers to the matrix used to generate the data, \texttt{projection} is the approach of `re-unitarizing' using a polar decomposition after gradient updates, \texttt{arjovsky} is the composition approach defined in Equation~\ref{eqn:arjovsky}, $\mathfrak{u}(n)$ is our parametrization (Equation~\ref{eqn:parametrization}) and \texttt{rand} is a random unitary matrix generated in the same manner as \texttt{true}. Values in bold are the best for that $n$ (excluding \texttt{true}). The error for \texttt{true} is typically very small, so we omit it.} \label{table:accuracies} \end{table*} Table~\ref{table:accuracies} shows the test-set loss for different values of $n$ and different approaches for learning $U$. We performed between 6 and 18 replicates of each experiment, and show bootstrap estimates of means and standard errors over these replicates. As we can see, the learning task becomes more challenging as $n$ increases, but our parametrization ($\mathfrak{u}(n)$) consistently outperforms the other approaches. \subsection{Restricting to $7n$ parameters} \label{section:restriction} As mentioned, \texttt{arjovsky} uses only $7n$ parameters. To check if this difference accounts for the differences in loss observed in Table~\ref{table:accuracies}, we ran experiments where we fixed all but $7n$ (selected randomly) of the $\{\lambda_j\}$ in the \texttt{lie\_algebra} parametrization. The fixed parameters retained their initial values throughout the experiment. We observe that, as suspected, restricting to $7n$ parameters results in a performance degradation equivalent to that of \texttt{arjovsky}. \begin{table*} \small \begin{tabular}{r || c c | c} $n$ & \texttt{arjovsky} & \texttt{lie\_restricted} & \texttt{lie\_unrestricted} \\\hline 8 & $1.2 \pm 0.1$ & $1.0 \pm 0.2$ & $0.04 \pm 0.01$\\ 14 & $11.6 \pm 0.3$ & $ 12.6 \pm 0.4 $ & $0.25 \pm 0.03$ \\ 20 & $27.8 \pm 0.7$ & $28.0 \pm 0.6$ & $0.19 \pm 0.03$ \end{tabular} \caption{We observe that restricting our approach to the same number of learnable parameters as that of \cite{arjovsky2015unitary} causes a similar degradation in performance on the task. This indicates that the relatively superior performance of our model is explained by its generality in capturing arbitrary unitary matrices.} \label{table:restrict} \end{table*} Table~\ref{table:restrict} shows the results for $n=8, 14, 20$. The fact that the restricted case is consistently within error of the \texttt{arjovsky} model supports our hypothesis that the difference in learnable parameters accounts for the difference in performance. This suggests that generalising the model of \citeauthor{arjovsky2015unitary} to allow for $n^2$ parameters may result in performance similar to our approach. However, how to go about such a generalisation is unclear, as a naive approach would simply use a composition of $n^2$ operators, and this would likely become computationally intractable. \subsection{Method of generating $U$} \label{section:method} As described, we used three methods to generate the true $U$. One of these produces $U$ in the subspace available to the composition parametrization (Equation~\ref{eqn:arjovsky}), so we were curious to see if this parametrization performed better on experiments using that method. We were also concerned that generating $U$ using the Lie algebra parametrization might make the task too `easy' for our approach, as its random initialization could lie close to the true solution. Figure~\ref{fig:boxplots} shows box-plots of the distribution of test losses from these approaches for the three methods, comparing our approach ($\mathfrak{u}(n)$) with that of \citeauthor{arjovsky2015unitary}~\shortcite{arjovsky2015unitary}, denoted \texttt{arjovsky}. To combine results from experiments using different values of $n$, we first scaled test-set losses by the performance of \texttt{rand} (the random unitary matrix), so the y-axis ranges from 0 (perfect) to 1 (random performance). The dotted line denotes the average (over methods) of the test-set loss for \texttt{true}, similarly scaled. The right panel in Figure~\ref{fig:boxplots} shows a zoomed-in version of the $\mathfrak{u}(n)$ result where the comparison with \texttt{true} is more meaningful, and a comparison with the case where we have restricted to $7n$ learnable parameters (see earlier). \begin{figure} \centering \includegraphics[scale=0.55]{boxplot_all_inkscape.pdf} \caption{We ask whether the method used to generate $U$ influences performance for different approaches to \emph{learning} $U$. Error bars are bootstrap estimates of 95\% confidence intervals. To compare across different $n$'s, we normalise each loss by the loss of \texttt{rand} for that $n$, and reporrt fractions. The dotted line is the \texttt{true} loss, similarly normalised. the choice of method to generate $U$ does not appear to affect test-set loss for the different approaches. \emph{Right}: Finer resolution on the $\mathfrak{u}(n)$ result in left panel. We also include the case where we restrict to $7n$ learnable parameters.} \label{fig:boxplots} \end{figure} We do not observe a difference (within error) between the methods, which is consistent between $\mathfrak{u}(n)$ and \texttt{arjovsky}. Our concern that using the Lie algebra to generate $U$ would make the task `too easy' for $\mathfrak{u}(n)$ was seemingly unfounded. \section{Unitary Recurrent Neural Network for Long Memory Tasks} To demonstrate that our approach is practical for use in deep learning, we incorporate it into a recurrent neural network to solve standard long-memory tasks. Specifically, we define a general unitary RNN with recurrence relation \begin{equation} \mathbf{h}_t = f\left( \beta U \mathbf{h}_{t-1} + V \mathbf{x}_t + \mathbf{b} \right) \end{equation} where $f$ is a nonlinearity, $\beta$ is a free scaling factor, $U$ is our unitary matrix parametrised as in equation~\ref{eqn:parametrization}, $\mathbf{h}_t$ is the hidden state of the RNN and $\mathbf{x}_t$ is the input data at `time-point' $t$. We refer to this as a `general unitary RNN' (guRNN), to distinguish it from the restricted uRNN of~\citeauthor{arjovsky2015unitary}~\shortcite{arjovsky2015unitary}. We use the guRNN on two tasks: the `adding problem' and the `memory problem', first described in~\cite{hochreiter1997long}. For the sake of brevity we refer to~\cite{arjovsky2015unitary} for specific experimental details, as we use an identical experimental setup (reproduced in TensorFlow; see above github link for code). We compare our model (guRNN) with the restricted uRNN (ruRNN) parametrised as in equation~\ref{eqn:arjovsky}, a LSTM~\cite{hochreiter1997long}, and the IRNN of~\citeauthor{le2015simple}~\shortcite{le2015simple}. Figure~\ref{fig:RNN} shows the results for each task where the sequence length or the memory duration is $T=100$. \begin{figure} \includegraphics[scale=0.85]{rnn_portrait_roboto.pdf} \caption{We compare different RNN models on two standard long-memory learning tasks, described in~\cite{hochreiter1997long}. The state size for all models was $n=30$, except for the ruRNN~\cite{arjovsky2015unitary}, which had $n=512$ and $n=128$ for the adding and memory tasks respectively; the optimal hyperparameters reported in their work. For our model (guRNN), we use $f=\mathrm{relu}$ and $f=\mathrm{tanh}$ for the nonlinearities in the adding and memory tasks. We compare guRNN with (guRNN$_\beta$) or without (guRNN$_1$) a scaling factor $\beta$ in front of $U$ to compensate for the tendency of the nonlinearity to shrink gradients. We used $\beta = 1.4$ and $\beta = 1.05$. That $\mathrm{relu}$ requires a larger $\beta$ is expected, as this nonlinearity discards more gradient information. Gradient clipping to $[-1, 1]$ was used for the LSTM and IRNN~\cite{le2015simple}. Dotted lines denote random baselines. The learning rate was set to $\alpha=10^{-3}$ for all models except IRNN, which used $\alpha=10^{-4}$. We used RMSProp~\cite{Tieleman2012} with decay 0.9 and no momentum. The batch size was 20.} \label{fig:RNN} \end{figure} While our model guarantees unitarity of $U$, this is \emph{not} sufficient to prevent gradients from vanishing. Consider the norm of the gradient of the cost $C$ with respect to the data at time $\tau$, and use submultiplicativity of the norm to write; \begin{equation*} \left\| \frac{\partial C}{\partial \mathbf{x}_\tau} \right\| \leq \left\| \frac{\partial C}{\partial \mathbf{x}_T} \right\| \left( \prod_{t = \tau}^{T-1} \| f' \left( U \mathbf{h}_t + V \mathbf{x}_t + \mathbf{b}\right) \| \| U \|\right) \left\|\frac{\partial \mathbf{h}_\tau}{\mathbf{x}_\tau} \right\| \end{equation*} where $f'$ is a diagonal matrix giving the derivatives of the nonlinearity. Using a unitary matrix fixes $\| U \| = 1$, but beyond further restrictions (on $V$ and $\mathbf{b}$) does nothing to control the norm of $f'$, which is at \emph{most} 1 for common nonlinearities. Designing a nonlinearity to better preserve gradient norms is beyond the scope of this work, so we simply scaled $U$ by a constant multiplicative factor $\beta$ to counteract the tendency of the nonlinearity to shrink gradients. In Figure~\ref{fig:RNN} we denote this setup by guRNN$_\beta$. Confirming our intuition, this simple modification greatly improves performance on both tasks. Perhaps owing to our efficient gradient calculation (appendix A) and simpler recurrence relation, our model runs faster than that of~\cite{arjovsky2015unitary} (in our implementation), by a factor of 4.8 and 2.6 in the adding and memory tasks shown in Figure~\ref{fig:RNN} respectively. This amounts to the guRNN processing 61.2 and 37.0 examples per second in the two tasks, on a GeForce GTX 1080 GPU. \section{Discussion} \label{section:discussion} Drawing from the rich theory of Lie groups and Lie algebras, we have described a parametrization of unitary matrices appropriate for use in deep learning. This parametrization exploits the Lie group-Lie algebra correspondence through the exponential map to represent unitary matrices in terms of real coefficients relative to a given basis of the Lie algebra $\mathfrak{u}(n)$. As this map from $\mathfrak{u}(n)$ to $U(n)$ is surjective, the parametrization can describe any unitary matrix. We have demonstrated that unitary matrices can be learned with high accuracy using simple gradient descent, and that this approach outperforms a recently-proposed parametrization (from~\citeauthor{arjovsky2015unitary}~\shortcite{arjovsky2015unitary}) and significantly outperforms the approach of `re-unitarizing' after gradient updates. This experimental design is quite simple, designed to probe a core problem, before considering the broader setting of RNNs. Our experiments with general unitary RNNs using this parametrization showed that this approach is practical for deep learning. With a fraction of the parameters, our model outperforms LSTMs on the standard `memory problem' and attains comparable (although inferior) performance on the adding problem~\cite{hochreiter1997long}. Further work is required to understand the difference in performance between our approach and the ruRNN of~\cite{arjovsky2015unitary} - perhaps the $7n$-dimensional subspace captured by their parametrization is serendipitously \emph{beneficial} for these RNN tasks - although we note that the results presented here are not the fruit of exhaustive hyperparameter exploration. Of particular interest is the impressive performance of both uRNNs on the memory task, where the LSTM and IRNN appear to fail to learn. While our RNN experiments have demonstrated the utility of using a unitary operator for these tasks, we believe that the role of the nonlinearity in the vanishing and exploding gradient problem must not be discounted. We have shown that a simple scaling factor can help reduce the vanishing gradient problem induced by the choice of nonlinearity. More analysis considering the combination of nonlinearity and transition operator must be performed to better tackle this problem. The success of our parametrization for unitary operator learning suggests that the approach of performing gradient updates in the Lie algebra is particularly effective. As Lie groups describe many naturally-occuring symmetries, the Lie group-Lie algebra correspondence could be rich for further exploitation to enhance performance in tasks beyond our initial motivation of recurrent neural networks. \section{Appendix A: Derivation of derivative of the matrix exponential} This derivation draws elements from~\citeauthor{kalbfleisch1985analysis}~\shortcite{kalbfleisch1985analysis} and~\citeauthor{jennrich1976fitting}~\shortcite{jennrich1976fitting}. We have $U = \exp(L)$, and seek $dU$. For what follows, we simply require that $L$ be normal, so the results are more general than the unitary case. In this case, $L$ is skew-Hermitian, which is normal and therefore diagonalisable by unitary matrices. Thus, there exist $W \in U(n)$ and $D = \mathrm{diag}(d_1, \dots, d_n)$ such that $L = W D W^{\dagger}$, and therefore \begin{equation} U = W \tilde{D} W^{\dagger} \label{eqn:-1} \end{equation} where $\tilde{D} = \mathrm{diag}(e^{d_1}, \dots, e^{d_n})$. We assume we can calculate: $dL$, $W$, and $D$ and seek an expression for $dU$. Then using~\ref{eqn:-1}: \begin{equation} \begin{split} dU &= d(W \tilde{D} W^{\dagger}) \\ &= dW \tilde{D} W^{\dagger} + W d\tilde{D} W^{\dagger} + W \tilde{D} dW^{\dagger} \end{split} \end{equation} Pre-multiplying with $W^{\dagger}$ and post-multiplying with $W$: \begin{equation} W^{\dagger} dU W = W^{\dagger} dW \tilde{D} + d\tilde{D} + \tilde{D} dW^{\dagger} W \label{eqn:0} \end{equation} The last term can be simplified by differentiating both sides of $W^{\dagger} W = \mathbb{I}$ (this follows from unitarity of $W$); \begin{equation} W^{\dagger} W + W^{\dagger} dW = 0 \Rightarrow dW^{\dagger} W = -W^{\dagger} dW \label{eqn:1} \end{equation} and substituting back into~\ref{eqn:0} to get: \begin{equation} W^{\dagger} dU W = W^{\dagger} dW \tilde{D} - \tilde{D} W^{\dagger} dW + d\tilde{D} \end{equation} We can then say that $dU = W V W^{\dagger}$ where \begin{equation} V = W^{\dagger} dW \tilde{D} - \tilde{D} W^{\dagger} dW + d\tilde{D} \end{equation} Similarly, $dL = W A W^{\dagger}$ where (replacing $\tilde{D}$ with $D$) \begin{equation} A = W^{\dagger} dW D - D W^{\dagger} dW + dD \label{eqn:2} \end{equation} and also $A = W^{\dagger} dL W$. \subsection{Calculating $V$} We use the convention that repeated indices denote summation over that index, unless otherwise stated. Looking at the components of $V$; \begin{equation} V_{ij} = (W^{\dagger} dW \tilde{D})_{ij} - (\tilde{D} W^{\dagger} dW)_{ij} + d\tilde{D}_{ij} \end{equation} \subsubsection{Diagonal case ($i = j$): (no summation over $i$)} \begin{equation} V_{ii} = W^{\dagger}_{ia} dW_{ab} \tilde{D}_{bi} - \tilde{D}_{ia} W^{\dagger}_{ab} dW_{bi} + d\tilde{D}_{ii} \end{equation} Since $\tilde{D}_{bi} = \delta_{bi} \tilde{d}_i$, the first two terms cancel: \begin{equation} \begin{split} V_{ii} =& W^{\dagger}_{ia} dW_{ab} \delta_{bi} \tilde{d}_i - \delta_{ai} \tilde{d}_i W^{\dagger}_{ab} dW_{bi} + d\tilde{D}_{ii}\\ =& W^{\dagger}_{ia} dW_{ai} \tilde{d}_i - \tilde{d}_i W^{\dagger}_{ib} dW_{bi} + d\tilde{D}_{ii}\\ =& d\tilde{D}_{ii} \label{eqn:3} \end{split} \end{equation} Using~\ref{eqn:2} we get $A_{ii} = dD_{ii} = (W^{\dagger} dL W)_{ii}$ Recall that the diagonal elements of $\tilde{D}$ are the exponentiated versions of the diagonal elements of $D$, so $\tilde{D}_{ii} = e^{d_i}$. Then \begin{equation} d\tilde{D}_{ii} = d(d_i) e^{d_i} = dD_{ii} \tilde{D}_{ii} \end{equation} Inserting that into Equation~\ref{eqn:3}: \begin{equation} V_{ii} = dD_{ii} \tilde{D}_{ii} = (W^{\dagger} dL W)_{ii} \tilde{D}_{ii} = (W^{\dagger} dL W)_{ii} e^{d_i} \end{equation} This produces Equation~\ref{eqn:vii} in the main paper. \subsubsection{Off-diagonal case ($i \neq j$): (no summation over $i, j$)} In this case, the purely diagonal part vanishes. We get: \begin{equation} \begin{split} V_{ij} =& W^{\dagger}_{ia} dW_{ab} \delta_{bj} \tilde{d}_j - \delta_{ai} \tilde{d}_i W^{\dagger}_{ab} dW_{bj}\\ =& W^{\dagger}_{ia} dW_{aj} \tilde{d}_j - W^{\dagger}_{ib} dW_{bj} \tilde{d}_i \\ &= (W^{\dagger} dW)_{ij} (\tilde{d}_j - \tilde{d}_i) \end{split} \label{eqn:previj} \end{equation} Similarly, \begin{equation} A_{ij} = (W^{\dagger} dW)_{ij} (d_j - d_i) \end{equation} Remembering that this is all component-wise multiplication (no summation over $i$ and $j$), we can rearrange expressions to get: \begin{equation} (W^{\dagger} dW)_{ij} = \frac{A_{ij}}{d_j - d_i} = \frac{(W^{\dagger} dL W)_{ij}}{d_j - d_i} \end{equation} Combining this with~\ref{eqn:previj} and remembering $\tilde{d}_a = e^{d_a}$, we have, for $i \neq j$: \begin{equation} V_{ij} = (W^{\dagger} dL W)_{ij} \left(\frac{e^{d_i} - e^{d_j}}{d_i - d_j}\right) \end{equation} This is Equation~\ref{eqn:vij} in the main paper. \subsection{Efficiently calculating $W^{\dagger} dL W$} This section is specific to our work, as it relies on the choice of basis for $\mathfrak{u}(n)$. In our case, $dL$ is simple. $L$ is a linear combination of the parameters $\lambda_i$; \begin{equation} L = \sum_i^{n^2} \lambda_i T_i \end{equation} Where $T_i$ are the basis matrices of $\mathfrak{u}(n)$. Then \begin{equation} dL_a = \frac{\partial L}{\partial \lambda_a} = T_a \end{equation} We need $W^{\dagger} T_a W$ for all $a$. Since the $T_a$s are sparse, this is cheaper than performing $n^2$ full matrix multiplications, as we demonstrate now. In components; \begin{equation} (W^{\dagger} T_a W)_{i j} = W^{\dagger}_{i k} {T_a}_{k l} W_{l j} \end{equation} Cases: \subsubsection{$T_a$ diagonal, purely imaginary} $T_a$ is zero except for a $i$ in the $a$-th position on the diagonal. \begin{equation} \begin{split} (W^{\dagger} T_a W)_{i j} &= i W^{\dagger}_{i a} W_{a j} = i W^*_{a i} W_{a j}\\ \Rightarrow W^{\dagger} T_a W &= i \cdot \mathrm{outer}(\mathbf{w}^*_a, \mathbf{w}_a) \end{split} \end{equation} where $\mathbf{w}_a$ is the $a$-th \emph{row} of $W$. \subsubsection{$T_a$ symmetric, purely imaginary} $T_{rs}$ is zero except for $i$ in position $(r, s)$ and $(s, r)$. \begin{equation} \begin{split} (W^{\dagger} T_{rs} W)_{i j} &= i W^{\dagger}_{i k} (\delta_{ks, lr} + \delta_{kr, ls}) W_{l j} \\ &= i (W^{\dagger}_{is} W_{rj} + W^{\dagger}_{ir} W_{s j}) = i ( W^*_{si} W_{rj} + W^*_{ri} W_{sj}) \\ \Rightarrow W^{\dagger} T_{rs} W &= i \cdot (\mathrm{outer}(\mathbf{w}^*_s, \mathbf{w}_r) + \mathrm{outer}(\mathbf{w}^*_r, \mathbf{w}_s)) \end{split} \end{equation} \subsubsection{$T_a$ antisymmetric, purely real} $T_{rs}$ is zero except for $1$ in position $(r, s)$ and $-1$ in position $(s, r)$. \begin{equation} \begin{split} (W^{\dagger} T_{rs} W)_{i j} &= W^{\dagger}_{i k} (\delta_{kr, sl} - \delta_{ks, rl}) W_{l j} \\ &= W^{\dagger}_{ir} W_{sj} - W^{\dagger}_{is} W_{r j} = W^*_{ri} W_{sj} - W^*_{si} W_{rj} \\ \Rightarrow W^{\dagger} T_{rs} W &= \mathrm{outer}(\mathbf{w}^*_r, \mathbf{w}_s) - \mathrm{outer}(\mathbf{w}^*_s, \mathbf{w}_r) \end{split} \end{equation} These reproduce the expressions in the main paper. The outer product of two $n$-dimensional vectors is an $O(n^2)$ operation, and so this provides a (up to) factor $n$ speed-up on matrix multiplication. \section{Appendix B: Changing the basis of $\mathfrak{u}(n)$} \label{section:basis} The Lie group parametrization assumes a fixed basis of $\mathfrak{u}(n)$. Our intuition is that this makes some regions of $U(n)$ more `accessible' to the optimization procedure, elements whose coefficients are small given this basis. Learning a matrix $U$ which came from elsewhere in $U(n)$ may therefore be more challenging. We emulated this `change of basis` without needing to explicitly construct a new basis by generating a change of basis matrix, $M$. That is, if $V_j$ is the $j$-th element of the new basis, it is given by \begin{equation} V_j = \sum_k M_{jk} T_k \end{equation} If $\{\tilde{\lambda}\}_a$ are the coefficients of $L$ relative to the basis $V$, the coefficients relative to the old basis $T$ are given by: \begin{equation} \lambda_b = \sum_k \tilde{\lambda}_k M_{kb} = \tilde{\lambda}^T \cdot M \end{equation} A change of basis matrix must be full-rank. We generate one by sampling a square, $n^2 \times n^2$ matrix from a continuous uniform distribution $\mathcal{U}(-c, c)$ ($c$ is a constant we vary in experiments, see Figure~\ref{fig:basis}). This is very unlikely to be singular. We choose the $c$ range of the distribution such that $M$ will have `large' values relative to the true matrix $U$, whose parameters $\lambda$ (relative to $T$) are drawn from $\mathcal{N}(0, 0.01)$. Preliminary experiments suggested that the learning rate must be adjusted to compensate for the change of scale - evidence for this is visible in the first column of Figure~\ref{fig:basis}, where changing the basis without changing the learning rate results in an unstable validation set trace. Poor performance resulting from an inappropriate learning rate is not our focus here, so we performed experiments for different values of the learning rate. Figure~\ref{fig:basis} shows a grid of validation set losses as we vary the learning rate (columns) and the value of $c$ (rows). Our intuition is that if the performance under the change of basis is \emph{purely} driven by the difference in scale, using an appropriately-scaled learning rate should negate its affect. Each parameter $\lambda_j$ is scaled by a variable uniformly distributed between $(-c, c)$. The expectation value of the absolute value of this quantity is $c^2/2$, so we consider learning rates normalised by this factor. As seen in Figure~\ref{fig:basis}, the graphs on the diagonal are \emph{not} identical, suggesting that merely scaling the learning rate does not account for the change of learning behavior given a new basis - at least in expectation. Nonetheless, it is reassuring to observe that for all choices of $c$ explored, there exists a learning rate which facilitates learning, even if it markedly slower than the `ideal' case. While having a `misspecified' basis does appear to negatively impact learning, it can be largely overcome with choice of learning rate. \begin{figure} \includegraphics[scale=0.5]{basis_inkscape.pdf} \caption{ We consider the effects on learning of changing the basis (rows) and changing the learning rate (columns). For this experiment, $n=6$. The first row uses the original basis. Other rows use change of basis matrices sampled from $\mathcal{U}(-c, c)$ where $c = \{5, 10, 20\}$. The learning rates decrease from the `default' value of 0.001 used in the other experiments. Subsequent values are given by $\frac{0.001}{c^2}$ for the above values of $c$, in an attempt to rescale by the expected absolute value of components of the change of basis matrix. If the change of scale were solely responsible for the change in learning behavior, we would therefore expect the graphs on the diagonal to look the same.} \label{fig:basis} \end{figure} \bibliographystyle{aaai}
{'timestamp': '2017-01-11T02:05:09', 'yymm': '1607', 'arxiv_id': '1607.04903', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04903'}
arxiv
\section{Cycle graphs}\label{sec:cycles} We consider the family of graphs consisting of one cycle of length $\leq n$ (and no other edges or vertices). We discuss both of the cases where the decoder is aware and oblivious of the value of $n$, as discussed in \Cref{pro:aware}. In particular we show that oblivious decoding requires a larger induced universal graph for this problem. Our new bounds leave small gaps which are interesting open problems to tighten. \input{lowerbounds} \input{upperbounds} \section{General $D$} \newcommand{\mathcal{G}}{\mathcal{G}} In this section we present two upper bounds on $g_v(\mathcal{G}_D)$, the number of nodes in the smallest induced universal graph for graphs on $n$ nodes with bounded degree $D$. In \Cref{thmDetUpper} we give a deterministic construction of an induced universal graph for $\mathcal{G}_D$ that relies on the induced universal graph constructed in \Cref{sec:max2upper}. In \Cref{thmRandUpper} we give a randomized construction of an induced universal graph for $\mathcal{G}_D$ that with probability $\frac{1}{2}$ has a small number of nodes. Combining the two results shows the existence of an adjacency labeling scheme for $\mathcal{G}_D$ of size $\log \binom{\floor{n/2}|}{\floor{D/2}} + O\!\left(\min\set{D+\log n,\sqrt{D\log n}\log(n/d)}\right)$. In \Cref{corLowerBoundLabelSizeBoundedDeg} and \Cref{corRandLowerBound} we give lower bounds on $g_v(\mathcal{G}_D)$. These lower bounds imply that any adjacency labeling scheme for $\mathcal{G}_D$ must have labels of size at least $\log \binom{\floor{n/2}|}{\floor{D/2}} - O\!\left(\min\set{D,\sqrt{D\log n}\log(n/d)}\right)$, which means that the upper bounds are tight up to an additive term of size $O\!\left(\min\set{D+\log n,\sqrt{D\log n}\log(n/d)}\right)$, which is at most $O(\sqrt{n \log n})$. Previous labeling schemes use labels that are larger by an additive term of size $\Omega(D)$, which is $\Omega(n)$ when $D = \Omega(n)$, so this is the first adjacency labeling scheme for $\mathcal{G}_D$ where the dominating term is optimal. \subsection{Upper bounds on $g_v(\mathcal{G}_D)$} We show the following deterministic bound. \begin{theorem} \label{thmDetUpper} For the family $\mathcal{G}_D$ of graphs with bounded degree $D$ on $n$ nodes \[ g_v(\mathcal{G}_D) \le 2^{k+1} \cdot \frac{n^k}{(k-1)!} , \ \ \text{where} \ k = \ceil{D/2} \] \end{theorem} \begin{proof} For a set $S$ we let $S^{\le k}$ denote the set of all subsets of $S$ of size $\le k$. We note that $\abs{S^{\le k}} \le 2\frac{\abs{S}^k}{k!}$ whenever $S$ is finite. We will show that $g_v(\mathcal{G}_D) \le 2\frac{(2n-1)^k}{(k-1)!}$. Fix $n,D$, let $k = \ceil{D/2}$ and let $U_n$ be the induced universal graph for $\mathcal{G}_2$ defined in \Cref{sec:max2upper}. We note that $V[U_n] = [2n-1]$. We define the graph $G$ to have vertex set $[2n-1] \times [2n-1]^{\le k-1}$ and such that there is an edge between $(x,A)$ and $(y,B)$ iff $x \in B$, $y \in A$ or $x$ and $y$ are adjacent in $U_n$. Since $G$ has the desired number of nodes we proceed to show that $G$ is an induced universal graph for $\mathcal{G}_D$. Let $H$ be a graph in $\mathcal{G}_D$. By \Cref{Butlersplit} we know that we can decompose the edges of $H$ into $H_0$ and $H_1$ such that $\Delta(H_0) \le 2, \Delta(H_1) \le 2(k-1)$. We can find an embedding function $f : V[H] \to V[U_n]$ of $H_0$ in $U_n$ by the universality of $U_n$. By the same argument as in the first part of the proof we can orient the edges of $H_1$ such that any node has at most $k-1$ outgoing edges in $H_1$. For $u \in V[H]$ let $S_u$ be the set of nodes $v$ such that there exists an edge between $u$ and $v$ in $H_1$ oriented from $u$ to $v$. We see that $u$ and $v$ are adjacent iff $f(u)$ and $f(v)$ are adjacent in $U_n$ or it holds that $u \in S_v$ or $v \in S_u$. Therefore $\lambda : V[H] \to V[G]$ defined by $u \to (f(u), f(S_u))$ is an embedding function of $H$ in $G$. Hence $G$ must be an induced universal graph for $\mathcal{G}_D$. \end{proof} The intuition behind the randomized bound below is the following. Consider placing all $n$ vertices on a circle in a randomly chosen order and rename the vertices with indices $[n]$ following the order on the circle. Now, a vertex $v \in [n]$ remembers its neighbours in the next half of the circle, i.e., $v$ stores all the adjacant vertices among $\{v+1, \ldots, v+\lceil n/2 \rceil\}$ (where indices are taken modulu $n$). If two vertices $u,v$ are adjacant, then clearly either $u$ stores the index of $v$ or conversely, hence an adjacancy query can be answered. A Chernoff bound implies that vertex $v$ with high probability stores at most $D/2 + O(\sqrt{D \log n})$ indices. It follows that there exists an order of the points on the circle where every vertex stores that many neighbours and the theorem follows. \begin{theorem}\footnote{In the full version we improve this to $\binom{\floor{n/2}}{\floor{D/2}} \cdot 2^{O \!\left (\sqrt{D\log D} \cdot \log(n/D) \right )}$} \label{thmRandUpper} For the family $\mathcal{G}_D$ of graphs with bounded degree $D$ on $n \ge 2D$ nodes \[ g_v(\mathcal{G}_D) \le \binom{\floor{n/2}}{\floor{D/2}} \cdot 2^{O \!\left (\sqrt{D\log n} \cdot \log(n/D) \right )} \] \end{theorem} \begin{proof} Fix $n,D$ and wlog assume that $n$ is odd. For $D \le \log n$ the result follows from \Cref{thmDetUpper} so assume that $D \ge \log n$. Let $G$ be a graph in $\mathcal{G}_D$, and wlog assume that $V[G] = [n]$. Let $\pi : [n] \to [n]$ be a permutation of $[n]$ chosen uniformly at random. For each $u \in V[G]$ let $S_u$ be the set of differences $\pi(v) - \pi(u) \bmod n$ where $v$ is a neighbour of $u$ and $\pi(v) - \pi(u) \bmod n$ is at most $\floor{\frac{n}{2}}+1$. That is: \[ S_u = \set{(\pi(v) - \pi(u)) \bmod n \mid (u,v) \in E[G], \ (\pi(v) - \pi(u)) \bmod n \in \set{1,2,\ldots,\floor{\frac{n}{2}}}} \] Given two nodes $u,v$ we can determine whether $u$ are adjacent from $\pi(u),\pi(v)$ and $S_u,S_v$ in the following way. If $(\pi(u)-\pi(v)) \bmod n \le \floor{\frac{n}{2}}+1$ they are adjacent iff $(\pi(u)-\pi(v)) \bmod n \in S_v$. Otherwise they are adjacent iff $(\pi(v)-\pi(u)) \bmod n \in S_u$. We note that $\mathbb{E}(\abs{S_u}) = \frac{\deg_G(u)}{2} \le \frac{D}{2}$. By a standard Chernoff bound without replacement we see that \begin{align} \label{eqNeighbourBound} \abs{S_u} \le D', \ \ \text{where} \ D' = \floor{\frac{D}{2} + O \!\left ( \sqrt{D\log n} \right )} \end{align} with probability $\ge 1 - \frac{1}{2n}$ for a given vertex $u \in V[G]$. So with probability at least $\frac{1}{2}$ we have that \eqref{eqNeighbourBound} holds for every $u \in V[G]$. In particular there exists $\pi$ such that \eqref{eqNeighbourBound} holds for every $u \in V[G]$. Fix such a $\pi$. Let $D'' = \min\set{\floor{\frac{n}{2}},D'}$. Then for any node $u$ we can encode $\pi(u)$ and $S_u$ using at most $O(\log n) + \log \binom{\floor{n/2}}{D''}$ bits. Hence we conclude that: \[ g_v(\mathcal{G}_D) \le \binom{\floor{n/2}}{D''} n^{O(1)} \] The conclusion now follows from the following estimate \[ \binom{\floor{n/2}}{D''} \le \binom{\floor{n/2}}{\floor{D/2}} \cdot \left ( \frac{\floor{n/2}}{\floor{D/2}} \right )^{D''-\floor{D/2}} \le \binom{\floor{n/2}}{\floor{D/2}} \cdot \left ( \frac{n}{D} \right )^{O\!\left(\sqrt{D\log n}\right )} \] \end{proof} \subsection{Lower bounds on $g_v(\mathcal{G}_D)$} We now show lower bounds on $g_v(\mathcal{G}_D)$. Our first lower bound follows from counting perfect matchings. \begin{lemma} \label[lemma]{lemBipartiteBoundedDegLowerBound} Let $n, D$ be positive integers where $n$ is even. Let $V = [n]$. The number of graphs $G$ with $\Delta(G) \le D$ and vertex set $V$ is at least $\frac{\left((n/2)!\right)^{D}}{D^{Dn/2}}$. \end{lemma} \begin{proof} Let $V_0 = [n/2], V_1 = [n] \setminus [n/2]$. Let $M_0,M_1,\ldots,M_{r-1}$ be all perfect matchings of $V_0$ and $V_1$ where $r = (n/2)!$. Now consider the following family of graphs being the union of $D$ such perfect matchings: \[ \mathcal{F} = \set{G \mid V[G] = V, E[G] = M_{i_0} \cup \ldots M_{i_{D-1}}, i_0,\ldots,i_{D-1} \in [r]} \] Every graph in $\mathcal{F}$ is the union of $D$ perfect matchings and therefore has max degree $\le D$. Now fix $G \in \mathcal{F}$ and let $M$ be a perfect matching $G$. We can write $M = \set{(u,f(u)) \mid u \in V_0}$ for some bijective function $f : V_0 \to V_1$. There are at most $D$ ways to choose $f(u)$ for every $u \in V_0$ since $(u,f(u))$ must be an edge of $G$. Hence there are at most $D^{n/2}$ ways to choose a perfect matching of $G$, and $G$ can be written as a union of $D$ perfect matchings in at most $D^{Dn/2}$ ways. Since $G$ was arbitrarily chosen this must hold for any $G \in \mathcal{F}$. Since there are $r^D$ ways to choose $D$ perfect matchings we conclude that $\mathcal{F}$ consists of at least $\frac{r^D}{D^{nD/2}}$ graphs as desired. \end{proof} As an immediate corollary of \Cref{lemBipartiteBoundedDegLowerBound} we get a lower bound on the number of nodes in an induced universal graph, shown below in \cref{corLowerBoundLabelSizeBoundedDeg}. \begin{corollary} \label[corollary]{corLowerBoundLabelSizeBoundedDeg} The induced universal graph for the family $\mathcal{G}_D$ of graphs with bounded degree $D$ and $n$ nodes has at least $\Omega \!\left ( \left ( \frac{n}{2eD} \right )^{D/2} \right )$ nodes. \end{corollary} \begin{proof} Let $G$ be the induced universal graph for the family $\mathcal{G}_D$. Let $V = [n]$. Any graph $H$ from $\mathcal{G}_D$ on the vertex set $V$ is uniquely defined by the embedding function $f$ of $H$ in $G$. Since there are no more than $\abs{V[G]}^n$ ways to choose $f$, \Cref{lemBipartiteBoundedDegLowerBound} gives that $\abs{V[G]}^n \ge \frac{\left(\floor{n/2}!\right)^{D}}{D^{D\floor{n/2}}}$. The result now follows from Stirling's formula. \[ \abs{V[G]} \ge \left ( \frac{\left(\floor{n/2}!\right)^{2/n}}{D^{\floor{n/2}/(n/2)}} \right )^{D/2} \] We note that $\floor{n/2}/(n/2) = 1$ when $n$ is even. When $n$ is odd we have $\floor{n/2} = \frac{n-1}{2}$. Hence $\floor{n/2}/(n/2) = 1 - \frac{1}{n}$. Since $D \le n$ we have $D^{1-\frac{1}{n}} = \Theta(D)$. \end{proof} Our second lower bound comes from bounding the probability that a random graph on $n$ vertices, where each edge exists with probability around $D/n$, has max degree $D$. \begin{lemma} \label{lemRandLowerBound} Let $n, D$ be positive integers where $n \ge 2D$. Let $V = [n]$. The number of graphs $G$ with $\Delta(G) \le D$ and vertex set $V$ is at least $\binom{\binom{n}{2}}{\floor{nD/2}} \cdot 2^{-O \!\left (n\sqrt{D\log n} \cdot \log(n/D) \right )}$. \end{lemma} \begin{proof} Fix $n, D$. For $D \le \log^2 n$ the result follows from \Cref{lemBipartiteBoundedDegLowerBound}, so assume that $D \ge \log^2 n$. Let $D' = D - O\!\left(\sqrt{D\log n}\right)$ be an integer. Let $G$ be a random $G(n,p)$ graph where $p = \frac{D'}{n-1}$ and $V[G] = [n]$. That is, $G$ is a random graph on $n$ nodes and for every pair $u,v \in V[G]$ there is an edge between $u$ and $v$ with probability $p$. We say that $G$ is \emph{good} if it satisfies the following two properties: \begin{enumerate} \item[1] $\Delta(G) \le D$. \item[2] $\abs{E[G]} \ge nD''$ where $D''$ is an even integer satisfying $\frac{nD''}{2} = \frac{nD'}{2} - O(\sqrt{nD})$. \end{enumerate} We note that $D'' = D - O(\left(\sqrt{D\log n}\right)$. We will argue that $G$ satisfies Property 1 with probability at least $\frac{1}{3}$. By a Chernoff bound the probability that $u \in V[G]$ has more than $D$ neighbours is at most $\frac{1}{3n}$ if $D'$ is chosen sufficiently small. So with probability at least $\frac{2}{3}$ we have $\Delta(G) \le D$. Similarly, with probability at least $\frac{2}{3}$ we have $\abs{E[G]} \ge \frac{nD'}{2} - O(\sqrt{nD})$ if we choose the constant in the $O$-notation large enough. So with probability at least $\frac{1}{3}$ $G$ is good. Let $r$ be the number of good graphs and enumerate them $G_1,G_2,\ldots,G_r$. The probability that $G = G_i$ is $p^{\abs{E[G_i]}}(1-p)^{\binom{n}{2}-\abs{E[G_i]}}$. Since $G_i$ is good we know that $\abs{E[G_i]} \ge \frac{nD''}{2}$. Hence the probability is at most: \[ p^{nD''/2}(1-p)^{\binom{n}{2}-nD''/2} \le \binom{\binom{n}{2}}{nD''/2}^{-1} \] Where the inequality follows from the binomial expansion of $(p+(1-p))^{\binom{n}{2}}$. Hence we see that: \[ \frac{1}{3} \le \sum_{i=1}^r \Pr(G=G_i) \le r\binom{\binom{n}{2}}{\frac{nD''}{2}}^{-1} \] And hence there are at least $\frac{1}{3}\binom{\binom{n}{2}}{nD''/2}$ graphs with vertex set $[n]$ and maximum degree $\le D$. Now the result follows from the following estimate: \[ \binom{\binom{n}{2}}{\frac{nD''}{2}} \ge \binom{\binom{n}{2}}{\floor{\frac{nD}{2}}} \left ( \frac{\binom{n}{2}}{nD''/2} \right )^{nD''-nD} \ge \binom{\binom{n}{2}}{\floor{\frac{nD}{2}}} \left ( \frac{n}{D} \right )^{-O\!\left(n\sqrt{D \log n}\right)} \] \end{proof} As previously we get a bound on $g_v(\mathcal{G}_D)$. \begin{corollary} \label[corollary]{corRandLowerBound} For the family $\mathcal{G}_D$ of graphs with bounded degree $D$ on $n \ge 2D$ nodes \[ g_v(\mathcal{G}_D) \ge \binom{\floor{n/2}}{\floor{D/2}} \cdot 2^{-O \!\left (\sqrt{D\log n} \cdot \log(n/D) \right )} \] \end{corollary} \begin{proof} By the same argument as for \Cref{corLowerBoundLabelSizeBoundedDeg} we get that \Cref{lemRandLowerBound} implies: \[ g_v(\mathcal{G}_D) \ge \binom{\binom{n}{2}}{\floor{nD/2}}^{1/n} \cdot 2^{-O \!\left (\sqrt{D\log n} \cdot \log(n/D) \right )} = \binom{\floor{n/2}}{\floor{D/2}} \cdot 2^{-O \!\left (\sqrt{D\log n} \cdot \log(n/D) \right )} \] \end{proof} \section{Introduction} A graph $G=(V, E)$ is said to be an \emph{induced universal graph} for a family $\cal F$ of graphs if it contains each graph in $\cal F$ as a vertex-induced subgraph. A graph $H=(V',E')$ is contained in $G$ as a \emph{vertex-induced subgraph} if $V' \subseteq V$ and $E'=\{vw\mid v,w \in V' \wedge vw \in E\}$. Induced universal graphs have been studied since the 1960s~\cite{moon1965minimal,Rado64}, and bounds on the sizes of induced universal graphs have been given for many families of graphs, including general, bipartite~\cite{AlstrupKTZ14}, and bounded arboricity graphs~\cite{adjacencytrees2015}. We later define the classic distributed data structure \emph{adjacency labeling scheme} and describe how it is directly related to induced universal graphs. In Table~\ref{tab:adjacency2} in \Cref{sec:overview} below we give an overview of previous results and results in this paper. \subsection{Overview of new and existing results}\label{sec:overview} We give an overview in Table~\ref{tab:adjacency2} of dominating existing and new results. All bounds are on sizes of induced universal graphs. In the table, ``P'' refers to a result in this paper, $k=\ceil{D/2}$, $L=(\sqrt{D\log n} \cdot \log(n/D))$ and $U=(\sqrt{D\log n} \cdot \log(n/D))$. The ``A'' and ``B'' case below represent two different constructions. The upper bound in ``B'' is a randomized construction, whereas both lower bounds hold for both upper bounds. \begin{table*}[ht] \renewcommand{\arraystretch}{1.3} \small \centering \makebox[0pt][c]{ \begin{tabular}{|c|c|c|c|} \hline \hline \bf Graph family & \bf Lower bound & \bf Upper bound & \bf Lower/Upper\\ \hline \noalign{\vskip 2mm} \hline General& $2^{\frac{n-1}{2}}$ & $O( 2^{\frac{n}{2}})$ & \cite{moon1965minimal}/ \cite{AlstrupKTZ14} \\ \hline Tournaments & $2^{\frac{n-1}{2}}$ & $O( 2^{\frac{n}{2}})$ & \cite{moon1968topics}/\cite{AlstrupKTZ14} \\ \hline Bipartite& $\Omega(2^{\frac{n}{4}})$ & $O( 2^{\frac{n}{4}})$ & \cite{Lozin2007}/\cite{AlstrupKTZ14} \\ \hline \noalign{\vskip 2mm} \hline A: Max degree $D$ & $\Omega((\frac{n}{2eD})^{D/2})$ & $O\!\left(\frac{\min (n,k2^k)}{k!}n^k \right)$ & P/P and ~\cite{icalpnoy14} \\ \hline B: Max degree $D$ & $\binom{\floor{n/2}}{\floor{D/2}} \cdot 2^{-O(L)}$ & $ \binom{\floor{n/2}}{\floor{D/2}} \cdot 2^{O(U)}$ & P/P \\ \hline Max degree $D = o\!\left(\sqrt{n}\right)$ or $D \ge \frac{(2/3+\Omega(1))n}{\ln n}$ & $\binom{\floor{n/2}}{\floor{D/2}}\cdot n^{-O(1)}$ & & \cite{mckay1990asymptotic,mckay1991asymptotic} \\ \hline Constant odd degree $D$ & $\Omega(n^{\frac{D}{2}})$ & $O(n^{k-\frac{1}{D}})$ & \cite{Butler_induced-universalgraphs}/\cite{privatealon,AlonCapalbo2008,Esperet2008} \\ \hline Max degree 2& $11 \floor{n/6}$ & $2n-1$& \cite{Esperet2008}/P \\ \hline Acyclic, max degree 2& $\floor{3/2n}$ & $\floor{3/2n}$& P/P \\ \hline A cycle aware of $n$& $n+ \Omega(\log \log n)$ & $n+\log n + O(1)$ & P/P \\ \hline A cycle not aware of $n$& $n + \Omega\!\left(\sqrt[3]{n}\right)$ & $n+ O(\sqrt{n})$ & P/P \\ \hline \noalign{\vskip 2mm} \hline Excluding a fixed minor & $\Omega(n)$ & $n^2 (\log {n})^{O(1)} $ & \cite{gavoille2007shorter} \\ \hline Planar& $\Omega(n)$ &$n^2(\log n)^{O(1)}$ & \cite{gavoille2007shorter} \\ \hline Planar, constant degree & $\Omega(n)$ & $O(n^2)$& \cite{Chung90} \\ \hline Outerplanar & $\Omega(n)$ & $n (\log n)^{O(1)}$ & \cite{gavoille2007shorter} \\ \hline Outerplanar, constant degree & $\Omega(n)$& $O(n)$& \cite{Chung90}\\ \hline \noalign{\vskip 2mm} \hline Treewidth $l$ & $n2^{\Omega(l)}$& $n (\log \frac{n}{l})^{O(l)} $& \cite{gavoille2007shorter}\\ \hline Constant arboricity $l$ & $\Omega(n^l)$ & $O(n^l)$ & \cite{alstruprauhe}/\cite{adjacencytrees2015} \\ \hline \end{tabular} } \caption{Induced-universal graphs for various families of graphs. ``P'' is results in this paper. For the max degree results $k=\ceil{D/2}$. In the result for families of graphs with an excluded minor, the~$O(1)$ term in the exponent depends on the fixed minor excluded.} \label[table]{tab:adjacency2} \end{table*} \subsection{Maximum degree $2$ and maximum degree $D$} Let $g_v(\mathcal{F})$ be the smallest number of vertices in any induced universal graph for a family of graphs $\mathcal{F}$. Let $\mathcal{G}_D$ be the family of graphs with $n$ vertices and maximum degree $D$. In the families of graphs we study in this paper, a graph always has $n$ vertices, unless explicitly stated otherwise. {\bf {\large Maximum degree $2$.}} Butler~\cite{Butler_induced-universalgraphs} shows that $g_v(\mathcal{G}_2)\leq 6.5n$. That was subsequently improved to $g_v(\mathcal{G}_2)\leq 2.5n+O(1)$ by Esperet {\em et al.}~\cite{Esperet2008} who also show the lower bound $g_v(\mathcal{G}_2)\geq 11 \floor{n/6}$. Esperet {\em et al.}~\cite{Esperet2008} conjecture that $g_v(\mathcal{G}_2)\leq 2n+o(n)$ and raise as an open problem to prove or disprove this. We show the correctness of the conjecture by proving $g_v(\mathcal{G}_2)\leq 2n-1$. The $11 \floor{n/6}$ lower bound is based on a family of graphs whose largest component has $3$ vertices. We show matching $\frac{11}{6}n+\Oo(1)$ upper bounds for the family of graphs in $\mathcal{G}_2$ whose largest component is sufficiently small ($\leq6$ vertices), and for the family of graphs in $\mathcal{G}_2$ whose smallest component is sufficiently large ($\geq10$ vertices). {\bf {\large Maximum degree $D$.}} Let $k=\ceil{D/2}$. To give an upper bound for any value of $D$, Butler~\cite{Butler_induced-universalgraphs} first establishes: \begin{corollary}[\cite{Butler_induced-universalgraphs}]\label[corollary]{Butlersplit} Let $G \in \mathcal{G}_D$ be a graph on $n$ vertices with maximum degree $D$. Then $G$ can be decomposed into $k$ edge disjoint subgraphs where the maximum degree of each subgraph is at most $2$. \end{corollary} To achieve an upper bound this can be combined with: \begin{theorem}[\cite{Chung90}] \label[theorem]{ChungSplit} Let $\mathcal{F}$ and $\mathcal{Q}$ be two families of graphs and let $G$ be an induced universal graph for $\mathcal{F}$. Suppose that every graph in the family $\mathcal{Q}$ can be edge-partitioned into $\ell$ parts, each of which forms a graph in $\mathcal{F}$. Then $g_v(\mathcal{Q}) \leq |V[G]|^\ell$. \end{theorem} Butler~\cite{Butler_induced-universalgraphs} concludes $g_v(\mathcal{G}_D)\leq (6.5n)^k $. Similarly Esperet {\em et al.}~\cite{Esperet2008} achieve $g_v(\mathcal{G}_D)\leq (2.5n+O(1))^k$, and we achieve $g_v(\mathcal{G}_D)\leq (2n-1)^k=O(2^k n^k)$. For constant maximum degree $D$, Butler~\cite{Butler_induced-universalgraphs} also shows $g_v(\mathcal{G}_D)=\Omega(n^{D/2})$. When $D$ is even and constant, the bounds are hence very tight: $g_v(\mathcal{G}_D)=\Theta(n^{D/2})$. However, for non-constant $D$ we can, using another approach but still building on top of our maximum degree $2$ solution, beat Butler's lower bound for constant degree: For any value of $D$, we prove the upper bound $g_v(\mathcal{G}_D)=O\!\left(\frac{k2^k}{k!}n^k \right)$. We also give a lower bound for any value of $D$: $\Omega\!\left((\frac{n}{2eD})^{D/2}\right)$. {\bf {\large Constant odd degree.}} A \emph{universal} graph for a family of graphs ${\cal F}$ is a graph that contains each graph from ${\cal F}$ as a subgraph (not necessarily vertex induced). The challenge is to construct universal graphs with as few edges as possible. A graph has \emph{arboricity} $k$ if the edges of the graph can be partitioned into at most $k$ forests. Graphs with maximum degree $D$ have arboricity bounded by $\floor{\frac{D}{2}}+1$~\cite{chartrand68,Lovasz66}. When $D$ is odd and constant, some improvement have been achieved \cite{AlonCapalbo2008,Esperet2008} on the above bounds on $g_v(\mathcal{G}_D)$ by arguments involving universal graphs and graphs with bounded arboricity. Let $\mathcal{A}_k$ denote a family of graphs with arboricity at most $k$. \begin{theorem}[\cite{Chung90}] \label[theorem]{Arboricity} Let $G$ be a universal graph for $\mathcal{A}_k$ and $d_i$ the degree of vertex $i$ in $G$. Then $g_v(\mathcal{A}_k) \leq \sum_{i}(d_i+1)^k$. \end{theorem} Alon and Capalbo~\cite{alon2007sparse} describes a universal graph with $n$ vertices of maximum degree $c(D)n^{1-2/D}\log^{4/D}n$ for the family $\mathcal{G}_D$, where $D\geq 3$ and $c(D)$ is a constant. Using this bound in Theorem~\ref{Arboricity}, Esperet {\em et al.}~\cite{Esperet2008} note that for odd $D$ (and hence arboricity $k=\ceil{\frac{D}{2}}$), we get $g_v(\mathcal{G}_D)\leq c_1(D)n^{k-\frac{1}{D}}\log^{2+\frac{2}{D}}n$, for a constant $c_1(D)$.\footnote{In~\cite{Esperet2008} a typo states that the maximum degree for the universal graph in~\cite{alon2007sparse} is $c(D)n^{2-2/D}\log^{4/D}n$. The theorem in~\cite{alon2007sparse} only states the total number of edges being $c(D)n^{2-2/D}\log^{4/D}n$, however the maximum degree is $c(D)n^{1-2/D}\log^{4/D}n$~\cite{privatealon}.} Using the slightly better universal graphs from~\cite{AlonCapalbo2008} the maximum degree is reduced to $c(D)n^{1-2/D}$~\cite{privatealon}, giving $g_v(\mathcal{G}_D)\leq c_2(D)n^{k-\frac{1}{D}}$, for a constant $c_2(D)$. Note that using this technique for even values of $D$ would give $g_v(\mathcal{G}_D)\leq c_3(D)n^{\frac{D}{2}+1-\frac{2}{D}}$, for a constant $c_3(D)$, which is asymptotically worse even for constant values of $D$, compared to any of the new upper bounds presented in this paper. In~\cite{alon2010universality} it is stated that the methods in~\cite{AlonCapalbo2008} can be used to achieve $g_v(\mathcal{G}_D)=O(n^{D/2})$ for constant odd values of $D>1$, however according to~\cite{privatealon} this still has to be checked more carefully, and the hidden constant in the $O$-notation is not small. \subsection{Adjacency labeling schemes and induced universal graphs} An \emph{adjacency labeling scheme} for a given family $\mathcal{F}$ of graphs assigns \emph{labels} to the vertices of each graph in $\mathcal{F}$ such that a \emph{decoder} given the labels of two vertices from a graph, and no other information, can determine whether or not the vertices are adjacent in the graph. The labels are assumed to be bit strings, and the goal is to minimize the maximum label size. A $b$-bit labeling scheme uses at most $b$ bits per label. Information theoretical studies of adjacency labeling schemes go back to the 1960s~\cite{Breuer66,BF67}, and efficient labeling schemes were introduced in~\cite{KNR92,muller}. For graphs with bounded degree $D$, it was shown in~\cite{BF67} that labels of size $2nD$ can be constructed such that two vertices are adjacent whenever the Hamming distance~\cite{hamming} of their labels is at most $4D-4$. A labelling scheme for $\mathcal{F}$ is said to have \emph{unique labels} if no two vertices in the same graph from $\mathcal{F}$ are given the same label. \begin{theorem}[\cite{KNR92}] \label[theorem]{KNRreduction} A family $\mathcal{F}$ of graphs has a $b$-bit adjacency labeling scheme with unique labels iff $g_v(\mathcal{F}) \leq 2^b$. \end{theorem} From a labeling perspective the above new upper and lower bounds are at most an additive $O(D+\log n)$ term from optimality. \subsection{Better bounds for larger $D$, $D=\Omega(\log^3 n)$} We have another approach which for large $D$, $D=\Omega(\log^3 n)$, gives better bounds than the ones presented above for constant $D$. The previous best upper bound for such large $D$ was $\binom{n}{\ceil{D/2}} n^{O(1)}$ due to Adjiashvili and Rotbart~\cite{icalpnoy14}. For any $D$ we prove the lower and upper bounds \[\binom{\floor{n/2}}{\floor{D/2}} \cdot 2^{-O \!\left (\sqrt{D\log n} \cdot \log(n/D) \right )} \text{ and } \binom{\floor{n/2}}{\floor{D/2}} \cdot 2^{O \!\left (\sqrt{D\log n} \cdot \log(n/D) \right )},\] where the upper bound is a randomized construction. From a labeling perspective our bounds are the first to give labels for any value of $D$ that are at most $o(n)$ bits longer than the shortest possible labels. An asymptotic enumeration of the number of $D$-regular graphs due to McKay and Wormald \cite{mckay1990asymptotic,mckay1991asymptotic} combined with Stirling's formula gives a stronger lower bound of $\binom{\floor{n/2}}{\floor{D/2}} \cdot n^{-O(1)}$ whenever $D = o\left(\sqrt{n}\right)$ or $D > \frac{cn}{\ln n}$ for a constant $c > \frac{2}{3}$. \subsection{Acyclic graphs and cycle graphs} On our way to understand the family $\mathcal{G}_2$ better, we first examine two other basic families of graphs. For the family $\mathcal{AC}$ of acyclic graphs on $n$ vertices with maximum degree $2$ we show an upper bound matching exactly the lower bound in~\cite{Esperet2008}, which makes us conclude $g_v(\mathcal{AC})=\floor{3/2n}$. This lower bound is not explicitly stated in~\cite{Esperet2008}, but follows directly from the construction of the lower bound for $g_v(\mathcal{G}_2)$. We also study the family $\mathcal{C}_n$ of graphs consisting of one cycle of length $\leq n$ (and no other edges or vertices). For this family we show $n+ \Omega(\log \log n)\leq g_v(\mathcal{C}_n) \leq n+\log n + O(1)$. \subsection{Oblivious decoding} From a labeling perspective one can assume all labels have the same length~\cite{AlstrupKTZ14}. Hence, if the decoder does not know what $n$ is, it will always be able to compute $n$ approximately. However, we show that the label size in an optimum labeling scheme can be smaller if the decoder knows $n$ precisely. To be more specific, let $\mathcal{F}_n$ be a family of graphs for each $n=1,2,\ldots$. We show that there is a labeling scheme of $\mathcal F_n$ using $f(n)$ labels that enables a decoder not aware of $n$ to answer adjacency queries iff there is a family of graphs $G_1,G_2,\ldots$ such that $G_n$ is an induced universal graph for $\mathcal F_n$, $|G_n|=f(n)$, and $G_n$ is an induced subgraph of $G_{n+1}$ for every $n$. Next we show that with this extra requirement to the induced universal graph we have $n + \Omega\!\left(\sqrt[3]{n}\right) \leq g_v(\mathcal{C}_n) \leq n+ O(\sqrt{n})$. The lower bound is true for infinitely many $n$, but for specific $n$ it might not hold. For the other problems studied in this paper, the decoder does not need to know $n$, but the lower bounds hold even if it does. To the best of our knowledge this is the first time this relationship between labeling schemes and induced universal graphs has been described and examples have been given where the complexities differ. \subsection{Related results} For the family of general, undirected graphs on $n$ vertices, Alstrup {\em et al.}~\cite{AlstrupKTZ14} give an induced universal graph with $O(2^{n/2})$ vertices, which matches a lower bound by Moon \cite{moon1965minimal}. More recently Alon~\cite{Alonconstant2016} shows the existents of a construction having a better constant factor than the one in~\cite{AlstrupKTZ14}. It follows from~\cite{adjacencytrees2015,alstruprauhe} that $g_v(\mathcal{A}_k)=\theta(n^k)$ for the family $\mathcal{A}_k$ of graphs with constant arboricity $k$ and $n$ vertices. Using universal graphs constructed by Babai {\em et al.}~\cite{BCEGS82}, Bhatt {\em et al.}~\cite{BCLR89}, and Chung {\em et al.}~\cite{CG78,CG79,CG83,CGP76}, Chung~\cite{Chung90} obtains the best currently known bounds for e.g.~induced universal graphs for planar and outerplanar bounded degree graphs. Labeling schemes are being widely used and well-studied in the theory community: Chung~\cite{Chung90} gives labels of size $\log n+O(\log \log n)$ for adjacency labeling in trees, which was improved to $\log n + O(\log^* n)$~\cite{alstruprauhe} and in~\cite{bonichon2006short,Chung90,Fraigniaud2009randomized,fraigniaudkorman2,KMS02} to $\log n + \Theta(1)$ for various special cases of trees. Finally it was improved to $\log n + \Theta(1)$ for general trees~\cite{adjacencytrees2015}. Using labeling schemes, it is possible to avoid costly access to large global tables and instead only perform local and distributed computations. Such properties are used in applications such as XML search engines~\cite{AKM01}, network routing and distributed algorithms~\cite{Cowen01,EilamGP03,Gavoille01,ThZw05}, dynamic and parallel settings ~\cite{CohenKaplan2010,dynamicKormanP07}, and various other applications~\cite{Korman2010,peleg2,SK85}. A survey on induced universal graphs and adjacency labeling can be found in~\cite{AlstrupKTZ14}. See~\cite{gavoillepeleg} for a survey on labeling schemes for various queries. \section{Maximum degree $2$ upper bounds}\label{sec:max2upper} In this section we prove upper bounds on $g_v(\mathcal{G}_2)$, and on $g_v(\mathcal{F})$ for several special families $\mathcal{F}\subseteq\mathcal{G}_2$. \subsection{$2n-1$ upper bound for $g_v(\mathcal{G}_2)$} \pgfdeclarelayer{background} \pgfdeclarelayer{foreground} \pgfsetlayers{background,main,foreground} \newenvironment{tikzpicture-Un}[1][1]{% \begin{tikzpicture}[scale=0.5] \pgfmathtruncatemacro{\n}{#1}; \pgfmathtruncatemacro{\vmax}{2*\n-2}; \begin{scope}[ vertex style/.style={ draw, circle, minimum size=3mm, inner sep=0pt, outer sep=0pt% }, selected vertex style/.style={ draw, circle, fill=blue!20, minimum size=3mm, inner sep=0pt, outer sep=0pt% }, selected edge style/.style={ rounded corners,line width=1.5mm,blue!20,cap=round% } ] \foreach \i in {0,...,\vmax}{% \pgfmathtruncatemacro{\x}{div(\i+1,2)}; \pgfmathtruncatemacro{\y}{mod(\i+1,2)*(2*mod(\x,2)-1)}; \node[vertex style] (v\i) at (\x,\y) {\tiny $\i$}; }; }{% \foreach \i in {0,...,\vmax}{% \pgfmathtruncatemacro{\nexti}{\i+1}; \ifthenelse{\i=2 \OR \nexti>\vmax \OR \nexti=2}{% }{% \draw[thick,color=red] (v\i) -- (v\nexti); } \pgfmathtruncatemacro{\nexti}{4-mod(\i,2)+\i} \ifthenelse{\i=2 \OR \nexti>\vmax \OR \nexti=2}{% }{% \pgfmathtruncatemacro{\imod}{mod(\i,2)} \ifthenelse{\imod=1}{% \draw[thick,color=ForestGreen] (v\i) -- (v\nexti); }{% \draw[thick,color=blue] (v\i) -- (v\nexti); } } }; \end{scope} \end{tikzpicture} }% \NewEnviron{tikzpicture-Un-induced}[2]{ \begin{tikzpicture-Un}[#1] \BODY \begin{pgfonlayer}{background} \foreach \i in {#2}{% \node[selected vertex style] at (v\i) {\tiny $\i$}; } \foreach \i in {#2}{% \ifthenelse{\i=2}{% }{% \foreach \j in {#2}{% \ifthenelse{\i<\j \AND \NOT \j=2}{% \pgfmathtruncatemacro{\nexti}{\i+1}; \ifthenelse{\nexti=\j}{% \draw[selected edge style] (v\i.center) -- (v\j.center); }{} \pgfmathtruncatemacro{\nexti}{4-mod(\i,2)+\i} \ifthenelse{\nexti=\j}{% \draw[selected edge style] (v\i.center) -- (v\j.center); }{} }{ } } } } \end{pgfonlayer} \end{tikzpicture-Un} }% \newcommand{\tikzUnInduced}[2][]{ \begin{tikzpicture-Un-induced}{#2}{#1} \end{tikzpicture-Un-induced} } Here we prove that there exists an induced universal graph with $2n-1$ vertices and $4n-9$ edges for the family $\mathcal{G}_2$ of all graphs with $n$ vertices and maximum degree $2$. \begin{definition}\label[definition]{def:Un} Let \begin{align*} s(x)&:= \begin{cases} x+4&\text{ if }x\equiv0\pmod{2} \\ x+3&\text{ otherwise} \end{cases} \end{align*} and for any $n\in\mathbb{N}_0$ let $U_n$ be the graph with vertex set $[2n-1]$ and an edge $(u,v)$ iff $u,v\neq2$ and either $\abs{u-v}=1$ or $u=s(v)$ or $v=s(u)$. (See~\cref{fig:Un-example}). \end{definition} \begin{figure}[h!] \begin{center} \tikzUnInduced{1}~ \tikzUnInduced{2}~ \tikzUnInduced{3}~ \tikzUnInduced{4}~ \tikzUnInduced{5}~ \tikzUnInduced{6} \\ ~\\ \tikzUnInduced{26} \caption{$U_1,\ldots,U_6$, and $U_{26}$ with each $(u,v)$ colored \textcolor{red}{red}/\textcolor{ForestGreen}{green}/\textcolor{blue}{blue} if $\abs{u-v}=1/3/4$.} \label{fig:Un-example} \end{center} \end{figure} \begin{theorem} The graph family $U_0, U_1, \ldots $ has the property that for $n\in\mathbb{N}_0$ \begin{enumerate}[label=(\alph*)] \item $U_n$ has $\max\set{0,2n-1}$ vertices, and $\max\set{0,n-1,3n-5,4n-9}$ edges. \item $U_n$ is an induced subgraph of $U_{n+1}$. \item $U_n$ is an induced universal graph for the family of graphs with $n$ vertices and maximum degree $2$ \end{enumerate} \end{theorem} \begin{proof} If $n=0$, $U_n$ has $0$ vertices. Otherwise the number of vertices in $U_n$ is trivially $2n-1$ from the definition. It is also clear that $U_0$ and $U_1$ each have $0$ edges, $U_2$ has $1$ edge, $U_3$ has $4$ edges, and $U_4$ has $7$ edges. Finally for $n>4$, $U_{n}$ has exactly $4$ edges more than $U_{n-1}$, and therefore has $4(n-4)+7 = 4n-9$ edges, as desired. Since the existence of an edge $(u,v)$ does not depend on $n$, the subgraph of $U_{n+1}$ induced by all vertices with label $\leq2n-2$ is exactly $U_n$. For the final part, consider a graph $G\in\mathcal{G}_2$. We need to show that $G$ is an induced subgraph of $U_n$. The proof is by induction on the number of $P_{\set{\geq3}}$ and $C_{\set{\geq4}}$ components in $G$. If there are no such components, all components are either $P_1$, $P_2$, or $C_3$. Suppose therefore that $G \simeq k_1\times{}P_1 + k_2\times{}P_2 + k_3\times{}C_3$ for some $k_1,k_2,k_3\in\mathbb{N}_0$, and let $n_1=k_1$, $n_2=2k_2$, and $n_3=3k_3$ (so $n=n_1+n_2+n_3$). Further, assume that $n>1$ since otherwise it is trivial. Informally, we will show that assigning labels greedily, smallest label first, in the order $C_3$, $P_2$, $P_1$ is sufficient. Formally, let $\set{I_3,I_2,I_1}$ be the partition of $\set{-1,\ldots,2n-2}$ into parts of size $2n_3$, $2n_2$, and $2n_1$ such that $i_3<i_2<i_1$ for all $(i_3,i_2,i_1)\in I_3\times{}I_2\times{}I_1$, and let $A_3:=I_3\setminus\set{-1,2}$, $A_2:=I_2\setminus\set{-1,2}$, and $A_1:=(I_1\cup\set{2})\setminus\set{-1}$. Then $\set{A_3,A_2,A_1}$ is a partition of $V[U_n]$. Now let \begin{itemize} \item $V_3:=\set{i\in A_3\mathrel{}\middle\vert\mathrel{} i\in\set{0,1,4}\pmod{6}}$ \item $V_2:=\set{i\in A_2\mathrel{}\middle\vert\mathrel{} i-(6n_3-1)\in\set{1,2,4,7}\pmod{8}}$ \item $V_1:= \begin{cases} \emptyset&\text{if }n_1=0\\ \set{2}&\text{if }n_1=1\\ \set{2,2(n-n_1)}\cup\set{i\in A_1\mathrel{}\middle\vert\mathrel{} i\equiv1\pmod{2}\wedge i\geq2(n-n_1)+3}&\text{otherwise} \end{cases}$ \end{itemize} Let $V=V_1\cup{}V_2\cup{}V_3$ and let $G'$ be the subgraph of $U_n$ induced by $V$. We claim that $G\simeq{}G'$ (see~\cref{fig:V1V2V3}). \begin{figure}[h!] \begin{center} \begin{tikzpicture-Un-induced}{24}{ 0,1,4, 6,7,10, 12,13,16, 18,19,22, 24,25, 27,30, 32,33, 35,38, 2,40,43,45} \draw[very thick,dotted,red] ($(v0.north west)+(-0.15,1.15)$) -- ($(v3.north west)+(-0.15,0.15)$) -- ($(v3.north west)+(-0.15,1.15)$) -- ($(v22.north east)+(+0.15,0.15)$) -- ($(v21.south east)+(+0.15,-1.15)$) -- ($(v0.south west)+(-0.15,-0.15)$) -- cycle; \draw[very thick,dotted,red] ($(v24.south west)+(-0.15,-0.15)$) rectangle ($(v38.north east)+(0.15,0.15)$); \draw[very thick,dotted,red] ($(v2.north west)+(-0.15,0.75)$) -- ($(v46.north east)+(0.15,0.75)$) -- ($(v45.south east)+(0.15,-1.15)$) -- ($(v40.south west)+(-0.15,-0.15)$) -- ($(v39.north west)+(-0.15,1.5)$) -- ($(v2.north east)+(0.15,0.5)$) -- ($(v2.south east)+(0.15,-0.15)$) -- ($(v2.south west)+(-0.15,-0.15)$) -- cycle; \end{tikzpicture-Un-induced} \caption{$U_{24}$ with $4\times{}P_1+4\times{}P_2+4\times{}C_3$ embedded. The dotted red boxes represent $A_1$, $A_2$, and $A_3$ respectively. $V_1$, $V_2$, and $V_3$ consist of the marked vertices in each of the dotted red boxes.} \label{fig:V1V2V3} \end{center} \end{figure} \noindent Now it follows from~\cref{def:Un} that for $v\in V$ the neighbors of $v$ in $G'$ are: \begin{align*} N(v) &:= (V\setminus\set{2})\cap \begin{cases} \emptyset &\text{ if }v=2\\ \set{v-4,v-3,v-1,v+1,v+4} &\text{ if }v\neq2 \wedge v\equiv0\pmod{2}\\ \set{v-1,v+1,v+3} &\text{ otherwise} \end{cases} \end{align*} To see that $G\simeq G'$, first note that $\abs{V_1}=n_1$ and $N(v_1)=\emptyset$ for all $v_1\in{}V_1$. Thus the component of $v_1$ in $G'$ is a $P_1$. Second, note that $\abs{V_2}=n_2$ and that each vertex $v_2\in{}V_2$ has the form $v_2=b_2+k$ with $b_2=(6n_3-1)+8j\equiv1\pmod{2}$ for some $j\in[\floor{\frac{n_2}{4}}], k\in\set{1,2,4,7}$. Now $N(b_2+1)=\set{b_2+2}\subseteq V_2$, $N(b_2+2)=\set{b_2+1}\subseteq V_2$, $N(b_2+4)=\set{b_2+7}\subseteq V_2$, and $N(b_2+7)=\set{b_2+4}\subseteq V_2$, so $v_2$ has exactly one neighbor in $V$, and this neighbor is also in $V_2$. Thus the component of $v_2$ in $G'$ is a $P_2$. Third, note that $\abs{V_3}=n_3$, and that each vertex $v_3\in{}V_3$ has the form $v_3=b_3+k$ with $b_3=6j\equiv0\pmod{2}$ for some $j\in[\frac{n_3}{3}], k\in\set{0,1,4}$. Now $N(b_3+0)=\set{b_3+1,b_3+4}\subseteq V_3$, $N(b_3+1)=\set{b_3+0,b+4}\subseteq V_3$, and $N(b_3+4)=\set{b_3+0,b+1}\subseteq V_3$, so the component of $v_3$ in $G'$ consists of the $3$ vertices $\set{b_3,b_3+1,b_3+4}$, which form a $C_3$. Thus $G'\simeq n_1\times{}P_1 + \frac{n_2}{2}\times{}P_2 + \frac{n_3}{3}\times{}C_3 \simeq k_1\times{}P_1 + k_2\times{}P_2 + k_3\times{}C_3 \simeq G$. For the induction case, suppose $G$ has a component $X$ which is either a $P_k$ for some $k\geq3$, or a $C_k$ for some $k\geq4$. In either case, let $I^-:=[2(n-k)-1]$ and $I^+:=[2n-1]\setminus{}I^-$. Then $I^-$ induces an $U_{n-k}$ subgraph in $U_n$, which by induction has $G-X$ as induced subgraph. Thus all we need to show is that we can extend this to an embedding of $G$ by using using only vertices from $I^+$ to embed $X$ (see~\cref{fig:VP-VC}). \begin{figure}[h!]% \begin{center}% \begin{tikzpicture-Un-induced}{6}{1,4,6,8,9,10} \draw[very thick,dotted,red] ($(v0.south west)+(-1.15,-0.15)$) rectangle ($(v0.north east)+(-0.85,2.15)$); \draw[very thick,dotted,green] ($(v0.south west)+(-0.15,-0.15)$) rectangle ($(v10.north east)+(0.15,0.15)$); \end{tikzpicture-Un-induced} ~~~ \begin{tikzpicture-Un-induced}{7}{3,6,8,10,11,12} \draw[very thick,dotted,red] ($(v0.south west)+(-0.15,-0.15)$) rectangle ($(v0.north east)+(0.15,2.15)$); \draw[very thick,dotted,green] ($(v2.north west)+(-0.15,0.15)$) rectangle ($(v12.south east)+(0.15,-0.15)$); \end{tikzpicture-Un-induced} ~~~ \begin{tikzpicture-Un-induced}{10}{9,12,14,16,17,18} \draw[very thick,dotted,red] ($(v0.south west)+(-0.15,-0.15)$) rectangle ($(v6.north east)+(0.15,0.15)$); \draw[very thick,dotted,green] ($(v8.south west)+(-0.15,-0.15)$) rectangle ($(v18.north east)+(0.15,0.15)$); \end{tikzpicture-Un-induced}% \\ ~ \\ \begin{tikzpicture-Un-induced}{6}{3,4,6,8,9,10} \draw[very thick,dotted,red] ($(v0.south west)+(-1.15,-0.15)$) rectangle ($(v0.north east)+(-0.85,2.15)$); \draw[very thick,dotted,green] ($(v0.south west)+(-0.15,-0.15)$) rectangle ($(v10.north east)+(0.15,0.15)$); \end{tikzpicture-Un-induced} ~~~ \begin{tikzpicture-Un-induced}{7}{5,6,8,10,11,12} \draw[very thick,dotted,red] ($(v0.south west)+(-0.15,-0.15)$) rectangle ($(v0.north east)+(0.15,2.15)$); \draw[very thick,dotted,green] ($(v2.north west)+(-0.15,0.15)$) rectangle ($(v12.south east)+(0.15,-0.15)$); \end{tikzpicture-Un-induced} ~~~ \begin{tikzpicture-Un-induced}{10}{11,12,14,16,17,18} \draw[very thick,dotted,red] ($(v0.south west)+(-0.15,-0.15)$) rectangle ($(v6.north east)+(0.15,0.15)$); \draw[very thick,dotted,green] ($(v8.south west)+(-0.15,-0.15)$) rectangle ($(v18.north east)+(0.15,0.15)$); \end{tikzpicture-Un-induced}% \\ \caption{$P_6$ (top) and $C_6$ (bottom) embedded in $U_{6}$ (left), $U_{7}$ (middle), and $U_{10}$ (right). In each case the dotted red and green boxes represent $I^-$ and $I^+$ respectively, and $V^P$ or $V^C$ is the marked vertices in the green box. Notice that the contents of the red boxes is $U_0$ (left), $U_1$ (middle), and $U_4$ (right).} \label{fig:VP-VC} \end{center} \end{figure} \noindent Now let \begin{itemize} \item $V^P:=\set{2(n-k)+1, 2n-3}\cup\set{i\in I^+\mathrel{}\middle\vert\mathrel{} i\geq 2(n-k)+4 \wedge i\equiv0\pmod{2}}$ \item $V^C:=\set{2(n-k)+3, 2n-3}\cup\set{i\in I^+\mathrel{}\middle\vert\mathrel{} i\geq 2(n-k)+4 \wedge i\equiv0\pmod{2}}$ \end{itemize} Now for $k\geq3$ the subgraph induced by $V^P$ in $U_n$ is $P_k$, and for all $v\in{}V^P$ all neighbors to $v$ are in $I^+$. Similarly, for $k\geq4$ the subgraph induced by $V^P$ in $U_n$ is $C_k$, and for all $v\in{}V^C$ all neighbors to $v$ are in $I^+$. Thus, either $V^P$ or $V^C$ can be used to extend the embedding of $G-X$ in $U_{n-k}$ to an embedding of $G$ in $U_n$. \end{proof} \subsection{$\frac{11}{6}n+\Oo(1)$ upper bound when all components are small} Esperet {\em et al.}~\cite{Esperet2008} showed that $g_v(\mathcal{G}_2)\geq 11 \floor{n/6}$ by considering a specific family of graphs whose largest component had $3$ vertices. We used the same idea in our proof of \Cref{thm:pathlower}. A natural attempt to improve the lower bound would be to include larger components. However, as the following shows, considering components with $4$, $5$, or $6$ vertices is not sufficient. \begin{figure}[h!] \begin{tikzpicture*}{\textwidth} \begin{scope}[every node/.append style={ draw, circle, minimum size=2mm, inner sep=0pt, outer sep=0pt% }] \node (v0) at (1,1) {}; \node (v1) at (2,1) {}; \node (v2) at (3,1) {}; \node (v3) at (1,2) {}; \node (v4) at (2,2) {}; \node (v5) at (3,2) {}; \node (v6) at (1,3) {}; \node (v7) at (2,3) {}; \node (v8) at (3,3) {}; \node (v9) at (1,4) {}; \node (v10) at (3,4) {}; \node (v11) at (1,5) {}; \node (v12) at (2,5) {}; \node (v13) at (3,5) {}; \node (v14) at (1,6) {}; \node (v15) at (2,6) {}; \node (v16) at (3,6) {}; \node (v17) at (1,7) {}; \node (v18) at (2,7) {}; \node (v19) at (3,7) {}; \draw (v0) -- (v1); \draw (v1) -- (v2); \draw (v0) -- (v3); \draw (v1) -- (v3); \draw (v2) -- (v4); \draw (v2) -- (v5); \draw (v3) -- (v4); \draw (v3) -- (v6); \draw (v4) -- (v6); \draw (v5) -- (v7); \draw (v5) -- (v8); \draw (v6) -- (v7); \draw (v7) -- (v8); \draw (v7) -- (v9); \draw (v7) -- (v10); \draw (v9) -- (v12); \draw (v10) -- (v12); \draw (v11) -- (v12); \draw (v11) -- (v14); \draw (v12) -- (v13); \draw (v12) -- (v14); \draw (v13) -- (v15); \draw (v13) -- (v16); \draw (v14) -- (v17); \draw (v15) -- (v16); \draw (v15) -- (v17); \draw (v16) -- (v18); \draw (v16) -- (v19); \draw (v17) -- (v18); \draw (v18) -- (v19); \node (v20) at (1+4,1) {}; \node (v21) at (2+4,1) {}; \node (v22) at (3+4,1) {}; \node (v23) at (1+4,2) {}; \node (v24) at (2+4,2) {}; \node (v25) at (3+4,2) {}; \node (v26) at (1+4,3) {}; \node (v27) at (2+4,3) {}; \node (v28) at (3+4,3) {}; \node (v29) at (1+4,4) {}; \node (v30) at (3+4,4) {}; \node (v31) at (1+4,5) {}; \node (v32) at (2+4,5) {}; \node (v33) at (3+4,5) {}; \node (v34) at (1+4,6) {}; \node (v35) at (2+4,6) {}; \node (v36) at (3+4,6) {}; \node (v37) at (1+4,7) {}; \node (v38) at (2+4,7) {}; \node (v39) at (3+4,7) {}; \draw (v20) -- (v21); \draw (v21) -- (v22); \draw (v20) -- (v23); \draw (v21) -- (v23); \draw (v22) -- (v24); \draw (v22) -- (v25); \draw (v23) -- (v24); \draw (v23) -- (v26); \draw (v24) -- (v26); \draw (v25) -- (v27); \draw (v25) -- (v28); \draw (v26) -- (v27); \draw (v27) -- (v28); \draw (v27) -- (v29); \draw (v27) -- (v30); \draw (v29) -- (v32); \draw (v30) -- (v32); \draw (v31) -- (v32); \draw (v31) -- (v34); \draw (v32) -- (v33); \draw (v32) -- (v34); \draw (v33) -- (v35); \draw (v33) -- (v36); \draw (v34) -- (v37); \draw (v35) -- (v36); \draw (v35) -- (v37); \draw (v36) -- (v38); \draw (v36) -- (v39); \draw (v37) -- (v38); \draw (v38) -- (v39); \node (v40) at (1+14,1) {}; \node (v41) at (2+14,1) {}; \node (v42) at (3+14,1) {}; \node (v43) at (1+14,2) {}; \node (v44) at (2+14,2) {}; \node (v45) at (3+14,2) {}; \node (v46) at (1+14,3) {}; \node (v47) at (2+14,3) {}; \node (v48) at (3+14,3) {}; \node (v49) at (1+14,4) {}; \node (v50) at (3+14,4) {}; \node (v51) at (1+14,5) {}; \node (v52) at (2+14,5) {}; \node (v53) at (3+14,5) {}; \node (v54) at (1+14,6) {}; \node (v55) at (2+14,6) {}; \node (v56) at (3+14,6) {}; \node (v57) at (1+14,7) {}; \node (v58) at (2+14,7) {}; \node (v59) at (3+14,7) {}; \draw (v40) -- (v41); \draw (v41) -- (v42); \draw (v40) -- (v43); \draw (v41) -- (v43); \draw (v42) -- (v44); \draw (v42) -- (v45); \draw (v43) -- (v44); \draw (v43) -- (v46); \draw (v44) -- (v46); \draw (v45) -- (v47); \draw (v45) -- (v48); \draw (v46) -- (v47); \draw (v47) -- (v48); \draw (v47) -- (v49); \draw (v47) -- (v50); \draw (v49) -- (v52); \draw (v50) -- (v52); \draw (v51) -- (v52); \draw (v51) -- (v54); \draw (v52) -- (v53); \draw (v52) -- (v54); \draw (v53) -- (v55); \draw (v53) -- (v56); \draw (v54) -- (v57); \draw (v55) -- (v56); \draw (v55) -- (v57); \draw (v56) -- (v58); \draw (v56) -- (v59); \draw (v57) -- (v58); \draw (v58) -- (v59); \node (v60) at (11,1) {}; \node (v61) at (11,2) {}; \node (v62) at (10,3) {}; \node (v63) at (11,3) {}; \node (v64) at (12,3) {}; \node (v65) at (10,4) {}; \node (v66) at (12,4) {}; \node (v67) at ( 9,5) {}; \node (v68) at (13,5) {}; \node (v69) at (10,6) {}; \node (v70) at (12,6) {}; \node (v71) at (10,7) {}; \node (v72) at (11,7) {}; \node (v73) at (12,7) {}; \node (v74) at (11,8) {}; \node (v75) at (11,9) {}; \draw (v60) -- (v61); \draw (v61) -- (v62); \draw (v61) -- (v63); \draw (v61) -- (v64); \draw (v62) -- (v65); \draw (v63) -- (v65); \draw (v63) -- (v66); \draw (v64) -- (v66); \draw (v65) -- (v66); \draw (v65) -- (v67); \draw (v66) -- (v68); \draw (v67) -- (v69); \draw (v68) -- (v70); \draw (v69) -- (v70); \draw (v69) -- (v71); \draw (v69) -- (v72); \draw (v70) -- (v72); \draw (v70) -- (v73); \draw (v71) -- (v74); \draw (v72) -- (v74); \draw (v73) -- (v74); \draw (v74) -- (v75); \node (v76) at (11,13) {}; \node (v77) at ( 8,10) {}; \node (v78) at ( 9,10) {}; \node (v79) at ( 7,11) {}; \node (v80) at ( 8,11) {}; \node (v81) at (10,11) {}; \node (v82) at ( 8,12) {}; \node (v83) at ( 9,12) {}; \draw (v77) -- (v78); \draw (v77) -- (v79); \draw (v78) -- (v80); \draw (v78) -- (v81); \draw (v78) -- (v83); \draw (v79) -- (v80); \draw (v79) -- (v82); \draw (v81) -- (v83); \draw (v82) -- (v83); \node (v84) at (22- 8,10) {}; \node (v85) at (22- 9,10) {}; \node (v86) at (22- 7,11) {}; \node (v87) at (22- 8,11) {}; \node (v88) at (22-10,11) {}; \node (v89) at (22- 8,12) {}; \node (v90) at (22- 9,12) {}; \draw (v84) -- (v85); \draw (v84) -- (v86); \draw (v85) -- (v87); \draw (v85) -- (v88); \draw (v85) -- (v90); \draw (v86) -- (v87); \draw (v86) -- (v89); \draw (v88) -- (v90); \draw (v89) -- (v90); \draw (v75) -- (v78); \draw (v75) -- (v85); \draw (v76) -- (v83); \draw (v76) -- (v90); \node (v91) at ( 2, 9) {}; \node (v92) at ( 6, 9) {}; \node (v93) at ( 4,10) {}; \node (v94) at ( 3,11) {}; \node (v95) at ( 5,11) {}; \node (v96) at ( 4,12) {}; \node (v97) at ( 2,13) {}; \node (v98) at ( 6,13) {}; \node (v99) at ( 1,11) {}; \draw (v91) -- (v92); \draw (v91) -- (v93); \draw (v91) -- (v97); \draw (v92) -- (v93); \draw (v93) -- (v94); \draw (v93) -- (v95); \draw (v94) -- (v96); \draw (v95) -- (v96); \draw (v96) -- (v97); \draw (v96) -- (v98); \draw (v97) -- (v98); \draw (v97) -- (v99); \node (v100) at (22- 2, 9) {}; \node (v101) at (22- 6, 9) {}; \node (v102) at (22- 4,10) {}; \node (v103) at (22- 3,11) {}; \node (v104) at (22- 5,11) {}; \node (v105) at (22- 4,12) {}; \node (v106) at (22- 2,13) {}; \node (v107) at (22- 6,13) {}; \node (v108) at (22- 1,11) {}; \draw (v100) -- (v101); \draw (v100) -- (v102); \draw (v100) -- (v106); \draw (v101) -- (v102); \draw (v102) -- (v103); \draw (v102) -- (v104); \draw (v103) -- (v105); \draw (v104) -- (v105); \draw (v105) -- (v106); \draw (v105) -- (v107); \draw (v106) -- (v107); \draw (v106) -- (v108); \draw (v79) -- (v92); \draw (v79) -- (v98); \draw (v86) -- (v101); \draw (v86) -- (v107); \node (v109) at (19,4) {}; \end{scope} \end{tikzpicture*} \caption{This graph on $110$ nodes embeds all graphs on $60$ nodes whose maximum degree is $2$ and whose largest component has size at most $6$.} \label{fig:116-small} \end{figure} \begin{theorem} For any $n\in\mathbb{N}$ there exists a graph with $\frac{11}{6}n+\mathcal{O}(1)$ vertices, that contains as induced subgraphs all graphs on $n$ vertices whose maximum degree is $2$ and whose largest component has at most $6$ vertices. \end{theorem} \begin{proof} Let $G$ be a graph with $n$ vertices and maximum degree $2$ whose largest component has at most $6$ vertices. Let $H$ be the graph on $110$ vertices depicted in Figure~\ref{fig:116-small}. It is easy to see by inspection that this graph has each of $60\times P_1$, $30\times P_2$, $20\times P_3$, $20\times C_3$, $15\times P_4$, $15\times C_4$, $12\times P_5$, $12\times C_5$, $10\times P_6$, and $10\times C_6$ as induced subgraphs. Now, any graph with the desired properties whose components do not include all the components of one of these graphs has at most $(60-1)+(60-2)+(60-3)+(60-3)+(60-4)+(60-4)+(60-5)+(60-5)+(60-6)+(60-6)=561$ vertices, and can be embedded in at most $10$ copies of $H$. The whole of $G$ can therefore be embedded in at most $c=\left\lfloor\frac{n}{60}\right\rfloor+10$ copies of $H$. The total number of vertices in $c\times H$ is $110c\leq\frac{11}{6}n+1100$, which is $\frac{11}{6}n+\mathcal{O}(1)$ as desired. \end{proof} A more careful analysis shows that $\left\lceil\frac{n}{60}\right\rceil$ copies of $H$ is always sufficient to embed any $G\in\mathcal{G}_2$ with $n$ vertices, which in particular means that the $11\floor{n/6}$ bound is achievable for any such graph with $n$ divisible by $60$. We are not sure if the above construction can be extended to handle components of size $7$ or more. It would involve constructing a graph with $770$ vertices. An interesting open question is: Is there a function $f$, such that for any $n,s\in\mathbb{N}$ the family of graphs with $n$ vertices, maximum degree $2$, and maximum component size $s$ has an induced universal graph with at most $\frac{11}{6}n+f(s)$ vertices? \subsection{$\frac{11}{6}n+\Oo(1)$ upper bound when all components are large} Since it appears difficult to improve the lower bound by considering only small components, the next natural thing might be to consider just large components. As the following upper bound shows, this is also unlikely to succeed. \begin{figure}[h] \begin{tikzpicture*}{\textwidth} \pgfmathtruncatemacro{\cols}{13}; \pgfmathtruncatemacro{\p}{1}; \begin{scope}[every node/.append style={ draw, circle, minimum size=2mm, inner sep=0pt, outer sep=0pt% }, vertex style/.style={ draw, circle, minimum size=3mm, inner sep=0pt, outer sep=0pt% }, selected vertex style/.style={ draw, circle, fill=blue!20, minimum size=3mm, inner sep=0pt, outer sep=0pt% }, selected edge style/.style={ rounded corners,line width=1.5mm,blue!20,cap=round% } ] \node[vertex style] (v01) at (0,2) {}; \foreach \i in {1,...,\cols}{% \node[vertex style] (v\i0) at (-1+2*\i,0) {}; \node[vertex style] (v\i1) at ( 0+2*\i,2) {}; \node[vertex style] (v\i2) at (-1+2*\i,4) {}; }; \foreach \i in {1,...,\cols}{% \pgfmathtruncatemacro{\previ}{\i-1}; \draw[thick,color=blue] (v\i0) -- (v\previ1) -- (v\i2); \ifthenelse{\i>1}{% \draw[thick,color=blue] (v\previ0) -- (v\i0); \draw[thick,color=blue] (v\previ2) -- (v\i2); }{% } \draw[thick,color=blue] (v\i0) -- (v\i1) -- (v\i2); \pgfmathtruncatemacro{\imod}{mod(\i,\p)}; \ifthenelse{\imod=0}{% \draw[dashed] ($(v\i0.south east)+(0.25,-1.25)$) -- ($(v\i2.north east)+(0.25,1.25)$); }{% } }; \end{scope} \end{tikzpicture*} \caption{The graph with this repeated pattern embeds in the first $\frac{3}{2}n-2$ vertices all graphs on $n$ vertices whose components are all even cycles.} \label{fig:32-even} \end{figure} \begin{figure}[h] \begin{tikzpicture*}{\textwidth} \pgfmathtruncatemacro{\cols}{13}; \pgfmathtruncatemacro{\p}{3}; \begin{scope}[every node/.append style={ draw, circle, minimum size=2mm, inner sep=0pt, outer sep=0pt% }, vertex style/.style={ draw, circle, minimum size=3mm, inner sep=0pt, outer sep=0pt% }, selected vertex style/.style={ draw, circle, fill=blue!20, minimum size=3mm, inner sep=0pt, outer sep=0pt% }, selected edge style/.style={ rounded corners,line width=1.5mm,blue!20,cap=round% } ] \node[vertex style] (v01) at (0,2) {}; \foreach \i in {1,...,\cols}{% \node[vertex style] (v\i0) at (-1+2*\i,0) {}; \node[vertex style] (v\i1) at ( 0+2*\i,2) {}; \node[vertex style] (v\i2) at (-1+2*\i,4) {}; \pgfmathtruncatemacro{\imod}{mod(\i,\p)}; \pgfmathtruncatemacro{\itop}{\i+1}; \ifthenelse{\imod=1 \AND \itop<\cols}{% \node[vertex style,color=red] (v\i3) at (2+2*\i,3.25) {}; }{% } }; \foreach \i in {1,...,\cols}{% \pgfmathtruncatemacro{\previ}{\i-1}; \draw[thick,color=blue] (v\i0) -- (v\previ1) -- (v\i2); \ifthenelse{\i>1}{% \draw[thick,color=blue] (v\previ0) -- (v\i0); \draw[thick,color=blue] (v\previ2) -- (v\i2); }{% } \draw[thick,color=blue] (v\i0) -- (v\i1) -- (v\i2); \pgfmathtruncatemacro{\imod}{mod(\i,\p)}; \pgfmathtruncatemacro{\itop}{\i+2}; \ifthenelse{\imod=1 \AND \itop<\cols}{% \draw[thick,color=red] (v\i2) -- (v\i3); \draw[thick,color=red] (v\i3) -- (v\itop1); \pgfmathtruncatemacro{\inext}{\i+3}; \draw[thick,color=red] (v\i3) -- (v\inext2); \draw[thick,color=red] (v\i3) -- (v\i1); }{% } \ifthenelse{\imod=0}{% \draw[dashed] ($(v\i0.south east)+(0.25,-1.25)$) -- ($(v\i2.north east)+(0.25,1.25)$); }{% } }; \end{scope} \end{tikzpicture*} \caption{The graph with this repeated pattern embeds in the first $\frac{11}{6}n+\mathcal{O}(1)$ vertices all graphs on $n$ vertices whose maximum degree is $2$ and whose smallest component has size at least $10$.} \label{fig:116-large} \end{figure} \begin{theorem} For any $n\in\mathbb{N}$ there exists a graph with at most $\frac{11}{6}n+\mathcal{O}(1)$ vertices, that contain as induced subgraphs all graphs on $n$ vertices whose maximum degree is $2$ and whose smallest component has at least $10$ vertices. \end{theorem} \begin{proof} Consider the graph family $A$ implied by the pattern in Figure~\ref{fig:32-even}. Observe that the leftmost $\frac{3}{2}n-2$ vertices of this pattern embeds all graphs on $n$ vertices whose components are all even cycles. In particular, each (even) cycle of length $s\geq10$ will be embedded in such a way that it uses exactly $\frac{s-4}{2}\geq3$ consecutive edges from the top or bottom rows. Now consider the modified graph family $B$ in Figure~\ref{fig:116-large}. Every third edge along the top row is associated with one of the added red vertices. Now consider an odd cycle $C$ of length $s>10$. By splitting one vertex in the cycle, we can extend it to an even cycle $C'$ of length $\geq12$. When we embed this $C'$, it will contain an edge associated with one of the red vertices. We can therefore arrange that the split vertices are the endpoints of such an edge, and we can obtain an embedding of $C$ by replacing them with the associated red vertex. Similarly, since the minimum component size is assumed to be $10$, we can turn any number of paths of total length $s$ into a cycle of even length by adding at most $\frac{1}{10}n+\mathcal{O}(1)$ vertices. Thus any graph $G$ with $n$ vertices, maximum degree $2$ and minimum component size $10$ can be converted into a graph $G'$ with at most $n'=\frac{11}{10}n+\mathcal{O}(1)$ vertices whose components are all even cycles. The graph $G'$ can then be embedded in a graph from family $A$ with $\frac{3}{2}n'+\mathcal{O}(1)$ vertices. This graph can then be converted to a graph in family $B$ with at most $\frac{10}{9}(\frac{3}{2}n'+\mathcal{O}(1))=\frac{11}{6}n+\mathcal{O}(1)$ vertices, and the embedding of $G'$ in $A$ can be converted to an embedding of $G$ in $B$ as previsously described. \end{proof} \section{Paths}\label{sec:paths} \pgfdeclarelayer{background} \pgfdeclarelayer{foreground} \pgfsetlayers{background,main,foreground} We show that there exists an induced universal graph with $\lfloor 3n/2 \rfloor$ vertices and at most $\lfloor 3n/2 \rfloor - 1$ edges for the family $\mathcal{AC}$ of graphs consisting of a set of paths with a total of $n$ vertices. Our new induced universal graph matches the following lower bound. \begin{theorem}[Claim 1, \cite{Esperet2008}]\label{thm:pathlower} Every induced universal graph that embeds any acyclic graph $G$ on $n$ vertices with $\Delta(G)\leq 2$ has at least $\lfloor 3n/2 \rfloor$ vertices. \end{theorem} \begin{proof} The theorem can be extracted from the proof of Claim $1$ in \cite{Esperet2008}. Consider the two graphs $G'$ and $G''$, with $G'$ consisting of $n$ $P_1$ and $G''$ consising of $\floor{n/2}$ $P_2$ plus at most one $P_1$. An induced universal subgraph must contain $n$ disjoint $P_1$ to embed $G'$, and $\floor{n/2}$ disjoint $P_2$ to embed $G''$. Each $P_2$ in the embedding of $G''$ can overlap with at most one $P_1$ from the embedding of $G'$ in the induced universal graph, hence we need at least $n + \lfloor n/2 \rfloor = \lfloor 3n/2 \rfloor$ vertices in the induced universal graph. \end{proof} Our induced universal graph $U^p_n$ that matches \Cref{thm:pathlower} is defined as below. \begin{definition}\label{def:upn} Let \begin{align*} s(x)&:= \begin{cases} x+2&\text{ if }x\equiv2\pmod{3} \\ x+1&\text{ otherwise} \end{cases} \end{align*} For any $n \in {\mathbb{N}}$ let $U^p_n$ be the graph over vertex set $\left[ \lfloor 3n/2 \rfloor \right]$, and for all $u < v \in [\lfloor 3n/2 \rfloor]$ let there be an edge $(u,v)$ iff $v = s(u)$ (See \Cref{fig:Up_n}). \end{definition} \begin{figure}[h] \centering \begin{tikzpicture}[scale=0.5] \pgfmathtruncatemacro{\n}{6}; \pgfmathtruncatemacro{\vmax}{2*\n}; \pgfdeclarelayer{background} \pgfdeclarelayer{foreground} \pgfsetlayers{background,main,foreground} \begin{scope}[ vertex style/.style={ draw, circle, minimum size=3mm, inner sep=0pt, outer sep=0pt% }, selected vertex style/.style={ draw, circle, fill=blue!20, minimum size=3mm, inner sep=0pt, outer sep=0pt% }, selected edge style/.style={ rounded corners,line width=1.5mm,blue!20,cap=round% } ] \node[vertex style] (v0) at (0,-1) {\tiny $0$}; \node[vertex style] (v1) at (0,0) {\tiny $1$}; \node[vertex style] (v2) at (1,0) {\tiny $2$}; \node[vertex style] (v3) at (2,-1) {\tiny $3$}; \node[vertex style] (v4) at (2,0) {\tiny $4$}; \node[vertex style] (v5) at (3,0) {\tiny $5$}; \node[vertex style] (v6) at (4,-1) {\tiny $6$}; \node[vertex style] (v7) at (4,0) {\tiny $7$}; \node[vertex style] (v8) at (5,0) {\tiny $8$}; \node[vertex style] (v9) at (6,-1) {\tiny $9$}; \node[vertex style] (v10) at (6,0) {\tiny $10$}; \node[vertex style] (v11) at (7,0) {\tiny $11$}; \node[vertex style] (v12) at (8,-1) {\tiny $12$}; \node[vertex style] (v13) at (8,0) {\tiny $13$}; \node[vertex style] (v14) at (9,0) {\tiny $14$}; \node[vertex style] (v15) at (10,-1) {\tiny $15$}; \draw[thick,color=blue] (v0) -- (v1); \draw[thick,color=blue] (v3) -- (v4); \draw[thick,color=blue] (v6) -- (v7); \draw[thick,color=blue] (v9) -- (v10); \draw[thick,color=blue] (v12) -- (v13); \draw[thick,color=blue] (v1) -- (v2); \draw[thick,color=red] (v2) -- (v4); \draw[thick,color=blue] (v4) -- (v5); \draw[thick,color=red] (v5) -- (v7); \draw[thick,color=blue] (v7) -- (v8); \draw[thick,color=red] (v8) -- (v10); \draw[thick,color=blue] (v10) -- (v11); \draw[thick,color=red] (v11) -- (v13); \draw[thick,color=blue] (v13) -- (v14); \end{scope} \end{tikzpicture} \caption{$U^p_{11}$, with each $(u,v)$ colored \textcolor{blue}{blue} if $v=u+1$ and \textcolor{red}{red} if $v=u+2$, i.e., the edges come from cases $1$ and $2$ of \Cref{def:upn}, respectively.} \label[figure]{fig:Up_n} \end{figure} When $n$ is even $U^p_n $ is a simple caterpillar graph, where every second vertex of the main path has an extra vertex connected to it. When $n$ is odd $U^p_n$ is a caterpillar and a single isolated vertex (see \Cref{fig:Up_n}). In the following, we show that $U^p_n$ embeds the family of acyclic graphs over $n$ vertices with maximum degree $2$, and that the corresponding decoder is size oblivious. We proceed by showing that a few particular paths can be embedded in the graph, and finally that any graph in $\mathcal{AC}$ can be embedded using the same embedding techniques. \begin{definition}\label{def:bb} Let $G$ and $U$ be graphs and let $\lambda$ be an embedding function of $G$ into $U$. We say that a vertex $v \in V[U]$ is \emph{used} if there exists $v' \in V[G]$ such that $\lambda(v') = v$. A node $w\in V[U]$ is \emph{allocated} if $w$ is used or adjacent to a used vertex. A subset $X \subseteq V[U]$ is \emph{allocated} when every vertex $x \in X$ is allocated. \end{definition} This definition allows us to argue that, given a specific graph $G\in\mathcal{AC}$ with $n$ vertices, we can allocate a part of our induced universal graph $U^p_{n}$ for embedding a part of $G$, and then the remaining unallocated part of $U^p_{n}$ is available for embedding for the remaining part of $G$. We divide $G$ into several parts and show that each part can be embedded in $U^p_{n}$. For each part we embed, the number of allocated vertices divded by the number of used vertices is at most $\lfloor 3n/2 \rfloor$. \Cref{thm:paths} implies that these embedding strategies can be combined, i.e., applied consecutively one after the other, implying that all of $G$ can be embedded in $U^p_{n}$. Our argument relies heavily on allocation of blocks as defined below. \begin{definition}\label{def:block} Let \emph{block} $B_j$ of $U^p_n$, where $j\in[\floor{\frac{n}{2}}]$, be the vertices $\{3j, 3j+1, 3j+2 \}$. \end{definition} In \Cref{lem:combined}, we show how to embed single paths of any length and simple families of paths in $U^p_{n}$ efficiently. \Cref{fig:p2k1,fig:p3p1} shows how the cases are handled. \begin{figure}[h] \centering \begin{tikzpicture}[scale=0.5] \pgfmathtruncatemacro{\n}{6}; \pgfmathtruncatemacro{\vmax}{2*\n}; \pgfdeclarelayer{background} \pgfdeclarelayer{foreground} \pgfsetlayers{background,main,foreground} \begin{scope}[ vertex style/.style={ draw, circle, minimum size=3mm, inner sep=0pt, outer sep=0pt% }, selected vertex style/.style={ draw, circle, fill=blue!20, minimum size=3mm, inner sep=0pt, outer sep=0pt% }, selected edge style/.style={ rounded corners,line width=1.5mm,blue!20,cap=round% } ] \node[selected vertex style] (v0) at (0,-1) {\tiny $0$}; \node[selected vertex style] (v1) at (0,0) {\tiny $1$}; \node[selected vertex style] (v2) at (1,0) {\tiny $2$}; \node[vertex style] (v3) at (2,-1) {\tiny $3$}; \node[selected vertex style] (v4) at (2,0) {\tiny $4$}; \node[selected vertex style] (v5) at (3,0) {\tiny $5$}; \node[vertex style] (v6) at (4,-1) {\tiny $6$}; \node[selected vertex style] (v7) at (4,0) {\tiny $7$}; \node[selected vertex style] (v8) at (5,0) {\tiny $8$}; \node[vertex style] (v9) at (6,-1) {\tiny $9$}; \node[selected vertex style] (v10) at (6,0) {\tiny $10$}; \node[vertex style] (v11) at (7,0) {\tiny $11$}; \node[vertex style] (v12) at (8,-1) {\tiny $12$}; \node[vertex style] (v13) at (8,0) {\tiny $13$}; \node[vertex style] (v14) at (9,0) {\tiny $14$}; \draw[thick,color=blue] (v0) -- (v1); \draw[thick,color=blue] (v3) -- (v4); \draw[thick,color=blue] (v6) -- (v7); \draw[thick,color=blue] (v9) -- (v10); \draw[thick,color=blue] (v12) -- (v13); \draw[thick,color=blue] (v1) -- (v2); \draw[thick,color=red] (v2) -- (v4); \draw[thick,color=blue] (v4) -- (v5); \draw[thick,color=red] (v5) -- (v7); \draw[thick,color=blue] (v7) -- (v8); \draw[thick,color=red] (v8) -- (v10); \draw[thick,color=blue] (v10) -- (v11); \draw[thick,color=red] (v11) -- (v13); \draw[thick,color=blue] (v13) -- (v14); \begin{pgfonlayer}{background} \draw[selected edge style] (v0.center) -- (v1.center) -- (v2.center) -- (v4.center) -- (v5.center) -- (v7.center) -- (v8.center) -- (v10.center); \draw[very thick,dotted,red] ($(v0.south west)+(-0.15,-0.15)$) rectangle ($(v2.north east)+(0.15,0.15)$); \draw[very thick,dotted,red] ($(v3.south west)+(-0.15,-0.15)$) rectangle ($(v5.north east)+(0.15,0.15)$); \draw[very thick,dotted,red] ($(v6.south west)+(-0.15,-0.15)$) rectangle ($(v8.north east)+(0.15,0.15)$); \draw[very thick,dotted,red] ($(v9.south west)+(-0.15,-0.15)$) rectangle ($(v11.north east)+(0.15,0.15)$); \end{pgfonlayer} \end{scope} \end{tikzpicture} ~~~~ \begin{tikzpicture}[scale=0.5] \pgfmathtruncatemacro{\n}{6}; \pgfmathtruncatemacro{\vmax}{2*\n}; \pgfdeclarelayer{background} \pgfdeclarelayer{foreground} \pgfsetlayers{background,main,foreground} \begin{scope}[ vertex style/.style={ draw, circle, minimum size=3mm, inner sep=0pt, outer sep=0pt% }, selected vertex style/.style={ draw, circle, fill=blue!20, minimum size=3mm, inner sep=0pt, outer sep=0pt% }, selected edge style/.style={ rounded corners,line width=1.5mm,blue!20,cap=round% } ] \node[selected vertex style] (v0) at (0,-1) {\tiny $0$}; \node[selected vertex style] (v1) at (0,0) {\tiny $1$}; \node[selected vertex style] (v2) at (1,0) {\tiny $2$}; \node[vertex style] (v3) at (2,-1) {\tiny $3$}; \node[selected vertex style] (v4) at (2,0) {\tiny $4$}; \node[selected vertex style] (v5) at (3,0) {\tiny $5$}; \node[vertex style] (v6) at (4,-1) {\tiny $6$}; \node[selected vertex style] (v7) at (4,0) {\tiny $7$}; \node[selected vertex style] (v8) at (5,0) {\tiny $8$}; \node[selected vertex style] (v9) at (6,-1) {\tiny $9$}; \node[selected vertex style] (v10) at (6,0) {\tiny $10$}; \node[vertex style] (v11) at (7,0) {\tiny $11$}; \node[vertex style] (v12) at (8,-1) {\tiny $12$}; \node[vertex style] (v13) at (8,0) {\tiny $13$}; \node[vertex style] (v14) at (9,0) {\tiny $14$}; \draw[thick,color=blue] (v0) -- (v1); \draw[thick,color=blue] (v3) -- (v4); \draw[thick,color=blue] (v6) -- (v7); \draw[thick,color=blue] (v9) -- (v10); \draw[thick,color=blue] (v12) -- (v13); \draw[thick,color=blue] (v1) -- (v2); \draw[thick,color=red] (v2) -- (v4); \draw[thick,color=blue] (v4) -- (v5); \draw[thick,color=red] (v5) -- (v7); \draw[thick,color=blue] (v7) -- (v8); \draw[thick,color=red] (v8) -- (v10); \draw[thick,color=blue] (v10) -- (v11); \draw[thick,color=red] (v11) -- (v13); \draw[thick,color=blue] (v13) -- (v14); \begin{pgfonlayer}{background} \draw[selected edge style] (v0.center) -- (v1.center) -- (v2.center) -- (v4.center) -- (v5.center) -- (v7.center) -- (v8.center) -- (v10.center) -- (v9.center); \draw[very thick,dotted,red] ($(v0.south west)+(-0.15,-0.15)$) rectangle ($(v2.north east)+(0.15,0.15)$); \draw[very thick,dotted,red] ($(v3.south west)+(-0.15,-0.15)$) rectangle ($(v5.north east)+(0.15,0.15)$); \draw[very thick,dotted,red] ($(v6.south west)+(-0.15,-0.15)$) rectangle ($(v8.north east)+(0.15,0.15)$); \draw[very thick,dotted,red] ($(v9.south west)+(-0.15,-0.15)$) rectangle ($(v11.north east)+(0.15,0.15)$); \end{pgfonlayer} \end{scope} \end{tikzpicture} \caption{(left) $U^p_{10}$, with a $P_{8}$ embedded, and (right) $U^p_{10}$, with a $P_{9}$ embedded. The embedded paths are shown embedded in \textcolor{blue!40}{blue}, and the allocated blocks in \textcolor{red}{red}. Both cases use at most $\lfloor 3n/2 \rfloor $ vertices.}\label[figure]{fig:p2k1} \end{figure} \begin{figure}[h] \centering \begin{tikzpicture}[scale=0.5] \pgfmathtruncatemacro{\n}{6}; \pgfmathtruncatemacro{\vmax}{2*\n}; \pgfdeclarelayer{background} \pgfdeclarelayer{foreground} \pgfsetlayers{background,main,foreground} \begin{scope}[ vertex style/.style={ draw, circle, minimum size=3mm, inner sep=0pt, outer sep=0pt% }, selected vertex style/.style={ draw, circle, fill=blue!20, minimum size=3mm, inner sep=0pt, outer sep=0pt% }, selected edge style/.style={ rounded corners,line width=1.5mm,blue!20,cap=round% } ] \node[selected vertex style] (v0) at (0,-1) {\tiny $0$}; \node[selected vertex style] (v1) at (0,0) {\tiny $1$}; \node[selected vertex style] (v2) at (1,0) {\tiny $2$}; \node[vertex style] (v3) at (2,-1) {\tiny $3$}; \node[vertex style] (v4) at (2,0) {\tiny $4$}; \node[selected vertex style] (v5) at (3,0) {\tiny $5$}; \node[selected vertex style] (v6) at (4,-1) {\tiny $6$}; \node[selected vertex style] (v7) at (4,0) {\tiny $7$}; \node[vertex style] (v8) at (5,0) {\tiny $8$}; \node[vertex style] (v9) at (6,-1) {\tiny $9$}; \node[vertex style] (v10) at (6,0) {\tiny $10$}; \node[vertex style] (v11) at (7,0) {\tiny $11$}; \node[vertex style] (v12) at (8,-1) {\tiny $12$}; \node[vertex style] (v13) at (8,0) {\tiny $13$}; \node[vertex style] (v14) at (9,0) {\tiny $14$}; \draw[thick,color=blue] (v0) -- (v1); \draw[thick,color=blue] (v3) -- (v4); \draw[thick,color=blue] (v6) -- (v7); \draw[thick,color=blue] (v9) -- (v10); \draw[thick,color=blue] (v12) -- (v13); \draw[thick,color=blue] (v1) -- (v2); \draw[thick,color=red] (v2) -- (v4); \draw[thick,color=blue] (v4) -- (v5); \draw[thick,color=red] (v5) -- (v7); \draw[thick,color=blue] (v7) -- (v8); \draw[thick,color=red] (v8) -- (v10); \draw[thick,color=blue] (v10) -- (v11); \draw[thick,color=red] (v11) -- (v13); \draw[thick,color=blue] (v13) -- (v14); \begin{pgfonlayer}{background} \draw[selected edge style] (v0.center) -- (v1.center) -- (v2.center); \draw[selected edge style] (v5.center) -- (v7.center) -- (v6.center); \draw[very thick,dotted,red] ($(v0.south west)+(-0.15,-0.15)$) rectangle ($(v2.north east)+(0.15,0.15)$); \draw[very thick,dotted,red] ($(v3.south west)+(-0.15,-0.15)$) rectangle ($(v5.north east)+(0.15,0.15)$); \draw[very thick,dotted,red] ($(v6.south west)+(-0.15,-0.15)$) rectangle ($(v8.north east)+(0.15,0.15)$); \end{pgfonlayer} \end{scope} \end{tikzpicture} ~~~~ \begin{tikzpicture}[scale=0.5] \pgfmathtruncatemacro{\n}{6}; \pgfmathtruncatemacro{\vmax}{2*\n}; \pgfdeclarelayer{background} \pgfdeclarelayer{foreground} \pgfsetlayers{background,main,foreground} \begin{scope}[ vertex style/.style={ draw, circle, minimum size=3mm, inner sep=0pt, outer sep=0pt% }, selected vertex style/.style={ draw, circle, fill=blue!20, minimum size=3mm, inner sep=0pt, outer sep=0pt% }, selected edge style/.style={ rounded corners,line width=1.5mm,blue!20,cap=round% } ] \node[selected vertex style] (v0) at (0,-1) {\tiny $0$}; \node[selected vertex style] (v1) at (0,0) {\tiny $1$}; \node[selected vertex style] (v2) at (1,0) {\tiny $2$}; \node[selected vertex style] (v3) at (2,-1) {\tiny $3$}; \node[vertex style] (v4) at (2,0) {\tiny $4$}; \node[selected vertex style] (v5) at (3,0) {\tiny $5$}; \node[selected vertex style] (v6) at (4,-1) {\tiny $6$}; \node[vertex style] (v7) at (4,0) {\tiny $7$}; \node[selected vertex style] (v8) at (5,0) {\tiny $8$}; \node[selected vertex style] (v9) at (6,-1) {\tiny $9$}; \node[vertex style] (v10) at (6,0) {\tiny $10$}; \node[selected vertex style] (v11) at (7,0) {\tiny $11$}; \node[selected vertex style] (v12) at (8,-1) {\tiny $12$}; \node[vertex style] (v13) at (8,0) {\tiny $13$}; \node[vertex style] (v14) at (9,0) {\tiny $14$}; \draw[thick,color=blue] (v0) -- (v1); \draw[thick,color=blue] (v3) -- (v4); \draw[thick,color=blue] (v6) -- (v7); \draw[thick,color=blue] (v9) -- (v10); \draw[thick,color=blue] (v12) -- (v13); \draw[thick,color=blue] (v1) -- (v2); \draw[thick,color=red] (v2) -- (v4); \draw[thick,color=blue] (v4) -- (v5); \draw[thick,color=red] (v5) -- (v7); \draw[thick,color=blue] (v7) -- (v8); \draw[thick,color=red] (v8) -- (v10); \draw[thick,color=blue] (v10) -- (v11); \draw[thick,color=red] (v11) -- (v13); \draw[thick,color=blue] (v13) -- (v14); \begin{pgfonlayer}{background} \draw[selected edge style] (v0.center) -- (v1.center) -- (v2.center); \draw[selected edge style] (v5.center) -- (v5.center) ; \draw[selected edge style] (v6.center) -- (v6.center) ; \draw[selected edge style] (v8.center) -- (v8.center) ; \draw[selected edge style] (v9.center) -- (v9.center) ; \draw[selected edge style] (v11.center) -- (v11.center) ; \draw[selected edge style] (v12.center) -- (v12.center) ; \draw[very thick,dotted,red] ($(v0.south west)+(-0.15,-0.15)$) -- ($(v1.north west)+(-0.15,0.15)$) -- ($(v2.north east)+(0.15,0.15)$) -- ($(v2.south east)+(0.15,-0.15)$) -- ($(v1.south east)+(0.15,-0.15)$) -- ($(v0.south east)+(0.15,-0.15)$) -- ($(v0.south west)+(-0.15,-0.15)$) ; \draw[very thick,dotted,green] ($(v3.south west)+(-0.15,-0.15)$) rectangle ($(v3.north east)+(0.15,0.15)$); \draw[very thick,dotted,black] ($(v5.south west)+(-0.15,-1.15)$) rectangle ($(v13.north east)+(0.15,0.15)$); \end{pgfonlayer} \end{scope} \end{tikzpicture} \caption{(left) $U^p_{10}$ with two $P_{3}$ embedded, and (right) $U^p_{10}$ with one $P_3$ and a number of $P_1$ embedded. Embedded paths are shown in \textcolor{blue!40}{blue}, and allocated blocks in \textcolor{red}{red}. The extra allocation to handle one $P_3$ and one $P_1$ is shown in dotted \textcolor{green}{green}. The trivial extension of $6$ additional $P_1$ is shown in dotted black. All cases use at most $\lfloor 3n/2 \rfloor $ vertices.} \label[figure]{fig:p3p1} \end{figure} \begin{lemma}\label{lem:combined} Let $k > 0$ unless otherwise specified. For the induced universal graph $U^p_{n}$ it holds that \begin{enumerate}[label=(\alph*)] \item $U^p_{2k}$ embeds $P_{2k}$. \label{case:p2k} \item $U^p_{2k}$ embeds $P_{2k+1}$ when $k > 1$. \label{case:p2k1} \item $U^p_{k}$ embeds $k$ $P_1$. \label{case:p1} \item $U^p_{6}$ embeds two $P_3$. \label{case:2p3} \item $U^p_{3+l}$ embeds one $P_3$ and $l \geq 0$ $P_1$. \label{case:p3p1} \end{enumerate} \end{lemma} \begin{proof} We show that the cases in \Cref{lem:combined} can be embedded in our induced universal graph. The general strategy is to allocate blocks as in \Cref{def:block} and embed the input in these blocks, where at least two out of the three vertices in a block are used, yielding the desired ratio between allocated and used vertices. Consider first case \ref{case:p2k}, where we are to embed an even path. See \Cref{fig:p2k1}. We allocate $k$ block $B_0, \ldots, B_{k-1}$ and embed the path by using three vertices in $B_0$, one vertex in $B_{k-1}$, and two vertices in $B_1, \ldots, B_{k-2}$. Say $n=2k$, then the size of the induced universal graph is thus $\lfloor 3n/2 \rfloor $. In the second case \ref{case:p2k1} we are to embed an odd path. See \Cref{fig:p2k1}. We use the same strategy as above, the difference being that two vertices are used in $B_{k-1}$, namely the two with the smallest label. As we embed one more vertex in the same number of blocks we are still within $\lfloor 3n/2 \rfloor $. For \ref{case:p1} we can embed a number $k$ of $P_1$ by allocating $\lfloor k/2 \rfloor$ blocks and embedding two $P_1$ per block. If $k$ is odd we embed the last $P_1$ by allocating the isolated vertex labelled $\floor{3k/2}-1$. When the input is \ref{case:2p3} we embed the two $P_3$ by allocating three blocks as seen in \Cref{fig:p3p1}. As we allocate $9$ vertices and use $6$, this strategy is within the $\lfloor 3n/2 \rfloor $ bound. In the final case \ref{case:p3p1} we allocate the first block $B_0$ and embed the $P_3$ in the block. Next we apply case \ref{case:p1} on the remaining $P_1$. See \Cref{fig:p3p1}. In total we then use $3 + \lfloor 3l/2 \rfloor$ vertices. \end{proof} We are now ready to state the main theorem of this section. \Cref{case:main} follows from consecutive applications of \Cref{lem:combined} and a careful order in which we embed the vertices of some given graph $G\in\mathcal{AC}$ with $n$ vertices in $U^p_n$. In particular, it is crucial that the $P_3$'s and $P_1$'s in $G$ are embedded second to last and last, respectively, since after embedding one of these two parts of $G$, the next unallocated vertex is not necessarily the first vertex of a new block. \begin{theorem}\label{thm:generalupperbound}\label{thm:paths} The graph family $U^p_0, U^p_1, \ldots$ has the property that for $n \in {\mathbb{N}}_1$ \begin{enumerate}[label=(\alph*)] \item $U^p_n$ has $\lfloor 3n/2 \rfloor$ vertices and $\max\set{0, 3\floor{\frac{n}{2}}-1}$ edges.\label{case:size} \item $U^p_n$ is an induced subgraph of $U^p_{n+1}$.\label{case:induced} \item $U^p_n$ is an induced universal graph for the family of acyclic graphs $G$ with $\Delta(G)\leq2$ and $n$ vertices.\label{case:main} \end{enumerate} \end{theorem} \begin{proof} Cases \ref{case:size} and \ref{case:induced} follow immediately from \Cref{def:upn}. Say the input graph $G$ consists of set $S_{\mathrm{even}}$ of $P_{2k}$ for $k \geq 1$, set $S_{\mathrm{odd}}$ of $P_{2k+1}$ for $k \geq 2$, set $S_{3}$ of $P_3$, and set $S_{1}$ of $P_1$. Let the cardinality of each set be the number of paths in the set and let the total number of vertices in each set be denoted $l_{\mathrm{even}}$, $l_{\mathrm{odd}}$, $l_{3}$, and $l_1$ respectively. Observe that every acyclic graph with $\Delta(G)\leq2$ has such a partition. The proof direction is to embed the different parts of the input in the right order, such that our embedding strategy from \Cref{lem:combined} can be applied. We start by embedding $S_{\mathrm{even}}$ by allocating the at most $3l_{\mathrm{even}}/2$ first vertices of $U^p_{n}$ by $|S_{\mathrm{even}}|$ invocations of \Cref{lem:combined} case \ref{case:p2k}. It follows that the next unallocated vertex is the first vertex of a new block, i.e., after embedding the even length paths we have spent at most $l_{\mathrm{even}}/2$ of blocks of size $3$. We allocate the next $\lfloor 3l_{\mathrm{odd}}/2 \rfloor$ vertices of $U^p_{n}$ by performing $|S_{\mathrm{odd}}|$ invocations of \Cref{lem:combined} case \ref{case:p2k1}. Again, the next unallocated vertex is the first vertex of a new block. The next step is embedding $S_3$ and $S_1$. If $|S_3|$ is even then proceed by invoking \Cref{lem:combined} case \ref{case:2p3} $|S_3|/2$ times to embed all pairs of $P_3$. This allocation uses $3 l_3 /2$ vertices from $U^p_{n}$. We can then embed $S_1$ trivially as in \Cref{lem:combined} case \ref{case:p1}, allocating additionally $\lfloor 3 l_1 / 2 \rfloor$ vertices of $U^p_{n}$. If $|S_3|$ is odd then allocate all the pairs using $|S_3|-1$ invocations of \Cref{lem:combined} case \ref{case:2p3}, which uses $3(l_3 - 3)/2$ vertices of $U^p_{n}$. We proceed by invoking \Cref{lem:combined} case \ref{case:p3p1} to embed the remaining $P_3$ along with $S_1$. In total we need to allocate at most $\lfloor 3(l_{\mathrm{even}} + l_{\mathrm{odd}} + l_3 + l_1 )/2 \rfloor = \lfloor 3n/2 \rfloor$ vertices, and hence $U^p_{n}$ induces any acyclic graph $G$ on $n$ vertices where $\Delta(G)\leq2$. \end{proof} \subsection{Preliminaries}\label{sec:prelim} Let $[n]=\{0, \ldots, n-1\}$, ${\mathbb{N}}_0 = \set{0,1,2,\ldots}$, ${\mathbb{N}}={\mathbb{N}}_1=\set{1,2,\ldots}$, and let $\log n$ refer to $\log_2 n$. For a graph $G$, let $V[G]$ be the set of vertices and $E[G]$ be the set of edges of $G$, and let $\abs{G}=\abs{V[G]}$ be the number of vertices. We denote the maximum degree of graph $G$ as $\Delta(G)$. For $i \in {\mathbb{N}}$, let $P_{i}$ denote a path with $i$ vertices, and for $i>2$, let $C_i$ denote a simple cycle with $i$ vertices. Let $G$ and $U$ be two graphs and let $\lambda\colon V[G] \to V[U]$ be an injective function. If $\lambda$ has the property that $uv\in E[G]$ if and only if $\lambda(u)\lambda(v)\in E[U]$, we say that $\lambda$ is an \emph{embedding function} of $G$ into $U$. $G$ is an \emph{induced subgraph} of $U$ if there exists an embedding function of $G$ into $U$, and in that case, we say that $G$ is \emph{embedded} in $U$ and that $U$ \emph{embeds} $G$. Let $\mathcal F$ be a family of graphs. $U$ is an \emph{induced universal graph} of $\mathcal F$ if $G$ is an induced subgraph of $U$ for each $G\in\mathcal F$. \newcommand{\mathcal{F}}{\mathcal{F}} Let $\mathcal{F}$ be a family of graphs and for each positive integer $n$, let $\mathcal{F}_n$ be the graphs in $\mathcal{F}$ on $n$ vertices. For $f : {\mathbb{N}}_0 \to {\mathbb{N}}_0$ we say that $\mathcal{F}$ can be labeled using $f(n)$ labels with a \emph{size aware decoder} if there exists a decoder $d_n : {\mathbb{N}}_0 \times {\mathbb{N}}_0 \to \{0,1\}$ for $n\in{\mathbb{N}}$, that satisfies the following: For every graph $G \in \mathcal{F}_n$ there is an encoding function $e : G \to [f(n)]$ such that $u,v \in G$ are adjacent iff $d_n(e(u),e(v)) = 1$. We say that $\mathcal{F}$ can be labeled using $f(n)$ labels with a \emph{size oblivious decoder} if there exists $d : {\mathbb{N}}_0 \times {\mathbb{N}}_0 \to \{0,1\}$ with the following property: For every $n\in{\mathbb{N}}$ and every $G\in\mathcal{F}_n$, there is an encoding function $e : G \to [f(n)]$ such that $u,v \in G$ are adjacent iff $d(e(u),e(v)) = 1$. The following theorem explains the relation between size aware and size oblivious decoders and induced universal graphs. \begin{proposition}\label[proposition]{pro:aware} Given a family of graphs $\mathcal{F}$ and a function $f : {\mathbb{N}} \to {\mathbb{N}}$ the following holds. 1) $\mathcal{F}$ can be labeled using $f(n)$ labels with a size aware decoder iff there exists a family of graphs $G_1, G_2, \ldots$ such that $G_n$ is an induced universal graph for $\mathcal{F}_n$ and $\abs{G_n} = f(n)$ for every $n$. 2) $\mathcal{F}$ can be labeled using $f(n)$ labels with a size oblivious decoder iff there exists a family of graphs $G_1, G_2, \ldots$ such that $G_n$ is an induced universal graph for $\mathcal{F}_n$, $\abs{G_n} = f(n)$, and $G_n$ is an induced subgraph of $G_{n+1}$ for every $n$. \end{proposition} \begin{proof} 1) First assume that $\mathcal{F}$ can be labeled using $f(n)$ labels with a size aware decoder. Let $d_n : {\mathbb{N}}_0 \times {\mathbb{N}}_0 \to \{0,1\}$ be the corresponding family of decoders. Let $G_n$ be defined on the vertex set $[f(n)]$ such that $i \neq j$ are adjacent iff $d_n(i,j) = 1$. Obviously, $G_n$ contains exactly $f(n)$ nodes. Furthermore $G_n$ is an induced universal graph of $\mathcal{F}_n$. This shows the first direction. For the other direction let such a family $G_1, G_2, \ldots$ be given. Wlog assume that the vertex set of $G_n$ is $[f(n)]$. We let $d_n : {\mathbb{N}}_0 \times {\mathbb{N}}_0 \to \{0,1\}$ be defined by $d_n(u,v) = 1$ iff $u,v < f(n)$ and $u,v$ are adjacent in $G_n$. For $G \in \mathcal{F}_n$ let $\lambda : G \to G_n$ be an embedding function of $G$ in $G_n$. For a node $u \in V[G]$ we assign it the label $\lambda(u)$. Then for nodes $u,v \in V[G]$ we have $d_n(\lambda(u),\lambda(v)) = 1$ iff $\lambda(u)$ and $\lambda(v)$ are adjacent. This happens iff $u$ and $v$ are adjacent as desired. 2) The first direction is as in the first part of the theorem. We just need to note that $\lambda : [f(n)] \to [f(n+1)]$ is an embedding function of $G_n$ in $G_{n+1}$. Now consider the other direction and let such a family $G_1, G_2, \ldots$ be given and wlog assume that the vertex set of $G_n$ is $[f(n)]$. Furthermore wlog assume that $\lambda_n : G_n \to G_{n+1}$ given by $k \to k$ is an embedding function of $G_n$ in $G_{n+1}$. Let $d : {\mathbb{N}}_0 \times {\mathbb{N}}_0 \to \{0,1\}$ be defined in the following way. For $u,v \in {\mathbb{N}}_0$ let $d(u,v) = 1$ iff there exists $n$ such that $f(n) > u,v$ and $u$ and $v$ are adjacent in $G_n$. We note that if one such $n$ exists it must hold for all $n$ with $f(n) > u,v$ that $u$ and $v$ are adjacent in $G_n$. Hence we can assign labels in the same way as the first part of the theorem. \end{proof}
{'timestamp': '2016-07-25T02:01:18', 'yymm': '1607', 'arxiv_id': '1607.04911', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04911'}
arxiv
\section{Introduction} \label{sxn:intro} Graphs, long popular in computer science and discrete mathematics, have received renewed interest recently in statistics, machine learning, data analysis, and related areas because they provide a useful way to model many types of relational data. In this way, graphs can be used to extract insight from data arising in many application domains. In biology, e.g., graphs are routinely used to generate hypotheses for experimental validation~\cite{Tuncbag-2016-glioblastoma}; and in neurscience, they are used to study the networks and circuits in the brain~\cite{Bassett-2006-small-world,Sporns-2002-network-analysis}. Given their ubiquity, graphs and graph-based data have been approached from several different perspectives. In computer science, it is common to develop algorithms, e.g., for connected component, minimum spanning tree, and maximum flow problems, to run on data that are modeled as a precisely-specified input graph. These algorithms are then characterized by the number of operations they use for the worst-possible input at any size. In statistics and machine learning, on the other hand, it is common to use graphs as models to perform inference about unseen data. In this case, one often hypothesizes an unseen graph with a particular structure, such as block structure, hierarchical structure, low-rank structure in the adjacency matrix, etc. Then one runs algorithms on the observed data in order to impute entries in the unobserved hypothesized graph. These methods may be characterized in terms of running time, but they are also characterized in terms of the amount of data needed to recover the hidden hypothesized structure. In many application areas where the end goal is to obtain some sort of domain-specific insight, e.g., such as in social network analysis, neuroscience, medical imaging, etc., one constructs graphs from primary data, and then one runs a computational procedure that does \emph{not} come with either of these traditional types of theoretical guarantees. As an example, consider the GeneRank method~\cite{morrison2005-generank}, where we have a set of genes related to an experimental condition in a microarray study. This set of genes is ``refined'' via a locally-biased graph algorithm closely related to those we will discuss. Importantly, this operational refinement procedure does \emph{not} come with the sort of theory traditional in statistics, machine learning, or computer science. As anther example, e.g., in social network applications, one might run a random walk process for a few steps from a starting node of interest, and if the walk ``gets stuck'' then one might interpret this as evidence that that region of the graph is meaningful in the application domain~\cite{EH09_TR}. These are examples of the types of heuristics commonly-used in applications. By heuristic, we mean an algorithm in the sense that it performs a sequence of well-defined steps, but one where precise theory is lacking (although usually heuristics come with strong intuitive motivation and are justified in terms of some downstream application). In particular, typically heuristics do not explicitly optimize a well-defined objective function and typically they do not come with well-defined inferential guarantees. Note that, in both of these examples, the goal is to find ``local'' or ``small scale'' structure in the data graph. Both examples also correspond to what practitioners interested in downstream applications actually do. Existing algorithmic and statistical theory, however, has challenges with these local or small-scale structures. For instance, a very ``good'' algorithmic runtime on a graph is traditionally one that is \emph{linear} in the number of vertices and edges. If the output of interest is only a vanishingly small fraction of a large graph, however, then this theory may not provide strong qualitative guidance on how these locally-biased methods behave in practice. Likewise, inferential methods often assume that the structures inferred constitute a substantial fraction of the graph, and many statistical techniques have challenges differentiating very small structure from random noise. In this overview, we describe a class of graph algorithms that has proven to be very useful for identifying and interpreting small-scale local structure in large-scale data. For this class of algorithms, however, strong algorithmic and statistical theory has been developed. In particular, these graph algorithms are \emph{locally-biased} in one of several precisely-quantified senses. We will describe what we mean by this in more detail below, but, informally, this means that the algorithms are most interested in only a small part of a large graph. As opposed to heuristic operational procedures, however, many of these algorithms do come with strong worst-case algorithmic guarantees, and many of these algorithms also do come with statistical guarantees that prove they have \emph{implicit} regularization properties. This complementary algorithmic-statistical theory helps explain their improved performance in many practical applications. While the approach of locally-biased graph algorithms is very general, it has been developed most extensively for the fundamental problem of finding locally-biased graph partitions, i.e., clusters or communities, and so we will focus on locally-biased approaches for the graph clustering problem. Of course, this partitioning question is of interest in many more application-driven areas, where one is interested in finding useful or meaningful clusters as part of a data analysis pipeline. \subsection{The rationale for local analysis in real-world data} As a quick example of why local graph analysis is frequently used in data and data science applications, we present in Figure~\ref{fig:small-cluster} the results of finding the best partition of both a random geometric graph and a more typical data graph. Standard graph partitioning algorithms must operate on, or ``touch'', each vertex and edge of the graph to identify these partitions. The best partition of the geometric graph is around half the data, where it is reasonable to run an algorithm that touches all the data. On the other hand, the best partition of the data graph is very small, and in this case touching the entire graph to find it can be too costly in terms of computation time. The local graph clustering techniques discussed in this paper can find this cluster touching only edges and nodes in the output cluster, greatly reducing the computation~time. Far from being a pathology or a peculiarity, the finding that optimal partitions of real-world networks are often extremely imbalanced, thus leading to very small optimal clusters, is endemic to many of the graphs arising in large-scale data analysis~\cite{LLDM08_communities_CONF,LLDM09_communities_IM,LLM10_communities_CONF,Jeub15}.\footnote{An important applied question has to do with the meaningfulness, usefulness, etc., of such small clusters. We do not consider those questions here, and instead we refer the interested reader to prior work~\cite{LLDM08_communities_CONF,LLDM09_communities_IM,LLM10_communities_CONF,Jeub15}. Here, we instead focus on the algorithmic and statistical properties of these locally-biased algorithms.} Let us now explain in more detail Figure~\ref{fig:small-cluster}. Figure~\ref{fig:small-cluster-a} shows a graph with 3000 nodes that is typical of many graphs that possess a strong underlying \emph{geometry}, e.g., those used in computer graphics, computer vision, logistics planning, road network analysis, and so on. This particular graph is produced by generating 3000 random points in the plane and connecting all points within a small radius, such that the final graph is connected. The geometric graph can be nearly bisected by optimizing a measure known as conductance (we shall define this shortly), which is designed to balance partition size and quality. In Figure~\ref{fig:small-cluster-b}, we show a more typical data graph of around 10680 nodes~\cite{Moguna-2004-models}, where this particular data graph is based on the trust relationships in a PGP (Pretty Good Privacy) key-chain. Optimizing the same conductance objective function results in a tiny set, Figure \ref{fig:small-cluster-d}, and not the near-bisection as in the geometric case, Figure \ref{fig:small-cluster-c}. (We were able to use integer optimization techniques to directly solve the NP-hard problems at the cost of months of computation.) Many other examples of this general phenomenon can be found in prior work~\cite{LLDM08_communities_CONF,LLDM09_communities_IM,LLM10_communities_CONF,Jeub15}. \begin{figure}[t] \subfigure[A random geometric graph\label{fig:small-cluster-a}]{\includegraphics[width=0.5\linewidth]{U3A-full}}% \subfigure[A typical data graph\label{fig:small-cluster-b}]{\includegraphics[width=0.5\linewidth]{pgp-full}} \subfigure[The optimal conductance solution for the geometric graph bisects the graph into two large well-balanced pieces\label{fig:small-cluster-c}]{\includegraphics[scale=0.32]{U3A-bestset}} \subfigure[The optimal conductance solution for a typical data graph. (Inset. A zoomed view of the subgraph where the two unfilled notes are the border with the rest of the graph.)\label{fig:small-cluster-d}]{\raisebox{0cm}{\includegraphics[width=0.5\linewidth]{pgp-bestset}}\llap{\colorbox{white}{\includegraphics[scale=0.32]{pgp-bestset-zoom}}}} \caption{At left, a geometric graph has a pleasing and intuitive layout in the two-dimensional plane. At right, a more typical data graph has a classic \emph{hairball} layout that shows little high level structure. Due to the evident lack of global structure in the data graph, locally-biased graph algorithms are often used in these contexts. The solution of the Minimum-Conductance problem in the geometric graph is a large set of nodes, and it has conductance value $0.00464$. The solution of the Minimum-Conductance problem in the more typical data graph is a small set of nodes, and it has conductance value $0.00589$. The inset figure shows that this small graph is very dense and has only 3 edges leaving the set.} \label{fig:small-cluster} \end{figure} \subsection{Partitioning as a model problem} The problem of finding good partitions or clusters is ubiquitous. Representative examples include biomedical applications \cite{ICOYHS01,GN02}, internet and world-wide-web \cite{FFF99,AJB99,KKRRT99}, social graphs \cite{LLDM08_communities_CONF,scott,Traud11,UKBM11}, human communication graphs \cite{OSHSLKKB07}, human mobility graphs \cite{EEBL10}, voting graphs in political science \cite{PMNW05,multiplex_Mucha,MMP12,TKMP11,GHKV07}, protein interaction graphs \cite{JPD10}, material science \cite{BODP12,RCHSSKMN11}, neuroscience \cite{BWPMCG11,WBMPG12,BWRPMG13}, collaboration graphs \cite{ELP11}. All of the features of locally-biased computations are present in this model partitioning problem. For example, while some of these algorithms read the entire graph as input but are engineered to return answers that are biased toward and meaningful for a smaller part of the input graph~\cite{MOV12_JMLR,andersen08soda,ZBLWS04,pan2004-cross-modal-discovery}, other algorithms can take as input a small ``seed set'' of nodes as well as an oracle with which to access neighbors of a node, and they return meaningful answers without even touching the entire graph~\cite{FCSRM16_TR,ACL06,KG14,ST13}. Similarly, while these algorithms are often formulated in the language of theoretical computer science as approximation algorithms, i.e., they come with running time guarantees and can be shown to \emph{approximate} to within some quality-of-approximation factor some objective function of interest, e.g., conductance, in other cases one can prove statistical results such as that they \emph{exactly} solve a regularized version of that objective~\cite{GM14_ICML,Veldt-preprint-simple-local-flow,MO11-implementing,FCSRM16_TR}. Importantly, this statistical regularization is implicit rather than explicit. Typically, regularization is explicitly used in statistics, when fitting models with a large number of parameters, in order to avoid overfitting to the given data. It is also used to select answers biased towards specific sets---for example, sparse solution sets by using the Lasso~\cite{T96}. In the case of locally-biased graph algorithms, one simply runs a \emph{faster} algorithm for a problem. In some cases, the nature of the approximation that this fast algorithm makes can be related back to a regularized variant of the objective function. \subsection{Overview} In this paper, we will consider partitioning from the perspective of conductance, and we will survey a recent class of results about a common localizing construction. These methods will let us find the optimal sets in Figure~\ref{fig:small-cluster} without resorting to integer optimization (but also losing the proof of optimality). Depending on the exact construction, they will also come with a variety of helpful statistical properties. We'll conclude with a variety of different perspectives on these problems and some open questions. In Section \ref{sec:prelim} we describe assumptions, notation and preliminary results which we will use in this paper. In Section \ref{sec:global_cond_spcut} we discuss two global graph partitioning problems and their spectral relaxation. In Section \ref{sec:localgraphpart} we describe the local graph clustering application. In Section \ref{sec:empirical} we provide empirical evaluations for the global and local graph clustering algorithms which are described in this paper. Finally, in Section \ref{sec:disc_conclusion} we give our conclusions. \section{Text that has been cut} \section{Intro} Motivated by these very large-scale data analysis applications where only small meaningful clusters exist and where the graphs are so large that iterating over all edges and nodes is measured in minutes or hours, recent work has focused on \emph{locally-biased graph algorithms}. This refers to a broad class of algorithms that are designed to take as input a large graph, e.g., a billion node social or information network, and to solve problems that are in some sense ``nearby'' an exogenously-specified ``seed set'' of nodes. While these algorithms are often very useful in practice, and while many of them have connections with heuristic procedures that practitioners often apply to their data, a distinguishing feature of them is their non-trivial algorithmic and/or statistical theory. In this overview paper, we will cover recent work of global and local graph algorithms, touching on each of these topics, reviewing complementary aspects, and focusing on optimization questions. We split this paper into three parts, optimization objectives, global and local algorithms. First we will present optimization objectives which by consensus quantify the notion of a cluster in a graph. The optimization problems that we present are NP-hard, thus cannot be optimized in polynomial time. Then we discuss state-of-the-art polynomial time relaxations that result in spectral or max-flow problems. Second, we present an overview of locally-biased graph partitioning methods in terms of \emph{flow-based methods} and \emph{spectral-based methods}. Finally, we illustrate their performance in practice and comment on the implicit or explicit regularization that is applied by each algorithm. \section{Regularization, Beyond $\ell_1$ and $\ell_2$} It is easy to see that the above problem is a continuous representation of $s$-$t$ Min-Cut problem. The constraints $x_s=1$ and $x_t=0$ represent regularization such that the trivial solution of a constant vector $x$ is obtained. At the same time these two constraints affect the separation of the graph in two parts such that the nodes $v_s$ and $v_t$ are in different parts of the partition. The approximation is based on the distortion error of embedding the semi-metric to the so called $\ell_1$-metrics set, see \cite{} (\textcolor{red}{Leighton Rao}) for details. \paragraph{Theoretical issues: combining spectral and flow.} \textcolor{red}{The material below is also covered in the SDP section, we need to combine them.} Although it isn't our main focus, we comment briefly on one set of well-known results and how it fits in with our discussion. A natural question in the above is whether one can combine the complementary ideas from spectral and flow to obtain improved results. The answer is yes, and this is the ARV algorithm. It (1) can be written as a tighter relaxation of the expansion/conductance problem, (2) can be written as an SDP, (3) provides improvement over spectral as well as LR, (4) leads to related optimization-based methods/approaches such as KRF and MWUM that lead to similar improvements. XXX. GIVE THE OBJECTIVE AND RELAXATION AND RESULTS AND LEAVE IT AT THAT. BTW, also, LMO showed that the practice follows the theory for graphs up to thousands to tens of thousands of nodes~\cite{LMO09}, but, aside from this, these methods haven't really been implemented. XXX. WE'LL PROBABLY SAY IN THE CONCLUSION THAT LOCAL ARV METHODS ARE OPEN. \subsection{Embedding aspects}\label{subsection:embeddings} \textcolor{red}{I have to embed ( :-) ) this section in previous sections since most of the material below is already mentioned above.} These two approaches have an interpretation in terms of embeddings (which is of theoretical interest, but which also can be seen empirically), and this provides a way to think of the two together as complementary (in the global case, but we will do the local case below). To start, return to min-cut, and note that that objective, while tractable, often leads to trivial solutions, in that it cuts on a very small number of nodes, e.g., one or two. Thus, it is common to normalize by the volume. (Alternatively, one could have a balance constraint or use methods that explicitly or implicitly provide a bias toward large sets of nodes.) In this case, one can define the expansion of a set of nodes to be the usual expansion-SA-to-Volume measure. XXX. DEFINE. If the graph is weighted or has variable degrees, then one could define the conductance to be the usual conductance-SA-to-Vol measure. (They are the same for unweighted/degree-regular graphs, but not otherwise and the differences are important in theory/practice.) Note that the input to these objectives is just a graph $G=(V,E,W)$. These objectives are intractable, but they capture the qualitative idea of what most people think of by clusters---relatively large, relatively a lot of stuff inside, relatively less interaction between the cluster and its complement. The point is that spectral and flow both give approximation algorithms for expansion/conductance. Spectral relaxes one way, i.e., the $\{-1,1\}$ constraint to being $\pm1$ on average, and this can be solved by computing eigenvectors or diffusions Flow relaxes another way, i.e, the $\{0,1\}$ constraint to be a metric, and this can be written as the solution of an LP, which can then be solved with flow methods like Dinic or related methods. From this embedding perspective, it is clear that spectral embeds the graph not just on a like, and it then does a sweep cut, but it also embeds the graph in a complete graph, i.e., the Laplacian of a complete graph, and it is here that the duality is the tightest. It is here that the quadratic approximation result of Cheeger arises. And note that for spectral methods random walks mix quickly on constant-degree expanders and slowly on line graphs, and this can be sued to construct the Guattery-Miller cockroach graphs. XXX. SOMETHING ABOUT CONNECTIONS WITH L2. Similarly, flow methods embed you in an $\ell_1$ space, and Bourgain's embedding lemma says that an $O(\log n)$ distortion can be expected, and this happens on constant degree expanders. We have gone through this in some detail since many of the ideas are essential for constructing local versions of these methods. Many of these results are ``obvious'' to certain research areas and not even thought about by other research areas, so we went through them in the more well-developed global partitioning area, so we can draw similarities with local methods. \subsection{Some additional observations} There is, of course, the usual theory-practice gap. Theoretical work typically considers the problem of two clusters, and applied work is often more interested in more than two clusters. The latter, while also using a lot of algorithm engineering, often uses ideas that boil down to the former. Here, we mention a few things. \paragraph{Practical issues: going beyond spectral and flow.} Global graph partitioning methods basically boil down to some combination of spectral and flow, also couples with ideas like multi-resolution. The canonical example of this is METIS~\cite{karypis98_metis,karypis98metis}. This, coupled with doing things ``right,'' e.g., doing the sweep cut right with spectral of doing something analogous like Goldberg does with flow algorithms, can have a big effect on the quality of the result. We won't go into a lot of detail about this, but we expect that a lot of these ideas can also lead to improved local and \section{Spectral methods} The material in this section is based on \cite{S11}. Then $$ vol(E(S,S^c)) = \frac{x^T L x}{(c_1-c_2)^2} $$ and $$ x^TDx = c_1^2 vol(S) + c_2^2 vol(S^c). $$ Depending on how we define $c_1$ and $c_2$ we obtain different problems. For example, if $$ c_1= \sqrt{\frac{vol(S^c)}{vol(S)}}, \ c_2= -\sqrt{\frac{vol(S)}{vol(S^c)}} $$ then the following problem \begin{align}\label{spcutLD} \mbox{minimize} & \quad \frac{x^TLx}{x^TDx} \\\nonumber \mbox{subject to} &\quad x\in\{c_1,c_2\}^{|\mathcal{V}|} \end{align} is equivalent to the Sparsest-Cut problem \eqref{spcut}. If $c_1=1$ and $c_2=0$ then \eqref{spcutLD} is equivalent to the Minimum-Isoperimetry problem \eqref{isop}. It is clear that for different values of $c_1$ and $c_2$ we impose different regularization on the optimal partition of the graph. However for any values of $c_1$ and $c_2$ problem \eqref{spcutLD} is still NP-hard. A possible way to overcome this difficulty is to relax the solution set to $\{u\in\mathbb{R}^{|\mathcal{V}|} \ | 1_{|\mathcal{V}|}^T D u = 0\}$, where $1_{|\mathcal{V}|}$ is a column vector of ones of length $|\mathcal{V}|$. This relaxation is equivalent to finding the second largest eigenvalue of the normalized graph Laplacian $\mathcal{L}$, which justifies the name spectral relaxation. The relaxed problem is \begin{align}\label{spcutLD} \mbox{minimize} & \quad \frac{x^TLx}{x^TDx} \\\nonumber \mbox{subject to} &\quad x\in\{u\in\mathbb{R}^{|\mathcal{V}|} \ | \ 1_{|\mathcal{V}|}^T D u = 0\}, \end{align} which is a non-convex problem, but all local solutions are of the same importance since all have the same objective value. The local solutions differ only by a positive constant factor and a sign change. The reason for imposing the orthogonality constraint $1_{|\mathcal{V}|}^T D x = 0$ is because otherwise \eqref{spcutLD} has a trivial solution, the eigevector $D^{1/2} 1_{|\mathcal{V}|}$ (any other constant vector can be used instead of $1_{|\mathcal{V}|}$) of the zero (the smallest) eigevalue of $\mathcal{L}$. Let us define $\delta_S(v_i,v_j) = |x_i - x_j|^2$.\ Using $\delta_S$ we can rewrite the numerator in the objective function as $$ x^T L x = \sum_{i=1}^{|\mathcal{V}|}\sum_{j=1}^{|\mathcal{V}|} C_{ij}\delta_S(v_i,v_j). $$ Another way of viewing the spectral relaxation is by noticing that if instead of defining $x : \mathcal{V} \to \{c_1,c_2\}$ to be an indicator function, we allow it to be any arbitrary function $x: \mathcal{V} \to \mathbb{R}$, then we relax the cut-metric $\delta_S$ to be the Euclidean square distance. \section{Local methods} \subsection{The Local-Isoperimetry Problem} Recall that we introduced the Sparsest-Cut and Minimum-Isoperimetry problems as regularizations of the Min-Cut problem that were designed to achieve some control over the size of the set identified. The Local-Isoperimetry problem is an integer problem that adds more regularization (or a constraint) to achieve a local solution~\cite{MOV12_JMLR}. The problem depends on a graph $G$ and a reference set $R$ that must be contained within the solution. We also make the size of the final set a parameter $k$. The new program is \begin{align} \hat{\phi}(\mathcal{G};R,k) \quad := \quad \mbox{minimize} & \; \tilde{\phi}(S)= \frac{vol(E(S,S^c))}{vol(S)} \\\nonumber \mbox{subject to} & \; S\subset \mathcal{V},\ vol(S) \le k \\ \label{eq:localiso} & \; R \subseteq S. \nonumber \end{align} It differs from the Minimum-Isoperimetry problem because we have replaced the volume bound with a constant $k$ and require that the solution set $S$ contain the reference set $R$. The idea with this problem is that we wish to localize the solution to the Minimum-Isoperimetry problem around a subset of nodes $R$. We'll often take $R$ to be a single node. Note that if $k = vol(G)$ then this problem may be solved as a parametric flow problem using techniques akin to those in~\cite{HochbaumNcutprime}. If $k = vol(G)/2$, then we are able to use $|V|$ runs of this algorithm to solve the Minimum-Isoperimetry problem by setting $R$ to be each vertex. So solving this is NP-hard in general. We illustrate one counter-intuitive feature of this problem in Figure~\ref{fig:local-iso}. First, let us note that one of the global solutions of the Minimum-Isoperimetry problem must be a connected subgraph. However, the solution set of the Local-Isoperimetry problem may be a disconnected graph. This occurs if there is another set in the graph with a sufficiently small isoperimetry value such that it is better to pay the price for disconnecting the reference graph $R$ and returning the union of the two. \begin{figure}[t] \subfigure[The Local-Isometry solution may be disconnected. The singleton node is the set $R$.]{\includegraphics[scale=0.33]{U3A-local-iso-1-500}}\hspace{0.01\linewidth}% \subfigure[Increasing $k$ results in a connected set for this problem.]{\includegraphics[scale=0.33]{U3A-local-iso-1-5000}} \caption{The singleton node in (a) is not a bug. The single disconnected node was the set $R$. \textfinish{Add more discussion.} \textfinish{add PGP figures}} \label{fig:local-iso} \end{figure} \section{Discussion and conclusion} \label{sec:disc_conclusion} Although the optimization approach we have adopted is designed to highlight similarities between different variants of locally-biased graph algorithms, it is also worth emphasizing that there are a number of quite different and complementary perspectives people in different research communities have adopted thus far on these methods. For example: \textbf{Theoretical and empirical.} The theoretical implications of these locally-biased algorithms are often used to improve the performance of long-standing problems in theoretical computer science by improving runtimes, improving approximation constants, and handling special cases. Empirically, these algorithms are used to \emph{study} real-world data and to accelerate and improve performance on discovery and prediction tasks. Due to the strong locality, the fast runtimes for theory often manifest as extremely fast algorithms in practice. Well-implemented strongly-local algorithms often have runtimes in milliseconds even on billion-edge graphs~\cite{KG14,FCSRM16_TR}. \textbf{Algorithmic and statistical.} Some of the work is motivated by having better algorithmic results, e.g., being fast and/or being a rigorous approximation algorithm, i.e., worst-case guarantees in terms of approximating the optimal solution of a combinatorial problem, while other work has provided an interpretation in terms of statistical properties, e.g., explicitly optimizing a regularized objective \cite{WSST14} or implicitly having output that are nice in some sense, i.e., well-connected output cluster \cite{ZLM13}. Often, locally-biased algorithms alone suffice as the result is an improvement to some downstream activity that will necessarily look at all the data anyway. \textbf{Optimization and operational.} The locally-biased methods tend to result from stating an optimization problem and solving it with some sort of black box or white box. Strongly-local algorithms often arise by studying a specific procedure on a graph and showing that it satisfies some condition, e.g., that it terminates so quickly that it cannot explore the entire graph, that it leads to a solution with certain quality-of-approximation guarantees, etc. See, for instance, the spectral algorithms \cite{ACL06,AL08,AP09,C09,ST13,CS14,KG14} and the flow-based algorithms \cite{KKOV07_TR,OSVV08,OZ14}. In light of these complementary approaches as well as the ubiquity with which graphs are used to model data, we expect that locally-biased graph algorithms and our optimization perspective on locally-biased graph algorithms will find increasing usefulness in many application areas. \section{Empirical Evaluation} \label{sec:empirical} In this section, we illustrate differences among global, weakly local, and strongly local solutions to the problems discussed in Section~\ref{sec:localgraphpart}. Additionally, we discuss differences between spectral and flow methods (which is equivalently $\ell_2$ vs. $\ell_1$ metrics for node distances). To do so, we make use of the following real-world undirected and unweighted networks. \begin{compactitem} \item \textbf{US-Senate}. Each node in this network is a Senator that served in a single term (two years) of Congress. Our data cover the period from year $1789$ to $2008$. Senators appear as multiple nodes if they served in multiple terms. Edges are based on the similarity of voting records between Senators and thresholded at the maximum similarity such that the graph remains connected. Edge-weights are discarded. For a detailed discussion of this data-set we refer the reader to \cite{multiplex_Mucha}. This graph has $8974$ nodes and $153804$ edges. This graph has two large clusters with small conductance ratio, i.e., downward-slopping network community profile; see Figure $6$ in \cite{Jeub15} for details. The first cluster consists of all the nodes before the year $1913$ and the second cluster consists of nodes after that year. \item \textbf{CA-GrQc}. The data for this graph is a general relativity and quantum cosmology collaboration network. Details can be found in the Stanford Network Analysis Project.\footnote{\url{http://snap.stanford.edu/data}} This graph has $4158$ nodes and $13422$ edges. This graph has many clusters of small size with small conductance ratio, while large clusters have large conductance ratio, i.e., upward-slopping network community profile; see Figure $6$ in \cite{Jeub15} for details. \item \textbf{FB-Johns55}. This graph is a Facebook anonymized data-set on a particular day in September $2005$ for a student social network at John Hopkins university. The graph is unweighted and it represents ``friendship" ties. The data form a subset of the Facebook100 data-set from \cite{TKMP11,TMP12}. This graph has $5157$ nodes and $186572$ edges. This is an expander-like graph, all small and large clusters have about the same conductance ratio, i.e., flat network community profile; see Figure $6$ in \cite{Jeub15} for details. \item \textbf{US-Roads}. The data for this graph is from the National Highway Planning Network \cite{LLDM08_communities_CONF}. Each node in this network is an intersection between two highways and the edges represent segments of the highways themselves. \end{compactitem} Note that the small-scale vs. large-scale clustering properties of the first three networks have been characterized previously~\cite{Jeub15}. In addition, it is known that US-Roads has a downward-sloping network community profile. \paragraph{Global, weakly local, and strongly local solutions} We first demonstrate differences among global, weakly local, and strongly local algorithms. Let us start with a comparison among spectral algorithms. By comparing algorithms that use that same metric, i.e., $\ell_2$, to measure distances among nodes we minimize factors that can affect the solution, and we focus on weak vs. strong locality. In all figures we show the solution obtained by an algorithm without applying any rounding procedure. We illustrate the importance of the nodes by colouring and size; details are explained in the captions of the figures and in the text. The layout for all graphs has been obtained using the force-directed algorithm \cite{H05}, which is available from the graph-tool project.\footnote{\url{https://graph-tool.skewed.de}} For US-Senate, the comparison is shown in Figure \ref{Fig_senate_spectral}. Figures \ref{Fig_senate_spectral_1} and \ref{Fig_senate_spectral_2} show the solutions of global algorithms, Spectral relaxation and MOV global ($z=1_{|\mathcal{V}|}$ and then we orthogonalize $z$ with respect to $D1_{|\mathcal{V}|}$), respectively. As expected, the US-Senate graph has two large clusters, i.e., before the year $1913$ and after that year, that partition along the one-dimensional time axis. This global structure is nicely captured by Spectral relaxation and MOV global in Figures \ref{Fig_senate_spectral_1} and \ref{Fig_senate_spectral_2}, respectively. Given an input seed set, Figures \ref{Fig_senate_spectral_3} and \ref{Fig_senate_spectral_4} illustrate the weakly and strongly local solutions by MOV and $\ell_1$-regularized Page-Rank, respectively. For MOV in Figures \ref{Fig_senate_spectral_3} we set $z_i = 1$ for all $i$ in the input seed set and $z_i=0$ for all $i$ outside the input seed set. Then we orthogonalize $z$ with respect to $D\cdot1_{|\mathcal{V}|}$. For $\ell_1$-regularized Page-Rank, we only give a single node as an input seed set, i.e., $h_i=1$ where $i$ is the input node and $h_i=0$ for all other nodes. Moreover, we set the locality parameter $\epsilon$ large enough such that the solution is very sparse, i.e., strongly local. In Figures \ref{Fig_senate_spectral_3} and \ref{Fig_senate_spectral_4}, we demonstrate the input seed sets by nodes with a blue halo around them. In Figure \ref{Fig_senate_spectral_3}, the cluster which is found by MOV consists of the nodes which have large mass concentration around the input seed set, i.e., the nodes around the input seed set that have large size and are coloured with a bright red shade. MOV recovers this cluster by examining the whole graph; each node has a weight assigned to it in Figure \ref{Fig_senate_spectral_3}. On the other hand, a similar cluster is found in Figure \ref{Fig_senate_spectral_4} by using $\ell_1$-regularized Page-Rank without examining the whole graph. This is possible because nodes of the graph have zero weight assigned and need not be considered. \emph{This speed and data advantage, along with the sparsity-based implicit regularization~\cite{GM14_ICML}, are some of the reasons that strongly-local algorithms, such as $\ell_1$-PageRank, are used so often in practice~\cite{LLDM09_communities_IM,Jeub15}.} \begin{figure*} \centering \subfigure[Global spectral relaxation]{\label{Fig_senate_spectral_1}\includegraphics[scale=0.22]{senate_eig2} \put(-220,0){ \begin{tikzpicture} \draw (0,0) -- (7.0,0); \foreach \x in {0,2.5,3.1,7.0} \draw (\x cm,3pt) -- (\x cm,-3pt); \draw (0.1,0) node[below=3pt] (a) {\tiny $1789$} node[above=3pt] {}; \draw (2.5,0) node[below=3pt] {\tiny $1860$} node[above=3pt] (c) {}; \draw (3.1,0) node[below=3pt](d) {} node[above=3pt] {\tiny $1913$}; \draw (6.9,0) node[above=3pt] (f) {\tiny $2008$} node[below=3pt] {}; \end{tikzpicture} } } \subfigure[MOV with global seed]{\label{Fig_senate_spectral_2} \includegraphics[scale=0.22]{senate_mov} }\\ \subfigure[MOV with local seed]{\label{Fig_senate_spectral_3} \includegraphics[scale=0.22]{senate_mov_local} } \subfigure[ACL $\ell_1$-regularized Page-Rank]{\label{Fig_senate_spectral_4}\includegraphics[scale=0.22]{senate_l1pr}} \caption{US-Senate.\ This figure shows the solutions of (a) Spectral relaxation, (b) MOV with global bias, (c) MOV with local bias and (d) strongly-local $\ell_1$-regularized Page-Rank. We use a heat map to represent the weights of the nodes. For Spectral relaxation and MOV bright yellow means large positive and bright red means large negative. For $\ell_1$-regularized Page-Rank bright yellow means large positive and bright red means small positive. The blue halo around a node in Figures \ref{Fig_senate_spectral_3} and \ref{Fig_senate_spectral_4} means that this node is included in the seed set. The size of the nodes shows the weights of the solution in absolute value. If a weight is nearly zero then the corresponding node is barely~visible. } \label{Fig_senate_spectral} \end{figure*} In Figure \ref{Fig_grqc_spectral}, we present global, weakly local, and strongly local solutions for the less well-partitionable and thus less easily-visualizable CA-GrQc graph. As already mentioned in the description of this data-set, this graph has many small clusters with small conductance ratio and large clusters have large ratio. This is also justified in our experiment by the fact that global methods, such as the Spectral relaxation and MOV global in Figures \ref{Fig_grqc_spectral_1} and \ref{Fig_grqc_spectral_2}, respectively, recover small clusters. The two global procedures find small clusters which are presented in Figures \ref{Fig_grqc_spectral_1} and \ref{Fig_grqc_spectral_2} with red, orange and yellow colours. However, since there are many small clusters of small conductance ratio, one might want to find different clusters than the ones obtained by Spectral relaxation and MOV global. This is possible using localized procedures such as MOV and $\ell_1$-regularized Page-Rank. Given two different seed sets we demonstrate in Figures \ref{Fig_grqc_spectral_3} and \ref{Fig_grqc_spectral_4} that MOV successfully finds other clusters than the ones obtained by the global methods. The same is shown in Figures \ref{Fig_grqc_spectral_5} and \ref{Fig_grqc_spectral_6} for $\ell_1$-regularized Page-Rank. Notice that MOV assigns weights (perhaps small) to all the nodes of the graph; on the other hand, $\ell_1$-regularized Page-Rank, as a strongly local procedure, assigns weights only to a small number of nodes, without examining all of the graph. \begin{figure} \centering \subfigure[Spectral relaxation]{\label{Fig_grqc_spectral_1}\includegraphics[scale=0.111]{CA-GrQc-cc_eig2}} \subfigure[MOV global]{\label{Fig_grqc_spectral_2}\includegraphics[scale=0.111]{CA-GrQc-cc_mov}} \\ \subfigure[MOV local, seed $1$]{ \begin{tikzpicture}[every node/.style={anchor=center}] \node(a) at (8,4){\label{Fig_grqc_spectral_3}\includegraphics[scale=0.095]{CA-GrQc-cc_mov_local}}; \node(b) at (7.5,3.3){\frame{\colorbox{white}{\includegraphics[scale=0.04]{CA-GrQc-cc_mov_local_zoom}}}}; \draw[black] (9.0,4.05)rectangle (9.6,3.76); \draw[black,->](8.33,3.3)--(9,3.75); \end{tikzpicture} } \subfigure[MOV local, seed $2$]{ \begin{tikzpicture}[every node/.style={anchor=center}] \node(a) at (8,4){\label{Fig_grqc_spectral_4}\includegraphics[scale=0.095]{CA-GrQc-cc_mov_local_diff_seed}}; \node(b) at (7.5,3.3){\frame{\colorbox{white}{\includegraphics[scale=0.04]{CA-GrQc-cc_mov_local_diff_seed_zoom}}}}; \draw[black] (8.8,4.53)rectangle (9.2,4.28); \draw[black,->](8.33,3.3)--(8.8,4.28); \end{tikzpicture} } \\ \subfigure[$\ell_1$-regularized Page-Rank, seed $1$]{ \begin{tikzpicture}[every node/.style={anchor=center}] \node(a) at (8,4){\label{Fig_grqc_spectral_5}\includegraphics[scale=0.095]{CA-GrQc-cc_l1pr}}; \node(b) at (7.5,3.3){\frame{\colorbox{white}{\includegraphics[scale=0.04]{CA-GrQc-cc_l1pr_zoom}}}}; \draw[black] (9.0,4.05)rectangle (9.6,3.76); \draw[black,->](8.33,3.3)--(9,3.75); \end{tikzpicture} } \subfigure[$\ell_1$-regularized Page-Rank, seed $2$]{ \begin{tikzpicture}[every node/.style={anchor=center}] \node(a) at (8,4){\label{Fig_grqc_spectral_6}\includegraphics[scale=0.095]{CA-GrQc-cc_l1pr_diff_seed}}; \node(b) at (7.5,3.3){\frame{\colorbox{white}{\includegraphics[scale=0.04]{CA-GrQc-cc_l1pr_diff_seed_zoom}}}}; \draw[black] (8.8,4.53)rectangle (9.2,4.28); \draw[black,->](8.33,3.3)--(8.8,4.28); \end{tikzpicture} } \caption{CA-GrQc.\ This figure shows the solutions of Spectral relaxation, MOV with global input, MOV with local input and $\ell_1$-regularized Page-Rank. The meaning of the colours of the nodes and its sizes is the same as in Figure \ref{Fig_senate_spectral}.} \label{Fig_grqc_spectral} \end{figure} We now use the FB-Johns55 graph which has an expander-like behaviour at all size scales, i.e., all small and large clusters have large conductance ratio. See Figure $6$ in \cite{Jeub15} for details. We present the results of this experiment in Figure \ref{Fig_fb_spectral}. Notice that in Figures \ref{Fig_fb_spectral_1} and \ref{Fig_fb_spectral_2} the global methods identify three main clusters, one small (red nodes), one medium size (orange nodes) and one large (yellow nodes). All these clusters have similar conductance ratio. In Figures \ref{Fig_fb_spectral_3} and \ref{Fig_fb_spectral_4} we show that MOV can recover the medium or the small size clusters, respectively, by giving a localized seed set. In Figures \ref{Fig_fb_spectral_5} and \ref{Fig_fb_spectral_6} we illustrate that using $\ell_1$-regularized Page-Rank one can find very similar clusters while exploiting the strongly local running time of the method. \begin{figure} \centering \subfigure[Spectral relaxation]{\label{Fig_fb_spectral_1}\includegraphics[scale=0.11]{Johns-Hopkins55-cc_eig2}} \subfigure[MOV global]{\label{Fig_fb_spectral_2}\includegraphics[scale=0.11]{Johns-Hopkins55-cc_mov}} \\ \subfigure[MOV local]{\label{Fig_fb_spectral_3} \includegraphics[scale=0.11]{Johns-Hopkins55-cc_mov_local}} \subfigure[MOV local, seed $2$]{\label{Fig_fb_spectral_4}\includegraphics[scale=0.11]{Johns-Hopkins55-cc_mov_local_diff_seed}} \\ \subfigure[$\ell_1$-regularized Page-Rank]{\label{Fig_fb_spectral_5}\includegraphics[scale=0.11]{Johns-Hopkins55-cc_l1pr}} \subfigure[$\ell_1$-regularized Page-Rank, seed $2$]{\label{Fig_fb_spectral_6}\includegraphics[scale=0.11]{Johns-Hopkins55-cc_l1pr_diff_seed}} \caption{FB-Johns55.\ This figure shows the solutions of Spectral relaxation, MOV with global input, MOV with local input and $\ell_1$-regularized Page-Rank. The meaning of the colours of the nodes and its sizes is the same as in Figure \ref{Fig_senate_spectral}.} \label{Fig_fb_spectral} \end{figure} Let us now present the performance of flow-based algorithms on the same graphs. We begin with US-Senate in Figure \ref{Fig_senate_flow}. In this figure, the red nodes are part of the solution of Flow Improve or Local Flow Improve, depending on the experiment; the yellow nodes are part of the seed set only; and the orange nodes are in both the solution of the flow algorithm and the input seed set. In Figure \ref{Fig_senate_flow_1}, we used as an input seed set to Flow Improve the cluster obtained by applying sweep cut with respect to the conductance ratio on the Spectral relaxation solution. Figures \ref{Fig_senate_flow_2} and \ref{Fig_senate_flow_3} present a clear distinction between Flow Improve and Local Flow Improve, weakly and strongly local algorithms, respectively. For both figures, the input seed set is located at about the middle of the graph. Flow Improve as a weakly local algorithm examines the whole graph and returns a cluster which includes the period before $1913$. Also, it includes big part of the input seed set in the cluster due to the overlapping regularization term in the denominator of its objective function. See the definition of the objective function $\phi_R$ for Flow Improve in Section \ref{sec:localgraphpart}. On the other hand, in Figure \ref{Fig_senate_flow_3} Local Flow Improve as a strongly local algorithm does not examine the whole graph and its solution is concentrated only around the input seed set. \begin{figure*} \centering \subfigure[Local Flow Improve, seed: Spectral relaxation + sweep cut]{\label{Fig_senate_flow_1}\includegraphics[scale=0.15]{senate_flowI_s_local_seed1} \hspace{-5.5cm} \begin{tikzpicture} \draw (0,0) -- (4.8,0); \foreach \x in {0,1,1.5,4.8} \draw (\x cm,3pt) -- (\x cm,-3pt); \draw (0.1,0) node[below=3pt] (a) {\tiny $1789$} node[above=3pt] {}; \draw (1,0) node[below=3pt] {\tiny $1860$} node[above=3pt] (c) {}; \draw (1.5,0) node[below=3pt](d) {} node[above=3pt] {\tiny $1913$}; \draw (4.7,0) node[above=3pt] (f) {\tiny $2008$} node[below=3pt] {}; \end{tikzpicture} } \subfigure[Flow Improve, local seed set]{\label{Fig_senate_flow_2}\includegraphics[scale=0.15]{senate_flowI_w_local_seed2}} \subfigure[Local Flow Improve, local seed set]{\label{Fig_senate_flow_3}\includegraphics[scale=0.15]{senate_flowI_s_local_seed2}} \caption{US-Senate.\ This figure shows the solutions of Flow Improve and Local Flow Improve for various input seed sets. Red nodes are only Flow Improve or Local Flow Improve, depending on the experiment; yellow nodes are only seed set; and orange nodes are both part of the flow algorithm and the seed set.} \label{Fig_senate_flow} \end{figure*} The distinction that we discussed in the previous paragraph between Flow Improve and Local Flow Improve is easy to visualize in the relatively well-structured US-Senate, but it is not so clear in all graphs. For example, in Figure \ref{Fig_cagrqc_flow} we present the performance of these two algorithms for the CA-GrQc graph. Since this graph has only small clusters of small conductance ratio, Flow Improve and Local Flow Improve find the same clusters. This is clearly shown by comparing Figures \ref{Fig_cagrqc_flow_1} and \ref{Fig_cagrqc_flow_2} and Figures \ref{Fig_cagrqc_flow_3} and \ref{Fig_cagrqc_flow_4}. A similar performance is observed for the FB-Johns55 graph in Figure \ref{Fig_fb_flow}, except that the solution of Flow Improve and Local Flow Improve are not exactly the same but only very similar. \begin{figure} \centering \subfigure[Flow Improve, seed $1$]{\label{Fig_cagrqc_flow_1} \begin{tikzpicture}[every node/.style={anchor=center}] \node(a) at (8,4){\includegraphics[scale=0.095]{CA-GrQc-cc_flowI_w_local_seed1}}; \node(b) at (7.5,3.3){\frame{\colorbox{white}{\includegraphics[scale=0.04]{CA-GrQc-cc_flowI_w_local_seed1_zoom}}}}; \draw[black] (9.0,4.05)rectangle (9.6,3.76); \draw[black,->](8.33,3.3)--(9,3.75); \end{tikzpicture} } \subfigure[Local Flow Improve, seed $1$]{\label{Fig_cagrqc_flow_2} \begin{tikzpicture}[every node/.style={anchor=center}] \node(a) at (8,4){\includegraphics[scale=0.095]{CA-GrQc-cc_flowI_s_local_seed1}}; \node(b) at (7.5,3.3){\frame{\colorbox{white}{\includegraphics[scale=0.04]{CA-GrQc-cc_flowI_s_local_seed1_zoom}}}}; \draw[black] (9.0,4.05)rectangle (9.6,3.76); \draw[black,->](8.33,3.3)--(9,3.75); \end{tikzpicture} }\\ \subfigure[Flow Improve, local seed $2$]{\label{Fig_cagrqc_flow_3} \begin{tikzpicture}[every node/.style={anchor=center}] \node(a) at (8,4){\includegraphics[scale=0.095]{CA-GrQc-cc_flowI_w_local_seed2}}; \node(b) at (7.5,3.3){\frame{\colorbox{white}{\includegraphics[scale=0.04]{CA-GrQc-cc_flowI_w_local_seed2_zoom}}}}; \draw[black] (8.8,4.53)rectangle (9.2,4.28); \draw[black,->](8.33,3.3)--(8.8,4.28); \end{tikzpicture} } \subfigure[Local Flow Improve, seed $2$]{\label{Fig_cagrqc_flow_4} \begin{tikzpicture}[every node/.style={anchor=center}] \node(a) at (8,4){\includegraphics[scale=0.095]{CA-GrQc-cc_flowI_s_local_seed2}}; \node(b) at (7.5,3.3){\frame{\colorbox{white}{\includegraphics[scale=0.04]{CA-GrQc-cc_flowI_s_local_seed2_zoom}}}}; \draw[black] (8.8,4.53)rectangle (9.2,4.28); \draw[black,->](8.33,3.3)--(8.8,4.28); \end{tikzpicture} } \caption{CA-GrQc.\ This figure shows the solutions of Flow Improve and Local Flow Improve for various input seed sets. Red nodes are only Flow Improve or Local Flow Improve, depending on the experiment; yellow nodes are only seed set; and orange nodes are both part of the flow algorithm and the seed set.} \label{Fig_cagrqc_flow} \end{figure} \begin{figure} \centering \subfigure[Flow Improve, seed $1$]{\label{Fig_fb_flow_1}\includegraphics[scale=0.11]{Johns-Hopkins55-cc_flowI_w_local_seed1}} \subfigure[Local Flow Improve, seed $1$]{\label{Fig_fb_flow_2}\includegraphics[scale=0.11]{Johns-Hopkins55-cc_flowI_s_local_seed1}}\\ \subfigure[Flow Improve, seed $2$]{\label{Fig_fb_flow_3}\includegraphics[scale=0.11]{Johns-Hopkins55-cc_flowI_w_local_seed2}} \subfigure[Local Flow Improve, seed $2$]{\label{Fig_fb_flow_4}\includegraphics[scale=0.11]{Johns-Hopkins55-cc_flowI_s_local_seed2}} \caption{FB-Johns55. This figure shows the solutions of Flow Improve and Local Flow Improve for various input seed sets. Red nodes are only Flow Improve or Local Flow Improve, depending on the experiment; yellow nodes are only seed set; and orange nodes are both part of the flow algorithm and the seed set.} \label{Fig_fb_flow} \end{figure} \paragraph{Flow vs. spectral, or $\ell_1$ vs. $\ell_2$} Spectral algorithms measure distances of the nodes based on the $\ell_2$ norm. Generally this means that the nodes of the graph are embedded on the real line. On the other hand, flow algorithms measure distances of the nodes based on the $\ell_1$ norm. The solution to flow-based algorithms that we discussed is binary, either a node is added in the solution with weight $1$ or it is not and it has weight $0$. In this case, the objective function $\|Bx\|_{1,C}$ of the flow algorithms is a locally-biased variation on $\cut(S)$, where $S$ is constructed based on the binary $x$.\ Therefore, the flow algorithms aim to find a balance between finding good cuts and identifying the input seed set. This implies that the flow algorithms try to minimize the absolute number of edges that cross the partition, but at the same time they try to take into account the volume regularization effect of the denominator in the objective function. In this section, we will try to isolate the effect of $\ell_1$ and $\ell_2$ metrics in the output solution. We do this by employing MQI and spectral MQI, which are flow (i.e., $\ell_1$) and spectral (i.e., $\ell_2$) problems, respectively. The first set of results is shown in Figure \ref{Fig_senate_l1vl2}. Notice in Figure \ref{Fig_senate_l1vl2_1} and \ref{Fig_senate_l1vl2_2} that MQI and spectral MQI + sweep cut recover the large clusters, i.e., before and after the year $1913$. There are only minor differences between the two solutions. Moreover, observe that Spectral MQI returns a solution which is not binary. This is illustrated in Figure \ref{Fig_senate_l1vl2_3}, where the weights of the nodes are real numbers. Then sweep cut is applied on the solution of spectral MQI to obtain a binary solution with small conductance ratio, i.e., Figure \ref{Fig_senate_l1vl2_2}. The previous example did not reveal any difference between MQI and spectral MQI other than the fact that spectral MQI has to be combined with the sweep cut rounding procedure to obtain a binary solution. In Figure \ref{Fig_usroads_l1vl2}, we present a result showing where the solutions have substantial differences. The graph that we used for this is the US-Roads, and the input seed set consists of nodes near Minneapolis together with some suburban areas around the city. Notice in Figures \ref{Fig_usroads_l1vl2_1} that MQI, i.e., $\ell_1$ metric, shrinks the boundaries of the input seed set. However, MQI does not accurately recover Minneapolis. The reason is the volume regularization which is imposed by the denominator of the objective function of MQI. This regularization forces the solution to have large volume. On the other hand, spectral MQI + sweep cut in Figure \ref{Fig_usroads_l1vl2_2} recovers Minneapolis. The reason is that for spectral MQI the regularization effect of the denominator is unimportant since the objective function is invariant to scalar multiplications of the solution vector. It's the solution of spectral MQI, i.e., the eigenvector of smallest eigenvalue, which is presented in Figure \ref{Fig_usroads_l1vl2_3}, that is concentrated closely around Minneapolis. Due to this concentration of the eigenvector around Minneapolis, the sweep is successful. Briefly, spectral MQI, which is a continuous relaxation of MQI, implicitly offers an additional level of volume regularization, which turns out to be useful in this example. Finally, we present another set of results using the FB-Johns55 graph in Figure \ref{Fig_fb_l1vl2}. As we saw before, notice that for this less well-structured graph the solutions of MQI and spectral MQI + sweep cut are nearly the same. This happens because the regularization effect of the denominator of MQI and the regularization imposed by spectral MQI have nearly the same effect on this graph. This is also justified by the fact that MQI in Figure \ref{Fig_fb_l1vl2_1} and spectral MQI without sweep cut in Figure \ref{Fig_fb_l1vl2_3} recover nearly the same cluster. \begin{figure*} \centering \subfigure[MQI, seed: Spectral relaxation + sweep cut]{\label{Fig_senate_l1vl2_1}\includegraphics[scale=0.15]{senate_mqi} \hspace{-5.5cm} \begin{tikzpicture} \draw (0,0) -- (4.8,0); \foreach \x in {0,1,1.5,4.8} \draw (\x cm,3pt) -- (\x cm,-3pt); \draw (0.1,0) node[below=3pt] (a) {\tiny $1789$} node[above=3pt] {}; \draw (1,0) node[below=3pt] {\tiny $1860$} node[above=3pt] (c) {}; \draw (1.5,0) node[below=3pt](d) {} node[above=3pt] {\tiny $1913$}; \draw (4.7,0) node[above=3pt] (f) {\tiny $2008$} node[below=3pt] {}; \end{tikzpicture} } \subfigure[Spectral MQI + sweep cut, seed: Spectral relaxation + sweep cut]{\label{Fig_senate_l1vl2_2}\includegraphics[scale=0.15]{senate_smqi_sweep}} \subfigure[Spectral MQI, seed: Spectral relaxation + sweep cut]{\label{Fig_senate_l1vl2_3}\includegraphics[scale=0.15]{senate_smqi}} \caption{US-Senate.\ This figure shows the solutions of MQI, spectral MQI, spectral MQI + sweep cut given the solution of Spectral relaxation + sweep cut as an input seed set. For Figures \ref{Fig_senate_l1vl2_1} and \ref{Fig_senate_l1vl2_2} the red nodes are only MQI or spectral MQI + sweep cut depending on the experiment; yellow nodes are only seed set; and orange nodes are both part of the flow or spectral algorithm and the seed set. Figure \ref{Fig_senate_l1vl2_3} shows the solution of spectral MQI without sweep cut. For Figure \ref{Fig_senate_l1vl2_3} we use a heat map to represent the weights of the nodes. Bright yellow means large positive and bright red means small positive. The size of the nodes shows the weights of the solution in absolute value. } \label{Fig_senate_l1vl2} \end{figure*} \begin{figure*} \centering \subfigure[MQI, seed: Minneapolis and suburban areas]{ \begin{tikzpicture}[every node/.style={anchor=center}] \node(a) at (8,4){\label{Fig_usroads_l1vl2_1}\includegraphics[scale=0.133]{usroads_mqi}}; \node(b) at (7.5,3.3){\frame{\colorbox{white}{\includegraphics[scale=0.056]{usroads_mqi_zoom}}}}; \draw[black] (8,4.75)rectangle (8.35,4.5); \draw[black,->](7.5,4.0)--(8,4.5); \end{tikzpicture} } \subfigure[Spectral MQI + sweep cut, seed: Minneapolis and suburban areas]{ \begin{tikzpicture}[every node/.style={anchor=center}] \node(a) at (8,4){\label{Fig_usroads_l1vl2_2}\includegraphics[scale=0.133]{usroads_smqi_sweep}}; \node(b) at (7.5,3.3){\frame{\colorbox{white}{\includegraphics[scale=0.056]{usroads_smqi_sweep_zoom}}}}; \draw[black] (8,4.75)rectangle (8.35,4.5); \draw[black,->](7.5,4.0)--(8,4.5); \end{tikzpicture} } \subfigure[Spectral MQI, seed: Minneapolis and suburban areas]{ \begin{tikzpicture}[every node/.style={anchor=center}] \node(a) at (8,4){\label{Fig_usroads_l1vl2_3}\includegraphics[scale=0.133]{usroads_smqi}}; \node(b) at (7.5,3.3){\frame{\colorbox{white}{\includegraphics[scale=0.056]{usroads_smqi_zoom}}}}; \draw[black] (8,4.75)rectangle (8.35,4.5); \draw[black,->](7.5,4.0)--(8,4.5); \end{tikzpicture} } \caption{US-Roads.\ This figure shows the solutions of MQI, spectral MQI, spectral MQI + sweep cut given Minneapolis and its suburban areas as an input seed set. The meaning of the colours of the nodes and its sizes is the same as in Figure \ref{Fig_senate_l1vl2}.} \label{Fig_usroads_l1vl2} \end{figure*} \begin{figure*} \centering \subfigure[MQI]{\label{Fig_fb_l1vl2_1}\includegraphics[scale=0.14]{Johns-Hopkins55-cc_mqi}} \subfigure[Spectral MQI + sweep cut]{\label{Fig_fb_l1vl2_2}\includegraphics[scale=0.14]{Johns-Hopkins55-cc_smqi_sweep}} \subfigure[Spectral MQI]{\label{Fig_fb_l1vl2_3}\includegraphics[scale=0.14]{Johns-Hopkins55-cc_smqi}} \caption{FB-Johns55. This figure shows the solutions of MQI, spectral MQI, spectral MQI + sweep cut for a given input seed set. The meaning of the colours of the nodes and its sizes is the same as in Figure \ref{Fig_senate_l1vl2}.} \label{Fig_fb_l1vl2} \end{figure*} \section{Conductance partitioning} \section{ Sparsest-Cut, Minimum-Conductance, and Spectral~Relaxations}\label{sec:global_cond_spcut} In this section, we present two ubiquitous combinatorial optimization problems: Sparsest-Cut and Minimum-Conductance. These problems are NP-hard \cite{SM90,LR99}, but they can be relaxed to tractable convex optimization problems~\cite{ARV09}. We discuss one of the commonly used relaxation techniques which will motivate part of our discussion for local graph clustering algorithms. Both Sparsest-Cut and Minimum-Conductance give different ways of balancing the size of a partition with its quality. Sparsest-Cut finds the partition that minimizes the ratio of the fraction of edges that are removed divided by the scaled product of volumes of the two disjoint sets of nodes defined by removing those edges. In particular, if we have a partition $(S, S^c)$, where $S^c$ is defined in Section \ref{sec:prelim}, then $\cut(S)$ is the number of edges that are removed, and the scaled product of volumes $\vol(S)\vol(S^c)/\vol(\mathcal{V})$ is the volume of the disjoint sets of nodes. Putting all together in an optimization problem, we obtain \begin{align}\label{spcut} \tilde{\phi}(\mathcal{G}):= \mbox{minimize} & \ \tilde{\phi}(S):= \frac{\cut(S)}{\frac{1}{\vol(\mathcal{V})}\vol(S)\vol(S^c)} \\\nonumber \mbox{subject to} &\ S\subset \mathcal{V}. \end{align} We shall use the term \emph{expansion of a set} to refer to the ratio $\tilde{\phi}(S)$, and the term \emph{expansion of the graph} to refer to $\tilde{\phi}(\mathcal{G})$, in which case this problem is known as the Sparsest-Cut problem. Another way of balancing the partition is \begin{align}\label{isop} \phi(\mathcal{G}):= \mbox{minimize} & \ \phi(S):= \frac{\cut(S)}{\min(\vol(S),\vol(S^c))} \\\nonumber \mbox{subject to} &\ S\subset \mathcal{V}. \end{align} In this case, we divide by the minimum of $\vol(S)$ and $\vol(S^c)$, rather than their product. We shall use the term \emph{conductance of a set} to refer to the ratio of cut to volume $\phi(S)$, and the term \emph{conductance of the graph} to refer to $\phi(\mathcal{G})$, in which case this problem is known as the Minimum-Conductance problem. The difference between the two problems \eqref{spcut} and \eqref{isop} is that the former regularizes based on the number of connections lost among pairs of nodes, while the latter regularizes based on the size of the small side of the partition. Optimal solutions to these problems differ by a factor of $2$: \begin{equation}\label{eq:equiv_cond_sparsecut} \frac{1}{2}\tilde{\phi}(S) \le \phi(S) \le \tilde{\phi}(S), \end{equation} leading to the two objectives $\tilde{\phi}(S)$ and $\phi(S)$ being almost substitutable from a theoretical computer science perspective~\cite{ARV09}. However, this does not mean that the actual obtained solutions by solving \eqref{spcut} and \eqref{isop} are similar; in general, they are not. There are three major relaxation techniques for the NP-hard problems \eqref{spcut} and \eqref{isop}: spectral relaxation; all pairs multi-commodity flow or linear programming (LP) relaxation; and semidefinite programming (SDP) relaxation. For detailed descriptions about the LP and SDP relaxations we refer the reader to \cite{LR99} and \cite{ARV09}, respectively. We focus here on spectral relaxation since similar relaxations are widely used for the development of local clustering methods, which we discuss in subsequent sections. \subsection{Spectral Relaxation}\label{subsec:spcut} Spectral graph partitioning is one of the best known relaxations of the Sparsest-Cut \eqref{spcut} and Minimum-Conductance \eqref{isop}. The relaxation is the same for both problems, although the diversity of derivations of spectral partitioning does not always make this connection clear. For a partition $(S, S^c)$, let's associate a vector $x\in\{c_1,c_2\}^{|\mathcal{V}|}$ such that $x_i=c_1$ if $v_i\in S$ and $x_i=c_2$ if $v_i\in S^c$. (For simplicity, think of $c_1 = 1$ and $c_2 = 0$, so $x$ is the set indicator vector.) The spectral clustering relaxation uses a continuous relaxation of the set indicator vector in problems \eqref{spcut} and \eqref{isop} to produce an eigenvector. The relaxed problem is \begin{align}\label{spcutLD} \lambda_2 := \mbox{minimize} & \ \frac{\|Bx\|_{2,C}^2}{2\|x\|_{2,D}^2} \\\nonumber \mbox{subject to} &\ 1_{|\mathcal{V}|}^T D x = 0\\\nonumber &\ x\in\mathbb{R}^{|\mathcal{V}|} - \{0_{|\mathcal{V}|}\}. \end{align} (The denominator $\|x\|_{2,D}^2 = \sum_i |x_i|^2 d_i$.) To see why \eqref{spcutLD} is a continuous relaxation of \eqref{spcut} we make two observations. First, notice that for all $x$ in $\mathbb{R}^{|\mathcal{V}|} - \{0_{|\mathcal{V}|}\}$ such that $1_{|\mathcal{V}|}^T D x = 0$ the denominator in \eqref{spcutLD} satisfies $2\vol(\mathcal{V})\|x\|_{2,D}^2 = \sum_{i=1}^{|\mathcal{V}|}\sum_{j=1}^{|\mathcal{V}|} d_id_j|x_i-x_j|^2$. Therefore, $\lambda_2$ in \eqref{spcutLD} is equivalent to \begin{align}\label{eq:1434} \lambda_2 = \mbox{minimize} & \ \frac{\|Bx\|_{2,C}^2}{\frac{1}{\vol(\mathcal{V})}\sum_{i=1}^{|\mathcal{V}|}\sum_{j=1}^{|\mathcal{V}|} d_id_j|x_i-x_j|^2} \\\nonumber \mbox{subject to} &\ 1_{|\mathcal{V}|}^T D x = 0\\\nonumber &\ x\in\mathbb{R}^{|\mathcal{V}|} - \{0_{|\mathcal{V}|}\}. \end{align} The optimal value of the right hand side in \eqref{eq:1434} is equivalent to the optimal value of right hand side in the following expression \begin{align}\label{eq:1435} \lambda_2 = \mbox{minimize} & \ \frac{\|Bx\|_{2,C}^2}{\frac{1}{\vol(\mathcal{V})}\sum_{i=1}^{|\mathcal{V}|}\sum_{j=1}^{|\mathcal{V}|} d_id_j|x_i-x_j|^2} \\\nonumber \mbox{subject to} & \ x\in\mathbb{R}^{|\mathcal{V}|} - \{0_{|\mathcal{V}|},1_{|\mathcal{V}|}\}. \end{align} To prove this notice that the objective function of the right hand side in \eqref{eq:1435} is invariant to constant shifts of $x$, i.e., $x$ and $x + c 1_{|\mathcal{V}|}$ have the same objective function, where $c$ is a constant. Therefore, if $\tilde{x}$ is an optimal solution of the right hand side in \eqref{eq:1435} then $\hat{x} = \tilde{x} - \frac{1^T_{|\mathcal{V}|}D\tilde{x}}{\vol(\mathcal{V})} 1_{|\mathcal{V}|}$ has the same optimal objective value and also $1_{|\mathcal{V}|}^TD \hat{x} = 0$. Second, by restricting the solution in \eqref{eq:1435} in $\{0,1\}^{|\mathcal{V}|}$ instead of $\mathbb{R}^{|\mathcal{V}|}$ we get that $\cut(S) = \|Bx\|_{2,C}^2$ and $\sum_{i=1}^{|\mathcal{V}|}\sum_{j=1}^{|\mathcal{V}|} d_id_j|x_i-x_j|^2 = \vol(S)\vol(S^c)$. Using these two observations, it is easy to see that \eqref{spcutLD} is a continuous relaxation of \eqref{spcut}. Using \eqref{eq:equiv_cond_sparsecut}, it is easy to see that \eqref{spcutLD} is a relaxation for \eqref{isop} as well. The quality of approximation of relaxation \eqref{spcutLD} to Sparsest-Cut \eqref{spcut} is given by Cheeger's inequality \cite{LS88,SJ89} $${\lambda_2}/{\vol(\mathcal{V})}\le \tilde{\phi}(\mathcal{G}) \le {(8 \lambda_2)^{1/2}}/{\vol(\mathcal{V})} $$ while the approximation guarantee for the Minimum-Conductance problem \eqref{isop} is $$ {\lambda_2}/{2}\le \phi(\mathcal{G}) \le (2 \lambda_2)^{1/2}, $$ which can be found in \cite{bM89}. (A generalization of these bounds holds for arbitrary vectors~\cite{Mihail}.) Both of these approximation ratios can be realized by rounding procedures described below. Another form of relaxation is the combinatorial model relaxation, which is formulation as problem \eqref{spcutLD} by ignoring the orthogonality constraint and restricting $x\in\{0,1\}^{|\mathcal{V}|}$ instead of $x\in\mathbb{R}^{|\mathcal{V}|}$. An extensive study of the spectral and the combinatorial mode relaxation can be found in \cite{Hoc13}, while empirical comparisons between these relaxations are discussed in \cite{HLB13}. \subsection{Rounding} \label{subsec:rounding} In practice, the solution obtained by the spectral relaxation is unlikely to lie in $\{0,1\}^{|\mathcal{V}|}$, i.e., it is unlikely to be the indicator vector of a set. Therefore, it is necessary to have an efficient post-processing procedure where the solution is rounded to a set. At the same time it is important to guarantee that the rounded solution has good worst-case guarantees in terms of the conductance or sparsest cut objective. One of the most efficient and theoretically justified rounding procedures for spectral relaxation is the \emph{sweep cut}. The sweep cut procedure is summarized in the following steps. \begin{compactenum}\footnotesize \item Input: the solution $x\in\mathbb{R}^{|\mathcal{V}|}$ of \eqref{spcutLD}. \item Sort the indices of $x$ in decreasing order with respect to the values of the components of $x$. Let $i_1,i_2,\dots,i_{|\mathcal{V}|}$ be the sorted indices. \item Using the sorted indices generate a collection of sets $\mathcal{S}_{j}:=\{i_1,i_2,\dots,i_j\}$ for each $j\in \{1,2,\dots,|\mathcal{V}|\}$. \item Compute the conductance or sparsest-cut objective for each set $S_j$ and return the minimum. \end{compactenum} Notice that sweep cut can be used to obtain approximate solutions for both Sparsest-Cut and Minimum-Conductance. In fact, the proof for the upper inequalities of the approximation guarantees of spectral relaxation to Sparsest-Cut and Minimum-Conductance are obtained by using the sweep cut procedure \cite{LS88,SJ89}. \section{Regularization, $\ell_2$ versus $\ell_1$} In the previous section we followed a theoretical computer science perspective. We discussed tractable combinatorial problems, i.e., min-cut and $s$-$t$ min-cut, and NP-hard combinatorial problems, i.e., minimum conductance and isoperimetry. We discussed how to relax the latter NP-hard problems in order to obtain continuous versions that are ``good" approximations in terms of worst-case objective value. In this section we make a step back and study the regularization properties that are imposed by min-cut and certain spectral problems. Understanding the regularization properties that are imposed by each problem on the solution will allow us to understand the structure of the output solution in practice. In subsequent sections we will use the regularization problems by min-cut and spectral to understand what properties are imposed on the solution by current state-of-the-art local algorithms. \paragraph{Properties of $s$-$t$ Min-Cut} We now discuss regularization properties for the $s$-$t$ min-cut problem. Similar properties hold for min-cut since this is the best $s$-$t$ min-cut over all pairs of nodes in $\mathcal{V}$. It can be shown \cite{} that the following optimization problem \begin{align}\label{eq:mincutL1} \nonumber \mbox{minimize} & \quad \|Bx\|_{1,C}\\ \mbox{subject to} & \quad x_s =1, \ x_t = 0 \\\nonumber &\quad x\ge 0. \end{align} is equivalent to $s$-$t$ min-cut, which we introduced in Section \ref{subsec:mincutmaxflow}. The solution to $s$-$t$ min-cut is binary and lies in $[0,1]^{|\mathcal{V}|}$, see \cite{}. Thus, the solution defines a partition $S, S^c$. Since we assumed that the given graph has edges with unit-weights then the $s$-$t$ min-cut objective penalizes partitions $S,S^c$ that have many outgoing edges from $S$ to $S^c$. Intuitively, this implies that min-cut looks for partitions which have clear boundaries. For many applications, depending on the given graph such a property might be very important. Later on we will see that there are local algorithms which preserve this property close to a given input seed set. \paragraph{Properties of spectral} Let us now replace the $\ell_1$ norm in \eqref{eq:mincutL1} with the $\ell_2$ norm to obtain the following problem \begin{align}\label{eq:spectralL2} \nonumber \mbox{minimize} & \quad \|Bx\|_{2,C}\\ \mbox{subject to} & \quad x_s =1, \ x_t = 0 \\\nonumber &\quad x\ge 0. \end{align} From the preliminaries we know that $\|Bx\|_{2,C} = x^T L x$. This problem is related to spectral relaxation \eqref{spcutLD}. The only difference between \eqref{eq:spectralL2} and \eqref{spcutLD} is that we do not scale the $\ell_2$ norm in the constraint with the diagonal matrix $D$. This means that we do not put weights on nodes based on their degree, i.e., all nodes are of the same importance. Similarly to our discussion on spectral relaxation it can be shown that problem \eqref{eq:spectralL2} is a relaxation of the Minimum-Conductance and Minimum-Isoperimetry problems where all nodes are of the same importance. However, in this section our focus is the properties imposed by the $\ell_2$ norm and not the relaxation properties of problem \eqref{eq:spectralL2}. The solution to \eqref{eq:spectralL2} satisfies $$ L x = \lambda_2 x, $$ where $\lambda_2$ is the second smallest eigenvalue of $L$ for a unit-length eigenvector $x$. Since $L$ is the Laplacian operator of the given graph, then the eigenvector which satisfies the previous equation can be seen as the solution to a diffusion process. This means that the solution to problem \eqref{eq:spectralL2} is generally ``smooth", meaning that the values of the components of $x$ are in $\mathbb{R}$ and they are not binary. This is an important difference between \eqref{eq:mincutL1} and \eqref{eq:spectralL2}, which is due to the geometry that $\ell_1$ and $\ell_2$ norms define. Intuitively, the ``smoothness" of the solution given by spectral relaxation implies that we loose the property of \eqref{eq:mincutL1}, which is to preserve boundaries. If one takes a clustering perspective, then this drawback can be fixed by combining spectral with some sweep procedure which will possibly ignore components of $x$ with very small values, i.e., nodes outside the boundary. This two step-procedure is provably at most as good as \eqref{eq:mincutL1} if our objective is to find the best partition with the fewest outgoing edges. However, one should not conclude that using $\ell_1$ norm than $\ell_2$ defines a better geometry. The decision between $\ell_1$ and $\ell_2$ is application depended. If one wants to preserve boundaries then they should use the $\ell_1$ norm. If one wants to perform a diffusion on a given graph, then one should use the $\ell_2$ norm. \section{Locally-biased graph partitioning methods}\label{sec:localgraphpart} All of the algorithms described in Section~\ref{sec:global_cond_spcut} are ``global,'' in that they touch all of the nodes of the input graph at least once, and thus they have a running time that is at least linear in the size of the input graph. Informally, locally-biased graph clustering algorithms find clusters near a specified seed set of vertices, in many cases without even touching the entire input graph. In this section, we will describe several local graph clustering algorithms, each of which has somewhat different properties. To understand the seemingly-quite-different algorithms we will discuss, we will distinguish local graph clustering algorithms based on three major features. \begin{compactenum} \item \textit{Weakly or strongly local algorithms}. Weakly local algorithms are those that are biased toward a local part of the graph but may ``touch'' the entire input graph during the computation---i.e., they formally have running times that scale with the size of the graph. Strongly-local graph algorithms are those that only access a small portion of the entire input graph in order to perform their computation---i.e., they formally have running times that are linear in the size of the output or input set of nodes but independent of the size of the input graph. We show that the difference between weakly and strongly local algorithms often translates to whether we penalize the solution by adding an $\ell_1$ norm penalty implicitly to the objective function and/or by restricting the feasible region of the problem by adding implicitly a locality constraint. Both ways result in strongly local algorithms. \item \textit{Localizing bias.} Current local graph clustering algorithms are supervised, i.e., one has to give a reference set of seed nodes. We discuss two major ways that this information is incorporated in the problem. First, the bias to the input is incorporated in the objective function of the problem through a localizing construction we will call the \emph{reference cut graph}. Second, the bias to the input is incorporated to the problem as a constraint. \item \textit{$\ell_1$ and $\ell_2$ metrics.} The final major feature that distinguishes locally-biased algorithms is how the cut measure is treated. Via the cut metric~\cite{DezaLaurent97}, this can be viewed as embedding the vertices of $\mathcal{G}$ and evaluating their distance in the embedding. Two distances are explicitly or implicitly used in locally-biased algorithms: the $\ell_1$ and the $\ell_2$ metric spaces. The former results in local flow algorithms, and the latter results in local spectral algorithms. The distinction between these two is very important in practice, as we show by empirical evaluation in subsequent sections. \end{compactenum} \noindent The local graph clustering algorithms that we consider in the following sections and their basic properties with respect to the above three features are given in Table \ref{table1}. \begin{table} \centering \begin{tabular}{lcccc} \toprule \multicolumn{1}{c}{Methods} & Locality & Bias & Metric \\ \midrule Flow-Improve \cite{AL08_SODA} & Weak & Objective & $\ell_1$ \\ MOV \cite{MOV12_JMLR} & Weak & Constraint & $\ell_2$ \\ Local Flow-Improve \cite{OZ14} & Strong & Objective & $\ell_1$ \\ MQI \cite{kevin04mqi} & Strong & Constraint & $\ell_1$ \\ spectral MQI \cite{Chung07_localcutsLAA} & Strong & Constraint & $\ell_2$ \\ $\ell_1$-reg. Page-Rank \cite{ACL06,GM14_ICML} & Strong & Objective & $\ell_2$ \\ \bottomrule \end{tabular} \caption{State-of-the-art local graph clustering methods and their properties with respect to the three features that are discussed in Section \ref{sec:localgraphpart}.} \label{table1} \end{table} \subsection{A general localizing construction} We describe these locally-biased graph methods in terms of an augmented graph we call the \emph{reference cut graph}. We should emphasize that this is a conceptual construction to highlight the similarities and differences between locally-biased algorithms in Table~\ref{table1}---in particular, these algorithms do \emph{not} explicitly construct the reference cut graph. Let $h,g\in\mathbb{R}^{|\mathcal{V}|}$, $h,g\ge 0$, and $g-h \ge 0$, and let $\alpha$, $\beta$, and $\gamma$ be parameters specified below.. Then the reference cut graph is constructed from a simple, undirected graph $\mathcal{G}$ as follows: \begin{compactenum}\footnotesize \item Add a source and sink node $s$ and $t$. \item Add edges from $s$ to each node in $\mathcal{V}$. \item Add edges from each node in $\mathcal{V}$ to $t$. \item Weight each original edge by $\gamma$. \item Weight the edges from $s$ to $\mathcal{V}$ by $\alpha h$, where $\alpha \ge 0$. \item Weight the edges from $t$ to $\mathcal{V}$ by $\beta (g - h)$, $\beta \ge 0$. \end{compactenum} Let $H := diag(h)$, $G := diag(g)$ and $Z = G-H$. Then we can also view the augmented graph through its incidence matrix and weight matrix: \[ \tilde{B} = \begin{bmatrix} 1_{|\mathcal{V}|} & -I_{|\mathcal{V}|} & 0 \\ 0 & B & 0 \\ 0 & I_{|\mathcal{V}|} & -1_{|\mathcal{V}|} \end{bmatrix}, \ \tilde{C}= \begin{bmatrix} \alpha H & 0 & 0 \\ 0 & \gamma C & 0 \\ 0 & 0 & \beta Z \end{bmatrix}, \] respectively. The above construction might look overly complicated. However, we will see in the following subsections that it simplifies for local spectral and flow graph clustering algorithms with specific settings for $h,g$ and $\gamma$. \subsection{Weakly-Local and Strongly-Local flow methods} Although finding the set of minimum conductance is NP-hard in general, there are a number of cases and variations that admit polynomial time algorithms and can be solved via Max-Flow/Min-Cut or a parametric Max-Flow method. These algorithms begin with a reference set $R$ of nodes, and they return a smaller (or not much larger) set of nodes that is a better partition in terms of the conductance ratio $\phi$. Typically, the returned value is \emph{optimal} for a variation on the Minimum-Conductance and/or the Sparsest-Cut objective. The methods themselves are highly flexible and apply to other variations of Minimum-Conductance and Sparsest-Cut. For the sake of simplicity, we will describe them for conductance. All of the following procedures adopt the following meta-algorithm starting with working set $W$ initialized to an input reference set of nodes $R$, values $\alpha_1, \beta_1, \gamma_1$ and vectors $h = d_R$, $g=d$, where $d_R$ is a vector of length $|\mathcal{V}|$ with components equal to $d_i$'s for nodes $v_i\in R$ and zeros for nodes $v_i\in R^c$. Figure~\ref{fig:cut-graph} illustrates the construction of an augmented graph based on the previous setting of $\alpha,\beta,\gamma$ and $h,g$. \noindent \textbf{\footnotesize The Local-Flow Meta-algorithm} \begin{compactenum} \footnotesize \item Initialize $W_1 = R$, $k = 1$, $h=d_R$, $g=d$ and $\alpha_1, \beta_1, \gamma_1$ based on $R$. \item Create the reference cut graph $\tilde{B}_k, \tilde{C}_k$ based on $R$ and $\alpha_k, \beta_k, \gamma_k$. \item Solve the $s,t$-Min-Cut problem associated with $\tilde{B}_k,\tilde{C}_k$ \item Set $W_{k+1}$ to be the $s$-side of the cut \item\label{step:cond-or-variant} Check if $W_{k+1}$ has smaller conductance (or some variant of it, as we will make specific in the text below) than before and stop if not and return $W_k$ \item Update $\alpha_{k+1}, \beta_{k+1}, \gamma_{k+1}$ based on $W_{k+1}$ and $R$ \item Set $k \to k+1$ \item Repeat starting from state 2 \end{compactenum} \begin{figure} \subfigure[A simple graph]{\includegraphics[width=0.3\linewidth]{cut-graph-init}} \hfill \subfigure[Adding the source $s$ and sink $t$]{\includegraphics[width=0.3\linewidth]{cut-graph-1}} \hfill \subfigure[The reference cut graph, with weights indicated]{\includegraphics[width=0.3\linewidth]{cut-graph}} \caption{The construction of the reference cut graph begins by adding a source node $s$ connected to the reference set $R$ and a sink node $t$ connected to the rest of the graph. Then we add weights to the network based on the degrees and three parameters $\alpha, \beta, $ and $\gamma$. Each edge to the source node is weighted by $\alpha \cdot \text{degree}$, each edge to the sink node is weighted by $\beta \cdot \text{degree}$, and each internal edge is weighted by $\gamma$. Note that one of the choices of $\alpha, \beta, $ or $\gamma$ will be 1, but various papers adopt different choices, and so we leave it general.} \label{fig:cut-graph} \end{figure} Next, we describe several procedures that are instantiations of this basic Local-Flow Meta-algorithm. \paragraph{MQI} The first algorithm we consider is the MQI procedure due to Lang and Rao~\cite{kevin04mqi}. This method is designed to take the reference set $R$ with $\vol(R) \le \vol(G)/2$ and identify a subset of it $S \subseteq R$. The method instantiates the Local-Flow Meta-algorithm using $\alpha_k = \cut(W_k), \gamma_k = \vol(W_k), \beta_k = \infty$ and $h=d_R$, $g=d$.\ The idea with this method is that the reference cut graph will have an $s,t$-Min-Cut value strictly less than $\alpha_k \gamma_k$ if and only if there is a strict subset $S \subset W_k$ that has conductances less than $\alpha_k / \gamma_k$. (See~\cite{kevin04mqi} for the proof.) If there is such a set, then the result $W_{k+1}$ will be a set with conductance less than $\alpha_k / \gamma_k$. Since $\alpha_k$ and $\gamma_k$ are picked based on the current working set $W_k$, at each step the algorithm monotonically improves the conductance. Also, each step minimizes the objective \begin{align*} \mbox{minimize} & \; \| \tilde{B}x \|_{1,\tilde{C}_k} \label{eq:mqi-l1} \\ \mbox{subject to} & \; x_i = 0 \ \forall v_i\in R^c, x_s = 1, x_t = 0. \end{align*} In fact, when the algorithm terminates, that means that there is no subset of $R$ with conductance less than $\alpha_k / \gamma_k$. Hence, we have solved the following variation on the conductance problem \begin{align*} \mbox{minimize} & \; \phi(S)= \frac{\cut(S)}{\vol(S)} \\ \mbox{subject to} & \; S \subseteq R. \end{align*} The key difference from the standard conductance problem is that we have restricted ourselves to a \emph{subset} of the reference set $R$. Procedurally, this is guaranteed because the edges connecting $R^c$ to $t$ have weight infinity, so they will never be cut. Thus, operationally, MQI is always a strongly local algorithm since it only operates within the input seed set $R$. Nodes connected to $t$ with weight infinity can be agglomerated or merged into a mega-sink node $T$. The resulting graph has the same size as $R$ along with the source and sink. (This is how the MQI construction is described in the original paper.) The MQI problem can be solved using Max-Flow method on the resulting graph a logarithmic number of times \cite{kevin04mqi}. Therefore, the running time for solving MQI depends on the Max-Flow algorithm that is used. Details about running times of Max-Flow algorithms can be found in~\cite{GT14}. \paragraph{Flow-Improve} The Flow-Improve method due to Andersen and Lang~\cite{AL08_SODA} was inspired by MQI and designed to address the weakness that the algorithm will always find an output set within the reference set $R$, i.e., that is a subset of $R$. (As an illustration, see Figure~\ref{fig:mqi-vs-flow-improve}.) Again, Flow-Improve takes as input a reference set $R$ with volume less than half the graph. The idea behind Flow-Improve is that we want to find a set with conductance at least as good as $R$ and that also is highly correlated with $R$. To do this, consider the following variant of conductance \[ \phi_R(S) = \frac{\cut(S)}{\vol(S \cap R) - \theta \vol(S \cap R^c)} \] where $\theta = \vol(R)/\vol(R^c)$, and where the value is $\infty$ if the denominator is negative. For any set $S$, $\phi_R(S) \ge \phi(S)$. Thus, this modified conductance score is an upper-bound on the true conductance. Again, we are able to show that the Local-Flow Meta-algorithm can solve for the exact value of $\phi_R(S)$ in polynomial time. To do so, instantiate that algorithm with $\alpha_k = \phi_R(W_k)$, $\beta_k = \theta \phi_R(W_k)$, $\gamma_k = 1$ and $h=d_R$, $g=d$.\ The value of a cut on set $S$ in the resulting graph is \[ \cut(S) + \alpha_k \vol(R) - \alpha_k [\vol(S \cap R) - \theta \vol(S \cap R^c)]. \] (See~\cite{AL08} for the justification.) Andersen and Lang show that the algorithm monotonically reduces $\phi_R(W_{k})$ at each iteration as well. Each iteration now solves the $s,t$-Min-Cut problem \begin{align} \mbox{minimize} & \; \| \tilde{B}x \|_{1,\tilde{C}_k} \label{eq:FlowImprove} \\ \mbox{subject to} & \; x_s = 1, x_t = 0. \nonumber \end{align} In order to match precisely their Flow-Improve procedure, we would need to modify our Meta-algorithm to check the value of $\phi_R(W_k)$, instead of conductance (at Step~\ref{step:cond-or-variant} of the Local-Flow Meta-algorithm above), for monotonic decrease. The authors also show that this procedure terminates in a finite number of iterations. At termination, the Flow-Improve algorithm has exactly solved $\mbox{minimize} \; \phi_R(S), S \subseteq V$. This can be considered a locally-biased variation of the conductance objective, where we penalize departure from the reference set $R$. Consequently, the solutions will tend to identify small conductance sets nearby $R$. Flow-Improve is a very useful algorithm, but it has two small weaknesses. The first is that it is a weakly local algorithm. At each step, we have to solve a Min-Cut problem that is the size of the original graph. The second is that the Min-Cut problems do not have integer weights. (Note that $\theta$ will almost never be an integer.) Most fast Max-Flow/Min-Cut procedures and implementations assume integer weights. For instance, many implementations of the push-relabel method (hipr~\cite{goldberg95_push}) only allows integer weights. Boykov and Kolmogorov's solver is a notable exception~\cite{Boykov-2004-maxflow}. Similarly to MQI, the running time of solving the Max-Flow/Min-Cut problem depends on the particular solver that is used. A summary of Max-Flow/Min-Cut methods can be found in \cite{GT14}. \begin{figure} \centering \subfigure[MQI]{\includegraphics[width=0.30\linewidth,trim=80mm 33mm 00mm 57mm,clip]{U3A-mqi-spectral}} \subfigure[Flow-Improve]{\includegraphics[width=0.30\linewidth,trim=80mm 33mm 00mm 57mm,clip]{U3A-flow-improve-spectral}} \subfigure[The difference]{\includegraphics[width=0.30\linewidth,trim=80mm 33mm 00mm 57mm,clip]{U3A-flow-improve-mqi-diff}} \caption{The results of running MQI and Flow-Improve on the reference set produced by a spectral partitioning method on the geometric graph (i.e., run global spectral \S\ref{subsec:spcut}; then round with a sweep-cut \S\ref{subsec:rounding}; and then refine using MQI and Flow-Improve). The Flow-Improve method identifies the optimal set from Figure~\ref{fig:small-cluster} in this case, whereas MQI cannot because it searches only within the given set $R$.} \label{fig:mqi-vs-flow-improve} \end{figure} \paragraph{Local-Flow-Improve} The Local-Flow-Improve algorithm due to Orecchia and Zhu~\cite{OZ14} sought to address the weak-locality of the Flow-Improve method and create a strongly local flow based method. This involved two key innovations: a modification to the construction and objective that enables strong locality; and an algorithm to realize that strong locality. This Local-Flow-Improve method essentially interpolates between MQI and Flow-Improve. In one limit, it is strictly local to the reference graph and exactly reproduces the MQI output. In the other limit, it is exactly Flow-Improve. To do this, Orecchia and Zhu alter the objective function used for Flow-Improve to place an additional penalty on deviating from the set $R$. They describe this as increasing the weight of connections $\beta_k$ in the reference cut graph by scaling these by a value $\kappa \ge 1$. If $\kappa = 1$, then their construction is exactly that of Flow-Improve. If $\kappa = \infty$, then this construction is equivalent to that of MQI. The effect of $\kappa$ is illustrated in Figure~\ref{fig:local-flow-improve}. In terms of the optimization framework, their modification corresponds to using \[ \phi_R'(S;\kappa) = \frac{\cut(S)}{\vol(S \cap R) - \theta \kappa \vol(S \cap R^c)} \ \] where $\kappa \ge 1$ and $\theta = \vol(R)/\vol(R^c)$ as in Flow-Improve, and again the value is $\infty$ if the denominator is negative. This result corresponds to instantiating the Local-Flow Meta-algorithm using $\alpha_k = \phi_R'(W;\kappa)$, $\beta_k = \phi_R'(W;\kappa) \theta \kappa$ and $h=d_R$, $g=d$. The second innovation is that they describe an algorithm to solve the Min-Cut problem on the reference cut graph that does not need to explore the entire graph. This second piece used a novel modification of Dinic's procedure~\cite{D70} to compute a Max-Flow/Min-Cut that exploited the locality. We refer interested readers back to Orecchia and Zhu for details of this second somewhat complicated construction. In our recent work~\cite{Veldt-preprint-simple-local-flow}, however, we describe a simplified framework for the Local-Flow-Improve method that shows that the strong locality in their modification results from implicitly regularizing the Flow-Improve objective with a $\ell_1$ norm regularizer. (This will mirror strongly local spectral results in the forthcoming spectral section.) In fact, our recent work~\cite{Veldt-preprint-simple-local-flow} shows that each iteration exactly solves \begin{align} \mbox{minimize} & \; \| \tilde{B} x\|_{1,\tilde{C}_k'} + \varepsilon \| D x \|_1 \label{eq:FlowImprove-l1} \\ \mbox{subject to} & \; x_s = 1, x_t = 0, \nonumber \end{align} where $\tilde{C}_k'$ is a small perturbation on the above definition and $\varepsilon$ is a locality parameter. The volume of the output cluster $S$ of the method in \cite{Veldt-preprint-simple-local-flow} is bounded $\vol(S) \le \vol(R)(1+2/\epsilon) + E(R,R^c)$, where $\epsilon:= \vol(R)/\vol(R^c) + \delta$ and $\delta\ge 0$ is a constant. That work also describes a simple procedure to realize the strong locality that leverages any Max-Flow/Min-Cut solver on a sequence of sub-problems whose size is bounded independent of the graph. \begin{figure} \subfigure[Reference set $R$.]{\includegraphics[trim=0 60mm 90mm 10mm, clip,width=0.24\linewidth]{U3A-flow-improve-1-R}} \subfigure[The Flow-Improve result.]{\includegraphics[trim=0 60mm 90mm 10mm, clip,width=0.24\linewidth]{U3A-flow-improve-1-0}} \subfigure[Local-Flow-Improve $\kappa \!= \! e^3$]{\includegraphics[trim=0 60mm 90mm 10mm, clip,width=0.24\linewidth]{U3A-flow-improve-1-3}} \subfigure[Local-Flow-Improve $\kappa \!= \! e^5$]{\includegraphics[trim=0 60mm 90mm 10mm, clip,width=0.24\linewidth]{U3A-flow-improve-1-5}} \caption{The results of running Flow-Improve compared with Local-Flow-Improve with a reference set $R$. The Flow-Improve result returns a fairly large set whereas the Local-Flow-Improve results produce successively smaller sets as the penalty $\kappa$ increases. When $\kappa = e^5$ then the result simply fills in the hole in the reference~set.} \label{fig:local-flow-improve} \end{figure} \subsection{Weakly-and-Strongly local spectral methods} There are spectral analogues for each of the three flow-based constructions on the augmented graph. The development of these ideas occurred in parallel, largely independently, and it was not obvious until recently that the ideas were very related. Here, we make these connections explicit. Of the three flow constructions, the simplest is the MQI objective. We begin with it. \paragraph{SpectralMQI} The method we call SpectralMQI was proposed as the Dirichlet partitioning problem in~\cite{Chung07_localcutsLAA}. Given a graph $\mathcal{G}$ and a subset of vertices, consider finding the set $S$ of minimal local conductance $\phi'(S) = \cut(S)/\vol(S)$ such that $S \subseteq R$, where, again, $R$ is a reference set specified in the input. Note that the only difference from conductance is that we don't have the minimum in the denominator. A spectral algorithm to find an approximate minimizer of this is to solve the generalized eigenvector problem \begin{align*} \lambda_R = \mbox{minimize} & \quad \frac{\|Bx\|_{2,C}^2}{\|x\|_{2,D}^2} \\ \mbox{subject to} &\quad x_{i} = 0 \ \forall v_i \in R^c. \end{align*} The solution vector $x$ and value $\lambda_R$ are related to the smallest eigenvalue of the sub-matrix of the normalized Laplacian corresponding to the nodes in $R$. (Note that we take the sub-matrix of the normalized Laplacian, rather than the normalized Laplacian on the sub-graph induced by $R$.) A sweep-cut over the eigenvector $x$ produces a set $S$ that satisfies a Cheeger inequality with respect to the best possible solution~\cite{Chung07_localcutsLAA}. This definition of local conductance is also called $\texttt{NCut'}$ by Hochbaum~\cite{Hochbaum-2010-ncutp}, who gave a polynomial time algorithm to compute it that is closely related to the MQI procedure. In this case, if $R$ has volume less than half the graph, then this is exactly the spectral analogue of the MQI procedure and the result is a Cheeger-like bound on the overall conductance. \paragraph{MOV} The Mahoney-Orecchia-Vishnoi (MOV) objective~\cite{MOV12_JMLR} is a spectral analogue of the FlowImprove method, with a few subtle differences. The goal is to find a small Rayleigh quotient, as in \eqref{spcutLD}, that is highly correlated with an input vector $z\in\mathbb{R}^{|V|}$, where $z$ represents the seed or local-bias. Given this, the MOV objective is \begin{align*} \mbox{minimize} & \ \frac{\|Bx\|_{2,C}^2}{\|x\|_{2,D}^2} \\\nonumber \mbox{subject to} &\ 1_{|\mathcal{V}|}^T D x = 0 \\\nonumber &\ (z^T D x)^2 \ge \kappa &\ x\in\mathbb{R}^{\mathcal{V}}. \end{align*} The solution of this problem represents an embedding of the nodes in $\mathcal{V}$ which is locally biased, i.e., large values for components/nodes that are considered important and small or zero values for the rest. According to \cite{MOV12_JMLR}, there is a constant $\rho$, i.e., the optimal dual variable for the locally-biased constraint, such that the solution to the MOV problem satisfies $ (L+\rho D) x = \rho D z$.\ The null space of $L$ is the vector $1_{|\mathcal{V}|}$, and assuming that $1_{|\mathcal{V}|}Dz = 0$, then the solution to the previous system is unique. One final detail is that the MOV construction fixes $\| x \|_2 = 1$. Consequently, the MOV solution is \begin{equation} \label{eq:mov} x = c (L + \rho D)^\dagger D z \quad c = (\| (L + \rho D)^\dagger D z \|_2)^{-1}. \end{equation} In the MOV paper~\cite{MOV12_JMLR}, they show that $\rho$ can be chosen such that $x^T D z = \kappa$, the desired correlation strength with the input vector $z$, through a simple bisection procedure. Solving the linear system \eqref{eq:mov} results in a weakly-local method that satisfies another Cheeger-like inequality. Recent extensions show that it is possible to get multiple locally-biased vectors that are akin to eigenvectors from this setup~\cite{HM14_JRNL,LBM16_TR}. The methodology is able to leverage the large number of Laplacian system solvers \cite{V12} that can find an approximate solution to \eqref{eq:mov} in nearly linear time. The pseudo-inverse allows us to ``pass through'' $\rho = 0$ and approach $\rho = -\lambda_2$. (This system is singular at $\rho = 0$ and $\rho = \lambda_2$.) What is interesting is that taking the limit $\rho \to -\lambda_2$ directly maps to the spectral relaxation~\eqref{spcutLD}. Thus, the $\rho$ parameter interpolates between the global spectral relaxation~\eqref{spcutLD} and a spectral-version of the Min-Cut problem in each step of FlowImprove. Based on the reference cut graph, the MOV objective is $\mbox{minimize} \ \|\tilde{B}\tilde{x}\|_{2,\tilde{C}}^2$, where $\tilde{x} : = [1; x; 0]$. The reference graph cut setting is $\gamma=1$, $g=d$, $h=Dz$ and $\alpha=\beta=\rho\ge0$ controls the desired strength of the correlation to the input vector $z$.\ Notice that the MOV problem is a spectral, i.e., $\ell_2$, version of the $s,t$-Min-Cut problem. This observation was made first in \cite{GM14_ICML,GM15_KDD}. If $\rho$ is extremely large, the solution to the above problem would have perfect correlation with the input vector $h$. As $\rho \to 0$, we decrease the effective correlation with the input vector $h$. (These arguments are formal in~\cite{MOV12_JMLR}.) \section{Preliminaries and Notation} \label{sec:prelim} \textbf{Graph assumptions:} We use the letter $\mathcal{G}$ to denote a given connected graph. We assume that $\mathcal{G}$ is undirected with no self-loops. Many of the constructions we will use operate on \emph{weighted graphs} and so we assume that each edge may have a positive capacity. Graphs that are unweighted should have all of their capacities set to $1$. \textbf{Nodes, edges and cuts:} Let $\mathcal{V} = \{v_1,v_2\dots,v_n\}$ be a given set of $|\mathcal{V}|$ nodes of graph $\mathcal{G}$. We denote with $e_{ij}$ an edge in the graph between nodes $v_i$ and $v_j$. Let $\mathcal{E}$ be a given set of $|\mathcal{E}|$ edges of graph $\mathcal{G}$. A subset $S\subset\mathcal{V}$ of nodes can be used to define a partitioning of $\mathcal{V}$ into $S$ and $S^c:=\mathcal{V} \backslash S$. We define a cut as subset $E \subset \mathcal{E}$ which partitions the graph $\mathcal{G}$ into two sets. Given a partition $S\subset\mathcal{V}$ and $S^c$, then $E(S,S^c)=\{e_{ij}\in \mathcal{E} \ | \ v_i\in S \mbox{ and } v_j\in S^c\}$ is the set of edges with one side in $S$ and the other side in $S^c$. If the partition is clear from the context we write the cut set as $E$ instead of $E(S,S^c)$.\ Let $c_{ij}$ be a weight of the edge $e_{ij}$, then we define the cut $S$ as \begin{equation} \cut(S) := \cut(E(S,S^c)) := \sum_{e_{ij}\in E(S,S^c)} c_{ij}. \end{equation} The volume of a set $S$ is \begin{equation} \vol(S) := \sum_{v_i \in S} \sum_{e_{ij} \in \mathcal{E}} c_{ij}. \end{equation} For simplicity of notation, we will drop the input $\mathcal{G}$ in $\mathcal{V}$ and $\mathcal{E}$ if it is clear from the context that we are referring to a single graph $\mathcal{G}$. \textbf{Matrix notation:} We denote with $A\in\mathbb{R}^{|\mathcal{V}|\times |\mathcal{V}|}$ the adjacency matrix for a given graph, where $A_{ij} = c_{ij}$ $\forall e_{ij}\in \mathcal{E}$ and zero elsewhere. Let $d_i$ be the degree of node $v_i\in\mathcal{V}$, $D\in\mathbb{R}^{|\mathcal{V}|\times |\mathcal{V}|}$ be the degree diagonal matrix $D_{ii} = d_i$, $L=D-A$ be the graph Laplacian, and $\mathcal{L} = D^{-1/2}LD^{-1/2}$ be the symmetric normalized graph Laplacian. Note that the volume of a subset $S$ is $\vol(S) = \sum_{v_i\in S} d_{i}$. We denote with $B\in\mathbb{R}^{|\mathcal{E}|\times |\mathcal{V}|}$ the incidence matrix of the given graph $\mathcal{G}$. Every row of the incidence matrix corresponds to an edge $e_{ij}\in \mathcal{E}$ in $\mathcal{G}$. Assuming arbitrary ordering of the edges of the graph, in this paper we define the rows of the incidence matrix as $B_{e_{ij}} = e_i - e_j$ $\forall e_{ij}\in \mathcal{E}$, where $e_i\in\mathbb{R}^{|\mathcal{V}|}$ is equal to one at the $i^{th}$ position and zero elsewhere. Finally, $C\in\mathbb{R}^{|\mathcal{E}|\times|\mathcal{E}|}$ is a diagonal matrix of the weights of each edge, i.e., $C_{ij} = c_{ij}$ $\forall i,j$. In this notation, the Laplacian matrix $L = B^T C B$. \textbf{Norms:} For all $x \in \mathbb{R}^{|\mathcal{E}|}$, we define the weighted $\ell_1$ and $\ell_2$ norms $\|x\|_{1,C}: = \sum_{e_{ij}\in E} c_{ij} |x_{ij}|$ and $\|x\|_{2,C}^2: = \sum_{e_{ij}\in E} c_{ij} |x_{ij}|^2$, respectively. Given a partition $S,S^c$ and a vector $x\in\{0,1\}^{|\mathcal{V}|}$ such that $x_i=1$ if $v_i\in S$ and $x_i = 0$ if $v_i\in S^c$, then $\cut(S) = \|Bx\|_{1,C}$. Moreover, notice that $\cut(S) = \|Bx\|_{2,C}^2 = x^T B^T C B x = x^T L x$. \textbf{Miscellaneous:} We use $[x;y;z]$ to denote a single column vector where the individual vectors $x,y,z$ are stacked in this order. Finally, the vectors $0_{|\mathcal{V}|}$ and $1_{|\mathcal{V}|}$ are the all zeros and ones vectors of length $|\mathcal{V}|$, respectively. \subsection{Strongly-local flow and spectral methods} \paragraph{$\ell_1$-Regularized Page-Rank} The $\ell_1$-regularized Page-Rank problem was initially studied in \cite{GM14_ICML} and then further refined in \cite{FCSRM16_TR}. In the latter work, the problem is defined as \begin{align}\label{eq:l1pr} \mbox{minimize} & \quad \frac{1}{2}\|\tilde{B}\tilde{x}\|_{\tilde{C},2}^2 + \epsilon \|Dx\|_1, \end{align} where $\tilde{x} : = [1; x; 0]$.\ The reference cut graph setting for \eqref{eq:l1pr} is $g=d$ and $h\ge 0$ is a vector that satisfies $\|h\|_1=1$ and $\|h\|_\infty \ge \epsilon$.\ The latter condition is to guarantee that the solution to \eqref{eq:l1pr} is not the zero vector. Moreover, $\alpha = \beta $ and $\gamma = (1-\alpha)/2$. Similarly to $z$ for MOV, the vector $h$ controls the input seed set and the weights of nodes in that set. The larger the weights the more the solution will be correlated with the corresponding nodes in the input seed set. The solution vector to problem \eqref{eq:l1pr} is component-wise non-negative and the parameter $\alpha$ controls how much energy is concentrated close to the input seed set. Formally, based on theoretical guarantees in \cite{ACL06} the vector $h$ should be an indicator vector for a single seed node, around which there is a target cluster of nodes $C$. The algorithm is not guaranteed to find the exact target cluster $C$, but if $C$ has conductance less than $\alpha/10$ then it is guaranteed to return a cluster with conductance of $\mathcal{O}(\sqrt{\alpha \log(\vol(C))})$. We refer the reader to \cite{ACL06} for a detailed description of the theoretical graph clustering guarantees. The idea of $\ell_1$-regularized Page-Rank graph clustering initially appeared in \cite{ACL06} in the form of implicit regularization. In particular, the authors in \cite{ACL06} suggest solving a personalized Page-Rank linear system approximately. In \cite{FCSRM16_TR,GM14_ICML}, the authors noticed that the termination criteria in \cite{ACL06} are related to the first-order optimality conditions of the above $\ell_1$-regularized Page-Rank problem, and they draw the connection to explicit $\ell_1$ regularization. It is shown in \cite{FCSRM16_TR} that solving the $\ell_1$-regularized Page-Rank problem has the same Cheeger-like worst-case approximation guarantees to the Minimum-Conductance problem as the original procedure in \cite{ACL06}. However, there is an important technical difference: one advantage of solving the $\ell_1$-regularized problem is that the locality of the solution is a property of the optimization problem as opposed to a property of an algorithm. In particular, by solving the $\ell_1$-regularized problem it is guaranteed to obtain the same solution regardless of the algorithm used. In comparison, applying the procedure in \cite{ACL06}, where the output depends on the setting of the procedure, i.e., the strategy for choosing nodes to be updated at every iteration, leads to somewhat different solutions, depending on the specific settings chosen. Let $x^*$ be the optimal solution of \eqref{eq:l1pr} and $S^*$ be the set of nodes where $x^*$ is non-zero. In \cite{FCSRM16_TR}, it is shown that many standard optimization algorithms such as iterative soft-thresholding or block iterative soft-thresholding solve \eqref{eq:l1pr} with running time $\mathcal{O}(\vol(S^*)/\alpha)$, which can be independent of the volume of the whole graph $\vol(\mathcal{V})$. This opens up the possibility of the use of these algorithms more generally. For details about the algorithms, we refer the reader to~\cite{FCSRM16_TR}.
{'timestamp': '2016-12-06T02:08:31', 'yymm': '1607', 'arxiv_id': '1607.04940', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04940'}
arxiv
\section{Introduction} \begin{quotation} \textit{``One Picture is Worth a Thousand Words''}\\ \hspace*{\fill} [An advertisement for the \textit{San Antonio Light} (1918)] \end{quotation} Teaching undergraduate \textit{Analysis of Algorithms} has been a rewarding, although a bit taxing, experience. I was often surprised to learn that many basic problems that clearly belong to its core syllabus had been left unanswered or partially answered. Also, it seemed a bit odd to me that many otherwise decent texts offered unnecessarily imprecise computations\footnote{A notable exception in this category is \cite{sedfla:ana}.} of several rather fundamental results. \medskip In this article, I pursue a seemingly marginal topic, the best-case behavior of a well-known sorting algorithm $ {\tt MergeSort} $, which pursuit, however, yields some interesting findings that could hardly be characterized as \textit{``marginal.''} It turns out that - contrary to what a casual student of this subject might believe - computing the exact formula for the number of comparisons of keys that $ {\tt MergeSort} $ performs on any $ n $-element array in the best case is not a routine exercise and leads to a problem that gained some notoriety for being a hard nut to crack analytically: the \textit{sum of digits} problem. Even more unexpectedly, a relatively straightforward\footnote{Although not quite \textit{closed-form}.} formula for the said number of comparisons yields an improvement of a well-known answer to this instance of the \textit{sum of digits} problem: \begin{quote} How many $ 1 $s appear in binary representations of all integers between (but not including) $ 0 $ and $ n $? \end{quote} \section{$ {\tt MergeSort} $ and its best-case behavior} \label{sec:mergsor} A call to $ {\tt MergeSort} $ inherits an $ n $-element array $ {\tt A} $ of integers and sorts it non-decreasingly, following the steps described below. \begin{algMergeSort} \label{alg:mersor} To sort an $ n $-element array $ {\tt A} $ do: \begin{enumerate} \item \label{alg:mersor:item1} If $ n \leq 1 $ then return $ {\tt A} $ to the caller, \item \label{alg:mersor:item2} If $ n \geq 2 $ then \begin{enumerate} \item \label{alg:mersor:item2:it1} pass the first $ \lfloor \frac{n}{2} \rfloor $ elements of $ {\tt A} $ to a recursive call to $ {\tt MergeSort} $, \item pass the last $ \lceil \frac{n}{2} \rceil $ elements of $ {\tt A} $ to another recursive call to $ {\tt MergeSort} $, \item \label{alg:mersor:item2:it2} linearly merge, by means of a call to $ {\tt Merge} $, the non-decreasingly sorted arrays that were returned from those calls onto one non-decreasingly sorted array $ {\tt A}^{\prime} $, \item \label{alg:mersor:item2:it3} return $ {\tt A}^{\prime} $ to the caller. \end{enumerate} \end{enumerate} \end{algMergeSort} A Java code of $ {\tt Merge} $ is shown on the Figure~\ref{fig:Merge}. \begin{figure}[h] \centering \includegraphics[width=0.7\linewidth]{./Merge1} \includegraphics[width=0.7\linewidth]{./Merge2} \caption{A Java code of $ {\tt Merge} $, based on a pseudo-code from \cite{baa:ana}. Calls to $ {\tt Boolean} $ method $ {\tt Bcnt.incr()} $ count the number of comps.} \label{fig:Merge} \end{figure} \medskip A typical measure of the running time of $ {\tt MergeSort} $ is the number of \textit{comparisons of keys}, which for brevity I call \textit{comps}, that it performs while sorting array $ {\tt A} $. Since no comps are performed outside $ {\tt Merge} $, the running time of $ {\tt MergeSort} $ can be computed as the sum of numbers of comps performed by all calls to $ {\tt Merge} $ during the execution of $ {\tt MergeSort} $. Since the minimum number of comps performed by $ {\tt Merge} $ on two list is equal to the length of the shorter list, and any increasingly sorted array on any size $ N \geq 2 $ produces only best-case scenarios for all subsequent calls to $ {\tt Merge} $, a rudimentary analysis of the recursion tree for $ {\tt MergeSort} $ easily yields the exact formula for the minimum number of comps for the entire $ {\tt MergeSort} $. The problem arises when one tries to reduce the said formula, which naturally involves long summations, to one that can be evaluated in a logarithmic time. \subsection{Recursion tree} \label{subsecsec:rectre} The obvious recursion tree for $ {\tt MergeSort} $ and sufficiently large $ n $ is shown on Figure~\ref{fig:rectre}. \begin{figure} [h] \includegraphics[scale=.15]{RecTreeMergeSort4.JPG} \caption{\label{fig:rectre} A sketch of the recursion 2-tree $ T $ for $ {\tt MergeSort} $ for a sufficiently large $ n $, with levels shown on the left and the numbers of nodes shown on the right. The nodes correspond to calls to $ {\tt MergeSort} $ and show sizes of (sub)arrays passed to those calls. The last level is $ h $; it only contains nodes with value 1. The root corresponds to the original call to $ {\tt MergeSort} $. If a call that is represented by a node $ p $ executes further recursive call to $ {\tt MergeSort} $ then these calls are represented by the children of $ p $; otherwise $ p $ is a leaf.} \end{figure} A recursive application of the equality\footnote{It can be verified separately for odd and even values of $ n $.} \begin{equation} \label{eq:n/2=n+1/2} \lceil \frac{n}{2}\rceil = \lfloor \frac{n+1}{2}\rfloor \end{equation} allows for rewriting of that tree onto one whose first four levels are shown on Figure~\ref{fig:rectre1}. \begin{figure} [h] $ \,\,\,\,\,\,\,\, \,\,\,\,\,\,\,\, \,\,\,\,\,\,\,\, $\includegraphics[width=.75\linewidth]{RecursionTreeSimpleNarrowerColored} \caption{\label{fig:rectre1} The first four levels of the recursion 2-tree $ T $ from Figure~\ref{fig:rectre}, with the equality (\ref{eq:n/2=n+1/2}) applied, recursively. The number of comparisons of keys performed in the best case by $ {\tt Merge} $ invoked in step~\ref{alg:mersor:item2:it2} of Algorithm~\ref{alg:mersor} as a result to a call to $ {\tt MergeSort} $ corresponding to a node of $ T $ is equal to the number that is shown in its left child, highlighted yellow. All the right children at level $ k \geq 1 $ of $ T $ show numbers of the form $ \lfloor \frac{n+i}{2^{k+1}} \rfloor $, where $ i \geq 2^k $. Thus all the left children (highlighted yellow) at level $ k \geq 1$ show numbers of the form $ \lfloor \frac{n+i}{2^{k+1}} \rfloor $, where $ i < 2^k $.} \end{figure} \subsection{Best-case and its characterization $ B(n) $} \label{subsec:bestchar} The best-case arrays of sizes $ \lfloor \frac{n}{2} \rfloor $ and $ \lceil \frac{n}{2} \rceil $ for $ {\tt Merge} $, where $ n \geq 2 $, are those in which every element of the first array is less than all elements of the second one. In such a case, $ {\tt MergeSort} $ performs $ \lfloor \frac{n}{2} \rfloor $ of comps. \medskip \medskip Thus the following recurrence relation for the least number $ B(n) $ of comparisons of keys that $ {\tt MergeSort} $ performs on any $ n $-element array is straightforward to derive from its description given by Algorithm~\ref{alg:mersor}. \begin{equation} \label{eq:rec_rel1} B(1) = 0, \end{equation} and, for $ n \geq 2 $, \begin{equation} \label{eq:rec_rel2} B(n) = \lfloor \frac{n}{2}\rfloor + B( \lfloor \frac{n}{2}\rfloor) + B( \lceil \frac{n}{2}\rceil). \end{equation} Using the equality (\ref{eq:n/2=n+1/2}), the recurrence relation (\ref{eq:rec_rel2}) is equivalent to: \begin{equation} \label{eq:rec_rel3} B(n) = \lfloor \frac{n}{2}\rfloor + B( \lfloor \frac{n}{2}\rfloor) + B( \lfloor \frac{n+1}{2}\rfloor) . \end{equation} A graph of $ B(n) $ is shown on Figure~\ref{fig:Best-case_rec_solution}. \begin{figure} [h] \centering \includegraphics[width=0.7\linewidth]{Best-case_MergeSort_old_rec_solution} \caption{Graph of the solution $ B(n) $ of the recurrence \eqref{eq:rec_rel1} and \eqref{eq:rec_rel2}.} \label{fig:Best-case_rec_solution} \end{figure} \medskip Unfolding the recurrence (\ref{eq:rec_rel3}) allows for noticing that the minimum number $ B(n) $ of comps performed by all calls to $ {\tt Merge} $ is equal to the sum of all values shown at nodes highlighted yellow in the recursion tree $ T $ of Figure~\ref{fig:rectre1}. They may be summed-up level-by-level. One can notice from Figure~\ref{fig:rectre1} that the number of comps performed at any level $ k $ with the maximal number $ 2^k $ of nodes is given by this formula: \begin{equation} \label{eq:formula_level_i} \sum _{i=0} ^{2^k-1} \lfloor \frac{n+i}{2^{k+1}} \rfloor . \end{equation} What is not clear is whether all levels of the recursion tree $ T $ are maximal. Fortunately, the answer to this question does not depend on whether given instance of $ {\tt MergeSort} $ is running on a best-case array or on any other case of array. It has been known form a classic analysis of the worst-case running time of $ {\tt MergeSort} $ that every level of its recursion tree $ T $ that contains at least one non-leaf, or - in other words - a node that shows value $ p \geq 2 $, is maximal. \ref{sec:mergesort} page~\pageref{sec:mergesort} contains a detailed derivation of that fact. Thus all levels 0 through $ h-1 $ of $ T $ are maximal. Therefore, the formula (\ref{eq:formula_level_i}) gives the number of comps for every level $ 0 \leq k \leq h-1 $. \medskip The last level $ h $ of $ T $ may be not maximal because the level $ h-1 $ may contain leaves, or - in other words - nodes that show value $ p = 1 $, where $ p = \lfloor \frac{n+i}{2^{h-1}} \rfloor $ for some $ 0 \leq i \leq 2^{h-1} - 1 $, and as such do not have any children in level $ h $. However, for each such node the value of $ \lfloor \frac{p}{2} \rfloor = \lfloor \frac{n+i}{2^{h}} \rfloor $ is 0, so it can be included in summation (\ref{eq:formula_level_i}) without affecting its value even though the said value does not correspond to any node in level $ h $. Therefore, the formula (\ref{eq:formula_level_i}) gives the number of comps for level $ k = h $. \medskip Also, the depth of $ T $ is $ \lfloor \lg n \rfloor $, as the Theorem~\ref{thm:depthRectree} page \pageref{thm:depthRectree} in \ref{sec:excerpts} states. Thus the minimum number of comps performed by $ {\tt MergeSort} $ is given by this formula: \begin{equation} \label{eq:formula1} \sum _{k=0} ^{\lfloor \lg n \rfloor} \sum _{i=0} ^{2^k-1} \lfloor \frac{n+i}{2^{k+1}} \rfloor . \end{equation} Unfortunately, the summation~(\ref{eq:formula1}) contains $ n - 1 $ non-zero terms, so it cannot be evaluated quickly in its present form. Fortunately, its inner summation (\ref{eq:formula_level_i}) can be reduced to a closed-form formula. \subsection{\textit{Zigzag} function} \label{subsec:zig} In order to reduce (\ref{eq:formula_level_i}) to a closed form, I am going to use function \textit{Zigzag} defined by: \begin{equation} \label{eq:def_zigzag} \mbox{\textit{Zigzag}}\,(n) = \min (x - \lfloor x \rfloor, \lceil x \rceil - x) . \end{equation} The following fact is instrumental for that purpose. \medskip \begin{thm} \label{thm:formula_level_Zigzag} For every natural number n and every positive natural number m, \begin{equation} \label{eq:formula_level_Zigzag} \sum _{i=m} ^{2m-1} \lfloor \frac{n+i}{2m} \rfloor - \sum _{i=0} ^{m-1} \lfloor \frac{n+i}{2m} \rfloor = 2m \times \mbox{\textit{Zigzag}}\,(\frac{n}{2m}), \end{equation} where \textit{Zigzag} is a function defined by \eqref{eq:def_zigzag} and visualized on Figure~\ref{fig:zigzag}. \end{thm} \begin{figure} [h] \centering \includegraphics[width=0.7\linewidth]{Takagi_function_zigzag_basic_half} \caption{Graph of function $ \mbox{\textit{Zigzag}} (x) $ $ = $ $ \min (x - \lfloor x \rfloor, \lceil x \rceil - x) $.} \label{fig:zigzag} \end{figure} \begin{proof} The equality (\ref{eq:formula_level_Zigzag}) can be verified experimentally, for instance, with a help of software for symbolic computation\footnote{\label{foot:Mat} I used Wolfram Mathematica for that purpose.}. The analytic proof is deferred to Section~\ref{sec:proof_formula_level_Zigzag}. \end{proof} \medskip \begin{corollary} \label{cor:formula_level_Zigzag_1} For every natural number n and every positive natural number m, \begin{equation} \label{eq:formula_level_Zigzag_1} \sum _{i=0} ^{m-1} \lfloor \frac{n+i}{2m} \rfloor = \frac{n}{2} - m \times \mbox{\textit{Zigzag}}\,(\frac{n}{2m}), \end{equation} where \textit{Zigzag} is a function defined by \eqref{eq:def_zigzag} and visualized on Figure~\ref{fig:zigzag}. \end{corollary} \begin{proof} First, let's note\footnote{Analytic proof of that fact is a straightforward exercise; see Appendix~\ref{sec:proof1} page \pageref{sec:proof1}.} that \begin{equation} \label{eq:100} \sum _{i=0} ^{2m-1} \lfloor \frac{n+i}{2m} \rfloor = n. \end{equation} From (\ref{eq:100}) I conclude \begin{equation} \label{eq:110} \sum _{i=0} ^{m-1} \lfloor \frac{n+i}{2m} \rfloor + \sum _{i=m} ^{2m-1} \lfloor \frac{n+i}{2m} \rfloor = n. \end{equation} Solving equations (\ref{eq:formula_level_Zigzag}) and (\ref{eq:110}) for $ \sum _{i=0} ^{m-1} \lfloor \frac{n+i}{2m} \rfloor $ yields (\ref{eq:formula_level_Zigzag_1}). \end{proof} Here is the closed-form of the summation (\ref{eq:formula_level_i}). \begin{corollary} \label{cor:formula_level_Zigzag_2} For every natural number n and every natural number k, \begin{equation} \label{eq:formula_level_Zigzag_2} \sum _{i=0} ^{2^k-1} \lfloor \frac{n+i}{2^{k+1}} \rfloor = \frac{n}{2} - 2^k \mbox{\textit{Zigzag}}\,(\frac{n}{2^{k+1}}), \end{equation} where \textit{Zigzag} is a function defined by \eqref{eq:def_zigzag} and visualized on Figure~\ref{fig:zigzag}. \end{corollary} \begin{proof} Substitute $ m = 2^k $ in (\ref{eq:formula_level_Zigzag_1}). \end{proof} The following theorem yields the formula (\ref{eq:formula_Zigzag*}) for the minimum number $ B(n) $ of comps performed by $ {\tt MergeSort} $. \begin{thm} \label{thm:formula_Zigzag} For every natural number n, \begin{equation} \label{eq:formula_Zigzag*} \sum _{k=0} ^{\lfloor \lg n \rfloor} \sum _{i=0} ^{2^k-1} \lfloor \frac{n+i}{2^{k+1}} \rfloor = \frac{n}{2}(\lfloor \lg n \rfloor + 1) - \sum _{k=0} ^{\lfloor \lg n \rfloor} 2^k \mbox{\textit{Zigzag}}\,(\frac{n}{2^{k+1}}), \end{equation} where \textit{Zigzag} is a function defined by \eqref{eq:def_zigzag} and visualized on Figure~\ref{fig:zigzag}. \end{thm} \begin{proof} \[\sum _{k=0} ^{\lfloor \lg n \rfloor} \sum _{i=0} ^{2^k-1} \lfloor \frac{n+i}{2^{k+1}} \rfloor = \sum _{k=0} ^{\lfloor \lg n \rfloor}( \frac{n}{2} - 2^k \mbox{\textit{Zigzag}}\,(\frac{n}{2^{k+1}})) = \] \[ = \frac{n}{2}(\lfloor \lg n \rfloor + 1) - \sum _{k=0} ^{\lfloor \lg n \rfloor} 2^k \mbox{\textit{Zigzag}}\,(\frac{n}{2^{k+1}}) .\] \end{proof} \medskip \begin{figure} [h] \centering \includegraphics[width=0.7\linewidth]{Best-case_MergeSort_both_formulas} \caption{Graphs of functions $ \sum _{k=0} ^{\lfloor \lg n \rfloor} \sum _{i=0} ^{2^k-1} \lfloor \frac{n+i}{2^{k+1}} \rfloor $ (bottom line) and $ \frac{n}{2}(\lfloor \lg n \rfloor + 1) - \sum _{k=0} ^{\lfloor \lg n \rfloor} 2^k \mbox{\textit{Zigzag}}\,(\frac{n}{2^{k+1}}) $ (top line) of equality \eqref{eq:formula_Zigzag*}. They coincide with each other for all natural numbers $ n $.} \label{fig:Best-case_MergeSort_worksheet_best-case} \end{figure} Formula (\ref{eq:formula_Zigzag*}), although not quite closed-form, comprises of summation with only $ \lfloor \lg n \rfloor +1 $ closed-form terms, so it may be evaluated in $ O(\log ^{c}) $ time, where $ c $ is a constant. I will show in Section~\ref{sec:frac} that (\ref{eq:formula_Zigzag*}) does not have a closed form. Graphs of both sides of equality (\ref{eq:formula_Zigzag*}) are shown on Figure~\ref{fig:Best-case_MergeSort_worksheet_best-case}. Once can see that for natural numbers $ n $ they coincide with the solution $ B(n) $ of recurrences \eqref{eq:rec_rel1} and \eqref{eq:rec_rel2} visualized on Figure~\ref{fig:Best-case_rec_solution}. \begin{cor} \label{thm:formula_Zigzag_B} For every natural number n, the minimum number $ B(n) $ of comps that $ {\tt MergeSort} $ performs while sorting an $ n $-element array is: \begin{equation} \label{eq:formula_Zigzag_B} B(n) = \frac{n}{2}(\lfloor \lg n \rfloor + 1) - \sum _{k=0} ^{\lfloor \lg n \rfloor} 2^k \mbox{\textit{Zigzag}}\,(\frac{n}{2^{k+1}}), \end{equation} where \textit{Zigzag} is a function defined by \eqref{eq:def_zigzag} and visualized on Figure~\ref{fig:zigzag}. \end{cor} \section{A fractal in $ B(n) $} \label{sec:frac} A deceitfully simple expression \begin{equation} \label{eq:sum_zigzag} \sum _{k=0} ^{\lfloor \lg x \rfloor} 2^{k+1} \mbox{\textit{Zigzag}}\,(\frac{x}{2^{k+1}}), \end{equation} half of which occurs in formula (\ref{eq:formula_Zigzag_B}) of Corollary~\ref{thm:formula_Zigzag_B}, is a formidable adversary for those who may try to turn it into a closed form, although the time required for its evaluation for any given $ n $ is $ O (\log ^ c) $ \footnote{So, to all practical purposes, (\ref{eq:formula_Zigzag_B}) is a closed-form formula.}. That does not come as a surprise, taking into account that its graph, shown on Figure~\ref{fig:Best-case_MergeSort_worksheet_sum_zigzag}, bears a resemblance of fractal. This can be easily seen as soon as a sawtooth function $ 2^{\lfloor \lg x \rfloor + 1} - x $ is subtracted from it, yielding the function $ F(x) $ given by \begin{equation} \label{eq:def_F} F(x) = \sum _{k=0} ^{\lfloor \lg x \rfloor} 2^{k+1} \mbox{\textit{Zigzag}}\,(\frac{x}{2^{k+1}}) - 2^{\lfloor \lg x \rfloor + 1} + x. \end{equation} \medskip \begin{figure} [h] \centering \includegraphics[width=0.7\linewidth]{Best-case_MergeSort_worksheet_sum_zig_with_chainsaw} \caption{A graph of function $\sum _{k=0} ^{\lfloor \lg x \rfloor} 2^{k+1} \mbox{\textit{Zigzag}}\,(\frac{x}{2^{k+1}}) $ plotted against a sawtooth function $ 2^{\lfloor \lg x \rfloor + 1} - x $.} \label{fig:Best-case_MergeSort_worksheet_sum_zigzag} \end{figure} \noindent Since $ \frac{1}{2} \leq \frac{x}{2^{\lfloor \lg x \rfloor + 1}} < 1 $, equality \eqref{eq:def_zigzag} implies \begin{equation} \nonumber \mbox{\textit{Zigzag}}\,(\frac{x}{2^{\lfloor \lg x \rfloor+1}}) = 1 - \frac{x}{2^{\lfloor \lg x \rfloor+1}}, \end{equation} or \begin{equation} \label{eq:zigprop1} 2^{\lfloor \lg x \rfloor+1} \mbox{\textit{Zigzag}}\,(\frac{x}{2^{\lfloor \lg x \rfloor+1}}) = 2^{\lfloor \lg x \rfloor+1} - x. \end{equation} The equality \eqref{eq:zigprop1} simplifies definition \eqref{eq:def_F} of function $ F $ to \begin{equation} \label{eq:fractal} F(x) = \sum _{k=1} ^{\lfloor \lg x \rfloor} 2^{k} \mbox{\textit{Zigzag}}\,(\frac{x}{2^{k}}), \end{equation} visualized on Figure~\ref{fig:Best-case_MergeSort_worksheet_sum_zigzag_minus_chainsaw}. \begin{figure} [h] \centering \includegraphics[width=0.7\linewidth]{Best-case_MergeSort_zigzags_and_sum_and_top_lines} \caption{A graph of function $ F(x) = \sum _{k=1} ^{\lfloor \lg x \rfloor} 2^{k} \mbox{\textit{Zigzag}}\,(\frac{x}{2^{k}})$ plotted below its tight linear upper bound $ y = \frac{x-1}{2} $ (if can be shown that $ F(x) = \frac{x-1}{2} $ whenever $ x $ $ = $ $ \frac{1}{3}(2^{k+1} + (-1)^k) $ for some integer $ k \geq 0 $); also shown below $ F(x) $ are the terms $ 2^{k} \mbox{\textit{Zigzag}}\,(\frac{x}{2^{k}}) $ of the summation and their tight linear upper bound $ y = \frac{x}{3} $.} \label{fig:Best-case_MergeSort_worksheet_sum_zigzag_minus_chainsaw} \end{figure} \medskip The function $ F $ is a fractal with quasi similarity that repeats at intervals of exponentially growing length. It is a union \begin{equation} \label{eq:F_union_def} F = \bigcup _{k=0} ^{\infty} f_k \end{equation} of functions $ f_k $, each having an interval $ [ 2^k, 2^{k+1}) $ as its domain. In other words, for every integer $ k \geq 0 $, \begin{equation} \label{eq:def_f_k} f_k = F \restriction [ 2^k, 2^{k+1}), \end{equation} which, of course, yields \eqref{eq:F_union_def}. \begin{figure} [h] \centering \includegraphics[width=0.7\linewidth]{Takagi_function_progression_5_with_upper_and_terms_of_sum} \caption{A graph of the first six (the first one is $ 0 $) normalized parts of function of Figure~\ref{fig:Best-case_MergeSort_worksheet_sum_zigzag_minus_chainsaw} plotted against the line $ y = \sum _{i=0} ^{\infty} \frac{1}{2^{2i+1}} = \frac{2}{3} $. Also shown (in blue) are the first five terms $ \frac{1}{2^i} \mbox{\textit{Zigzag}} \, (2^i x) $, $ i = 0,...,4 $, of sums that occur in the formula \eqref{eq:f_k_simplified} for $ \tilde{f}_k(x) $; for each integer $ n $ and all $ x \in [n, n+1) $, their parts above the $ X $-axis restricted to $ [n, n+1) $ visualize a fragment of an infinite binary search \textit{trie} $ T $ defined as the set of shortest binary expansions of $ x - \lfloor x \rfloor $ with the last digit $ 1 $ (if the said binary expansion is finite) being interpreted as the sequence terminator; in particular, the root of $ T $ is $ .1 $, and if $ {\bf a} $ is a finite binary sequence then the children of binary expansion $ .{\bf a}1 $ are $ .{\bf a}01 $ and $ .{\bf a}11 $ .} \label{fig:Best-case_MergeSort_worksheet_sum_zigzag_minus_chainsaw_progression} \end{figure} Let $ \hat{f}_k $ be the normalized $ f_k $ on interval $ [0,1) $, defined by: \begin{equation} \label{eq:f_k_normalized} \hat{f}_k (x) = \frac{1}{2^k} f_k (2^k (x + 1)) , \end{equation} and $ \tilde{f}_k $ be the periodized $ \hat{f}_k $ by composing it with a sawtooth function $ x- \lfloor x \rfloor $,\footnote{The fractional part of $ x $.} defined by: \begin{equation} \label{eq:f_k_periodized} \tilde{f}_k(x) = \hat{f}_k(x- \lfloor x \rfloor). \end{equation} Contracting definitions \eqref{eq:def_f_k}, \eqref{eq:f_k_normalized}, and \eqref{eq:f_k_periodized}, yields \begin{equation} \label{eq:f_k_simplified_a} \tilde{f}_k(x) = \frac{1}{2^k} F (2^k (x- \lfloor x \rfloor + 1)). \end{equation} One can compute\footnote{An elementary geometric argument based on the graph visualized on Figure~\ref{fig:Best-case_MergeSort_worksheet_sum_zigzag_minus_chainsaw_progression} will do.} from \eqref{eq:f_k_simplified_a} the following alternative formula for $ \tilde{f}_k(x) $: \begin{equation} \label{eq:f_k_simplified} \tilde{f}_k(x) = \sum _{i=0} ^{k-1} \frac{1}{2^i} \mbox{\textit{Zigzag}} \, (2^i x). \end{equation} Figure~\ref{fig:Best-case_MergeSort_worksheet_sum_zigzag_minus_chainsaw_progression} shows functions $ \tilde{f}_0,...,\tilde{f}_6 $ drawn on the same graph. \medskip Since each function $ f_k $, and - therefore - each function $ \hat{f}_k $, and - therefore - each function $ \tilde{f}_k $, are a result of smaller and smaller triangles piled, originating in function \textit{Zigzag} of definition (\ref{eq:fractal}) of function $ F $, on one another as shown on Figure~\ref{fig:Best-case_MergeSort_worksheet_sum_zigzag_minus_chainsaw_progression}, for any integers $ 0 \leq i < j $, $ \tilde{f}_i $ linearly interpolates $ \tilde{f}_j $. Because of that, each $ \tilde{f}_i $ linearly interpolates the limit $ \tilde{F} $ of all $ \tilde{f}_k $s defined by: \begin{equation} \label{eq:def_lim} \tilde{F}(x) = \lim _{k \rightarrow \infty} \tilde{f}_k (x), \end{equation} as Figure~\ref{fig:Takagi_function_progression_5} illustrates. An application of \eqref{eq:f_k_simplified} to \eqref{eq:def_lim} yields: \begin{equation} \label{eq:def_lim2} \tilde{F}(x) = \sum _{i=0} ^{\infty} \frac{1}{2^i} \mbox{\textit{Zigzag}} \, (2^i x). \end{equation} \begin{figure}[h] \centering \includegraphics[width=0.7\linewidth]{./Takagi_function_progression_5_with_upper} \caption{Functions functions $ \tilde{f}_0 (x),\tilde{f}_1 (x), ... $ and their limit (the topmost curve) $ \tilde{F} (x) $ given by (\ref{eq:def_lim2}). Collapsing the \textit{Zigzag}$ (x) $ would yield the same, albeit scaled-down (by the factor of 2) pattern $ \frac{1}{2}\tilde{F}(2x) $, as (\ref{eq:def_lim2}) does imply.} \label{fig:Takagi_function_progression_5} \end{figure} Since for every integer $ n $ and $ i \geq k $, $ 2^i \frac{n}{2^k} $ is integer, $ \mbox{\textit{Zigzag}} \, (2^i \frac{n}{2^k}) = 0 $. Therefore, by virtue of \eqref{eq:f_k_simplified} and \eqref{eq:def_lim2}, for every non-negative integer $ k $ and $ n $, \begin{equation} \label{eq:Ftilde=ftilde_k} \tilde{F}(\frac{n}{2^k}) = \tilde{f}_k(\frac{n}{2^k}). \end{equation} This and \eqref{eq:f_k_simplified} eliminate the need for infinite summation\footnote{As it appears in \eqref{eq:def_lim2}} while computing $ \tilde{F}(\frac{n}{2^k}) $. \medskip It can be shown that although a continuous function, $ \tilde{F} $ is nowhere-differentiable. As such, it does not have a closed-form formula as any closed-form formula on a real interval must define a function have a derivative at every point of that interval, except for a non-dense set of its points. Since $ \tilde{F} $ can be expressed in function, described by a closed-form formula, of the right-hand side of formula \eqref{eq:formula_Zigzag*}, the latter does not have a closed-form formula, either. \begin{thm} \label{thm:no_closed_form} There is no closed-form formula $ \varphi(n) $ the values of which coincide with $ \sum _{k=0} ^{\lfloor \lg n \rfloor} 2^k \mbox{\textit{Zigzag}}\,(\frac{n}{2^{k+1}}), $ for all positive integers $ n $, that is, for every closed-form formula $ \varphi(n) $ on function \textit{Zigzag} there is a positive $ n $ such that \begin{equation} \label{eq:no_closed_form} \sum _{k=0} ^{\lfloor \lg n \rfloor} 2^k \mbox{\textit{Zigzag}}\,(\frac{n}{2^{k+1}}) \neq \varphi(n), \end{equation} where \textit{Zigzag} is a function defined by \eqref{eq:def_zigzag} and visualized on Figure~\ref{fig:zigzag}. \end{thm} \begin{proof} Follows from the above discussion. A more detailed proof is deferred to Section~\ref{sec:proof_no_closed_form}. \end{proof} \medskip This way I arrived at the following conclusion. \medskip \begin{cor} \label{cor:no_closed_form} There is no closed-form formula for $ B(n) $. \end{cor} \begin{proof} A closed-form formula for $ B(n) $ would, by virtue of \eqref{eq:formula_Zigzag_B} page~\pageref{eq:formula_Zigzag_B}, yield a closed-form formula for $ \sum _{k=0} ^{\lfloor \lg n \rfloor} 2^k \mbox{\textit{Zigzag}}\,(\frac{n}{2^{k+1}}) $, which by Theorem~\ref{thm:no_closed_form} does not exist. \end{proof} \medskip \textbf{\textit{Note}}. One can apply the reverse transformations to those used in Section~\ref{sec:frac} on function $ \tilde{F} $ and construct a fractal function $ \breve{F} $, shown on Figure~\ref{fig:Best-case_MergeSort_worksheet_sum_zig_minus_chainsaw_w_upper}, given by the equation \begin{figure}[h] \centering \includegraphics[width=0.7\linewidth]{./Best-case_MergeSort_worksheet_sum_zig_minus_chainsaw_w_upper} \caption{A graph of function $ \breve{F} (x) = 2^{\lfloor \lg x \rfloor } \tilde{F}(\frac{x}{2^{\lfloor \lg x \rfloor }}) $ plotted above a graph of the function $ F(x) = \sum _{k=1} ^{\lfloor \lg x \rfloor} 2^{k} \mbox{\textit{Zigzag}}\,(\frac{x}{2^{k}}) $. } \label{fig:Best-case_MergeSort_worksheet_sum_zig_minus_chainsaw_w_upper} \end{figure} \begin{equation} \label{eq:def_F_u} \breve{F} (x) = 2^{\lfloor \lg x \rfloor } \tilde{F}(\frac{x}{2^{\lfloor \lg x \rfloor}}), \end{equation} that for every positive integer $ n $ satisfies \begin{equation} \label{eq:F_u=F} \breve{F} (n) = F(n), \end{equation} where $ F $ is given by \eqref{eq:fractal}. \section{Computing $ \tilde{F} (x) $ and $ B(n) $ from one another } \label{sec:compfromfrac} Computing values of function $ \tilde{F} (x) $ does not have to be as complex as (or more complex than) the definition \eqref{eq:def_lim2} implies. Of course, for every integer $ n $, $ \tilde{F} (n) $ $ = $ $ 0 $. One can apply some elementary arguments based on a structure visualized on Figure~\ref{fig:Takagi_function_progression_5} to conclude that \begin{equation} \tilde{F} (\frac{2}{3}) = \tilde{F} (\frac{1}{3}) = \frac{2}{3} , \end{equation} (the latter being the maximum of $ \tilde{F} (x) $) or that for every positive integer $ k $, \begin{equation} \tilde{F} (\frac{1}{2^k}) = \frac{ k }{2^k} . \end{equation} It takes a bit more work to compute \begin{equation} \tilde{F} (\frac{3}{2^k}) = \frac{3 k - 4 }{2^k} . \end{equation} \medskip It turns out that computing values of function $ \tilde{F} (x) $ for every $ x $ that has a finite binary expansion can be done easily if an oracle for computing the values of the function $ B(n) $ defined by \eqref{eq:rec_rel1} and \eqref{eq:rec_rel2} is given\footnote{Which is not that surprising after a glance at Figure~\ref{fig:Best-case_MergeSort_worksheet_sum_zig_minus_chainsaw_w_upper}.}. Once that is accomplished, since $ \tilde{F} (x) $ is a continuous function and the set of numbers with finite binary expansions is dense in the set $ \mathfrak{R} $ of reals, it allows for fast approximations of $ \tilde{F} (x) $ for every real $ x $. \footnote{It helps to remember that $ \tilde{F} $ is a periodic function with $ \tilde{F} (x) = \tilde{F} (x - \lfloor x \rfloor) $.} \medskip \begin{thm} \label{thm:mainB} For every positive integer $ n $ \footnote{Of course, one if free to assume that $ n $ is odd here.} and integer $ k $ with $ n \leq 2^k $, \begin{equation} \label{eq:mainB} \tilde{F} (\frac{n}{2^k}) = \frac{n \times k - 2 B(n)}{2^k} . \end{equation} \end{thm} \begin{proof} The equality \eqref{eq:mainB} can be verified experimentally, for instance, with a help of software for symbolic computation$ ^{\ref{foot:Mat}} $. The analytic proof is deferred to Section~\ref{sec:comment}. \end{proof} Theorem~\ref{thm:mainB} allows for easy computing of $ B(n) $ if $ \tilde{F} (\frac{n}{2^k}) $ is given for some $ k \geq \lg n $ using this form of \eqref{eq:mainB}: \begin{cor} \label{cor:mainB2} For every positive integer $ n $ and integer $ k $ with $ n \leq 2^k $, \begin{equation} \label{eq:mainB2} B(n) = \frac{n \times k }{2} - 2^{k-1} \tilde{F} (\frac{n}{2^k}). \end{equation} \end{cor} \begin{proof} An obvious conclusion from \eqref{eq:mainB}. \end{proof} For instance, putting $ k = \lfloor \lg n \rfloor + 1 $ in \eqref{eq:mainB2} easily yields \eqref{eq:formula_Zigzag_B}. For $ k = \lceil \lg n \rceil $ we obtain \[ B(n) = \frac{n \lceil \lg n \rceil }{2} - 2^{\lceil \lg n \rceil-1} \tilde{F} (\frac{n}{2^{\lceil \lg n \rceil}}) = \] [by \eqref{eq:def_lim2}] \[ = \frac{n \lceil \lg n \rceil }{2} - 2^{\lceil \lg n \rceil-1} \sum _{i=0} ^{\infty} \frac{1}{2^i} \mbox{\textit{Zigzag}} \, (2^i \frac{n}{2^{\lceil \lg n \rceil}}) = \] [since for $ i \geq \lceil \lg n \rceil $, $ 2^i \frac{n}{2^{\lceil \lg n \rceil}} $ is integer and $ \mbox{\textit{Zigzag}} \, (2^i \frac{n}{2^{\lceil \lg n \rceil}}) = 0 $] \[ = \frac{n \lceil \lg n \rceil }{2} - 2^{\lceil \lg n \rceil-1} \sum _{i=0} ^{\lceil \lg n \rceil - 1} \frac{1}{2^i} \mbox{\textit{Zigzag}} \, (2^i \frac{n}{2^{\lceil \lg n \rceil}}) = \] \[ = \frac{n \lceil \lg n \rceil }{2} - \frac{1}{2} \sum _{i=0} ^{\lceil \lg n \rceil - 1} 2^{\lceil \lg n \rceil - i} \mbox{\textit{Zigzag}} \, ( \frac{n}{2^{\lceil \lg n \rceil - i}}) .\] Substituting $ k $ for $ \lceil \lg n \rceil - i $ we conclude \begin{equation} \label{eq:mainAlt} B(n) = \frac{n \lceil \lg n \rceil }{2} - \frac{1}{2} \sum _{k=1} ^{\lceil \lg n \rceil} 2^{k} \mbox{\textit{Zigzag}} \, ( \frac{n}{2^{k}}), \end{equation} a similar to \eqref{eq:formula_Zigzag_B} characterization of $ B(n) $. \section{Relationship between the best case and the worst case} A casual student of $ {\tt MergeSort} $ tends to believe that its worst-case behavior is about twice as bad as its best-case behavior. This, of course, is only approximately true. In this Section, I will derive the exact difference between $ 2 B(n) $ and $ W(n) $ using function $ F $ defined by \eqref{eq:def_F} page \pageref{eq:def_F}. \medskip An exact formula for the number $ W(n) $ of comparisons of keys performed by $ {\tt MergeSort} $ in the worst case is known\footnote{See \eqref{eq:recmergesort900} in the \ref{sec:excerpts}.} and is given for any positive integer $ n $ by the following equality: \begin{equation} \label{eq_worst} W(n) = \sum _{i = 1} ^{n} \lceil \lg i \rceil . \end{equation} From \eqref{eq:formula_Zigzag_B} and \eqref{eq:def_F}, one can derive \[ 2B(n) = n \lfloor \lg n \rfloor - 2^{\lfloor \lg n \rfloor + 1} + 2n - F(n) = \] [by $ \sum _{i = 1} ^{n} \lceil \lg i \rceil = n \lfloor \lg n \rfloor - 2^{\lfloor \lg n \rfloor + 1} + n + 1 $ from \cite{knu:art}] \[ = \sum _{i = 1} ^{n} \lceil \lg i \rceil - 1 + n - F(n) = \] [by \eqref{eq_worst}] \[ = W(n) - 1 + n - F(n) . \] The above yield the following characterization. \begin{thm} \label{thm:dif2BW} For every positive integer $ n $, the difference between twice the number $ B(n) $ of comparison of keys performed in the best case and the number $ W(n) $ of comparison of keys performed in the worst case by $ {\tt MergeSort} $ while sorting an $ n $-element array is: \begin{equation} \label{eq:dif2BW} 2B(n) - W(n) = n - 1 - F(n) , \end{equation} where $ F(n) $, visualized on Figure~\ref{fig:Best-case_MergeSort_worksheet_sum_zigzag_minus_chainsaw}, is given by \eqref{eq:fractal}. \end{thm} \begin{proof} Follows from the above discussion. \end{proof} In particular, since for every positive integer $ n $, \begin{equation} \label{eq:F_ub} 0 \leq F(n) \leq \frac{n-1}{2} \end{equation} (see Figure~\ref{fig:Best-case_MergeSort_worksheet_sum_zigzag_minus_chainsaw} for explanation), I conclude with the following tight linear bounds on $ 2B(n) - W(n) $. \begin{cor} For every positive integer $ n $, the difference between twice the minimum number $ B(n) $ and the maximum number $ W(n) $ of comparison of keys performed in the worst case by $ {\tt MergeSort} $ while sorting an $ n $-element array satisfies this inequality: \begin{equation} \frac{n-1}{2} \leq 2B(n) - W(n) \leq n-1 . \end{equation} \end{cor} \begin{proof} Follows from \eqref{eq:dif2BW} and \eqref{eq:F_ub}. \end{proof} \begin{figure}[h] \centering \includegraphics[width=0.7\linewidth]{Best-case_MergeSort_bounds_2B-W} \caption{A graph of $ 2B(n) - W(n) $ shown between graphs of its tight linear bounds $ n - 1 $ and $ \frac{n - 1}{2} $.} \label{fig:2B-W_with_bounds} \end{figure} Obviously, $ 2B(n) - W(n) = n - 1$ whenever $ F(n) = 0 $, that is, whenever $ n = 2^{\lfloor \lg n \rfloor} $. It can be shown that $ 2B(n) - W(n) = \frac{n-1}{2} $ whenever $ n $ $ = $ $ \frac{1}{3}(2^{k+1} + (-1)^k) $ for some integer $ k \geq 0 $. \medskip A graph of $ 2B(n) - W(n) $ and its tight bounds are shown on Figure~\ref{fig:2B-W_with_bounds}. \section{The sum of digits problem} \label{sec:sumdig} A known explicit formula, published in \cite{tro:digsum}, for the total number of bits in all integers between 0 and $ n $ (not including 0 and $ n $) is expressed in terms of function \textit{Zigzag} (referred to as $ 2 g $ in \cite{tro:digsum}) and is given by:\footnote{The following are screen shots and an excerpt from \cite{tro:digsum}.} {\centering \includegraphics[width=1\linewidth]{Quote_from_Trollope_A}} \noindent $ \,\, $ Let $ g(x) $ be periodic of period 1 and defined on $ [0,1] $ by {\centering \includegraphics[width=1\linewidth]{Quote_from_Trollope}} \medskip It has been shown in \cite{mci:numones} that the recurrence relation for $ A(n,2) $ is the same as the recurrence relation for $ B(n) $ given by (\ref{eq:rec_rel1}) and (\ref{eq:rec_rel2}). Therefore, the formula (\ref{eq:formula_Zigzag*}) derived in this paper is equivalent to $ A(n,2) $ given above by the considerably more complicated definition. Interestingly, the above definition can be simplified to \eqref{eq:formula_Zigzag*} along the lines of the elementary derivation of the alternative formula \eqref{eq:mainAlt} for $ B(n) $ on page~\pageref{eq:mainAlt}\footnote{Even more interestingly, if someone did bother to simplify Trollope's formula of \cite{tro:digsum} then I am not aware of it.}. \section{Proof of Theorem~\ref{thm:formula_level_Zigzag} page~\pageref{thm:formula_level_Zigzag}, Subsection~\ref{subsec:zig}} \label{sec:proof_formula_level_Zigzag} In this Section, I provide an analytic proof of the experimentally-derived Theorem~\ref{thm:formula_level_Zigzag} page~\pageref{thm:formula_level_Zigzag}, Subsection~\ref{subsec:zig} that was instrumental for the derivation of a logarithmic-length formula\footnote{$ B(n) = \frac{n}{2}(\lfloor \lg n \rfloor + 1) - \sum _{k=0} ^{\lfloor \lg n \rfloor} 2^k \mbox{\textit{Zigzag}}\,(\frac{n}{2^{k+1}}) $, where $ \mbox{\textit{Zigzag}}\,(x) = \min (x - \lfloor x \rfloor, \lceil x \rceil - x) $.} for $ B(n) $. The result and its proof have a flavor of Concrete Mathematics. Although they are interesting in their own right, they cannot be found in \cite{knu:concrete}. \begin{thm} \label{thm:formula_level_Zigzag_App} {\rm (Same as Theorem~\ref{thm:formula_level_Zigzag}.)} For every natural number n and every positive natural number m, \begin{equation} \label{eq:formula_level_Zigzag_App} \sum _{i=m} ^{2m-1} \lfloor \frac{n+i}{2m} \rfloor - \sum _{i=0} ^{m-1} \lfloor \frac{n+i}{2m} \rfloor = 2m \times \mbox{\textit{Zigzag}}\,(\frac{n}{2m}), \end{equation} where \textit{Zigzag} is a function defined by \eqref{eq:def_zigzag} and visualized on Figure~\ref{fig:zigzag} page~\pageref{fig:zigzag}. \end{thm} \begin{proof} First, let's note that \[ \sum _{i=m} ^{2m-1} \lfloor \frac{n+i}{2m} \rfloor - \sum _{i=0} ^{m-1} \lfloor \frac{n+i}{2m} \rfloor = \sum _{i=0} ^{m-1} \lfloor \frac{n+i+m}{2m} \rfloor - \sum _{i=0} ^{m-1} \lfloor \frac{n+i}{2m} \rfloor = \sum _{i=0} ^{m-1} (\lfloor \frac{n+i}{2m} + \frac{1}{2} \rfloor - \lfloor \frac{n+i}{2m} \rfloor) , \] that is, \begin{equation} \label{eq:formula_level_Zigzag_App_var} \sum _{i=m} ^{2m-1} \lfloor \frac{n+i}{2m} \rfloor - \sum _{i=0} ^{m-1} \lfloor \frac{n+i}{2m} \rfloor = \sum _{i=0} ^{m-1} (\lfloor \frac{n+i}{2m} + \frac{1}{2} \rfloor - \lfloor \frac{n+i}{2m} \rfloor). \end{equation} Let \begin{equation} \label{eq:def_r} n = k \times 2 m + r , \end{equation}where $ 0 \leq r < 2m $, and let $ 0 \leq i < m $. We have \[ \lfloor \frac{n+i}{2m} + \frac{1}{2} \rfloor = \lfloor \frac{k \times 2 m + r+i}{2m} + \frac{1}{2} \rfloor = k + \lfloor \frac{r+i}{2m} + \frac{1}{2} \rfloor \] and \[ \lfloor \frac{n+i}{2m} \rfloor = \lfloor \frac{k \times 2 m + r+i}{2m} \rfloor = k + \lfloor \frac{r+i}{2m} \rfloor .\] Thus, by virtue of \eqref{eq:formula_level_Zigzag_App_var}, \begin{equation} \label{eq:formula_level_Zigzag_App_var2} \sum _{i=m} ^{2m-1} \lfloor \frac{n+i}{2m} \rfloor - \sum _{i=0} ^{m-1} \lfloor \frac{n+i}{2m} \rfloor = \sum _{i=0} ^{m-1} (\lfloor \frac{r+i}{2m} + \frac{1}{2} \rfloor - \lfloor \frac{r+i}{2m} \rfloor) . \end{equation} We have \begin{equation} \label{eq:dif=0_or_1} \lfloor \frac{r+i}{2m} + \frac{1}{2} \rfloor - \lfloor \frac{r+i}{2m} \rfloor = \left\{ \begin{array}{ll} 1 \mbox{ if } \; \frac{1}{2} \leq \frac{r+i}{2m} < 1 \\ \\ 0 \mbox{ otherwise,} \end{array} \right. \end{equation} because $ \frac{r+i}{2m} + \frac{1}{2} < \frac{3m}{2m} + \frac{1}{2} = 2 $ so that $ \lfloor \frac{r+i}{2m} + \frac{1}{2} \rfloor \leq 1 $ and, therefore, $ \lfloor \frac{r+i}{2m} + \frac{1}{2} \rfloor - \lfloor \frac{r+i}{2m} \rfloor \leq 1 $. \medskip Let $ I $ be defined as \begin{equation} \label{eq:defI} I = \{ i \in \mathbb{N} \mid \frac{1}{2} \leq \frac{r+i}{2m} < 1 \} = \{ i \in \mathbb{N} \mid m-r \leq i < 2m-r \} . \end{equation} By virtue of \eqref{eq:dif=0_or_1}, we have \begin{equation} \label{eq:formula_level_Zigzag_App_var3} \sum _{i=0} ^{m-1} (\lfloor \frac{r+i}{2m} + \frac{1}{2} \rfloor - \lfloor \frac{r+i}{2m} \rfloor) = \sum _{i \in I} (\lfloor \frac{r+i}{2m} + \frac{1}{2} \rfloor - \lfloor \frac{r+i}{2m} \rfloor) = \sum _{i \in I} 1 = \#{I}, \end{equation} where $ \# (I) $ denotes the cardinality of $ I $. \medskip If $ r \leq m $ then, by \eqref{eq:defI}, $ \# I = m - (m-r) = r $. If $ r > m $ then, by \eqref{eq:defI}, $ \# I = 2 m - r $. In any case, \begin{equation} \nonumber \# I = \min (r, 2m - r) = 2m \min (\frac{r}{2m}, 1- \frac{r}{2m}) = \end{equation} [since $ 0 \leq \frac{r}{2m} < 1 $ so that $ \lfloor \frac{r+i}{2m} \rfloor = 0 $ and $ \lceil \frac{r+i}{2m} \rceil = 1 $] \[ = 2m \min (\frac{r}{2m} - \lfloor \frac{r}{2m} \rfloor, \lceil \frac{r}{2m} \rceil- \frac{r}{2m}) = \] [by the definition \eqref{eq:def_zigzag} of function {\em Zigzag}] \[ = 2m \times \mbox{\em Zigzag} \, ( \frac{r}{2m}) =\] [since {\em Zigzag} is a periodic function with period 1] \[= 2m \times \mbox{\em Zigzag} \, ( k+ \frac{r}{2m}) = 2m \times \mbox{\em Zigzag} \, ( \frac{k \times 2m + r}{2m}) =\] [by \eqref{eq:def_r}] \[= 2m \times \mbox{\em Zigzag} \, ( \frac{n}{2m}) .\] Thus \begin{equation} \label{eq:cardI=2mZ} \# I = 2m \times \mbox{\em Zigzag} \, ( \frac{n}{2m}) . \end{equation} From \eqref{eq:formula_level_Zigzag_App_var}, \eqref{eq:formula_level_Zigzag_App_var2}, \eqref{eq:formula_level_Zigzag_App_var3}, and \eqref{eq:cardI=2mZ}, I conclude~\eqref{eq:formula_level_Zigzag_App}. \end{proof} \section{Proof of Theorem~\ref{thm:no_closed_form} page~\pageref{thm:no_closed_form}, Section~\ref{sec:frac} \label{sec:proof_no_closed_form}} In this Section, I present a brief discussion/motivation of what can be generally considered a \textit{closed-form formula} for a function from the set of real numbers into a set of real numbers. I provide an analytic proof of Theorem~\ref{thm:no_closed_form} page~\pageref{thm:no_closed_form}, Section~\ref{sec:frac} that implies the non-existence of closed-form formula for the minimum number $ B(n) $ of comparisons of keys by $ {\tt MergeSort} $ while sorting an $ n $-element array. I am going to use the acronym $ cf\!f $ as an abbreviation for \textit{closed-form formula}. \medskip \medskip For reader's convenience, the Theorem~\ref{thm:no_closed_form} is quoted below as Theorem~\ref{thm:no_closed_form_add}. \begin{thm} \label{thm:no_closed_form_add} {\rm (Same as Theorem~\ref{thm:no_closed_form}.)} There is no $ cf\!f $ $ \varphi(n) $ the values of which coincide with $ \sum _{k=0} ^{\lfloor \lg n \rfloor} 2^k \mbox{\textit{Zigzag}}\,(\frac{n}{2^{k+1}}), $ for all positive integers $ n $, that is, for every $ cf\!f $ $ \varphi(n) $ on function \textit{Zigzag} there is a positive $ n $ such that \begin{equation} \label{eq:no_closed_form_add} \sum _{k=0} ^{\lfloor \lg n \rfloor} 2^k \mbox{\textit{Zigzag}}\,(\frac{n}{2^{k+1}}) \neq \varphi(n), \end{equation} where \textit{Zigzag} is a function defined by \eqref{eq:def_zigzag} and visualized on Figure~\ref{fig:zigzag}. \end{thm} The rest of this Section constitutes the proof of Theorem~\ref{thm:no_closed_form_add}. \medskip First, let me use an example of function $ 2^x : \mathbb{R} \longrightarrow \mathbb{R} $ as an insight of what may be accepted as a $cf\!f$ for a \textit{continuous} function - like, say, $ \tilde{F}(x) $ - on the set $ \mathbb{R} $ of reals or on an interval thereof. One picks a dense\footnote{In the metric topology of $ \mathbb{R} $.} subset $ \mathbb{Q} $ of $ \mathbb{R} $, with a collection of mappings $ \rho_x(i) : \mathbb{N} \longrightarrow \mathbb{Q} $, where $ x \in \mathbb{R} $, given by $ \rho_x(i) = \frac{\lfloor i \times x \rfloor}{i} $ so that $ \lim _{i \rightarrow \infty}\rho_x(i) = x $. Since for any $ x \in \mathbb{R} \setminus \mathbb{Q} $, $ 2^x $ has been defined as \begin{equation} 2^x = \lim _{i \rightarrow \infty} 2^{\rho_x (i)} = \lim _{i \rightarrow \infty} \sqrt[i]{2^{\lfloor i \times x \rfloor}} , \end{equation} $ \lim _{i \rightarrow \infty} \sqrt[i]{2^{\lfloor i \times x \rfloor}} $ is considered a $cf\!f$ $ \alpha : \mathbb{R} \longrightarrow \mathbb{R} $ for $ 2^x $. \medskip \medskip \begin{lem} \label{lem:cff_F_tilde} For every positive integer $ n $, \begin{equation} \label{eq:proof5} \tilde{F} (\frac{n}{2^{\lfloor \lg n \rfloor}}) = \frac{n ( \lfloor \lg n \rfloor + 2) - 2 B(n)}{2^{\lfloor \lg n \rfloor}} -2, \end{equation} where the function $F$ has been defined by the equality~\eqref{eq:def_F} page~\pageref{eq:def_F}, the function $\tilde{F} $, visualized on Figure~\ref{fig:Tak} \footnote{Also, together with its partial sums, on Figure~\ref{fig:Takagi_function_progression_5}, page~\pageref{fig:Takagi_function_progression_5}.}, has been defined by the equality~\eqref{eq:def_lim2} page~\pageref{eq:def_lim2}, and the function $ B(n) $ has been defined by the equations \eqref{eq:rec_rel1} and \eqref{eq:rec_rel3} page~\pageref{eq:rec_rel1}. \end{lem} \begin{proof} \begin{figure} \centering \includegraphics[width=0.7\linewidth]{Takagi_function} \caption{A graph of the Blancmange function $ \tilde{F}(x) = \sum _{i=0} ^{\infty} \frac{1}{2^i} Zigzag (2^i x) $. \label{fig:Tak}} \end{figure} From \eqref{eq:def_F} page~\pageref{eq:def_F}, I compute \[ \sum _{i=0} ^{\lfloor \lg n \rfloor} 2^{i+1} \mbox{\textit{Zigzag}}\,(\frac{n}{2^{i+1}}) = F(n) + 2^{\lfloor \lg n \rfloor + 1} - n ,\] that is, \begin{equation} \label{eq:proof1} \sum _{i=0} ^{\lfloor \lg n \rfloor} 2^{i} \mbox{\textit{Zigzag}}\,(\frac{n}{2^{i+1}}) = \frac{1}{2} F(n) + 2^{\lfloor \lg n \rfloor} - \frac{n}{2} . \end{equation} Applying \eqref{eq:proof1} to the equality \eqref{eq:formula_Zigzag_B} page~\pageref{eq:formula_Zigzag_B}, I conclude \[ B(n) = \frac{n}{2}(\lfloor \lg n \rfloor + 1) - (\frac{1}{2} F(n) + 2^{\lfloor \lg n \rfloor} - \frac{n}{2}) , \] or \[ B(n) = \frac{n}{2}(\lfloor \lg n \rfloor + 1) - \frac{1}{2} F(n) - 2^{\lfloor \lg n \rfloor} + \frac{n}{2} , \] that is, \[ \frac{1}{2} F(n) = \frac{n}{2}(\lfloor \lg n \rfloor + 1) - B(n) - 2^{\lfloor \lg n \rfloor} + \frac{n}{2} , \] or \begin{equation} \label{eq:proof2} F(n) = n (\lfloor \lg n \rfloor + 2) - 2 B(n) - 2^{\lfloor \lg n \rfloor+1} . \end{equation} On the other hand, by virtue of \eqref{eq:fractal} page~\pageref{eq:fractal}, \[ F(n) = \sum _{i=1} ^{\lfloor \lg n \rfloor} 2^{i} \mbox{\textit{Zigzag}}\,(\frac{n}{2^{i}}) = \] [putting $ j = \lfloor \lg n \rfloor - i $] \[ = \sum _{j=0} ^{\lfloor \lg n \rfloor-1} 2^{\lfloor \lg n \rfloor-j} \mbox{\textit{Zigzag}}\,(\frac{n}{2^{\lfloor \lg n \rfloor-j}}) = 2^{\lfloor \lg n \rfloor} \sum _{j=0} ^{\lfloor \lg n \rfloor-1} \frac{1}{2^j} \mbox{\textit{Zigzag}}\,(\frac{2^j n}{2^{\lfloor \lg n \rfloor}}) =\] [since for $ j \geq \lfloor \lg n \rfloor $, $ \frac{2^j n}{2^{\lfloor \lg n \rfloor}} \in \mathbb{N} $ so that $ \mbox{\textit{Zigzag}}\,(\frac{2^j n}{2^{\lfloor \lg n \rfloor}}) = 0 $] \[ = 2^{\lfloor \lg n \rfloor} \sum _{j=0} ^{\infty} \frac{1}{2^j} \mbox{\textit{Zigzag}}\,(\frac{2^j n}{2^{\lfloor \lg n \rfloor}}) = \] [by \eqref{eq:def_lim2} page~\pageref{eq:def_lim2}] \[ 2^{\lfloor \lg n \rfloor} \tilde{F} (\frac{n}{2^{\lfloor \lg n \rfloor}}) . \] Thus, \begin{equation} \label{eq:proof3} F(n) = 2^{\lfloor \lg n \rfloor} \tilde{F} (\frac{n}{2^{\lfloor \lg n \rfloor}}) \end{equation} or \begin{equation} \label{eq:proof4} \tilde{F} (\frac{n}{2^{\lfloor \lg n \rfloor}}) = \frac{1}{2^{\lfloor \lg n \rfloor}} F(n) . \end{equation} Combining equalities \eqref{eq:proof2} and \eqref{eq:proof4} yields \[ \tilde{F} (\frac{n}{2^{\lfloor \lg n \rfloor}}) = \frac{1}{2^{\lfloor \lg n \rfloor}} ( n (\lfloor \lg n \rfloor + 2) - 2 B(n) - 2^{\lfloor \lg n \rfloor+1}) , \] or \eqref{eq:proof5}. \end{proof} \begin{lem} \label{lem:main_no_cff} If the function $ B(n) $ defined by the equations \eqref{eq:rec_rel1} and \eqref{eq:rec_rel3} has a $ cf\!f $ $ \beta : \mathbb{N} \longrightarrow \mathbb{N} $ then the function $ \tilde{F}(x) $ defined by the equation \eqref{eq:def_lim2} page~\pageref{eq:def_lim2} has a $ cf\!f $ $ \varphi : [1,2) \longrightarrow [0,\frac{2}{3}] $. \end{lem} \begin{proof} Let \begin{equation} \label{eq:def_D} D = \{ \frac{n}{2^{\lfloor \lg n \rfloor}} \mid n \in \mathbb{N} \} \end{equation} be the set of rationals in the interval $ [1,2) $ with finite binary expansions\footnote{It is a trivial exercise to show that every real number with finite binary expansion in the interval $ [1,2) $ is of the form $ \frac{n}{2^{\lfloor \lg n \rfloor}} $ for some $ n \in \mathbb{N} $, and it is obvious that every real number of that form has a finite binary expansion and falls into that interval.}, enumerated by $ \nu (n) : \mathbb{N} \longrightarrow D $ given by $ \nu (n) = \frac{n}{2^{\lfloor \lg n \rfloor}} $ and visualized on Figure~\ref{fig:mapping}. \begin{figure} [h] \centering \includegraphics[width=0.7\linewidth]{Verifications_for_best-case_MergeSort_iterator_of_D} \caption{A graph of enumeration $ \nu (n) = \frac{n}{2^{\lfloor \lg n \rfloor}} $ of the set $ D $.} \label{fig:mapping} \end{figure} \medskip $ D $ is a dense subset of the interval $ [1,2) $ of reals. Indeed, if $ x \in [1,2) $ then for every $ n \in \mathbb{N} $, $ \frac{\lfloor 2^n x \rfloor}{2^n} \in D $ and \begin{equation} \label{eq:convD} \lim _{n \rightarrow \infty} \frac{\lfloor 2^n x \rfloor}{2^n} = x. \end{equation} Hence, for any $ x \in [1,2) $, putting \begin{equation} \label{eq:n=floor} n = \lfloor 2^i x \rfloor , \end{equation} so that \[ {\lfloor \lg n \rfloor} = {\lfloor \lg \lfloor 2^i x \rfloor \rfloor} = {\lfloor \lg 2^i x \rfloor} = { \lfloor i+ \lg x \rfloor} ={i+ \lfloor \lg x \rfloor} = i \] [the last equality holds because $ 1 \leq x < 2 $ so that $ 0 \leq \lg x < 1 $ and $ \lfloor \lg x \rfloor = 0 $], or \begin{equation} \label{eq:lg=i} {\lfloor \lg n \rfloor} = i , \end{equation} we conclude, by virtue of \eqref{eq:convD}, \begin{equation} \nonumber \tilde{F}(x) = \tilde{F}(\lim _{i \rightarrow \infty} \frac{\lfloor 2^i x \rfloor}{2^i}) = \end{equation} [by the continuity of $ \tilde{F}(x) $] \[ = \lim _{i \rightarrow \infty} \tilde{F}( \frac{\lfloor 2^i x \rfloor}{2^i}) = \] [by the equality \eqref{eq:proof5} of Lemma~\ref{lem:cff_F_tilde}] \[ = \lim _{i \rightarrow \infty} \frac{ \lfloor 2^i x \rfloor (i + 2) - 2 B(\lfloor 2^i x \rfloor)}{2^{i}} - 2 = \lim _{i \rightarrow \infty} \frac{i \lfloor 2^i x \rfloor - 2 B(\lfloor 2^i x \rfloor)}{2^{i}} + \lim _{i \rightarrow \infty} 2\frac{ \lfloor 2^i x \rfloor }{2^{i}} - 2 =\] [by the equality \eqref{eq:convD}] \[ \lim _{i \rightarrow \infty} \frac{i \lfloor 2^i x \rfloor - 2 B(\lfloor 2^i x \rfloor)}{2^{i}} + 2x - 2. \] Thus, for any $ x \in [1,2) $, \begin{equation} \label{eq:proof6} \tilde{F}(x) = \lim _{i \rightarrow \infty} \frac{i \lfloor 2^i x \rfloor - 2 B(\lfloor 2^i x \rfloor)}{2^{i}} + 2x - 2 . \end{equation} The equality \eqref{eq:proof6} shows that if there is a $ cf\!f $ $ \beta : \mathbb{N} \longrightarrow \mathbb{N} $ for function $ B $ defined by the equations \eqref{eq:rec_rel1} and \eqref{eq:rec_rel3} page~\pageref{eq:rec_rel1} then there is a $ cf\!f $ $ \varphi : [1,2) \longrightarrow [0,\frac{2}{3}] $ given by \[ \lim _{i \rightarrow \infty} \frac{i \lfloor 2^i x \rfloor - 2 \beta(\lfloor 2^i x \rfloor)}{2^{i}} + 2x - 2 \] for $ \tilde{F}(x) $. This completes the proof of Lemma~\ref{lem:main_no_cff}. \end{proof} \medskip Should the nowhere-differentiable function $ \tilde{F} $ have a $ cf\!f $, it would be differentiable everywhere except, perhaps, on a non-dense subset of $ \mathbb{R} $. The following inductive argument demonstrates that. All atomic $ cf\!f $s are differentiable except, perhaps, on a non-dense subset of $ \mathbb{R} $. If a finite number of $ cf\!f $s are differentiable except, perhaps, on non-dense subsets of $ \mathbb{R} $ then their composition is differentiable except, perhaps, on non-dense subsets of $ \mathbb{R} $. \footnote{For instance, function $ \sqrt{x}Zigzag(\frac{1}{x}) $ is differentiable on $ [0,1] $, except for the non-dense set $ \{0\} \cup \{ \frac{1}{n} \mid n \in \mathbb{N} \} $.} Thus $ \tilde{F} $ has no $ cf\!f $. \medskip The above observation, together with Lemma~\ref{lem:main_no_cff}, complete the proof of Theorem~\ref{thm:no_closed_form_add}. \section{Proof of Theorem~\ref{thm:mainB} page~\pageref{thm:mainB}, Section~\ref{sec:compfromfrac} \label{sec:comment}} In this Section, I provide an analytic proof of experimentally-derived Theorem~\ref{thm:mainB} page~\pageref{thm:mainB}, Section~\ref{sec:compfromfrac}. This result, re-stated by Theorem~\ref{thm:mainB_add} below, allows for practically efficient computations of values of the continuous Blackmange function for reals with finite binary floating-point representations. I also provide some properties (Lammas~\ref{lem:100}, \ref{lem:200}, and \ref{lem:300}) of the \textit{Zigzag} function, given by the equality \eqref{eq:def_zigzag} page~\pageref{eq:def_zigzag} and visualized on Figure~\ref{fig:zigzag} page~\pageref{fig:zigzag}, that are useful for a neat derivation of a formula for the Blancmange function as (the limit of) a finite sum of some values of the \textit{Zigzag} function. \medskip Let the function\footnote{Known as the Blancmange function.} $\tilde{F} $, visualized on Figure~\ref{fig:Tak} page~\pageref{fig:Tak}, be defined by \eqref{eq:def_lim2} page~\pageref{eq:def_lim2}, and $ B(n) $, given by \eqref{eq:rec_rel1} and \eqref{eq:rec_rel3} page~\pageref{eq:rec_rel1}, be the least number of comparisons of keys that $ {\tt MergeSort} $ performs while sorting an $ n $-element array. \begin{thm} \label{thm:mainB_add} {\rm (Same as Theorem~\ref{thm:mainB}.)} For every positive integer $ n $ \footnote{Of course, one if free to assume that $ n $ is odd here.} and integer $ k $ with $ n \leq 2^k $, \begin{equation} \label{eq:mainB_add} \tilde{F} (\frac{n}{2^k}) = \frac{n \times k - 2 B(n)}{2^k} . \end{equation} \end{thm} \medskip The reminder of this Section constitutes a proof of Theorem~\ref{thm:mainB_add}. \medskip \textit{Note}. Function \textit{Zigzag}, visualized on Figure~\ref{fig:zigzag} page~\pageref{fig:zigzag}, has been defined by \eqref{eq:def_zigzag} page~\pageref{eq:def_zigzag}. \begin{lem} \label{lem:100} For every $ k \geq \lfloor \lg n \rfloor + 2 $, \begin{equation} \label{eq:100x} 2^k Zigzag (\frac{n}{2^k}) = n. \end{equation} \end{lem} \begin{proof} Let $ k \geq \lfloor \lg n \rfloor + 2 $, or $ 2^k \geq 2 \times 2^{\lfloor \lg n \rfloor+1} > 2n$, that is \begin{equation} \label{eq:110x} 2^k > 2n. \end{equation} We have: \[0 \leq \lfloor \frac{n}{2^k} \rfloor \leq \] [by \eqref{eq:110x}] \[\leq \lfloor \frac{n}{2n} \rfloor = \lfloor \frac{1}{2} \rfloor =0 \] or \begin{equation} \label{eq:120} \lfloor \frac{n}{2^k} \rfloor = 0. \end{equation} Also, \[1 \leq \lceil \frac{n}{2^k} \rceil \leq \] [by \eqref{eq:110x}] \[\leq \lceil \frac{n}{2n} \rceil = \lceil \frac{1}{2} \rceil =1 \] or \begin{equation} \label{eq:130} \lceil \frac{n}{2^k} \rceil = 1. \end{equation} Now, \[2^k Zigzag (\frac{n}{2^k}) =\] [by \eqref{eq:def_zigzag} page~\pageref{eq:def_zigzag}] \[ = 2^k \min \{ \frac{n}{2^k} - \lfloor \frac{n}{2^k} \rfloor,\lceil \frac{n}{2^k} \rceil - \frac{n}{2^k} \} = \min \{ n - 2^k \lfloor \frac{n}{2^k} \rfloor,2^k \lceil \frac{n}{2^k} \rceil - n \} = \] [by \eqref{eq:120} and \eqref{eq:130}] \[ = \min \{ n ,2^k - n \} = \] [since by \eqref{eq:110x}, $ 2^k - n \geq n $] \[=n.\] Hence, \eqref{eq:100x} holds. \end{proof} \begin{lem} \label{lem:200} For every $ k \geq \lfloor \lg n \rfloor + 1 $, \begin{equation} \label{eq:200} \sum_{i=\lfloor \lg n \rfloor + 2}^{k} 2^i Zigzag (\frac{n}{2^i}) = n \times k - n(\lfloor \lg n \rfloor + 1). \end{equation} \end{lem} \begin{proof} By induction on $ k $. \medskip \textit{Basis step}: $ k = \lfloor \lg n \rfloor + 1 $. \medskip \[ L = \sum_{i=\lfloor \lg n \rfloor + 2}^{\lfloor \lg n \rfloor + 1} 2^i Zigzag (\frac{n}{2^i}) = 0. \] \[R = n (\lfloor \lg n \rfloor + 1) - n (\lfloor \lg n \rfloor + 1) = 0. \] Hence, $ L=R $. This completes the \textit{Basis step}. \bigskip \textit{Inductive step}: $ k \geq \lfloor \lg n \rfloor + 2 $. \medskip \textit{Inductive hypothesis}: \eqref{eq:200}. \medskip \[ \sum_{i=\lfloor \lg n \rfloor + 2}^{k+1} 2^i Zigzag (\frac{n}{2^i}) = \sum_{i=\lfloor \lg n \rfloor + 2}^{k} 2^i Zigzag (\frac{n}{2^i}) + 2^k Zigzag (\frac{n}{2^k}) = \] [by the \textit{Inductive hypothesis} and by the equality~\eqref{eq:100x} of Lemma~\ref{lem:100}] \[= n \times k - n(\lfloor \lg n \rfloor + 1) + n = n \times (k+1) - n(\lfloor \lg n \rfloor + 1) .\] Thus \[\sum_{i=\lfloor \lg n \rfloor + 2}^{k+1} 2^i Zigzag (\frac{n}{2^i}) = n \times (k+1) - n(\lfloor \lg n \rfloor + 1) .\] This completes the \textit{Inductive step}. \end{proof} \begin{lem} \label{lem:300} For every $ k \geq \lfloor \lg n \rfloor + 1 $, \begin{equation} \label{eq:300} 2^k \tilde{F} (\frac{n}{2^k}) = \sum_{i=1}^{k} 2^i Zigzag (\frac{n}{2^i}). \end{equation} \end{lem} \begin{proof} By the definition \eqref{eq:def_lim2} page~\pageref{eq:def_lim2} of function $\tilde{F} $ , we get: \[ 2^k \tilde{F} (\frac{n}{2^k}) = 2^k \sum _{i=0} ^{\infty} \frac{1}{2^i} Zigzag (2^i \frac{n}{2^k}) = \] [since for every integer $ x $, $ Zigzag (x) = 0 $, so that for $ i \geq k $, $ Zigzag (2^i \frac{n}{2^k}) = 0 $] \[ = 2^k \sum _{i=0} ^{k-1} \frac{1}{2^i} Zigzag (2^i \frac{n}{2^k}) = \sum _{i=0} ^{k-1} 2^{k-i} Zigzag ( \frac{n}{2^{k-i}}) = \] [putting $ j = k - i $] \[ = \sum _{j=1} ^{k} 2^{j} Zigzag ( \frac{n}{2^{j}}),\] which completes the proof of \eqref{eq:300}. \end{proof} At this point, we are ready to conclude the proof of Theorem~\ref{thm:mainB}. \medskip By virtue of \eqref{eq:formula_Zigzag_B} page~\pageref{eq:formula_Zigzag_B}, we have: \[ 2 B(n) = n(\lfloor \lg n \rfloor + 1) - \sum _{k=0} ^{\lfloor \lg n \rfloor} 2^{k+1} Zigzag (\frac{n}{2^{k+1}}) = \] \[ = n(\lfloor \lg n \rfloor + 1) - \sum _{i=1} ^{\lfloor \lg n \rfloor+1} 2^{i} Zigzag (\frac{n}{2^{i}}) = \] \[ = n(\lfloor \lg n \rfloor + 1) - \sum _{i=1} ^{k} 2^{i} Zigzag (\frac{n}{2^{i}}) + \sum _{i=\lfloor \lg n \rfloor+2} ^{k} 2^{i} Zigzag (\frac{n}{2^{i}}) = \] [by Lemmas \ref{lem:200} and \ref{lem:300}] \[ = n(\lfloor \lg n \rfloor + 1) - 2^k \tilde{F} (\frac{n}{2^k}) + n \times k - n(\lfloor \lg n \rfloor + 1) = n \times k - 2^k \tilde{F} (\frac{n}{2^k}) ,\] that is, \[ 2 B(n) = n \times k - 2^k \tilde{F} (\frac{n}{2^k}) ,\] from which \eqref{eq:100x} follows. \medskip This completes the proof of Theorem~\ref{thm:mainB}. \bigskip \bigskip \textit{Note}. A glance at the proof of Lemma~\ref{lem:200} suffices to notice that it fails if $ n > 2^k $, and so does Theorem~\ref{thm:mainB}. In particular, for $ k = \lfloor \lg n \rfloor $, Lemma~\ref{lem:cff_F_tilde} page~\pageref{lem:cff_F_tilde} yields \begin{equation} \tilde{F} (\frac{n}{2^k}) = \frac{n \times k - 2 B(n)}{2^k} + \frac{2n}{2^k} -2 > \frac{n \times k - 2 B(n)}{2^k} \end{equation} since for $ n > 2^{\lfloor \lg n \rfloor} $, $ \frac{2n}{2^{\lfloor \lg n \rfloor}} -2 >0. $ \bibliographystyle{alpha}
{'timestamp': '2016-12-06T02:14:23', 'yymm': '1607', 'arxiv_id': '1607.04604', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04604'}
arxiv
\section{Introduction} We start with a brief recall of $t$-designs. Let ${\mathcal{P}}$ be a set of $v \ge 1$ elements, and let ${\mathcal{B}}$ be a set of $k$-subsets of ${\mathcal{P}}$, where $k$ is a positive integer with $1 \leq k \leq v$. Let $t$ be a positive integer with $t \leq k$. The pair ${\mathbb{D}} = ({\mathcal{P}}, {\mathcal{B}})$ is called a $t$-$(v, k, \lambda)$ {\em design\index{design}}, or simply {\em $t$-design\index{$t$-design}}, if every $t$-subset of ${\mathcal{P}}$ is contained in exactly $\lambda$ elements of ${\mathcal{B}}$. The elements of ${\mathcal{P}}$ are called points, and those of ${\mathcal{B}}$ are referred to as blocks. We usually use $b$ to denote the number of blocks in ${\mathcal{B}}$. A $t$-design is called {\em simple\index{simple}} if ${\mathcal{B}}$ does not contain repeated blocks. In this paper, we consider only simple $t$-designs. A $t$-design is called {\em symmetric\index{symmetric design}} if $v = b$. It is clear that $t$-designs with $k = t$ or $k = v$ always exist. Such $t$-designs are {\em trivial}. In this paper, we consider only $t$-designs with $v > k > t$. A $t$-$(v,k,\lambda)$ design is referred to as a {\em Steiner system\index{Steiner system}} if $t \geq 2$ and $\lambda=1$, and is denoted by $S(t,k, v)$. A necessary condition for the existence of a $t$-$(v, k, \lambda)$ design is that \begin{eqnarray}\label{eqn-tdesignnecessty} \binom{k-i}{t-i} \mbox{ divides } \lambda \binom{v-i}{t-i} \end{eqnarray} for all integer $i$ with $0 \leq i \leq t$. The interplay between codes and $t$-designs goes in two directions. In one direction, the incidence matrix of any $t$-design generates a linear code over any finite field ${\mathrm{GF}}(q)$. A lot of progress in this direction has been made and documented in the literature (see, for examples, \cite{AK92}, \cite{DingBook}, \cite{Tonchev,Tonchevhb}). In the other direction, the codewords of a fixed Hamming weight in a linear or nonlinear code may hold a $t$-design. Some linear and nonlinear codes were employed to construct $t$-designs \cite{AK92,HKM04,HMT05,KM00,MT04,Tonchev,Tonchevhb}. Binary and ternary Golay codes of certain parameters give $4$-designs and $5$-designs. However, the largest $t$ for which an infinite family of $t$-designs is derived directly from codes is $t=3$. According to the references \cite{AK92}, \cite{Tonchev,Tonchevhb} and \cite{KLhb}, not much progress on the construction of $t$-designs from codes has been made so far, while many other constructions of $t$-designs are documented in the literature (\cite{BJL,CMhb,KLhb,RR10}). The objective of this paper is to construct infinite families of $2$-designs and $3$-designs from a type of binary linear codes with five weights. The obtained $t$-designs depend only on the weight distribution of the underlying binary codes. The total number of $2$-designs and $3$-designs presented in this paper are exponential in $m$, where $m \geq 5$ is an odd integer. In addition, the block size of the designs can vary in a huge range. \section{The classical construction of $t$-designs from codes} Let ${\mathcal{C}}$ be a $[v, \kappa, d]$ linear code over ${\mathrm{GF}}(q)$. Let $A_i:=A_i({\mathcal{C}})$, which denotes the number of codewords with Hamming weight $i$ in ${\mathcal{C}}$, where $0 \leq i \leq v$. The sequence $(A_0, A_1, \cdots, A_{v})$ is called the \textit{weight distribution} of ${\mathcal{C}}$, and $\sum_{i=0}^v A_iz^i$ is referred to as the \textit{weight enumerator} of ${\mathcal{C}}$. For each $k$ with $A_k \neq 0$, let ${\mathcal{B}}_k$ denote the set of the supports of all codewords with Hamming weight $k$ in ${\mathcal{C}}$, where the coordinates of a codeword are indexed by $(0,1,2, \cdots, v-1)$. Let ${\mathcal{P}}=\{0, 1, 2, \cdots, v-1\}$. The pair $({\mathcal{P}}, {\mathcal{B}}_k)$ may be a $t$-$(v, k, \lambda)$ design for some positive integer $\lambda$. The following theorems, developed by Assumus and Mattson, show that the pair $({\mathcal{P}}, {\mathcal{B}}_k)$ defined by a linear code is a $t$-design under certain conditions. \begin{theorem}\label{thm-AM1}[Assmus-Mattson Theorem \cite{AM74}, \cite[p. 303]{HP03}] Let ${\mathcal{C}}$ be a binary $[v, \kappa, d]$ code. Suppose ${\mathcal{C}}^\perp$ has minimum weight $d^\perp$. Suppose that $A_i=A_i({\mathcal{C}})$ and $A_i^\perp=A_i({\mathcal{C}}^\perp)$, for $0 \leq i \leq v$, are the weight distributions of ${\mathcal{C}}$ and ${\mathcal{C}}^\perp$, respectively. Fix a positive integer $t$ with $t < d$, and let $s$ be the number of $i$ with $A_i^\perp \ne 0$ for $0 < i \leq v-t$. Suppose that $s \leq d -t$. Then \begin{itemize} \item the codewords of weight $i$ in ${\mathcal{C}}$ hold a $t$-design provided that $A_i \ne 0$ and $d \leq i \leq v$, and \item the codewords of weight $i$ in ${\mathcal{C}}^\perp$ hold a $t$-design provided that $A_i^\perp \ne 0$ and $d^\perp \leq i \leq v$. \end{itemize} \end{theorem} To construct $t$-designs via Theorem \ref{thm-AM1}, we will need the following lemma in subsequent sections, which is a variant of the MacWilliam Identity \cite[p. 41]{vanLint}. \begin{theorem} \label{thm-MI} Let ${\mathcal{C}}$ be a $[v, \kappa, d]$ code over ${\mathrm{GF}}(q)$ with weight enumerator $A(z)=\sum_{i=0}^v A_iz^i$ and let $A^\perp(z)$ be the weight enumerator of ${\mathcal{C}}^\perp$. Then $$A^\perp(z)=q^{-\kappa}\Big(1+(q-1)z\Big)^vA\Big(\frac {1-z} {1+(q-1)z}\Big).$$ \end{theorem} Later in this paper, we will need also the following theorem. \begin{theorem}\label{thm-allcodes} Let ${\mathcal{C}}$ be an $[n, k, d]$ binary linear code, and let ${\mathcal{C}}^\perp$ denote the dual of ${\mathcal{C}}$. Denote by $\overline{{\mathcal{C}}^\perp}$ the extended code of ${\mathcal{C}}^\perp$, and let $\overline{{\mathcal{C}}^\perp}^\perp$ denote the dual of $\overline{{\mathcal{C}}^\perp}$. Then we have the following. \begin{enumerate} \item ${\mathcal{C}}^\perp$ has parameters $[n, n-k, d^\perp]$, where $d^\perp$ denotes the minimum distance of ${\mathcal{C}}^\perp$. \item $\overline{{\mathcal{C}}^\perp}$ has parameters $[n+1, n-k, \overline{d^\perp}]$, where $\overline{d^\perp}$ denotes the minimum distance of $\overline{{\mathcal{C}}^\perp}$, and is given by \begin{eqnarray*} \overline{d^\perp} = \left\{ \begin{array}{ll} d^\perp & \mbox{ if $d^\perp$ is even,} \\ d^\perp + 1 & \mbox{ if $d^\perp$ is odd.} \end{array} \right. \end{eqnarray*} \item $\overline{{\mathcal{C}}^\perp}^\perp$ has parameters $[n+1, k+1, \overline{d^\perp}^\perp]$, where $\overline{d^\perp}^\perp$ denotes the minimum distance of $\overline{{\mathcal{C}}^\perp}^\perp$. Furthermore, $\overline{{\mathcal{C}}^\perp}^\perp$ has only even-weight codewords, and all the nonzero weights in $\overline{{\mathcal{C}}^\perp}^\perp$ are the following: \begin{eqnarray*} w_1, \, w_2,\, \cdots,\, w_t;\, n+1-w_1, \, n+1-w_2, \, \cdots, \, n+1-w_t; \, n+1, \end{eqnarray*} where $w_1,\, w_2,\, \cdots,\, w_t$ denote all the nonzero weights of ${\mathcal{C}}$. \end{enumerate} \end{theorem} \begin{proof} The conclusions of the first two parts are straightforward. We prove only the conclusions of the third part below. Since $\overline{{\mathcal{C}}^\perp}$ has length $n+1$ and dimension $n-k$, the dimension of $\overline{{\mathcal{C}}^\perp}^\perp$ is $k+1$. By assumption, all codes under consideration are binary. By definition, $\overline{{\mathcal{C}}^\perp}$ has only even-weight codewords. Recall that $\overline{{\mathcal{C}}^\perp}$ is the extended code of ${\mathcal{C}}^\perp$. It is known that the generator matrix of $\overline{{\mathcal{C}}^\perp}^\perp$ is given by (\cite[p. 15]{HP03}) \begin{eqnarray*} \left[ \begin{array}{cc} {\mathbf{\bar{1}}} & 1 \\ G & {\mathbf{\bar{0}}} \end{array} \right]. \end{eqnarray*} where ${\mathbf{\bar{1}}}=(1 1 1 \cdots 1)$ is the all-one vector of length $n$, ${\mathbf{\bar{0}}}=(000 \cdots 0)^T$, which is a column vector of length $n$, and $G$ is the generator matrix of ${\mathcal{C}}$. Notice again that $\overline{{\mathcal{C}}^\perp}^\perp$ is binary, the desired conclusions on the weights in $\overline{{\mathcal{C}}^\perp}^\perp$ follow from the relation between the two generator matrices of the two codes $\overline{{\mathcal{C}}^\perp}^\perp$ and ${\mathcal{C}}$. \end{proof} \section{A type of binary linear codes with five-weights and related codes}\label{sec-maincodes} In this section, we first introduce a type of binary linear codes ${\mathcal{C}}_m$ of length $n=2^m-1$, which has the weight distribution of Table \ref{tab-zhou3}, and then analyze their dual codes ${\mathcal{C}}_m^\perp$, the extended codes $\overline{{\mathcal{C}}_m^\perp}$, and the duals $\overline{{\mathcal{C}}_m^\perp}^\perp$. Such codes will be employed to construct $t$-designs in Sections \ref{sec-2designs} and \ref{sec-3designs}. Examples of such codes will be given in Section \ref{sec-examplecodes}. \begin{table}[ht] \caption{The weight distribution of ${\mathcal{C}}_{m}$ for odd $m$.}\label{tab-zhou3} \centering \begin{tabular}{ll} \hline Weight $w$ & No. of codewords $A_w$ \\ \hline $0$ & $1$ \\ $2^{m-1}-2^{(m+1)/2}$ & $(2^m-1)\cdot 2^{(m-5)/2}\cdot (2^{(m-3)/2}+1)\cdot (2^{m-1}-1)/3$ \\ $2^{m-1}-2^{(m-1)/2}$ & $(2^m-1)\cdot 2^{(m-3)/2}\cdot (2^{(m-1)/2}+1)\cdot (5\cdot 2^{m-1}+4)/3$ \\ $2^{m-1}$ & ${(2^m-1)}\cdot (9\cdot 2^{2m-4}+3\cdot 2^{m-3}+1)$ \\ $2^{m-1}+2^{(m-1)/2}$ & $(2^m-1)\cdot 2^{(m-3)/2}\cdot (2^{(m-1)/2}-1)\cdot (5\cdot 2^{m-1}+4)/3$ \\ $2^{m-1}+2^{(m+1)/2}$ & $(2^m-1)\cdot 2^{(m-5)/2}\cdot (2^{(m-3)/2}-1)\cdot (2^{m-1}-1)/3$ \\ \hline \end{tabular} \end{table} \begin{theorem}\label{thm-BCHcodeDual} Let $m \geq 5$ be an odd integer and let ${\mathcal{C}}_m$ be a binary code with the weight distribution of Table \ref{tab-zhou3}. Then the dual code ${\mathcal{C}}_{m}^\perp$ has parameters $[2^m-1, 2^m-1-3m, 7]$, and its weight distribution is given by \begin{eqnarray*} 2^{3m}A^\perp_k &=& \binom{2^m-1}{k} +a U_a(k) + b U_b(k) + c U_c(k) + d U_d(k) + e U_e(k), \end{eqnarray*} where $0 \leq k \leq 2^m-1$, \begin{eqnarray*} a &=& (2^m-1) 2^{(m-5)/2} (2^{(m-3)/2}+1) (2^{m-1}-1)/3, \\ b &=& (2^m-1) 2^{(m-3)/2} (2^{(m-1)/2}+1) (5\times 2^{m-1}+4)/3, \\ c &=& {(2^m-1)} (9\times 2^{2m-4}+3\times 2^{m-3}+1), \\ d &=& (2^m-1) 2^{(m-3)/2} (2^{(m-1)/2}-1) (5\times 2^{m-1}+4)/3, \\ e &=& (2^m-1) 2^{(m-5)/2} (2^{(m-3)/2}-1) (2^{m-1}-1)/3, \end{eqnarray*} and \begin{eqnarray*} U_a(k) = \sum_{\substack{0 \le i \le 2^{m-1}-2^{(m+1)/2} \\ 0\le j \le 2^{m-1}+2^{(m+1)/2}-1 \\i+j=k}}(-1)^i \binom{2^{m-1}-2^{(m+1)/2}} {i} \binom{2^{m-1}+2^{(m+1)/2}-1}{j}, \end{eqnarray*} \begin{eqnarray*} U_b(k) = \sum_{\substack{0 \le i \le 2^{m-1}-2^{(m-1)/2} \\ 0\le j \le 2^{m-1}+2^{(m-1)/2}-1 \\i+j=k}}(-1)^i \binom{2^{m-1}-2^{(m-1)/2}} {i} \binom{2^{m-1}+2^{(m-1)/2}-1}{j}, \end{eqnarray*} \begin{eqnarray*} U_c(k) = \sum_{\substack{0 \le i \le 2^{m-1} \\ 0\le j \le 2^{m-1}-1 \\i+j=k}}(-1)^i \binom{2^{m-1}} {i}\binom{2^{m-1}-1} {j}, \end{eqnarray*} \begin{eqnarray*} U_d(k) = \sum_{\substack{0 \le i \le 2^{m-1}+2^{(m-1)/2} \\ 0\le j \le 2^{m-1}-2^{(m-1)/2}-1 \\i+j=k}}(-1)^i \binom{2^{m-1}+2^{(m-1)/2}}{i}\binom{2^{m-1}-2^{(m-1)/2}-1}{j}, \end{eqnarray*} \begin{eqnarray*} U_e(k) &=& \sum_{\substack{0 \le i \le 2^{m-1}+2^{(m+1)/2} \\ 0\le j \le 2^{m-1}-2^{(m+1)/2}-1 \\i+j=k}}(-1)^i \binom{2^{m-1}+2^{(m+1)/2}}{i}\binom{2^{m-1}-2^{(m+1)/2}-1}{j}. \end{eqnarray*} \end{theorem} \begin{proof} By assumption, the weight enumerator of ${\mathcal{C}}_{m}$ is given by $$ A(z)=1+az^{2^{m-1}-2^{(m+1)/2}} +bz^{2^{m-1}-2^{(m-1)/2}} +cz^{2^{m-1}}+dz^{2^{m-1}+2^{(m-1)/2}} +ez^{2^{m-1}+2^{(m+1)/2}}. $$ It then follows from Theorem \ref{thm-MI} that the weight enumerator of ${\mathcal{C}}_{m}^\perp$ is given by \begin{eqnarray*} 2^{3m}A^\perp(z) &=& (1+z)^{2^m-1}\left[ 1 + a\left(\frac {1-z} {1+z}\right)^{2^{m-1}-2^{\frac{m+1}{2}}} + b\left(\frac {1-z} {1+z}\right)^{2^{m-1}-2^{ \frac{m-1}{2} }} \right] + \\ & & (1+z)^{2^m-1}\left[ c\left(\frac {1-z} {1+z}\right)^{2^{m-1}}+ d\left(\frac {1-z} {1+z}\right)^{2^{m-1}+2^{\frac{m-1}{2} }} + e\left(\frac {1-z} {1+z}\right)^{2^{m-1}+2^{ \frac{m+1}{2} }} \right]. \end{eqnarray*} Hence, we have \begin{eqnarray*} 2^{3m}A^\perp(z) &=& (1+z)^{2^m-1} + \\ & & a(1-z)^{2^{m-1}-2^{(m+1)/2}}(1+z)^{2^{m-1}+2^{(m+1)/2}-1} + \\ & & b(1-z)^{2^{m-1}-2^{(m-1)/2}}(1+z)^{2^{m-1}+2^{(m-1)/2}-1} + \\ & & c(1-z)^{2^{m-1}}(1+z)^{2^{m-1}-1} + \\ & & d(1-z)^{2^{m-1}+2^{(m-1)/2}}(1+z)^{2^{m-1}-2^{(m-1)/2}-1} + \\ & & e(1-z)^{2^{m-1}+2^{(m+1)/2}}(1+z)^{2^{m-1}-2^{(m+1)/2}-1}. \end{eqnarray*} Obviously, we have \begin{eqnarray*} (1+z)^{2^m-1} &=& \sum_{k=0}^{2^m-1} \binom{2^m-1}{k}z^k. \end{eqnarray*} It is easily seen that \begin{eqnarray*} (1-z)^{2^{m-1}-2^{(m+1)/2}}(1+z)^{2^{m-1}+2^{(m+1)/2}-1} = \sum_{k=0}^{2^m-1} U_a(k) z^k \end{eqnarray*} and \begin{eqnarray*} (1-z)^{2^{m-1}-2^{(m-1)/2}}(1+z)^{2^{m-1}+2^{(m-1)/2}-1} = \sum_{k=0}^{2^m-1} U_b(k) z^k. \end{eqnarray*} Similarly, \begin{eqnarray*} (1-z)^{2^{m-1}+2^{(m-1)/2}}(1+z)^{2^{m-1}-2^{(m-1)/2}-1} = \sum_{k=0}^{2^m-1} U_d(k) z^k \end{eqnarray*} and \begin{eqnarray*} (1-z)^{2^{m-1}+2^{(m+1)/2}}(1+z)^{2^{m-1}-2^{(m+1)/2}-1} = \sum_{k=0}^{2^m-1} U_e(k) z^k. \end{eqnarray*} Finally, we have \begin{eqnarray*} (1-z)^{2^{m-1}}(1+z)^{2^{m-1}-1}= \sum_{k=0}^{2^m-1} U_c(k) z^k. \end{eqnarray*} Combining these formulas above yields the weight distribution formula for $A_k^\perp$. The weight distribution in Table \ref{tab-zhou3} tells us that the dimension of ${\mathcal{C}}_{m}$ is $3m$. Therefore, the dimension of ${\mathcal{C}}_{m}^\perp$ is equal to $2^m-1-3m$. Finally, we prove that the minimum distance of ${\mathcal{C}}_{m}^\perp$ equals $7$. We now prove that $A_k^\perp=0$ for all $k$ with $1 \leq k \leq 6$. Let $x=2^{(m-1)/2}$. With the weight distribution formula obtained before, we have \begin{eqnarray*} \binom{2^m-1}{1} &=& 2x^2 - 1,\\ a U_a(1) &=& 1/3 x^7 + 7/12 x^6 - 2/3 x^5 - 7/8 x^4 + 5/12 x^3 + 7/24 x^2 - 1/12 x, \\ b U_b(1) &=& 10/3x^7 + 5/3x^6 - 2/3x^5 + 1/2x^4 - 11/6x^3 - 2/3x^2 + 2/3x, \\ c U_c(1) &=& -9/2x^6 + 3/4x^4 - 5/4x^2 + 1, \\ d U_d(1) &=& -10/3x^7 + 5/3x^6 + 2/3x^5 + 1/2x^4 + 11/6x^3 - 2/3x^2 - 2/3x, \\ e U_e(1) &=& -1/3x^7 + 7/12x^6 + 2/3x^5 - 7/8x^4 - 5/12x^3 + 7/24x^2 + 1/12x. \end{eqnarray*} Consequently, \begin{eqnarray*} 2^{3m} A_1^\perp = \binom{2^m-1}{1} +a U_a(1) + b U_b(1) + c U_c(1) + d U_d(1) + e U_e(1)=0. \end{eqnarray*} Plugging $k=2$ into the weight distribution formula above, we get that \begin{eqnarray*} \binom{2^m-1}{2} &=& 2x^4 - 3x^2 + 1,\\ a U_a(2) &=& 7/12x^8 + 5/6x^7 - 35/24x^6 - 13/12x^5 + 7/6x^4 + 1/6x^3 - 7/24x^2 + 1/12x,\\ b U_b(2) &=& 5/3x^8 - 5/3x^7 - 7/6x^6 + 7/6x^5 - 7/6x^4 + 7/6x^3 + 2/3x^2 - 2/3x, \\ c U_c(2) &=& -9/2x^8 + 21/4x^6 - 2x^4 + 9/4x^2 - 1, \\ d U_d(2) &=& 5/3x^8 + 5/3x^7 - 7/6x^6 - 7/6x^5 - 7/6x^4 - 7/6x^3 + 2/3x^2 + 2/3x, \\ e U_e(2) &=& 7/12x^8 - 5/6x^7 - 35/24x^6 + 13/12x^5 + 7/6x^4 - 1/6x^3 - 7/24x^2 - 1/12x. \end{eqnarray*} Consequently, \begin{eqnarray*} 2^{3m} A_2^\perp = \binom{2^m-1}{2} +a U_a(2) + b U_b(2) + c U_c(2) + d U_d(2) + e U_e(2)=0. \end{eqnarray*} After similar computations with the weight distribution formula, one can prove that $A_k^\perp=0$ for all $k$ with $3 \leq k \leq 6$. Plugging $k=7$ into the weight distribution formula above, we arrive at \begin{eqnarray*} A_7^\perp = \frac{(x^2-1) (2x^2 - 1) (x^4 - 5x^2 + 34)}{630} . \end{eqnarray*} Notice that $x^4 - 5x^2 + 34=(x^2-5/2)^2 +34-25/4 >0$. We have $A_7^\perp >0$ for all odd $m \geq 5$. This proves the desired conclusion on the minimum distance of ${\mathcal{C}}_{m}^\perp$. \end{proof} \begin{theorem}\label{thm-lastcode} Let $m \geq 5$ be an odd integer and let ${\mathcal{C}}_m$ be a binary code with the weight distribution of Table \ref{tab-zhou3}. The code $\overline{{\mathcal{C}}_{m}^\perp}^\perp$ has parameters $$ \left[2^m, \, 3m+1, \, 2^{m-1}-2^{(m+1)/2}\right], $$ and its weight enumerator is given by \begin{eqnarray}\label{eqn-doubledual} \overline{A^\perp}^\perp (z) = 1+uz^{2^{m-1}-2^{\frac{m+1}{2} }} + vz^{2^{m-1}-2^{ \frac{m-1}{2}}} + wz^{2^{m-1}} + vz^{2^{m-1}+2^{ \frac{m-1}{2}}} + uz^{2^{m-1}+2^{\frac{m+1}{2} }} +z^{2^m}, \end{eqnarray} where \begin{eqnarray*} u &=& \frac{2^{3m-4} - 3 \times 2^{2m-4} + 2^{m-3}}{3}, \\ v &=& \frac{5\times 2^{3m-2} + 3 \times 2^{2m-2} - 2^{m+1}}{3} , \\ w &=& {2(2^m-1)} (9\times 2^{2m-4}+3\times 2^{m-3}+1). \end{eqnarray*} \end{theorem} \begin{proof} It follows from Theorem \ref{thm-allcodes} that the code has all the weights given in (\ref{eqn-doubledual}). It remains to determine the frequencies of these weights. The weight distribution of the code ${\mathcal{C}}_{m}$ given in Table \ref{tab-zhou3} and the generator matrix of the code $\overline{{\mathcal{C}}_{m}^\perp}^\perp$ documented in the proof of Theorem \ref{thm-allcodes} show that $$ \overline{A^\perp}^\perp_{2^{m-1}}=2c=w, $$ where $c$ was defined in Theorem \ref{thm-BCHcodeDual}. We now determine $u$ and $v$. Recall that ${\mathcal{C}}_{m}^\perp$ has minimum distance $7$. It then follows from Theorem \ref{thm-allcodes} that $\overline{{\mathcal{C}}_{m}^\perp}$ has minimum distance $8$. The first and third Pless power moments say that \begin{eqnarray*} \left\{ \begin{array}{lll} \sum_{i=0}^{2^m} \overline{A^\perp}^\perp_{i} &=& 2^{3m+1}, \\ \sum_{i=0}^{2^m} i^2 \overline{A^\perp}^\perp_{i} &=& 2^{3m-1} 2^m(2^m+1). \end{array} \right. \end{eqnarray*} These two equations become \begin{eqnarray*} \left\{ \begin{array}{l} 1+u+v+c = 2^{3m}, \\ (2^{2m-2} +2^{m+1}) u + (2^{2m-2} +2^{m-1}) v + 2^{2m-2}c + 2^{2m-1} = 2^{4m-2}(2^m+1). \end{array} \right. \end{eqnarray*} Solving this system of equations proves the desired conclusion on the weight enumerator of this code. \end{proof} Finally, we settle the weight distribution of the code $\overline{{\mathcal{C}}_{m}^\perp}$. \begin{theorem}\label{thm-3rdcode} Let $m \geq 5$ be an odd integer and let ${\mathcal{C}}_m$ be a binary code with the weight distribution of Table \ref{tab-zhou3}. The code $\overline{{\mathcal{C}}_{m}^\perp}$ has parameters $[2^m, 2^m-1-3m, 8]$, and its weight distribution is given by \begin{eqnarray} 2^{3m+1}\overline{A^\perp}_k &=& \left(1+(-1)^k \right) \binom{2^m}{k} + w E_0(k) + u E_1(k) + v E_2(k) + v E_3(k) +u E_4(k), \end{eqnarray} where $w, u, v$ are defined in Theorem \ref{thm-lastcode}, and \begin{eqnarray*} E_0(k) = \frac{1+(-1)^k}{2} (-1)^{\lfloor k/2 \rfloor} \binom{2^{m-1}}{\lfloor k/2 \rfloor}, \end{eqnarray*} \begin{eqnarray*} E_1(k) = \sum_{\substack{0 \le i \le 2^{m-1}-2^{(m+1)/2} \\ 0\le j \le 2^{m-1}+2^{(m+1)/2} \\i+j=k}}(-1)^i \binom{2^{m-1}-2^{(m+1)/2}} {i} \binom{2^{m-1}+2^{(m+1)/2}}{j}, \end{eqnarray*} \begin{eqnarray*} E_2(k) = \sum_{\substack{0 \le i \le 2^{m-1}-2^{(m-1)/2} \\ 0\le j \le 2^{m-1}+2^{(m-1)/2} \\i+j=k}}(-1)^i \binom{2^{m-1}-2^{(m-1)/2}} {i} \binom{2^{m-1}+2^{(m-1)/2}}{j}, \end{eqnarray*} \begin{eqnarray*} E_3(k) = \sum_{\substack{0 \le i \le 2^{m-1}+2^{(m-1)/2} \\ 0\le j \le 2^{m-1}-2^{(m-1)/2} \\i+j=k}}(-1)^i \binom{2^{m-1}+2^{(m-1)/2}} {i} \binom{2^{m-1}-2^{(m-1)/2}}{j}, \end{eqnarray*} \begin{eqnarray*} E_4(k) = \sum_{\substack{0 \le i \le 2^{m-1}+2^{(m+1)/2} \\ 0\le j \le 2^{m-1}-2^{(m+1)/2} \\i+j=k}}(-1)^i \binom{2^{m-1}+2^{(m+1)/2}} {i} \binom{2^{m-1}-2^{(m+1)/2}}{j}, \end{eqnarray*} and $0 \leq k \leq 2^m$. \end{theorem} \begin{proof} By definition, $$ \dim\left( \overline{{\mathcal{C}}_{m}^\perp} \right) = \dim\left({\mathcal{C}}_{m}^\perp \right)=2^m-1-3m. $$ It has been showed in the proof of Theorem \ref{thm-BCHcodeDual} that the minimum distance of $\overline{{\mathcal{C}}_{m}^\perp}$ is equal to $8$. We now prove the conclusion on the weight distribution of this code. By Theorems \ref{thm-MI} and \ref{thm-lastcode}, the weight enumerator of $\overline{{\mathcal{C}}_{m}^\perp}$ is given by \begin{eqnarray}\label{eqn-july0} 2^{3m+1}\overline{A^\perp}(z) &=& (1+z)^{2^m}\left[ 1 + \left(\frac{1-z}{1+z}\right)^{2^m} + w\left(\frac {1-z} {1+z}\right)^{2^{m-1}} \right] + \nonumber \\ & & (1+z)^{2^m}\left[ u\left(\frac {1-z} {1+z}\right)^{2^{m-1}-2^{\frac{m+1}{2} }}+ v \left(\frac {1-z} {1+z}\right)^{2^{m-1}-2^{\frac{m-1}{2} }} \right] + \nonumber \\ && (1+z)^{2^m}\left[ v \left(\frac {1-z} {1+z}\right)^{2^{m-1}+2^{\frac{m-1}{2} }} + u\left(\frac {1-z} {1+z}\right)^{2^{m-1}+2^{\frac{m+1}{2}}} \right]. \end{eqnarray} Consequently, we have \begin{eqnarray}\label{eqn-j18-1} 2^{3m+1}\overline{A^\perp}(z) &=& (1+z)^{2^m} + (1-z)^{2^m} + w (1-z^2)^{2^{m-1}} + \nonumber \\ & & u(1-z)^{2^{m-1}-2^{(m+1)/2}}(1+z)^{2^{m-1}+2^{(m+1)/2}} + \nonumber \\ & & v(1-z)^{2^{m-1}-2^{(m-1)/2}}(1+z)^{2^{m-1}+2^{(m-1)/2}} + \nonumber \\ & & v(1-z)^{2^{m-1}+2^{(m-1)/2}}(1+z)^{2^{m-1}-2^{(m-1)/2}} + \nonumber \\ & & u(1-z)^{2^{m-1}+2^{(m+1)/2}}(1+z)^{2^{m-1}-2^{(m+1)/2}}. \end{eqnarray} We now treat the terms in (\ref{eqn-j18-1}) one by one. We first have \begin{eqnarray}\label{eqn-j18-2} (1+z)^{2^m} + (1-z)^{2^m} = \sum_{k=0}^{2^m} \left(1+(-1)^k \right) \binom{2^m}{k}. \end{eqnarray} One can easily see that \begin{eqnarray}\label{eqn-j18-3} (1-z^2)^{2^{m-1}} = \sum_{i=0}^{2^{m-1}} (-1)^i \binom{2^{m-1}}{i} z^{2i} = \sum_{k=0}^{2^{m}} \frac{1+(-1)^k}{2} (-1)^{\lfloor k/2 \rfloor} \binom{2^{m-1}}{\lfloor k/2 \rfloor} z^{k}. \end{eqnarray} Notice that \begin{eqnarray*} (1-z)^{2^{m-1}-2^{(m+1)/2}}=\sum_{i=0}^{2^{m-1}-2^{(m+1)/2}} \binom{2^{m-1}-2^{(m+1)/2}}{i} (-1)^i z^i \end{eqnarray*} and \begin{eqnarray*} (1+z)^{2^{m-1}+2^{(m+1)/2}}=\sum_{i=0}^{2^{m-1}+2^{(m+1)/2}} \binom{2^{m-1}+2^{(m+1)/2}}{i} z^i \end{eqnarray*} We have then \begin{eqnarray}\label{eqn-j18-4} (1-z)^{2^{m-1}-2^{(m+1)/2}} (1+z)^{2^{m-1}+2^{(m+1)/2}} = \sum_{k=0}^{2^m} E_1(k) z^k. \end{eqnarray} Similarly, we have \begin{eqnarray}\label{eqn-j18-5} (1-z)^{2^{m-1}-2^{(m-1)/2}} (1+z)^{2^{m-1}+2^{(m-1)/2}} = \sum_{k=0}^{2^m} E_2(k) z^k, \end{eqnarray} \begin{eqnarray}\label{eqn-j18-6} (1-z)^{2^{m-1}+2^{(m-1)/2}} (1+z)^{2^{m-1}-2^{(m-1)/2}} = \sum_{k=0}^{2^m} E_3(k) z^k, \end{eqnarray} \begin{eqnarray}\label{eqn-j18-7} (1-z)^{2^{m-1}+2^{(m+1)/2}} (1+z)^{2^{m-1}-2^{(m+1)/2}} = \sum_{k=0}^{2^m} E_4(k) z^k. \end{eqnarray} Plugging (\ref{eqn-j18-2}), (\ref{eqn-j18-3}), (\ref{eqn-j18-4}), (\ref{eqn-j18-5}), (\ref{eqn-j18-6}), and (\ref{eqn-j18-7}) into (\ref{eqn-j18-1}) proves the desired conclusion. \end{proof} \section{Infinite families of $2$-designs from ${\mathcal{C}}_{m}^\perp$ and ${\mathcal{C}}_{m}$}\label{sec-2designs} \begin{theorem}\label{thm-2designs} Let $m \geq 5$ be an odd integer and let ${\mathcal{C}}_m$ be a binary code with the weight distribution of Table \ref{tab-zhou3}. Let ${\mathcal{P}}=\{0,1,2, \cdots, 2^m-2\}$, and let ${\mathcal{B}}$ be the set of the supports of the codewords of ${\mathcal{C}}_{m}$ with weight $k$, where $A_k \neq 0$. Then $({\mathcal{P}}, {\mathcal{B}})$ is a $2$-$(2^m-1, k, \lambda)$ design, where \begin{eqnarray*} \lambda=\frac{k(k-1)A_k}{(2^m-1)(2^m-2)}, \end{eqnarray*} where $A_k$ is given in Table \ref{tab-zhou3}. Let ${\mathcal{P}}=\{0,1,2, \cdots, 2^m-2\}$, and let ${\mathcal{B}}^\perp$ be the set of the supports of the codewords of ${\mathcal{C}}_{m}^\perp$ with weight $k$ and $A_k^\perp \neq 0$. Then $({\mathcal{P}}, {\mathcal{B}}^\perp)$ is a $2$-$(2^m-1, k, \lambda)$ design, where \begin{eqnarray*} \lambda=\frac{k(k-1)A_k^\perp}{(2^m-1)(2^m-2)}, \end{eqnarray*} where $A_k^\perp$ is given in Theorem \ref{thm-BCHcodeDual}. \end{theorem} \begin{proof} The weight distribution of ${\mathcal{C}}_{m}^\perp$ is given in Theorem \ref{thm-BCHcodeDual} and that of ${\mathcal{C}}_{m}$ is given in Table \ref{tab-zhou3}. By Theorem \ref{thm-BCHcodeDual}, the minimum distance $d^\perp$ of ${\mathcal{C}}_{m}^\perp$ is equal to $7$. Put $t=2$. The number of $i$ with $A_i \neq 0$ and $1 \leq i \leq 2^m-1 -t$ is $s=5$. Hence, $s=d^\perp-t$. The desired conclusions then follow from Theorem \ref{thm-AM1} and the fact that two binary vectors have the same support if and only if they are equal. \end{proof} \begin{example} Let $m \geq 5$ be an odd integer and let ${\mathcal{C}}_m$ be a binary code with the weight distribution of Table \ref{tab-zhou3}. Then the BCH code ${\mathcal{C}}_{m}$ holds five $2$-designs with the following parameters: \begin{itemize} \item $(v,\, k, \, \lambda)=\left(2^m-1,\ 2^{m-1}-2^{\frac{m+1}{2}}, \ \frac{2^{\frac{m-5}{2}} \left(2^{\frac{m-3}{2}}+1\right) \left(2^{m-1} - 2^{\frac{m+1}{2}} \right)\left(2^{m-1} - 2^{\frac{m+1}{2}} -1\right)}{6} \right).$ \item $(v,\, k, \, \lambda)=\left(2^m-1,\ 2^{m-1}-2^{\frac{m-1}{2}}, \ \frac{2^{m-2} \left(2^{m-1} - 2^{\frac{m-1}{2} } -1 \right)\left( 5 \times 2^{m-1} + 4 \right)}{6} \right).$ \item $(v, \, k, \, \lambda)=\left(2^m-1, \ 2^{m-1}, \ 2^{m-2} (9 \times 2^{2m-4}+ 3 \times 2^{m-3} +1) \right).$ \item $(v,\, k, \, \lambda)=\left(2^m-1,\ 2^{m-1}+2^{\frac{m-1}{2}}, \ \frac{2^{m-2} \left(2^{m-1} + 2^{\frac{m-1}{2} } -1 \right)\left( 5 \times 2^{m-1} + 4 \right)}{6} \right).$ \item $(v,\, k, \, \lambda)=\left(2^m-1,\ 2^{m-1}+2^{\frac{m+1}{2}}, \ \frac{2^{\frac{m-5}{2}} \left(2^{\frac{m-3}{2}}-1\right) \left(2^{m-1} + 2^{\frac{m+1}{2}} \right)\left(2^{m-1} + 2^{\frac{m+1}{2}} -1\right)}{6} \right).$ \end{itemize} \end{example} \begin{example} Let $m \geq 5$ be an odd integer and let ${\mathcal{C}}_m$ be a binary code with the weight distribution of Table \ref{tab-zhou3}. Then the supports of all codewords of weight $7$ in ${\mathcal{C}}_{m}^\perp$ give a $2$-$(2^m-1, 7, \lambda)$ design, where $$ \lambda=\frac{ 2^{2(m-1)} - 5 \times 2^{m-1} + 34 }{30}. $$ \end{example} \begin{proof} By Theorem \ref{thm-BCHcodeDual}, we have $$ A^\perp_7=\frac{(2^{m-1}-1) (2^m-1) (2^{2(m-1)} - 5 \times 2^{m-1} + 34)}{630}. $$ The desired conclusion on $\lambda$ follows from Theorem \ref{thm-2designs}. \end{proof} \begin{example} Let $m \geq 5$ be an odd integer and let ${\mathcal{C}}_m$ be a binary code with the weight distribution of Table \ref{tab-zhou3}. Then the supports of all codewords of weight $8$ in ${\mathcal{C}}_{m}^\perp$ give a $2$-$(2^m-1, 8, \lambda)$ design, where $$ \lambda=\frac{ (2^{m-1}-4)(2^{2(m-1)} - 5 \times 2^{m-1} + 34) }{90}. $$ \end{example} \begin{proof} By Theorem \ref{thm-BCHcodeDual}, we have $$ A^\perp_8=\frac{(2^{m-1}-1) (2^{m-1}-4) (2^m-1) (2^{2(m-1)} - 5 \times 2^{m-1} + 34)}{2520}. $$ The desired conclusion on $\lambda$ follows from Theorem \ref{thm-2designs}. \end{proof} \begin{example} Let $m \geq 7$ be an odd integer and let ${\mathcal{C}}_m$ be a binary code with the weight distribution of Table \ref{tab-zhou3}. Then the supports of all codewords of weight $9$ in ${\mathcal{C}}_{m}^\perp$ give a $2$-$(2^m-1, 9, \lambda)$ design, where $$ \lambda=\frac{ (2^{m-1}-4)(2^{m-1}-16)(2^{2(m-1)} - 2^{m-1} + 28) }{315}. $$ \end{example} \begin{proof} By Theorem \ref{thm-BCHcodeDual}, we have $$ A^\perp_9=\frac{(2^{m-1}-1) (2^{m-1}-4) (2^{m-1}-16) (2^m-1) (2^{2(m-1)} - 2^{m-1} + 28)}{11340}. $$ The desired conclusion on $\lambda$ follows from Theorem \ref{thm-2designs}. \end{proof} \section{Infinite families of $3$-designs from $\overline{{\mathcal{C}}_{m}^\perp}$ and $\overline{{\mathcal{C}}_{m}^\perp}^\perp$}\label{sec-3designs} \begin{theorem}\label{thm-newdesigns2} Let $m \geq 5$ be an odd integer and let ${\mathcal{C}}_m$ be a binary code with the weight distribution of Table \ref{tab-zhou3}. Let ${\mathcal{P}}=\{0,1,2, \cdots, 2^m-1\}$, and let $\overline{{\mathcal{B}}^\perp}^\perp$ be the set of the supports of the codewords of $\overline{{\mathcal{C}}_{m}^\perp}^\perp$ with weight $k$, where $\overline{A^\perp}^\perp_k \neq 0$. Then $({\mathcal{P}}, \overline{{\mathcal{B}}^\perp}^\perp)$ is a $3$-$(2^m, k, \lambda)$ design, where \begin{eqnarray*} \lambda=\frac{\overline{A^\perp}^\perp_k\binom{k}{3}}{\binom{2^m}{3}}, \end{eqnarray*} where $\overline{A^\perp}^\perp_k$ is given in Theorem \ref{thm-lastcode}. Let ${\mathcal{P}}=\{0,1,2, \cdots, 2^m-1\}$, and let $\overline{{\mathcal{B}}^\perp}$ be the set of the supports of the codewords of $\overline{{\mathcal{C}}_{m}^\perp}$ with weight $k$ and $\overline{A^\perp}_k \neq 0$. Then $({\mathcal{P}}, \overline{{\mathcal{B}}^\perp})$ is a $3$-$(2^m, k, \lambda)$ design, where \begin{eqnarray*} \lambda=\frac{\overline{A^\perp}_k \binom{k}{3}}{\binom{2^m}{3}}, \end{eqnarray*} where $\overline{A^\perp}_k$ is given in Theorem \ref{thm-3rdcode}. \end{theorem} \begin{proof} The weight distributions of $\overline{{\mathcal{C}}_{m}^\perp}^\perp$ and $\overline{{\mathcal{C}}_{m}^\perp}$ are described in Theorems \ref{thm-lastcode} and \ref{thm-3rdcode}. Notice that the minimum distance $\overline{d^\perp}$ of $\overline{{\mathcal{C}}_{m}^\perp}^\perp$ is equal to $8$. Put $t=3$. The number of $i$ with $\overline{A^\perp}_i \neq 0$ and $1 \leq i \leq 2^m -t$ is $s=5$. Hence, $s=\overline{d^\perp}-t$. Clearly, two binary vectors have the same support if and only if they are equal. The desired conclusions then follow from Theorem \ref{thm-AM1}. \end{proof} \begin{example} Let $m \geq 5$ be an odd integer and let ${\mathcal{C}}_m$ be a binary code with the weight distribution of Table \ref{tab-zhou3}. Then $\overline{{\mathcal{C}}_{m}^\perp}^\perp$ holds five $3$-designs with the following parameters: \begin{itemize} \item $(v,\, k, \, \lambda)=\left(2^m,\ 2^{m-1}-2^{\frac{m+1}{2}}, \ \frac{ \left(2^{m-1} - 2^{\frac{m+1}{2}} \right) \left(2^{m-1} - 2^{\frac{m+1}{2}} -1\right) \left(2^{m-1} - 2^{\frac{m+1}{2}} -2\right)}{48} \right).$ \item $(v,\, k, \, \lambda)=\left(2^m,\ 2^{m-1}-2^{\frac{m-1}{2}}, \ \frac{ 2^{\frac{m-1}{2} } \left(2^{m-1} - 2^{\frac{m-1}{2} } -1 \right) \left( 2^{\frac{m-1}{2} } -2 \right)\left( 5 \times 2^{m-3} + 1 \right)}{3} \right).$ \item $(v, \, k, \, \lambda)=\left(2^m, \ 2^{m-1}, \ (2^{m-2}-1) (9 \times 2^{2m-4}+ 3 \times 2^{m-3} +1) \right).$ \item $(v,\, k, \, \lambda)=\left(2^m,\ 2^{m-1}+2^{\frac{m-1}{2}}, \ \frac{ 2^{\frac{m-1}{2} } \left(2^{m-1} + 2^{\frac{m-1}{2} } -1 \right) \left( 2^{\frac{m-1}{2} } +2 \right)\left( 5 \times 2^{m-3} + 1 \right)}{3} \right).$ \item $(v,\, k, \, \lambda)=\left(2^m,\ 2^{m-1}+2^{\frac{m+1}{2}}, \ \frac{ \left(2^{m-1} + 2^{\frac{m+1}{2}} \right) \left(2^{m-1} + 2^{\frac{m+1}{2}} -1\right) \left(2^{m-1} + 2^{\frac{m+1}{2}} -2\right)}{48} \right).$ \end{itemize} \end{example} \begin{example} Let $m \geq 5$ be an odd integer and let ${\mathcal{C}}_m$ be a binary code with the weight distribution of Table \ref{tab-zhou3}. Then the supports of all codewords of weight $8$ in $\overline{{\mathcal{C}}_{m}^\perp}$ give a $3$-$(2^m, 8, \lambda)$ design, where $$ \lambda=\frac{2^{2(m-1)} - 5 \times 2^{m-1}+34}{30}. $$ \end{example} \begin{proof} By Theorem \ref{thm-3rdcode}, we have $$ \overline{A^\perp}_8=\frac{2^m(2^{m-1}-1)(2^m-1)(2^{2(m-1)} - 5 \times 2^{m-1}+34)}{315}. $$ The desired value of $\lambda$ follows from Theorem \ref{thm-newdesigns2}. \end{proof} \begin{example} Let $m \geq 7$ be an odd integer and let ${\mathcal{C}}_m$ be a binary code with the weight distribution of Table \ref{tab-zhou3}. Then the supports of all codewords of weight $10$ in $\overline{{\mathcal{C}}_{m}^\perp}$ give a $3$-$(2^m, 10, \lambda)$ design, where $$ \lambda=\frac{(2^{m-1}-4) (2^{m-1}-16) (2^{2(m-1)}-2^{m-1}+28)}{315}. $$ \end{example} \begin{proof} By Theorem \ref{thm-3rdcode}, we have $$ \overline{A^\perp}_{10}=\frac{2^{m-1}(2^{m-1}-1)(2^m-1)(2^{m-1}-4) (2^{m-1}-16) (2^{2(m-1)}-2^{m-1}+28) }{4 \times 14175}. $$ The desired value of $\lambda$ follows from Theorem \ref{thm-newdesigns2}. \end{proof} \begin{example} Let $m \geq 5$ be an odd integer and let ${\mathcal{C}}_m$ be a binary code with the weight distribution of Table \ref{tab-zhou3}. Then the supports of all codewords of weight $12$ in $\overline{{\mathcal{C}}_{m}^\perp}$ give a $3$-$(2^m, 12, \lambda)$ design, where $$ \lambda=\frac{(2^{h-2}-1) (2 \times 2^{5h} - 55 \times 2^{4h} + 647 \times 2^{3h} - 2727 \times 2^{2h} + 11541 \times 2^{h} - 47208)}{2835} $$ and $h=m-1$. \end{example} \begin{proof} By Theorem \ref{thm-3rdcode}, we have $$ \overline{A^\perp}_{12}=\frac{\epsilon^2 (\epsilon^2-1) (\epsilon^2-4) (2 \epsilon^2-1) (2 \epsilon^{10} - 55 \epsilon^8 + 647 \epsilon^6 - 2727 \epsilon^4 + 11541 \epsilon^2 - 47208) }{8 \times 467775}, $$ where $\epsilon=2^{(m-1)/2}$. The desired value of $\lambda$ follows from Theorem \ref{thm-newdesigns2}. \end{proof} \section{Two families of binary cyclic codes with the weight distribution of Table \ref{tab-zhou3}}\label{sec-examplecodes} To prove the existence of the $2$-designs in Section \ref{sec-2designs} and the $3$-designs in Section \ref{sec-3designs}, we present two families of binary codes of length $2^m-1$ with the weight distribution of Table \ref{tab-zhou3}. Let $n=q^m-1$, where $m$ is a positive integer. Let $\alpha$ be a generator of ${\mathrm{GF}}(q^m)^*$. For any $i$ with $0 \leq i \leq n-1$, let $\mathbb{M}_i(x)$ denote the minimal polynomial of $\beta^i$ over ${\mathrm{GF}}(q)$. For any $2 \leq \delta \leq n$, define \begin{eqnarray}\label{eqn-BCHgeneratorPolyn} g_{(q,n,\delta,b)}(x)={\mathrm{lcm}}(\mathbb{M}_{b}(x), \mathbb{M}_{b+1}(x), \cdots, \mathbb{M}_{b+\delta-2}(x)), \end{eqnarray} where $b$ is an integer, ${\mathrm{lcm}}$ denotes the least common multiple of these minimal polynomials, and the addition in the subscript $b+i$ of $\mathbb{M}_{b+i}(x)$ always means the integer addition modulo $n$. Let ${\mathcal{C}}_{(q, n, \delta,b)}$ denote the cyclic code of length $n$ with generator polynomial $g_{(q, n,\delta, b)}(x)$. ${\mathcal{C}}_{(q, n, \delta, b)}$ is called a \emph{primitive BCH code} with \emph{designed distance} $\delta$. When $b=1$, the set ${\mathcal{C}}_{(q, n, \delta, b)}$ is called a \emph{narrow-sense primitive BCH code}. Although primitive BCH codes are not good asymptotically, they are among the best linear codes when the length of the codes is not very large \cite[Appendix A]{DingBook}. So far, we have very limited knowledge of BCH codes, as the dimension and minimum distance of BCH codes are in general open, in spite of some recent progress \cite{Ding,DDZ15}. However, in a few cases the weight distribution of a BCH code can be settled. The following theorem introduces such a case. \begin{theorem}\label{thm-BCHcode} Let $m \geq 5$ be an odd integer and let $\delta=2^{m-1}-1-2^{(m+1)/2}$. Then the BCH code ${\mathcal{C}}_{(2, 2^m-1, \delta, 0)}$ has length $n=2^m-1$, dimension $3m$, and the weight distribution in Table \ref{tab-zhou3}. \end{theorem} \begin{proof} A proof can be found in \cite{DFZ}. \end{proof} It is known that the dual of a BCH code may not be a BCH code. The following theorem describes a family of cyclic codes having the weight distribution of Table \ref{tab-zhou3}, which may not be BCH codes. \begin{theorem} Let $m \geq 5$ be an odd integer. Let ${\mathcal{C}}_m$ be the dual of the narrow-sense primitive BCH code ${\mathcal{C}}_{(2, 2^m-1, 7, 1)}$. Then ${\mathcal{C}}_m$ has the weight distribution of Table \ref{tab-zhou3}. \end{theorem} \begin{proof} A proof can be found in \cite{Kasa69}. \end{proof} \section{Summary and concluding remarks} In this paper, with any binary linear code of length $2^m-1$ and the weight distribution of Table \ref{tab-zhou3}, a huge number of infinite families of $2$-designs and $3$-designs with various block sizes were constructed. These constructions clearly show that the coding theory approach to constructing $t$-designs are in fact promising, and may stimulate further investigations in this direction. It is open if the codewords of a fixed weight in a family of linear codes can hold an infinite family of $t$-designs for some $t \geq 4$. It is noticed that the technical details of this paper are tedious. However, one has to settle the weight distribution of a linear code and the minimum distance of its dual at the same time, if one would like to employ the Assmus-Mattson Theorem for the construction of $t$-designs. Note that it could be very difficult to prove that a linear code has minimum weight $7$. This explains why the proofs of some of the theorems are messy and tedious, but necessary. \section*{Acknowledgments} The research of C. Ding was supported by the Hong Kong Research Grants Council, under Project No. 16300415.
{'timestamp': '2016-07-19T02:05:49', 'yymm': '1607', 'arxiv_id': '1607.04815', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04815'}
arxiv
\section{Proof of Theorem~\ref{the:gl}}\label{sec:algorithm} In this section, we prove Theorem~\ref{the:gl}. Throughout this section, $G:[0,1]^E \to \mathbb{R}_+$ denotes the multilinear extension of $g$, while $L:[0,1]^E \to \mathbb{R}_+$ and $W:[0,1]^E \to \mathbb{R}_+$ denote the following linear functions: \begin{align*} L({\bm x}) = \sum_{e \in E}{\bm x}(e)\ell(e) \quad \text{and} \quad W({\bm x}) = \sum_{e \in E}{\bm x}(e)w(e). \end{align*} Furthermore, we define $d_g = \max_{e \in E} g(e)$, $d_\ell = \max_{e \in E} \ell(e)$, and $d_{g,\ell} = \max(d_g,d_\ell)$. Note that we have $g(O) \leq nd_g \leq nd_{g,\ell}$, $\ell(O) \leq nd_\ell \leq nd_{g,\ell}$, and $d_{g,\ell} \leq g(O)+\ell(O) \leq 2n d_{g,\ell}$. Recall that $n = |E|$. In Section~\ref{subsec:small}, we argue that we need to deal with ``small'' and ``large'' elements separately in order to guarantee that we get a set satisfying the knapsack constraint after rounding. Our algorithm updates a vector ${\bm x} \in [0,1]^E$ in several iterations and then rounds it. In Section~\ref{subsec:small-continous-greedy}, we present an algorithm that updates ${\bm x}$ by adding a vector supported on small elements. In Section~\ref{subsec:general-continuous-greedy}, we present the entire algorithm that computes the vector ${\bm x}$ by taking large elements into account. Then, in Section~\ref{subsec:rounding}, we describe our rounding procedure. We need to guess several parameters when running the algorithms in Section~\ref{subsec:small-continous-greedy} and~\ref{subsec:general-continuous-greedy}. Our final algorithm with the guessing process is presented in Section~\ref{subsec:final}. \input{small} \input{small-algorithm} \input{general-algorithm} \input{rounding} \input{entire} \section{The Budget Allocation Problem}\label{sec:applications} In this section, we bound the curvature of the submodular function that represents the budget allocation problem, and we confirm that our algorithm can be applied to the budget allocation problem in order to obtain an approximation factor better than $1-1/e$. We formally define the budget allocation problem. The input consists of a bipartite graph with the bipartition $A \cup B$, a weight function $w:A \to [0,1]$, a capacity function $c: A \to \mathbb{N}$, and a probability function $p:A \to [0,1]$. Intuitively speaking, the sets $A$ and $B$ correspond to media channels and customers, respectively. Each edge $(a,b)$ in the bipartite graph represents the potential influence of media channel $a$ on customer $b$. Consider a budget allocation ${\bm b} \in \mathbb{Z}_+^A$ to $A$ with ${\bm b}(a) \leq c(a)$ and $\sum_{a \in A}{\bm b}(a) w(s) \leq 1$. If a node $a$ is allocated a budget of ${\bm b}(a)$, it makes ${\bm b}(a)$ independent trials to activate each adjacent node $b$. The probability that $b$ is activated by $a$ in each trial is $p(a)$. Thus, the probability that $b$ becomes active is \[ 1 - \prod_{a \in \Gamma(b)}p(a)^{{\bm b}(a)}, \] where $\Gamma(b)$ denotes the set of nodes in $A$ adjacent to $b$. Hence, the expected number of activated target nodes is \[ \sum_{b \in B}\Bigl(1 - \prod_{a \in \Gamma(b)}p(a)^{{\bm b}(a)}\Bigr). \] The objective of this problem is to find the budget allocation that maximizes the expected number of activated target nodes. We can recast the problem using a submodular function. For each $a \in A$, let $E_a = \set{(a,i) \mid i \in c(a)}$, and let $E = \bigcup_{a \in A}E_a$. Then, we define $f:2^E \to \mathbb{R}_+$ as \[ f(S) = \sum_{b \in B}\Bigl(1 - \prod_{a \in \Gamma(b)}p(a)^{|S \cap E_a|}\Bigr). \] Further, we define $w':2^E \to [0,1]$ to be $w'((a,i)) = w(a)$. Then, the budget allocation problem is equivalent to maximizing $f(S)$ subject to $w'(S) \leq 1$. We now observe several properties of $f$. \begin{lemma}\label{lem:ba-marginal-gain} Let $S \subsetneq E$ and $(a,i) \in E \setminus S$. Then, \[ f_S((a,i)) = \sum_{b \in B: a \in \Gamma(b)}(1-p(a))\prod_{a' \in \Gamma(b)}p(a')^{|S \cap E_{a'}|}. \] \end{lemma} \begin{proof} For each $b \in B$, we define a function $g^b:2^E \to \mathbb{R}_+$ as $g^b(T) = 1 - \prod_{a \in \Gamma(b)}p(a)^{|T \cap E_a|}$. Note that $f_S((a,i)) = \sum_{b \in B}g^b_S((a,i))$. If $a \not \in \Gamma(b)$, then we clearly have $g^b_S((a,i)) = 0$. If $a \in \Gamma(b)$, then we have \[ g^b_S((a,i)) = (1-p(a))\prod_{a' \in \Gamma(b)}p(a')^{|S \cap E_{a'}|}. \] Summing $g^b_S((a,i))$ over all $b \in B$, we obtain the claim. \end{proof} \begin{corollary}\label{cor:ba-submodular} The function $f$ is submodular. \end{corollary} \begin{proof} From Lemma~\ref{lem:ba-marginal-gain}, it is easy to see that $f_S((a,i)) \geq f_T((a,i))$ holds for $S \subseteq T\subsetneq E$ and $(a,i) \in E \setminus T$. \end{proof} \begin{corollary}\label{cor:ba-curvature} The curvature $c_f$ of $f$ satisfies \[ c_f \leq 1- \min_{a \in A}\min_{b \in B: a \in \Gamma(b)}p(a)^{c(a)-1}\prod_{a' \in \Gamma(b) \setminus \set{a}}p(a')^{c(a')}. \] \end{corollary} \begin{proof} From Lemma~\ref{lem:ba-marginal-gain}, we have \begin{align*} f_{E\setminus (a,i)}((a,i)) & = \sum_{b \in B: a \in \Gamma(b)}(1-p(a))p(a)^{c(a)-1}\prod_{a' \in \Gamma(b) \setminus \set{a}}p(a')^{c(a')}, \\ f((a,i)) & = \sum_{b \in B: a \in \Gamma(b)}(1-p(a)). \end{align*} Hence, \begin{align*} c_f & = 1 - \min_{(a,i) \in E}\frac{f_{E\setminus (a,i)}((a,i))}{f((a,i))}\\ & = 1- \min_{a \in A}\frac{\sum_{b \in B: a \in \Gamma(b)}(1-p(a))p(a)^{c(a)-1}\prod_{a' \in \Gamma(b) \setminus \set{a}}p(a')^{c(a')}}{\sum_{b \in B: a \in \Gamma(b)}(1-p(a))} \\ & \leq 1- \min_{a \in A}\min_{b \in B: a \in \Gamma(b)}p(a)^{c(a)-1}\prod_{a' \in \Gamma(b) \setminus \set{a}}p(a')^{c(a')}. \qedhere \end{align*} \end{proof} From our main result (Theorem~\ref{the:intro}) and Corollaries~\ref{cor:ba-submodular} and~\ref{cor:ba-curvature}, when the capacity of each node $a \in A$ is bounded by a constant and the number of vertices adjacent to each node $b\in B$ is bounded by a constant, we obtain a polynomial-time algorithm whose approximation ratio is strictly better than $1-1/e$. \subsection{Putting things together}\label{subsec:final} Now, we present our entire algorithm. The idea is to simply guess $v_g$, $v_\ell$, $m$, $\set{\gamma^t_i}$, $\set{\lambda_i}$, $\set{\gamma^t_{\rm S}}$, and $\lambda_{\rm S}$, run Algorithm~\ref{alg:greedy-general} with the guessed values, and then round the obtained vectors using Algorithm~\ref{alg:rounding}. Naively, we have $O(|V_{\epsilon,n}(g,\ell)|^{O(1/\epsilon)})=O((\log (n/\epsilon)/\epsilon)^{O(1/\epsilon)} )$ choices for the sequence $\set{\gamma^t_{\rm S}}$. We can decrease the number of choices since $g$ has a bounded curvature. If we have a guess $\gamma_{\rm S}^0$ such that $\gamma_{\rm S}^0 \geq g(O_{\rm S}) \geq (1-\epsilon)\gamma_{\rm S}^0$, then we must have $\gamma_{\rm S}^0 \geq g_{S}(O_{\rm S}) \geq (1-\epsilon)(1-c_g) \gamma_{\rm S}^0$ for any set $S \subseteq E$. Hence, it suffices to consider sequences whose maximum and minimum values are within a factor of $(1-\epsilon)(1-c_g)$. Let $V_{\epsilon,n,\gamma_{\rm S}^0}(g,\ell) := \set{v \in V_{\epsilon,n}(g,\ell) \mid v \geq (1-\epsilon)(1-c_g)\gamma_{\rm_S}^0}$. Then, the number of such sequences is at most $|V_{\epsilon,n}(g,\ell)| \cdot |V_{\epsilon,n,\gamma_{\rm S}^0}(g,\ell)|^{O(1/\epsilon)}$, which is much smaller than $O((\log (n/\epsilon)/\epsilon)^{O(1/\epsilon)})$. A detailed description of our algorithm is given in Algorithm~\ref{alg:knapsack}. \begin{algorithm}[t!] \caption{$\textsc{Knapsack}$}\label{alg:knapsack} \begin{algorithmic}[1] \Require{A monotone submodular function $g:2^E \to \mathbb{R}_+$, a linear function $\ell:2^E \to \mathbb{R}$, a weight function $w :E \to \mathbb{R}_+$, and $\epsilon \in (0,1)$.} \Ensure{A set $S \subseteq E$ satisfying $w(S) \leq 1$.} \For{each choice of $v_g,v_\ell \in V_{\epsilon,n}(g,\ell)$} \State{$E_{\rm L} \leftarrow$ the set of large elements with respect to $v_g$ and $v_\ell$.} \State{$E_{\rm S} \leftarrow$ the set of small elements with respect to $v_g$ and $v_\ell$.} \State{$\mathcal{S} \leftarrow \emptyset$.} \State{$M := \lfloor \frac{1}{(1-c_g)\epsilon^6}\rfloor$} \For{each choice of $m$ from $\set{0,1,\ldots,M}$} \For{each choice of $\set{\gamma^t_i},\set{\lambda_i}$ from $ V_{\epsilon,m}(g,\ell)/m$} \For{each choice of $\gamma^0_{\rm S}, \lambda_{\rm S}$ from $V_{\epsilon,n}(g,\ell)$} \For{each choice of $\set{\gamma_{\rm S}^\epsilon,\ldots,\gamma_{\rm S}^{1-\epsilon}}$ from $V_{\epsilon,n,\gamma_{\rm S}^0}(g,\ell)$} \State{$({\bm y}_1,\ldots,{\bm y}_m,{\bm z}) \leftarrow \textsc{GuessingContinuousGreedy}_{\epsilon,\epsilon}(g,\ell,w,E_{\rm L},E_{\rm S},m,\set{\gamma^t_i}, \set{\lambda_i},\set{\gamma^t_{\rm S}},\lambda_{\rm S})$.} \State{$S \leftarrow \textsc{Rounding}_\epsilon(w,E_{\rm L}, E_{\rm S}, m,\set{{\bm y}_i},{\bm z})$.} \State{$\mathcal{S} \leftarrow \mathcal{S} \cup \set{S}$.} \EndFor \EndFor \EndFor \EndFor \EndFor \State{\Return $\arg\max_{S \in \mathcal{S}}g(S)+\ell(S)$.} \end{algorithmic} \end{algorithm} \begin{proof}[Proof of Theorem~\ref{the:gl}] Consider the case that $v_g$ and $v_\ell$ satisfy~\eqref{eq:guess-g(O)-and-l(O)}, $m = |O_{\rm L}|$, and $\set{\gamma^t_i},\set{\lambda_i}$, $\set{\gamma^t_{\rm S}}$, and $\lambda_{\rm S}$ are good guesses. Let $S$ be the (random) set obtained with these guesses. By Lemma~\ref{lem:rounding}, we have \begin{align} \mathop{\mathbf{E}}[g(S) + \ell(S)] \geq (1-\epsilon)(\widehat{G}({\bm x}) + L({\bm x})) - O(\epsilon)(g(O)+\ell(O) + v_g + v_\ell). \label{eq:g(S)+l(S)} \end{align} Conditioned on the event that \textsf{GuessingContinuousGreedy} succeeds, by (i) and (ii) of Lemma~\ref{lem:continuous-greedy}, we get \begin{align} \eqref{eq:g(S)+l(S)} & \geq (1-\epsilon)(1-1/e-O(\epsilon))g(O) + (1-\epsilon)(1-O(\epsilon))\ell(O) - O(\epsilon)(g(O)+\ell(O)+v_g+v_\ell + 8 d_{g,\ell}) \nonumber \\ & \geq (1-1/e)g(O) + \ell(O) - O(\epsilon)(g(O)+\ell(O)). \label{eq:g(S)+l(S)-good} \end{align} Since \textsf{GuessingContinuousGreedy} succeeds with probability at least $1-\epsilon$, we get \begin{align*} \mathop{\mathbf{E}}[g(S) + \ell(S)] & \geq (1-\epsilon)\cdot \eqref{eq:g(S)+l(S)-good} \geq (1-1/e)g(O) + \ell(O) - O(\epsilon)(g(O)+\ell(O)). \end{align*} Since Algorithm~\ref{alg:knapsack} outputs the set with the maximum objective, we have the desired property on the objective value. It is clear that the output of Algorithm~\ref{alg:knapsack} has weight at most $1$ because \textsf{Rounding} always outputs a set of weight at most $1$. For arbitrary $\gamma \in V_{\epsilon,n}(g,\ell)$, the time complexity of Algorithm~\ref{alg:knapsack} is \begin{align*} & O\Bigl(\frac{nM^2}{\epsilon^3}\log \frac{n M}{\epsilon}+\frac{n^4}{\epsilon}+\frac{n^2}{\epsilon^3}\log \frac{1}{\epsilon}\Bigr) \cdot |V_{\epsilon,n}(g,\ell)|^{O(1)} \cdot |V_{\epsilon,n,\gamma}(g,\ell)|^{O(1/\epsilon)} \cdot |V_{\epsilon,m}(g,\ell)|^{O(M/\epsilon)}\\ & = O\Bigl(\frac{nM^2}{\epsilon^3}\log \frac{n M}{\epsilon}+\frac{n^4}{\epsilon}+\frac{n^2}{\epsilon^3}\log \frac{1}{\epsilon}\Bigr) \cdot \Bigl(\frac{\log (n/\epsilon)}{\epsilon} \Bigr)^{O(1)}\cdot \Bigl(\frac{1}{\epsilon}\log \frac{1}{1-c_g} \Bigr)^{O(1/\epsilon)} \cdot \Bigl(\frac{\log (M/\epsilon)}{\epsilon} \Bigr)^{O(M/\epsilon)}\\ & = O\Bigl(\frac{n}{(1-c_g)^2\epsilon^{15}}\log \frac{n}{(1-c_g)\epsilon}+\frac{n^4}{\epsilon}+\frac{n^2}{\epsilon^3}\log \frac{1}{\epsilon}\Bigr) \cdot \Bigl(\frac{\log n}{\epsilon} \Bigr)^{O(1)} \cdot \\ & \qquad \Bigl(\frac{1}{\epsilon}\log \frac{1}{1-c_g} \Bigr)^{O(1/\epsilon)} \cdot \Bigl(\frac{1}{\epsilon}\log \frac{1}{1-c_g} \Bigr)^{O(1/((1-c_g)\epsilon^7))}\\ & = O\Bigl(\frac{n^4\polylog(n)}{(1-c_g)^2}\Bigr) \cdot \Bigl(\frac{1}{\epsilon}\log \frac{1}{1-c_g} \Bigr)^{\poly(1/\epsilon)/(1-c_g)}. \end{align*} Hence, we have the desired time complexity. By replacing $\epsilon$ with $\epsilon/C$ for a large constant $C$ (to change $O(\epsilon)$ to $\epsilon$), we have the desired result. \end{proof} \subsection{Continuous greedy algorithm with guessing}\label{subsec:general-continuous-greedy} In this section, we present an algorithm whose goal is to output a vector ${\bm x} \in [0,1]^E$ such that (i) $G({\bm x}) \geq (1-1/e)g(O)$, (ii) $L({\bm x}) \geq \ell(O)$, and (iii) $W({\bm x}) \leq w(O)$. Our algorithm is a variant of the continuous greedy algorithm~\cite{Calinescu:2011ju} but differs in the following aspects: we consider two functions $g$ and $\ell$, and we handle large and small elements separately. Let $m$ be an integer given as a parameter, which is a guessed value of $|O_{\rm L}|$ (with respect to the current values of $v_g$ and $v_\ell$). Then, we make copies $E_1,\ldots,E_{m}$ of $E$ and define a set $\widehat{E} = \bigcup_{i \in [m]}E_i \cup E_{\rm S}$. Then, we define a function $\widehat{g} : 2^{\widehat{E}} \rightarrow \mathbb{R}_+$ as $\widehat{g}(S_1,S_2,\ldots,S_{m},S_{\rm S}) = g(S_1 \cup \cdots \cup S_{m} \cup S_{\rm S})$. We note that $\widehat{g}$ is a monotone submodular function. Let $\widehat{G}$ be the multilinear extension of $\widehat{g}$. We introduce a vector ${\bm y}_i \in [0,1]^E$ for each $i \in [m]$ and another vector ${\bm z} \in [0,1]^E$. We always guarantee that ${\bm y}_i\;(i \in [m])$ is supported on $E_i$ and ${\bm z}$ is supported on $E_{\rm S}$. Our algorithm runs in $1/\epsilon$ iterations and updates the vectors ${\bm y}_i\;(i \in [m])$ and ${\bm z}$ in each iteration. Here, we assume that $1/\epsilon$ is an integer; otherwise, we slightly decrease $\epsilon$. The final output is the sequence of vectors $({\bm y}_1,\ldots,{\bm y}_{m},{\bm z})$, and their sum ${\bm x} := \sum_{i \in [m]}{\bm y}_i + {\bm z}$ will satisfy the conditions stated initially in this section. We call the first iteration the iteration at time $0$, the second iteration the iteration at time $\epsilon$, and so on. To explain how we update the vectors, we introduce several notations. For $t = \set{0,\epsilon,\ldots,1}$, we define ${\bm y}^t_i\;(i \in [m])$ and ${\bm z}^t$ as the vectors ${\bm y}_i$ and ${\bm z}$ immediately before the iteration at time $t$. We note that ${\bm y}^0_i = {\bm 0}\;(i \in [m])$ and ${\bm z}^0 = {\bm 0}$ hold. We define ${\bm y}^1_i\;(i \in [m])$ and ${\bm z}^1$ as ${\bm y}_i\;(i \in [m])$ and ${\bm z}$, respectively, after the iteration at time $1-\epsilon$. Note that the algorithm outputs the sequence of vectors $({\bm y}^1_1,\ldots,{\bm y}^1_m,{\bm z}^1)$. Then, we define ${\bm x}^t = \sum_{i \in [m]}{\bm y}^t_i + {\bm z}^t$. Further, for $t \in \set{0,\epsilon,\ldots,1-\epsilon}$ and $i \in \set{0,1,\ldots,m}$, we define ${\bm x}^t_i = \sum_{j \leq i}{\bm y}^{t+ \epsilon}_j + \sum_{j > i}{\bm y}^t_j + {\bm z}^t$, i.e., the vector obtained after the iteration at time $t-\epsilon$ followed by updating ${\bm y}_1,\ldots,{\bm y}_i$. Note that ${\bm x}^t_0 = {\bm x}^t$. As in the argument in Section~\ref{subsec:small}, we try all possible values for guessing $|O_{\rm L}|$. Hence, in what follows, we assume that the guessed value $m$ is correct, i.e., $m = |O_{\rm L}|$. Let $o_1,\ldots,o_{m}$ be the large elements in $O$, i.e., $O_{\rm L} = \set{o_1,\ldots,o_m}$. For $i \in [m]$, let $\widehat{o}_i$ be the copy of $o_i$ in $E_i$. Then, we define $\widehat{O}_{\rm L} = \set{\widehat{o}_1,\ldots,\widehat{o}_m}$ and $\widehat{O} = \widehat{O}_{\rm L} \cup O_{\rm S} \subseteq \widehat{E}$. For each $i \in [m]$, we update the vector ${\bm y}_i^t$ to ${\bm y}_i^{t+\epsilon}$ by finding an element $e_i^t \in E_i$ and adding the vector $\epsilon {\bm 1}_{e_i^t}$. Here, we want the element $e_i^t$ to satisfy (i) $\mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^t_{i-1})}(e_i^t)] \geq \mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^t_{i-1})}(\widehat{o}_i)]$, (ii) $\ell(e_i^t) \geq \ell(o_i)$, and (iii) $w(e_i^t) \leq w(o_i)$. As we do not know the values of $\mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^t_{i-1})}(\widehat{o}_i)]$ and $\ell(o_i)$, the algorithm requires their guessed values $\gamma_i^t$ and $\lambda_i$, respectively. We do not have to guess $w(o_i)$ because we will choose the element with the minimum weight satisfying (i) and (ii). Then, we update the vector ${\bm z}^t$ to ${\bm z}^{t+\epsilon}$ by finding a vector ${\bm v}^t$ and adding the vector $\epsilon {\bm v}^t$. Here, we want the vector ${\bm v}$ to satisfy (i) $\sum_{e \in E_{\rm S}}{\bm v}(e)\mathop{\mathbf{E}}[\widehat{g}_{R({\bm x})}(e)] \geq \mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^t_{i-1})}(O_S)]$ (note that $O_S \subseteq E_S \subseteq \widehat{E}$), (ii) $L({\bm v}) \geq \ell(O_{\rm S})$, and (iii) $W({\bm v}) \leq w(O_{\rm S})$. Such a vector can be found by calling \textsc{SmallElements} with the guessed values $\gamma^t_{\rm S}$ and $\lambda_{\rm S}$ for $\mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^t_{i-1})}(O_S)]$ and $\ell(O_{\rm S})$, respectively. A detailed description of the algorithm is given in Algorithm~\ref{alg:greedy-general}. We will show that $\widehat{G}({\bm x}^{t+\epsilon})-G({\bm x}^t) \geq \epsilon (g(O) - \widehat{G}({\bm x}^{t+\epsilon}))$, which is sufficient to show that $\widehat{G}({\bm x}^{1})$ is close to the $(1-1/e)$-approximation to $g(O)$. We will also show that $L({\bm x}^1) \geq \ell(O)$ and $W({\bm x}) \leq w(O)$. \begin{algorithm}[t!] \caption{$\textsc{GuessingContinuousGreedy}_{\epsilon,\delta}(g,\ell,w,E_{\rm L}, E_{\rm S},m,\set{\gamma^t_i}, \set{\gamma^t_{\rm S}}, \set{\lambda_i},\lambda_{\rm S})$}\label{alg:greedy-general} \begin{algorithmic}[1] \Require{A monotone submodular function $g:2^E \to \mathbb{R}_+$, a monotone linear function $\ell:2^E \to \mathbb{R}$, a weight function $w :E \to [0,1]$, $\epsilon,\delta\in (0,1)$, a set of large and small elements $E_{\rm L}$ and $E_{\rm S}$, an integer $m\in \mathbb{N}$, guessed values $\set{\gamma^t_i}_{i\in [m],t \in \set{0,\epsilon,\ldots,1-\epsilon}}$, $\set{\gamma^t_{\rm S}}_{t \in \set{0,\epsilon,\ldots,1-\epsilon}}$, $\set{\lambda_i}_{i \in [m]}$, and $\lambda_{\rm S}$.} \Ensure{A vector ${\bm x} \in [0,1]^E$.} \State{${\bm y}_i\leftarrow {\bm 0}\in [0,1]^{\widehat{E}}$ for $i \in [m]$ and ${\bm z}\leftarrow {\bm 0}\in [0,1]^{\widehat{E}}$.} \For{$(t\leftarrow 0$; $t \leq 1-\epsilon$; $t\leftarrow t+\epsilon$)} \For{($i \leftarrow 1$; $i \leq m$; $i \leftarrow i + 1$)} \State{${\bm \theta}_i(e) \leftarrow \textsc{Estimate}_{\epsilon,\epsilon/m,\epsilon\delta/(2nm)}(\mathop{\mathbf{E}}[\widehat{g}_{R({\bm x})}](e))$ for each $e \in E_i$.} \State{Let $e = \arg\min\set{w(e) \mid e \in E_i, {\bm \theta}_i(e) \geq (1-\epsilon)\gamma^t_i - \epsilon d/m, \ell(e) \geq \lambda_i}$.} \State{${\bm y}_i \leftarrow {\bm y}_i + \epsilon {\bm 1}_e$.} \EndFor \State{${\bm v} \leftarrow \textsc{SmallElements}_{\epsilon,\epsilon\delta/2}(\widehat{g},\ell,w,E_{\rm S},\gamma^t_{\rm S},\lambda_{\rm S},\sum_{i\in[m]}{\bm y}_i + {\bm z})$.} \State{${\bm z} \leftarrow {\bm z} + \epsilon {\bm v}$.} \EndFor \State{\Return $({\bm y}_1,\ldots,{\bm y}_{m},{\bm z})$.} \end{algorithmic} \end{algorithm} For $t \in \set{0,\epsilon,\ldots,1-\epsilon}$ and $i \in [m]$, let ${\bm \theta}_i^t$ be the ${\bm \theta}_i$ used in the iteration at time $t$. From Lemma~\ref{lem:chernoff} and the union bound, we immediately have the following: \begin{proposition}\label{pro:general-chernoff} With probability at least $1-\delta/2$, we have \begin{align*} (1- \epsilon )\mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^{t}_{i-1})}(e)] - \frac{\epsilon d_{g,\ell}}{m} & \leq {\bm \theta}^t_i(e) \leq (1 + \epsilon )\mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^{t}_{i-1})}(e)] + \frac{\epsilon d_{g,\ell}}{m} \end{align*} for every $t \in \set{0,\epsilon,\ldots,1-\epsilon}$, $i \in [m]$, and $e \in E_i$. \end{proposition} We formalize the concept that $\gamma_i^t$ and $\lambda_i$ are sufficiently accurate. \begin{definition}\label{def:good-guess-large} For $t \in \set{0,\epsilon,\ldots,1-\epsilon}$ and $i \in [m]$, we say that $\gamma^t_i$ is a \emph{good guess} if \[ \mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^{t}_{i-1})}(\widehat{o}_i)] \geq \gamma^t_i \geq (1-\epsilon) \mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^{t}_{i-1})}(\widehat{o}_i)] - \frac{\epsilon d_{g,\ell}}{m} \] holds. For $i \in [m]$, we say that $\lambda_i$ is a \emph{good guess} if \[ \ell(o_i) \geq \lambda_i \geq (1-\epsilon) \ell(o_i) - \frac{\epsilon d_{g,\ell}}{m} \] holds. \end{definition} Since $\mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^{t}_{i-1})}(o_i)] \leq d_{g,\ell}$ and $\ell(o_i) \leq d_{g,\ell}$ hold for every $i \in [m]$, we can find good guesses by trying all the values in the set $V_{\epsilon,m}(g,\ell)/m := \set{v / m\mid v \in V_{\epsilon,m}(g,\ell)}$. \begin{lemma}\label{lem:large-guess} Suppose that the consequence of Proposition~\ref{pro:general-chernoff} holds and that $\set{\gamma_i^t}$ and $\set{\lambda_i}$ are good guesses. Then, for every $t \in \set{0,\epsilon,\ldots,1-\epsilon}$, we have the following: \begin{itemize} \item[(i)] $\mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^{t}_{i-1})}(e^t_i)] \geq (1 - \epsilon)^3\mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^{t}_{i-1})}(\widehat{o}_i)] - 3\epsilon d_{g,\ell}/m$, \item[(ii)] $\ell(e^t_i) \geq (1-\epsilon)\ell(o_i) - \epsilon d_{g,\ell}/m$ for $i \in [m]$, and \item[(iii)] $w(e^t_i) \leq w(o_i)$ for $i \in [m]$. \end{itemize} \end{lemma} \begin{proof} Fix $t \in \set{0,\epsilon,\ldots,1-\epsilon}$ and $i \in [m]$. Note that we have \[ {\bm \theta}^t_i(o_i) \geq (1-\epsilon)\mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^{t}_{i-1})}(\widehat{o}_i)]-\frac{\epsilon d_{g,\ell}}{m} \geq (1-\epsilon)\gamma^t_i- \frac{\epsilon d_{g,\ell}}{m} \] and $\ell(o_i) \geq \lambda_i$. Since $o_i$ (in $E_i$) is a candidate for $e^t_i$, the element $e^t_i$ is well defined. In particular, we have $w(e^t_i) \leq w(o_i)$ because $e^t_i$ is chosen as the element with the minimum element satisfying the conditions. We have \[ (1+\epsilon)\mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^{t}_{i-1})}(e^t_i)]+\frac{\epsilon d_{g,\ell}}{m} \geq {\bm \theta}^t_i(e^t_i) \geq (1-\epsilon)\gamma^t_i - \frac{\epsilon d_{g,\ell}}{m} \geq (1-\epsilon)^2\mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^t_i)}(o_i)]-\frac{2\epsilon d_{g,\ell}}{m}. \] Rearranging this inequality, we get (i). Further, (ii) is immediate from the fact that $\ell(e_i^t) \geq \lambda_i$. \end{proof} We say that $\gamma_{\rm S}^t$ for $t \in \set{0,\epsilon,\ldots,1-\epsilon}$ and $\lambda_{\rm S}$ are \emph{good guesses} if they are good guesses in the sense of Definition~\ref{def:good-guess-small}. Then, we have the following: \begin{lemma}\label{lem:continuous-greedy} Suppose that $\set{\gamma_i^t},\set{\lambda_i}$, $\set{\gamma_{\rm S}^t}$, and $\lambda_{\rm S}$ are good guesses. Then, Algorithm~\ref{alg:greedy-general} returns vectors ${\bm y}_1,\ldots,{\bm y}_{m},{\bm z}$ such that ${\bm x} := \sum_{i \in [m]}{\bm y}_i + {\bm z}$ satisfies the following: \begin{itemize} \item[(i)] $\widehat{G}({\bm x}) \geq (1-1/e-O(\epsilon))g(O)-6\epsilon d_{g,\ell}$, \item[(ii)] $L({\bm x}) \geq (1-O(\epsilon))\ell(O)- 2 \epsilon d_{g,\ell}$, and \item[(iii)] $W({\bm x}) \leq w(O)$, \end{itemize} with probability at least $1-\delta$. The running time is $O(\frac{nm^2}{\epsilon^3}\log \frac{n m}{\epsilon \delta}+\frac{n^4}{\epsilon}+\frac{n^2}{\epsilon^3}\log \frac{1}{\epsilon \delta})$. \end{lemma} \begin{proof} With probability $1-\delta/2$, the consequence of Proposition~\ref{pro:general-chernoff} holds. Further, with probability $1-\delta/2$, all the invocations of \textsc{SmallElements} succeed in outputting vectors with the guarantees in Lemma~\ref{lem:small-element-guess}. By the union bound, all these occur with probability at least $1-\delta$. In what follows, we assume that this occurs. First, we check~(i). For each $t \in \set{0,\epsilon,\ldots,1-\epsilon}$, we have \begin{align*} & \widehat{G}({\bm x}^t_{m}) - \widehat{G}({\bm x}^t) = \sum_{j=1}^{m}\Bigl(\widehat{G}({\bm x}^t_{j-1} + \epsilon {\bm 1}_{e^t_j}) - \widehat{G}({\bm x}^t_{j-1})\Bigr)\\ & \geq \epsilon\sum_{j=1}^{m}\Bigl(\mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^t_{j-1})}(e^t_j)]\Bigr) \tag{By concavity of $\widehat{G}$}\\ & \geq \epsilon(1 - \epsilon)^3\sum_{j=1}^{m}\Bigl(\mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^t_{j-1})}(\widehat{o}_j)] - \frac{3\epsilon d_{g,\ell}}{m}\Bigr) \tag{By (i) of Lemma~\ref{lem:large-guess}}\\ & \geq \epsilon(1 - \epsilon)^3\sum_{j=1}^{m} \Bigl(\mathop{\mathbf{E}}\bigl[\widehat{g}_{R({\bm x}^t_{m}) \cup \set{\widehat{o}_k \mid k \in [j-1] }}(\widehat{o}_j) \bigr]\Bigr) -3\epsilon^2 d_{g,\ell} \\ & = \epsilon(1 - \epsilon)^3\Bigl(\mathop{\mathbf{E}}\bigl[\widehat{g}(R({\bm x}^{t}_{m}) \cup \widehat{O}_{\rm L}) - \widehat{g}(R({\bm x}^{t}_{m}))\bigr]\Bigr)- 3\epsilon^2 d_{g,\ell} \\ & \geq \epsilon(1 - \epsilon)^3(\mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^t_{m})}(\widehat{O}_{\rm L})] ) - 3\epsilon^2 d_{g,\ell}. \end{align*} For each $t \in \set{0,\epsilon,\ldots,1-\epsilon}$, we have \begin{align*} & \widehat{G}({\bm x}^{t+\epsilon}) - \widehat{G}({\bm x}^t_{m}) = \widehat{G}({\bm x}^{t}_{m} + \epsilon {\bm v}) - \widehat{G}({\bm x}^t_{m}) \\ & \geq \epsilon \sum_{e \in E}{\bm v}(e) \mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^{t+\epsilon})}(e)] \tag{by Lemma~\ref{lem:discretization}} \\ & \geq \epsilon \bigl((1-\epsilon)^3 \mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^{t+\epsilon})}(O_{\rm S})] - 3 \epsilon d_{g,\ell} \bigr) \tag{by (i) of Lemma~\ref{lem:small-element-guess}}\\ & \geq \epsilon (1-\epsilon)^3 \mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^{t+\epsilon})}(O_{\rm S})] - 3\epsilon^2 d_{g,\ell}. \end{align*} Combining these two inequalities, we get \begin{align*} & \widehat{G}({\bm x}^{t+\epsilon}) - \widehat{G}({\bm x}^t) \\ & \geq \epsilon(1 - \epsilon)^3(\mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^t_{m})}(\widehat{O}_{\rm L})] )- 3\epsilon^2 d_{g,\ell} + \epsilon (1-\epsilon)^3 \mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^{t+\epsilon})}(O_{\rm S} )] - 3 \epsilon^2 d_{g,\ell}\\ & \geq \epsilon (1 - \epsilon)^3\mathop{\mathbf{E}}[\widehat{g}_{R({\bm x}^{t+\epsilon})}(\widehat{O})] - 6 \epsilon^2 d_{g,\ell}\\ & \geq \epsilon (1 - \epsilon)^3\bigl(\widehat{g}(\widehat{O}) - \widehat{G}({\bm x}^{t+\epsilon})\bigr) - 6\epsilon^2 d_{g,\ell} = \epsilon (1 - \epsilon)^3\bigl(g(O) - \widehat{G}({\bm x}^{t+\epsilon})\bigr) - 6\epsilon^2 d_{g,\ell}. \end{align*} Rewriting the above inequality, we get \[ g(O) - \frac{\beta}{\alpha} - \widehat{G}({\bm x}^{t + \epsilon}) \leq \frac{g(O) - \frac{\beta}{\alpha} - \widehat{G}({\bm x}^t)}{1+\alpha}, \] where $\alpha = \epsilon(1 - \epsilon)^3$ and $\beta = 6\epsilon^2 d_{g,\ell}$. Then, by induction, we can prove that \[ g(O) - \frac{\beta}{\alpha} - \widehat{G}({\bm x}^t) \leq \frac{1}{(1+\alpha)^{t/\epsilon}}\Bigl(g(O) - \frac{\beta}{\alpha}\Bigr). \] Substituting $t = 1$ and rewriting once again, we get \[ \widehat{G}({\bm x}^1) \geq \Bigl(1 - \frac{1}{(1+\alpha)^{1/\epsilon}}\Bigr)(g(O)- \frac{\beta}{\alpha}) \geq \Bigl(1-\frac{1}{e}-O(\epsilon )\Bigr)\Bigl(g(O)-\frac{\beta}{\alpha}\Bigr) \geq \Bigl(1-\frac{1}{e}-O(\epsilon )\Bigr)g(O) - 6\epsilon d_{g,\ell}, \] assuming that $\epsilon$ is sufficiently small, say, less than $1/2$. To see (ii), we have for $t \in \set{0,\ldots,1-\epsilon}$ that \begin{align*} L({\bm x}^{t+\epsilon}) - L({\bm x}^{t}) & = L\Bigl({\bm x}^t + \epsilon \sum_{i=1}^{m} {\bm 1}_{e^t_i} + \epsilon {\bm v}\Bigr) - L({\bm x}^t) \\ & = \epsilon \sum_{i=1}^{m}\ell(e^t_i) + \epsilon (1-\epsilon)\ell(O_{\rm S}) - \epsilon^2 d_{g,\ell} \tag{by (ii) of Lemma~\ref{lem:small-element-guess}}\\ & \geq \epsilon((1-\epsilon)\ell(O_{\rm L})-\epsilon d_{g,\ell}) + \epsilon (1-\epsilon)\ell(O_{\rm S}) - \epsilon^2 d_{g,\ell} \tag{by (ii) of Lemma~\ref{lem:large-guess}}\\ & \geq \epsilon(1-\epsilon)\ell(O)- 2\epsilon^2 d_{g,\ell}. \end{align*} By induction, we get $L({\bm x}^1) \geq (1-\epsilon)\ell(O) - 2\epsilon d_{g,\ell}$. To see (iii), we have for $t \in \set{0,\ldots,1-\epsilon}$ that \begin{align*} W({\bm x}^{t+\epsilon}) - W({\bm x}^t) & = W\Bigl({\bm x}^t + \epsilon \sum_{i=1}^{m} {\bm 1}_{e^t_i} + \epsilon {\bm v}\Bigr) - W({\bm x}^t) \\ & \leq \epsilon (w(O_{\rm L})+ w(O_{\rm S}) ) \tag{By (iii)'s of Lemmas~\ref{lem:small-element-guess} and~\ref{lem:large-guess}}\\ & = \epsilon w(O). \end{align*} By induction, we get $W({\bm x}^1) \leq w(O)$. Finally, we analyze the time complexity. For estimating the ${\bm \theta}_i$'s, we need $O(\frac{nm}{\epsilon} \cdot \frac{m}{\epsilon^2}\log \frac{nm}{\epsilon \delta}) = O(\frac{nm^2}{\epsilon^3}\log \frac{n m}{\epsilon \delta})$ time. The time complexity of \textsc{SmallElements} is at most $O(\frac{1}{\epsilon} \cdot \bigl(n^4+\frac{n^2}{\epsilon^2}\log \frac{1}{\epsilon \delta}) = O(\frac{n^4}{\epsilon}+\frac{n^2}{\epsilon^3}\log \frac{1}{\epsilon \delta})$. Hence, the running time is as desired. \end{proof} \section{Introduction} In this paper, we consider the problem of maximizing a monotone submodular function under a knapsack constraint. Specifically, given a monotone submodular function $f:2^E \to \mathbb{R}_+$ and a weight function $w:E \to [0,1]$, we aim to solve the following optimization problem: \begin{align*} \text{maximize }f(S) \quad \text{subject to } w(S) \leq 1 \text{ and } S \subseteq E, \end{align*} where $w(S) = \sum_{e \in S}w(e)$. This problem has wide applications in machine learning tasks such as sensor placement~\cite{Krause:2008vo}, document summarization~\cite{Lin:2010wpa,Lin:2011wt}, maximum entropy sampling~\cite{Lee:2006cm}, and budget allocation~\cite{Soma:2014tp}. Although this problem is NP-hard in general, it is known that we can achieve $(1-1/e)$-approximation in polynomial time~\cite{Sviridenko:2004hq}, and this approximation ratio is indeed tight~\cite{Feige:1998gx}. Although it is useful to know that we can always obtain $(1-1/e)$-approximation in polynomial time, it is observed that a simple greedy method outputs even better solutions in real applications (see, e.g.,~\cite{Krause:2008vo}), and it is more desirable if we can guarantee a better approximation ratio by making assumptions on the input function. One such assumption is the notion of curvature, introduced by Conforti and Cornu{\'e}jols~\cite{Conforti:1984ig}. For a monotone submodular function $f:2^E \to \mathbb{R}_+$, the \emph{(total) curvature} of $f$ is defined as \[ c_f = 1 - \min_{e \in E}\frac{f_{E-e}(e)}{f(e)}. \] Intuitively speaking, the curvature measures how close $f$ is to a linear function. To see this, note that $c_f \in [0,1]$ and $c_f = 0$ if and only if $f$ is a linear function. It was shown in~\cite{Conforti:1984ig} that, for maximizing a monotone submodular function under a cardinality constraint, the greedy algorithm achieves an approximation ratio $(1-e^{-c_f})/c_f$, and the result was extended to a matroid constraint~\cite{Vondrak:2010zz}. Recently, Sviridenko~\emph{et~al.}~\cite{Sviridenko:2015ur} obtained a polynomial-time algorithm for a matroid constraint with an approximation ratio $1-c_f/e$, and showed that this approximation ratio is indeed tight for every $c_f \in [0,1]$ even under a cardinality constraint (note that $1-c_f/e$ is strictly larger than $(1-e^{-c_f})/c_f$ except when $c_f = 0$ or $c_f = 1$). In this paper, we extend these results to a knapsack constraint and present a polynomial-time algorithm under a knapsack constraint with an approximation ratio $1-c_f/e$. More specifically, we show the following: \begin{theorem}\label{the:intro} There is an algorithm that, given a monotone submodular function $f: 2^E \to \mathbb{R}_+$, a weight function $w: E \to [0,1]$, and $\epsilon \in (0,1)$, outputs a (random) set $S \subseteq E$ with $w(S) \leq 1$ (with probability one) satisfying \[ \mathop{\mathbf{E}}[f(S)] \geq \Bigl(1-\frac{c_f}{e} - \epsilon\Bigr)f(O). \] Here, $O\subseteq E$ is an optimal solution to the problem, i.e., $O$ is a set with $w(O) \leq 1$ that maximizes $f$. The running time is $O\Bigl(n^5+n^4\polylog(n) \cdot \bigl(\frac{1}{\epsilon} \bigr)^{\poly(1/\epsilon)}\Bigr)$, where $n = |E|$. \end{theorem} Note that the approximation ratio $1-c_f/e$ is indeed tight for every $c_f \in [0,1]$ because the lower bound given by~\cite{Sviridenko:2015ur} holds even for a cardinality constraint. To the best of our knowledge, this is the first result for a knapsack constraint that incorporates the curvature to obtain an approximation ratio better than $1-1/e$, which is tight for general submodular functions. We can apply our algorithm to all the above-mentioned applications to obtain a better solution when the input function has a small curvature. As a representative example, we consider the budget allocation problem~\cite{Alon:2012em}, which models a marketing process that allocates a given budget among media channels, such as TV, newspapers, and the Web, in order to maximize the impact on customers. We model the process using a bipartite graph on a vertex set $A \cup B$, where $A$ and $B$ correspond to the media channels and the customers, respectively, and an edge $(a,b) \in A \times B$ represents the potential influence of media channel $a$ on customer $b$. In a simplified setting where we can use each channel at most once, each media channel $a \in A$ can activate a customer with a predetermined probability $p_a \in [0,1]$. Then, we have to find a set $S \subseteq A$ that maximizes the expected number of activated customers subject to $w(S) := \sum_{a \in S}w(a) \leq 1$, where $w(a)$ is the cost of using media channel $a$. We can formulate this problem as the maximization of a monotone submodular function $f:2^A \to \mathbb{R}_+$ under the knapsack constraint $w(S) \leq 1$. We can show that $c_f \leq 1 - \min_{b \in B}p^{|\Gamma(b)|-1}$, where $\Gamma(b)$ denotes the set of neighbors of $b$ in the bipartite graph. By Theorem~\ref{the:intro}, this immediately gives the approximation ratio $1-c_f/e-\epsilon$ for this problem. The actual model is more general and discussed in detail in Section~\ref{sec:applications}. \subsection{Proof technique} Now, we present the outline of our proof. Let $f:2^E \to \mathbb{R}_+$ be the input function and $O \subseteq E$ be the optimal solution, i.e., $O$ is the set that maximizes $f$ among the sets with weight at most one. We assume that $c_f = 1-\Omega(\epsilon)$; otherwise, we can use a standard algorithm~\cite{Sviridenko:2004hq} to achieve the desired approximation ratio. Using the argument in~\cite{Sviridenko:2015ur}, we can decompose the input function $f$ into a monotone submodular function $g:2^E \to \mathbb{R}_+$ and a linear function $\ell:2^E \to \mathbb{R}_+$ such that, if we can compute a set $S \subseteq E$ with $w(S) \leq 1$ and $f(S) = g(S) + \ell(S) \geq (1-1/e)g(O)+\ell(O)$, then $S$ is a $(1-c_f/e)$-approximate solution. Moreover, by slightly changing the argument in~\cite{Sviridenko:2015ur}, we can also assume that $c_g=1-\Omega(\epsilon(1-c_f)) = 1-\Omega(\epsilon^2)$. In order to find the desired set $S \subseteq E$, we use a variant of the continuous greedy algorithm~\cite{Calinescu:2011ju} that simultaneously optimizes $g$ and $\ell$. In this algorithm, we consider continuous versions of $g$, $\ell$, and $w$, denoted by $G:[0,1]^E \to \mathbb{R}_+$, $L:[0,1]^E \to \mathbb{R}_+$, and $W:[0,1]^E \to \mathbb{R}_+$, respectively. We note that the function $G$ is called the multilinear extension of $g$, and that $L$ and $W$ are linear functions. We start with the zero vector ${\bm x} \in [0,1]^E$ and then iteratively update it. The algorithm consists of $1/\epsilon$ iterations, and roughly speaking, in each iteration, we find a vector ${\bm v} \in [0,1]^E$ with the following properties: (i) $G({\bm x} + \epsilon {\bm v}) - G({\bm x}) \geq \epsilon (G({\bm x} \vee {\bm 1}_{O}) - G({\bm x}))$, (ii) $L(\epsilon {\bm v}) = \epsilon L({\bm v}) \geq \epsilon \ell(O)$, and (iii) $W(\epsilon {\bm v}) = \epsilon W({\bm v})\leq w(O)$. Then, we update ${\bm x}$ by adding $\epsilon {\bm v}$. Here, ${\bm 1}_O$ is the characteristic vector of the set $O$ and $\vee$ is the coordinate-wise maximum. Intuitively speaking, these conditions mean that moving along the direction ${\bm v}$ from ${\bm x}$ is no worse than moving towards ${\bm x} \vee {\bm 1}_O$. We can find such a vector ${\bm v}$ by linear programming. Then, after $1/\epsilon$ iterations, we get a vector ${\bm x} \in [0,1]^E$ such that $G({\bm x}) \geq (1-1/e)G({\bm 1}_O) = (1-1/e)g(O)$, $L({\bm x}) \geq \ell(O)$, and $W({\bm x}) \leq w(O)$. Finally, we obtain a set $S \subseteq E$ by rounding the vector ${\bm x}$, where each element $e \in E$ is added with probability ${\bm x}(e)$. Unfortunately, this strategy does not work as is. Here, a crucial issue is that we cannot show the concentration of the weight in the rounding step. To address this issue, by borrowing an idea from~\cite{Badanidiyuru:2013jc}, we split the elements into large and small ones, where an element is said to be \emph{small} if $g(e) \leq \epsilon^6 g(O)$ and $\ell(e) \leq \epsilon^6 \ell(O)$, and is said to be \emph{large} otherwise (in our analysis, it is more convenient to define large and small elements in terms of $g$ and $\ell$ instead of $w$). Then, since the curvature of $g$ is bounded away from one, we can bound the number of large elements in $O$ by a function of $\epsilon$.\footnote{Although it is claimed in~\cite{Badanidiyuru:2013jc} that the number of large elements is bounded for any submodular function, it is not true in general.} Let $O_{\rm L},O_{\rm S} \subseteq O$ be the set of large and small elements in $O$, respectively. Further, we let $O_{\rm L} = \set{o_1,\ldots,o_m}$. Then, in each iteration, we do the following: For each $i \in \set{1,\ldots,m}$, we find an element $e_i$ such that (i) $G({\bm x} \vee {\bm 1}_{e_i}) - G({\bm x}) \geq G({\bm x} \vee {\bm 1}_{o_i}) - G({\bm x})$, (ii) $\ell(e_i) \geq \ell(o_i)$, and (iii) $w(e_i) \leq w(o_i)$. Then, we update ${\bm x}$ by adding $\epsilon{\bm 1}_{e_i}$. Here, ${\bm 1}_e$ is a characteristic vector of the element $e\in E$. Intuitively speaking, adding $e_i$ to the current solution is no worse than adding $o_i$. For small items, we find a vector ${\bm v}$ as before by considering the characteristic vector ${\bm 1}_{O_{\rm S}}$; then, we update ${\bm x}$ by adding $\epsilon {\bm v}$. In the rounding step, we handle large and small elements separately. Note that, for each $i \in \set{1,\ldots,m}$, we have computed $1/\epsilon$ elements (through $1/\epsilon$ iterations). Then, we chose one of them uniformly at random and add it to the output set. An advantage of this rounding procedure is that we can guarantee that the chosen element for $i \in \set{1,\ldots,m}$ has weight at most $w(o_i)$. For small elements, we apply the previous rounding procedure with a minor tweak to guarantee that the output set has weight at most one. In order to realize this idea, we need to address several additional issues. First, as we do not know the set $O$, we do not know values related to $O$, such as $g(O)$, $\ell(O)$, $G({\bm x} \vee {\bm 1}_O)$, and $G({\bm x} \vee {\bm 1}_{o_i})$. Hence, we cannot determine whether an element is small or large, and we cannot find the desired vector or element in each iteration. We address this issue by guessing these values. For example, we can show a lower bound and an upper bound on $g(O)$ that are $O(n)$ times apart. This means that we can find a $(1-\epsilon)$-approximation to $g(O)$ in the geometric sequence of length $O(\log_{1+\epsilon} n)=O((\log n)/\epsilon)$ between the lower and upper bounds. If we naively guess all the values, as we have $1/\epsilon$ iterations, the resulting time complexity will be $\mathrm{poly}(n) \cdot \bigl((\log n)/\epsilon\bigr)^{\mathrm{poly}(1/\epsilon)}$. However, since the function $g$ has curvature $1-\Omega(\epsilon^2)$, we can reduce the number of candidate values and thus improve the time complexity to $\mathrm{poly}(n)\cdot (1/\epsilon)^{\mathrm{poly}(1/\epsilon)}$. \subsection{Related work} As mentioned earlier, it has been shown that the greedy method achieves $(1-e^{-c_f})/c_f$ approximation for a cardinality constraint~\cite{Conforti:1984ig}. The result was extended to a matroid constraint by Vondr{\'a}k\xspace~\cite{Vondrak:2010zz}. He showed that the result actually holds if we replace $c_f$ with the \emph{curvature to the optimum} $c_f^*$, and the approximation ratio $(1-e^{-c_f^*})/c_f^*$ is tight. Sviridenko~\emph{et~al.}~\cite{Sviridenko:2015ur} improved the approximation ratio to $1-c_f/e-\epsilon$ for a matroid constraint (and hence, a cardinality constraint), which is unattainable with $c_f^*$, and showed that the approximation ratio $1-c_f/e$ is tight even for a cardinality constraint. Curvature has been used to explain the empirical performance of the greedy method. Sharma~\emph{et~al.}~\cite{Sharma:2015ur} considered maximum entropy sampling on Gaussian radial basis functions (RBF) kernels, which can be modeled as the maximization of a monotone submodular function, and showed that the curvature of this problem is close to zero. The maximization of a submodular function under a knapsack constraint has been studied extensively. Sviridenko obtained a $(1-1/e)$-approximation algorithm with time complexity $O(n^5)$~\cite{Sviridenko:2004hq}. We can also obtain $(1-1/e-\epsilon)$-approximation with a constant number of knapsack constraints; however, the time complexity blows up to $n^{\mathrm{poly}(1/\epsilon)}$~\cite{Kulik:2013ix}. It has been claimed in~\cite{Badanidiyuru:2013jc} that, for any fixed $\epsilon > 0$, there is a $(1-1/e-\epsilon)$-approximation algorithm with time complexity $\tilde{O}(n^2)$. However, as mentioned in the footnote, their argument has a drawback. Several approximation guarantees have been achieved in~\cite{Iyer:2013tl} using various parameters of the input function. However, none of them has an approximation ratio better than $1-1/e$ based solely on the assumption that the curvature is bounded. \subsection{Organization} The remainder of this paper is organized as follows. Section~\ref{sec:pre} introduces the definitions used throughout the paper and reviews the basic properties of submodular functions. Section~\ref{sec:reduction} explains the reduction to a joint approximation of a monotone submodular function and a monotone linear function. Section~\ref{sec:algorithm} presents a joint approximation algorithm. Section~\ref{sec:applications} describes an application to the budget allocation problem. \section*{Acknowledgments} We thank Takanori Maehara for providing us with the problem and insightful comments. \bibliographystyle{abbrv} \section{Preliminaries}\label{sec:pre} For an integer $n \in \mathbb{N}$, let $[n]$ denote the set $\set{1,\ldots,n}$. In this paper, the symbol $E$ always denotes a (finite) domain of a function. For a function $w:E \to \mathbb{R}$ and a subset $S \subseteq E$, we define $w(S) = \sum_{e \in S}w(e)$. Similarly, for a vector ${\bm x} \in \mathbb{R}^E$ and a set $S \subseteq E$, we define ${\bm x}(S) = \sum_{e \in S}{\bm x}(e)$. For an element $e \in E$, we define ${\bm 1}_e$ as the unit vector whose $e$-th element is $1$. For a set $S \subseteq E$, we define ${\bm 1}_S$ as $\sum_{e \in S}{\bm 1}_e$. Let $f:2^E \to \mathbb{R}$ be a function. For an element $e \in E$, we simply write $f(e)$ to denote $f(\set{e})$. For a set $S \subseteq E$, we define a function $f_S:2^{E} \to \mathbb{R}$ as $f_S(T) = f(S \cup T) - f(S)$. We say that $f$ is \emph{submodular} if, for any $S,T \subseteq E$, \[ f(S) + f(T) \geq f(S \cap T) + f(S \cup T). \] An equivalent condition is the \emph{diminishing return property}, which requires $f_S(e) \geq f_T(e)$ for any $S \subseteq T \subsetneq E$ and $e \in E\setminus T$. We say that $f$ is \emph{linear} if $f(S) = \sum_{e \in S}f(e)$ holds for every $S \subseteq E$. Note that, if $f$ is submodular (resp., linear), then $f_S$ is also submodular (resp., linear). For a vector ${\bm x} \in [0,1]^E$, let $R({\bm x})$ denote a random set, where each element $e\in E$ is included in the set with probability ${\bm x}(e)$. For a submodular function $f:2^E \to \mathbb{R}$, the \emph{multilinear extension} $F:[0,1]^E \to \mathbb{R}$ of $f$ is defined as \[ F({\bm x}) := \mathop{\mathbf{E}}[f(R({\bm x}))] = \sum_{S \subseteq E}f(S)\prod_{e \in S} {\bm x}(e) \prod_{e \in E \setminus S}(1-{\bm x}(e)). \] For an element $e\in E$ and a vector ${\bm x} \in [0,1]^E$, we define $\partial_e F({\bm x})$ as the slope of $F$ at ${\bm x}$ in the direction of ${\bm 1}_e$. The following fact is well known (see, e.g.,~\cite{Feldman:2013Tq}): \begin{align} \partial_e F({\bm x}) = \frac{F({\bm x} \vee {\bm 1}_e) - F({\bm x})}{1-x_e}= \frac{\mathop{\mathbf{E}}[f_{R({\bm x})}(e)]}{1-x_e}.\label{eq:partial-derivative} \end{align} The following lemma bounds the marginal gain of $F$ when adding $\epsilon {\bm y}$ to ${\bm x}$: \begin{lemma}\label{lem:discretization} Let $f:2^E \to \mathbb{R}_+$ be a monotone submodular function and ${\bm x},{\bm y} \in [0,1]^E$ be vectors such that ${\bm x} + \epsilon {\bm y} \in [0,1]^E$. Then, \[ F({\bm x} + \epsilon {\bm y}) - F({\bm x}) \geq \epsilon \sum_{e\in E}{\bm y}(e)\mathop{\mathbf{E}}[f_{R({\bm x}+\epsilon {\bm y})}(e)]. \] \end{lemma} \begin{proof} Let $e_1,\ldots,e_n$ be an arbitrary ordering of elements in $E$. For $i \in \set{0,1,\ldots,n}$, let ${\bm x}^i = {\bm x} + \sum_{j=1}^i \epsilon {\bm y}(e) {\bm 1}_e$. Note that ${\bm x}^0 = {\bm x}$ and ${\bm x}^n = {\bm x}+\epsilon {\bm y}$. Then, we have \begin{align*} F({\bm x} + \epsilon {\bm y}) - F({\bm x}) & = \sum_{i \in [n]} \partial_{e_i} F({\bm x}^{i-1}) \epsilon {\bm y}(e_i) \tag{by multilinearity of $F$}\\ & \geq \sum_{i \in [n]} \mathop{\mathbf{E}}[f_{R({\bm x}^{i-1})}(e)] \epsilon {\bm y}(e_i) \tag{by~\eqref{eq:partial-derivative}}\\ & \geq \epsilon\sum_{i \in [n]}{\bm y}(e_i) \mathop{\mathbf{E}}[f_{R({\bm x}^n)}(e)]. \tag{by submodularity of $f$}\\ & = \epsilon\sum_{i \in [n]}{\bm y}(e_i) \mathop{\mathbf{E}}[f_{R({\bm x}+\epsilon {\bm y})}(e)]. \qedhere \end{align*} \end{proof} We frequently use the following form of Chernoff's bound. \begin{lemma}[Relative+Additive Chernoff's bound~\cite{Badanidiyuru:2013jc}]\label{lem:chernoff} Let $X_1 , \ldots , X_n$ be independent random variables such that $X_i \in [0,1]$ for every $i \in [n]$. Let $X = \frac{1}{n} \sum_{i \in [n]} X_i$ and $\mu = \mathop{\mathbf{E}}[X]$. Then, for any $\alpha \in (0,1)$ and $\beta > 0$, we have \begin{align*} \Pr[|X - \mu| > \alpha \mu+\beta] \leq 2\exp\Bigl(-\frac{n\alpha \beta}{3}\Bigr). \end{align*} \end{lemma} This immediately gives the following sampling algorithm: \begin{corollary}\label{cor:chernoff} Suppose that we can obtain independent samples of a random variable $X$ bounded in $[0,d]$. Let $\mu = \mathop{\mathbf{E}}[X]$. Then, there exists an algorithm, denoted by $\textsc{Estimate}_{\alpha,\beta,\delta}(X)$, that, given $\alpha,\beta,\delta\in(0,1)$, outputs a value $\hat{\mu}$ such that $|\hat{\mu} - \mu| \leq \alpha \mu+\beta d$ with probability at least $1-\delta$. The number of samples used by the algorithm is $O(\log(1/\delta)/(\alpha\beta))$. \end{corollary} \section{Reduction}\label{sec:reduction} In this section, we prove Theorem~\ref{the:intro} using the following theorem, which gives a joint approximation of a monotone submodular function and a monotone linear function. \begin{theorem}\label{the:gl} There is an algorithm that, given a monotone submodular function $g : 2^E \to \mathbb{R}_+$, a monotone linear function $\ell : 2^E \to \mathbb{R}_+$, a weight function $w: E \to [0,1]$, and $\epsilon \in (0,1)$, outputs a (random) set $S \subseteq E$ with $w(S) \leq 1$ satisfying \[ \mathop{\mathbf{E}}[g(S) + \ell(S)] \geq \Bigl(1 - \frac{1}{e}\Bigr) g ( O ) + \ell(O) - \epsilon \bigl(g(O)+\ell(O)\bigr). \] Here, $O = \arg\max_{T\subseteq E:w(T) \leq 1}\bigl(g(T)+\ell(T)\bigr)$ is an optimal solution. The running time is $O\Bigl(\frac{n^4\polylog(n)}{(1-c_g)^2}\Bigr) \cdot \Bigl(\frac{1}{\epsilon}\log \frac{1}{1-c_g} \Bigr)^{\poly(1/\epsilon)/(1-c_g)}$, where $n = |E|$. \end{theorem} The proof of Theorem~\ref{the:gl} is given in Section~\ref{sec:algorithm}. In the remainder of this section, we prove Theorem~\ref{the:intro} using Theorem~\ref{the:gl}. The argument is similar to that used in~\cite{Sviridenko:2015ur}, but it is more subtle here because the running time in Theorem~\ref{the:gl} depends on the curvature of $g$. We use the following lemma. \begin{lemma}[Lemma 2.1 of~\cite{Sviridenko:2015ur}]\label{lem:2.1-of-Sviridenko} If $f : 2^E \to \mathbb{R}_+$ is a monotone submodular function, then $\sum_{e \in E} f_{E-e}(e) \geq (1 - c_f)f(S)$ for all $S \subseteq E$. \end{lemma} \begin{theorem}\label{the:f} There is an algorithm that, given a monotone submodular function $f: 2^E \to \mathbb{R}_+$, a weight function $w: E \to [0,1]$, and $\epsilon \in (0,1)$, outputs a (random) set $S \subseteq E$ with $w(S) \leq 1$ satisfying \[ \mathop{\mathbf{E}}[f(S)] \geq \Bigl(1-\frac{c_f}{e} - \epsilon\Bigr)f(O). \] Here, $O = \arg\max_{T \subseteq E: w(T) \leq 1}f(T)$ is an optimal solution. The running time is $O\Bigl(\frac{n^4}{(1-c_f)^2\epsilon^{17}}\log \frac{n}{(1-c_f)\epsilon}\Bigr) \cdot \Bigl(\frac{\log (n/\epsilon)}{\epsilon} \Bigr)^{O(1/\epsilon)} \Bigl(\frac{\log (1/((1-c_f)\epsilon))}{\epsilon} \Bigr)^{O(1/((1-c_f)\epsilon^8))}$, where $n = |E|$. \end{theorem} \begin{proof} Define the functions $g,\ell:2^E \to \mathbb{R}_+$ such that \begin{align*} \ell(S) = \Bigl(1-\frac{\epsilon}{2}\Bigr)\sum_{e \in S}f_{E-e}(e) \quad \text{and} \quad g(S) = f(S) - \ell(S) \end{align*} for every $S \subseteq E$. It is not hard to see that $\ell$ is a nonnegative monotone linear function and that $g$ is a nonnegative monotone submodular function. Moreover, the curvature of $g$ is \begin{align*} c_g = 1 - \min_{e \in E}\frac{g_{E-e}(e)}{g(e)} = 1 - \min_{e \in E}\frac{f_{E-e}(e) - (1-\epsilon/2)f_{E-e}(e)}{f(e) - (1-\epsilon/2)f_{E-e}(e)} \leq 1 - \frac{\epsilon}{2}\min_{e \in E}\frac{f_{E-e}(e)}{f(e)} = 1-\frac{\epsilon (1-c_f)}{2}. \end{align*} Further, Lemma~\ref{lem:2.1-of-Sviridenko} implies that for any set $S \subseteq E$, \[ \ell(S) = \Bigl(1-\frac{\epsilon}{2}\Bigr)\sum_{e\in S} f_{E-e}(e) \geq \Bigl(1-\frac{\epsilon}{2}\Bigr)(1 - c_f)f(S) \geq \Bigl(1 - c_f-\frac{\epsilon}{2}\Bigr)f(S). \] By applying Theorem~\ref{the:gl} to $g$, $\ell$, $w$, and $\epsilon/2$, we can find a (random) set $S \subseteq E$ with $w(S) \leq 1$ satisfying \begin{align*} \mathop{\mathbf{E}}[f(S)] & = \mathop{\mathbf{E}}[g(S) + \ell(S)] \geq \Bigl(1 - \frac{1}{e}\Bigr)g(O) + \ell(O) - \frac{\epsilon}{2} \bigl( g(O) + \ell(O)\bigr)\\ & = \Bigl(1 - \frac{1}{e}\Bigr) f(O) + \frac{1}{e}\ell(O) - \frac{\epsilon}{2} f(O)\\ & \geq \Bigl(1 - \frac{1}{e}\Bigr) f(O) + \frac{1-c_f-\epsilon/2}{e}f(O) - \frac{\epsilon}{2} f(O)\\ & \geq \Bigl(1 - \frac{c_f}{e} - \epsilon\Bigr) f(O). \end{align*} The running time is clearly as stated. \end{proof} Now, we prove our main theorem. \begin{proof}[Proof of Theorem~\ref{the:intro}] If $c_f < 1-e\epsilon$, then we run the algorithm in Theorem~\ref{the:f}. The approximation factor is $1-c_f/e-\epsilon$ and the running time is $O\Bigl(\frac{n^4}{(1-c_f)^2\epsilon^{17}}\log \frac{n}{(1-c_f)\epsilon}\Bigr) \cdot \Bigl(\frac{\log (n/\epsilon)}{\epsilon} \Bigr)^{O(1/\epsilon)} \Bigl(\frac{\log (1/((1-c_f)\epsilon))}{\epsilon} \Bigr)^{O(1/((1-c_f)\epsilon^8))}=O\Bigl(n^4\polylog(n) \cdot \bigl(\frac{1}{\epsilon} \bigr)^{\poly(1/\epsilon)}\Bigr)$. If $c_f \geq 1-e\epsilon$, then we simply run the $O(n^5)$-time $(1-1/e)$-approximation algorithm presented in~\cite{Sviridenko:2004hq}. Then, the approximation factor is \[ 1-\frac{1}{e} \geq 1-\frac{1-e\epsilon}{e}-\epsilon \geq 1-\frac{c_f}{e}-\epsilon. \] In both cases, the approximation factor is at least $1-c_f/e-\epsilon$ whereas the running time is as desired. \end{proof} \subsection{Rounding}\label{subsec:rounding} In this section, we explain how to round the vectors obtained by \textsc{GuessingContinuousGreedy} (Algorithm~\ref{alg:greedy-general}). Let $({\bm y}_1,\ldots,{\bm y}_m,{\bm z})$ be the vectors obtained by \textsc{GuessingContinuousGreedy}, and let ${\bm v}^{t}$ be the vector supported on $E_{\rm S}$ obtained in the iteration at time $t$ in \textsc{GuessingContinuousGreedy}. Note that ${\bm z} = \sum_{t \in \set{0,\epsilon,\ldots,1-\epsilon}}{\bm v}^t$. Our algorithm is summarized in Algorithm~\ref{alg:rounding}. \begin{algorithm}[t!] \caption{$\textsc{Rounding}_{\epsilon}(w,E_{\rm L}, E_{\rm S},m,\set{{\bm y}_i},{\bm z})$}\label{alg:rounding} \begin{algorithmic}[1] \Require{A weight function $w:E \to [0,1]$, $E_{\rm _L},E_{\rm S} \subseteq E$, a set of vectors $\set{{\bm y}_i}_{i \in [m]}$, and a vector ${\bm z}$.} \Ensure{A set $S \subseteq E$.} \State{$S_{\rm L} \leftarrow \emptyset$, $S_{\rm S} \leftarrow \emptyset$.} \State{Define ${\bm z}' \in [0,1]^{E_{\rm S}}$ as ${\bm z}'(e) = (1-\epsilon){\bm z}(e)$ if $w(e) < \epsilon^3 \max_t W({\bm v}^t )$ and ${\bm z}'(e) = 0$ otherwise.} \State{For each $e \in E_{\rm S}$, add it to $S_{\rm S}$ independently with probability ${\bm z}'(e)$.} \For{$i \in [m]$} \State{Add exactly one element in $E_i$ to $S_{\rm L}$ (as an element of $E$), where an element $e \in E_i$ is chosen with probability ${\bm y}_i(e)$.} \EndFor \If{$w(S_{\rm S} \cup S_{\rm L}) \leq 1$} \State{\Return $S_{\rm S} \cup S_{\rm L}$.} \Else \State{\Return $\emptyset$.} \EndIf \end{algorithmic} \end{algorithm} We use the following lemma to analyze the objective value of the output set. \begin{lemma}[Lemma~3.7 of~\cite{Calinescu:2011ju}]\label{lem:single-rounding} Let $E = E_1 \cup \cdots \cup E_k$, let $f : 2^E \to \mathbb{R}_+$ be a monotone submodular function, and for all $i \neq j$, we have $E_i \cap E_j = \emptyset$. Let ${\bm x} \in \mathbb{R}_+^E$ such that for each $E_i$ we have ${\bm x}(E_i) \leq 1$. If $T$ is a random set where we sample independently from each $E_i$ at most one random element, i.e., element $e$ with probability ${\bm x}(e)$, then \[ \mathop{\mathbf{E}}[f(T)] \geq F({\bm x}). \] \end{lemma} \begin{lemma}\label{lem:rounding-objective-values} We have $\mathop{\mathbf{E}}[g(S_{\rm L} \cup S_{\rm S})] \geq (1 - \epsilon)\widehat{G}({\bm x}) - \epsilon^3 v_g$ and $\mathop{\mathbf{E}}[\ell(S_{\rm L} \cup S_{\rm S})] \geq (1 - \epsilon)L({\bm x}) - \epsilon^3 v_\ell$. \end{lemma} \begin{proof} Let ${\bm x}' = \sum_{i\in [m]}{\bm y}_i + {\bm z}'$. First, let us relate the value of the vector ${\bm x}$ to that of ${\bm x}'$. \begin{align*} \widehat{G}({\bm x}')=\widehat{G}\Bigl(\sum_{i \in [m]} {\bm y}_i + {\bm z}' \Bigr) & \geq \widehat{G}\Bigl(\sum_{i \in [m]} {\bm y}_i + (1-\epsilon){\bm z}\Bigr) - \sum_{e \in E_{\rm S}: w(e) \geq \epsilon^3 \max_t W({\bm v}^t)}{\bm z}(e)g(e) \\ & \geq \widehat{G}\Bigl((1-\epsilon)(\sum_{i \in [m]} {\bm y}_i+{\bm z})\Bigr) - \max_{e\in E_{\rm S}} g(e) \sum_{e \in E_{\rm S}:w(e) \geq \epsilon^3 \max_t W({\bm v}^t)}{\bm z}(e) \\ & \geq (1-\epsilon)\widehat{G}({\bm x})- \epsilon^6 v_g \cdot \frac{1}{\epsilon^3} \geq (1-\epsilon)\widehat{G}({\bm x})-\epsilon^3 v_g. \end{align*} Next, we note that we get $S_{\rm L}$ by selecting exactly one random element from each $E_i$, which is a copy of $E_{\rm L}$, and we get $S_{\rm S}$ by sampling independently from ${\bm v}$. Hence, by applying Lemma~\ref{lem:single-rounding} with sets $E_1,\ldots,E_{m}$ and sets $\set{\set{e} \mid e \in S_{\rm S}}$, we get \[ \mathop{\mathbf{E}}[g(S_{\rm L} \cup S_{\rm S})] \geq (1-\epsilon)\widehat{G}({\bm x}) - \epsilon^3 v_g. \] By a similar argument, we get $L({\bm x}') \geq (1-\epsilon)L({\bm x}) - \epsilon^3 v_\ell$, and we have $\mathop{\mathbf{E}}[\ell(S_{\rm L} \cup S_{\rm S})] \geq (1-\epsilon)L({\bm x})-\epsilon^3 v_\ell$. \end{proof} Next, we show that the probability that the weight of the output set exceeds $w(O)$ decays exponentially. \begin{lemma}\label{lem:rounding-weight} For any $\gamma \geq 1$, we have $w(S_{\rm L} \cup S_{\rm S}) \leq \gamma w(O)$ with probability $1-\exp\bigl(-\Omega(\gamma/\epsilon^2)\bigr)$. \end{lemma} \begin{proof} Recall that, for each $i \in [m]$, the vector ${\bm y}_i$ is the sum of $1/\epsilon$ elements $e^0_i,\ldots,e^{1-\epsilon}_i$, and we pick one of them in Algorithm~\ref{alg:rounding}. By the condition $w(e^t_i) \leq w(o_i)$ for every $i \in [m]$ and $t \in \set{0,\epsilon,\ldots,1-\epsilon}$, the weight of the large elements after the rounding will be less than that of the large elements of the optimal solution. Hence, it is sufficient to prove that $w(S_{\rm S} ) \leq \gamma w(O_{\rm S})$ holds with probability $1-\exp(-\Omega(\gamma/\epsilon^2))$, where $S_{\rm S}$ is the set obtained by rounding ${\bm z}'$. First, note that \[ \mathop{\mathbf{E}}[w(S_{\rm S})] = \mathop{\mathbf{E}}[w(R({\bm z}'))] \leq (1-\epsilon)\mathop{\mathbf{E}}[w(R({\bm z}))] \leq (1-\epsilon)\max_{t} W({\bm v}^t) \leq (1-\epsilon)w(O_{\rm S}). \] For each $e \in E$, we set up a random variable $X_e$ to be $X_e = w(e)/(\epsilon^3w(O_{\rm S}))$ if $e \in S_{\rm S}$ and $X_e = 0$ otherwise. Note that each $X_e$ is bounded in $[0,1]$ because $\max_t W({\bm v}^t) \leq w(O_{\rm S})$. For $X = \sum_{e \in E_{\rm S}}X_e$, we have $\mu := \mathop{\mathbf{E}}[X] = \mathop{\mathbf{E}}[w(S_{\rm S})]/(\epsilon^3w(O_{\rm S})) \leq (1-\epsilon)/\epsilon^3$. Invoking Lemma~\ref{lem:chernoff} with $\alpha=\epsilon/2$ and $\beta=\gamma/(2\epsilon^3)$, we have \begin{align*} \Pr[w(S_{\rm S}) > \gamma w(O_{\rm S})] & = \Pr\Bigl[X \geq \frac{\gamma}{\epsilon^3}\Bigr] \leq \Pr\Bigl[X \geq (1+\alpha)\mu + \beta\Bigr] \\ & \leq 2\exp\Bigl(-\frac{\alpha \beta}{3}\Bigr) = \exp\Bigl(-\Omega\Bigl(\frac{\gamma}{\epsilon^2}\Bigr)\Bigr). \qedhere \end{align*} \end{proof} \begin{lemma}\label{lem:rounding} Algorithm~\ref{alg:rounding} outputs a (random) set $S$ with $w(S) \leq 1$ satisfying \[ \mathop{\mathbf{E}}[g(S)+\ell(S)] \geq (1 - \epsilon)(\widehat{G}({\bm x})+L({\bm x})) - O(\epsilon) \cdot (g(O)+\ell(O)+v_g+v_\ell). \] \end{lemma} \begin{proof} It is clear that we always have $w(S) \leq 1$. Now, we analyze the objective value attained by $S$. For any $\gamma \geq 1$, the probability that $w(S_{\rm L} \cup S_{\rm S}) > \gamma w(O)$ is at most $\exp\bigl(-C\gamma/\epsilon^2\bigr)$ for some $C > 0$ by Lemma~\ref{lem:rounding-weight}. Note that, if $T \subseteq E$ satisfies $w(T) \leq \gamma w(O)$, then $g(T)+\ell(T) \leq \gamma (g(O)+\ell(O))$ from the submodularity of $g+\ell$. By Lemma~\ref{lem:rounding-objective-values}, we have \begin{align*} & \mathop{\mathbf{E}}[g(S) + \ell(S)]\\ & \geq \mathop{\mathbf{E}}[g(S_{\rm L} \cup S_{\rm S})+\ell(S_{\rm L} \cup S_{\rm S})] - \int_1^\infty \gamma(g(O)+\ell(O))\exp(-C\gamma/\epsilon^2) \mathrm{d}\gamma \\ & \geq (1 - \epsilon)\widehat{G}({\bm x}) - \epsilon^3 v_g + (1 - \epsilon)L({\bm x}) - \epsilon^3 v_\ell - \frac{\epsilon^4+C\epsilon^2}{C^2}\exp(-C/\epsilon^2)(g(O)+\ell(O))\\ & = (1 - \epsilon)(\widehat{G}({\bm x})+L({\bm x})) - O(\epsilon) \cdot (g(O)+\ell(O)+v_g+v_\ell). \qedhere \end{align*} \end{proof} \subsection{Subroutine for handling small elements}\label{subsec:small-continous-greedy} Here, we explain a subroutine that finds a vector ${\bm v} \in [0,1]^E$ supported on the set $E_S$ of small elements (with respect to the current guesses $v_g$ and $v_\ell$) in order to update the current vector ${\bm x} \in \mathbb{R}^E$. We want ${\bm v}$ to satisfy the following properties: (i) $\sum_{e \in E_{\rm S}}{\bm v}(e) \mathop{\mathbf{E}}[g_{R({\bm x})}(e)] \geq \mathop{\mathbf{E}}[g_{R({\bm x})}(O_{\rm S})]$, (ii) $L({\bm v}) \geq \ell(O_{\rm S})$, and (iii) $W({\bm v}) \leq w(O_{\rm S})$. There are several issues in finding such a vector ${\bm v}$: We cannot exactly calculate $\mathop{\mathbf{E}}[g_{R({\bm x})}(e)]\;(e \in E_{\rm S})$; hence, we need to estimate it. Further, we do not know the values $\mathop{\mathbf{E}}[g_{R({\bm x})}(O_{\rm S})]$ and $\ell(O_{\rm S})$. In the subroutine presented here, we assume that their guessed values, denoted by $\gamma$ and $\lambda$, respectively, are given as a part of the input. Once we succeed in accurately estimating $\mathop{\mathbf{E}}[g_{R({\bm x})}(e)]\;(e \in E_{\rm S})$ and the given guessed values $\gamma$ and $\lambda$ are sufficiently accurate, we can find the desired vector ${\bm v}$ by solving a linear program. A detailed description of the subroutine is given in Algorithm~\ref{alg:small-elements}. \begin{algorithm}[t!] \caption{$\textsc{SmallElements}_{\epsilon,\delta}(g,\ell,w,E_{\rm S}, \gamma,\lambda,{\bm x})$}\label{alg:small-elements} \begin{algorithmic}[1] \Require{A monotone submodular function $g:2^E \to \mathbb{R}_+$, a monotone linear function $\ell:2^E \to \mathbb{R}$, a weight function $w :E \to [0,1]$, $\epsilon,\delta \in (0,1)$, a set of small elements $E_{\rm S}$, guessed values $\gamma,\lambda$, and a vector ${\bm x} \in [0,1]^E$.} \Ensure{A vector ${\bm v} \in [0,1]^E$.} \State{For each $e \in E_{\rm S}$, let ${\bm \theta}(e) = \textsc{Estimate}_{\epsilon,\epsilon/n,\delta/n}(g_{R({\bm x})}(e))$.} \State{Find a vector ${\bm v} \in [0,1]^E$ supported on $E_{\rm S}$ that minimizes $W({\bm v})$ subject to \[ {\bm v} \cdot {\bm \theta} \geq (1-\epsilon)\gamma - \epsilon d_{g,\ell} \quad \text{and} \quad L({\bm v}) \geq \lambda. \] by linear programming. } \State{\Return ${\bm v}$.} \end{algorithmic} \end{algorithm} Now, we analyze Algorithm~\ref{alg:small-elements}. From Corollary~\ref{cor:chernoff} and the fact that $g_{S}(e) \leq d_g \leq d_{g,\ell}$ for every $S \subseteq E$ and $e \in E$, we have the following: \begin{proposition}\label{pro:small-element-chernoff} With probability at least $1-\delta$, we have \[ (1- \epsilon)\mathop{\mathbf{E}}[g_{R({\bm x})}(e)] - \frac{\epsilon d_{g,\ell}}{n} \leq {\bm \theta}(e) \leq (1+ \epsilon)\mathop{\mathbf{E}}[g_{R({\bm x})}(e)] + \frac{\epsilon d_{g,\ell}}{n} \] for every $e \in E_{\rm S}$. \end{proposition} We formalize the concept that $\gamma$ and $\lambda$ are sufficiently accurate, and then show that Algorithm~\ref{alg:small-elements} outputs a desired vector with accurate $\gamma$ and $\lambda$. \begin{definition}\label{def:good-guess-small} We say that $\gamma$ and $\lambda$ are \emph{good guesses} if \[ \mathop{\mathbf{E}}[g_{R({\bm x})}(O_{\rm S})] \geq \gamma \geq (1-\epsilon)\mathop{\mathbf{E}}[g_{R({\bm x})}(O_{\rm S})] - \epsilon d_{g,\ell} \quad \text{and} \quad \ell(O_{\rm S}) \geq \lambda \geq (1-\epsilon)\ell(O_{\rm S}) - \epsilon d_{g,\ell} \] hold, respectively. \end{definition} Since $\mathop{\mathbf{E}}[g_{R({\bm x})}(O_{\rm S})] \leq nd_{g,\ell}$ and $\ell(O_{\rm S}) \leq nd_{g,\ell}$ hold, we can find good guesses by trying all the values in the set $V_{\epsilon,n}(g,\ell)$. \begin{lemma}\label{lem:small-element-guess} Suppose that $\gamma$ and $\lambda$ are good guesses. Then, Algorithm~\ref{alg:small-elements} returns a vector ${\bm v} \in [0,1]^E$ supported on $E_{\rm S}$ such that \begin{itemize} \item[(i)] $\sum_{e \in E_{\rm S}}{\bm v}(e)\mathop{\mathbf{E}}[g_{R({\bm x})}(e)] \geq (1-\epsilon)^3\mathop{\mathbf{E}}[g_{ R({\bm x})}(O_{\rm S})] - 3\epsilon d_{g,\ell}$, \item[(ii)] $L({\bm v}) \geq (1-\epsilon)\ell(O_{\rm S})-\epsilon d_{g,\ell}$, and \item[(iii)] $W({\bm v}) \leq w(O_{\rm S})$, \end{itemize} with probability at least $1-\delta$. The time complexity of Algorithm~\ref{alg:small-elements} is $O(n^4+n^2\log (n/\delta )/\epsilon^2)$. \end{lemma} \begin{proof} With probability at least $1-\delta$, the consequence of Proposition~\ref{pro:small-element-chernoff} holds. In what follows, we assume that this occurs. The vector ${\bm 1}_{O_{\rm S}}$ satisfies \begin{align*} {\bm 1}_{O_{\rm S}}\cdot {\bm \theta} & = \sum_{e \in O_{\rm S}}{\bm \theta}(e) \geq \sum_{e \in O_{\rm S}}\Bigl((1-\epsilon)\mathop{\mathbf{E}}[g_{R({\bm x})}(e)] - \frac{\epsilon d_{g,\ell}}{n}\Bigr) \\ & \geq (1-\epsilon)\mathop{\mathbf{E}}[g_{R({\bm x})}(O_{\rm S})] - \epsilon d_{g,\ell} \geq (1-\epsilon)\gamma - \epsilon d_{g,\ell}. \end{align*} Furthermore, we have $L({\bm 1}_{O_{\rm S}}) = \ell(O_{\rm S}) \geq \lambda$. Hence, the vector ${\bm v}$ is well defined, and in particular, we have $W({\bm v}) \leq W(O_{\rm S})$. Then, we have \begin{align*} \sum_{e \in E_{\rm S}}{\bm v}(e)\mathop{\mathbf{E}}[g_{R({\bm x})}(e)] & \geq (1-\epsilon)\sum_{e \in E_{\rm S}}{\bm v}(e) \Bigl({\bm \theta}(e)-\frac{\epsilon d_{g,\ell}}{n}\Bigr) \geq (1-\epsilon)\sum_{e \in E_{\rm S}}{\bm v}(e) {\bm \theta}(e)-\epsilon d_{g,\ell} \\ & \geq (1-\epsilon)\bigl((1-\epsilon)\gamma -\epsilon d_{g,\ell}\bigr)- \epsilon d_{g,\ell} \geq (1-\epsilon)^2\gamma- 2\epsilon d_{g,\ell} \\ & \geq (1-\epsilon)^2 \bigl((1-\epsilon)\mathop{\mathbf{E}}[g_{R({\bm x})}(O_{\rm S})] - \epsilon d_{g,\ell}\bigr) - 2\epsilon d_{g,\ell} \\ & \geq (1-\epsilon)^3\mathop{\mathbf{E}}[g_{R({\bm x})}(O_{\rm S})] - 3\epsilon d_{g,\ell}. \end{align*} It is easy to confirm (ii) and (iii). The time complexity for computing ${\bm \theta}$ is $O(n^2\log (n/\delta )/\epsilon^2)$ from Corollary~\ref{cor:chernoff}, and the time complexity for solving the linear program is $O(n^4)$ by using the ellipsoid method. The total time complexity is bounded by $O(n^4+n^2\log (n/\delta )/\epsilon^2)$. \end{proof} \subsection{Small elements}\label{subsec:small} Our algorithm computes a vector ${\bm x} \in [0,1]^E$ with $W({\bm x}) \leq 1$ and then rounds it to a set. A natural rounding method is to simply output the random set $R({\bm x})$. Then, we can guarantee that the expected objective values $\mathop{\mathbf{E}}[g(R({\bm x}))]$ and $\mathop{\mathbf{E}}[ \ell(R({\bm x}))]$ are sufficiently large and the expected weight $\mathop{\mathbf{E}}[w(R({\bm x}))]$ is at most one. However, we cannot guarantee the concentration of $w(R({\bm x}))$ because some elements have large contributions to the weight. To resolve this issue, we say that elements in $E$ are \emph{small} if \[ g(e) \leq \epsilon^6 g(O) \quad \text{and} \quad \ell(e) \leq \epsilon^6 \ell(O). \] Then, we can freely remove some of small elements for decreasing the weight without decreasing the value significantly. Further, we can prove that the number of large elements is bounded by a polynomial in $\epsilon$ and $c_g$. An issue here is that we do not know $O$; hence, we cannot determine whether an element is small. To resolve this issue, we guess the values of $g(O)$ and $\ell(O)$. Without loss of generality, we can assume that $\epsilon/n = (1-\epsilon)^k$ for some integer $k$; otherwise, we slightly decrease the value of $\epsilon$. Then, we define a set $V_{\epsilon,n}(g,\ell) = \set{nd_{g,\ell},(1-\epsilon)nd,\ldots,\epsilon d_{g,\ell}, 0}$, and we use the values in $V_{\epsilon}(g,\ell)$ to guess $g(O)$ and $\ell(O)$. Since $g(O) \leq nd_{g,\ell}$ and $\ell(O) \leq nd_{g,\ell}$ hold, there exist some $v_g, v_\ell \in V_{\epsilon,n}(g,\ell)$ such that \begin{align} (1-\epsilon)v_g - \epsilon d_{g,\ell} \leq g(O) \leq v_g \quad \text{and} \quad (1-\epsilon)v_\ell - \epsilon d_{g,\ell} \leq \ell(O) \leq v_\ell. \label{eq:guess-g(O)-and-l(O)} \end{align} We say that an element $e \in E$ is \emph{small with respect to $(v_g,v_\ell)$} if \[ g(e) \leq \epsilon^6 v_g \quad \text{and} \quad \ell(e) \leq \epsilon^6 v_\ell. \] Otherwise, we say that an element $e \in E$ is \emph{large with respect to $(v_g,v_\ell)$}. Let $E_{\rm L}(v_g,v_\ell) \subseteq E$ and $E_{\rm S}(v_g,v_\ell) \subseteq E$ be the sets of large and small elements, respectively, with respect to $(v_g,v_\ell)$. Further, we define $O_{\rm L}(v_g,v_\ell) = E_{\rm L}(v_g,v_\ell) \cap O$ and $O_{\rm S}(v_g,v_\ell) = E_{\rm S}(v_g,v_\ell) \cap O$. We omit $v_g$ and $v_\ell$ from these notations if they are clear from the context. When $v_g$ and $v_\ell$ satisfy~\eqref{eq:guess-g(O)-and-l(O)}, we can upper bound the number of large elements in $O$: \begin{lemma}\label{lem:bound-on-large-elements} If $v_g$ and $v_\ell$ satisfy~\eqref{eq:guess-g(O)-and-l(O)}, then we have $|O_{\rm L}| = O\bigl(\frac{1}{(1-c_g)\epsilon^6}\bigr)$. \end{lemma} \begin{proof} Let $m_\ell$ be the number of elements $e \in O$ with $\ell(e) > \epsilon^6 v_\ell$. Then, we have $\epsilon^6 v_\ell m_\ell \leq \ell(O)$. Since $v_\ell \geq \ell(O)$, we have $m_\ell \leq 1/\epsilon^6$. Let $\set{o_1,\ldots,o_{m_g}}$ be the set of elements $e \in O$ with $g(e) > \epsilon^6 v_g$. Then, we have \[ g(O) \geq \sum_{i \in [m_g]}g_{\set{o_1,\ldots,o_{i-1}}}(o_i) \geq (1-c_g)\sum_{i \in [m_g]}g(o_i) \geq (1-c_g)\epsilon^6 v_g m_g. \] Since $v_g \geq g(O)$, we have $m_g \leq \frac{1}{(1-c_g)\epsilon^6}$. Then, we have $|O_{\rm L}| \leq m_g + m_\ell = O(\frac{1}{(1-c_g)\epsilon^6})$. \end{proof} In addition to the values of $g(O)$ and $\ell(O)$, the value of $|O_{\rm L}|$ is not also not known. However, we can easily guess it because there are only $O(\frac{1}{(1-c_g)\epsilon^6})$ choices from Lemma~\ref{lem:bound-on-large-elements}. We use the symbol $m$ to denote the guessed value of $|O_{\rm L}|$. For each choice of $v_g$, $v_\ell$, and $m$, we compute a (random) set that jointly maximizes $g$ and $\ell$, and the final output is the best one among them. Since $|V_{\epsilon,n}(g,\ell)| = O(\log_{1/(1-\epsilon)}(n/\epsilon)) = O(\log(n/\epsilon)/\epsilon)$, this guessing process makes the running time $O\Bigl(\bigl(\log(n/\epsilon)/\epsilon\bigr)^2 \cdot \frac{1}{(1-c_g)\epsilon^6}\Bigr) = O\Bigl(\frac{\log^2(n/\epsilon)}{(1-c_g)\epsilon^8}\Bigr)$ times larger. The details will be explained in Section~\ref{subsec:final}.
{'timestamp': '2016-07-18T02:07:36', 'yymm': '1607', 'arxiv_id': '1607.04527', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04527'}
arxiv
\section{Introduction} Let ${\mathcal{P}}$ be a set of $v \ge 1$ elements, and let ${\mathcal{B}}$ be a set of $k$-subsets of ${\mathcal{P}}$, where $k$ is a positive integer with $1 \leq k \leq v$. Let $t$ be a positive integer with $t \leq k$. The pair ${\mathbb{D}} = ({\mathcal{P}}, {\mathcal{B}})$ is called a $t$-$(v, k, \lambda)$ {\em design\index{design}}, or simply {\em $t$-design\index{$t$-design}}, if every $t$-subset of ${\mathcal{P}}$ is contained in exactly $\lambda$ elements of ${\mathcal{B}}$. The elements of ${\mathcal{P}}$ are called points, and those of ${\mathcal{B}}$ are referred to as blocks. We usually use $b$ to denote the number of blocks in ${\mathcal{B}}$. A $t$-design is called {\em simple\index{simple}} if ${\mathcal{B}}$ does not contain repeated blocks. In this paper, we consider only simple $t$-designs. A $t$-design is called {\em symmetric\index{symmetric design}} if $v = b$. It is clear that $t$-designs with $k = t$ or $k = v$ always exist. Such $t$-designs are {\em trivial}. In this paper, we consider only $t$-designs with $v > k > t$. A $t$-$(v,k,\lambda)$ design is referred to as a {\em Steiner system\index{Steiner system}} if $t \geq 2$ and $\lambda=1$, and is denoted by $S(t,k, v)$. A necessary condition for the existence of a $t$-$(v, k, \lambda)$ design is that \begin{eqnarray}\label{eqn-tdesignnecessty} \binom{k-i}{t-i} \mbox{ divides } \lambda \binom{v-i}{t-i} \end{eqnarray} for all integer $i$ with $0 \leq i \leq t$. There has been an interplay between codes and $t$-designs for decades. The incidence matrix of any $t$-design spans a linear code over any finite field ${\mathrm{GF}}(q)$. A lot of progress in this direction has been made and documented in the literature (see, for examples, \cite{AK92}, \cite{DingBook}, \cite{Tonchev,Tonchevhb}). On the other hand, both linear and nonlinear codes may hold $t$-designs. Some linear and nonlinear codes were employed to construct $2$-designs and $3$-designs \cite{AK92,Tonchev,Tonchevhb}. Binary and ternary Golay codes of certain parameters hold $4$-designs and $5$-designs \cite{AK92}. However, the largest $t$ for which an infinite family of $t$-designs is derived directly from codes is $t=3$. It looks that not much progress on the construction of $t$-designs from codes has been made so far, while many other constructions of $t$-designs are documented in the literature (\cite{BJL,CMhb,KLhb,RR10}). The main objective of this paper is to construct infinite families of $2$-designs and $3$-designs from linear codes. In addition, we determine the parameters of some known $t$-designs, and present many conjectured infinite families of $2$-designs that are based on projective ternary cyclic codes. \section{The classical construction of $t$-designs from codes and highly nonlinear functions} Let ${\mathcal{C}}$ be a $[v, \kappa, d]$ linear code over ${\mathrm{GF}}(q)$. Let $A_i:=A_i({\mathcal{C}})$, which denotes the number of codewords with Hamming weight $i$ in ${\mathcal{C}}$, where $0 \leq i \leq v$. The sequence $(A_0, A_1, \cdots, A_{v})$ is called the \textit{weight distribution} of ${\mathcal{C}}$, and $\sum_{i=0}^v A_iz^i$ is referred to as the \textit{weight enumerator} of ${\mathcal{C}}$. For each $k$ with $A_k \neq 0$, let ${\mathcal{B}}_k$ denote the set of supports of all codewords of Hamming weight $k$ in ${\mathcal{C}}$, where the coordinates of a codeword are indexed by $(0,1,2, \cdots, v-1)$. Let ${\mathcal{P}}=\{0, 1, 2, \cdots, v-1\}$. The pair $({\mathcal{P}}, {\mathcal{B}}_k)$ may be a $t$-$(v, k, \lambda)$ design for some positive integer $\lambda$. The following theorems, developed by Assumus and Mattson, show that the pair $({\mathcal{P}}, {\mathcal{B}}_k)$ defined by a linear code is a $t$-design under certain conditions. \begin{theorem}\label{thm-AM1}[Assmus-Mattson Theorem \cite{AM74}, \cite[p. 303]{HP03}] Let ${\mathcal{C}}$ be a binary $[v, \kappa, d]$ code. Suppose ${\mathcal{C}}^\perp$ has minimum weight $d^\perp$. Suppose that $A_i=A_i({\mathcal{C}})$ and $A_i^\perp=A_i({\mathcal{C}}^\perp)$, for $0 \leq i \leq v$, are the weight distributions of ${\mathcal{C}}$ and ${\mathcal{C}}^\perp$, respectively. Fix a positive integer $t$ with $t < d$, and let $s$ be the number of $i$ with $A_i^\perp \ne 0$ for $0 < i \leq v-t$. Suppose that $s \leq d -t$. Then \begin{itemize} \item the codewords of weight $i$ in ${\mathcal{C}}$ hold a $t$-design provided that $A_i \ne 0$ and $d \leq i \leq v$, and \item the codewords of weight $i$ in ${\mathcal{C}}^\perp$ hold a $t$-design provided that $A_i^\perp \ne 0$ and $d^\perp \leq i \leq v$. \end{itemize} \end{theorem} The Assmus-Mattson Theorem for nonbinary codes is given as follows [Assmus-Mattson Theorem \cite{AM74}, \cite[p. 303]{HP03}] \begin{theorem}\label{thm-AM2} Let ${\mathcal{C}}$ be a $[v, \kappa, d]$ code over ${\mathrm{GF}}(q)$. Suppose ${\mathcal{C}}^\perp$ has minimum weight $d^\perp$. Let $w$ be the largest integer with $w \leq v$ satisfying $$ w - \left\lfloor \frac{w+q-2}{q-1} \right\rfloor < d. $$ (So $w=v$ when $q=2$.) Define $w^\perp$ analogously using $d^\perp$. Suppose that $A_i=A_i({\mathcal{C}})$ and $A_i^\perp=A_i({\mathcal{C}}^\perp)$, for $0 \leq i \leq v$, are the weight distributions of ${\mathcal{C}}$ and ${\mathcal{C}}^\perp$, respectively. Fix a positive integer $t$ with $t < d$, and let $s$ be the number of $i$ with $A_i^\perp \ne 0$ for $0 < i \leq v-t$. Suppose that $s \leq d -t$. Then \begin{itemize} \item the codewords of weight $i$ in ${\mathcal{C}}$ hold a $t$-design provided that $A_i \ne 0$ and $d \leq i \leq w$, and \item the codewords of weight $i$ in ${\mathcal{C}}^\perp$ hold a $t$-design provided that $A_i^\perp \ne 0$ and $d^\perp \leq i \leq \min\{v-t, w^\perp\}$. \end{itemize} \end{theorem} The Assmus-Mattson Theorems documented above are very powerful tools in constructing $t$-designs from linear codes. We will employ them heavily in this paper. It should be noted that the conditions in Theorems \ref{thm-AM1} and \ref{thm-AM2} are sufficient, but not necessary for obtaining $t$-designs. To construct $t$-designs via Theorems \ref{thm-AM1} and \ref{thm-AM2}, we will need the following lemma in subsequent sections, which is a variant of the MacWilliam Identity \cite[p. 41]{vanLint}. \begin{theorem} \label{thm-MI} Let ${\mathcal{C}}$ be a $[v, \kappa, d]$ code over ${\mathrm{GF}}(q)$ with weight enumerator $A(z)=\sum_{i=0}^v A_iz^i$ and let $A^\perp(z)$ be the weight enumerator of ${\mathcal{C}}^\perp$. Then $$A^\perp(z)=q^{-\kappa}\Big(1+(q-1)z\Big)^vA\Big(\frac {1-z} {1+(q-1)z}\Big).$$ \end{theorem} A function $f$ from ${\mathrm{GF}}(q^m)$ to itself is called {\em planar} or \textit{perfect nonlinear} (PN) if \[\max_{0\ne a\in{\mathrm{GF}}(q^m)}\max_{b\in{\mathrm{GF}}(q^m)}|\{x\in{\mathrm{GF}}(q^m): f(x+a)-f(x)=b\}|=1,\] and {\em almost perfect nonlinear} (APN) if \[\max_{0\ne a\in{\mathrm{GF}}(q^m)}\max_{b\in{\mathrm{GF}}(q^m)}|\{x\in{\mathrm{GF}}(q^m): f(x+a)-f(x)=b\}|=2.\] Later in this paper, we will employ such functions in the constructions of linear codes and thus our constructions of $t$-designs. \section{Infinite families of $3$-designs from the binary RM codes}\label{sec-brmdesigns} It was known that Reed-Muller codes give families of $3$-$(2^m, k, \lambda)$ designs (\cite[Chapter 15]{MS77}, \cite{Tonchevhb}). However, the parameters of $k$ and $\lambda$ may not be specifically given in the literature. The purpose of this section is to determine the parameters of some $3$-designs derived from binary Reed-Muller codes. We use ${\mathrm{RM}}(r, m)$ to denote the binary Reed-Muller code of length $2^m$ and order $r$. Note that ${\mathrm{RM}}(m-r, m)^\perp={\mathrm{RM}}(r-1, m)$, where $2 \leq r < m$. The definition and information about binary Reed-Muller codes can be found in \cite[Section 4.5]{vanLint} and \cite[Chapters 13 and 14]{MS77}. \begin{lemma}\label{lem-RMwt1} The weight distribution of ${\mathrm{RM}}(m-2, m)$ (except $A_i=0$) is given by \begin{eqnarray*} A_{4k}= \frac{1}{2^{m+1}} \left[2\binom{2^m}{4k} + (2^{m+1}-2) \binom{2^{m-1}}{2k}\right] \end{eqnarray*} for $0 \leq k \leq 2^{m-2}$, and by \begin{eqnarray*} A_{4k+2}= \frac{1}{2^{m+1}} \left[2\binom{2^m}{4k+2} - (2^{m+1}-2) \binom{2^{m-1}}{2k+1}\right] \end{eqnarray*} for $0 \leq k \leq 2^{m-2}-1$. \end{lemma} \begin{proof} It is well known that the weight enumerator of ${\mathrm{RM}}(1, m)$ is $$ 1 + (2^{m+1}-2)z^{2^{m-1}} + z^{2^m}. $$ By Theorem \ref{thm-MI}, the weight enumerator of RM$(m-2, m)$, which is the dual of RM$(1, m)$, is given by \begin{eqnarray*} B(z) &=& \frac{1}{2^{m+1}} (1+z)^{2^m}\left[ 1 + (2^{m+1}-2) \left(\frac {1-z} {1+z}\right)^{2^{m-1}} + \left(\frac {1-z} {1+z}\right)^{2^m} \right] \\ &=& \frac{1}{2^{m+1}} \left[ (1+z)^{2^m} + (2^{m+1}-2) (1-z^2)^{2^{m-1}} + (1-z)^{2^m} \right] \\ &=& \frac{1}{2^{m+1}} \left[ 2 \sum_{i=0}^{2^{m-1}} \binom{2^m}{2i} z^{2i} +(2^{m+1}-2) \sum_{i=0}^{2^{m-1}} \binom{2^{m-1}}{i} (-1)^i z^{2i}\right] \\ &=&\frac{1}{2^{m+1}} \sum_{k=0}^{2^{m-2}} \left[ 2\binom{2^m}{4k} + (2^{m+1}-2) \binom{2^{m-1}}{2k} \right] z^{4k} + \\ & & \frac{1}{2^{m+1}}\sum_{k=0}^{2^{m-2}-1} \left[ 2\binom{2^m}{4k+2} - (2^{m+1}-2) \binom{2^{m-1}}{2k+1}\right] z^{4k+2}. \end{eqnarray*} The desired conclusion then follows. \end{proof} The following theorem gives parameters of all the $3$-designs in both ${\mathrm{RM}}(m-2, m)$ and ${\mathrm{RM}}(1, m)$. \begin{theorem}\label{thm-brmdesign1} Let $m \geq 3$. Then ${\mathrm{RM}}(m-2, m)$ has dimension $2^m -m-1$ and minimum distance $4$. For even positive integer $\kappa$ with $4 \leq \kappa \leq 2^m-4$, the supports of the codewords with weight $\kappa$ in ${\mathrm{RM}}(m-2, m)$ hold a $3$-$(2^m, \kappa, \lambda)$ design, where \begin{eqnarray*} \lambda=\left\{ \begin{array}{ll} \frac{\frac{1}{2^{m+1}}\binom{\kappa}{3}\left(2\binom{2^m}{4k} + (2^{m+1}-2) \binom{2^{m-1}}{2k} \right)}{\binom{2^m}{3}} & \mbox{ if } \kappa = 4k, \\ \frac{\frac{1}{2^{m+1}}\binom{\kappa}{3}\left(2\binom{2^m}{4k+2} - (2^{m+1}-2) \binom{2^{m-1}}{2k+1} \right)}{\binom{2^m}{3}} & \mbox{ if } \kappa = 4k+2. \end{array} \right. \end{eqnarray*} The supports of all codewords of weight $2^{m-1}$ in ${\mathrm{RM}}(1, m)$ hold a $3$-$(2^m, 2^{m-1}, 2^{m-2}-1)$ design. \end{theorem} \begin{proof} Note that the weight distribution of ${\mathrm{RM}}(1,m)$ is given by $$ A_0=1, \ A_{2^m}=1, \ A_{2^{m-1}}=2^{m+1}-2, \ \mbox{ and } A_i =0 \mbox{ for all other $i$.} $$ It is known that the minimum distance $d$ of ${\mathrm{RM}}(m-2, m)$ is equal to $4$. Put $t=3$. The number of $i$ with $A_i^\perp \neq 0$ and $1 \leq i \leq 2^m -3$ is $s=1$. Hence, $s=d-t$. Notice that two binary vectors have the same support if and only if they are equal. The desired conclusions then follow from Theorem \ref{thm-AM1} and Lemma \ref{lem-RMwt1}. \end{proof} As a corollary of Theorem \ref{thm-brmdesign1}, we have the following \cite[p. 63]{MS77}, which is well known. \begin{corollary} The minimum weight codewords in ${\mathrm{RM}}(m-2, m)$ form a $3$-$(2^m, 4, 1)$ design, i.e., a Steiner system. \end{corollary} The following theorem is also well known, and tells us that Reed-Muller codes give much more $3$-designs \cite{Tonchevhb}. \begin{theorem}\label{thm-brmdesign2} Let $m \geq 4$ and $2 \leq r < m$. Then ${\mathrm{RM}}(m-r, m)$ has dimension $2^m -\sum_{i=0}^{r-1} \binom{m}{i}$ and minimum distance $2^r$. For every nonzero weight $\kappa$ in ${\mathrm{RM}}(m-r, m)$, the codewords of weight $\kappa$ in RM$(m-r, m)$ hold a $3$-$(2^m, \kappa, \lambda)$ design. \end{theorem} \begin{proof} Since $2 \leq r < m$, by Theorem 24 in \cite[p. 400]{MS77}, the automorphism group of ${\mathrm{RM}}(m-r, m)$ is triply transitive. The desired conclusion then follows from Theorem 8.4.7 in \cite[p. 308]{HP03}. \end{proof} Determining the weight distribution of ${\mathrm{RM}}(m-r, m)$ may be hard for $3 \leq r \leq m-3$ in general. Therefore, it may be difficult to find out the parameters $(\kappa, \lambda)$ of all the $3$-designs. The following problem is open in general. \begin{open} Determine the weight distribution of ${\mathrm{RM}}(m-r, m)$ for $3 \leq r \leq m-3$. \end{open} Some progress on the open problem above was made by Kasami and Tokura \cite{KT} and Kasami, Tokura and Azumi \cite{KTA}. Detailed information on this problem can be found in \cite[Chapter 15]{MS77}. \section{Designs from cyclic Hamming codes}\label{sec-hmdesigns} Let $\alpha$ be a generator of ${\mathrm{GF}}(q^m)^*$. Set $\beta=\alpha^{q-1}$. Let $g(x)$ be the minimal polynomial of $\beta$ over ${\mathrm{GF}}(q)$. Let ${\mathcal{C}}_{(q,m)}$ denote the cyclic code of length $v=(q^m-1)/(q-1)$ over ${\mathrm{GF}}(q)$ with generator polynomial $g(x)$. Then ${\mathcal{C}}_{(q,m)}$ has parameters $[(q^m-1)/(q-1), (q^m-1)/(q-1)-m, d]$, where $d \in \{2,3\}$. When $\gcd(q-1, m)=1$, ${\mathcal{C}}_{(q,m)}$ has minimum weight $3$ and is equivalent to the Hamming code. \begin{lemma}\label{lem-HCwt} The weight distribution of ${\mathcal{C}}_{(q,m)}$ is given by \begin{eqnarray*} A_{k}= \frac{1}{q^m} \sum_{\substack {0 \le i \le (q^{m-1}-1)/(q-1) \\0 \le j \le q^{m-1} \\ i+j=k}}\left[\binom{\frac{q^{m-1}-1}{q-1}}{i} \binom{q^{m-1}}{j}\Big((q-1)^k+(-1)^j(q-1)^i(q^m-1)\Big)\right] \end{eqnarray*} for $0 \leq k \leq (q^m-1)/(q-1)$. \end{lemma} \begin{proof} ${\mathcal{C}}_{(q,m)}^\perp$ is the simplex code, as $\gcd(q-1, (q^{m}-1)/(q-1))=1$. Its weight enumerator is $$ 1+(q^m-1)z^{q^{m-1}}. $$ By Theorem \ref{thm-MI}, the weight enumerator of ${\mathcal{C}}_{(q,m)}$ is given by \begin{eqnarray*} A(z) &=& \frac{1}{q^m} (1+(q-1)z)^{v}\left[ 1 + (q^{m}-1) \left(\frac {1-z} {1+(q-1)z}\right)^{q^{m-1}} \right] \\ &=& \frac{1}{q^m} \left[ (1+(q-1)z)^{v} + (q^m-1) (1-z)^{q^{m-1}}(1+(q-1)z)^{\frac {q^{m-1}-1}{q-1}} \right] \\ &=& \frac{1}{q^m} (1+(q-1)z)^{\frac {q^{m-1}-1}{q-1}} \left[ (1+(q-1)z)^{q^{m-1}} + (q^m-1) (1-z)^{q^{m-1}} \right]. \end{eqnarray*} The desired conclusion then follows. \end{proof} A code of minimum distance $d=2e+1$ is \textit{perfect}, if the spheres of radius $e$ around the codewords cover the whole space. The following theorem introduces a relation between perfect codes and $t$-designs and is due to Assmus and Mattson \cite{AM74}. \begin{theorem}\label{thm-perfectcodedesign} A linear $q$-ary code of length $v$ and minimum distance $d=2e+1$ is perfect if and only if the supports of the codewords of minimum weight form a simple $(e+1)$-$(v, 2e+1, (q-1)^e)$ design. In particular, the minimum weight codewords in a linear or nonlinear perfect code, which contains the zero vector, form a Steiner system $S(e+1, 2e+1, v)$. \end{theorem} It is known that the Hamming code over ${\mathrm{GF}}(q)$ is perfect, and the codewords of weight $3$ hold a $2$-design by Theorem \ref{thm-perfectcodedesign}. The $2$-designs documented in the following theorem may be viewed as an extension of this result. \begin{theorem}\label{thm-HMdesign171} Let $m \geq 3$ and $q = 2$ or $m \geq 2$ and $q >2$, and let $\gcd(q-1, m)=1$. Let ${\mathcal{P}}=\{0,1,2, \cdots, (q^m-q)/(q-1)\}$, and let ${\mathcal{B}}$ be the set of the supports of the codewords of Hamming weight $k$ with $A_k \neq 0$ in ${\mathcal{C}}_{(q,m)}$, where $3 \leq k \leq w$ and $w$ is the largest such that $w-\lfloor (w+q-2)/(q-1) \rfloor < 3$. Then $({\mathcal{P}}, {\mathcal{B}})$ is a $2$-$((q^m-1)/(q-1), k, \lambda)$ design. In particular, the supports of codewords of weight $3$ in ${\mathcal{C}}_{(q,m)}$ form a $2$-$((q^m-1)/(q-1), 3, q-1)$ design. The supports of all codewords of weight $q^{m-1}$ in ${\mathcal{C}}_{(q,m)}^\perp$ form a $2$-$((q^m-1)/(q-1), q^{m-1}, \lambda)$ design, where $$ \lambda=(q-1)q^{m-2}. $$ \end{theorem} \begin{proof} ${\mathcal{C}}_{(q,m)}^\perp$ is the simplex code, as $\gcd(q-1, (q^{m}-1)/(q-1))=1$. Its weight enumerator is $$ 1+(q^m-1)z^{q^{m-1}}. $$ A proof of this weight enumerator is straightforward and can be found in \cite[Theorem 15]{DY13}. Recall now Theorem \ref{thm-AM2} and the definition of $w$ for ${\mathcal{C}}_{(q,m)}$ and $w^\perp$ for ${\mathcal{C}}_{(q,m)}^\perp$. Since ${\mathcal{C}}_{(q,m)}$ has minimum weight $3$. Given that the weight enumerator of ${\mathcal{C}}_{(q,m)}^\perp$ is $1+(q^m-1)z^{q^{m-1}},$ we deduce that $w^\perp=q^{m-1}$. Put $t=2$. It then follows that $s=1=d-t$. The desired conclusion on the $2$-design property then follows from Theorem \ref{thm-AM2} and Lemma \ref{lem-HCwt}. We now prove that the supports of codewords of weight $3$ in ${\mathcal{C}}_{(q,m)}$ form a $2$-$((q^m-1)/(q-1), 3, q-1)$ design. We have already proved that these supports form a $2$-$((q^m-1)/(q-1), 3, \lambda)$ design. To determine the value $\lambda$ for this design, we need to compute the total number $b$ of blocks in this design. To this end, we first compute the total number of codewords of weight $3$ in ${\mathcal{C}}_{(q,m)}$. It follows from Lemma \ref{lem-HCwt} that $$ A_3=\frac{(q^m-1)(q^m-q)}{6}. $$ Since $3$ is the minimum nonzero weight in ${\mathcal{C}}_{(q,m)}$, it is easy to see that two codewords of weight $3$ in ${\mathcal{C}}_{(q,m)}$ have the same support if and only one is a scalar multiple of another. Thus, the total number $b$ of blocks is given by $$ b:=\frac{A_3}{q-1}=\frac{(q^m-1)(q^m-q)}{6(q-1)}. $$ It then follows that $$ \lambda=\frac{b\binom{3}{2}}{\binom{\frac{q^m-1}{q-1}}{2}}=q-1. $$ Let $\alpha$ be a generator of ${\mathrm{GF}}(q^m)^*$, and set $\beta=\alpha^{q-1}$. Then $\beta$ is a $v$-th primitive root of unity, where $v=(q^m-1)/(q-1)$. It is known that $$ {\mathcal{C}}_{(q,m)}^\perp=\{{\mathbf{c}}_u: u \in {\mathrm{GF}}(q^m)\}, $$ where ${\mathbf{c}}_u=(({\mathrm{Tr}}(u), {\mathrm{Tr}}(u\beta), \cdots, {\mathrm{Tr}}(u\beta^{v-1}))$ and ${\mathrm{Tr}}(x)$ is the trace function from ${\mathrm{GF}}(q^m)$ to ${\mathrm{GF}}(q)$. It is then easily seen that ${\mathbf{c}}_{u}$ and ${\mathbf{c}}_{v}$ have the same support if and only if $u=av$ for some $a \in {\mathrm{GF}}(q)^*$. We then deduce that the total number $b^\perp$ of blocks in the design is given by $$ b^\perp = \frac{q^m-1}{q-1}. $$ Consequently, $$ \lambda^\perp = \frac{\frac{q^m-1}{q-1} \binom{q^{m-1}}{2}}{\binom{\frac{q^{m-1}-1}{q-1}}{2}} =(q-1)q^{m-2}. $$ Thus, the supports of all codewords of weight $q^{m-1}$ in ${\mathcal{C}}_{(q,m)}^\perp$ form a $2$-design with parameters $$ \left((q^m-1)/(q-1), \ q^{m-1}, \ (q-1)q^{m-2} \right). $$ \end{proof} Theorem \ref{thm-HMdesign171} tells us that for some $k \geq 3$ with $A_k \neq 0$, the supports of the codewords with weight $k$ in ${\mathcal{C}}_{(q,m)}$ form $2$-$((q^m-1)/(q-1), k, \lambda)$ design. However, it looks complicated to determine the parameter $\lambda$ corresponding to this $k \geq 4$. We draw the reader's attention to the following open problem. \begin{open} Let $q \geq 3$ and $m \geq 2$. For $k \geq 4$ with $A_k \neq 0$, determine the value $\lambda$ in the $2$-$((q^m-1)/(q-1), k, \lambda)$ design, formed by the supports of the codewords with weight $k$ in ${\mathcal{C}}_{(q,m)}$. \end{open} Notice that two binary codewords have the same support if and only if they are equal. When $q=2$, Theorem \ref{thm-HMdesign171} becomes the following. \begin{corollary}\label{cor-HMdesign171} Let $m \geq 3$. Let ${\mathcal{P}}=\{0,1,2, \cdots, 2^m-2\}$, and let ${\mathcal{B}}$ be the set of the supports of the codewords with Hamming weight $k$ in ${\mathcal{C}}_{(2,m)}$, where $3 \leq k \leq 2^m-3$. Then $({\mathcal{P}}, {\mathcal{B}})$ is a $2$-$(2^m-1, k, \lambda)$ design, where $$ \lambda=\frac{(k-1)kA_k}{(2^m-1)(2^m-2)} $$ and $A_k$ is given in Lemma \ref{lem-HCwt}. The supports of all codewords of weight $2^{m-1}$ in ${\mathcal{C}}_{(2,m)}^\perp$ form a $2$-$(2^m-1, 2^{m-1}, 2^{m-2})$ design. \end{corollary} Corollary \ref{cor-HMdesign171} says that each binary Hamming code ${\mathcal{C}}_{(2,m)}$ and its dual code give a total number $2^m-4$ of $2$-designs with varying block sizes. The following are examples of the $2$-designs held in the binary Hamming code. \begin{example} Let $m \geq 4$. Let ${\mathcal{P}}=\{0,1,2, \cdots, 2^m-2\}$, and let ${\mathcal{B}}$ be the set of the supports of the codewords with Hamming weight $3$ in ${\mathcal{C}}_{(2,m)}$. Then $({\mathcal{P}}, {\mathcal{B}})$ is a $2$-$(2^m-1, \, 3, \, 1)$ design. \end{example} \begin{proof} By Lemma \ref{lem-HCwt}, we have $$ A_3=\frac{(2^{m-1}-1)(2^m-1)}{3}. $$ The desired value for $\lambda$ then follows from Corollary \ref{cor-HMdesign171}. \end{proof} \begin{example}\label{exam-hmdesign4} Let $m \geq 4$. Let ${\mathcal{P}}=\{0,1,2, \cdots, 2^m-2\}$, and let ${\mathcal{B}}$ be the set of the supports of the codewords with Hamming weight $4$ in ${\mathcal{C}}_{(2,m)}$. Then $({\mathcal{P}}, {\mathcal{B}})$ is a $2$-$(2^m-1, \, 4, \, 2^{m-1}-2)$ design. \end{example} \begin{proof} By Lemma \ref{lem-HCwt}, we have $$ A_4=\frac{(2^{m-1}-1)(2^{m-1}-2)(2^m-1)}{6}. $$ The desired value for $\lambda$ then follows from Corollary \ref{cor-HMdesign171}. \end{proof} \begin{example}\label{exam-hmdesign5} Let $m \geq 4$. Let ${\mathcal{P}}=\{0,1,2, \cdots, 2^m-2\}$, and let ${\mathcal{B}}$ be the set of the supports of the codewords with Hamming weight $5$ in ${\mathcal{C}}_{(2,m)}$. Then $({\mathcal{P}}, {\mathcal{B}})$ is a $2$-$(2^m-1, \, 5, \, \lambda)$ design, where $$ \lambda=\frac{2(2^{m-1}-2)(2^{m-1}-4)}{3} $$ \end{example} \begin{proof} By Lemma \ref{lem-HCwt}, we have $$ A_5=\frac{(2^{m-1}-1)(2^{m-1}-2)(2^{m-1}-4)(2^m-1)}{15}. $$ The desired value for $\lambda$ then follows from Corollary \ref{cor-HMdesign171}. \end{proof} \begin{example}\label{exam-hmdesign6} Let $m \geq 4$. Let ${\mathcal{P}}=\{0,1,2, \cdots, 2^m-2\}$, and let ${\mathcal{B}}$ be the set of the supports of the codewords with Hamming weight $6$ in ${\mathcal{C}}_{(2,m)}$. Then $({\mathcal{P}}, {\mathcal{B}})$ is a $2$-$(2^m-1, \, 6, \, \lambda)$ design, where $$ \lambda=\frac{(2^{m-1}-2)(2^{m-1}-3)(2^{m-1}-4)}{3} $$ \end{example} \begin{proof} By Lemma \ref{lem-HCwt}, we have $$ A_6=\frac{(2^{m-1}-1)(2^{m-1}-2)(2^{m-1}-3)(2^{m-1}-4)(2^m-1)}{45}. $$ The desired value for $\lambda$ then follows from Corollary \ref{cor-HMdesign171}. \end{proof} \begin{example}\label{exam-hmdesign7} Let $m \geq 4$. Let ${\mathcal{P}}=\{0,1,2, \cdots, 2^m-2\}$, and let ${\mathcal{B}}$ be the set of the supports of the codewords with Hamming weight $7$ in ${\mathcal{C}}_{(2,m)}$. Then $({\mathcal{P}}, {\mathcal{B}})$ is a $2$-$(2^m-1, \, 7, \, \lambda)$ design, where $$ \lambda=\frac{(2^{m-1}-2)(2^{m-1}-3)(4 \times 2^{2(m-1)}-30 \times 2^{m-1} +71)}{30}. $$ \end{example} \begin{proof} By Lemma \ref{lem-HCwt}, we have $$ A_7=\frac{(2^{m-1}-1)(2^{m-1}-2)(2^{m-1}-3)(2^m-1)(4 \times 2^{2(m-1)}-30 \times 2^{m-1} +71)}{630}. $$ The desired value for $\lambda$ then follows from Corollary \ref{cor-HMdesign171}. \end{proof} \section{Designs from a class of binary codes with two zeros and their duals}\label{sec-newdesigns} In this section, we construct many infinite families of $2$-designs and $3$-designs with several classes of binary cyclic codes whose duals have two zeros. These binary codes are defined by almost perfect nonlinear (APN) functions over ${\mathrm{GF}}(2^m)$. \begin{table}[ht] \caption{Weight distribution for odd $m$.}\label{tab-CG1} \centering \begin{tabular}{ll} \hline Weight $w$ & No. of codewords $A_w$ \\ \hline $0$ & $1$ \\ $2^{m-1}-2^{(m-1)/2}$ & $(2^m-1)(2^{(m-1)/2}+1)2^{(m-3)/2}$ \\ $2^{m-1}$ & $(2^m-1)(2^{m-1}+1)$ \\ $2^{m-1}+2^{(m-1)/2}$ & $(2^m-1)(2^{(m-1)/2}-1)2^{(m-3)/2}$ \\ \hline \end{tabular} \end{table} \begin{lemma}\label{lem-TZwt} Let $m \geq 5$ be odd. Let ${\mathcal{C}}_m$ be a binary linear code of length $2^m-1$ such that its dual code ${\mathcal{C}}_m^\perp$ has the weight distribution of Table \ref{tab-CG1}. Then the weight distribution of ${\mathcal{C}}_m$ is given by \begin{eqnarray*} 2^{2m}A_k&=& \sum_{\substack{0 \le i \le 2^{m-1}-2^{(m-1)/2} \\ 0\le j \le 2^{m-1}+2^{(m-1)/2}-1 \\i+j=k}}(-1)^ia\binom{2^{m-1}-2^{(m-1)/2}} {i} \binom{2^{m-1}+2^{(m-1)/2}-1}{j}\\ & & + \binom {2^m-1}{k}+\sum_{\substack{0 \le i \le 2^{m-1} \\ 0\le j \le 2^{m-1}-1 \\i+j=k}}(-1)^ib\binom{2^{m-1}} {i}\binom{2^{m-1}-1} {j} \\ & & + \sum_{\substack{0 \le i \le 2^{m-1}+2^{(m-1)/2} \\ 0\le j \le 2^{m-1}-2^{(m-1)/2}-1 \\i+j=k}}(-1)^ic\binom{2^{m-1}+2^{(m-1)/2}}{i}\binom{2^{m-1}-2^{(m-1)/2}-1}{j} \end{eqnarray*} for $0 \le k \le 2^m-1$, where \begin{eqnarray*} a &=& (2^m-1)(2^{(m-1)/2}+1)2^{(m-3)/2}, \\ b &=& (2^m-1)(2^{m-1}+1), \\ c &=& (2^m-1)(2^{(m-1)/2}-1)2^{(m-3)/2}. \end{eqnarray*} In addition, ${\mathcal{C}}_m$ has parameters $[2^m-1, 2^m-1-2m, 5]$. \end{lemma} \begin{proof} By assumption, the weight enumerator of ${\mathcal{C}}_m^\perp$ is given by $$ A^\perp(z)=1+az^{2^{m-1}-2^{(m-1)/2}}+bz^{2^{m-1}}+cz^{2^{m-1}+2^{(m-1)/2}}. $$ It then follows from Theorem \ref{thm-MI} that the weight enumerator of ${\mathcal{C}}_m$ is given by \begin{eqnarray*} A(z) &=& \frac{1}{2^{2m}} (1+z)^{2^m-1}\left[ 1 + a\left(\frac {1-z} {1+z}\right)^{2^{m-1}-2^{(m-1)/2}} \right] + \\ & & \frac{1}{2^{2m}} (1+z)^{2^m-1}\left[ b\left(\frac {1-z} {1+z}\right)^{2^{m-1}}+c\left(\frac {1-z} {1+z}\right)^{2^{m-1}+2^{(m-1)/2}} \right] \\ &=& \frac{1}{2^{2m}} \Bigg[ (1+z)^{2^m-1} + a(1-z)^{2^{m-1}-2^{(m-1)/2}}(1+z)^{2^{m-1}+2^{(m-1)/2}-1} \\ & & + b(1-z)^{2^{m-1}}(1+z)^{2^{m-1}-1} + c(1-z)^{2^{m-1}+2^{(m-1)/2}}(1+z)^{2^{m-1}-2^{(m-1)/2}-1} \Bigg]. \end{eqnarray*} Obviously, we have \begin{eqnarray*} (1+z)^{2^m-1} &=& \sum_{k=0}^{2^m-1} \binom{2^m-1}{k}z^k. \end{eqnarray*} It is easily seen that \begin{eqnarray*} \lefteqn{(1-z)^{2^{m-1}-2^{(m-1)/2}}(1+z)^{2^{m-1}+2^{(m-1)/2}-1} } \\ &=& \sum_{k=0}^{2^m-1} \left[ \sum_{\substack{0 \le i \le 2^{m-1}-2^{(m-1)/2} \\ 0\le j \le 2^{m-1}+2^{(m-1)/2}-1 \\i+j=k}}(-1)^i \binom{2^{m-1}-2^{(m-1)/2}} {i} \binom{2^{m-1}+2^{(m-1)/2}-1}{j} \right] z^k \end{eqnarray*} and \begin{eqnarray*} \lefteqn{(1-z)^{2^{m-1}+2^{(m-1)/2}}(1+z)^{2^{m-1}-2^{(m-1)/2}-1} } \\ &=& \sum_{k=0}^{2^m-1} \left[ \sum_{\substack{0 \le i \le 2^{m-1}+2^{(m-1)/2} \\ 0\le j \le 2^{m-1}-2^{(m-1)/2}-1 \\i+j=k}}(-1)^i \binom{2^{m-1}+2^{(m-1)/2}}{i}\binom{2^{m-1}-2^{(m-1)/2}-1}{j} \right] z^k. \end{eqnarray*} Similarly, we have \begin{eqnarray*} (1-z)^{2^{m-1}}(1+z)^{2^{m-1}-1}= \sum_{k=0}^{2^m-1} \left[ \sum_{\substack{0 \le i \le 2^{m-1} \\ 0\le j \le 2^{m-1}-1 \\i+j=k}}(-1)^i \binom{2^{m-1}} {i}\binom{2^{m-1}-1} {j} \right] z^k. \end{eqnarray*} Combining these formulas above yields the weight distribution formula for $A_k$. The weight distribution in Table \ref{tab-CG1} tells us that the dimension of ${\mathcal{C}}_m^\perp$ is $2m$. Therefore, the dimension of ${\mathcal{C}}_m$ is equal to $2^m-1-2m$. Finally, we prove that the minimum distance $d$ of ${\mathcal{C}}_m$ equals $5$. After tedious computations with the formula of $A_k$ given in Lemma \ref{lem-TZwt}, one can verify that $A_1=A_2=A_3=A_4=0$ and \begin{eqnarray}\label{eqn-minimumwt5} A_5=\frac{4\times 2^{3m-5} - 22 \times 2^{2m-4} + 26 \times 2^{m-3} -2}{15}. \end{eqnarray} When $m \geq 5$, we have $$ 4\times 2^{3m-5} = 4 \times 2^{m-1} 2^{2m-4} \geq 64 \times 2^{2m-4} > 22 \times 2^{2m-4} $$ and $$ 26 \times 2^{m-3} -2 >0. $$ Consequently, $A_5>0$ for all odd $m$. This proves that $d=5$. \end{proof} \begin{theorem}\label{thm-newdesigns1} Let $m \geq 5$ be odd. Let ${\mathcal{C}}_m$ be a binary linear code of length $2^m-1$ such that its dual code ${\mathcal{C}}_m^\perp$ has the weight distribution of Table \ref{tab-CG1}. Let ${\mathcal{P}}=\{0,1,2, \cdots, 2^m-2\}$, and let ${\mathcal{B}}$ be the set of the supports of the codewords of ${\mathcal{C}}_m$ with weight $k$, where $A_k \neq 0$. Then $({\mathcal{P}}, {\mathcal{B}})$ is a $2$-$(2^m-1, k, \lambda)$ design, where \begin{eqnarray*} \lambda=\frac{k(k-1)A_k}{(2^m-1)(2^m-2)}, \end{eqnarray*} where $A_k$ is given in Lemma \ref{lem-TZwt}. Let ${\mathcal{P}}=\{0,1,2, \cdots, 2^m-2\}$, and let ${\mathcal{B}}^\perp$ be the set of the supports of the codewords of ${\mathcal{C}}_m^\perp$ with weight $k$ and $A_k^\perp \neq 0$. Then $({\mathcal{P}}, {\mathcal{B}}^\perp)$ is a $2$-$(2^m-1, k, \lambda)$ design, where \begin{eqnarray*} \lambda=\frac{k(k-1)A_k^\perp}{(2^m-1)(2^m-2)}, \end{eqnarray*} where $A_k^\perp$ is given in Lemma \ref{lem-TZwt}. \end{theorem} \begin{proof} The weight distribution of ${\mathcal{C}}_m$ is given in Lemma \ref{lem-TZwt} and that of ${\mathcal{C}}_m^\perp$ is given in Table \ref{tab-CG1}. By Lemma \ref{lem-TZwt}, the minimum distance $d$ of ${\mathcal{C}}_m$ is equal to $5$. Put $t=2$. The number of $i$ with $A_i^\perp \neq 0$ and $1 \leq i \leq 2^m-1 -t$ is $s=3$. Hence, $s=d-t$. The desired conclusions then follow from Theorem \ref{thm-AM1} and the fact that two binary vectors have the same support if and only if they are equal. \end{proof} \begin{example} Let $m \geq 5$ be odd. Then ${\mathcal{C}}_m^\perp$ gives three $2$-designs with the following parameters: \begin{itemize} \item $(v,\, k, \, \lambda)=\left(2^m-1,\ 2^{m-1}-2^{(m-1)/2}, \ 2^{m-3} (2^{m-1} - 2^{(m-1)/2} -1) \right).$ \item $(v, \, k, \, \lambda)=\left(2^m-1, \ 2^{m-1}+2^{(m-1)/2}, \ 2^{m-3} (2^{m-1} + 2^{(m-1)/2} -1) \right).$ \item $(v, \, k, \, \lambda)=\left(2^m-1, \ 2^{m-1}, \ (2^m-1)(2^{m-1}+1) \right).$ \end{itemize} \end{example} \begin{example} Let $m \geq 5$ be odd. Then the supports of all codewords of weight $5$ in ${\mathcal{C}}_m$ give a $2$-$(2^m-1,\, 5,\, (2^{m-1}-4)/3)$ design. \end{example} \begin{proof} By Lemma \ref{lem-TZwt}, $$ A_5 = \frac{(2^{m-1}-1) (2^{m-1}-4) (2^m-1)}{30} $$ The desired value for $\lambda$ then follows from Theorem \ref{thm-newdesigns1}. \end{proof} \begin{example} Let $m \geq 5$ be odd. Then the supports of all codewords of weight $6$ in ${\mathcal{C}}_m$ give a $2$-$(2^m-1,\, 6,\, \lambda)$ design, where $$ \lambda= \frac{(2^{m-2}-2)(2^{m-1}-3)}{3}. $$ \end{example} \begin{proof} By Lemma \ref{lem-TZwt}, $$ A_6 = \frac{(2^{m-1}-1) (2^{m-1}-4) (2^{m-1}-3) (2^m-1)}{90} $$ The desired value for $\lambda$ then follows from Theorem \ref{thm-newdesigns1}. \end{proof} \begin{example} Let $m \geq 5$ be odd. Then the supports of all codewords of weight $7$ in ${\mathcal{C}}_m$ give a $2$-$(2^m-1,\, 7,\, \lambda)$ design, where $$ \lambda= \frac{2 \times 2^{3(m-1)} - 25 \times 2^{2(m-1)} + 123 \times 2^{m-1} - 190}{30}. $$ \end{example} \begin{proof} By Lemma \ref{lem-TZwt}, $$ A_7 = \frac{(2^{m-1}-1) (2^m-1) (2 \times 2^{3(m-1)} - 25 \times 2^{2(m-1)} + 123 \times 2^{m-1} - 190)}{630}. $$ The desired value for $\lambda$ then follows from Theorem \ref{thm-newdesigns1}. \end{proof} \begin{example} Let $m \geq 5$ be odd. Then the supports of all codewords of weight $8$ in ${\mathcal{C}}_m$ give a $2$-$(2^m-1,\, 8,\, \lambda)$ design, where $$ \lambda= \frac{ (2^{m-2}-2) (2 \times 2^{3(m-1)} - 25 \times 2^{2(m-1)} + 123 \times 2^{m-1} - 190)}{45}. $$ \end{example} \begin{proof} By Lemma \ref{lem-TZwt}, $$ A_8 = \frac{(2^{m-1}-1) (2^{m-1}-4) (2^m-1) (2 \times 2^{3(m-1)} - 25 \times 2^{2(m-1)} + 123 \times 2^{m-1} - 190)}{8 \times 315}. $$ The desired value for $\lambda$ then follows from Theorem \ref{thm-newdesigns1}. \end{proof} \begin{lemma}\label{lem-TZEwt} Let $m \geq 5$ be odd. Let ${\mathcal{C}}_m$ be a linear code of length $2^m-1$ such that its dual code ${\mathcal{C}}_m^\perp$ has the weight distribution of Table \ref{tab-CG1}. Denote by $\overline{{\mathcal{C}}}_m$ the extended code of ${\mathcal{C}}_m$ and let $\overline{{\mathcal{C}}}_m^\perp$ denote the dual of $\overline{{\mathcal{C}}}_m$. Then the weight distribution of $\overline{{\mathcal{C}}}_m$ is given by \begin{eqnarray*} 2^{2m+1}\overline{A}_k&=& (1+(-1)^k) \binom{2^m}{k} + \frac{1+(-1)^k}{2} (-1)^{\lfloor k/2 \rfloor} \binom{2^{m-1}}{\lfloor k/2 \rfloor} v + \\ & & u \sum_{\substack{0 \le i \le 2^{m-1}-2^{(m-1)/2} \\ 0\le j \le 2^{m-1}+2^{(m-1)/2} \\i+j=k}}(-1)^i \binom{2^{m-1}-2^{(m-1)/2}} {i} \binom{2^{m-1}+2^{(m-1)/2}}{j} + \\ & & u \sum_{\substack{0 \le i \le 2^{m-1}+2^{(m-1)/2} \\ 0\le j \le 2^{m-1}-2^{(m-1)/2} \\i+j=k}}(-1)^i \binom{2^{m-1}+2^{(m-1)/2}}{i}\binom{2^{m-1}-2^{(m-1)/2}}{j} \end{eqnarray*} for $0 \le k \le 2^m$, where $$ u=2^{2m-1}-2^{m-1} \mbox{ and } v = 2^{2m}+2^m-2. $$ In addition, $\overline{{\mathcal{C}}}_m$ has parameters $[2^m, 2^m-1-2m, 6]$. The code $\overline{{\mathcal{C}}}_m^\perp$ has weight enumerator \begin{eqnarray}\label{eqn-wtenumerator} \overline{A}^\perp(z) = 1+uz^{2^{m-1}-2^{(m-1)/2}}+vz^{2^{m-1}}+uz^{2^{m-1}+2^{(m-1)/2}}+z^{2^m}, \end{eqnarray} and parameters $[2^m, \ 2m+1, \ 2^{m-1}-2^{(m-1)/2}]$. \end{lemma} \begin{proof} It was proved in Lemma \ref{lem-TZwt} that ${\mathcal{C}}_m$ has parameters $[2^m-1, 2^m-1-2m, 5]$. By definition, the extended code $\overline{{\mathcal{C}}}_m$ has parameters $[2^m, 2^m-1-2m, 6]$. By Table \ref{tab-CG1}, all weights of ${\mathcal{C}}_m^\perp$ are even. Note that ${\mathcal{C}}_m^\perp$ has length $2^m-1$ and dimension $2m$, while $\overline{{\mathcal{C}}}_m^\perp$ has length $2^m$ and dimension $2m+1$. By definition, $\overline{{\mathcal{C}}}_m$ has only even weights. Therefore, the all-one vector must be a codeword in $\overline{{\mathcal{C}}}_m^\perp$. It can be shown that the weights in $\overline{{\mathcal{C}}}_m^\perp$ are the following: $$ 0, \ w_1,\ w_2, \ w_3,\ 2^m-w_1,\ 2^m-w_2, \ 2^m-w_3, \ 2^m, $$ where $w_1, w_2$ and $w_3$ are the three nonzero weights in ${\mathcal{C}}_m^\perp$. Consequently, $\overline{{\mathcal{C}}}_m^\perp$ has the following four weights $$ 2^{m-1}-2^{(m-1)/2}, \ 2^{m-1}, \ 2^{m-1}+2^{(m-1)/2}, \ 2^m. $$ Recall that $\overline{{\mathcal{C}}}_m$ has minimum distance $6$. Employing the first few Pless Moments, one can prove that the weight enumerator of $\overline{{\mathcal{C}}}_m^\perp$ is the one given in (\ref{eqn-wtenumerator}). By Theorem \ref{thm-MI}, the weight enumerator of $\overline{{\mathcal{C}}}_m$ is given by \begin{eqnarray}\label{eqn-j18-1} 2^{2m+1}\overline{A}(z) &=& (1+z)^{2^m}\left[ 1 + u\left(\frac {1-z} {1+z}\right)^{2^{m-1}-2^{(m-1)/2}}+ v\left(\frac {1-z} {1+z}\right)^{2^{m-1}} \right] + \nonumber \\ && (1+z)^{2^m}\left[ u\left(\frac {1-z} {1+z}\right)^{2^{m-1}+2^{(m-1)/2}} + \left(\frac{1-z}{1+z}\right)^{2^m} \right] \nonumber \\ &=& (1+z)^{2^m} + (1-z)^{2^m} + v (1-z^2)^{2^{m-1}} + \nonumber \\ & & u(1-z)^{2^{m-1}-2^{(m-1)/2}}(1+z)^{2^{m-1}+2^{(m-1)/2}} + \nonumber \\ & & u(1-z)^{2^{m-1}+2^{(m-1)/2}}(1+z)^{2^{m-1}-2^{(m-1)/2}} . \end{eqnarray} We now treat the terms in (\ref{eqn-j18-1}) one by one. We first have \begin{eqnarray}\label{eqn-j18-2} (1+z)^{2^m} + (1-z)^{2^m} = \sum_{k=0}^{2^m} \left(1+(-1)^k \right) \binom{2^m}{k}. \end{eqnarray} One can easily see that \begin{eqnarray}\label{eqn-j18-3} (1-z^2)^{2^{m-1}} = \sum_{i=0}^{2^{m-1}} (-1)^i \binom{2^{m-1}}{i} z^{2i} = \sum_{k=0}^{2^{m}} \frac{1+(-1)^k}{2} (-1)^{\lfloor k/2 \rfloor} \binom{2^{m-1}}{\lfloor k/2 \rfloor} z^{k}. \end{eqnarray} Notice that \begin{eqnarray*} (1-z)^{2^{m-1}-2^{(m-1)/2}}=\sum_{i=0}^{2^{m-1}-2^{(m-1)/2}} \binom{2^{m-1}-2^{(m-1)/2}}{i} (-1)^i z^i \end{eqnarray*} and \begin{eqnarray*} (1+z)^{2^{m-1}+2^{(m-1)/2}}=\sum_{i=0}^{2^{m-1}+2^{(m-1)/2}} \binom{2^{m-1}+2^{(m-1)/2}}{i} z^i \end{eqnarray*} We have then \begin{eqnarray}\label{eqn-j18-4} \lefteqn{(1-z)^{2^{m-1}-2^{(m-1)/2}} (1+z)^{2^{m-1}+2^{(m-1)/2}} } \nonumber \\ & & = \sum_{k=0}^{2^m} \left[ \sum_{\substack{0 \le i \le 2^{m-1}-2^{(m-1)/2} \\ 0\le j \le 2^{m-1}+2^{(m-1)/2} \\i+j=k}}(-1)^i \binom{2^{m-1}-2^{(m-1)/2}} {i} \binom{2^{m-1}+2^{(m-1)/2}}{j} \right] z^k. \end{eqnarray} Similarly, we have \begin{eqnarray}\label{eqn-j18-5} \lefteqn{(1-z)^{2^{m-1}+2^{(m-1)/2}} (1+z)^{2^{m-1}-2^{(m-1)/2}} } \nonumber \\ & & = \sum_{k=0}^{2^m} \left[ \sum_{\substack{0 \le i \le 2^{m-1}+2^{(m-1)/2} \\ 0\le j \le 2^{m-1}-2^{(m-1)/2} \\i+j=k}}(-1)^i \binom{2^{m-1}+2^{(m-1)/2}} {i} \binom{2^{m-1}-2^{(m-1)/2}}{j} \right] z^k. \end{eqnarray} Plugging (\ref{eqn-j18-2}), (\ref{eqn-j18-3}), (\ref{eqn-j18-4}), and (\ref{eqn-j18-5}) into (\ref{eqn-j18-1}) proves the desired conclusion. \end{proof} \begin{theorem}\label{thm-newdesigns2} Let $m \geq 5$ be odd. Let ${\mathcal{C}}_m$ be a linear code of length $2^m-1$ such that its dual code ${\mathcal{C}}_m^\perp$ has the weight distribution of Table \ref{tab-CG1}. Denote by $\overline{{\mathcal{C}}}_m$ the extended code of ${\mathcal{C}}_m$ and let $\overline{{\mathcal{C}}}_m^\perp$ denote the dual of $\overline{{\mathcal{C}}}_m$. Let ${\mathcal{P}}=\{0,1,2, \cdots, 2^m-1\}$, and let $\overline{{\mathcal{B}}}$ be the set of the supports of the codewords of $\overline{{\mathcal{C}}}_m$ with weight $k$, where $\overline{A}_k \neq 0$. Then $({\mathcal{P}}, \overline{{\mathcal{B}}})$ is a $3$-$(2^m, k, \lambda)$ design, where \begin{eqnarray*} \lambda=\frac{\overline{A}_k\binom{k}{3}}{\binom{2^m}{3}}, \end{eqnarray*} where $\overline{A}_k$ is given in Lemma \ref{lem-TZEwt}. Let ${\mathcal{P}}=\{0,1,2, \cdots, 2^m-1\}$, and let $\overline{{\mathcal{B}}}^\perp$ be the set of the supports of the codewords of $\overline{{\mathcal{C}}}_m^\perp$ with weight $k$ and $\overline{A}_k^\perp \neq 0$. Then $({\mathcal{P}}, \overline{{\mathcal{B}}}^\perp)$ is a $3$-$(2^m, k, \lambda)$ design, where \begin{eqnarray*} \lambda=\frac{\overline{A}_k^\perp\binom{k}{3}}{\binom{2^m}{3}}, \end{eqnarray*} where $\overline{A}_k^\perp$ is given in Lemma \ref{lem-TZEwt}. \end{theorem} \begin{proof} The weight distributions of $\overline{{\mathcal{C}}}_m$ and $\overline{{\mathcal{C}}}_m^\perp$ are described in Lemma \ref{lem-TZEwt}. Notice that the minimum distance $d$ of $\overline{{\mathcal{C}}}_m$ is equal to $6$. Put $t=3$. The number of $i$ with $\overline{A}_i^\perp \neq 0$ and $1 \leq i \leq 2^m -t$ is $s=3$. Hence, $s=d-t$. The desired conclusions then follow from Theorem \ref{thm-AM1} and the fact that two binary vectors have the same support if and only if they are identical. \end{proof} \begin{example} Let $m \geq 5$ be odd. Then $\overline{{\mathcal{C}}}_m^\perp$ gives three $3$-designs with the following parameters: \begin{itemize} \item $(v,\, k, \, \lambda)=\left(2^m,\ 2^{m-1}-2^{(m-1)/2}, \ (2^{m-3}-2^{(m-3)/2}) (2^{m-1}-2^{(m-1)/2}-1) \right).$ \item $(v, \, k, \, \lambda)=\left(2^m, \ 2^{m-1}+2^{(m-1)/2}, \ (2^{m-3}+2^{(m-3)/2}) (2^{m-1}-2^{(m-1)/2}-1) \right).$ \item $(v, \, k, \, \lambda)=\left(2^m, \ 2^{m-1}, \ (2^{m-1}+1)(2^{m-2}-1) \right).$ \end{itemize} \end{example} \begin{example} Let $m \geq 5$ be odd. Then the supports of all codewords of weight $6$ in $\overline{{\mathcal{C}}}_m$ give a $3$-$(2^m,\, 6,\, \lambda)$ design, where $$ \lambda= \frac{2^{m-1}-4}{3}. $$ \end{example} \begin{proof} By Lemma \ref{lem-TZEwt}, $$ \overline{A}_6 = \frac{2^{m-1} (2^{m-1}-1) (2^{m-1}-4) (2^m-1)}{90} $$ The desired value for $\lambda$ then follows from Theorem \ref{thm-newdesigns2}. \end{proof} \begin{example} Let $m \geq 5$ be odd. Then the supports of all codewords of weight $8$ in $\overline{{\mathcal{C}}}_m$ give a $3$-$(2^m,\, 8,\, \lambda)$ design, where $$ \lambda= \frac{2 \times 2^{3(m-1)} - 25 \times 2^{2(m-1)} + 123 \times 2^{m-1} - 190}{30}. $$ \end{example} \begin{proof} By Lemma \ref{lem-TZEwt}, $$ \overline{A}_8 = \frac{2^{m-1}(2^{m-1}-1) (2^m-1) (2 \times 2^{3(m-1)} - 25 \times 2^{2(m-1)} + 123 \times 2^{m-1} - 190)}{8 \times 315}. $$ The desired value for $\lambda$ then follows from Theorem \ref{thm-newdesigns2}. \end{proof} \begin{example} Let $m \geq 5$ be odd. Then the supports of all codewords of weight $10$ in $\overline{{\mathcal{C}}}_m$ give a $3$-$(2^m,\, 10,\, \lambda)$ design, where $$ \lambda= \frac{ (2^{m-1}-4) (2 \times 2^{4(m-1)} - 34 \times 2^{3(m-1)} + 235 \times 2^{2(m-1)} - 931 \times 2^{m-1} + 1358)}{315}. $$ \end{example} \begin{proof} By Lemma \ref{lem-TZEwt}, $$ \overline{A}_{10} = \frac{2^{h} (2^{h}-1) (2^{h}-4) (2^{h+1}-1) (2\times 2^{4h} - 34 \times 2^{3h} + 235 \times 2^{2h} - 931 \times 2^{h} + 1358)}{4\times 14175}, $$ where $h=m-1$. The desired value for $\lambda$ then follows from Theorem \ref{thm-newdesigns2}. \end{proof} To demonstrate the existence of the $2$-designs and $3$-designs presented in Theorems \ref{thm-newdesigns1} and \ref{thm-newdesigns2}, respectively, we describe a list of binary codes that have the weight distribution of Table \ref{tab-CG1} below. Let $\alpha$ be a generator of ${\mathrm{GF}}(2^m)^*$. Let $g_s(x)=\mathbb{M}_1(x)\mathbb{M}_s(x)$, where $\mathbb{M}_i(x)$ is the minimal polynomial of $\alpha^i$ over ${\mathrm{GF}}(2)$. Let ${\mathcal{C}}_m$ denote the cyclic code of length $v=2^m-1$ over ${\mathrm{GF}}(2)$ with generator polynomial $g_s(x)$. It is known that ${\mathcal{C}}_m^\perp$ has dimension $2m$ and the weight distribution of Table \ref{tab-CG1} when $m$ is odd and $s$ takes on the following values \cite{DLLZ}: \begin{enumerate} \item $s=2^h+1$, where $\gcd(h, m)=1$ and $h$ is a positive integer. \item $s=2^{2h}-2^h+1$, where $h$ is a positive integer. \item $s=2^{(m-1)/2}+3$. \item $s=2^{(m-1)/2}+2^{(m-1)/4}-1$, where $m \equiv 1 \pmod{4}$. \item $s=2^{(m-1)/2}+2^{(3m-1)/4}-1$, where $m \equiv 3 \pmod{4}$. \end{enumerate} In all these cases, ${\mathcal{C}}_m$ has parameters $[2^m-1, 2^m-1-2m, 5]$ and is optimal. It is also known that the binary narrow-sense primitive BCH code with designed distance $2^{m-1}-2^{(m-1)/2}$ has also the weight distribution of Table \ref{tab-CG1} \cite{DFZ}. These codes and their extended codes give $2$-designs and $3$-designs when they are plugged into Theorems \ref{thm-newdesigns1} and \ref{thm-newdesigns2}. It is known that ${\mathcal{C}}_m$ has parameters $[2^m-1, 2^m-1-2m, 5]$ if and only if $x^e$ is an APN monomial over ${\mathrm{GF}}(2^m)$. However, even if $x^e$ is APN, the dual code ${\mathcal{C}}_m^\perp$ may have many weights, and thus the code ${\mathcal{C}}_m$ and its dual ${\mathcal{C}}_m^\perp$ may not give $2$-designs. One of such examples is the inverse APN monomial. \section{Infinite families of $2$-designs from a type of ternary linear codes}\label{sec-june28} In this section, we will construct infinite families of $2$-designs with a type of primitive ternary cyclic codes. \begin{table}[ht] \caption{Weight distribution of some ternary linear codes}\label{tab-CG3} \centering \begin{tabular}{|l|l|} \hline Weight $w$ & No. of codewords $A_w$ \\ \hline $0$ & $1$ \\ $2\times 3^{m-1}-3^{(m-1)/2}$ & $(3^m-1)(3^{m-1}+3^{(m-1)/2})$ \\ $2\times 3^{m-1}$ & $(3^m-1)(3^{m-1}+1)$ \\ $2\times 3^{m-1}+3^{(m-1)/2}$ & $(3^m-1)(3^{m-1}-3^{(m-1)/2})$ \\ \hline \end{tabular} \end{table} \begin{table}[ht] \caption{Weight distribution of some ternary linear codes}\label{tab-CG328} \centering \begin{tabular}{|l|l|} \hline Weight $w$ & No. of codewords $A_w$ \\ \hline $0$ & $1$ \\ $2\times 3^{m-1}-3^{(m-1)/2}$ & $3^{2m}-3^m$ \\ $2\times 3^{m-1}$ & $(3^m+3)(3^m-1)$ \\ $2\times 3^{m-1}+3^{(m-1)/2}$ & $3^{2m}-3^m$ \\ \hline $3^m$ & $2$ \\ \hline \end{tabular} \end{table} \begin{lemma}\label{lem-TZEwt28} Let $m \geq 3$ be odd. Assume that ${\mathcal{C}}_m$ is a ternary linear code of length $3^m-1$ such that its dual code ${\mathcal{C}}_m^\perp$ has the weight distribution of Table \ref{tab-CG3}. Denote by $\overline{{\mathcal{C}}}_m$ the extended code of ${\mathcal{C}}_m$ and let $\overline{{\mathcal{C}}}_m^\perp$ denote the dual of $\overline{{\mathcal{C}}}_m$. Then we have the following conclusions. \begin{enumerate} \item The code ${\mathcal{C}}_m$ has parameters $[3^m-1, \, 3^m-1-2m, \, 4]$. \item The code ${\mathcal{C}}_m^\perp$ has parameters $[3^m-1, \, 2m, \, 2\times 3^{m-1}-3^{(m-1)/2}]$. \item The code $\overline{{\mathcal{C}}}_m^\perp$ has parameters $[3^m, \, 2m+1, \, 2\times 3^{m-1}-3^{(m-1)/2}]$, and its weight distribution is given in Table \ref{tab-CG328}. \item The code $\overline{{\mathcal{C}}}_m$ has parameters $[3^m, 3^m-1-2m, 5]$, and its weight distribution is given by \begin{eqnarray*} 3^{2m+1}\overline{A}_k &=& (2^k+(-1)^k 2) \binom{3^m}{k} + \\ & & v \sum_{\substack{0 \le i \le 2 \times 3^{m-1} \\ 0\le j \le 3^{m-1} \\i+j=k}}(-1)^i \binom{2 \times 3^{m-1}} {i} 2^j \binom{3^{m-1}}{j} + \\ & & u \sum_{\substack{0 \le i \le 2\times 3^{m-1}-3^{\frac{m-1}{2}} \\ 0\le j \le 3^{m-1}+3^{\frac{m-1}{2}} \\i+j=k}}(-1)^i \binom{2 \times 3^{m-1}-3^{\frac{m-1}{2}}} {i} 2^j \binom{3^{m-1}+3^{\frac{m-1}{2}}}{j} + \\ & & u \sum_{\substack{0 \le i \le 2 \times 3^{m-1}+3^{\frac{m-1}{2} } \\ 0\le j \le 3^{m-1}-3^{\frac{m-1}{2}} \\i+j=k}}(-1)^i \binom{2 \times 3^{m-1}+3^{\frac{m-1}{2}}}{i}2^j \binom{3^{m-1}-3^{\frac{m-1}{2}}}{j} \end{eqnarray*} for $0 \le k \le 3^m$, where $$ u=3^{2m}-3^{m} \mbox{ and } v = (3^m+3)(3^m-1). $$ \end{enumerate} \end{lemma} \begin{proof} The proof is similar to that of Lemma \ref{lem-TZEwt} and is omitted here. \end{proof} \begin{theorem}\label{thm-newdesigns228} Let $m \geq 3$ be odd. Let ${\mathcal{C}}_m$ be a linear code of length $3^m-1$ such that its dual code ${\mathcal{C}}_m^\perp$ has the weight distribution of Table \ref{tab-CG3}. Denote by $\overline{{\mathcal{C}}}_m$ the extended code of ${\mathcal{C}}_m$ and let $\overline{{\mathcal{C}}}_m^\perp$ denote the dual of $\overline{{\mathcal{C}}}_m$. Let ${\mathcal{P}}=\{0,1,2, \cdots, 3^m-1\}$, and let $\overline{{\mathcal{B}}}$ be the set of the supports of the codewords of $\overline{{\mathcal{C}}}_m$ with weight $k$, where $5 \leq k \leq 10$ and $\overline{A}_k \neq 0$. Then $({\mathcal{P}}, \overline{{\mathcal{B}}})$ is a $2$-$(3^m,\, k,\, \lambda)$ design for some $\lambda$. Let ${\mathcal{P}}=\{0,1,2, \cdots, 3^m-1\}$, and let $\overline{{\mathcal{B}}}^\perp$ be the set of the supports of the codewords of $\overline{{\mathcal{C}}}_m^\perp$ with weight $k$ and $\overline{A}_k^\perp \neq 0$. Then $({\mathcal{P}}, \overline{{\mathcal{B}}}^\perp)$ is a $2$-$(3^m, \, k, \, \lambda)$ design for some $\lambda$. \end{theorem} \begin{proof} The weight distributions of $\overline{{\mathcal{C}}}_m$ and $\overline{{\mathcal{C}}}_m^\perp$ are described in Lemma \ref{lem-TZEwt28}. Notice that the minimum distance $d$ of $\overline{{\mathcal{C}}}_m$ is equal to $5$. Put $t=2$. The number of $i$ with $\overline{A}_i^\perp \neq 0$ and $1 \leq i \leq 3^m -t$ is $s=3$. Hence, $s=d-t$. The desired conclusions then follow from Theorem \ref{thm-AM2}. \end{proof} \begin{corollary} Let $m \geq 3$ be odd. Let ${\mathcal{C}}_m$ be a ternary linear code of length $3^m-1$ such that its dual code ${\mathcal{C}}_m^\perp$ has the weight distribution of Table \ref{tab-CG3}. Denote by $\overline{{\mathcal{C}}}_m$ the extended code of ${\mathcal{C}}_m$ and let $\overline{{\mathcal{C}}}_m^\perp$ denote the dual of $\overline{{\mathcal{C}}}_m$. Let ${\mathcal{P}}=\{0,1,2, \cdots, 3^m-1\}$, and let $\overline{{\mathcal{B}}}^\perp$ be the set of the supports of the codewords of $\overline{{\mathcal{C}}}_m^\perp$ with weight $2\times 3^{m-1}-3^{(m-1)/2}$. Then $({\mathcal{P}}, \overline{{\mathcal{B}}}^\perp)$ is a $2$-$(3^m, \, 2\times 3^{m-1}-3^{(m-1)/2}, \, \lambda)$, where $$ \lambda=\frac{(2\times 3^{m-1}- 3^{(m-1)/2})(2\times 3^{m-1}- 3^{(m-1)/2} -1)}{2}. $$ \end{corollary} \begin{proof} It follows from Theorem \ref{thm-newdesigns228} that $({\mathcal{P}}, \overline{{\mathcal{B}}}^\perp)$ is a $2$-design. We now determine the value of $\lambda$. Note that $\overline{{\mathcal{C}}}_m^\perp$ has minimum weight $2\times 3^{m-1}-3^{(m-1)/2}$. Any two codewords of minimum weight $2\times 3^{m-1}-3^{(m-1)/2}$ have the same support if and only if one is a scalar multiple of the other. Consequently, $$ \left|\overline{{\mathcal{B}}}^\perp \right|=\frac{3^{2m}-3^m}{2}. $$ It then follows that $$ \lambda=\frac{3^{2m}-3^m}{2}\frac{\binom{2\times 3^{m-1}-3^{(m-1)/2}}{2}}{\binom{3^m}{2}} = \frac{(2\times 3^{m-1}- 3^{(m-1)/2})(2\times 3^{m-1}- 3^{(m-1)/2} -1)}{2}. $$ \end{proof} \begin{corollary} Let $m \geq 3$ be odd. Let ${\mathcal{C}}_m$ be a ternary linear code of length $3^m-1$ such that its dual code ${\mathcal{C}}_m^\perp$ has the weight distribution of Table \ref{tab-CG3}. Denote by $\overline{{\mathcal{C}}}_m$ the extended code of ${\mathcal{C}}_m$ and let $\overline{{\mathcal{C}}}_m^\perp$ denote the dual of $\overline{{\mathcal{C}}}_m$. Let ${\mathcal{P}}=\{0,1,2, \cdots, 3^m-1\}$, and let $\overline{{\mathcal{B}}}$ be the set of the supports of the codewords of $\overline{{\mathcal{C}}}_m$ with weight $5$. Then $({\mathcal{P}}, \overline{{\mathcal{B}}})$ is a $2$-$(3^m,\, 5,\, \lambda)$ design, where $$ \lambda=\frac{5(3^{m-1}-1)}{2}. $$ \end{corollary} \begin{proof} It follows from Theorem \ref{thm-newdesigns228} that $({\mathcal{P}}, \overline{{\mathcal{B}}})$ is a $2$-design. We now determine the value of $\lambda$. Using the weight distribution formula in Lemma \ref{lem-TZEwt28}, we obtain that $$ \overline{A}_5=\frac{3^{3m-1}-4 \times 3^{2m-1}+3^m}{4}. $$ Recall that $\overline{{\mathcal{C}}}_m$ has minimum weight $5$. Any two codewords of minimum weight $5$ have the same support if and only if one is a scalar multiple of the other. Consequently, $$ \left|\overline{{\mathcal{B}}}^\perp \right|=\frac{\overline{A}_5}{2}. $$ It then follows that $$ \lambda= \frac{\overline{A}_5}{2} \frac{\binom{5}{2}}{\binom{3^m}{2}}=\frac{5(3^{m-1}-1)}{2}. $$ \end{proof} Theorem \ref{thm-newdesigns228} gives more $2$-designs. However, determining the corresponding value $\lambda$ may be hard, as the number of blocks in the design may be difficult to derive from $\overline{A}_k$ or $\overline{A}_k^\perp$. \begin{open} Determine the value of $\lambda$ of the $2$-$(3^m,\, k,\, \lambda)$ design for $6 \leq k \leq 10$, which are described in Theorem \ref{thm-newdesigns228}. \end{open} \begin{open} Determine the values of $\lambda$ of the $2$-$(3^m,\, 3^{m-1},\, \lambda)$ design and the $2$-$(3^m,\, 2\times 3^{m-1}-3^{(m-1)/2},\, \lambda)$ design, which are described in Theorem \ref{thm-newdesigns228}. \end{open} To demonstrate the existence of the $2$-designs presented in Theorem \ref{thm-newdesigns228}, we present a list of ternary cyclic codes that have the weight distribution of Table \ref{tab-CG3} below. Put $n=3^m-1$. Let $\alpha$ be a generator of ${\mathrm{GF}}(3^m)^*$. Let $g_s(x)=\mathbb{M}_{n-1}(x)\mathbb{M}_{n-s}(x)$, where $\mathbb{M}_i(x)$ is the minimal polynomial of $\alpha^i$ over ${\mathrm{GF}}(3)$. Let ${\mathcal{C}}_m$ denote the cyclic code of length $n=3^m-1$ over ${\mathrm{GF}}(3)$ with generator polynomial $g_s(x)$. It is known that ${\mathcal{C}}_m^\perp$ has dimension $2m$ and the weight distribution of Table \ref{tab-CG3} when $m$ is odd and $s$ takes on the following values \cite{CDY,YCD}: \begin{enumerate} \item $s=3^h+1$, $h \geq 0$ is an integer. \item $s=(3^h + 1)/2$, where $h$ is a positive integer and $\gcd(m, h)=1$. \end{enumerate} In these two cases, $x^s$ is a planar function on ${\mathrm{GF}}(3^m)$. Hence, these ternary codes are extremal in the sense that they are defined by planar functions whose differentiality is extremal. More classes of ternary codes such that their duals have the weight distribution of Table \ref{tab-CG3} are documented in \cite{DLLZ}. They give also $2$-designs via Theorem \ref{thm-newdesigns228}. There are also ternary cyclic codes with three weights but different weight distributions in \cite{DLLZ}. They may also hold $2$-designs. \section{Conjectured infinite families of $2$-designs from projective cyclic codes}\label{sec-conjectureddesigns} Throughout this section, let $m \geq 3$ be an odd integer, and let $v=(3^m-1)/2$. The objective of this section is to present a number of conjectured infinite families of $2$-designs derived from linear projective ternary cyclic codes. \begin{table} \begin{center} \caption{The weight distribution for odd $m \ge3$}\label{Tab-GG2} \begin{tabular}{|c|c|} \hline Weight & Frequency \\ \hline $0$ & $1$ \\ \hline $3^{m-1}-3^{(m-1)/2}$ & $\frac{(3^{m-1}+3^{(m-1)/2})(3^m-1)}{2}$ \\ \hline $3^{m-1}$ & $(3^m-3^{m-1}+1)(3^m-1)$ \\ \hline $3^{m-1}+3^{(m-1)/2}$ & $\frac{(3^{m-1}-3^{(m-1)/2})(3^m-1)}{2}$ \\ \hline \end{tabular} \label{table4} \end{center} \end{table} \begin{lemma}\label{lem-june21} Let ${\mathcal{C}}_m$ be a linear code of length $v$ over ${\mathrm{GF}}(3)$ such that its dual ${\mathcal{C}}_m^\perp$ has the weight distribution in Table \ref{Tab-GG2}. Then the weight distribution of ${\mathcal{C}}_m$ is given by \begin{eqnarray*} 3^{2m}A_k &=& \sum_{\substack{0 \le i \le 3^{m-1}-3^{(m-1)/2} \\ 0\le j \le \frac {3^{m-1}+2\cdot 3^{(m-1)/2}-1} {2} \\i+j=k}}(-1)^i2^ja\binom{3^{m-1}-3^{(m-1)/2}} {i} \binom{\frac {3^{m-1}+2 \cdot 3^{(m-1)/2}-1}{2}}{j}\\ & & + \binom {\frac {3^m-1} {2}}{k}2^k+ \sum_{\substack{0 \le i \le 3^{m-1} \\ 0\le j \le \frac {3^{m-1}-1} {2} \\i+j=k}}(-1)^i2^jb\binom{3^{m-1}} {i}\binom{\frac {3^{m-1}-1} {2}} {j} \\ & & + \sum_{\substack{0 \le i \le 3^{m-1}+3^{(m-1)/2} \\ 0\le j \le \frac {3^{m-1}-2 \cdot 3^{(m-1)/2}-1}{2} \\i+j=k}}(-1)^i2^jc\binom{3^{m-1}+3^{(m-1)/2}}{i}\binom{\frac {3^{m-1}-2 \cdot 3^{(m-1)/2}-1}{2}}{j} \end{eqnarray*} for $0 \le k \le \frac {3^m-1} {2}$, where \begin{eqnarray*} a &=& \frac{(3^{m-1}+3^{(m-1)/2})(3^m-1)}{2}, \\ b &=& (3^m-3^{m-1}+1)(3^m-1), \\ c &=& \frac{(3^{m-1}-3^{(m-1)/2})(3^m-1)}{2}. \end{eqnarray*} In addition, ${\mathcal{C}}_m$ has parameters $[(3^m-1)/2, (3^m-1)/2-2m, 4]$. \end{lemma} \begin{proof} Note that the weight enumerator of ${\mathcal{C}}_m^\perp$ is $$1+az^{3^{m-1}-3^{(m-1)/2}}+bz^{3^{m-1}}+cz^{3^{m-1}+3^{(m-1)/2}}.$$ The proof of this theorem is similar to that of Lemma \ref{lem-TZwt} and is omitted. \end{proof} Below we present two examples of ternary linear codes ${\mathcal{C}}_m$ such that their duals ${\mathcal{C}}_m^\perp$ have the weight distribution of Table \ref{Tab-GG2}. \begin{example}\label{exam-j271} Let $m \geq 3$ be odd. Let $\alpha$ be a generator of ${\mathrm{GF}}(3^m)^*$. Put $\beta=\alpha^2$. Let $\mathbb{M}_i(x)$ denote the minimal polynomial of $\beta^i$ over ${\mathrm{GF}}(3)$. Define $$ \delta=3^{m-1}-1-\frac{3^{(m+1)/2}-1}{2} $$ and $$ h(x)=(x-1){\mathrm{lcm}}(\mathbb{M}_1(x), \, \mathbb{M}_2(x), \, \cdots, \, \mathbb{M}_{\delta-1}(x)), $$ where ${\mathrm{lcm}}$ denotes the least common multiple of the polynomials. Let ${\mathcal{C}}_m$ denote the cyclic code of length $v=(3^m-1)/2$ over ${\mathrm{GF}}(3)$ with generator polynomial $g(x):=(x^v-1)/h(x)$. Then ${\mathcal{C}}_m$ has parameters $[(3^m-1)/2, (3^m-1)-2m, 4]$ and ${\mathcal{C}}_m^\perp$ has the weight distribution of Table \ref{Tab-GG2}. \end{example} \begin{proof} A proof of the desired conclusions was given in \cite{LDXG}. \end{proof} \begin{example}\label{exam-j272} Let $m \geq 3$ be odd. Let $\alpha$ be a generator of ${\mathrm{GF}}(3^m)^*$. Let $\beta=\alpha^2$. Let $g(x)=\mathbb{M}_{n-1}(x)\mathbb{M}_{n-2}(x)$, where $\mathbb{M}_i(x)$ is the minimal polynomial of $\beta^i$ over ${\mathrm{GF}}(3)$. Let ${\mathcal{C}}_m$ denote the cyclic code of length $v=(3^m-1)/2$ over ${\mathrm{GF}}(3)$ with generator polynomial $g(x)$. Then ${\mathcal{C}}_m$ has parameters $[(3^m-1)/2, (3^m-1)-2m, 4]$ and ${\mathcal{C}}_m^\perp$ has the weight distribution of Table \ref{Tab-GG2}. \end{example} \begin{proof} The desired conclusions can be proved similarly as Theorem 19 in \cite{LDXG}. \end{proof} \begin{conj}\label{conj-j261} Let ${\mathcal{P}}=\{0,1,2, \cdots, v-1\}$, and let ${\mathcal{B}}$ be the set of the supports of the codewords of ${\mathcal{C}}_m$ with Hamming weight $k$, where $A_k \neq 0$. Then $({\mathcal{P}}, {\mathcal{B}})$ is a $2$-$(v, k, \lambda)$ design for all odd $m \ge 3$. \end{conj} \begin{conj}\label{conj-j262} Let ${\mathcal{P}}=\{0,1,2, \cdots, v-1\}$, and let ${\mathcal{B}}$ be the set of the supports of the codewords of ${\mathcal{C}}_m$ with Hamming weight $4$. Then $({\mathcal{P}}, {\mathcal{B}})$ is a Steiner system $S(2, 4, (3^m-1)/2)$ for all odd $m \ge 3$. \end{conj} There are a survey on Steiner systems $S(2,4,v)$ \cite{RR10} and a book chapter on Steiner systems \cite{CMhb}. It is known that a Steiner system $S(2,4,v)$ exists if and only if $v \equiv 1 \mbox{ or } 4 \pmod{12}$ \cite{Hanani}. If Conjecture \ref{conj-j261} is true, so is Conjecture \ref{conj-j262}. In this case, a coding theory construction of a Steiner system $S(2, 4, (3^m-1)/2)$ for all odd $m \ge 3$ is obtained. \begin{conj}\label{conj-j263} Let ${\mathcal{P}}=\{0,1,2, \cdots, v-1\}$, and let ${\mathcal{B}}$ be the set of the supports of the codewords of ${\mathcal{C}}_m^\perp$ with Hamming weight $k$, where $A_k^\perp \neq 0$. Then $({\mathcal{P}}, {\mathcal{B}})$ is a $2$-$(v, k, \lambda)$ design for all odd $m \ge 3$. \end{conj} Even if some or all of the three conjectures are not true for ternary codes with the weight distribution of Table \ref{Tab-GG2}, these conjectures might still be valid for the two classes of ternary cyclic codes descried in Examples \ref{exam-j271} and \ref{exam-j272}. Note that Theorem \ref{thm-AM2} does not apply to the three conjectures above. We need to develop different methods for settling these conjectures. \section{Summary and concluding remarks} In the last section of this paper, we mention some applications of $t$-designs and summarize the main contributions of this paper. \subsection{Some applications of $2$-designs} Let ${\mathcal{P}}$ be an Abelian group of order $v$ under a binary operation denoted by $+$. Let ${\mathcal{B}}=\{B_1, B_2, \cdots, B_b\}$, where all $B_i$ are $k$-subsets of ${\mathcal{P}}$ and $k$ is a positive integer. We define $\Delta(B_i)$ to be the multiset $\{ x-y: x \in B_i,\ y \in B_i\}$. If every nonzero element of ${\mathcal{P}}$ appears exactly $\delta$ times in the multiset $\bigcup_{i=1}^b \Delta(B_i)$, we call ${\mathcal{B}}$ a $(v, k, \delta)$ difference family in $({\mathcal{P}}, +)$. The following theorems are straightforward and should be well known. \begin{theorem}\label{thm-june261} Let ${\mathcal{P}}$ be an Abelian group of order $v$ under a binary operation denoted by $+$. Let ${\mathcal{B}}=\{B_1, B_2, \cdots, B_b\}$, where all $B_i$ are $k$-subsets of ${\mathcal{P}}$ and $k$ is a positive integer. Then $({\mathcal{P}}, {\mathcal{B}})$ is a $2$-$(v, k, \lambda)$ design if and only if ${\mathcal{B}}$ is a $(v, k, \lambda v)$ difference family in $({\mathcal{P}}, +)$. \end{theorem} \begin{theorem}\label{thm-june262} Let $({\mathcal{P}}, {\mathcal{B}})$ be a $t$-$(v, k, \lambda)$ design, where ${\mathcal{P}}$ is an Abelian group. If $t \geq 2$, then ${\mathcal{B}}$ is a $(v, k, \delta)$ difference family in ${\mathcal{P}}$, where $$ \delta=\frac{v \lambda \binom{v-2}{t-2}}{\binom{k-2}{t-2}}. $$ \end{theorem} Difference families have applications in the design and analysis of optical orthogonal codes, frequency hopping sequences, and other engineering areas. By Theorems \ref{thm-june261} and \ref{thm-june262}, $t$-designs with $t \geq 2$ have also applications in these areas. In addition, $2$-designs give naturally linear codes \cite{AK92,DingBook}. These show the importance of $2$-designs in applications. \subsection{Summary} It is well known that binary Reed-Muller codes hold $3$-designs. Hence, the only contribution of Section \ref{sec-brmdesigns} is the determination of the specific parameters of the $3$-designs held in ${\mathrm{RM}}(m-2, m)$ and its dual code, which are documented in Theorem \ref{thm-brmdesign1}. It has also been known for a long time that the codewords of weight $3$ in the Hamming code hold a $2$-$((q^m-1)/(q-1), 3, q-1)$ design. The contribution of Section \ref{sec-hmdesigns} is Theorem \ref{thm-HMdesign171}, which may be viewed as an extension of the known $2$-$((q^m-1)/(q-1), 3, q-1)$ design held in the Hamming code, and also the parameters of the infinite families of $2$-designs derived from the binary Hamming codes, which are documented in Examples \ref{exam-hmdesign4}, \ref{exam-hmdesign5}, \ref{exam-hmdesign6}, and \ref{exam-hmdesign7}. A major contribution of this paper is presented in Section \ref{sec-newdesigns}, where Theorems \ref{thm-newdesigns1} and \ref{thm-newdesigns2} document many infinite families of $2$-design and $3$-designs. The parameters of these $2$-designs and $3$-designs are given specifically. These designs are derived from binary cyclic codes that are defined by special almost perfect nonlinear functions. Another major contribution of this paper is documented in Section \ref{sec-june28}, where Theorem \ref{thm-newdesigns228} and its two corollaries describe several infinite families of $2$-designs. These $2$-designs are related to planar functions. It is noticed that the total number of $3$-designs presented in this paper (see Theorems \ref{thm-brmdesign1} and \ref{thm-newdesigns2}) are exponential. All of them are derived from linear codes. After comparing the list of infinite families of $3$-designs in \cite{KLhb} with the $3$-designs presented in this paper, one may conclude that many, if not most, of the known infinite families of $3$-designs are from coding theory. Section \ref{sec-conjectureddesigns} presents many conjectured infinite families of $2$-designs. The reader is cordially invited to attack these conjectures and solve other open problems presented in this paper.
{'timestamp': '2016-07-19T02:05:49', 'yymm': '1607', 'arxiv_id': '1607.04813', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04813'}
arxiv
\section{Introduction} Several natural graph classes are known to have polynomially many minimal separators, w.r.t. the number $n$ of vertices of the graph. It is the case for \emph{chordal} graphs, which have at most $n$ minimal separators~\cite{RTL76}, \emph{weakly chordal}, \emph{circular-arc} and \emph{circle} graphs, which have $\mathcal{O}(n^2)$ minimal separators~\cite{BoTo01,KKW98}. The property of having polynomially many minimal separators has been used in algorithms for decades, initially in an ad-hoc manner, i.e., algorithms were based on minimal separators but also other specific features of particular graph classes (see, e.g., ~\cite{BKK93,KKW98}). Later, it was observed that minimal separators are sufficient for solving problems like \textsc{Treewidth} or \textsc{Minimum fill-in}~\cite{BoTo01,BoTo02}. Both problems are related to \emph{minimal triangulations}. Given an arbitrary graph $G$, a minimal triangulation is a minimal chordal supergraph $H$ of $G$, on the same vertex set. Bouchitt\'e and Todinca~\cite{BoTo01} introduced the notion of \emph{potential maximal clique}, that is, a vertex set of $G$ inducing a maximal clique in some minimal triangulation $H$ of $G$. Their algorithm for treewidth is based on dynamic programming over minimal separators and potential maximal clique s. The same authors proved that the number of potential maximal clique s is polynomially bounded in the number of minimal separators~\cite{BoTo02}. Fomin and Villanger~\cite{FoVi10} found a more surprising application of minimal separators and potential maximal clique s, proving that they were sufficient for solving problems like \textsc{Maximum Independent Set}, \textsc{Maximum Induced Forest}, and more generally for finding a maximum induced subgraph $G[F]$ of treewidth at most $t$, where $t$ is a constant. More formally, let $\operatorname{poly}$ be some polynomial. We call $\mathcal{G}_{\poly}$ the family of graphs such that $G \in \mathcal{G}_{\operatorname{poly}}$ if and only if $G$ has at most $\operatorname{poly}(n)$ minimal separators. By~\cite{FoVi10}, the problem of finding a maximum induced subgraph of treewidth at most $t$ can be solved in polynomial time on $\mathcal{G}_{\poly}$. The exponent of the polynomial depends on $\operatorname{poly}$ and on $t$. In~\cite{FTV15}, Fomin \textit{et al.} further extend the technique to compute large induced subgraphs of bounded treewidth, and satisfying some CMSO property (expressible in counting monadic second-order logic). That allows to capture problems like \textsc{Longest induced path}. They also point out some limits of the approach. It is asked in~\cite{FTV15} whether the techniques can be extended for solving the \textsc{Connected Vertex Cover} problem, which is equivalent to finding a maximum independent set $F$ such that $G - F$ is connected. More generally, their algorithm computes an induced subgraph $G[F]$ of treewidth at most $t$ satisfying some CMSO property, but is not able to ensure any property relating the induced subgraph to the initial graph. Here we make some progress in this direction. First, we consider the problem \textsc{Distance-$d$ Independent Set} on $\mathcal{G}_{\poly}$, where the goal is to find a maximum independent set $F$ of the input graph $G$, such that the vertices of $F$ are at pairwise distance at least $d$ in $G$ (in the literature this problem is also known as {\sc $d$-Scattered-Set}). This is equivalent to finding a maximum independent set in graph $G^{d-1}$, the $(d-1)$-th power of $G$. Eto \textit{et al.}~\cite{EGM14} already studied the problem on chordal graphs, and proved that it is polynomial for every even $d$, and NP-hard for any odd $d\geq 3$ (it is even $W[1]$-hard when parameterized by the solution size). Their positive result is based on the observation that for any even $d$, if $G$ is chordal then so is $G^{d-1}$. Eto \textit{et al.}~\cite{EGM14} ask if \textsc{Distance-$d$ Independent Set} is polynomial on chordal bipartite graphs (which are \emph{not} chordal but weakly chordal, see Section~\ref{se:prelim}), a subclass of $\mathcal{G}_{\poly}$. We bring a positive answer to their question for even values $d$, by a result of combinatorial nature: for any graph $G$ and any odd $k$, the graph $G^k$ has no more minimal separators than $G$ (see Section~\ref{se:pow}). Consequently, \textsc{Distance-$d$ Independent Set} is polynomial on $\mathcal{G}_{\poly}$, for any even value $d$ and any polynomial $\operatorname{poly}$, and NP-hard for any odd $d \geq 3$ and any $\operatorname{poly}(n)$ asymptotically larger than $n$. Such a dichotomy between odd and even values also appears when computing large $d$-clubs, that are induced subgraphs of diameter at most $d$~\cite{GHKR14}, and for quite similar reasons. Second, we consider \textsc{Connected Vertex Cover}, \textsc{Connected Feedback Vertex Set} and more generally the problem of finding a maximum induced subgraph $G[F]$ of treewidth at most $t$, such that $G - F$ is connected. We show (Section~\ref{se:cvc}) that the problems are polynomially solvable for subclasses of $\mathcal{G}_{\poly}$, like chordal and circular-arc graphs. This does not settle the complexity of these problems on $\mathcal{G}_{\poly}$. As we shall discuss in Section~\ref{se:ind}, when restricted to bipartite graphs in $\mathcal{G}_{\poly}$, \textsc{Connected Vertex Cover} can be reduced from \textsc{Red-Blue Dominating Set} (see~\cite{DLS14}). It might be that this latter problem is NP-hard on bipartite graphs of $\mathcal{G}_{\poly}$; that was our hope, since the very related problem \textsc{Independent Dominating Set} is NP-hard on chordal bipartite graphs~\cite{DMK90}, and on circle graphs~\cite{BGMPST14}. This question is still open, however we will observe that the \textsc{Red-Blue Dominating Set} is polynomial on the two natural classes of bipartite graphs with polynomially many minimal separators: chordal bipartite and circle bipartite graphs. \section{Preliminaries}\label{se:prelim} Let $G = (V,E)$ be a graph. Let $dist_G(u,v)$ denote the distance between vertices $u$ and $v$ (the minimum number of edges of a $uv$-path). We denote by $N_G^k[v]$ the set of vertices at distance at most $k$ from $v$. Let also $N_G^k(v) = N_G^k[v] \setminus \{v\}$, and we call these sets the \emph{closed} and \emph{open neighborhoods at distance} $k$ of $v$, respectively. Similarly, for a set of vertices $U \subseteq V$, we call the sets $N_G^k(U) = \cup_{u\in U} N_G^k(u) \backslash~ U$ and $N_G^k[U] = \cup_{u\in U} N_G^k[u]$ the open and closed neighborhoods at distance $k$ of $U$, respectively. For $k=1$, we simply denote by $N_G(U)$, respectively $N_G[U]$, the open and closed neighborhoods of $U$; the subscript is omitted if clear from the context. A \emph{clique} (resp. \emph{independent set}) of $G$ is a set of pairwise adjacent (resp. non-adjacent) vertices. A distance-$d$ independent set is a set of vertices at pairwise distance at least $d$. Equivalently, it is an independent set of the $(d-1)$-th power $G^{d-1}$ of $G$. Graph $G^k = (V,E^k)$ is obtained from $G$ by adding an edge between every pair of vertices at distance at most~$k$. Given a vertex subset $C$ of $G$, we denote by $G[C]$ the subgraph induced by $C$. We say that $C$ is a connected component of $G$ if $G[C]$ is connected and $C$ is inclusion-maximal for this property. For $S \subseteq V$, we simply denote $G - S$ the graph $G[V \setminus S]$. We say that $S$ is a \emph{$a,b$-minimal separator} of $G$ if $a$ and $b$ are in distinct components $C$ and $D$ of $G-S$, and $N(C) = N(D) = S$. We also say that $S$ is a minimal separator if it is an $a,b$-minimal separator for some pair of vertices $a$ and $b$. \begin{proposition}[\cite{BBH00}]\label{prop:min_sep} Let $G = (V,E)$ be a graph, $C$ be a connected set of vertices, and let $D$ be a component of $G - N[C]$. Then $N(D)$ is an $a,b$-minimal separator of $G$, for any $a \in C$ and $b \in D$. \end{proposition} \subsection{Graph classes} A graph is \emph{chordal} if it has no induced cycle with more than three vertices. A graph $G$ is \emph{weakly chordal} if $G$ and its complement $\overline{G}$ have no induced cycle with more than four vertices. The classes of \emph{circle} and \emph{circular-arc graphs} are defined by their intersection model. A graph $G$ is a \emph{circle graph} (resp. a \emph{circular-arc graph}) if every vertex of the graph can be associated to a chord (resp. to an arc) of a circle such that two vertices are adjacent in $G$ if and only if the corresponding chords (resp. arcs) intersect. We may assume w.l.o.g. that, in the intersection model, no two chords (resp. no two arcs) share an endpoint. On the circle, we add a \emph{scanpoint} between each two consecutive endpoints of the set of chords (resp. arcs). A \emph{scanline} is a line segment between two scanpoints. Given an intersection model of a circle (resp. circular-arc) graph $G$, for any minimal separator $S$ of $G$ there is a scanline such that the vertices of $S$ correspond exactly to the chords (resp. arcs) intersecting the scanline, see, e.g.,~\cite{KKW98}. Chordal graphs have at most $n$ minimal separators~\cite{RTL76}; weakly chordal, circle and circular-arc graphs all have $\mathcal{O}(n^2)$ minimal separators~\cite{BoTo01,KKW98}. \begin{definition}\label{de:gpoly} Let $\operatorname{poly}$ be some polynomial. We call $\mathcal{G}_{\operatorname{poly}}$ the family of graphs such that $G \in \mathcal{G}_{\operatorname{poly}}$ if and only if $G$ has at most $\operatorname{poly}(n)$ minimal separators, where $n = |V(G)|$. \end{definition} \subsection{Dynamic programming over minimal triangulations}\label{ss:FoVi10} Let $G=(V,E)$ be an arbitrary graph. A chordal supergraph $H = (V, E')$ (i.e., with $E \subseteq E'$), is called a \emph{triangulation} of $G$. If, moreover, $E'$ is inclusion-minimal among all possible triangulations, we say that $H$ is a \emph{minimal triangulation} of $G$. The \emph{treewidth} of a chordal graph is its maximum clique size, minus one. Forests have treewidth $1$, and graphs with no edges have treewidth $0$. The treewidth $\tw(G)$ of an arbitrary graph $G$ is the minimum treewidth over all (minimal) triangulations $H$ of $G$. Cliques of minimal triangulations play a central role in treewidth. A \emph{potential maximal clique} of $G$ is a set of vertices that induces a maximal clique in some minimal triangulation $H$ of $G$. By~\cite{BoTo01}, if $\Omega$ is a potential maximal clique, then for every component $C_i$ of $G - \Omega$, its neighborhood $S_i$ is a minimal separator. Moreover, the sets $S_i$ are exactly the minimal separators of $G$ contained in $\Omega$. \begin{proposition}[\cite{BBC00,BoTo02}] For any polynomial $\operatorname{poly}$, there is a polynomial-time algorithm enumerating the minimal separators and the potential maximal clique s of graphs on $\mathcal{G}_{\poly}$. \end{proposition} Minimal separators and potential maximal clique s have been used for computing treewidth and other parameters related to minimal triangulations, on $\mathcal{G}_{\poly}$. Fomin and Villanger~\cite{FoVi10} extend the techniques to a family of problems: \begin{proposition}[\cite{FoVi10}]\label{pr:FoVi10} For any polynomial $\operatorname{poly}$ and any constant $t$, there is a polynomial algorithm computing a \textsc{Maximum Induced Subgraph of Treewidth at most $t$} on $\mathcal{G}_{\poly}$. \end{proposition} Clearly, \textsc{Maximum Independent Set} (which is equivalent to \textsc{Minimum Vertex Cover}) and \textsc{Maximum Induced Forest} (which is equivalent to \textsc{Minimum Feedback Vertex Set}) fit into this framework: they consist in finding maximum induced subgraphs $G[F]$ of treewidth at most 0, respectively at most 1. The first ingredient of~\cite{FoVi10} is the following observation. \begin{proposition}[\cite{FoVi10}]\label{pr:compat} Let $G = (V,E)$ be a graph, $F \subseteq V$, and let $H_F$ be a minimal triangulation of $G[F]$. There exists a minimal triangulation $H_G$ of $G$ such that $H_G[F] = H_F$. We say that $H_G$ \emph{respects} the minimal triangulation $H_F$ of $G[F]$. \end{proposition} Note that, for any clique $\Omega$ of $H_G$, we have that $F \cap \Omega$ induces a clique in $H_F$. In particular, if $\tw(G[F]) \leq t$ and the clique size of $H_F$ is at most $t+1$, then every maximal clique of $H_G$ intersects $F$ in at most $t+1$ vertices. The second ingredient is a dynamic programming scheme that we describe below. Let $S$ be a minimal separator of $G$, and $C$ be a component of $G - S$ such that $N(C) = S$. The pair $(S,C)$ is called a \emph{block}. Let $\Omega$ be a potential maximal clique\ such that $S \subset \Omega \subseteq S \cup C$. Then $(S,C,\Omega)$ is called a \emph{good triple}. In the sequel, $W$ denotes a set of at most $t+1$ vertices. \begin{definition}\label{de:partcomp} Let $(S,C)$ (resp. $(S,\Omega,C)$) be a block (resp. a good triple) and let $W \subseteq S$ (resp. $W \subseteq \Omega$) be a set of vertices of size at most $t+1$ . We say that a vertex set $F$ is a \emph{partial solution compatible with $(S,C,W)$} (resp. with $(S,C,\Omega,W)$) if: \begin{enumerate} \item $G[F]$ is of treewidth at most $t$, \item $F \subseteq S \cup C$, \item $W = F \cap S$ (resp. $W = F \cap \Omega$), \item there is a minimal triangulation $H$ of $G$ respecting some minimal triangulation of $G[F]$ of treewidth at most $t$, such that $S$ is a minimal separator (resp. $S$ is a minimal separator and $\Omega$ is a maximal clique) of $H$. \end{enumerate} \end{definition} Observe that the two variants of compatibility differ by parameter $\Omega$ and the last two conditions. We denote by $\alpha(S,C,W)$ (resp. $\beta(S,C,\Omega,W)$) the size of a largest partial solution compatible with $(S,C,W)$ (resp. $(S,C,\Omega,W)$). We now show how these quantities can be computed over all blocks and all good triples. The dynamic programming will proceed by increasing size over the blocks $(S,C)$, the size of the block being $|S \cup C|$. It is based on the following equations (see~\cite{FoVi10,FTV15} for details and proofs and Figure~\ref{fi:alphabeta} for an illustration). \paragraph{Base case.} It occurs for good triples $(S,C,\Omega)$ such that $\Omega = S \cup C$. In this case, for each subset $W$ of $\Omega$ of size at most $t+1$, \begin{equation}\label{eq:base} \beta(S,C,\Omega,W) = |W|. \end{equation} \begin{figure}[h] \begin{center} \includegraphics[scale=0.5]{AlphaFromBeta.pdf}\hspace{1cm} \includegraphics[scale=0.5]{BetaFromAlpha.pdf} \end{center} \vspace{-1cm} \caption{Computing $\alpha$ form $\beta$ (left), and $\beta$ from $\alpha$ (right).} \label{fi:alphabeta} \end{figure} \paragraph{Computing $\alpha$ from $\beta$.} The following equation allows to compute the $\alpha$ values from $\beta$ values: \begin{equation}\label{eq:afb} \alpha(S,C,W) = \max_{\Omega, W'} \beta(S,C,\Omega,W'), \end{equation} where the maximum is taken over all potential maximal clique s $\Omega$ such that $(S,C,\Omega)$ is a good triple, and all subsets $W'$ of $\Omega$, of size at most $t+1$, such that $W = W' \cap S$. \paragraph{Computing $\beta$ from $\alpha$.} Let $(S,C,\Omega)$ be a good triple, and fix an order $C_1, C_2,\dots,C_p$ on the connected components of $G[C \setminus \Omega]$. Let $S_i = N_G(C_i)$, for all $1 \leq i \leq p$. By~\cite{BoTo01}, $(S_i,C_i)$ are also blocks of $G$. A partial solution $F$ compatible with $(S,C,\Omega,W)$ is obtained as a union of partial solutions $F_i$ compatible with $(S_i,C_i,W \cap S_i)$, for each $1 \leq i \leq p$, and the set $W$. Denote by $\gamma_i(S,C,\Omega,W)$ the size of the largest partial solution $F$ compatible\footnote{To be precise, the $\gamma$ function is not required at this stage, if we only compute largest induced subgraphs of treewidth at most $t$. However it becomes necessary when we request the solution to satisfy additional properties, as it will happen in Section~\ref{se:cvc}.} with $(S,C,\Omega,W)$, contained in $\Omega \cup C_1 \cup \dots \cup C_i$ (hence $F$ is not allowed to intersect the components $C_{i+1}$ to $C_p$). We have the following equations. \begin{equation}\label{eq:g1} \gamma_1(S,C,\Omega,W) = \alpha(S,C,\Omega,W \cap S_1) + |W| - |W \cap S_1|. \end{equation} For all $i$, $2 \leq i \leq p$, \begin{equation}\label{eq:gi} \gamma_i(S,C,\Omega,W) = \gamma_{i-1}(S,C,\Omega,W) + \alpha(S,C,\Omega,W \cap S_i) - |W \cap S_i|. \end{equation} and finally \begin{equation}\label{eq:bfg} \beta(S,C,\Omega,W) = \gamma_p(S,C,\Omega,W). \end{equation} For convenience we also consider that $\emptyset$ is a minimal separator, and $(\emptyset,V)$ is a block. Then the size of the optimal global solution is simply $\alpha(\emptyset,V,\emptyset)$. The algorithm can be adapted to output an optimal solution, not only its size. \section{Powers of graphs with polynomially many minimal separators}\label{se:pow} Let us prove that for any odd $k$, graph $G^k$ has no more minimal separators than $G$. \begin{theorem}\label{th:main} Consider a graph $G$, an odd number $k=2l+1$ with $l\geq 0$, and a minimal separator $\overline{S}$ of $G^k$. Then there exists a minimal separator $S$ of $G$ such that $\overline{S} = N^{l}_G[S]$. \end{theorem} \begin{proof} The lemma is trivially true if $\overline{S} = \emptyset$. Let $a,b \in V$ such that $\overline{S} \neq \emptyset$ is an $a,b$-minimal separator in $G^k$, and call $C_a$, $C_b$ the components of $G^k - \overline{S}$ that contain $a$ and $b$, respectively. Let us call $D_a = N^{l}_G[C_a]$ and $D_b = N^{l}_G[C_b]$. \smallskip {\bf Claim 1: $dist_G(D_a, D_b) \geq 2$.} Suppose that $dist_G(D_a, D_b) < 2$, and pick $x\in D_a, y \in D_b$ with $dist_G(x,y)\leq 1$ (notice that possibly $x=y$). Let $x_a \in C_a$ and $x_b \in C_b$ be such that there exists an $x_a, x$-path and a $y, x_b$ -path in $G$, each one of length at most $l$, called $P_a$ and $P_b$, respectively. This implies that there must be a $x_a, x_b$-path of length at most $2l + 1 = k$ in $G$, which means that $\{x_a, x_b\} \in E(G^k)$, a contradiction with the fact that $\overline{S}$ separates $C_a$ from $C_b$ in $G^k$. \smallskip {\bf Claim 2}: $\tilde{S} = \overline{S} ~\backslash \left( D_a \cup D_b \right)$ separates $a$ and $b$ in $G$. Notice first that $N_G(D_a) \subseteq N_G^{l+1}(C_a) \subseteq \overline{S}$. Suppose that $\tilde{S}$ does not separate $a$ and $b$, and let $P$ be an $a,b$-path in $G$ that does not pass through $\tilde{S}$. Let $x_1, \dots, x_{s-2}$ the internal nodes of $P$, where $s = |P|$, and consider $i = \max\{j ~|~ x_j \in D_a\cap P\}$. Since $P \cap \tilde{S} = \emptyset$, necessarily $x_{i+1} \in D_b$, a contradiction with Claim 1. \smallskip {\bf Claim 3}: $D_a$ and $D_b$ are connected subsets of $G$. This is straightforward from the definition of the sets, $D_a = N^{l}_G[C_a]$ and $D_b = N^{l}_G[C_b]$, and the fact that $C_a$ and $C_b$ are connected in $G$. \medskip Let $\tilde{C}_b$ be the connected component of $G - N_G[D_a]$ that contains $b$, and denote $S = N_G(\tilde{C_b})$. Note that $S \subseteq \tilde{S} \subset \overline{S}$. By applying Proposition \ref{prop:min_sep}, we have that $S$ is a minimal $a,b$-separator in $G$. Call $\tilde{C}_a$ the component of $G - S$ that contains $a$. Since $S \subseteq \tilde{S}$, we have that $D_b \subseteq \tilde{C}_b$ and $D_a \subseteq \tilde{C}_a$. \smallskip {\bf Claim 4}: $N^l_G[S] = \overline{S}$. We first prove that $N^l_G[S] \subseteq \overline{S}$. By construction, $S \subseteq N_G(D_a)$. Consequently $S\subseteq N_G^{l+1}(C_a) \backslash N_G^{l}(C_a)$, therefore $N_G^l[S] \subseteq N_G^{2l+1}(C_a) = N_{G^k}(C_a) = \overline{S}$. Conversely, we must show that every vertex $x$ of $\overline{S}$ is in $N^l_G[S]$. By contradiction, let $x \in \overline{S} \setminus N^l_G[S]$. We distinguish two cases~: $x \in \tilde{C}_a$, and $x \in \overline{S} \setminus \tilde{C}_a$. In the first case, since $N_{G^k}(C_b) = \overline{S}$, there exists a path from some vertex $y\in C_b$ to $x$ of length at most $k$, in graph $G$. Let us call $P$ one of those $y,x$-paths. Observe that the first $l+1$ vertices of the path belong to $D_b \subseteq \tilde{C_b}$, and none of the last $l+1$ vertices of the path belongs to $S$ (otherwise $x \in N_G^l[S]$). Then $P$ is a path that connects $\tilde{C_b}$ with $\tilde{C_a}$ without passing through $S$, a contradiction with the fact that $S$ separates $a$ and $b$ in graph $G$. It remains to prove the last case, when $x\in \overline{S} \setminus \tilde{C}_a$. Since $N_{G^k}(C_a) = \overline{S}$, there exists a node $y \in C_a$ such that there is a $y,x$-path $P$ of length at most $k$ in $G$. Since the first $l+1$ vertices of the path belong to $D_a$, and the last $l+1$ vertices of the path do not belong to $S$, we deduce that $P$ is an $y,x$-path in $G$ that does not intersect $S$. The path can be extended (through $C_a$) into an $a,x$-path that does not intersect $S$, a contradiction with the fact that $x$ does not belong to $\tilde{C}_a$. This concludes the proof of our theorem. \qed \end{proof} Recall that \textsc{Distance-$d$ Independent set} on $G$ is equivalent to \textsc{Maximum Independent Set} on $G^{d-1}$. Since the latter problem is polynomial on $\mathcal{G}_{\poly}$ by Proposition~\ref{pr:FoVi10}, we deduce: \begin{theorem}\label{th:odddis} For any even value $d$, and any polynomial $\operatorname{poly}$, problem \textsc{Distance-$d$ Independent set} is polynomially solvable on $\mathcal{G}_{\poly}$. \end{theorem} We remind that for any odd value $d$, problem \textsc{Distance-$d$ Independent set} is NP-hard on chordal graphs~\cite{EGM14}, thus on $\mathcal{G}_{\poly}$ for any polynomial $\operatorname{poly}$ asymptotically larger than $n$. The construction of~\cite{EGM14} also shows that even powers of chordal graphs may contain exponentially many minimal separators. \section{On \textsc{Connected Vertex Cover} and \textsc{Connected Feedback Vertex Set}}\label{se:cvc} Let us consider the problem of finding a maximum induced subgraph $G[F]$ such that $\tw(G[F])\leq t$ and $G - F$ is connected. One can easily observe that, for $t=0$ (resp. $t=1$), this problem is equivalent to \textsc{Connected Vertex Cover} (resp. \textsc{Connected Feedback Vertex Set}), in the sense that if $F$ is an optimal solution for the former, than $V(G) - F$ is an optimal solution for the latter. Our goal is to enrich the dynamic programming scheme described in Subsection~\ref{ss:FoVi10} in order to ensure the connectivity of $G - F$. One should think of this dynamic programming scheme of Subsection~\ref{ss:FoVi10} as similar to dynamic programming algorithms for bounded treewidth. The difference is that the bags (here, the potential maximal clique s) are not small but polynomially many, and we parse simultaneously through a set of decompositions. Nevertheless, we can borrow several classical ideas from treewidth-based algorithms. In general, for checking some property for the solution $F$, we add a notion of \emph{characteristics} of partial solutions. Then, for a characteristic $c$, we update the Definition~\ref{de:partcomp} in order to define partial solutions compatible with $(S,C,W,c)$ (resp. $(S,C,\Omega,W,c)$), by requesting the partial solution to be compatible with characteristic $c$. Parameter $c$ will also appear in the updated version of Equations~\ref{eq:base} to~\ref{eq:bfg}. As usual in dynamic programming, the characteristics must satisfy several properties: (1) we must be able to compute the characteristic for the base case, (2) the characteristic of a partial solution $F$ obtained from gluing smaller partial solutions $F_i$ must only depend on the characteristics of $F_i$, and (3) the characteristic of a global solution should indicate whether it is acceptable or not. Moreover, for a polynomial algorithm, we need the set of possible characteristics to be polynomially bounded. For checking connectivity conditions on $G-F$, we define the characteristics of partial solutions in a natural way. Consider a block $(S,C)$ (resp. a good triple $(S,C,\Omega)$) and a subset $W$ of $S$ (resp. of $\Omega$). Let $F$ be a partial solution compatible with $(S,C,W)$ (resp. $(S,C,\Omega,W)$), see Definition~\ref{de:partcomp}. The \emph{characteristic} $c$ of $F$ for $(S,C,W)$ (resp. for $(S,C,\Omega,W)$) is defined as the partition induced on $S \setminus W$ (resp. on $\Omega \setminus W$) by the connected components of $G[S \cup C] - F$. More formally, let $D_1, \dots, D_q$ denote the connected components of $G[S \cup C] - F$, and let $P_j = D_j \cap S$ (resp. $P_j = D_j \cap \Omega$), for all $1 \leq j \leq q$. Then $c = \{P_1,\dots, P_q\}$. We decide that if $S \neq \emptyset$, partial solutions $F$ having some component $D_j$ that does not intersect $S$ (resp. $\Omega$) are immediately rejected; indeed, for any extension $F'$ of $F$, the graph $G - F'$ remains disconnected. Hence we may assume that all sets $P_j$ are non-empty. We say that a partial solution $F$ is \emph{compatible with $(S,C,W,c)$} (resp. \emph{with $(S,C,\Omega,W,c)$}) if it satisfies the conditions of Defintion~\ref{de:partcomp}, and $c$ is the characteristic of $F$ for $(S,C,W)$ (resp. for $(S,C,\Omega,W)$). We also define functions $\alpha(S,C,W,c)$, $\beta(S,C,\Omega,W,c)$ and $\gamma_i(S,C,\Omega,W,c)$ like in Subsection~\ref{ss:FoVi10}, as the maximum size of partial solutions $F$ compatible with the parameters. We can update Equations~\ref{eq:base} to~\ref{eq:bfg} as follows. \paragraph{Base case.} For the good triples $(S,C,\Omega)$ such that $(S,C)$ is inclusion-minimal (hence $\Omega = S \cup C$), \begin{equation}\label{eq:base2} \beta(S,C,\Omega,W,c) = |W|~\text{if $c$ corresponds to the connected components of $G[\Omega \setminus W]$.} \end{equation} Otherwise we set $\beta(S,C,\Omega,W,c) = -\infty$. \paragraph{Computing $\alpha$ from $\beta$.} \begin{equation}\label{eq:afb2} \alpha(S,C,W,c) = \max_{\Omega, W',c'} \beta(S,C,\Omega,W',c'), \end{equation} where the maximum is taken over all potential maximal clique s $\Omega$ such that $(S,C,\Omega)$ is a good triple, and all subsets $W'$ of $\Omega$, of size at most $t+1$, such that $W = W' \cap S$, and all characteristics $c'$ such that each part of $c$ corresponds to the intersection between $S$ and a part of $c'$. If $S \neq \emptyset$ we also request that each part of $c'$ intersects $S$. This condition allows to reject partial solutions $F$ for which a component of $G[S \cup C] - F$ is strictly contained in $C$. Indeed, such partial solutions cannot extend to global solutions $F'$ such that $G - F'$ is connected. For the particular case $S = \emptyset$ (hence $C=V$ and $W = \emptyset$) we only consider characteristics $c'$ with a single part. This ensures that the global solution $F$ satisfies that $G - F$ is connected. If there is no such triple $(\Omega, W',c')$, then we set $\alpha(S,C,W,c) = - \infty$ (we can assume that, when it has no parameters, function $\max$ returns $-\infty$). \paragraph{Computing $\beta$ from $\alpha$.} \begin{equation}\label{eq:g12} \gamma_1(S,C,\Omega,W,c) = \max_{c'} (\alpha(S_1,C_1,\Omega,W \cap S_1, c') + |W| - |W \cap S_1|), \end{equation} over all characteristics if $c'$ that \emph{map correctly} on $c$, in the following sense. Consider a characteristic $c'$ and let $G_{c'}[\Omega \setminus W]$ be the graph obtained from $G[\Omega \setminus W]$ by completing each part $D \in c'$ into a clique. We say that a characteristic $c'$ maps correctly on $c$ if $c$ is the partition of $\Omega \setminus W$ defined by the connected components of $G_{c'}[\Omega \setminus W]$. The notion of mapping transforms the characteristic of the partial solution $F_1$ w.r.t. $(S_1,C_1,W \cap S_1)$ into the characteristic of $F_1 \cup W$ w.r.t. the quadruple $(S,C,\Omega,W)$. For all $i$, $2 \leq i \leq p$, \begin{equation}\label{eq:gi2} \gamma_i(S,C,\Omega,W,c) = \max_{c_{i-1},c_i}(\gamma_{i-1}(S,C,\Omega,W,c_{i-1}) + \alpha(S,C,\Omega,W \cap S_i,c_i) - |W \cap S_i|), \end{equation} over all pairs of characteristics $c_{i-1},c_i$ that \emph{map correctly} on $c$. That is, $c$ must correspond to the connected components of $G_{c_{i-1},c_i}[\Omega \setminus W]$, obtained from $G[\Omega \setminus W]$ by completing each part of $c_{i-1}$ and each part $c_i$ of into a clique. Finally \begin{equation}\label{eq:bfg2} \beta(S,C,\Omega,W,c) = \gamma_p(S,C,\Omega,W,c). \end{equation} The optimal solution size is, as before, $\alpha(\emptyset,V,\emptyset,\{\emptyset\})$. In general, the number of characteristics may be exponential. Nevertheless, there are classes of graphs with the property that each minimal separator $S$ and each potential maximal clique\ $\Omega$ can be partitioned into at most a constant number of cliques. With this constraint, the number of characteristics is polynomial (even constant, for any given triple $(S,C,W)$ or quadruple $(S,C,\Omega,W)$). This is the case for chordal graphs, where each minimal separator and each potential maximal clique\ induces a clique in $G$. It is also the case for circular-arc graphs. Recall that each minimal separator corresponds to the set of arcs intersecting a pair of scanpoints~\cite{KKW98}. Moreover, by~\cite{KKW98,BoTo01}, each potential maximal clique\ corresponds to the set of arcs intersecting a triple of scanpoints. Since arcs intersecting a given scanpoint form a clique, we have that each minimal separator can be partitioned into two cliques, and each potential maximal clique\ can be partitioned into three cliques. We deduce: \begin{theorem}\label{th:cvc} On chordal and circular-arc graphs, problems \textsc{Connected Vertex Cover} and~\textsc{Connected Feedback Vertex Set} are solvable in polynomial time. More generally, one can compute in polynomial time a maximum vertex subset $F$ such that $G[F]$ is of treewidth at most $t$ and $G - F$ is connected. \end{theorem} Note that Escoffier \textit{et al.}~\cite{EGM10} already observed that \textsc{Connected Vertex Cover} is polynomial for chordal graphs. \section{\textsc{Independent Dominating Set} and variants}\label{se:ind} The \textsc{Independent Dominating Set} problem consists in finding a \emph{minimum} independent set $F$ of $G$ such that $F$ dominates $G$. Hence the solution $F$ induces a graph of treewidth $0$ and it is natural to ask if similar techniques work in this case. The fact that we have a minimization problem is not a difficulty: the general dynamic programming scheme applies in this case, and for any weighted problem with polynomially bounded weights, including negative ones~\cite{FoVi10,FTV15}. \textsc{Independent Dominating Set} is known to be NP-complete in chordal bipartite graphs~\cite{DMK90} and in circle graphs~\cite{BGMPST14}. Therefore, it is NP-hard on $\mathcal{G}_{\poly}$ for some polynomials $\operatorname{poly}$. But, again, we can use our scheme in the case of circular-arc graphs, for this problem or any problem of the type minimum dominating induced subgraph of treewidth at most a constant~$t$. Let $(S,C)$ be a block an let $F \subseteq S \cup C$ be a partial solution compatible with $(S,C,W)$ for some $W \subseteq S$ of size at most $t+1$ (in the sense of Definition~\ref{de:partcomp}). The natural way for defining the characteristic of $F$ is to specify which vertices of $S$ are dominated by $F$ and which are not (we already know that $F \cap S = W$). It is thus enough to memorize which vertices of $S$ are dominated by $F \cap C$. In circular-arc graphs, this information can be encoded using a polynomial number of characteristics. Indeed, a minimal separator $S$ corresponds to arcs intersecting a scanline, between two scanpoints $p_1$ and $p_2$ of some intersection model of $G$. Moreover (see~\cite{KKW98}), the vertices of component $C$ correspond to the arcs situated on one of the sides of the scanline. Let $s^1_1,s^1_2,\dots, s^1_{l_1}$ be the arcs of the model containing scanpoint $p_1$, ordered by increasing intersection with the side of $p_1p_2$ corresponding to $C$. Simply observe that if $F \cap C$ dominates vertex $s^1_i$, it also dominates all vertices $s^1_j$ with $j>i$. Therefore we only have to store the vertex $s^1_{min_1}$ dominated by $F \cap C$ which has a minimum intersection with the side of the scanline corresponding to component $C$, and proceed similary for the arcs of $S$ containing scanpoint $p_2$. These two vertices of $S$ will define the characteristic of $F$, and they suffice to identify all vertices of $S$ dominated by $F \cap C$. \begin{figure} \centering \begin{tikzpicture}[scale=1] \draw(-1,0) arc (0:360:2) ; \draw[ dotted] (-0.66,0) arc (0:10:2.33); \draw[-|] (-0.66,0) arc (0:-30:2.33); \draw[ dotted] (-0.33,0) arc (0:10:2.66); \draw[-|] (-0.33,0) arc (0:-45:2.66) ; \draw[dotted] (0,0) arc (0:10:3); \draw[-|] (0,0) arc (0:-60:3); \draw[-|] (-6,0) arc (180:230:3) ; \draw[dotted] (-6,0) arc (180:170:3) ; \draw[-|] (-5.66,0) arc (180:200:2.66) ; \draw[dotted] (-5.66,0) arc (180:170:2.66) ; \draw[densely dotted, thick, |-|] (-4.8,-1.5) arc (220:310:2.33); \node (p1) at (-0.75,-0.3){$\phantom{p_1}$}; \node (p2) at (-5.25,-0.3){$\phantom{p_2}$}; \draw[-,very thick] (p1)--(p2); \node (pp1) at (-1.2,-0.1){$p_1$}; \node (pp2) at (-4.75,-0.1){$p_2$}; \node (C) at (-3.3,-2.6){$F \cap C$}; \node (pp2) at (-1.1,-1.35){$s_1^1$}; \node (pp2) at (-1.2,-2.1){$s_2^1$}; \node (pp2) at (-1.7,-2.6){$s_3^1$}; \node (pp2) at (-5.4,-1.1){$s_1^2$}; \node (pp2) at (-4.75,-2.4){$s_2^2$}; \end{tikzpicture} \caption{Domination in circular-arc graphs. The characteristic of $F$ w.r.t. $(S,C)$ is $(s_3^1, s_2^2)$.}\label{fi:ca} \end{figure} These characteristics can be used to compute a minimum dominating induced subgraph of treewidth at most $t$, for circular-arc graphs, in polynomial time. We will not show, in details, how to do it, since the technique is quite classical. Problem \textsc{Independent Dominating Set} is already known to be polynomial for this class~\cite{Ch98,Va12}. The algorithm of Vatshelle~\cite{Va12} is more general, based on parameters called \emph{boolean-width} and \emph{MIM-width}, which are small ($\mathcal{O}(\log n)$ for the former, constant for the latter) on circular-arc graphs and also other graph classes. Another problem of similar flavor, combining domination and independence, is \textsc{Red-Blue Dominating Set}. In this problem we are given a bipartite graph $G=(R,B,E)$ with red and blue vertices, and an integer $k$, and the goal is to find a set of at most $k$ blue vertices dominating all the red ones. \textsc{Red-Blue Dominating Set} can be reduced to \textsc{Connected Vertex Cover} as follows~\cite{DLS14}. Let $G'$ be the graph obtained from $G=(R,B,E)$ by adding a new vertex $u$ adjacent to all vertices of $B$ and then, for each $v \in R \cup \{u\}$, a pendant vertex $v'$ adjacent only to $v$. Then $G$ has a red-blue dominating set of size at most $k$ if and only if $G'$ has a connected vertex cover of size at most $k+|B|+1$. Indeed any minimum connected vertex cover of $G'$ must contain $u$, $R$, and a subset of $B$ dominating $R$. It is not hard to prove that this reduction increases the number of minimal separators by at most $\mathcal{O}(n)$, see Appendix~\ref{app:red}. Therefore, if \textsc{Red-Blue Dominating Set} is NP-hard on (bipartite) $\mathcal{G}_{\poly}$ for some $poly$, so is \textsc{Connected Vertex Cover}. There are two natural, well-studied classes of bipartite graphs with polynomial number of minimal separators, and it turns out that \textsc{Red-Blue Dominating Set} is polynomial for both. One is the class of chordal bipartite graphs (which are actually defined as the bipartite, \emph{weakly} chordal graphs). For this class, \textsc{Red-Blue Dominating Set} is polynomial by~\cite{DMK90}. Reference~\cite{DMK90} considers the total domination problem for the class, but the approach is based on red-blue domination. The second natural class is the class of circle bipartite graphs, i.e., bipartite graphs that are also circle graphs. They have an elegant characterization established by de Fraysseix~\cite{Fr81}. Let $H = (V,E)$ be a planar multigraph, and partition its edge set into two parts $E_R$ and $E_B$ such that $T=(V,E_R)$ is a spanning tree of $H$. Let $B(H, E_R) = (E_R, E_B, E')$ be the bipartite graph defined as follows: $E_R$ is the set of red vertices, $E_B$ is the set of blue vertices, and $e_R \in E_R$ is adjacent to $e_B \in E_B$ if the unique cycle obtained from the spanning tree $T$ by adding $e_B$ contains the edge $e_R$. We say that $B(H, E_R)$ is a fundamental graph of $H$. By~\cite{Fr81}, a graph is circle bipartite if and only if it is the fundamental graph $B(H, E_R)$ of a planar multigraph $H$. Consider now the \textsc{Tree augmentation} problem that consists in finding, on input $G$ and a spanning tree $T$ of $G$, a minimum set of edges $D \subseteq E(G)-E(T)$ such that each edge in $E(T)$ is contained in at least one cycle of $G' = (V, E(T) \cup D)$. In \cite{Provan199987} is shown that \textsc{Tree augmentation} is polynomial when the input graph is planar. Is direct to see that a set $S \subseteq E_B$ is a solution of the \textsc{Tree augmentation} problem on input $H = (V, E_R \cup E_B)$ and $T = (V, E_R)$, if and only if $S$ is a solution of \textsc{Red-Blue Dominating Set} on input $B(H) = (E_R, E_B, E')$. This observation, together with \cite{Fr81} and \cite{Provan199987}, impliy that \textsc{Red-Blue Dominating Set} is polynomial in circle bipartite graphs. \section{Discussion} We showed how the dynamic programming scheme of~\cite{FoVi10,FTV15} can be extended for other optimization problems, on \emph{subclasses} of $\mathcal{G}_{\poly}$. Note that the algorithm of~\cite{FTV15} allows to find in polynomial time, on $\mathcal{G}_{\poly}$, a maximum (weight) subgraph $G[F]$ of treewidth at most $t$, satisfying some property expressible in CMSO. It also handles annotated versions, where the vertices/edges of $G[F]$ must be selected from a prescribed set. We have seen that \textsc{Distance-$d$ Independent Set} can be solved in polynomial time on $\mathcal{G}_{\poly}$ for any even $d$. This also holds for the more general problem of finding an induced subgraph $G[F]$ whose components are at pairwise distance at least $d$, and such that each component is isomorphic to a graph in a fixed family. E.g., each component could be an edge, to have a variant of \textsc{Maximum Induced Matching} where edges should be at pairwise distance at least $d$. For this we need to solve the corresponding problem on $G^{d-1}$, using only edges from $G$, as in~\cite{FTV15}. When seeking for maximum (resp. minimum) induced subgraphs $G[F]$ of treewidth at most $t$ such that $G - F$ is connected (resp. $F$ dominates $G$) on particular subclasses of $\mathcal{G}_{\poly}$, we can add any CMSO condition on $G[F]$. It is not unlikely that the techniques can be extended to other classes than circular-arc graphs (and chordal graphs, for connectivity constraints). We also believe that the interplay between graphs of bounded MIM-width~\cite{Va12} and $\mathcal{G}_{\poly}$ deserves to be studied. None of the classes contains the other, but several natural graph classes are in their intersection, and they are both somehow related to induced matchings. We leave as open problems the complexity of \textsc{Connected Vertex Cover} and \textsc{Connected Feedback Vertex set} in weakly chordal graphs, and on $\mathcal{G}_{\poly}$. We have examples showing that, even for weakly chordal graphs, the natural set of characteristics that we used in Section~\ref{se:cvc} is not polynomially bounded. \paragraph{Acknowledgements.} We thank Iyad Kanj for fruitful discussions on the subject. \bibliographystyle{plain}
{'timestamp': '2016-07-18T02:07:51', 'yymm': '1607', 'arxiv_id': '1607.04545', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04545'}
arxiv
\section{Introduction} Robots are increasingly being used in living spaces, factories, and outdoor environments. One recent trend has been the development of co-robots (or cobots), robots that are intended to physically interact with humans in a shared workspace. In such environments, various elements or parts of the robot tend to be in close proximity to the humans or other moving objects. This proximity gives rise to two kinds of challenges in terms of motion planning. First, we have to predict the future actions and reactions of moving obstacles or agents in the environment to avoid collisions with obstacles. Therefore, the collision avoidance algorithm needs to deal with uncertain and imperfect representation of future obstacle motions efficiently. Second, the computed robot motion still needs to be reasonably efficient. It is not desired to compute a very slow or excessively diverting trajectory in order to avoid collisions. Various uncertainties arise from control errors, sensing errors, or environmental errors (i.e. imperfect environment representation) in the estimation and prediction of environment obstacles. Typically, these uncertainties are modeled using Gaussian distributions. Motion planning algorithms use probabilistic collision detection to avoid collisions with the given imperfect obstacle representation. With such obstacle representations, it can be impossible (Gaussian distributions of obstacle positions have non-zero probabilities in the entire workspace) to compute a perfectly collision-free, or results in an inefficient trajectory to avoid collisions with very low probabilities. In order to balance the safety and efficiency of planned motions, motion planning under uncertainties is desired to guarantee collision-free of the computed trajectory only in a limited probabiliy bound, which can be specified using a parameter, \emph{confidence level} (e.g. 0.99)~\cite{du2012robot}. For the probabilistic collision detection, stochastic algorithms are used to approximate the collision probability \cite{blackmore2006probabilistic,lambert2008fast}. However, such probabilistic collision detection algorithms are computationally intensive and mostly limited to 2D spaces. Most prior planning approaches for high-DOF robots perform the exact collision checking with scaled objects that enclose the potential object volumes~\cite{bry2011rapidly,van2012lqg,lee2013sigma,sun2015stochastic}. Although these approaches guarantee probabilistical safety bounds, they highly overestimate the collision probability, which result in less optimal trajectories or failure to finding feasible trajectories in a limited planning time in dynamic environments. \noindent {\bf Main Results:} In this paper, we present a novel approach to perform probabilistic collision detection. Our approach has two novel contributions. First, we provide a fast approximation of collision probability between the high-DOF robot and high-DOF obstacles. Our approach computes more accurate probabilities than approaches using exact collision checking with enlarged obstacle shapes, and the computed probability is guaranteed as the upper bound that the actual probability is always lower than the computed probability. Second, we describe a practical belief space estimation algorithm that accounts for both spatial and temporal uncertainties in the position and motion of each obstacle in dynamic environments with moving obstacles. We present a trajectory optimization algorithm for high-DOF robots in dynamic, uncertain environments based on our probabilistic collision detection and belief space estimation. We have evaluated our planner using robot arms operating in a simulation and a real environment workspace with high-resolution point cloud data corresponding to moving human obstacles, captured using a Kinect. Our approach uses a high value of the confidence level ($0.95$ or above) to perform probabilistic collision detection and can compute a smooth collision-free trajectory. The paper is organized as follows. Section~\ref{sec:related} gives a brief overview of prior work on probabilistic collision detection and motion planning. We introduce the notation and the algorithm of our probabilistic collision detection algorithm in Section~\ref{sec:pcc}. We describe the belief space estimation and trajectory planning algorithm in Section~\ref{sec:environment} and Section~\ref{sec:optimization}, respectively. We highlight planning performance in challenging human environment scenarios in Section~\ref{sec:result}. \section{Related Work} \label{sec:related} In this section, we give a brief overview of prior work on probabilistic collision detection, trajectory planning, and uncertainty handling. \subsection{Probabilistic Collision Detection} Collision checking is an integral part of any motion planning algorithm and most prior techniques assume an exact representation of the robot and obstacles. Given some uncertainty or imperfect representation of the obstacles, the resulting algorithms perform probabilistic collision detection. Typically, these uncertainties are modeled using Gaussian distributions and stochastic algorithms are used to approximate the collision probability \cite{blackmore2006probabilistic,lambert2008fast}. In stochastic algorithms, a large number of sample evaluations are required to compute the accurate collision probability. If it can be assumed that the size of the objects is relatively small, the collision probability can be approximated using the probability at a single configuration corresponds to the mean of the probability distribution function (PDF), which provides a closed-form solution~\cite{du2011probabilistic}. This approximation is fast, but the computed probability cannot provide a bound, and can be either higher or lower than the actual probability, where the error increases as the object is bigger and has high-DOFs. For high-dimensional spaces, a common approach for checking collisions for imperfect or noisy objects is to perform the exact collision checking with scaled objects that enclose the potential object volumes~\cite{van2012lqg,Park:2012:ICAPS}. Prior approaches generally enlarge an object shape, which may correspond to a robot or an obstacle, to compute the space occupied by the object for a given standard deviation. This may correspond to a sphere~\cite{bry2011rapidly} or a ‘sigma hull’~\cite{lee2013sigma}. This approach provides an upper bounding volume for the given confidence level. However, the computed volume overestimates the probability and can be much bigger than the actual volume corresponds to the confidence level, which can cause failure of finding existing feasible trajectories in motion planning. Many other approaches have been proposed to perform probabilistic collision detection on point cloud data. Bae et al.~\cite{bae2009closed} presented a closed-form expression for the positional uncertainty of point clouds. Pan et al.~\cite{pan2011probabilistic} reformulate the probabilistic collision detection problem as a classification problem and compute per point collision probability. However, these approaches assume that the environment is static. Other techniques are based on broad phase data structures that handle large point clouds for realtime collision detection~\cite{pan2013real}. \subsection{Planning in Dynamic Environments} There is considerable literature on motion planning in dynamic scenes. In some applications, the future locations or trajectories of the obstacles are known. As a result, the time dimension is added to the configuration space of the robot and classical motion planning algorithms can be applied to the resulting state space~\cite{LaValle:2006}. In many scenarios, the future positions of the obstacles are not known. As a result, the planning problem is typically solved locally using reactive techniques such as dynamic windows or velocity obstacles~\cite{Fiorini:1998}, or assuming that the obstacle trajectories are known within a short horizon~\cite{Likhachev:2009}. Other methods use replanning algorithms, which interleave planning with execution. These methods include sampling-based planners~\cite{Hauser:safety,David:2002,SMP:2005}, grid searches~\cite{Koenig:2003:PBP,Likhachev05anytimedynamic}, or trajectory optimization~\cite{Park:2012:ICAPS}. Our formulation is based on optimization-based replanning, and we take into account smoothness and dynamic constraints. Applications that require high responsiveness use control-based approaches~\cite{haschke2008line,kroger2010online}, which can compute trajectories in realtime. They compute the robot trajectory in the Cartesian space, i.e. the workspace of the robot, according to the sensor data. However, the mapping from the Cartesian trajectory to the trajectory in the configuration space of high-DOF robots can be problematic. Furthermore, control-based approaches tend to compute less optimal robot trajectories as compared to the planning approaches that incorporate the estimation of the future obstacle poses. Planning algorithms can compute better robot trajectories in applications in which a good prediction about obstacle motions in a short horizon can be provided. \subsection{Planning under Uncertainties} The problem of motion planning under uncertainty, or belief space planning, has been an active area of research for the last few decades. The main goal is to plan a path for a robot in partially-observable state spaces. The underlying problem is formally defined using POMDPs (partially-observable Markov decision processes), which provide a mathematically rigorous and general approach for planning under uncertainty~\cite{kaelbling1998planning}. The resulting POMDP planners handle the uncertainty by reasoning over the {\em belief} space. A belief corresponds to the probability distribution over all possible states. However, The POMDP formulation is regarded as computationally intractable~\cite{papadimitriou1987complexity} for problems which are high-dimentional or have a large number of actions. Therefore, many efficient approximations~\cite{silver2010monte,kurniawati2013online,somani2013despot} and parallel techniques~\cite{shani2010evaluating,lee2013gpu} have been proposed to provide a better estimation of belief space. Most approaches for continuous state spaces use Gaussian belief spaces, which are estimated using Bayesian filters (e.g., Kalman filters)~\cite{leung2006planning,platt2010belief}. Algorithms using Gaussian belief spaces have also been proposed for the motion planning of high-DOF robots~\cite{van2012lqg,sun2015stochastic}, but they do not account for environment uncertainty or imperfect obstacle information. Instead, most planning algorithms handling environment uncertainty deal with issues arising from visual occlusions~\cite{missiuro2006adapting,guibas2010bounded,kahn2015active,charrow2015information}. In terms of dynamic environments, motion planning with uncertainty algorithms is mainly limited to 2D spaces~\cite{du2012robot,bai2015intention}, where the robots are modeled as circles, or to specialized applications such as people tracking~\cite{bandyopadhyay2009motion}. \begin{comment} The resulting POMDP planners handle the uncertainty by reasoning over the {\em belief} space~\cite{kaelbling1998planning}. A belief corresponds to the probability distribution over all possible states. However, POMDP is regarded as computationally intractable~\cite{papadimitriou1987complexity} for problems which are high-dimentional or have a large number of actions. Most practical solutions are limited to static scenes or low-dimensional state spaces~\cite{silver2010monte,kurniawati2013online,somani2013despot}. POMDP is a general motion planning framework that can compute the optimal solution under different types of uncertainties~\cite{kaelbling1998planning}. Most practical solutions are limited to static scenes or low-dimensional state spaces~\cite{silver2010monte,kurniawati2013online,somani2013despot}. The POMDP formulation considers every possible state to find the optimal solution, and is regarded as computationally intractable due to high dimensionality~\cite{papadimitriou1987complexity}. The exact state of the robot or the environment is typically not known. As a result, these approaches estimate the probability distributions of states, which are defined as the \textit{belief space}. Many efficient approximations~\cite{silver2010monte,kurniawati2013online,somani2013despot} and parallel techniques~\cite{shani2010evaluating,lee2013gpu} have been proposed to provide a better estimation of belief space. Many approximate POMDP formulations have been proposed for discretized state spaces~\cite{kurniawati2013online,somani2013despot}. \end{comment} \section{Probabilistic Collision Detection} \label{sec:pcc} In this section, we first introduce the notation and terminology used in the paper and present our probabilistic collision checking algorithm between the robot and the environment. \subsection{Notation and Assumptions} \label{subsec:notation} Our goal is to compute a collision probability between a high-DOF robot configuration and a given obstacle representation of dynamic environments, where the obstacle representation is a probability distribution which accounts uncertainties in the future obstacle motion prediction. For an articulated robot with $D$ one-dimensional joints, we represent a single robot configuration as $\mathbf q$, which is a vector composed from the joint values. The $D$-dimensional vector space of $\mathbf q$ is the configuration space $\mathcal{C}$ of the robot. We denote the collision-free subset of $\mathcal{C}$ as $\mathcal{C}_{free}$, and the other configurations corresponding to collisions as $\mathcal{C}_{obs}$. We assume that the robot consists of $J$ links $R_1,...,R_J$, where $J \leq D$. Furthermore, for each robot link $R_j$, we use multiple bounding volumes $B_{j1},...,B_{jK}$ to tightly enclose $R_j(\mathbf q)$ which corresponds to a robot configuration $\mathbf q$, i.e., \begin{equation} \label{eq:robot_bv} \begin{split} \forall j : R_j(\mathbf q) \subset \bigcup_{k=1}^K B_{jk}(\mathbf q) \,\,\textrm{for}\,\, (1 \le j \le J). \end{split} \end{equation} In our experiments, bounding spheres are automatically generated along the medial axis of each robot link. We represent $L$ obstacles in the environment as $O_l \, (1 \le l \le L)$, and assume that the obstacles undergo rigid motion. The configuration of these obstacles is specified based on geometric (shape) representation and their poses. As is the case for the robot, we use the bounding volumes $S_{l1},...,S_{lM}$ to enclose each obstacle $O_l$ in the environment: \begin{equation} \label{eq:obs_bv} \begin{split} \forall l : O_l \subset \bigcup_{m=1}^M S_{lm} \,\,\textrm{for}\,\, (1 \le l \le L). \end{split} \end{equation} For dynamic obstacles, we assume the predicted position of a bounding volume $S_{lm}$ at time $t$ is estimated as a Gaussian distribution $\mathcal{N} (\mathbf p_{lm}, \mathbf \Sigma_{lm})$, which will be described in Section~\ref{sec:environment}. \subsection{Probabilistic Collision Checking} \label{subsec:pcc} The collision probability between a robot configuration $\mathbf q_i$ with the environment at time $t_i$, $P(\mathbf q_i \in \mathcal{C}_{obs}(t_i))$ can be formulated as \begin{equation} \label{eq:colspace} \begin{split} P\left(\left(\bigcup_j \bigcup_k B_{jk}(\mathbf q_i)\right) \bigcap \left(\bigcup_l \bigcup_m S_{lm}(t_i) \right) \neq \emptyset \right). \end{split} \end{equation} We assume the robot links $R_j$ and obstacles $O_l$ are independent with each other link or obstacle, as their positions depend on corresponding joint values or obstacle states. Then (\ref{eq:colspace}) can be computed as \begin{align} \label{eq:colprob} &P(\mathbf q_i \in \mathcal C_{obs}(t_i)) =1-\prod_j\prod_l \overline{P_{col}(i,j,l) }, \end{align} where $P_{col}(i,j,l)$ is the collision probability between $R_j(\mathbf q_i)$ and obstacles $O_l(t_i)$. Since positions of bounding volumes $B_{jk}$ and $S_{lm}$ are determined by joint values or obstacle states of the corresponding robot link or obstacle, bounding volumes for the same object are dependant with each other, and $P_{col}(i,j,l)$ can be approximated as \begin{align} \label{eq:colprob2} &P_{col}(i,j,l)\approx\max_{k,m} P_{col}(i,j,k,l,m)\\ &P_{col}(i,j,k,l,m)=P(B_{jk}(\mathbf q_i)\cap S_{lm}(t_i) \neq \emptyset), \end{align} where $P_{col}(i,j,k,l,m)$ denotes the collision probability between $B_{jk}(\mathbf q_i)$ and $S_{lm}(t_i)$. \begin{figure}[t] \centering \includegraphics[trim=0in 0in 0in 1.0in, clip=true, width=0.6\linewidth]{max_prob.pdf} \caption{Approximation of probabilistic collision detection between a sphere obstacle of radius $r_2$ with a probability distribution $\mathcal{N} (\mathbf p_{lm}, \mathbf \Sigma_{lm})$ and a rigid sphere robot $B_{jk}(\mathbf q_i)$ centered at $\mathbf o_{jk}(\mathbf q_i)$ with radius $r_1$. It is computed as the product of the probability at $\mathbf x_{max}$ with the volume of the sphere with the radius computed as the sum of two radii, $V=\frac{4\pi}{3}(r_1+r_2)^3$.} \label{fig:prob_approx} \end{figure} Fig.~\ref{fig:prob_approx} illustrates how $ P_{col}(i,j,k,l,m)$ can be computed for $S_{lm}(t_i) \sim \mathcal{N} (\mathbf p_{lm}, \mathbf \Sigma_{lm})$. If we assume that the robot's bounding volume $B_{jk}(\mathbf q_i)$ is a sphere centered at $\mathbf o_{jk}(\mathbf q_i)$, similar to the environment bounding volume $S_{lm}$, and denote the radii of $B_{jk}$ and $S_{lm}$ as $r_1$ and $r_2$, respectively, the exact probability of collision between them is given as: \begin{equation} \label{eq:colobj} \begin{split} P_{col}(i,j,k,l,m)=\int_{\mathbf x}I(\mathbf x,\mathbf o_{jk}(\mathbf q_i))p(\mathbf x,\mathbf p_{lm},\mathbf \Sigma_{lm})d \mathbf x,\\ \end{split} \end{equation} where the indicator function $I(\mathbf x,\mathbf o)$ and the obstacle function $p(\mathbf x,\mathbf p,\mathbf \Sigma)$ are defined as, \begin{align} \label{eq:colobj1} I(\mathbf x,\mathbf o)=\left\{\begin{matrix} 1 & \textrm{if}\: \|\mathbf x - \mathbf o\| \leq (r_1+r_2) \\ 0 & \textrm{otherwise} \end{matrix}\right. \, \textrm{and} \end{align} \begin{align} \label{eq:colobj2} p(\mathbf x,\mathbf p,\mathbf \Sigma)=\frac{e^{-0.5(\mathbf x-\mathbf p)^T\mathbf \Sigma^{-1}(\mathbf x-\mathbf p)}}{\sqrt{(2\pi)^3\|\mathbf \Sigma\|}}, \end{align} respectively. It is known that there is no closed form solution for (\ref{eq:colobj}). Toit and Burdick approximate (\ref{eq:colobj}) as $V \cdot p(\mathbf o_{jk}(\mathbf q_i),\mathbf p_{lm},\mathbf \Sigma_{lm})$, where $V$ is the volume of sphere, i.e., $V=\frac{4\pi}{3}(r_1+r_2)^3$~\cite{du2011probabilistic}. However, this approximated probability can be either smaller or larger than the exact probability. If the covariance $\mathbf \Sigma_{lm}$ is small, the approximated probability can be much smaller than the exact probability. In order to compute an upper bound on the collision probability, we compute $\mathbf x_{max}$, the position has the maximum probability of $\mathcal{N} (\mathbf p_{lm}, \mathbf \Sigma_{lm})$ in $\mathbf B_{jk}(\mathbf q_i)$, and compute the upper bound of $P_{col}(i,j,k,l,m)$ as \begin{align} \label{eq:approx} P_{approx}(i,j,k,l,m) = V \cdot p(\mathbf x_{max},\mathbf p_{lm},\mathbf \Sigma_{lm}). \end{align} Although $\mathbf x_{max}$ has no closed-form solution, it can be computed efficiently. \begin{lemma} \label{thm:lemmamax} $\mathbf x_{max}$, the position has the maximum probability of $\mathcal{N} (\mathbf p_{lm}, \mathbf \Sigma_{lm})$ in $\mathbf B_{jk}(\mathbf q_i)$, is formulated as an one-dimensional search of a parameter $\lambda$, \begin{align} \label{eq:lemma} \mathbf x_{max}&=\left\{ \mathbf x|\|\mathbf x -\mathbf o_{jk}(\mathbf q_i)\|=(r_1+r_2) \,\textrm{and}\, \mathbf x \in \mathbf x(\lambda)\right\}, \textrm{where}\\ \mathbf x(\lambda)&=(\mathbf \Sigma_{lm}^{-1}+\lambda \mathbf I)^{-1}(\mathbf \Sigma_{lm}^{-1}\mathbf p_{lm}+\lambda \mathbf o_{jk}(\mathbf q_i)). \end{align} \end{lemma} \begin{proof} The problem of finding the position with the maximum probability in a convex region can be formulated as an optimization problem with a Lagrange multiplier $\lambda$~\cite{groetsch1984theory}, \begin{align} \label{eq:lemmaproof1} \mathbf x_{max} = \argmin_{\mathbf x} \left\{ (\mathbf x-\mathbf p_{lm})^T \mathbf \Sigma_{lm}^{-1}(\mathbf x - \mathbf p_{lm})+\lambda (\mathbf x - \mathbf o_{jk})^2\right\}. \end{align} The solution of (\ref{eq:lemmaproof1}) satisfies \begin{align} \label{eq:lemmaproof2} &\triangledown \left\{ (\mathbf x-\mathbf p_{lm})^T \mathbf \Sigma_{lm}^{-1}(\mathbf x - \mathbf p_{lm})+\lambda (\mathbf x - \mathbf o_{jk})^2\right\}=0, \end{align} and can be computed as \begin{align} \label{eq:lemmaproof3} &2\mathbf \Sigma_{lm}^{-1}(\mathbf x - \mathbf p_{lm})+2\lambda(\mathbf x-\mathbf o_{jk})=0\\ &\mathbf x = (\mathbf \Sigma_{lm}^{-1}+\lambda \mathbf I)^{-1})(\mathbf \Sigma_{lm}^{-1}\mathbf p_{lm} + \lambda \mathbf o_{jk}). \end{align} \end{proof} The approximated probability (\ref{eq:approx}) is guaranteed as an upper bound of the exact collision probability (\ref{eq:colobj}). \begin{theorem} \label{thm:approx} The approximated probability $P_{approx}(i,j,k,l,m)$ (\ref{eq:approx}) is always greater or equal to the exact collision probability $P_{col}(i,j,k,l,m)$ (\ref{eq:colobj}). \end{theorem} \begin{proof} $p(\mathbf x_{max},\mathbf p_{lm},\mathbf \Sigma_{lm}) \ge p(\mathbf x,\mathbf p_{lm},\mathbf \Sigma_{lm})$ for $\{\mathbf x|\|\mathbf x - \mathbf o_{jk}(\mathbf q_i)\| \leq (r_1+r_2)\}$ from Lemma~\ref{thm:lemmamax}. Therefore, \begin{align} \label{eq:theorem3} P_{approx}(i,j,k,l,m)&=V \cdot p(\mathbf x_{max},\mathbf p_{lm},\mathbf \Sigma_{lm}) \\ &= \int_{\mathbf x}I(\mathbf x,\mathbf o_{jk}(\mathbf q_i))d \mathbf x \cdot p(\mathbf x_{max},\mathbf p_{lm},\mathbf \Sigma_{lm})\\ &=\int_{\mathbf x}I(\mathbf x,\mathbf o_{jk}(\mathbf q_i))\cdot p(\mathbf x_{max},\mathbf p_{lm},\mathbf \Sigma_{lm})d \mathbf x \\ &\ge \int_{\mathbf x}I(\mathbf x,\mathbf o_{jk}(\mathbf q_i))\cdot p(\mathbf x,\mathbf p_{lm},\mathbf \Sigma_{lm})d \mathbf x \\ &=P_{col}(i,j,k,l,m). \end{align} \end{proof} \subsection{Comparisons with Other Algorithms} \begin{figure}[ht] \centering \subfloat[Case I] { \includegraphics[width=0.2\linewidth]{analysis_1.png} } \subfloat[Case II] { \includegraphics[width=0.2\linewidth]{analysis_2.png} } \begin{tabular}{|c|p{1.5cm}|p{1.5cm}|} \hline \multirow{2}{*}{Algorithms}& \multicolumn{2}{|c|}{Collision probability}\\ \cline{2-3} & \multicolumn{1}{c|}{Case I} & \multicolumn{1}{c|}{Case II}\\ \hline Numerical integration & \multicolumn{1}{r|}{0.09\%(O)} & \multicolumn{1}{r|}{1.72\%(X)}\\ \hline \begin{tabular}[x]{@{}c@{}}Enlarged bounding volumes\\ ($\delta_{CL} = 0.99$)~\cite{van2012lqg,Park:2012:ICAPS}\end{tabular}& \multicolumn{1}{r|}{100.00\%(X)} & \multicolumn{1}{r|}{ 100.00\%(X)} \\ \hline \begin{tabular}[x]{@{}c@{}}Approximation using\\ the center point PDF~\cite{du2011probabilistic}\end{tabular} & \multicolumn{1}{r|}{0.02\%(O)} & \multicolumn{1}{r|}{0.89\%(O)} \\ \hline Our approach & \multicolumn{1}{r|}{0.80\%(O)} & \multicolumn{1}{r|}{8.47\%(X)} \\ \hline \end{tabular} \caption{{\bf Comparison of approximated collision probabilities for feasible (Case I) and infeasible (Case II) scenarios for $\delta_{CL}=0.99$:} We compare the exact collision probability (computed using numerical integration) with approximated probabilities of 1) enlarged bounding volumes (blue contour)~\cite{van2012lqg,Park:2012:ICAPS}, 2) approximation using object center point (in green)~\cite{du2011probabilistic}, and 3) our approach that uses the maximum probability point (in red). Our approach guarantees to not underestimate the probability, while the approximated probability is close to the exact probability. } \label{fig:pcc_comparison} \end{figure} \begin{comment} A common approach for checking collisions for imperfect or noisy objects is to perform the exact collision checking with scaled objects that enclose the potential object volumes~\cite{van2012lqg,Park:2012:ICAPS}. Prior approaches generally enlarge an object shape, which may correspond to a robot or an obstacle, to compute the space occupied by the object for a given standard deviation. This may correspond to a sphere~\cite{bry2011rapidly} or a ‘sigma hull’~\cite{lee2013sigma}. This approach provides an upper bounding volume for the given confidence level. The computed volume overestimates the probability and can be much bigger than the actual volume corresponding to the confidence level. This overestimation occurs because the collision only occurs in the space that is occupied by robot, not the entire bounding volume. When there is a small overlap with the robot and the bounding volume, the exact probability of collision is usually much smaller than the one computed using the given sigma. If there are multiple obstacles in the environment, the enlarged bounding volume makes the approach conservative, and can prevent it from computing collision-free trajectories, which may still exist in the bounding volume. \end{comment} In Fig.~\ref{fig:pcc_comparison}, we illustrate two cases of the collision probability computation between a circle $B$ (in gray), and a point (in black) $\mathbf x$ which has uncertainties, $\mathbf x \sim (\mathbf p, \mathbf \Sigma)$, in 2D. We evaluate the exact collision probabilities using the numerical integration of the PDF. The collision probability of Case I is $0.09\%$, which is feasible with $\delta_{CL} = 0.99$, while the probability of Case II is $1.72\%$, which is infeasible. Contours represent the bounds for different confidence levels, where the blue contour corresponds to $\delta_{CL}=0.99$. In both cases, the blue contour intersects with $B$ and approaches that use enlarged bounding volumes~\cite{van2012lqg,Park:2012:ICAPS} determine the objects are collide, while the collision probability for Case I is $0.09\%$. Du Toit and Burdick~\cite{du2011probabilistic} used the probability of the center point (shown in green in Fig.~\ref{fig:pcc_comparison}) to compute a collision probability that is close to the actual value. However, their approach cannot guarantee upper bounds, and the approximated probability can significantly smaller from the actual probability if the covariance value is small. Case II in Fig.~\ref{fig:pcc_comparison} shows that the approximated probability is $0.89\%$, that satisfies the safety with the $\delta_{CL} = 0.99$, which is not true for the exact probability $1.72\%$. Unlike~\cite{du2011probabilistic}, we approximate the probability of the entire volume using the maximum probability value of a single point (shown in red in Fig.~\ref{fig:pcc_comparison}), as described in Section~\ref{subsec:pcc}. Our approach guarantees computation of the upper bound of collision probability, while the approximated probability is close to the exact probability than the enlarged bounding volume approaches. \section{Belief State Estimation} \label{sec:environment} In this section, we describe our approach for computing the current state $\mathbf p$ of environment obstacles, and use that to estimate the current belief state $\mathbf b_t$ and future states $\mathbf b_i \: (i>t)$, which are represented as the probability distributions. We construct or update the belief state of the environment $\mathbf b = (\mathbf p, \mathbf \Sigma)$ using means and covariances $\mathbf p_{ij}$ and $\mathbf\Sigma_{ij}$ of the poses of the existing bounding volumes $S_{ij}$. That is, $\mathbf p = \begin{bmatrix} \mathbf p_{11}^T & ... & \mathbf p_{lm}^T \end{bmatrix} ^T$ and $\mathbf\Sigma = \textrm{diag}(\mathbf\Sigma_{11},...,\mathbf\Sigma_{lm})$, where $\mathbf \Sigma$ is a block diagonal matrix of the covariances. \subsection{Environment State Model} \label{subsec:env_state} \begin{comment} For simplicity, we assume that we have the exact geometric representation and position of the static obstacles in the scene. However, we may not have the exact shape representation and poses for the dynamic obstacles. Rather, we assume that we have a few candidate shapes for the obstacles; e.g., an obstacle may correspond to a known shape such as a ball or a human arm. In our approach, the assumptions of known and unknown obstacles can be relaxed without a loss of generality. For example, we may not have the exact geometric representation of the static obstacle, and we can also deal with noisy representations of static obstacles. We assume that the environment state, corresponding to the dynamic obstacles, is provided using the depth sensors and converted into point cloud data, which are captured at a high frame rate. Point clouds corresponding to known static obstacles are removed in the background segmentation step, but the planner takes into account static obstacles for collision checking. It can be computationally inefficient to estimate and predict the states of dynamic obstacles that are represented using a large number of point clouds. Therefore, we use a reduced environment state representation that is defined in terms of the positions and velocities of the dynamic obstacles and utilize the predefined shape models for the dynamic obstacles. Each shape model for an obstacle in the model database is defined with multiple bounding volume shapes and their initial poses. \end{comment} In order to compute reliable obstacle motion trajectories in dynamic environments, first it is important to gather the state of obstacles using sensors. There is considerable work on pose recognition in humans~\cite{plagemann2010real,shotton2013real} or non-human objects~\cite{lepetit2005randomized} in computer vision and related areas. \begin{figure}[ht] \centering \includegraphics[width=0.5\textwidth]{environment_state.png} \caption{{\bf Environment belief state estimation for a human obstacle:} We approximate the point cloud from the sensor data using bounding volumes. The shape of bounding volumes are pre-known in the database, and belief states are defined on the probability distributions of bounding volume poses: (a) input point clouds (blue dots) (b) the bounding volumes (red spheres)with their mean positions (black dots) (c) the probabilistic distribution of mean positions. 0\% confidence level (black) to 100\% confidence level (white).} \label{fig:ho} \end{figure} We assume that a model database is given that consists of pre-defined shape models for each moving obstacle in the environment; e.g., an obstacle may correspond to a known shape such as a ball or a human arm. Furthermore, we are also given a bounding volume approximation of each such model. In particular, we use spheres as the underlying bounding volumes (Fig.~\ref{fig:ho}), as they provide an efficient approximation for computing the collision probability (see Section~\ref{subsec:pcc}). We segment out the background pixels correspond to the known static environments from the depth map, and generate a point cloud which is used to compute the best approximating environment state $\mathbf{p}^*$. It can be computationally inefficient to estimate and predict the states of dynamic obstacles that are represented using a large number of point clouds. Therefore, we use a reduced environment state representation that is defined in terms of the positions and velocities of the dynamic obstacles and utilize the predefined shape models for the dynamic obstacles. Each shape model for an obstacle in the model database is defined with multiple bounding volume shapes and their initial poses. For the input point cloud, we perform the object recognization at the beginning frame, then optimize $\mathbf{p}^*$ using the Ray-Constrained Iterative Closest Point~\cite{ganapathi12realtime} algorithm. Given the predefined shape model for each obstacle, ICP algorithm computes the best approximating environment state $\mathbf{p}^*$ for the input point clouds $\mathbf d_1,..., \mathbf d_n$. The likelihood of $\mathbf d_k$ for an environment state $\mathbf p$ is modeled as \begin{equation} P_{pc}(\mathbf d_k | \mathbf{p}) \propto \exp \left( {-} \frac{1}{2} \min_{i,j} \|S_{ij}-\mathbf d_k\| ^2 \right), \label{eq:probability_model} \end{equation} and the optimal environment state $\mathbf{p}^*$ that maximizes the likelihood of the each point cloud is computed with two additional constraints, represented as $C_1$ and $C_2$: \begin{align} \begin{split} &\mathbf p^* = \argmax_{\mathbf{p}} = \prod_k P_{pc}(\mathbf d_k | \mathbf{p}), \\ \text{subject to} \: C_1:& \forall (\mathbf p_{ij}, \mathbf p_{ik}) : (1 - \epsilon) \leq \frac{||\mathbf{p}_{ij} - \mathbf{p}_{ih}||}{c_{dist}({{ij}, {ih})}} \leq (1 + \epsilon) \\ C_2:& \forall \mathbf S_{ij} \forall \mathbf s_i : \textrm{proj}_{\mathbf s_i} (\mathbf S_{ij}) \subset \textrm{proj}_{\mathbf s_i}(\mathbf d_1,...,\mathbf d_n), \end{split} \label{eq:maximization}, \end{align} where ${c_{dist}({ij}, {ih})}$ is the distance between $\mathbf p_{ij}$ and $\mathbf p_{ih}$ of the predefined shape model, and $\textrm{proj}(\mathbf s_i)$ represents a projection to the 2D image space of depth sensor $\mathbf s_i$. Constraint $C_1$ corresponds to the length preserving constraint for the bounding volumes belong to the same object. $C_2$ ensures that the correct point clouds are generated for $\mathbf S_{ij}$ in view of all sensors $\mathbf s_i$. \subsection{Belief State Estimation and Prediction} \label{subsec:env_belief} The optimal solution $\mathbf p^*$ computed in Section~\ref{subsec:env_state} can have erros due to the sensors (e.g., point-cloud sensors) or poor sampling. Furthermore, obstacle motion can be sudden or abrupt and this can result in various uncertainties in the prediction of future motion. At each time $t$, we use the Kalman filter to estimate the position and velocity of the bounding volume $\mathbf S_{ij}$. We estimate the current belief states $\mathbf b_t = (\mathbf p_t, \Sigma_t)$ from the history of observed environment states $\mathbf{p}^*$, and then also predict the future state of the environment that is used for probabilistic collision checking. Its state at time $t$ is represented as \begin{align} (\mathbf{x}_{ij})_t = \begin{bmatrix} (\mathbf p_{ij})_t^T & (\mathbf{\dot{p}}_{ij})_t^T\end{bmatrix}^T, \end{align} where $(\mathbf p_{ij})_t$ is the position of $\mathbf S_{ij}$ at time $t$. We will omit subscript $_{ij}$ when we refer to a single obstacle. Using the Kalman filter, we estimate $\mathbf{x}_t$ as \begin{align} \mathbf{x}_t &= \mathbf{A} \mathbf{x}_{t-1} + \mathbf{B} \mathbf{u}_t + \mathbf{w}_t, \label{eq:KF_predict} \\ \mathbf{z}_t &= \mathbf{C} \mathbf{x}_t + \mathbf v_t, \label{eq:KF_udpate} \end{align} where the matrices are defined as \begin{equation} \mathbf A = \begin{bmatrix} I _{3\times3} & \Delta tI _{3\times3}\\ 0 & I _{3\times3} \end{bmatrix}, \mathbf{B} = \begin{bmatrix} I _{3\times3} \\ \Delta tI _{3\times3} \end{bmatrix}, \mathbf{C} = \begin{bmatrix} I _{3\times3} & 0 \end{bmatrix}, \end{equation} and $\mathbf w_t$ and $\mathbf v_t$ are the process noise and observation noise, respectively. $\mathbf{z}_t$ is an observation that corresponds to $\mathbf p^*$. Although we cannot directly control the environment, we compute an hypothetical input $\mathbf{u}_t$ that is used to preserve the distances between the bounding volumes belong to the same object in the predicted result. During the estimation, if the distance of an object $\mathbf S_{ij}$ from another object $\mathbf S_{ih}$ exceeds the distance in the predefined shape model, we compute an appropriate value for $\mathbf{u}_t$ to preserve the initial distance. In order to preserve the initial distance $\|(\mathbf p_{ij})_0-(\mathbf p_{ih})_0\|$, we pull the $\mathbf S_{ij}$'s position $(\mathbf p_{ij})_t$ toward $\mathbf S_{ih}$'s position $(\mathbf p_{ih})_t$ using \begin{equation} \label{eq:length_control} \mathbf{u}_{t} = \left( (\mathbf{p}_{ih})_t - (\mathbf{p}_{ij})_t \right) \left( 1 - \frac{\|(\mathbf p_{ij})_0-(\mathbf p_{ih})_0\|}{\|(\mathbf p_{ij})_t-(\mathbf p_{ih})_t\|} \right) . \end{equation} \subsection{Spatial and Temporal Uncertainties in Belief State} \label{subsec:uncertainties} \begin{figure}[ht] \centering \subfloat[] { \includegraphics[width=0.22\linewidth]{uncertainty1.png} } \subfloat[] { \includegraphics[width=0.22\linewidth]{uncertainty2_4.png} \label{fig:sensor_error_single} } \subfloat[] { \includegraphics[width=0.22\linewidth]{uncertainty3.png} } \subfloat[] { \includegraphics[width=0.22\linewidth]{uncertainty4.png} } \caption{{\bf Spatial uncertainty:} (a) Sphere obstacle and its point cloud samples from a depth sensor. (b) Probability distribution of a sphere center state $\mathbf p$ for a single point cloud $\mathbf d_k$. (c) Probability distribution of $\mathbf p$ for a partially visible obstacle. (d) Probability distribution of $\mathbf p$ for a fully visible obstacle. } \label{fig:sensor_error} \end{figure} During the environment state estimation, spatial uncertainty or errors arise from the resolution of the sensor. It is known that the depth sensor error can be modeled as Gaussian distributions around each point $\mathbf d_k$~\cite{nguyen2012modeling}. We assume that the center of distribution is $\mathbf d_k$ itself and the covariance is isotropic and can be represented as $\sigma_{s}^2 I_{3\times3}$. Due to the sensor error, the optimal environment state $\mathbf p^*$ computed from (\ref{eq:maximization}) may differ from the true environment state $\mathbf p^{t}$. We derive the equation for the observation noise $\mathbf v_t$ in (\ref{eq:KF_udpate}) for an environment state computed using (\ref{eq:maximization}). For simplicity, we assume the environment has only one sphere with radius $r$ and its optimal state is computed from point clouds (Fig.~\ref{fig:sensor_error}(a)). For a single obstacle case, the optimization equation (\ref{eq:maximization}) can be written as \begin{align} P(\mathbf p) \propto \max_{\mathbf{p}} \quad & \prod_k \exp \left( {-} \frac{1}{2} \left( ||\mathbf{p} - \mathbf{d}_k|| - r \right)^2 \right) \notag \\ = &\prod_k P( \mathbf{p} | \mathbf{d}_k ). \label{eq:maximization2} \end{align} Here, $P( \mathbf{p} | \mathbf{d}_k )$ corresponds to the spherical probability distribution that represents the highest value at distance $r$. If $r \gg \sigma_{s}$, it can be approximated near $\mathbf{p}^{t}$ as a Gaussian distribution as shown in Fig.~\ref{fig:sensor_error}(b), \begin{equation} \label{eq:noise_approx} P( \mathbf{p} | \mathbf{d}_k ) \sim \mathcal{N}( \mathbf{p}^{t}, \sigma_{s}^2 \mathbf{n}^{t} \times (\mathbf{n}^{t}) ^T ), \end{equation} where $\mathbf{n}_k = (\mathbf{p}^t - \mathbf{d}_k) / ||\mathbf{p}^t - \mathbf{d}_k||$. $P(\mathbf p)$ is a product of these spherical probability distributions (\ref{eq:noise_approx}) for different point cloud $\mathbf d_k$, and it corresponds to another Gaussian distribution $\mathcal{N}( \mathbf{p}_t, \Sigma^* )$. Therefore, the observation error $\mathbf{v}_t$ can be represented as: \begin{align} \mathbf{v}_t \sim P(\mathbf p) - \mathbf p^t = \mathcal{N}( \mathbf{0}, \Sigma^* ). \end{align} If we are given more samples from the sensor and there is less sensor error, the error distribution becomes more centralized. Temporal uncertainty arises due to discretization of the time domain, which corresponds to approximating the velocity of dynamic obstacle using forward differencing method. Let $\mathbf{x}(t)$ be the obstacle position at time $t$. By Taylor expansion, we obtain \begin{equation} \mathbf{x}(t + \Delta t) = \mathbf{x}(t) + \dot{\mathbf{x}}(t) \Delta t + \frac{1}{2} \ddot{\mathbf{x}}(t) \Delta t^2 + O(\Delta t^3), \end{equation} and \begin{equation} \dot{\mathbf{x}}(t) \approx \frac{\mathbf{x}(t + \Delta t) - \mathbf{x}(t)}{\Delta t} + \frac{1}{2} \ddot{\mathbf{x}}(t) \Delta t + O(\Delta t^2). \label{eq:taylor_expansion} \end{equation} From the history of past environment states, we compute $\ddot{\mathbf{x}}(t)$ of each object and its covariance $\Sigma_a (t)$. Based on Equation (\ref{eq:taylor_expansion}), we get the process error $\mathbf w_t$ as \begin{equation} \mathbf w_t \sim \mathcal{N} \left( \mathbf{0}, \left[ \begin{array}{c|c} \frac{1}{4} (\Delta t)^4 \Sigma_a(t) & \mathbf{0} \\ \hline \mathbf{0} & \frac{1}{4} (\Delta t)^2 \Sigma_a(t) \end{array} \right] \right), \end{equation} which is used in our estimation framework (Section~\ref{subsec:env_belief}) to compute the environment belief states. These estimated belief states are used for collision probability computation (Section~\ref{subsec:pcc}). \begin{comment} \subsection{Analysis} The observation error, $\mathbf v_t$ is computed as the product of the noise of each point cloud belongs to the same bounding volume, as shown in (\ref{eq:maximization2}). The empirically measured error of Kinect is known as $0.014m$ for the point cloud which is $3m$ far from the sensor~\cite{nguyen2012modeling}. Furthermore, the uncertainty of the position $\mathbf p_{ij}$ is inversely proportional to the number of point cloud datasets, $\mathbf d_k$, which are used for the computation of $\mathbf p_{ij}$. However, there is another source of the observation error. We assume that there is a pre-defined shape in the model database, which exactly matches with the environment obstacles. This is not the case in many applications. For example, we may use one generic model for all human-like obstacles. There can be errors between the predefined shape and the actual object, which is part of the observation error $\mathbf v$, that affects the accuracy of the final result. For each iteration of the trajectory optimization algorithm, the collision probability is computed for all pairs of the robot bounding volumes $\mathbf O_{jk}$ and the environment objects $\mathbf S_{lm}$. Therefore, the performance of the planning algorithm is a linear function function of the number of overlaps between the robot bounding volumes and the environment objects. In order to predict future belief states, we use an independent prediction model for each object $\mathbf S_{lm}$ with a length preserving constraint, given in Equation (\ref{eq:length_control}), instead of the joint prediction model which requires $\mathcal O(m^2)$ computations, where $m$ is the number of objects, i.e., the dimension of the environment state. This allows efficient linear time computation of the future belief state. \end{comment} \section{Space-Time Trajectory Optimization} \label{sec:optimization} In this section, we describe our motion planning algorithm based on probabilistic collision detection (Section~\ref{sec:pcc}) and environment belief state estimation (Section~\ref{sec:environment}). Fig.~\ref{fig:architecture} highlights various components of our planning algorithm. The pseudo-code description is given in Algorithm 1 for a single planning step $\delta T$. \begin{figure}[t] \centering \includegraphics[trim=0in 0in 0in 0in, clip=true, width=0.9\linewidth]{architecture.pdf} \caption{{\bf Trajectory Planning:} We highlight various components of our algorithm. These include belief space estimation from the sensor data and environment description, probabilistic collision checking, and trajectory optimization.} \label{fig:architecture} \end{figure} \begin{algorithm}[t] \caption{$\mathbf Q^*=$PlanWithEnvUncertainty($\mathbf Q$, $\{\mathbf d_k\}, t_i$) \\: Compute the optimal robot trajectory $\mathbf Q^*$ during the planning step $\Delta T$ for the environment point clouds $\{\mathbf d_k\}$ at time $t_i$} \label{alg:pseudo} \begin{algorithmic}[1] \REQUIRE initial trajectory $\mathbf Q$, environment point clouds $\{\mathbf d\}$, time $t_i$ \ENSURE Optimal robot trajectory $\mathbf Q^*$ for time step $\Delta T$ \STATE $\mathbf p_i$ = EnvironmentStateComputation($\{\mathbf d_k\}$) // {\em compute the environment state of dynamic obstacles} \FOR {$k \in \{i, ..., i + \Delta T\}$} \STATE $\mathbf B_k$ = BeliefStateEstimation($\mathbf B_0, ..., \mathbf B_{k-1}$, $\mathbf p_i$) //{\em estimate the current and future belief states} \ENDFOR \WHILE {elapsed time $<\Delta T$} \STATE $P$=ProbCollisionChecking($\mathbf Q,\{\mathbf B_i,...,\mathbf B_{i+\Delta T}\}$) // {\em perform probabilistic collision detection} \STATE $\mathbf Q^*$=Optimize($\mathbf Q,P$) // {\em compute the optimal trajectory for high-DOF robot} \ENDWHILE \end{algorithmic} \end{algorithm} As described in Section.~\ref{sec:environment}, we construct or update the belief state of the environment $\mathbf b = (\mathbf p, \Sigma)$, which is the probability distribution of the poses of the existing bounding volumes. Then we predict the future belief state of the environment. We define the time-space domain $\mathcal X$, which adds a time dimension to the configuration space, i.e., $\mathcal X = \mathcal C \times T$. The robot's trajectory, $\mathbf q(t)$, is represented as a function of time from the start configuration $\mathbf q_s$ to the goal configuration $\mathbf q_g$. It is represented using the matrix $\mathbf Q$, \begin{equation} \label{eq:x} \mathbf Q=\begin{bmatrix} \mathbf q_s & \mathbf q_1&...& \mathbf q_{n-1} & \mathbf q_g\\t_0 & t_1&...&t_{n-1}&t_n\end{bmatrix}, \end{equation} which corresponds to $n+1$ configurations at discretized keyframes, $t_i=i \Delta_T$, which have a fixed interval $\Delta_T$. We denote the $i$-th column of $\mathbf Q$ as $\mathbf x_i=\begin{bmatrix}\mathbf q_i^T & t_i \end{bmatrix}^T$. Given the initial and goal positions for motion planning, our planner computes a locally optimal trajectory based on the objective function defined for the duration of the trajectory and also based on other constraints (e.g., smoothness). We use incremental trajectory optimization, which repeatedly refines a motion trajectory using an optimization formulation~\cite{Park:2012:ICAPS}. The planner initializes the robot trajectory $\mathbf Q$ as a smooth trajectory of predefined length $T$ between the start and goal configurations $\mathbf q_s$ and $\mathbf q_g$, i.e., \begin{align} \label{eq:traj_init} \mathbf Q=\argmin_{Q}\sum_{i=1}^{n-1}\|\mathbf q_{i-1}-2\mathbf q_i+\mathbf q_{i+1}\|^2. \end{align} The trajectory is refined during every planning step $\Delta T$ based on various constraints, and we add collision probability constraints which is based on the probabilistic collision described in Section~\ref{sec:pcc} as the collision-free constraints. We define the collision probability constraint of feasible robot trajectories based on the following probability computation formulation (shown as $P()$): \begin{equation} \label{eq:pcol} \begin{split} \forall \mathbf x_i : P(\mathbf q_i \in \mathcal{C}_{obs}(t_i)) < 1 - \delta_{CL}. \end{split} \end{equation} The computed trajectories that satisfy (\ref{eq:pcol}) guarantee that the probability of collision with the obstacles is bounded by the confidence level $\delta_{CL}$, i.e. the probability that a computed trajectory has no collision is higher than $\delta_{CL}$. Use of a higher confidence level computes safer, but more conservative trajectories. The use of a lower confidence level increases the success rate of planning, but also increases the probability of collision. The objective function for trajectory optimization at time $t_k$ can be expressed as the sum of trajectory smoothness cost, and collision constraint costs for dynamic uncertain obstacles and static known obstacles, \begin{small} \begin{equation} \label{eq:opt} \begin{split} f(\mathbf Q)=\min_{Q}&\sum_{i=k+m}^{n}\left(\|\mathbf q_{i-1}-2\mathbf q_i+\mathbf q_{i+1}\|^2+C_{static}(\mathbf Q_i) \right)\\ +&\sum_{i=k+m}^{k+2m} \textrm{max}(P(\mathbf q_i \in \mathcal C_{obs}(\mathbf x_i))-(1-\delta_{CL}),0), \end{split} \end{equation} \end{small} where $m$ is the number of time steps in a planning time step $\Delta T$. Furthermore, we can add additional kinematic or dynamic constraints that the robot has to satisfy, such as bounds on the joint position, velocity limits or robot balancing constraints. These can be satisfied in the trajectory optimization framework by formulating them as a constraint optimization problem, with these specific constraints. Unlike the previous optimization-based planning approaches~\cite{Park:2012:ICAPS,Zucker:IJRR:2012} which maintain and cannot change the predefined trajectory duration for the computed trajectory, our planner can adjust the duration of trajectory $T$ to avoid collisions with the dynamic obstacles. When the trajectory planning starts from $\mathbf t_i$ ($\mathbf t_i$ can be different from $\mathbf t_s$ due to replanning) and if the computed trajectory $\mathbf Q$ violates the collision probability constraint (\ref{eq:pcol}) at time $j$, i.e., $P(\mathbf q_j \in \mathcal C_{obs}(t_j)) \ge \delta_{CL}$, we repeatedly add a new time step $\mathbf x_{new}$ before $\mathbf x_{j}$ and rescale the trajectory from $\left[\mathbf t_i,...,\mathbf t_{j-1}\right]$ to $\left[\mathbf t_i,...,\mathbf t_{j-1}, \mathbf t_{new}\right]$, until $\mathbf x_{new}$ is collision-free. Moreover, the next planning step starts from $\mathbf x_{new}$. This formulation of adjusting the trajectory duration allows the planner to slow the robot down when it cannot find a safe trajectory for the previous trajectory duration due to the dynamic obstacles. The optimization problem in (\ref{eq:opt}) is solved using Covariant Hamiltonian trajectory optimization~\cite{Zucker:IJRR:2012}, which preserves the trajectory smoothness during optimization. If the optimization algorithm converges, our algorithm computes the optimal trajectory, \begin{align} \mathbf Q^*=\argmin_{\mathbf Q}f(\mathbf Q), \end{align} which provides a probabilistic collision guarantee with the given confidence level $\delta_{CL}$, for the time step $\Delta T$. \section{Results} \label{sec:result} In this section, we describe our implementation and highlight the performance of our planning algorithm on different benchmark scenarios. We tested our planning algorithm in simulated environments with models of a 6-DOF Universal Robot UR5 (Fig.~\ref{fig:experiment1}(a)(b)) and a 7-DOF KUKA IIWA robot arm (Fig.~\ref{fig:experiment1}(c)(d)). The environments have some complex static obstacles such as tools or furniture in a room. The dynamic obstacle is a human, and we assume that the robot operates in close proximity to the human, however, the human does not intend to interact with the robot. We use a Kinect as the depth sensor, which can represent a human as 25-30k point clouds. We use a commodity PC for the planner, and use OpenMP to compute the probabilistic collision checking in parallel using multi-core CPUs. \subsection{Experimental Results} \begin{table*}[ht] \centering \resizebox{\linewidth}{!}{ \begin{tabular}{|c|c|c|c|c|c|c|} \hline Benchmark & Robot DOF & \begin{tabular}[x]{@{}c@{}}\# of Robot\\Bounding\\ Volumes\end{tabular} & \begin{tabular}[x]{@{}c@{}}\# of Samples\\ in Point Cloud\end{tabular} & \begin{tabular}[x]{@{}c@{}}Environment \\ State DOF\end{tabular} & \begin{tabular}[x]{@{}c@{}}Confidence \\ Level\end{tabular} & \begin{tabular}[x]{@{}c@{}}Average \\ Planning\\ Time\end{tabular} \\ \hline Prediction 1 & 6 (UR5) & 30 & 33,000 & 336 & $0.95$ & 138.83 ms \\ \hline Prediction 2 & 6 (UR5) & 30 & 29,500 & 336 & $0.95$ & 115.55 ms \\ \hline \begin{tabular}[x]{@{}c@{}}Time-Space\\Search 1\end{tabular} & 7 (IIWA) & 35 & 35,000 & 336 & $0.95$ & 771.44 ms \\ \hline \begin{tabular}[x]{@{}c@{}}Time-Space\\Search 2\end{tabular} & 7 (IIWA) & 35 & 35,500 & 336 & $0.95$ & 552.64 ms \\ \hline \begin{tabular}[x]{@{}c@{}}Exact\\Collision\\Checking\end{tabular} & 7 (IIWA) & 35 & 35,000 & 336 & $1.0$ & 154.99 ms \\ \hline Sensing Noise 1 & 7 (IIWA) & 35 & 35,000 & 336 & $0.95$ & 720.52 ms \\ \hline Sensing Noise 2 & 7 (IIWA) & 35 & 35,000 & 336 & $0.99$ & 846.11 ms \\ \hline \end{tabular} } \caption{{\bf Complexity and planning results in our benchmarks:} We use two different robot models UR5 and IIWA, in our benchmarks. We highlight the complexity of each benchmark in terms of robot bounding volumes, the number of point cloud samples, DOF of the environment state, and the confidence level used for probabilistic collision detection. We compute the average planning time for each benchmark on a multi-core CPU.} \label{table:performance} \end{table*} \begin{figure}[t] \centering \subfloat { \includegraphics[width=0.22\linewidth]{result1.png} } \subfloat { \includegraphics[width=0.22\linewidth]{result2.png} } \subfloat { \includegraphics[width=0.22\linewidth]{result3.png} } \subfloat { \includegraphics[width=0.22\linewidth]{result4.png} } \caption{{\bf Robot Trajectory with Dynamic Human Obstacles:} Static obstacles are shown in green, the estimated current and future human bounding volumes are shown in blue and red, respectively. (a) When a human is approaching the 6-DOF robot arm (UR5), our planner changes its trajectory to avoid potential future collisions. (b) When a standing human only stretchs out an arm, our shape model-based prediction prevents unnecessary reactive motions, which results a better robot trajectory than the prediction using simple extrapolations. (c) A collision-free computed trajectory that avoids collisions with the obstacle and the environment. (d) The robot adjusts its speed or waits if there is no feasible path to the goal position due to the dynamic obstacles.} \label{fig:experiment1} \end{figure} Table~\ref{table:performance} presents the complexity of the benchmarks and the performance of our planning results. Our first benchmark tests our shape model-based environment belief state prediction. When a human is dashing onto the robot at a fast speed, the robot is aware of the potential collision with the predicted future human position and changes its trajectory (Fig.~\ref{fig:experiment1}(a)). However, if a human in standing only stretchs out an arm toward the robot, even if the velocity of the arm is fast, the model-based prediction prevents unnecessary reactive motions, which is different from the prediction models with constant velocity or acceleration extrapolations (Fig.~\ref{fig:experiment1}(b)). The second benchmark set shows our planner's collision-free path computation in the space-time domain. The planner computes a collision-free trajectory that avoids collision with the obstacles and the environments (Fig.~\ref{fig:experiment1}(c)). If there is no feasible solution due to dynamic obstacles, the planner adjusts its speed or waits until it finds a solution (Fig.~\ref{fig:experiment1}(d)). \begin{figure}[ht] \centering \subfloat { \includegraphics[width=0.3\linewidth]{confidence_noise1.png} } \subfloat { \includegraphics[width=0.3\linewidth]{confidence_noise2.png} } \subfloat { \includegraphics[width=0.3\linewidth]{confidence_noise3.png} } \caption{{\bf Robot Trajectory with Different Confidence and Noise Levels:} (a) A trajectory with exact collision checking for zero-noise obstacles. (b) A trajectory with $\delta_{CL}=0.95$ and $\mathbf v_t=0.005 I_{3 \times 3}$. (c) A trajectory with $\delta_{CL}=0.99$ and $\mathbf v_t=0.05 I_{3 \times 3}$. } \label{fig:experiment2} \end{figure} Fig.~\ref{fig:experiment2} shows a robot trajectory with different confidence levels and sensor noises. If the obstacle states are assumed as exact, the robot can follow the shortest and smoothest trajectory that is close to the obstacle (Fig.~\ref{fig:experiment2}(a)). However, as the noise of the environment state or expected confidence level becomes higher, the computed robot trajectories become longer and less smooth to avoid potential collision with the obstacles (Fig.~\ref{fig:experiment2}(b)-(c)). \subsection{Comparison with Other Algorithms} \begin{table}[ht] \centering \begin{tabular}{|c|c|c|c|} \hline Algorithms & \begin{tabular}[x]{@{}c@{}}Number of\\Collisions\end{tabular} & \begin{tabular}[x]{@{}c@{}}Trajectory\\Duration (sec)\end{tabular} & \begin{tabular}[x]{@{}c@{}}Trajectory\\Length (m)\end{tabular}\\ \hline \begin{tabular}[x]{@{}c@{}}Enlarged bounding\\ volumes~\cite{van2012lqg,Park:2012:ICAPS}\end{tabular} & 0.02 & 10.47 & 2.32\\ \hline \begin{tabular}[x]{@{}c@{}}Approximation using\\ the center point PDF~\cite{du2011probabilistic}\end{tabular} & 0.43 & 6.62 & 1.52\\ \hline Our approach & 0.03 & 7.16 & 1.87 \\ \hline \end{tabular} \caption{{\bf Planning results of different probabilistic collision detection algorithms:} Our probabilistic collision detection approach shows a high safety as the approach using enlarged bounding volumes, while computes efficient trajectories.} \label{table:performance2} \end{table} In order to compare our algorithm with other probabilistic collision detection algorithms, we plan trajectories using the different probabilistic collision detection algorithms. We choose different initial and goal configurations for each trials, and compute trajectories with $\delta_{CL}=0.99$. The trajectory durations are initialized to 5 seconds. We applied the same recorded human motion that stretches an arm that blocks the initial robot trajectory to the planning, but each trial has a different small perturbation of the human obstacle position that corresponds to the environment uncertainties. We measure the number of collisions, as well as the durations and lengths of the computed trajectories for planners with three different probabilistic collision detection algorithms. The averages of 100 trials are shown in Table~\ref{table:performance2}. The enlarged bounding volumes have less collisions, but the durations and lengths of the computed trajectories are longer than other approaches, since the overestimated collision probability makes the planner to compute trajectories which are unnecessarily far apart from the obstacles, or to wait when there is a feasible trajectory. On the other hand, the approximating approach that uses the probability of the object center point underestimate the collision probability and causes several collisions in the planned trajectories. Our approach shows a similar safety with the approach using enlarged bounding volumes, while it also computes efficient trajectories that have shorter trajectory durations and lengths. \section{Conclusions and Future Work} We present a novel algorithm for trajectory planning for high-DOF robots in dynamic, uncertain environments. This include new methods for belief space estimation and probabilistic collision detection. Our approach is quite fast, and works well in our simulated results where it can compute collision-free paths with high confidence level. Our probabilistic collision detection computes tighter upper bounds of the collision probability as compared to prior approaches. We highlight the performance of our planner on different benchmarks with human obstacles for two robot models. To the best of our knowledge, that can handle high-DOF robots in dynamic environment with imperfect obstacle representations. Our approach has some limitations. Some of the assumptions used in belief space estimation in terms of Gaussian distribution and Kalman filter may not hold. Moreover, we may have a pre-defined shape representation of the obstacle. The trajectory optimization may get stuck at a local minima and may not converge to a global optimal solution. There are many avenues for future work. Our approach only takes into account the imperfect information about the moving obstacles. In particular, we assume that a good point-cloud sample of the obstacles is given for probabilistic collision checking. Our current approach does not account for control errors or sensor errors, which are rather common with the controllers and sensors.
{'timestamp': '2016-07-19T02:05:21', 'yymm': '1607', 'arxiv_id': '1607.04788', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04788'}
arxiv
\section{Introduction} \label{sec:intro} Hyperspectral imaging systems have become increasingly popular for a variety of applications, including remote sensing and biomedical analytics. With their dense, contiguous and narrow-band spectral sampling in visible through short-wave infrared regions of the electromagnetic spectrum, they provide rich spectral characterization of the objects that are dominant in the pixels of the hyperspectral image. The capability of hyperspectral data to accurately capture material-specific properties makes them an attractive choice for characterizing vegetation mapping invasive and endangered vegetation, (e.g., for ecological and precision agriculture applications), detection and characterization of physiological conditions and other related biomedical applications \cite{vyas2013estimating,li2012compressive,chen2011denoising,NG2011,prasad2014SMoG,PLFB2012,KPB2010Derivatives,prasad2009information,YP2015,PC2013Asilomar_Sparse,li2011multi,di2011active,PB2008a}. In addition to such applications where hyperspectral data has seen a widespread popularity and acceptance, we suggest that hyperspectral data is also particularly suited for enhanced computer vision applications as they relate to scene understanding, biometrics, and person re-dentification, by virtue of their robust characterization of material properties. Person re-identification -- the task of recognizing a person separated in location and time, has emerged as an important application of multi-camera surveillance systems. Despite algorithmic advances \cite{gheissari2006person,farenzena2010person,zheng2011person} built upon traditional computer vision imaging systems, person reidentification remains a difficult problem due to various challenges, including variations in illumination conditions, pose and viewpoints. Advances in this area include pose, viewpoint and illumination invariant feature extraction \cite{gheissari2006person,farenzena2010person}, as well as the design of appropriate similarity metrics. A majority of these methods take into account global appearance of a person, such as a weighted color histogram \cite{farenzena2010person}. Local spatial information is often extracted by analyzing cropped regions around the face \cite{dantcheva2011frontal}. In this paper, we assert that hyperspectral imagery is potentially very beneficial for the task of person re-identification in a multi-camera surveillance scenario --- specifically, spectral content can serve as a powerful descriptor that can be used by itself or in conjunction with classical spatial and statistical features derived for re-identification. The spectral reflectance \emph{signature} will demonstrate variability across materials (e.g. clothing) and across skin between different people. While it is expected that traditional computer vision imaging systems can characterize differences in clothing and other traditional descriptors, which may be highly separable between people in the visible wavelength regime, subtle differences due to individual skin physiology can be better characterized by hyperspectral imagery. With this in mind, we developed a pilot study and acquired hyperspectral imagery from fifteen subjects in the visible and very near infrared region of the electromagnetic spectrum at two different locations and at different times of the day (morning versus afternoon). We utilized a simple distance metric appropriate for hyperspectral data and reported re-identification performance using spectral features derived from superpixel patches over the skin, to demonstrate the efficacy of such data for person reidentification. This was compared with reidentification undertaken with color imagery. The outline of this paper is as follows. In section 2, we provide details of the data acquisition, and describe the data that was acquired. In section 3, we describe the approach utilized to setup and quantify re-identification performance with this data. In section 4, we provide experimental results for the re-identification task, and in section 5, we provide concluding remarks. \section{Hyperspectral Data Acquisition for Person Reidenitifcation} \label{sec:data} With the goal of demonstrating the efficacy of hyperspectral data for person re-identification, we acquired hyperspectral data from $15$ people under a traditional multi-camera surveillance scenario at two different locations and two different times of the day (morning and afternoon). The hyperspectral images were acquired using a Headwall Photonics$^\text{TM}$ hyperspectral imager --- the spatial size of each image was $1004\times400$ and each pixel had $325$ contiguous spectral bands spanning the visible and near-infrared spectrum from $400nm-1000nm$ uniformly, with a full-width half-maximum (FWHM) bandwidth of $1.8nm$. In order to evaluate the performance of a re-identification model, the dataset must represent commonly encountered confounding factors such as viewpoint and illumination variation. Hence, for each person, the images were acquired at two different times of the day (morning and afternoon), and for each of these two acquisitions, the viewpoints, and location of the camera were different. This data collection was carried out in two batches --- in the series of 15 hyperspectral images acquired in the morning, the camera orientation was fixed relative to the background in the scene, and each person was asked to arbitrarily stand somewhere in the scene and assume a natural (and arbitrary pose). Again, in the afternoon, another series of 15 images were acquired with the sample 15 people, but at a different location, and with a different orientation of the camera. For the purpose of quantifying the potential of hyperspectral images for person re-identification, we treat the morning images from the 15 people as the gallery set, and the afternoon images from those people as the probe set. Also, in addition to the camera having two different orientations and locations in the morning and afternoon, each person was asked to stand arbitrarily in the scene in order to get arbitrary viewpoints. Due to the temporal difference of the captured data, variations in physiological conditions are also represented in this dataset. Fig. \ref{fig:spectra} depicts spectral signatures from the background objects and various parts of the head from one of the $15$ people. It also depicts spectral signatures corresponding to skin pixels (from the face and hands) for two people (Person 12 and Person 13) in the gallery (AM) and probe (PM) sets. This suggests that hyperspectral data can effectively characterize variability between people when using pixels over skin objects. \begin{figure}[h]% \centering \includegraphics[width=8cm, natwidth =560, natheight = 420]{MeanSpecAllFace3AM.png} \includegraphics[width=8cm, natwidth =560, natheight = 420]{MeanSpecProbGallerySkin.png} \caption{\emph{Top}: Mean spectral signatures for various material types in one of the images, including background, clothes, skin (from face and hands), and spectra from other parts of the head; \emph{Bottom}: Mean spectra of ``skin'' from people with IDs 12 and 13 in the gallery set (AM) and the probe set (PM).} \label{fig:spectra} \end{figure} \section{Spectral Angle based Person Re-identification} \label{sec:method} In this paper, we focus on the utility of spectral information from skin pixels for person re-identification. Our approach consists of the following steps --- we manually annotated small patches of ``skin'' pixels (on the face and hands) for each person in the gallery and probe sets. We carried out superpixel segmentation to match mean spectra from skin superpixels to avoid pixel mixing that would result from rectangular windows that are traditionally employed. By averaging spectral signatures over superpixels, we stabilize spectral response from local variability and noise, while at the same time avoiding inadvertent mixing that would have resulted had we chosen rectangular windows. Specifically, we utilized the entropy rate superpixel algorithm which ensures compact and homogenous clusters of similar sizes \cite{ERSuperPixelLiu2011,priyasuperpixels2015}. We took superpixels that intersected with our ``ground-truth'' skin patches in each image and used those to match each probe image with the gallery. A spectral angle distance was used as the similarity metric for the re-identification task. If $S_i$ and $S_j$ represent superpixels in the gallery and probe set respectively, then a spectral angle distance $d_{sa} (S_i,S_j)$ between the two superpixels can be defined as : \begin{equation}\label{eq:SAD} {d_{sa} (S_i,S_j)} = {\frac{{{\hat{{\mathbf{x}}}}_{S_i}^T}{{\hat{{\mathbf{x}}}}_{S_j}}}{{\parallel {{\hat{{\mathbf{x}}}}_{S_i}} \parallel} {\parallel {{\hat{{\mathbf{x}}}}_{S_j}} \parallel}}} \end{equation} \noindent where, ${\hat{{\mathbf{x}}}}_{S_i}$ is the mean spectral signature of region ${S_i}$. In addition to facilitating a computationally simple comparison, using spectral angle as a similarity metric with spectral signature features provides us with an added advantage in that the metric exhibits illumination invariance \cite{CP2015_ADA_JSTSP,keshava2004distance,adler2001shadow}. Average spectral angle distances between skin superpixels from the probe image and every image in the gallery set are used to re-identify the probe set. Note that the superpixels that result from the entropy rate superpixel algorithm modified to use spectral angle based similarity are highly effective at oversegmenting the image into uniform sized clusters while preserving borders, and are hence appropriate for spectral matching via the spectral angle distance. In a practical implementation, matching skin superpixels between probe and gallery sets can be easily accomplished by first utilizing a face detection algorithm to identify the skin superpixels in all the images. For this closed set re-identification problem, we report performance via the cumulative matching characteristic (CMC) curve. The CMC curve represents the expectation of finding the correct match in the top \textit{{r}} matches. In other words, a rank-\textit{{r}} recognition rate shows the percentage of the test images that are correctly recognized from the top \textit{{r}} matches in the gallery set. The rank-1 value on this curve indicates the true identification performance, while the rank-$N$ score ($N$ being the number of images in the gallery) will be $100\%$ for closed-set re-identification, with the curve monotonically increasing from 1 through $N$. Comparison between hyperspectral and RGB (color) images based on this approach is reported in the CMC curve in Fig.~\ref{fig:CMC}. We observe that hyperspectral images not only provides a superior rank-1 performance compared to when using (RGB) color images, the CMC curve for hyperspectral images increases much faster as a function of the rank, with hyperspectral data providing as much as $20\%$ better identification performance. \begin{figure} \centering \includegraphics[height = 7cm]{CMC_Sk.png} \caption{CMC curves}\label{fig:CMC} \end{figure} \section{Conclusions, Caveats and Future Work} We conclude from the data and the results that hyperspectral images have potential to enhance re-identification performance in multi-camera surveillance systems --- the preliminary dataset and resulting CMC curves suggest the ``value'' added by considering the narrow-band spectral information for re-identification as opposed to 3-channel color images. By being able to distinguish subtle spectral variations between people (e.g. via the spectral signatures of their skin), it may also enable long-duration re-identification wherein significant time may have elapsed between the person reappearing in the collective field of view of the system. We acknowledge an important caveat with results presented here --- the sample size (30 images total in gallery and probe sets) is small --- overall performance will drop when the number of people are added to the re-identification problem. However, we expect that spectral signature as a descriptor to characterize skin pixels effectively is likely to result in superior performance compared to traditional (RGB) color systems. Finally, we note that the approach to re-identification can be enhanced by complementing spectral signatures with other descriptors (e.g. spatial information). In ongoing work, we are expanding the gallery and probe sets, and are exploring strategies to fuse information provided from spectral signatures with currently established color image based feature descriptors for effective re-identification. \balance \bibliographystyle{IEEEbib}
{'timestamp': '2016-07-18T02:09:19', 'yymm': '1607', 'arxiv_id': '1607.04609', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04609'}
arxiv
\section[#1 \debug{\fbox {#2}}]{#1 \cmd{msec} \dlabel{#2}}% \markboth{\today}{Sec. \thesection}} \newcommand{\msubsection}[2]{\subsection[#1 \debug{\fbox {#2}}] {#1 \cmd{msubsection} \dlabel{#2}}% \markboth{\today}{Sec. \thesection}} \newcommand{\msubsubsection}[2]{\subsubsection[#1 \debug{\fbox {#2}}] {#1 \cmd{msubsubsection} \dlabel{#2}}% \markboth{\today}{Sec. \thesection}} \renewcommand{{\hfill $\Box$}{\cmd{PE}}}{{\hfill qed}{\cmd{PE}}} \renewcommand{\dB}{\begin{description}} \renewcommand{\labelitemi}{$\bullet$} \setlist{leftmargin=5.5mm} \newtheorem{theorem}{Theorem} \newtheorem{lemma}{Lemma} \newtheorem{definition}{Definition} \newcommand{\textbf}{\textbf} \newcommand{\cdot}{\cdot} \begin{document} \title{ Stochastic Broadcast Control of Multi-Agent Swarms} \author{Ilana Segall and Alfred Bruckstein } \date{Center for Intelligent Systems\\MultiAgent Robotic Systems (MARS) Lab\\Computer Science Department\\ Technion, Haifa 32000, Israel} \maketitle \newpage \tableofcontents \newpage \begin{abstract} We present a model for controlling swarms of mobile agents via broadcast control, assumed to be detected by a random set of agents in the swarm. The agents that detect the control signal become ad-hoc leaders of the swarm. The agents are assumed to be velocity controlled, identical, anonymous, memoryless units with limited capabilities of sensing their neighborhood. Each agent is programmed to behave according to a linear local gathering process, based on the relative position of all its neighbors. The detected exogenous control, which is a desired velocity vector, is added by the leaders to the local gathering control. The graph induced by the agents adjacency is referred to as the \emph{visibility graph}. We show that for piecewise constant system parameters and a connected visibility graph, the swarm asymptotically aligns in each time-interval on a line in the direction of the exogenous control signal, and all the agents move with identical speed. These results hold for two models of pairwise influence in the gathering process, uniform and scaled. The impact of the influence model is mostly evident when the visibility graph is incomplete. These results are conditioned by the preservation of the connectedness of the visibility graph. In the second part of the report we analyze sufficient conditions for preserving the connectedness of the visibility graph. We show that if the visibility graph is complete then certain bounds on the control signal suffice to preserve the completeness of the graph. However, when the graph is incomplete, general conditions, independent of the leaders topology, could not be found.\end{abstract} \textbf{Keywords}: broadcast control, leaders following, linear agreement protocol, collective behavior, conditions for maintaining connectivity, neighbors influence, piecewise constant linear systems \section{Introduction}\label{Introduction} We present a system composed of a group or swarm of autonomous agents and a controller. All the agents behave according to a distributed gathering process, ensuring cohesion of the swarm, and the controller sends desired velocity controls to the cloud. The signal sent by the controller is received by a random set of agents. If all the agents receive the signal then the cloud will move with the desired velocity. If only part of the agents receive the signal then the cloud will move in the desired direction but with a fraction of the desired speed, depending on the topology of the inter-agent visibility graph. This can be viewed as representing the "inertia" or the "reluctance of the cloud to move" in the desired direction with the desired speed. We investigate two models of neighbors influence in the local control, uniform and scaled. We show that if the visibility graph is complete, then the ratio of the achieved collective speed to the desired speed, for both influence models, is the ratio of the \emph{number} of leaders to the total number of agents. However, when the graph is incomplete, the ratio of the achieved collective speed to the desired speed is a function of the influence model. If the influence is uniform the ratio stays as before, i.e. the ratio of the number of leaders to the total number of agents. but if the influence is scaled then the ratio of the achieved collective speed to the desired speed depends not only on the number of leaders but also on the exact topology of the visibility graph and on the location of the leaders within the graph. Hence, for the same number of leaders in the same incomplete visibility graph, with scaled influence, different results can be obtained for different leaders. \subsection{Statement of problem}\label{Model} We consider a system composed of $n$ homogeneous agents evolving in $\textbf{R}^2$. The agents are assumed to be homogenous, memoryless, with limited visibility (myopic) and are modeled by single integrators, namely are velocity controlled. The visibility (sensing) zone of agent $i$ is a disc of radius $R$ around its location. Agents within the sensing zone of agent $i$ are referred to as the \emph{neighbors} of $i$. If $j$ is a neighbor of $i$, we write $i \sim j$. The set of neighbors of $i$, define the \emph{neighborhood} of $i$, denoted by $N_i$. The emergent behavior of agents with unlimited visibility and stochastic broadcast control was discussed in \dcite{SB2016} Each agent can measure only the \emph{relative position} of other agents in its own local coordinate system. The orientation of all local coordinate systems is aligned to that of a global coordinate system, as illustrated in Fig.\dref{fig-frames}, i.e. agents are assumed to have compasses enabling them to align their local reference frames to a global reference frame. Here $p_i=(x_i,y_i)$ represents the position of agent $i$ in the global reference frame, \emph{unknown to the agent itself}. \begin{figure} \begin{center} \includegraphics[scale=0.4]{ReferenceFrames.jpg} \caption{Illustration of local and global reference frames alignment}\label{fig-frames} \end{center} \end{figure} We assume that the agents do not have data transmission capabilities, but all the agents are capable of detecting an exogenous, broadcast control. At any time, a random set of agents detect the broadcast control. These agents will be referred to as ad-hoc \emph{leaders}, while the remaining agents will be the \emph{followers}. The exogenous control, a velocity vector $u$, is common to all the leaders. The agents are unaware of which of their neighbors are leaders. The setup of the problem is illustrated in Fig. \dref{topology}. \begin{figure} \begin{center} \includegraphics[scale=0.5]{ProblemIllustration2.jpg} \caption{Illustration of problem topology at a certain point in time}\label{topology} \end{center} \end{figure} The sets of the leaders and of the followers are denoted by $N^l$, $N^f$ respectively. The number of leaders and followers in the system is denoted by $n_l=|N^l|$, $n_f=|N^f|$ respectively. The sum $n=n_f+n_l$ is the total number of agents. The agents are labeled $1,...,n$. \msubsection{The dynamics of the agents}{DynModel} In our model, the followers apply a local gathering control based on the relative position of all their neighbors and the leaders apply \emph{the same local control (\dref{gen-SelfDyn}) with the addition of the exogenous input $u$}. In general, the strength of the influence of neighbor $j$ on the movement of agent $i$ is some function $f(j,i)$, most often a function of the distance between $i$ and $j$, cf. \dcite{M-T}, \dcite{J-E}, \dcite{C-S}. If we denote by $\sigma_{ji}$ the strength of the \emph{influence} of agent $j$ on the movement of agent $i$, then we have: \begin{itemize} \item for each $i \in N^f$ \begin{equation}\dlabel{gen-SelfDyn} \dot{p}_i(t)=\sum\limits_{j \sim i} \sigma_{ji}(t) (p_j(t) - p_i(t)) \end{equation} where $p_i$ is the position of agent $i$ \item for $ i \in N^l$ \begin{equation}\dlabel{gen-LeadDyn} \dot{p}_i(t)=\sum\limits_{j \sim i} \sigma _{ji}(t) (p_j(t) - p_i(t)) + u \end{equation} \end{itemize} We consider two cases of influence : \begin{enumerate} \item \emph{Uniform} - The influence of all neighbors on any agent is identical and time independent, i.e. $\sigma_{ji} (t) =1 \text{ } \forall j \in N_i (t)$. \item \emph{Scaled} - The influence of an agent $j \in N_i(t)$ on $i$ is scaled by the size of the neighborhood $N_i(t)$, i.e. for each $i$, we have $ \sigma_{ji}(t) = \frac{1}{|N_i (t)|} ; \forall j \in N_i (t)$. \end{enumerate} Fig. \dref{UniScaled} illustrates an example of pairwise interaction graph with uniform influences, denoted by $G^U$, vs the corresponding graph with scaled influences, denoted by $G^S$. \begin{figure} \begin{center} \includegraphics[scale=0.4]{UniScaledGraph5n6m.jpg} \caption{Illustration of an interactions graphs with uniform vs scaled influence }\label{UniScaled} \end{center} \end{figure} In this report, we derive the emergent behavior of agents with any visibility graph, complete or incomplete, applying protocol (\dref{gen-SelfDyn}), (\dref{gen-LeadDyn}) for followers and leaders, for both influence models. We show that when the visibility graph is complete (due to a very large $R$) the two influence models will move the swarm with the same velocity to the same asymptotic (moving) gathering point but when the graph is incomplete the two influence models affect differently the collective velocity and asymptotic state of the swarm. Since $p_i(t) = [x_i(t) \quad y_i(t)]^T$ and $u =[u_x \quad u_y]^T$ and assuming that $x_i(t)$ and $y_i(t)$ are decoupled we can write \begin{eqnarray} \dot{x}_i(t)& = & \sum\limits_{j \in N_i}\sigma_{ji} (x_j(t) - x_i(t)) + b_i u_x\dlabel{x-1D}\\ \dot{y}_i(t)& = & \sum\limits_{j \in N_i}\sigma_{ji} (y_j(t) - y_i(t)) + b_i u_y\dlabel{y-1D} \end{eqnarray} and consider $x_i(t)$ and $y_i(t)$ separately, as one dimensional dynamics, (cf. Section \dref{Gen-1D}). \begin{equation}\label{bi} b_i = \begin{cases}1 ; \text{ if } i \in N^l \\ 0 ; \text{ otherwise} \end{cases} \end{equation} where $N^l$ is the set of leaders. In the piecewise constant case, when the time-line can be divided into intervals in which the system evolves as a linear time-independent dynamic system, (\dref{x-1D}) can be written in vector form as \begin{equation}\dlabel{x-1D-vec} \dot{x}( t )=-L_k\cdot x(t)+ B_k u_x(t_k) \end{equation} and similarly for (\dref{y-1D}), where \begin{itemize} \item $t \in [t_k \quad t_{k+1} )$ \item $t_k$ is a switching point, i.e. the time when either the visibility graph , the leaders or the exogenous control change \item $L_k$ is the Laplacian associated with the interactions graph $G_k$, either uniform or scaled, in the interval $[t_k \quad t_{k+1} )$ \item $B_k$ is a leaders indicator in the interval $[t_k \quad t_{k+1} )$ , i.e. a vector of dimension $n$ with $0$ entries in places corresponding to the followers and $1$ in those corresponding to the leaders \item $u_x(t_k)$ is the $x$ - component of the exogenous control $u$ in the interval $[t_k \quad t_{k+1} )$ \item $L_k, B_k, u_k $ are constant \end{itemize} The emergent behavior in the interval $t \in [t_k, t_{k+1})$ is a function of the corresponding properties of $L_k$. We show in the sequel that if the influence is uniform then the corresponding Laplacian is symmetric and its properties are independent of the topology of the graph but if the influence is scaled then the Laplacian corresponding to an incomplete graph is non-symmetric while the Laplacian corresponding to a complete graph is symmetric with the corresponding change in properties. In the sequel we treat each such interval separately, and thus it is convenient to suppress the subscript $k$. We first assume $G_k$ to be strongly connected for all $k$. In the second part of the report, we show scenarios and conditions for never losing friends, i.e. for $G_k \subseteq G_{k+1}; \quad \forall k$. We show that if $G_k$ is complete then bounding $|u_k|$ suffices to ensure that it remains complete. However, if $G_k$ is incomplete, the conditions are tightly related to the graph topology and could be derived only for specific cases. \textbf{\textit{Note}} that losing visibility to a neighbor does not necessarily mean losing connectivity. However, never losing neighbors ensures never losing connectivity. \msubsection{Literature survey and contribution}{survey} Many ways of controlling the collective behavior of self-organized multi-agent systems by means of one or more \textbf{special agents}, referred to as \emph{leaders} or \emph{shills}, have been investigated in recent years. We will be grouping the surveyed work in several broad categories and indicate the novelty of our model as compared to each. \begin{enumerate} \item \underline{Leaders that do not abide by the agreement protocol}\\ These leaders are pre-designated and their state value is fixed at a desired value. Jadbabaie et al. in \dcite{JLM} consider Vicsek's discrete model \dcite{VC95}, and introduce a leader that moves with a fixed heading . Tanner, Rahmani, Mesbahi and others in \dcite{Tanner}, \dcite{Rahmani}, \dcite{Rahmani2}, \dcite{RM2}, etc. consider static leaders (sometimes named "anchors") and show conditions on the topology that will ensure the controllability of the group. A system is controllable if for any initial state there exists a control input that transfers any initial state to any final state in finite time. Our model differs from the above in that the leaders are neither pre-designated nor static. The number of leaders and their identity is arbitrary. They do not ignore the agreement protocol, but rather add the received exogenous control to the computed local rule of motion and move accordingly. We do not require the system to reach a pre-defined final state. Our aim is to steer the swarm in a desired direction. We show the emergent dynamics for a desired velocity sent by a controller and received by random agents in the swarm. \item \underline{Leaders combining the consensus protocol with goal attraction}\\In \dcite{DGEH}, \dcite{GDEH09}, the exogenous control is a goal position, known only to the leaders. The dynamics of all agents, leaders or followers, is based on the consensus protocol. For leaders however, it includes an additional goal attraction term which aims at leading the team to the \textbf{pre-defined goal position}. The attraction term is a function of the leader's distance from the goal position, therefore varies from leader to leader. This approach is the closest to our model that we have found in the surveyed literature, but some major differences exist. In our model the exogenous control is not a goal position but a velocity vector, $u$, \textbf{common to all leaders}. Moreover, agents are not aware of their own position, but only of their relative position to their neighbors. We show that with our model, the agents, rather than gathering at a goal position, \emph{asymptotically align along a line in the direction of $u$ and move with identical speed}. \item \underline{Shills} - Intelligent agents with on-line state information of regular units. Han, Guo and Li, \dcite{HLG2006}, followed by Wang, \dcite{HW2013} introduced the notions of shill and soft control. Shills are special agents \textbf{added} to the swarm with the purpose of controlling the collective behavior. They are the exogenously controlled part of the system. The basic local rules of motion of the existing agents in the system are not changed. The existing agents treat the special agent as an ordinary agent, thus enabling it to "cheat" or "seduce" its neighbors towards the desired goals. These special agents are called "shills" \footnote{Shill is a decoy who acts as an enthusiastic customer in order to stimulate the participation of others}. As opposed to the above, in our work we study the emergent collective behavior when probabilistically selected agents, out of the existing agents, receive an exogenous control $u$. These agents become the ad-hoc leaders. The number of leaders is not predetermined, hence can be any number from $1$ to $n$. Also, we do not design $u$ in order to obtain some desired final state. Moreover, in our model the leaders do not have an entirely stand-alone control rule. All agents follow the same rule of motion, with the addition of the exogenous control, when received, i.e. while leaders. Leaders do not have on-line state information of other agents. The only available information, for leaders and all other agents, is relative position to neighbors. \item \underline{Broadcast control}\\ Recently Azuma, Yoshimura and Sugie \dcite{AYS2013} have proposed a broadcast control framework for multi-agent coordination, but in their model the control is assumed to be received by all units, i.e. there are \emph{no followers}. In this model the global controller observes the group performance, designs the information to be broadcast and sends a signal, received by all, to govern the group behavior. The agents set the local control, based on the received signal. As opposed to the above, in our model the broadcast control is the goal velocity vector, aiming to steer the swarm in some desired direction with desired speed. The detailed group performance is not directly observed by the controller, therefore the broadcast control does not depend on it. Moreover, not all units necessarily receive the broadcast control, but at least one does. \end{enumerate} \msubsection{Paper outline}{Outline} We derive the collective swarm behavior for piecewise constant systemד. We first treat each time interval separately, as a \emph{time-independent system } over an interval $[0,t)$. Section \dref{Gen-1D} presents the one dimensional case which is readily extended to two dimensions in Section \dref{LTI-dyn}. In Section \dref{SimEx} we show simulation results, illustrating the two dimensional swarm behavior over a single time interval. In Section \dref{MultiIntEx} we extend the investigation of one interval to multiple intervals, where new intervals are triggered by changes in the exogenous control, $u$, in leaders or in the visibility graph. We assume that $u$ and the leaders change randomly, but the visibility graph is state dependent, therefore, when the visibility is limited, the system may disconnect. In Section \dref{never-losing2} we derive conditions for a complete visibility graph to remain complete and in Section \dref{LimitedComplete-Ex} we illustrate the effect of the derived bounds. In Section \dref{LimitedIncomplete} we derive conditions for never losing friends, when the visibility graph is incomplete, and show that these depend on the exact, time-dependent, topology. We conclude in section \dref{future} with a short summary and directions for future research. \msec{One dimensional group dynamics}{Gen-1D} In this Section we consider a one dimensional piecewise constant system, (\dref{x-1D-vec}). In the sequel we threat each time interval, $[t_k \quad t_{k+1} )$, separately. Thus, it is convenient to suppress the subscript $k$. Moreover, it is convenient to denote by $t$ the relative time since the beginning of the interval ($t=0$) and by $x(0)$ the state of the system at this time. We then have (in each interval) \begin{equation}\dlabel{1D-vec} \dot{x}( t )=-L\cdot x(t)+ B u \end{equation} Eq. (\dref{1D-vec}) has the well known solution (ref. \dcite{TK}) \begin{equation}\dlabel{eq-pieceDyn} x(t) = e^{-L t} x(0) + \int_{0}^{t} e^{-L(t-\tau)} B u \mathrm{d}\tau \end{equation} Eq. (\dref{eq-pieceDyn}) can be rewritten as \begin{equation}\dlabel{eq-xdyn2} x(t) = x^{(h)}(t) + x^{(u)}(t) \end{equation} where \begin{itemize} \item $x^{(h)}(t)= e^{-L t} x(0)$ represents the zero input solution \item $x^{(u)}(t)=\int_{0}^{t} e^{-L (t-\tau)} B u \mathrm{d}\tau$ represents the contribution of the exogenous input to the group dynamics \end{itemize} \msubsection{Definitions}{Def} \begin{itemize} \item $G^U$ an undirected graph of uniform interactions, with vertices labeled $1,...,n$. \item ${{d}_{i}}$ the number of neighbors of vertex $i \in G^U$, i.e. the degree of $i$ \item $\Delta $ the degree matrix of the graph $G^U$, a diagonal matrix with elements $\Delta_{ii}={{d}_{i}}$, \item $A^U$ the adjacency matrix of $G^U$, a symmetric matrix with 0,1 elements, such that \begin{equation*} A^U_{ij} = \begin{cases} 1 & \text{if } i \sim{\ } j \\ 0 & \text{otherwise } \\ \end{cases} \end{equation*} \item $L^U = L(G^U)$ the Laplacian representing $G^U$, is defined by \begin{equation}\dlabel{def-Lu} L^U=\Delta -A^U \end{equation}\dlabel{Def-Gamma} \item $\Gamma$ the normalized Laplacian of $G^U$, is defined by \begin{equation}\dlabel{def-Gamma} \Gamma= \Delta^{-1/2} L^U \Delta^{-1/2} \end{equation} \item $G^S$ the directed graph of scaled interactions corresponding to $G^U$ \item $L^S=L(G^S)$ the Laplacian representing $G^S$ \begin{equation}\dlabel{def-Ls} L^S=\Delta^{-1} L^U \end{equation} \end{itemize} \emph{\underline{Note}} that Eq. (\dref{1D-vec}) and its general solution (\dref{eq-pieceDyn}) hold for both $L^U$ or $L^S$. In the following Sections, we develop explicit solutions for each case and investigate their properties. \msubsection{Zero input group dynamics }{ZeroInp} Denote by $L$ the Laplacian associated with the time-independent visibility graph, in the time interval. The zero input group dynamics is given by \begin{equation}\dlabel{eq-agree} \dot{x}^{(h)}( t )=-L\cdot x^{(h)}(t) \end{equation} We will show that for both $L=L^U$ and $L=L^S$, representing Laplacians of connected graphs and strongly connected digraphs respectively, the solution of eq. (\dref{eq-agree}) converges asymptotically to a consensus state, namely $x^{(h)}_i=x^{(h)}_j=\alpha; \forall i,j, i\neq j$ (cf. Proposition 2 in \dcite{OS-M2003}).\\ Since we consider each interval separately and $t$ is the time elapsed from the beginning of the interval, by "asymptotic state" we mean here the value of the state for large $t$. The value of the consensus state $\alpha$, in each interval, is obtained by explicitly calculating $exp(-Lt)$, for large $t$, as described below. \subsubsection{Uniform influence - Symmetric Laplacian $L^U$} \LB{L-uniConverge} The value of the consensus state for an undirected, connected, interactions graph with corresponding Laplacian, $L^U$, is the average of the initial states. \LE {\em Proof:\/\ }\cmd{ PB} \\ Using the properties of $L^U$ (cf. Appendix \dref{Graphs}), namely that: \begin{itemize} \item $L^U$ is a real symmetric positive semi-definite matrix \item all the eigenvalues of $L^U$, denoted by $\lambda^U_i$ are real and non-negative. \item if $G^U$ is connected then there is a single zero eigenvalue, denoted by $\lambda^U_1$ and the remaining eigenvalues are strictly positive. \item we can always select $n$ real orthonormal eigenvectors of $L^U$, denoted by $V^U_i$, where $V^U_i$ is the (right) eigenvector corresponding to eigenvalue $\lambda^U_i$ (cf. Theorem \dref{T-properties}d). \item the normalized eigenvector corresponding to $\lambda^U_{1}=0$ is ${V^U_{1}}\text{=}\frac{1}{\sqrt{n}}\mathbf{1}_n$. \end{itemize} it follows that $L^U$ can be diagonalized, with \begin{equation*} L^U=V^U\Lambda^U {V^U}^T \end{equation*} where $V^U$ is the matrix of (right) orthonormal real eigenvectors of $L^U$ and $\Lambda^U$ is the diagonal matrix of eigenvalues of $L^U$ (see Appendix \dref{App-decomp}). Therefore we have \begin{eqnarray*} e^{-L^U \cdot t}&=&e^{-\left( V^U \Lambda^U (V^U)^T \right) t} \\& =& V^U e^{-\Lambda^U t} (V^U)^T=e^{-\lambda^U_1 t}V^U_1 (V^U)_1^T+e^{-\lambda^U_2 t}V^U_2 (V^U_2)^T+.......+e^{-\lambda^U_n t} V^U_n (V^U_n)^T \end{eqnarray*} Since ${V^U_{1}}\text{=}\frac{1}{\sqrt{n}}\mathbf{1}_n$ we can write: \begin{equation*} x^{(h)}(t)= e^{-L t}x(0) )=\frac{1}{n}{{\mathbf{1}_n}^{T}}x(0)\mathbf{1}_n + \sum_{i=2}^n e^{-\lambda^U_i t}((V^U_i)^T x(0)) V^U_i \end{equation*} or \begin{equation}\dlabel{eq-xh} x^{(h)}(t)=\alpha \mathbf{1}_n + \sum_{i=2}^n e^{-\lambda^U_i t}((V^U_i)^T x(0)) V^U_i \end{equation} Since $\lambda^U_i>0$ forall $i>1$ we have \begin{equation}\dlabel{eq-x1} x^{(h)}_\infty=\underset{t\to \infty }{\mathop{\lim }}\,x^{(h)}(t)=\frac{1}{n}{{\mathbf{1}_n}^{T}}x(0)\mathbf{1}_n=\alpha \mathbf{1}_n \end{equation} with \ \begin{equation}\dlabel{eq-alphaG} \alpha =\frac{1}{n}\sum_{i=1}^n x_i(0) \end{equation} the \emph{average of the initial states}. {\hfill $\Box$}{\cmd{PE}} \subsubsection{Scaled influence} Let $G^S$ be a strongly connected interactions (visibility) graph with scaled influences corresponding to $G^U$. Then the Laplacian $L^S$ has the following properties (cf. Appendix \dref{ScaledGraph}). \begin{itemize} \item The eigenvalues of $L^S$ are also the eigenvalues of $\Gamma$, the normalized Laplacian of $G^U$, a real symmetric matrix, as defined in section \dref{Def}, equation (\dref{Def-Gamma}) \item All eigenvalues of $L^S$, denoted by $\lambda^S_i$, are real and non-negative \item There is a single zero eigenvalue, $\lambda^S_1=0$, and all remaining eigenvalues are strictly positive \item The eigenvectors of $L^S$ relate to the the eigenvectors of the real symmetric matrix $\Gamma$ by: \begin{equation*} V_i^S=\Delta^{-1/2} V_i^\Gamma \end{equation*} where $V_i^S$ and $V_i^\Gamma$ correspond to the eigenvalue $\lambda_i^S=\lambda_i^\Gamma$ and $\Delta$ is the degree matrix associated with the undirected graph $G^U$ \item Since $\Gamma$ is real and symmetric, one can select $V_i^\Gamma$, for all $i$, s.t $V^\Gamma$ is real and orthonormal, where $V_i^\Gamma$ is the $i'th$ column of $V^\Gamma$ (cf. Theorem \dref{T-properties}d). Since $\Delta$ is real and invertible it follows that the corresponding $V^S$ is a matrix of normalized real right eigenvectors of $L^S$ \item $V_1^S$ corresponding to $\lambda^S_1=0$ is $\displaystyle \frac{1}{\sqrt{n}}\mathbf{1}_n$ \item $L^S$ is diagonizable, thus it can be written as \begin{equation*} L^S=V^S \Lambda^S (V^S)^{-1} \end{equation*} where $\Lambda^S $ is a diagonal matrix, s.t. $\Lambda^S_{ii}=\lambda^S_i $ and $V^S$ is the matrix of normalized real right eigenvectors of $L^S$ \item If we denote $(V^S)^{-1}$ by $(W^S)^T$, i.e. $(W^S)^T=(V^S)^{-1}$, then \begin{itemize} \item Each row of $(W^S)^T$ is a left eigenvector of $L^S$ \item The first row of $(W^S)^T$, denoted by $(W^S_1)^T$, is a left eigenvector of $L^S$ corresponding to $\lambda_1^S=0$ satisfying $(W^S_1)^T V^S_1=1$, where $V^S_1$ is the normalized right eigenvector corresponding to $\lambda_1^S=0$ \end{itemize} \item According to Theorem \dref{T-WsT1} in Appendix \dref{ScaledGraph} \begin{equation}\dlabel{eq-Ws1T} (W^S_1)^T= \frac{\sqrt{n} \cdot \mathbf{d}^T}{\sum_{i=1}^n d_i} \end{equation} where $\mathbf{d}$ is a vector of degrees in the graph $G^U$, $\mathbf{d}_i=d_i$, and $d_i$ is the degree of vertex $i$ in $G^U$. \end{itemize} \LB{L-scaledConverge} The value of the \emph{asymptotic consensus state} $\alpha$ for a strongly connected digraph $G^S$ representing scaled influences, is in the convex hull of the initial states $x(0)$ and is given by \begin{equation*} \alpha= \frac{ \mathbf{d}^T x(0)}{\sum_{i=1}^n d_i} \end{equation*} where $\mathbf{d}$ is the vector of degrees in the undirected graph $G^U$ corresponding to $G^S$. \LE {\em Proof:\/\ }\cmd{ PB} We have \begin{equation*} L^S=V^S \Lambda^S (W^S)^T \end{equation*} where $(W^S)^T=(V^S)^{-1}$ Thus \begin{eqnarray*} x^{(h)}(t)&=&e^{-L^S t} x(0)\\ & = & e^{-\lambda^S_1 t}(W^S_1)^{T}x(0)V^S_1+e^{-\lambda^S _2t}(W^S_2)^T x(0) V^S_2+.......+e^{-\lambda^S_n t}(W^S_n)^{T} x(0)V^S_n\\ & = & (W^S_1)^{T}x(0)V^S_1 + \sum_{i=2}^N e^{-\lambda^S_i t}(W^S_i)^{T}x(0)V^S_i\\ & = & \frac{ \mathbf{d}^T x(0)}{\sum_{i=1}^n d_i} \mathbf{1}_n+ \sum_{i=2}^N e^{-\lambda^S_i t}(W^S_i)^{T}x(0)V^S_i \end{eqnarray*} where we used \begin{itemize} \item $\lambda^S_1=0$ \item $\displaystyle V^S_1 = \frac{1}{\sqrt{n}}\mathbf{1}_n$ \item $(W^S_1)^T$ from eq. (\dref{eq-Ws1T}) \end{itemize} Since $ \lambda^S_i>0 \quad \forall i\geq 2$ we have for $t \rightarrow \infty$ \begin{equation}\dlabel{eq-x1s} x^{(h)}_\infty=\underset{t\to \infty }{\mathop{\lim }}\,x^{(h)}(t)=\frac{ \mathbf{d}^T x(0)}{\sum_{i=1}^n d_i} \mathbf{1}_n =\alpha \mathbf{1}_n \end{equation} Thus, $\displaystyle \alpha= \frac{ \mathbf{d}^T x(0)}{\sum_{i=1}^n d_i}$ is the asymptotic consensus value for dynamics with scaled influences and no external input. {\hfill $\Box$}{\cmd{PE}} Lemma \dref{L-scaledConverge} holds for any visibility graph, $G^U$. If we let the graph be complete, then we have $d_i=n-1; \quad i=1,..,n$ and thus $\displaystyle \alpha= \frac{ 1}{n} {\sum_{i=1}^n x(0)}$, i.e. the asymptotic consensus value, for complete graphs with scaled influence, is the average of the initial states. The above results can be summarized by the following theorem: \TB{T-ConsensusValue} The value of the \emph{asymptotic consensus state}, $\alpha$, of $n$ agents with a connected visibility (interactions) graph is \begin{alphlist} \titem{a} the average of the initial states if the influence is uniform or if the influence is scaled and the visibility graph is complete. \titem{b} the weighted average of the initial states, $\displaystyle \alpha= \frac{ \mathbf{d}^T x(0)}{\sum_{i=1}^n d_i}$, if the influence is scaled and the visibility graph is incomplete, where \begin{itemize} \item $d_i$ is the degree of vertex $i$ in $G^U$ \item $\mathbf{d}^T$ is the vector of degrees in $G^U$, i.e. $\mathbf{d}^T=(d_1 d_2 ....d_n)$ \end{itemize} \end{alphlist} \TE \msubsection{Input induced group dynamics}{MoveAgreement} Next, consider the general form of the input-related part of the group dynamics, $x^{(u)}(t)$, given by eq. (\dref{gen-xu}), where $L, B$ and $u$ are constant in the time interval $[0,t]$. \begin{equation}\dlabel{gen-xu} x^{(u)}(t)= \int_{0}^t e^{-L(t-\tau)}B u d\tau = \int_0^{t} e^{-L\nu}B u d\nu \end{equation} Eq. (\dref{gen-xu}) holds for both the uniform and the scaled influence, i.e $L=L^U$ or $L=L^S$. \begin{itemize} \item For the \textbf{uniform influence case}, since $L^U$ is symmetric we can use again the Spectral theorem and decompose (\dref{gen-xu}) into \begin{equation}\dlabel{Sym-xu} x^{(u)}(t)= \sum_{i=1}^n\left [ \int_0^{t} e^{-\lambda^U_i \nu}V^U_i (V^U_i)^T d\nu \right ] B u \end{equation} \item For \textbf{any} visibility graph with \textbf{scaled influence }, using the properties of $L^S$, we can write \begin{equation}\dlabel{Scaled-xu} x^{(u)}(t)= \sum_{i=1}^n \left [ \int_0^t e^{-\lambda^S_i \nu}V^S_i (W^S_i)^T d\nu \right ] B u \end{equation} \end{itemize} Since for both $L^U$ and $L^S$, representing connected graphs, there is a single zero eigenvalue and the remaining eigenvalues are positive, we can decompose $x^{(u)}(t)$ in two parts: \begin{equation} x^{(u)}(t)= x^{(a)}(t)+ x^{(b)}(t) \end{equation}\dlabel{eq-xu} where \begin{itemize} \item $x^{(a)}(t)$ is the zero eigenvalue dependent term, representing the movement in the agreement space \item $x^{(b)}(t)$ is the remainder, representing the deviation from the agreement space \end{itemize} \subsubsection{Movement along the agreement subspace } \paragraph{The uniform case}\mbox{} We have \begin{equation}\dlabel{Uni-xua} x^{(a)}(t) = \int_0^t e^{-\lambda^U _1 \nu} \text{} V^U_1 (V^U_1)^T B u d\nu = V^U_1 (V^U_1)^T B u t = \frac{n_l}{n} \text{} u \text{} t\mathbf{1}_n \end{equation} where $n_l$ is the number of leaders and we have used $V^U_1=\frac{1}{\sqrt{n}} \mathbf{1}$ and $\mathbf{1}^T B=n_l$. Therefore: \LB{L-firstSym} Consider a group of $n$ agents, forming a connected interactions graph, and moving according to (\dref{x-1D}) with uniform influences. If there are $n_l$ agents that receive an exogenous velocity control $u$, the entire group will move collectively with a velocity $\displaystyle \frac{n_l}{n} u $. \LE \paragraph{Scaled case}\mbox{} For the scaled case we have \begin{equation}\dlabel{Scaled-xua} x^{(a)}(t) = \int_0^t e^{-\lambda^S _1 \nu} \text{} V^S_1 (W^S_1)^T B u d\nu = V^S_1 (W^S_1)^T B u t = \frac{\sum_{i \in N^l} d_i}{\sum_{i=1}^n d_i}\text{} u \text{} t \text{} \mathbf{1}_n \end{equation} Substituting in (\dref{Scaled-xua}) $V^S_1= \displaystyle \frac{1}{\sqrt{n}} \mathbf{1}_n$ and $(W^S_1)^T$ from (\dref{eq-Ws1T}) we obtain \begin{equation}\dlabel{Scaled-beta} x^{(a)}(t) = \frac{\sum_{i \in N^l} d_i}{\sum_{i=1}^n d_i} \text{} u \text{} t \text{} \mathbf{1}_n \end{equation} \LB{L-firstScaled} Consider a group of $n$ agents, forming a strongly connected interactions graph with scaled influences, with some of the agents being leaders, i.e. detecting the exogenous velocity control $u$. If each agent moves according to (\dref{x-1D}) then the entire group will move collectively with a velocity $\displaystyle \frac{\sum_{i \in N^l} d_i}{\sum_{i=1}^n d_i} u$, where $N^l$ is the set of leaders and $d_i$ is the number of edges entering $i$. \LE We see from (\dref{Scaled-beta}) that if the the influences are scaled and \begin{enumerate} \item the visibility graph is complete then the collective velocity of the group reduces to $\displaystyle \frac{n_l}{n} u $, same as for the uniform case. \item the visibility graph is incomplete then the collective velocity of the group is a function not only of the number of leaders but also of the number of links connecting the leaders to followers \end{enumerate} \textbf{\textsf{Example}}: We illustrate the impact of leader selection on the collective velocity, when the visibility graph is incomplete and scaled influence is used, by considering the two configurations shown in Fig. \dref{ChangeLeader}, with identical $G^U$, but different leader. \begin{figure} \begin{center} \includegraphics[scale=0.5]{ChangeLeader.jpg} \caption{Same $G^u$ with different leader }\dlabel{ChangeLeader} \end{center} \end{figure} Based on Lemma \dref{L-firstScaled}, when agent 5 is the leader the group will move with velocity $\displaystyle \frac{1}{12} u$, while when the leader is agent 3 the collective velocity increases to $\displaystyle \frac{1}{4} u$. Note that when uniform influence is employed, the collective velocity depends only on the \emph{number of leaders}. Thus, in both above configurations, the collective velocity is $\displaystyle \frac{1}{5} u$ \subsubsection{Deviations from the agreement subspace }\label{DevProp} Consider now the remainder $x^{(b)}(t)$ of the input-related part, i.e. the part of $x^{(u)}(t)$ containing all eigenvalues of $L$ other than the zero eigenvalue and representing the agents' state deviation from the agreement subspace. The geometric meaning of deviations is elaborated in section \dref{Dev-mean}. In the sequel we will need the following definitions: \begin{definition}Two agents $i,j$ in a network $G$ are said to be \emph{equivalent} if there exists a Leaders-Followers Preserving Permutation $\Pi$ such that $\Pi(i) = j$,$\Pi(j) = i$ and $\Pi(G) = G$ \end{definition} \begin{definition} A Leaders-Followers Preserving Permutation $\Pi$ is a permutation of agents labeling such that $\Pi(leader)$ is a leader and $\Pi(follower)$ is a follower for all leaders and followers. \end{definition} \paragraph{Uniform case}\mbox{} We have \begin{equation*} x^{(b)}(t)= \left [ \sum_{i=2}^n \int_0^t \left (e^{-\lambda^U _i \cdot \nu} \right ) V^U_i (V^U_i)^T d\nu \right ] B u \end{equation*} Thus \begin{equation}\dlabel{Uni-xub} x^{(b)}(t)= \left[ \sum_{i=2}^n \frac{1}{\lambda^U_i}(1-e^{-\lambda^U_i t})V^U_i (V^U_i)^T \right ] B u \end{equation} Since all eigenvalues $\lambda^U_i \text{ for } i \geq 2$ are strictly positive, $x^{(b)}(t)$ converges asymptotically to a time independent vector, denoted by $\varrho$, given by: \begin{equation}\dlabel{Uni-Delta} \varrho = \left[ \sum_{i=2}^n \frac{1}{\lambda^U_i}V^U_i (V^U_i)^T \right ] B u \end{equation} The quantity $\varrho$ represents the vector of asymptotic deviations of the agents from the agreement subspace. \TB{T-DevSum} The asymptotic deviations of all agents, with uniform interactions, sum to zero \begin{equation}\dlabel{eq-sumb} \sum_{i=1}^n \varrho_i = 0 \end{equation} where $\varrho_i$ is the deviation of agent $i$. \TE {\em Proof:\/\ }\cmd{ PB} Consider eq. (\dref{1D-vec}) with $L=L^U$ and multiply it from the left by $\textbf{1}^T$. Recalling that $L^U$ has a left eigenvector $\textbf{1}^T$ corresponding to $\lambda^U_1=0$, we obtain \begin{equation*} \sum_{i=1}^n \dot{x}_i(t) = n_l u \end{equation*} and thus, for all $t$ \begin{equation}\dlabel{eq-sumt} \sum_{i=1}^n x_i(t) = n_l u t + \sum_{i=1}^n x_i(0) \end{equation} On the other hand, recalling that \begin{equation}\dlabel{eq-xt} x(t)= x^{(h)}(t)+ x^{(a)}(t) + x^{(b)}(t) \end{equation} multiplying (\dref{eq-xt}) from the left by $\mathbf{1}_n^T$ and letting $t\rightarrow \infty$, we have: \begin{equation}\dlabel{eq-sumtt} \sum_{i=1}^n x_i(t \rightarrow \infty) = n \alpha + n_l u t + \sum_{i=1}^n \varrho_i \end{equation} Substituting for $\alpha$ its value from eq. (\dref{eq-alphaG}) and comparing equations (\dref{eq-sumt}) and (\dref{eq-sumtt}) we obtain the required result (\dref{eq-sumb}). {\hfill $\Box$}{\cmd{PE}} In general, agents have non-equal deviations, but there are some special cases, detailed in Theorem \dref{T-SpecialDevUni}. \TB{T-SpecialDevUni} \begin{alphlist} \titem{a} Equivalent agents have the same deviation \titem{b} In a fully connected network, all followers have the same asymptotic deviation and all leaders have the same asymptotic deviation, with opposite sign to followers' deviation. \titem{c} If all agents are leaders, i.e. $n_l=n$, then all asymptotic deviations are zero, i.e. $\varrho_i=0, \text{ } \forall i$ \end{alphlist} \TE {\em Proof:\/\ }\cmd{ PB} \\ \tref{a} Equivalent agents follow the same equation, therefore have the same deviation.\\ \tref{b} In a fully connected network, all followers are equivalent to each other and all leaders are equivalent to each other. Thus all followers have the same asymptotic deviation and all leaders have the same asymptotic deviation (different from the followers). Since the sum of all asymptotic deviations is zero, eq. (\dref{eq-sumb}), the deviations of the followers and of the leaders have opposite signs.\\ \tref{c} If $n_l=n$, then $B=\mathbf{1}_n$. Since $V^U_k$ is an eigenvector of the Laplacian $L^U$ with eigenvalue $\lambda^U_k$, we have $L^U V^U_k = \lambda^U_k V^U_k$ or \begin{equation}\label{eq-Vuk} V^U_k = \frac {1}{\lambda^U_k}L^U V^U_k \end{equation} Substituting (\dref{eq-Vuk}) in equation (\dref{Uni-Delta}) we obtain: \begin{equation*} \varrho = \left( \sum_{k=2}^n \frac{1}{(\lambda^U_k)^3} (L^U V^U_k) ((V^U_k)^T (L^U)^T) \right) \mathbf{1}_n u = \mathbf {0}_n \end{equation*} since $(L^U)^T \mathbf{1}_n = \mathbf {0}_n$. {\hfill $\Box$}{\cmd{PE}} \paragraph{Scaled case}\mbox{}\\ Following the same procedure as above, with the corresponding decomposition of $L=L^S$, we obtain the following expression for $x^{(b)}(t)$, in the scaled case: \begin{equation}\dlabel{eq-xbtScaled} x^{(b)}(t)= \left[ \sum_{i=2}^n \frac{1}{\lambda^S_i}(1-e^{-\lambda^S_i t} ) V^S_i (W^S_i)^T \right ] B u \end{equation} and since $\lambda^S_i; \quad i \geq 2$ are positive \begin{equation}\label{eq-devScaled} \varrho=\underset{t\to \infty }{\mathop{\lim }}\,x^{(b)}(t)=\left [ \sum_{i=2}^n \frac{1}{\lambda^S_i} V^S_i (W^S_i)^T \right ] B u \end{equation} Thus, here again $x^{(b)}(t)$, converges asymptotically to a time-independent vector, $\varrho$, given by (\dref{eq-devScaled}) and representing asymptotic deviations from the agreement subspace. \TB{T-DevSumScaled} The \textbf{weighted sum} of the asymptotic deviations of all agents, with scaled pair-wise interactions, is zero \begin{equation}\dlabel{eq-sumbs} \sum_{i=1}^n d_i \varrho_i = 0 \end{equation} where $\varrho_i$ is the deviation of agent $i$ and $d_i$ is the number of edges entering $i$. \TE {\em Proof:\/\ }\cmd{ PB} Multiplying eq. (\dref{1D-vec}), where $L=L^S$, from the left by $(W^S_1)^T$ and integrating, we obtain \emph{for any $t$} \begin{equation}\dlabel{eq-xtScaled} \mathbf{d}^T \cdot x(t) = \mathbf{d}^T \cdot B u t +\mathbf{d}^T \cdot x(0) \end{equation} where $\mathbf{d}$ is the vector of degrees in the corresponding $G^U$ and we used \begin{itemize} \item $(W^S_1)^T L^S = \mathbf{0}_n^T$ \item $\displaystyle (W^S_1)^T=\frac{\sqrt{n} \mathbf{d}^T}{\sum_{i=1}^{n} d_i}$ \end{itemize} Considering now $t \rightarrow \infty$, we can write $x(t \to \infty)$ from eq. (\dref{eq-xt}) as \begin{equation}\label{xt-inf} x(t \to \infty) = \frac{\mathbf{d}^T x(0)}{\sum_{i=1}^{n} d_i} \mathbf{1}_n + \frac{\sum_{i \in N^l} d_i}{\sum_{i=1}^n d_i} u t \mathbf{1}_n + \varrho \end{equation} where we used Lemma \dref{L-scaledConverge} and Lemma \dref{L-firstScaled}.\\ Multiplying (\dref{xt-inf}) from the left by $\mathbf{d}^T$ we obtain \begin{equation}\label{xt-inf2} \begin{split} \mathbf{d}^T \cdot x(t) & = \frac{\mathbf{d}^T x(0)}{\sum_{i=1}^{n} d_i} \sum_{i=1}^{n} d_i + \frac{\sum_{i \in N^l} d_i}{\sum_{i=1}^n d_i} u t \sum_{i=1}^{n} d_i + \mathbf{d}^T \cdot \varrho \\ & = \mathbf{d}^T x(0) + \sum_{i \in N^l} d_i u t + \mathbf{d}^T \cdot \varrho\\ & = \mathbf{d}^T \cdot x(0) + \mathbf{d}^T \cdot B u t + \mathbf{d}^T \cdot \varrho \end{split} \end{equation} Comparing now (\dref{xt-inf2}) with (\dref{eq-xtScaled}) for $t\to\infty$ we immediately obtain the required result (\dref{eq-sumbs}). {\hfill $\Box$}{\cmd{PE}} Theorem \dref{T-DevPropertiesScaled} shows properties of the asymptotic deviations of agents with scaled influences in some special cases. These properties for scaled influences are identical to the corresponding ones for uniform influence. \TB{T-DevPropertiesScaled} $n$ agents with scaled interaction, out of which $n_l$ agents are leaders, satisfy the following: \begin{alphlist} \titem{a} All equivalent agents have the same asymptotic deviation \titem{b} In a fully connected network all followers have the same asymptotic deviation and all leaders have the same asymptotic deviation, with opposite sign to followers' deviation. \titem{c} If all agents are leaders, i.e. $n_l=n$, then $\varrho_i=0, \text{ } \forall i$ \end{alphlist} \TE {\em Proof:\/\ }\cmd{ PB} \\ \tref{a} Equivalent agents follow the same equation, therefore have the same deviation.\\ \tref{b} In a fully connected network, with scaled influences, \begin{itemize} \item $d_i=n-1; \quad \forall i$, thus substituting in (\dref{eq-sumbs}) we obtain $\displaystyle \sum_{i=1}^n \varrho_i=0$ \item all leaders are equivalent and all followers are equivalent, thus all leaders have the same asymptotic deviation, $\varrho_l$, and all followers have the same asymptotic deviation, $\varrho_f$ \end{itemize} Thus \begin{equation*} n_l \varrho_l + n_f \varrho_f = 0 \end{equation*} Thus, $sign(\varrho_l) = - sign(\varrho_f)$ \\ \tref{c} If $n_l=n$, then $B=\mathbf{1}_n$. Since $V^S_k$ is a right eigenvector of the Laplacian $L^S$ with eigenvalue $\lambda^S_k$ and $(W^S_k)^T$ is a left eigenvector with the same eigenvalue, we have \begin{itemize} \item $\displaystyle V^S_k = \frac {1}{\lambda^S_k}L V^S_k$ \item $\displaystyle (W^S_k)^T = \frac {1}{\lambda^S_k} (W^S_k)^T L^S$ \end{itemize} Substituting in equation (\dref{eq-devScaled}) we obtain: \begin{equation*} \varrho = \left( \sum_{k=2}^n \frac{1}{(\lambda^S_k)^3} (L^S V^S_k) ((W^S_k)^T L^S) \right) \mathbf{1}_n u = \mathbf {0}_n \end{equation*} since $L^S\mathbf{1}_n = \mathbf {0}_n$.\\ {\hfill $\Box$}{\cmd{PE}} \paragraph{Illustration of asymptotic deviations for various cases}\mbox{} In this section we illustrate by a few examples the impact of the influence model as well as of the equivalence on the obtained deviations. Due to the construction of the interaction graph with scaled influence, $G^S$, out of the the interaction graph with uniform influence, $G^U$, equivalent nodes in $G^U$ are also equivalent in $G^S$. Consider the graphs in Fig. \dref{fig-NewExamples}. \begin{figure} \begin{center} \includegraphics[scale=0.6]{NewExamples.jpg} \caption{Several Networks (Leaders are squares)}\label{fig-NewExamples} \end{center} \end{figure} Denote by $A^U$ the adjacency matrix corresponding to $G^U$ and by $A^S$ the adjacency matrix corresponding to $G^S$. Then the adjacency matrices for each interactions graph depicted in Fig. \dref{fig-NewExamples}, uniform or scaled, are: \newpage \begin{description} \item[(a)] \begin{multicols}{2} \begin{equation*} A^U=\left [ \begin{matrix} 0 & 1 & 0 & 0 & 1\\ 1 & 0 & 1 & 0 & 0\\ 0 & 1 & 0 & 0 & 1\\ 0 & 0 & 0 & 0 & 1\\ 1 & 0 & 1 & 1 & 0 \end{matrix} \right ] \end{equation*} \begin{equation*} A^S=\left [ \begin{matrix} 0 & \frac{1}{2} & 0 & 0 & \frac{1}{2}\\ \frac{1}{2} & 0 & \frac{1}{2} & 0 & 0\\ 0 & \frac{1}{2} & 0 & 0 & \frac{1}{2}\\ 0 & 0 & 0 & 0 & 1\\ \frac{1}{3} & 0 & \frac{1}{3} & \frac{1}{3} & 0 \end{matrix} \right ] \end{equation*} \end{multicols} \item[(b)] \begin{multicols}{2} \begin{equation*} A^U=\left [ \begin{matrix} 0 & 1 & 0 & 0 & 0\\ 1 & 0 & 0 & 1 & 1\\ 0 & 0 & 0 & 1 & 1\\ 0 & 1 & 1 & 0 & 0\\ 0 & 1 & 1 & 0 & 0 \end{matrix} \right ] \end{equation*} \begin{equation*} A^S=\left [ \begin{matrix} 0 & 1 & 0 & 0 & 0\\ \frac{1}{3} & 0 & 0 & \frac{1}{3} & \frac{1}{3}\\ 0 & 0 & 0 & \frac{1}{2} & \frac{1}{2}\\ 0 & \frac{1}{2} & \frac{1}{2} & 0 & 0\\ 0 & \frac{1}{2} & \frac{1}{2} & 0 & 0 \end{matrix} \right ] \end{equation*} \end{multicols} \item[(c)] \begin{multicols}{2} \begin{equation*} A^U=\left [ \begin{matrix} 0 & 1 & 1 & 1 & 1\\ 1 & 0 & 1 & 1 & 1\\ 1 & 1 & 0 & 1 & 1\\ 1 & 1 & 1 & 0 & 1\\ 1 & 1 & 1 & 1 & 0 \end{matrix} \right ] \end{equation*} \begin{equation*} A^S=\left [ \begin{matrix} 0 & 0.25 & 0.25 & 0.25 & 0.25\\ 0.25 & 0 & 0.25 & 0.25 & 0.25\\ 0.25 & 0.25 & 0 & 0.25 & 0.25\\ 0.25 & 0.25 & 0.25 & 0 & 0.25\\ 0.25 & 0.25 & 0.25 & 0.25 & 0 \end{matrix} \right ] \end{equation*} \end{multicols} \end{description} Denoting now by $\varrho^U$ the deviations vector for the uniform case, by $\varrho^S$ the deviations vector for the scaled case and using the input $u =1$ in all examples we obtain: \begin{description} \item[(a)] Node 5 is the leader, nodes 1 and 3 are equivalent, the others have no equivalents. \begin{multicols}{2} \begin{equation*} \varrho^U=\left [ \begin{matrix} -0.06\\ -0.16\\ -0.06\\ 0.04\\ 0.24 \end{matrix} \right ] \end{equation*} \begin{equation*} \varrho^S=\left [ \begin{matrix} -0.2526\\ -0.5142\\ -0.2526\\ 0.2952\\ 0.5812 \end{matrix} \right ] \end{equation*} \end{multicols} We see in this example that \begin{itemize} \item In both cases, uniform and scaled influence, the asymptotic deviations of the equivalent agents' 1 and 3, are identical \item $\displaystyle \sum_{i=1}^n \varrho^U_i = 0$ \item $\displaystyle \sum_{i=1}^n \varrho^S_i \neq 0$ \item $\displaystyle \sum_{i=1}^n d_i \varrho^S_i = 0$ where $d_i$ is the $i'th$ element of $\mathbf{d}^T=[2 \quad 2\quad 2 \quad 1 \quad 3]$ \end{itemize} \item[(b)] The leaders, nodes 4 and 5 are equivalent, the others have no equivalent \begin{multicols}{2} \begin{equation*} \varrho^U=\left [ \begin{matrix} -0.5200\\ -0.1200\\ 0.0800\\ 0.2800\\ 0.2800 \end{matrix} \right ] \end{equation*} \begin{equation*} \varrho^S=\left [ \begin{matrix} -0.6857\\ -0.3368\\ 0.0284\\ 0.4098\\ 0.4098 \end{matrix} \right ] \end{equation*} \end{multicols} In this example again \begin{itemize} \item In both cases, uniform and scaled influence, the asymptotic deviations of the equivalent agents' 4 and 5, are identical \item $\displaystyle \sum_{i=1}^n \varrho^U_i = 0$ \item $\displaystyle \sum_{i=1}^n \varrho^S_i \neq 0$ \item $\displaystyle \sum_{i=1}^n d_i \varrho^S_i = 0$ where $d_i$ is the $i'th$ element of $\mathbf{d}^T=[1 \quad 3 \quad 2 \quad 2 \quad 2]$ \end{itemize} \item[(c)] Nodes 4 and 5 are leaders. Clearly they are equivalent, and so are nodes 1, 2, 3. \begin{multicols}{2} \begin{equation*} \varrho^U=\left [ \begin{matrix} -0.0800\\ -0.0800\\ -0.0800\\ 0.1200\\ 0.1200 \end{matrix} \right ] \end{equation*} \begin{equation*} \varrho^S=\left [ \begin{matrix} -0.3200\\ -0.3200\\ -0.3200\\ 0.4800\\ 0.4800 \end{matrix} \right ] \end{equation*} \end{multicols} In this example, as before: \begin{itemize} \item equivalent nodes have identical deviations, for both uniform and scaled influences \item $\displaystyle \sum_{i=1}^n \varrho^U_i = 0$, \end{itemize} but also $\displaystyle \sum_{i=1}^n \varrho^S_i = 0$. This is due to the completeness of the graph, as stated in Theorem \dref{T-DevPropertiesScaled}. Moreover, we note that in this example, where the visibility graph is complete, the dispersion of agents along the alignment line, i.e. the distance between the position of leaders to the position of followers, is 4 times larger in the scaled case than in the uniform case. This is due to the following holding \textbf{for complete graphs}; \begin{itemize} \item $\lambda^U_i=n; \quad i=2,....,n$ and thus $\displaystyle \varrho^U = \frac{1}{n}\left [ \sum_{i=2}^n V^U_i (V^U_i)^T \right ] B u$ \item $\displaystyle \lambda^S_i=\frac{n}{n-1}; \quad i=2,....,n$; and thus $\displaystyle \varrho^S=\frac{n-1}{n}\left [ \sum_{i=2}^n V^S_i (W^S_i)^T \right ] B u$.\\ Since $V^S=V^U$ and $(V^S_i)^T=(W^S_i)^T$ we obtain, when the same $u$ is used in both cases, \textbf{$ \varrho^S =(n-1) \varrho^U $} \end{itemize} \end{description} \msec{Two dimensional group dynamics }{LTI-dyn} In this section we derive the asymptotic dynamics of a two-dimensional group of agents, in a time interval $[0,t)$, where the system is time independent and the visibility graph is connected. Denote by $p_i = (x_i,y_i)^T $ the position of agent $i$ at time $t$. Let $x(t)$ denote the $n$-dimensional vector $x(t) = (x_1(t) ... x_n(t))^T$ and similarly for $y(t)$. Let $p(t)$ be the $2n$-dimensional vector $(x^T(t)\quad y^T(t))^T$. Assuming that the two dimensions are decoupled, Eq. (\dref{1D-vec}) holds for each component and thus: \iffalse \begin{equation}\dlabel{eq-dynamics3} \dot{p}( t )=-(I_2 \otimes L ) p(t)+ (I_2 \otimes B) u \end{equation} where \begin{itemize} \item $\otimes$ is the Kronecker product. The Kronecker product of a $p \times q$ matrix $P$ with an $r \times s$ matrix $Q$ is defined as \begin{equation}\label{def-kron} P \otimes Q = \left[ \begin{matrix} P_{11}Q & P_{12}Q & \cdots & P_{1q}Q \\ P_{21}Q & P_{22}Q & \cdots & P_{2q}Q \\ \vdots & \vdots & \cdots & \vdots \\ P_{p1}Q & P_{p2}Q & \cdots & P_{pq}Q\\ \end{matrix} \right] \end{equation} \item $I_2$ is the $2 \times 2$ identity matrix \item $L$ is the Laplacian of the interactions graph, $L=L^U$ for uniform interactions or $L=L^S$ for scaled interactions. \item $B$ is a vector indicating the leaders, i.e. $B_i=1$ if agent $i$ is a leader and $0$ if it is a follower \item $\mathbf{u}$ is a two dimensional exogenous control, $\mathbf{u}=[u_x \text{ } u_y]^T$ \end{itemize} Equivalently, \fi \begin{eqnarray*} \dot{x} ( t ) &=& -L\cdot x(t)+ Bu_x \\ \dot{y}( t ) &=& -L\cdot y(t)+ Bu_y \end{eqnarray*} Applying the results derived in section \dref{Gen-1D}, for one time interval, we can write: \begin{equation}\label{p-decoupled} p(t)= p^{(h)}(t)+p^{(a)}(t)+p^{(b)}(t)= \left [\begin{matrix} x^{(h)}(t)+x^{(a)}(t)+x^{(b)}(t)\\ y^{(h)}(t)+y^{(a)}(t)+y^{(b)}(t) \end{matrix} \right ] \\ \end{equation} where $t$ is the time from the beginning of the interval. Thus, for the $x$ axis, we have the following expressions and for the $y$ axis we have the same with $y$ replacing $x$. \begin{itemize} \item for the \textbf{uniform case} \begin{eqnarray*} x^{(h)}(t) & = &\frac{1}{n}{\mathbf{1}_n^{T}}x(0)\mathbf{1}_n + \sum_{k=2}^n e^{-\lambda^U_k t} ((V^U_k)^T x(0)) V^U_k\\ x^{(a)}(t) & = &\frac{n_l}{n} u_x t \mathbf{1}_n\\ x^{(b)}(t) &= &\left[ \sum_{k=2}^n \frac{1}{\lambda^U_k}(1-e^{-\lambda^U_k t})V^U_k (V^U_k)^T \right ] B u_x \end{eqnarray*} where \begin{itemize} \item $\lambda^U_i; \quad i=1, ...,n$ are the eigenvalues of the Laplacian $L^U$ and $V^U_i; \quad i=1, ...,n $ are the corresponding right eigenvectors, selected such that the eigenvector corresponding to $\lambda^U_1=0$ is $V^U_1=\displaystyle \frac{1}{\sqrt{n}}\mathbf{1}_n$ and $V^U$, the matrix with columns $V^U_i$, is orthonormal. \item we assumed in the expression for $ x^{(a)}(t)$ that there are $n_l$ agents receiving the exogenous input \end{itemize} \item for the \textbf{scaled case} \begin{eqnarray*} x^{(h)}(t) & = & \frac{ \mathbf{d}^T x(0)}{\sum_{i=1}^n d_i} \mathbf{1}_n+ \sum_{i=2}^n e^{-\lambda^S_i t}(W^S_i)^{T} x(0) V^S_i\\ x^{(a)}(t) & = & \frac{\sum_{i \in N^l} d_i}{\sum_{i=1}^n d_i} u_x t \mathbf{1}_n\\ x^{(b)}(t) &= &\left[ \sum_{k=2}^n \frac{1}{\lambda^S_k}(1-e^{-\lambda^S_k t})V^S_k (W^S_k)^T \right ] B u_x \end{eqnarray*} \end{itemize} where \begin{itemize} \item $\lambda^S_i; \quad i=1... n$ are the eigenvalues of the Laplacian $L^S$, s.t. $\lambda^S_1=0$ \item $V^S$ is a matrix whose columns, $V^S_i$, are the \emph{normalized} right eigenvectors of $L^S$. In particular, the normalized right eigenvector corresponding to $\lambda^S_1=0$, is $\displaystyle V^S_1=\frac{1}{\sqrt{n}} \mathbf{1}_n$. \item $(W^S)^T$ is the matrix of left eigenvectors, selected s.t. $(W^S)^T = (V^S)^{-1}$ . The first row of $(W^S)^T$, denoted by $(W^S_1)^T$, is a left eigenvector of $L^S$ corresponding to $\lambda^S_1=0$ and satisfies Theorem \dref{T-WsT1}: \begin{equation*} (W^S_1)^T = \frac{\sqrt{n} \mathbf{d}^T}{\sum_{i=1}^n d_i} \end{equation*} \item $d_i$ are the number of neighbors of node $i$ and $ \mathbf{d}$ is a vector with $d_i$ as its $i'th$ element \end{itemize} \msubsection{Interpretation of the asymptotic deviations in the Euclidean space}{Dev-mean} \subsubsection{Asymptotic position of agent $i$}\label{AsympPos2D} The asymptotic positions of agent $i$, in the two-dimensional space, when an external control $\mathbf{u}=(u_x \quad u_y)^T$ is detected by $n_l$ agents, will be \begin{equation}\label{pAsymp} p_i(t \rightarrow \infty)= \left [\begin{matrix} \alpha_x +\beta u_x t + \gamma_i u_x\\ \alpha_y +\beta u_y t + \gamma_i u_y \end{matrix} \right ] \\ \end{equation} where \begin{itemize} \item $\alpha=(\alpha_x\text{ }\alpha_y)^T$ is the agreement, or gathering, point when there is no external input \item $\beta (u_x\text{ } u_y)^T $ is the collective velocity. \item $\gamma_i (u_x \text{ } u_y)^T $ are the $x$ and $y$ components of the asymptotic deviation of agent $i$ \end{itemize} The values of $\alpha_x, \text{ }\alpha_y, \text{ }\beta$ and $\gamma$, the coefficients of the asymptotic position, are a function of the assumed influence model, as shown in Table \dref{AsymptoticPosCoef} for a general visibility graph. Note that $\gamma_i$ is the deviation factor, i.e. $\gamma_i u_x$ is the deviation of agent $i$ in the $x$ direction and similarly for $y$. \begin{table} \centering \caption{Coefficients of asymptotic position} \label{AsymptoticPosCoef} \begin{tabular}{||c|| c| c||} \hline & \textbf{Uniform influence} & \textbf{Scaled influence} \\ [0.5ex] \hline\hline $\alpha_x$ & $\displaystyle \frac{1}{n} \mathbf{1}_n^T x(0)$ & $\displaystyle \frac{ \mathbf{d}^T x(0)}{\sum_{i=1}^n d_i}$ \\[2ex] \hline $\alpha_y$ & $\displaystyle \frac{1}{n} \mathbf{1}_n^T y(0)$ &$ \displaystyle \frac{ \mathbf{d}^T y(0)}{\sum_{i=1}^n d_i}$ \\[2ex] \hline $\beta$ & $\displaystyle \frac{n_l}{n}$ & $ \displaystyle \frac{\sum_{i \in N^l} d_i}{\sum_{i=1}^n d_i}$ \\[2ex] \hline $\gamma$ & $\displaystyle \sum_{k=2}^n \left[ \frac{1}{\lambda^U_k}V^U_k (V^U_k)^T \right ] B$ & $\displaystyle \sum_{k=2}^n \left[ \frac{1}{\lambda^S_k}V^S_k (W^S_k)^T \right ] B$ \\[2ex] \hline \end{tabular} \end{table} \subsubsection{Asymptotic deviations} The vector of asymptotic deviations, s.t. $\varrho_i = \gamma_i \mathbf{u}$ is the deviation of agent $i$, in the $(x, y)$ space, from the (moving) consensus $\mathbf{\alpha}+\beta \mathbf{u} t$, where $\mathbf{\alpha} = (\alpha_x, \alpha_y)$. The agents align along a line in the direction of $\mathbf{u}$. The line is anchored at the zero-input gathering, or consensus, point $\mathbf{\alpha}$. Since $\gamma$ is time independent, the asymptotic dispersion of agents along this line is time independent, as illustrated in Fig. \dref{fig-dev}. The swarm moves with velocity $\beta \mathbf{u}$. \begin{figure} \begin{center} \includegraphics[scale=0.7]{Deviations.jpg} \caption{Asymptotic dispersion of agents along the direction of $u$}\label{fig-dev} \end{center} \end{figure} \msubsection{Example of simulation results - Single time interval }{SimEx} A single time interval of a piecewise constant system is equivalent to a time-independent configuration with constant exogenous control and leaders. We consider a network of 5 agents and illustrate the group behaviour, for a constant $u$, both in case of incomplete visibility graph and of complete visibility graph. In these examples, the exogenous control is $\mathbf{u} = (10, 2)$. The initial positions $x(0), y(0)$ were once randomly selected in $[-50,50]$, and kept common for all runs. \subsubsection{Incomplete visibility graph}\label{SimExIncomplete} In the examples in this section, we illustrate the impact of the influence model applied by the agents and of the leader selection on the agents dynamics when the interaction graphs, $G^U$ and $G^S$, are as illustrated in Fig. \dref{GraphExSim}. \begin{figure} \begin{center} \includegraphics[scale=0.6]{UniScaledGraph5n6m.jpg} \caption{Simulated pairwise interaction graph}\label{GraphExSim} \end{center} \end{figure} Fig. \dref{ExSimDyn} shows the emergent dynamics of the agents when agent 5 detects the constant exogenous control, thus is the leader. This example will be named Ex1. In Fig. \dref{ExSimDyn} the leader is colored red and the followers are blue. \begin{figure} \begin{center} \includegraphics[scale=0.55]{UniScaledDyn_Ex1.jpg} \caption{Emergent dynamics in Ex1 with uniform and scaled influences}\label{ExSimDyn} \end{center} \end{figure} The agents are seen to asymptotically align, in both cases, along a line in the direction of $\mathbf{u}$, in this case a line with slope 0.2, as expected. The dots indicate the position of the units at consecutive times, t=1,2,3,... We can also see that, in this example, the collective speed of the agents with scaled influence is considerably lower than that of the agents with scaled influence. While the collective speed in the uniform case is $0.2 |u| $, corresponding to $\displaystyle \beta=\frac{n_l}{n}$ with $n_l=1, n=5$, for the scaled case it is only $0.0833 |u|$, corresponding to $ \displaystyle \beta = \frac{\sum_{i \in N^l} d_i}{\sum_{i=1}^n d_i}$. \\ Fig. \dref{Ex1Dyn} shows a comparative view of the agents' dynamics in Ex1. Here again we see the difference in the collective speed with uniform vs scaled influence, but we also see that the agents' alignment lines are parallel and each is anchored at the corresponding zero-input gathering point. \begin{figure} \begin{center} \includegraphics[scale=0.7]{UniScaledDynEx1.jpg} \caption{Comparative view of emergent dynamics with uniform and scaled influences - Ex1}\label{Ex1Dyn} \end{center} \end{figure} Note however that while for the uniform case the coefficient of the collective speed is a function of only the number of leaders, for the scaled case it is also a function of the topology itself, i.e. of the number and distribution of links. Thus, by selecting now agent 4 instead of 5 as leader, we do not change the speed in the uniform case but increase it three times in the scaled case. This brings the velocities of the agents with scaled influence to be larger than the ones with uniform influence, as illustrated in Fig. \dref{Ex2Dyn} \begin{figure} \begin{center} \includegraphics[scale=0.7]{UniScaledDynEx2.jpg} \caption{Comparative view of emergent dynamics with uniform and scaled influences - Leader is agent 4 - Ex2}\label{Ex2Dyn} \end{center} \end{figure} Fig. \dref{ExSimDev} shows the asymptotic deviation of the agents relative to the moving gathering point, in both leader cases, agent 4 or agent 5. In both cases, agents 1 and 3 were equivalent, therefore had the same deviation, but this is not always the case. For example, if agent 1 is selected as leader, Ex3, there will be no equivalent agents, as shown in Fig \dref{Ex3SimDev}. Therefore, \textbf{equivalence is not preserved under change of leader}. \begin{figure} \begin{center} \includegraphics[scale=0.5]{DevLeader4vsLeader5.jpg} \caption{Impact of leader selection on agents' asymptotic derivations relative to the moving consensus}\label{ExSimDev} \end{center} \end{figure} \begin{figure} \begin{center} \includegraphics[scale=0.6]{UniScaledDevEx3.jpg} \caption{Asymptotic derivations relative to the moving consensus when agent 1 is leader}\label{Ex3SimDev} \end{center} \end{figure} Another issue to be considered is that of the impact of the influence model on the time of convergence. Fig. \dref{ZeroInpDyn} shows the convergence to consensus for uniform and scaled dynamics, when no exogenous control is applied. We see clearly that the convergence time with scaled influence is longer than that with uniform influence. The convergence time is a function of the first non-zero eigenvalue of the Laplacian, $\lambda_2$. In our examples one has $\lambda^U_2=0.8299$ and $\lambda^S_2=0.5657$. Since in these examples we only change leaders, $G^U$ and $G^S$ and the corresponding $\lambda_2$ do not change. Therefore the time of convergence, is identical for all 3 examples. However, we can say that the time of convergence with scaled influence is always at least the time of convergence with uniform influence, since \begin{itemize} \item the eigenvalues of the Laplacian of $G^S$ are the eigenvalues of the \textbf{normalized Laplacian} of the corresponding graph with uniform influence, $G^U$. If we denote the eigenvalues of the normalized Laplacian by $\phi^U_i; i=1,.,n$ Then $\lambda^S_i=\phi^U_i; \quad i=1,...n$ \item As shown by Butler in \dcite{ButlerPhD}, Theorem 4 \begin{equation*} \frac{1}{d_{max}} \lambda^U_i \leq \phi^U_i \leq \frac{1}{d_{min}} \lambda^U_i \end{equation*} where $d_{max}$ is the maximum degree and $d_{min}$ is the minimum degree of a vertex in $G_U$. \end{itemize} Thus, $\lambda^S_2 \leq \lambda^U_2$ for any graph $G^U$ and corresponding $G^S$. \iffalse If $G^U$ is a \textbf{complete graph} then \begin{itemize} \item $\lambda^U_i = n; \quad i=2,...,n$ \item $d_{max}=d_{min} = n-1$ \end{itemize} and we obtain $\displaystyle \lambda^S_i = \frac{n}{n-1}; \quad i=2,...,n$, as expected. \fi \begin{figure} \begin{center} \includegraphics[scale=0.6]{ZeroInputConvEx2.jpg} \caption{Zero Input dynamics as a function of time}\label{ZeroInpDyn} \end{center} \end{figure} \subsubsection{Complete visibility graph}\label{SimExComplete} In this example we assume a network of 5 agents with complete visibility graphs. Fig. \dref{Ex5nComplete} illustrates the emergent behavior in case of scaled influence vs uniform influence and shows that \begin{itemize} \item the zero input gathering point coincides \item the position of the moving gathering point coincides, thus the collective velocity coincides \item the dispersion of the agents around the moving gathering point is larger when the influence is scaled, in fact exactly 4 times larger, as expected \item the time for convergence to (moving) consensus is larger in case of scaled influence, as expected \end{itemize} \begin{figure} \begin{center} \includegraphics[scale=0.7]{DynUniScaledComp-5nComplete.jpg} \caption{Comparative view of emergent dynamics with uniform and scaled influences when the visibility graph is complete }\label{Ex5nComplete} \end{center} \end{figure} \newpage \msec{Multiple time intervals}{MultiIntEx} In the previous sections we considered a single time interval were the system is time independent, i.e. the visibility graph and the corresponding Laplacian $L$, the leaders and the exogenous control $u$ are constant along the interval. We showed the dependence of the emergent behavior on the influence model, scaled or uniform, in case of complete and incomplete visibility graphs. We now consider a sequence of time intervals, $[t_k, t_{k+1})$, where a new time interval is triggered by changes in one of the system parameters, the broadcast control $u$, the agents detecting the broadcast control, i.e. the leaders, or the visibility graph and the corresponding Laplacian. In order for the group behavior along multiple intervals to be a concatenation of dynamics along single intervals, with the end states of one interval becoming the start states of the next interval, we need to ensure that the visibility graph remains strongly connected. In this section we derive sufficient conditions, which are conditions for never losing friends, i.e. for initially adjacent pairs of agents to remain adjacent. Thus, we require $G_k \subseteq G_{k+1}$ and consider two cases of visibility graphs, each for uniform and scaled influences: \begin{enumerate} \item $G_k$ is complete \item $G_k$ is incomplete \end{enumerate} Changes in the visibility graph are state dependent, i.e. a link $(i,j)$ exists at time $t$ iff $|p_i(t)-p_j(t)| \leq R$, where $R$ is the visibility, or sensing, range. In the next sections we derive \textbf{conditions for \emph{never losing neighbors}} and illustrate their effect by simulations. We show that \begin{enumerate} \item if the initial interactions graph is complete and the sensing range is $R$, then \begin{itemize} \item Follower to follower distance and leader to leader distance are monotonically decreasing, therefore initial links are preserved, independently of the value of $u$, for both uniform influence ( Lemma \dref{L-L2Lpreserve}) and scaled influence (Theorem \dref{T-ScaledComplete}a) \item Leader to follower links can be proven to be maintained only if the exogenous control is limited to \begin{enumerate} \item $|u| \leq nR$, for the \textbf{uniform case}, Theorem \dref{T-L2Fpreserve} \item $\displaystyle |u| \leq \frac{n}{n-1} R$, for the \textbf{scaled case}, Theorem \dref{T-ScaledComplete}b \end{enumerate} \end{itemize} Recalling that in case of complete graphs, all leaders asymptotically move together (one moving gathering point) and all followers move together (at another point gathering point) we note that the distance between any leader to any follower tends to $d_{lf} = (\gamma_l-\gamma_f)|u|$ (cf. section \dref{Dev-mean}) and thus preserving the link requires $d_{lf} \leq R$. Since for the complete visibility case $\gamma_l^S=(n-1)\gamma_l^U$ and $\gamma_f^S=(n-1)\gamma_f^U$ the ratio between the bounds on $u$ shown above becomes evident.\\ In section \dref{LimitedComplete-Ex} we show an example of emergent dynamics when $|u|$ is within bounds and another example where $|u|$ exceeds the derived limit \item if the initial graph is incomplete then \begin{itemize} \item conditions for never losing friends are tightly related to the graph topology.\\ Since an external controller does not know the time-dependent topology these are not useful in practice. \item for a general form of incomplete graph, bounds cannot be derived or are too loose to be useful. \end{itemize} Although useful bounds could not be derived, many simulations show that if the interactions graph starts as an incomplete graph, when inputting $u$ such that $|u| < R$, the agents fast converge to a complete graph, as shown by some examples in section \dref{IncompleteEx}. \end{enumerate} \msubsection{Conditions for maintaining complete graphs }{never-losing2} Denote by $\delta_{ij}$ the distance between two adjacent agents $i$ and $j$ \begin{equation}\label{dist2} \delta_{ij}=\delta_{ji}= |p_i-p_j|= \sqrt{(p_i-p_j)^T(p_i-p_j)} \end{equation} Since the movement of the agents is smooth, a necessary and sufficient condition for the link to be always preserved is $d{\delta}_{ij}/dt \leq 0$ when $\delta_{ij}=R$, or equivalently $d(\delta_{ij}^2)/dt \leq 0$, when $\delta_{ij}=R$. Note that $d(\delta_{ij}^2)/dt$ has the same sign as $d{\delta}_{ij}/dt$ and is defined on all of $\textbf{R}^n$ while $d\delta_{ij}/dt$ is not defined when $p_i=p_j$. We have \begin{equation}\label{deriv-dist} \frac{d(\delta_{ij}^2)}{dt} =2 \delta_{ij} \dot{\delta_{ij}} = 2(p_i-p_j)^T(\dot{p_i}-\dot{p_j}) \end{equation} \subsubsection{Uniform influence}\mbox{}\\ If the visibility graph is a complete graph with uniform influences then $\sigma_{ji}=1; \quad \forall i,j$ and equations (\dref{gen-SelfDyn}), (\dref{gen-LeadDyn}) can be combined and reformulated as \begin{equation}\label{gen-dyn} \dot{p_i}=-n_i p_i+\sum_{k \in N_i} p_k+b_i u \end{equation} where $p_i = (x_i \quad y_i)^T$ , $u =(u_x \quad u_y)^T$, $N_i$ is the neighborhood of agent $i$, $n_i=|N_i|$ and $b_i= 1$ if $i$ is a leader and 0 if $i$ is a follower. Since for a complete graph $n_i=n-1; \quad \forall i$, Eq. (\dref{gen-dyn})can be rewritten as \begin{equation*} \dot{p_i}=-(n-1) p_i+\sum_{k =1; k \neq i}^n p_k + b_i u \end{equation*} and similarly for $\dot{p_j}$, where $n$ is the total number of agents. Thus \begin{equation*} \dot{p}_i-\dot{p}_j=-n(p_i-p_j)+(b_i-b_j) u \end{equation*} Denoting $b_{ij}=(b_i-b_j)$, we have \begin{equation}\dlabel{eq-bij} b_{ij} = \begin{cases}0 ; \text{ if both } i,j \text{ are followers or both are leaders}\\ 1 ; \text{ if } i \text{ is leader and } j \text{ is follower} \end{cases} \end{equation} Substituting in eq. (\dref{deriv-dist}) one obtains \begin{equation}\label{Uni-dist2} \frac{d\delta_{ij}^2}{dt} = -2n \delta_{ij}^2 +2(p_i-p_j)^T b_{ij} u \end{equation} \LB{L-L2Lpreserve} If the visibility graph of $n$ agents with uniform influences is a complete graph, then all leader to leader and follower to follower links are preserved, independently of the externally applied control $u$. \LE {\em Proof:\/\ }\cmd{ PB} If $i$ and $j$ in (\dref{Uni-dist2})are both leaders or both followers, then $b_{ij}=0$ and thus eq. (\dref{Uni-dist2}) becomes \begin{equation*} \frac{d\delta_{ij}^2}{dt} = -2n \delta_{ij}^2 \end{equation*} with the solution \begin{equation*} \delta_{ij}^2 (t) = e^{-2nt} \delta_{ij}^2 (0) \end{equation*} Thus, $\delta_{ij}(t)$ decreases monotonically from the initial condition. {\hfill $\Box$}{\cmd{PE}} We shall consider now the \textbf{case when $i$ is a leader and $j$ is a follower}. \TB{T-L2Fpreserve} If the visibility graph of $n$ agents with uniform influences is a complete graph and the magnitude of the exogenous control is limited to $|u| \leq nR$, then the connection of a leader $i$ and a follower $j$ is never lost. \TE {\em Proof:\/\ }\cmd{ PB} When $i$ is a leader and $j$ is a follower Eq. (\dref{Uni-dist2}) becomes \begin{equation}\label{Uni-distL2F} \frac{d\delta_{ij}^2(t)}{dt} = -2n \delta_{ij}(t)^2 +2(p_i(t)-p_j(t))^T u \end{equation} But $(p_i-p_j)^T u = \langle (p_i-p_j), u \rangle \leq |p_i-p_j||u| =\delta_{ij}|u|$. Consider a time $t_1$ when for the first time $\delta_{ij}(t_1)=R$ holds. Since $|u| \leq n R$ for all $t$, we obtain $\displaystyle \frac{d\delta_{ij}^2}{dt}(t_1) \leq 0$. Therefore, when $i$ is a leader and $j$ is a follower, if $|u| \leq nR$, then $\delta_{ij}(t_1) \leq R$ and by induction this result holds for all $t$. {\hfill $\Box$}{\cmd{PE}} \subsubsection{Scaled influence}\mbox{}\\ If the visibility graph is a complete graph with scaled influences then $\sigma_{ji}=\frac{1}{n-1}; \quad \forall i,j$ and equations (\dref{gen-SelfDyn}), (\dref{gen-LeadDyn}) can be combined and reformulated as \begin{eqnarray}\dlabel{Scaled-dyn} \dot{p_i} & = &\sum_{k \in N_i} \frac{1}{n-1}( p_k-p_i)+b_i u\\ & = & -p_i+ \frac{1}{n-1} \sum_{k=1,k \neq i}^n p_k +b_i u\\ & = & -\frac{n}{n-1} p_i + \sum_{k=1}^n p_k+b_i u \end{eqnarray} and similarly for $\dot{p_j}$. Thus, we have \begin{equation}\dlabel{Deriv-Diff} \dot{p_i}-\dot{p_j}=-\frac{n}{n-1}( p_i-p_j) +b_{ij}u \end{equation} where $b_{ij}$ as in (\dref{eq-bij}). Therefore, multiplying (\dref{Deriv-Diff}) from the left by $2(p_i-p_j)^T$ we obtain: \begin{equation}\dlabel{Scaled-deriv} \frac{d (\delta_{ij}^2)}{dt}=-2 \frac{n}{n-1} \delta_{ij}^2 + 2 b_{ij} (p_i-p_j)^T u \end{equation} The dynamics of $\delta_{ij}(t)$, as expressed by (\dref{Scaled-deriv}), for the case when $i$ and $j$ are both followers or both leaders and for the case when $i$ is a leader and $j$ is a follower are summarized by the following theorem: \TB{T-ScaledComplete} If the visibility graph of $n$ agents with scaled influences is a complete graph, then \begin{alphlist} \titem{a} All follower-to-follower links and all leader-to-leader links are monotonically decreasing from the initial conditions, thus these links are preserved, independently of the exogenous control $u$ \titem{b} If the exogenous control satisfies $|u| \leq \frac{n}{n-1} R$ then all Leader-to-Follower links are preserved \end{alphlist} \TE {\em Proof:\/\ }\cmd{ PB} \tref{a} If $i$ and $j$ are both followers or leaders then $b_{ij}=0$. By substituting in (\dref{Scaled-deriv})and solving the resulting homogenous equation, one obtains \begin{equation*} \delta_{ij}^2(t)=e^{-2 \frac{n}{n-1}t} \delta_{ij}^2(0) \end{equation*} Thus, $\delta_{ij}$ monotonically decreases for any two followers or any two leaders and therefore the link is preserved.\\ \tref{b} If $i$ is a leader and $j$ is a follower then $b_{ij}=1$. Substituting this in eq. (\dref{Scaled-deriv}) and letting again $t_1$ be the first time when $\delta_{ij}(t_1)=R$ we obtain \begin{equation*} \frac{d( \delta_{ij}^2)}{dt}(t_1) \leq -2 \frac{n}{n-1} R^2 + 2R|u| \end{equation*} where we used the inequality for inner products $(p_i-p_j)^T u \leq \delta_{ij} |u|$. If $|u| \leq \frac{n}{n-1} R$ for all $t$, then $\displaystyle \frac{d( \delta_{ij}^2)}{dt}(t_1) \leq 0$, and thus, by induction, the leader-to-follower link is preserved for all $t$. {\hfill $\Box$}{\cmd{PE}} \subsubsection{Simulation examples - Effect of $|u|$ on complete graph preservation}\label{LimitedComplete-Ex} We illustrate the emergent behavior of a group of 6 agents with initially complete visibility graph, $R=50$, $u$ and leaders randomly selected, as shown. In the first example, Ex1, where $u_x, u_y$ have random values in the range $[100, 100]$, at $t=5sec$, the restriction on $|u|$ for the scaled case is not satisfied while for the uniform case it is satisfied. Thus, when the scaled influence is applied, the graph splits in two parts (after ~ 5 sec), leaders forming one component and followers forming the other component. When the split occurs, the agents dynamics simulation is stopped. Thus, in Fig. \dref{fig-LimitedVisDyn-Ex1}, the dynamics with scaled influence (cyan and magenta) stopped soon after the beginning of the run (at t=5 sec) while the dynamics with uniform influence (blue and red) evolved for the whole requested period (40 sec). \begin{figure} \begin{center} \includegraphics[scale=0.6]{GroupDynamics-Ex2.jpg} \caption{Group dynamics with limited visibility and high $|u|$ -Ex1}\label{fig-LimitedVisDyn-Ex1} \end{center} \end{figure} When the range of $u_x, u_y$ is reduced to within the limits, all links are preserved, as illustrated in Ex2, where $u_x \in [-20,20]$, $u_y \in [-10,10]$. The leaders were again randomly selected. \begin{figure} \begin{center} \includegraphics[scale=0.6]{GroupDynamics-Ex3.jpg} \caption{Group dynamics with limited visibility and $|u|$ within limits - Ex2}\label{fig-LimitedVisDyn-Ex2} \end{center} \end{figure} In this case the initial complete graph is preserved for both the scaled and the uniform influence and the agents complete the run in both cases. \msubsection{Conditions for never losing friends when visibility graph is incomplete}{LimitedIncomplete} In this section we show that for a general case of incomplete graphs, the "never losing friends" requirement imposes stringent conditions on the topology. Moreover, we show, by examples, that for specific topologies these conditions are too stringent and the property can be proven under relaxed restrictions.\\ We employ the following notations: \begin{itemize} \item $\textbf{N}^f$ denotes the set of followers \item $\textbf{N}^l$ denotes the set of leaders \item $n_f = |\textbf{N}^f|$ is the number of followers \item $n_l= |\textbf{N}^l|$ is the number of leaders \item $n = n_f+n_l$ is the total number of agents \item the set of followers adjacent to an agent $i$, leader or follower, is denoted by $\textbf{N}_i^f $\\ $\textbf{N}_i^f \subseteq \textbf{N}^f$ \item the set of leaders adjacent to an agent $i$, leader or follower, is denoted by $\textbf{N}_i^l $\\ $\textbf{N}_i^l \subseteq \textbf{N}^l$ \item $n_{il}$ is the number of leaders agent $i$ is connected to, $n_{il}=|\textbf{N}_i^l |$ \item $n_{if}$ is the number of followers agent $i$ is connected to, $n_{if}=|\textbf{N}_i^f |$ \item $\textbf{N}_i$ is the neighborhood of $i$, $\textbf{N}_i = \textbf{N}_i^f \bigcup \textbf{N}_i^l$ \item $n_i$ is the size of the neighborhood of $i$, $n_i = n_{il} + n_{if}$ \item $\textbf{N}_{(ij)}^l$ denotes the set of leaders adjacent to both $i$ and $j$ \item $n_{(ij)l}$ is the number of leaders that have a link to both $i$ and $j$ \item $\textbf{N}_{(ij)}^f$ denotes the set of followers adjacent to both $i$ and $j$ \item $n_{(ij)f}$ is the number of followers that have a link to both $i$ and $j$ \end{itemize} Can we find conditions on the topology and on $|u|$ s.t. any two nodes, $i$ and $j$, initially connected, i.e. satisfying $\delta_{ij}(0) = |p_i(0)-p_j(0)| \leq R$ will remain connected, i.e. will satisfy $\frac{d}{dt}\delta_{ij}^2 \leq 0$ when $\delta_{ij}(t)=R$ ? We consider $t_1$, the first time when for one or more links holds $\delta_{ij}(t_1)=R$ and derive conditions for $\frac{d}{dt}\delta_{ij}^2(t_1) \leq 0$ for each link type and each influence type. \subsubsection{General incomplete topology - Uniform case}\label{IncompleteGeneral} If each agent applies the movement equation with uniform influence, then we have \begin{itemize} \item for followers \begin{equation}\dlabel{ML-FolDynU} \dot{p}_i = -\sum_{k \in \textbf{N}_i^f} (p_i-p_k) - \sum_{k \in \textbf{N}_i^l} (p_i-p_k); \quad i \in \textbf{N}^f \end{equation} \item for leaders \begin{equation}\dlabel{ML-LeadDynU} \dot{p}_i=-\sum_{k \in \textbf{N}_i^l} (p_i-p_k) - \sum_{k \in \textbf{N}_i^f} (p_i-p_k) + u; \quad i \in \textbf{N}^l \end{equation} \end{itemize} \begin{enumerate} \item If $i$ and $j$ are \textbf{\emph{both followers}}, then applying (\dref{ML-FolDynU}) to $i$ and $j$ we obtain \begin{equation}\dlabel{eq-F2F-U} \begin{aligned} \dot{p}_i - \dot{p}_j = & -\sum_{k \in \textbf{N}_i^f} (p_i-p_k) - \sum_{k \in \textbf{N}_i^l} (p_i-p_k) \\ & +\sum_{k \in \textbf{N}_j^f} (p_j-p_k) + \sum_{k \in \textbf{N}_j^l} (p_j-p_k) \end{aligned} \end{equation} Separating now the set of neighbors common to $i$ and $j$ from the set of private neighbors to $i$ or $j$ and using \begin{eqnarray*} \textbf{N}_i^f & = & \textbf{N}_{ij}^f + \textbf{N}_i^f \backslash \textbf{N}_{ij}^f\\ \textbf{N}_i^l & = & \textbf{N}_{ij}^l + \textbf{N}_i^l \backslash \textbf{N}_{ij}^l \end{eqnarray*} and similarly for $j$, we obtain \begin{equation*} \begin{aligned} \dot{p}_i - \dot{p}_j = & -n_{(ij)f} p_i + \sum_{k \in \textbf{N}_{ij}^f} p_k -\sum_{k \in \textbf{N}_i^f \backslash \textbf{N}_{ij}^f} (p_i-p_k) \\ & -n_{(ij)l} p_i + \sum_{k \in \textbf{N}_{ij}^l} p_k -\sum_{k \in \textbf{N}_i^l \backslash \textbf{N}_{ij}^l} (p_i-p_k) \\ & +n_{(ij)f} p_j - \sum_{k \in \textbf{N}_{ij}^f} p_k +\sum_{k \in \textbf{N}_j^f \backslash \textbf{N}_{ij}^f} (p_j-p_k) \\ & + n_{(ij)l} p_j -\sum_{k \in \textbf{N}_{ij}^l} p_k +\sum_{k \in \textbf{N}_j^l \backslash \textbf{N}_{ij}^l} (p_j-p_k)\\ = & -(n_{(ij)f}+n_{(ij)l})(p_i-p_j) - \sum_{k \in \textbf{N}_i^f \backslash \textbf{N}_{ij}^f} (p_i-p_k) -\sum_{k \in \textbf{N}_i^l \backslash \textbf{N}_{ij}^l} (p_i-p_k)\\ & +\sum_{k \in \textbf{N}_j^f \backslash \textbf{N}_{ij}^f} (p_j-p_k)+\sum_{k \in \textbf{N}_j^l \backslash \textbf{N}_{ij}^l} (p_j-p_k) \end{aligned} \end{equation*} Consider now the time $t_1$, the first time when one or more links satisfy $\delta_{ij}(t_1)=R$ and let the considered follower to follower link be among them. Then we have $\delta_{ij}(t_1)=R$ and $\delta_{ik}(t_1) = |p_i(t_1)-p_k(t_1)| \leq R; \quad \forall k \in \textbf{N}_i^f \quad \text{and } k \in \textbf{N}_i^l $ and similarly for $j$. Recalling that $\displaystyle \frac{d}{dt}\delta_{ij}^2 = 2(p_i-p_j)^T ( \dot{p}_i - \dot{p}_j)$ we obtain at \begin{equation}\dlabel{F2Fderiv} \begin{aligned} \frac{1}{2} \frac{d}{dt}\delta_{ij}^2(t_1) = & -(n_{(ij)f}+n_{(ij)l})R^2 +\sum_{k \in \textbf{N}_i^f \backslash \textbf{N}_{ij}^f} (p_i-p_j)^T (p_k-p_i) +\sum_{k \in \textbf{N}_i^l \backslash \textbf{N}_{ij}^l} (p_i-p_j)^T (p_k-p_i)\\ & +\sum_{k \in \textbf{N}_j^f \backslash \textbf{N}_{ij}^f} (p_i-p_j)^T (p_j-p_k)+\sum_{k \in \textbf{N}_j^l \backslash \textbf{N}_{ij}^l} (p_i-p_j)^T (p_j-p_k) \end{aligned} \end{equation} Using now $V_1^T V_2 \leq |V_1| |V_2|$ we can write eq. (\dref{F2Fderiv}) as \begin{equation}\dlabel{F2Fderiv2} \begin{aligned} \frac{1}{2} \frac{d}{dt}\delta_{ij}^2 \leq & -(n_{(ij)f}+n_{(ij)l})R^2 +(n_{if}-n_{(ij)f}) R^2+ (n_{il}-n_{(ij)l}) R^2\\ & + (n_{jf}-n_{(ij)f}) R^2+ (n_{jl}-n_{(ij)l}) R^2\\ =& [ n_i+n_j-3 n_{(ij)f} - 3 n_{(ij)l}]R^2 \end{aligned} \end{equation} where we used \begin{equation*} n_i =n_{if} + n_{il} \end{equation*} and similarly for $j$.\\ Thus, if $n_i+n_j \leq 3 n_{(ij)f} + 3 n_{(ij)l}$ is satisfied then $ \frac{d}{dt}\delta_{ij}^2(t_1) \leq 0$ when $i, j \in \textbf{N}^f$. \item If $i$ and $j$ are \textbf{\emph{both leaders}}, then applying (\dref{ML-LeadDynU}) to $i$ and $j$ we obtain \begin{equation}\dlabel{eq-L2L-U} \begin{aligned} \dot{p}_i - \dot{p}_j = & -\sum_{k \in \textbf{N}_i^f} (p_i-p_k) - \sum_{k \in \textbf{N}_i^l} (p_i-p_k) + u\\ & +\sum_{k \in \textbf{N}_j^f} (p_j-p_k) + \sum_{k \in \textbf{N}_j^l} (p_j-p_k) -u \end{aligned} \end{equation} Since $u$ is common to $i$ and $j$ eq. (\dref{eq-L2L-U}) reduces to eq. (\dref{eq-F2F-U}) and therefore we obtain the same condition for never losing neighbors: if $n_i+n_j \leq 3 n_{(ij)f} + 3 n_{(ij)l}$ is satisfied then $ \frac{d}{dt}\delta_{ij}^2(t_1) \leq 0$ when $i, j \in \textbf{N}^l$ and at $t_1$ $\delta_{ij}=R$ and $\delta_{ik} \leq R$, $\delta_{jk} \leq R \quad \forall k \neq i, k \neq j$ \item If \textbf{\emph{$i$ is leader and $j$ is follower}}, then from (\dref{ML-LeadDynU}) for $i$ and (\dref{ML-FolDynU}) for $j$ we obtain \begin{equation*} \begin{aligned} \dot{p}_i - \dot{p}_j = & -\sum_{k \in \textbf{N}_i^f} (p_i-p_k) - \sum_{k \in \textbf{N}_i^l} (p_i-p_k) + u \\ & +\sum_{k \in \textbf{N}_j^f} (p_j-p_k) + \sum_{k \in \textbf{N}_j^l} (p_j-p_k) \end{aligned} \end{equation*} which, following the same technique as above, reduces to \begin{equation*} \begin{aligned} \dot{p}_i - \dot{p}_j = & -(n_{(ij)f}+n_{(ij)l})(p_i-p_j) +\sum_{k \in \textbf{N}_i^f \backslash \textbf{N}_{ij}^f} (p_i-p_k) -\sum_{k \in \textbf{N}_i^l \backslash \textbf{N}_{ij}^l} (p_i-p_k) + u\\ & +\sum_{k \in \textbf{N}_j^f \backslash \textbf{N}_{ij}^f} (p_j-p_k)+\sum_{k \in \textbf{N}_j^l \backslash \textbf{N}_{ij}^l} (p_j-p_k) \end{aligned} \end{equation*} \end{enumerate} \begin{equation}\dlabel{L2Fderiv} \begin{aligned} \frac{1}{2} \frac{d}{dt}\delta_{ij}^2 \leq & -(n_{(ij)f}+n_{(ij)l})R^2 +(n_{if}-n_{(ij)f}) R^2+ (n_{il}-n_{(ij)l}) R^2 + |u|R\\ & + (n_{jf}-n_{(ij)f}) R^2+ (n_{jl}-n_{(ij)l}) R^2\\ =& [ n_i+n_j-3 n_{(ij)f} - 3 n_{(ij)l}]R^2 +|u|R \end{aligned} \end{equation} Thus, if $3 ( n_{(ij)f} + n_{(ij)l} ) \geq (n_i+n_j) $ and $|u| \leq [ 3 ( n_{(ij)f} + n_{(ij)l} ) - (n_i+n_j)]R$ then for $i \in \textbf{N}^l$ and $j \in \textbf{N}^f$, $\delta_{ij}^2 \leq 0$ when $\delta_{ij}=R$.\\ All of the above results can be summarized by the following theorem: \TB{IncompleteGen} Given a group of agents with connected visibility graph and uniform influence, any link $(i,j)$ satisfying the following conditions will be preserved \begin{enumerate} \item ( $i \in N^f$ and $j \in N^f$) or ($i \in N^l$ and $j \in N^l$) and $n_i+n_j \leq 3 n_{(ij)f} + 3 n_{(ij)l}$, independently of the exogenous control \item if $i \in N^l$ and $j \in N^f$ and $n_i+n_j \leq 3 n_{(ij)f} + 3 n_{(ij)l}$ then an input $u$ that satisfies \begin{equation*} |u| \leq[ 3 (n_{(ij)f}+ n_{(ij)l})-(n_i+n_j)] R \end{equation*} will ensure the link preservation \end{enumerate} where \begin{itemize} \item $n_{(ij)l}$ is the number of leaders that have a link to both $i$ and $j$ \item $n_{(ij)f}$ is the number of followers that have a link to both $i$ and $j$ \item $n_i$ is the number of nodes adjacent to $i$ \item $n_j$ is the number of nodes adjacent to $j$ \end{itemize} \TE Note that these conditions are not useful to us since the controller is unaware of the time varying and random values needed in the quantity limiting the control speed $|u|$, in order to ensure the preservation of all initial visibility links. \paragraph{Effect of assuming a Specific topology on conditions for never losing neighbors}\mbox{}\\ In this section we show that if a specific topology is assumed, then the bounds derived in section \dref{IncompleteGeneral}, for a general incomplete graph with uniform influences, can be tightened. We illustrate the effect on the example shown in Fig. \dref{fig-Ex1-Incomplete}. A more general example, although with some specific features, is shown in Appendix \dref{incomplete}, where all leaders form a complete graph and all followers form a complete graph. \begin{figure} \begin{center} \includegraphics[scale=0.6]{Ex1-Incomplete.jpg} \caption{Ex1 - specific case of incomplete graph}\label{fig-Ex1-Incomplete} \end{center} \end{figure} If we consider link $(4,3)$ and apply theorem \dref{IncompleteGen}, we have: \begin{itemize} \item $n_4=2$ \item $n_3=3$ \item $n_{(34)f}=1$ \item $n_{(34)l}=0$ \end{itemize} Thus the condition $n_3+n_4 \leq 3 n_{(34)f} + 3 n_{(34)l}$ does not hold and there is no $u$ that will ensure that link $(4,3)$ is preserved. However, if we consider the particular structure of the graph we obtain: \begin{equation*} \begin{aligned} \dot{p}_4-\dot{p}_3 = & -(p_4-p_3)-(p_4-p_2)+u + (p_3-p_4)+(p_3-p_2)+ (p_3-p_1)\\ = & -3 (p_4-p_3) + (p_3-p_1) + u \end{aligned} \end{equation*} Using the same technique as above, we obtain \begin{equation*} \frac{1}{2} \frac{d}{dt}\delta_{34}^2 \leq - 2 R^2 + |u| R \end{equation*} Thus, for this particular, incomplete, topology, $|u| \leq 2 R$ ensures the preservation of link $(4,3)$. \subsubsection{ General incomplete topology - Scaled case}\mbox{} If each agent applies the movement equation with scale influence, then we have \begin{itemize} \item for followers \begin{equation}\dlabel{ML-FolDynS} \dot{p}_i = -\frac{1}{n_i}\sum_{k \in \textbf{N}_i^f} (p_i-p_k) -\frac{1}{n_i} \sum_{k \in \textbf{N}_i^l} (p_i-p_k); \quad i \in \textbf{N}^f \end{equation} \item for leaders \begin{equation}\dlabel{ML-LeadDynS} \dot{p}_i=-\frac{1}{n_i}\sum_{k \in \textbf{N}_i^l} (p_i-p_k) -\frac{1}{n_i} \sum_{k \in \textbf{N}_i^f} (p_i-p_k) + u; \quad i \in \textbf{N}^l \end{equation} \end{itemize} \begin{enumerate} \item $i$ and $j$ are \textbf{followers}\\ Applying (\dref{ML-FolDynS}) to $i$ and $j$ one can write: \begin{equation}\label{F2Fs} \dot{p}_i - \dot{p}_j = \frac{1}{n_i}\sum_{k \in \textbf{N}_i^f} (p_k-p_i) +\frac{1}{n_i} \sum_{k \in \textbf{N}_i^l} (p_k-p_i)+\frac{1}{n_j}\sum_{k \in \textbf{N}_i^f} (p_j-p_k) +\frac{1}{n_j} \sum_{k \in \textbf{N}_i^l} (p_j-p_k) \end{equation} \begin{eqnarray*} \frac{d}{dt}\delta_{ij}^2 & = & 2(p_i-p_j)^T ( \dot{p}_i - \dot{p}_j)\\ & = & 2 \left[ \frac{1}{n_i}\sum_{k \in \textbf{N}_i^f} (p_i-p_j)^T (p_k-p_i) +\frac{1}{n_i} \sum_{k \in \textbf{N}_i^l} (p_i-p_j)^T (p_k-p_i) \right ]\\ & + & 2 \left[ \frac{1}{n_j}\sum_{k \in \textbf{N}_j^f} (p_i-p_j)^T (p_j-p_k) +\frac{1}{n_j} \sum_{k \in \textbf{N}_i^l}(p_i-p_j)^T (p_j-p_k) \right ] \end{eqnarray*} Using now \begin{itemize} \item $V_1^T V_2 \leq |V_1| |V_2|$ \item $\delta_{ij} = R$ \item $\delta_{ik} = |p_i-p_k| \leq R; \quad \forall k \in \textbf{N}_i^f \quad \text{and } k \in \textbf{N}_i^f $ and similarly for $j$ \end{itemize} we obtain \begin{equation}\label{dF2Fs} \frac{d}{dt}\delta_{ij}^2 \leq 2 \left[ \frac{1}{n_i} \left ( n_{if} R^2 + n_{il} R^2 \right ) + \frac{1}{n_j} \left ( n_{jf} R^2 + n_{jl} R^2 \right ) \right] \end{equation} Since $n_i = n_{if} + n_{il}$, and similarly for $j$, eq. (\dref{dF2Fs}) becomes \begin{equation}\label{dF2Fs2} \frac{d}{dt}\delta_{ij}^2 \leq 4 R^2 \end{equation} Note that equation \dref{dF2Fs2} does not ensure that $\frac{d}{dt}\delta_{ij}^2 \leq 0$ when the distance between two followers approaches the visibility range $R$. As such it is not useful, since it does not ensure that this distance does not increase beyond $R$. \item $i$ and $j$ are \textbf{leaders}\\ Since $u$ is common to all leaders we obtain the same bound on leader to leader link as on follower to follower link, (\dref{dF2Fs2}) \item $i$ is a \textbf{follower and} $j$ is a \textbf{leader}\\ Following the same procedure as above, we obtain \begin{equation}\label{dL2Fs2} \frac{d}{dt}\delta_{ij}^2 \leq 4 R^2 + 2|u|R \end{equation} Thus, without any assumptions on the topology of the graph, the property of never losing friends when applying the protocol with scaled influence, cannot be proven. \end{enumerate} \paragraph{Specific cases of topology - Uniform vs Scaled influence}\mbox{} Although it seems from the above that scaled influence is weaker than uniform influence in never losing neighbors, we will show here that there are specific cases where visibility link preservation with uniform influence can be proven only under the assumption of certain initial configurations, i.e. under "conditional topology" conditions, while scaled influence relaxes these conditions. We consider the case of a single leader with a single link to a complete sub-graph of followers, as illustrated in Fig. \dref{fig-case1}. \begin{figure} \begin{center} \includegraphics[scale=0.6]{OneLeaderEx.jpg} \caption{Illustration of incomplete graph-case 1}\label{fig-case1} \end{center} \end{figure} and show that \begin{itemize} \item if the uniform protocol is applied, then some very strict constraints on the initial states are required in order to ensure the property of never lose neighbors for $n_f > 2$ \item if the scaled protocol is applied, then for $ |u|\leq \frac{n}{n-1} R$ all initial visibility links are preserved for any $n>2 \quad \text{or} \quad n_f>1$. \end{itemize} \subparagraph{Uniform influence with a-single-leader-to-a-single-follower connection} The topology considered here belongs to the class of incomplete graphs with the followers forming a complete subgraph and the leaders forming a complete subgraph, discussed in Appendix \dref{incomplete}. Assuming the leader to be agent $n$ and its adjacent follower to be agent $n-1$ we have: \begin{itemize} \item $n_{il}=0$ for $i=1,...,n-2$ \item $n_{il}=1$ for $i = n-1$ \item $n_{if}=1$ for $i=n$ \item $n_{if}=n-2$ for $i=1,...,n-1$ \item $n_{(ij)l}=0$, for all $i,j$. \end{itemize} Thus, conditions (\dref{F2F-connect})-(\dref{L2F-preserve}) in Appendix \dref{incomplete} become: \begin{itemize} \item The leader to leader condition (\dref{L2L-connect}) is not applicable \item The condition for follower to follower connection preservation (\dref{F2F-connect}): since $n_{il} + n_{jl} \leq 1$, we obtain : $n_f\geq 1$, obvious. \item The conditions for the leader to follower connection preservation (\dref{L2F-preserve}) yields: $n<4$ (namely $n \leq 3$ or equivalently $n_f\leq 2$) and thus (\dref{u-connect}) yields $|u| \leq R (4-n)$ \end{itemize} Therefore, a single leader with a single connection to followers cannot be proven to drive the followers without losing the connection \textbf{unless the number of followers $n_f \leq 2$} and the exogenous control satisfies $|u| \leq R (4-n)$. \subparagraph{Conditional initial links preservation without limiting the number of followers} By conditional initial links preservation we mean that the initial links can be proven to be maintained only when the \textbf{initial states are limited to certain configurations}. We have shown above that for the single leader with single leader-follower connection, the initial links can be proven to be preserved only when the number of followers is limited to two. Here we show that with certain initial configurations, the restriction on the number of followers is removed. In particular, we show that there exists an exogenous control $u$ such that for certain initial configurations, the link between the leader and the leading-follower is preserved for any number of followers. In the following two lemmas we look at a graph where agent $n$ is \underline{a single leader with a single link} to a follower labelled $n-1$, which will be called "leading follower". We assume that the followers subgraph is initially complete and denote the visibility range by $R$. \LB{lemma1} Suppose that the following initial condition holds: \begin{equation*} \delta_{n-1,i}(0) < \frac{R}{n-1}; \text{ } i=1,...,n-2 \end{equation*} Then for all times $t$ we have that: \begin{equation*} \delta_{ij}(t) < \frac{2R}{n-1}; \text{ } i,j=1,...,n-2 \end{equation*} \LE {\em Proof:\/\ }\cmd{ PB} By the triangle inequality the following holds: \begin{equation*} \delta_{ij}(0) < \frac{2R}{n-1}; \text{ } i,j=1,...,n-2 \end{equation*} The Lemma follows from the fact that \emph{the distance between non-leading followers is monotonically decreasing}. This is seen from the fact that, given that the followers subgraph is complete, we have for $i,j=1,...n-2$: \begin{eqnarray*} \dot{p}_i &=& -(n-1)p_i+\sum_{k=1}^{n-1}p_k \\ \dot{p}_j &=& -(n-1)p_j+\sum_{k=1}^{n-1}p_k \end{eqnarray*} and thus \begin{eqnarray*} \frac{d}{dt} \delta_{ij}^2 (t)&=& 2(p_i(t)-p_j(t))^T(\dot{p}_i(t)-\dot{p}_j(t))\\ &=& -2(n-1) \delta_{ij}^2(t) \end{eqnarray*} with the solution \begin{equation}\dlabel{Conditional-F2F} \delta_{ij}^2 (t)=e^{-2(n-1)t}\delta_{ij}^2(0) \end{equation} {\hfill $\Box$}{\cmd{PE}} \LB{lemma2} Suppose that $|u|\leq \frac{n}{n-1} R$ and that the following initial conditions hold: \begin{eqnarray*} \delta_{n,n-1}(0) & < & R \\ \delta_{n-1,i}(0) & < & \frac{R}{n-1}; \text{ } i=1,...,n-2 \end{eqnarray*} Then for all times $t$ hold: \begin{alphlist} \titem{a} $\delta_{n,n-1}(t) \leq R$ \titem{b} $\displaystyle \delta_{n-1,i}(t) \leq \frac{R}{n-1}; \text{ } i=1,...,n-2$ \end{alphlist} \LE {\em Proof:\/\ }\cmd{ PB} We shall prove the Lemma by contradiction. Suppose \tref{a}, \tref{b} do not hold and let $t_1$ be \textbf{the first time when \tref{a} and/or \tref{b} is contradicted by one or more links}, namely that \begin{eqnarray*} \delta_{n,n-1}(t_1^+) &>& R \\ \text{and/or } \delta_{n-1,i}(t_1^+) & > & \frac{R}{n-1} \end{eqnarray*} Note that until time $t_1$ both \tref{a} and \tref{b} hold for all links and since all $\delta$'s are continuous functions, at time $t_1$ holds $\delta_{n-1,i}(t_1) \leq \frac{R}{n-1}$ and $\delta_{n,n-1}(t_1) \leq R; \text{ } i=1,...,n-2$. Consider \textbf{any one} of the links that contradicts \tref{a} or \tref{b} at time $t_1$. If link $(n,n-1)$ contradicts \tref{a}, then \begin{eqnarray} \delta_{n-1,n}(t_1) &=&R\label{n1n-t1} \\ \delta_{n-1,i}(t_1) & \leq & \frac{R}{n-1}; \quad i= (1, ...., n-2)\label{n1i-t1} \\ \frac{d }{dt}\delta_{n-1,n}^2(t_1)& > & 0\label{not-a-t1} \end{eqnarray} Starting from \begin{eqnarray*} \dot{p}_n &=& p_{n-1}-p_n+u \\ \dot{p}_{n-1} &=& \sum_{i=1}^{n-2} (p_i-p_{n-1})+p_n-p_{n-1} \end{eqnarray*} we obtain \begin{eqnarray*} \frac{d }{dt}\delta_{n-1,n}^2(t_1)& =& 2(p_{n-1}(t_1)-p_n(t_1))^T \left [ \sum_{i=1}^{n-2} \left ( p_i(t_1)-p_{n-1}(t_1) \right ) + 2\left ( p_n(t_1)-p_{n-1}(t_1) \right )-u \right ]\\ & = & -4 \delta_{n,n-1}^2(t_1)+2 \sum_{i=1}^{n-2} \left( (p_n(t_1)-p_{n-1}(t_1))^T (p_{n-1}(t_1)-p_i(t_1)) \right ) +2 (p_n(t_1)-p_{n-1}(t_1))^T u \\ & \leq & -4 R^2+2 (n-2)\frac{R^2}{n-1} + 2 R |u| \end{eqnarray*} where we used (\dref{n1n-t1}), (\dref{n1i-t1}) and the property of inner products $V_1^T V_2 \leq |V_1||V_2|$. Since $ |u|\leq \frac{n}{n-1} R$ , we have \begin{equation*} \frac{d }{dt}\delta_{n-1,n}^2(t_1) \leq -2 R^2 < 0 \end{equation*} contradicting (\dref{not-a-t1}), i.e. the assumption that \tref{a} does not hold. Now suppose that the considered link is $(n-1,i)$ for some follower $i \in 1,...,n-2$. At time $t_1$ holds \begin{eqnarray} \delta_{n,n-1}(t_1) & \leq & R\label{b1-t1} \\ \delta_{n-1,i}(t_1)& = & \frac{R}{n-1}; \quad i \in 1,...,n-2\label{b2-t1} \\ \delta_{n-1,j}(t_1) & \leq & \frac{R}{n-1}; \quad j= 1,...,n-2 ; \quad j \neq i\label{b3-t1} \end{eqnarray} If \tref{b} is contradicted by link $(n-1,i)$ for the first time at $t_1$ then $\displaystyle \frac{d}{dt}\delta_{n-1,i}^2(t_1) > 0 $ will hold. \begin{eqnarray*} \dot{p}_{n-1} &=& \sum_{j=1}^{n-2} (p_j-p_{n-1})+p_n-p_{n-1}\\ & = & -(n-1)p_{n-1}+\sum_{j=1}^{n-1} p_j-p_{n-1} +p_n\\ \dot{p}_i & = & \sum_{j=1}^{n-1} (p_j-p_i)\\ & = & - (n-1) p_i + \sum_{j=1}^{n-1} p_j \end{eqnarray*} \begin{eqnarray*} \frac{d }{dt}\delta_{n-1,i}^2(t) &= & 2(p_{n-1}(t)-p_i(t))^T [-2((n-1)(p_{n-1}(t)-p_i(t))+(p_n(t)-p_{n-1}(t))\\ & \leq & -2(n-1) \delta_{n-1,i}^2+2\delta_{n-1,i} \delta_{n,n-1}(t) \end{eqnarray*} where we used again the inequality for inner products. Considering now the above at time $t_1$ and using(\dref{b1-t1}), (\dref{b2-t1}), we obtain \begin{eqnarray*} \frac{d }{dt}\delta_{n-1,i}^2(t_1) & \leq & 2 \frac{R^2}{n-1}-2 \frac{(n-1)R^2}{(n-1)^2}\\ & \leq & 0 \end{eqnarray*} contradicting the assumption that \tref{b} does not hold at time $t_1$ for link $(n-1,i)$. {\hfill $\Box$}{\cmd{PE}} From the previous two Lemmas it follows that: \TB{cond-preserve} Let agent $n$ be a single leader with a single link to a follower labelled $n-1$. Assume that followers subgraph is initially complete and denote the visibility range by $R$. Suppose that $|u|\leq \frac{n}{n-1} R$ and that the following initial conditions hold: \begin{eqnarray*} \delta_{n,n-1}(0) & < & R\\ \delta_{n-1,i}(0) & < & \frac{R}{n-1}; \text{ } i=1,...,n-2 \end{eqnarray*} Then neighbors are never lost, i.e. all initial links are preserved. \TE \subparagraph{Scaled influence with a-single-leader-to-a-single-follower connection} We assume as before that the followers form a complete graph. The agents are labeled s.t. agent $n$ is the leader and $n-1$ is the leading follower. There are no constraints on the initial conditions, i.e. $\delta_{ij}(0) \leq R; \quad \forall i \sim j$. Recall that all agents apply the scaled protocol \begin{equation*} \dot{p}_i = \frac{1}{n_i}\sum_{j \in N_i} (p_j-p_i)+b_i u \end{equation*} where \begin{itemize} \item $p_i = (x_i \quad y_i)^T$ \item $N_i$ is the neighborhood of $i$ and $n_i=|N_i|$ \item $b_i$ is 1 if $i=n$, i.e. $i$ is the leader, and 0 otherwise \end{itemize} \TB{T-ScaledSingle} Let $n$ agents with scaled influence and with visibility range $R$ have a-single-leader-to-a-single-follower connection and complete followers subgraph. If we label the leader by $n$ and the leading follower by $n-1$, then \begin{alphlist} \titem{a} \underline{for $ i,j=1,...n-2$}, $\delta_{ij}(t)$ is monotonically decreasing, thus if $\delta_{ij}(0) \leq 0 $ then $\delta_{ij}(t) <0$ for all $t$, independently of the external control, $u$ \titem{b} if $ |u|\leq \frac{n}{n-1} R$ and \begin{eqnarray*} \delta_{n,n-1}(0) & < & R \\ \delta_{n-1,i}(0) & < & R; \quad i=1,....n-2 \end{eqnarray*} then \begin{eqnarray*} \delta_{n,n-1}(t) & \leq & R \\ \delta_{n-1,i}(t) & \leq & R; \quad i=1,....n-2 \end{eqnarray*} for all $t$ \end{alphlist} \TE {\em Proof:\/\ }\cmd{ PB} \underline{Property \tref{a}} - As before, we consider $\displaystyle \frac{d}{dt}\delta_{ij}^2(t); \quad i,j=1,...,n-2$ and use \begin{eqnarray*} \frac{d}{dt}\delta_{ij}^2(t) &= & 2(p_i(t)-p_j(t))^T(\dot{p}_i(t)-\dot{p}_j(t)) \\ \dot{p}_i(t) & = & -\frac{n-1}{n-2}p_i(t)+\frac{1}{n-2}\sum_{k=1}^{n-1}p_k(t) \\ \dot{p}_j (t)& = & -\frac{n-1}{n-2}p_j(t)+\frac{1}{n-2}\sum_{k=1}^{n-1}p_k(t) \end{eqnarray*} to obtain \begin{equation*} \frac{d}{dt}\delta_{ij}^2(t)=-2 \frac{n-1}{n-2}\delta_{ij}^2(t) \end{equation*} with the solution \begin{equation}\dlabel{Scaled-F2F} \delta_{ij}^2 (t)=e^{- 2 \frac{n-1}{n-2} t}\delta_{ij}^2(0) \end{equation} which is monotonically decreasing\\ \underline{Property \tref{b}} - We shall prove this property again by contradiction. Suppose that $t_1$ is the first time that this property is contradicted by one or more links, namely an external control $ |u|\leq \frac{n}{n-1} R$ is applied and \begin{eqnarray*} \delta_{n,n-1}(t_1^+) & > & R \\ \text{and/or } \delta_{n-1,i}(t_1^+) & > & R; \quad i=1,....n-2 \end{eqnarray*} Since $t_1$ is the first time that the above holds and all links sizes are continuous functions, for all $t \leq t_1$ property \tref{b} holds, thus \begin{eqnarray*} \delta_{n,n-1}(t_1) & \leq & R \\ \delta_{n-1,i}(t_1) & \leq & R; \quad i=1,....n-2 \end{eqnarray*} Consider any one of the links that contradicts \tref{b} at time $t_1$. \begin{enumerate} \item Assume that the link that contradicts \tref{b} at time $t_1$ is $(n,n-1)$, then let \begin{eqnarray} \delta_{n,n-1}(t_1) & = & R\label{dist-t1-nn1}\\ \delta_{n-1,i}(t_1) & \leq & R; \quad i=1,....n-2\label{dist-t1-n1i} \end{eqnarray} and show that $ \frac{d }{dt}\delta_{n,n-1}^2(t_1) > 0$ \textbf{does not hold}. \begin{eqnarray*} \dot{p}_n &=& p_{n-1}-p_n+u \\ \dot{p}_{n-1} &=& \frac{1}{n-1} \left [ \sum_{j=1}^{n-2}(p_j-p_{n-1})+(p_n-p_{n-1}) \right ] \end{eqnarray*} \begin{equation*} \dot{p}_n- \dot{p}_{n-1}=-2 (p_n-p_{n-1})+\frac{1}{n-1} \sum_{j=1}^{n-2}(p_{n-1}-p_j)+u \end{equation*} Multiplying from left by $2(p_n-p_{n-1})^T$ and using the inequality for inner products, we obtain \begin{equation*} \frac{d }{dt}\delta_{n,n-1}^2(t) \leq -4\delta_{n,n-1}^2(t)+ \frac{2}{n-1}\sum_{j=1}^{n-2} \delta_{n,n-1}(t) \delta_{n-1,j}(t)+2 \delta_{n,n-1}(t)|u| \end{equation*} Since at $t_1$ eqs. (\dref{dist-t1-nn1}), (\dref{dist-t1-n1i}) hold, we have \begin{equation*} \frac{d }{dt}\delta_{n,n-1}^2(t_1) \leq -4R^2+2\frac{n-2}{n-1}R^2+2 R |u| \end{equation*} Thus, if $|u| \leq \frac{n}{n-1}R$, then $ \frac{d }{dt}\delta_{n,n-1}^2(t_1) \leq 0$, contradicting the assumption that statement \tref{b} of the Theorem does not hold for link $(n,n-1)$. \item Consider now a link $(n-1,i)$, for any $i=1,...,n-2$ and show that it cannot be the one that first contradicts \tref{b} at time $t_1$. As for \tref{a}, we have at $t_1$ \begin{eqnarray*} \delta_{n,n-1}(t_1) & \leq & R \\ \delta_{n-1,i}(t_1) & \leq & R; \quad i=1,....n-2 \end{eqnarray*} For any link $j; \quad j \in 1,....,n-2$ assumed to contradict statement \tref{b} of the Theorem, we have to show that when $ \delta_{n-1,j}(t_1) = R$, while \begin{eqnarray} \delta_{n,n-1}(t_1) & \leq & R\label{scaled1-t1} \\ \delta_{n-1,i}(t_1) & \leq & R; \quad i \neq j\label{scaled2-t1} \end{eqnarray} if $|u| \leq \frac{n}{n-1}R$, then $ \frac{d }{dt}\delta_{n-1,j}^2(t_1) > 0$ does not hold, contradicting the assumption that statement \tref{b} of the Theorem does not hold for link $(n-1,j)$. We have \begin{eqnarray*} \dot{p}_{n-1} &=& \frac{1}{n-1} \left [ \sum_{j=1}^{n-2}(p_j-p_{n-1}) +(p_n-p_{n-1}) \right ]\\ \dot{p}_{j} &=& \frac{1}{n-2} \left [ \sum_{k=1}^{n-2}(p_k-p_j) +(p_{n-1}-p_j) \right ] \end{eqnarray*} \begin{eqnarray*} \frac{d}{dt} \delta_{n-1,j}^2(t) &=& 2(p_{n-1}(t)-p_j(t))^T (\dot{p}_{n-1}(t)-\dot{p}_j(t)) \\ &=& \frac{2}{n-1} \left [ \sum_{k=1}^{n-2}(p_{n-1}(t)-p_j(t))^T(p_k(t)-p_{n-1}(t)) + (p_{n-1}(t)-p_j(t))^T(p_n(t)-p_{n-1}(t)) \right ]\\ & & - \frac{2}{n-2}\left [ \sum_{k=1}^{n-2}(p_{n-1}(t)-p_j(t))^T(p_k(t)-p_j(t)) + \delta_{n-1,k}^2(t)\right ] \end{eqnarray*} Using now in the above equation, at $t=t_1$, $ \delta_{n-1,j}(t_1) = R$, (\dref{scaled1-t1}), (\dref{scaled2-t1}) and the inequality for inner products $V_1^T V_2 \leq |V_1||V_2|$, we obtain \begin{eqnarray*} \frac{d}{dt} \delta_{n-1,i}^2(t_1) & \leq & -\frac{2}{n-1}R^2 \\ & < & 0 \end{eqnarray*} again contradicting the assumption that statement \tref{b} of the Theorem does not hold for this link. \end{enumerate} {\hfill $\Box$}{\cmd{PE}} \subsubsection{Some simulation results with incomplete initial interaction graph}\label{IncompleteEx} In this section two examples are shown where the agents initial interaction topology is incomplete. Although we could not find analytic limits on $|u|$ such that the property of never lose neighbors is ensured we ran both cases, and many others, with $|u|< R$ and in both cases the agents converged to a complete graph which was afterwards preserved. \paragraph{Incomplete initial interaction graph - Ex1} \begin{itemize} \item n=6 \item initial number of links = 10 \item $u$ and leaders as shown in Fig. \dref{fig-IncompleteEx1} \end{itemize} \begin{figure} \begin{center} \includegraphics[scale=0.5]{UniScaledDyn-IncompleteEx1.jpg} \caption{Dynamics with Incomplete initial graph - Ex1}\label{fig-IncompleteEx1} \end{center} \end{figure} \begin{figure} \begin{center} \includegraphics[scale=0.7]{InteractionsGraph-IncompleteEx1.jpg} \caption{Convergence to complete graph - Ex1}\label{fig-GraphsIncompleteEx1} \end{center} \end{figure} \paragraph{Incomplete initial interaction graph - Ex2} \begin{itemize} \item n=8 \item initial number of links = 12 \item $u$ and leaders randomly selected, as shown in Fig. \dref{fig-IncompleteEx2} \end{itemize} \begin{figure} \begin{center} \includegraphics[scale=0.4]{StateDependentTopo-Ex2Incomplete.jpg} \caption{Convergence to complete graph - Ex2}\label{fig-GraphsIncompleteEx2} \end{center} \end{figure} \begin{figure} \begin{center} \includegraphics[scale=0.4]{Ex2IncompleteDyn.jpg} \caption{Dynamics with initially incomplete graph - Ex2}\label{fig-IncompleteEx2} \end{center} \end{figure} \newpage \msec{Summary and directions for future research}{future} In this report we introduced a model for controlling swarms of identical, simple, oblivious, myopic agents by broadcast velocity control that is received by a random set of agents in the swarm. The agents detecting the broadcast control are the ad-hoc leaders of the swarm, while they detect the exogenous control. All the agents, modeled as single integrators, apply a local linear gathering control, based on the weighted relative position to all neighbors. The weights are the neighbors' influence on the agent. The leaders superimpose the received exogenous control, a desired velocity $u$. We considered two models of neighbors influence, uniform and scaled by the size of agent's neighborhood. We have shown that if the the system is piecewise constant, where in each time interval the system evolves as a time-independent dynamic linear system with a connected visibility graph, then in each such interval, $[t_k, t_{k+1})$, the swarm tends to asymptotically align on a line in the direction of $u(t_k)$, anchored at the zero-input gathering point, $\alpha(t_k)$ and moves with a collective velocity that is a fraction of the desired velocity. We denote this fraction by $\beta(t_k)$. If the visibility graph in the interval is complete, then $\alpha(t_k)$ for both influence models is the same, the average of all agents' positions at the beginning of the interval, and $\displaystyle \beta(t_k)=\frac{n_l(t_k)}{n} $. However, if the visibility graph in the interval is incomplete then $\alpha(t_k)$ and $\beta(t_k)$ are not the same for the two models. Moreover, in the scaled case they are a function of the topology of the graph, the in-degree of its nodes and of the selected leaders. Since we assumed that in each interval the visibility graph is connected we need conditions to ensure that a connected graph remains connected. We showed that if the graph is complete then restrictions on $|u|$, pending the influence model, will ensure that it remains complete. However, when the graph is incomplete, conditions for never losing neighbors are tightly related to the graph topology and therefore not useful in practice. Never losing neighbors might be too stringent a requirement. We note that although conditions, independent of specific topologies, for never losing friends in an incomplete graph were not found, in practice all simulations that we ran showed convergence to complete graphs which were afterwards preserved if $|u|$ was within bounds.\\ In future research, we intend to extend the dynamic model to double integrators, i.e. acceleration controlled agents. Also, we are currently considering the same paradigm of stochastic broadcast control in conjunction with non-linear gathering processes, as for example \dcite{Bellaiche}, and connectedness preserving gathering processes, as for example \dcite{DJ2010}. \newpage
{'timestamp': '2016-07-19T02:07:32', 'yymm': '1607', 'arxiv_id': '1607.04881', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04881'}
arxiv
\section{Introduction}\label{sec:intro} \setlength{\abovedisplayskip}{3pt} \setlength{\abovedisplayshortskip}{3pt} \setlength{\belowdisplayskip}{3pt} \setlength{\belowdisplayshortskip}{3pt} \setlength{\jot}{2pt} \setlength{\floatsep}{2ex} \setlength{\textfloatsep}{2ex} We address the problem of \emph{learning from conditional distributions} where the goal is to learn a function that links conditional distributions to target variables. Specifically, we are provided input samples $\{x_i\}_{i=1}^N\in\Xcal^N$ and their corresponding responses $\{y_i\}_{i=1}^N\in \Ycal^N$. For each $x\in\Xcal$, there is an associated conditional distribution $p(z|x): \Zcal\times \Xcal\rightarrow \RR$. However, we cannot access the entire conditional distributions $\{p(z|x_i)\}_{i=1}^N$ directly; rather, we only observe a limited number of samples or in the extreme case only \emph{one sample} from each conditional distribution $p(z|x)$. The task is to learn a function $f$ which links the conditional distribution $p(z|x)$ to target $y \in \Ycal$ by minimizing the expected loss: \begin{equation}\label{eq:target} \min_{f\in\Fcal}~L(f)=\EE_{x,y}\sbr{\ell\rbr{y, \EE_{z|x}\sbr{f(z,x)}}} \end{equation} where $\ell:\Ycal \times\Ycal \to\RR$ is a convex loss function. The function space $\Fcal$ can be very general, but we focus on the case when $\Fcal$ is a reproducing kernel Hilbert space~(RKHS) in main text, namely, $\Fcal = \{f:\Zcal\times \Xcal\rightarrow \RR \,|\, f(z, x) = \inner{f}{\psi(z, x)}\}$ where $\psi(z, x)$ is a suitably chosen (nonlinear) feature map. Please refer to Appendix~\ref{appendix:extend_dual_embedding} for the extension to arbitrary function approximators, \eg, random features and neural networks. The problem of learning from conditional distributions appears in many different tasks. For example: \begin{itemize}[leftmargin=*,nosep,nolistsep] \item {\bf Learning with invariance.} Incorporating priors on invariance into the learning procedure is crucial for computer vision~\cite{NiyGirPog98}, speech recognition~\cite{AnsLeiRosMut13} and many other applications. The goal of invariance learning is to estimate a function which minimizes the expected risk while at the same time preserving consistency over a group of operations $g=\{g_j\}_{j=1}^\infty$. \citet{MroVoiPog15} shows that this can be accomplished by solving the following optimization problem \begin{equation}\label{eq:invariant} \min_{f\in \tilde\Hcal} \EE_{x, y} [\ell(y, \EE_{z|x\sim \mu(g(x))}[\langle f, \psi(z)\rangle_{\tilde\Hcal}] )] +(\nu/2)\|f\|_{\tilde\Hcal}^2 \end{equation} where $\tilde\Hcal$ is the RKHS corresponding to kernel $\tilde k$ with implicit feature map $\psi(\cdot)$, $\nu>0$ is the regularization parameter. Obviously, the above optimization~(\ref{eq:invariant}) is a special case of (\ref{eq:target}). In this case, $z$ stands for possible variation of data $x$ through conditional probability given by some normalized Haar measure $\mu(g(x))$. Due to computation and memory constraints, one can only afford to generate a few virtual samples from each data point $x$.\\ \item {\bf Policy evaluation in reinforcement learning.} Policy evaluation is a fundamental task in reinforcement learning. Given a policy $\pi(a|s)$ which is a distribution over action space condition on current state $s$, the goal is to estimate the value function $V^\pi(\cdot)$ over the state space. $V^\pi(s)$ is the fixed point of the Bellman equation $$ V^\pi(s) = \EE_{s'|a, s}[R(s,a)+\gamma V^\pi(s')], $$ where $R(s,a):\Scal\times \Acal\to \RR$ is a reward function and $\gamma\in(0, 1)$ is the discount factor. Therefore, the value function can be estimated from data by minimizing the mean-square Bellman error~\cite{Baird95,SutMaeSze08}: \begin{equation}\label{eq:RL_obj} \min_{~V^\pi}~\EE_{s, a}\sbr{\rbr{R(s,a) - \EE_{s'|a, s}\sbr{V^\pi(s) - \gamma V^\pi(s')}}^2}. \end{equation} Restrict the policy to lie in some RKHS, this optimization is clearly a special case of~\eq{eq:target} by viewing $\rbr{(s, a), R(s, a), s'}$ as $(x, y, z)$ in~\eq{eq:target}. Here, given state $s$ and the the action $a\sim \pi(a|s)$, the successor state $s'$ comes from the transition probability $p(s'|a,s)$. Due to the online nature of MDPs, we usually observe only one successor state $s'$ for each action $a$ given $s$,~\ie, only one sample from the conditional distribution given $s, a$.\\ \item{\bf Optimal control in linearly-solvable MDP.} The optimal control in a certain class of MDP, \ie, linearly-solvable MDP, can be achieved by solving the linear Bellman equation~\cite{Todorov06,Todorov09} \begin{equation}\label{eq:linear_optimal_bellman} z(s) = \exp\rbr{-R(s)}\EE_{s'|s\sim p(s'|s)}\sbr{z(s')}, \end{equation} where $R(s)$ denotes the immediate cost and $p(s'|s)$ denotes the passive dynamics without control. With $z(s)$, the trajectory of the optimal control $\pi^*$ can be calculated by $p^{\pi^*}(s'|s) = \frac{p(s'|s)z(s)}{\EE_{s'|s\sim p(s'|s)}\sbr{z(s')}}$. Therefore, $z(\cdot)$ can be estimated from data by optimizing \begin{equation}\label{eq:OC_obj} \min_{~z}~\EE_{s}\sbr{\rbr{z(s) - \EE_{s'|s}\sbr{\exp\rbr{-R(s)}z(s')}}^2}. \end{equation} Restricting function $z(\cdot)$ to lie in some RKHS, this optimization is a special case of~\eq{eq:target} by viewing $\rbr{s, 0, s'}$ as $(x, y, z)$ in~\eq{eq:target}. Here given a state $s$, the successor state $s'$ comes from the passive dynamics. Similar as policy evaluation, we usually observe only one successor state $s'$ given $s$,~\ie, only one sample from the conditional distribution given $s$.\\ \item{\bf Hitting time and stationary distribution in stochastic process.} Estimating the hitting time and stationary distribution of stochastic process are both important problems in social network application and MCMC sampling technique. Denote the transition probability as $p(s'|s)$. The hitting time of $s_j$ starting from $s_i$ is defined as $H(s_i, s_j) = \inf\cbr{n\ge 0; S_n = s_j, S_0 = s_i}$. Hence, the expected hitting time $h(\cdot, \cdot)$ satisfies \begin{eqnarray} h(s_i, s_j) = \begin{cases} 1 + \EE_{s_k\sim p(s|s_i), s_k\neq s_j}\sbr{h(s_k, s_j)} & \quad \text{if } i\neq j\\ 1 + \EE_{s_k\sim p(s|s_i)}\sbr{h(s_k, s_i)} & \quad \text{if } i = j\\ \end{cases}. \end{eqnarray} Based on the property of stochastic process, we can obtain the stationary distribution with $\pi(s_i) = \frac{1}{h(s_i, s_i)}$. The hitting time $h(\cdot, \cdot)$ can be learned by minimizing: \begin{eqnarray}\label{eq:HT_obj} \min_{h}\EE_{s, t}\sbr{\rbr{1 - \EE_{s'\sim \tilde p(s'|s, t)}\sbr{h(s, t) - h(s', t)}}^2}, \end{eqnarray} where $\tilde p(s'|s, t) = p(s'|s)$ if $s=t$, otherwise $\tilde p(s'|s, t) \propto \begin{cases} p(s'|s) & \quad \text{if } s'\neq t\\ 0 & \quad \text{if } s' = t\\ \end{cases}$. Similarly, when restricting the expected hitting time to lie in some RKHS, this optimization is a special case of~\eq{eq:target} by viewing $\rbr{(s, t), 1, s'}$ as $(x, y, z)$ in~\eq{eq:target}. Due to the stochasticity of the process, we only obtain one successor state $s'$ from current state $(s, t)$,~\ie, only one sample from the conditional distribution given $(s, t)$. \end{itemize} \paragraph{Challenges.} Despite the prevalence of learning problems in the form of \eq{eq:target}, solving such problem remains very challenging for two reasons: (\emph{i}) we often have limited samples or in the extreme case only one sample from each conditional distribution $p(z|x)$, making it difficult to accurately estimate the conditional expectation. (\emph{ii}) the conditional expectation is nested inside the loss function, making the problem quite different from the traditional stochastic optimization setting. This type of problem is called {\sl compositional stochastic programming}, and very few results have been established in this domain. \paragraph{Related work.} A simple option to address (\ref{eq:target}) is using sample average approximation (SAA), and thus, instead solve $$ \min_{f\in\Fcal} \frac{1}{N} \sum_{i=1}^N \sbr{\ell\rbr{y_i, \frac{1}{M}\sum_{j=1}^M f(z_{ij}, x_i)}}, $$ where $\{(x_i,y_i)\}_{i=1}^N\sim p(x,y)$, and $\{z_{ij}\}_{j=1}^M\sim p(z|x_i)$ for each $x_i$. To ensure an excess risk of $\epsilon$, both $N$ and $M$ need be at least as large as $\Ocal(1/\epsilon^2)$, making the overall sample required to be $\Ocal(1/\epsilon^4)$; see~\cite{NemJudLanSha09,WanFanLiu14} and references therein. Hence, when $M$ is small, SAA would provide poor results. A second option is to resort to stochastic gradient methods (SGD). One can construct a \emph{biased} stochastic estimate of the gradient using $ {\nabla}_f L = \nabla \ell(y, \langle f,\tilde{\psi}(x)\rangle) \tilde{\psi}(x), $ where $\tilde{\psi}(x)$ is an estimate of $\EE_{z|x}[\psi(z,x)]$ for any $x$. To ensure convergence, the bias of the stochastic gradient must be small,~\ie, a large amount of samples from the conditional distribution is needed. Another commonly used approach is to first represent the conditional distributions as the so-called kernel conditional embedding, and then perform a supervised learning step on the embedded conditional distributions~\cite{SonFukGre13, GruLevBalPatetal12}. This two-step procedure suffers from poor statistical sample complexity and computational cost. The kernel conditional embedding estimation costs $O(N^3)$, where $N$ is number of pair of samples $(x, z)$. To achieve $\epsilon$ error in the conditional kernel embedding estimation, $N$ needs to be $\Ocal(1/\epsilon^4)$\footnote{With appropriate assumptions on joint distribution $p(x, z)$, a better rate can be obtained~\cite{GruLevBalPatetal12}. However, for fair comparison, we did not introduce such extra assumptions.}. Recently,~\citet{WanFanLiu14} solved a related but fundamentally distinct problem of the form, \begin{equation}\label{eq:WanFanLiu} \min_{f\in\Fcal}~L(f)=\EE_{y}\sbr{\ell(y, \EE_{z}[f(z)])} \end{equation} where $f(z)$ is a smooth function parameterized by some finite-dimensional parameter. The authors provide an algorithm that combines stochastic gradient descent with moving average estimation for the inner expectation, and achieves an overall $\Ocal(1/\epsilon^{3.5})$ sample complexity for smooth convex loss functions. The algorithm does not require the loss function to be convex, but it cannot directly handle random variable $z$ with \emph{infinite support}. Hence, such an algorithm does not apply to the more general and difficult situation that we consider in this paper. \paragraph{Our approach and contribution.} To address the above challenges, we propose a novel approach called \emph{dual kernel embedding}. The key idea is to reformulate (\ref{eq:target}) into a min-max or saddle point problem by utilizing the Fenchel duality of the loss function. We observe that with smooth loss function and continuous conditional distributions, the dual variables form a continuous function of $x$ and $y$. Therefore, we can parameterize it as a function in some RKHS induced by any universal kernel, where the information about the marginal distribution $p(x)$ and conditional distribution $p(z|x)$ can be aggregated via a kernel embedding of the joint distribution $p(x,z)$. Furthermore, we propose an efficient algorithm based on stochastic approximation to solve the resulting saddle point problem over RKHS spaces, and establish finite-sample analysis of the generic learning from conditional distributions problems. Compared to previous applicable approaches, an advantage of the proposed method is that it requires only \emph{one sample} from each conditional distribution. Under mild conditions, the overall sample complexity reduces to $\Ocal(1/\epsilon^2)$ in contrast to the $\Ocal(1/\epsilon^4)$ complexity required by SAA or kernel conditional embedding. As a by-product, even in the degenerate case (\ref{eq:WanFanLiu}), this implies an $\Ocal(1/\epsilon^2)$ sample complexity when inner function is linear, which already surpasses the result obtained in \cite{WanFanLiu14} and is known to be unimprovable. Furthermore, our algorithm is generic for the family of problems of learning from conditional distributions, and can be adapted to problems with different loss functions and hypothesis function spaces. Our proposed method also offers some new insights into several related applications. In reinforcement learning settings, our method provides the first algorithm that truly minimizes the mean-square Bellman error~(MSBE) with both theoretical guarantees and sample efficiency. We show that the existing gradient-TD2 algorithm by~\citet{SutMaePreBhaetal09,LiuLiuGhaMah15}, is a special case of our algorithm, and the residual gradient algorithm~\cite{Baird95} is derived by optimizing an upper bound of MSBE. In the invariance learning setting, our method also provides a unified view of several existing methods for encoding invariance. Finally, numerical experiments on both synthetic and real-world datasets show that our method can significantly improve over the previous state-of-the-art performances. \section{Preliminaries}\label{sec:preliminary} We first introduce our notations on Fenchel duality, kernel and kernel embedding. Let $\Xcal\subset \RR^d$ be some input space and $k:\Xcal\times\Xcal\to\RR$ be a positive definite kernel function. For notation simplicity, we denote the feature map of kernel $k$ or $\tilde k$ as $$ \phi(x):= k(x,\cdot),\quad \psi(z) : = \tilde k(z, \cdot), $$ and use $k(x,\cdot)$ and $\phi(x)$, or $\tilde k(z, \cdot)$ and $\psi(z)$ interchangeably. Then $k$ induces a RKHS $\Hcal$, which has the property $h(x) = \langle h,\phi(x)\rangle_{\Hcal}$, $\forall h\in \Hcal$, where $\langle\cdot,\cdot\rangle_{\Hcal}$ is the inner product and $\|h\|_\Hcal^2:=\langle h,h\rangle_\Hcal$ is the norm in $\Hcal$. We denote all continuous functions on $\Xcal$ as $\Ccal(\Xcal)$ and $\|\cdot\|_\infty$ as the maximum norm. We call $k$ a \emph{universal kernel} if $\Hcal$ is dense in $\Ccal(\Omega')$ for any compact set $\Omega'\subseteq\Xcal$,~\ie, for any $\epsilon>0$ and $u\in \Ccal(\Omega')$, there exists $h\in\Hcal$, such that $\|u-h\|_\infty\leq \epsilon$. Examples of universal kernel include the Gaussian kernel, $k(x, x') = \exp\rbr{-\frac{\|x-x'\|_2^2}{\sigma^{-2}}}$, Laplacian kernel, $k(x, x') =\exp\rbr{-\frac{\|x-x'\|_1}{\sigma^{-1}}}$, and so on. \paragraph{Convex conjugate and Fenchel duality.} Let $\ell : \RR^d\rightarrow \RR$, its convex conjugate function is defined as $$ \ell^*(u) = \sup_{v\in \RR^d}\{u^\top v - \ell(v)\}. $$ When $\ell$ is proper, convex and lower semicontinuous for any $u$, its conjugate function is also proper, convex and lower semicontinuous. More improtantly, the $(\ell, \ell^*)$ are dual to each other, \ie, $(\ell^*)^* = \ell$, which is known as Fenchel duality~\cite{HirLem12,RifLip07}. Therefore, we can represent the $\ell$ by its convex conjugate as , $$ \ell(v) = \sup_{u\in \RR^d}\{v^\top u - \ell^*(u)\}. $$ It can be shown that the supremum achieves if $v\in \partial \ell^*(u)$, or equivalently $u\in \partial \ell(v)$. \paragraph{Function approximation using RKHS.} Let $\Hcal^\delta:=\{h\in\Hcal:\|h\|_{\Hcal}^2\leq \delta\}$ be a bounded ball in the RKHS, and we define the approximation error of the RKHS $\Hcal^\delta$ as the error from approximating continuous functions in $\Ccal(\Xcal)$ by a function $h\in \Hcal^\delta$, \ie,~\cite{Bach14,Barron93} \begin{equation} \begin{array}{c} \Ecal(\delta):=\sup_{u\in\CC(\Xcal)}\inf_{h\in \Hcal^\delta}\|u-h\|_\infty. \end{array} \end{equation} One can immediately see that $\Ecal(\delta)$ decreases as $\delta$ increases and vanishes to zero as $\delta$ goes to infinity. If $\Ccal(\Xcal)$ is restricted to the set of uniformly bounded continuous functions, then $\Ecal(\delta)$ is also bounded. The approximation property,~\ie,~dependence on $\delta$ remains an open question for general RKHS, but has been carefully established for special kernels. For example, with the kernel $k(x,x') = 1/(1+\exp(\inner{x}{x'}))$ induced by the sigmoidal activation function, we have $\Ecal(\delta)=O(\delta^{-2/(d+1)}\log(\delta))$ for Lipschitz continuous function space $\Ccal(\Xcal)$~\cite{Bach14}.\footnote{The rate is also known to be unimprovable by~\citet{DeVHowMic89}.} \paragraph{Hilbert space embedding of distributions.} Hilbert space embeddings of distributions~\cite{SmoGreSonSch07} are mappings of distributions into potentially \emph{infinite} dimensional feature spaces, \begin{align} \mu_{x} \, := \, \EE_{x} \sbr{\phi(x)} \, = \, \int_{\Xcal} \phi(x) p(x) dx~:~ \Pcal \mapsto \Hcal \label{eq:embedding} \end{align} where the distribution is mapped to its expected feature map,~\ie,~to a point in a feature space. Kernel embedding of distributions has rich representational power. Some feature map can make the mapping injective~\cite{SriGreFukLanetal08}, meaning that if two distributions are different, they are mapped to two distinct points in the feature space. For instance, when $\Xcal\subseteq\RR^d$, the feature spaces of many commonly used kernels, such as the Gaussian RBF kernel, will generate injective embedding. We can also embed the joint distribution $p(x,y)$ over a pair of variables using two kernels $k(x,x) = \inner{\phi(x)}{\phi(x')}_{\Hcal}$ and $\tilde k(z,z') = \inner{\psi(z)}{\psi(z')}_{\Gcal}$ as \begin{eqnarray*} \Ccal_{zx} \, &:=& \, \EE_{zx} \sbr{\psi(z)\otimes \phi(x)} \\ &=& \int_{\Zcal\times\Xcal} \psi(z)\otimes \phi(x) p(z,x) dzdx : \Pcal \mapsto \Hcal\otimes\Gcal, \end{eqnarray*} where the joint distribution is mapped to a point in a tensor product feature space. Based on embedding of joint distributions, kernel embedding of conditional distributions can be defined as $\Ucal_{z|x}:=\Ccal_{zx}\Ccal_{xx}^{-1}$ as an operator $\Hcal \mapsto \Gcal$~\cite{SonFukGre13}. With $\Ucal_{z|x}$, we can obtain the expectations easily, \ie, \begin{eqnarray} \EE_{z|x}\sbr{g(z)} = \langle g, \langle \Ucal_{z|x}, \phi(x)\rangle_{\Hcal} \rangle_{\Gcal}. \end{eqnarray} Both the joint distribution embedding, $\Ccal_{zx}$, and the conditional distribution embedding, $\Ucal_{z|x}$, can be estimated from \iid~samples $\{(x_i, z_i)\}_{i=1}^N$ from $p(x, z)$ or $p(z|x)$, respectively~\cite{SmoGreSonSch07, SonFukGre13}, as \begin{eqnarray*} \widehat\Ccal_{zx} = \frac{1}{N}\Psi \Upsilon^\top, ~\text{and}~~~ \widehat \Ucal_{z|x} = \Psi(K + \lambda I)^{-1}\Upsilon^\top, \end{eqnarray*} where $\Psi = (\psi(z_1), \ldots, \psi(z_N))$, $\Upsilon = (\phi(x_1), \ldots, \phi(x_N))$, and $K = \Upsilon^\top \Upsilon$. Due to the inverse of $K + \lambda I$, the kernel conditional embedding estimation requires $\Ocal(N^3)$ cost. \section{Dual Embedding Framework} In this section, we propose a novel and sample-efficient framework to solve problem~\eq{eq:target}. Our framework leverages Fenchel duality and feature space embedding technique to bypass the difficulties of nested expectation and the need for overwhelmingly large sample from conditional distributions. We start by introducing the interchangeability principle, which plays a fundamental role in our method. \begin{lemma}[interchangeability principle]\label{lem:switch_correct} Let $\xi$ be a random variable on $\Xi$ and assume for any $\xi\in \Xi$, function $g(\cdot,\xi):\RR\to(-\infty,+\infty)$ is a proper\footnote{We say $g(\cdot, \xi)$ is proper when $\{u\in \RR: g(u, \xi)<\infty\}$ is non-empty and $g(u, \xi)>-\infty$ for $\forall u$.} and upper semicontinuous\footnote{We say $g(\cdot, \xi)$ is upper semicontinuous when $\{u\in \RR: g(u, \xi)<\alpha\}$ is an open set for $\forall \alpha\in\RR$. Similarly, we say $g(\cdot, \xi)$ is lower semicontinuous when $\{u\in \RR: g(u, \xi) >\alpha\}$ is an open set for $\forall\alpha\in \RR$.} concave function. Then \begin{equation*} \EE_{\xi}[\max_{u\in\RR}g(u,\xi)] =\max_{u(\cdot)\in \Gcal(\Xi)}\EE_{\xi}[g(u(\xi),\xi)]. \end{equation*} where $\Gcal(\Xi)=\{u(\cdot):\Xi\to\RR\}$ is the entire space of functions defined on support $\Xi$. \end{lemma} The result implies that one can replace the expected value of point-wise optima by the optimum value over a function space. For the proof of lemma~\ref{lem:switch_correct}, please refer to Appendix~\ref{appendix:dualcontinuity}. More general results of interchange between maximization and integration can be found in \cite[Chapter~14]{RocWet98} and \cite[Chapter~7]{ShaDen14}. \subsection{Saddle Point Reformulation} Let the loss function $\ell_y(\cdot):=\ell(y,\cdot)$ in \eq{eq:target} be a proper, convex and lower semicontinuous for any $y$. We denote $\ell_y^*(\cdot)$ as the convex conjugate; hence $\ell_y(v) = \max_{u}\{uv-\ell^*_y(u)\}$, which is also a proper, convex and lower semicontinuous function. Using the Fenchel duality, we can reformulate problem~\eq{eq:target} as \begin{eqnarray}\label{eq:dual_opt} \min_{f\in\Fcal} \EE_{xy}\bigg[\max_{u\in \RR} \Big[\EE_{z|x}[f(z,x)]\cdot u - \ell_y^*(u) \Big]\bigg], \end{eqnarray} Note that by the concavity and upper-semicontinuity of $-\ell_y^*(\cdot)$, for any given pair $(x,y)$, the corresponding maximizer of the inner function always exists. Based on the interchangeability principle stated in Lemma~\ref{lem:switch_correct}, we can further rewrite (\ref{eq:dual_opt}) as \begin{equation}\label{eq:dual_opt_exchange} \min_{f\in\Fcal} \max_{u(\cdot)\in \Gcal(\Xi)}\Phi(f,u):= \EE_{zx}[f(z,x)\cdot u(x,y)] - \EE_{xy}[\ell_y^*(u(x,y))], \end{equation} where $\Xi=\Xcal\times\Ycal$ and $\Gcal(\Xi)=\{u(\cdot):\Xi\to\RR\}$ is the entire function space on $\Xi$. We emphasize that the $\max$-operator in~\eq{eq:dual_opt} and~\eq{eq:dual_opt_exchange} have different meanings: the one in~\eq{eq:dual_opt} is taking over a single variable, while the other one in~\eq{eq:dual_opt_exchange} is over all possible function $u(\cdot)\in\Gcal(\Xi)$. Now that we have eliminated the nested expectation in the problem of interest, and converted it into a stochastic saddle point problem with an additional dual function space to optimize over. By definition, $\Phi(f,u)$ is always concave in $u$ for any fixed $f$. Since $f(z,x) = \inner{f}{\psi(z,x)}$, $\Phi(f,u)$ is also convex in $f$ for any fixed $u$. Our reformulation (\ref{eq:dual_opt_exchange}) is indeed a convex-concave saddle point problem. \begin{figure*}[!t] \centering \begin{tabular}{ccc} \includegraphics[width=0.315\textwidth, trim=1cm 0.8cm 1.6cm 1.6cm, clip]{figure/illustration_f_reverse_1.pdf}& \includegraphics[width=0.315\textwidth, trim=1cm 0.8cm 1.6cm 1.6cm, clip]{figure/illustration_f_reverse_50.pdf} & \includegraphics[width=0.315\textwidth, trim=1cm 0.8cm 1.6cm 1.6cm, clip]{figure/illustration_f_reverse_150.pdf} \\ (a) $0$-th Iteration &(b) $50$-th Iteration &(c) $150$-th Iteration \\ \includegraphics[width=0.315\textwidth, trim=1cm 0.8cm 1.6cm 1.6cm, clip]{figure/illustration_f_reverse_400.pdf} & \includegraphics[width=0.315\textwidth, trim=1cm 0.8cm 1.6cm 1.6cm, clip]{figure/illustration_f_reverse_1000.pdf} & \includegraphics[width=0.315\textwidth, trim=1cm 0.8cm 1.6cm 1.6cm, clip]{figure/illustration_f_reverse_2000.pdf} \\ (a) $400$-th Iteration &(b) $1000$-th Iteration &(c) $2000$-th Iteration \\ \end{tabular} \caption{Toy example with $f^*$ sampled from a Gaussian processes. The $y$ at position $x$ is obtained by smoothing $f^*$ with a Gaussian distribution condition on location $x$, \ie, $y = \EE_{z|x}\sbr{f^*(z)}$ where $z\sim p(z|x) = \Ncal\rbr{x, 0.3}$. Given samples $\{x, y\}$, the task is to recover $f^*(\cdot)$. The blue dash curve is the ground-truth $f^*(\cdot)$. The cyan curve is the observed noisy $y$. The red curve is the recovered signal $f(\cdot)$ and the green curve denotes the dual function $u(\cdot, y)$ with the observed $y$ plugged for each corresponding position $x$. Indeed, the dual function $u(\cdot, y)$ emphasizes the difference between $y$ and $\EE_{z|x}\sbr{f(z)}$ on every $x$. The interaction between primal $f(\cdot)$ and dual $u(\cdot, y)$ results in the recovery of the denoised signal.} \label{fig:procedure_illustration} \end{figure*} \paragraph{An example.} Let us illustrate this through a concrete example. Let $f^*(\cdot)\in\Fcal$ be the true function, and output $y = \EE_{z|x}\sbr{f^*(z)}$ given $x$. We can recover the true function $f^*(\cdot)$ by solving the optimization problem $$ \min_{f\in \Fcal}\EE_{xy}\sbr{\frac{1}{2}\rbr{y - \EE_{z|x}\sbr{f(z)}}^2}. $$ In this example, $\ell_y(v)=\frac{1}{2}(y-v)^2$ and $\ell_y^*(u)=uy+\frac{1}{2}u^2$. Invoking the saddle point reformulation, this leads to $$ \min_{f\in \Fcal}\max_{ u\in \Gcal(\Xi)}\EE_{xyz}\sbr{\rbr{f(z) - y}u(x,y)} - \frac{1}{2}\EE_{xy}\sbr{u(x,y)^2} $$ where the dual function $u(x,y)$ fits the discrepancy between $y$ and $\EE_{z|x}\sbr{f(z)}$, and thus, promotes the performance of primal function by emphasizing the different positions. See Figure~\ref{fig:procedure_illustration} for the illustration of the interaction between the primal and dual functions. \subsection{Dual Continuation} Although the reformulation in \eq{eq:dual_opt_exchange} gives us more structure of the problem, it is not yet tractable in general. This is because the dual function $u(\cdot)$ can be an arbitrary function which we do not know how to represent. In the following, we will introduce a tractable representation for (\ref{eq:dual_opt_exchange}). First, we will define the function $u^*(\cdot):\Xi=\Xcal\times\Ycal\to\RR$ as the \emph{optimal dual function} if for any pair $(x,y)\in\Xi$, $$u^*(x,y)\in\argmax\nolimits_{u\in\RR} \left\{u\cdot \EE_{z|x}[f(z,x)] - \ell_y^*(u)\right\}.$$ Note the optimal dual function is well-defined since the optimal set is nonempty. Furthermore, $u^*(x,y)$ is related to the conditional distribution via $u^*(x,y)\in \partial \ell_y(\EE_{z|x}[f(z,x)])$. This can be simply derived from convexity of loss function and Fenchel's inequality; see~\cite{HirLem12} for a more formal argument. Depending on the property of the loss function $\ell_y(v)$, we can further derive that (see proofs in Appendix~\ref{appendix:dualcontinuity}): \begin{proposition}\label{prop:dualcontinuity} Suppose both $f(z,x)$ and $p(z|x)$ are continuous in $x$ for any $z$, \begin{enumerate} \item[(1)] (Discrete case) If the loss function $\ell_y(v)$ is continuously differentiable in $v$ for any $y\in\Ycal$, then $u^*(x,y)$ is unique and continuous in $x$ for any $y\in \Ycal$; \item[(2)] (Continuous case) If the loss function $\ell_y(v)$ is continuously differentiable in $(v,y)$, then $u^*(x,y)$ is unique and continuous in $(x,y)$ on $\Xcal\times\Ycal$. \end{enumerate} \end{proposition} This assumption is satisfied widely in real-world applications. For instance, when it comes to the policy evaluation problem in~\ref{eq:RL_obj}, the corresponding optimal dual function is continuous as long as the reward function is continuous, which is true for many reinforcement tasks. The fact that the optimal dual function is a continuous function has interesting consequences. As we mentioned earlier, the space of dual functions can be arbitrary and difficult to represent. Now we can simply restrict the parametrization to the space of continuous functions, which is tractable and still contains the global optimum of the optimization problem in~\eq{eq:dual_opt_exchange}. This also provides us the basis for using an RKHS to approximate these dual functions, and simply optimizing over the RKHS. \subsection{Feature Space Embedding} In the rest of the paper, we assume conditions described in Proposition~\ref{prop:dualcontinuity} always hold. For the sake of simplicity, we focus only on the case when $\Ycal$ is a continuous set. Hence, from Proposition~\ref{prop:dualcontinuity}, the optimal dual function is indeed continuous in $(x,y)\in\Xi=\Xcal\times\Ycal$. As an immediate consequence, we lose nothing by restricting the dual function space $\Gcal(\Xi)$ to be continuous function space on $\Xi$. Recall that with the universal kernel, we can approximate any continuous function with arbitrarily small error. Thus we approximate the dual space $\Gcal(\Xi)$ by the bounded RKHS $\Hcal^{\delta}$ induced by a universal kernel $k((x,y), (x',y')) = \langle \phi(x,y), \phi(x',y')\rangle_{\Hcal}$ where $\phi(\cdot)$ is the implicit feature map. Therefore, $u(x,y) = \inner{u}{\phi(x,y)}_{\Hcal}$. Note that $\Hcal^\delta$ is a subspace of the continuous function space, and hence is a subspace of the dual space $\Gcal(\Xi)$. To distinguish inner product between the primal function space $\Fcal$ and the dual RKHS $\Hcal^\delta$, we denote the inner product in $\Fcal$ as $\langle \cdot, \cdot\rangle_{\Fcal}$. We can rewrite the saddle point problem in~\eq{eq:dual_opt_exchange} as \begin{align}\label{eq:dual_approximate} \min_{f \in\Fcal} \max_{u\in \Hcal^\delta} \Phi(f,u) &= \EE_{xyz}\sbr{\langle f,\psi(z,x)\rangle_{\Fcal}\cdot\langle u, \phi(x,y)\rangle_{\Hcal} \hspace{-1mm}-\hspace{-1mm} \ell_y^*(\langle u, \phi(x,y)\rangle_{\Hcal})} \nonumber\\ &= f^\top \Ccal_{zxy} u - \EE_{xy}[\ell_y^*(\langle u, \phi(x,y)\rangle_{\Hcal})], \end{align} where $f(z, x) = \langle f, \psi(z, x)\rangle_{\Fcal}$ by the definition of $\Fcal$, and $\Ccal_{zxy} = \EE_{zxy}[\psi(z,x)\otimes\phi(x,y)]$ is the joint embedding of $p(z,x, y)$ over $\Fcal\times \Hcal$. The new saddle point approximation (\ref{eq:dual_approximate}) based on dual kernel embedding allows us to efficient represent the dual function and get away from the fundamental difficulty with insufficient sampling from the conditional distribution. There is no need to access either the conditional distribution $p(z|x)$, the conditional expectation $\EE_{z|x}\sbr{\cdot}$, or the conditional embedding operator $\Ucal_{z|x}$ anymore, therefore, reducing both the statistical and computational complexity. Specifically, given a pair of sample $(x,y,z)$, where $(x,y)\sim p(x,y)$ and $z\sim p(z|x)$, we can now easily construct an unbiased stochastic estimate for the gradient, namely, \begin{eqnarray*} \nabla_{{f}}\hat{\Phi}_{x,y,z}({f},u)&=&\psi(z,x) u(x,y),\\ \nabla_{u}\hat{\Phi}_{x,y,z}({f},u)&=&[f(z,x)-\nabla \ell_y^*(u(x,y))] \phi(x,y), \end{eqnarray*} with $\EE\sbr{\nabla\hat{\Phi}_{x,y,z}({f},u)}=\nabla\Phi(f, u)$, respectively. For simplicity of notation, we use $\nabla$ to denote the subgradient as well as the gradient. With the unbiased stochastic gradient, we are now able to solve the approximation problem (\ref{eq:dual_approximate}) by resorting to the powerful mirror descent stochastic approximation framework~\cite{NemJudLanSha09}. \subsection{Sample-Efficient Algorithm} The algorithm is summarized in Algorithm~\ref{alg:stochastic_composite_general}. At each iteration, the algorithm performs a projected gradient step both for the primal variable $f$ and dual variable $u$ based on the unbiased stochastic gradient. The proposed algorithm avoids the need for overwhelmingly large sample sizes from the conditional distributions when estimating the gradient. At each iteration, only one sample from the conditional distribution is required in our algorithm! Throughout our discussion, we make the following standard assumptions: \begin{assumption}\label{asp:bounded} There exists constant scalars $C_\Fcal$, $M_\Fcal$, and $c_\ell$, such that for any ${f}\in{\Fcal},u\in\Hcal^\delta$, \begin{eqnarray*} \EE_{z,x}[\|f(z,x)\|_2^2]\leq M_\Fcal, \quad\EE_{z,x}[\|\psi(z,x)\|_\Fcal^2]\leq C_\Fcal, \quad \EE_{y}[\|\nabla \ell^*_y(u)\|_2^2]\leq c_\ell. \end{eqnarray*} \end{assumption} \begin{assumption}\label{asp:kernel} There exists constant $\kappa>0$ such that $k(w,w')\leq \kappa$ for any $w,w'\in\Xcal$. \end{assumption} Assumption~\ref{asp:bounded} and~\ref{asp:kernel} basically suggest that the variance of our stochastic gradient estimate is always bounded. Note that we do not assume any strongly convexity or concavity of the saddle point problem, or Lipschitz smoothness. Hence, we set the output as the average of intermediate solutions weighted by the learning rates $\{\gamma_i\}$, as often used in the literature, to ensure the convergence of the algorithm. \begin{algorithm}[t!] \caption{\textbf{Embedding-SGD} for Optimization~(\ref{eq:dual_approximate})} \text{\bf Input:} $p(x,y),\, p(z|x),\, \psi(z,x),\,\phi(x,y),\, \{\gamma_i\geq 0\}_{i=1}^t$\\[-4mm] \begin{algorithmic}[1]\label{alg:stochastic_composite_general} \FOR{$i=1,\ldots, t$} \STATE Sample $(x_i,y_i) \sim p(x,y)$ and $z_i \sim p(z|x)$. \STATE ${f}_{i+1} = \Pi_{\Fcal}({f}_i-\gamma_i\psi(z_i,x_i)u_i(x_i,y_i))$. \STATE $u_{i+1} = \Pi_{\Hcal^\delta}(u_i+\gamma_i [f_i(z_i,x_i)-\nabla \ell_{y_i}^*(u_i(x_i,y_i))]\phi(x_i,y_i))$ \ENDFOR\\ \text{\bf Output:} $\bar{f}_t=\frac{\sum_{i=1}^t\gamma_i{f}_i}{\sum_{i=1}^t\gamma_i}$, $\bar u_t=\frac{\sum_{i=1}^t \gamma_iu_i}{\sum_{i=1}^t \gamma_i}$ \end{algorithmic} \end{algorithm} Define the accuracy of any candidate solution $(\bar f,\bar u)$ to the saddle point problem as \begin{equation}\label{eq:sadaccuracy} \epsilon_{\rm gap}(\bar f,\bar u):=\max_{u\in \Hcal^\delta}\Phi(\bar f,u)-\min_{f\in\Fcal}\Phi(f,\bar u). \end{equation} We have the following convergence result, \begin{theorem} \label{thm:main} Under Assumptions~\ref{asp:bounded} and~\ref{asp:kernel}, the solution $(\bar{f}_t,\bar u_t)$ after $t$ steps of the algorithm with step-sizes being $\gamma_t=\frac{\gamma}{\sqrt{t}} (\gamma>0)$ satisfies: \begin{equation}\label{eq:mainbound} \EE[\epsilon_{\rm gap} (\bar{f}_t,\bar u_t)]\leq [(2D_{\Fcal}^2+4\delta)/\gamma+\gamma \Ccal(\delta,\kappa) ]\frac{1}{\sqrt{t}} \end{equation} where $D_{\Fcal}^2=\sup_{{f}\in{\Fcal}}\frac{1}{2}\|{f}_0-{f}\|_2^2$ and $\Ccal(\delta,\kappa)= \kappa(5M_\Fcal+c_\ell)+\frac{1}{8}(\delta+\kappa)^2C_\Fcal$. \end{theorem} The above theorem implies that our algorithm achieves an overall $\Ocal(1/\sqrt{t})$ convergence rate, which is known to be unimprovable already for traditional stochastic optimization with general convex loss function \cite{NemJudLanSha09}. We further observe that \begin{proposition} \label{prop:Lipschitzianity} If $f(z,x)$ is uniformly bounded by $C$ and $\ell_y^*(v)$ is uniformly $K$-Lipschitz continuous in $v$ for any $y$, then $\Phi(f,u)$ is $(C+K)$-Lipschitz continuous on $\Gcal(\Xi)$ with respect to $\|\cdot\|_\infty$, i.e. $$|\Phi(f,u_1)-\Phi(f,u_2)|\leq (C+K)\|u_1-u_2\|_\infty, \forall u_1,u_2\in\Gcal(\Xi).$$ \end{proposition} Let ${f}_*$ be the optimal solution to (\ref{eq:target}). Invoking the Lipschitz continuity of $\Phi$ and using standard arguments of decomposing the objective, we have $$L(\bar {f}_t)-L({f}_*)\leq \epsilon_{\rm gap}(\bar {f}_t,\bar u_t)+2(C+K)\Ecal(\delta).$$ Combining Proposition~\ref{prop:Lipschitzianity} and Theorem~\ref{thm:main}, we finally conclude that under the conditions therein, \begin{equation}\label{eq:combinedbound} \EE[L(\bar{f}_t)-L({f}_*)]\leq \Ocal\left(\frac{\delta^{3/2}}{\sqrt{t}} +\Ecal(\delta)\right). \end{equation} There is clearly a delicate trade-off between the optimization error and approximation error. Using large $\delta$ will increase the optimization error but decrease the approximation error. When $\delta$ is moderately large (which is expected in the situation when the optimal dual function has small magnitude), our dual kernel embedding algorithm can achieve an overall $\Ocal(1/\epsilon^2)$ sample complexity when solving learning problems in the form of (\ref{eq:target}). For the analysis details, please refer to Appendix~\ref{appendix:convergece_rate}. \section{Applications}\label{sec:application} In this section, we discuss in details how the dual kernel embedding can be applied to solve several important learning problems in machine learning, \eg, learning with invariance and reinforcement learning, which are the special cases of the optimization~\eq{eq:target}. {By simple verification, these examples satisify our assumptions for the convergence of algorithm.} We tailor the proposed algorithm for the respective learning scenarios and unify several existing algorithms for each learning problem into our framework. Due to the space limit, we only focus on algorithms with kernel embedding. Extended algorithms with random feature, doubly SGD, neural networks as well as their hybrids can be found in Appendix~\ref{appendix:dual_random_fea},~\ref{appendix:doublySGD} and~\ref{appendix:dual_neural_networks}. \subsection{Learning with Invariant Representations} {\bf Invariance learning.} The goal is to solve the optimization (\ref{eq:invariant}), which learns a function in RKHS $\tilde\Hcal$ with kernel $\tilde k$. Applying the dual kernel embedding, we end up solving the saddle point problem \begin{eqnarray*} \min_{f\in\tilde{\Hcal}}\max_{u\in \Hcal}~\EE_{zxy}\sbr{\langle f, \psi(z)\rangle_{\tilde\Hcal} \cdot u(x,y)}- \EE_{xy}[\ell_y^*(u(x,y))]+ \frac{\nu}{2}\|f\|^2_{\tilde{\Hcal}}, \end{eqnarray*} where $\Hcal$ is the dual RKHS with the universal kernel introduced in our method. \noindent{\bf Remark.} The proposed algorithm bears some similarities to virtual sample techniques~\cite{NiyGirPog98, LooCanBot07} in the sense that they both create examples with prior knowledge to incorporate invariance. In fact, the virtual sample technique can be viewed as optimizing an upper bound of the objective~\eq{eq:invariant} by simply moving the conditional expectation outside, \ie, $\EE_{x, y} [\ell(y, \EE_{z|x}[f(z)] )] \le \EE_{x, y, z}\big[\ell(y,f(z))\big]$, where the inequality comes from convexity of $\ell(y, \cdot)$. \noindent{\bf Remark.} The learning problem~\eq{eq:invariant} can be understood as learning with RKHS $\hat \Hcal$ with Haar-Integral kernel $\hat k$ which is generated by $\tilde k$ as $\hat k(x, x') =\langle \EE_{p(z|x)}[\psi(z)], \EE_{p(z'|x')}[\psi(z')]\rangle_{\tilde \Hcal}$, with implicit feature map $\EE_{p(z|x)}[\psi(z)]$. If $f\in \tilde \Hcal$, then, $ f(x) = \EE_{z|x}[\langle f, \psi(z)\rangle_{\tilde\Hcal}] = \langle f, \EE_{z|x}[\psi(z)]\rangle \in \hat \Hcal$. The Haar-Integral kernel can be viewed as a special case of Hilbertian metric on probability measures on which the output of function should be invariant~\cite{HeiBou05}. Therefore, other kernels defined for distributions, \eg, the probability product kernel~\cite{JebKonHow04}, can be also used in incorporating invariance. \noindent{\bf Remark.} Robust learning with contamined samples can also be viewed as incorporating invariance prior with respect to the perturbation distribution into learning procedure. Therefore, rather than resorting to robust optimization techniques~\cite{BhaPanSmo05,BenGhaNem08}, the proposed algorithm for learning with invariance serves as a viable alternative for robust learning. \subsection{Reinforcement Learning} {\bf Policy evaluation.} The goal is to estimate the value function $V^\pi(\cdot)$ of a given policy $\pi(a|s)$ by minimizing the mean-square Bellman error (MSBE)~\eq{eq:RL_obj}. With $V^\pi\in \tilde\Hcal$ with feature map $\psi(\cdot)$, we apply the dual kernel embedding, which will lead to the saddle point problem \begin{eqnarray}\label{eq:RL_dual} \min_{V^\pi\in\tilde{\Hcal}} \max_{u\in\Hcal} &&\EE_{s',a, s} \sbr{\rbr{R(s,a) - \langle V^\pi, \psi(s) -\gamma \psi(s') \rangle_{\tilde \Hcal}} u(s, a)} -\frac{1}{2}\EE_{s, a}[u^2(s, a)]. \end{eqnarray} In the optimization~\eq{eq:RL_dual}, we simplify the dual $u$ to be function over $\Scal \times \Acal$ due to the fact that $R(s, a)$ is determinastic given $s$ and $a$ in our setting. If $R(s, a)$ is a random variable sampled from some distribution $p(R|s, a)$, then the dual function should be defined over $\Scal \times \Acal \times \RR$. \noindent{\bf Remark.} The algorithm can be extended to off-policy setting. Let $\pi_b$ be the behavior policy and $\rho(a|s) = \frac{\pi(a|s)}{\pi_b(a|s)}$ be the importance weight, then the objctive will be adjusted by $\rho(a|s)$, \ie \begin{eqnarray*} \min_{V^\pi\in \tilde \Hcal}\EE_{s, a}\sbr{\rbr{\EE_{s'|a, s}\sbr{\rho(a|s)\rbr{R(s, a) - \langle V^\pi, \psi(s) -\gamma \psi(s')\rangle_{\tilde \Hcal} }}}^2} \end{eqnarray*} where the successor state $s'\sim P(s'|s, a)$ and actions $a\sim\pi_b(a|s)$ from behavior policy. With the dual kernel embedding, we can derive similar algorithm for off-policy setting, with extra importance weight $\rho(a|s)$ to adjust the sample distribution. \noindent{\bf Remark.} We used different RKHSs for primal and dual functions. If we use the \emph{same finite basis functions} to parametrize both the value function and the dual function, \ie, $V^\pi(s)=\theta^T\psi(s)$ and $u(s)=\eta^T\psi(s)$, where $\psi(s) = [\psi_i(z)]_{i=1}^d\in \RR^{d}$, $\theta, \eta\in \RR^d$, our saddle point problem \eq{eq:RL_dual} reduces to $ \min_{\theta} \big\|\EE_{s, a, s'}[\Delta_\theta(s, a, s')\psi]\big\|^2_{\EE[\psi\psi^\top]^{-1}}, $ where $\Delta_\theta(s, a, s') = R(s, a) + \gamma V^\pi(s') - V^\pi(s)$. This is exactly the same as the objective proposed in~\cite{SutMaePreBhaetal09} of gradient-TD2. Moreover, the update rules in gradient-TD2 can also be derived by conducting the proposed Embedding-SGD with such parametrization. For details of the derivation, please refer to Appendix~\ref{appendix:GTD_special}. From this perspective, gradient-TD2 is simply a special case of the proposed Embedding-SGD applied to policy evaluation with particular parametrization. However, in the view of our framework, there is really no need to, and should not, restrict to the same finite parametric model for the value and dual functions. As further demonstrated in our experiments, with different nonparametric models, the performances can be improved significantly. See details in Section~\ref{subsec:RL_exp}. The residual gradient~(RG)~\cite{Baird95} is trying to apply stochastic gradient descent directly to the MSBE with finite parametric form of value function, \ie, $V^\pi(s)=\theta^T\psi(s)$, resulting the gradient as $ \EE_{s, a, s'}\sbr{\Delta_\theta(s, a, s')\psi(s)} - \gamma\EE_s\sbr{\EE_{s', a|s}\sbr{\Delta_\theta(s, a, s')}\EE_{s'|s}\sbr{\psi(s')}}. $ Due to the inside conditional expectation in gradient expression, to obtain an unbiased estimator of the gradient, it requires two independent samples of $s'$ given $s$, which is not practical. To avoid such ``double sample'' problem, \citet{Baird95} suggests to use gradient as $\EE_{s, a, s'}\sbr{\Delta_\theta(s, a, s')\rbr{\psi(s) - \gamma\psi(s')}}$. In fact, such algorithm is actually optimizing $\EE_{s, a, s'}\sbr{\Delta_\theta(s, a, s')^2}$, which is an upper bound of MSBE~\eq{eq:RL_obj} because of the convexity of square loss. Our algorithm is also fundamentally different from the TD algorithm even in the finite state case. The TD algorithm updates the state-value function directly by an estimate of the temporal difference based on one pair of samples, while our algorithm updates the state-value function based on accumulated estimate of the temporal difference, which intuitively is more robust. \noindent{\bf Optimal control.} The goal is to estiamte the $z(\cdot)$ function by minimizing the error in linear Bellamn equation~\eq{eq:OC_obj}. With $z\in \tilde\Hcal$ with feature map $\psi(\cdot)$, we apply the dual kernel embedding, which will lead to the saddle point problem \begin{eqnarray}\label{eq:OC_dual} \min_{z \in\tilde{\Hcal}} \max_{u\in\Hcal} \Phi(z,u):=\EE_{s', s} \sbr{\langle z, \psi(s) - \exp(-R(s))\psi(s') \rangle_{\tilde \Hcal}\cdot u(s)} -\frac{1}{2}\EE_{s}[u^2(s)]. \end{eqnarray} With the learned $z^*$, we can recover the optimal control via its conditional distribution $p^{\pi_*}(s'|s) = \frac{p(s'|s)z^*(s)}{\EE_{s'|s\sim p(s'|s)}\sbr{z^*(s')}}$. \subsection{Events Prediction in Stochastic Processes} {\bf Expected Hitting Time.} The goal is to estimate the expected hitting time $h(\cdot, \cdot)$ which minimizes the recursive error~\eq{eq:HT_obj}. With $h\in \tilde \Hcal$ with feature map $\psi(\cdot, \cdot)$, we apply the dual kernel embedding similarly to the policy evaluation, which will lead to the saddle point problem \begin{eqnarray}\label{eq:HT_dual} \min_{h \in\tilde{\Hcal}} \max_{u\in\Hcal} \Phi(h,u):=\EE_{s, t}\EE_{s'|s, t} \sbr{ \rbr{1 - \langle h, \psi(s, t) - \psi(s', t) \rangle_{\tilde\Hcal} } u(s, t)}- \frac{1}{2}\EE_{s}\sbr{u(s, t)^2}. \end{eqnarray} \noindent{\bf Remark.} With the proposed algorithm, we can estimate $h(s, t)$, the expected hitting time starting from state $s$ and hitting state $t$, even without observing the hitting events actually happen. We only need to collect the trajectory of the stochastic processes, or just the one-step transition, to feed to the algorithm, therefore, utilize the data more efficietly. \section{Experiments} We test the proposed algorithm for two applications, \ie, learning with invariant representation and policy evaluation. For full details of our experimental setups, please refer to Appendix~\ref{appendix:experiment_setup}. \subsection{Experiments on Invariance Learning} To justify the algorithm for learning with invariance, we test the algorithm on two tasks. We first apply the algorithm to robust learning problem where the inputs are contaminated, and then, we conduct comparison on molecular eneretics prediction problem~\cite{MonHanFazRupetal12}. We compare the proposed algorithm with SGD with virtual samples technique~\cite{NiyGirPog98,LooCanBot07} and SGD with finite sample average for inner expectation~(SGD-SAA). We use Gaussian kernel in all tasks. To demonstrate the sample-efficiency of our algorithm, $10$ virtual samples are generated for each datum in training phase. The algorithms are terminated after going through $10$ rounds of training data. We emphasize that the SGD with virtual samples is optimizing an upper bound of the objective, dan thus, it is predictable that our algorithm can achieve better performance. We plot its result with dot line instead. \paragraph{\bf Noisy measurement.} We generate a synthetic dataset by \begin{eqnarray*} \bar x &\sim&\Ucal([-0.5, 0.5]),\quad x = \bar x + 0.05e,\\ y&=& (\sin(3.53\pi \bar x) + \cos(7.7 \pi \bar x))\exp(-1.6\pi|\bar x|) + 3 \bar x^2+ 0.01e, \end{eqnarray*} where the contamination $e\sim \Ncal(0, 1)$. Only $(x, y)$ are provided to learning methods, while $\bar x$ is unknown. The virtual samples are sampled from $z\sim \Ncal(x, 0.05^2)$ for each observation. The 10 runs average results are illustrated in Figure~\ref{fig:learning_invariant}(a). The proposed algorithm achieves average MSE as low as $0.0029$ after visit $0.1$M data, significantly better than the alternatives. \begin{figure*}[!t] \centering \begin{tabular}{cc} \includegraphics[width=0.35\textwidth]{figure/synthetic_invariant_kernel_best-crop.pdf}&~~~~~~~~~~~~ \includegraphics[width=0.35\textwidth]{figure/quantummachine-crop.pdf}\\ (a) Robust Learning &~~~~~~~~~~~~(b) QuantumMachine\\ \end{tabular} \caption{Learning with invariance.} \label{fig:learning_invariant} \end{figure*} \paragraph{\bf QuantumMachine.} We test the proposed algorithm for learning with invariance task on QuantumMachine 5-fold dataset for atomization energy prediction. We follow~\cite{MonHanFazRupetal12} that the data points are represented by Coulomb matrices, and the virtual samples are generated by random permutation. The average results are shown in Figure~\ref{fig:learning_invariant}(b). The proposed algorithm achieves a significant better solution, while SGD-SAA and SGD with virtual samples stuck in inferior solutions due to the inaccurate inner expectation estimation and optimizing indirect objective, respectively. \subsection{Experiments on Policy Evaluation}\label{subsec:RL_exp} We compare the proposed algorithm to several prevailing algorithms for policy evaluation, including gradient-TD2~(GTD2)~\cite{SutMaePreBhaetal09,LiuLiuGhaMah15}, residual gradient~(RG)~\cite{Baird95} and kernel MDP~\cite{GruLevBalPonetal12} in terms of mean square Bellman error~\cite{DanGerPet14}. It should point out that kernel MDP is not an online algorithm, since it requires to visit the entire dataset when estimating the embedding and inner expectation in each iteration. We conduct experiments for policy evaluation on several benchmark datasets, including navigation, cart-pole swing up and PUMA-560 manipulation. We use Gaussian kernel in the nonparametric algorithms, \ie, kernel MDP and Embedding SGD, while we test random Fourier features~\cite{RahRec08} for the parametric competitors, \ie, GTD2 and RG. In order to demonstrate the sample efficiency of our method, we only use one sample from the conditional distribution in the training phase, therefore, cross-validation based on Bellman error is not appropriate. We perform a parameter sweep to select the hyper-parameters as~\cite{SilLevHeeetal14}. See appendix \ref{appendix:experiment_setup} for detailed settings. Results are averaged over 10 independent trials. \begin{figure*}[!t] \centering \begin{tabular}{ccc} \includegraphics[width=0.312\textwidth]{figure/kernel_synthetic_best_backup-crop.pdf}& \includegraphics[width=0.312\textwidth]{figure/cp_best_backup-crop.pdf}& \includegraphics[width=0.312\textwidth]{figure/puma_best_backup-crop.pdf} \\ (a) Navigation & (b) Cart-Pole &(c) PUMA-560\\ \end{tabular} \caption{Policy evaluation.} \label{fig:policy_evaluation} \end{figure*} \paragraph{\bf Navigation.} The navigation in an unbounded room task extending the discretized MDP in~\cite{GruLevBalPonetal12} to continuous-state continuous-action MDP. Specifically, the reward is $R(s) = \exp(-100\|s\|^2)$ centered in the middle of the room and $s\sim \Ncal(0, 0.2I)$. We evaluate the deterministic policy policy $\pi(s) = -0.2s R(s)$, following the gradient of the reward function. The transition distribution follows Gaussian distribution, $ p(s'|a, s) = \Ncal(s+a, 0.1I)$. Results are reported in Figure~\ref{fig:policy_evaluation}(a). \paragraph{\bf Cart-pole swing up.} The cart-pole system consists of a cart and a pendulum. It is an under-actuated system with only one control act on the cart. The goal is to swing-up the pendulum from the initial position (point down). The reward will be maximum if the pendulum is swing up to $\pi$ angle with zero velocity. We evaluate the linear policy $\pi(s) = As+b$ where $A\in \mathbb{R}^{1\times 4}$ and $b\in\mathbb{R}^{1\times 1}$. Results are reported in Figure~\ref{fig:policy_evaluation}(b). \paragraph{\bf PUMA-560 manipulation.} PUMA-560 is a robotic arm that has 6 degrees of freedom with 6 actuators on each joint. The task is to steer the end-effector to the desired position and orientation with zero velocity. The reward function is maximum if the arm is located to the desired position. We evaluate the linear policy $\pi(s) = {A}s+{b}$ where ${A}\in \mathbb{R}^{6\times 12}$ and ${b}\in\mathbb{R}^{6\times 1}$. Results are reported in Figure~\ref{fig:policy_evaluation}(c). In all experiments, the proposed algorithm performs consistently better than the competitors. The advantages of proposed algorithm mainly come from three aspects: {\bf i)}, it utilizes more flexible dual function space, rather than the constrained space in GTD2; {\bf ii)}, it directly optimizes the MSBE, rather than its surrogate as in GTD2 and RG; {\bf iii)}, it directly targets on value function estimation and forms an one-shot algorithm, rather than a two-stage procedure in kernel MDP including estimating conditional kernel embedding as an intermediate step. \section{Conclusion}\label{sec:conclusion} We propose a novel \emph{sample-efficient} algorithm, {\bf Embedding-SGD}, for addressing learning from conditional distribution problems. Our algorithm benefits from a fresh employ of saddle point and kernel embedding techniques, to mitigate the difficulty with limited samples from conditional distribution as well as the presence of nested expectations. To our best knowledge, among all existing algorithms able to solve such problems, this is \emph{the first} algorithm that allows to take only one sample at a time from the conditional distribution and comes with provable theoretical guarantee. We apply the proposed algorithm to solve two fundamental problems in machine learning, \ie, learning with invariance and policy evaluation in reinforcement learning. The proposed algorithm achieves the state-of-the-art performances on these two tasks comparing to the existing algorithms. As we discussed in Appendix~\ref{appendix:control}, the algorithm is also applicable to control problem in reinforcement learning. In addition to its wide applicability, our algorithm is also very versatile and amenable for all kinds of enhancement. The algorithm can be easily extended with random feature approximation or doubly stochastic gradient trick. Moreover, we can extend the framework by learning complicated nonlinear feature jointly with the function, which results the dual neural network embedding in Appendix~\ref{appendix:dual_neural_networks}. It should be emphasized that since the primal and dual function spaces are designed for different purposes, although we use both RKHS in main text for simplicity, we can also use different function approximators separately for primal and dual functions. \bibliographystyle{plainnat} {
{'timestamp': '2017-01-03T02:01:26', 'yymm': '1607', 'arxiv_id': '1607.04579', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04579'}
arxiv
\section{Introduction} Recently, we proposed Prototypes as a way to represent knowledge on the web~\cite{researchPaper}\footnote{ Please use that paper as a reference for all definitions.}. That paper has its focus on theoretical aspects and analysis. In this resource paper we describe the tools we developed to deploy prototypes. First, in \cref{sec:standalone} we present the implementation of a knowledge base, based on the implementation of a Java interface, which can be used for storing prototypes. Then, we reuse this system to show how the knowledge base can be used in remote and distributed settings (\cref{sec:distributed}). Each of the sections includes some amount of benchmarking to give the reader an impression of the practical re-usability of the provided solutions. We do assume that the reader has some familiarity with the ideas behind prototypes. The implementation and the code used for the benchmarks is licensed under the LGPLv3 license and can be downloaded from \url{https://github.com/miselico/knowledgebase}. \section{A Standalone Knowledge Base} \label{sec:standalone} A prototype knowledge base (KB) consists of a collection of prototypes. To mirror this, the IKnowledge interface, which we define as the basis for a KB, has only one method which must\footnote{Other methods are Java 8 default methods.} be implemented. The signature of this method is \lstinline$Optional<? extends Prototype> isDefined(ID id);$. The provided Java source code contains five implementations of this interface, namely \begin{description} \item[EmptyKnowledgeBase] is a KB without any content. However, as per the definition, it still contains the empty prototype $\emptyProtoID$. \item[PredefinedKB] is a KB containing string and integer constants and is described in more details in this section. \item[KnowledgeBase] stores prototypes. It can be constructed using another \lstinline$IKnowledgeBase$ as a basis. The underlying basis will be queried in case the requested prototype is not directly defined in the \lstinline$KnowledgeBase$. \item[RemoteKB] gets its prototypes from a remote KB. This implementation is described further in~\cref{sec:remote}. \item[ChainedKB] is an \lstinline$IknowledgeBase$ which connects multiple \lstinline$IKnowledgeBase$s together. The KBs are checked in turn until one where the Prototype is defined is found. If none is found, an empty \lstinline$Optional$ is returned, indicating that no Prototype could be found. \end{description} Each prototype consists of four components, namely \begin{inparaenum}[\itshape 1\upshape)] \item its own ID, \item the ID of its base, \item the change set for adding parts, and \item the change set for removing parts~\cite{researchPaper}. \end{inparaenum} This structure is closely mimicked in our implementation. The IDs are essentially represented using String types and the change sets using multimaps (i.e., maps which can associate multiple values for a given key). The formal definition allows the creation of a prototype which would remove all values for a given property. According to the theoretical definition, that computation would involve the set of all possible IDs by enumeration, which is unfeasible. Hence % our implementation has two distinct changeset implementations and treats the `remove all' as a special case which does not require enumeration. Another aspect which a concrete implementation should cover is the use of literals. At its current state the formal Prototype KB definition does not support literals as the value of a property. Instead, one has to represent a literal by using an agreed prototype. Therefore, we designed \lstinline$PredefinedKB$ which acts like a KB which implicitly contains all possible string and integer literals encoded as prototypes. The extension of the supported literal types to any type is facilitated. \subsection{Consistency Checking} When a KB is created out of a set of prototypes, it should be checked that the result is in accordance with our Prototype Knowledge Base definition \cite[Definition 4]{researchPaper}. In this paper we say that the KB must be checked for consistency. This consistency check is performed in the \lstinline$KnowledgeBase$ implementation. First, all IDs and property names must be valid absolute IRIs, which is enforced by the type system. Next, if there is any prototype with a definition involving an $ID$ which cannot be found in the KB, then the creation will be refused. Then, it is checked whether all inheritance chains eventually (recursively) end up at the empty prototype. If also that is the case then a check is performed to ensure that no ID is used twice (this includes checking the underlying KB). In practice, one might want to remove this last check and the issue of duplicates could be resolved in favor of prototypes in a given KB. This is possible using the \lstinline$ChainedKB$. The design of our software helps to build KB which are consistent. The KB provides a builder class which can be used for construction. Further, the KB itself is completely immutable. Changes are made by creating a new KB. This ensures the consistency at any point in time. \subsection{Fixpoint Computation} Given a knowledge base $KB_{o}$ we implemented a method to compute its interpretation $KB_{n}$. This interpretation contains for each prototype definition with ID $id$ in $KB_o$ a new prototype definition of the form $(id, (\text{ \url{PROTO:P_0} }, ADD, \emptyset))$. Where $ADD$ is such that under an interpretation $I_{KB}(KB_o) = I_{KB} (KB_n)$. This boils down to computing the fixpoint for each of the prototype expressions. However, a direct implementation of the definition would not work since there is a universal quantification over all IDs (an infinite set). Hence, we implement this such that simple change expressions are created only for these IDs which are actually used. We implemented both the consistency check and the fixpoint computation in a scalable fashion. For both the consistency check and the computation of the fixpoints, the implementation is optimized such that it will not compute things twice. When the fixpoint for a prototype $P_1$ has already been computed, then the computation of the fixpoint for a prototype $P_2$ with $base$ $P_1$ will reuse this result. Similarly during the consistency check for recursive derivation from $\emptyProtoID$: if it is already known that a prototype $P_1$ derives recursively from $\emptyProtoID$, then we reuse this information to conclude that $P_2$ with base $P_1$ derives from $\emptyProtoID$. Next, we will introduce the data sets and the benchmarks in which they are used. \subsection{Data Sets and Benchmarks} \label{sec:datasets} Since the prototype system is new there are no existing real-world dataset which make use of its features. It would be possible to use existing RDF datasets as prototypes, but it would result in a KB which does not use the inheritance feature specific to prototypes. Therefore, we decided to use synthetic data sets for our benchmarks. We created three types of data sets in three different sizes, resulting in nine data sets altogether. Note that we do not use the remove capabilities in our data sets. This is not required since a remove will only reduce the burden on the system. An overview of the datasets can be found in \cref{tab:datasets}. \begin{table*}[t] \caption{An overview of the data sets. The numbers between brackets indicate the different size parameters used to generate the data sets (see \cref{sec:datasets} for more information). The table shows the amount of prototypes and the average number (and st. dev.) of properties in the add set of the prototypes. Below we will refer to the data sets with their initial letters only. } \label{tab:datasets} \centering \setlength{\tabcolsep}{4pt} \makebox[\textwidth][c]{ % \begin{tabular}{lcccccc} \toprule Data set & \multicolumn{3}{c}{prototypes} & \multicolumn{3}{c}{properties per prototype} \\ \cmidrule(r){2-4} \cmidrule(r){5-7} \textbf{ba}seline (19/20/21) &1,048,575 & 2,097,151 & 4,194,303 & 0 & 0 & 0 \\ \textbf{bl}ocks (10/20/30) &1,000,000 & 2,000,000 & 3,000,000 & 1 & 1 & 1\\ \textbf{inc}remental (1/2/3) & 1,000,000 & 2,000,000 & 3,000,000 & 2.0 $\pm$ 1.4 &2.0 $\pm$ 1.4 &2.0 $\pm$ 1.4 \\ \bottomrule \end{tabular} } \end{table*} The first type of data sets does have beneficial properties for consistency checking and fixpoint computation. Further it does not have any properties attached to the proptotypes. Hence, we will call these \emph{baseline} data sets. To generate the data we start with one prototype which derives from $\emptyProtoID$, next we create two prototypes which derive form the one, then we create four prototypes which derive from these two, and so on until we create $2^{n}$ prototypes which derive from $2^{n-1}$ (for $n \in \{19,20,21\}$). For the second type we change the set-up to be less ideal and introduce properties. We create $10$, $20$, and $30$ blocks of $100,000$ prototypes and hence this type will be called \emph{blocks}. All prototypes in each block derive from a randomly chosen prototype in a lower block. Then, each of the prototypes has a property with a value randomly chosen from the block below. In the lowest block, the base is always $\emptyProtoID$ and the value for the property is always the same fixed prototype. The third type of data sets, which we call \emph{incremental}, is more demanding for the fixpoint computation and consistency check. This time we add 1, 2, and 3 million prototypes to the KB, one at a time. Each prototype gets a randomly selected earlier created one as its base. Furthermore, each prototype gets between $0$ and $4$ properties chosen from $10$ distinct ones (with replacement). The value of each property is chosen randomly among the prototypes. \vspace{-1em} \subsubsection{Results:} For each data set we measure how long it takes to perform the consistency check and to compute the fixpoint of all prototypes (i.e., compute the whole interpretation). We also measure the final average number of properties per prototype. These results can be found in \cref{tab:experiments}. \begin{table*}[t] \caption{The outcomes of the benchmark. For each dataset the table shows how long the consistency check took to complete and the time needed for the computation of the fixpoint. The last three columns show the average number (and standard deviation) of properties after computation of the fixpoint.} \label{tab:experiments} \centering \setlength{\tabcolsep}{4pt} \makebox[\textwidth][c]{ % \begin{tabular}{lccccccccc} \toprule Data set & \multicolumn{3}{c}{consistency(ms)} & \multicolumn{3}{c}{fixpoint(ms)} &\multicolumn{3}{c}{prop. per prototype in fp.} \\ \cmidrule(r){2-4} \cmidrule(r){5-7} \cmidrule(r){8-10} \textbf{ba} (19/20/21) & 2,659 & 4,083 & 8,150 & 5,281 & 7,344 & 15,055 & 0 & 0 & 0\\ \textbf{bl} (10/20/30) & 3,517 & 6,195 & 9,278 & 12,740 & 27,367 & 50,003 & 5.5 $\pm$ 2.9 & 10.5 $\pm$ 5.8 & 15.5 $\pm$ 8.6\\ \textbf{inc} (1/2/3) & 4,580 &8,469 & 10,436 & 23,597 &57,151 &94,702 & 26.7 $\pm$ 9.0& 27.3 $\pm$ 9.1& 30.0 $\pm$ 9.6\\ \bottomrule \end{tabular} } \end{table*} As can be seen from the table, the consistency check scales linear with the number of prototypes in the system. In some cases it seems like the behavior is even sub-linear. This is likely caused by just-in-time compilation. For the fixpoint, the baseline dataset provides close to linear performance, which is expected. Again, larger sets seem to compute even faster (or rather, the small set is handled slower because the JIT compiler has not yet optimized the code). The blocks and incremental experiments also show the expected scalability. They do, however, not have a linear scaling because in the larger experiments the numer of properties per prototype in the fixpoints is larger. The results are obtained by running the code on a single `Intel(R) Xeon(R) E5-2670 @ 2.60GHz' core (using \emph{taskset}). To keep results comparable we allowed the JVM to use large amounts of memory. The memory was mainly used to store the fixpoint of the KB, something one would in practice rarely keep in memory. These results show that the prototype system can scale well, even to millions of prototypes. \section{Distributed Knowledge Bases} \label{sec:remote} \label{sec:distributed} Our goal is to create a KB which can be used on the web. Hence, it is not sufficient to show that our implementation can be used locally. In this section we present how we implemented the client-server version of our KB. In our implementation we use the ubiquitous HTTP protocol and well known data formats. We also illustrate that KBs can have explicit links to each other trough the \texttt{Link} header of the HTTP protocol. To show the knowledge sharing scenario in action we perform benchmarks in which we query the KB in a simulated web environment. \subsection{Prototype Serialization and Joining} To communicate the Prototypes between server and client we want to use a language which is platform independent. Furthermore, the serialization should be reasonably easy to parse using different modern programming languages. Despite the simple textual serialization already available in the software and demonstrated in the research paper~\cite{researchPaper}, we choose to implement JSON serialization for the client--server interaction. This would also enable more straightforward integration with Javascript clients (and servers) at a later point. The JSON serialization itself is straightforward. A prototype is converted to the following structure: \begin{lstlisting} {"id":"theID", "base":"baseID", "add":{"propA":["id1", ...], ...}, "rem":{"propB":["id3", ...], ...}, "remAll":{"propC", ...}} \end{lstlisting} \subsubsection{Joining of Prototype Definitions} is needed when retrieving the representation of a prototype from multiple sources. In general the approach to this problem is dependent on the data sources and the amount of trust the client has in them. Imagine that one queries data source A for information about Germany. One of the properties of Germany returned by A is that the country has 80M inhabitants. When service B is asked about the same prototype a population of 20M is claimed. Now, the client has a specification of the schema it wants the countries to fulfill. Concrete, it could be that a country can only have one number for the population count property. Hence, the application would choose for the amount from the most trusted source. Several implementations of joining the changesets of prototypes are provided. \subsection{Deployment On Web Architecture} To serve prototypes on the web we use the HTTP protocol. To get the (serialized form of) the prototype, one needs to send a GET request with the protoype ID as a query parameter with the name $p$. For example, if the server is located at \url{http://example.com/} and one wants to request the prototype \url{isbn:123-4-56-789012-3}, then the request URL will be \url{http://example.com?p=isb We also implemented a way to serve fixpoints of prototypes. Since we are using HTTP, we can also use the existing optimizations and caching startegies available. From the server perspective, we use gzip compression in case the client supports it. Further, the server indicates how long the prototype will remain unchanged using the Cache-Control header \cite{rfc7234}. Besides, the ETag header \cite{rfc7232} is used; if the client wants to use the prototype but the cache time has expired, then it only needs to check with the server whether the ETag has changed to know whether it is up-to-date. The server implementation uses an embedded Jetty server which can be configured as desired. For instance, it is possible to deploy the implemented handler using HTTPS or HTTP/2. The client side (\lstinline|RemoteKB|) supports content compression, implements the caching of prototypes, and uses the ETag information. Besides, HTTP connections are reused for multiple prototypes in order to avoid the TCP handshake. Further, the client (and server) can handle multiple requests concurrently. The \texttt{Link: rel="alternate"} HTTP header~\cite{rfc5988} is used to indicate that other providers might have more information about a given prototype. Concrete, if a client asks for a prototype from service provider A, A might tell that B might have a definition of the given prototype as well. An application can then, in turn, get the definition from service B. We refrain from defining the exact meaning of the link between the two prototypes and rely on the application to choose its interpretation. We could have chosen to use the semantics of \url{owl:sameAs}, but this has lead to confusion and misuse in the past (see also~\cite{halpin2010owl}). The server also supports the retrieval of multiple prototypes at once. However, in that mode ETags and alternates will not work. Furthermore, if any of the prototypes requested is not found, the server will return an error code. Having this functionality is reasonable since the payload of the responses is relatively small and hence the serving time is dominated by the round trip time. \subsection{Benchmarks} In order to get repeatable results in our benchmarks, we work in a simulated web environment. For the simulation of a web environment there are two essential components. First, there are delays and losses on the network and second limited transmission rates. To simulate the delays and losses we use the netem\footnote{\url{http://www.linuxfoundation.org/collaborate/workgroups/networking/netem}} kernel component available in the Linux kernel. We attempt to obtain realistic settings by performing prior experiments in which we measure these factors when connecting from Finland (Europe) to New York city (USA). This way we found an average round trip time of 184.7 ms (min: 184.4 ms, max: 185.1 ms, stdev: 0.3 ms). We did not get any packet loss during out experiments, but will anyway use a package loss of 0.04\% (i.e 4 in 10,000 packets got lost in transmission). We arbitrary capped the bandwidth to 1024 KBit/s using token bucket filtering. This speed is arguably on the lower side, but shows that the KB can also be used when only limited bandwidth is available. In this benchmark we use the blocks(30) data set as presented in \cref{sec:datasets} and perform benchmarks in two environments. In the first and second benchmark, the network speed is virtually unconstrained (both server and client are on the same host). The difference between these two experiments is that first we only allow one concurrent request, while in the second one we allow up to 100. In the third experiment client and server are both deployed on their own virtual machine with the network modifications described above, the client can make up to 100 requests concurrently. In the benchmarks the client selects random prototypes and requests the fixpoint from the server. The timing for different amounts of prototypes can be found from~\cref{tab:remote}. As can be seen, it is beneficial to perform multiple requests simultaneously. Further, the network delay has a major impact on the timings. It becomes clear that requesting a couple of thousand fixpoints from the server does not really put it under stress. This can be seen from the second benchmark where hundred requests are send at the same time: the time to get 10,000 fixpoints is only half a second longer than to get 1,000 fixpoints. For the remote case we further observe a linear relation between the time needed and number of prototypes and note that in our simulated web environment we are able to retrieve roughly 50 prototype fixpoints per second. \begin{table*}[t] \caption{The outcomes of the benchmark. For each setting the time needed to fetch the fixpoints is shown in function of the number of fixpoints requested. \emph{Single} is the benchmark with the server and the client on the same host and one simultaneous request. \emph{Multi} is the same settign with multiple requests. \emph{Web Multi} is the setting where the client and server are on separate host with a simulated web link between them. All timings are in milliseconds.} \label{tab:remote} \centering \setlength{\tabcolsep}{4pt} \makebox[\textwidth][c]{ % \begin{tabular}{rrrrrrrr} \toprule Amount & Single & Multi & Web Multi & Amount & Single & Multi & Web Multi \\ \cmidrule(r){1-4} \cmidrule(r){5-8} 1,000 & 2,653 & 1,567 & 27,303 & 6,000 & 8,780 & 1,919 & 117,295 \\ 2,000 & 2,889 & 1,190 & 37,715 & 7,000 & 10,181 & 2,124 & 131,140 \\ 3,000 & 4,513 & 1,348 & 56,367 & 8,000 & 11,613 & 2,085 & 149,882 \\ 4,000 & 6,042 & 1,381 & 74,976 & 9,000 & 13,493 & 2,227 & 168,415 \\ 5,000 & 6,559 & 1,460 & 93,496 & 10,000 & 14,426 & 2,062 & 187,379 \\ \bottomrule \end{tabular} } \end{table*} \section{Conclusions} In this paper we presented the software we developed to spearhead further work in the Prototype based knowledge representation. We reviewed parts of the implementation of the prototype knowledge base and showed the results of benchmarks for consistency checking, fixpoint computing, and remote knowledge base access. At the current stage we see this software mainly used in research settings. However, the benchmarks show that the software provides scalability needed for use in production environment. \section*{Acknowledgments} Stefan Decker would like to thank Pat Hayes, Eric Neumann, and Hong-Gee Kim for discussions about Prototypes and Knowledge Representation in general. Michael Cochez performed parts of this research at the Industrial Ontologies Group of the University of Jyväskylä (Finland) and at the Insight Centre for Data Analytics in Galway, Ireland. Furthermore, it has to be mentioned that the implementation of the software was greatly simplified by Google's Guava library, Apache HttpComponents, the Jetty webserver, Google GSON, JUnit, Apache Abdera, and the Apache Commons Math™ library. \bibliographystyle{splncs03}
{'timestamp': '2016-07-19T02:05:47', 'yymm': '1607', 'arxiv_id': '1607.04809', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04809'}
arxiv
\section{Introduction} Hyperspectral imaging techniques have been widely used for a variety of applications such as mineral mapping, surveillance, and environmental monitoring. With its rich spectral information, hyperspectral data provide unique spectral patterns of the materials present in the scene. This capability makes hyperspectral data especially suitable for ground cover classification problems. Although hyperspectral data forms a high dimensional feature space, the information is often effectively represented in a much lower dimensional subspace --- hence, finding an appropriate subspace is crucial for effective hyperspectral data classification. \textcolor{blue}{}. Several linear and non-linear dimensionality reduction methods have been proposed in literature to address this issue \cite{HN2004,roweis2000nonlinear,tenenbaum2000global,belkin2001laplacian,Sug2007,gao2015discriminative,LSX2010,raducanu2012supervised,zhang2012graph,cui2012novel,hou2010multiple,song2008unified}. The objective function of such dimensionality reduction methods are typically utilize Euclidean distance information. Different from such Euclidean-based dimensionality reduction methods, angle or correlation-based dimensionality reduction methods have been proposed in literature to exploit specific benefits of angular information --- something that is particularly relevant for hyperspectral data. In \cite{ma2007discriminant}, correlation discriminant analysis (CDA) is proposed to transform the data so that the ratio of between-class and within-class sample correlation is maximized. In \cite{cui15angular}, the authors propose several supervised spectral angle based dimensionality reduction methods for robust hyperspectral data classification. In typical remote sensing data classification applications, the process of collecting labeled training data is often very time consuming and expensive. Unlabeled data on the other hand is easily available and hence unsupervised dimensionality reduction methods that effectively learn the most appropriate subspace can hence be readily utilized. With that in mind, we propose an unsupervised counterpart of our recently proposed supervised subspace algorithm, the angular discriminant Analysis (ADA). This unsupervised counterpart is referred to as local similarity preserving projection (LSPP) in this paper. Unlike ADA which requires labeled training samples, LSPP does not require labeled training samples to learn the projection matrix. Additionally, it is well-known that utilizing spatial information in hyperspectral data can dramatically improve the classification accuracies because any such method accounts for the spatial variability of spectral content in local spatial neighborhoods. This follows from the observation that spatially neighboring pixels are highly likely to belong to the same class and have similar spectral characteristics. To incorporate such spatial information of hyperspectral data into our unsupervised projection, we develop a spatial information driven variant of LSPP (SLSPP) which effectively uses the spatial contextual information around each pixel in hyperspectral images to learn the \emph{optimal projection}. Recently, sparse representation-based classification (SRC) has been proposed for face recognition \cite{WYG2009} and achieved a great amount of attention in various other applications such as digit recognition \cite{labusch2008simple}, speech recognition \cite{gemmeke2011exemplar}, gesture recognition \cite{zhou2013kernel}, vehicle classification \cite{mei2011robust} as well as remote sensing data classification \cite{MStgars2013,CNT2011,srinivas2011exploiting}. The central idea of SRC is to represent a test sample as a sparse linear combination of atoms in a dictionary which is formed by all of the available training samples. The class label of the test sample is assigned to a class whose reconstruction error is the lowest. In \cite{CNT2011}, the authors propose a join sparsity model to incorporate the contextual information of test samples to improve the classification performance of SRC. However, the contextual information of training samples have not been used. Besides the proposed dimensionality reduction methods, we also propose a sparse representation based classifier which takes into account the spatial information for both training and test samples in this work. Experimental results through two real-world hyperspectral datasets demonstrate that our proposed methods outperform other existing approaches. The rest of the paper is organized as follows. In Sec.~\ref{sec:dim_tra}, we briefly introduce the recently developed supervised dimensionality reduction methods (ADA and LADA), and Sec.~\ref{sec:dim_pro1} and Sec.~\ref{sec:dim_pro2} describe the proposed LSPP and SLSPP dimensionality reduction methods respectively. Sec.~\ref{sec:classifier} describes the proposed classification method. In Sec.~\ref{sec:data}, the two practical hyperspectral benchmarking datasets employed to validate the proposed method are described, and the experimental results illustrating the benefits of the proposed work is described in Sec.~\ref{sec:exp}. \section{Spectral Angle-Based Dimensionality Reduction} \subsection{ADA and LADA} \label{sec:dim_tra} Recently, supervised angular discriminant analysis (ADA) was proposed in \cite{cui15angular}. ADA finds a subspace where the angular separation of between-class samples is maximized while the angular separation of within-class samples is simultaneously minimized. It is mainly used to improve the classification performance of NN with cosine angle distance and SRC with OMP as the recovery method. Let us define $\{\boldsymbol{x}_{i} \in \mathbb{R}^{d}, y_i \in \{1,2, \ldots, c\}, i=1,2, \ldots, n\}$ to be the $d$-dimensional $i$-th training sample with an associated class label $y_i$, where $c$ is the number of classes and $n$ is the total number of training samples. $n = \sum_{l=1}^{c}{n_{l}}$ where $n_{l}$ denotes the number of training samples from class $l$. Let $\boldsymbol{\mathit{T}} \in \mathbb{R}^{d \times r}$ be the projection matrix, where $r$ denotes the reduced dimensionality. The projection $\mathit{T}_{\textit{ADA}}$ in ADA can obtained by solving \begin{align} \boldsymbol{\mathit{T}}_{\textit{ADA}} &\approx \operatornamewithlimits{argmin}_{\boldsymbol{\mathit{T}}\in \mathbb{R}^{d \times r}}\left[\operatorname{tr}\big((\boldsymbol{\mathit{T}}^{t}\boldsymbol{\mathit{O}}^{(\text{w})}\boldsymbol{\mathit{T}})^{-1}\boldsymbol{\mathit{T}}^{t}\boldsymbol{\mathit{O}}^{(\text{b})}\boldsymbol{\mathit{T}}\big)\right]. \label{eq:ada} \end{align} where $\boldsymbol{\mathit{O}}^{(\text{w})}$ and $\boldsymbol{\mathit{O}}^{(\text{b})}$ are defined as \begin{align} \boldsymbol{\mathit{O}}^{(\text{w})} &= \sum^{c}_{l=1}\sum^{}_{i:y_i=l} \boldsymbol{\mu}_{l}\boldsymbol{x}_{i}^{t}, \label{eq:Ow} \\ \boldsymbol{\mathit{O}}^{(\text{b})} &= \sum^{c}_{l=1}n_l\boldsymbol{\mu}\boldsymbol{\mu}_{l}^{t}. \label{eq:Ob} \end{align} The problem in \eqref{eq:ada} can be converted to a generalized eigenvalue problem. The authors in \cite{cui15angular} also extend ADA into its localized variant named local angular discriminant analysis (LADA) by incorporating a locality preserving property through an affinity matrix. LADA was shown to handle more complex, potentially multimodal data distributions. The projection matrix $\mathit{T}_{\textit{LADA}}$ of LADA can be obtained by solving \begin{align} \boldsymbol{\mathit{T}}_{\textit{LADA}} &= \operatornamewithlimits{argmin}_{\boldsymbol{\mathit{T}}\in \mathbb{R}^{d \times r}}\left[\operatorname{tr}\big((\boldsymbol{\mathit{T}}^{t}\boldsymbol{\mathit{O}}^{(\text{lw})}\boldsymbol{\mathit{T}})^{-1}\boldsymbol{\mathit{T}}^{t}\boldsymbol{\mathit{O}}^{(\text{lb})}\boldsymbol{\mathit{T}}\big)\right]. \label{eq:lspdr} \end{align} The within-class and between-class outer product matrices of LADA are defined as \begin{align} \boldsymbol{\mathit{O}}^{(\text{lw})} &= \sum_{i,j=1}^{n}\mathit{W}_{ij}^{(\text{lw})}\boldsymbol{x}_{i}\boldsymbol{x}_{j}^{t}, \label{eq:lada_ow} \\ \boldsymbol{\mathit{O}}^{(\text{lb})} &= \sum_{i,j=1}^{n}\mathit{W}_{ij}^{(\text{lb})}\boldsymbol{x}_{i}\boldsymbol{x}_{j}^{t}, \label{eq:lada_ob} \end{align} where the weight matrices are defined based on heat kernel $\mathit{A}_{ij}$ as \begin{align} \mathit{W}^{(\text{lw})}_{ij}&= \begin{cases} \mathit{A}_{ij}/n_l, & \text{if $y_i,y_j=l$}, \\ 0, & \text{if $y_i\ne y_j$}, \end{cases} \label{eq:lada_w} \\ \mathit{W}^{(\text{lb})}_{ij}&= \begin{cases} \mathit{A}_{ij}(1/n-1/n_l), & \text{if $y_i,y_j=l$}, \\ 1/n, & \text{if $y_i\ne y_j$}. \end{cases} \label{eq:lada_b} \end{align} \subsection{LSPP} \label{sec:dim_pro1} In this paper, we seek to make two related contributions within the context of angular discriminant analysis --- (1) developing an unsupervised approach to spectral angle based subspace learning, where local spectral angles are preserved following this unsupervised project, and (2) developing a projection that incorporates spatial information when learning such an \emph{optimal} projection. We first form a unsupervised version of ADA which we refer to as local similarity preserving projection (LSPP). It seeks a lower dimensional space where the correlation or angular relationship {between samples that are neighbors in the feature space} are preserved. We can also think of it as an angular equivalent of the commonly employed locality preserving projection (LPP) \cite{HN2004}. Let $\textit{x}_i$ be the $i$-th training sample and $\textit{P}$ be the $d \times r$ projection matrix, where $r$ is the reduced dimensionality. The objective function of LSPP can be simplified as \begin{align} \textit{I} &= \sum_{ij}\textit{W}_{ij}(\textit{P}^t\textit{x}_i)^t(\textit{P}^t\textit{x}_j) \nonumber \\ &= \sum_{ij}\operatorname{\emph{tr}}\big[\textit{W}_{ij}(\textit{P}^t\textit{x}_i)^t(\textit{P}^t\textit{x}_j)\big] \nonumber \\ &= \sum_{ij}\operatorname{\emph{tr}}\big[\textit{W}_{ij}\textit{P}^t\textit{x}_j(\textit{P}^t\textit{x}_i)^t \big] \nonumber \\ &= \sum_{ij}\operatorname{\emph{tr}}\big[\textit{P}^t\textit{W}_{ij}\textit{x}_i\textit{x}_j^t\textit{P}\big] \nonumber \\ &= \operatorname{\emph{tr}}\big[\textit{P}^t\textit{X}\textit{W}\textit{X}^t\textit{P}\big] \end{align} The heat kernel $\textit{W}_{ij}\in [0,1]$ between $\textit{x}_i$ and $\textit{x}_j$ is defined as \begin{equation} \textit{W}_{ij}=\exp\left(-\frac{\Vert \textit{x}_i-\textit{x}_j\Vert^2}{\sigma}\right) , \label{eq:aff1} \end{equation} where $\sigma$ is the parameter in the heat kernel. We impose a constraint ($\textit{P}^t\textit{X}\textit{D}\textit{X}^t\textit{P}=1$ where $D_{ii}=\sum_j\textit{W}_{ij}$) {to avoid biases caused by different samples}. {The larger the value $D_{ii}$ which is corresponding to $i$-th training sample, the more important $i$-th training sample is.} The final objective function is defined as \begin{equation} \operatornamewithlimits{argmax}_{\textit{P}}{\ \operatorname{\emph{tr}}\big[\textit{P}^t\textit{X}\textit{W}\textit{X}^t\textit{P}}\big] \qquad \operatorname{s. t.} \quad \textit{P}^t\textit{X}\textit{D}\textit{X}^t\textit{P}=I \label{eq:obj1} \end{equation} The problem in \ref{eq:obj1} can be solved as a generalized eigenvalue problem as \begin{equation} \textit{X}\textit{W}\textit{X}^t\textit{P} = \lambda\textit{X}\textit{D}\textit{X}^t\textit{P} \label{eq:eig} \end{equation} The projection matrix $\textit{P}$ are the eigenvectors corresponding to the $r$ largest eigenvalues. \subsection{SLSPP} \label{sec:dim_pro2} It is well understood from many recent works \cite{TBC2009,CNT2011,JBP2012,cui2013locality}, that by aking into account the spatial neighborhood information, hyperspectral image classification accuracy can be significantly increased. This is based on the observation that spatially neighboring samples in hyperspectral data often consist of similar materials,and hence they are spectrally correlated. In order to utilize spatially neighboring samples in a lower-dimensional subspace, the spatial neighborhood relationship of hyperspectral data should be preserved. To address this problem, we propose a spatial variant of LSPP (SLSPP) in this work to further improve the classification accuracies. Let $\{\textit{z}_{k}, k \in \Omega_i\}$ be the spatial neighborhood samples around a training sample $\textit{x}_{i}$, then the objective function of SLSPP can be reduced to \begin{align} \textit{I} &= \sum_{i}\sum_{k \in \Omega_i} \textit{W}_{ik}(\textit{P}^t\textit{x}_i)^t(\textit{P}^t\textit{z}_{k}) \nonumber \\ &= \sum_{i}\sum_{k \in \Omega_i}\operatorname{\emph{tr}}\big[\textit{W}_{ik}(\textit{P}^t\textit{x}_i)^t(\textit{P}^t\textit{z}_{k})\big] \nonumber \\ &= \sum_{i}\sum_{k \in \Omega_i}\operatorname{\emph{tr}}\big[\textit{W}_{ik}\textit{P}^t\textit{z}_{k}(\textit{P}^t\textit{x}_i)^t\big] \nonumber \\ &= \sum_{i}\sum_{k \in \Omega_i}\operatorname{\emph{tr}}\big[\textit{P}^t\textit{W}_{ik}\textit{z}_{k}\textit{x}_i^t\textit{P}\big] \nonumber \\ &= \operatorname{\emph{tr}}\big[\textit{P}^tM\textit{P}\big] \end{align} where $M = \sum_{i}\sum_{k \in \Omega_i}\textit{W}_{ik}\textit{z}_{k}\textit{x}_i^t$. The final objective function is defined as \begin{equation} \operatornamewithlimits{argmax}_{\textit{P}}{\ \operatorname{\emph{tr}}\big[\textit{P}^tM\textit{P}}\big] \qquad \operatorname{s. t.} \quad \textit{P}^t\textit{P}=I \label{eq:obj2} \end{equation} Similar to LSPP, the projection matrix $\textit{P}$ are the eigenvectors corresponding to the $r$ largest eigenvalues. Note that both LSPP and SLSPP are unsupervised projections in the sense that they do not require labels when learning the projections. We also note that a projection such as SLSPP is particularly beneficial when the backend classifier utilizes the spatial structure in the spatially neighboring pixels for each test pixel during classification. Towards that end, we next propose a modified sparse representation based classifier that utilizes sparse representations of the entire spatial neighborhood of a test pixel simultaneously when making a decision. \section{Sparse Representation-Based Classification via SBOMP} \label{sec:classifier} \subsection{SBOMP} The simultaneous orthogonal matching pursuit (SOMP) \cite{tropp2006algorithms} and block orthogonal matching pursuit (BOMP) \cite{eldar2010block} are all variants of orthogonal matching pursuit (OMP) that explore the \emph{block structure} of test samples and training samples respectively. In this work, we effectively combine these two recovery methods and propose SBOMP to explore the block structure of both training and test samples simultaneously. SBOMP is illustrated in Algorithm~\ref{sbomp}. Let $x_t$ be a test sample. Assume $\textit{A}_{i}$ contains spatial neighborhood samples around $x_i$ (inclusive of $x_i$), $S$ contains the spatial neighborhood samples of $x_t$ (inclusive of $x_t$) and $K$ is the sparsity level. {SBOMP estimates the coefficient $\hat{\textit{C}}$ based on the $K$ mostly correlated spatial training samples in $\textit{A}$}. \begin{algorithm}[htbp] \caption{SBOMP} \label{sbomp} \begin{algorithmic}[1] \STATE \textbf{Input:} A spectral-spatial training data $\textit{A} = \{\textit{A}_{i}\}_{i=1}^{n}$, test data $\textit{S}$ and row sparsity level $K$. \\\hrulefill \STATE Initialize $\textit{R}^{0} = \textit{S}$, $\Lambda^{0} = \emptyset$, and the iteration counter $m = 1$. \WHILE{$m \le K$} \STATE Update the support set $\Lambda^{m} = \Lambda^{m-1} \cup \lambda$ by solving \begin{equation} \lambda = \operatornamewithlimits{argmax}_{i=1,2,\ldots, n}\|\textit{A}_i^{t}\textit{R}^{m-1}\|_{2,1}. \nonumber \end{equation} \STATE Derive the coefficient matrix $C^{m}$ based on \begin{equation*} \textit{C}^{m} = \left(\textit{A}^{t}_{\Lambda^{m}}\textit{A}_{\Lambda^{m}}\right)^{-1}\textit{A}^{t}_{\Lambda^{m}}S \end{equation*} \STATE Update the residual matrix $\textit{R}^{m}$ \begin{equation*} \textit{R}^{m} = \textit{S}-\textit{A}_{\Lambda^{m}}\textit{C}^{m} \end{equation*} \STATE $m \leftarrow m + 1$ \ENDWHILE \\\hrulefill \STATE \textbf{Output:} Coefficient matrix $\hat{\textit{C}} = \textit{C}^{m-1}$. \end{algorithmic} \end{algorithm} \subsection{Classification via SBOMP} The classification method employed after SLSPP is SBOMP-based Classification (SBOMP-C), as described in Algorithm~\ref{sbompc}. Since SLSPP can preserve the spatial neighboring samples for both training and test samples in a lower-dimensional subspace, by using SBOMP-C, we can exploit the block structure relationship effectively in the spatial domain between training and test samples. The block diagram of proposed methods are illustrated in Fig.~\ref{fig:diag}. \begin{algorithm}[htbp] \caption{SBOMP-C} \label{sbompc} \begin{algorithmic}[1] \STATE \textbf{Input:} A spectral-spatial training data $\textit{A} = \{\textit{A}_{i}\}_{i=1}^{n}$, test data $\textit{S}$ and row sparsity level $K$. \\\hrulefill \STATE Calculate row-sparsity coefficient $\hat{\textit{C}}$ based on \begin{equation*} \hat{\textit{C}} = \text{SBOMP} \ (\textit{A}, S, K) \end{equation*} \STATE Calculate residuals for each class \begin{equation*} \textit{r}_{k}(\textit{S}) = \|\textit{S}-\textit{A}\delta_{k}(\hat{\textit{C}})\|_2, \quad k = 1,2, \ldots, c \end{equation*} \STATE Determine the class label of $\textit{S}$ based on \begin{equation*} \omega = \operatornamewithlimits{argmin}_{k = 1,2,\ldots, c}(\textit{r}_{k}(\textit{S})). \nonumber \end{equation*} \\\hrulefill \STATE \textbf{Output:} A class label $\omega$. \end{algorithmic} \end{algorithm} \begin{figure*}[htbp] \centering \begin{tabular}{c} \includegraphics[width=13cm]{figure1_eps-eps-converted-to.pdf} \\ \end{tabular} \caption{Block diagram of the proposed work.} \label{fig:diag} \end{figure*} \section{Experimental Hyperspectral Data} \label{sec:data} We validate the proposed approaches with two hyperspectral imagery datasets --- a standard benchmarking dataset from the University of Pavia (an urban ground cover classification problem), and a hyperspectral imagery data collected by our lab to study wetland species composition. \subsection{University of Pavia Data} The first experimental hyperspectral dataset employed was collected using the Reflective Optics System Imaging Spectrometer (ROSIS) sensor \cite{Gam2004}. This image, covering the University of Pavia, Italy, has 103 spectral bands with a spatial coverage of $610 \times 340$ pixels, and 9 classes of interests are considered in this dataset. A three-band true color image and its ground-truth are shown in Figure \ref{fig:data_u}. This dataset represents a standardized benchmark as it is a well understood and widely studied dataset that is used to quantify performance of machine learning algorithms with hyperspectral data. \begin{figure}[htbp] \centering \begin{tabular}{cc} \includegraphics[height=5cm]{figure2_eps-eps-converted-to.pdf} & \includegraphics[height=5cm]{figure3_eps-eps-converted-to.pdf} \\ (a) & (b) \\ \end{tabular} \vspace*{-0.1in} \begin{center} \includegraphics[height=2cm]{figure4_eps-eps-converted-to.pdf} \\ \end{center} \vspace*{-0.1in} \caption{ (a) True color image and (b) ground-truth of the University of Pavia hyperspectral data.} \label{fig:data_u} \end{figure} \subsection{Wetland Data} The second hyperspectral data used in this work was acquired by us in Galveston, Texas in {October, 2014} which includes two different wetland scenes captured at ground-level (side-looking views) over wetlands in Galveston. This is an unprecedented dataset in that it represents ``street view'' type hyperspectral images that have very different characteristics and are very useful for on-ground sensing. The two image cubes are referred to as area 1, and area 2, representing different regions of the wetlands that were imaged --- In addition to common wetland classes, area 2 has Black Mangrove (\emph{Avicennia germinans}) trees in the scene, a species which is of particular interest in ecological studies of wetlands, in addition to Spartina. The images were annotated with species information by an expert in Marine biology, who identified the various species in these hyperspectral scenes. This data was acquired using a Headwall Photonics hyperspectral imager which provides measurements in 325 spectral bands with a spatial size of $1004 \times 5130$. The hyperspectral data uniformly spanned the visible and near-infrared spectrum from $400 nm - 1000 nm$. The objects of interests are primarily vegetation species common in such wetlands. Six different classes were identified in area-1 including soil, \emph{symphyotrichum}, \emph{schoenoplectus}, \emph{spartina patens}, \emph{borrichia} and \emph{rayjacksonia}. The second area includes \emph{Avicennia germinans}, \emph{batis}, \emph{schoenoplectus}, \emph{spartina alterniflora}, \emph{soil}, \emph{water} and \emph{bridge}. Since soil and \emph{schoenoplectus} are included in both areas, the total number of classes in the combined library are eleven. This dataset represents a ``real-world'' application of our method for hyperspectral imaging in the field on arbitrary problems of interest. \begin{figure*}[htbp] \centering \begin{tabular}{c} \includegraphics[height=4cm]{figure5_eps.png} \vspace{-0.2in} \\ Wetland data, area - 1 \\ \includegraphics[height=4cm]{figure6_eps.png} \vspace{-0.2in} \\ Wetland data, area - 2 \\ \end{tabular} \vspace{-0.1in} \begin{center} \includegraphics[width=7cm]{figure7_jpg.jpg} \end{center} \vspace{-0.2in} \caption{True color images of the wetland dataset inset with ground truth.} \end{figure*} \section{Experimental Settings and Results} \label{sec:exp} The efficacy of the proposed LSPP, SLSPP and SBOMP are evaluated as a function of training samples per class using the two practical hyperspectral datasets mentioned previously. SLSPP--SBOMP-C indicates the data is projected based on SLSPP, and SBOMP-C is employed as the backend classifier. A nearest-neighbor (NN) classifier with cosine angle distance is used after LSPP and LADA projection, since they do not take spatial information into account when deriving the projection matrix. Similar to SLSPP--SOMP-C, LSPP--NN and LADA--NN. Each experiment is repeated 10 times using a repeated random subsampling validation technique, and the average accuracy is reported. The number of test samples per class is fixed to 100 for every random subsampling. Fig.~\ref{fig:result_u} shows the classification accuracies as a function of training samples for the University of Pavia hyperspectral data. The parameter for each algorithm is determined via searching through a wide range of the parameter space and the accuracies reported in this plot is based on the optimal parameter values. As can be seen from this figure, our proposed SLSPP followed by SBOMP-C gives the highest classification accuracies consistently over a wide range of the training sample size. LSPP--NN also gives better classification result compared with LADA--NN. We perform a similar analysis using the wetland hyperspectral data. Fig.~\ref{fig:result_g4} and Fig.~\ref{fig:result_g5} plot the classification accuracies with respect to the training sample size per class for wetland area - 1 and wetland area - 2 respectively. It can be seen from the two plots that the proposed methods generally outperform other baseline methods for the vegetation type of hyperspectral data which demonstrate the diverse applicability of the proposed methods. \begin{figure}[h] \centering \includegraphics[height=6cm]{figure8_eps-eps-converted-to.pdf} \\ \caption{Overall classification accuracy (\%) versus number of training samples for the University of Pavia data.} \label{fig:result_u} \end{figure} \begin{center} \begin{figure}[htbp] \centering \includegraphics[height=6cm]{figure9_eps-eps-converted-to.pdf} \\ \caption{Overall classification accuracy (\%) versus number of training samples for the wetland data, area - 1.} \label{fig:result_g4} \end{figure} \end{center} \begin{figure}[htbp] \centering \includegraphics[height=6cm]{figure10_eps-eps-converted-to.pdf} \\ \caption{Overall classification accuracy (\%) versus number of training samples for the wetland data, area - 2.} \label{fig:result_g5} \end{figure} The class specific accuracies for different datasets are shown in Table~\ref{tab:table1}, Table~\ref{tab:table2} and Table~\ref{tab:table3} respectively. In this experiment, the training sample size per class is fixed to 10 and the test sample size is 100 per class. Each experiment is repeated 10 times and the average accuracy is reported. As can be seen from the class-specific tables for the wetland data, the spatial information plays a crucial role, especially for the species with complex textures and shapes such as \emph{Spartina-Patens}, \emph{Sedge} and \emph{Symphyotrichum}. \begin{table*}[htbp] \centering \caption{Class-specific accuracies (\%) for the University of Pavia Data.} \resizebox{13cm}{!}{ \begin{tabular}{ccccc} \toprule \textit{\textbf{Class Name / Algorithm}} & \textit{\textbf{LSPP--SBOMP-C}} & \textit{\textbf{LSPP--SOMP-C}} & \textit{\textbf{LSPP--NN}} & \textit{\textbf{LADA--NN}} \\ \midrule \textit{\textbf{Asphalt}} & 77.2 & 60.8 & 31.4 & 30.9 \\ \textit{\textbf{Meadows}} & 64.4 & 62.5 & 60.2 & 59.6 \\ \textit{\textbf{Gravel}} & 79.2 & 65.5 & 61.1 & 59 \\ \textit{\textbf{Trees}} & 88.2 & 79 & 94.4 & 94.1 \\ \textit{\textbf{Metal Sheets}} & 98.9 & 98.2 & 99.9 & 99.9 \\ \textit{\textbf{Soil}} & 67.6 & 59.1 & 57.1 & 53.4 \\ \textit{\textbf{Bitumen}} & 84.9 & 83 & 84.8 & 84.4 \\ \textit{\textbf{Bricks}} & 60.1 & 64.8 & 66.2 & 62.9 \\ \textit{\textbf{Shadows}} & 99.2 & 96.9 & 96.9 & 95.9 \\ \textit{\textbf{Overall Accuracy}} & 80.0 & 74.4 & 72.4 & 71.1 \\ \bottomrule \end{tabular}% } \label{tab:table1}% \end{table*}% \begin{table*}[htbp] \centering \caption{Class-specific accuracies (\%) for the Wetland, Area-1 data.} \resizebox{13cm}{!}{ \begin{tabular}{ccccc} \toprule \textit{\textbf{Class Name / Algorithm}} & \textit{\textbf{LSPP--SBOMP-C}} & \textit{\textbf{LSPP--SOMP-C}} & \textit{\textbf{LSPP--NN}} & \textit{\textbf{LADA--NN}} \\ \midrule \textit{\textbf{Soil}} & 99.8 & 100 & 99.8 & 99.9 \\ \textit{\textbf{Symphyotrichum}} & 86.8 & 85.5 & 78.1 & 76.1 \\ \textit{\textbf{Sedge}} & 93.4 & 93.3 & 91.6 & 92.1 \\ \textit{\textbf{Spartina-Paten}} & 68.4 & 59.1 & 64.2 & 56 \\ \textit{\textbf{Borrichia}} & 91.6 & 91.2 & 91.7 & 93.7 \\ \textit{\textbf{Rayjacksonia}} & 91.6 & 89 & 84.7 & 92.2 \\ \textit{\textbf{Overall Accuracy}} & 88.6 & 86.4 & 85.0 & 85.0 \\ \bottomrule \end{tabular}% } \label{tab:table2}% \end{table*}% \begin{table*}[htbp] \centering \caption{Class-specific accuracies (\%) for the Wetland, Area-2 data.} \resizebox{13cm}{!}{ \begin{tabular}{ccccc} \toprule \textit{\textbf{Class Name / Algorithm}} & \textit{\textbf{LSPP--SBOMP-C}} & \textit{\textbf{LSPP--SOMP-C}} & \textit{\textbf{LSPP--NN}} & \textit{\textbf{LADA--NN}} \\ \midrule \textit{\textbf{Soil}} & 96.1 & 96.8 & 87.7 & 86.7 \\ \textit{\textbf{Mangrove Tree}} & 97.1 & 95 & 97.1 & 98.5 \\ \textit{\textbf{Batis}} & 99.2 & 99.1 & 97.9 & 97.2 \\ \textit{\textbf{Sedge}} & 97 & 94.3 & 92.3 & 89.8 \\ \textit{\textbf{Spartina-Alterniflora}} & 89.7 & 90.2 & 75.3 & 48 \\ \textit{\textbf{Water}} & 99 & 99 & 98.5 & 98.7 \\ \textit{\textbf{Bridge}} & 99.9 & 99.4 & 94.3 & 85.7 \\ \textit{\textbf{Overall Accuracy}} & 96.9 & 96.3 & 91.9 & 86.4 \\ \bottomrule \end{tabular}% } \label{tab:table3}% \end{table*}% Next, we analyze the effect of the window size (that defines the spatial neighborhood) for the SLSPP method. Fig.~\ref{fig:win_u} depicts the classification accuracies as a function of different window size using the University of Pavia dataset. From this figure, we can see that the optimal window size is 5. \begin{figure}[htbp] \centering \includegraphics[height=6cm]{figure14_eps-eps-converted-to.pdf} \\ \caption{Overall classification accuracy (\%) versus different window size for the University of Pavia and Wetland hyperspectral data.} \label{fig:win_u} \end{figure} In this work, we also visualize the data distributions after projection for the proposed angle-based SLSPP and the Euclidean-based LPP methods. Figure~\ref{fig:vis} (a) shows the subset image for University of Pavia and Figure~\ref{fig:vis} (b) plots all the training samples used in this experiment on an $\ell_2$ normalized sphere. Figure~\ref{fig:vis} (c) and (d) show the same samples after an SLSPP and LPP projection on an $\ell_2$ normalized sphere respectively. $U_1$, $U_2$ and $U_3$ are the three projections found by SLSPP and LPP corresponding to the largest eigenvalues. As can be seen from this figure, SLSPP is much more effective at preserving the inter-sample relationships in terms of spectral angle in the lower-dimensional subspace compared to LPP. \begin{figure}[htbp] \centering \begin{tabular}{cc} \includegraphics[height=3cm]{figure15_eps-eps-converted-to.pdf} & \includegraphics[height=3cm]{figure16_eps-eps-converted-to.pdf} \\ (a) & (b) \\ \includegraphics[height=3cm]{figure17_eps-eps-converted-to.pdf} & \includegraphics[height=3cm]{figure18_eps-eps-converted-to.pdf} \\ (c) & (d) \\ \end{tabular} \caption{Illustrating the (a) subset image of the University of Pavia, (b) original samples, (c) SLSPP projected samples and (d) LPP projected samples on the sphere.} \label{fig:vis} \end{figure} \section{Conclusion} In this work, we have presented an unsupervised variant (LSPP) of the recently developed supervised dimensionality reduction method --- ADA, as well as its spatial variant, SLSPP, that utilize spatial information around the samples when learning the projections. By incorporating spatial information in the dimensionality reduction projection, we are able to learn much more effective subspaces that not only preserves angular information among the training pixels in the feature space, but also their spatial neighbors. We also propose a related sparse representation classifier (SBOMP-C) that is optimized for feature spaces generated by SLSPP. Through experimental results based on two practical real-world hyperspectral datasets, we note that the proposed methods significantly outperform the baseline methods. \bibliographystyle{IEEEtran}
{'timestamp': '2016-07-18T02:08:55', 'yymm': '1607', 'arxiv_id': '1607.04593', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04593'}
arxiv
\section{Introduction} \label{sec:introduction} Beyond-CMOS technologies using alternate state variables, such as electron spin, magnetic domains, spin waves, phase change, and photons have garnered significant interest lately for low-power and robust computing applications \cite{galatsis2009alternate, allwood2005magnetic, slonczewski1999excitation, qureshi2009scalable}. Spin-based devices, implemented with nanomagnets, have become an extrememly popular choice for magnetic memory, storage, and logic owing to their non-volatility, low power, and low area footprints. Spintronics has established itself as a front-runner in this race of beyond-CMOS technologies, with devices such as the spin-transfer torque (STT) MRAM (that offers high density and high-performance non-volatile storage coupled with low power and cost) predicted to replace conventions DRAMs in the near future \cite{lin200945nm, huai2008spin, kultursay2013evaluating}. The dynamics and performance of the majority of spin-based devices are modeled using the stochastic Landau-Lifshitz-Gilbert-Slonczewski (s-LLGS) equation. This equation describes the temporal evolution of the magnetization vector, $\boldsymbol{M}$, of a monodomain nanomagnet under the effects of magnetic fields, STT and thermal noise \cite{Slonczewski1996, Ralph, Stiles, Liz, stiles2006}. Mathematically, the s-LLGS equation is given as \begin{equation} \frac{d\boldsymbol{M}}{dt} = -\gamma\mu_0(\boldsymbol{M}\times \boldsymbol{H}_{eff}) + \frac{\alpha}{M_s} \Big(\boldsymbol{M}\times\frac{d\boldsymbol{M}}{dt}\Big) - \frac{\boldsymbol{M} \times (\boldsymbol{M} \times \boldsymbol{I_s})}{qN_sM_s}, \label{basic_sLLGS} \end{equation} \noindent where $\gamma$ is the gyromagnetic ratio of electron, $\boldsymbol{H}_{eff}$ is the effective magnetic field experienced by the nanomagnet, $\alpha$ is the dimensionless Gilbert damping constant, $M_s$ is the saturation magnetization of the nanomagnet, $\boldsymbol{I}_s$ is the applied spin current, $q$ is the elementary charge, $N_s$ is the number of spins given as $N_s = \frac{2M_s V}{\gamma\hbar}$, and $V$ is the volume of the nanomagnet.\\ \noindent The nanomagnets used in spintronic devices and memories today are sub-$100$ nm \cite{chun2013scaling, cascales2013magnetization}; for such small dimensions the macrospin approximation \cite{Tannous2006} validates the use of the monodomain model, wherein the nanomagnet is assumed to possess a single coherent magnetization ($\boldsymbol{M}$) over the entire domain and any spatial variation in $\boldsymbol{M}$ is not considered. This approximation is only valid for nanomagnets of dimensions smaller than the critical Stoner radius, which is of the order of a few $100$s of nm for typical magnetic materials \cite{Tannous2006}. The first term on the right hand side (RHS) in \eqref{basic_sLLGS} is the conservative precessional torque that governs the precession of the magnetization vector around the effective field acting on the nanomagnet. This effective field comprises the magnetocrystalline anisotropy field, the shape anisotropy field, and the external applied field. A Langevin field $\boldsymbol{h}_r = h_x \boldsymbol{\hat{x}} + h_y \boldsymbol{\hat{y}} + h_z \boldsymbol{\hat{z}}$, representing Gaussian white noise, is added into the effective field in the s-LLGS equation to model thermal noise. The second term on the RHS in (\ref{basic_sLLGS}) is the Gilbert damping torque, which is responsible for damping the precessions of the magnetization vector and eventually relaxing it to one of its stable states \cite{Aquino2004}. The final term on the RHS in \eqref{basic_sLLGS} is the Slonczewski spin torque arising from the deposition of spin angular momentum by the itinerant electrons of the spin-polarized current. The field-like torque \cite{xiao2005}, (FLT) which results from the non-equilibrium spin accumulation in the nanomagnet, where the transverse component of spin current may persist with a characteristic length of few angstroms or nanometers, is negligible compared to the STT and is not considered in this study. For analysis in this paper, we transform \eqref{basic_sLLGS} into its dimensionless form expressed as\footnote{The spherical coordinates representation of the s-LLGS equation is discussed in section 5.} \begin{equation} \label{eq_llg_implicit1} \frac{d\boldsymbol{m}}{dt} = - \boldsymbol{m} \times \boldsymbol{h}_{eff} + \alpha \left( \boldsymbol{m} \times \frac{d\boldsymbol{m}}{dt} \right) - \boldsymbol{m} \times ( \boldsymbol{m} \times \boldsymbol{i}_s) ,\\ \end{equation} \noindent where we have the normalized quantities $\boldsymbol{m} = \frac{\boldsymbol{M}}{M_s}$, $\boldsymbol{h}_{eff} = \frac{\boldsymbol{H}_{eff}}{M_s}$, and $\boldsymbol{i_s} = \frac{\boldsymbol{I}_s}{I}$. Here, the scaling factor, $I$, for spin current is defined as $I = q\gamma \mu_0M_s N_s$. The time scale is normalized using the factor $(\gamma \mu_0 M_s)^{-1}$. The advantages of the normalized equation \eqref{eq_llg_implicit1} over \eqref{basic_sLLGS} are: (a) it is easier to deal with normalized quantities in terms of numerical complexity, and (b) normalized entities are mathematically well behaved under the application of a numerical scheme. The explicit form of \eqref{eq_llg_implicit1} obtained by decoupling $d\boldsymbol{m}/dt$ is given as (see Appendix A for the detailed derivations) \begin{equation} \label{eq_llg_explicit1} \frac{d\boldsymbol{m}}{dt} = - \frac{1}{1+\alpha^2} \left[ \boldsymbol{m} \times \boldsymbol{h}_{eff} + (\boldsymbol{m} \times (\boldsymbol{m} \times \boldsymbol{i}_s)) + \alpha \left( \boldsymbol{m} \times( \boldsymbol{m} \times \boldsymbol{h}_{eff})) - \alpha (\boldsymbol{m} \times \boldsymbol{i}_s \right)\right]. \end{equation} \noindent Prior works \cite{llg1,llg2,llg3} have reviewed numerical techniques to solve the LLG equation, but a clear and comprehensive treatment of the interplay of thermal noise and deterministic dynamics is lacking. Reference \cite{Aquino2006} applies the implicit midpoint integration technique to the deterministic LLG equation (without thermal noise) and details the intricacies of the accuracy, stability, and time step used in the simulation. But it falls short because all the physical systems in existence experience finite temperature effects; hence, there is a need to include the thermal energy term in the effective field acting on the nanomagnet. The addition of the thermal noise transforms the deterministic LLG equation into a stochastic differential equation (SDE), which warrants an appropriate and careful choice of stochastic calculus and numerical integration scheme for correct convergence. In Ref. \cite{banas2013computational}, the authors analyze the implicit midpoint scheme for a single spin, a finite ensemble of spins, and an infinite ensemble of ferromagnetic spins, but they do not consider the Slonczewski spin torque, which is essential since STT-based switching of nanomagnets has become immensely popular in recent devices owing to its efficiency and reliability. Reference \cite{banas2013computational} also does not offer any comparison of the implicit midpoint scheme with other numerical schemes or present any quantitative evidence as to why one method must be preferred over others with respect to solving the s-LLGS equation. Reference \cite{Pinna2013} presents the impact of thermal noise on the magnetization reversal, but it does not present the details of the numerical scheme employed to treat the thermal noise. In this research, we leverage these prior works to carefully study the impact of the specific numerical scheme to solve the s-LLGS equation on the macrospin evolution. We propose a new method called the RK4-Huen, which is particularly useful when the stochastic term in the SDE is much smaller than the deterministic term, which is usually the case in magnetic bodies. We also comment on the importance of the time step used for numerical integration on the accuracy of various numerical schemes. The second part of this paper focuses on SPICE simulations of nanomagnet dynamics. SPICE-based models are widely used to facilitate the design and optimization of complex magneto-logic networks. However, it is important to represent the s-LLGS equation in SPICE in a manner that the existing numerical integration schemes in SPICE can successfully handle the multiplicative white noise in the system. We quantify the performance (accuracy and stability) of SPICE solvers that use numerical schemes, such as trapezoidal and Euler, to solve the s-LLGS equation in both cartesian and spherical coordinate systems.\\ \noindent The remainder of this paper is organized as follows. Section~\ref{sec:eff_field} describes the formulation of the effective magnetic field acting on the macrospin. The details underlying the midpoint method are presented in Section~\ref{sec:midpoint}. In Section~\ref{sec:methods}, the accuracy of various numerical methods, including a method for small noise, to solve the s-LLGS equation is presented. We conclude the paper by comparing the results of the implicit midpoint method and those obtained from SPICE solvers and the NIST-standard micromagnetic tool OOMMF. \vspace{-2ex} \section{Description of the effective magnetic field} \label{sec:eff_field} To arrive at the expression for the effective field in the s-LLGS equation, we consider the following energies, per unit volume, in the energy landscape of the macrospin \cite{Bruno, Pinna2015,spaldin2010,2005Aquino}: \begin{enumerate}[(1)] \item Zeeman energy due to an externally applied field, $E_{zeeman} = -\mu_0 (\boldsymbol{H}_{app} \cdot \boldsymbol{M}),$ \vspace{-1ex} \item Uniaxial anisotropy energy, $E_{uniaxial} = -K_u\cos^2\theta,$ \vspace{-1ex} \item Shape anisotropy energy, $E_{shape} = \frac{1}{2}\mu_0 (N_xM_x^2 + N_yM_y^2 + N_zM_z^2),$ \vspace{-1ex} \item Thermal energy, $E_T.$ \end{enumerate} \noindent In the above set of equations, $\boldsymbol{H}_{app}$ is the external magnetic field, $K_u = \frac{1}{2}\mu_0M_sH_k $ is the uniaxial energy density ($H_k$ is the anisotropy field), $\theta $ is the angle between the easy axis and the magnetization $(\cos\theta = \boldsymbol{\hat{n}} \cdot \boldsymbol{m} = \boldsymbol{\hat{n}} \cdot \frac{\boldsymbol{M}}{M_s})$, and $N_x, N_y$ and $N_z$ are the geometry-dependent demagnetization coefficients of the nanomagnet. The exchange energy, which originates from the overlap of electron orbitals, is a very short range force that acts on the order of the exchange length of the magnetic material. Since the exchange lengths of typical magnetic materials are on the order of a few nm, and the size of the nanomagnets used in applications today have dimensions of few 10's of nm, the exchange energy becomes insignificant compared to long range interactions like the dipolar interaction, that results in the shape anisotropy term \cite{pinna2015spin}. Hence, for the purposes of this paper, we neglect the exchange energy term in the formulation of the effective field. \\ \noindent The thermal field $\boldsymbol{H}_T(t)$ can be expressed in terms of the Wiener process as $\boldsymbol{H}_T(t) dt = \nu d\boldsymbol{W}(t) $ \cite{Aquino2006}, where $\boldsymbol{W}(t)$ is the Wiener process, and $\nu =\sqrt{\frac{2\alpha K_bT}{\mu_0 M_s^2 V }}$ \cite{Sun2006, Sasikanth2012}. Here{\color{red}{,}} $K_bT$ is the thermal energy. The statistical properties of this thermal field discussed by Brown and Kubo are given as \cite{Brown1963, kubo1970}\\ \indent (1) The mean thermal field: $\langle \boldsymbol{H}_{T,i}(t) \rangle= 0,$\\ \indent (2) The correlation between the components of $\boldsymbol{H}_T(t)$ defined over a time interval $\tau$, \begin{equation} \langle \boldsymbol{H}_{T,i}(t)\boldsymbol{H}_{T,j}(t+\tau) \rangle = \frac{2K_bT\alpha}{\gamma \mu_0^2 M_s V}\delta_{ij}\delta(\tau), \end{equation} where $\delta_{ij}$ is the Kronecker delta function. To simulate the thermal effects numerically, we discretize the model in time \begin{equation} \label{eq_discretized_thermal_model} \boldsymbol{H}_T(t) \Delta t = \nu \Delta \boldsymbol{W}(t), \end{equation} where $\Delta \boldsymbol{W}(t) = \boldsymbol{W}(t + \Delta t) - \boldsymbol{W}(t)$. The normalized standard deviation of the thermal field is given by \begin{equation} \sigma = \sqrt{\frac{2\alpha K_bT}{\mu_0 M_s^2 V}} \sqrt{ \frac{\Delta t' }{\gamma \mu_0 M_s} }, \end{equation} where $\Delta t$ is the time step of the numerical method used and $t' = (\gamma \mu_0 M_s) t$. \noindent We then have \begin{equation} \boldsymbol{h}_T(t) \Delta t' = \sigma \xi_t, \end{equation} where the normalized thermal field $\boldsymbol{h}_T = \boldsymbol{H}_T / M_s$, and $\xi_t \sim \mathcal{N}(0,1)$ is a standard Gaussian vector.\\ \noindent The total energy of the macrospin (excluding the thermal energy) is \begin{equation} \begin{aligned} E_{total} &= V[E_{zeeman} + E_{uniaxial} + E_{shape}] \\ &= V\Big[-\mu_0 (\boldsymbol{H}_{app}\cdot \boldsymbol{M}) - K_u\cos^2\theta + \frac{1}{2}\mu_0 (N_xM_x^2 + N_yM_y^2 + N_zM_z^2)\Big]. \end{aligned} \end{equation} \noindent The total normalized effective field is then given as\\ \begin{equation} \label{heff_1} \begin{aligned} \boldsymbol{h}_{eff} &= \frac{\boldsymbol{H}_{eff}}{M_s} = \frac{-1}{\mu_0 M_s V}\nabla_{\boldsymbol{M}}E_{total}(\boldsymbol{M}) + \boldsymbol{h}_T\\ &= \boldsymbol{h}_{app} + \frac{H_k}{M_s}(\boldsymbol{\hat{n}} \cdot \boldsymbol{m}) \boldsymbol{\hat{n}} - \sum_i N_i\boldsymbol{m}_i +\boldsymbol{h}_T., \end{aligned} \end{equation} \noindent where we have normalized as $\boldsymbol{h}_{app} = \frac{\boldsymbol{H}_{app}}{M_s}, \boldsymbol{m}_i = \frac{\boldsymbol{M}_i}{M_s},$ and $\nabla_{\boldsymbol{M}}$ is the gradient with respect to the magnetization $\boldsymbol{M}$.\\ \vspace{-15pt} \section{The Implicit Midpoint method}\label{sec:midpoint} Using a numerical scheme based on the midpoint rule ensures that~(\ref{eq_llg_implicit1}) converges to the Stratonovich solution in the limit of $\Delta t \rightarrow$ 0. In this section, we define the implicit midpoint method, discretize the deterministic LLGS equation, and derive the Jacobian for use in the Gauss-Newton algorithm. \subsection{The deterministic case} For simplicity, we start the discussion with a one-dimensional (1D) deterministic ordinary differential equations (ODE) of the form \[ y'(t) = f(t, y(t)), \] with initial condition $y(0) = y_0$. The implicit midpoint update is given as \begin{equation} \label{eq_implicit1} y_{n+1} = y_n + \Delta t \cdot f\left( t_n + \frac{\Delta t }{2} , \frac{y_n + y_{n+1}}{2}\right ), \end{equation} where $t_0 = 0$ and $t_{n+1} = t_n + \Delta t$. In general, \eqref{eq_implicit1} is a nonlinear equation of $y_{n+1}$. To solve it for $y_{n+1}$ in the 1D case, one can apply Newton's method on the system \begin{equation} S(y) = y - y_n - \Delta t \cdot f\left( t_n + \frac{\Delta t }{2} , \frac{y_n + y}{2}\right ). \end{equation} \noindent In order to solve a non-linear system $\boldsymbol S:\mathbb{C}^n \to \mathbb{C}^m$, we can use a generalized version of Newton's method, the Gauss-Newton algorithm. Analogous to the 1D case, we can Taylor expand a differentiable system $\boldsymbol S$ \begin{equation} \boldsymbol S(x) = \boldsymbol S( \boldsymbol x_0) + J[\boldsymbol S](\boldsymbol x_0) \cdot (\boldsymbol x - \boldsymbol x_0) + \epsilon, \end{equation} where $J[\boldsymbol S](\boldsymbol x_0)$ is the Jacobian of $\boldsymbol S$ at $\boldsymbol x_0$. Note that $\boldsymbol x, \boldsymbol x_0 \in \mathbb{C}^n$, $\boldsymbol S(\boldsymbol x) \in \mathbb{C}^m$, and $J[\boldsymbol S](\boldsymbol x_0) \in \mathbb{C}^{m \times n}$, and $\epsilon = o(\|\boldsymbol x- \boldsymbol x_0\|_2^2)$. The $ij^{\text{th}}$ entry of the Jacobian of $\boldsymbol S$ is defined by \begin{equation} J[\boldsymbol S](\boldsymbol x)_{ij} = \frac{ \partial S_i( \boldsymbol x) }{\partial x_j}, \end{equation} where $S_i$ is the $i^{\text{th}}$ component of $\boldsymbol S$, and $x_j$ is the $j^{\text{th}}$ component of $\boldsymbol x$. Setting $\boldsymbol S( \boldsymbol x) = 0$, dropping the higher-order terms, and setting $\boldsymbol x_{n+1} = \boldsymbol x$, $\boldsymbol x_n = \boldsymbol x_0$, we can write \begin{equation} \boldsymbol x_{n+1} = \boldsymbol x_n - J[\boldsymbol S](\boldsymbol x_n)^{-1} \cdot \boldsymbol S(\boldsymbol x_n), \end{equation} if $J[\boldsymbol S]$ is invertible. As a result, we can use implicit methods on multi-dimensional ODE's, including the s-LLGS equation. \subsection{Discretizing the deterministic Landau-Lifshitz-Gilbert-Slonczewski equation} In order to apply the midpoint method, we need to discretize \eqref{eq_llg_implicit1}. Note that \eqref{eq_implicit1} takes the form \begin{equation} \label{eq_llg_implicit_step} \boldsymbol m_{n+1} = \boldsymbol m_n + \Delta t \cdot \boldsymbol f(t_n + \Delta t / 2, \boldsymbol m_{n+1/2}). \end{equation} Using the implicit formulation of $f$, we obtain \begin{equation} \begin{aligned} \boldsymbol f(t_n + \Delta t/2, \boldsymbol m_n, \boldsymbol m_{n+1}) =& (-\boldsymbol m_{n+1/2} \times \boldsymbol h_{n+1/2}) + \alpha (\boldsymbol m_{n+1/2} \times \Delta \boldsymbol m) \\ &- \boldsymbol m_{n+1/2} \times( \boldsymbol m_{n+1/2} \times \boldsymbol i_s), \end{aligned} \end{equation} where $\boldsymbol m_{n+1/2} = (\boldsymbol m_n + \boldsymbol m_{n+1})/2$, $\boldsymbol h_{n+1/2} = \boldsymbol h(\boldsymbol m_{n+1/2})$, and $\Delta \boldsymbol m = (\boldsymbol m_{n+1} - \boldsymbol m_n)/ \Delta t$. Since we are dealing with an implicit method, using the implicit definition of $d \boldsymbol m/dt$ from \eqref{eq_llg_implicit1} does not require any additional computation. In fact, using the implicit definition of $d\boldsymbol m/dt$ yields a more efficient method. This is due to the reduced complexity of the Jacobian of the system $\boldsymbol S_n$, which is used to solve for $\boldsymbol m_{n+1}$, \begin{equation} \label{eq_llg_implicit_system} \boldsymbol S_n(\boldsymbol m) = \boldsymbol m - \boldsymbol m_n - \Delta t \cdot \boldsymbol f(t_n + \Delta t/2, \boldsymbol m_n, \boldsymbol m ). \end{equation} \noindent Having set up the system $\boldsymbol S_n$, it remains to derive its Jacobian with respect to $\boldsymbol m$. \subsection{Derivation of the Jacobian} First, we state that for $\boldsymbol a, \boldsymbol b \in \mathbb{C}^3$, the cross product of $a$ and $b$ can be restated in terms of matrix-vector multiplication \begin{subequations} \begin{equation} \boldsymbol a \times \boldsymbol b = (a^{\times}) \boldsymbol b, \end{equation} where \begin{equation} a^{\times} = \begin{bmatrix} 0 & -a_3 & a_2 \\ a_3 & 0 & -a_1 \\ -a_2 & a_1 & 0 \end{bmatrix}. \end{equation} \end{subequations} \noindent The Jacobian of a cross product of two functions $\boldsymbol f,\boldsymbol g: \mathbb{C}^n \to \mathbb{C}^3$ is given by \cite{Choroszucha2010} \begin{equation} J[\boldsymbol f \times \boldsymbol g] = f^{\times} J[\boldsymbol g] - g^{\times} J[\boldsymbol f] . \end{equation} \noindent Using the above relation, one can derive the Jacobian as \begin{equation} \label{eq_jacobian} \begin{aligned} J[\boldsymbol S_n](\boldsymbol m) = \ &I + \Delta t/2 \left( \boldsymbol m_{n+1/2}^{\times} J[\boldsymbol h] - \boldsymbol h_{n+1/2}^\times \right) \\ & + \Delta t /2 \left[ \boldsymbol m_{n+1/2}^\times \boldsymbol i_s^\times - \left(\boldsymbol m_{n+1/2} \times \boldsymbol i_s \right)^\times \right] \\ &- \alpha \boldsymbol m_n^\times, \end{aligned} \end{equation} \noindent where $\boldsymbol m_{n+1/2} = (\boldsymbol m+\boldsymbol m_n)/2$, $\boldsymbol h_{n+1/2} = \boldsymbol h(\boldsymbol m_{n+1/2})$, and \begin{equation} J[\boldsymbol h] = \frac{H_k}{M_s} \begin{bmatrix} n_x^2 & n_x n_y & n_x n_z \\ n_y n_x & n_y^2 & n_y n_z \\ n_z n_x & n_z n_y & n_z^2 \end{bmatrix} - \begin{bmatrix} N_x & & \\ & N_y & \\ & & N_z \end{bmatrix}, \end{equation} \noindent where $\boldsymbol n= (n_x, n_y, n_z)^T$ is the easy axis, and $\boldsymbol N = (N_x, N_y, N_z)^T$ are the demagnetization coefficients. To summarize, we will use the Jacobian in \eqref{eq_jacobian} to solve $\boldsymbol S_n$ in \eqref{eq_llg_implicit_system} for the magnetization value $\boldsymbol m_{n+1}$ using the Gauss-Newton algorithm. \section{Methods to solve the s-LLGS equation}\label{sec:methods} In this section, we first obtain the Stratonovich SDE form of the s-LLGS equation. We then formulate the various numerical schemes for Stratonovich SDEs. Specifically, we focus on implicit midpoint, Heun, Euler-Heun, and a new method, namely the RK4-Heun. The accuracy of these methods is tested on an SDE with a known analytical solution. Finally, we perform numerical tests for these methods by applying them on the s-LLGS equation. \subsection{Stratonovich SDE form of the s-LLGS equation} \noindent A stochastic integral over a Wiener process $W(t): \mathbb{R}^+ \to \mathbb{R}$ \cite{Morters2010} is defined as \begin{equation} \int_a^b g(t ) dW(t) = \lim_{\Delta t \to 0} \sum_k g(\tau_k) (W(t_{k+1}) - W(t_k)), \end{equation} where $\{ t_k \}_k$ forms a partition of $[a,b]$, and $\tau_k \in [t_{k+1}, t_k]$. Contrary to the Riemann integral, different choices of $\tau_k$ yield different results of the integral. This is the case if $g$ is a function of both $t$ and the Wiener process $W(t)$. The most common choices are $\tau_k = t_k$ and $\tau_k = (t_{k+1} + t_k)/2$. The former yields the Ito calculus, while the latter results in the Stratonovich calculus. A widely used notation for the Stratonovich integral to distinguish it from the Ito integral is \begin{equation} \int_a^b g(t) \circ dW(t), \end{equation} which we will use in the following. Numerical schemes that attempt to approximate an SDE's solution have to be constructed for a specific calculus. In our case, this is the Stratonovich interpretation \cite{Gardiner1997}.\\ \noindent In a somewhat general form, we can write a Stratonovich SDE as \begin{equation} \label{eq_stochastic_def} dX_t = f(X_t, t) dt + g(X_t, t) \circ dW_t. \end{equation} The s-LLGS equation in \eqref{eq_llg_explicit1} can be restated in the general Stratonovich SDE form given in \eqref{eq_stochastic_def}. To this end, let $X(t) = \boldsymbol{m}_t$, and define \begin{subequations} \label{eq_fg_stochastic} \begin{equation} \label{eq_f_stochastic} \begin{aligned} f(\boldsymbol{m}_t, t) =& -\alpha' \ [ \boldsymbol{m}_t \times \boldsymbol{h} + \boldsymbol{m}_t \times (\boldsymbol{m}_t \times \boldsymbol{i}_s) \\ &+ \alpha (\boldsymbol{m}_t \times (\boldsymbol{m}_t \times \boldsymbol{h}) - \boldsymbol{m}_t \times \boldsymbol{i}_s )], \end{aligned} \end{equation} \begin{equation} \label{eq_g_stochastic} \begin{aligned} g(\boldsymbol{m}_t,t) =& - (\alpha' \nu) \ m_t^\times [ I + \alpha m_t^\times ], \end{aligned} \end{equation} \end{subequations} where $\alpha' = 1/(1 + \alpha^2)$, and $\nu$ is the standard deviation of the Wiener process, which is used to model the thermal field fluctuations. Together \eqref{eq_stochastic_def} and \eqref{eq_fg_stochastic} define the form of the s-LLGS equation we will be working with throughout this paper. Further, we will deal with two modes of convergence of numerical approximations to solutions of SDEs introduced in \cite{Kloeden_Platen}. Given a solution $X_t$ of \eqref{eq_stochastic_def}, an approximation $\tilde X_t$ is said to converge to $X_t$ in the {\it strong sense with order} $\gamma > 0$ if there is a $ C \in \mathbb{R}$ such that \begin{equation} \mathbb{E} \left( \left| \tilde X_t - X_t \right| \right) < C (\Delta t)^\gamma, \end{equation} holds for any discrete approximation $\tilde X_t$ with maximum step-size $\Delta t \>$\cite{Kloeden_Platen}. On the other hand, an approximation $\tilde X_t$ is said to converge to $X_t$ in the {\it weak sense with order} $\gamma > 0$ if there is a $ C \in \mathbb{R}$ such that \begin{equation} \left| \mathbb{E} ( p( \tilde X_t) ) - \mathbb{E} (p(X_t)) \right| < C (\Delta t)^\gamma, \end{equation} holds for any polynomial $p$ and any discretization with maximum step size $\Delta t$. Note that convergence in the strong sense is equivalent to convergence for each realization of $W_t$ (i.e. path), while convergence in the weak sense merely implies that the statistical properties of the approximation converge to those of the solution. \subsection{Numerical schemes for Stratonovich SDEs} In order to numerically solve \eqref{eq_stochastic_def}, the following must be computed: \begin{equation} \label{eq_stochastic_solution} X_t = \int_0^t f(X_t, t) dt + \int_0^t g(X_t,t) \circ dW(t) + X_0, \end{equation} where the first integral is a regular Riemann integral, and the second integral is a stochastic integral interpreted in the Stratonovich sense. In our case, we are dealing with three-dimensional (3D) vector integrals, and $W(t)$ is a 3D Wiener process. Below, we briefly outline the methods that we focus on in this work. \begin{enumerate} \item \textit{Euler-Heun}\\ Arguably the simplest method that converges to the Stratonovich solution is the Euler-Heun method defined by \begin{subequations} \begin{equation} X_{n+1} = X_n+ f(X_n, t_n) \Delta t + \frac{1}{2} \left[ g( \tilde X_{n+1}, t_{n+1}) + g(X_n, t_n)\right] \eta_n, \end{equation} \begin{equation} \tilde X_{n+1} = X_n + g(X_n, t_n)\eta_n, \end{equation} where $\eta_n = \sqrt{\Delta t} \xi_n$, $\Delta t \in \mathbb{R}^+$, and $\xi_n \sim \mathcal{N}(0,1)$. \end{subequations} \item \textit{Heun}\\ The Heun method is given by \begin{equation} X_{n+1} = X_n + \frac{1}{2} \left[ f(\tilde X_{n+1}, t_{n+1}) + f(X_n, t_n) \right] \Delta t+ \frac{1}{2}\left[ g( \tilde X_{n+1}, t_{n+1}) + g(X_n, t_n)\right] \eta_n, \end{equation} where \begin{equation} \begin{aligned} \tilde X_{n+1} = X_n + f(X_n, t_n) \Delta t + g(X_n, t_n) \eta_n. \end{aligned} \end{equation} \item \textit{Implicit midpoint}\\ The implicit midpoint rule is defined by \begin{equation} \begin{aligned} X_{n+1} = X_n + f(X_{n+1/2}, t_n+\Delta t/2) \Delta t + g(X_{n+1/2}, t_n+ \Delta t/2) \eta_n, \\ \end{aligned} \end{equation} where $X_{n+1/2} = (X_{n+1} + X_n) /2$. Note that this defines an implicit system just as in the deterministic case, and we can use the methods derived for the deterministic case to solve it. We use the Euler step \begin{equation} X^* = X_n + f(X_n, t_n) \Delta t + g(X_n, t_n) \eta_n, \end{equation} as the initial guess for the Gauss-Newton algorithm, to find $X_{n+1}$.\\ \end{enumerate} \vspace*{-3ex} \noindent All of the above methods are known to converge to the Stratonovich solution with a strong order $1/2$, and a weak order $1$ \cite{Kloeden_Platen,Milstein2002}. Compared to numerical methods for deterministic DEs, this order of convergence is low. However, stochastic higher-order methods generally require the approximation of iterated stochastic integrals, which is a detailed and time-intensive procedure \cite{Gaines_1993}. If an SDE has a special structure, like an additive or commutative noise term, this calculation can be simplified. Unfortunately, the noise term of the s-LLGS equation is multiplicative and non-commutative.\\ \noindent Further, it is important to note that semi-implicit numerical methods based on extrapolation, which are used to handle deterministic DEs, generally do not converge to solutions of SDEs. The reason for this is that extrapolations from the past destroy the Markov property (independent increments) of the Wiener process over which we integrate. As seen in Figure \ref{fig_adam_path}, a semi-implicit midpoint scheme using Adam's extrapolation \cite{Serpico2001}, where $X_{n+1/2} = \frac{1}{2}(3X_n-X_{n-1})$, does not converge to the solution of the test SDE, \begin{equation} \label{eq_test_eq} dX_t = X_t dt + X_t \circ dW_t, \end{equation} with solution \begin{equation} \label{eq_test_sol} X_t = e^{t+W_t}. \end{equation} \vspace*{-3ex} \begin{figure}[H] \begin{center} \includegraphics[scale=0.42]{adam_path_err} \end{center} \vspace*{-3ex} \caption{\footnotesize Average path-wise error of midpoint approximations using Adam's extrapolation compared to the analytical solution of \eqref{eq_test_eq}.} \label{fig_adam_path} \end{figure} \subsection{A method for small noise} In many stochastic models corresponding to physical systems, the noise term is usually much smaller than the drift term. Indeed, while the stochastic term plays a critical role in the s-LLGS equation, it is frequently one to two orders of magnitude smaller than the deterministic term, if $T$ is close to room temperature. This means a higher order approximation of the drift term alone could improve the accuracy of the entire approximating process, when the absolute error is dominated by the error in the deterministic term. This idea has been investigated for Ito SDEs in \cite{Mil_1997, Ro_2013}. Here, we propose a scheme for Stratonovich SDEs, which we are going to refer to as RK4-Heun. It is defined by \begin{equation} \begin{aligned} X_{n+1} &= X_n + D \Delta t + S \eta_n, \\ D &= (d_1 + 2d_2 + 2d_3 + d_4)/6, \\ S &= (s_1 + s_2)/2,\\ s_1 &= g(X_n,t_n),\\ s_2 &= g(X_n + f(X_n, t_n) \Delta t + s_1 \eta_n), \\ d_1 &= f(X_n,t_n),\\ d_2 &= f(X_n + (d_1 + s_1)/2, t_n + \Delta t/2), \\ d_3 &= f(X_n + (d_2 + s_1)/2, t_n + \Delta t/2), \\ d_4 &= f(X_n + d_3 + s_1, t_n + \Delta t). \end{aligned} \end{equation} \noindent Importantly, the RK4 stages are only used to approximate the deterministic part of the equation. Therefore, convergence to the Stratonovich solution is maintained. Further, we made the observation that making the additional update \begin{equation} \begin{aligned} X_{n+1}' &= X_n + D \Delta t + S' \eta_n, \\ S' &= (s_1 + s_2')/2, \\ s_2' &= g(X_{n+1}, t_{n+1}), \\ \end{aligned} \end{equation} after computing the above, leads to a significant increase in accuracy for the test equation \eqref{eq_test_eq}. The additional update includes the higher order approximation of the deterministic term in the Heun step of the stochastic term. As a consequence, it is not surprising that this leads to a better approximation. However, we have not yet investigated analytical justifications of this update. Future work will look into that and the possible limitations of this effect. \subsection{Numerical tests using a general SDE} To compare the accuracy of the various methods discussed above, we consider a modified version of the test SDE \eqref{eq_test_eq}, which can be solved analytically, \begin{equation} \label{eq_test_gen} dX_t = a X_t dt + b X_t \circ dW_t, \end{equation} where $a, b \in \mathbb{R}$. A Stratonovich solution to \eqref{eq_test_gen} is given by \begin{equation} \label{eq_integral_test_eq} X_t = X_0 + \int_0^t X_s ds + \int_0^t X_s \circ dW_s = e^{at+b W_t}, \end{equation} where $X_0 = 1$. We can now compare the results of different numerical schemes to this analytical solution. \noindent The implicit midpoint method for \eqref{eq_test_eq} is defined by \begin{equation} X_{t+1} = X_t + a \frac{1}{2} ( X_{t+1} + X_t) \Delta t + b \frac{1}{2}(X_{t+1} + X_t) \eta_t. \end{equation} This can be solved for $X_{t+1}$ analytically, according to \begin{equation} \begin{aligned} \label{eq_test_implicit} X_{t+1} = X_t \left( \frac{ 2 + c}{2 - c} \right), \\ c = a \Delta t + b \eta_t. \end{aligned} \end{equation} \noindent The experimental results for the path-wise error to the analytical solution, $X_{1}$, are shown in Figure \ref{fig_path_err_1} and \ref{fig_path_err_2} for two different choices of $b$ in \eqref{eq_test_gen}. The data shows that the RK4-Heun scheme is more accurate than all other methods for all step sizes considered. Interestingly, the empirical order of convergence, which is the slope of the error function in Figure \ref{fig_path_err}, is only constant for the Euler-Heun method. All other methods start out with a faster order (steeper slope) for larger step sizes. This is due to the fact that the deterministic part of the equation, and hence the error in its approximation, dominates the stochastic part. Therefore, the slope for big step sizes is more like the deterministic second order of convergence for the Heun and implicit midpoint schemes. We see this effect for smaller step sizes as the size $b$ of the stochastic part is decreased in Figure~\ref{fig_path_err_2}. \vspace{-2ex} \begin{figure}[H] \centering \begin{subfigure}{.45\linewidth} \centering \includegraphics[scale=0.4]{path_err_3} \vspace{-3ex} \caption{$a = 1, b = 0.1$} \label{fig_path_err_1} \end{subfigure} \qquad \begin{subfigure}{.45 \linewidth} \centering \includegraphics[scale=.4]{path_err_2} \vspace{-3ex} \caption{$a = 1, b = 0.01$} \label{fig_path_err_2} \end{subfigure} \vspace{-1ex} \caption{\footnotesize Average path-wise error of the numerical approximations corresponding to equation \eqref{eq_test_gen} with two different choices of $a$ and $b$. } \label{fig_path_err} \end{figure} \vspace{-3ex} \subsection{Numerical tests using the s-LLGS equation} \noindent Now, we are going to test the properties of these methods on the s-LLGS equation, defined by \eqref{eq_f_stochastic} and \eqref{eq_g_stochastic}. It is important to note that the norm of the magnetization vector $\boldsymbol{m}$ is preserved if the equation is interpreted in the Stratonovich sense. This follows from the fact that in the Stratonovich calculus, \[ d( \| m_t \|^2 ) = 2 \boldsymbol{m}_t \cdot d\boldsymbol{m}_t = 0, \] whereas in the Ito calculus, Ito's Lemma gives \vspace{-2ex} \[ d( \|m_t\|^2 ) = 2 \boldsymbol{m}_t \cdot d\boldsymbol{m}_t + \sum_{i,j = 1}^3 \frac{ \partial^2 \| \boldsymbol m\|^2}{\partial m_i \partial m_j}(\boldsymbol{m}_t) ~ \left( dm_{i,t} \cdot dm_{j,t} \right), \] which is, in general, not zero. Explicit schemes like Euler-Heun or Heun, while solving the Stratonovich equation, do not preserve the norm. Indeed, one has to take a very small step size $\Delta t$ so that the norm of the magnetization does not blow up. On the other hand, the implicit midpoint method preserves the norm. The contrasting behavior of the magnetization norm obtained using different stochastic calculi is highlighted in Figures 3a and 3b. Indeed the midpoint method that converges to the Stratonovich solution preserves the norm while the Ito solution does not. \vspace{-2ex} \begin{figure}[H] \centering \begin{minipage}{.5\textwidth} \centering \includegraphics[scale=0.39]{stratonovich} {(a)} \label{fig:test1} \end{minipage}% \begin{minipage}{.5\textwidth} \centering \vspace*{-2ex} \includegraphics[scale=0.39]{ito} (b) \label{fig:test2} \end{minipage} \vspace{-2ex} \caption{\footnotesize Time evolution of magnetization with (a) implicit midpoint converging to the Stratonovich solution and (b) Heun-Euler converging to the Ito solution. Conditions are zero spin current (only noise) and energy barrier $U = 10K_BT$. The magnetization norm is preserved with the former, but blows up with the latter. } \end{figure} \noindent The deviation of the magnetization norm from unity for different numerical techniques is depicted in Figure \ref{fig_norm_comparison}. The error tolerance for the Gauss-Newton algorithm in the implicit midpoint method was $10^{-12}$. For this reason, the norm is only preserved up to this order of magnitude. In practice, decreasing the error tolerance further only slows down the algorithm without significant benefit. In Figure \ref{fig_magnetization_difference}, we show the maximum norm of the difference of the magnetization vectors, calculated by the Heun, implicit midpoint, and RK4-Heun methods. The difference is quite pronounced at larger time steps as expected, and diminishes as the time step is reduced. We see that the explicit methods converge to the same path quickly, while the difference to the implicit scheme decreases at a slower rate.\\ \vspace{-4ex} \begin{figure}[H] \centering \begin{subfigure}{.45\textwidth} \centering \includegraphics[scale=0.4]{mag_norm_plot} \caption{\footnotesize Norm of magnetization vector in the course of several simulations with different $\Delta t$, calculated with three numerical schemes. Here, $1$ ns $\sim 66$ time units.} \label{fig_norm_comparison} \end{subfigure} \qquad \begin{subfigure}{.45\textwidth} \centering \includegraphics[scale=0.4]{traj_diff} \caption{\footnotesize Maximum norm of the difference of magnetization vectors as calculated with the implicit midpoint method, Heun, and RK4-Heun scheme. } \label{fig_magnetization_difference} \end{subfigure} \caption{\footnotesize Results of using the Heun, RK4-Heun, and implicit midpoint scheme on the s-LLGS equation.} \label{fig_LLG_bench} \end{figure} \noindent It would be interesting to see the discrepancy in the switching boundaries obtained from the Heun and implicit midpoint schemes. The 50$\%$ switching boundary is a useful metric since it is commonly used to benchmark solvers. To this end, we construct a contour plot (Figure \ref{3Dcontour}) by sweeping over spin current durations and amplitudes to ascertain the 50$\%$ and 90$\%$ switching boundaries from the two methods. The maximum discrepancy in the switching boundaries is observed at the 50$\%$ switching probability. However, the difference in the switching probability between the two methods diminishes in the high current, long time-scale regimes for the chosen time step of numerical integration. \vspace{-4ex} \begin{figure}[H] \includegraphics[scale=0.47]{contour} \vspace{-4ex} \caption{\footnotesize Contour plot for switching probability as a function of spin current amplitude and duration. 50$\%$ and 90$\%$ switching boundaries are depicted for implicit midpoint and explicit Heun schemes.} \label{3Dcontour} \vspace{0ex} \end{figure} \section{SPICE simulation of macrospin dynamics} Circuit-level simulations using nanomagnets are often conducted using SPICE-based models, which represent the nanomagnet using basic circuital elements such as resistors, capacitors, and current sources. It is, therefore, important to benchmark the accuracy of SPICE numerical solvers with respect to the implicit midpoint method to solve the s-LLGS equation. SPICE uses methods such as Euler, Gear, trapezoidal, or a combination of these, to numerically integrate DEs. Although the trapezoidal method is compatible with the Stratonovich stochastic calculus, other numerical methods in SPICE require that the s-LLGS equation be transformed into the equivalent Ito representation for correct convergence. While there are many versions of SPICE available \cite{ngspice2011,xyce2014,smartspice2010}, possibly with varying minimum time steps and specific algorithms to solve equations, we use NGSPICE for our simulatons in this paper. Figure~\ref{fig:nanomagnet_schem} shows the SPICE circuit implementation of a nanomagnet subject to thermal effects and spin torque, in one particular direction (x, y or z). The other two magnetization directions are implemented similarly. The magnetization $\boldsymbol{m} = \boldsymbol{M}/M_s$ is modeled as the node voltage of a capacitor, and the effective field inside the nanomagnet is represented as a dependent current source. Detailed circuit derivations can be found in prior works \cite{Sasikanth2012} and \cite{Phillip}. The s-LLGS equation was implemented in SPICE in both its cartesian and spherical coordinates form, and the results from these implementations are discussed below. \subsection{SPICE implementation of the s-LLGS equation in cartesian form} Large-scale Monte Carlo simulations were conducted using the circuit representation in Figure~\ref{fig:nanomagnet_schem} to generate the probability density function (PDF) plots of the magnetization reversal delays of an in-plane nanomagnet. The time step of integration is taken to be 1 ps, reducing which, leads to convergence issues in the SPICE nodal analysis. From the results shown in Figure~\ref{fig:spice_vs_matlab}, we find that SPICE solvers working with the cartesian form of the s-LLGS equation overestimate the mean delay of magnetization reversal as compared to the implicit midpoint method. In addition, unlike the implicit midpoint method, SPICE solvers are unable to preserve the magnetization norm with the cartesian s-LLGS eqauation, as shown in Figure \ref{SPICE_norm}. We also highlight the differences in the initial angle distribution obtained from various numerical schemes in Figure \ref{initial_angle}. In this figure, the macrospin is subject to thermal noise for a period of 1 ns and no external magnetic field or spin torque is applied. The s-LLGS equation conserves magnetization norm and has a Boltzmann initial angle distribution only if the Stratonovich stochastic calculus with the midpoint prescription is used. For other stochastic discretization schemes, none of these properties are ensured and a carefully chosen drift term has to added to recover the validity of these properties when other stochastic calculi are used \cite{roma2014numerical}. As expected, the discrepancy in results is exacerbated for Euler method due to the fact that it does not solve for the correct Stratonovich SDE equation and will require an alternative Ito representation of the s-LLGS equation. Whereas the trapezoidal method does converge to the Stratonovich solution for $\Delta t \rightarrow 0$, but it is limited by the minimum time step of the DE solver in SPICE. Hence we see a 200 ps difference in the mean reversal delay obtained with implicit midpoint and the trapezoidal solver of SPICE (with cartesian s-LLGS equation). It must be noted that these significant errors in magnetization reversal computed from SPICE will ultimately lead to inaccurate estimates of circuit-level performance metrics such as error-rate, latency, and energy dissipation of complex magneto-logic networks. \\ \vspace*{-4ex} \begin{figure}[H] \centering \begin{subfigure}[t]{0.5\textwidth} \centering \includegraphics[scale=0.47]{schematic} \caption{\footnotesize Schematic of nanomagnet used in the circuit\\ simulations.} \label{fig:nanomagnet_schem} \end{subfigure}% ~ \begin{subfigure}[t]{0.5\textwidth} \centering \includegraphics[scale=0.33]{SPICEvsMATLAB3-eps-converted-to.pdf} \caption{\footnotesize PDFs of reversal delays of a nanomagnet using implicit midpoint, SPICE trapezoidal solver (cartesian and spherical s-LLGS), and SPICE backward-Euler solver.} \label{fig:spice_vs_matlab} \end{subfigure} \vspace*{-1ex} \caption{\footnotesize The simulations were performed for an in-plane magnet using identical dimensions $40\times 40\times 1$ nm$^3$, parameters $M_s = 1.11e6$ A/m, $H_k = 1.11e5$ A/m, $\alpha = 0.01$, time step $1$ ps, and spin current $0.16$ mA.} \end{figure} \vspace*{-2ex} \begin{figure}[H] \centering \begin{minipage}{.5\textwidth} \centering \includegraphics[scale=0.4]{SPICEnorm-eps-converted-to.pdf} \caption{\footnotesize Norm of the magnetization vector in the course of a simulation, calculated with SPICE and implicit mid-point solvers. The parameters used are the same as for Figure~\ref{fig:spice_vs_matlab}. } \label{SPICE_norm} \end{minipage}% ~ \hspace*{2ex} \begin{minipage}{.5\textwidth} \centering \vspace{2ex} \includegraphics[scale=0.42]{SPICE_init2-eps-converted-to.pdf} \caption{\footnotesize Initial angle distribution of the nanomagnet after it has been subjected to only thermal noise for 1 ns, from SPICE and our implicit midpoint solver. \\} \label{initial_angle} \end{minipage} \end{figure} \subsection{SPICE implementation of the s-LLGS equation in spherical form} To mitigate the aforementioned errors in the SPICE-based solvers, we look at the implementation of the s-LLGS equation in spherical coordinates form. The spherical coordinates of the unit magnetization vector $\mathbf{m}$ at any position can be written as $(\theta, \phi)$, where $\theta$ is measured from the positive direction of $z$-axis, and $\phi$ is measured counterclockwise from the positive direction of $x$-axis. Further, the local orthogonal unit vectors in the directions of increasing $\theta$, and $\phi$ respectively are given by \begin{equation} \boldsymbol{\hat{\theta}} = [\cos\theta \cos\phi, \cos\theta \sin\phi, -\sin\theta]; \quad \boldsymbol{\hat{\phi}} = [-\sin\phi, \cos\phi, 0]. \end{equation} \noindent The s-LLGS equation in spherical coordinates can be expressed in terms of the $\theta$ and $\phi$ components of the effective field ($h_{\theta}, h_{\phi}$), and spin current ($i_{s\theta}, i_{s\phi}$) as \begin{equation} \begin{bmatrix} \frac{d\theta}{dt}\\ \sin\theta \cdot \frac{d\phi}{dt} \end{bmatrix} = \frac{1}{1+\alpha^2}\begin{bmatrix} h_{\phi} + i_{s\theta} + \alpha h_{\theta} - \alpha i_{s\phi}\\ i_{s\phi} - h_{\theta} + \alpha h_{\phi} + \alpha i_{s\theta} \end{bmatrix}, \label{eq:LLG_sph} \end{equation} \begin{wrapfigure}{l}{0.52\textwidth} \vspace{-5ex} \includegraphics[scale=0.31]{SPICE_init1-eps-converted-to.pdf} \caption{\footnotesize Initial angle distribution of the nanomagnet after it has been subjected to only thermal noise for 1 ns, from SPICE trapezoidal solver (spherical s-LLGS) and our implicit midpoint solver} \label{spherical_init} \vspace*{-1ex} \end{wrapfigure} \noindent where $(i_s/h)_{\theta} = \mathbf{(i_s/h)}\cdot\boldsymbol{\hat{\theta}}$, $(i_s/h)_{\phi} = \mathbf{(i_s/h)}\cdot\boldsymbol{\hat{\phi}}$, and $\cdot$ denotes dot product. The solution ($\theta$, $\phi$) of (\ref{eq:LLG_sph}) can be reverted back to cartesian coordinates by using $\mathbf{m} = [\sin\theta\cos\phi, \sin\theta\sin\phi, \cos\theta]$. Though a change of coordinate system does not change the solution of the system being solved, there are some subtle differences in the numerical implementation of the cartesian and spherical forms. An apparent difference is the need to solve for only two variables $\theta$ and $\phi$ in spherical coordinates, compared to three variables $m_x, m_y$ and $m_z$ in cartesian. This makes implementing s-LLGS equation in spherical coordinates less expensive, especially when using implicit methods, where the overhead cost of calculating the $\theta$ and $\phi$ components (few multiplications) is way less than solving the implicit step (which incurs fixed point iteration). This also forces the norm to be preserved to unity automatically as shown in Figure \ref{SPICE_norm}. Importantly, we can also see from Figures \ref{fig:spice_vs_matlab} and \ref{spherical_init} that the deviation in the delay distribution and initial angle distribution from the implicit midpoint solver is minimized for the case of the spherical s-LLGS implementation. \noindent Figures \ref{fig:carLLG} and \ref{fig:sphLLG} show the trajectory of magnetization of the cartesian and spherical coordinates implementation of the s-LLGS equation for a range of time steps. For smaller time steps, the cartesian and spherical forms yield identical solutions which are both accurate and stable. For moderate time steps, the cartesian form stretches the trajectory to outside the unit circle; the spherical form has kinks around $m_z = \pm 1$ due to singularity of $\frac{d\phi}{dt}$ in (\ref{eq:LLG_sph}) at $\theta = 0, \pi$. This results in underestimation of reversal delay at moderate time step. For larger time steps, the cartesian and spherical forms produce unstable solutions, which are unbounded and oscillatory in nature respectively. In short, there is a trade-off between differentiability and boundedness in the cartesian and spherical implementations, respectively. \vspace{4ex} \begin{figure}[H] \begin{subfigure}[t]{0.33\textwidth} \includegraphics[width=0.95\textwidth]{car_small} \caption{Small time step: 0.01} \label{fig:car_small} \end{subfigure}% ~ \begin{subfigure}[t]{0.33\textwidth} \includegraphics[width=0.95\textwidth]{car_medium} \caption{Moderate time step: 0.1} \label{fig:car_medium} \end{subfigure}% ~ \begin{subfigure}[t]{0.33\textwidth} \includegraphics[width=0.95\textwidth]{car_large} \caption{Large time step: 0.3} \label{fig:car_large} \end{subfigure} \caption{\footnotesize Cartesian form s-LLGS simulation of magnetization reversal from $-x$ to $+x$ direction for an applied field $H_{app}= M_s$ along positive x-axis for different time steps (normalized). The simulation parameters are same as that in Figure \ref{fig:spice_vs_matlab}. (a) Small time step yields both accurate and stable solution. (b) Moderate time step gives a stable solution which is stretched along the reversal direction, thereby underestimating the reversal delay (zero crossing of $m_x$). (c) Large time step results in unbounded and unstable solution.} \label{fig:carLLG} \end{figure} \begin{figure}[H] \begin{subfigure}[t]{0.33\textwidth} \includegraphics[width=0.95\textwidth]{sph_small} \caption{Small time step: 0.01} \label{fig:sph_small} \end{subfigure}% ~ \begin{subfigure}[t]{0.33\textwidth} \includegraphics[width=0.95\textwidth]{sph_medium} \caption{Moderate time step: 0.1} \label{fig:sph_medium} \end{subfigure}% ~ \begin{subfigure}[t]{0.33\textwidth} \includegraphics[width=0.95\textwidth]{sph_large} \caption{Large time step: 0.3} \label{fig:sph_large} \end{subfigure} \caption{\footnotesize Spherical form s-LLGS simulation of magnetization reversal from $-x$ to $+x$ direction for an applied field $H_{app}= M_s$ along positive x-axis for different time steps (normalized). The simulation parameters are same as that in Figure \ref{fig:spice_vs_matlab}. (a) Small time step yields both accurate and stable solution. (b) Moderate time step gives a stable solution with kinks and missing precessions around the unstable pole at $m_z=\pm 1$, and also underestimates the reversal delay. (c) Large time step results in bounded and oscillatory solution.} \label{fig:sphLLG} \end{figure} \noindent We have already seen that time step is crucial to obtain an accurate and a stable solution. To get a smooth and continuous trajectory of $\mathbf{m}$, $|d\mathbf{m}|$ should be small for a given time step $dt$. Since, $\frac{d\mathbf{m}}{dt} \propto \mathbf{h}_{\mathrm{eff}}, \mathbf{i}_{\mathrm{s}}$, we get the constraint \begin{equation} \{|\mathbf{h}_{\mathrm{eff}}|, |\mathbf{i}_{\mathrm{s}}|\}dt\ll 1\quad \text{or} \quad \mathrm{max}\{|\mathbf{h}_{\mathrm{eff}}|, |\mathbf{i}_{\mathrm{s}}|\}dt\ll 1. \label{eq:tscons1} \end{equation} From (\ref{heff_1}), the magnitude of effective field is bounded by \begin{align*} |\mathbf{h}_{\mathrm{eff}}| &= \left|\mathbf{h}_{app} + \frac{H_k}{M_s} (\hat{\mathbf{n}}\cdot \mathbf{m})\hat{\mathbf{n}} - \sum_i N_i m_i + \mathbf{h}_T\right| \\ &\leq |\mathbf{h}_{app}| + \left|\frac{H_k}{M_s}(\hat{\mathbf{n}}\cdot \mathbf{m})\hat{\mathbf{n}}\right| + \left|\sum_i N_i m_i \right| + |\mathbf{h}_T| \\ &= |\mathbf{h}_{app}| + \frac{H_k}{M_s} + 1 + \nu = |\mathbf{h}_{app}| + \varepsilon \end{align*} where $\varepsilon = \frac{H_k}{M_s} + 1 + \nu$. Therefore, the constraint in (\ref{eq:tscons1}) becomes \begin{equation} \mathrm{max}\{|\mathbf{h}_{\mathrm{ap}}| + \varepsilon, |\mathbf{i}_{\mathrm{s}}|\}dt\ll 1. \label{eq:tscons2} \end{equation} Suppose we take the LHS in (\ref{eq:tscons2}) to be 10 times smaller than 1, we get \begin{equation} dt_{\mathrm{crit}} = \frac{0.1}{\mathrm{max}\{|\mathbf{h}_{\mathrm{ap}}|+\varepsilon, |\mathbf{i}_{\mathrm{s}}|\}}. \end{equation} Note that the critical time step doesn't depend on $\alpha$, when we have chosen a $dt$ which satisfies the wider constraint in (\ref{eq:tscons1}). For the simulation results in Figures \ref{fig:car_small} and \ref{fig:sph_small}, we have $\varepsilon = 0.1+1+0 = 1.1$ and $|\mathbf{h}_{ap}| = 1$, which gives $\varepsilon = 2.1$, and $dt_{\mathrm{crit}} = 0.045$. Hence, we get a smooth trajectory in Figures \ref{fig:car_small} and \ref{fig:sph_small} since the time step chosen is smaller than this critical time step. But this is not the case for Figures 10(b-c) and 11(b-c), which results in unboundedness, discontinuities, and oscillations. \section{Benchmarking with OOMMF} The Object Oriented MicroMagnetic Framework (OOMMF) by NIST is a widely used open source, portable, public domain tool for micromagnetics. The Oxs (OOMMF eXtensible Solver) is an extensible micromagnetic computation engine capable of solving problems defined on three-dimensional grids of rectangular cells holding three-dimensional spins \cite{Donahue}. We use OOMMF's Oxs with evolver class \textquotedblleft SpinXferEvolve" to simulate a single magnet whose magnetization evolves under the application of a spin current. Unfortunately there are no default evolver classes from OOMMF that include the effects of thermal noise. However, there are third-party extensions capableof performing thermal simulations in \begin{figure}[H] \hspace*{-15ex} \includegraphics[scale=0.38]{MATLABvsOOMMF} \vspace*{-5ex} \caption{\footnotesize The evolution of the magnetization vector under STT (without thermal effects) using our implicit midpoint implementation and the OOMMF solver. } \label{MATLABvsOOMMF} \end{figure} \noindent OOMMF. While the extension \textquotedblleft Xf$\_$ThermSpinXferEvolve" \cite{Fong} implements the solution of the s-LLGS equation using the Heun method, it naively renormalizes the magnetization norm in every iteration. The numerical accuracy and stability of this operation are questionable, and there appears to be no physical reason for this. In this section, we compare the magnetization vectors (from OOMMF) in the deterministic case with the corresponding vectors obtained from our implementation of the implicit midpoint method, as shown in Figure \ref{MATLABvsOOMMF}. This exercise substantiates the claim that our implicit midpoint realization is very close to the NIST standard. \section{Outlook and Conclusion} While a discussion of strong higher-order methods was not the goal of this paper, there are notable developments, whose applicability in solving the s-LLGS equation will be investigated in the future. Namely, the efficient strong order stochastic Runge-Kutta schemes which were proposed in \cite{Ro_2010_2}. These schemes have the advantage that the number of evaluations of the drift term of an SDE only increases linearly with the dimension of the driving Wiener process. This is in contrast to previous methods, which relied on a quadratically increasing number of evaluations of the drift term. For the approximation of the general multiple stochastic integrals, a method introduced in \cite{Wi_2001, Wi_2001_2} can be used.\\ \noindent Further, is important to note that many properties of magnets that are of interest to engineers can be solved for using weakly convergent schemes. For example, the switching probability of a magnet at an arbitrary time is such a property. Importantly, there are known schemes which converge in the weak sense with orders up to 4 \cite{Kloeden_Platen}. Recently, a very efficient explicit scheme with weak convergence order 2 has been introduced in \cite{Ro_2009, Ro_2010}. Many of these schemes can be simplified so that no iterated stochastic integrals have to be computed. This is a time-intensive process because many random variables have to be computed at each time step, and it is one of the reasons why efficient high strong-order schemes are currently only available for equations with special structure. In order to take advantage of these higher order approximations, the authors are currently investigating weakly convergent higher-order schemes for the s-LLGS equation.\\ \noindent Summarising, in this paper, we examine the accuracy of (i) implicit midpoint, (ii) Heun, (iii) Euler-Heun, and (iv) RK4-Heun numerical methods to solve the s-LLGS equation of macrospin dynamics. We compare the performance of these methods in terms of the average path-wise error, preservation of the magnetization norm, and 50\% switching boundary of macrospin reversal. We clearly show the higher accuracy of the implicit midpoint method as compared to other methods. However, the RK4-Heun method offers significant benefits in precision when the stochastic term in the s-LLGS equation is 2-3 orders of magnitude lower than the deterministic term. We also demonstrate that SPICE-based numerical integration schemes, such as trapezoidal, Gear, and Euler, when solving the cartesian s-LLGS equation, perform poorly and lead to significant errors in the results as compared to the implicit midpoint method at the same time step. We discuss the spherical coordinates implementation of the s-LLGS equation in SPICE as a possible solution to mitigate this problem, and also evaluate the critical time step required to obtain stable and accurate solutions for these implementations. Through an exhaustive study, we provide guidelines that will help researchers analyze macrospin dynamics more accurately in the context of appropriate stochastic calculus and the use of numerical integration method. \section*{Acknowledgements} \noindent The authors would like to acknowledge Prof. Supriyo Datta and Dr. Kerem Camsari from Purdue, and Nickvash Kani from Georgia Tech for the many useful discussions.
{'timestamp': '2017-01-18T02:01:48', 'yymm': '1607', 'arxiv_id': '1607.04596', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04596'}
arxiv
\section{Introduction} We investigate the problem of simulation from a multivariate normal (MVN) distribution whose samples are restricted to the intersection of a set of hyperplanes, which is shown to be inherently related to the simulation of a conditional distribution of a MVN distribution. A naive approach, which linearly transforms a random variable drawn from the conditional distribution of a related MVN distribution, requires a large number of intermediate variables that are often computationally expensive to instantiate. To address this issue, we propose a fast and exact simulation algorithm that directly projects a MVN random variable onto the intersection of a set of hyperplanes. We further show that sampling from a MVN distribution, whose covariance (precision) matrix can be decomposed as the sum (difference) of a positive-definite matrix, whose inversion is known or easy to compute, and a low-rank symmetric matrix, may also be made significantly fast by exploiting this newly proposed stimulation algorithm for hyperplane-truncated MVN distributions, avoiding the need of Cholesky decomposition that has a computational complexity of $O(k^3)$ \citep{golub2012matrix}, where $k$ is the dimension of the MVN random variable. Related to the problems under study, the simulation of MVN random variables subject to certain constraints \citep{gelfand1992bayesian} has been investigated in many other different settings, such as multinomial probit and logit models \citep{albert1993bayesian,mcculloch2000bayesian,imai2005bayesian,train2009discrete,holmes2006bayesian,johndrow2013diagonal}, Bayesian isotonic regression \citep{neelon2004bayesian}, Bayesian bridge \citep{polson2014bayesian}, blind source separation \citep{schmidt2009linearly}, and unmixing of hyperspectral data \citep{altmann2014sampling, dobigeon2009joint}. A typical example arising in these different settings is to sample a random vector $\xv\in\mathbb{R}^k$ from a MVN distribution subject to $k$ inequality constraints as \begin{equation} \xv\sim\Nor_{\mathcal{S}}(\muv,\Sigmamat),~~\mathcal{S}=\{\xv:\lv\le \Gmat \xv \le \uv\}, \end{equation} where $\Nor_{\mathcal{S}}(\muv,\Sigmamat)$ represents a MVN distribution truncated on the sample space $\mathcal{S}$, $\muv\in\mathbb{R}^k$ is the mean, $\Sigmamat\in\mathbb{R}^{k\times k}$ is the covariance matrix, $\Gmat\in\mathbb{R}^{k\times k}$ is a full-rank matrix, $\lv\in \mathbb{R}^k$, $\uv\in \mathbb{R}^k$, and $\lv<\uv$. If the elements of $\lv$ and $\uv$ are permitted to be $-\infty$ and $+\infty$, respectively, then both single sided and fewer than $k$ inequality constraints are allowed. Equivalently, as in \citet{geweke1991efficient,geweke1996bayesian}, one may let $\xv = \muv + \Gmat^{-1} \zv$ and use Gibbs sampling \citep{Geman,gelfand1990sampling} to sample the $k$ elements of $\zv$ one at a time conditioning on all the others from a univariate truncated normal distribution, for which efficient algorithms exist \citep{robert1995simulation,damien2001sampling,chopin2011fast}. To deal with the case that the number of linear constraints imposed on $\xv$ exceed its dimension $k$ and to obtain better mixing, one may consider the Gibbs sampling algorithm for truncated MVN distributions proposed in \citet{rodriguez2004efficient}. In addition to Gibbs sampling, to sample truncated MVN random variables, one may also consider Hamiltonian Monte Carlo \citep{pakman2014exact,lan2014spherical} and a minimax tilting method proposed in \citet{botev2016normal}. \section{Hyperplane-truncated and conditional MVNs}\label{sec:2} For the problem under study, we express a $k$-dimensional MVN distribution truncated on the intersection of $k_2<k$ hyperplanes as \begin{equation}\label{eq:x_S} \xv\sim\Nor_{\mathcal{S}}(\muv,\Sigmamat),~~\mathcal{S}=\{\xv: \Gmat \xv = \rv\}, \end{equation} where $$ \Gmat\in\mathbb{R}^{k_2\times k}, ~~\rv\in\mathbb{R}^{k_2}, $$ and $\mbox{Rank}(\Gmat)=k_2$. The probability density function can be expressed as \begin{align}\label{eq:px} p( \xv \,|\, \muv,\Sigmamat, \Gmat,\rv) =\frac{1}{Z} \exp\left[-\frac{1}{2}(\xv- \muv)^T \Sigmamat^{-1} (\xv- \muv) \right] \delta(\Gmat\xv = \rv), \end{align} where $Z$ is a constant ensuring $\int p( \xv \,|\, \muv,\Sigmamat, \Gmat,\rv)d\xv = 1$, and $\delta(x)=1$ if the condition $x$ is satisfied and $\delta(x)=0$ otherwise. Let us partition $\Gmat$, $\xv$, $\muv$, $\Sigmamat$, and $\Lambdamat = \Sigmamat^{-1}$ as $$ \Gmat = (\Gmat_1,\Gmat_2),~ \xv=\begin{bmatrix} \xv_1 \\ \xv_2 \end{bmatrix},~ \muv = \begin{bmatrix} \muv_1 \\ \muv_2 \end{bmatrix},~ \Sigmamat = \begin{bmatrix} \Sigmamat_{11} &\Sigmamat_{12} \\ \Sigmamat_{21} & \Sigmamat_{22} \end{bmatrix},~ \mbox{and}~ \Lambdamat = \begin{bmatrix} \Lambdamat_{11} & \Lambdamat_{12} \\ \Lambdamat_{21} & \Lambdamat_{22} \end{bmatrix}, $$ whose sizes are $$ (k_2\times k_1,k_2\times k_2),~ \begin{bmatrix} k_1 \times 1 \\ k_2 \times 1 \end{bmatrix},~ \begin{bmatrix} k_1 \times 1\\ k_2\times 1 \end{bmatrix},~ \begin{bmatrix} k_1\times k_1&k_1\times k_2 \\ k_2\times k_1& k_2\times k_2 \end{bmatrix},~\mbox{and}~ \begin{bmatrix} k_1\times k_1&k_1\times k_2 \\ k_2\times k_1& k_2\times k_2 \end{bmatrix}, $$ respectively, where $k=k_1+k_2$, $\Sigmamat_{21} = \Sigmamat_{12}^T$, and $\Lambdamat_{21} = \Lambdamat_{12}^T$. A special case that frequently arises in real applications is when $\Gmat_1=\mathbf{0}_{k_2\times k_1}$ and $\Gmat_2= \Imat_{k_2}$, which means $(\mathbf{0}_{k_2\times k_1},\Imat_{k_2})\xv=\xv_2=\rv$ and the need is to simulate $\xv_1$ given $\xv_2=\rv$. For a MVN random variable $ \xv\sim\mathcal{N}(\muv,\Sigmamat) $, it is well known, $e.g.$, in \citet{tong2012multivariate}, that the conditional distribution of $\xv_1$ given $\xv_2=\rv$, $i.e.$, the distribution of $\xv$ restricted to $\mathcal{S}=\{\xv: (\mathbf{0}_{k_2\times k_1},\Imat_{k_2})\xv = \rv\}$, can be expressed as \begin{equation}\label{eq:conditional} \xv_1 \,|\, \xv_2 = \rv \,\sim\,\Nor \left[\muv_1 + \Sigmamat_{12}\Sigmamat_{22}^{-1}(\rv-\muv_2), ~~\Sigmamat_{11} - \Sigmamat_{12}\Sigmamat_{22}^{-1}\Sigmamat_{21}\right]. \end{equation} Alternatively, applying the Woodbury matrix identity to relate the entries of the covariance matrix $\Sigmamat$ to those of the precision matrix $\Lambdamat$, one may obtain the following equivalent expression as \begin{equation}\label{eq:conditionalPrecision} \xv_1 \,|\, \xv_2 = \rv \,\sim\,\Nor \left[\muv_1 - \Lambdamat_{11}^{-1} \Lambdamat_{12} (\rv-\muv_2), ~\Lambdamat_{11}^{-1}\right]. \end{equation} In a general setting where $\Gmat\neq ( \mathbf{0}_{k_2\times k_1}, \Imat_{k_2})$, let us define a full rank linear transformation matrix $\Hmat\in\mathbb{R}^{k\times k}$, with $(\Hmat_1,\Hmat_2)$ as the $(k\times k_1,k\times k_2)$ partition of $\Hmat$, where the columns of $\Hmat_1\in\mathbb{R}^{k\times k_1}$ span the null space of the $k_2$ rows of $\Gmat$, making $\Gmat\Hmat=(\Gmat\Hmat_1,\Gmat\Hmat_2)=(\mathbf{0}_{k_2\times k_1},\Gmat\Hmat_2)$, where $\Gmat\Hmat_2$ is a $k_2\times k_2$ full rank matrix. \linebreak[4] For example, a linear transformation matrix $\Hmat$ that makes $\Gmat\Hmat=(\mathbf{0}_{k_2\times k_1},\Imat_{k_2})$ can be constructed using the command $\mathrm{\Hmat= inv([null(\Gmat)';\Gmat]}$) in Matlab and \linebreak[4] $\mathrm{\Hmat<\!\!-solve(rbind(t(Null(t(\Gmat))),\Gmat))}$ in R. With $\Hmat $ and $\Hmat^{-1}$, one may re-express the constraints as $\mathcal{S}=\{\xv: (\mathbf{0}_{k_2\times k_1},\Gmat\Hmat_2) (\Hmat^{-1}\xv) = \rv\}$. Denote $\zv=\Hmat^{-1}\xv$, then we can generate $\xv$ by letting $\xv=\Hmat \zv$, where \begin{equation} \label{eq:pztruccond} \zv\sim\Nor_{\mathcal{D}}[\Hmat^{-1}\muv, \Hmat^{-1}\Sigmamat (\Hmat^{-1})^T],~~ \mathcal{D}=\{\zv: \Gmat\Hmat_2\zv_2=\rv\}=\{\zv: \zv_2=(\Gmat\Hmat_2)^{-1}\rv\}. \end{equation} More specifically, denoting $\Lambdamat = [\Hmat^{-1}\Sigmamat(\Hmat^{-1})^T]^{-1} = \Hmat^T \Sigmamat^{-1}\Hmat$ as the precision matrix for $\zv$, we have \begin{align}\label{eq:precision} \begin{bmatrix} \Lambdamat _{11} &\Lambdamat _{12} \\ \Lambdamat _{21} & \Lambdamat _{22} \end{bmatrix} &= \Hmat^T\Sigmamat^{-1} \Hmat = \begin{bmatrix} \Hmat_1^T\Sigmamat^{-1}\Hmat_1 &\Hmat^T_1\Sigmamat^{-1} \Hmat_2\\ \Hmat_2^T\Sigmamat^{-1}\Hmat_1 &\Hmat_2^T\Sigmamat^{-1} \Hmat_2 \end{bmatrix}, \end{align} and hence $\xv$ truncated on $\mathcal{S}$ can be naively generated using the following algorithm, whose computational complexity is described in Table \ref{tab:CompAlg1} of the Appendix. \begin{algorithm}[H] \begin{itemize} \item Find $\Hmat=(\Hmat_1,\Hmat_2)$ that satisfies $\Gmat\Hmat=(\Gmat\Hmat_1,\Gmat\Hmat_2)=(\mathbf{0}_{k_2\times k_1},\Gmat\Hmat_2)$, where $\Gmat\Hmat_2$ is a full rank matrix; \item Let $\zv_2 =(\Gmat \Hmat_2)^{-1}\rv$, $\Lambdamat _{11} = \Hmat_1^T\Sigmamat^{-1}\Hmat_1$, and $\Lambdamat _{12}=\Hmat_1^T\Sigmamat^{-1}\Hmat_2$; \item Sample $\zv_1\,|\, \zv_2=(\Gmat \Hmat_2)^{-1}\rv \sim\Nor( \muv_{z_1}, \Lambdamat^{-1}_{11})$, where $$\muv_{z_1}=(\Imat_{k_1},\mathbf{0}_{k_1\times k_2})\Hmat^{-1}\muv - \Lambdamat^{-1}_{11}\Lambdamat_{12}\left[(\Gmat\Hmat_2)^{-1}\rv - (\mathbf{0}_{k_2\times k_1},\Imat_{k_2})\Hmat^{-1}\muv\right];$$ \item Return $\xv = \Hmat\zv=\Hmat_1 \zv_1 + \Hmat_2 (\Gmat \Hmat_2)^{-1}\rv $. \end{itemize} \caption{\label{alg:1} Simulation of the hyperplane truncated MVN distribution $\xv\sim\Nor_{\mathcal{S}}(\muv,\Sigmamat)$, where $\mathcal{S}=\{\xv: \Gmat \xv = \rv\}$, by transforming a random variable drawn from the conditional distribution of another MVN distribution.} \end{algorithm}\vspace{2mm} For illustration, we consider a simple 2-dimensional example with $\muv = (1,1.2)^T$, $\Sigmamat = [(1,0.3)^T,(0.3,1)^T] $, $\Gmat = (1,1)$, and $\rv = 1$. If we choose $\Hmat_1 = (-0.7071,0.7071)^T$ and $\Hmat_2=(1.3,1.3)^T$, then we have $z_2 = (\Gmat \Hmat_2)^{-1}\rv = (2.6)^{-1} = 0.3846$, $\Lambdamat_{11} = 1.4285$, and $\Lambdamat_{12}=0$; as shown in Figure~\ref{fig:PxPz}, we may generate $\xv$ using $$\xv = (-0.7071,0.7071)^T z_1 + (1.3,1.3)^Tz_2$$ where $z_1\sim\Nor(0.1414,0.7)$ and $z_2=0.3846$. \begin{figure}[!t] \centering \subfigure[]{ \includegraphics[height = 4.5 cm]{pxOri.pdf} } \subfigure[]{ \includegraphics[height = 4.5 cm]{pzIndep.pdf} } \caption{\small Illustration of (a) $p(\xv)$ in \eqref{eq:px}, where $\muv = (1,1.2)^T$, $\Sigmamat = [(1,0.3)^T,(0.3,1)^T] $, $\Gmat = (1,1)$, and $\rv = 1$, and (b) $p(\zv)$ in \eqref{eq:pztruccond}, where $\Hmat_1 = (-0.7071,0.7071)^T$, $\Hmat_2=(1.3,1.3)^T$, and $\Hmat^{-1}=[(-0.7071,0.3846)^T, (0.7071,0.3846)^T]$. The coordinate systems of $\xv$ and $\zv$ are shown in black and red, respectively, and the first and second axes of a coordinate system are shown as dotted and dashed lines, respectively.} \label{fig:PxPz} \end{figure} For high dimensional problems, however, Algorithm \ref{alg:1} in general requires a large number of intermediate variables that could be computationally expensive to compute. In the following discussion, we will show how to completely avoid instantiating these intermediate variables. \section{Fast and exact simulation of MVN distributions } Instead of using Algorithm \ref{alg:1}, we first provide a theorem to show how to efficiently and exactly simulate from a hyperplane-truncated MVN distribution. In the Appendix, we provide two different proofs. The first proof facilitates the derivations by employing an existing algorithm of \citet{hoffman1991constrained} and \citet{doucet2010note}, which describes how to simulate from the conditional distribution of a MVN distribution shown in \eqref{eq:conditional} without computing $\Sigmamat_{11} - \Sigmamat_{12}\Sigmamat_{22}^{-1}\Sigmamat_{21}$ and its Cholesky decomposition. Note it is straightforward to verify that the algorithm in \citet{hoffman1991constrained} and \citet{doucet2010note}, as shown in the Appendix, can be considered as a special case of the proposed algorithm with $\Gmat = [\bds 0, \Imat]$. \vspace{2mm} \begin{algorithm}[H] \begin{itemize} \item Sample $\yv\sim\Nor (\muv,\Sigmamat)$; \item Return $\xv = \yv + \Sigmamat \Gmat^T ( \Gmat \Sigmamat \Gmat^T )^{-1} (\rv - \Gmat \yv)$, which can be realized using \begin{itemize} \item Solve $\alphav$ such that $( \Gmat \Sigmamat \Gmat^T ) \alphav = \rv - \Gmat \yv$; \item Return $\xv = \yv + \Sigmamat \Gmat^T \alphav$. \end{itemize} \end{itemize} \caption{\label{alg:2} Simulation of the hyperplane truncated MVN distribution $\xv\sim\Nor_{\mathcal{S}}(\muv,\Sigmamat)$, where $\mathcal{S}=\{\xv: \Gmat \xv = \rv\}$, by transforming a random variable drawn from $\yv\sim\Nor(\muv,\Sigmamat)$. } \end{algorithm}\vspace{2mm} \begin{thm} \label{maintheorem1} Suppose $\xv$ is simulated with Algorithm \ref{alg:2}, then it is distributed as $ \xv\sim\Nor_{\mathcal{S}}(\muv,\Sigmamat),~~\mathcal{S}=\{\xv: \Gmat \xv = \rv\}, $ where $ \Gmat\in\mathbb{R}^{k_2\times k}, ~~\rv\in\mathbb{R}^{k_2}, $ and $\mbox{Rank}(\Gmat)=k_2<k$. \end{thm} The above algorithm and theorem, whose computational complexity is described in Table \ref{tab:CompAlg2} of the Appendix, show that one may draw $\yv$ from the unconstrained MVN as $\yv\sim\Nor ( \muv , \Sigmamat )$ and directly map it to a vector $\xv$ on the intersection of hyperplanes using $ \xv =\Sigmamat \Gmat^T (\Gmat \Sigmamat \Gmat^T )^{-1} \rv +\left[ \Imat-\Sigmamat \Gmat^T ( \Gmat \Sigmamat \Gmat^T )^{-1}\Gmat\right]\yv.\notag $ For illustration, with the same $\muv$, $\Sigmamat$, $\Gmat$, and $\rv$ as those in Figure \ref{fig:PxPz}, we show in Figure \ref{fig:DemoAlg2} a simple two dimensional example, where the unrestricted Gaussian distribution $ \Nor ( \muv , \Sigmamat )$ is represented with a set of ellipses, and the constrained sample space $\mathcal{S}$ is represented as a straight line in the two-dimensional setting. With $\Sigmamat \Gmat^T (\Gmat \Sigmamat \Gmat^T )^{-1} \rv = (0.5,0.5)^T$, $\left[ \Imat-\Sigmamat \Gmat^T ( \Gmat \Sigmamat \Gmat^T )^{-1}\Gmat\right] = [(0.5,-0.5)^T,(-0.5,0.5)^T]$, one may directly maps a sample $\yv \sim \Nor ( \muv , \Sigmamat )$ to a vector on the constrained space. For example, if $\yv = (1,2)^T$, then it would be mapped to $\xv = (0,1)^T$ on the straight line. \begin{figure}[h] \centering \includegraphics[height = 5 cm]{pxOriProjYtoX.pdf}\\ \caption{A two dimensional demonstration of Algorithm \ref{alg:2} that maps a random sample from $\yv\sim\Nor ( \muv , \Sigmamat )$ to a sample in the constrained space using $ \xv =\Sigmamat \Gmat^T (\Gmat \Sigmamat \Gmat^T )^{-1} \rv +\left[ \Imat-\Sigmamat \Gmat^T ( \Gmat \Sigmamat \Gmat^T )^{-1}\Gmat\right]\yv $. For example, if $\muv = (1,1.2)^T$, $\Sigmamat = [(1,0.3)^T,(0.3,1)^T]$, $\Gmat = (1,1)$, and $\rv = 1$, then $\yv = (1,2)^T$ would be mapped to $\xv=(0,1)^T$ on a straight line using Algorithm \ref{alg:2}. } \label{fig:DemoAlg2} \end{figure} \subsection{Fast simulation of MVN distributions with structured covariance or precision matrices} For fast simulation of MVN distributions with structured covariance or precision matrices, our idea is to relate them to higher-dimensional hyperplane-truncated MVN distributions, with block-diagonal covariance matrices, that can be efficiently simulated with Algorithm \ref{alg:2}. We first introduce an efficient algorithm for the simulation of a MVN distribution, whose covariance matrix is a positive-definite matrix subtracted by a low-rank symmetric matrix. Such kind of covariance matrices commonly arise in the conditional distributions of MVN distributions, as shown in~\eqref{eq:conditional}. We then further extend this algorithm to the simulation of a MVN distribution whose precision (inverse covariance) matrix is the sum of a positive-definite matrix and a low-rank symmetric matrix. Such kind of precision matrices commonly arise in the conditional posterior distributions of the regression coefficients in both linear regression and generalized linear models. \begin{thm}\label{thm_condition} The probability density function (PDF) of the MVN distribution \begin{equation}\label{eq:px1} \xv_1\sim \Nor ( \muv_1,~ \Sigmamat_{11} - \Sigmamat_{12}\Sigmamat_{22}^{-1}\Sigmamat_{21}), \end{equation} is the same as the PDF of the marginal distribution of $\xv_1=(x_1,\ldots,x_{k_1})^T$ in $\xv=(\xv_1^T,x_{k_1+1},\ldots,x_{k})^T$, whose PDF is expressed as \begin{align} p( \xv\,|\, \muv,\tilde \Sigmamat,\Gmat,\rv ) &= \Nor_{\{ \xv: \Gmat \xv = \rv\}}\left( \muv, \tilde \Sigmamat \right) \notag\\ &=\frac{1}{Z} \exp\left[-\frac{1}{2}(\xv- \muv)^T\tilde \Sigmamat^{-1} (\xv- \muv) \right] \delta(\Gmat\xv = \rv), \end{align} where $Z$ is a normalization constant, $\Gmat_1 = \Sigmamat_{21}\Sigmamat_{11}^{-1} $ is a matrix of size $k_2\times k_1$, $\Gmat_2 $ is a user-specified full rank invertible matrix of size $k_2\times k_2$, $\rv\in\mathbb{R}^{k_2}$ is a user-specified vector, and \begin{equation}\label{eq:14} \Gmat=(\Gmat_1,\Gmat_2) \in\mathbb{R}^{k_2\times k},~~~~ \muv = \begin{bmatrix} \muv_1\\ \muv_2 \end{bmatrix}\in\mathbb{R}^{k}, ~~~~\tilde \Sigmamat = \begin{bmatrix} \Sigmamat_{11} & \mathbf{0} \\ \mathbf{0} & \tilde \Sigmamat_{22} \end{bmatrix}\in\mathbb{R}^{k\times k}, \end{equation} where \begin{align}\label{eq:tilde_mu2} & \muv_2= \Gmat_{2}^{-1}(\rv - \Sigmamat_{21}\Sigmamat_{11}^{-1} \muv_1),\\%\in \mathbb{R}^{ k_2},\\ \label{eq:tilde_sig22} &\tilde \Sigmamat_{22} = \Gmat_2^{-1}\left(\Sigmamat_{22} - \Sigmamat_{21} \Sigmamat_{11}^{-1} \Sigmamat_{12}\right)(\Gmat_{2}^{-1})^T. \end{align} \end{thm} The above theorem shows how the simulation of a MVN distribution, whose covariance matrix is a positive-definite matrix minus a symmetric matrix, can be realized by the simulation of a higher-dimensional hyperplane-truncated MVN distribution. By construction, it makes the covariance matrix $\tilde \Sigmamat$ of the truncated-MVN be block diagonal, but still preserves the flexibility to customize the full-rank matrix $\Gmat_2$ and the vector~$\rv$. While there are infinitely many choices for both $\Gmat_2$ and $\rv$, in the following discussion, we remove that flexibility by specifying $\Gmat_2 = \Imat_{k_2} $, leading to $\Gmat=(\Gmat_1,\Gmat_2)=(\Sigmamat_{21}\Sigmamat_{11}^{-1} ,\Imat_{k_2})$, and $\rv = \Sigmamat_{21}\Sigmamat_{11}^{-1} \muv_1$. This specific setting of $\Gmat_2$ and $\rv$ leads to the following Corollary that is a special case of Theorem~\ref{thm_condition}. Note that while we choose this specific setting in the paper, depending on the problems under study, other settings may lead to even more efficient simulation algorithms. \begin{cor}\label{cor1} The PDF of the MVN distribution \begin{equation} \xv_1 \sim \Nor ( \muv_1, \Sigmamat_{11} - \Sigmamat_{12}\Sigmamat_{22}^{-1}\Sigmamat_{21}) \end{equation} is the same as the PDF of the marginal distribution of $\xv_1$ in $\xv=(\xv_1^T,x_{k_1+1},\ldots,x_{k})^T$, whose PDF is expressed as \begin{align} p( \xv) &= \Nor_{\{ \xv: \, \Sigmamat_{21}\Sigmamat_{11}^{-1}\xv_1 + \xv_2 = \Sigmamat_{21}\Sigmamat_{11}^{-1} \muv_1\}}\left( \muv, \tilde \Sigmamat \right) \notag\\ &=\frac{1}{Z} \exp\left[-\frac{1}{2}(\xv- \muv)^T\tilde \Sigmamat^{-1} (\xv- \muv) \right] \delta( \Sigmamat_{21}\Sigmamat_{11}^{-1}\xv_1 + \xv_2 = \Sigmamat_{21}\Sigmamat_{11}^{-1} \muv_1), \end{align} where $\xv_2 = (x_{k_1+1},\ldots,x_{k})^T$, $Z$ is a normalization constant, and \begin{equation} \muv = \begin{bmatrix} \muv_1\\ \mathbf{0} \end{bmatrix}\in\mathbb{R}^{k}, ~~~~\tilde \Sigmamat = \begin{bmatrix} \Sigmamat_{11} & \mathbf{0} \\ \mathbf{0} & \Sigmamat_{22} - \Sigmamat_{21} \Sigmamat_{11}^{-1} \Sigmamat_{12} \end{bmatrix}\in\mathbb{R}^{k\times k}. \end{equation} \end{cor} Further applying Theorem \ref{maintheorem1} to Corollary \ref{cor1}, as described in detail in the Appendix, a MVN random variable $\xv$ with a structured covariance matrix can be generated as in Algorithm \ref{alg:3}, where there is no need to compute $\Sigmamat_{11}-\Sigmamat_{12}\Sigmamat_{22}^{-1}\Sigmamat_{21}$ and its Cholesky decomposition. Suppose the covariance matrix $\Sigmamat_{11}$ admits some special structure that makes it easy to invert and computationally efficient to simulate from $\Nor (\mathbf{0},\Sigmamat_{11})$, then Algorithm \ref{alg:3} could lead to a significant saving in computation if $k_2\ll k_1$. On the other hand, when $k_2\gg k_1$ and $\Sigmamat_{22}- \Sigmamat_{21} \Sigmamat_{11}^{-1} \Sigmamat_{12}$ admits no special structures, Algorithm \ref{alg:3} may not bring any computational advantage and hence one may resort to the naive Cholesky decomposition based procedure. Detailed computational complexity analyses for both methods are provided in Tables \ref{tab:CompNaive3} and \ref{tab:CompAlg3} of the Appendix, respectively. \vspace{2mm} \begin{algorithm}[H] \begin{itemize} \item Sample $\yv_1\sim\Nor (\mathbf{0},\Sigmamat_{11})$ and $\yv_2\sim\Nor (\mathbf{0},\Sigmamat_{22}- \Sigmamat_{21} \Sigmamat_{11}^{-1} \Sigmamat_{12})$ ; \item Return $\xv_1 = \muv_1+\yv_1 - \Sigmamat_{12} \Sigmamat_{22}^{-1} (\Sigmamat_{21} \Sigmamat_{11}^{-1}\yv_1 + \yv_2)$, which can be realized using \begin{itemize} \item Solve $\alphav$ such that $ \Sigmamat_{22}\alphav = \Sigmamat_{21} \Sigmamat_{11}^{-1}\yv_1 + \yv_2$; \item Return $\xv_1 = \muv_1+\yv_1 - \Sigmamat_{12} \alphav$. \end{itemize} \end{itemize} \caption{\label{alg:3} Simulation of the MVN distribution $$\xv_1\sim\Nor(\muv_1,\Sigmamat_{11}-\Sigmamat_{12}\Sigmamat_{22}^{-1}\Sigmamat_{21}).$$ } \end{algorithm} \vspace{2mm} \begin{cor} \label{cor2} A random variable simulated with Algorithm \ref{alg:3} is distributed as $ \xv_1\sim\Nor (\muv_1, \Sigmamat_{11} - \Sigmamat_{12}\Sigmamat_{22}^{-1}\Sigmamat_{21}). $ \end{cor} The efficient simulation algorithm for a MVN distribution with a structured covariance matrix can also be further extended to a MVN distribution with a structured precision matrix, as described below, where $\betav \in \Rbb^p$, $\muv_{\beta} \in \Rbb^{p}$, $\Phimat \in \Rbb^{n \times p}$, and both $\Amat \in \Rbb^{p \times p}$ and $\Omegamat \in \Rbb^{n \times n}$ are positive-definite matrices. Computational complexity analyses for both the naive Cholesky decomposition based implementation and Algorithm \ref{alg:4} are provided in Table \ref{tab:CompNaive4} and \ref{tab:CompAlg4} of the Appendix, respectively. Similar to Algorithm~\ref{alg:3}, Algorithm \ref{alg:4} may bring a significant saving in computation when $p \gg n$ and $\Amat$ admits some special structure that makes it easy to invert and computationally efficient to simulate $\yv_1$. \vspace{2mm} \begin{algorithm}[H] \begin{itemize} \item Sample $\yv_1\sim\Nor (\mathbf{0},\Amat^{-1})$ and $\yv_2\sim\Nor (\mathbf{0},\Omegamat^{-1})$ ; \item Return $ \betav =\muv_{\beta}+\yv_1 - \Amat^{-1} \Phimat^T (\Omegamat^{-1}+\Phimat\Amat^{-1}\Phimat^T)^{-1} \left( \Phimat \yv_1+\yv_2\right)$, which can be realized using \begin{itemize} \item Solve $\alphav$ such that $ (\Omegamat^{-1}+\Phimat\Amat^{-1}\Phimat^T)\alphav = \Phimat \yv_1+\yv_2$. \item Return $\betav =\muv_{\beta}+\yv_1 - \Amat^{-1} \Phimat^T \alphav$. \end{itemize} \end{itemize} \caption{\label{alg:4} Simulation of the MVN distribution $$\betav\sim\Nor\left[\muv_{\beta}, (\Amat + \Phimat^T \Omegamat \Phimat)^{-1}\right].$$ } \end{algorithm} \vspace{2mm} \begin{cor}\label{cor3} The random variable obtained with Algorithm \ref{alg:4} is distributed as $\betav\sim\Nor(\muv_{\beta},\Sigmamat_{\beta})$, where $ \Sigmamat_{\beta} = (\Amat + \Phimat^T \Omegamat \Phimat)^{-1}$. \end{cor} \section{Illustrations} Below we provide several examples to illustrate Theorem \ref{maintheorem1}, which shows how to efficiently simulate from a hyperplane-truncated MVN distribution, and Corollary \ref{cor2} (Corollary \ref{cor3}), which shows how to efficiently simulate from a MVN distribution with a structured covariance (precision) matrix. We run all our experiments on a 2.9 GHz computer. \subsection{Simulation of hyperplane-truncated MVNs} We first compare Algorithms \ref{alg:1} and \ref{alg:2}, whose generated random samples follow the same distribution, as suggested by Theorem \ref{maintheorem1}, to highlight the advantages of Algorithm~\ref{alg:2} over Algorithm \ref{alg:1}. We then employ Algorithm \ref{alg:2} for a real application whose data dimension is high and sample size is large. \subsubsection{Comparison of Algorithms \ref{alg:1} and \ref{alg:2}} \label{sec:A1vsA2} We compare Algorithms \ref{alg:1} and \ref{alg:2} in a wide variety of settings by varying the data dimension $k$, varying the number of hyperplane constraints $k_2$, and choosing either a diagonal covariance matrix $\Sigmamat$ or a non-diagonal one. We generate random diagonal covariance matrices using the MATLAB command $\diag(0.05+\text{rand}(k,1))$ and random non-diagonal ones using $U.'*\diag(0.05+\text{rand}(k,1))*U$, where $\text{rand}(k,1)$ is a vector of $k$ uniform random numbers and $U$ consists of a set of $k$ orthogonal basis vectors. The elements of $\muv$, $\rv$, and $\Gmat$ are all sampled from $\Nor(0,1)$, with the singular value decomposition applied to $\Gmat$ to check whether $\mbox{Rank}(\Gmat)=k_2$. First, to verify Theorem \ref{maintheorem1}, we conduct an experiment with $k=5000$ data dimension, $k_2=20$ hyperplanes, and a diagonal $\Sigmamat$. Contour plots of two randomly selected dimensions of the 10,000 random samples simulated with Algorithms \ref{alg:1} and \ref{alg:2} are shown in the top and bottom rows of Figure \ref{fig:A1vsA2CutPatch}, respectively. The clear matches between the contour plots of these two different algorithms suggest the correctness of Theorem \ref{maintheorem1}. \begin{figure}[t] \centering \subfigure[]{ \includegraphics[width = 2.2 cm]{ZA1A2Trial1D515D4164A1.pdf} } \subfigure[]{ \includegraphics[width = 2.2 cm]{ZA1A2Trial1D2249D4294A1.pdf} } \subfigure[]{ \includegraphics[width = 2.2 cm]{ZA1A2Trial1D2253D834A1.pdf} } \subfigure[]{ \includegraphics[width = 2.2 cm]{ZA1A2Trial1D3138D3871A1.pdf} } \subfigure[]{ \includegraphics[width = 2.2 cm]{ZA1A2Trial2D550D1011A1.pdf} } \subfigure[]{ \includegraphics[width = 2.2 cm]{ZA1A2Trial1D515D4164A2.pdf} } \subfigure[]{ \includegraphics[width = 2.2 cm]{ZA1A2Trial1D2249D4294A2.pdf} } \subfigure[]{ \includegraphics[width = 2.2 cm]{ZA1A2Trial1D2253D834A2.pdf} } \subfigure[]{ \includegraphics[width = 2.2 cm]{ZA1A2Trial1D3138D3871A2.pdf} } \subfigure[]{ \includegraphics[width = 2.2 cm]{ZA1A2Trial2D550D1011A2.pdf} } \caption{\small Comparison of the contour plots of two randomly selected dimensions of the 10,000 $k=5000$ dimensional random samples simulated with Algorithm \ref{alg:1} (top row) and Algorithm \ref{alg:2} (bottom row). Each of the five columns corresponds to a random trial. } \label{fig:A1vsA2CutPatch} \end{figure} To demonstrate the efficiency of Algorithm \ref{alg:2}, we first carry out a series of experiments with the number of hyperplane constraints fixed at $k_2=20$ and the data dimension increased from $k=50$ to $k=5000$. The computation time of simulating 10,000 samples averaged over five random trials is shown in Figure \ref{fig:A1A2K220GenCov} for non-diagonal $\Sigmamat$'s and in Figure \ref{fig:A1A2K220DiagCov} for diagonal ones. It is clear that, when the data dimension $k$ is high, Algorithm \ref{alg:2} has a clear advantage over Algorithm \ref{alg:1} by avoiding computing unnecessary intermediate variables, which is especially evident when $\Sigmamat$ is diagonal. We then carry out a series of experiments where we vary not only $k$, but also $k_2$ from $0.1k$ to $0.9k$ for each~$k$. As shown in Figure \ref{fig:A1vsA2Time}, it is evident that Algorithm \ref{alg:2} dominates Algorithm \ref{alg:1} in all scenarios, which can be explained by the fact that Algorithm \ref{alg:2} needs to compute much fewer intermediate variables. Also observed is that a larger $k_2$ leads to slower simulation for both algorithms, but to a much lesser extent for Algorithm \ref{alg:2}. Moreover, the curvatures of those curves indicate that Algorithm \ref{alg:2} is more practical in a high dimensional setting. Note that since Algorithm \ref{alg:2} can naturally exploit the structure of the covariance matrix $\Sigmamat$ for fast simulation, it is clearly more capable of benefiting from having a diagonal or block-diagonal $\Sigmamat$, demonstrated by comparing Figures \ref{fig:Alg1GenCovVaryK2} and \ref{fig:Alg2GenCovVaryK2} with Figures \ref{fig:Alg1DiagCovVaryK2} and \ref{fig:Alg2DiagCovVaryK2}. All these observations agree with our computational complexity analyses for Algorithms \ref{alg:1} and \ref{alg:2}, as shown in Table \ref{tab:CompAlg1} and \ref{tab:CompAlg2} of the Appendix, respectively. \begin{figure}[t] \centering \subfigure[]{\label{fig:A1A2K220GenCov} \includegraphics[width = 4.1 cm]{A1A2K220GenCov.pdf} } \subfigure[]{\label{fig:Alg1GenCovVaryK2} \includegraphics[width = 4.1 cm]{Alg1GenCovVaryK2.pdf} } \subfigure[]{\label{fig:Alg2GenCovVaryK2} \includegraphics[width = 4.1 cm]{Alg2GenCovVaryK2.pdf} } \subfigure[]{\label{fig:A1A2K220DiagCov} \includegraphics[width = 4.1 cm]{A1A2K220DiagCov.pdf} } \subfigure[]{\label{fig:Alg1DiagCovVaryK2} \includegraphics[width = 4.1 cm]{Alg1DiagCovVaryK2.pdf} } \subfigure[]{\label{fig:Alg2DiagCovVaryK2} \includegraphics[width = 4.1 cm]{Alg2DiagCovVaryK2.pdf} } \caption{\small Average time of simulating 10,000 hyperplane-truncated MVN samples over five random trials in different dimensions with non-diagonal covariance matrixes (top row) and diagonal ones (bottom row). (a)(d) Comparison with fixed $k_2 = 20$. (b)(e) Algorithm \ref{alg:1} with varying $k_2$. (c)(f) Algorithm~\ref{alg:2} with varying $k_2$. } \label{fig:A1vsA2Time} \end{figure} \subsubsection{A practical application of Algorithm \ref{alg:2}} In what follows, we extend Algorithm \ref{alg:2} to facilitate simulation from a MVN distribution truncated on a probability simplex $\mathbb{S}^k = \{ \xv : \xv \in \Rbb^k, \bds 1^T \xv = 1, x_i \ge 0, i= 1,\cdots,k \} $. This problem frequently arises when unknown parameters can be interpreted as fractions or probabilities, for instance, in topic models \citep{blei2003latent}, admixture models \citep{pritchard2000inference,dobigeon2009bayesian,bazot2013unsupervised}, and discrete directed graphical models \citep{heckerman1998tutorial}. With Algorithm \ref{alg:2}, one may remove the equality constraint to greatly simplify the problem. More specifically, we focus on a big data setting in which the globally shared simplex-constrained model parameters could be linked to some latent counts via the multinomial likelihood. When there are tens of thousands or millions of observations in the dataset, scalable Bayesian inference for the simplex-constrained globally shared model parameters is highly desired, for example, for inferring the topics' distributions over words in latent Dirichlet allocation \citep{blei2003latent,OnlineLDA} and Poisson factor analysis \citep{zhou2012beta,GBN}. Let us denote the $\kappa$th model parameter vector constrained on a $V$-dimensional simplex by $\phiv_\kappa\in \mathbb{S}^V$, which could be linked to the latent counts $n_{vj\kappa}\in \Zbb$ of the $j$th document under a multinomial likelihood as $(n_{1j\kappa},\ldots, n_{Vj\kappa})\sim \mbox{Mult}(n_{\cdotv j\kappa}, \phiv_\kappa)$, where $\Zbb = \{ 0,1,2,\cdots\}$, $v\in\{1,\ldots,V\}$, $\kappa\in\{1,\ldots,K\}$, and $j\in\{1,\ldots,N\}$. In topic modeling, one may consider $K$ as the total number of latent topics and $n_{vj\kappa}$ as the number of words at the $v$th vocabulary term in the $j$th document that are associated with the $\kappa$th latent topic. Note that the dimension $V$ in real applications is often large, such as tens of thousands in topic modeling. Given the observed counts $n_{vj}$ for the whole dataset, in a batch-learning setting, one typically iteratively updates the latent counts $n_{vj\kappa}$ conditioning on $\phiv_\kappa$, and updates $\phiv_\kappa$ conditioning on $n_{vj\kappa}$. However, this batch-learning inference procedure would become inefficient and even impractical when the dataset size $N$ grows to a level that makes it too time consuming to finish even a single iteration of updating all local variables $n_{vj\kappa}$. To address this issue, we consider constructing a mini-batch based Bayesian inference procedure that could make substantial progress in posterior simulation while the batch-learning one may still be waiting to finish a single iteration. Without loss of generality, in the following discussion, we drop the latent factor/topic index $\kappa$ to simplify the notation, focusing on the update of a single simplex-constrained global parameter vector. More specifically, we let the latent local count vector $\nv_j =(n_{1j},\ldots,n_{Vj})^T$ be linked to the simplex-constrained global parameter vector $\phiv \in \mathbb{S}^V$ via the multinomial likelihood as $\nv_j \sim \Mult \left( n_{\cdotv j}, \phiv \right)$, and impose a Dirichlet distribution prior on $\phiv$ as $\phiv \sim \Dir \left( \eta \mathbf{1}_V\right)$. Instead of waiting for all $\nv_j$ to be updated before performing a single update of $\phiv$, we develop a mini-batch based Bayesian inference algorithm under a general framework for constructing stochastic gradient Markov chain Monte Carlo (SG-MCMC) \citep{ma2015complete}, allowing $\phiv$ to be updated every time a mini-batch of $\nv_j$ are processed. For the sake of completeness, we concisely describe the derivation for a SG-MCMC algorithm, as outlined below, for simplex-constrained globally shared model parameters. We refer the readers to \citet{TLASGR} for more details on the derivation and its application to scalable inference for topic modeling. Using the reduced-mean parameterization of the simplex constrained vector $\phiv$, namely $\varphiv = (\phi_1,\cdots,\phi_{V-1})^T$, where $\varphiv \in \mathbb{R}_{+}^{V-1}$ is constrained with $\varphi_{\cdotv} \le 1$, we develop a SG-MCMC algorithm that updates $\varphiv$ for the $t$th mini-batch as \begin{equation} \label{eq:upvarphi} \varphiv_{t + 1} \!=\! \left[ \varphiv_t \!+\! \frac{\varepsilon _t}{M} \!\left[ \left( \rho \bar \nv_{: \cdotv} \!+\! \eta \right) \!-\! \left(\rho n_{\cdotv \cdotv} \!+\! \eta V\right) \varphiv_t \right] \!+\! \Nc \left( \bds 0,\frac{2\varepsilon _t}{M} \!\left[ \diag \left( \varphiv_t \right) \!-\! \varphiv_t \varphiv_t ^T \right] \right) \right]_{\triangle} \!, \end{equation} where $\varepsilon _t$ are annealed step sizes, $\rho$ is the ratio of the dataset size $N$ to the mini-batch size, \zz $\nv_{: \cdotv}=(\nv_{1 \cdotv},\cdots,\nv_{V \cdotv})^T = \sum_{j\in I_t} \nv_{j}$, $\bar \nv_{: \cdotv} = (\nv_{1 \cdotv},\cdots,\nv_{(V-1) \cdotv})^T$, $[\cdotv]_{\triangle}$ denotes the constraint that $\varphiv \in \mathbb{R}_{+}^{V-1}$ and $\varphi_{\cdotv} \le 1$, and $M := \Ebb \left[\sum_{j=1}^N n_{\cdotv j} \right]$ is approximated along the updating using $ M = \left( 1 - \varepsilon_t \right) M + {\varepsilon_t} \rho \Ebb \left[ n_{ \cdotv \cdotv } \right] $. Alternatively, we have an equivalent update equation for $\phiv$ as \begin{equation} \label{eq:upphi} \phiv_{t + 1} \!=\! \left[ \phiv_t \!+\! \frac{\varepsilon _t}{M} \!\left[ \left( \rho \nv_{: \cdotv} \!+\! \eta \right) \!-\! \left(\rho n_{\cdotv \cdotv} \!+\! \eta V\right) \phiv_t \right] \!+\! \Nc \left( \bds 0,\frac{2\varepsilon _t}{M} \diag \left( \phiv_t \right) \right) \right]_{\angle} \!, \end{equation} where $[\cdotv]_{\angle}$ represents the constraint that $\phiv \in \Rbb_{+}^{V}$ and $\bds 1 ^T \phiv = 1$. It is clear that \eqref{eq:upvarphi} corresponds to simulation of a $V-1$ dimensional truncated MVN distribution with $V$ inequality constraints. Since the number of constraints is larger than the dimension, previously proposed iterative simulation methods such as the one in \citet{botev2016normal} are often inappropriate. Note that, by omitting the non-negative constraints, the update in \eqref{eq:upphi} corresponds to simulation of a hyperplane-truncated MVN simulation with a diagonal covariance matrix, which can be efficiently sampled as described in the following example. \noindent\textbf{Example 1:} \textit{ Simulation of a hyperplane-truncated MVN distribution as $$ \xv\sim\Nor_{\mathcal{S}}[\muv,a\,\diag(\phiv)],~~\mathcal{S}=\left\{\xv: \mathbf{1}^T \xv = 1\right\}, $$ where $\xv\in\mathbb{R}^{k}$, $\muv\in\mathbb{R}^{k}$, $\mathbf{1}^T\xv =\sum_{i=1}^k x_i$, $\phiv\in\mathbb{R}^{k}$, $a>0$, $\phi_i > 0$ for $i \in\{ 1,\cdots,k\}$, and $\mathbf{1}^T \phiv = \sum_{i=1}^k \phi_i=1$, can be realized as follows. \begin{itemize} \item Sample $\yv\sim\Nor [ \muv , a \diag(\phiv) ]$; \item Return $\xv = \yv + ( 1 - \mathbf{1}^T \yv) \phiv$. \end{itemize} } \noindent The sampling steps in Example 1 directly follow Algorithm \ref{alg:2} and Theorem~\ref{maintheorem1} with the distribution parameters specified as $\Sigmamat = a \diag (\phiv)$, $\Gmat = \bds 1^T$, and $\rv = 1$. Accordingly, we present the following fast sampling procedure for \eqref{eq:upvarphi}. \noindent\textbf{Example 2:} \textit{ Simulation from \eqref{eq:upvarphi} can be approximately but rapidly realized as \begin{itemize} \item Sample $\yv \sim \Nor \big[ \phiv_t + \frac{\varepsilon _t}{M} \left[ \left( \rho \nv_{: \cdotv} + \eta \right) - \left(\rho n_{\cdotv \cdotv} + \eta V\right) \phiv_t \right] ,\frac{2\varepsilon _t}{M} \diag \left( \phiv_t \right) \big]$; \item Calculate $\zv = \yv + ( 1 - \mathbf{1}^T \yv) \phiv_t$; \item If $\zv \in \mathbb{S}$, return $\varphiv_{t+1} = (z_1,\cdots,z_{V-1})^T$; else calculate $\dv = \max(\epsilon,\zv)$ with a small constant $\epsilon \ge 0$, let $\ev = \dv / \sum\nolimits_{i=1}^V d_i$, and return $\varphiv_{t+1} = (e_1,\cdots,e_{V-1})^T$. \end{itemize} } To verify Example 2, we conduct an experiment using multinomial-distributed data vectors of $V=2000$ dimensions, which are generated as follows: considering that the simplex-constrained vector $\phiv$ is usually sparse in a high-dimensional application, we sample a $V=2000$ dimensional vector $\fv$ whose elements are uniformly distributed between 0 and 1, randomly select 40 dimensions and reset their values to be 100, and set $\phiv = \fv / \sum\nolimits_{i=1}^V f_i$; we simulate $N=10,000$ samples, each $\nv_j$ of which is generated from the multinomial distribution $\mbox{Mult}(n_{\cdotv j}, \phiv)$, where the number of trials is random and generated as $n_{\cdotv j} \sim \Pois (50)$. We set $\varepsilon_t = t^{-0.99}$ and use mini-batches, each of which consists of 10 data samples, to stochastically update global parameters via SG-MCMC. For comparison, we choose the same SG-MCMC inference procedure but consider simulating \eqref{eq:upvarphi}, as performed every time a mini-batch of data samples are provided, either as in Example 2 or with the Gibbs sampler of \citet{rodriguez2004efficient}. Simulating \eqref{eq:upvarphi} with the Gibbs sampler of \citet{rodriguez2004efficient} is realized by updating all the $V$ dimensions, one dimension at a time, in each Gibbs sampling iteration. We set the total number of Gibbs sampling iterations for \eqref{eq:upvarphi} in each mini-batch based update as 1, 5, or 10. Note that in practice, the $\nv_j$ belonging to the current mini-batch are often latent and are updated conditioning on the data samples in the mini-batch and $\phiv$. For simplicity, all $\nv_j$ here are simulated once and then fixed. \begin{figure}[!t] \centering \subfigure[]{\label{fig:ResErrIterationComp} \includegraphics[height = 4.6 cm]{ResErrIteration10.pdf} } \subfigure[]{\label{fig:ResErrTimeComp} \includegraphics[height = 4.6 cm]{ResErrTime10.pdf} } \caption{\small Comparisons of the residual errors of the simplex-constrained parameter vector, estimated under various settings of the stochastic-gradient MCMC (SG-MCMC) algorithm, as a function of (a) the number of processed mini-batches and (b) time. The curves labeled as ``Batch posterior mean'', ``SG-MCMC-fast'', and ``SG-MCMC-Gibbs'' correspond to the batch posterior mean, SG-MCMC with \eqref{eq:upvarphi} simulated as in Example 2, and SG-MCMC with \eqref{eq:upvarphi} simulated with the Gibbs sampler of \citet{rodriguez2004efficient}, respectively. The digit following ``SG-MCMC-Gibbs'' represents the number of Gibbs sampling iterations to simulate \eqref{eq:upvarphi} for each mini-batch. } \label{fig:ResErrComp} \end{figure} Using $\phiv_{post}^* = ( \sum_{j=1}^N \nv_{j} + \eta ) / ( \sum_{j=1}^N n_{\cdotv j} + \eta V ) $, the posterior mean of $\phiv$ in a batch-learning setting, as the reference, we show in Figure \ref{fig:ResErrComp} how the residual errors for the estimated $\phiv^*$, defined as $\left\| \phiv^* - \phiv \right\|_2 $, change both as a function of the number of processed mini-batches and as a function of computation time under various settings of the mini-batch based SG-MCMC algorithm. The curves shown in Figure \ref{fig:ResErrComp} suggest that for each mini-batch, to simulate \eqref{eq:upvarphi} with the Gibbs sampler of \citet{rodriguez2004efficient}, it is necessary to have more than one Gibbs sampling iteration to achieve satisfactory results. It is clear from Figure \ref{fig:ResErrIterationComp} that the Gibbs sampler with 5 or 10 iterations for each mini-batch, even though each mini-batch has only 10 data samples, provides residual errors that quickly approach that of the batch posterior mean with a tiny gap, indicating the effectiveness of the SG-MCMC updating in \eqref{eq:upvarphi}. While simulating \eqref{eq:upvarphi} with Gibbs sampling could in theory lead to unbiased samples if the number of Gibbs sampling iterations is large enough, it is much more efficient to simulate \eqref{eq:upvarphi} with the procedure described in Example 2, which provides a performance that is undistinguishable from those of the Gibbs sampler with as many as 5 or 10 iterations for each mini-batch, but at the expense of a tiny fraction of a single Gibbs sampling iteration. \subsection{Simulation of MVNs with structured covariance matrices} To illustrate Corollary \ref{cor2}, we mimic the truncated MVN simulation in \eqref{eq:upvarphi} and present the following simulation example with a structured covariance matrix. \noindent\textbf{Example 3:} Simulation of a MVN distribution as $$ \xv_1\sim\Nor [\muv_1,a\,\diag(\phiv_1)-a\,\phiv_1\phiv_1^T], $$ where $\xv_1\in\mathbb{R}^{k-1}$, $\muv_1\in\mathbb{R}^{k-1}$, $a>0$, $\phiv_1=(\phi_1,\ldots,\phi_{k-1})^T$, $\phi_{i}>0$ for $i\in\{1,\ldots,k-1\}$, and $\sum_{i=1}^{k-1}\phi_i <1$, can be realized as follows. \begin{itemize} \item Sample $\yv_1\sim\Nor [ \mathbf{0} , a\,\diag(\phiv_1) ]$ and $\yv_2\sim\Nor ( 0 , a^{-1}\,\phi_k )$, where $\phi_k=1- \sum_{i=1}^{k-1} \phi_i$; \item Return $\xv_1 = \muv_1+\yv_1 - (\mathbf{1}^T \yv_1 + a\yv_2) \phiv_1$. \end{itemize} Denoting $\xv=(\xv_1^T,x_{k})^T$, $\phiv=(\phiv_1^T,\phi_{k})^T$, $\muv=(\muv_1^T,\mu_{k})^T$, and $\mu_k=1-\mathbf{1}^T \muv_1$, the above sampling steps can also be equivalently expressed as follows. \begin{itemize} \item Sample $\yv\sim\Nor [ \muv , a\,\diag(\phiv) ]$; \item Return $\xv_1 = \yv_1 + (1- \mathbf{1}^T \yv ) \phiv_1$. \end{itemize} Directly following Algorithm \ref{alg:3} and Corollary \ref{cor2}, the first sampling approach for the above example can be derived by specifying the distribution parameters as $\Sigmamat_{11} = a \diag (\phiv_1)$, $\Sigmamat_{12} = \phiv_1$, $\Sigmamat_{21} = \phiv_1^T$, and $\Sigmamat_{22} = a^{-1}$, while the second approach can be derived by specifying $\Sigmamat_{11} = a \diag (\phiv_1)$, $\Sigmamat_{12} = a\phiv_1$, $\Sigmamat_{21} = a\phiv_1^T$, and $\Sigmamat_{22} = a$. To illustrate the efficiency of the proposed algorithms in Example 3, we simulate from the MVN distribution $\xv_1\sim\Nor [\muv_1,a\,\diag(\phiv_1)-a\,\phiv_1\phiv_1^T]$ using both a naive implementation via Cholesky decomposition of the covariance matrix and the fast simulation algorithm for a hyperplane-truncated MVN random variable described in Example 3. We set the dimension from $k = 10^2$ up to $k=10^4$ and set $\muv = (1/ k,\ldots,1/k)$ and $a = 0.5$. For each $k$ and each simulation algorithm, we perform 100 independent random trials, in each of which $\phiv$ is sampled from the Dirichlet distribution $\Dir ( 1,\ldots,1)$ and 10,000 independent random samples are simulated using that same $\phiv$. \begin{figure}[!t] \centering \includegraphics[width = 6.3 cm]{TimeDimension.pdf} \caption{\small Comparison of the naive Cholesky decomposition based implementation and Algorithm \ref{alg:3} in terms of the average time of generating 10,000 $k$-dimensional random samples from $ \xv_1\sim\Nor [\muv_1,a\,\diag(\phiv_1)-a\,\phiv_1\phiv_1^T] $. The distribution parameters are randomly generated and computation time averaged over 100 random trials is displayed. } \label{fig:TimeVsDim} \end{figure} As shown in Figure \ref{fig:TimeVsDim}, for the proposed Algorithm \ref{alg:3}, the average time of simulating 10,000 random samples increases linearly in the dimension $k$. By contrast, for the naive Cholesky decomposition based simulation algorithm, whose computational complexity is $O(k^3)$ \citep{golub2012matrix}, the average simulation time increases at a significantly faster rate as the dimension $k$ increases. \begin{figure}[t] \centering \subfigure[]{ \includegraphics[width = 2.2cm]{NaiveContour5.pdf} } \subfigure[]{ \includegraphics[width = 2.2 cm]{NaiveContour6.pdf} } \subfigure[]{ \includegraphics[width = 2.2 cm]{NaiveContour9.pdf} } \subfigure[]{ \includegraphics[width = 2.2 cm]{NaiveContour15.pdf} } \subfigure[]{ \includegraphics[width = 2.2 cm]{NaiveContour49.pdf} } \subfigure[]{ \includegraphics[width = 2.2 cm]{MargCutContour5.pdf} } \subfigure[]{ \includegraphics[width = 2.2 cm]{MargCutContour6.pdf} } \subfigure[]{ \includegraphics[width = 2.2 cm]{MargCutContour9.pdf} } \subfigure[]{ \includegraphics[width = 2.2 cm]{MargCutContour15.pdf} } \subfigure[]{ \includegraphics[width = 2.2 cm]{MargCutContour49.pdf} } \caption{\small Comparison of the contour plots of two randomly selected dimensions of the 10,000 $k=10^4$ dimensional random samples simulated with the naive Cholesky implementation (top row) and Algorithm \ref{alg:3} (bottom row). Each of the five columns corresponds to a random trial. } \label{fig:ContourCompare} \end{figure} For explicit verification, with the 10,000 simulated $k=10^4$ dimensional random samples in a random trial, we randomly choose two dimensions and display their joint distribution using a contour plot. As in Figure \ref{fig:ContourCompare}, shown in the first row are the contour plots of five different random trials for the naive Cholesky implementation, whereas shown in the second row are the corresponding ones for the proposed Algorithm \ref{alg:3}. As expected, the contour lines of the two figures in the same column closely match each other. \begin{figure}[!th] \centering \includegraphics[width = 8 cm]{A3FixK1VaryK2DiagCov.pdf} \caption{\small Comparison of the naive Cholesky decomposition based implementation and Algorithm \ref{alg:3} in terms of the average time of generating one $k_1=4000$ dimensional sample from $\xv_1\sim\Nor(\muv_1,\Sigmamat_{11}-\Sigmamat_{12}\Sigmamat_{22}^{-1}\Sigmamat_{21})$, with diagonal $\Sigmamat_{11}$ and $\Sigmamat_{22}$. The distribution parameters are randomly generated and computation time averaged over 50 random trials is displayed. } \label{fig:A3} \end{figure} To further examine when to apply Algorithm \ref{alg:3} instead of the naive Cholesky decomposition based implementation in a general setting, we present the computational complexity analyses in Tables \ref{tab:CompNaive3} and \ref{tab:CompAlg3} of the Appendix for the naive approach and Algorithm \ref{alg:3}, respectively. In addition, we mimic the settings in Section \ref{sec:A1vsA2} to conduct a set of experiments with randomly generated $\Sigmamat_{12}$, diagonal $\Sigmamat_{11}$, and diagonal $\Sigmamat_{22}$. We fix $k_1 = 4000$ and vary $k_2$ from 1 to 8000. The computation time for one sample averaged over 50 random trials is presented in Figure \ref{fig:A3}. It is clear from Tables \ref{tab:CompNaive3} and \ref{tab:CompAlg3} and Figure \ref{fig:A3} that, as a general guideline, one may choose Algorithm \ref{alg:3} when $k_2$ is smaller than $ k_1$ and $\Sigmamat_{11}$ admits some special structure that makes it easy to invert and computationally efficient to simulate from $\Nor(\bf{0},\Sigmamat_{11})$. \subsection{Simulation of MVNs with structured precision matrices} To examine when to apply Algorithm \ref{alg:4} instead of the naive Choleskey decomposition based procedure, we first consider a series of random simulations in which the sample size $n$ is fixed while the data dimension $p$ is varying. We then show that Algorithm \ref{alg:4} can be applied for high-dimensional regression whose $p$ is often much larger than $n$. \begin{figure}[!th] \centering \includegraphics[width = 8 cm]{A4FixNVaryPDiagCov.pdf} \caption{\small Comparison of the naive Cholesky decomposition based implementation and Algorithm \ref{alg:4} in terms of the average time of generating one $p$ dimensional sample from $\betav\sim\Nor\left[\muv_{\beta}, (\Amat + \Phimat^T \Omegamat \Phimat)^{-1}\right]$, with diagonal $\Amat$ and $\Omegamat$. The distribution parameters are randomly generated and computation time averaged over 50 random trials is displayed. } \label{fig:A4} \end{figure} We fix $n = 4000$, vary $p$ from 1 to 8000, and mimic the settings in Section \ref{sec:A1vsA2} to randomly generate $\Phimat$, diagonal $\Amat$, and diagonal $\Omegamat$. As a function of dimensions $p$, the computation time for one sample averaged over 50 random trials is shown in Figure \ref{fig:A4}. It is evident that, identical to the complexity analysis in Tables \ref{tab:CompNaive4} and \ref{tab:CompAlg4}, Algorithm \ref{alg:4} has a linear complexity with respect to $p$ under these settings, which will bring significant acceleration in a high-dimensional setting with $p \gg n$. If the sample size $n$ is large enough that $n>p$, then one may directly apply the naive Cholesky decomposition based implementation. Algorithm \ref{alg:4} could be slightly modified to be applied to high-dimensional regression, where the main objective is to efficiently sample from the conditional posterior of $\betav \in \Rbb^{p \times 1}$ in the linear regression model as \begin{equation} \tv \sim\Nor(\Phimat \betav,\Omegamat^{-1}),~\betav\sim\Nor(\mathbf{0},\Amat^{-1}), \end{equation} where $\Phimat\in\mathbb{R}^{n\times p}$, $\Omegamat \in \Rbb^{n \times n}$, and different constructions on $\Amat\in\mathbb{R}^{p\times p}$ lead to a wide variety of regression models \citep{caron2008sparse,carvalho2010horseshoe,polson2014bayesian}. The conditional posterior of $\betav$ is directly derived and shown in the following example, where its simulation algorithm is summarized by further generalizing Corollary~\ref{cor3}. \noindent\textbf{Example 4:} \textit{ Simulation of the MVN distribution $$\betav\sim\Nor\left[(\Amat + \Phimat^T \Omegamat \Phimat)^{-1}\Phimat^T\Omegamat\tv, ~~(\Amat + \Phimat^T \Omegamat \Phimat)^{-1}\right]$$ can be realized as follows. \begin{itemize} \item Sample $\yv_1\sim\Nor (\mathbf{0},\Amat^{-1})$ and $\yv_2\sim\Nor (\mathbf{0},\Omegamat^{-1})$ ; \item Return $ \betav =\yv_1 + \Amat^{-1} \Phimat^T (\Omegamat^{-1}+\Phimat\Amat^{-1}\Phimat^T)^{-1} \left(\tv - \Phimat \yv_1-\yv_2\right) $, which can be realized using \begin{itemize} \item Solve $\alphav$ such that $ (\Omegamat^{-1}+\Phimat\Amat^{-1}\Phimat^T)\alphav = \tv - \Phimat \yv_1-\yv_2$; \item Return $\betav =\yv_1 + \Amat^{-1} \Phimat^T \alphav$. \end{itemize} \end{itemize} } Note that if $\Omegamat = \Imat_n$, then the simulation algorithm in Example 4 reduces to the one in Proposition 2.1 of \citet{bhattacharya2015fast}, which is shown there to be significantly more efficient than that of \citet{rue2001fast} for high-dimensional regression if $p\gg n$. \section{Conclusions} A fast and exact simulation algorithm is developed for a multivariate normal (MVN) distribution whose sample space is constrained on the intersection of a set of hyperplanes, which is shown to be inherently related to the conditional distribution of a unconstrained MVN distribution. The proposed simulation algorithm is further generalized to efficiently simulate from a MVN distribution, whose covariance (precision) matrix can be decomposed as the sum (difference) of a positive-definite matrix and a low-rank symmetric matrix, using a higher dimensional hyperplane-truncated MVN distribution whose covariance matrix is block-diagonal. \bibliographystyle{ba}
{'timestamp': '2017-02-21T02:01:50', 'yymm': '1607', 'arxiv_id': '1607.04751', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04751'}
arxiv
\section{Introduction} Suppose that $\ensuremath{\textup{\textsf{F}}} = \ensuremath{\textup{\textsf{F}}}_q$ is a finite field with size~$q$. Let $m$ and~$n$ be integers such that $0 \le m \le n$. The paper that introduced Wiedemann's algorithm~\cite{wied86} also includes a proof of the following claim --- which concerns an $n \times n$ matrix obtained by appending an additional set of row vectors to a matrix $A \in \matgrp{\ensuremath{\textup{\textsf{F}}}}{m}{n}$ with maximal rank:\footnote{Wiedemann attributes much of the proof of this claim to an anonymous referee who is thanked for allowing this work to be included.} \begin{quote} \textbf{Theorem~$\text{\textbf{1}}'$ [Wiedemann]}: \emph{Numbers~$\epsilon > 0$ and~$c_1$ exist, both independent of~$q$, with the following property: For any integers $n > m \ge 0$ a random procedure exists for generating $n-m$ row vectors with length~$n$ such that if $A$ is an $m \times n$ matrix of rank~$m$, then with probability at least~$\epsilon$, the resulting $n \times n$ matrix is nonsingular and the total Hamming weight of the generated rows is at most $1 + c_1 n \log n$.} \end{quote} Unfortunately the unknown constants~$\epsilon$ and~$c_1$ are neither supplied nor estimated. Furthermore, it seems that if the proof in~\cite{wied86} is applied without change in order to determine these values then either~$c_1$ must be so large or $\epsilon$ so tiny that the result is of limited practical interest. This is, somewhat, rectified in Section~\ref{sec:modified_proof}: While the outline of Wiedemann's argument is maintained, along with the details of several steps, several other components are revised or replaced entirely in order to remove unnecessary bounds on various parameters and to simplify the estimation of the unknown parameters~$\epsilon$ and~$c_1$. The bound~$\epsilon$ is also increased by adding another $\ell$ rows to the resulting matrix~$B \in \matgrp{\ensuremath{\textup{\textsf{F}}}}{(n+\ell)}{n}$ rows; here, $\ell$ depends on the size of the field~$\ensuremath{\textup{\textsf{F}}}$. In particular, the following result is obtained. \begin{theorem} \label{thm:constants_for_conditioner} Let $\ensuremath{\textup{\textsf{F}}} = \ensuremath{\textup{\textsf{F}}}_q$ be the finite field with size~$q$. Let $m$ and~$n$ be integers such that $n \ge m \ge 0$. Let $\ell$ be a nonnegative integer and let $\sigma$, $\tau$ and $\upsilon$ be positive constants (depending on~$q$, but independent of~$n$ and~$m$) as given in Table~\ref{fig:summary_table} on page~\pageref{fig:summary_table}. A random procedure exists for generating $n - m + \ell$ rows with length~$n$ such that if $A$ is an $m \times n$ matrix of rank~$m$, then an additional $m + \ell$ rows (each with length~$n$) are produced, and the expected number of nonzero entries in these rows is $\sigma n \ln n + \tau n$ if $n - m \ge \upsilon$, and at most $\frac{q-1}{q} (n-m+\ell) n \le \frac{q-1}{q} (\upsilon + \ell) n$, otherwise. If $q \le n^2$ then the matrix $B \in \ensuremath{\textup{\textsf{F}}}^{(n+\ell) \times n}$ obtained from~$A$ by adding these rows has maximal rank~$n$ with probability at least~$\frac{9}{10}$. If $q > n^2$ then this matrix has maximal rank with probability at least $\frac{9}{10} - \frac{9}{10n}$. \end{theorem} The probability bounds listed above are quite arbitrary. The parameter~$\sigma$ does not depend on this probability. Formulas for~$\ell$, $\tau$ and~$\upsilon$, depending on the field size~$q$ and an arbitrarily small failure probability~$\epsilon$, are given in Section~\ref{sec:modified_proof}. \begin{figure}[t!] \begin{center} \begin{tabular}{ccccc|ccccc} $q$ & $\ell$ & $\sigma$ & $\tau$ & $\upsilon$ & $q$ & $\ell$ & $\sigma$ & $\tau$ & $\upsilon$ \\[2pt] \hline $2$\rule{0pt}{12pt} & $8$ & $\frac{43}{2}$ & $17$ & $41$ & $13$ & $3$ & $\frac{120}{13}$ & $6$ & $150$ \\ $3$\rule{0pt}{12pt} & $5$ & $16$ & $11$ & $55$ & $16$--$19$ & $2$ & $\frac{9(q-1)}{q}$ & $5$ & $194$ \\ $4$\rule{0pt}{12pt}& $4$ & $\frac{225}{16}$ & $9$ & $65$ & $23$--$29$ & $2$ & $\frac{8(q-1)}{q}$ & $4$ & $285$ \\ $5$\rule{0pt}{12pt} & $4$ & $\frac{64}{5}$ & $8$ & $75$ & $31$--$43$ & $2$ & $\frac{15(q-1)}{2q}$ & $4$ & $381$ \\ $7$\rule{0pt}{12pt} & $3$ & $\frac{78}{7}$ & $7$ & $96$ & $47$---$59$ & $2$ & $\frac{7(q-1)}{q}$ & $4$ & $577$ \\ $8$\rule{0pt}{12pt} & $3$ & $\frac{21}{2}$ & $6$ & $108$ & $61$--$71$ & $2$ & $\frac{27(q-1)}{4q}$ & $4$ & $783$ \\ $9$\rule{0pt}{12pt} & $3$ & $\frac{88}{9}$ & $6$ & $124$ & $73$--$83$ & $2$ & $\frac{33(q-1)}{5q} n$ & $4$ & $996$ \\ $11$\rule{0pt}{12pt} & $3$ & $\frac{105}{11}$ & $6$ & $136$ & $\ge 89$ & $2$ & $\frac{13(q-1)}{2q}$ & $4$ & $1213$ \end{tabular} \end{center} \caption{Bounds Established in Section~\ref{sec:modified_proof}} \label{fig:summary_table} \end{figure} A second result, which is also proved in Section~\ref{sec:modified_proof}, establishes that the constant~$\sigma$, mentioned above, can be made arbitrarily close to~$6 \left(1 - \frac{1}{q}\right)$, provided that the minimum field size~$q$ and the constant~$\upsilon$ are both increased --- at the cost of increasing the constants~$\ell$, $\tau$ and $\upsilon$ (but not~$\sigma$) that are listed. \begin{theorem} \label{thm:second_constants_for_conditioner} Let $N$ be an integer such that $N \ge 18$. Let $\ensuremath{\textup{\textsf{F}}}_q$ be a finite field with size $q \ge 16N+9$ Let $m$ and~$n$ be integers such that $n \ge m \ge 0$. Let $\sigma = \left(1 - \frac{1}{q}\right)\ \cdot \left (6 + \frac{3}{N}\right)$, $\tau = 1$, and $\upsilon = \lceil (2N+1) \ln (2N+1) + \frac{167}{5} (2N+1) \rceil$. A random procedure exists for generating $n-m$ rows with length~$n$ such that if $A$ is an $m \times n$ matrix of rank~$m$, then an additional $m$ rows (each with length~$n$) are produced, and the expected number of nonzero entries in this row is $\sigma n \ln n + \tau n$ if $n - m \ge \upsilon$, and at most $\frac{q-1}{q} (n - m) n \le \frac{q-1}{q} \upsilon n$, otherwise. If $q \le n^2$ then the matrix $B \in \matring{\ensuremath{\textup{\textsf{F}}}}{n}$ obtained from~$A$ by adding these rows is nonsingular with probability at least $\frac{8}{9}$. If $q > n^2$ then this matrix is nonsingular with probability at least \mbox{$\frac{8}{9} - \frac{8}{9n}$}. \end{theorem} Once again, the probability bounds here are quite arbitrary, and probability bounds that are closer to one can be obtained by applications of the same techniques, at the cost of increasing the values of the constants~$\tau$ and~$\upsilon$. This is work in progress. Future versions of this report will document progress in establishing that this yields an efficient matrix preconditioner, to bound the number of nontrivial nilpotent blocks of a conditioned matrix without lowering matrix rank, for matrices over small finite fields. \section{A Modified Proof of Wiedemann's Result} \label{sec:modified_proof} This section describes modifications to Wiedemann's argument needed to establish Theorems~\ref{thm:constants_for_conditioner} and~\ref{thm:second_constants_for_conditioner}. \subsection{Getting Started --- and Improving Reliability by Adding Rows} \label{ssec:getting_started} Suppose that $m$ and~$n$ are positive integers such that $0 \le m \le n$ and $A \in \matgrp{\ensuremath{\textup{\textsf{F}}}}{m}{n}$ is a matrix with maximal rank~$m$, where $\ensuremath{\textup{\textsf{F}}} = \ensuremath{\textup{\textsf{F}}}_q$ is a finite field with size~$q$. Following Wiedemann's argument, let us begin by assuming that $q \le n^2$ and suppose, as well, that \begin{equation} \label{eq:definition_of_k_and_c2} n = m + k + c_2 \end{equation} where $c_2$ will be defined later. Suppose first that $k \le c_3 \ln n$, where $c_3$ is another constant to be chosen later, and that the remaining $n-m+\ell$ rows of an $(n + \ell) \times n$ matrix~$B$ are chosen uniformly and independently from~$\matgrp{\ensuremath{\textup{\textsf{F}}}}{1}{n}$. The following lemma, which is easily proved, bounds the probability that the rank of~$B$ is less than~$n$ in this case. \begin{lemma} \label{lem:dense_selection_of_vectors} Let $\ell$ be a nonnegative integer and let $B \in \matgrp{\ensuremath{\textup{\textsf{F}}}}{(n + \ell)}{n}$ be a matrix produced by appending another $n-m+\ell$ rows, selected uniformly and independently from~$\matgrp{\ensuremath{\textup{\textsf{F}}}}{1}{n}$, to~$A$. Then the probability that the rank of~$B$ is less than~$n$ is at most $q^{-\ell}$. Furthermore, if $q \ge 3$ then the top $n \times n$ submatrix of~$B$ is nonsingular with probability at least $\frac{1}{q-1}$. \end{lemma} \begin{proof} Permuting the columns of~$A$ (and~$B$) as needed we may assume without loss of generality that the principal $m \times m$ submatrix of~$A$ is nonsingular. Let us continue by choosing the entries in the leftmost $m$~columns of the $n-m+\ell$ rows that are to be appended to~$A$. Regardless of the choice of these entries, this completes an $(n+\ell) \times m$ submatrix of~$B$, including the leftmost $m$ columns, that must also have maximal rank~$m$. The remaining entries of the top~$m$ rows of~$B$ are, of course, fixed: They are entries of~$A$. The entries in the lower columns may now be chosen freely and (viewing the selection of these entries in column order, instead of row order) a standard argument establishes that, for $1 \le i \le n-m$, if the leftmost $m+i-1$ columns of~$B$ are linearly independent then the probability that the $m+i^{\text{th}}$ column of~$B$ is a linear combination of these columns is at most $q^{m+i-n-\ell-1}$. It now follows that $B$ has rank less than~$n$ with probability at most \[ \sum_{i=1}^{n-m} q^{m+i-n-\ell-1} < \sum_{j \ge 0} q^{-(\ell+1)-j} = \frac{q^{-(\ell+1)}}{1-q^{-1}} \le q^{-\ell}. \] Finally, if $q \ge 3$ then, setting $\ell = 0$, one can see the (top) $n \times n$ submatrix obtained by appending these rows is singular with probability at most $\frac{q^{-1}}{1 - q^{-1}} = \frac{1}{q-1}$, as claimed. \end{proof} Since $n- m = k + c_2$, the expected number of nonzero entries in these rows is \[ \left( \frac{q-1}{q} \right) (k + c_2 + \ell)n < \left( \frac{q-1}{q} \right) \cdot \left( c_3 n \ln n + (c_2 + \ell) n \right) \] when $k \le c_3 \ln n$. With that noted let us suppose, instead, that $k > c_3 \ln n$. Following Wiedemann once again, let \begin{equation} \label{eq:definition_of_z} z = 1 - \frac{c_3 \ln n}{k} > 0. \end{equation} Suppose that, for the initial $k$~rows, each entry is set to zero with probability~$z$. The remaining unset entries are then chosen uniformly and independently from~$\ensuremath{\textup{\textsf{F}}}$. The expected number of nonzero entries in these rows is then \[ \left( \frac{q-1}{q} \right) c_3 n \ln n. \] If the entries of another $c_2 + \ell$ rows are chosen uniformly and independently from~$\ensuremath{\textup{\textsf{F}}}$ then the expected number of nonzero entries in these rows is \[ \left( \frac{q-1}{q} \right) (c_2 + \ell) n. \] Consequently the expected number of nonzero entries in all these rows is less than \[ \left( \frac{q-1}{q} \right) \cdot \left( c_3 n \ln n + (c_2 + \ell)n \right) \] in this case as well. The bulk of the rest of Wiedemann's argument concerns the derivation of an upper bound for the probability that $B$ has rank less than~$n$ if $k > c_3 \ln n$ and the rows of~$B$ are chosen in this way. Following Wiedemann, let $\rho$ be the probability that the rows of~$A$, together with the first $k$ (sparse) rows generated using the above process, are linearly dependent --- that is, the probability that the space spanned by these vectors has dimension less than $m+k$. Wiedemann shows that \begin{equation} \label{eq:bound_for_rho} \rho \le \rho_0 + \rho_1 \end{equation} where \begin{equation} \label{eq:definition_of_rho0} \rho_0= \sum_{1 \le j \le k\beta_0} \binom{k}{j} (q-1)^j \left( q^{-1} + \frac{(q-1)}{q} (nq)^{-c_4 \beta} \right)^{n-m}, \end{equation} and \begin{equation} \label{eq:definition_of_rho_1} \rho_1 = \sum_{k \beta_0 < j \le k} \binom{k}{j} (q-1)^j \left( q^{-1} + \frac{(q-1)}{q} (nq)^{-c_4 \beta} \right)^{n-m}, \end{equation} when \begin{equation} \label{eq:definition_of_c4} c_4 = \frac{c_3}{3}, \end{equation} and when \begin{equation} \label{eq:definition_of_beta} \beta = \frac{j}{k} \end{equation} in the above expressions, and where $\beta_0$ is yet another constant to be defined later. A useful bound for $\rho_1$ is next obtained: Assuming that \begin{equation} \label{eq:constraints_on_c2_and_c4} c_2 \ge \frac{3}{2} \ge \log_2 e \qquad \text{and} \qquad c_4 \ge \frac{2}{\beta_0}, \end{equation} Wiedemann establishes that \begin{equation} \label{eq:bound_for_rho1} \rho_1 \le 2 q^{-c_2}. \end{equation} Wiedemann continues by observing that \begin{equation} \label{eq:first_bound_for_rho0} \rho_0 \le \sum_{1 \le j < k \beta_0} \left( \frac{1}{\beta^{\beta} (1-\beta)^{1-\beta}} f(q) \right)^k, \end{equation} where \begin{equation} \label{eq:definition_of_f} f(x) = (x-1)^{\beta} \left( x^{-1} + (1-x^{-1}) (nx)^{-c_4 \beta} \right). \end{equation} \subsection{Getting to the Next Step by a Different Route} \label{ssec:next_step} Wiedemann continues by using the above to establish that \begin{equation} \label{eq:big_goal} \rho_0 \le \sum_{1 \le j < k \beta_0} \beta^{k \beta}. \end{equation} Unfortunately, Wiedemann's involves a Taylor series approximation that seems only to be accurate for a limited range of values, and might suggest that either $\beta$ must be tiny or $c_4$ must be huge in order for it to be applicable. The argument that follows is, therefore, quite different from given by Wiedemann~\cite{wied86}. With that noted, consider the equation at lines~\eqref{eq:first_bound_for_rho0} and~\eqref{eq:definition_of_f} once again. These imply that \begin{equation} \label{eq:what_is_known_1} \begin{split} \rho_0 &\le \sum_{1 \le j < k \beta_0} \left(\frac{(q-1)^{\beta}}{\beta^{\beta} (1-\beta)^{1-\beta}} \left( \frac{1}{q} + \frac{q-1}{q} (nq)^{-c_4 \beta} \right) \right)^k \\ &\le \sum_{1 \le j < k \beta_0} \left(\frac{(q-1)^{\beta}}{\beta^{\beta} (1-\beta)^{1-\beta}} \left( \frac{1}{q} + \frac{q-1}{q} \left( \frac{\beta}{q} \right)^{c_4 \beta} \right)\right)^k \end{split} \end{equation} since $n^{-1} \le k^{-1} \le \frac{j}{k} = \beta$. It follows from this that \begin{equation} \label{eq:what_is_known_2} \rho_0 < \sum_{1 \le j < k \beta_0} \left(\frac{1}{\beta^{\beta} (1-\beta)^{1-\beta}} \left( \frac{(q-1)^{\beta}}{q} + \frac{(q-1) q^{(1-c_4)\beta}}{q} \beta^{c_4 \beta} \right) \right)^k. \end{equation} \subsubsection{Bounding Terms in $\boldsymbol{\rho_0}$ When $\boldsymbol{\beta}$ is Extremely Small} \label{ssec:beta_is_tiny} Note that $\displaystyle{\lim_{\beta \rightarrow 0^{+}}} \beta^{\beta} = \displaystyle{\lim_{\beta \rightarrow 0^{+}}} (1-\beta)^{1-\beta} = 1$, and $\beta^{\beta} < 1$ when $0 < \beta < 1$. The bounds given at lines~\eqref{eq:what_is_known_1} and~\eqref{eq:what_is_known_2} can be simplified by establishing a lemma like the following, allowing the factor $(1-\beta)^{-(1-\beta)}$ to be replaced by a factor $\beta^{\gamma \beta}$, for a negative constant~$\gamma$, when $\beta$ is small. \begin{lemma} \label{lem:getting_rid_of_pesky_term} Consider the relationship between $(1-x)^{-(1-x)}$ and $x^{\gamma x}$, for a negative constant~$\gamma$, when $x$ is small and positive. \begin{enumerate} \renewcommand{\labelenumi}{\text{\textup{(\alph{enumi})}}} \setlength{\itemsep}{0pt} \item If $0 < x \le \frac{5}{43}$ then $(1-x)^{-(1-x)} \le x^{\gamma x}$, with $\gamma = -\frac{11}{25}$. \item If $0 < x \le \frac{1}{5}$ then $(1-x)^{-(1-x)} \le x^{\gamma x}$, with $\gamma = -\frac{23}{40}$. \end{enumerate} \end{lemma} \begin{proof} Consider the function \[ g(x) = \gamma x \ln x + (1-x) \ln (1-x) \] when $\gamma$ is a negative constant and $0 < x < 1$. Since $e^{g(x)} = \frac{x^{\gamma x}}{(1-x)^{-(1-x)}}$ and $(1-x)^{-(1-x)} > 0$, $(1-x)^{-(1-x)} \le x^{\gamma x}$ (for $0 < x < 1$) if and only if $g(x) \ge 0$. Now \begin{align*} \lim_{x \rightarrow 0^{+}} g(x) &= \lim_{x \rightarrow 0^{+}} \frac{\gamma \ln x}{x^{-1}} + \lim_{x \rightarrow 0^{+}} (1-x) \ln (1-x) \\ &= \lim_{x \rightarrow 0^{+}} \frac{\gamma \ln x}{x^{-1}} \\ &= \lim_{x \rightarrow 0^{+}} \frac{\gamma x^{-1}}{-x^{-2}} \tag{by l'H\^{o}pital's Rule} \\ &= \lim_{x \rightarrow 0^{+}} -\gamma x = 0. \end{align*} It is easily checked that $g'(x) = \gamma \ln x - \ln (1-x) + \gamma - 1$. Thus $\displaystyle{\lim_{x \rightarrow{0^{+}}}} g'(x) = +\infty$, so that $g'(x) > 0$ when $x$ is small and positive. It follows from the above that $g(x) > 0$ when $x$ is small and positive, as well. Note next that $g''(x)= \frac{\gamma}{x} + \frac{1}{1-x}$, so that $\displaystyle{\lim_{x \rightarrow 0^{+}}} g''(x) = -\infty$, since $\gamma < 0$, and $g''(x) < 0$ when $x$ is small and positive. On the other hand, $g'''(x) = -\frac{\gamma}{x^2} + \frac{1}{(1-x)^2} > 0$ when $0 < x < 1$. It now follows that $g(x) \ge 0$ for $0 < x \le \delta$ if $g(\delta) \ge 0$ and $g'(\delta) < 0$: Since $g'''(x) > 0$ for all $x$ such that $0 < x < 1$, this implies that either \begin{enumerate} \renewcommand{\labelenumi}{\text{\textup{\roman{enumi}.}}} \setlength{\itemsep}{0pt} \item $g(x) \ge 0$ for all $x$ such that $0 < x < 1$, \item there exists a value $\Gamma$ such that $0 < \Gamma < 1$, $g'(x) \ge 0$ when $0 < x \le \Gamma$ and $g'(x) < 0$ when $\Gamma < x < 1$, or \item there exist values~$\Gamma_1$ and~$\Gamma_2$ such that $0 < \Gamma_1 < \Gamma_2 < 1$, $g'(x) \ge 0$ when $0 < x \le \Gamma_1$, $g'(x) \le 0$ when $\Gamma_1 \le x \le \Gamma_2$, and $g'(x) > 0$ when $\Gamma_2 < x < 1$. \end{enumerate} The claim is certainly trivial in the first case. In the second case it necessarily follows that $\Gamma < \delta$, while it follows that $\Gamma_1 < \delta < \Gamma_2$ in the third case. In each of the last two cases, the function~$g$ is either nondecreasing or has a local maximum in the interval $0 < x \le \delta$. In either case, it is minimized at one or the other of this interval's endpoints. Since $\displaystyle{\lim_{x \rightarrow 0^{+}}} g(x) = 0$, it therefore suffices to confirm that $g(\delta) \ge 0$ in order to establish that $g(x) \ge 0$ when $0 < x \le \delta$. Part~(a) of the claim can now be established by choosing $\gamma = -\frac{11}{25}$ and $\delta = \frac{5}{43}$; then $g'(\delta) = -\frac{11}{25} \ln \frac{5}{43} - \ln \frac{38}{43} - \frac{36}{25} < -0.3 < 0$ and $g(\delta) = -\frac{11}{215} \ln \frac{5}{43} + \frac{38}{43} \ln \frac{38}{43} > 0.0008 > 0$, as required. Part~(b) of the claim can be established by choosing $\gamma = -\frac{23}{40}$ and $\delta = \frac{1}{5}$; then $g'(\delta) = \frac{23}{40} \ln 5 - \ln \frac{4}{5} - \frac{63}{40} < -0.4 < 0$ and $g(\delta) = \frac{23}{200} \ln 5 + \frac{4}{5} \ln \frac{4}{5} > 0.006 > 0$. \end{proof} Suppose, now, that $\gamma \in \ensuremath{\mathbb{Q}}$ is a negative constant such that $(1 - \beta)^{-(1-\beta)} \le \beta^{\gamma \beta}$ when $0 < \beta \le \Delta$ for a positive constant~$\Delta$; it follows by the above lemma that one might choose $\gamma = -\frac{11}{25}$ if $\Delta = \frac{5}{43}$, and that one might choose $\gamma = -\frac{23}{40}$ if $\Delta = \frac{1}{5}$. It would follow from the inequality at line~\eqref{eq:what_is_known_2} that \begin{equation} \label{eq:what_is_known_3} \rho_0 \le \sum_{1 \le j < k \beta_0} \left(\beta^{(\gamma-1)\beta} \left( \frac{(q-1)^{\beta}}{q} + \frac{(q-1)q^{(1-c_4)\beta}}{q} \beta^{c_4 \beta} \right)\right)^k \end{equation} This can be further simplified by bounding $(q-1)^{\beta}$ by $\beta^{\delta \beta}$ for a small positive constant~$\delta$: \begin{lemma} \label{lem:getting_rid_of_power_of_q} Consider the relationship between $\zeta^x$ and $x^{\delta x}$ when $\zeta$ is a positive constant. If $\zeta = 2$ and $0 < x \le \frac{1}{5}$ then $\zeta^x \le x^{\delta x}$ when $\delta = -\frac{9}{20}$. \end{lemma} \begin{proof} Consider the function \[ h(x) = \delta x \ln x - x \ln \zeta \] when $\delta$ is a negative constant and $\zeta$ is a positive one. Since $e^{h(x)} = \frac{x^{\delta x}}{\zeta^x}$ and $\zeta^x > 0$ when $x > 0$, $\zeta^x \le x^{\delta x}$ (for positive~$x$) if and only if $h(x) \ge 0$. Now note that\\[-33pt] \begin{align*} \lim_{y \rightarrow 0^{+}} h(y) &= \lim_{y \rightarrow 0^{+}} \frac{\delta \ln y}{y^{-1}} - 0\\ &= \lim_{y \rightarrow 0^{+}} \frac{\delta y^{-1}}{-y^{-2}} \tag{by l'H\^{o}pital's Rule} \\ &= \lim_{y \rightarrow 0^{+}} -\delta y = 0. \end{align*} It is easily checked that $h'(x) = \delta \ln x + \delta - \ln \zeta$. Now $\displaystyle{\lim_{y \rightarrow 0^{+}}} h'(y)= +\infty$, since $\delta < 0$, so that $h'(x) > 0$ for sufficiently small positive~$x$. It follows by the above that $h(x) > 0$ when $x$ is small and positive as well. Since $h''(x) = \frac{\delta}{x} < 0$ when $x > 0$ it now follows, for any positive constant~$\rho$, that if $h(\rho) \ge 0$ then $h(x) \ge 0$ as well when $0 < x \le \rho$ --- for it follows from that this that either $h(x) \ge 0$ for all positive~$x$ --- in which case the claim is trivial --- or there exists some constant $\Gamma$ such that $h(x) \ge 0$ when $0 < x \le \Gamma$, and such that $h(x) < 0$ when $x > \Gamma$. If $h(\frac{1}{5}) > \frac{1}{2}$, then $\Gamma$ must be greater than~$\frac{1}{5}$ in this second case. With that noted, the claim can now be established by setting $\zeta=2$, $\delta = -\frac{9}{20}$, $\rho = \frac{1}{5}$, and confirming that $h(\rho) = \frac{9}{100} \ln 5 - \frac{1}{5} \ln 2 > 0.006$. \end{proof} Suppose next that $\delta \in \ensuremath{\mathbb{Q}}$ is constant that is less than or equal to~$0$ such that $(q-1)^{\beta} \le \beta^{\delta \beta}$ when $0 < x \le \Delta$; one can certainly choose $\delta = 0$ if $q = 2$, and it follows by the above lemma that if $q=3$ then one can choose $\delta = -\frac{9}{20}$ when $\Delta = \frac{1}{5}$. It is already necessary for the argument being developed that $c_4 \ge 1$, so that (when $q \ge 2$) $q^{(1-c_4)\beta} \le 1$. It would therefore follow from the bound at line~\eqref{eq:what_is_known_3} that \begin{equation} \label{eq:what_is_known_4} \rho_0 \le \sum_{1 \le j < k \beta_0} \left(\beta^{(\gamma -1)\beta} \left( \frac{\beta^{\delta \beta}}{q} + \frac{(q-1)}{q} \beta^{c_4 \beta}\right)\right)^k. \end{equation} Once again suppose that --- as in Wiedemann's original argument --- we wish to show that \[ \rho_0 \le \sum_{1 \le j < k \beta_0} \beta^{k\beta}. \] Then it follows from the above that it is sufficient to show that \begin{equation} \label{eq:what_is_needed_1} \beta^{(\gamma - 1) \beta} \left( \frac{\beta^{\delta \beta}}{q} + \frac{(q-1)}{q} \beta^{c_4 \beta} \right) \le \beta^{\beta} \qquad \text{when $0 < \beta = \frac{j}{k} \le \beta_0$,} \end{equation} that is, that $f_1(\beta, q, c, \gamma, \delta) \ge 0$, when $0 < \beta \le \beta_0$ and $c = c_4$, for \begin{equation} \label{eq:first_general_approximation} f_1(\beta, q, c, \gamma, \delta) = \beta^{\beta} - \beta^{\beta (\gamma-1)} \left( \frac{\beta^{\beta \delta}}{q} + \frac{(q-1)}{q} \beta^{\beta c} \right). \end{equation} Since ${\displaystyle{\lim_{\beta \rightarrow 0^{+}}}} \beta^{\beta} = 1$, \[ \lim_{\beta \rightarrow 0^{+}} f_1(\beta, q, c, \gamma, \delta) = 1 - \left( {\textstyle{\frac{1}{q}}} + {\textstyle{\frac{q-1}{q}}} \right) = 0. \] \begin{lemma} \label{lem:correctness_of_first_approximation} Suppose that $\gamma = \frac{a}{d}$ and $\delta = \frac{b}{d}$ for non-positive integers~$a$ and~$b$ and a positive integer~$d$. Suppose, as well, that \begin{equation} \label{eq:new_requirement_for_c} c > \frac{2q}{q-1} - \frac{\delta}{q-1} - \frac{q \gamma}{q-1}. \end{equation} If $\Delta$ and~$\widehat{\Delta}$ are positive constants such that $0 < \Delta < \widehat{\Delta} \le \frac{1}{e}$, $f_1(\Delta, q, c, \gamma, \delta) \ge 0$ and $f_1(\widehat{\Delta}, q, c, \gamma, \delta) < 0$, then $f_1(\beta, q, c, \gamma, \delta) \ge 0$ for $0 < \beta \le \Delta$. \end{lemma} \begin{proof} Let $z = \beta^{\beta}$, so that $f_1(\beta, q, c, \gamma, \delta) = p_0(z)$, where \[ p_0(z) = z - \frac{1}{q} z^{\gamma + \delta - 1} - \frac{q-1}{q} z^{c+\gamma - 1}. \] It follows that (differentiating with respect to~$z$) \[ p_0'(z) = 1 - \frac{1}{q}(\gamma + \delta - 1) z^{\gamma + \delta - 2} - \frac{(q-1)}{q}(c+\gamma -1) z^{c+ \gamma - 2}, \] so that \begin{align*} \lim_{z \rightarrow 1^{-}} p_0'(z) &= 1 - \frac{1}{q}(\gamma + \delta - 1) - \frac{(q-1)}{q} (c + \gamma - 1) \\ &= 2 - \frac{\delta}{q} - \gamma - \frac{(q-1)}{q} c \\ &= \frac{q-1}{q} \left( \frac{2q}{q-1} - \frac{\delta}{q-1} - \frac{q \gamma}{q-1} - c \right) \\ &< 0, \end{align*} by the inequality at line~\eqref{eq:new_requirement_for_c}. Thus $p_0$ is a decreasing function as $z$ approaches~$1$ from below and, since ${\displaystyle{\lim_{z \leftarrow 1^{-}}}} p_0(z) = 0$, it follows that $p_0(z) > 0$ when $z$ is less than and sufficiently close to~$1$. Now, since $\beta^{\beta} < 1$ when $0 < \beta < 1$ and ${\displaystyle{\lim_{\beta \rightarrow 0^{+}}}} \beta^{\beta} = 1$, this implies that $f_1(\beta) > 0$ when $\beta$ is positive, and sufficiently small, as well. Recall that $\gamma = \frac{a}{d}$ and $\delta = \frac{b}{d}$ where $a, b, d \in \ensuremath{\mathbb{Z}}$, $a \le 0$, $b \le 0$, and $d > 0$. Thus $\beta^{(1-\gamma-\delta)\beta} f_1(\beta, q, c, \gamma, \delta) = p_1(y)$, where $y = \beta^{\beta/d}$ and \[ p_1(y) = -\frac{(q-1)}{q} y^{cd - b} + y^{2d-a-b} -\frac{1}{q} \in \ensuremath{\mathbb{Q}}[y], \] so that (for $y$ as above) $f_1(\beta, q, c, \gamma, \delta) \ge 0$ if and only if $p_1(y) \ge 0$ --- and (by the above) $p_1(y) > 0$ if $y$ is less than and sufficiently close to~$1$. Now --- regardless of the relationship between $c$ and~$\gamma$ --- there are at most two changes in sign of the nonzero coefficients of this polynomial, when listed by decreasing powers of~$y$. It follows that if $0 < \Delta < \widehat{\Delta} \le \frac{1}{e}$ (so that the function $g(\beta) = \beta^{\beta/d}$ is decreasing, and injective, over the interval $0 < \beta \le \widehat{\Delta}$), $f_1(\Delta) \ge 0$ and $f_1(\widehat{\Delta}) < 0$, then $f_1(\beta) \ge 0$ for $0 < \beta \le \Delta$ --- for, otherwise, the polynomial~$p_1$ would necessarily have at least four positive roots in the interval $\widehat{\Delta}^{\widehat{\Delta}/d} \le y \le 1$, contradicting Descarte's rule of signs. \end{proof} It therefore suffices to check the condition at line~\eqref{eq:new_requirement_for_c} and to confirm that $f_1(\Delta) \ge 0$ and $f_1(\widehat{\Delta}) < 0$, for $0 < \Delta < \widehat{\Delta} \le \frac{1}{e}$, in order to establish that $f_1(\beta) \ge 0$ when $0 < \beta \le \Delta$ --- so that \begin{equation} \label{eq:first_target} \sum_{1 \le j \le k \Delta} \left( \frac{(q-1)^{\beta}}{\beta^{\beta} (1-\beta)^{1 - \beta}} \left( \frac{1}{q} + \frac{q-1}{q} (nq)^{-c_4 \beta} \right) \right)^k \le \sum_{1 \le j \le k \Delta} \beta^{k\beta}. \end{equation} \subsubsection{Bounding Terms in $\boldsymbol{\rho_0}$ When $\boldsymbol{\beta}$ is Larger} \label{ssec:beta_is_moderate} The process described in Subsection~\ref{ssec:beta_is_tiny} can only be used to establish the inequality at line~\eqref{eq:first_target}, above, for small positive constants~$\Delta$ that are generally much smaller than the desired bound $\beta_0 = \frac{2}{c_4}$. However, a complementary process --- which in turn, does not seem to be useful to establish the above inequalities when $\beta$ is extremely close to zero --- can (at least, sometimes) be used to establish that these inequalities hold for larger~$\Delta$ as well. Once again, recall that \[ \frac{(q-1)^{\beta}}{\beta^{\beta} (1-\beta)^{1-\beta}} \left( \frac{1}{q} + \frac{q-1}{q} (nq)^{-c_4 \beta} \right) \le \frac{(q-1)^{\beta}}{\beta^{\beta} (1-\beta)^{1-\beta}} \left( \frac{1}{q} + \frac{q-1}{q} \left( \frac{\beta}{q} \right)^{c_4 \beta} \right). \] Suppose, now, that $\eta$ is a constant such that $0 < \eta < 1$. Then it certainly follows that \[ \frac{(q-1)^{\beta}}{\beta^{\beta} (1-\beta)^{1-\beta}} \left( \frac{1}{q} + \frac{q-1}{q} (nq)^{-c_r \beta} \right) \le \beta^{\beta} \] when $\Gamma_L \le \beta \le \Gamma_H$, for positive constants~$\Gamma_L$ and~$\Gamma_H$, if \begin{equation} \label{eq:first_new_relationship} \frac{(q-1)^{\beta}}{\beta^{\beta} (1-\beta)^{1-\beta}} \cdot \frac{1}{q} \le \eta \beta^{\beta} \end{equation} and \begin{equation} \label{eq:second_new_relationship} \frac{(q-1)^{\beta}}{\beta^{\beta} (1-\beta)^{1-\beta}} \cdot \frac{q-1}{q} \left(\frac{\beta}{q}\right)^{c_4 \beta} \le (1 - \eta) \beta^{\beta} \end{equation} when $\Gamma_L \le \beta \le \Gamma_H$ as well. Since $q > 1$ and $0 < \beta < 1$, the inequality at line~\eqref{eq:first_new_relationship} holds if and only if \[ \frac{\eta \beta^{2\beta} (1-\beta)^{1-\beta} q}{(q-1)^\beta} \ge 1. \] Considering logarithms, one can see that this is the case for $\Gamma_L \le \beta \le \Gamma_H$ if and only if $F_1(\beta) \ge 0$ for $\Gamma_L \le \beta \le \Gamma_H$, where \begin{equation} \label{eq:defiinition_of_F1} F_1(x) = 2x\ln x + (1-x) \ln (1-x) - x \ln (q-1) + \ln q + \ln \eta. \end{equation} Similarly, the inequality at line~\eqref{eq:second_new_relationship} is satisfied if and only if \[ \frac{(1 - \eta) \beta^{(2 - c_4)\beta} (1-\beta)^{1-\beta} q^{c_4\beta + 1}}{(q-1)^{\beta+1}} \ge 1. \] Considering logarithms, one can see that this is the case for $\Gamma_L \le \beta \le \Gamma_H$ if and only if $F_2(\beta) \ge 0$ for $\Gamma_L \le \beta \le \Gamma_2$, where \begin{equation} \label{eq:definition_of_F2} F_2(x) = (2-c_4)x\ln x + (1-x)\ln(1-x) + (c_4x+1) \ln q - (x+1)\ln(q-1) + \ln (1-\eta). \end{equation} Note next that \[ F_1'(x) = 1 + 2 \ln x - \ln (1-x) - \ln (q-1) \] --- which is independent of~$\eta$ --- and \[ F_1''(x) = \frac{2}{x} + \frac{1}{1-x} \] --- which is positive if $0 < x < 1$. Consequently it it suffices to check that $F_1'(\beta_0) < 0$ in order to establish that $F_1'(x) < 0$ for $0 < x \le \beta_0$, so that $F_1(x)$ is decreasing over the interval $\Delta < x \le \beta_0$. If this is the case, and $\Delta \le \Gamma_L < \Gamma_H \le \beta_0$, then it suffices to check that $F_1(\Gamma_H) \ge 0$ in order to confirm that $F_1(\beta) \ge 0$ for $\Gamma_L \le \beta \le \Gamma_H$ as well. Note as well that \[ F_2'(x) = (1-c_4) + (2-c_4)\ln x - \ln (1-x) + c_4 \ln q - \ln (q-1) \] --- which is also independent of~$\eta$ --- and that \[ F_2''(x) = \frac{2- c_4}{x} + \frac{1}{1-x} \] --- which is negative (for $c_4 > 2$) if $0 < x < \frac{2-c_4}{1-c_4} = 1 + \frac{1}{1-c_4}$, zero if $x = 1 + \frac{1}{1-c_4}$, and positive if $x > 1 + \frac{1}{1-c_4}$. Consequently if $\beta_0 \le 1 + \frac{1}{1-c_4}$ then it suffices to check that $F2'(\beta_0) \ge 0$ in order to establish that $F_2$ is increasing over the interval $\Delta \le x \le \beta_0$. If $\Delta \le 1 + \frac{1}{1 - c_4} \le \beta_0$ then it suffices to check that $F_2'\left(1 + \frac{1}{1-c_4}\right) \ge 0$ in order to confirm that $F_2$ is increasing over this interval. If $1 + \frac{1}{1 -c_4} \le \Delta$ then it suffices to check that $F_2'(\Delta) \ge 0$ in order to confirm this. In any case, if this has been confirmed and $\Delta \le \Gamma_L < \Gamma_H \le \beta_0$, then it suffices to check that $F_2(\Gamma_L) \ge 0$ in order to confirm that $F_2(\beta) \ge 0$ for $\Gamma_L \le \beta \le \Gamma_H$. The desired inequality can now be established, for $\Delta \le \beta \le \beta_0$, by breaking this interval into one or more subintervals, and using the above process with various choices of~$\eta$ to confirm that $F_1$ and~$F_2$ are both non-negative over each subinterval. \subsubsection{Establishing That $f$ is a Decreasing Function} \label{ssec:f_is_decreasing} Once again, consider the function \[ f(x) = (x-1)^{\beta} (x^{-1} + (1 - x^{-1}) (nx)^{-c_4 \beta}) \] as defined at line~\eqref{eq:definition_of_f}. Wiedemann establishes that if $0 < \beta \le \beta_0 < {\textstyle{\frac{1}{4}}}$, $n \ge 1$, $q \ge 2$ and $c_4 > {\textstyle{\frac{4}{\ln 2}}}$, then $f$ is a non-increasing function, so that $f(q) \le f(2)$ for $q \ge 2$ --- as needed to establish that results like the above hold for larger finite fields as well. Unfortunately, this argument requires both $c_4$ and~$c_3$ to assume larger values than are either necessary or desirable. However, Wiedemann's argument can be modified in a straightforward way to establish the following. \begin{lemma} \label{lem:f_is_decreasing} Suppose that $n \ge 1$, $q \ge 16$, $0 < \beta \le \beta_0 \le \frac{12}{13}$, and $c_4 \ge \frac{2}{\beta_0} \ge \frac{13}{6}$. Then $f$ is a decreasing function of~$x$ over the interval $x \ge q$. \end{lemma} \begin{proof} As Wiedemann notes, if $f$ is as defined at line~\eqref{eq:definition_of_f} then \begin{multline*} f'(x) = \beta (x-1)^{\beta-1} (x^{-1} + (1-x^{-1}) (nx)^{-c_4 \beta}) \\ + (x-1)^{\beta}(-x^{-2} + x^{-2}(nx)^{-c_4\beta} -c_4 \beta(x^{-1}-x^{-2}) (nx)^{-c_4\beta}) \end{multline*} so that \[ x^2(x-1)^{-\beta}f'(x) = g(x) + h(x), \] where \[ g(x) = (\beta x - c_4 \beta x + c_4 \beta) (nx)^{-c_4 \beta} \] and \[ h(x) = \frac{\beta x}{x-1} - 1 + (nx)^{-c_4 \beta} = \beta + \beta(x-1)^{-1} - 1 + (nx)^{-c_4 \beta}. \] Consequently, for $x > 1$, if $g(x) < 0$ and $h(x) < 0$ then $f'(x) < 0$ as well. Now, since $\beta (nx)^{-c_4 \beta} > 0$ when $n$, $x$, $c_4$ and~$\beta$ are all positive, it suffices to show that $q - c_4 q + c_4 < 0$ in order to establish that $g(q) < 0$, and $q - c_4 q + c_4 < 0$ if and only if $q > \frac{c_4}{c_4 - 1} = 1 + \frac{1}{c_4-1}$. Since $c_4 \ge \frac{13}{6} > 2$, $1 + \frac{1}{c_4 - 1} < 2$, so that $g(q) < 0$ when $q \ge 16$, as desired. Consider the function~$h$ when $n$, $q$, $\beta$, $\beta_0$ and~$c_4$ are as above. This function is certainly decreasing with both~$x$ and~$c_4$. It therefore suffices to set $x = q = 16$ and $c_4 = \frac{13}{6}$ and show that \[ H(\beta) = h(16) = {\textstyle{\frac{16}{15}}} \beta - 1 + (16n)^{-\frac{13}{6} \beta} < 0 \] when $0 < \beta \le \frac{12}{13}$ in order to establish that $h(x) < 0$, for $\beta$ in this range, and for $q$ and~$n$ as above. Now it is easily checked that ${\displaystyle{\lim_{\beta \rightarrow 0^{+}}}} H(\beta) = 0 - 1 + 1 = 0$. Considered as a function of~$\beta$ (and differentiating with respect to~$\beta$), $H'(\beta) = {\textstyle{\frac{16}{15}}} - {\textstyle{\frac{13}{6}}} \ln (16n) \cdot (16n)^{-\frac{13}{6} \beta}$, so that ${\displaystyle{\lim_{\beta \rightarrow 0^{+}}}} H'(\beta) = \frac{16}{15} - \frac{13}{6} \ln(16n) \le \frac{16}{15} - \frac{13}{6} \ln 16 < -4$. Thus both $H'(\beta)$ and~$H(\beta)$ are negative when $\beta$ is positive and sufficiently small. Note next that $H''(\beta) = \frac{169}{36} \ln(16n)^2 \cdot (16n)^{-\frac{13}{6} \beta} > 0$ whenever $\beta > 0$, so that $H'(\beta)$ is a strictly increasing function of~$\beta$. This admits (only) two possibilities: Either $H(\beta) < 0$ for all $\beta > 0$ --- which certainly establishes the desired result --- or there exists a positive value $\Delta$ such that $H(\beta) < 0$ when $0 < \beta < \Delta$, $H(\Delta) = 0$, and $H(\beta) > 0$ when $\beta > \Delta$. In either case it now suffices to check that $H(\beta) < 0$ when $\beta$ has the maximum value of interest, that is, when $\beta = \frac{12}{13}$. It therefore remains only to note that \[ H\left(\frac{12}{13}\right) = \frac{64}{65} -1 + (16n)^{-2} \le -\frac{1}{65} + \frac{1}{256} < -0.01 < 0 \] in order to complete the proof. \end{proof} \subsubsection{Application of These Processes} \label{ssec:bounding_rho0} The processes described in Subsections~\ref{ssec:beta_is_tiny} and~\ref{ssec:beta_is_moderate} and the result established in Section~\ref{ssec:f_is_decreasing} can now be applied to establish the following. \begin{lemma} \label{lem:bound_when_q=2} If $q = 2$, $0 < \beta \le \frac{6}{43}$ and $c_4 \ge \frac{43}{3}$ then \[ \frac{1}{\beta^{\beta} (1-\beta)^{1-\beta}} \left( {\textstyle{\frac{1}{2}}} + {\textstyle{\frac{1}{2}}} (2n)^{-c_4 \beta} \right) \le \beta^{\beta}. \] \end{lemma} \begin{proof} To begin, let us use the process described in Subsection~\ref{ssec:beta_is_tiny} to establish the above inequality when $0 < \beta \le \frac{5}{43}$. It follows by part~(a) of Lemma~\ref{lem:getting_rid_of_pesky_term} that $(1-x)^{-(1-x)} \le x^{\gamma x}$ when $0 < x \le \frac{5}{43}$ and $\gamma = -\frac{11}{25}$, so that $\gamma$ can be set to have this value when this process is applied. Since $(q-1)^x = 1^x = 1$ when $0 < x \le \frac{5}{43}$, $(q-1)^x \le x^{\delta x}$ in this range when $\delta = 0$, so this value will be used for this constant. In this case \[ c_4 - \left( \frac{2q}{q-1} - \frac{\delta}{q-1} - \frac{q\gamma}{q-1} \right) = \frac{89}{15} > 0, \] so that the condition at line~\eqref{eq:new_requirement_for_c} is satisfied. Since $0 < \frac{5}{43} < \frac{7}{43} \le \frac{1}{e}$, it now suffices to note that $f_1(\frac{5}{43}, 2, \frac{43}{3}, -\frac{11}{25}, 0) > 0.04$ and $f_1(\frac{7}{43}, 2, \frac{43}{3}, -\frac{11}{25}, 0) < - 0.03$ --- for it then follows by Lemma~\ref{lem:correctness_of_first_approximation} that the inequality in the claim is satisfied when $0 < \beta \le \frac{5}{43}$. The process described in Subsection~\ref{ssec:beta_is_moderate} can now be used to establish the above inequality when $\frac{5}{43} \le \beta \le \frac{6}{43}$, completing the proof. Since $F_1'\left(\frac{6}{43}\right) < -2.7$ the function~$F_1$ is decreasing over this interval, for every choice of~$\eta$. Since $\frac{6}{43} < \frac{37}{40} = 1 + \frac{1}{1 - (43/3)}$ and $F_2'\left(\frac{6}{43}\right) > 21$, the function $F_2$ is increasing over this interval for every choice of~$\eta$. It now suffices to confirm that if $\eta = \frac{99}{100}$ then $F_1\left(\frac{6}{43}\right) > 0.004$ and $F_2\left(\frac{5}{43}\right) > 0.2$, so that $F_1$ and $F_2$ are both non-negative over the interval $\frac{5}{43} \le \beta \le \frac{6}{43}$, as desired. \end{proof} It now follows that \begin{equation} \label{eq:fourth_bound_for_rho0_when_q=2} \rho_0 \le \sum_{1 \le j < k \beta_0} \beta^{k\beta} \quad \text{if $q = 2$, $\beta_0 = \frac{6}{43}$, and $c_4 \ge \frac{43}{3}$.} \end{equation} In the above lemma the upper limit, $\beta_0 = \frac{6}{43}$ for~$\beta$, has been chosen so that $\beta_0 = \frac{2}{c_4}$ --- in order to match the constraint between~$\beta_0$ and~$c_4$ as shown at line~\eqref{eq:constraints_on_c2_and_c4}. A plot of the function $\beta^{\beta} - \frac{1}{\beta^{\beta} (1-\beta)^{1-\beta}} \left(\frac{1}{2} + \frac{1}{2} \left(\frac{\beta}{2}\right)^{\frac{43}{3}\beta}\right)$, for $0 < \beta \le \frac{6}{43}$, is shown in Figure~\ref{fig:plot1}. \begin{figure}[t!] \begin{center} \scalebox{0.4}{\includegraphics{plot_1.eps}} \end{center} \caption{Plot of $\beta^{\beta} - \frac{1}{\beta^{\beta} (1-\beta)^{1-\beta}} \left( \frac{1}{2} - \frac{1}{2} \left( \frac{\beta}{2}\right)^{\frac{43}{3}\beta}\right)$ when $0 < \beta \le \frac{6}{43}$} \label{fig:plot1} \end{figure} As this may suggest, the above result result can be improved slightly --- but not by very much: The inequality at line~\eqref{eq:fourth_bound_for_rho0_when_q=2}, above, is not satisfied if $c_4$ is decreased to~$14$ and $\beta_0$ increased to~$\frac{1}{7}$. In order to see one more example of this process let us consider the case that $q \ge 3$. An application of the technique described above establishes the following. \begin{lemma} \label{lem:bound_when_q=3} If $q = 3$, $0 < \beta \le \frac{1}{4}$ and $c_4 \ge 8$ then \[ \frac{2^{\beta}}{\beta^{\beta}(1-\beta)^{1-\beta}} \left( {\textstyle{\frac{1}{3}}} + {\textstyle{\frac{2}{3}}} (3n)^{-c_4\beta}\right) \le \beta^{\beta}. \] \end{lemma} \begin{proof} To begin, let us use the process described in Subsection~\ref{ssec:beta_is_tiny} to establish the above inequality when $0 < \beta \le \frac{1}{5}$. It follows by part~(b) of Lemma~\ref{lem:getting_rid_of_pesky_term} that $(1-x)^{-(1-x)} \le x^{\gamma x}$ when $0 < x \le \frac{1}{5}$ and $\gamma = -\frac{23}{40}$, so that $\gamma$ can be set to have this value when this process is applied. It follows by Lemma~\ref{lem:getting_rid_of_power_of_q} that if $q=3$ and $\delta = -\frac{9}{20}$ then $(q-1)^x \le x^{\delta x}$ when $0 < x \le \frac{1}{5}$, so $\delta$ can be set to be $-\frac{9}{20}$ in this argument. In this case \[ c_4 - \left( \frac{2q}{q-1} - \frac{\delta}{q-1} - \frac{q\gamma}{q-1} \right) = \frac{313}{80} > 0, \] so that the condition at line~\eqref{eq:new_requirement_for_c} is satisfied. Since $0 < \frac{1}{5} < \frac{1}{4} \le \frac{1}{e}$, it now suffices to note that $f_1(\frac{1}{5}) > 0.0008$ and $f_1(\frac{1}{4}) < - 0.03$ --- for it then follows by Lemma~\ref{lem:correctness_of_first_approximation} that the inequality in the claim is satisfied when $0 < \beta \le \frac{1}{5}$. The process described in Subsection~\ref{ssec:beta_is_moderate} can now be used to establish the above inequality when $\frac{1}{5} \le \beta \le \frac{1}{4}$, completing the proof. Since $F_1'\left(\frac{1}{4}\right) < -2.1$ the function~$F_1$ is decreasing over this interval, for every choice of~$\eta$. Since $\frac{1}{4} < \frac{6}{7} = 1 + \frac{1}{1 - 8}$ and $F_2'\left(\frac{1}{4}\right) > 9$, the function $F_2$ is increasing over this interval for every choice of~$\eta$. It now suffices to confirm that if $\eta = \frac{39}{40}$ then $F_1\left(\frac{6}{25}\right) > 0.01$ and $F_2\left(\frac{1}{5}\right) > 0.08$, so that $F_1$ and $F_2$ are both non-negative over the interval $\frac{1}{5} \le \beta \le \frac{6}{25}$. It then suffices to confirm that if $\eta = \frac{123}{125}$ then $F_1\left(\frac{1}{4}\right) > 0.0002$ and $F_2\left(\frac{6}{25}\right) > 0.05$, so that $F_1$ and $F_2$ are both non-negative over the interval $\frac{6}{25} \le x \le \frac{1}{4}$, as needed to complete the proof. \end{proof} It now follows that \begin{equation} \label{final_bound_for_rho0_when_q=3} \rho_0 \le \sum_{1 \le j < k \beta_0} \beta^{k\beta} \quad \text{if $q = 3$, $\beta_0 = \frac{1}{4}$, and $c_4 \ge 4$.} \end{equation} A plot of the function $\beta^{\beta} - \frac{2^{\beta}}{\beta^{\beta} (1-\beta)^{1-\beta}} \left( \frac{1}{3} + \frac{2}{3} \left(\frac{\beta}{3}\right)^{8 \beta}\right)$, when $0 < \beta \le \frac{1}{4}$, is shown in Figure~\ref{fig:plot2}. \begin{figure}[t!] \begin{center} \scalebox{0.4}{\includegraphics{plot_2.eps}} \end{center} \caption{Plot of $\beta^{\beta} - \frac{1}{\beta^{\beta} (1-\beta)^{1-\beta}} \left(\frac{1}{3} + \frac{2}{3} \left(\frac{\beta}{3}\right)^{8\beta}\right)$ when $0 < \beta \le \frac{1}{4}$} \label{fig:plot2} \end{figure} Once again, this suggests that the above result cannot be improved by very much. Appendix~\ref{sec:continuation_of_argument} include details of analyses for additional field sizes as well --- as summarized in Figure~\ref{fig:choices_of_c4} on page~\pageref{fig:choices_of_c4}. A Maple worksheet, that can be used to check these details, is available online at \begin{center} \url{http://www.cpsc.ucalgary.ca/~eberly/Research/sparse_conditioner.mw}. \end{center} \begin{figure}[t!] \begin{center} \begin{tabular}{ccc|ccc|ccc} $q$ & $c_4$ & $\beta_0$ & $q$ & $c_4$ & $\beta_0$ & $q$ & $c_4$ & $\beta_0$ \\[2pt] \hline $2$ \rule{0pt}{12pt} & $\frac{43}{3}$ & $\frac{6}{43}$ & $9$ & $\frac{11}{3}$ & $\frac{6}{11}$ & $47$--$59$ & $\frac{7}{3}$ & $\frac{6}{7}$ \\ $3$ \rule{0pt}{12pt} & $8$& $\frac{1}{4}$ & $11$ & $\frac{7}{2}$ & $\frac{4}{7}$ & $61$--$71$ & $\frac{9}{4}$ & $\frac{8}{9}$ \\ $4$ \rule{0pt}{12pt} & $\frac{25}{4}$ & $\frac{8}{25}$ & $13$ & $\frac{10}{3}$ & $\frac{3}{5}$ & $73$--$83$ & $\frac{11}{5}$ & $\frac{10}{11}$ \\ $5$ \rule{0pt}{12pt} & $\frac{16}{3}$ & $\frac{3}{8}$ & $16$--$19$ & $3$ & $\frac{2}{3}$ & $\ge 89$ & $\frac{13}{6}$ & $\frac{12}{13}$ \\ $7$ \rule{0pt}{12pt} & $\frac{13}{3}$ & $\frac{6}{13}$ & $23$--$29$ & $\frac{8}{3}$ &$\frac{3}{4}$ & \\ $8$ \rule{0pt}{12pt} & $4$ & $\frac{1}{2}$ & $31$--$43$ & $\frac{5}{2}$ & $\frac{4}{5}$ & & \end{tabular} \end{center} \caption{Choices of~$c_4$ and~$\beta_0$ for Various Field Sizes} \label{fig:choices_of_c4} \end{figure} It follows from this that \[ \rho_0 \le \sum_{1 \le j < k \beta_0} \beta^{k\beta} \] for each of the choices of~$q$, $\beta_0$ and~$c_4$ given in Figure~\ref{fig:choices_of_c4}. \subsection{Asymptotic Results: Choice of Field Size} \label{ssec:asymptotics_1} The objective of this next subsection is to identify bounds on the sizes of primes allowing the inequality at line~\eqref{eq:big_goal} to be established when $c_4$ is closer to~$2$. Suppose, in particular, that $N$ is an integer such that $N \ge 18$ and that \begin{equation} \label{eq:asymptotic_constraints_on_constants} c_4 = 2 + {\textstyle{\frac{1}{N}}} \qquad \text{and} \qquad q \ge 16N + 9. \end{equation} Consider now the function \begin{equation} \label{eq:definition_of_g} \begin{split} g(\beta) &= \frac{\left( \frac{(q-1)^{\beta}}{\beta^{\beta} (1-\beta)^{1-\beta}} \right) \left( \frac{1}{q} + \left(\frac{q-1}{q}\right) \left( \frac{\beta}{q} \right)^{c\beta} \right)}{\beta^{\beta}} \\ &= \frac{(q-1)^{\beta}}{\beta^{2\beta} (1-\beta)^{1-\beta}} \left( \frac{1}{q} + \left(\frac{q-1}{q}\right) \left( \frac{\beta}{q} \right)^{c_4 \beta} \right) \end{split} \end{equation} noting --- by the inequality at line~\eqref{eq:what_is_known_1} --- that the inequality at line~\eqref{eq:big_goal} is satisfied if $g(\beta) \le 1$ when $0 < \beta \le \beta_0 = \frac{2}{c_4}$. Consider, as well the function \begin{equation} \label{eq:definition_of_h} \begin{split} h(\beta) &= \ln g(\beta) \\ &= \beta \ln (q-1) - 2 \beta \ln \beta - (1 - \beta) \ln (1-\beta) \\ &\hspace*{1 true in} + \ln \left( \frac{1}{q} + \left( \frac{q-1}{q} \right) \left(\frac{\beta}{q} \right)^{c_4 \beta} \right) \end{split} \end{equation} observing that \begin{equation} \label{eq:definition_of_hprime} h'(\beta) = \ln (q-1) - 2 \ln \beta + \ln (1-\beta) - 1 + \frac{H(\beta)}{H(\beta)+1} (c_4 + c_4 \ln \beta - c_4 \ln q) \end{equation} where \begin{equation} \label{eq:definition_of_H} H(\beta) = (q-1) \left( \frac{\beta}{q}\right)^{c_4 \beta}. \end{equation} \begin{lemma} \label{lem:first_asymptotic_interval} If $0 < \beta \le \frac{1}{50 c_4 \ln q}$ then $g(\beta) \le 1$. \end{lemma} \begin{proof} It is easily checked that $\displaystyle{\lim_{\beta \rightarrow 0^+} g(\beta)} = 1$ and $\displaystyle{\lim_{\beta \rightarrow 0^+} h(\beta)} = 0$. The claim can therefore be established by showing that $h'(\beta) < 0$ when $0 < \beta \le \frac{1}{50 c_4 \ln q}$. Consider the above function $H(\beta)$, recalling as well that \begin{equation} \label{eq:log_approximation} \frac{x}{1+x} \le \ln (1+x) \le x, \end{equation} for any real number~$x$ such that $x > -1$. Replacing $x$ with $-x$ (where $x < 1$), one has that \[ - \frac{x}{1-x} \le \ln (1-x) \le -x \] as well, and replacing $x$ with $1-x$ (where, once again $x < 1$) one has that \[ 1 - \frac{1}{x} \le \ln x \le x-1. \] It follows from this that (for $0 < x < 1$) \[ x - 1 \le x \ln x \le x^2 - x, \] so that \[ e^{x-1} \le x^x \le e^{x^2 - x} \le 1 \] when $0 < x \le 1$. It follows from the definition of $H(\beta)$ at line~\eqref{eq:definition_of_H} that \begin{align*} H(\beta) &\ge (q-1) \frac{e^{(\beta-1) c_4}}{q^{c_4 \beta}} \\ &\ge (q-1) \frac{e^{-c_4}}{q^{c_4 \beta}} \\ &= (1 - q^{-1}) e^{-c_4} q^{1 - c_4 \beta} \\ &\ge (1 - q^{-1}) e^{-\frac{37}{18}} q^{1- c_4 \beta} \tag{since $N \ge 18$, so that $c_4 \le \frac{37}{18}$} \\ &\ge \frac{296}{297} \frac{e^{-\frac{37}{18}}}{q^{c_4 \beta}} q \tag{since $q = 16N + 9 \ge 297$}\\ &\ge \frac{296}{297} \frac{e^{-\frac{37}{18}}}{q^{\frac{1}{50 \ln q}}} q & \tag{since $\beta \le \frac{1}{50 c_4 \ln q}$} \\ &= \frac{296}{297} e^{-\frac{37}{18} - \frac{1}{50}} q\\ &> \frac{q}{8} \\ &\ge 2N+1 \tag*{(since $q \ge 16N + 9$).} \\ \end{align*} It follows that \[ \frac{H(\beta)}{H(\beta)+1} = 1 - (H(\beta)+1)^{-1} \ge 1 - (2N+1)^{-1} = \frac{2N}{2N+1}. \] Note, as well that $c_4 + c_4 \ln \beta - c_4 \ln q = c_4 \left( 1 + \ln \textstyle{\frac{\beta}{q}} \right) < c_4 \left( 1 + \ln \textstyle{\frac{1}{q}} \right) < 0$. It now follows by the equation at line~\eqref{eq:definition_of_hprime} that \begin{align*} h'(\beta) &= \ln (q-1) - 2 \ln \beta + \ln (1-\beta) -1 + \frac{H(\beta)}{H(\beta) +1} (c_4 + c_4 \ln \beta - c_4 \ln q) \\ &\le \ln (q-1) - 2 \ln \beta + \ln (1-\beta) - 1 + \textstyle{\frac{2N}{2N+1}} (c_4 + c_4 \ln \beta - c_4 \ln q) \\ &= \ln (q-1) - 2 \ln \beta + \ln (1-\beta) - 1 + 2(1+ \ln \beta - \ln q) \tag{since $c_4 = 2 + \frac{1}{N} = \frac{2N+1}{N}$} \\ &< - \ln q + \ln (1 - \beta) + 1 < 0, \end{align*} as required. \end{proof} A different approach is required for larger values of~$\beta$ because $h'(\beta)$ is eventually positive. Note that $g(\beta) = g_1(\beta) + g_2(\beta)$, where \begin{equation} \label{eq:definition_of_g1} g_1(\beta) = \frac{(q-1)^{\beta}}{\beta^{2\beta} (1-\beta)^{1-\beta}} \cdot \frac{1}{q} = q^{-1} (q-1)^{\beta} \cdot \frac{(1-\beta)^{\beta-1}}{\beta^{2\beta}} \end{equation} and \begin{equation} \label{eq:definition_of_g2} g_2(\beta) = \frac{(q-1)^{\beta}}{\beta^{2\beta} (1-\beta)^{1-\beta}} \cdot \left( \frac{q-1}{q} \right) \left( \frac{\beta}{q} \right)^{c_4 \beta} =\left( 1-\frac{1}{q}\right) \frac{\beta^{\beta/N}}{ \left( \frac{q^{c_4-1}}{1-\beta} \right)^{\beta} (1- \beta)}. \end{equation} \begin{lemma} \label{lem:second_asymptotic_interval} If $\frac{1}{50 c_4 \ln q} \le \beta \le \frac{7}{8}$ then $g(\beta) \le 1$. \end{lemma} \begin{proof} Consider first the function \[ k(x) = \frac{(1-x)^{x-1}}{x^{2x}} \] and \[ \ell(x) = \ln k(x) = (x-1) \ln (1-x) - 2x \ln x, \] noting that \[ \ell'(x) = \ln (1-x) - 2 \ln x - 1 \] and \[ \ell''(x) = - \frac{1}{1-x} - \frac{2}{x}, \] so that $\ell''(x) < 0$ when $0 < x < 1$. Note that $\ell'(x) = 0$ when \[ \frac{1-x}{x^2} = e, \] that is, when $e x^2 + x - 1 = 0$. Applying the quadratic equation, one can see that the functions $k(x)$ and~$\ell(x)$ are both increasing when $0 < x < \frac{-1 + \sqrt{1+4e}}{2e}$, and decreasing when $\frac{1 + \sqrt{1+4e}}{2e} < x < 1$. In particular, $k(x) \le k\left(\frac{-1 + \sqrt{1 + 4e}}{2e}\right) < 3$ for $0 < x < 1$. This be used to obtain upper bounds for the function~$g_1$, shown at line~\eqref{eq:definition_of_g1}, above, over various intervals. Suppose, in particular, that $k(\beta) \le \delta$ when $\Delta_L < \beta \le \Delta_H$ for constants $\delta$, $\Delta_L$ and~$\Delta_H$ such that $0 < \Delta_L < \Delta_H < 1$. It follows that if $\Delta_L < \beta \le \Delta_H$ then \[ g_1(\beta) \le \delta q^{-1} (q-1)^{\beta} \le {\textstyle{\frac{\delta}{297}}} 296^{\beta} \quad \text{when $\beta \le \textstyle{\frac{7}{8}}$} \] since $q \ge 297$; this upper bound for $g_2(\beta)$ is increasing with $\beta$. Note, as well, that, since $\frac{x}{1+x} \le \ln (1+x) \le x$ for any real number~$x$ such that $x > -1$, $-\frac{x}{1-x} \le \ln (1-x) \le -x$ for any real number~$x$ such that $0 < x < 1$. Consequently $-x \le (1-x) \ln (1-x) \le -x + x^2$, so that \[ e^{-x} \le (1-x)^{1-x} \le e^{-x+x^2}, \] and (replacing $x$ with $1-x$, and applying the bounds for $(1-x)^{1-x}$) \[ e^{1-x} \le x^x \le e^{-x+x^2} \] when $0 < x < 1$. Thus, if $g_2(\beta)$ is as given at line~\eqref{eq:definition_of_g2}, above, then \begin{align*} \label{eq:bound_for_g2} g_2(\beta) &= \left( 1 - \frac{1}{q} \right) \frac{\beta^{\beta/N}}{\left( \frac{q^{c_4-1}}{1-\beta}\right)^{\beta} (1-\beta)} \\ &\le \left( 1 - \frac{1}{q} \right) \frac{1}{q^{(c_4 -1)\beta} (1-\beta)^{1-\beta}} \tag{since $\beta^{\beta} \le e^{-\beta + \beta^2} \le 1$} \\ &\le \left( 1 - \frac{1}{q} \right) \left( \frac{e}{q^{c_4-1}} \right)^{\beta} & \tag{since $(1-\beta)^{1-\beta} \ge e^{-\beta}$} \\ &< \left( 1 - \frac{1}{q} \right) \left( \frac{e}{q} \right)^{\beta} \tag{since $c_4 > 2$} \\ &\le {\textstyle{\frac{296}{297}}} \left( {\textstyle{\frac{e}{297}}} \right)^{\beta} \tag*{(since $q \ge 297$).} \end{align*} Since $q > e$, this upper bound for $g_2(\beta)$ is certainly decreasing as $\beta$ increases. It follows by Lemma~\ref{lem:first_asymptotic_interval} that $g(\beta) = g_1(\beta) + g_2(\beta) < 1$ when $\beta = \frac{1}{50 c_4 \ln q}$. Now \begin{align*} g_2 \left( {\textstyle{\frac{1}{50 c_4 \ln q}}} \right) &\le \left( {\textstyle{1 - \frac{1}{q}}} \right) \left( {\textstyle{\frac{e}{q}}} \right)^{\frac{1}{50 c_4 \ln q}} \\ &\le \left( {\textstyle{1 - \frac{1}{q}}} \right) \left( e^{\frac{1}{50 c_4}} \right)^{\frac{1}{\ln q} - 1} \\ &\le \left( e^{\frac{1}{50 c_4}} \right)^{\frac{1}{\ln q}-1}. \\ \end{align*} Since $e^{\frac{1}{50 c_4}} > 1$, $q \ge 297$, and the above exponent $\frac{1}{\ln q}- 1$ decreases as $q$ increases, it now follows that \[ g_2\left({\textstyle{\frac{1}{50 c_4 \ln q}}} \right) \le \left( e^{\frac{1}{50 c_4}} \right)^{\frac{1}{\ln 297} - 1}. \] Now, since $N \ge 18$, $c_4 \le \frac{37}{18}$ and $\frac{1}{50 c_4} \ge \frac{9}{925}$. Since the exponent in the above expression is negative, it now follows that \[ g_2\left({\textstyle{\frac{1}{50 c_4 \ln q}}} \right) \le \left( e^{\frac{9}{925}} \right)^{\frac{1}{\ln 297} - 1} < \frac{397}{400}. \] Since $g_2$ is decreasing with $\beta$ and $g_1$ is increasing with~$\beta$, it now suffices to choose a value~$\gamma$ such that $\frac{1}{50 c_4 \ln q} < \gamma \le \frac{7}{8}$, and $g_1(\gamma) \le \frac{3}{400}$ in order to conclude that $g(\beta) = g_1(\beta) + g_2(\beta) \le 1$ when $\frac{1}{50 c_4 \ln q} \le \beta \le \gamma$. Suppose now that $\gamma \le \frac{1}{8}$ as well; then $k(\gamma) \le k\left(\frac{1}{8}\right) \le 2$ so that $g_1(\beta) \le \frac{2}{297} 296^{\beta}$. It follows from that that if $\gamma = \frac{1}{75}$ then $\frac{1}{50 c_4 \ln q} < \frac{1}{75} < \frac{1}{8}$ and $g_1(\gamma) < \frac{3}{400}$, as required to conclude that $g(\beta) < 1$ when $\frac{1}{50 c_4 \ln q} \le \beta \le \frac{1}{75}$. Note next that $g_2\left(\frac{1}{75}\right) \le \frac{296}{297} \left( \frac{e}{297} \right)^{\frac{1}{75}} < \frac{19}{20}$. Since $g_2$ is decreasing with~$\beta$ and $g_1$ is increasing with $\beta$, it suffices to choose a value~$\widehat{\gamma}$ such that $\frac{1}{75} < \widehat{\gamma} \le \frac{7}{8}$ and $g(\widehat{\gamma}) < \frac{1}{20}$ in order to conclude that $g(\beta) \le 1$ when $\frac{1}{75} \le \beta \le \widehat{\gamma}$ as well. As noted above, $k(\beta) < 3$ when $0 < \beta < 1$, and it follows that $g_1(\beta) \le \frac{3}{297} 296^{\beta}$ for all such~$\beta$. It follows from this that if $\widehat{\gamma} = \frac{1}{4}$ then $g_1(\gamma) < \frac{1}{20}$, as needed to conclude that $g(\beta) \le 1$ when $\frac{1}{75} \le \beta \le \frac{1}{4}$. Now note that $g_2(\left(\frac{1}{4}\right) \le \frac{296}{97} \left( \frac{e}{297} \right)^{\frac{1}{4}} < \frac{1}{3}$. Since $g_2$ is decreasing with~$\beta$ and $g_1$ is increasing with~$\beta$ it suffices to choose a value $\widetilde{\gamma}$ such that $\frac{1}{4} < \widetilde{\gamma} \le \frac{7}{8}$ and $g(1)(\widetilde{\gamma}) \le \frac{2}{3}$ in order to conclude that $g(\beta)\le1$ when $\frac{1}{4} \le \beta \le \widetilde{\gamma}$. Once again, $g_1(\widetilde{\gamma}) \le \frac{3}{297} 296^{\widetilde{\gamma}}$, and this suffices to set $\widetilde{\gamma} = \frac{2}{3}$ in order to ensure that $g_1(\widetilde{\gamma}) < \frac{2}{3}$, as needed. Now $g_2(\left(\widetilde{\beta}\right) = g_2\left(\frac{2}{3}\right) < \frac{1}{20}$, so it suffices to choose $\overline{\gamma}$ such that $\frac{2}{3} < \overline{\gamma} \le \frac{7}{8}$ and $g_1(\overline{\gamma}) \le\frac{19}{20}$ in order to ensure that $g(\beta) \le 1$ when $\frac{2}{3} \le \beta \overline{\gamma}$. Now, $k(x) \le \frac{5}{2}$ when $\frac{2}{3} \le x \le \frac{7}{8}$, so that $g_1(x) \le \frac{5}{2} \cdot \frac{1}{297} \cdot 296^x$ for all $x$ in this range, and this can be used to establish that one can set $\overline{\beta} = \frac{4}{5}$ in order to ensure that the desired conditions are met. Finally, $g_2\left(\frac{4}{5}\right) < \frac{23}{1000}$ and $k(x) < \frac{99}{50}$ when $\frac{4}{5} \le x \le \frac{7}{8}$. This can be used to establish that $g_1(\left(\frac{7}{8}\right) < \frac{977}{1000}$, as needed to establish that $g(\beta) \le 1$ when $\frac{4}{5} \le \beta \le \frac{7}{8}$ and complete the proof of the claim. \end{proof} Once again the functions~$h(\beta)$, $h'(\beta)$ and~$H(\beta)$, shown at lines~\eqref{eq:definition_of_h}--\eqref{eq:definition_of_H}, are of use to prove the desired result for larger values of~$\beta$. \begin{lemma} \label{lem:third_asymptotic_interval} If $\frac{7}{8} \le \beta \le \frac{2N}{2N+1}$ then $g(\beta) \le 1$. \end{lemma} \begin{proof} Consider the functions~$h(\beta)$, $h'(\beta)$ and~$H(\beta)$. Note first that if $\frac{7}{8} \le \beta \le \frac{2N}{2N+1}$ then \begin{align*} H(\beta)&= (q-1) \left({\textstyle{\frac{\beta}{q}}}\right)^{c_4 \beta} \\ &\le (q-1) \left({\textstyle{\frac{1}{q}}}\right)^{c_4 \beta}\tag{since $\beta < 1$, $q >0$,and $c_4 \beta > 1$} \\ &\le q^{1 - c_4 \beta} \\ &\le q^{-\frac{3}{4}} \tag*{(since $c_4 \ge 2$ and $\beta \ge \frac{7}{8}$, so that $1 - c_4 \beta \le - \frac{3}{4}$).} \end{align*} Since $H(\beta) \ge 0$ as well, it follows that \[ \frac{H(\beta)}{H(\beta)+1} \le H(\beta) \le q^{-\frac{3}{4}} \] as well. Since $c_4 = 2 + \frac{1}{N} \le 2 + \frac{1}{18} = \frac{37}{18}$, \[ c_4 \frac{H(\beta)}{H(\beta)+1} \le \frac{37}{18} \cdot q^{-\frac{3}{4}}. \] Since $1 + \ln \beta - \ln q < 0$ it now follows that \begin{align*} h'(\beta) &= \ln (q-1) - 2 \ln \beta + \ln (1-\beta) - 1 + \frac{H(\beta)}{H(\beta)+1} (c_4 + c_4 \ln \beta - c_4 \ln q) \\ &\ge \ln (q-1) - 2 \ln \beta + \ln (1-\beta) - 1 + \frac{37}{18} \cdot q^{-\frac{3}{4}} (1 + \ln \beta + \ln q) \\ &\ge \ln (16N+8) - 2 \ln \beta + \ln \left(\frac{1}{2N+1}\right) - 1 + \frac{37}{18} \cdot q^{-\frac{3}{4}} (1 + \ln \beta + \ln q) \tag{since $q-1 \ge 16N+8$ and $1 - \beta \ge \frac{1}{2N+1}$} \\ &= \ln 8 - 2 \ln \beta - 1 + \frac{37}{18} \cdot q^{-\frac{3}{4}}(1 + \ln \beta + \ln q) \\ &= (\ln 8 - 1 + {\textstyle{\frac{37}{18}}} \cdot q^{-\frac{3}{4}} (1 + \ln q)) - (2 - {\textstyle{\frac{37}{18}}} \cdot q^{-\frac{3}{4}}) \ln \beta \\ &\ge {\textstyle{\frac{9}{10}}} - (2 - {\textstyle{\frac{37}{18}}} \cdot q^{-\frac{3}{4}}) \ln \beta \tag{since $\ln 8 - 1 + {\textstyle{\frac{37}{18}}} \cdot q^{-\frac{3}{4}} (1 + \ln q) \ge \ln 8 - 1 + {\textstyle{\frac{37}{18}}} \cdot 267^{-\frac{3}{4}} (1 + \ln 267) \le {\textstyle{\frac{9}{10}}}$} \\ &\ge {\textstyle{\frac{9}{10}}} \tag{since $\ln \beta < 0$ and $2 - {\textstyle{\frac{37}{18}}} \cdot q^{-\frac{3}{4}} \ge 2 - {\textstyle{\frac{37}{18}}} \cdot 267^{-\frac{3}{4}} \ge {\textstyle{\frac{19}{10}}} > 0$} \\ &> 0. \end{align*} Thus the function $h(\beta)$ is increasing over the interval $\frac{7}{8} \le \beta \le \frac{2N}{2N+1}$. Since $h(\beta) = \ln g(\beta)$, the function $g(\beta)$ is increasing as well --- and it suffices to confirm that $g\left(\frac{2N}{2N+1}\right) \le 1$ in order to establish the claim. Now recall that $g\left(\frac{2N}{2N+1}\right) = g_1\left(\frac{2N}{2N+1}\right) + g_2\left(\frac{2N}{2N+1}\right)$, for the functions~$g_1(\beta)$ and~$g_2(\beta)$ as defined at lines~\eqref{eq:definition_of_g1} and~\eqref{eq:definition_of_g2} respectively. Applying these definitions one can see that \begin{align*} g_1\left({\textstyle{\frac{2N}{2N+1}}}\right) &= q^{-1} (q-1)^{\frac{2N}{2N+1}} \frac{\left({\textstyle{\frac{1}{2N+1}}}\right)^{-\frac{1}{2N+1}}} {\left({\textstyle{\frac{2N}{2N+1}}}\right)^{\frac{4N}{2N+1}}} \\ &= \left( 1 - {\textstyle{\frac{1}{q}}} \right) \frac{(q-1)^{-\frac{1}{2N+1}} \cdot \left( {\textstyle{\frac{1}{2N+1}}} \right)^{-\frac{1}{2N+1}}} {\left( {\textstyle{\frac{2N}{2N+1}}} \right)^{\frac{4N}{2N+1}}} \\ &\le \frac{16N+8}{16N+9} \cdot \frac{\left((16N+8) \cdot \left( {\textstyle{\frac{1}{2N+1}}}\right)\right)^{-\frac{1}{2N+1}}} {\left( {\textstyle{\frac{2N}{2N+1}}} \right)^{\frac{4N}{2N+1}}} \tag{since $q \ge 16N+9$} \\ &= \frac{16N+8}{16N+9} \cdot \frac{8^{-\frac{1}{2N+1}}} {\left( {\textstyle{\frac{2N}{2N+1}}} \right)^{\frac{4N}{2N+1}}} \\ &\le \frac{16N+8}{16N+9} \cdot \frac{8^{-\frac{1}{2N+1}}} {e^{-\frac{2}{2N+1}}} \tag{since ${\textstyle{\left( \frac{2N}{2N+1} \right)}}^{\frac{4N}{2N+1}} \ge e^{-\frac{2}{2N+1}}$} \\ &= \frac{16N+8}{16N+9} \cdot \left( \frac{e^2}{8} \right)^{\frac{1}{2N+1}} \\ &\le \frac{16N+8}{16N+9} \tag{since $\textstyle{\frac{e^2}{8}} < 1$} \end{align*} and \begin{align*} g_2\left({\textstyle{\frac{2N}{2N+1}}}\right) &= \left(1 - {\textstyle{\frac{1}{q}}}\right) \frac{\left( {\textstyle{\frac{2N}{2N+1}}} \right)^{\frac{2}{2N+1}} } { \left( \frac{q^{\frac{N+1}{N}}}{\frac{1}{2N+1}} \right)^{\frac{2N}{2N+1}} \left( {\textstyle{\frac{1}{2N+1}}} \right) } \\ &= \left(1 - {\textstyle{\frac{1}{q}}}\right) \frac{\left( {\textstyle{\frac{2N}{2N+1}}} \right)^{\frac{2}{2N+1}} } { \left( q^{\frac{N+1}{N}} \right)^{\frac{2N}{2N+1}} \left( {\textstyle{\frac{1}{2N+1}}} \right)^{\frac{1}{2N+1}} } \\ &= \left(1 - {\textstyle{\frac{1}{q}}}\right) \frac{\left( {\textstyle{\frac{(2N)^2}{2N+1}}} \right)^{\frac{1}{2N+1}} q^{-\frac{1}{2N+1}} } {q} \\ &\le \left(1 - {\textstyle{\frac{1}{q}}}\right) \frac{\left( {\textstyle{\frac{(2N)^2}{(2N+1)^2}}} \right)^{\frac{1}{2N+1}} }{q} \tag{since $q \ge 16N+9 \ge 2N+1$} \\ &\le \left(1 - {\textstyle{\frac{1}{q}}}\right) \cdot {\textstyle{\frac{1}{q}}} \\ &\le \frac{1}{q} \\ &\le \frac{1}{16N+9} \tag{since $q \ge 16N+9$} \end{align*} as needed to establish that $g\left(\frac{2N}{2N+1}\right) \le 1$ and complete the proof. \end{proof} The following is now a straightforward consequence of Lemmas~\ref{lem:first_asymptotic_interval}--\ref{lem:third_asymptotic_interval}. \begin{corollary} \label{cor:asymptotic_primes} If $N \ge 18$, $c_4$ and~$q$ are as shown at line~\eqref{eq:asymptotic_constraints_on_constants}, and $\beta_0 = \frac{2}{c_4} = \frac{2N}{2N+1}$, the the inequality at line~\eqref{eq:big_goal} is satisfied. \end{corollary} \subsection{Splitting the Sum to Get a Better Bound for $\boldsymbol{\rho_0}$} \label{ssec:splitting_sum} Let $\epsilon$ be a positive constant. Suppose now that $\Delta$ is a positive integer whose depends on~$\epsilon$ and the field size~$q$. It follows from the above (for appropriate choices of~$q$, $\beta_0$ and~$c_4$) that \begin{align*} \rho_0 &\le \sum_{1 \le j < k \beta_0} \beta^{k \beta} \\ &= \sum_{1 \le j < k \beta_0} \left(\frac{j}{k}\right)^j & \tag{since $\beta = \frac{j}{k}$} \\ &= \zeta+ \theta, \end{align*} where \begin{equation} \label{eq:defn_of_zeta} \zeta = \sum_{1 \le j \le \Delta} \left( \frac{j}{k} \right)^j \end{equation} and \begin{equation} \label{eq:defn_of_theta} \theta = \sum_{\Delta < j < k \beta_0} \left( \frac{j}{k} \right)^j. \end{equation} It follows from the above that \begin{align*} \theta &\le \sum_{\Delta < j \le k \beta_0} \left( \frac{j}{k} \right) ^j\\ &\le \sum_{\Delta < j \le k \beta_0} \beta_0^j \\ &\le \beta_0^{\Delta + 1} \sum_{j \ge 0} \beta_0^j \\ &= \frac{\beta_0^{\Delta+1}}{1 - \beta_0} \\ &\le {\textstyle{\frac{1}{10}}} \epsilon \end{align*} provided that \[ \Delta \ge \frac{\ln (\epsilon^{-1}) + \ln 10 - \ln (1 - \beta_0)}{\ln (1/\beta_0)} - 1. \] Choices of~$\Delta$ that satisfy this inequality for various field sizes (and corresponding choices of~$\beta_0$) are shown in Figure~\ref{fig:choices_of_Delta} on page~\pageref{fig:choices_of_Delta}. \begin{figure}[t!] \begin{center} \begin{tabular}{ccc|ccc|ccc} $q$ & $\beta_0$ & $\Delta$ & $q$ & $\beta_0$ & $\Delta$ & $q$ & $\beta_0$ & $\Delta$ \\[2pt] \hline $2$ \rule{0pt}{12pt} & $\frac{6}{43}$ & $\lceil \frac{51}{100} \ln (\epsilon^{-1}) + \frac{1}{4} \rceil$ & $9$ & $\frac{6}{11}$ & $\lceil \frac{33}{20} \ln (\epsilon^{-1}) + \frac{41}{10} \rceil$ & $47$--$59$ & $\frac{6}{7}$ & $\lceil \frac{13}{2} \ln (\epsilon^{-1}) + \frac{133}{5} \rceil$ \\ $3$ \rule{0pt}{12pt} & $\frac{1}{4}$ & $\lceil \frac{73}{100} \ln (\epsilon^{-1}) + \frac{9}{10} \rceil$ & $11$ & $\frac{4}{7}$ & $\lceil \frac{179}{100} \ln (\epsilon^{-1}) + \frac{47}{10} \rceil$ & $61$--$71$ & $\frac{8}{9}$ & $\lceil \frac{17}{2} \ln (\epsilon^{-1}) + \frac{149}{4} \rceil$ \\ $4$ \rule{0pt}{12pt} & $\frac{8}{25}$ & $\lceil \frac{22}{25} \ln (\epsilon^{-1}) + \frac{7}{5} \rceil$ & $13$ & $\frac{3}{5}$ & $\lceil \frac{49}{25} \ln (\epsilon^{-1}) + \frac{107}{20} \rceil$ & $73$--$83$ & $\frac{10}{11}$ & $\lceil \frac{21}{2} \ln (\epsilon^{-1}) + \frac{242}{5} \rceil$ \\ $5$ \rule{0pt}{12pt} & $\frac{3}{8}$ & $\lceil \frac{51}{50} \ln (\epsilon^{-1}) + \frac{19}{10} \rceil$ & $16$--$19$ & $\frac{2}{3}$ & $\lceil \frac{99}{40} \ln (\epsilon^{-1}) + \frac{37}{5} \rceil$ & $\ge 89$ & $\frac{12}{13}$ & $\lceil \frac{25}{2} \ln (\epsilon^{-1}) + \frac{599}{10} \rceil$ \\ $7$ \rule{0pt}{12pt} & $\frac{6}{13} $ & $\lceil \frac{13}{10} \ln (\epsilon^{-1}) + \frac{14}{5} \rceil$ & $23$--$29$ & $\frac{3}{4}$ & $\lceil \frac{87}{25} \ln (\epsilon^{-1}) + \frac{119}{10} \rceil$ & \\ $8$ \rule{0pt}{12pt} & $\frac{1}{2}$ & $\lceil \frac{29}{20} \ln (\epsilon^{-1}) + \frac{17}{5} \rceil$ & $31$--$43$ & $\frac{4}{5}$ & $\lceil \frac{9}{2} \ln (\epsilon^{-1}) + \frac{50}{3} \rceil$ & \\ \end{tabular} \end{center} \caption{Choices of $\Delta$ for Various Field Sizes} \label{fig:choices_of_Delta} \end{figure} When $N \ge 18$ and $\beta_0 = \frac{2N}{2N+1}$ (as in Subsection~\ref{ssec:asymptotics_1}) \begin{align*} \frac{\ln (\epsilon^{-1}) + \ln 10 - \ln(1 - \beta_0)}{\ln(1/\beta_0} - 1 &= \frac{\ln (\epsilon^{-1} + \ln 10 - \ln \left( {\textstyle{\frac{1}{2N+1}}}\right)}{\ln \left(1 + {\textstyle{\frac{1}{2N}}}\right)} - 1 \\ &\le \frac{\ln (\epsilon^{-1}) + \ln 10 + \ln (2N+1)}{{\textstyle{\frac{1}{2N+1}}}} - 1 \tag{since $\ln \left(1 + \frac{1}{2N}\right) \ge \frac{1}{2N+1}$} \\ &= (2N+1) \ln (\epsilon^{-1}) + (2N+1) \ln (2N+1) + (2N+1) \ln 10 - 1. \end{align*} It therefore suffices to ensure that \[ \Delta \ge \lceil (2N+1) \ln (\epsilon^{-1}) + (2N+1) \ln (2N+1) + (2N+1) \ln 10 - 1 \rceil \] in this case. It also follows from the above that \begin{align*} \zeta &\le \sum_{1 \le j \le \Delta} \left( \frac{j}{k} \right)^j \\ &\le \sum_{1 \le j \le \Delta} \left( \frac{\Delta}{k} \right)^j \\ &< \sum_{j \ge 1} \left( \frac{\Delta}{k} \right)^j \\ &= \frac{\Delta/k}{1-\Delta/k} \\ &\le \textstyle{\frac{4}{5}} \epsilon \end{align*} provided that $k \ge \lceil (\frac{5}{4} \epsilon^{-1} + 1) \Delta \rceil$, and this is the case if $k \ge \lceil (\frac{5}{4} \epsilon^{-1} + 1) (\widehat{\Delta} + 1) \rceil$, where $\Delta = \lceil \widehat{\Delta} \rceil$. Suitable choices of~$k$ for small field sizes are as shown in Figure~\ref{fig:choices_of_k} on page~\pageref{fig:choices_of_k}. \begin{figure}[t!] \begin{center} \begin{tabular}{c|c|c} $q$ & Lower Bound for $k$ & Bound when $\epsilon = \frac{1}{10}$ \\[2pt] \hline $2$ \rule{0pt}{12pt} & $\lceil \frac{51}{80} \epsilon^{-1} \ln (\epsilon^{-1}) + \frac{25}{16} \epsilon^{-1} + \frac{51}{100} \ln (\epsilon^{-1}) + \frac{5}{4} \rceil$ & $33$ \\ $3$ \rule{0pt}{12pt} & $\lceil \frac{73}{80} \epsilon^{-1} \ln (\epsilon^{-1}) + \frac{19}{8} \epsilon^{-1} + \frac{73}{100} \ln (\epsilon^{-1}) + \frac{19}{10} \rceil$ & $49$ \\ $4$ \rule{0pt}{12pt} & $\lceil \frac{11}{10} \epsilon^{-1} \ln (\epsilon^{-1}) + 3 \epsilon^{-1} + \frac{22}{25} \ln (\epsilon^{-1}) + \frac{12}{5} \rceil$ & $60$ \\ $5$ \rule{0pt}{12pt} & $\lceil \frac{51}{40} \epsilon^{-1} \ln (\epsilon^{-1}) + \frac{29}{8} \epsilon^{-1} + \frac{51}{50} \ln (\epsilon^{-1}) + \frac{29}{10} \rceil$ & $71$ \\ $7$ \rule{0pt}{12pt} & $\lceil \frac{13}{8} \epsilon^{-1} \ln (\epsilon^{-1}) + \frac{19}{4} \epsilon^{-1} + \frac{13}{10} \ln (\epsilon^{-1}) + \frac{19}{5} \rceil$ & $92$ \\ $8$ \rule{0pt}{12pt} & $\lceil \frac{29}{16} \epsilon^{-1} \ln (\epsilon^{-1}) + \frac{11}{2} \epsilon^{-1} + \frac{29}{20} \ln (\epsilon^{-1}) + \frac{22}{5} \rceil$ & $105$ \\ $9$ \rule{0pt}{12pt} & $\lceil \frac{33}{16} \epsilon^{-1} \ln (\epsilon^{-1}) + \frac{51}{8} \epsilon^{-1} + \frac{33}{20} \ln (\epsilon^{-1}) + \frac{51}{10} \rceil$ & $121$ \\ $11$ \rule{0pt}{12pt} & $\lceil \frac{179}{80} \epsilon^{-1} \ln (\epsilon^{-1}) + \frac{57}{8} \epsilon^{-1} + \frac{179}{100} \ln (\epsilon^{-1}) + \frac{57}{10} \rceil$ & $133$ \\ $13$ \rule{0pt}{12pt} & $\lceil \frac{49}{20} \epsilon^{-1} \ln (\epsilon^{-1}) + \frac{127}{16} \epsilon^{-1} + \frac{49}{25} \ln (\epsilon^{-1}) + \frac{127}{20} \rceil$& $147$ \\ $16$--$19$ \rule{0pt}{12pt} & $\lceil \frac{99}{32} \epsilon^{-1} \ln (\epsilon^{-1}) + \frac{21}{2} \epsilon^{-1} + \frac{99}{40} \ln (\epsilon^{-1}) + \frac{42}{5} \rceil$& $191$ \\ $23$--$29$ \rule{0pt}{12pt} & $\lceil \frac{87}{20} \epsilon^{-1} \ln (\epsilon^{-1}) + \frac{129}{8} \epsilon^{-1} + \frac{87}{25} \ln (\epsilon^{-1}) + \frac{129}{10} \rceil$ & $283$ \\ $31$--$43$ \rule{0pt}{12pt} & $\lceil \frac{45}{8} \epsilon^{-1} \ln (\epsilon^{-1}) + \frac{265}{12} \epsilon^{-1} + \frac{9}{2} \ln (\epsilon^{-1}) + \frac{53}{3} \rceil$ & $379$ \\ $47$--$59$ \rule{0pt}{12pt} & $\lceil \frac{65}{8} \epsilon^{-1} \ln (\epsilon^{-1}) + \frac{69}{2} \epsilon^{-1} + \frac{13}{2} \ln (\epsilon^{-1}) + \frac{138}{5} \rceil$ & $575$ \\ $61$--$71$ \rule{0pt}{12pt} & $\lceil \frac{85}{8} \epsilon^{-1} \ln (\epsilon^{-1}) + \frac{765}{16} \epsilon^{-1} + \frac{17}{2} \ln (\epsilon^{-1}) + \frac{153}{4} \rceil $ & $781$ \\ $73$--$83$ \rule{0pt}{12pt} & $\lceil \frac{105}{8} \epsilon^{-1} \ln (\epsilon^{-1}) + \frac{247}{4} \epsilon^{-1} + \frac{21}{2} \ln (\epsilon^{-1}) + \frac{247}{5} \rceil$ & $994$ \\ $\ge 89$ \rule{0pt}{12pt} & $\lceil \frac{125}{8} \epsilon^{-1} \ln (\epsilon^{-1}) + \frac{609}{8} \epsilon^{-1} + \frac{25}{2} \ln (\epsilon^{-1}) + \frac{609}{10} \rceil$& $1211$ \end{tabular} \end{center} \caption{Choices of~$k$ for Various Field Sizes} \label{fig:choices_of_k} \end{figure} When $N \ge18$, $c_4 = 2 + \frac{1}{N}$, and $\beta_0 =\frac{2}{c_4} = \frac{2N}{2N+1}$, it suffices that \begin{multline} \label{eq:asymptotic_bound_for_k} k \ge \left\lceil \left({\textstyle{\frac{5}{4}}} \epsilon^{-1} + 1\right) ((2N+1) \ln (\epsilon^{-1}) + (2N+1) \ln (2N+1) + (2N+1) \ln 10 \right\rceil \\ \in \Theta(\epsilon^{-1} N(\ln (\epsilon^{-1}) + \ln N)). \end{multline} In particular, when $\epsilon = \frac{1}{10}$, it suffices to ensure that \begin{equation} \label{eq:asymptotic_bound_for_k_with_specific_failure_probability} k \ge \left\lceil (2N+1) \ln (2N+1) = {\textstyle{\frac{167}{5}}} \ln (2N+1) \right\rceil. \end{equation} It now follows that $\rho_0 \le \frac{1}{10} \epsilon + \frac{4}{5} \epsilon = \frac{9}{10} \epsilon$ provided that this constraint on~$k$ can be satisfied. \subsection{Completion of the Analysis for the Case $\boldsymbol{q \le n^2}$} Suppose next that one wishes to ensure that $\rho_1 \le \frac{1}{20}\epsilon$, so that $\rho \le \frac{19}{20} \epsilon$. If the constraint on~$k$, described above, can be satisfied, then it follows by the inequality at line~\eqref{eq:bound_for_rho1} that it suffices to choose~$c_2$ such that $2q^{-c_2} \le \frac{\epsilon}{20}$, that is, \[ c_2 \ge \log_q (40 \epsilon^{-1}) = \frac{\ln (\epsilon^{-1}) + \ln 40}{\ln q}. \] It remains to choose $c_2 + \ell$ rows of the $(n + \ell) \times n$ matrix~$B$ uniformly and independently from $\matgrp{\ensuremath{\textup{\textsf{F}}}}{1}{n}$. Suppose that that the set of rows of the original matrix~$A$, and the $k$ ``sparse'' rows selected as described above, are linearly independent. Then it follows by Lemma~\ref{lem:dense_selection_of_vectors} that (once the remaining rows of~$B$ are chosen uniformly and independently) the rank of~$B$ is less than~$n$ with probability at most~$q^{-\ell}$. Furthermore, if $q \ge 3$ then the top $n$~rows of~$B$ are linearly independent --- so that we can set $\ell = 0$ --- with probability at least $1 - \frac{1}{q-1}$. Thus, if we wish to ensure that this probability is at most $\frac{1}{20}\epsilon$ then it suffices to ensure that either \[ \ell \ge \log_q (20 \epsilon^{-1}) = \textstyle{\frac{\ln (\epsilon^{-1}) + \ln 20}{\ln q}} \quad \text{or} \quad q \ge 20 \epsilon^{-1} + 1 \text{ (and $\ell = 0$).} \] It now follows that if $c_4$, $c_2$ and~$\ell$ have all been chosen as described above then the probability that $B$ has rank less than~$n$ is at most \[ \rho + \frac{\epsilon}{20} (1-\rho) \le \rho + \frac{\epsilon}{20} \le \frac{19 \epsilon}{20} + \frac{\epsilon}{20} = \epsilon. \] Choices of~$c_2$ and~$\ell$ satisfying the above constraints, along with the constraints at line~\eqref{eq:constraints_on_c2_and_c4}, are shown in Figure~\ref{fig:choices_of_c2_and_ell}, for the case that $\epsilon = \frac{1}{10}$. \begin{figure}[t!] \begin{center} \begin{tabular}{ccc|ccc|ccc} $q$ & $c_2$ & $\ell$ & $q$ & $c_2$ & $\ell$ & $q$ & $c_2$ & $\ell$ \\ \hline $2$ \rule{0pt}{12pt} & $9$ & $8$ & $5$ & $4$ & $4$ & $16$--$19$ & $3$ & $2$ \\ $3$ \rule{0pt}{12pt} & $6$ & $5$ & $7$ & $4$ & $3$ & $23$--$89$ & $2$ & $2$ \\ $4$ \rule{0pt}{12pt} & $5$ & $4$ & $8$--$13$ & $3$ & $3$ & & \end{tabular} \end{center} \caption{Choices of~$c_2$ and~$\ell$ for Various Field Sizes when $\epsilon = \frac{1}{10}$} \label{fig:choices_of_c2_and_ell} \end{figure} It now suffices to set $\sigma = c_3 \left( \frac{q-1}{q} \right)= 3 c_4 \left( \frac{q-1}{q} \right)$, for $c_4$ as given in Figure~\ref{fig:choices_of_c4} and $\tau = c_2 + \ell$, for $c_2$ and~$\ell$ as given in Figure~\ref{fig:choices_of_c2_and_ell}, in order to establish the claim in Theorem~\ref{thm:constants_for_conditioner} when $k = n - m - c_2$ is greater than or equal to the lower bound given in Subsection~\ref{ssec:splitting_sum} and $q \le n^2$, for $c_2$ as given above. Setting $\upsilon$ to be the sum of~$\ell$ and the lower bound for~$k$, described in Subsection~\ref{ssec:splitting_sum}, suffices to establish these claims when $n - m - c_2$ is less than the lower bound for~$k$ and $q \le n^2$ as well, for $c_2$ as above. The values shown in Figure~\ref{fig:summary_table} have been obtained using these equations. Similarly, Theorem~\ref{thm:second_constants_for_conditioner} can be obtained by setting $c_4 = 2 + \frac{1}{N}$ for $N \ge 18$, $c_3 = 3 c_4 = 6 + \frac{3}{N}$, $\sigma = c_3 (1 - \frac{1}{q})$, $c_2 = \left\lceil \frac{\ln (40 \epsilon^{-1})}{\ln q} \right\rceil$, $\ell = \left\lceil \frac{\ln 20 \epsilon^{-1}}{ln q} \right\rceil$ if $\ell \le 20 \epsilon^{-1} + 1$, setting $\ell = 0$ otherwise, setting $\tau = c_2 + \ell$, and setting $\upsilon$ to the sum of~$\ell$ and the lower bound for~$k$ described in Subsection~\ref{ssec:splitting_sum}, above. \subsection{Analysis for the Case $\boldsymbol{q > n^2}$} A slight variant of the argument from Wiedemann~\cite{wied86} can be applied when $q > n^2$. Since dense linear algebra is certainly adequate for computations on small matrices it will be assumed that $n \ge 7$, so that $q \ge 49$. Suppose, once again, that $A$ is an $m \times n$ matrix over a field~$\ensuremath{\textup{\textsf{F}}}$ that is either infinite or has size $q > n^2$. Let $\widehat{q}$ be the largest power of a prime that is less than or equal to~$n^2$. It suffices to apply the above construction, using the choices of $c_4$, $c_3$, $\beta_0$, $c_2$ and~$\ell$ appropriate for a field with size~$\widehat{q}$ (so that $\ell = 0$) --- except that, after choosing entries of rows that might be nonzero, the remaining entries of the matrix~$B$, to be filled in, should be chosen uniformly and independently from a finite subset~$S$ of~$\ensuremath{\textup{\textsf{F}}}$ with size at least $n^2$, rather than from the finite field with size~$\widehat{q}$. In order to see that this process is reliable, consider yet another matrix --- namely, a matrix~$\widehat{B}$ obtained by placing a distinct indeterminate into each row entry that is assigned a value from~$S$, above, instead of~$0$. Let us denote the indeterminate placed into the $i^{\text{th}}$ new row, in column~$j$, by $z_{i, j}$. Since $\ell = 0$ this results in an $n \times n$ matrix whose entries are elements of~$\ensuremath{\textup{\textsf{F}}}$ and indeterminates. Let $\widehat{f}$ be the determinant of this matrix --- a multivariate polynomial with total degree at most $n-m$, since only $n-m$ rows include indeterminates, and each entry of such a row has total degree at most one. Since the rows of the $m \times n$ matrix~$A$ are linearly independent, there exists a sequence of integers $i_1, i_2, \dots, i_m$ such that \[ 1 \le i_1 < i_2 < \dots < i_m \le n \] and such that the $m \times m$ submatrix, including columns $i_1, i_2, \dots, i_m$, is nonsingular. Permuting rows of~$A$ as needed, we may assume without loss of generality that the entry of the $j^{\text{th}}$ row of~$A$ in column~$i_j$ is nonzero, for $1 \le j \le m$. Consequently, if the $j^{\text{th}}$ row of~$A$ was replaced by a row whose $i_j^{\text{th}}$ entry is~$1$ and whose other entries are~$0$, this would result in an $n \times m$ matrix~$\widehat{A}$ whose rows are linearly independent as well. Indeed, the $m \times m$ submatrix including the entries in columns $i_1, i_2,\dots, i_m$ would have determinant~$1$. Similarly, the rows of this matrix are linearly independent when the entries are viewed as elements of the finite field~$\ensuremath{\textup{\textsf{F}}}_{\widehat{q}}$ with size~$\widehat{q}$, instead of as elements of~$\ensuremath{\textup{\textsf{F}}}$. Let us call this matrix (an $m \times n$ matrix with entries in~$\ensuremath{\textup{\textsf{F}}}_{\widehat{q}}$) $\widetilde{A}$. Note that the process, described above, to produce new rows to obtain~$B$ from~$A$, is independent of the entries in the rows of~$A$ --- it only depends on the number~$m$ of rows and~$n$ of columns of~$A$. With that noted, let us consider yet another $n \times n$ matrix, namely a matrix with entries in~$F_{\widehat{q}}$ whose first $m$ rows are the rows of~$\widetilde{A}$ and whose remaining rows are produced by initially deciding to set the same entries of rows to~$0$ as for the new rows of~$B$, and whose remaining entries are chosen uniformly and independently from~$\ensuremath{\textup{\textsf{F}}}_{\widehat{q}}$. It follows by the analysis for the case $q \le n^2$ that this matrix is nonsingular with some probability $\sigma \ge \frac{8}{9}$. Let us suppose that this is the case. Then there must exist a set of column indices $i_{m+1}, i_{m+2}, \dots, i_n$ such that \[ 1 \le i_{m_1} < i_{m+2}, \dots, i_n \le n, \quad \{ i_1, i_2, \dots, i_m \} \cup \{i_{m+1}, i_{m+2}, \dots, i_n \} = \{1, 2, \dots, n \}, \] and the entries of~$\widetilde{A}$ in row~$j$ and column~$i_j$ are all nonzero, for $1 \le j \le n$. Consequently if $m+1 \le j \le n$ then the entry of~$\widehat{B}$ in row~$j$ and column~$i_j$ is an indeterminate, $z_{j-m, i_j}$, rather than zero. It now follows that the above polynomial~$\widehat{f}$ is not identically zero (in this case): For if one sets the value of each indeterminate $z_{j-m, i_j}$ to be~$1$ and one sets the value of all other indeterminates to be~$0$, then the value of this polynomial is the product of $\pm 1$ and the determinant of the submatrix of~$A$ including the entries in columns $i_1, i_2, \dots, i_m$ --- which is nonsingular, as noted above. It now follows by an application of the Schwartz-Zippel lemma~\cite{schwar80, zipp79} that the above matrix~$B$ is singular, in this particular case, with probability at most $\frac{n-m}{|S|} \le \frac{n}{|S|} \le \frac{1}{n}$. It follows that the overall probability that $B$ is singular is at most \[ (1 - \sigma) + \textstyle{\frac{\sigma}{n}} \le \textstyle{\frac{1}{9} + \frac{8}{9n}}, \] as needed to complete the proofs of Theorems~\ref{thm:constants_for_conditioner} and~\ref{thm:second_constants_for_conditioner}. \bibliographystyle{plain}
{'timestamp': '2016-07-18T02:07:18', 'yymm': '1607', 'arxiv_id': '1607.04514', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04514'}
arxiv
\section{Introduction} We study $r$-nets, a powerful tool in computational and metric geometry, with several applications in approximation algorithms. An $r$-net for a metric space $(X,\norm{\cdot}), \, |X|=n$ and for numerical parameter $r$ is a subset $R\subseteq X$ such that the closed $r/2$-balls centered at the points of $R$ are disjoint, and the closed $r$-balls around the same points cover all of $X$. We define approximate $r$-nets analogously. Formally, \begin{dfn} Given a pointset $X \subseteq {\mathbb R}^d$, a distance parameter $r \in {\mathbb R}$ and an approximation parameter $\epsilon >0$, a $(1+\epsilon)r$-net of $X$ is a subset $R \subseteq X$ s.t. the following properties hold: \begin{enumerate} \item (packing) For every $p, q \in R$, $p \neq q $, we have that $\norm{p-q}_2 \geq r$. \item (covering) For every $p \in X$, there exists a $q \in R$ s.t. $\norm{p-q}_2 \leq (1+\epsilon)r$. \end{enumerate} \end{dfn} \paragraph{Previous Work.} Finding $r$-nets can be addressed naively by considering all points of $X$ unmarked and, while there remains an unmarked point $p$, the algorithm adds it to $R$ and marks all other points within distance $r$ from $p$. The performance of this algorithm can be improved by using grids and hashing \cite{HP04}. However, their complexity remains too large when dealing with big data in high dimension. The naive algorithm is quadratic in $n$ and the grid approach is in $O(d^{d/2} n)$, hence it is relevant only for constant dimension $d$~\cite{HR15}. In \cite{HPM05}, they show that an approximate net hierarchy for an arbitrary finite metric can be computed in $O(2^{ddim}n \log n)$, where $ddim$ is the doubling dimension. This is satisfactory when doubling dimension is constant, but requires a vast amount of resources when it is high. When the dimension is high, there is need for algorithms with time complexity polynomial in $d$ and subquadratic in $n$. One approach, which computes $(1+\epsilon)r$-nets in high dimension is that of \cite{EHS15}, which uses the Locality Sensitive Hashing (LSH) method of \cite{AI08}. The resulting time complexity is $\tilde{O}(dn^{2-\Theta(\epsilon)})$, where $\epsilon>0$ is quite small and $\tilde{O}$ hides polylogarithmic factors. In general, high dimensional analogues of classical geometric problems have been mainly addressed by LSH. For instance, the approximate closest pair problem can be trivially solved by performing $n$ approximate nearest neighbor (ANN) queries. For sufficiently small $\epsilon$, this costs $\tilde{O}(dn^{2-\Theta(\epsilon)})$ time, due to the complexity factor of an LSH query. Several other problems have been reduced to ANN queries \cite{GIV01}. Recently, Valiant \cite{Val12}, \cite{Val15} presented an algorithm for the approximate closest pair problem in time $\tilde{O}(dn^{2-\Theta(\sqrt{\epsilon})})$. This is a different approach in the sense that while LSH exploits dimension reduction through random projections, the algorithm of \cite{Val15} is inspired by high dimensional phenomena. One main step of the algorithm is that of projecting the pointset up to a higher dimension. \paragraph{Our Contribution.} We present a new randomized algorithm that computes approximate $r$-nets in time subquadratic in $n$ and polynomial in the dimension, and improves upon the complexity of the best known algorithm. Our method does not employ LSH and, with probability $1-o(1)$, it returns $R\subset X$, which is a $(1+\epsilon)r$-net of $X$. We reduce the problem of an approximate $r$-net for arbitrary vectors (points) under Euclidean distance to the same problem for vectors on the unit sphere. Then, depending on the magnitude of distance $r$, an algorithm handling ``small" distances or an algorithm handling ``large" distances is called. These algorithms reduce the Euclidean problem of $r$-nets on unit vectors to finding an $r$-net for unit vectors under inner product (Section~\ref{SGeneral}). This step requires that the multiplicative $1+\epsilon$ approximation of the distance corresponds to an additive $c\epsilon$ approximation of the inner product, for suitable constant $c>0$. Next, we convert the vectors having unit norm into vectors with entries $\{-1, +1\}$ (Section \ref{SInner}). This transformation is necessary in order to apply the Chebyshev embedding of \cite{Val15}, an embedding that damps the magnitude of the inner product of ``far" vectors, while preserving the magnitude of the inner product of ``close" vectors. For the final step of the algorithm, we first apply a procedure that allows us to efficiently compute $(1+\epsilon)$-nets in the case where the number of ``small" distances is large. Then, we apply a modified version of the {\tt Vector Aggregation} algorithm of \cite{Val15}, that exploits fast matrix multiplication, so as to achieve the desired running time. In short, we extend Valiant's framework \cite{Val15} and we compute $r$-nets in time $\tilde{O}(dn^{2-\Theta(\sqrt{\epsilon})})$, thus improving on the exponent of the LSH-based construction \cite{EHS15}, when $\epsilon$ is small enough. This improvement by $\sqrt{\epsilon}$ in the exponent is the same as the complexity improvement obtained in \cite{Val15} over the LSH-based algorithm for the approximate closest pair problem. Our study is motivated by the observation that computing efficiently an $r$-net leads to efficient solutions for several geometric problems, specifically in approximation algorithms. In particular, our extension of $r$-nets in high dimensional Euclidean space can be plugged in the framework of~\cite{HR15}. The new framework has many applications, notably the $k$th nearest neighbor distance problem, which we solve in $\tilde{O}(dn^{2-\Theta(\sqrt{\epsilon})})$. \paragraph{Paper Organization.} Section \ref{SInner} presents an algorithm for computing an approximate net with respect to the inner product for a set of unit vectors. Section~\ref{SGeneral} translates the problem of finding $r$-nets under Euclidean distance to the same problem under inner product. In Section \ref{Sapps}, we discuss applications of our construction and possible future work. Omitted proofs are included in the Appendices. We use $\norm{\cdot}$ to denote the Euclidean norm $\norm{\cdot}_2$ throughout the paper. \section{Points on a sphere under inner product}\label{SInner} In this section, we design an algorithm for constructing an approximate $\rho$-net of vectors on the sphere under inner product. To that end, we reduce the problem to constructing an approximate net under absolute inner product for vectors that lie on the vertices of a unit hypercube. Since our ultimate goal is a solution to computing $r$-nets with respect to Euclidean distance, we allow additive error in the approximation, which under certain assumptions, translates to multiplicative error in Euclidean distance. In the following, we define rigorously the notion of approximate $\rho$-nets under inner product. \begin{dfn} \label{DfnNetInn} For any $X\subset {\mathbb S}^{d-1}$, an approximate $\rho$-net for $(X,\langle \cdot,\cdot\rangle)$ , with additive approximation parameter $\epsilon>0$, is a subset $C\subseteq X$ which satisfies the following properties: \begin{itemize} \item for any two $p \neq q \in C$, $\langle p, q \rangle < \rho$, and \item for any $x\in X$, there exists $p \in C$ s.t. $\langle x, p \rangle \geq \rho-\epsilon$. \end{itemize} \end{dfn} One relevant notion is that of $\epsilon$-kernels \cite{AHV05}. In $\epsilon$-kernels, one is interested in finding a subset of the input pointset, which approximates its directional width. Such constructions have been extensively studied when the dimension is low, due to their relatively small size. \subsection{Crude approximate nets} In this subsection we develop our basic tool, which is based on the Vector Aggregation Algorithm by \cite{Val15}. This tool aims to compute approximate $\rho$-nets with multiplicative error, as opposed to what we have set as our final goal for this section, namely to bound additive error. Moreover, in the context of this subsection, two vectors are close to each other when the magnitude of their inner product is large, and two vectors are far from each other when the magnitude of their inner product is small. Let $|\langle \cdot,\cdot \rangle|$ denote the magnitude of the inner product of two vectors. \begin{dfn} \label{DfnMagnInnNet} For any $X=[x_1,\ldots, x_n], X' =[x_1',\ldots,x_n'] \subset {\mathbb R}^{d \times n}$, a crude approximate $\rho$-net for $(X,X',|\langle \cdot,\cdot \rangle|)$, with multiplicative approximation factor $c>1$, is a subset $C\subseteq [n]$ which satisfies the following properties: \begin{itemize} \item for any two $i \neq j \in C$, $|\langle x_i, x_j' \rangle| < c \rho$, and \item for any $i\in [n]$, there exists $j \in C$ s.t.\ $|\langle x_i, x_j' \rangle| \geq \rho$. \end{itemize} \end{dfn} {\tt Vector Aggregation} follows the exposition of \cite{Val15}. The main difference is that, instead of the ``compressed'' matrix $Z^T Z$, we use the form $X^T Z$, where $Z$ derives from vector aggregation. Both forms encode the information in the Gram matrix $X^T X$. The matrix $X^TZ$ is better suited for our purposes, since each row corresponds to an input vector instead of an aggregated subset; this extra information may be useful in further problems. \begin{framed} {\tt Vector Aggregation}\\ Input: $X =[x_1,\ldots,x_n] \in {\mathbb R}^{d \times n}$, $X' =[x_1',\ldots,x_n'] \in {\mathbb R}^{d \times n}$, $\alpha \in (0,1)$, $\tau>0$. Output: $n\times n^{1-\alpha}$ matrix $W$ and random partition $S_1 , \ldots , S_{n^{1-\alpha}}$ of $\{x_1,\ldots,x_n\}$. \begin{itemize} \item Randomly partition $[n]$ into $n^{1-\alpha}$ disjoint subsets, each of size $n^{\alpha}$ , denoting the sets $S_1 , \ldots , S_{n^{1-\alpha}}$. \item For each $i = 1, 2, \ldots , 78 \log n$: \begin{itemize} \item Select $n$ coefficients $q_1 ,\ldots , q_n \in \{-1, +1\}$ at random. \item Form the $d\times n^{1-\alpha}$ matrix $Z^i$ with entries $z_{j,k}^i=\sum_{l\in S_k} q_l \cdot x_{j,l}'$ \item $W^i=X^T Z^i$ \end{itemize} \item Define the $n \times n^{1-\alpha}$ matrix $W$ with $w_{i,j} =quartile(|w_{i,j}^1|,\ldots|w_{i,j}^{78 \log n}|)$. \item Output $W$ and $S_1 , \ldots , S_{n^{1-\alpha}}$. \end{itemize} \end{framed} \begin{thm}\label{ThmVecAgg} Let $X \in {\mathbb R}^{d \times n}$, $X' \in {\mathbb R}^{d \times n}$, $\alpha \in (0,1)$, $\tau>0$ the input of {\tt Vector Aggregation}. Then, the algorithm returns a matrix $W$ of size $n\times n^{1-\alpha}$ and a random partition $S_1 , \ldots , S_{n^{1-\alpha}}$, which with probability $1-O(1/n^3)$ satisfies the following: \begin{itemize} \item For all $j\in [n]$ and $k\in [n^{1-\alpha}]$, if $\forall u \in S_k$, $ |\langle x_j, u \rangle|\leq \tau$ then $|w_{j,k}| < 3 \cdot n^{\alpha} \tau$. \item For all $j\in [n]$ and $k\in [n^{1-\alpha}]$ if $\exists u\in S_k$, $|\langle x_j, u \rangle|\geq 3n^{\alpha}\tau$ then $|w_{j,k}| \geq 3 \cdot n^{\alpha} \tau$. \end{itemize} Moreover, the algorithm runs in time $\tilde{O}(dn+n^{2-\alpha}+MatrixMul( n \times d,d \times n^{1-\alpha}))$. \end{thm} For the case of pointsets with many ``small" distances, we rely crucially on the fact that the expected number of near neighbors for a randomly chosen point is large. So, if we iteratively choose random points and delete these and their neighbors, we will end up with a pointset which satisfies the property of having sufficiently few ``small" distances. Then, we apply {\tt Vector Aggregation}. \begin{framed} {\tt Crude ApprxNet}\\ Input: $X =[x_1,\ldots,x_n] \in {\mathbb R}^{d \times n}$, $X' =[x_1',\ldots,x_n'] \in {\mathbb R}^{d \times n}$, $\alpha \in (0,1)$, $\tau>0$. Output: $C'\subseteq [n]$, {$F' \subseteq [n]$}. \begin{itemize} \item $C\gets \emptyset$, $F_1 \gets \emptyset, F_2 \gets \{x_1,\ldots,x_n\}$ \item Repeat $n^{0.5}$ times: \begin{itemize} \item Choose a column $x_i$ uniformly at random. \item $C \gets C \cup \{x_i\}$. \item Delete column $i$ from matrix $X$ and column $i$ from matrix $X'$. \item Delete each column $k$ from matrix $X$, $X'$ s.t. $|\langle x_i, x_k' \rangle| \geq \tau$. \item If there is no column $k$ from matrix $X$ s.t. $|\langle x_i, x_k'\rangle| \geq \tau$, then $F_1 \gets F_1 \cup \{x_i\}$ \end{itemize} \item Run {\tt Vector Aggregation} with input $X$, $X'$, $\alpha$, $\tau$ and output $W$, $S_1,\ldots,S_{n^{1-\alpha}}$. \item For each of the remaining columns $i=1,\ldots$: \begin{itemize} \item For any $|w_{i,j}|\geq 3 n^{\alpha} \tau$: \begin{itemize} \item If more than $n^{1.7}$ times in here, output "ERROR". \item Compute inner products between $x_i$ and vectors in $S_j$. For each vector $x_k' \in S_j$ s.t. $x_k' \neq x_i$ and $|\langle x_i,x_k'\rangle|\geq \tau$, delete row $k$ {and $F_2 \gets F_2 \backslash \{ x_i\}$.} \end{itemize} \item $C \gets C \cup \{x_i\} $ \end{itemize} \item Output indices of $C$ {and $F \gets \{F_1 \cup F_2 \}$}. \end{itemize} \end{framed} \begin{thm}\label{ThmCrudeNet} On input $X =[x_1,\ldots,x_n] \in {\mathbb R}^{d \times n}$, $X' =[x_1',\ldots,x_n'] \in {\mathbb R}^{d \times n}$, $\alpha \in (0,1)$, $\tau>0$, {\tt Crude ApprxNet}, computes a crude $3n^{\alpha}$-approximate $\tau$-net for $X$, $X'$, following the notation of Definition \ref{DfnMagnInnNet}. The algorithm costs time: $$ \tilde{O}(n^{2-\alpha}+ d \cdot n^{1.7+\alpha}+MatrixMul( n \times d,d \times n^{1-\alpha})), $$ and succeeds with probability $1-O(1/n^{0.2})$. Additionally, it outputs a set $F\subseteq R$ with the following property: $\{x_i \mid \forall x_j \neq x_i~ |\langle x_j,x_i \rangle | < \tau \}\subseteq F \subseteq \{x_i \mid \forall x_j \neq x_i~ |\langle x_j,x_i \rangle | < n^a\tau \}$. \end{thm} \begin{proof} We perform $n^{0.5}$ iterations and for each, we compare the inner products between the randomly chosen vector and all other vectors. Hence, the time needed is $O(dn^{1.5})$. In the following, we denote by $X_i$ the number of vectors which have ``large" magnitude of the inner product with the randomly chosen point in the $i$th iteration. Towards proving correctness, suppose first that ${\mathbb E}[X_i]>2n^{0.5}$ for all $i=1, \ldots n^{0.5}$. The expected number of vectors we delete in each iteration of the algorithm is more than $2n^{0.5}+1$. So, after $n^{0.5}$ iterations, the expected total number of deleted vectors will be greater than $n$. This means that if the hypothesis holds for all iterations we will end up with a proper net. Now suppose that there is an iteration $j$ where ${\mathbb E}[X_j] \leq 2n^{0.5}$. After all iterations, the number of ``small" distances are at most $n^{1.5}$ on expectation. By Markov's inequality, when the {\tt Vector Aggregation} algorithm is called, the following is satisfied with probability $1-n^{-0.2}$ : $$ |\{(i,k) \mid |\langle x_i, x_k'\rangle| \geq\tau, i\neq k\}| \leq n^{1.7} . $$ By Theorem \ref{ThmVecAgg} and the above discussion, the number of entries in the matrix $W$ that we need to visit is at most $n^{1.7}$. For each entry, we perform a brute force which costs $d n^\alpha$. Now notice that the first iteration stores centers $c$ and deletes all points $p$ for which $|\langle c,p\rangle| \geq \tau$. Hence, any two centers $c,c'$ satisfy $ |\langle c,p\rangle| < \tau$. In the second iteration, over the columns of $W$, notice that by Theorem \ref{ThmVecAgg}, for any two centers $c,c'$ we have $|\langle c,c'\rangle| <3 n^{\alpha}\tau.$ \end{proof} \subsection{Approximate inner product nets} In this subsection, we show that the problem of computing $\rho$-nets for the inner product of unit vectors reduces to the less natural problem of Definition \ref{DfnMagnInnNet}, which refers to the magnitude of the inner product. The first step consists of mapping the unit vectors to vectors in $\{-1,1\}^{d'}$. The mapping is essentially Charikar's LSH scheme \cite{Cha02}. Then, we apply the Chebyshev embedding of~\cite{Val15} in order to achieve gap amplification, and finally we call algorithm {\tt Crude ApprxNet}, which will now return a proper $\rho$-net with additive error. \begin{thm}[\cite{Val15}] \label{ThmUnif} There exists an algorithm with the following properties. Let $d'=O(\frac{\log n}{\delta^2})$ and $Y \in {\mathbb R}^{d'\times n}$ denote its output on input $X$, $\delta$, where $X$ is a matrix whose columns have unit norm, with probability $1 - o(1/n^2 )$, for all pairs $i, j \in [n]$, $ \Big|{\langle Y_i , Y_j \rangle}/{d'}-\Big(1-2 \cdot {\mathrm{cos}^{-1}(\langle X_i,X_j \rangle)}/{ \pi}\Big)\Big| \leq \delta ,$ where $X_i$, $Y_i$ denote the $i$th column of $X$ and $Y$ respectively. Additionally, the runtime of the algorithm is $O( \frac{d n \log n}{\delta^2})$. \end{thm} The following theorem provides a randomized embedding that damps the magnitude of the inner product of ``far" vectors, while preserving the magnitude of the inner product of ``close" vectors. The statement is almost verbatim that of~\cite[Prop.6]{Val15} except that we additionally establish an asymptotically better probability of success. The proof is the same, but since we claim stronger guarantees on success probability, we include the complete proof in Appendix~\ref{AppThmCheb}. \begin{thm}\label{ThmCheb} Let $Y$, $Y'$ be the matrices output by algorithm ``Chebyshev Embedding" on input $X, X' \in \{-1,1\}^{d\times n} , \tau^{+}\in [-1,1] , \tau^{-} \in [-1,1]$ with $\tau^{-}<\tau^{+}$ , integers $q, d'$. With probability {$ 1 - o(1/n)$} over the randomness in the construction of $Y, Y'$, for all $i, j \in [n]$, $\langle Y_i , Y_j' \rangle$ is within $\sqrt{d'} \log n$ from the value $ T_q \Big(\frac{\langle X_i, X_j'\rangle/d' - \tau^{-}}{\tau^{+}-\tau^{-}}2 -1 \Big) \cdot d' \cdot (\tau^{+}-\tau^{-})^q /{2^{3q-1}}, $ where $T_q$ is the degree-$q$ Chebyshev polynomial of the first kind. The algorithm runs in time $O(d' \cdot n\cdot q)$. \end{thm} \begin{framed} {\tt Inner product ApprxNet}\\ Input: $X =[x_1,\ldots,x_n] $ with each $x_i \in {\mathbb S}^{d-1}$, $\rho \in [-1,1]$, $\epsilon \in (0,1/2]$. Output: Sets $C, F \subseteq [n]$. \begin{itemize} \item If $\rho\leq \epsilon$, then: \begin{itemize} \item $C \gets \emptyset$, $F\gets \emptyset$, $W \gets \{x_1,\ldots,x_n\}$ \item While $W\neq \emptyset$: \begin{itemize} \item Choose arbitrary vector $x\in W$. \item $W \gets W \setminus \{y \in W \mid \langle x,y\rangle \geq \rho-\epsilon \}$ \item $C \gets C \cup \{x\}$ \item If $\forall y \in W$, $\langle x,y \rangle<\rho-\epsilon $ then $F\gets F. \cup \{x\}$ \end{itemize} \item Return indices of $C$, $F$. \end{itemize} \item Apply Theorem \ref{ThmUnif} for input $X$, $\delta=\epsilon/2 \pi$ and output $Y\in \{-1,1\}^{d' \times n}$ for $d'=O(\log n/\delta^2)$. \item Apply Theorem \ref{ThmCheb} for input $Y$, $d''= n^{0.2}$, $q=50^{-1} \log n$, $\tau^-=-1$, $\tau^{+}=1-\frac{2 \cos^{-1}(\rho-\epsilon)}{\pi} +\delta$ and output $Z, Z'$. \item Run algorithm {\tt Crude ApprxNet} with input $\tau=3n^{0.16}$, $\alpha=\sqrt{\epsilon}/500$, $Z,Z'$ and output $C$, $F$. \item Return $C$, $F$. \end{itemize} \end{framed} \begin{thm}\label{AppIPnet} The algorithm {\tt Inner product ApprxNet}, on input $X =[x_1,\ldots,x_n] $ with each $x_i \in {\mathbb S}^{d-1}$, $\rho \in [-1,1]$ and $\epsilon \in (0,1/2]$, computes an approximate $\rho$-net with additive error $\epsilon$, using the notation of Definition \ref{DfnNetInn}. The algorithm runs in time $\tilde{O}(dn+n^{2-\sqrt{\epsilon}/600})$ and succeeds with probability $1-O(1/n^{0.2})$. Additionally, it computes a set $F$ with the following property: $\{x_i \mid \forall x_j \neq x_i~ \langle x_j,x_i \rangle < \rho -\epsilon \}\subseteq F \subseteq \{x_i \mid \forall x_j \neq x_i~ \langle x_j,x_i \rangle < \rho \}$. \end{thm} \section{Approximate nets in high dimensions} \label{SGeneral} In this section, we translate the problem of computing $r$-nets in $({\mathbb R}^d,\|\cdot \|)$ to the problem of computing $\rho$-nets for unit vectors under inner product. One intermediate step is that of computing $r$-nets for unit vectors under Euclidean distance. \subsection{From arbitrary to unit vectors} In this subsection, we show that if one is interested in finding an $r$-net for $({\mathbb R}^d,\|\cdot \|)$, it is sufficient to solve the problem for points on the unit sphere. One analogous statement is used in \cite{Val15}, where they prove that one can apply a randomized mapping from the general Euclidean space to points on a unit sphere, while preserving the ratio of distances for any two pairs of points. The claim derives by the simple observation that an $r$-net in the initial space can be approximated by computing an $\epsilon r/c$-net on the sphere, where $c$ is the maximum norm of any given point envisaged as vector. Our exposition is even simpler since we can directly employ the analogous theorem from \cite{Val15}. \begin{cor}\label{Standardize} There exists an algorithm, {\tt Standardize}, which, on input a $d \times n$ matrix $X$ with entries $x_{i,j} \in {\mathbb R}$, a constant $\epsilon \in (0, 1)$ and a distance parameter $r \in {\mathbb R}$, outputs a $m'\times n $ matrix $Y$, with columns having unit norm and $m'=\log^3n$, and a distance parameter $\rho \in {\mathbb R} $, such that a $\rho$-net of $Y$ is an approximate $r$-net of $X$, with probability $1-o(1/poly(n))$. \end{cor} \begin{comment} \begin{framed} \textbf{Standardize}\\ Input: A $d \times n$ matrix $X$ with entries $x_{i,j} \in {\mathbb R}$, a constant $\epsilon \in (0, 1)$, a distance parameter $r \in {\mathbb R}$. Output: A $m'\times n $ matrix $Y$ with columns having unit norm and $m'=\log^3n$, and a distance parameter $\rho \in {\mathbb R} $, such that our algorithm computes an $r$-net of $X$ given a $\rho$-net of $Y$. \begin{itemize} \item Define two $d$-dimensional vectors $X_{n+1}, X_{n+2}$, s.t.\ $r'=X_{n+1}-X_{n+2}$ and $\|r'\|=r$, and let matrix $X'$ denote the concatenation of $X$, $X_{n+1}$ and $X_{n+2}$ with size $d\times n+2$. \item Perform a Johnson-Lindenstrauss transformation on the columns of $X'$, projecting them to dimension $m'$, so as to yield matrix $X''$. \item Let $c$ denote the magnitude of the largest column of $X''$. Choose a random $m'$-dimensional vector $u$ of magnitude $8c/\epsilon$. \item Let matrix $Y$ be the result of adding $u$ to each column of $X''$ and normalizing all columns so as to have unit norm. \item Define $\rho:=\|Y_{n+1}-Y_{n+2}\|$ to be the new distance parameter. \end{itemize} \end{framed} \end{comment} \subsection{Approximate nets under Euclidean distance} In this subsection, we show that one can translate the problem of computing an $r$-net for points on the unit sphere under Euclidean distance, to finding an $r$-net for unit vectors under inner product as defined in Section \ref{SInner}. Moreover, we identify the subset of the $r$-net which contains the centers that are approximately far from any other point. Formally, \begin{dfn} Given a set of points $X$ and $\epsilon>0$, a set $F\subseteq X$ of $(1+\epsilon)$-approximate $r$-far points is defined by the following property: $\{x\in X \mid \forall x \neq y \in X ~ \|x-y\| > (1+\epsilon)r \}\subseteq F \subseteq \{x\in X \mid \forall x \neq y \in X ~ \|x-y\| > r \}$. \end{dfn} If $r$ is greater than some constant, the problem can be immediately solved by the law of cosines. If $r$ cannot be considered as constant, we distinguish cases $r\geq 1/n^{0.9}$ and $r <1/n^{0.9}$. The first case is solved by a simple modification of an analogous algorithm in \cite[p.13:28]{Val15}. The second case is not straightforward and requires partitioning the pointset in a manner which allows computing $r$-nets for each part separately. Each part has bounded diameter which implies that we need to solve a ``large $r$" subproblem. \begin{thm}\label{ThmLargeRadius} There exists an algorithm, {\tt ApprxNet(Large radius)}, which, for any constant $\epsilon\in (0,1/2]$, $X\subset {\mathbb S}^{d-1}$ s.t. $|X|=n$, outputs a $(1+\epsilon)r$-net and a set of $(1+\epsilon)$-approximate $r$-far points with probability $1-O(1/n^{0.2})$. Additionally, provided $r>1/n^{0.9}$ the runtime of the algorithm is $\tilde{O}(dn^{2-\Theta(\sqrt[]{\epsilon})})$. \end{thm} Let us now present an algorithm which translates the problem of finding an $r$-net for $r<1/n^{0.9}$ to the problem of computing an $r$-net for $r\geq 1/n^{0.9}$. The main idea is that we compute disjoint subsets $S_i$, which are far enough from each other, so that we can compute $r$-nets for each $S_i$ independently. We show that for each $S_i$ we can compute $T_i \subseteq S_i$ which has bounded diameter and $T_i'\subseteq S_i$ such that $T_i$, $T_i'$ are disjoint, each point in $T_i$ is far from each point in $T_i'$, and $|T_i'|\leq 3|S_i|/4$. It is then easy to find $r$-nets for $T_i$ by employing the ApprxNet(Large radius) algorithm. Then, we recurse on $T_i'$ which contains a constant fraction of points from $|S_i|$. Then, we cover points in $S_i \setminus(T_i \cup T_i')$ and points which do not belong to any $S_i$. \begin{framed} {\tt ApprxNet(Small radius)}\\ Input: $X =[x_1,\ldots,x_n]^T $ with each $x_i \in {\mathbb S}^{d-1}$, $r< 1/n^{0.9}$, $\epsilon \in (0,1/2]$. Output: Sets $R, F \subseteq [n]$. \begin{enumerate} \item Project points on a uniform random unit vector and consider projections $p_1,\ldots,p_n$ which wlog correspond to $x_1,\ldots,x_n\in {\mathbb R}^d$. \item Traverse the list as follows \begin{itemize} \item If $|\{j \mid p_j \in [p_i-r,p_i] \}| \leq n^{0.6}$ or $i=n$: \begin{itemize} \item If $|\{j \mid p_j <p_i \}| \leq n^{0.9}$ remove from the list all points $p_j$ s.t. $p_j<p_i-r$ and save set $K=\{x_j \mid p_j\in [p_i-r,p_i] \}$. \item If $|\{j \mid p_j <p_i\}| > n^{0.9}$ save sets $K_i=\{x_j \mid p_j\in [p_i-r,p_i] \} \cup K$, $S_i=\{x_j\mid p_j<p_i-r\}\setminus K$ and remove projections of $S_i$ and $K_i$ from the list. \end{itemize} \end{itemize} \item After traversing the list if we have not saved any $S_i$ go to 5; otherwise for each $S_i$: \begin{itemize} \item For each $u\in S_i$, sample $n^{0.1}$ distances between $u$ and randomly chosen $x_k\in S_i$. Stop if for the selected $u\in S_i$, more than $1/3$ of the sampled points are in distance $\leq r n^{0.6}$. This means that one has found $u$ s.t. $|\{x_k \in S_i, \|u-x_k\|\leq r n^{0.6}\}| \geq |S_i|/4$ with high probability. If no such point was found, output "ERROR". \item Let $0\leq d_1\leq \ldots\leq d_{|S_i|}$ be the distances between $u$ and all other points in $S_i$. Find $c\in[ r n^{0.6},2r n^{0.6}]$ s.t. $|\{j \in [n] \mid d_j \in [c,c+r] \}| <n^{0.4}$, store $W_i=\{x_j \mid d_j \in [c,c+r] \}$, and remove $W_i$ from $S_i$. \item Construct the sets $T_i=\{x_j \in S_i \mid d_j<c\}$ and $T_i'=\{x_j \in S_i \mid d_j > c+r\}$. \begin{itemize} \item For $T_i$, subtract $u$ from all vectors in $T_i$, run {\tt Standardize}, then {\tt ApprxNet (Large radius)}, both with {$\epsilon/4$}. Save points which correspond to output at $R_i$, $F_i$ respectively. \item Recurse on $T_i'$ the whole algorithm, and notice that $|T_i'|\leq 3 |S_i|/4$. Save output at $R_i'$, and $F_i'$ respectively. \end{itemize} \end{itemize} \item Let $R \gets \bigcup_i R_i \cup R_i'$ and $F \gets \bigcup_i F_i \cup F_i'$. Return to the list $p_1,\ldots,p_n$. \begin{enumerate} \item {Remove from $F$ all points which cover at least one point from $\bigcup_i W_i$ or $\bigcup_i K_i$.} \item \label{itm:deleteb} Delete all points $ (\bigcup_i T_i) \setminus (\bigcup_i R_i)$, and $ (\bigcup_i T_i') \setminus (\bigcup_i R_i')$. \item \label{itm:deletec}For each $i$ delete all points in $W_i$ covered by $R_i$, or covered by $R_i'$. \item \label{itm:deleted}For each $i$ delete all points in $K_i$ covered by $R$. \item Finally delete $R$ from the list. Store the remaining points at $F'$. \end{enumerate} \item $R' \gets \emptyset$. Traverse the list as follows: For each $p_i$, check the distances from all $x_j$ s.t. $p_j\in [p_i-r,p_i]$. \begin{itemize} \item If $\exists\, x_j \in R' :$ $\|x_i-x_j\| \leq r$, delete $x_i$ from the list, set $F' \gets F' \backslash \{x_i , x_j\}$ and continue traversing the list. \item If there is no such point $x_j$ then $R \gets R \cup \{x_i\}$ and continue traversing the list. \end{itemize} \item Output indices of $R\gets R \cup R'$ and $F \gets F \cup F'$. \end{enumerate} \end{framed} \begin{thm}\label{ThmSmallr} For any constant $\epsilon>0$, $X\subset {\mathbb S}^{d-1}$ s.t. $|X|=n$, and $r < 1/n^{0.9}$, {\tt ApprxNet(Small radius)} will output a $(1+\epsilon)r$-net and a set of $(1+\epsilon)$-approximate $r$-far points in time $\tilde{O}(dn^{2-\Theta(\sqrt[]{\epsilon})})$, with probability $1-o(1/n^{0.04})$. \end{thm} \begin{proof} Note that points in $S_i$ had projections $p_i$ in sets of contiguous intervals of width $r$; each interval had $\geq n^{0.6}$ points, hence the diameter of the projection of $S_i$ is $\leq n^{0.4}r$. By the Johnson Lindenstrauss Lemma \cite{DG02} we have that for $v \in {\mathbb S}^{d-1}$ chosen uniformly at random: $${\mathrm Pr}\Big[\langle u,v\rangle^{2}\leq \frac{\|u\|^2}{n^{0.4}}\Big]\leq \frac{\sqrt{d} \sqrt{e}}{n^{0.2}}. $$ Hence, $ {\mathbb E}[| \{ x_k,x_j\in S_i \mid \|x_k-x_j\| \geq n^{0.6}r \text{ and } \|p_k-p_j\|\leq n^{0.4} r\}|] \leq |S_i|^2 \cdot \frac{\sqrt{e d}}{n^{0.2}}, $ and the probability $$ {\mathrm Pr}[| \{ x_k,x_j\in S_i \mid \|x_k-x_j\| \geq n^{0.6}r \text{ and } \|p_k-p_j\|\leq n^{0.4} r\}| \geq |S_i|^{1.95}] \leq |S_i|^{0.05} \cdot \frac{\sqrt{e d}}{n^{0.2}}\leq \frac{\sqrt{e d}}{n^{0.15}}. $$ Taking a union bound over all sets $S_i$ yields a probability of failure $o({1}/{n^{0.045}})$. This implies that (for large enough $n$, which implies large enough $|S_i|$) at least $${\binom{|S_i|}{2}} -|S_i|^{1.95}\geq {\frac{|S_i|^2}{4}}$$ distances between points in $S_i$ are indeed small ($\leq n^{0.6}r$). Hence, there exists some point $p_k \in S_i$ which $(n^{0.6}r)$-covers $|S_i|/2$ points. For each possible $p_k$ we sample $n^{0.1}$ distances to other points, and by {Chernoff bounds}, if a point $(n^{0.6}r)$-covers a fraction of more than $1/2$ of the points in $S_i$, then it covers more than $n^{0.1}/3$ sampled points with high probability. Similarly, if a point $(n^{0.6}r)$-covers a fraction of less than $1/4$ of the points in $S_i$, then it covers less than $n^{0.1}/3$ sampled points with high probability. More precisely, for some fixed $u\in S_i$, let $X_j=1$ when for the $j$th randomly chosen point $v\in S_i$, it holds $\| u-v\| \leq n^{0.6}r$ and let $X_j=0$ otherwise. Then, for $Y=\sum_{j=1}^{n^{0.1}} X_j$, it holds: $$ {\mathbb E}[Y]\geq n^{0.1}/2 \implies {\mathrm Pr}[Y\leq n^{0.1}/3 ]\leq \exp(- \Theta(n^{0.1})), $$ $$ {\mathbb E}[Y]\leq n^{0.1}/4 \implies {\mathrm Pr}[Y\geq n^{0.1}/3]\leq \exp(- \Theta(n^{0.1})). $$ Since for any point $x\in T_i$ and any point $y \in T_i'$ we have $\|x-y\|>r$, the packing property of $r$-nets is preserved when we build $r$-nets for $T_i$ and $T_i'$ independently. For each $T_i$, we succeed in building $r$-nets with probability $1-O(1/n^{0.2})$. By a union bound over all sets $T_i$, we have a probability of failure $O(1/n^{0.1})$. Furthermore, points which belong to sets $W_i$ and $K_i$ are possibly covered and need to be checked. For the analysis of the runtime of the algorithm, notice that step \ref{itm:deleteb} costs time $O(d\cdot (\sum_i|T_i|+\sum_i|T_i'|))=O(dn)$. Then, step \ref{itm:deletec} costs time $O(d \cdot \sum_i |W_i|\cdot |T_i|+d \cdot \sum_i |W_i|\cdot |T_i'|)=O(d n^{1.4})$. Finally, notice that we have at most $n^{0.1}$ sets $K_i$. Each $K_i$ contains at most $2n^{0.6}$ points, hence checking each point in $\bigcup_i K_i$ with each point in $R$ costs $O(d n^{1.7})$. Now regarding step 5, consider any interval $[p_i-r,p_i]$ in the initial list, where all points are projected. If $|\{ j \mid p_j \in [p_i-r,p_i]\}\leq 2 n^{0.9}$ then the $i$th iteration in step 5 will obviously cost $O(n^{0.9})$, since previous steps only delete points. If $|\{ j \mid p_j \in [p_i-r,p_i]\}> 2 n^{0.9}$, we claim that $|\{j<i \mid p_j \in [p_i-r,p_i] \text{ and } K_j \text{ is created}\}| \leq 1$. Consider the smallest $j <i$ s.t. $K_j$ is created and $p_j\in [p_i-r,p_i]$. This means that all points $p_k$, for $k\leq j$, are deleted when $p_j$ is visited. Now assume that there exists integer $l \in (j,i)$ s.t. $K_l$ is created. This means that the remaining points in the interval $[p_l-r,p_l]$ are $\leq n^{0.6}$ and all of the remaining points $p_k <p_l$ are more than $n^{0.9}$. This leads to contradiction, since by the deletion in the $j$th iteration, we know that all of the remaining points $p_k <p_l$ lie in the interval $[p_l-r,p_l]$. Now, assume that there exists one $ j<i$ s.t. $p_j \in [p_i-r,p_i]$ and $K_j$ is created. Then, when $p_i$ is visited, there at least $2 n^{0.9}-n^{0.6}>n^{0.9}$ remaining points in the interval $[p_i-r,p_i]$. Hence, there exists $l\geq i$ for which the remaining points in the interval $[p_i-r,p_i]$ are contained in $S_l \cup K_l$. Hence in this case, in step 5, there exist at most $O(n^{0.6})$ points which are not deleted and belong to the interval $[p_i-r,p_i]$. Now assume that there does not exist any $ j<i$ s.t. $p_j \in [p_i-r,p_i]$ and $K_j$ is created. This directly implies that there exists $l\geq i$ for which the remaining points in the interval $[p_i-r,p_i]$ are contained in $S_l \cup K_l$. At last, the total time of the above algorithm is dominated by the calls to the construction of the partial $r$-nets of the sets $T_i$. Thus, the total running time is $O(\sum_{ i} {|T_i|}^{2-\Theta(\sqrt{\epsilon})}+\sum_{ i} {|T_i|'}^{2-\Theta(\sqrt{\epsilon})})= O(\sum_{ i} {|T_i|}^{2-\Theta(\sqrt{\epsilon}})+\sum_{i} {(3|T_i|/4)}^{2-\Theta(\sqrt{\epsilon})})= \tilde{O}(n^{2-\Theta(\sqrt{\epsilon}))}).$ {Finally, taking a union bound over all recursive calls of the algorithm we obtain a probability of failure $o(1/n^{0.04})$.} \end{proof} We now present an algorithm for an $(1+\epsilon)r$-net for points in ${\mathbb R}^d$ under Euclidean distance. \begin{framed} {\tt ApprxNet}\\ Input: Matrix $X=[x_1,\ldots,x_n]$ with each $x_{i} \in {\mathbb R}^d$, parameter $r \in {\mathbb R}$, constant $\epsilon \in (0, 1/2]$. Output: $R \subseteq \{x_1,\ldots,x_n\}$ \begin{itemize} \item Let $Y$, $r'$ be the output of algorithm {\tt Standardize} on input $X$, $r$ with parameter $\epsilon/4$. \item If $r \geq 1/n^{0.9}$ run {\tt ApprxNet(Large radius)} on input $Y$, $\epsilon/4, r'$ and return points which correspond to the set $R$. \item If $r < 1/n^{0.9}$ run {\tt ApprxNet(Small radius)} on input $Y$, $\epsilon/4, r'$ and return points which correspond to the set $R$. \end{itemize} \end{framed} \begin{thm}\label{ApprxNet} Given $n$ points in ${\mathbb R}^d$, a distance parameter $r \in {\mathbb R}$ and an approximation parameter $\epsilon \in (0, 1/2]$, with probability $1-o(1/n^{0.04})$, {\tt ApprxNet} will return a $(1+\epsilon)r-net$, $R$, in $\tilde{O}(dn^{2-\Theta(\sqrt{\epsilon})})$ time. \end{thm} \begin{proof} The theorem is a direct implication of Theorems \ref{ThmLargeRadius}, \ref{ThmSmallr}, \ref{Stand}. \end{proof} \begin{thm}\label{DelFar} Given $X\subset{\mathbb R}^d$ such that $|X|=n$, a distance parameter $r \in {\mathbb R}$ and an approximation parameter $\epsilon \in (0, 1/2]$, there exists an algorithm, {\tt DelFar}, that will return, with probability $1-o(1/n^{0.04})$, a set $F'$ with the following properties in $\tilde{O}(dn^{2-\Theta(\sqrt{\epsilon})})$ time: \begin{itemize} \item If for a point $p \in X$ it holds that $\forall q\neq p, q \in X$ we have $\|p-q\| > (1+\epsilon)r$, then $p \notin F'$. \item If for a point $p \in X$ it holds that $\exists q\neq p, q \in X$ s.t. $\|p-q\| \leq r$, then $p \in F'$. \end{itemize} \end{thm} \section{Applications and Future work}\label{Sapps} Concerning applications, in \cite{HR15}, they design an approximation scheme, which solves various distance optimization problems. The technique employs a grid-based construction of $r$-nets which is linear in $n$, but exponential in $d$. The main prerequisite of the method is the existence of a linear-time decider (formally defined in Appendix~\ref{Aframework}). The framework is especially interesting when the dimension is constant, since the whole algorithm costs time linear in $n$ which, for some problems, improves upon previously known near-linear algorithms. When the dimension is high, we aim for polynomial dependency on $d$, and subquadratic dependency on $n$. Let us focus on the problem of approximating the {\it $k$th nearest neighbor distance}. \begin{dfn} Let $X\subset {\mathbb R}^d$ be a set of $n$ points, approximation error $\epsilon>0$, and let $d_1\leq \ldots \leq d_n$ be the nearest neighbor distances. The problem of computing an $(1+\epsilon)$-approximation to the {\it $k$th nearest neighbor distance} asks for a pair $x,y\in X$ such that $\|x-y\|\in [(1-\epsilon)d_k,(1+\epsilon)d_k]$. \end{dfn} Now we present an approximate decider for the problem above. This procedure combined with the framework we mentioned earlier, which employs our net construction, results in an efficient solution for this problem in high dimension. \begin{framed} {\tt kth NND Decider}\\ Input: $X \subseteq {\mathbb R}^d$, constant $\epsilon\in (0,1/2]$, integer $k>0$. Output: An interval for the optimal value $f(X, k)$. \begin{itemize} \item Call {\tt DelFar}$(X, \frac{r}{1+\epsilon/4}, \epsilon/4)$ and store its output in $W_1$. \item Call {\tt DelFar}$(X, r, \epsilon/4)$ and store its output in $W_2$. \item Do one of the following: \begin{itemize} \item If $|W_1| > k$, then output $``f(X, k) < r"$. \item If $|W_2| < k$, then output $``f(X, k) > r"$. \item If $|W_1| \leq k$ and $\abs{W_2} \geq k$, then output $``f(X, k) \in [\frac{r}{1+\epsilon/4}, \frac{1+\epsilon/4}r]"$. \end{itemize} \end{itemize} \end{framed} \begin{thm}\label{KND} Given a pointset $X \subseteq {\mathbb R}^d$, one can compute a $(1+\epsilon)$-approximation to the $k$-th nearest neighbor in $\tilde{O}(dn^{2-\Theta(\sqrt{\epsilon})})$, with probability $1-o(1)$. \end{thm} To the best of our knowledge, this is the first high dimensional solution for this problem. Setting $k=n$ and applying Theorem \ref{KND} one can compute the {\it farthest nearest neighbor} in $\tilde{O}(dn^{2-\Theta(\sqrt{\epsilon})})$ with high probability. Concerning future work, let us start with the problem of finding a greedy permutation. A permutation $\Pi = <\pi_1, \pi_2,\dots >$ of the vertices of a metric space $(X, \norm{\cdot})$ is a \textit{greedy permutation} if each vertex $\pi_i$ is the farthest in $X$ from the set $\Pi_{i-1} = <{\pi_1,\dots, \pi_{i-1}}>$ of preceding vertices. The computation of $r$-nets is closely related to that of the greedy permutation. The $k$-center clustering problem asks the following: given a set $X \subseteq {\mathbb R}^d$ and an integer $k$, find the smallest radius $r$ such that $X$ is contained within $k$ balls of radius $r$. By \cite{EHS15}, a simple modification of our net construction implies an algorithm for the $(1+\epsilon)$ approximate greedy permutation in time $\tilde{O}(d n^{2-\Theta(\sqrt{\epsilon})} \log \Phi)$ where $\Phi$ denotes the spread of the pointset. Then, approximating the greedy permutation implies a $(2+\epsilon)$ approximation algorithm for $k$-center clustering problem. We expect that one can avoid any dependencies on $\Phi$. \if 0 The Corollaries below follow from Theorem \ref{ApprxNet}, Lemma 3.5\cite{EHS15} and Lemma 2.1\cite{EHS15}. \begin{cor} Let $X$ be a set of $n$ points in ${\mathbb R}^d$, $\epsilon \in (0, 1)$ an error parameter and let $\Phi$ be the spread of the Euclidean metric on $X$. Then, one can compute in $O(dn^{2-\Theta(\sqrt{\epsilon})}\log \Phi)$ expected time a sequence that is a $(1 + \epsilon)$-greedy permutation for the Euclidean metric on $X$, with high probability. \end{cor} \begin{cor} Given a set $X$ of $n$ points in ${\mathbb R}^d$, an integer $k$ and an error parameter $\epsilon \in (0, 1)$, one can compute with high probability a $(2+\epsilon)$-approximation to the optimal $k$-center clustering in $O(dn^{2-\Theta(\sqrt{\epsilon})}\log \Phi)$, where $\Phi$ is the spread of the Euclidean metric on $X$. \end{cor}\fi \subsection*{Acknowledgment.} I.Z.~Emiris acknowledges partial support by the EU H2020 research and innovation programme, under the Marie Sklodowska-Curie grant agreement No 675789: Network ``ARCADES". \newpage \bibliographystyle{alpha}
{'timestamp': '2017-05-09T02:03:40', 'yymm': '1607', 'arxiv_id': '1607.04755', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04755'}
arxiv
\section{Introduction} \emph{Call-by-Push-Value}~\cite{LevyP04} is a class of functional languages generalizing the lambda-calculus in several directions. From the point of view of Linear Logic we understand it as a half-polarized system bearing some similarities with \Eg{}classical Parigot's lambda-mu-calculus, this is why we call it $\CBPV{}$. The main idea of Laurent and Regnier interpretation of call-by-name lambda-mu in Linear Logic~\cite{LaurentRegnier03} (following actually~\cite{Girard91a}) is that all types of the minimal fragment of the propositional calculus (with $\Rightarrow$ as unique connective) are interpreted as \emph{negative} types of Linear Logic which are therefore naturally equipped with structural morphisms: technically speaking, these types are algebras of the $\wn$-monad of Linear Logic. This additional structure of negative types allows to perform logical structural rules on the \emph{right side} of typing judgments even if these formulas are not necessarily of shape $\wn\sigma$, and this is the key towards giving a computational content to classical logical rules, generalizing the fundamental discovery of Griffin on typing $\CALLCC{}$ with Peirce Law~\cite{Griffin90}. From our point of view, the basic idea of $\CBPV{}$ is quite similar, though somehow dual and used in a less systematic way: data types are interpreted as \emph{positive} types of Linear Logic equipped therefore with structural morphisms (as linear duals of negative formulas, they are coalgebras of the $\oc$-comonad) and admit therefore structural rules on the \emph{left side} of typing judgment even if they are not of shape $\EXCL\sigma$. This means that a function defined on a data type can have a \emph{linear function type} even if it uses its argument in a non-linear way: this non-linearity is automatically implemented by means of the structural morphisms the positive data type is equipped with. The basic positive type in Linear Logic is $\EXCL\sigma$ (where $\sigma$ is any type): it is the very idea of Girard's call-by-name translation of the lambda-calculus into Linear Logic to represent the implication type $\sigma\Rightarrow\tau$ by means of the decomposition $\LIMPL{\EXCL\sigma}\tau$. The new idea of $\CBPV{}$ is to generalize this use of the linear implication to any type construction of shape $\LIMPL{\phi}{\tau}$ where $\phi$ is a positive type, without imposing any linearity restriction on the usage of the argument of type $\phi$ used by a function of type $\LIMPL{\phi}{\tau}$. This non-symmetrical restriction in the use of the linear implication motivates our description of $\CBPV$ as a ``half-polarized'' system: in a fully polarized system like Laurent's \emph{Polarized Linear Logic} LLP~\cite{LaurentRegnier03}, one would also require the type $\sigma$ to be negative in $\LIMPL\phi\sigma$ (the last system presented in~\cite{Ehrhard16a} implements this idea) and the resulting formalism would host classical computational primitives such as $\CALLCC$ as well. The price to pay, as illustrated in~\cite{AminiEhrhard15}, is a less direct access to data types: it is impossible to give a function from integers to integers the expected type $\LIMPL\Tnat\Tnat$ (where $\Tnat$ is the type of flat natural numbers satisfying $\Tnat=\PLUS\ONE\Tnat$), the simplest type one can give to such a term is $\LIMPL\Tnat{\wn\Tnat}$ which complicates its denotational interpretation\footnote{One can also consider $\wn$ as the computational monad of linear continuations and use a translation from direct style into monadic style (which, for this monad, is just a version of the familiar CPS translation). This is just a matter of presentation and of syntactic sugar and does not change the denotational interpretation in the kind of concrete models of Linear Logic we have in mind such as the relational model, the coherence space model etc.}. Not being polarized on the right side of implications, $\CBPV$ remains ``intuitionistic'' just as standard functional programming languages whose paradigmatic example is $\PCF$. So what is the benefit of this special status given to positive formulas considered as ``data types''? There are several answers to this question. \begin{itemize} \item First, and most importantly, it gives a \emph{call-by-value access} to data types: when translating $\PCF$ into Linear Logic, the simplest type for a function from integers to integers is $\LIMPL{\EXCL\Tnat}{\Tnat}$. This means that arguments of type $\Tnat$ are used in a call-by-name way: such arguments are evaluated again each time they are used. This can of course be quite inefficient. It is also simply \emph{wrong} if we extend our language with a random integer generator since in that case each evaluation of such an argument can lead to a different value: in $\PCF$ there is no way to keep memory of the value obtained for one evaluation of such a parameter and probabilistic programming is therefore impossible. In $\CBPV$ data types such as $\Tnat$ can be accessed in call-by-value, meaning that they are evaluated once and that the resulting value is kept for further computation: this is typically the behavior of a function of type $\LIMPL\Tnat\Tnat$. This is not compulsory however and an explicit $\oc$ type constructor still allows to define functions of type $\LIMPL{\EXCL\Tnat}{\Tnat}$ in $\CBPV$, with the usual $\PCF$ behavior. \item Positive types being closed under positive Linear Logic connectives (direct sums and tensor product) and under ``least fixpoint'' constructions, it is natural to allow corresponding constructions of positive types in $\CBPV$ as well, leading to a language with rich data type constructions (various kinds of trees, streams etc are freely available) and can be accessed in call-by-value as explained above for integers. From this data types point of view, the $\oc$ Linear Logic connective corresponds to the type of \emph{suspensions} or \emph{thunks} which are boxes (in the usual Linear Logic sense) containing unevaluated pieces of program. \item As already mentioned, since the Linear Logic type constructors $\LIMPL{}{}$ and $\EXCL{}$ are available in $\CBPV$ (with the restriction explained above on the use of $\LIMPL{}{}$ that the left side type must be positive), one can represent in $\CBPV$ both Girard's translations from lambda-calculus into Linear Logic introduced in~\cite{Girard87}: the usual one which is call-by-name and the ``boring one'' which is call-by-value. So our language $\CBPV$ is not intrinsically call-by-value and hosts very simply Girard's representation of call-by-name in Linear Logic as further explained in Section~\ref{sec:PCF-products}. \end{itemize} Concretely, in $\CBPV$, a term of positive type can be a \emph{value}, and then it is discardable and duplicable and, accordingly, its denotational interpretation is a morphism of coalgebras: values are particular terms whose interpretation is easily checked to be such a morphism, which doesn't preclude other terms of positive type to have the same property of course, in particular terms reducing to values! Being a value is a property which can be decided in time at most the size of the term and values are freely duplicable and discardable. The ``$\beta$-rules'' of the calculus (the standard $\beta$-reduction as well as the similar reduction rules associated with tensor product and direct sum) are subject to restrictions on certain subterms of redexes to be values (because they must be duplicable and discardable) and these restrictions make sense thanks to this strong decidability property of being a value. \subsection*{Probabilities in $\CBPV$.} Because of the possibility offered by $\CBPV$ of handling values in a call-by-value manner, this language is particularly suitable for probabilistic functional programming. Contrarily to the common monadic viewpoint on effects, we consider an extension of the language where probabilistic choice is a primitive $\COIN p$ of type $\PLUS\ONE\ONE$ (the type of booleans)\footnote{An not of type $T(\PLUS\ONE\ONE)$ where $T$ would be a computational monad of probabilistic computations.} parameterized by $p\in[0,1]\cap\Rational$ which is the probability of getting $\True$ (and $1-p$ is the probability of getting $\False$). So our probabilistic extension $\pCBPV$ of $\CBPV$ is in direct style, but, more importantly, the denotational semantics we consider is itself in ``direct style'' and does not rely on any auxiliary computational monad of probability distributions~\cite{Saheb-Djahromi80,JonesPlotkin89} (see~\cite{JungTix98} for the difficulties related with the monadic approach to probabilistic computations), random variables~\cite{phdBarker,goubaultvarraca11,Mislove16}, or measures~\cite{StatonYWHK16,HeunenKSY17}. On the contrary, we interpret our language in the model of \emph{probabilistic coherence spaces}~\cite{DanosEhrhard08} that we already used for providing a fully abstract semantics for probabilistic $\PCF$~\cite{EhrhardPaganiTasson14}. A probabilistic coherence space $X$ is given by an at most countable set $\Web X$ (the web of $X$) and a set $\Pcoh X$ of $\Web X$-indexed families of non-negative real numbers, to be considered as some kind of ``generalized probability distributions''. This set of families of real numbers is subject to a closure property implementing a simple intuition of probabilistic observations. Probabilistic coherence spaces are a model of classical Linear Logic and can be seen as $\omega$-continuous domains equipped with an operation of convex linear combination, and the linear morphisms of this model are exactly the Scott continuous functions commuting with these convex linear combinations. Besides, probabilistic coherence spaces can be seen as particular \emph{d-cones}~\cite{TixKP09a} and even \emph{Kegelspitzen}~\cite{KeimelP16}, that is, complete partial orders equipped with a Scott continuous ``convex structure'' allowing to compute probabilistic linear combinations of their elements. Kegelspitzen have been used recently by Rennela to define a denotational model of a probabilistic extension of FPC~\cite{Rennela16}. The main difference with respect to our approach seems to be the fact that non-linear morphisms (corresponding to morphisms of type $\Limpl{\Excl\sigma}{\tau}$ in our setting) are general Scott continuous functions in Rennela's model\footnote{More precisely, in his interpretation of FPC, Rennela uses strict Scott continuous functions, but, along the same lines, it seems clear that Kegelspitzen give rise to a model of PCF where morphisms are general Scott continuous functions.}, whereas they are analytic functions\footnote{Meaning that it is definable by a power series.} in ours, which can be seen as very specific Scott continuous functions. See also~\cite{EhrhardPaganiTasson18} where these functions are seen to be \emph{stable} in a generalized sense. As shown in~\cite{DanosEhrhard08} probabilistic coherence spaces have all the required completeness properties for interpreting recursive type definitions (that we already used in~\cite{EhrhardPaganiTasson11} for interpreting the pure lambda-calculus) and so we are able to associate a probabilistic coherence space with all types of $\pCBPV$. In this model the type $\PLUS\ONE\ONE$ is interpreted as the set of sub-probability distributions on $\{\True,\False\}$ so that we have a straightforward interpretation of $\COIN p$. Similarly the type of flat integers $\Tnat$ is interpreted as a probabilistic coherence space $\Snat$ such that $\Web\Snat=\Nat$ and $\Pcoh\Snat$ is the set of all probability distributions on the natural numbers. Given probabilistic spaces $X$ and $Y$, the space $\Limpl XY$ has $\Web X\times\Web Y$ as web and $\Pcoh{(\Limpl XY)}$ is the set of all $\Web X\times\Web Y$ matrices which, when applied to an element of $\Pcoh X$ gives an element of $\Pcoh Y$. The web of the space $\Excl X$ is the set of all finite multisets of elements of $\Web X$ so that an element of $\Limpl{\Excl X}{Y}$ can be considered as a power series on as many variables as there are elements in $\Web X$ (the composition law associated with the Kleisli category of the $\oc$-comonad is compatible with this interpretation of morphisms as power series). From a syntactic point of view, the only values of $\PLUS\ONE\ONE$ are $\True$ and $\False$, so $\COIN p$ is not a value. Therefore we cannot reduce $\LAPP{\ABST x{\PLUS\ONE\ONE}{M}}{\COIN p}$ to $\Subst M{\COIN p}{x}$ and this is a good thing since then we would face the problem that the boolean values of the various occurrences of $\COIN p$ might be different. We have first to reduce $\COIN p$ to a value, and the reduction rules of our probabilistic $\CBPV$ stipulate that $\COIN p$ reduces to $\True$ with probability $p$ and to $\False$ with probability $1-p$ (in accordance with the kind of operational semantics that we considered in our earlier work on this topic, starting with~\cite{DanosEhrhard08}). So $\LAPP{\ABST x{\PLUS\ONE\ONE}{M}}{\COIN p}$ reduces to $\Subst M\True x$ with probability $p$ and to $\Subst M\False x$ with probability $1-p$, which is perfectly compatible with the intuition that in $\CBPV$ application is a linear operation (and that implication is linear: the type of $\ABST x{\PLUS\ONE\ONE}{M}$ is $\LIMPL{(\PLUS\ONE\ONE)}{\sigma}$ for some type $\sigma$): in this operational semantics as well as in the denotational semantics outlined above, linearity corresponds to commutation with (probabilistic) convex linear combinations. \subsection*{Contents.} The results presented in this paper illustrate the tight connection between the syntactic and the denotational intuitions underpinning our understanding of this calculus. We first introduce in Section~\ref{sec:syntax} the syntax and operational semantics of $\pCBPV$, an abstract programming language very close to Paul Levy's Call by Push Value (CBPV)~\cite{LevyP04}. It however differs from Levy's language mainly by the fact that CBPV computation types products and recursive type definitions have no counterparts in our language. This choice is mainly motivated by the wish of keeping the presentation reasonably short. It is argued in Sections~\ref{subsec:exsyn} and~\ref{sec:PCF-products} that $\pCBPV$ is expressive enough for containing well behaved lazy data types such as the type of streams, and for encoding call-by-name languages with products. In Section~\ref{sec:PCS}, we present the Linear Logic model of probabilistic coherence spaces, introducing mainly the underlying linear category $\PCOH$, where $\pCBPV$ general types are interpreted, and the Eilenberg-Moore category $\EM\PCOH$, where the positive types are interpreted. In order to simplify the Adequacy and Full Abstraction proofs, we restrict actually our attention to a well-pointed subcategory of $\EM\PCOH$ whose objects we call ``dense coalgebras'': this will allow to consider all morphisms as functions. As suggested by one of the referees, there are probably smaller well-pointed subcategories of $\EM\PCOH$ where we might interpret our positive types, and in particular the category of families introduced in~\cite{Abramsky1998} describing call-by-value games. This option will be explored in further work. We prefer here to work with the most general setting as it is also compatible with a probabilistic extension of the last system of~\cite{Ehrhard16a}, which features classical $\CALLCC{}$-like capabilities. We prove then in Section~\ref{sec:adequacy} an Adequacy Theorem whose statement is extremely simple: given a closed term $M$ of type $\ONE$ (which has exactly one value $\ONELEM$), the denotational semantics of $M$, which is an element of $[0,1]$, coincides with its probability to reduce to $\ONELEM$ (such a term can only diverge or reduce to $\ONELEM$). In spite of its simple statement the proof of this result requires some efforts mainly because of the presence of unrestricted\footnote{Meaning that recursive type definitions are not restricted to covariant types.} recursive types in $\pCBPV$. The method used in the proof relies on an idea of Pitts~\cite{Pitts93} and is described in the introduction of Section~\ref{sec:adequacy}. Last we prove Full Abstraction in Section~\ref{sec:FA} adapting the technique used in~\cite{EhrhardPaganiTasson11} to the present $\pCBPV$ setting. The basic idea consists in associating, with any element $a$ of the web of the probabilistic coherence space $\Tsem\sigma$ interpreting the type $\sigma$, a term $\Testt a$ of type\footnote{For technical reasons and readability of the proof, the type we give to $\Testt a$ in Section~\ref{sec:FA} slightly differs from this one.} $\LIMPL{\EXCL\sigma}{\LIMPL{\EXCL\Tnat}{\ONE}}$ such that, given two elements $w$ and $w'$ of $\Pcoh{\Tsem\sigma}$ such that $w_a\not=w'_a$, the elements $\Psem{\Testt a}{}\Prom w$ and $\Psem{\Testt a}{}\Prom{(w')}$ of $\Pcoh{(\LIMPL{\EXCL\Tnat}{\ONE})}$ are different power series depending on a finite number $n$ of parameters (this number $n$ depends actually only on $a$) so that we can find a rational number valued sub-probability distribution for these parameters where these power series take different values in $[0,1]$. Applying this to the case where $w$ and $w'$ are the interpretations of two closed terms $M$ and $M'$ of type $\sigma$, we obtain, by combining $\Testt a$ with the rational sub-probability distribution which can be represented in the syntax using $\COIN p$ for various values of $p$, a $\CBPV$ closed term $C$ of type $\LIMPL{\EXCL\sigma}{\ONE}$ such that the probability of convergence of $\LAPP C{\STOP M}$ and $\LAPP C{\STOP{(M')}}$ are different (by adequacy). This proves that if two (closed) terms are operationally equivalent then they have the same semantics in probabilistic coherence spaces, that is, equational full abstraction. \subsection*{Further developments.} These results are similar to the ones reported in~\cite{EhrhardPaganiTasson15} but are actually different, and there is no clear logical connection between them, because the languages are quite different, and therefore, the observation contexts also. And this even in spite of the fact that $\PCF$ can be faithfully encoded in $\CBPV$. This seems to show that the semantical framework for probabilistic functional programming offered by probabilistic coherence spaces is very robust and deserves further investigations. One major outcome of the present work is a natural extension of probabilistic computation to rich data-types, including types of potentially infinite values (streams etc). Our full abstraction result cannot be extended to inequational full abstraction with respect to the natural order relation on the elements of probabilistic coherence spaces: a natural research direction will be to investigate other (pre)order relations and their possible interactive definitions. Also, it is quite tempting to replace the equality of probabilities in the definition of contextual equivalence by a distance; this clearly requires further developments. \section{Probabilistic Call By Push Value}\label{sec:syntax} We introduce the syntax of $\pCBPV$ of CBPV (where HP stands for ``half polarized''). Types are given by the following BNF syntax. We define by mutual induction two kinds of types: \emph{positive types} and \emph{general types}, given type variables $\zeta$, $\xi$\dots: \begin{align} \text{positive}\quad \phi,\psi,\dots{} &\Bnfeq \ONE \Bnfor \EXCL \sigma \Bnfor \TENS\phi\psi \Bnfor \PLUS\phi\psi \Bnfor \zeta \Bnfor \TREC \zeta\phi \label{eq:cbpv-pos-types} \\ \text{general}\quad \sigma,\tau\dots{} &\Bnfeq \FORG\phi \Bnfor \LIMPL\phi\sigma \label{eq:cbpv-gen-types} \end{align} The type $\ONE$ is the neutral element of $\ITens$ and it might seem natural to have also a type $\ZERO$ as the neutral element of $\IPlus$. We didn't do so because there is no associated constructor in the syntax of terms, and the only closed terms of type $\ZERO$ that one can write are ever-looping terms. Observe also that there are no restriction on the variance of types in the recursive type construction: for instance, in $\TREC\zeta\phi$ is a well-formed positive type if $\phi=\EXCL{(\LIMPL\zeta\zeta)}$, where $\zeta$ has a negative and a positive occurrence. Do well notice that our ``positive types'' are positive in the sense of logical polarities, and \emph{not} of the variance of type variables! Terms are given by the following BNF syntax, given variables $x,y,\dots$: \begin{align*} M,N\dots{} \Bnfeq x & \Bnfor \ONELEM \Bnfor \STOP M \Bnfor \PAIR MN \Bnfor \IN \ell M \Bnfor \IN r M \\ & \Bnfor \ABST x\phi M \Bnfor \LAPP MN \Bnfor \CASE M{x_\ell}{N_\ell}{x_r}{N_r}\\ & \Bnfor \PR \ell M \Bnfor \PR r M \Bnfor \GO M \Bnfor \FIXT x\sigma M \\ & \Bnfor \FOLD M \Bnfor \UNFOLD M \\ & \Bnfor \COIN p, \; p\in [0,1]\cap\mathbb Q \end{align*} \begin{remark} This functional language $\pCBPV$, or rather the sublanguage $\CBPV$ which is $\pCBPV$ stripped from the $\COIN p$ construct, is formally very close to Levy's CBPV. As explained in the Introduction, our intuition however are more related to Linear Logic than to CBPV and its general adjunction-based models. This explains why our syntax slightly departs from Levy's original syntax as described \Eg~in~\cite{LevyP02} and is much closer to the SFPL language of~\cite{MarzRohrStreicher99}: Levy's type constructor $F$ is kept implicit and $U$ is ``$\oc$''. We use LL inspired notations: $\STOP M$ corresponds to $\mathsf{thunk}(M)$ and $\GO M$ to $\mathsf{force}(M)$. Our syntax is also slightly simpler than that of SFPL in that our general types do not feature products and recursive types definitions, we will explain in Section~\ref{sec:PCF-products} that this is not a serious limitation in terms of expressiveness. \end{remark} Figure~\ref{fig:typing_system} provides the typing rules for these terms. A typing context is an expression $\cP=(x_1:\phi_1,\dots,x_k:\phi_k)$ where all types are positive and the $x_i$s are pairwise distinct variables. \begin{figure*} \centering \begin{center} \AxiomC{} \UnaryInfC{$\TSEQ{\cP,x:\phi}{x}{\phi}$} \DisplayProof \quad \AxiomC{$\TSEQ{\cP,x:\phi}{M}{\sigma}$} \UnaryInfC{$\TSEQ{\cP}{\ABST x\phi M}{\LIMPL\phi\sigma}$} \DisplayProof \quad \AxiomC{$\TSEQ{\cP}{M}{\LIMPL\phi\sigma}$} \AxiomC{$\TSEQ{\cP}{N}{\phi}$} \BinaryInfC{$\TSEQ{\cP}{\LAPP MN}{\sigma}$} \DisplayProof \end{center} \begin{center} \AxiomC{$\TSEQ\cP M\sigma$} \UnaryInfC{$\TSEQ\cP{\STOP M}{\EXCL\sigma}$} \DisplayProof \quad \AxiomC{} \UnaryInfC{$\TSEQ{\cP}{\ONELEM}{\ONE}$} \DisplayProof \quad \AxiomC{$\TSEQ\cP{M_\ell}{\phi_\ell}$} \AxiomC{$\TSEQ\cP{M_r}{\phi_r}$} \BinaryInfC{$\TSEQ\cP{\PAIR{M_\ell}{M_r}}{\TENS{\phi_\ell}{\phi_r}}$} \DisplayProof \quad \AxiomC{$\TSEQ\cP M{\phi_i}\quad \small i\in\{\ell,r\}$} \UnaryInfC{$\TSEQ\cP{\IN iM}{\PLUS{\phi_\ell}{\phi_r}}$} \DisplayProof \end{center} \begin{center} \AxiomC{$\TSEQ\cP{M}{\EXCL \sigma}$} \UnaryInfC{$\TSEQ\cP{\GO M}{\sigma}$} \DisplayProof \quad \AxiomC{$\TSEQ\cP M{\TENS{\phi_\ell}{\phi_r}\quad \small i\in\{\ell,r\}}$} \UnaryInfC{$\TSEQ\cP{\PR iM}{\phi_i}$} \DisplayProof \quad \AxiomC{$\TSEQ{\cP,x:\EXCL \sigma}{M}{\sigma}$} \UnaryInfC{$\TSEQ\cP{\FIXT x\sigma M}\sigma$} \DisplayProof \end{center} \begin{center} \AxiomC{$\TSEQ\cP M{\PLUS{\phi_\ell}{\phi_r}}$} \AxiomC{$\TSEQ{\cP,x_\ell:\phi_\ell}{M_\ell}\sigma$} \AxiomC{$\TSEQ{\cP,x_r:\phi_r}{M_r}\sigma$} \TrinaryInfC{$\TSEQ\cP{\CASE M{x_\ell}{M_\ell}{x_r}{M_r}}\sigma$} \DisplayProof \end{center} \begin{center} \AxiomC{} \UnaryInfC{$\TSEQ{\cP}{\COIN p}{\PLUS\ONE\ONE}$} \DisplayProof \end{center} \begin{center} \AxiomC{$\TSEQ{\cP}{M}{\Subst{\psi}{\TREC\zeta\psi}{\zeta}}$} \UnaryInfC{$\TSEQ{\cP}{\FOLD M}{\TREC\zeta\psi}$} \DisplayProof \quad \AxiomC{$\TSEQ{\cP}{M}{\TREC\zeta\psi}$} \UnaryInfC{$\TSEQ{\cP}{\UNFOLD M}{\Subst{\psi}{\TREC\zeta\psi}{\zeta}}$} \DisplayProof \end{center} \caption{Typing system for $\pCBPV$} \label{fig:typing_system} \end{figure*} \subsection{Reduction rules} \emph{Values} are particular $\pCBPV$ terms (they are not a new syntactic category) defined by the following BNF syntax: \begin{align*} V,W\dots{} \Bnfeq x \Bnfor \ONELEM \Bnfor \STOP M \Bnfor \PAIR{V}{W} \Bnfor \IN \ell {V} \Bnfor \IN r {V} \Bnfor \FOLD V\,. \end{align*} Figure~\ref{fig:reduction-rules} defines a deterministic \emph{weak} reduction relation $\Wred$ and a probabilistic reduction $\Rel{\Redone p}$ relation. This reduction is weak in the sense that we never reduce within a "box" $\STOP M$ or under a $\lambda$. The distinguishing feature of this reduction system is the role played by values in the definition of $\Wred$. Consider for instance the case of the term $\PR \ell {\PAIR{M_\ell}{M_r}}$; one might expect this term to reduce directly to $M_\ell$ but this is not the case. One needs first to reduce $M_\ell$ \emph{and} $M_r$ to values before extracting the first component of the pair (the terms $\PR \ell {\PAIR{M_\ell}{M_r}}$ and $M_\ell$ have not the same denotational interpretation in general). Of course replacing $M_i$ with $\STOP{M_i}$ allows a lazy behavior. Similarly, in the $\Wred$ rule for $\mathsf{case}$, the term on which the test is made must be reduced to a value (necessarily of shape $\IN \ell V$ or $\IN r V$ if the expression is well typed) before the reduction is performed. As explained in the Introduction this allows to ``memoize'' the value $V$ for further usage: the value is passed to the relevant branch of the $\mathsf{case}$ through the variable $x_i$. Given two terms $M$, $M'$ and a real number $p\in[0,1]$, $M\Rel{\Redone p} M'$ means that $M$ reduces in one step to $M'$ with probability $p$. We say that $M$ is \emph{weak normal} if there is no reduction $M\Rel{\Redone p}M'$. It is clear that any value is weak normal. When $M$ is closed, $M$ is weak normal iff it is a value or an abstraction. In order to simplify the presentation we \emph{choose} in Figure~\ref{fig:reduction-rules} a reduction strategy. For instance we decide that, for reducing $\PAIR{M_\ell}{M_r}$ to a value, one needs first to reduce $M_\ell$ to a value, and then $M_r$; this choice is of course completely arbitrary. A similar choice is made for reducing terms of shape $\LAPP{M}{N}$, where we require the argument to be reduced first. This choice is less arbitrary as it will simplify a little bit the proof of adequacy in Section~\ref{sec:adequacy} (see for instance the proof of Lemma~\ref{lemma:rel-app-closeness}). We could perfectly define a more general weak reduction relation as in~\cite{Ehrhard16a} for which we could prove a ``diamond'' confluence property but we would then need to deal with a reduction transition system where, at each node (term), several probability distributions of reduced terms are available and so we would not be able to describe reduction as a simple (infinite dimensional) stochastic matrix. We could certainly also define more general reduction rules allowing to reduce redexes anywhere in terms (apart for $\COIN p$ which can be reduced only when in linear position) but this would require the introduction of additional $\sigma$-rules as in~\cite{EhrhardGuerrieri16}. As in that paper, confluence can probably be proven, using ideas coming from~\cite{EhrhardRegnier02,Vaux08} for dealing with reduction in an algebraic lambda-calculus setting. \begin{figure*} \centering \begin{center} \AxiomC{} \UnaryInfC{$\GO{\STOP M}\Rel\Wred M$} \DisplayProof \quad \AxiomC{} \UnaryInfC{$\LAPP{\ABST x\phi M}{V}\Rel\Wred\Subst MVx$} \DisplayProof \quad \AxiomC{}\RightLabel{$i\in\{\ell,r\}$} \UnaryInfC{$\PR i{\PAIR{V_\ell}{V_r}}\Rel\Wred V_i$} \DisplayProof \end{center} \begin{center} \AxiomC{} \UnaryInfC{$\FIXT x\sigma M\Rel\Wred\Subst M{\STOP{(\FIXT x\sigma M)}}x$} \DisplayProof \quad \AxiomC{}\RightLabel{$i\in\{\ell, r\}$} \UnaryInfC{$\CASE{\IN iV}{x_\ell}{M_\ell}{x_r}{M_r}\Rel\Wred\Subst{M_i}{V}{x_i}$} \DisplayProof \end{center} \begin{center} \AxiomC{} \UnaryInfC{$\UNFOLD{\FOLD{V}}\Rel{\Wred}V$} \DisplayProof \end{center} \centering \begin{center} \AxiomC{$M\Rel{\Wred}M'$} \UnaryInfC{$M\Rel{\Redone 1}M'$} \DisplayProof \quad \AxiomC{} \UnaryInfC{$\COIN p\Rel{\Redone p} \IN \ell \ONELEM$} \DisplayProof \quad \AxiomC{} \UnaryInfC{$\COIN p\Rel{\Redone{1-p}} \IN r \ONELEM$} \DisplayProof \end{center} \begin{center} \AxiomC{$M\Rel{\Redone p} M'$} \UnaryInfC{$\GO M\Rel{\Redone p}\GO{M'}$} \DisplayProof \quad \AxiomC{$M\Rel{\Redone p} M'$} \UnaryInfC{$\LAPP MV\Rel{\Redone p}\LAPP{M'}V$} \DisplayProof \quad \AxiomC{$N\Rel{\Redone p} N'$} \UnaryInfC{$\LAPP MN\Rel{\Redone p}\LAPP{M}{N'}$} \DisplayProof \quad \AxiomC{$M\Rel{\Redone p} M'$}\RightLabel{$i\in\{\ell, r\}$} \UnaryInfC{$\PR iM\Rel{\Redone p}\PR i{M'}$} \DisplayProof \end{center} \begin{center} \AxiomC{$M_\ell\Rel{\Redone p} M'_\ell$} \UnaryInfC{$\PAIR{M_\ell}{M_r}\Rel{\Redone p}\PAIR{M'_\ell}{M_r}$} \DisplayProof \quad \AxiomC{$M_r\Rel{\Redone p} M'_r$} \UnaryInfC{$\PAIR{V}{M_r}\Rel{\Redone p}\PAIR{V}{M'_r}$} \DisplayProof \quad \AxiomC{$M\Rel{\Redone p} M'$} \RightLabel{$i\in\{\ell, r\}$}\UnaryInfC{$\IN iM\Rel{\Redone p}\IN i{M'}$} \DisplayProof \end{center} \begin{center} \AxiomC{$M\Rel{\Redone p} M'$} \UnaryInfC{$\CASE{M}{x_\ell}{M_\ell}{x_r}{M_r} \Rel{\Redone p}\CASE{M'}{x_\ell}{M_\ell}{x_r}{M_r}$} \DisplayProof \end{center} \begin{center} \AxiomC{$M\Rel{\Redone p} M'$} \UnaryInfC{$\FOLD M\Rel{\Redone p}\FOLD{M'}$} \DisplayProof \quad \AxiomC{$M\Rel{\Redone p} M'$} \UnaryInfC{$\UNFOLD M\Rel{\Redone p}\UNFOLD{M'}$} \DisplayProof \end{center} \caption{Weak and Probabilistic reduction axioms and rules for $\pCBPV$} \label{fig:reduction-rules} \end{figure*} \subsection{Observational equivalence}\label{sec:obs-eq} In order to define observational equivalence, we need to represent the probability of convergence of a term to a normal form. As in~\cite{DanosEhrhard08}, we consider the reduction as a discrete time Markov chain whose states are terms and stationary states are weak normal terms. We then define a stochastic matrix $\Redmats\in[0,1]^{\pCBPV\times\pCBPV}$ (indexed by terms) as \begin{equation*} \Redmats_{M,M'}= \begin{cases} p & \text{if }M\Rel{\Redone p}M'\\ 1 & \text{if $M$ is weak-normal and $M'=M$}\\ 0 & \text{otherwise.} \end{cases} \end{equation*} Saying that $\Redmats$ is stochastic means that the coefficients of $\Redmats$ belong to $\Rseg 01$ and that, for any given term $M$, one has $\sum_{M'}\Redmats_{M,M'}=1$ (actually there are at most two terms $M'$ such that $\Redmats_{M,M'}\not=0$). For all $M,M'\in\pCBPV$, if $M'$ is weak-normal then the sequence $(\Redmats^n_{M,M'})_{n=1}^\infty$ is monotone and included in $[0,1]$, and therefore has a lub that we denote as $\Redmats^\infty_{M,M'}$ which defines a sub-stochastic matrix (taking $\Redmats^\infty_{M,M'}=0$ when $M'$ is not weak-normal). When $M'$ is weak-normal, the number $p=\Redmats^\infty_{M,M'}$ is the probability that $M$ reduces to $M'$ after a finite number of steps. Let us say when two closed terms $M_1$, $M_2$ of type $\sigma$ are \emph{observationally equivalent}: \begin{center} $M_1\Rel\Obseq M_2$, if for all closed term $C$ of type $\LIMPL{\EXCL\sigma}{\ONE}$, $ \Redmats^\infty_{\LAPP C{\STOP{M_1}},\ONELEM} =\Redmats^\infty_{\LAPP C{\STOP{M_1}},\ONELEM}$. \end{center} For simplicity we consider only closed terms $M_1$ and $M_2$. We could also define an observational equivalence on non closed terms, replacing the term $C$ with a context $C[\ ]$ which could bind free variables of the $M_i$'s, this would not change the results of the paper. \subsection{Examples}\label{subsec:exsyn} For the sake of readability, we drop the fold/unfold constructs associated with recursive types definitions; they can easily be inserted at the right places. \subsubsection*{Ever-looping program.} Given any type $\sigma$, we define $\LOOP\sigma=\FIXT x\sigma{\GO x}$ which satisfies $\TSEQ{}{\LOOP\sigma}{\sigma}$. It is clear that $\LOOP\sigma\Rel\Wred\GO{\STOP{(\LOOP\sigma)}}\Rel\Wred\LOOP\sigma$ so that we can consider $\LOOP\sigma$ as the ever-looping program of type $\sigma$. \subsubsection*{Booleans.} We define the type $\BOOL=\PLUS\ONE\ONE$, so that $\TSEQ\cP{\COIN p}\BOOL$. We define the ``true'' constant as $\True =\IN \ell \ONELEM$ and the ``false'' constant as $\False =\IN r \ONELEM$. The corresponding eliminator is defined as follows. Given terms $M$, $N_\ell$ and $N_r$ we set $\IFB M{N_\ell}{N_r}=\CASE M{x_\ell}{N_\ell}{x_r}{N_r}$ where $x_i$ is not free in $N_i$ for $i\in\{\ell,r\}$, so that \begin{center} \AxiomC{$\TSEQ\cP M\BOOL$} \AxiomC{$\TSEQ\cP{N_\ell}\sigma$} \AxiomC{$\TSEQ{\cP}{N_r}\sigma$} \TrinaryInfC{$\TSEQ{\cP}{\IFB M{N_\ell}{N_r}}\sigma$} \DisplayProof \end{center} We have the following weak and probabilistic reduction rules, derived from Figure~\ref{fig:reduction-rules}: \begin{center} \AxiomC{} \UnaryInfC{$\IFB \True{N_\ell}{N_r}\Rel\Wred{N_\ell}$} \DisplayProof\quad \AxiomC{} \UnaryInfC{$\IFB \False{N_\ell}{N_r}\Rel\Wred{N_r}$} \DisplayProof \quad \AxiomC{$M\Rel{\Redone p} M'$} \UnaryInfC{$\IFB M{N_\ell}{N_r} \Rel{\Redone p}\IFB {M'}{N_\ell}{N_r}$} \DisplayProof \end{center} \subsubsection*{Natural numbers.} We define the type $\NAT$ of unary natural numbers by $\NAT=\PLUS\ONE\NAT$ (by this we mean that $\NAT=\TREC\zeta{(\PLUS\ONE\zeta)}$). We define $\NUM 0=\IN \ell \ONELEM$ and $\NUM{n+1}=\IN r{\NUM n}$ so that we have $\TSEQ\cP{\NUM n}{\NAT}$ for each $n\in\Nat$. Then, given a term $M$, we define the term $\TSUCC M=\IN r{M}$, so that we have \begin{center} \AxiomC{$\TSEQ\cP M\NAT$} \UnaryInfC{$\TSEQ\cP{\TSUCC M}\NAT$} \DisplayProof \end{center} Last, given terms $M$, $N_\ell$ and $N_r$ and a variable $x$, we define an ``\textsf{ifz}'' conditional by $\IFV M{N_\ell}{x}{N_r}=\CASE Mz{N_\ell}x{N_r}$ where $z$ is not free in $N_\ell$, so that \begin{center} \AxiomC{$\TSEQ\cP M\NAT$} \AxiomC{$\TSEQ\cP{N_\ell}\sigma$} \AxiomC{$\TSEQ{\cP,x:\NAT}{N_r}\sigma$} \TrinaryInfC{$\TSEQ{\cP}{\IFV M{N_\ell}{x}{N_r}}\sigma$} \DisplayProof \end{center} We have the following weak and probabilistic reduction rules, derived from Figure~\ref{fig:reduction-rules}: \begin{center} \AxiomC{} \RightLabel{$i\in\{\ell, r\}$} \UnaryInfC{$\IFV{\IN iV}{M_\ell}{x}{M_r}\Rel\Wred\Subst{M_i}{V}{x}$} \DisplayProof\quad \AxiomC{$M\Rel{\Redone p} M'$} \UnaryInfC{$\IFV M{N_\ell}x{N_r} \Rel{\Redone p}\IFV {M'}{N_\ell}x{N_r}$} \DisplayProof \end{center} These conditionals will be used in the examples below. \subsubsection*{Streams.} Let $\phi$ be a positive type and $\STREAM\phi$ be the positive type defined by $\STREAM\phi=\EXCL{(\TENS\phi{\STREAM\phi})}$, that is $\STREAM\phi=\TREC\zeta{\EXCL{(\TENS\phi\zeta)}}$. We can define a term $M$ such that $\TSEQ{}{M}{\LIMPL{\STREAM\phi}{\LIMPL\NAT \phi}}$ which computes the $n$th element of a stream: \begin{align*} M=\FIXTP f{\LIMPL{\STREAM\phi}{\LIMPL\NAT \phi}}{\ABST x{\STREAM\phi}{\ABST y\NAT{}}{}}\IFV y{\PR \ell {(\GO x)}}{z}{\LAPP{\GO f}{\PR r {(\GO x)}}{\,z}} \end{align*} Let $O=\STOP{(\LOOP{\TENS\phi{\STREAM\phi}})}$, a term which represents the ``undefined stream'' (more precisely, it is a stream which is a value, but contains nothing, not to be confused with $\LOOP{\STREAM\phi}$ which has the same type but is not a value). We have $\Tseq{}{O}{\STREAM\phi}$, and observe that the reduction of $\LAPP MO$ converges (to an abstraction) and that $\LAPP M{O\Appsep\NUM 0}$ diverges. Conversely, we can define a term $N$ such that $\TSEQ {}N{\LIMPL{\EXCL{(\LIMPL\NAT\phi)}}{\STREAM\phi}}$ which turns a function into the stream of its successive applications to an integer. \begin{align*} N=\FIXTP F{\LIMPL{\EXCL{(\LIMPL\NAT\phi)}}{\STREAM\phi}} {\ABST f{\EXCL{(\LIMPL\NAT\phi)}}{}} \STOP{\PAIR{\LAPP{\GO f}{\NUM 0}}{\LAPP{\GO F} { \STOP{(\ABST x\NAT{\LAPP{\GO f}{\TSUCC x}})} } }} \end{align*} Observe that the recursive call of $F$ is encapsulated into a box, which makes the construction lazy. As a last example, consider the following term $P$ such that $\Tseq{}{P}{\LIMPL{(\TENS{\STREAM\phi}{\STREAM\phi})}{\LIMPL{(\PLUS\NAT\NAT)}{\phi}}}$ given by \begin{align*} P=\ABST{y}{\TENS{\STREAM\phi}{\STREAM\phi}} {\ABST{c}{\PLUS\NAT\NAT}{\CASE{c}{x}{\LAPP M{x\Appsep\PR \ell y}}{x}{\LAPP M{x\Appsep\PR r y}}}} \end{align*} Take $\phi=\ONE$ and consider the term $Q=\PAIR{\STOP{\PAIR{\ONELEM}{O}}}O$, then we have $\Tseq{}Q{\TENS{\STREAM\One}{\STREAM\One}}$, and observe that $\LAPP P{Q\Appsep{\IN \ell {\NUM 0}}}$ converges to $\ONELEM$ whereas $\LAPP P{Q\Appsep{\IN r {\NUM 0}}}$ diverges. These examples suggest that $\STREAM\phi$ behaves as should behave a type of streams of elements of type $\phi$. \subsubsection*{Lists.} There are various possibilities for defining a type of lists of elements of a positive type $\phi$. The simplest definition is $\lambda_0=\PLUS\ONE{(\TENS\phi{\lambda_0})}$. This corresponds to the ordinary ML type of lists. But we can also define $\lambda_1=\PLUS\ONE{\EXCL{(\TENS\phi{\lambda_1})}}$ and then we have a type of lazy lists (or terminable streams) where the tail of the list is computed only when required. Here is an example of a term $L$ such that $\Tseq{}{L}{\lambda_1}$, with $\phi=\BOOL=\PLUS\ONE\ONE$ which is a list of random length containing random booleans: \begin{align*} L=\FIXT x{\lambda_1}{\IFB{\COIN{1/4}} {\IN \ell \ONELEM}{\IN r {\STOP{(\TENS{\COIN{1/2}}{\GO x})}}}} \end{align*} Then $L$ will reduce with probability $\frac 14$ to the empty list $\IN \ell \ONELEM$, and with probability $\frac 34$ to the list $L'=\IN r{\STOP{(\TENS{\COIN{1/2}}{L})}}$ (up to the equivalence of $\GO{\STOP L}$ with $L$) which is a value. One can access this value by evaluating the term $\CASE{L'}{z}{\_}{y}{\GO y}$ where $\_$ is any term of type $\TENS\BOOL{\lambda_1}$ (we know that this branch will not be evaluated) and this term reduces to $\PAIR{\True}{L}$ or $\PAIR{\False}{L}$ with probability $\frac 12$. In turn each of these terms $\PAIR bL$ will reduce to $\PAIR b{\IN \ell \ONELEM}$ with probability $\frac14$ and to $\PAIR b{L'}$ with probability $\frac 34$. We can iterate this process, defining a term $R$ of type $\LIMPL{\lambda_1}{\lambda_0}$ which evaluates completely a terminable stream to a list: \begin{align*} R=\FIXT{f}{(\LIMPL{\lambda_1}{\lambda_0})} {\ABST x{\lambda_1}{\CASE{x}{z}{\IN \ell \ONELEM}{z}{\LAPP{\ABST y{ \TENS{\Bool}{\lambda_1}}{\PAIR{\PR\ell y}{\LAPP{\GO f}{\PR r y}}}}{\GO z}}}}\,. \end{align*} Then $\LAPP RL$, which is a closed term of type $\lambda_0$, terminates with probability $1$. The expectation of the length of this ``random list'' is $\sum_{n=0}^\infty n(\frac 34)^n=12$. We could also consider $\lambda_2=\PLUS\ONE{(\TENS{\EXCL \sigma}{\lambda_2})}$ which allows to manipulate lists of objects of type $\sigma$ (which can be a general type) without accessing their elements. \subsubsection*{Probabilistic tests.} If $\TSEQ{\cP}{M_i}{\sigma}$ for $i=1,2$, we set $\DICE{p}{M_1}{M_2}=\IFB{\COIN p}{M_1}{M_2}$ and this term satisfies $\Tseq{\cP}{\DICE{p}{M_1}{M_2}}{\sigma}$. If $M_i$ reduces to a value $V_i$ with probability $q_i$, then $\DICE{p}{M_1}{M_2}$ reduces to $V_1$ with probability $p\,q_1$ and to $V_2$ with probability $(1-p)q_2$. Let $n\in\Nat$ and let $\Vect p=(\List p0n)$ be such that $p_i\in[0,1]\cap\Rational$ and $p_0+\cdots+p_n\leq 1$. Then one defines a closed term $\Ran{\Vect p}$, such that $\Tseq{}{\Ran{\Vect p}}{\Tnat}$, which reduces to $\Num i$ with probability $p_i$ for each $i\in\{0,\dots,n\}$. The definition is by induction on $n$. \begin{equation*} \Ran{\Vect p}= \begin{cases} \Num 0 & \hspace{-10em}\text{if }p_0=1\text{ whatever be the value of }n\\ \IFB{\COIN{p_0}}{\Num 0}{\LOOP\Tnat}& \hspace{-10em}\text{if }n=0\\ \IFB{\COIN{p_0}} {\Num 0} {\TSUCC{\Ran{\frac{p_1}{1-p_0},\dots,\frac{p_n}{1-p_0}}}} &\text{otherwise} \end{cases} \end{equation*} \medskip As an example of use of the test to zero conditional, we define, by induction on $k$, a family of terms $\Probe_k$ such that $\Tseq{}{\Probe_k}{\LIMPL\Tnat\ONE}$ and that tests the equality to $k$: \begin{align*} \Probe_0 = \Abst x\Tnat{\IFV{x}{\ONELEM}{z}{\LOOP\ONE}}\qquad \Probe_{k+1} = \Abst x\Tnat{\IFV{x}{\LOOP\ONE}{z}{\LAPP{\Probe_k}z}} \end{align*} For $M$ such that $\Tseq{}{M}{\Tnat}$, the term $\LAPP{\Probe_k}M$ reduces to $\ONELEM$ with a probability which is equal to the probability of $M$ to reduce to $\Num k$. \subsubsection{Notation.}\label{subsec:not-terms} Now, we introduce terms that will be used in the definition of testing terms in the proof of Full Abstraction in Section~\ref{sec:FA}. First, we define $\Pprod_k$ such that $\Tseq{}{\Pprod_k}{\LIMPL{\ONE}{\cdots\LIMPL{}{\LIMPL\ONE{\LIMPL{\phi}\phi}}}}$ (with $k$ occurrences of $\ONE$): \begin{align*} \Pprod_0 = \ABST y{\phi} y\qquad \Pprod_{k+1} = \ABST x\ONE{\Pprod_k}\,. \end{align*} Given for each $i\in\{0,\dots,k\}$, $M_i$ such that $\Tseq{\cP}{M_i}\ONE$ and $\Tseq{\cP}{N}{\phi}$, the term $\LAPP{\LAPP{\LAPP{\Pprod_{k+1}}{M_0}\cdots}{M_k}}N$ reduces to a value $V$ with probability $p_0\,\cdots\,p_k\,q$ where $p_i$ is the probability of $M_i$ to reduce to $\ONELEM$ and $q$ is the probability of $N$ to reduce to $V$. We use the notations: \begin{equation*} M_0\cdot N=\LAPP{\LAPP{\Pprod_1}{M_0}}N\qquad M_0\AND\cdots\AND M_{k-1} =\left\{ \begin{array}{l} \ONELEM\text{ if $k=0$}\\ \LAPP{\LAPP{\Pprod_{k}}{M_0}{\cdots} }M_{k-1}\text{ otherwise}, \end{array}\right. \end{equation*} so that $\TSEQ{\cP}{M_0\cdot N}{\phi}$ and the probability that $M_0\cdot N$ reduces to $V$ is $p_0\, q$ and $\TSEQ{\cP}{M_0\AND\cdots\AND M_{k-1}}{\ONE}$ and $M_0\AND\cdots\AND M_{k-1}$ reduces to $\ONELEM$ with probability $p_0\,\cdots\,p_{k-1}$. \medskip Given a general type $\sigma$ and terms $\List M0{k-1}$ such that, for any $i\in\{0,\dots,k-1\}$, $\Tseq{}{M_i}\sigma$, we define close terms $\Pchoose^\sigma_i(\List M 0{k-1})$ for $i\in\{0,\dots,n-1\}$ such that $\Tseq{}{\Pchoose^\sigma_i(\List M0{k-1})}{\LIMPL\Tnat{{\sigma}}}$ \begin{align*} \Pchoose^\sigma_0(\List M 0{k-1}) &= \Abst z\Tnat{\LOOP\sigma}\\ \Pchoose^\sigma_{i+1}(\List M 0{k-1}) &= \Abstpref z\Tnat \IFV z{M_0}{y}{\LAPP{\Pchoose^\sigma_{i}(\List M 1{k-1})}{y}} \text{ if }i\le k-1 \end{align*} Given a term $P$ such that $\Tseq{\cP}{P}{\Tnat}$ and $p_i$ the probability of $P$ to reduce to $\Num i$ for any $i$, the first steps of the reduction are probabilistic: \begin{align*} \forall i\in\{0,\dots, k\},\ {\LAPP{\Pchoose^\sigma_{k+1}(\List M0k)}{P}}\Rel{\Redonetr {p_i}} {\LAPP{\Pchoose^\phi_{k+1}(\List M0k)}{\Num i}} \end{align*} the next steps of the reduction are deterministic: \begin{align*} \LAPP{\Pchoose^\phi_{k+1}(\List M0k)}{\Num i} \Rel{\Wredtr} M_i \end{align*} \medskip As we will see more precisely in Paragraph~\ref{subsec:sem-type-term}, a term of type $\Tnat$ can be seen as a sub-probability distribution over $\Nat$. Given integers $0\le l\le r$, we define by induction the term $\Pext lr$ of type $\Limpl\Tnat\Tnat$: \begin{eqnarray*} \Pext 00&=&\ABST z\Tnat{\IFV z{\Num 0}x{\LOOP\Tnat}}\\ \forall r>0,\ \Pext 0r&=& \Pchoose^\Tnat_{r+1}{\TUPLE{\Num 0,\dots,\Num r}}\\ \Pext {l+1}{r+1}&=&\ABST{z}{\Tnat}{\IFV z{\LOOP\Tnat}{x}{\TSUCC{\LAPP{\Pext lr}x}}} \end{eqnarray*} such that if $\Tseq{}{P}{\Tnat}$, then $\LAPP{\Pext lr}P$ extracts the sub-probability distribution with support $\subseteq\{l,\dots,r\}$. Indeed, for any $i\in\{l,\dots,r\}$ $\LAPP{\Pext lr}P$ reduces to $\Num i$ with probability $p_i$ where $p_i$ is the probability of $P$ to reduce to $\Num i$. We also introduce, for $\Vect n=(\List n0k)$ a sequence of $k+1$ natural numbers, a term $\Pwin{i}{\Vect n}$ of type $\Limpl\Tnat\Tnat$ which extracts the sub-probability distribution whose support is in the $i^{th}$ window of length $n_i$ for $0\le i< k$: \begin{eqnarray*} \Pwin 0{\Vect n}&=& \Pext 0{n_0-1}\\ \Pwin {i+1}{\Vect n}&=&\Pext{n_0+\cdots+n_{i}}{n_0+\cdots+n_i+ n_{i+1}-1}. \end{eqnarray*} \subsection{On products and recursive definitions of general types}\label{sec:PCF-products} This section has nothing to do with probabilities, so we consider the deterministic language $\CBPV$, which is just $\pCBPV$ without the $\COIN p$ construct. Our $\CBPV$ general types, which are similar to Levy's CBPV computation types~\cite{LevyP04} or to the SFPL general types~\cite{MarzRohrStreicher99}, have $\LIMPL{}{}$ as only type constructor. This may seem weird when one compares our language with CBPV where products and recursive definitions are possible on computation types and are used for encoding CBN functional languages such as $\PCF$ extended with products. For keeping our presentation reasonably short, we will not consider the corresponding extensions of $\CBPV$ in this paper. Instead, we will shortly argue that such a $\PCF$ language with products can be easily encoded in our $\CBPV$. Another reason for not introducing a product $\IWith$ at the level of general types is that this would introduce a useless redundancy in the language since a type like $\LIMPL{\TENS{\EXCL{\sigma_1}}{\EXCL{\sigma_2}}}\tau$ would then be represented equivalently as $\LIMPL{\EXCL{(\sigma_1\IWith\sigma_2)}}\tau$. Concerning recursive type definitions, it is true that adding them at the level of general types would allow to define interesting types such as $\TREC\zeta{(\LIMPL{\EXCL\zeta}{\zeta})}$, yielding a straightforward encoding of the pure lambda-calculus in our language. This goal can nevertheless be reached (admittedly in a slightly less natural way) by using the positive recursive type definition $\phi=\TREC\zeta{\EXCL{(\LIMPL{\zeta}{\zeta})}}$. A pure term $t$ will be translated into a $\CBPV$ term $\Cterm t$ such that $\Tseq{x_1:{\phi_1},\dots,x_n:\phi}{\Cterm t}{\LIMPL\phi\phi}$, where the list $\List x1n$ contains all the free variables of $t$. This translation is defined inductively as follows: $\Cterm x=\GO x$, $\Cterm{(\App st)}=\GO{(\LAPP{\Cterm s}{\STOP{(\Cterm t)}})}$ and $\Cterm{(\Abs xs)}=\Abs x{\STOP{(\Cterm s)}}$. The examples we provide in Section~\ref{subsec:exsyn} also show that our recursive definitions restricted to positive types allow to introduce a lot of useful data types (integers, lists, trees, streams etc). So we do not see any real motivations for adding recursive general type definitions (and their addition would make the proof of adequacy in Section~\ref{sec:adequacy} even more complicated). Coming back to the redundancy of products, consider the following grammar of types \begin{align*} A,B,\dots\Bnfeq \Cnat\Bnfor \Impl AB\Bnfor\Cprod AB \end{align*} and the following language of terms \begin{align*} s,t,u,\dots\Bnfeq x\Bnfor\Num n\Bnfor\Csuc s\Bnfor\Cpred s \Bnfor\Cifz stu \Bnfor \Abst xAs\Bnfor\App st\Bnfor\Cpair st \Bnfor \Cproj \ell s\Bnfor \Cproj r s\Bnfor\Cfix xAs \end{align*} We call this languages $\PCF$ as it is a straightforward extension of the original $\PCF$ of~\cite{Plotkin77}. The typing rules are described in Figure~\ref{fig:typing-PCF}. A typing context is a sequence $\Gamma=(x_1:A_1,\dots,x_n:A_n)$ where the variables are pairwise distinct. We explain now how we interpret this simple programming language in $\CBPV$. \subsubsection*{Translating $\PCF$ types.} With any type $A$, we associate a \emph{finite sequence} of general types $\Ctype A=(\Ctype A_1,\dots,\Ctype A_n)$ whose length $n=\Clen A$ is given by: $\Clen\Cnat=1$, $\Clen{\Impl AB}=\Clen B$ and $\Clen{\Cprod AB}=\Clen A+\Clen B$. Given a sequence $\Vect\sigma=(\List\sigma 1n)$ of general types we define $\EXCL{\Vect\sigma}$ by induction: $\EXCL{()}=\ONE$ and $\EXCL{(\sigma,\Vect\sigma)}=\TENS{\EXCL\sigma}{\EXCL{\Vect\sigma}}$. Given a positive type $\phi$ and a sequence $\Vect\sigma=(\List\sigma 1n)$ of general types, we define $\LIMPL\phi{\Vect\sigma}=(\LIMPL\phi{\sigma_1},\dots,\LIMPL\phi{\sigma_n})$. Using these notations, we can now define $\Ctype A$ as follows: \begin{itemize} \item $\Ctype\Cnat=(\NAT)$ (a one element sequence) where $\NAT$ is the type of integers introduced in Section~\ref{subsec:exsyn}, $\NAT=\TREC\zeta{(\PLUS\ONE\zeta)}$, \item $\Ctype{(\Impl AB)}=\LIMPL{\EXCL{\Ctype A}}{\Ctype B}$, \item $\Ctype{(\Cprod AB)}=\Ccat{\Ctype A}{\Ctype B}$ (list concatenation). \end{itemize} \subsubsection*{Translating $\PCF$ terms.} Let now $s$ be a $\PCF$ term with typing judgment\footnote{So our translation depends on the typing judgment and not only on the term; this is fairly standard and can be avoided by considering typed free variables.} $\Tseq\Gamma sA$. Let $n=\Clen A$, we define a sequence $\Cterm s$ of length $n$ such that $\Tseq{\EXCL\Gamma}{\Cterm s_i}{\Ctype A_i}$ (for $i=1,\dots,n$) as follows (if $\Gamma=(x_1:C_1,\dots,x_k:C_k)$, then $\EXCL\Gamma=(x_1:\EXCL{\Ctype{C_1}},\dots,x_k:\EXCL{\Ctype{C_k}})$). If $s=x_j$, so that $A=C_j$ (for some $j\in\{1,\dots,k\}$), let $(\List\sigma 1n)=\Ctype A$. Since $\EXCL{\Ctype A}=\TENS{\EXCL{\sigma_1}}{(\TENS{\EXCL{\sigma_2}} {\cdots(\TENS{\EXCL{\sigma_{n-1}}}{(\TENS{\EXCL{\sigma_n}}\ONE)})\cdots})}$ we can set $\Cterm x=(\Cterm x_1,\dots,\Cterm x_n)$ where $\Cterm x_i=\GO{\PR\ell {\PR r {\PR r {\cdots\PR r {x}}}}}$ (with $i-1$ occurrences of $\PR r {}$). We set $\Cterm{\Num n}=\IN r {\cdots\IN r{\IN \ell \ONELEM}}$ ($n$ occurrences of $\IN r{}$), $\Cterm{(\Csuc s)}=\IN r{\Cterm s}$, $\Cterm{(\Cpred s)}=\CASE{\Cterm s}{x}{\IN \ell \ONELEM}{x}{x}$. Assume that $s=\Cifz tuv$ with $\Tseq\Gamma t\NAT$, $\Tseq\Gamma uA$ and $\Tseq\Gamma vA$ for some $\PCF$ type $A$. Let $l=\Clen A$. By inductive hypothesis we have $\Tseq{\EXCL{\Ctype\Gamma}}{\Cterm t}{\NAT}$, $\Tseq{\EXCL{\Ctype\Gamma}}{\Cterm u_i}{\Ctype A_i}$ and $\Tseq{\EXCL{\Ctype\Gamma}}{\Cterm v_i}{\Ctype A_i}$ for $i=1,\dots,l$. So we set $\Cterm s=(\CASE{\Cterm t}{z}{\Cterm u_i}{z}{\Cterm v_i})_{i=1}^l$ where $z$ is a variable which does not occur free in $u$ or $v$. Assume now that $\Tseq{\Gamma,x:A}{s}{B}$, we set $\Cterm{(\Abst xAs)}=(\ABST x{\EXCL{\Ctype A}}{\Cterm s_i})_{i=1}^{\Clen B}$. Assume that $\Tseq\Gamma s{\Impl AB}$ and $\Tseq\Gamma tA$. Then, setting $n=\Clen B$, we have $\Tseq{\EXCL{\Ctype\Gamma}}{\Cterm s_i}{\LIMPL{\EXCL{\Ctype A}}{\Ctype B_i}}$ for $i=1,\dots,n$ and $\Tseq{\EXCL{\Ctype\Gamma}}{\Cterm t_j}{\Ctype A_j}$ for $j=1,\dots,m$ where $m=\Clen A$. Then, setting \[ N=\PAIR{\STOP{(\Cterm{t_1})}}{\PAIR{\cdots}{\PAIR{\STOP{(\Cterm{t_{m-1}})}} {\PAIR{\STOP{(\Cterm{t_{m}})}}\ONELEM}\cdots}} \] we have $\Tseq{\EXCL{\Ctype\Gamma}}{N}{\EXCL{\Ctype A}}$ and we set $\Cterm{(\App st)}=(\LAPP{\Cterm s_i}N)_{i=1}^n$. Assume that $s=\Cpair{s_1}{s_2}$ with $\Tseq\Gamma{s_i}{A_i}$ for $i=1,2$ and $\Tseq\Gamma s{\Cprod{A_1}{A_2}}$. Then we set $\Cterm s=\Ccat{\Cterm{s_1}}{\Cterm{s_2}}$ (list concatenation). Assume that $\Tseq\Gamma s{\Cprod{A_1}{A_2}}$, with $n_i=\Clen{A_i}$ for $i=1,2$. Then we set $\Cterm{(\Cproj \ell s)}=(\Cterm s_1,\dots,\Cterm s_{n_1})$ and $\Cterm{(\Cproj r s)}=(\Cterm s_{n_1+1},\dots,\Cterm s_{n_1+n_2})$. Last assume that $s=\Cfix xAt$ with $\Tseq{\Gamma,x:A}{t}A$ so that, setting $n=\Clen A$, we have $\Tseq{\EXCL{\Ctype\Gamma},x:\EXCL{\Ctype A}}{\Cterm t_i}{\Ctype A_i}$ for $i=1,\dots,n$. Let $\List x1n$ be pairwise distinct fresh variables, and set \[ M_i=\Subst{\Cterm t_i}{\PAIR{{x_1}}{\cdots\PAIR{{x_{n-1}}}{{\PAIR{x_{n}}{\ONELEM}}}\cdots}}{x} \] for $i=1,\dots,n$. We have $\Tseq{\EXCL{\Ctype\Gamma},x_1:\EXCL{\Ctype A_1},\dots,x_n:\EXCL{\Ctype A_n}}{M_i}{\Ctype A_i}$. We are in position of applying the usual trick for encoding mutual recursive definitions using fixpoints operators. For the sake of readability, assume that $n=2$, so we have $\Tseq{\EXCL{\Ctype\Gamma},x_1:\EXCL{\Ctype A_1},x_2:\EXCL{\Ctype A_2}}{M_i}{\Ctype A_i}$ for $i=1,2$. Let $N_1=\FIXT{x_1}{\Ctype{A}_1}{M_1}$ so that $\Tseq{\EXCL{\Ctype\Gamma},x_2:\EXCL{\Ctype A_2}}{N_1}{\Ctype A_1}$. Then we have $\Tseq{\EXCL{\Ctype\Gamma,x_2:\EXCL{\Ctype A_2}}}{\Subst{M_2}{\STOP{N_1}}{x_1}}{\Ctype A_2}$. Therefore we can set $\Cterm s_2=\FIXT{x_2}{\Ctype A_2}{\Subst{M_2}{\STOP{N_1}}{x_1}}$ and we have $\Tseq{\EXCL{\Ctype\Gamma}}{\Cterm s_2}{\Ctype A_2}$. Finally we set $\Cterm s_1=\Subst{N_1}{\STOP{(\Cterm s_2)}}{x_2}$ with $\Tseq{\EXCL{\Ctype\Gamma}}{\Cterm s_1}{\Ctype A_1}$. We should check now that this translation is compatible with the operational semantics of our extended $\PCF$ language. A simple way to do so would be to choose a simple model of linear logic (for instance, the relational model) and to prove that the semantics of a $\PCF$ term is equal to the semantics of its translation in $\pCBPV$ stripped from its probabilistic construct $\COIN p$ (interpreting tuples of types using the ``additive'' cartesian product $\IWith$). This is a long and boring exercise. \begin{figure*} \centering \begin{center} \AxiomC{} \UnaryInfC{$\Tseq{\Gamma,x:A}xA$} \DisplayProof \quad \AxiomC{} \UnaryInfC{$\Tseq\Gamma{\Num n}\Cnat$} \DisplayProof \quad \AxiomC{$\Tseq\Gamma s\Cnat$} \UnaryInfC{$\Tseq\Gamma{\Csuc s}\Cnat$} \DisplayProof \quad \AxiomC{$\Tseq\Gamma s\Cnat$} \UnaryInfC{$\Tseq\Gamma{\Cpred s}\Cnat$} \DisplayProof \end{center} \begin{center} \AxiomC{$\Tseq\Gamma s\Cnat$} \AxiomC{$\Tseq\Gamma tA$} \AxiomC{$\Tseq\Gamma uA$} \TrinaryInfC{$\Tseq\Gamma{\Cifz stu}A$} \DisplayProof \quad \AxiomC{$\Tseq{\Gamma,x:A}sB$} \UnaryInfC{$\Tseq\Gamma{\Abst xAs}{\Impl AB}$} \DisplayProof \end{center} \begin{center} \AxiomC{$\Tseq\Gamma s{\Impl AB}$} \AxiomC{$\Tseq\Gamma tA$} \BinaryInfC{$\Tseq\Gamma{\App st}{B}$} \DisplayProof \quad \AxiomC{$\Tseq\Gamma{s_\ell}{A_\ell}$} \AxiomC{$\Tseq\Gamma{s_r}{A_r}$} \BinaryInfC{$\Tseq\Gamma{\Cpair{s_\ell}{s_r}}{\Cprod{A_\ell}{A_r}}$} \DisplayProof \quad \AxiomC{$\Tseq\Gamma s{\Cprod{A_\ell}{A_r}}$} \RightLabel{$i\in\{\ell,r\}$} \UnaryInfC{$\Tseq\Gamma{\Cproj is}{A_i}$} \DisplayProof \end{center} \begin{center} \AxiomC{$\Tseq{\Gamma,x:A}{M}{A}$} \UnaryInfC{$\Tseq\Gamma{\Cfix xAM}{A}$} \DisplayProof \end{center} \caption{Typing rules for a simple call-by-name language with products, PCF} \label{fig:typing-PCF} \end{figure*} \section{Probabilistic Coherent Spaces}\label{sec:PCS} \subsection{Semantics of LL, in a nutshell} \label{sec:LL-semantics-short} \label{sec:LL-based-models} The kind of denotational models we are interested in, in this paper, are those induced by a model of LL, as explained in~\cite{Ehrhard16a}. We remind the basic definitions and notations, referring to that paper for more details. \subsubsection{Models of Linear Logic.}\label{sec:LL-models} A model of LL consists of the following data. A symmetric monoidal closed category $(\cL,\ITens,\One,\Leftu,\Rightu,\Assoc,\Sym)$ where we use simple juxtaposition $g\Compl f$ to denote composition of morphisms $f\in\cL(X,Y)$ and $g\in\cL(Y,Z)$. We use $\Limpl XY$ for the object of linear morphisms from $X$ to $Y$, $\Evlin\in\cL(\Tens{(\Limpl XY)}{X},Y)$ for the evaluation morphism and $\Curlin\in \cL(\Tens ZX,Y)\to\cL(Z,\Limpl XY)$ for the linear curryfication map. For convenience, and because it is the case in the concrete models we consider (such as Scott Semantics~\cite{Ehrhard16a} or Probabilistic Coherent Spaces here), we assume this SMCC to be a $*$-autonomous category with dualizing object $\Bot$. We use $\Orth X$ for the object $\Limpl X\Bot$ of $\cL$ (the dual, or linear negation, of $X$). The category $\cL$ is cartesian with terminal object $\top$, product $\IWith$, projections $\Proj i$. By $*$-autonomy $\cL$ is co-cartesian with initial object $0$, coproduct $\IPlus$ and injections $\Inj i$. By monoidal closeness of $\cL$, the tensor product $\ITens$ distributes over the coproduct $\IPlus$. We are given a comonad $\Excl\_:\cL\to\cL$ with co-unit $\Der X\in\cL(\Excl X,X)$ (\emph{dereliction}) and co-multiplication $\Digg X\in\cL(\Excl X,\Excl{\Excl X})$ (\emph{digging}) together with a strong symmetric monoidal structure (Seely isos $\Seelyz$ and $\Seelyt$) for the functor $\Excl\_$, from the symmetric monoidal category $(\cL,\IWith)$ to the symmetric monoidal category $(\cL,\ITens)$ satisfying an additional coherence condition wrt.~$\Digg{}$. We use $\Int\_$ for the ``De Morgan dual'' of $\Excl\_$: $\Int X=\Orthp{\Exclp{\Orth X}}$ and similarly for morphisms. It is a monad on $\cL$. \subsubsection{The Eilenberg-Moore category.}\label{sec:EM-general} It is then standard to define the category $\EM\cL$ of $\IExcl$-coalgebras. An object of this category is a pair $P=(\Coalgc P,\Coalgm P)$ where $\Coalgc P\in\Obj\cL$ and $\Coalgm P\in\cL(\Coalgc P,\Excl{\Coalgc P})$ is such that $\Der{\Coalgc P}\Compl\Coalgm P=\Id$ and $\Digg{\Coalgc P}\Compl\Coalgm P=\Excl{\Coalgm P}\Compl\Coalgm P$. Then $f\in\EM\cL(P,Q)$ iff $f\in\cL(\Coalgc P,\Coalgc Q)$ such that $\Coalgm Q\Compl f=\Excl f\Compl\Coalgm P$. The functor $\Excl\_$ can be seen as a functor from $\cL$ to $\EM\cL$ mapping $X$ to $(\Excl X,\Digg X)$ and $f\in\cL(X,Y)$ to $\Excl f$. It is right adjoint to the forgetful functor $\Forgca:\EM\cL\to\cL$. Given $f\in\cL(\Coalgc P,X)$, we use $\Prom f\in\EM\cL(P,\Excl X)$ for the morphism associated with $f$ by this adjunction, one has $\Prom f=\Excl f\Compl\Coalgm P$. If $g\in\EM\cL(Q,P)$, we have $\Prom f\Compl g=\Promp{f\Compl g}$. Then $\EM\cL$ is cartesian (with product of shape $\Tens PQ=(\Tens{\Coalgc P}{\Coalgc Q},\Coalgm{\Tens PQ})$ and terminal object $(\One,\Coalgm\One)$, still denoted as $\One$). This category is also co-cartesian with coproduct of shape $\Plus PQ=(\Plus{\Coalgc P}{\Coalgc Q},\Coalgm{\Plus PQ})$ and initial object $(0,\Coalgm0)$ still denoted as $0$. The complete definitions can be found in~\cite{Ehrhard16a}. We use $\Contr P\in\EM\cL(P,\Tens PP)$ (\emph{contraction}) for the diagonal and $\Weak P\in\EM\cL(P,\One)$ (\emph{weakening}) for the unique morphism to the terminal object. We also consider occasionally the \emph{Kleisli category}\footnote{It is the full subcategory of $\EM\cL$ of free coalgebras, see any introductory text on monads and co-monads.} $\Kl\cL$ of the comonad $\oc$: its objects are those of $\cL$ and $\Kl\cL(X,Y)=\cL(\Excl X,Y)$. The identity at $X$ in this category is $\Der X$ and composition of $f\in\Kl\cL(X,Y)$ and $g\in\Kl\cL(Y,Z)$ is defined as \begin{align*} g\Comp f=g\Compl\Excl f\Compl\Digg X\,. \end{align*} This category is cartesian closed but this fact will not play an essential role in this work. \subsubsection{Fixpoints.}\label{parag:sem-fix-points} For any object $X$, we assume to be given $\Sfix_X\in\cL(\Exclp{\Limpl{\Excl X}X},X)$, a morphism such that\footnote{It might seem natural to require the stronger uniformity conditions of \emph{Conway operator}~\cite{PlotkinSimpson00}. This does not seem to be necessary as far as soundness of our semantics is concerned even if the fixpoint operators arising in concrete models satisfy these further properties.} $\Evlin\Compl(\Tens{\Der{\Limpl{\Excl X}{X}}}{\Prom{\Sfix_X}}) \Comp\Contr{\Excl{(\Limpl{\Excl X}{X})}}=\Sfix_X$ which will allow to interpret term fixpoints. In order to interpret fixpoints of types, we assume that the category $\cL$ is equipped with a notion of embedding-retraction pairs, following a standard approach. We use $\Embr\cL$ for the corresponding category. It is equipped with a functor $\Funofemb:\Embr\cL\to\Op\cL\times\cL$ such that $\Funofemb(X)=(X,X)$ and for which we use the notation $(\Ret\phi,\Emb\phi)=\Funofemb(\phi)$ and assume that $\Ret\phi\Compl\Emb\phi=\Id_X$. We assume furthermore that $\Embr\cL$ has all countable directed colimits and that the functor $\Embf=\Proj2\Compl\Funofemb:\Embr\cL\to\cL$ is continuous. We also assume that all the basic operations on objects ($\ITens$, $\IPlus$, $\Orth{(\_)}$ and $\Excl\_$) are continuous functors from $\Embr\cL$ to itself\footnote{This is a rough statement; one has to say for instance that if $\phi_i\in\Embr\cL(X_i,Y_i)$ for $i=1,2$ then $\Ret{(\Tens{\phi_1}{\phi_2})}=\Tens{\Ret{\phi_1}}{\Ret{\phi_2}}$ etc. The details can be found in~\cite{Ehrhard16a}.}. Then it is easy to carry this notion of embedding-retraction pairs to $\EM\cL$, defining a category $\Embr{\EM\cL}$, to show that this category has all countable directed colimits and that the functors $\ITens$ and $\IPlus$ are continuous on this category: $\Embr{\EM\cL}(P,Q)$ is the set of all $\phi\in\Embr\cL(\Coalgc P,\Coalgc Q)$ such that $\Emb\phi\in\EM\cL(P,Q)$. One checks also that $\Excl{}$ defines a continuous functor from $\Embr\cL$ to $\Embr{\EM\cL}$. This allows to interpret recursive types, more details can be found in~\cite{Ehrhard16a}. \subsubsection{Interpreting types.} \label{sec:cbpv-interpretation} Using straightforwardly the object $\One$ and the operations $\ITens$, $\IPlus$, $\Excl{}$ and $\Limpl{}{}$ of the model $\cL$ as well as the completeness and continuity properties explained in Section~\ref{parag:sem-fix-points}, we associate with any positive type $\phi$ and any repetition-free list $\Vect\zeta=(\List\zeta 1n)$ of type variables containing all free variables of $\phi$ a continuous functor $\Tsemca\phi_{\Vect\zeta}:(\Embr{\EM\cL})^n\to\Embr{\EM\cL}$ and with any general type $\sigma$ and any list $\Vect\zeta=(\List\zeta 1n)$ of pairwise distinct type variables containing all free variables of $\sigma$ we associate a continuous functor $\Tsem\sigma_{\Vect\zeta}:(\Embr{\EM\cL})^n\to\Embr{\cL}$. When we write $\Tsem\sigma$ or $\Tsemca\phi$ (without subscript), we assume implicitly that the types $\sigma$ and $\phi$ have no free type variables. Then $\Tsem\sigma$ is an object of $\cL$ and $\Tsemca\phi$ is an object of $\EM\cL$. We have $\Tsem\phi=\Coalgc{\Tsemca\phi}$ that is, considered as a generalized type, the semantics of a positive type $\phi$ is the carrier of the coalgebra $\Tsemca\phi$. Given a typing context $\cP=(x_1:\phi_1,\dots,x_k:\phi_k)$, we define $\Tsem\cP=\Tsemca{\phi_1}\ITens\cdots\ITens\Tsemca{\phi_k}\in\EM\cL$. In the model or probabilistic coherence spaces considered in this paper, we define $\Embr\cL$ in such a way that the only isos are the identity maps. This implies that the types $\TREC\zeta\phi$ and $\Subst\phi{(\TREC\zeta\phi)}\zeta$ are interpreted as \emph{the same object} (or functor). Such definitions of $\Embr\cL$ are possible in many other models (relational, coherence spaces, hypercoherences etc). We postpone the description of term interpretation because this will require constructions specific to our probabilistic semantics, in addition to the generic categorical ingredients introduced so far. \subsection{The model of probabilistic coherence spaces}\label{subsec:model-pcoh} Given a countable set $I$ and $u,u'\in\Realpto I$, we set $\Eval{u}{u'}=\sum_{i\in I}u_iu'_i$. Given $\cF\subseteq\Realpto I$, we set $\Orth\cF=\{u'\in\Realpto I\mid\forall u\in\cF\ \Eval{u}{u'}\leq 1\}$. A \emph{probabilistic coherence space} (PCS) is a pair $X=(\Web X,\Pcoh X)$ where $\Web X$ is a countable set and $\Pcoh X\subseteq\Realpto{\Web X}$ satisfies \begin{itemize} \item $\Biorth{\Pcoh X}=\Pcoh X$ (equivalently, $\Biorth{\Pcoh X}\subseteq\Pcoh X$), \item for each $a\in\Web X$ there exists $u\in\Pcoh X$ such that $u_a>0$, \item for each $a\in\Web X$ there exists $A>0$ such that $\forall u\in\Pcoh X\ u_a\leq A$. \end{itemize} If only the first of these conditions holds, we say that $X$ is a \emph{pre-probabilistic coherence space} (pre-PCS). The purpose of the second and third conditions is to prevent infinite coefficients to appear in the semantics. This property in turn will be essential for guaranteeing the morphisms interpreting proofs to be analytic functions, which will be the key property to prove full abstraction. So these conditions, though aesthetic at first sight, are important for our ultimate goal. \begin{lemma}\label{lemma:pcoh-charact} Let $X$ be a pre-PCS. The following conditions are equivalent: \begin{itemize} \item $X$ is a PCS, \item $\forall a\in\Web X\,\exists u\in\Pcoh X\,\exists u'\in\Orth{\Pcoh X}\ u_a>0\text{ and }u'_a>0$, \item $\forall a\in\Web X\,\exists A>0\,\forall u\in\Pcoh X\,\forall u'\in\Orth{\Pcoh X}\ u_a\leq A\text{ and }u'_a\leq A$. \end{itemize} \end{lemma} The proof is straightforward. We equip $\Pcoh X$ with the most obvious partial order relation: $u\leq v$ if $\forall a\in\Web X\ u_a\leq v_a$ (using the usual order relation on $\Real$). \begin{theorem}\label{th:Pcoh-prop} $\Pcoh X$ is an $\omega$-continuous domain. Given $u,v\in\Pcoh X$ and $\alpha,\beta\in\Realp$ such that $\alpha+\beta\leq 1$, one has $\alpha u+\beta v\in\Pcoh X$. \end{theorem} This is an easy consequence of the hypothesis $\Biorth{\Pcoh X}\subseteq\Pcoh X$. See~\cite{DanosEhrhard08} for details; from this result, we will only use the closure properties: $\Pcoh X$ is closed under sub-probabilistic linear combinations and under lubs of monotonic sequences. Though the $\omega$-continuity property (and the associated way-below relation) does not play any technical role, it is an intuitively satisfactory fact\footnote{The $\omega$-continuity is similar to separability for topological vector spaces.} which means that the ``size'' of our domains remains bounded. \subsubsection{Morphisms of PCSs}\label{subsec:morphisms} Let $X$ and $Y$ be PCSs. Let $t\in(\Realp)^{\Web X\times\Web Y}$ (to be understood as a matrix). Given $u\in\Pcoh X$, we define $\Matapp tu\in\Realpc^{\Web Y}$ by $(\Matapp tu)_b=\sum_{a\in\Web X}t_{a,b}u_a$ (application of the matrix $t$ to the vector $u$)\footnote{This is an unordered sum, which is infinite in general. It makes sense because all its terms are $\geq 0$.}. We say that $t$ is a \emph{(linear) morphism} from $X$ to $Y$ if $\forall u\in\Pcoh X\ \Matapp tu\in\Pcoh Y$, that is \begin{align*} \forall u\in\Pcoh X\,\forall{v'}\in\Orth{\Pcoh Y}\quad\sum_{(a,b)\in\Web X\times\Web Y}t_{a,b}u_av'_b\leq 1\,. \end{align*} The diagonal matrix $\Id\in(\Realp)^{\Web X\times\Web X}$ given by $\Id_{a,b}=1$ if $a=b$ and $\Id_{a,b}=0$ otherwise is a morphism. In that way we have defined a category $\PCOH$ whose objects are the PCSs and whose morphisms have just been defined. Composition of morphisms is defined as matrix multiplication: let $s\in\PCOH(X,Y)$ and $t\in\PCOH(Y,Z)$, we define $\Matapp ts\in(\Realp)^{\Web X\times\Web Z}$ by \begin{align*} (\Matapp ts)_{a,c}=\sum_{b\in\Web Y}s_{a,b}t_{b,c} \end{align*} and a simple computation shows that $\Matapp ts\in\PCOH(X,Z)$. More precisely, we use the fact that, given $u\in\Pcoh X$, one has $\Matapp{(\Matapp ts)}{u}=\Matapp t{(\Matapp su)}$. Associativity of composition holds because matrix multiplication is associative. $\Id_X$ is the identity morphism at $X$. Given $u\in\Pcoh X$, we define $\Norm u_X=\sup\{\Eval u{u'}\mid u'\in\Pcoh{\Orth X}\}$. By definition, we have $\Norm u_X\in[0,1]$. \subsubsection{Multiplicative constructs}\label{sec:multiplicatives} One sets $\Orth X=(\Web X,\Orth{\Pcoh X})$. It results straightforwardly from the definition of PCSs that $\Orth X$ is a PCS. Given $t\in\PCOH(X,Y)$, one has $\Orth t\in\PCOH(\Orth Y,\Orth X)$ if $\Orth t$ is the transpose of $t$, that is $(\Orth t)_{b,a}=t_{a,b}$. One defines $\Tens{X}{Y}$ by $\Web{\Tens{X}{Y}}=\Web{X}\times\Web{Y}$ and \begin{equation*} \Pcohp{\Tens XY}=\Biorth{\{\Tens uv\mid u\in\Pcoh X\text{ and }v\in\Pcoh Y\}} \end{equation*} where $\Tensp uv_{(a,b)}=u_av_b$. Then $\Tens XY$ is a pre-PCS. We have \[ \Pcoh{\Orth{(\Tens{X}{\Orth Y})}}=\Orth{\{\Tens{u}{v'}\mid u\in\Pcoh X\text{ and }v'\in\Pcoh{\Orth Y}\}}=\PCOH(X,Y)\,. \] It follows that $\Limpl XY=\Orth{(\Tens{X}{\Orth Y})}$ is a pre-PCS. Let $(a,b)\in\Web X\times\Web Y$. Since $X$ and $\Orth Y$ are PCSs, there is $A>0$ such that $u_av'_b<A$ for all $u\in\Pcoh X$ and $v'\in\Pcoh{\Orth Y}$. Let $t\in(\Realp)^{\Web{\Limpl XY}}$ be such that $t_{(a',b')}=0$ for $(a',b')\not=(a,b)$ and $t_{(a,b)}=1/A$, we have $t\in\Pcoh{(\Limpl XY)}$. This shows that $\exists t\in\Pcoh{(\Limpl XY)}$ such that $t_{(a,b)}>0$. Similarly we can find $u\in\Pcoh X$ and $v'\in\Pcoh{\Orth Y}$ such that $\epsilon=u_av'_b>0$. It follows that $\forall t\in\Pcoh{(\Limpl XY)}$ one has $t_{(a,b)}\leq 1/\epsilon$. We conclude that $\Limpl XY$ is a PCS, and therefore $\Tens XY$ is also a PCS. \begin{lemma}\label{lemma:PCS-moprh-charact} Let $X$ and $Y$ be PCSs. One has $\Pcoh{(\Limpl XY)}=\PCOH(X,Y)$. That is, given $t\in\Realpto{\Web X\times\Web Y}$, one has $t\in\Pcoh{(\Limpl XY)}$ iff for all $u\in\Pcoh X$, one has $t\Compl u\in\Pcoh Y$. \end{lemma} This results immediately from the definition above of $\Limpl XY$. \begin{lemma}\label{lemma:tens-morph-charact} Let $X_1$, $X_2$ and $Y$ be PCSs. Let $t\in(\Realp)^{\Web{\Limpl{\Tens{X_1}{X_2}}{Y}}}$. One has $t\in\PCOH(\Tens{X_1}{X_2},Y)$ iff for all $u_1\in\Pcoh{X_1}$ and $u_2\in\Pcoh{X_2}$ one has $\Matapp t{(\Tens{u_1}{u_2})}\in\Pcoh Y$. \end{lemma} \proofitem{Proof.} The condition stated by the lemma is clearly necessary. Let us prove that it is sufficient: under this condition, it suffices to prove that \begin{align*} \Orth t\in\PCOH(\Orth Y,\Orth{(\Tens{X_1}{X_2})})\,. \end{align*} Let $v'\in\Pcoh{\Orth Y}$, it suffices to prove that $\Matapp{\Orth t}{v'}\in\Pcoh{\Orth{(\Tens{X_1}{X_2})}}$. So let $u_1\in\Pcoh{X_1}$ and $u_2\in\Pcoh{X_2}$, it suffices to prove that $\Eval{\Matapp{\Orth t}{v'}}{\Tens{u_1}{u_2}}\leq 1$, that is $\Eval{\Matapp t{(\Tens{u_1}{u_2})}}{v'}\leq 1$, which follows from our assumption. \Endproof Let $s_i\in\PCOH(X_i,Y_i)$ for $i=1,2$. Then one defines \begin{align*} \Tens{s_1}{s_2}\in(\Realp)^{\Web{\Limpl{\Tens{X_1}{X_2}}{\Tens{Y_1}{Y_2}}}} \end{align*} by $(\Tens{s_1}{s_2})_{((a_1,a_2),(b_1,b_2))}=(s_1)_{(a_1,b_1)}(s_2)_{(a_2,b_2)}$ and one must check that \[ \Tens{s_1}{s_2}\in\PCOH({\Tens{X_1}{X_2},\Tens{Y_1}{Y_2}})\,. \] This follows directly from Lemma~\ref{lemma:tens-morph-charact}. Let $\One=(\{*\},[0,1])$. There are obvious choices of natural isomorphisms \begin{align*} \Leftu_X&\in\PCOH(\Tens\One X,X)\\ \Rightu_X&\in\PCOH(\Tens X\One,X)\\ \Assoc_{X_1,X_2,X_3}&\in\PCOH(\Tens{\Tensp{X_1}{X_2}}{X_3}, \Tens{X_1}{\Tensp{X_2}{X_3}})\\ \Sym_{X_1,X_2}&\in\PCOH(\Tens{X_1}{X_2},\Tens{X_2}{X_1}) \end{align*} which satisfy the standard coherence properties. This shows that $(\PCOH,\One,\Leftu,\Rightu,\Assoc,\Sym)$ is a symmetric monoidal category. \subsubsection{Internal linear hom.} Given PCSs $X$ and $Y$, let us define $\Evlin\in(\Realp)^{\Web{\Limpl{\Tens{(\Limpl XY)}{X}}{Y}}}$ by \begin{align*} \Evlin_{(((a',b'),a),b)}= \begin{cases} 1 & \text{if }(a,b)=(a',b')\\ 0 & \text{otherwise.} \end{cases} \end{align*} Then it is easy to see that $(\Limpl XY,\Evlin)$ is an internal linear hom object in $\PCOH$, showing that this SMCC is closed. If $t\in\PCOH(\Tens ZX,Y)$, the corresponding linearly curryfied morphism $\Curlin(t)\in\PCOH(Z,\Limpl XY)$ is given by $\Curlin(t)_{(c,(a,b))}=t_{((c,a),b)}$. \subsubsection{$*$-autonomy.} Take $\Bot=\One$, then one checks readily that $(\PCOH,\One,\Leftu,\Rightu,\Assoc,\Sym,\Bot)$ is a $*$-autonomous category. The duality functor $X\mapsto(\Limpl X\Bot)$ can be identified with the strictly involutive contravariant functor $X\mapsto\Orth X$. \subsubsection{Additives}\label{sec:sem-additives} Let $(X_i)_{i\in I}$ be a countable family of PCSs. We define a PCS $\Bwith_{i\in I}X_i$ by $\Web{\Bwith_{i\in I}X_i}=\bigcup_{i\in I}\{i\}\times\Web{X_i}$ and $u\in\Pcohp{\Bwith_{i\in I}X_i}$ if, for all $i\in I$, the family $u(i)\in(\Realp)^{\Web{X_i}}$ defined by $u(i)_a=u_{(i,a)}$ belongs to $\Pcoh{X_i}$. \begin{lemma} Let $u'\in(\Realp)^{\Web{\Bwith_{i\in I}X_i}}$. One has $u'\in\Pcoh{\Orthp{\Bwith_{i\in I}X_i}}$ iff \begin{itemize} \item $\forall i\in I\ u'(i)\in\Pcoh{\Orth{X_i}}$ \item and $\sum_{i\in I}\Norm{u'(i)}_{\Orth{X_i}}\leq 1$. \end{itemize} \end{lemma} The proof is quite easy. It follows that $\Bwith_{i\in I}X_i$ is a PCS. Moreover we can define $\Proj i\in\PCOH(\Bwith_{j\in I}X_j,X_i)$ by \begin{align*} (\Proj i)_{(j,a),a'}= \begin{cases} 1 & \text{if }j=i\text{ and }a=a'\\ 0 & \text{otherwise.} \end{cases} \end{align*} Then $(\Bwith_{i\in I}X_i,(\Proj i)_{i\in I})$ is the cartesian product of the family $(X_i)_{i\in I}$ in the category $\PCOH$. The coproduct $(\Bplus_{i\in I}X_i,(\Inj i)_{i\in I})$ is the dual operation, so that \begin{align*} \Web{\Bplus_{i\in I}X_i}=\Union_{i\in I}\{i\}\times\Web{X_i} \end{align*} and $u\in\Pcoh{(\Bplus_{i\in I}X_i)}$ if $\forall i\in I\ u(i)\in\Pcoh{X_i}$ and $\sum_{i\in I}\Norm{u(i)}_{X_i}\leq 1$. The injections $\Inj j\in\PCOH(X_j,\Bplus_{i\in I}X_i)$ are given by \begin{align*} (\Inj i)_{a',(j,a)}= \begin{cases} 1 & \text{if }j=i\text{ and }a=a'\\ 0 & \text{otherwise.} \end{cases} \end{align*} Given morphisms $s_i\in\PCOH(X_i,Y)$ (for each $i\in I$), then the unique morphism $s\in\PCOH(\Bplus_{i\in I} X_i, Y)$ is given by $s_{(i,a),b}=(s_i)_{a,b}$ and denoted as $\Case_{i\in I}s_i$ (in the binary case, we use $\Case(s_1,s_2)$). \subsubsection{Exponentials} Given a set $I$, a \emph{finite multiset} of elements of $I$ is a function $b:I\to\Nat$ whose \emph{support} $\Supp b=\{a\in I\mid b(a)\not=0\}$ is finite. We use $\Mfin I$ for the set of all finite multisets of elements of $I$. Given a finite family $\List a1n$ of elements of $I$, we use $\Mset{\List a1n}$ for the multiset $b$ such that $b(a)=\Card{\{i\mid a_i=a\}}$. We use additive notations for multiset unions: $\sum_{i=1}^kb_i$ is the multiset $b$ such that $b(a)=\sum_{i=1}^k b_i(a)$. The empty multiset is denoted as $0$ or $\Msetempty$. If $k\in\Nat$, the multiset $kb$ maps $a$ to $k\,b(a)$. Let $X$ be a PCS. Given $u\in\Pcoh X$ and $b\in\Mfin{\Web X}$, we define $u^b=\prod_{a\in\Web X}u_a^{b(a)}\in\Realp$. Then we set $\Prom u=(u^b)_{b\in\Mfin{\Web X}}$ and finally \begin{align*} \Excl X=(\Mfin{\Web X},\Biorth{\{\Prom u\mid u\in\Pcoh X\}}) \end{align*} which is a pre-PCS. We check quickly that $\Excl X$ so defined is a PCS. Let $b=\Mset{\List a1n}\in\Mfin{\Web X}$. Because $X$ is a PCS, and by Theorem~\ref{th:Pcoh-prop}, for each $i=1,\dots,n$ there is $u(i)\in\Pcoh X$ such that $u(i)_{a_i}>0$. Let $(\alpha_i)_{i=1}^n$ be a family of strictly positive real numbers such that $\sum_{i=1}^n\alpha_i\leq 1$. Then $u=\sum_{i=1}^n\alpha_iu(i)\in\Pcoh X$ satisfies $u_{a_i}>0$ for each $i=1,\dots,n$. Therefore $\Prom u_b=u^b>0$. This shows that there is $U\in\Pcoh{(\Excl X)}$ such that $U_b>0$. Let now $A\in\Realp$ be such that $\forall u\in\Pcoh X\,\forall i\in\{1,\dots,n\}\ u_{a_i}\leq A$. For all $u\in\Pcoh X$ we have $u^b\leq A^n$. We have \begin{align*} \Orth{(\Pcoh{(\Excl X)})}=\Triorth{\{\Prom u\mid u\in\Pcoh X\}} =\Orth{\{\Prom u\mid u\in\Pcoh X\}}\,. \end{align*} Let $t\in\Realpto{\Web{\Excl X}}$ be defined by $t_c=0$ if $c\not=b$ and $t_b=A^{-n}>0$; we have $t\in\Orth{(\Pcoh{(\Excl X)})}$. We have exhibited an element $t$ of $\Orth{(\Pcoh{(\Excl X)})}$ such that $t_b>0$. By Lemma~\ref{lemma:pcoh-charact} it follows that $\Excl X$ is a PCS. \subsubsection{Kleisli morphisms as functions.}\label{subsec:Kleisli_fun} Let $s\in\Realpto{\Web{\Limpl{\Excl X}{Y}}}$. We define a function $\Fun s:\Pcoh X\to\Realpcto{\Web Y}$ as follows. Given $u\in\Pcoh X$, we set \begin{align*} \Fun s(u)=s\Compl {\Prom u}=\left(\sum_{c\in\Web{\Excl X}}s_{c,b}u^c\right)_{b\in\Web Y}\,. \end{align*} \begin{theorem}\label{prop:kleisli-morph-charact} One has $s\in\Pcoh{(\Limpl{\Excl X}{Y})}$ iff, for all $u\in\Pcoh X$, one has $\Fun s(u)\in\Pcoh Y$. \end{theorem} This is an immediate consequence of the definition. \begin{theorem}\label{th:pcoh-functional} Let $s\in\PCOH(\Excl X,Y)$. The function $\Fun s$ is Scott-continuous. Moreover, given $s,s'\in\PCOH(\Excl X,Y)$, one has $s=s'$ (as matrices) iff $\Fun s=\Fun{s'}$ (as functions $\Pcoh X\to\Pcoh Y$). \end{theorem} This is an easy consequence of the fact that two polynomials of $n$ variables with real coefficients are identical iff they are the same function on any open subset of $\Real^n$. \emph{Terminology.} We say that $s\in\Pcoh{(\Limpl{\Excl X}Y)}$ is a \emph{power series} whose monomial $u^c$ has coefficient $s_{c,b}$. Since $s$ is characterized by the function $\Fun s$ we sometimes say that $\Fun s$ is a power series. \medskip We can consider the elements of $\Kl\PCOH(X,Y)$ (the morphisms of the Kleisli category of the comonad $\Excl\_$ on the category $\PCOH$) as particular Scott continuous functions $\Pcoh X\to\Pcoh Y$ and this identification is compatible with the definition of identity maps and of composition in $\Kl\PCOH$, see Section~\ref{sec:EM-general}. Of course, not all Scott continuous function are morphisms in $\Kl\PCOH$. \begin{theorem}\label{prop:order-fun-kleiseli} Let $s,s'\in\Kl\PCOH(X,Y)$ be such that $s\leq s'$ (as elements of $\Pcoh{(\Limpl{\Excl X}Y)}$). Then $\forall u\in\Pcoh X\ \Fun s(u)\leq\Fun{s'}(u)$. Let $(s(i))_{i\in\Nat}$ be a monotone sequence of elements of $\Kl\PCOH(X,Y)$ and let $s=\sup_{i\in\Nat}s(i)$. Then $\forall u\in\Pcoh X\ \Fun s(u)=\sup_{i\in I}\Fun{s_i}(u)$. \end{theorem} The first statement is obvious. The second one results from the monotone convergence Theorem. Given a multiset $b\in\Mfin I$, we define its \emph{factorial} $\Factor b=\prod_{i\in I}\Factor{b(i)}$ and its \emph{multinomial coefficient} $\Multinom{}{b}=\Factor{(\Card b)}/\Factor b\in\Natnz$ where $\Card b=\sum_{i\in I}b(i)$ is the cardinality of $b$. Remember that, given an $I$-indexed family $a=(a_i)_{i\in I}$ of elements of a commutative semi-ring, one has the multinomial formula \begin{align*} \Big(\sum_{i\in I}a_i\Big)^n=\sum_{b\in\Mfinc nI}\Multinom{}b a^b \end{align*} where $\Mfinc nI=\{b\in\Mfin I\mid\Card b=n\}$. Given $c\in\Web{\Excl X}$ and $d\in\Web{\Excl Y}$ we define $\Mexpset cd$ as the set of all multisets $r$ in $\Mfin{\Web X\times\Web Y}$ such that \begin{align*} \forall a\in\Web X\ \sum_{b\in\Web Y}r(a,b)=c(a) \quad\text{and}\quad \forall b\in\Web Y\ \sum_{a\in\Web X}r(a,b)=d(b)\,. \end{align*} Let $t\in\PCOH(X,Y)$, we define $\Excl t\in\Realpto{\Limpl{\Excl X}{\Excl Y}}$ by \begin{align*} (\Excl t)_{c,d} =\sum_{r\in\Mexpset cd}\frac{\Factor d}{\Factor r}t^r\,. \end{align*} Observe that the coefficients in this sum are all non-negative integers. \begin{lemma}\label{lemma:excl-morph-app} For all $u\in\Pcoh X$ one has $\Excl t\Compl\Prom u=\Prom{(t\Compl u)}$. \end{lemma} This results from a simple computation applying the multinomial formula. \begin{theorem} For all $t\in\PCOH(X,Y)$ one has $\Excl t\in\PCOH(\Excl X,\Excl Y)$ and the operation $t\mapsto\Excl t$ is functorial. \end{theorem} Immediate consequences of Lemma~\ref{lemma:excl-morph-app} and Theorem~\ref{th:pcoh-functional}. \subsubsection{Description of the exponential comonad.} We equip now this functor with a structure of comonad: let $\Der X\in\Realpto{\Web{\Limpl{\Excl X}X}}$ be given by $(\Der X)_{b,a}=\Kronecker{\Mset a}{b}$ (the value of the Kronecker symbol $\Kronecker ij$ is $1$ if $i=j$ and $0$ otherwise) and $\Digg X\in\Realpto{\Web{\Limpl{\Excl X}{\Excl{\Excl X}}}}$ be given by $(\Digg X)_{b,\Mset{\List b1n}}=\Kronecker{\sum_{i=1}^n b_i}{b}$. Then we have $\Der X\in\PCOH(\Excl X,X)$ and $\Digg X\in\PCOH(\Excl X,\Excl{\Excl X})$ simply because \begin{align*} \Fun{\Der X}(u)=u\quad\text{and}\quad\Fun{\Digg X}(u)=\Prom{(\Prom u)} \end{align*} for all $u\in\Pcoh X$, as easily checked. Using these equations, one also checks easily the naturality of these morphisms, and the fact that $(\Excl\_,\Der{},\Digg{})$ is a comonad. As to the monoidality of this comonad, we introduce $\Expmonisoz\in\Realpto{\Web{\Limpl{\One}{\Excl\top}}}$ by $\Expmonisoz_{\Onelem,\Mset{}}=1$ and $\Expmonisob XY\in\Realpto{\Web{\Limpl{\Tens{\Excl X}{\Excl Y}}{\Excl{(\With XY)}}}}$ by $(\Expmonisob XY)_{b,c,d}=\Kronecker{d}{\Injms 1b+\Injms 2c}$ where $\Injms i{\Mset{\List a1n}}=\Mset{(i,a_1),\dots,(i,a_n)}$. It is easily checked that the required commutations hold (again, we refer to~\cite{Mellies09}). \subsubsection{Fixpoints in $\Kl\PCOH$.} For any object $Y$ of $\PCOH$, a morphism $t\in\Kl\PCOH(Y,Y)$ defines a Scott-continuous function $f=\Fun t:\Pcohp Y\to\Pcohp Y$ which has a least fixpoint $\sup_{n\in\Nat}f^n(0)$. Let $X$ be an object of $\PCOH$ and set $Y=\Limpl{\Exclp{\Limpl{\Excl X}{X}}}X$. Then we have a morphism $t=\Curlin s\in\Kl\PCOH(Y,Y)$ where $s\in\PCOH( \Tens{\Excl Y} {\Exclp{\Limpl{\Excl X}{X}}} ,X)$ is defined as the following composition of morphisms in $\PCOH$: \begin{center} \begin{tikzpicture}[->, >=stealth] \node (1) {$\Tens{\Excl Y}{\Excl{(\Limpl{\Excl X}{X})}}$}; \node (2) [right of=1, node distance=60mm] {$\Excl Y\ITens\Excl{(\Limpl{\Excl X}{X})} \ITens\Excl{(\Limpl{\Excl X}{X})}$}; \node (3) [below of=2, node distance=12mm] {$\Excl X\ITens(\Limpl{\Excl X}{X})$}; \node (4) [below of=2, node distance=24mm] {$X$}; \tikzstyle{every node}=[midway,auto,font=\scriptsize] \draw (1) -- node [below] {$s$} (4); \draw (1) -- node {$\Tens{\Excl Y}{\Contr{\Limpl{\Excl X}{X}}}$} (2); \draw (2) -- node {$\Tens {\Prom{(\Evlin\Compl(\Tens{\Der Y}{\Excl{(\Limpl{\Excl X}{X})}}))}} {\Der{(\Limpl{\Excl X}{X})}}$} (3); \draw (3) -- node {$\Evlin\Compl\Sym$} (4); \end{tikzpicture} \end{center} Then $\Fun t$ is a Scott continuous function $\Pcoh Y\to\Pcoh Y$ whose least fixpoint is $\Sfix$, considered as a morphism $\Sfix\in\Kl\PCOH(\Limpl{\Excl X}{X},X)$, satisfies $\Fun\Sfix(u)=\sup_{n=0}^\infty\Fun u^n(0)$. \subsubsection{The partially ordered class of probabilistic coherence spaces} \newcommand\Subobj{\subseteq} \newcommand\Subwit[2]{\eta_{#1,#2}} We define the category $\Embr\PCOH$. This category is actually a partially ordered class whose objects are those of $\PCOH$. The order relation, denoted as $\Subobj$, is defined as follows: $X\Subobj Y$ if $\Web X\subseteq\Web Y$ and the matrices $\Emb{\Subwit XY}$ and $\Ret{\Subwit XY}$ defined, for $a\in\Web X$ and $b\in\Web Y$, by $(\Emb{\Subwit XY})_{a,b}=(\Ret{\Subwit XY})_{b,a}=\Kronecker ab$ satisfy $\Emb{\Subwit XY}\in\PCOH(X,Y)$ and $\Ret{\Subwit XY}\in\PCOH(Y,X)$. In other words: given $u\in\Pcoh X$, the element $\Matapp{\Emb{\Subwit XY}}{u}$ of $\Realpto{\Web Y}$ obtained by extending $u$ with $0$'s outside $\Web X$ belongs to $\Pcoh Y$. And conversely, given $v\in\Pcoh Y$, the element $\Matapp{\Ret{\Subwit XY}}{v}$ of $\Realpto{\Web X}$ obtained by restricting $v$ to $\Web X$ belongs to $\Pcoh X$. Considering $\Embr\PCOH$ as a category, $\Subwit XY$ is a notation for the unique element of $\Embr\PCOH(X,Y)$ when $X\Subobj Y$, in accordance with the notations of Paragraph~\ref{parag:sem-fix-points}. \begin{lemma}\label{lemma:sem-orth-subobj} If $X\Subobj Y$ then $\Orth X\Subobj\Orth Y$, $\Emb{\Subwit{\Orth X}{\Orth Y}}=\Orth{(\Ret{\Subwit XY})}$ and $\Ret{\Subwit{\Orth X}{\Orth Y}}=\Orth{(\Emb{\Subwit XY})}$. \end{lemma} The proof is a straightforward verification. We contend that $\Embr\PCOH$ is directed co-complete. Let $(X_\gamma)_{\gamma\in\Gamma}$ be a countable directed family in $\Embr\PCOH$ (so $\Gamma$ is a countable directed poset and $\gamma\leq\gamma'\Rightarrow X_\gamma\Subobj X_{\gamma'}$), we have to check that this family has a least upper bound $X$. We set $\Web X=\bigcup_{\gamma\in\Gamma}\Web{X_\gamma}$ and $\Pcoh X=\{w\in\Realpto{\Web X}\mid\forall\gamma\in\Gamma\ \Matapp{\Ret{\Subwit XY}}{w}\in\Pcoh{X_\gamma}\}$. This defines an object of $\PCOH$ which satisfies $\Pcoh X=\Biorth{\{\Matapp{\Emb{\Subwit{X_\gamma}{X}}}{u}\mid\gamma\in\Gamma\text{ and }u\in\Pcoh{X_\gamma}\}}$ and is therefore the lub of the family $(X_\gamma)_{\gamma\in\Gamma}$ in $\Embr\PCOH$. This object $X$ is denoted $\bigcup_{\gamma\in\Gamma}X_\gamma$. One checks easily that $\Orth{(\bigcup_{\gamma\in\Gamma}X_\gamma)} =\bigcup_{\gamma\in\Gamma}\Orth{X_\gamma}$. Then the functor $\Embf:\Embr\PCOH\to\PCOH$ defined by $\Embf(X)=X$ and $\Embf(\Subwit XY)=\Emb{\Subwit XY}$ is continuous: given a directed family $(X_\gamma)_{\gamma\in\Gamma}$ whose lub is $X$ and given a collection of morphisms $t_\gamma\in\PCOH(X_\gamma,Y)$ such that $t_{\gamma'}\Compl\Emb{\Subwit{X_{\gamma}}{X_{\gamma'}}}=t_\gamma$ for any $\gamma,\gamma'\in\Gamma$ such that $\gamma\leq\gamma'$, there is exactly one morphism $t\in\PCOH(X,Y)$ such that $t\Compl\Emb{\Subwit{X_\gamma}{X}}=t_\gamma$ for each $\gamma\in\Gamma$. Given $a\in\Web X$ and $b\in\Web Y$, $t_{a,b}=(t_\gamma)_{a,b}$ for any $\gamma$ such that $a\in\Web{X_\gamma}$ (our hypothesis on the $t_\gamma$'s means that $(t_\gamma)_{a,b}$ does not depend on the choice of $\gamma$). All the operations of Linear Logic define monotone continuous functionals on $\Embr\PCOH$ which moreover commute with the functor $\Funofemb$. This means for instance that if $X\Subobj Y$ then $\Excl X\Subobj\Excl Y$, $\Emb{\Subwit{\Excl X}{\Excl Y}}=\Excl{(\Emb{\Subwit{X}{Y}})}$, $\Ret{\Subwit{\Excl X}{\Excl Y}}=\Excl{(\Ret{\Subwit{X}{Y}})}$ and $\Excl{(\bigcup_{\gamma\in\Gamma}X_\gamma)}= \bigcup_{\gamma\in\Gamma}\Excl{X_\gamma}$ and similarly for $\ITens$ and $\IPlus$. As a consequence, and as a consequence of Lemma~\ref{lemma:sem-orth-subobj}, if $X_i\Subobj Y_i$ for $i=1,2$ then $\Limpl{X_1}{X_2}\Subobj\Limpl{Y_1}{Y_2}$, $\Emb{\Subwit{\Limpl{X_1}{X_2}}{\Limpl{Y_1}{Y_2}}} =\Limpl{\Ret{\Subwit{X_1}{Y_1}}}{\Emb{\Subwit{X_1}{Y_1}}}$ and $\Ret{\Subwit{\Limpl{X_1}{X_2}}{\Limpl{Y_1}{Y_2}}} =\Limpl{\Emb{\Subwit{X_1}{Y_1}}}{\Ret{\Subwit{X_1}{Y_1}}}$ and $\multimap$ commutes with directed colimits in $\Embr\PCOH$. \newcommand\Coalgmt[1]{\Coalgm{#1}} This notion of inclusion on probabilistic coherence spaces extends to coalgebras as outlined in Section~\ref{parag:sem-fix-points} (again, we refer to~\cite{Ehrhard16a} for more details). We describe briefly this notion of inclusion in the present concrete setting. Let $P$ and $Q$ be object of $\EM\PCOH$, we have $P\Subobj Q$ in $\Embr{\EM\PCOH}$ if $\Coalgc P\Subobj\Coalgc Q$ and $\Coalgm Q\Compl\Emb{\Subwit{\Coalgc P}{\Coalgc Q}}=\Excl{(\Emb{\Subwit{\Coalgc P}{\Coalgc Q}})}\Compl\Coalgm P$. The lub of a directed family $(P_\gamma)_{\gamma\in\Gamma}$ of coalgebras (for this notion of substructure) is the coalgebra $P=\bigcup_{\gamma\in\Gamma}P_\gamma$ defined by $\Coalgc P=\bigcup_{\gamma\in\Gamma}\Coalgc{P_\gamma}$ and $\Coalgm P$ is characterized by the equation $\Coalgm P\Compl\Emb{\Subwit{\Coalgc{P_\gamma}}{\Coalgc P}}=\Excl{\Emb{\Subwit{\Coalgc{P_\gamma}}{\Coalgc P}}}\Compl\Coalgm{P_\gamma}$ which holds for each $\gamma\in\Gamma$. As outlined in Section~\ref{sec:cbpv-interpretation}, this allows to interpret any type $\sigma$ as an object $\Tsem\sigma$ of $\PCOH$ and any positive type $\phi$ as an object $\Tsemca\phi$ such that $\Coalgc{\Tsemca\phi}=\Tsem\phi$, in such a way that the coalgebras $\Tsemca{\TREC\zeta\phi}$ and $\Tsemca{\Subst{\phi}{\TREC\zeta\phi}{\phi}}$ are \emph{exactly the same objects of $\EM\PCOH$}. We use $\Coalgmt\phi$ for $\Coalgm{\Tsemca\phi}$. \subsubsection{Dense coalgebras}\label{sec:reg-coalgebras} Let $P$ be an object of $\EM\PCOH$, so that $P=(\Coalgc P,\Coalgm P)$ where $\Coalgc P$ is a probabilistic coherence space and $\Coalgm P\in\PCOH(\Coalgc P,\Excl{\Coalgc P})$ satisfies $\Digg{\Coalgc P}\Compl\Coalgm P=\Excl{\Coalgm P}\Compl\Coalgm P$. Given coalgebras $P$ and $Q$, a morphism $t\in\PCOH(\Coalgc P,\Coalgc Q)$ is coalgebraic (that is $t\in\EM\PCOH(P,Q)$) if $\Coalgm Q\Compl t=\Excl t\Compl\Coalgm P$. In particular, we say that $u\in\Pcoh{(\Coalgc P)}$ is coalgebraic if, considered as a morphism from $\One$ to $\Coalgc P$, $u$ belongs to $\EM\PCOH(\One,P)$. This means that $\Prom u={\Coalgm P}\Compl u$. \begin{definition}\label{def:dense} Given an object $P$ of $\EM\PCOH$, we use $\PcohEM{(P)}$ for the set of coalgebraic elements of $\Pcoh{(\Coalgc P)}$. \end{definition} The following lemma is useful in the sequel and holds in any model of Linear Logic. \begin{lemma}\label{lemma:sem-values} Let $X$ be a probabilistic coherence space, one has $\PcohEM{(\Excl X)}=\{\Prom u\mid u\in\Pcoh X\}$. Let $P_\ell$ and $P_r$ be objects of $\EM\PCOH$. $\Tens{P_\ell}{P_r}$ is the cartesian product of $P_\ell$ and $P_r$ in $\EM\PCOH$. The function $\PcohEM{(P_\ell)}\times\PcohEM{(P_r)}\to\PcohEM{(\Tens{P_\ell}{P_r})}$ which maps $(u,v)$ to $\Tens uv$ is a bijection. The projections $\Projt i\in\EM\PCOH(\Tens{P_\ell}{P_r},P_i)$ are characterized by $\Projt i(\Tens{u_\ell}{u_r})=u_i$. The function $\{\ell\}\times\PcohEM{(P_\ell)}\cup\{r\}\times\PcohEM{(P_r)} \to\PcohEM{(\Plus{P_\ell}{P_r})}$ which maps $(i,u)$ to $\Inj i(u)$ is a bijection. The injection $u\mapsto\Inj i(u)$ has a left inverse $\Proj i\in\PCOH(\Plus{\Coalgc{P_\ell}}{\Coalgc{P_r}},\Coalgc{P_i})$ defined by $(\Proj i)_{(j,a),b}=\Kronecker{i}{j}\Kronecker{a}{b}$, which is not a coalgebra morphism in general. \end{lemma} \begin{proof} Let $v\in\PcohEM{(\Excl X)}$, we have $\Prom v={\Coalgm{\Excl X}}\Compl v=\Digg X\Compl v$ hence $\Prom{(\Der X\Compl v)}=\Excl{\Der X}\Compl\Prom v=\Excl{\Der X}\Compl\Digg X v=v$. The other properties result from the fact that the Eilenberg-Moore category $\EM\PCOH$ is cartesian and co-cartesian with $\ITens$ and $\IPlus$ as product and co-product, see~\cite{Mellies09} for more details. \end{proof} Because of these properties we write sometimes $(u_\ell,u_r)$ instead of $\Tens{u_\ell}{u_r}$ when $u_i\in\PcohEM{P_i}$ for $i\in\{\ell,r\}$. \begin{definition}\label{def:coalg-dense} An object $P$ of $\EM\PCOH$ is \emph{dense} if, for any object $Y$ of $\PCOH$ and any two morphisms $t,t'\in\PCOH(\Coalgc P,Y)$, if $t\Compl u=t'\Compl u$ for all $u\in\PcohEM{(P)}$, then $t=t'$. \end{definition} \begin{theorem}\label{th:coalg-dense-colsed} For any probabilistic coherence space $X$, $\Excl X$ is a dense coalgebra. If $P_\ell$ and $P_r$ are dense coalgebras then $\Tens{P_\ell}{P_r}$ and $\Plus{P_\ell}{P_r}$ are dense. The colimit in $\Embr{(\EM\PCOH)}$ of a directed family of dense coalgebras is dense. \end{theorem} \begin{proof} Let $X$ be an object of $\PCOH$, one has $\PcohEM{(\Excl X)}=\{\Prom u\mid u\in\Pcoh{X}\}$ by Lemma~\ref{lemma:sem-values}. It follows that $\Excl X$ is a dense coalgebra by Theorem~\ref{th:pcoh-functional}. Assume that $P_\ell$ and $P_r$ are dense coalgebras. Let $t,t'\in\PCOH(\Tens{\Coalgc{P_\ell}}{\Coalgc{P_r}},Y)$ be such that $t\Compl w=t'\Compl w$ for all $w\in\PcohEM{(\Tens{P_\ell}{P_r})}$. We have $\Curlin{(t)},\Curlin{(t')}\in\PCOH(\Coalgc{P_\ell},\Limpl{\Coalgc P_r}{Y})$ so, using the density of $P_\ell$, it suffices to prove that $\Curlin{(t)}\Compl u_\ell=\Curlin{(t')}\Compl u_\ell$ for each $u_\ell\in\PcohEM{(P_\ell)}$. So let $u_\ell\in\PcohEM{(P_\ell)}$ and let $s=\Curlin{(t)}\Compl u_\ell$ and $s'=\Curlin{(t')}\Compl u_\ell$. Let $u_r\in\PcohEM{(P_r)}$, we have $s\Compl u_r=t\Compl(\Tens{u_\ell}{u_r})=t'\Compl(\Tens{u_\ell}{u_r})=s'\Compl u_r$ since $\Tens{u_\ell}{u_r}\in\PcohEM{(\Tens{P_\ell}{P_r})}$ and therefore $s=s'$ since $P_r$ is dense. Let now $t,t'\in\PCOH(\Plus{\Coalgc{P_\ell}}{\Coalgc{P_r}},Y)$ be such that $t\Compl w=t'\Compl w$ for all $w\in\PcohEM{(\Plus{P_\ell}{P_r})}$. To prove that $t=t'$, it suffices to prove that $t\Compl\Inj i=t'\Compl\Inj i$ for $i\in\{\ell,r\}$. Since $P_i$ is dense, it suffices to prove that $t\Compl\Inj i\Compl u=t'\Compl\Inj i\Compl u$ for each $u\in\PcohEM{(P_i)}$ which follows from the fact that $\Inj i\Compl u\in\PcohEM{P_i}$. Last let $(P_\gamma)_{\gamma\in\Gamma}$ be a directed family of dense coalgebras (in $\Embr{\EM\PCOH}$) and let $P=\bigcup_{\gamma\in\Gamma}P_\gamma$, and let $t,t'\in\EM\PCOH(\Coalgc P,Y)$ be such that $t\Compl w=t'\Compl w$ for all $w\in\PcohEM{(P)}$. It suffices to prove that, for each $\gamma\in\Gamma$, one has $t\Compl\Emb{\Subwit{\Coalgc{P_\gamma}}{\Coalgc P}}=t'\Compl\Emb{\Subwit{\Coalgc{P_\gamma}}{\Coalgc P}}$ and this results from the fact that $P_\gamma$ is dense and $\Emb{\Subwit{\Coalgc{P_\gamma}}{\Coalgc P}}$ is a coalgebra morphisms (and therefore maps $\PcohEM{(P_\gamma)}$ to $\PcohEM{(P)}$). \end{proof} The sub-category $\EM\PCOH$ of dense coalgebras is cartesian and co-cartesian and is well-pointed by Theorem~\ref{th:coalg-dense-colsed}. We use $\EMR\PCOH$ for this sub-category and $\Embr{(\EMR\PCOH)}$ for the sub-class of $\Embr{\EM\PCOH}$ whose objects are the dense coalgebras (with the same order relation). \subsubsection{Interpreting types and terms in $\PCOH$}\label{subsec:sem-type-term} Given a type $\sigma$ with free type variables contained in the repetition-free list $\Vect\zeta$, and given a sequence $\Vect P$ of length $n$ of objects of $\EM\PCOH$, we define $\Tsem\sigma_{\Vect\zeta}(\Vect P)$ as an object of $\PCOH$ and when $\phi$ is a positive type (whose free variables are contained in $\Vect\zeta$) we define $\Tsemca\phi_{\Vect\zeta}(\Vect P)$ as an object of $\EM\PCOH$. These operations are continuous and their definition follows the general pattern described in Section~\ref{sec:cbpv-interpretation}. \begin{theorem}\label{th:pos-types-dense} Let $\phi$ be a positive type and let $\Vect\zeta=(\List\zeta 1n)$ be a repetition-free list of type variables which contains all the free variables of $\phi$. Let $\Vect P$ be a sequence of $n$ dense coalgebras. Then $\Tsemca\phi_{\Vect\zeta}(\Vect P)$ is a dense coalgebra. In particular, when $\phi$ is closed, the coalgebra $\Tsemca\phi$ is dense. \end{theorem} This is an immediate consequence of the definition of $\Tsemca\phi$ and of Theorem~\ref{th:coalg-dense-colsed} \begin{remark} This means that we have \emph{only one model}, where positive types are interpreted as objects of $\EM\PCOH$, and not two models as one could expect (one where positive types are interpreted in $\EM\PCOH$, and one where they are interpreted in $\EMR\PCOH$); it simply turns out that the interpretation of positive types in the model $\PCOH/\EM\PCOH$ are dense coalgebras. This is mainly due to the fact that the colimit of a directed family of dense coalgebras \emph{in the partially ordered class $\Embr{\EM\PCOH}$} is dense, see Theorem~\ref{th:coalg-dense-colsed}. From the viewpoint of Levy's CBPV~\cite{LevyP04}, whose semantics is described in terms of adjunctions, we are using a resolution of the comonad ``$\oc$'' through the category $\EM\PCOH$ (or, equivalently, through the category $\EMR\PCOH$). As pointed out to us by one of the referees and already mentioned in the introduction, there is another resolution through a category of families and introduced in~\cite{Abramsky1998}, which is initial among all resolutions that model CBPV. This other option will be explored in further work. \end{remark} Then $\BOOL=\PLUS\ONE\ONE$ satisfies $\Web{\Tsem\BOOL}=\{(\ell,\Onelem),(r,\Onelem)\}$ and $u\in\Realpto{\Web{\Tsem\BOOL}}$ satisfies $u\in\Pcoh{\Tsem\BOOL}$ iff $u_{(\ell,\Onelem)}+u_{(r,\Onelem)}\leq 1$. The coalgebraic structure of this object is given by \begin{align*} (\Coalgmt\BOOL)_{(j,\Onelem),\Mset{(j_1,\Onelem),\dots,(j_k,\Onelem)}}= \begin{cases} 1 & \text{if }j=j_1=\dots=j_k\\ 0 & \text{otherwise.} \end{cases} \end{align*} The object $\Snat=\Tsem\NAT$ satisfies $\Snat=\PLUS\One\Snat$ so that $\Web\SNat=\{(\ell,\Onelem),(r,(\ell,\Onelem)),(r,(r,(\ell,\Onelem))),\dots\}$ and we use $\Snum n$ for the element of $\Web\Snat$ which has $n$ occurrences of $r$. Given $u\in\Realpto{\Web\Snat}$, we use $l(u)$ for the element of $\Realpto{\Web\Snat}$ defined by $l(u)_{\Snum n}=u_{\Snum{n+1}}$. By definition of $\Snat$, we have $u\in\Pcoh\Snat$ iff $u_{\Snum 0}+\Norm{l(u)}_\Snat\leq 1$, and then $\Norm u_\Snat=u_{\Snum 0}+\Norm{l(u)}_\Snat$. It follows that $u\in\Pcoh\Snat$ iff $\sum_{n=0}^\infty u_{\Snum n}\leq 1$ and of course $\Norm u_\Snat=\sum_{n=0}^\infty u_{\Snum n}$. Then the coalgebraic structure $\Coalgmt\NAT$ is defined exactly as $\Coalgmt\BOOL$ above. In the sequel, we identify $\Web\Snat$ with $\Nat$. Given a typing context $\cP=(x_1:\phi_1,\dots,x_k:\phi_k)$, a type $\sigma$ and a term $M$ such that $\TSEQ\cP M\sigma$, $M$ is interpreted as a morphism $\Psem M^\cP\in\PCOH(\Tsem\cP,\Tsem\sigma)$. For all constructs of the language but probabilistic choice, this interpretation uses the generic structures of the model described in Section~\ref{sec:LL-semantics-short}, the description of this interpretation can be found in~\cite{Ehrhard16a}. We set $\Psem{\COIN p}{}=p\Base{(\ell,*)}+(1-p)\Base{(r,*)}$. If $\TSEQ{x_1:\phi_1,\dots,x_k:\phi_k}{M}{\sigma}$, the morphism $\Psem{M}^\cP$ is completely characterized by its values on $(u_1,\dots,u_k)\in\PcohEM{(\Tsemca\cP)}$. We describe now the interpretation of terms using this observation. \begin{itemize} \item $\Psem\ONELEM=1\in\Pcoh{\One}=[0,1]$. \item $\Psem{x_i}^\cP(\List u1k)=u_i$. \item $\Psem{\STOP N}^\cP(\List u1k)=\Prom{(\Psem N^\cP(\List u1k))}$. \item $\Psem{\PAIR{M_\ell}{M_r}}^\cP(\List u1k)= \Tens{\Psem{M_\ell}^\cP(\List u1k)}{\Psem{M_r}^\cP(\List u1k)}$. \item $\Psem{\IN i{N}}^\cP(\List u1k)=\Inj i(\Psem N^\cP(\List u1k))$, $i\in\{\ell,r\}$. \item $\Psem{\GO N}^{\cP}(\List u1k)=\Der{\Tsem\sigma}(\Psem{N}^\cP(\List u1k))$, assuming that $\TSEQ{\cP}{N}{\EXCL\sigma}$. \item If $\TSEQ{\cP}{N}{\LIMPL{\phi}{\sigma}}$ and $\TSEQ{\cP}{R}{\phi}$ then $\Psem{N}^\cP(\List u1k)\in\Pcoh{(\Limpl{\Tsem\phi}{\Tsem\sigma})}$, and $\Psem{R}^\cP(\List u1k)\in\Pcoh{(\Tsem\phi)}$ and using the application of a matrix to a vector we have $\Psem{\LAPP NR}^\cP(\List u1k)=\Psem{N}^\cP(\List u1k)\Compl\Psem{R}^\cP(\List u1k)$. \item If $\TSEQ{\cP,x:\phi}{N}{\sigma}$ then $\Psem{\ABST{x}{\phi}{N}}^\cP(\List u1k)\in\Pcoh{(\Limpl{\Tsem\phi}{\Tsem\sigma})}$ is completely described by the fact that, for all $u\in\PcohEM{(\Tsemca\phi)}$, one has $\Psem{\ABST{x}{\phi}{N}}^\cP(\List u1k)\Compl u=\Psem{N}^{\cP,x:\phi}(\List u1k,u)$. This is a complete characterization of this interpretation by Theorem~\ref{th:pos-types-dense}. \item If $\TSEQ{\cP}{N}{\PLUS{\phi_\ell}{\phi_r}}$ and $\TSEQ{\cP,y_i:\phi_i}{R_i}{\sigma}$ for $i\in\{\ell,r\}$, then\\ $\Psem{\CASE{N}{y_\ell}{R_\ell}{y_r}{R_r}}^\cP(\List u1k)=\Psem{R_\ell}^{\cP,y_\ell:\phi_\ell}(\List u1k,\Proj \ell(\Psem{N}^\cP(\List u1k)))+\Psem{R_r}^{\cP,y_r:\phi_r}(\List u1k,\Proj r(\Psem{N}^\cP(\List u1k)))$ where $\Proj i\in\PCOH{(\Plus{P_\ell}{P_r},P_i)}$ is the $i$th ``projection'' introduced in~\ref{sec:reg-coalgebras}, left inverse for $\Inj i$. \item If $\TSEQ{\cP,x:\EXCL\sigma}{N}{\sigma}$ then $\Psem{N}^{\cP,x:\EXCL\sigma} \in\PCOH(\Tens{\Coalgc{\Tsem\cP}}{\Excl{\Tsem\sigma}},\Tsem\sigma)$ and $\Psem{\FIXT x\sigma N}^\cP(\List u1k)=\sup_{n=0}^\infty f^n(0)$ where $f:\Pcoh{\Tsem\sigma}\to \Pcoh{\Tsem\sigma}$ is the Scott-continuous function given by $f(u)=\Psem{N}^{\cP,x:\Excl\sigma}(\List u1k,\Prom u)$. \item If $\TSEQ{\cP}{N}{\Subst\psi{\TREC\zeta\psi}\zeta}$ then $\Psem{\FOLD N}^\cP=\Psem N^\cP$ which makes sense since $\Tsem{\Subst\psi{\TREC\zeta\psi}\zeta}=\Tsem{\TREC\zeta\psi}$. \item If $\TSEQ{\cP}{N}{\TREC\zeta\psi}$ then $\Psem{\UNFOLD N}^\cP=\Psem N^\cP$. \end{itemize} \begin{theorem}[Soundness]\label{th:soundness} If $M$ satisfies $\TSEQ{\cP}{M}{\sigma}$ then \begin{align*} \Psem M^\cP=\sum_{\TSEQ{\cP}{M'}{\sigma}}\Redmats_{M,M'}\Psem{M'}^{\cP} \end{align*} \end{theorem} The proof is done by induction and is a straightforward verification. \begin{corollary}\label{th:soundness-ineq} Let $M$ be a term such that $\Tseq{}{M}{\One}$ so that $\Psem M\in\Izu$. Then $\Psem M\geq\Redmats^\infty_{M,\ONELEM}$. \end{corollary} This is an immediate consequence of Theorem~\ref{th:soundness} and of the definition of $\Redmats^\infty$, see Section~\ref{sec:obs-eq}. \subsection{Examples of term interpretations}\label{subsec:exden} We give the interpretation of terms that we gave as examples in Subsection~\ref{subsec:exsyn}. \begin{itemize} \item $\Psem{\LOOP\sigma}=\Psem{\FIXT x\sigma{\GO x}}=0$ \item $\Psem{\True}= \Base{(\ell,*)}$ and $\Psem{\False}=\Base{(r,*)}$ \item $\Psem{\IFB M{N_\ell}{N_r}}^\cP(\List u1k)=\Psem{M}^\cP_{(\ell,*)}(\List u1k)\Psem{N_\ell}^\cP(\List u1k)\\+\Psem{M}^\cP_{(r,*)}(\List u1k)\Psem{N_r}^\cP(\List u1k)$ \item $\Psem{\DICE p{M_\ell}{M_r}}^\cP(\List u1k)=p\Psem{M_\ell}^\cP(\List u1k)+(1-p)\Psem{M_r}^\cP(\List u1k)$ \item $\Psem{\NUM n}=\Snum n$ for $n\in\Nat$ \item $\Psem{\TSUCC M}^\cP_{n+1}(\List u1k)= \Psem{M}_n(\List u1k)$ \item $\Psem{\IFV M{N_\ell}x{N_r}}^\cP(\List u1k)=\Psem{M}^\cP_0(\List u1k)\Psem{N_\ell}^\cP(\List u1k)\\+\sum_{n=0}^\infty\Psem{M}^\cP_{n+1}(\List u1k)\Psem{N_r}^\cP(\List u1k)(\Snum n)$ \item $\Psem{\Ran{\Vect p}}=\sum_{i=1}^n p_i \Base{\Snum i}$ \item $\Psem{\LAPP{\Probe_\ell}M}^\cP(\List u1k)= \Psem{M}^\cP(\List u1k)_\ell\Base{*}$ \item $\Psem{M_0\cdot N}^\cP(\List u1k)=\Psem{M_0}^\cP(\List u1k)\Psem N^\cP(\List u1k)$ \item $\Psem{M_0\AND\cdots\AND M_l}^\cP(\List u1k)=\prod_{i=0}^l\Psem{M_i}^\cP(\List u1k)$ \item $\Psem{\LAPP{\Pchoose^\sigma_{l+1}(\List N0l)}P}^\cP(\List u1k)=\sum_{i=0}^l \Psem{P}_i^\cP(\List u1k)\cdot \Psem{N_i}^\cP(\List u1k)$ \item $\forall u \in\Pcoh{(\Tsem{\Tnat})},\ \Psem{\Pext lr}(u)=\sum_{i=l}^ru_i \Base{\Snum i}$ and \[\Psem{\Pwin l{\Vect n}}(u)=\sum_{i=n_1+\cdots+n_{l-1}+1}^{n_1+\cdots+n_l}u_i \Base{\Snum{i}}\] \end{itemize} \section{Adequacy}\label{sec:adequacy} Our goal is to prove the converse of Corollary~\ref{th:soundness-ineq}: for any closed term $M$ such that $\TSEQ{}{M}{\ONE}$, the probability that $M$ reduces to $\ONELEM$ is larger than or equal to $\Psem M{}\in\Pcoh{\Tsem\ONE}\Isom[0,1]$, so that we shall know that these two numbers are actually equal. In spite of its very simple statement, the proof of this property is rather long mainly because we have to deal with the recursive type definitions allowed by our syntax. As usual, the proof is based on the definition of a logical relations between terms and elements of the model (more precisely, given any type $\sigma$, we have to define a relation between closed terms of types $\sigma$ and elements of $\Pcoh{\Tsem\sigma}$; let us call such a relation a \emph{$\sigma$-relation}). Since we have no positivity restrictions on the occurrence of type variables wrt.~which recursive types are defined so that types are neither covariant nor contravariant wrt.~these type variables, we use a very powerful technique introduced in~\cite{Pitts93} for defining this logical relation. Indeed a type variable $\zeta$ can have positive and negative occurrences in a positive\footnote{Warning: the word ``positive'' has two different meanings here!} type $\phi$, consider for instance the case $\phi=\EXCL{(\LIMPL\zeta\zeta)}$ where the type variable $\zeta$ has a positive (on the right of the $\LIMPL{}{}$) and a negative occurrence (on the left). To define the logical relation associated with $\TREC\zeta\phi$, we have to find a fixpoint for the operation which maps a $(\TREC\zeta{\phi})$-relation $\cR$ to the relation $\Phi(\cR)=\EXCL{(\LIMPL{\cR}{\cR})}$ (which can be defined using $\cR$ as a ``logical relation'' in a fairly standard way). Relations are naturally ordered by inclusion, and this strongly suggests to define the above fixpoint using this order relation by \Eg{}~Tarski's Fixpoint Theorem. The problem however is that $\Phi$ is neither a monotone nor an anti-monotone operation on relations, due to the fact that $\zeta$ has a positive and a negative occurrence in $\phi$. It is here that Pitts's trick comes in: we replace the relations $\cR$ with pairs of relations $\cR=(\Nrel\cR,\Prel\cR)$ ordered as follows: $\cR\Subrel\cS$ if $\Prel\cR\subseteq\Prel\cS$ and $\Nrel\cS\subseteq\Nrel\cR$. Then we define accordingly $\Phi(\cR)$ as a pair of relations by $\Nrel{\Phi(\cR)}=\EXCL{(\LIMPL{\Prel\cR}{\Nrel\cR})}$ and $\Prel{\Phi(\cR)}=\EXCL{(\LIMPL{\Nrel\cR}{\Prel\cR})}$. Now the operation $\Phi$ is monotone wrt.~the $\Subrel$ relation and it becomes possible to apply Tarski's Fixpoint Theorem to $\Phi$ and get a pair of relations $\cR$ such that $\cR=\Phi(\cR)$. The next step consists in proving that $\Nrel\cR=\Prel\cR$. This is obtained by means of an analysis of the definition of the interpretation of fixpoints of types as colimits in the category $\Embr\PCOH$. One is finally in position of proving a fairly standard ``Logical Relation Lemma'' from which adequacy follows straightforwardly. In this short description of our adequacy proof, many technicalities have obviously been hidden, the most important one being that values are handled in a special way so that we actually consider two kinds of pairs of relations. Also, a kind of ``biorthogonality closure'' plays an essential role in the handling of positive types, no surprise for the readers acquainted with Linear Logic, see for instance the proof of normalization in~\cite{Girard87}. \subsection{Pairs of relations and basic operations} Given a \emph{closed} type $\sigma$, we define $\Rels\sigma$ as the set of all pairs of relations $\cR=(\Nrel\cR,\Prel\cR)$ such that, for $\epsilon\in\{\POS,\NEG\}$, each element of $\Srel\cR\epsilon$ is a pair $(M,u)$ where $\TSEQ{}{M}{\sigma}$ and $u\in\Pcoh{\Tsem\sigma}$. For a \emph{closed} positive type $\phi$, we also define $\Relsv\phi$ as the set of all pairs of relations $\cV=(\Nrel\cV,\Prel\cV)$ such that, for $\epsilon\in\{\POS,\NEG\}$, each element of $\Srel\cV\epsilon$ is a pair $(V,v)$ where $\TSEQ{}{V}{\phi}$ is a value and $v\in\PcohEM{\Tsem\phi}$. Given $\cR,\cS\in\Rels\sigma$, we write $\cR\Subrel\cS$ if $\Prel\cR\subseteq\Prel\cS$ and $\Nrel\cS\subseteq\Nrel\cR$. We define similarly $\cV\Subrel\cW$ for $\cV,\cW\in\Relsv\phi$. Then $\Rels\sigma$ is a complete meet-lattice, the infimum of a collection $(\cR_i)_{i\in I}$ being $\Infrel_{i\in I}\cR_i=(\bigcup_{i\in I}\Nrel\cR_i,\bigcap_{i\in I}\Prel\cR_i)$. The same holds of course for $\Relsv\phi$ and we use the same notations. We define $\cR(\ONE)$ as the set of all pairs $(M,p)$ such that $\TSEQ{}{M}{\ONE}$, $p\in[0,1]$ and $\Redmats^\infty_{M,\ONELEM}\geq p$. We define in Figure~\ref{fig:adeq-rel-log-op} logical operations on these pairs of relations. The last one is the aforementioned biorthogonality closure operation on pairs of relations. \begin{figure} \centering \begin{itemize} \item Let $\cR\in\Rels\sigma$, we define $\EXCL\cR\in\Relsv{\EXCL\sigma}$ by: $\Srel{\EXCL\cR}\epsilon=\{(\STOP M,\Prom u)\mid (M,u)\in\Srel\cR\epsilon\}$ for $\epsilon\in\{\NEG,\POS\}$. \item Let $\cV_i\in\Relsv{\phi_i}$ for $i\in\{\ell,r\}$. We define $\Srel{(\TENS{\cV_\ell}{\cV_r})}\epsilon=\{(\PAIR{V_\ell}{V_r},\Tens{v_\ell}{v_r})\}\mid (V_i,v_i)\in\Srel{\cV_i}\epsilon\}$ for $\epsilon\in\{\NEG,\POS\}$, so that $\TENS{\cV_\ell}{\cV_r}\in\Relsv{\TENS{\phi_\ell}{\phi_r}}$. \item Let $\cV_i\in\Relsv{\phi_i}$ for $i\in\{\ell,r\}$. We define $\Srel{(\PLUS{\cV_\ell}{\cV_r})}\epsilon=\{(\IN i{V},\Inj i(v))\}\mid i\in\{\ell,r\}\text{ and } (V,v)\in\Srel{\cV_i}\epsilon\}$ for $\epsilon\in\{\NEG,\POS\}$, so that $\PLUS{\cV_\ell}{\cV_r}\in\Relsv{\PLUS{\phi_\ell}{\phi_r}}$. \item Let $\cV\in\Relsv\phi$ and $\cR\in\Rels\sigma$. We define $\LIMPL\cV\cR\in\Rels{\LIMPL\phi\sigma}$ as follows: $\Srel{(\LIMPL\cV\cR)}\epsilon=\{(M,u)\mid\ \TSEQ{}{M}{\LIMPL\phi\sigma},\ u\in\Pcoh{\Tsem{\LIMPL\phi\sigma}}\text{ and }\forall (V,v)\in\Srel\cV{-\epsilon}\ (\LAPP MV,u\Matapp v)\in\Srel\cR\epsilon\}$. \item Last, given $\cV\in\Relsv{\phi}$, we define $\Crel\cV\in\Rels{\phi}$ as follows: $\Srel{\Crel\cV}\epsilon$ is the set of all $(M,u)$ such that $\TSEQ{}{M}{\phi}$, $u\in\Pcoh{\Tsem\phi}$ and, for all $(T,t)\in\Srel{(\LIMPL\cV\cR(\ONE))}{-\epsilon}$, one has $(\LAPP TM,\Matapp tu)\in\cR(\ONE)$. \end{itemize} \caption{Logical operations for pairs of relations} \label{fig:adeq-rel-log-op} \end{figure} Observe that all these operations are monotone wrt.~$\Subrel$. For instance $\cV\Subrel\cW\Andc\cR\Subrel\cS\Rightarrow(\LIMPL\cV\cR)\Subrel(\LIMPL\cW\cS)$, and $\cV\Subrel\cW\Rightarrow\Crel\cV\Subrel\Crel\cW$. \subsection{Fixpoints of pairs of relations} To deal with fixpoint types $\TREC\zeta\phi$, we need to consider types parameterized by relations as follows. Let $\sigma$ be a type and let $\Vect\zeta=(\List\zeta 1n)$ be a list of type variables without repetitions and which contains all free variables of $\sigma$. For all list $\Vect\phi=(\List\phi 1n)$ of \emph{closed} positive types, we define \begin{align*} \Trel\sigma{\Vect\zeta}:\prod_{i=1}^n\Relsv{\phi_i} \to\Rels{\Subst\sigma{\Vect\phi}{\Vect\zeta}}\,. \end{align*} Let also $\phi$ be a positive type whose free variables are contained in $\Vect\zeta$, we define \begin{align*} \Trelv\phi{\Vect\zeta}:\prod_{i=1}^n\Relsv{\phi_i} \to\Relsv{\Subst\phi{\Vect\phi}{\Vect\zeta}}\,. \end{align*} The definition is by simultaneous induction on $\sigma$ and $\phi$. All cases but one consist in applying straightforwardly the above defined logical operations on pairs of relations, for instance \begin{align*} \Trel{\LIMPL\phi\tau}{\Vect\zeta}(\Vect\cV) =\LIMPL{\Trelv\phi{\Vect\zeta}(\Vect\cV)}{\Trel\sigma{\Vect\zeta}(\Vect\cV)} \quad\text{and}\quad \Trel{\phi}{\Vect\zeta}(\Vect\cV)=\Crel{\Trelv\phi{\Vect\zeta}(\Vect\cV)}\,. \end{align*} We are left with the case of recursive definitions of types, so assume that $\phi=\TREC\zeta\psi$. Let $\Vect\phi=(\List\phi 1n)$ be a list of closed positive types and let $\Vect\cV\in\prod_{i=1}^n\Relsv{\phi_i}$, we set \begin{align} \label{eq:bi-rel-fixpoint-def} \Trelv\phi{\Vect\zeta}(\Vect\cV)= \Infrel\{\cV\in\Relsv{\Subst\phi{\Vect\phi}{\Vect\zeta}}\mid \FOLD{\Trelv{\psi}{\Vect\zeta,\zeta}(\Vect\cV,\cV)}\Subrel\cV\} \end{align} where we use the following notation: given $\cW\in\Relsv{\Substbis\psi{\Vect\phi/\Vect\zeta,\Subst\phi{\Vect\phi}{\Vect\zeta}/\zeta}}$, $\FOLD{\cW}\in\Relsv{\Subst{\phi}{\Vect\phi}{\Vect\zeta}}$ is given by $\Srel{\FOLD\cW}{\epsilon}=\{(\FOLD W,v)\mid(W,v)\in\Srel\cW\epsilon\}$ for $\epsilon\in\{\POS,\NEG\}$. We recall the statement of Tarski's fixpoint theorem. \begin{theorem} Let $S$ and $T$ be complete meet semi-lattices and let $f:S\times T\to T$ be a monotone function. For $x\in S$, let $g(x)$ be the meet of the set $\{y\in T\mid f(x,y)\leq y\}$. Then the function $g$ is monotone and satisfies $f(x,g(x))=g(x)$ for each $x\in S$. \end{theorem} Applying this theorem we obtain, by induction on types, the following property. \begin{lemma}\label{lemma:bi-rel-monotone} For any type $\sigma$ and any positive type $\phi$, the maps $\Trel\sigma{\Vect\zeta}$ and $\Trelv\phi{\Vect\zeta}$ are monotone wrt.~the $\Subrel$ order relation. If $\psi$ is a positive type, $\Vect\zeta=(\List\zeta 1n,\zeta)$ is a repetition-free list of type variables containing all the free variables of $\psi$ and $\phi=\TREC\zeta\psi$ and $\Vect\cV=(\List\cV 1n)$ is a list of pairs of relations such that $\cV_i\in\Relsv{\phi_i}$ for each $i$, then $\cV=\Trel\phi{\Vect\zeta}(\Vect\cV)$ satisfies $\cV=\FOLD{\Trel{\psi}{\Vect\zeta,\zeta}}(\Vect\cV,\cV)$. \end{lemma} \subsection{Some useful closeness lemmas} We state and prove a series of lemmas expressing that our pairs of relations are closed under various syntactic and semantic operations. \begin{lemma}\label{lemma:prob-conv-indep-det} Let $M$ and $M'$ be terms such that $\TSEQ{}{M}{\ONE}$ and $\TSEQ{}{M'}{\ONE}$. If $M\Rel\Wred M'$ then $\Redmats^\infty_{M,\ONELEM} =\Redmats^\infty_{M',\ONELEM}$. \end{lemma} This is straightforward since any reduction path from $M$ to $\ONELEM$ must start with the step $M\Rel\Wred M'$, and this is a probability $1$ step. \begin{lemma}\label{lemma:rel-app-closeness} Let $\phi$ be a closed positive type and let $\sigma$ be a closed type. Let $(M,u)\in\Srel{\Trel\phi{}}{-\epsilon}$ and $(R,r)\in\Srel{\Trel{\LIMPL\phi\sigma}{}}{\epsilon}$. Then $(\LAPP RM,\Matapp ru)\in\Srel{\Trel{\sigma}{}}{\epsilon}$. \end{lemma} \begin{proof} We can write $\sigma=\LIMPL{\phi_1}{\LIMPL\cdots{\LIMPL{\phi_n}\psi}}$ for some $n$ and $\List\phi 1n,\psi$ positive and closed. Given $(V_i,v_i)\in\Srel{\Trelv{\phi_i}{}}{-\epsilon}$ for $i=1,\dots,n$, we have to prove that \begin{align*} (\LAPP R{M\,V_1\cdots V_n},\Matapp ru\Appsep v_1\cdots v_n) \in\Srel{(\Crel{\Trelv{\psi}{}})}{\epsilon} \end{align*} so let $(T,t)\in\Srel{(\LIMPL{\Trelv\psi{}}{\Trel\ONE{}})}{-\epsilon}$, we have to prove that \begin{align*} (\LAPP{T}{(\LAPP R{M\,V_1\cdots V_n})},t(\Matapp ru\Appsep v_1\cdots v_n)) \in\Trel{\ONE}{}\,. \end{align*} % Let $S=\ABST{x}{\phi}{\LAPP T{(\LAPP R{x\,V_1\cdots V_n})}}$ so that $\TSEQ{}{S}{\LIMPL\phi\ONE}$. Similarly let $s\in\Pcoh{\Tsem{\LIMPL\phi\ONE}}$ be the linear morphism defined by $\Matapp s{u'}=t(\Matapp r{u'}\Appsep v_1\cdots v_n)$ (the fact that $s$ so defined is actually a morphism in $\PCOH$ results from the symmetric monoidal closeness of that category and from the fact that $r$ and $t$ are morphisms in $\PCOH$). % Let $(V,v)\in\Srel{\Trelv\phi{}}{-\epsilon}$, we have $(\LAPP RV,\Matapp rv)\in\Srel{\Trel\sigma{}}{\epsilon}$ and hence $(\LAPP R{V\Appsep V_1\cdots V_n}),\Matapp rv\Appsep v_1\cdots v_n\in\Srel{\Trel{\psi}{}}{\epsilon}$. Therefore \begin{align*} (\LAPP T{(\LAPP R{V\Appsep V_1\cdots V_n})}),t(\Matapp rv\Appsep v_1\cdots v_n)\in\Trel{\ONE}{} \end{align*} since we have assumed that $(T,t)\in\Srel{(\LIMPL{\Trelv\psi{}}{\Trel\ONE{}})}{-\epsilon}$. Since $t(\Matapp rv\Appsep v_1\cdots v_n)=\Matapp sv$, and by Lemma~\ref{lemma:prob-conv-indep-det}, it follows that $(\LAPP SV,\Matapp sv)\in\Trel\ONE{}$. Hence $(S,s)\in\Srel{\Trel{\LIMPL\phi\ONE}{}}{\epsilon}$ and therefore $(\LAPP SM,\Matapp su)\in\Trel\ONE{}$ since we have $(M,u)\in\Srel{\Trel\phi{}}{-\epsilon}$. We finish the proof by observing that $\Matapp su=t(\Matapp ru\Appsep v_1\cdots v_n)$ and by showing that \begin{align*} \Redmats^\infty_{\LAPP T{\LAPP R{M\,V_1\cdots V_n}},\ONELEM} =\Redmats^\infty_{\LAPP SM,\ONELEM} \end{align*} For this it suffices to observe (by inspection of the reduction rules) that each reduction path $\pi$ from $\LAPP T{(\LAPP R{M\,V_1\cdots V_n})}$ to $\ONELEM$ is of shape $\pi=\lambda\rho$ where \begin{itemize} \item $\lambda$ is a reduction path \[\LAPP T{(\LAPP R{M_1\,V_1\cdots V_n})}\Rel{\Redone{p_1}}\LAPP T{(\LAPP R{M_2\,V_1\cdots V_n})}\Rel{\Redone{p_2}}\cdots\Rel{\Redone{p_k}}\LAPP T{(\LAPP R{M_{k+1}\,V_1\cdots V_n})}\] where $M_1=M$, $M_{k+1}$ is a value $V$ and $M=M_1\Rel{\Redone{p_1}}M_2\Rel{\Redone{p_2}}\cdots\Rel{\Redone{p_{k}}} M_{k+1}=V$ \item and $\rho$ is a reduction path from $\LAPP T{(\LAPP R{V\,V_1\cdots V_n})}$ to $\ONELEM$. \end{itemize} Then we have $\LAPP SM=\LAPP S{M_1}\Rel{\Redone{p_1}}\LAPP S{M_2}\Rel{\Redone{p_2}}\cdots\Rel{\Redone{p_{k}}}\LAPP SV\Rel{\Redone 1} \LAPP T{(\LAPP R{V\,V_1\cdots V_n})}$, the last step resulting from the definition of $S$. In that way, we have defined a probability preserving bijection between the reduction paths from $\LAPP T{(\LAPP R{M_1\,V_1\cdots V_n})}$ to $\ONELEM$ and the reduction paths from $\LAPP SM$ to $\ONELEM$, proving our contention. \end{proof} \begin{lemma}\label{lemma:tens-crel} Let $\phi_i$ be closed positive types and $(M_i,u_i)\in\Srel{\Trel{\phi_i}{}}{\epsilon}$ for $i\in\{\ell,r\}$. Then $(\PAIR{M_\ell}{M_r},\TENS{u_\ell}{u_r}) \in\Srel{\Trel{\TENS{\phi_\ell}{\phi_r}}{}}{\epsilon}$. \end{lemma} \begin{proof} Let $(T,t)\in\Srel{(\Limpl{\Trelv{\TENS{\phi_\ell}{\phi_r}}{}} {\Trel{\ONE}{}})}{-\epsilon}$, we must prove that $(\LAPP T{\PAIR{M_\ell}{M_r}},t(\Tens{u_\ell}{u_r}))\in\Trel{\ONE}{}$. Let $S=\ABST{x_\ell}{\phi_\ell}{\ABST{x_r}{\phi_r}{\LAPP T{\PAIR{x_\ell}{x_r}}}}$ and $s\in\Pcoh{\Tsem{\LIMPL{\phi_\ell}{(\LIMPL{\phi_r}{\ONE})}}}$ be defined by $\Matapp s{u_\ell}\Appsep u_r=t(\Tens{u_\ell}{u_r})$ (again, $s$ is a morphism in $\PCOH$ by symmetric monoidal closeness of that category). It is clear that $(S,s)\in\Srel{(\LIMPL{\Trelv{\phi_\ell}{}} {(\LIMPL{\Trelv{\phi_r}{}}{\Trel{\ONE}{}}{})}{})}{-\epsilon}$. By Lemma~\ref{lemma:rel-app-closeness} we get $(\LAPP S{M_\ell},\Matapp s{u_\ell})\in\Srel{(\LIMPL{\Trelv{\phi_r}{}}{\Trel{\ONE}{}})}{-\epsilon}$ and then $(\LAPP{S}{M_\ell\,M_r},t(\Tens{u_\ell}{u_r})\in\Trel{\ONE}{}$. Observing that there is a probability preserving bijection between the reduction paths from $\LAPP{S}{M_\ell\,M_r}$ to $\ONELEM$ and the reduction paths from $\LAPP T{\PAIR{M_\ell}{M_r}}$ to $\ONELEM$, we conclude that $(\LAPP T{\PAIR{M_\ell}{M_r}},t(\Tens{u_\ell}{u_r}))\in\Trel{\ONE}{}$ as contended (in both terms one has to reduce first $M_\ell$ and then $M_r$ to a value). \end{proof} \begin{lemma}\label{lemma:proj-crel} Let $\phi_\ell$ and $\phi_r$ be closed positive types. If $(M,u)\in\Srel{\Trel{\TENS{\phi_\ell}{\phi_r}}{}}\epsilon$ then $(\PR iM,\Matapp{\Proj i}u)\in\Srel{\Trel{\phi_i}{}}\epsilon$. \end{lemma} \begin{proof} Let $(T,t)\in\Srel{(\Limpl{\Trelv{\phi_i}{}}{\Trel\ONE{}})}{-\epsilon}$, we have to prove that $(\LAPP T{\PR iM},\Matapp t{(\Matapp{\Proj i}u)})\in\Trel\ONE{}$. Let $S=\ABST x{\TENS{\phi_\ell}{\phi_r}}{\LAPP T{\PR ix}}$ and $s\in\Pcoh{\Tsem{\LIMPL{\TENS{\phi_\ell}{\phi_r}}\ONE}}$ be defined by $\Matapp s{u_0}=\Matapp t{(\Matapp{\Proj i}{u_0})}$ for all $u_0\in\Pcoh{\Tsem{\TENS{\phi_\ell}{\phi_r}}}$. Let $(W,w)\in\Srel{\Trelv{\TENS{\phi_\ell}{\phi_r}}{}}\epsilon$, which means that $W=\PAIR{V_\ell}{V_r}$ and $w=\Tens{v_\ell}{v_r}$ with $(V_j,v_j)\in\Srel{\Trelv{\phi_j}{}}\epsilon$ for $j\in\{\ell,r\}$. We have $\LAPP SW\Rel\Wred\LAPP T{V_i}$ and $\Matapp sw=\Matapp t{v_i}$ and we know that $(\LAPP T{V_i},\Matapp t{v_i})\in\Trel\ONE{}$ from which it follows by Lemma~\ref{lemma:prob-conv-indep-det} that $(\LAPP SW,\Matapp sw)\in\Trel{\ONE}{}$. So we have proven that $(S,s)\in\Srel{(\Limpl{\Trelv{\TENS{\phi_\ell}{\phi_r}}{}} {\Trel\ONE{}})}{-\epsilon}$ and hence $(\LAPP SM,\Matapp su)\in\Trel{\ONE}{}$. We have $\Matapp su=\Matapp t{(\Matapp{\Proj i}u)}$. Moreover we have a probability preserving bijection between the reduction paths from $\LAPP T{\PR iM}$ to $\ONELEM$ and the reduction paths from $\LAPP SM$ to $\ONELEM$, and hence we have $(\LAPP T{\PR iM},\Matapp t{(\Matapp{\Proj i}u)})\in\Trel\ONE{}$ as contended. Indeed, any reduction path $\pi$ from $\LAPP T{\PR iM}$ to $\ONELEM$ has shape $\pi=\lambda\rho$ where $\lambda$ is a reduction path $\LAPP T{\PR iM}=\LAPP T{\PR i{M_\ell}}\Rel{\Redone{p_1}}\LAPP T{\PR i{M_r}}\Rel{\Redone{p_2}}\cdots\Rel{\Redone{p_k}}\LAPP T{\PR i{W}}\Rel{\Redone 1}\LAPP T{V_i}$ (with $W=\PAIR{V_\ell}{V_r}$) and $\rho$ is a reduction path from $\LAPP T{V_i}$ to $\ONELEM$. The first steps $\lambda$ of this reduction are determined by the reduction path $M=M_\ell\Rel{\Redone{p_1}}\cdots\Rel{\Redone{p_k}}W$ from $M$ to the value $W$. This reduction path determines uniquely the reduction path $\LAPP SM=\LAPP S{M_\ell}\Rel{\Redone{p_1}}\cdots\Rel{\Redone{p_k}}\LAPP SW\Rel{\Redone 1}\LAPP T{\PR iW}\Rel{\Redone 1}\LAPP T{V_i}$ followed by the reduction $\rho$ from $\LAPP T{V_i}$ to $\ONELEM$ by $\rho$. \end{proof} \begin{lemma}\label{lemma:plus-crel} Let $\phi_\ell$ and $\phi_r$ be closed positive types and let $(M,u)\in\Srel{\Trel{\phi_i}{}}{\epsilon}$ for $i=\ell$ or $i=r$. Then $(\IN i{M},\Matapp{\Inj i}u)\in\Srel{\Trel{\PLUS{\phi_\ell}{\phi_r}}{}}{\epsilon}$. \end{lemma} \begin{proof} Let $(T,t)\in\Srel{(\Limpl{\Trelv{\PLUS{\phi_\ell}{\phi_r}}{}} {\Trel{\ONE}{}})}{-\epsilon}$, we must prove that $(\LAPP T{\IN i{M}},\Matapp t{(\Matapp{\Inj i}u)})\in\Trel{\ONE}{}$. Let $S=\ABST x{\phi_i}{\LAPP t{\IN i(x)}}$ and let $s\in\Pcoh{\Tsem{\LIMPL{\phi_i}{\ONE}}}$. It is clear that $(S,s)\in\Srel{(\Limpl{\Trelv{\phi_i}{}}{\Trel{\ONE}{}}{})}{-\epsilon}$ and it follows that $(\LAPP S{M},\Matapp su)\in\Trel{\ONE}{}$ which implies $(\LAPP T{\IN i{M}},\Matapp t{(\Matapp{\Inj i}u)})\in\Trel{\ONE}{}$ by the usual bijective and probability preserving bijection on reductions. \end{proof} The next lemma uses notations introduced in Section~\ref{sec:sem-additives}. \begin{lemma}\label{lemma:case-crel} Let $\phi_\ell$ and $\phi_r$ be closed positive type and $\sigma$ be a closed type. Let $(M,u)\in\Srel{\Trel{\PLUS{\phi_\ell}{\phi_r}}{}}\epsilon$. For $i\in\{\ell,r\}$, let $R_i$ be a term such that $\TSEQ{y_i:\phi_i}{R_i}{\sigma}$ and assume that $(\ABST{x_i}{\phi_i}{R_i},r_i) \in\Srel{\Trel{\LIMPL{\phi_i}{\sigma}}{}}{-\epsilon}$. Then $(\CASE{M}{y_\ell}{R_\ell}{y_r}{R_r}, \Matapp{\Case(r_\ell,r_r)}u)\in\Srel{\Trel{\sigma}{}}{-\epsilon}$. \end{lemma} \begin{proof} We can write $\sigma=\LIMPL{\psi_1}{\LIMPL\cdots{\LIMPL{\psi_k}{\psi}}}$ where $\psi$ and the $\psi_j$'s are closed and positive types. Given $(W_j,w_j)\in\Srel{\Trelv{\psi_j}{}}{\epsilon}$ for $j=1,\dots,k$, we have to prove that \begin{align}\label{eq:adeq-case-test1} (\LAPP{\CASE{M}{y_\ell}{R_\ell}{y_r}{R_r}}{\Vect W}, \Matapp{\Case(r_\ell,r_r)}u\Appsep\Vect w) \in\Srel{\Trelv{\psi}{}}{-\epsilon} \end{align} so let $(T,t)\in\Srel{(\Limpl{\Trelv{\psi}{}}{\Trel\ONE{}})}{\epsilon}$, our goal is to prove that \begin{align}\label{eq:adeq-case-test2} (\LAPP T{\LAPP{\CASE{M}{y_\ell}{R_\ell}{y_r} {R_r}}{\Vect W}}, \Matapp t{(\Matapp{\Case(r_\ell,r_r)}u\Appsep\Vect w)})\in\Trel\ONE{}\,. \end{align} Let $S=\ABST x{\PLUS{\phi_\ell}{\phi_r}}{\LAPP T{\LAPP{\CASE{x}{y_\ell}{R_\ell}{y_r} {R_r}}{\Vect W}}}$ and $s\in\Pcoh{\Tsem{\LIMPL{\PLUS{\phi_\ell}{\phi_r}}{\ONE}}}$ be defined by $\Matapp s{u_0}=\Matapp t{(\Matapp{\Case(r_\ell,r_r)}{u_0}\Appsep\Vect w)}$ for each $u_0\in\Pcoh{\Tsem{\PLUS{\phi_\ell}{\phi_r}}}$. Then we have $(S,s)\in\Srel{(\Limpl{\Trelv{\PLUS{\phi_\ell}{\phi_r}}{}} {\Trel\ONE{}})}{\epsilon}$. Let indeed $i\in\{\ell,r\}$ and let $(V,v)\in\Srel{\Trelv{\phi_i}{}}{-\epsilon}$ so that $(\IN iV,\Matapp{\Inj i}v)\in\Srel{\Trelv{\PLUS{\phi_\ell}{\phi_r}}{}}{-\epsilon}$. We have $\LAPP S{\IN iV}\Rel{\Transcl{\Wred}}\LAPP{T} {\LAPP{\Subst{R_i}{V}{y_i}}{\Vect W}}$ and $\Matapp s{(\Matapp{\Inj i}v)}=\Matapp t{(\Matapp{r_i}v\Appsep\Vect w)}$ and, by our assumptions and Lemma~\ref{lemma:prob-conv-indep-det}, $(\Subst{R_i}{V}{y_i},\Matapp{r_i}v)\in\Srel{\Trel{\sigma}{}}{-\epsilon}$ and hence $(\LAPP{\Subst{R_i}{V}{y_i}}{\Vect W},\Matapp{r_i}v\Appsep\Vect w)\in\Srel{\Trelv{\psi}{}}{-\epsilon}$. By Lemma~\ref{lemma:prob-conv-indep-det} it follows that $(\LAPP S{\IN iV},\Matapp s{(\Matapp{\Inj i}v)})\in\Trel\ONE{}$ and hence $(S,s)\in\Srel{(\Limpl{\Trelv{\PLUS{\phi_\ell}{\phi_r}}{}} {\Trel\ONE{}})}{\epsilon}$ as contended. Therefore $(\LAPP SM,\Matapp su)\in\Trel\ONE{}$. There is a bijective and probability preserving correspondence between the reductions from $\LAPP SM$ to $\ONELEM$ and the reductions from $\LAPP T{\LAPP{\CASE{M}{x_\ell}{\LAPP{R_\ell}{x_\ell}}{x_r} {\LAPP{R_r}{x_r}}}{\Vect W}}$ to $\ONELEM$: as usual such reductions start with a reduction $M=M_1\Rel{\Redone{p_1}}M_2\Rel{\Redone{p_2}}\cdots\Rel{\Redone{p_k}}M_k=\IN iV$ where $i\in\{\ell,r\}$ and $V$ is a value of type $\phi_i$ and (after a few $\Wred$-steps) continue with a reduction from $\LAPP{T}{\LAPP{R_i}{V\,\Vect W}}$ to $\ONELEM$. Therefore~\Eqref{eq:adeq-case-test2} holds and hence we have~\Eqref{eq:adeq-case-test1}, this ends the proof of the lemma. \end{proof} \begin{lemma}\label{lemma:der-crel} Let $\sigma$ be a closed type and let $(M,u)\in\Srel{\Trel{\EXCL\sigma}{}}\epsilon$. We have $(\GO M,\Matapp{\Der{}}u)\in\Srel{\Trel\sigma{}}\epsilon$. \end{lemma} \begin{proof} We can write $\sigma=\LIMPL{\psi_1}{\LIMPL\cdots{\LIMPL{\psi_k}{\psi}}}$ where $\psi$ and the $\psi_j$'s are closed and positive types. Given $(W_j,w_j)\in\Srel{\Trelv{\psi_i}{}}{-\epsilon}$, we have to prove that \begin{align}\label{eq:adeq-der-test1} (\LAPP{\GO M}{\Vect W}, \Matapp{\Der{}}u\Appsep\Vect w)\in\Srel{\Trelv{\psi}{}}{\epsilon} \end{align} so let $(T,t)\in\Srel{(\Limpl{\Trelv{\psi}{}}{\Trel\ONE{}})}{-\epsilon}$, our goal is to prove that \begin{align}\label{eq:adeq-der-test2} (\LAPP T{\LAPP{\GO M}{\Vect W}}, \Matapp t{(\Matapp{\Der{}}u\Appsep\Vect w)})\in\Trel\ONE{}\,. \end{align} We set $S=\ABST x{\EXCL\sigma}{\LAPP T{\LAPP{\GO x}{\Vect W}}}$ and we define $s\in\Pcoh{\Tsem{\LIMPL{\EXCL\sigma}{\ONE}}}$ by $\Matapp s{u_0}=\Matapp t{(\Matapp{\Der{}}{u_0}\Appsep\Vect w)}$ for all $u_0\in\Pcoh{\Tsem{\EXCL\sigma}}$, and we prove that $(S,s)\in\Srel{(\Limpl{\Trelv{\EXCL\sigma}{}}{\Trel\ONE{}})}{-\epsilon}$ as in the proof of Lemme~\ref{lemma:case-crel} (for instance). We finish the proof in the same way, showing~\Eqref{eq:adeq-der-test2} by establishing a bijective and probability preserving correspondence between reductions. Our contention~\Eqref{eq:adeq-der-test1} follows. \end{proof} \begin{lemma}\label{lemma:unfold-crel} Let $\phi$ be a closed positive type of shape $\phi=\TREC\zeta\psi$. If $(M,u)\in\Srel{\Trel{\phi}{}}\epsilon$ then $(\UNFOLD M,u)\in\Srel{\Trel{\Subst\psi\phi\zeta}{}}\epsilon$. \end{lemma} \begin{proof} Let $(T,t)\in\Srel{(\Limpl{\Trelv{\Subst\psi\phi\zeta}{}}{\Trel\ONE{}})} {-\epsilon}$, we must prove that $(\LAPP T{\UNFOLD M},u)\in\Trel{\ONE}{}$. As usual one defines $S=\ABST x{\phi}{\LAPP T{\UNFOLD x}}$ and one proves that $(S,t)\in\Srel{(\Limpl{\Trelv{\phi}{}}{\Trel\ONE{}})} {-\epsilon}$. This results from the fact that if $(V,v)\in\Srel{\Trelv{\phi}{}}{\epsilon}$ then $V=\FOLD W$ with $(W,v)\in\Srel{\Trelv{\Subst\psi\phi\zeta}{}}{\epsilon}$, from Lemma~\ref{lemma:prob-conv-indep-det} and from the fact that $\UNFOLD{\FOLD W}\Rel\Wred W$ (and of course from our assumption on $(T,t)$). It follows that $(\LAPP SM,\Matapp tu)\in\Trel{\ONE}{}$ from which we deduce $(\LAPP T{\UNFOLD M},u)\in\Trel{\ONE}{}$ by the usual reasoning involving a bijective probability preserving correspondence on reductions. \end{proof} \begin{lemma}\label{lemma:fold-crel} Let $\phi$ be a closed positive type of shape $\phi=\TREC\zeta\psi$. If $(M,u)\in\Srel{\Trel{\Subst\psi\phi\zeta}{}}\epsilon$ then $(\FOLD M,u)\in\Srel{\Trel{\phi}{}}\epsilon$. \end{lemma} \begin{proof} Let $(T,t)\in\Srel{(\Limpl{\Trelv{\phi}{}}{\Trel\ONE{}})} {-\epsilon}$, we must prove that $(\LAPP T{\FOLD M},u)\in\Trel{\ONE}{}$. As usual one defines $S=\ABST x{\Subst\psi\phi\zeta}{\LAPP T{\FOLD x}}$ and one proves that $(S,t)\in\Srel{(\Limpl{\Trelv{\Subst\psi\phi\zeta}{}}{\Trel\ONE{}})} {-\epsilon}$. This results easily from the fact that, if $(V,v)\in\Srel{\Trelv{\Subst\psi\phi\zeta}{}}{\epsilon}$ then $(\FOLD V,v)\in\Srel{\Trelv{\phi}{}}{\epsilon}$, from Lemma~\ref{lemma:prob-conv-indep-det} and from our assumption about $(T,t)$. Therefore we have $(\LAPP SM,\Matapp tu)\in\Trel{\ONE}{})$ from which we deduce $(\LAPP T{\FOLD M},u)\in\Trel{\ONE}{}$ by the usual reasoning. \end{proof} \begin{lemma}\label{lemma:Trel-sem-closeness} Let $\sigma$ be a closed type and let $M$ be a closed term of type $\sigma$. Then $(M,0)\in\Srel{\Trel{\sigma}{}}{\epsilon}$ and, if $D\subseteq\Pcoh{\Tsem\sigma}$ is directed and satisfies $\forall u\in D\ (M,u)\in\Srel{\Trel{\sigma}{}}{\epsilon}$ then $(M,\sup D)\in\Srel{\Trel{\sigma}{}}{\epsilon}$. Last, if $(M,u)\in\Srel{\Trel{\sigma}{}}{\epsilon}$ and $u'\leq u$ then $(M,u')\in\Srel{\Trel{\sigma}{}}{\epsilon}$. \end{lemma} \begin{proof} We can write $\sigma=\LIMPL{\phi_1}{\LIMPL\cdots{\LIMPL{\phi_n}\psi}}$ for some $n$ and $\List\phi 1n,\psi$ positive and closed. Let us prove the second statement. For $i=1,\dots,n$, let $(V_i,v_i)\in\Srel{\Trelv{\phi_i}{}}{-\epsilon}$, we must prove that $(\LAPP M{V_1\cdots V_n},\Matapp{(\sup D)}{v_1}\cdots v_n)\in\Srel{\Crel{\Trelv{\psi}{}}}{\epsilon}$, knowing that \[\forall u\in D\quad (\LAPP M{V_1\cdots V_n},u\Appsep v_1\cdots v_n)\in\Srel{\Crel{\Trelv{\psi}{}}}{\epsilon}\,. \] This results from the fact that, given $t\in\Pcoh{\Tsem{\LIMPL\psi\ONE}}$, the map $u\mapsto \Matapp t{(u\Appsep v_1\cdots v_n)}$ is Scott continuous from $\Pcoh{\Tsem\phi}$ to $[0,1]$. The first statement of the lemma results from the fact that this function maps $0$ to $0$. The last one results from the fact that this function is monotone. \end{proof} \subsection{Uniqueness of the relation} With any closed type $\sigma$ we have associated a pair of relations $\Trel\sigma{}$. We need now to prove that this pair satisfies $\Srel{\Trel\sigma{}}\POS=\Srel{\Trel\sigma{}}\NEG$ so that we have actually associated a unique relation with any type. To this end we prove first that $\Srel{\Trel\sigma{}}\POS\subseteq\Srel{\Trel\sigma{}}\NEG$. Defining, for any pair of relations $\cR$, the relation $\Op\cR$ as $(\Srel\cR\POS,\Srel\cR\NEG)$, this amounts to proving that ${\Trel\sigma{}}\Subrel\Op{\Trel\sigma{}}$. We use the same notation for the elements of $\Relsv\phi$ for $\phi$ positive. For the next lemma, we use the same notational conventions as above. \begin{lemma} Let $\Vect\cV$ be a list of pairs of relations such that $\cV_i\in\Relsv{\phi_i}$ and $\cV_i\Subrel\Op{\cV_i}$ for each $i$. Then $\Trel\sigma{\Vect\zeta}(\Vect\cV) \Subrel\Op{\Trel\sigma{\Vect\zeta}(\Vect\cV)}$ and $\Trelv\phi{\Vect\zeta}(\Vect\cV) \Subrel\Op{\Trelv\phi{\Vect\zeta}(\Vect\cV)}$. \end{lemma} \begin{proof} The proof is by induction on types. All cases result straightforwardly from the monotony of the logical operations on pairs of relations, but the case of fixpoints of types. So assume that $\phi=\TREC\zeta\psi$, let $\cV=\Trelv\phi{\Vect\zeta}(\Vect\cV)$ and let us prove that $\cV \Subrel\Op\cV$. For this, because of the definition of $\cV$ as a glb~\Eqref{eq:bi-rel-fixpoint-def}, it suffices to show that \begin{align*} \FOLD{\Trelv{\psi}{\Vect\zeta,\zeta}(\Vect\cV,\Op\cV)}\Subrel\Op\cV\,. \end{align*} By the first statement of Lemma~\ref{lemma:bi-rel-monotone} and our assumption on the $\cV_i$'s we have \[ \FOLD{\Trelv{\psi}{\Vect\zeta,\zeta}({\Vect\cV},\Op\cV)} \Subrel\FOLD{\Trelv{\psi}{\Vect\zeta,\zeta}(\Op{\Vect\cV},\Op\cV)}\,. \] By inductive hypothesis we have $\FOLD{\Trelv{\psi}{\Vect\zeta,\zeta}(\Op{\Vect\cV},\Op\cV)} \Subrel\Op{\FOLD{\Trelv{\psi}{\Vect\zeta,\zeta}({\Vect\cV},\cV)}}=\Op\cV$ since $\cV=\FOLD{\Trelv{\psi}{\Vect\zeta,\zeta}({\Vect\cV},\cV)}$ by Lemma~\ref{lemma:bi-rel-monotone}. \end{proof} We are left with proving the converse property, namely that $\Op{\Trel\sigma{}}\Subrel\Trel\sigma{}$ for each closed type $\sigma$. This requires a bit more work, and is based on a notion of ``finite'' approximation of elements of the model, that we define by syntactic means as follows. \subsubsection{Restriction operators} We define\footnote{This definition as well as our reasoning below features some similarities with \emph{step-indexing} that we would like to understand better.} closed terms $\Restr n\sigma$ and $\Restrv n\phi$ (for $n\in\Nat$, $\sigma$ a type and $\phi$ a positive type) typed as follows: $\TSEQ{}{\Restr n\sigma}{\LIMPL{\EXCL\sigma}{\sigma}}$ and $\TSEQ{}{\Restrv n\phi}{\LIMPL{\phi}{\phi}}$. \begin{align*} \Restr n\phi &= \ABST x{\Excl\phi}{\LAPP{\Restrv n\phi}{\GO x}} \\ \Restr n{\LIMPL\phi\sigma} &= \ABST f{\EXCL{(\LIMPL\phi\sigma)}} {\ABST{x}{\phi}{\LAPP{\Restr{n}{\sigma}} {\STOP{(\LAPP{\GO f}{\LAPP{\Restrv n\phi}{x}})}}}}\\ \Restrv n\ONE &= \ABST x\ONE x\\ \Restrv{n}{\EXCL\sigma} &= \ABST{x}{\EXCL\sigma}{\STOP{(\LAPP{\Restr n\sigma}{x})}}\\ \Restrv{n}{\TENS{\phi_\ell}{\phi_r}} &= \ABST x{\TENS{\phi_\ell}{\phi_r}}{\PAIR{\LAPP{\Restrv n{\phi_\ell}}{\PR \ell x}}{\LAPP{\Restrv n{\phi_r}}{\PR r x}}}\\ \Restrv n{\PLUS{\phi_\ell}{\phi_r}} &= \ABST x{\PLUS{\phi_\ell}{\phi_r}}{\CASE{x}{x_\ell} {\IN \ell {\LAPP{\Restrv n{\phi_\ell}}{x_\ell}}}{x_r} {\IN r {\LAPP{\Restrv n{\phi_r}}{x_r}}}}\\ \Restrv 0{\TREC\zeta\phi} &= \ABST x{\TREC\zeta\phi}{\LOOP{\TREC\zeta\phi}}\\ \Restrv{n+1}{\TREC\zeta\phi} &= \ABST{x}{\TREC\zeta\phi}{\FOLD{\LAPP{\Restrv n{\Subst\phi{\TREC\zeta\phi}\zeta}}{\UNFOLD x}}} \end{align*} This is a well-founded lexicographic inductive definition on triples $(n,\sigma,l)$ (where $l\in\{\Vsymb,\Gsymb\}$) if we order the symbols $\Vsymb$ and $\Gsymb$ by $\Vsymb<\Gsymb$. We consider actually only triples $(n,\sigma,l)$ such that $\sigma$ is positive if $l=\Vsymb$. We describe similarly the interpretation of these terms: we give an explicit description of the matrices $\Psem{\Restr n\sigma}{}$ and $\Psem{\Restrv n\phi}{}$. To this end, we define a family of sets $\Srestrp n\sigma l\subseteq\Web{\Tsem\sigma}$ by induction on $(n,\sigma,l)$ (where $n\in\Nat$, $l\in\{\Vsymb,\Gsymb\}$ and $\sigma$ is a closed type which is positive if $l=\Vsymb$). \begin{itemize} \item $\Srestrv n{\Excl\sigma}=\Mfin{\Srestr n\sigma}$ \item $\Srestrv n{\TENS{\phi_\ell}{\phi_r}}=\Srestrv n{\phi_\ell}\times\Srestrv n{\phi_r}$ \item $\Srestrv n{\PLUS{\phi_\ell}{\phi_r}}= \{\ell\}\times\Srestrv n{\phi_\ell}\cup\{r\}\times\Srestrv n{\phi_r}$ \item $\Srestrv 0{\TREC\zeta\psi}=\emptyset$ \item $\Srestrv{n+1}{\TREC\zeta\psi}=\Srestrv{n}{\Subst\phi{\TREC\zeta\psi}\zeta}$ \item $\Srestr n\phi=\Srestrv n\phi$ \item $\Srestr n{\LIMPL\phi\sigma}=\Srestrv n\phi\times\Srestr n\sigma$. \end{itemize} \begin{lemma}\label{lemma:restr-expression} Let $n\in\Nat$, $\phi$ be a closed positive type and $\sigma$ be a closed type. One has \begin{align*} \Psem{\Restrv n\phi}{}_{(a,b)}= \begin{cases} 1 & \text{if }a=b\in\Srestrv n\phi\\ 0 & \text{otherwise.} \end{cases} \quad \Psem{\Restr n\sigma}{}_{(c,b)}= \begin{cases} 1 & \text{if }c=\Mset b\text{ and }b\in\Srestr n\sigma\\ 0 & \text{otherwise.} \end{cases} \end{align*} \end{lemma} \begin{proof} By Theorem~\ref{th:pos-types-dense}, for a closed positive type $\phi$ and for $u\in\PcohEM{\Tsemca\phi}$, it suffices to prove that \begin{align*} \Psem{\Restrv n\phi}(u)_a= \begin{cases} u_a & \text{if }a\in\Srestrv n\phi\\ 0 & \text{otherwise} \end{cases} \end{align*} And for a closed type $\sigma$ and for $u\in\Pcoh{\Tsem\sigma}$, it suffices to prove \begin{align*} \Psem{\Restr n\sigma}(\Prom u)_a= \begin{cases} u_a & \text{if }a\in\Srestr n\sigma\\ 0 & \text{otherwise} \end{cases} \end{align*} Both statements are easily proved by induction. \end{proof} We need now to prove that, given $u\in\Pcoh{\Tsem{\sigma}}$, the sequence $\Psem{\Restr n\sigma}{(\Prom u)}$ is monotone and has $u$ as lub. \begin{lemma}\label{lemma:restr-monotone-limit} For any triple $(n,\sigma,l)$ where $\sigma$ is positive if $l=\Vsymb$, one has $\Srestrp n\sigma l\subseteq\Srestrp{n+1}\sigma l$. Moreover \begin{align*} \bigcup_{n=0}^\infty\Srestrp n\sigma l=\Web{\Tsem\sigma}\,. \end{align*} \end{lemma} \begin{proof} The first statement is straightforward, by induction on $(n,\sigma,l)$. For the second statement, we only have to prove the right-to-left inclusions. We define the \emph{height} $\Height a$ of an element $a$ of $\Web{\Tsem\sigma}$ as follows. \begin{itemize} \item $\Height\Onelem=1$ \item $\Height{a_1,a_2}=1+\max{(\Height{a_1},\Height{a_2})}$ (this definition is used when $\phi$ is a tensor and when $\sigma$ is a linear implication) \item $\Height{i,a}=1+\Height a$ \item $\Height{\Mset{\List a1k}}=1+\max{(\Height{a_1},\dots,\Height{a_k})}$ \end{itemize} Then by induction on $\Height a$ one proves that \begin{align*} \forall a\in\Web{\Tsem\sigma}\,\exists n\in\Nat\ a\in\Srestrp n\sigma l \end{align*} We deal only with the statement relative to $\Srestrv n\phi$. The closed positive type $\phi$ is of shape \begin{align*} \phi=\TREC{\zeta_1}{\cdots\TREC{\zeta_k}{\psi}} \end{align*} where $\psi$ is not of shape $\TREC\zeta\rho$. We introduce auxiliary closed types $\List \phi 1k$ as follows: \begin{align*} \phi_1&=\phi=\TREC{\zeta_1}{\cdots\TREC{\zeta_k}{\psi}}\\ \phi_2&= \TREC{\zeta_2}{\cdots\TREC{\zeta_k}{\Subst\psi{\phi_1}{\zeta_1}}}\\ &\ \ \vdots\\ \phi_{k+1}&= \Substbis\psi{\phi_1/\zeta_1,\phi_2/\zeta_2,\dots,\phi_k/\zeta_k} \end{align*} and all these types have the same interpretation in $\EM\PCOH$. The type $\psi$ cannot be one of the type variables $\zeta_i$ as otherwise we would have $\Web{\Tsem\phi}=\emptyset$, contradicting our assumption that $a$ belongs to this set. Assume that $\psi=\EXCL\sigma$ so that we must have $a=\Mset{\List b1l}$ with $b_i\in\Web{\Tsem{\sigma'}}$ (where $\sigma'=\Substbis\sigma{\phi_1/\zeta_1,\phi_2/\zeta_2,\dots,\phi_k/\zeta_k}$) for each $i=1,\dots,l$. We have $\Height{b_i}<\Height a$ for each $i$ so that we can apply the inductive hypothesis: for each $i$ there is $n_i$ such that $b_i\in\Srestr{n_i}{\sigma'}$. Using the monotonicity property (first statement of the lemma) and setting $n=\max(\List n1l)$ we have $b_i\in\Srestr n{\sigma'}$ and hence $a\in\Srestrv n{\Excl{\sigma'}}$. Therefore $a\in\Srestrv {n+k}{\phi}$ (coming back to the definition of this set). The other cases are dealt with similarly. \end{proof} \begin{lemma}\label{lemma:restr-sup-id} Let $\sigma$ be a closed type and let $\phi$ be a closed positive type. If $u\in\Pcoh{\Tsem\sigma}$ then the sequence $(\Matapp{\Psem{\Restr n\sigma}{}}{\Prom u})_{n\in\Nat}$ is monotone (in $\Pcoh{\Tsem\sigma}$) and has $u$ as lub. If $u\in\Pcoh{\Tsem\phi}$ then the sequence $(\Matapp{\Psem{\Restrv n\phi}{}}u)_{n\in\Nat}$ is monotone and has $u$ as lub. \end{lemma} \begin{proof} Immediate consequence of Lemmas~\ref{lemma:restr-expression} and~\ref{lemma:restr-monotone-limit}. \end{proof} \subsubsection{Main Inclusion Lemma} Now we are in position of proving the key lemma in the proof of the uniqueness of relations. \begin{lemma}\label{lemma:restr-minus-sub-plus} Let $\sigma$ be a closed type, $n\in\Nat$ and $l\in\{\Vsymb,\Gsymb\}$. If $l=\Gsymb$ and $(M,u)\in\Nrel{\Trel\sigma{}}$ then $(M,\Matapp{\Psem{\Restr n\sigma}{}}{\Prom u})\in\Prel{\Trel\sigma{}}$. If $l=\Vsymb$ and $\sigma$ is a closed positive type $\phi$ then $(V,v)\in\Nrel{\Trelv{\phi}{}}\Rightarrow(V,\Matapp{\Psem{\Restrv n\phi}{}}v)\in\Prel{(\Crel{\Trelv{\phi}{}})}=\Prel{\Trel{\phi}{}}$. \end{lemma} \begin{proof} By lexicographic induction on triples $(n,\sigma,l)$ (with $\sigma$ positive when $l=\Vsymb$). Until further notice, we assume that $l=\Vsymb$. The only case where ``$n$ decreases'' in this induction is when $\phi=\TREC\zeta\psi$, we start with this case. Assume that $\phi=\TREC\zeta\psi$ and that $(V,v)\in\Nrel{\Trelv{\phi}{}}$. If $n=0$ we have $\Matapp{\Psem{\Restrv n\phi}{}}v=0$ and hence $(V,\Matapp{\Psem{\Restrv n\phi}{}}v)\in\Prel{\Trel{\phi}{}}$ by Lemma~\ref{lemma:Trel-sem-closeness}. Assume that the implication holds for $n$ and let us prove it for $n+1$. Let $(V,v)\in\Nrel{\Trelv{\phi}{}}$, that is $V=\FOLD W$ with $(W,v)\in\Nrel{\Trelv{\Subst\psi\phi\zeta}{}}$. We have $\Matapp{\Psem{\Restrv{n+1}{\TREC\zeta\psi}}{}}v= \Matapp{\Psem{\Restrv{n}{\Subst\psi\phi\zeta}}{}}v$ by definition. By inductive hypothesis we have \begin{align}\label{eq:hyprec-unfold} (W,\Matapp{\Psem{\Restrv{n}{\Subst\psi\phi\zeta}}{}}v) \in\Prel{\Trel{\Subst\psi\phi\zeta}{}} \end{align} and we must prove that $(\FOLD W,\Matapp{\Psem{\Restrv{n}{\Subst\psi\phi\zeta}}{}}v) \in\Prel{\Trel{\phi}{}}$. Let $(T,t)\in\Nrel{(\LIMPL{\Trelv\phi{}}{\Trel\ONE{}})}$, we must prove that $(\LAPP T{\FOLD W},t(\Matapp{\Psem{\Restrv{n}{\Subst\psi\phi\zeta}}{}}v))\in\Trel\ONE{}$. Let $S=\ABST x{\Subst\psi\phi\zeta}{\LAPP T{\FOLD x}}$, we have $(S,t)\in\Nrel{(\LIMPL{\Trelv{\Subst\psi\phi\zeta}{}}{\Trel\ONE{}})}$ by Lemma~\ref{lemma:prob-conv-indep-det} and therefore \[ (\LAPP SW,t(\Matapp{\Psem{\Restrv{n}{\Subst\psi\phi\zeta}}{}}v))\in\Trel\ONE{} \] by~\Eqref{eq:hyprec-unfold} and Lemma~\ref{lemma:rel-app-closeness} and this implies $(\LAPP T{\FOLD W},\Matapp t{(\Matapp{\Psem{\Restrv{n}{\Subst\psi\phi\zeta}}{}}v)}) \in\Trel\ONE{}$ by Lemma~\ref{lemma:prob-conv-indep-det}. Assume that $\phi=\EXCL\sigma$ and that $(V,v)\in\Nrel{\Trelv{\EXCL\sigma}{}}$, that is $V=\STOP M$ and $v=\Prom u$ with $(M,u)\in\Nrel{\Trel\sigma{}}$. By inductive hypothesis we have $(M,\Matapp{\Psem{\Restr{n}{\sigma}}}{\Prom u}) \in\Prel{\Trel{\sigma}{}}$ and hence $(\STOP M,\Prom{(\Matapp{\Psem{\Restr{n}{\sigma}}}{\Prom u})})\in\Prel{\Trelv{\EXCL\sigma}{}}$ and since $\Prom{(\Matapp{\Psem{\Restr{n}{\sigma}}}{\Prom u})}=\Matapp{\Psem{\Restrv{n}{\EXCL\sigma}}}{\Prom u}$ we get \[ (V,\Matapp{\Psem{\Restrv{n}{\EXCL\sigma}}}v) \in\Prel{\Trelv{\EXCL\sigma}{}}\subseteq\Prel{\Trel{\EXCL\sigma}{}} \] as expected. Assume that $\phi=\TENS{\phi_\ell}{\phi_r}$ and that $(V,v)\in\Nrel{\Trelv{\TENS{\phi_\ell}{\phi_r}}{}}$, that is $V=\PAIR{V_\ell}{V_r}$ and $v=\Tens{v_\ell}{v_r}$ with $(V_i,v_i)\in\Nrel{\Trelv{\phi_i}{}}$ for $i\in\{\ell,r\}$. By inductive hypothesis we have $(V_i,\Matapp{\Psem{\Restr{n}{\phi_i}}}{v_i})\in\Prel{\Trel{\phi_i}{}}$. By Lemma~\ref{lemma:tens-crel} we get $(\PAIR{V_\ell}{V_r},\Tens{\Matapp{\Psem{\Restr{n}{\phi_\ell}}} {v_\ell}}{\Matapp{\Psem{\Restr{n}{\phi_r}}}{v_r}}) \in\Prel{\Trel{\TENS{\phi_\ell}{\phi_r}}{}}$, that is $(\PAIR{V_\ell}{V_r},\Psem{\Restr{n}{\TENS{\phi_\ell}{\phi_r}}}{}(\Tens{v_\ell}{v_r})) \in\Prel{\Trel{\TENS{\phi_\ell}{\phi_r}}{}}$. Assume that $\phi=\PLUS{\phi_\ell}{\phi_r}$ and $(V,v)\in\Nrel{\Trelv{\PLUS{\phi_\ell}{\phi_r}}{}}$. This means that for some $i\in\{\ell,r\}$, one has $V=\IN i{W}$ and $v=\Matapp{\Inj i}w$ for $(W,w)\in\Nrel{\Trelv{\phi_i}{}}$. By inductive hypothesis we have $(W,\Matapp{\Psem{\Restr{n}{\phi_i}}{}}w)\in\Prel{\Trel{\phi_i}{}}$ and hence $(\IN i{W},\Matapp{\Inj i}{(\Matapp{\Psem{\Restr{n}{\phi_i}}{}}w)}) \in\Prel{\Trel{\PLUS{\phi_\ell}{\phi_r}}{}}$ by Lemma~\ref{lemma:plus-crel}, that is $(\IN i{W}, \Matapp{\Psem{\Restr{n}{\PLUS{\phi_\ell}{\phi_r}}}{}}w) \in\Prel{\Trel{\PLUS{\phi_\ell}{\phi_r}}{}}$. We assume now that $l=\Gsymb$. If $\sigma$ is a closed positive type $\phi$ and let $(M,u)\in\Nrel{\Trel{\sigma}{}}$, we must prove that \[ (M,\Matapp{\Psem{\Restr{n}{\sigma}}{}}{\Prom u})\in\Prel{\Trel\sigma{}} \] which follows directly from the definition of $\Restr{n}{\phi}$ and from the inductive hypothesis applied to $(n,\phi,\Vsymb)$. Assume last that $\sigma=\LIMPL\phi\tau$ and that $(M,u)\in\Nrel{\Trel{\LIMPL\phi\tau}{}}$, we must prove that $(M,\Matapp{\Psem{\Restr{n}{\LIMPL\phi\tau}}{}}{\Prom u})\in\Prel{\Trel{\IMPL\phi\tau}{}}$. Let $(V,v)\in\Nrel{\Trelv{\phi}{}}$, we must prove that \begin{align}\label{eq:goal-app} (\LAPP MV,\Matapp{\Psem{\Restr{n}{\LIMPL\phi\tau}}{}}{\Prom u}\Appsep v) \in\Prel{\Trel\tau{}} \end{align} which follows from the fact that $\Matapp{\Psem{\Restr{n}{\LIMPL\phi\tau}}{}}{\Prom u}\Appsep v= \Psem{\Restr{n}{\tau}}{\Prom{(u(\Matapp{\Psem{\Restrv{n}{\phi}}{}}v))}}$. Indeed the inductive hypothesis applied to $(n,\phi)$ yields $(V,\Matapp{\Psem{\Restrv n\phi}{}}v)\in\Prel{\Trel{\phi}{}}$ and hence $(\LAPP MV,\Matapp u{(\Matapp{\Psem{\Restrv n\phi}{}}v)}) \in\Prel{\Trel{\tau}{}}$ by Lemma~\ref{lemma:rel-app-closeness}, from which we derive~\Eqref{eq:goal-app} by Lemma~\ref{lemma:restr-sup-id} and Lemma~\ref{lemma:Trel-sem-closeness}. \end{proof} \begin{lemma} For any closed type $\sigma$ one has $\Nrel{\Trel\sigma{}}=\Prel{\Trel\sigma{}}$. \end{lemma} \begin{proof} Immediate consequence of lemmas~\ref{lemma:Trel-sem-closeness}, \ref{lemma:restr-sup-id} and~\ref{lemma:restr-minus-sub-plus}. \end{proof} From now on we simply use the notation $\Trel\sigma{}$ instead of $\Nrel{\Trel\sigma{}}$ and $\Prel{\Trel\sigma{}}$. \subsection{Logical relation lemma} We can prove now the main result of this section. \begin{theorem}[Logical Relation Lemma]\label{lemma:adequacy} Assume that $\TSEQ{x_1:\phi_1,\dots,x_k:\phi_k}{M}{\sigma}$ and let $(V_i,v_i)\in\Trel{\phi_i}{}$ (where $V_i$ is a value and $v_i\in\PcohEM{\Tsem{\phi_i}}$) for $i=1,\dots,k$. Then $(\Substbis M{V_1/x_1,\dots,V_k/x_k},\Psem{M}^{\List x1k}{\Vect v})\in\Trel\sigma{}$ where $\Vect v=(\List v1k)$. \end{theorem} \begin{remark} One would expect to have rather assumptions of the shape ``$(V_i,v_i)\in\Trelv{\phi_i}{}$''; the problem is that we don't know whether $\Srel{\Trelv{\phi_i}{}}\POS=\Srel{\Trelv{\phi_i}{}}\NEG$. \end{remark} \begin{proof} By induction on the typing derivation of $M$, that is, on $M$. We set $\cP=(x_1:\phi_1,\dots,x_k:\phi_k)$ and, given a term $R$, we use $R'$ for the term $\Substbis R{V_1/x_1,\dots,V_k/x_k}$. We also use $\Vect v$ for the sequence $\List v1k$ and $\Vect x$ for the sequence $\List x1k$. The case $M=x_i$ is straightforward. Assume that $M=\STOP N$ and that $\phi=\EXCL\sigma$ with $\TSEQ\cP N\sigma$. By inductive hypothesis we have $(N',\Matapp{\Psem{N}^{\Vect x}}{\Vect v})\in\Trel\sigma{}$. Therefore $(\STOP{(N')},\Prom{(\Matapp{\Psem{N}^{\Vect x}}{\Vect v})})\in\Srel{\Trelv{\EXCL\sigma}{}}{\epsilon}$ (for $\epsilon=\POS$ or $\epsilon=\NEG$)\footnote{It is not clear whether $\Nrel{\Trelv\phi{}}=\Prel{\Trelv\phi{}}$ for any closed positive type $\phi$, but we don't need this property in this proof, so we leave this technical question unanswered.}. We have $\Srel{\Trelv{\EXCL\sigma}{}}{\epsilon} \subseteq\Crel{\Srel{\Trelv{\EXCL\sigma}{}}{\epsilon}} ={\Srel{\Trel{\EXCL\sigma}{}}{\epsilon}}=\Trel{\EXCL\sigma}{}$ and hence $(M',\Matapp{\Psem{M}^{\Vect x}}{\Vect v}))\in\Trel{\EXCL\sigma}{}$ as contended. Assume that $M=\PAIR{N_\ell}{N_r}$ and $\sigma=\TENS{\psi_\ell}{\psi_r}$ with $\TSEQ{\cP}{N_i}{\psi_i}$ for $i\in\{\ell,r\}$. By inductive hypothesis we have $(N'_i,\Matapp{\Psem{N_i}^{\Vect x}}{\Vect v})\in\Trel{\psi_i}{}$. By Lemma~\ref{lemma:tens-crel} we get \[(\PAIR{N'_\ell}{N'_r},\Matapp{\Psem{\PAIR{N_\ell}{N_r}}^{\Vect x}}{\Vect v})\in\Trel{\TENS{\psi_\ell}{\psi_r}}{}\] as contended, since $\Matapp{\Psem{\PAIR{N_\ell}{N_r}}^{\Vect x}}{\Vect v} =\Tens{\Matapp{\Psem{N_\ell}^{\Vect x}}{\Vect v}}{\Matapp{\Psem{N_r}^{\Vect x}}{\Vect v}}$. The case $M=\IN iN$ (and $\sigma=\PLUS{\psi_\ell}{\psi_r}$) is handled similarly, using Lemma~\ref{lemma:plus-crel}. Assume that $M=\FOLD N$ and $\sigma=\phi=\TREC\zeta\psi$ with $\TSEQ{\cP}{N}{\Subst\psi\phi\zeta}$. By inductive hypothesis we have $(N',\Matapp{\Psem{N}^{\Vect x}}{\Vect v}) \in\Trel{\Subst\psi\phi\zeta}{}$ which implies $(\FOLD{N'},\Matapp{\Psem{N}^{\Vect x}}{\Vect v})\in\Trel{\phi}{}$ by Lemma~\ref{lemma:fold-crel}. Assume that $M=\ABST x\phi N$ and $\sigma=\LIMPL\phi\tau$, with $\TSEQ{\cP,x:\phi}{N}{\tau}$. We must prove that $(\ABST{x}{\phi}{N'},\Matapp{\Psem{\ABST x\phi N}^{\Vect x}}{\Vect v})\in\Srel{(\Limpl{\Trelv\phi{}}{\Trel\tau{}})}\epsilon$ for an arbitrary $\epsilon\in\{\NEG,\POS\}$. So let $(V,v)\in\Srel{\Trelv{\phi}{}}{-\epsilon}$. Since $\Srel{\Trelv{\phi}{}}{-\epsilon}\subseteq\Trel{\phi}{}$, we have $(\Subst{N'}{V}{x},\Psem{N}^{\Vect x,x}(\Vect v,v))\in\Trel{\tau}{}$ by inductive hypothesis. It follows that $(\LAPP{\ABST{x}{\phi}{N'}}{V},\Matapp{\Psem{\ABST x\phi N}^{\Vect x}}{\Vect v}\Appsep v)\in\Trel\tau{}$ by Lemma~\ref{lemma:prob-conv-indep-det}, proving our contention. Assume that $M=\LAPP RN$ with $\TSEQ{\cP}{R}{\LIMPL\phi\sigma}$ and $\TSEQ{\cP}{N}{\phi}$ where $\phi$ is a closed positive type. By inductive hypothesis we have $(R',\Psem R^{\Vect x}(\Vect v))\in\Trel{\LIMPL\phi\sigma}{}$ and $(N',\Matapp{\Psem N^{\Vect x}}{\Vect v})\in\Trel{\phi}{}$ and hence $(\LAPP{R'}{N'},\Matapp{\Psem R^{\Vect x}}{\Vect v}\Appsep(\Matapp{\Psem N^{\Vect x}}{\Vect v}))\in\Trel{\sigma}{}$ by Lemma~\ref{lemma:rel-app-closeness}, that is $(M',\Matapp{\Psem M^{\Vect x}}{\Vect v})\in\Trel{\sigma}{}$. Assume that $M=\FIXT x\sigma N$ with $\TSEQ{\cP,x:\EXCL\sigma}{N}\sigma$. The function $f:\Pcoh{\Tsem\sigma}\to\Pcoh{\Tsem\sigma}$ defined by \begin{align*} f(u)=\Psem N^{\Vect x,x}(\Vect v,\Prom u) \end{align*} is Scott continuous and we have $\Matapp{\Psem M^{\Vect x}}{\Vect v}=\sup_{k\in\Nat}f^k(0)$. By induction on $k$, we prove that \begin{align}\label{eq:adeq-fixpoint-rec} \forall k\in\Nat\quad (M',f^k(0))\in\Trel{\sigma}{}\,. \end{align} The base case is proven by Lemma~\ref{lemma:Trel-sem-closeness}. Assume that $(M',f^k(0))\in\Trel{\sigma}{}$. Choosing an arbitrary $\epsilon$, we have $(\STOP{(M')},\Prom{(f^k(0))}) \in\Srel{\Trelv{\EXCL\sigma}{}}\epsilon\subseteq\Trel{\EXCL\sigma}{}$ and hence by our ``outermost'' inductive hypothesis we have $(\Subst{N'}{\STOP{(M')}}{x},f^{k+1}(0))\in\Trel\sigma{}$ from which we get $(M',f^{k+1}(0))\in\Trel\sigma{}$ by Lemma~\ref{lemma:prob-conv-indep-det} and this ends the proof of~\Eqref{eq:adeq-fixpoint-rec}. We conclude that $(M',\Matapp{\Psem M^{\Vect x}}{\Vect v})\in\Trel\sigma{}$ by Lemma~\ref{lemma:Trel-sem-closeness}. Assume that $M=\GO N$ with $\TSEQ{\cP}{N}{\EXCL\sigma}$. By inductive hypothesis we have $(N',\Matapp{\Psem{N}^{\Vect x}}{\Vect v})\in\Trel{\EXCL\sigma}{}$ which implies $(\GO{N'},\Der{}(\Matapp{\Psem N^{\Vect x}}{\Vect v}))\in\Trel{\sigma}{}$ by Lemma~\ref{lemma:der-crel}, that is $(M',\Matapp{\Psem{M}^{\Vect x}}{\Vect v})\in\Trel{\sigma}{}$. Assume that $M=\PR jN$ with $j\in\{\ell,r\}$, $\sigma=\Tens{\phi_\ell}{\phi_r}$ and $\TSEQ{\cP}{M}{\TENS{\phi_\ell}{\phi_r}}$. By inductive hypothesis we have $(N'\Matapp{,\Psem{N}^{\Vect x}}{\Vect v})\in\Trel{\TENS{\phi_\ell}{\phi_r}}{}$ and hence $(\PR j{N'},\Matapp{\Proj j}{(\Matapp{\Psem{N}^{\Vect x}}{\Vect v})}) \in\Trel{\phi_j}{}$ by Lemma~\ref{lemma:proj-crel} that is $(M',\Matapp{\Psem{M}^{\Vect x}}{\Vect v})\in\Trel{\phi_j}{}$. Assume that $M=\CASE{N}{y_\ell}{R_\ell}{y_r}{R_r}$ with $\TSEQ{\cP}{N}{\PLUS{\phi_\ell}{\phi_r}}$ and $\TSEQ{\cP,y_j:\phi_j}{R_j}{\sigma}$ for $j\in\{\ell,r\}$. By inductive hypothesis we have $(N',\Matapp{\Psem N^{\Vect x}}{\Vect v})\in\Trel{\PLUS{\phi_\ell}{\phi_r}}{}$ and $(\ABST{y_j}{\phi_j}{R'_j},\Matapp{\Psem{\ABST{y_j}{\phi_j}{R_j}}^{\Vect x}}{\Vect v})\in\Trel{\LIMPL{\phi_j}{\sigma}}{}$ for $j\in\{\ell,r\}$ (to prove this latter fact, one chooses $\epsilon\in\{\NEG,\POS\}$ and considers an arbitrary $(V,v)\in\Srel{\Trelv{\phi_j}{}}{-\epsilon}$, we have $(V,v)\in\Trel{\phi_j}{}$ and hence $(\Subst{R'_j}{V}{y_j},\Psem{R_j}^{\Vect x,y_j}(\Vect v,v))\in\Trel{\sigma}{}$ by inductive hypothesis, which implies \[ (\LAPP{\ABST{y_j}{\phi_j}{R'_j}}V, \Matapp{\Psem{\ABST{y_j}{\phi_j}{R_j}}^{\Vect x}}{\Vect v}\Appsep v)\in\Trel{\sigma}{} \] by Lemma~\ref{lemma:prob-conv-indep-det}). By Lemma~\ref{lemma:case-crel} we get \[(\CASE{N'}{y_\ell}{R'_\ell}{y_r}{R'_r}, \Matapp{\Case(\Psem{\ABST{y_\ell}{\phi_\ell}{R_\ell}}^{\Vect x}}{\Vect v}),\Matapp{\Psem{\ABST{y_r}{\phi_r}{R_r}}^{\Vect x}}{\Vect v}))(\Matapp{\Psem N^{\Vect x}}{\Vect v}))\in\Trel{\sigma}{} \] that is $(M',\Psem{M}^{\Vect x}(\Vect v))\in\Trel\sigma{}$, by Lemma~\ref{lemma:prob-conv-indep-det}. Assume that $M=\UNFOLD N$ where $\TSEQ{\cP}{N}{\phi}$ with $\phi=\TREC\zeta\psi$. We apply Lemma~\ref{lemma:unfold-crel} straightforwardly. Assume that $M=\ONELEM$ and the typing derivation consists of the axiom $\TSEQ{\cP}{\ONELEM}{\ONE}$ so that $\sigma=\ONE$. We have $(M,\Psem M{})\in\Trel{\ONE}{}$ by definition since $\Redmats^\infty_{M,\ONELEM}=1=\Psem M{}$. Assume last that $M=\COIN p$ for some $p\in[0,1]\cap\Rational$ and the typing derivation consists of the axiom $\TSEQ{\cP}{\COIN p}{\PLUS\ONE\ONE}$ so that $\sigma=\PLUS\ONE\ONE$. We must prove that $(\COIN p,\Psem{\COIN p}{})\in\Trel{\PLUS\ONE\ONE}{}$. Remember that $\Psem{\COIN p}{}=p\Base{(\ell,*)}+(1-p)\Base{(r,*)}$. Let $\epsilon\in\{\NEG,\POS\}$ and let $(T,t)\in \Srel{(\Limpl{\Trelv{\PLUS\ONE\ONE}{}}{{\Trel{\ONE}{}}})}{\epsilon}$, we must prove that $(\LAPP T{\COIN p},t(p\Base{(\ell,*)}+(1-p)\Base{(r,*)}))\in\Trel{\ONE}{}$. We have \begin{align*} \Redmats^\infty_{\LAPP T{\COIN p},\ONELEM} = p\Redmats^\infty_{\LAPP T{\IN \ell \ONELEM}, \ONELEM}+(1-p)\Redmats^\infty_{\LAPP T{\IN r \ONELEM},\ONELEM} \end{align*} since the first reduction step must be $\COIN p\Redone p\IN \ell \ONELEM$ or $\COIN p\Redone{1-p}\IN r \ONELEM$. By our assumption on $(T,t)$ we have $\Redmats^\infty_{\LAPP T{\IN i\ONELEM}}\geq t(\Base{(i,*)})$ and hence $\Redmats^\infty_{\LAPP T{\COIN p},\ONELEM}\geq t(p\Base{(\ell,*)}+(1-p)\Base{(r,*)})$ as contended, by linearity of $t$. \end{proof} \begin{theorem}[Adequacy]\label{th:rel-ad-lemma} Let $M$ be a closed term such that $\TSEQ{}{M}{\ONE}$. Then $\Psem M{}=\Redmats^\infty_{M,\ONELEM}$. \end{theorem} By Corollary~\ref{th:soundness-ineq} and Theorem~\ref{lemma:adequacy}. \section{Full Abstraction}\label{sec:FA} We prove now the Full Abstraction Theorem~\ref{thm:fa}, that is the converse of the Adequacy Theorem. \subsection{Outline of the proof.} We reason by contradiction and assume that two closed terms $M_1$ and $M_2$ have different semantics. Remember from Section~\ref{subsec:model-pcoh}, that a closed term of type $\sigma$ is interpreted as a vector with indices in the web $\Web{\Psem\sigma}$, so that there is $a\in\Web{\Psem\sigma}$ such that $\Psem{M_1}_a\neq\Psem{M_2}_a$. We want to design a term that will separate $M_1$ and $M_2$ observationally. We define a \emph{testing term} $\TSEQ{}{\Testt a}{\LIMPL{\EXCL\Tnat}{(\LIMPL{\EXCL\sigma}\ONE)}}$ that will depend only on the structure of the element $a$ of the web. We then use properties of the semantics (namely that terms of type $\LIMPL{\EXCL\Tnat}\tau$ can be seen as power series) to find reals $\vec p$ such that $\LAPP{\Testt a}{\STOP{\Ran{\vec p}}}$ separates $M_1$ and $M_2$: $$ \Redmats^\infty_{\LAPP{\LAPP{\Testt a}{\STOP{\Ran{\vec p}}}}{\STOP M_1},\ONELEM}\neq \Redmats^\infty_{\LAPP{\LAPP{\Testt a}{\STOP{\Ran{\vec p}}}}{\STOP M_2},\ONELEM} $$ \medskip \subsubsection*{Let us detail the key points of the proof.} Remember from Section~\ref{subsec:Kleisli_fun} that, because $\TSEQ{}{\Testt a}{\LIMPL{\EXCL\Tnat}{(\LIMPL{\EXCL\sigma}\ONE)}}$, its interpretation $\Psem{\Testt a}$ can be seen as a power series \begin{equation*} \Fun{\Psem{\Testt a}}(\vec\zeta) =\Psem{\Testt a}\Compl {\Prom{\vec\zeta\ }}=\left(\sum_{[\List k1n]\in\Web{\Excl \Tnat}}\Psem{\Testt a}_{[\List k1n],b}\prod_{i=1}^n\zeta_{k_i}\right)_{b\in\Web{\LIMPL{\EXCL\sigma}\ONE}} \end{equation*} with infinitely many parameters $\vec\zeta=(\zeta_0,\dots,\zeta_n,\dots)$. Moreover, if $\sum_{i=0}^\infty \zeta_i\le 1$, then $\vec\zeta\in\Pcoh{\Psem\Tnat}$ and $\Fun{\Psem{\Testt a}}(\vec\zeta)\in\Pcoh{\Psem{\LIMPL{\EXCL\sigma}\ONE}}$ (see Theorem~\ref{prop:kleisli-morph-charact}). The first key point is to remark that the testing term $\Testt a$ is defined in such a way that ${\Psem{\Testt a}}$ has actually only finitely many parameters $\List\zeta 0{\Lent a}$ (meaning that if the support of the multiset $c$ is not included in $\{0,\dots,\Lent a\}$, then $\Psem{\Testt a}_{(c,b)}=0$). Now, for any $u\in\Pcoh{\Psem\sigma}$, $\Psem{\ABST y{\EXCL\sigma}{\ABST x{\EXCL\Tnat}{\LAPP{\LAPP{\Testt a}{ x}}y}}} \Prom u\in\Pcoh{\Psem {\LIMPL{\EXCL\Tnat}\ONE}}$. It is also a power series that depends on the same finitely many parameters $\List\zeta 0{\Lent a}$. The second key point is a separation property of $\Psem{\Testt a }$: we prove that, in the power series $\Psem{\ABST y{\EXCL\sigma}{\ABST x{\EXCL\Tnat}{\LAPP{\LAPP{\Testt a}{ x}}y}}} \Prom u$, the coefficient of the unitary monomial\footnote{That is, the monomial where each exponent is equal to one.} $\prod_{k=0}^{\Lent a}\zeta_k$ is equal to $\coeff - a\,u_a$ with a coefficient $\coeff - a\neq 0$ which depends only on $a$. Now, by assumption, $\Psem{M_1}_a$ and $\Psem{M_2}_a$ have different coefficient. For $i=1,2$, we have ${\Psem{\ABST x{\EXCL\Tnat}{\LAPP{\LAPP{\Testt a}{ x}}{\STOP M_i}}}}= \Psem{\ABST y{\EXCL\sigma}{\ABST x{\EXCL\Tnat}{\LAPP{\LAPP{\Testt a}{ x}}y}}}{\Prom{\Psem{M_i}}}$. Thus, the power series ${\Psem{\ABST x{\EXCL\Tnat}{\LAPP{\LAPP{\Testt a}{ x}}{\STOP M_i}}}}$ (for $i=1,2$) have \emph{different coefficients}. The last key point uses classical analysis: if two power series with non-negative real coefficients and finitely many parameters have different coefficients, then they differ on non-negative arguments $\vec p$ close enough to zero: $\sum p_i\le 1$, so that $\vec p\in\Pcoh{\Psem\Tnat}$ and ${\Psem{\ABST x{\EXCL\Tnat}{\LAPP{\LAPP{\Testt a}{ x}}{\STOP M_1}}}}\Prom{\vec p\,}\neq{\Psem{\ABST x{\EXCL\Tnat}{\LAPP{\LAPP{\Testt a}{ x}}{\STOP M_2}}}}\Prom{\vec p\,}$. Finally, in order to substitute in $\Testt a$ the parameters $\vec \zeta$ with the reals $\vec p$, we use $\Ran{\vec p}$ as introduced in Paragraph~\ref{subsec:exsyn}. Indeed, $\Psem{\LAPP{\LAPP{\Testt a}{\STOP{\Ran{\vec p}}}}{\STOP M_i}}= \Fun{\Psem{\ABST x{\EXCL\Tnat}{\LAPP{\LAPP{\Testt a}{ x}}{\STOP M_i}}}}\Prom{\vec p\,}$. We conclude thanks to the Adequacy Theorem~\ref{th:rel-ad-lemma} that ensures that $$\Redmats^\infty_{\LAPP{\LAPP{\Testt a}{\STOP{\Ran{\vec p}}}}{\STOP M_1},\ONELEM}\neq \Redmats^\infty_{\LAPP{\LAPP{\Testt a}{\STOP{\Ran{\vec p}}}}{\STOP M_2},\ONELEM}$$ \subsection{Notations.} In order to define the testing term $\Testt a$, we will reason by induction and we will need to associate three kinds of \emph{testing terms} with the points of the webs. More precisely: \begin{itemize} \item Given a positive type $\phi$ and $a\in\Web{\Tsem\phi}$, we define a term $\Testv a$ such that \begin{align*} &\TSEQ{}{\Testv a}{\LIMPL{\EXCL\Tnat}{\LIMPL\phi\ONE}}. \end{align*} \item Given a general type $\sigma$ and $a\in\Web{\Tsem\sigma}$, we define terms $\Testa a$ and $\Testt a$ such that \begin{align*} &\TSEQ{}{\Testa a}{\LIMPL{\EXCL\Tnat}\sigma} &\TSEQ{}{\Testt a}{\LIMPL{\EXCL\Tnat}{\LIMPL{\EXCL\sigma}\ONE}}. \end{align*} \end{itemize} We also introduce natural numbers $\Lenv a$, $\Lent a$ and $\Lena a$ depending only on $a$. They represent the finite numbers of parameters on which the power series $\Fun{\Psem{\Testv a}}$, $\Fun{\Psem{\Testt a}}$ and $\Fun{\Psem{\Testa a}}$ depend respectively. We denote as $\coeffv a$, $\coefft a$ and $\coeffa a$ natural numbers depending only on $a$ and that will appear as the coefficient of the unitary monomial $\prod_{k=0}^{\Lenv a}\zeta_k$, $\prod_{k=0}^{\Lent a}\zeta_k$ and $\prod_{k=0}^{\Lena a}\zeta_k$ respectively of the corresponding power series. These numbers are all $>0$. \medskip We use the terms introduced in the probabilistic tests paragraph of Subsection~\ref{subsec:exsyn} and whose semantics are given in Subsection~\ref{subsec:exden}: \begin{itemize} \item $\Ran{\Vect p}$ which reduces to $\Num i$ with probability $p_i$ for $\sum_{i=0}^{k-1}p_i\le 1$, \item $M_0\cdot N$ which reduces to $V$ with probability $ p\,q$ if $M_0$ reduces to $\ONELEM$ with probability $p$ and $N$ reduces to $V$ with probability $q$, \item $M_0\AND\dots\AND M_{k-1}$ which reduces to $\ONELEM$ with probability $\prod_{i=0}^{k-1}p_i$ if $M_i$ reduces to $\ONELEM$ with probability $p_i$, \item $\LAPP{\Pchoose_k^\sigma(\List M0{k-1})}P$ which reduces to $M_i$ with probability $p_i$ if $p_i$ is the probability of $P$ to reduce to $\NUM i$, \item $\LAPP{\Pext lr}{\GO Z}$ and $\LAPP{\Pwin k{\vec n}}{\GO Z}$ to partition the parameters $\GO Z$. Indeed $Z$ will denote a variable of type $\EXCL\Tnat$ and $\GO Z$ has to be considered as the sequence of parameters $\Vect\zeta$ of the power series interpreting testing terms. $\Lenv a$, $\Lent a$ and $\Lena a$ represent the number of parameters on which the respective testing terms depend. We use $\LAPP{\Pwin i{\vec n}}{\GO Z}$ to extract subsequences of $\Vect \zeta$ that will be given as arguments to subterms in the inductive definition of the testing terms. Remember that $\LAPP{\Pwin i{n_0,\dots,n_k}}{\GO Z} \Redone {p_l} \Num l$ if $l$ is in the $i$th window of size $n_i$, that is $n_0+\cdots+n_{i-1}\le l\le n_0+\cdots+n_{i}-1$ and $p_l$ is the probability that $\GO Z$ reduces to $\Num l$, that is the non-negative real parameter $\zeta_l$. This is a key ingredient in the computation of the coefficient of the unitary monomial of the interpretation of testing terms by induction on type and on the structure of $a$. \end{itemize} \subsection{Testing terms.} We define the terms $\Testv a$, $\Testa a$ and $\Testt a$ and the associated natural numbers $\Lenv a$, $\Lena a$ and $\Lent a$, by induction on the structure of the point $a$. \medskip {Let $\phi$ be a positive type and $a\in\Web{\Tsem\phi}$. We define $\Testv a$ and $\Testa a$ by induction on the size of $a$ using the structure of $\phi$} \paragraph{Let $\phi=\EXCL\tau$ and $a=\Mset{\List b0{k-1}}$ with $b_i\in\Web{\Tsem\tau}$.} By inductive hypothesis, we have built terms $\TSEQ{}{\Testt{b_i}}{\LIMPL{\EXCL\Tnat}{\LIMPL{\EXCL\tau}\ONE}}$ and $\TSEQ{}{\Testa{b_i}}{\LIMPL{{\EXCL\Tnat}}\tau}$. Then we set \begin{multline*} \Testv a= \ABST{Z}{\EXCL\Tnat}{\ABST{x}{\EXCL\tau}{\LAPP{\EAPP{\Testt{b_0}}{{\left(\LAPP{\Pwin 0{\Lent{b_0},\dots,\Lent{b_{k-1}}}}\GO Z\right)}}}x\AND\cdots\\ \AND\LAPP{\EAPP{\Testt{b_{k-1}}}{\left(\LAPP{\Pwin {k-1}{\Lent{b_0},\dots,\Lent{b_{k-1}}}}\GO Z\right)}}x}},\\ \coeffv a =\prod_{i=0}^{k-1} \coefft{b_i},\ \text{ and } \Lenv a = \Lent{b_0} + \cdots + \Lent{b_{k-1}}\,. \end{multline*} \begin{multline*} \Testa a = \ABST{Z}{\EXCL\Tnat}{\STOP{\left(\langle\Pchoose^{\tau}_k\left(\EAPP{\Testa{b_0}}{\left(\LAPP{\Pwin{1}{k,\Lena{b_0},\cdots,\Lena{b_{k-1}}}}\GO Z\right)}\right.\right.,\dots,\\\left.\left.\EAPP{\Testa{b_{k-1}}}{\left(\LAPP{\Pwin{k}{k,\Lena{b_0},\cdots,\Lena{b_{k-1}}}}\GO Z\right)}\right)\rangle{\GO Z}\right)}}, \\ \coeffa a =\Factor a \,\prod_{i=0}^{k-1} \coeffa{b_i},\ \text{ and } \Lena a =k+ \Lena{b_0} + \cdots + \Lena{b_{k-1}}\,. \end{multline*} Remember that the factorial $\Factor a$ of a multiset $a$ has been defined in Paragraph~\ref{subsec:Kleisli_fun} as the number of permutations that fix $a$. \paragraph{If $\phi=\TENS{\phi_\ell}{\phi_r}$ and $a=(b_\ell,b_r)$ with $b_i\in\Web{\Tsem{\phi_i}}$ for $i\in\{\ell,r\}$,} then we set \begin{multline*} \Testv a = \ABST{Z}{\EXCL\Tnat}{\ABST{x}{\phi } {\LAPP{\EAPP{\Testv{b_\ell}}{\left(\LAPP{\Pwin 0{\Lenv{b_\ell},\Lenv{b_r}}}\GO Z\right)}}{\PR \ell x}\AND\LAPP{\EAPP{\Testv{b_r}}{\left(\LAPP{\Pwin 1{\Lenv{b_\ell},\Lenv{b_r}}}\GO Z\right)}}{\PR r x}}},\\ \coeffv a = \coeffv{b_\ell}\, \coeffv{b_r},\ \text{ and } \Lenv a=\Lenv{b_\ell}+\Lenv{b_r}\,. \end{multline*} \begin{multline*} \Testa a = \ABST{Z}{\EXCL\Tnat}\PAIR{\EAPP{\Testa{b_\ell}}{\left(\LAPP{\Pwin 0{\Lena{b_\ell},\Lena{b_r}}}\GO Z\right)}}{\EAPP{\Testa{b_r}}{\left(\LAPP{\Pwin 1{\Lena{b_\ell},\Lena{b_r}}}\GO Z\right)}},\\ \coeffa a = \coeffa{b_\ell}\,\coeffa{b_r} \text{ and } \Lena a=\Lena{b_\ell}+\Lena{b_r}\,. \end{multline*} \paragraph{If $\phi=\PLUS{\phi_\ell}{\phi_r}$ and $a=(\ell,a_\ell)$ with $b\in\Web{\Tsem{\phi_\ell}}$ (the case $a=(r,a_r)$ is similar),} then we set \begin{align*} \Testv a = \ABST{Z}{\EXCL\Tnat}{\ABST{x} {\PLUS{\phi_\ell}{\phi_r}}{\CASE{x}{y_\ell} {\LAPP{\LAPP{\Testv {a_\ell}}Z}{y_\ell}}{y_r}{\LOOP\ONE}}}, \quad \coeffv a = \coeffv{a_\ell} \quad\text{and } \Lenv a = \Lenv{a_\ell}\,. \end{align*} \begin{align*} \Testa a =\ABST{Z}{\EXCL\Tnat}{ \IN \ell {\LAPP{\Testa a_\ell}{Z}}}, \quad \coeffa a = \coeffa{a_\ell}\quad\text{and } \Lena a = \Lena{a_\ell}\,. \end{align*} \medskip Finally, for a general type $\sigma$ and $a\in\Web{\Tsem\sigma}$, we define $\Testa a$ and $\Testt a$. \paragraph{If $\sigma=\phi$ is positive,} then we have already defined $\Testa a$. \\ Let us now define $\Testt a$. This term does not depend on the structure of $\phi$: \begin{align*} \Testt a = \ABST Z{\EXCL\Tnat}{\ABST x{\EXCL\phi}{\LAPP{\LAPP{\Testv a}Z}{\GO x}}} , \quad \coefft a = \coeffv{a}\quad\text{and } \Lent a = \Lenv{a} \,. \end{align*} \paragraph{If $\sigma=\LIMPL\phi\tau$ and $a=(b,c)$ with $b\in\Web{\Tsem\phi}$ and $c\in\Web{\Tsem\tau}$,} then we set \begin{multline*} \Testa a =\ABST{Z}{\EXCL\Tnat}{ \ABST{x}{\phi} {{{\LAPP{\EAPP{\Testv b}{\left(\LAPP{\Pwin 0{\Lenv b,\Lena c}}\GO Z\right)}}x}\,\cdot\,{{\EAPP{\Testa c}{\left({\LAPP{\Pwin 1{\Lenv b,\Lena c}}\GO Z}\right)}}}}}}\,,\\ \coeffa a = \coeffv{b}\,\coeffa{c}\,, \text{ and }\Lena a=\Lenv b+\Lena c\,. \end{multline*} \begin{multline*} \Testt a = \ABST Z{\EXCL\Tnat}{\ABST{f}{\EXCL{(\LIMPL\phi\tau)}}{ {\LAPP{\EAPP{\Testt c}{\left(\LAPP{\Pwin 1{\Lena b,\Lent c}}{\GO Z}\right)}}{\STOP{\left(\LAPP{\GO f}{\EAPP{\Testa b}{\left(\LAPP{\Pwin 0{\Lena b,\Lent c}}\GO Z\right)}}\right)}}}}}\\ \coefft a = \coeffa{b}\,\coefft{c},\, \text{ and }\Lent a=\Lena b+\Lent c\,. \end{multline*} It is easy to check that these terms satisfy the announced typing judgments. It is also clear that $\coeffv a$, $\coeffa a$ and $\coefft a$ are non zero natural numbers. \medskip We will now tackle the proof of the main observation: that is that the semantics of $\Testt a$ is a power series with finitely many parameters and whose coefficient of the unitary monomial can be seen as a morphism in $\Pcoh{\Tsem{\LIMPL{\EXCL\sigma}\ONE}}$. Lemma~\ref{lem:coeff-morph} introduces notations for the unitary monomials and provides useful properties for proving the key Lemma~\ref{lem:point-test} which gives the coefficients of these monomials. \begin{lemma}\label{lem:coeff-morph} Let $\sigma$ be a general type and $t\in\Pcoh{\Tsem{\LIMPL{\EXCL\Tnat}{\sigma}}}$. \begin{enumerate} \item Assume that there is $k\in\Nat$ such that for any $c\in\Web{\Tsem{\sigma}}$, the power series $\Fun t_c$ over $\Pcoh{\Tsem\Tnat}$ depends on the $k$ first parameters. For any $c\in\Web{\Tsem\sigma}$, let us denote as $\mon{\vec\zeta}{\Fun t}_c$ the coefficient of the monomial $\Listbis\zeta 0{k-1}$ of $\Fun t_c$. Then, $k^{-k}\,\mon{\vec\zeta}{\Fun t}\in\Pcoh{\Tsem\sigma}$. \label{item1:coeff-morph} \item Assume moreover that $\sigma=\LIMPL\phi\tau$ where $\phi$ is a positive type and $\tau$ a general type. Let $m\in\Pcoh{\Tsem\tau}$ and $a\in\Web{\Tsem{\phi}}$. If $\forall u\in \PcohEM{\Tsemca\phi}\ \mon{\vec\zeta}{\Fun t}u =mu_a$ then $\forall u\in \Pcoh{\Tsem\phi}\ \mon{\vec\zeta}{\Fun t}u =mu_a$. \label{item2:coeff-morph} \end{enumerate} \end{lemma} \begin{proof} We prove~\Eqref{item1:coeff-morph}. First notice that $\forall c\in\Web{\Tsem\sigma}$, the coefficient of the monomial $\prod_{i=0}^{k-1}\zeta_i$ is $\mon{\vec\zeta}{\Fun t}_c=t_{([0,\dots,k-1],c)}$. Now, let $\Vect{\tfrac1k}$ be the sequence of $k$ coefficients all equal to $\frac1k$: \begin{equation*} \Fun{t}_c(\vec{\tfrac 1k})=\displaystyle\sum_{\substack{\mu\in\Web{\Tsem{\EXCL\Tnat}}\\\Supp\mu\subseteq\{0,\dots,k-1\}}}t_{(\mu,c)}{\tfrac 1k}^{\Card\mu} \end{equation*} so that $\mon{\vec\zeta}{\Fun t}_c\, k^{-k}\le \Fun{t}(\vec{\tfrac 1k})_c$. Since $\Vect{\tfrac 1k}\in\Pcoh{\Tsem\Tnat}$, $\Fun{t}(\vec{\tfrac 1k})\in\Pcoh{\Tsem\sigma}$ which is downward closed, we have that $k^{-k}\,\mon{\vec\zeta}{\Fun t}\in\Pcoh{\Tsem\sigma}$. Now we prove~\Eqref{item2:coeff-morph}. For any $a\in\Web{\Tsem{\phi}}$, there is $A$ such that $u_a\le A$ for any $u\in\Pcoh{\Tsem\phi}$ (see Subsection~\ref{subsec:model-pcoh}). Hence, for any $u\in\Pcoh{\Tsem\phi}$, $\tfrac{u_a}A m\in\Pcoh{\Tsem\tau}$ and we deduce thanks to Lemma~\ref{lemma:PCS-moprh-charact} that $u\mapsto u_a\,m\,A^{-1}$ is in $\Pcoh{\Tsem{\LIMPL\phi\tau}}$. Without loss of generality, we can choose $A\ge k^{k}$ so that $u\mapsto u_a\,m\,A^{-1}$ and $u\mapsto A^{-1}\mon{\vec\zeta}{\Fun t}u$ are both in $\Pcoh{\Tsem{\LIMPL\phi\tau}}$. Now, since $\Tsemca\phi$ is dense (see Theorem~\ref{th:pos-types-dense}), if $u\mapsto A^{-1}\,\mon{\vec\zeta}{\Fun t}u$ and $u\mapsto A^{-1}\,u_a\,m$ are equal on all coalgebraic points $u\in\PcohEM{\Tsemca\phi}$, they are equal (see Definition~\ref{def:dense}). Thus, for all $u\in\Pcoh{\Tsem\phi}$, $u_a\, m=\mon{\vec\zeta}{\Fun t}u$. \end{proof} We are now ready to prove that the coefficient of the unitary monomial of a testing term associated with a point $a$ of the web allows to extract the $a$-coefficient of an argument, up to a non-zero coefficient depending only on $a$. This is central in the proof of Full Abstraction. Let us first introduce some notations that will be used along this proof. Intuitively, for $s\in \Pcoh{\Tsem{\LIMPL{\EXCL\Tnat}\sigma}}$, we reason on power series $\Fun s$ with values in $\Pcoh{\Tsem{\sigma}}$. But formally, we reason on the non-negative real power series $\Fun s_{a'}$ defined for each $a'\in\Web{\Tsem\sigma}$ and for all parameters\footnote{\label{footnote:parameters}We follow the common mathematical practice of using the same notation $\Vect\zeta=(\List\zeta0n)$ to refer to the formal parameters of a power series and to real arguments of the corresponding function. } $\vec\zeta\in\Pcoh{\Tsem\iota}$ as $\Fun s_{a'}(\vec\zeta)=(\Fun s(\vec\zeta))_{a'}=(s\Prom{\left.\vec \zeta\,\right.})_{a'}$ (see Paragraph~\ref{subsec:Kleisli_fun}). We want to compute the unitary monomial of $\Fun s$ which will be in $\Pcoh{\Tsem\sigma}$. We define it for each $a'\in\Web{\Tsem\sigma}$ as $\mon{\vec\zeta}{s}_{a'}=\mon{\vec\zeta}{\Fun s_{a'}}$. We will also use the fact that a morphism $t\in\Pcoh{\Tsem{\LIMPL\phi\ONE}}$ is defined by the collection of $t_{(a',\ast)}$ for $a'\in\Web{\Tsem\phi}$ and is extensionally characterized by its values $t\,u$ on every $u\in \Pcoh{\Tsem\phi}$. Indeed, for any $a'\in\Web{\Tsem\phi}$, there is $\epsilon>0$ such that $\epsilon \Base{a'}\in\Pcoh{\Tsem\phi}$ and $t_{(a',\ast)}=\tfrac1\epsilon\,(t\,\epsilon\Base{a'})_{\ast}$ by linearity of matrix multiplication. \begin{lemma}\label{lem:point-test} Let $\sigma$ be a type and $a\in\Web{\Tsem\sigma}$. \begin{enumerate} \item\label{point-test0} Assume that $\sigma=\phi$ is positive. If $a'\in\Web{\Tsem\phi}$, then $\Fun{\Psem{\Testv a}}_{(a',\ast)}$ is a power series over $\Pcoh{\Tsem\Tnat}$ depending on $\Lenv a$ parameters, so we define $\mon{\vec\zeta}{\Psem{\Testv a}}_{(a',\ast)}=\mon{\vec\zeta}{\Fun{\Psem{\Testv a}}_{(a',\ast)}}$ and check that $\mon{\vec\zeta}{\Psem{\Testv a}}\in\Pcoh{\Tsem{\LIMPL\phi\ONE}}$ and that for any $u\in\Pcoh{(\Tsem\phi)}$, $\mon{\vec\zeta}{\Psem{\Testv a}}u=\coeffv a\,u_a$. \label{point-testa0} \item Assume that $\sigma$ is a general type. For any $a'\in\Web{\Tsem\sigma}$, $\Fun{\Psem{\Testa a}}_{a'}$ is a power series over $\Pcoh{\Tsem\Tnat}$ depending on $\Lena a$ parameters, so we define $\mon{\vec\zeta}{\Psem{\Testa a}}_{a'}=\mon{\vec\zeta}{\Fun{\Psem{\Testa a}}_{a'}}$ and check that $\mon{\vec\zeta}{\Psem{\Testa a}}\in\Pcoh{\Tsem\sigma}$ and that $\mon{\vec\zeta}{\Psem{\Testa a}}=\coeffa a\,\Base a$ where $\Base a$ is the base vector such that $(\Base a)_{a'}=\Kronecker{a'}a$ for $a'\in\Web{\Tsem\sigma}$. \label{point-testa+} \item Let $\sigma$ be a general type. For any $a'\in\Web{\Tsem{\EXCL\sigma}}$, $\Fun{\Psem{\Testt a}}_{(a',\ast)}$ is a power series over $\Pcoh{\Tsem\Tnat}$ depending on $\Lent a$ parameters, so we define $\mon{\vec\zeta}{\Psem{\Testt a}}_{(a',\ast)}=\mon{\vec\zeta}{\Fun{\Psem{\Testt a}}_{(a',\ast)}}$ and check that $\mon{\vec\zeta}{\Psem{\Testt a}}\in\Pcoh{\Tsem{\LIMPL{\EXCL\sigma}\ONE}}$ and that for any $u\in \Pcoh{\Tsem\sigma}$, $\mon{\vec\zeta}{\Psem{\Testt a}}\Prom u=\coefft a\,u_a$. \label{point-testa-} \end{enumerate} \end{lemma} \begin{proof} Let us argue by mutual induction on the size of $a$ and the structure of $\phi$. \medskip Let $\phi$ be a positive type and $a\in\Web{\Tsem\phi}$. We prove~\Eqref{point-testa+} and~\Eqref{point-testa0} by induction on the structure of $\phi$ \paragraph{Assume that $\phi=\EXCL\tau$ and that $a=\Mset{\List b0{k-1}}$} with $b_i\in\Web{\Tsem\tau}$. \smallskip We prove~\Eqref{point-testa0}. Let $a'=\Mset{\List{b'}0{k'-1}}\in\Tsem{\Excl\tau}$ with $b'_j\in\Web{\Tsem\tau}$ and $\vec\zeta\in\Pcoh{\Tsem\Tnat}$ be the concatenation of the finite sequences\footnote{We assume that the support of indices of the sequences are disjoint even if this requires some renaming.} $\vec\zeta^i\in\Pcoh{\Tsem\Tnat}$ such that the length of $\vec\zeta^i$ is $\Lent{b_i}$. By Theorem~\ref{th:pos-types-dense}, $\Fun{\Psem{\Testv a}}_{(a',\ast)}(\vec\zeta)=(\Psem{\Testv a}\,\Prom{\left.\vec\zeta\right.})_{(a',\ast)}\in\Pcoh{\Tsem{\LIMPL{\EXCL\tau}\ONE}}$ is completely determined by the function $u\mapsto \Psem{\Testv a}\,\Prom{\left.\vec\zeta\right.}\,\Prom u$ defined on $\Pcoh{\Psem{\tau}}$. By inductive hypothesis, $\Fun{\Psem{\Testv a}}_{(a',\ast)}$ depends on finitely many parameters $\Lenv a=\Lent{b_0}+\dots+\Lent{b_{k-1}}$, since \begin{align*} \Psem{\Testv a}\Prom{\left.\vec\zeta\right.}\Prom u = \prod_{i=0}^{k-1}\Psem{\Testt{b_i}}\Prom{\left.\vec\zeta^i\right.}\Prom u \qquad\text{and therefore}\qquad \mon{\vec\zeta}{ \Psem{\Testv a}}\Prom u = \prod_{i=0}^{k-1}\mon{\vec\zeta^i}{\Psem{\Testt{b_i}}}\Prom{u}. \end{align*} Again, by inductive hypothesis it follows that \[\mon{\vec\zeta}{\Psem{\Testv{a}}}\Prom u=\prod_{i=0}^{k-1}\coefft{b_i}\,u_{b_i}=\coeffv a\,(\Prom u)_a. \] We can apply~\Eqref{item2:coeff-morph} of Lemma~\ref{lem:coeff-morph}, so that we have $\mon{\vec\zeta}{\Psem{\Testv{a}}}u=\coeffv a\,u_a$ for all $u\in\Pcoh{\Tsem{\EXCL\tau}}$. \smallskip We prove~\Eqref{point-testa+}. Let $a'=\Mset{\List{b'}0{k'-1}}\in\Tsem{\Excl\tau}$ and $\vec\zeta\in\Pcoh{\Tsem\Tnat}$ be the concatenation of the finite sequences $\vec\zeta^\ast,\vec\zeta^0,\dots,\vec\zeta^{k-1}\in\Pcoh{\Tsem\Tnat}$ such that the length of $\Vect\zeta^{\ast}$ is $k$ and the length of $\vec\zeta^{i}$ is $\Lena{b_i}$ for $i\ge 0$. By inductive hypothesis, $\Fun{\Psem{\Testa a}}_{a'}$ depends on finitely many parameters $\Lenv a=k+\Lena{b_0}+\dots+\Lena{b_{k-1}}$, since \begin{align} \label{eq:aplus-expression} \Fun{\Psem{\Testa a}}_{a'}(\vec \zeta)=(\Psem{\Testa a}\Prom{\left.\vec\zeta\right.})_{a'} &= \Promp{\sum_{i=0}^{k-1} {\zeta^\ast_i}\ \Psem{\Testa{b_i}}\,\Prom{\left.\vec\zeta^{i}\right.}}_{a'}=\prod_{j=0}^{k'-1}\left(\sum_{i=0}^{k-1} {\zeta^\ast_i}\ \Psem{\Testa{b_i}}\,\Prom{\left.\vec\zeta^{i}\right.}\right)_{b'_j}\,. \end{align} We want to compute the coefficient of the unitary monomial, which contains exactly one copy of each parameter of each $\Vect\zeta^i$. If $k'\neq k$ then expression~\Eqref{eq:aplus-expression} contains no monomial where each parameter of $\Vect\zeta^\ast$ appears exactly once, so that $\mon{\vec\zeta}{\Psem{\Testa a}}_{a'}=0$ in that case. If $k'=k$ and $\mathfrak{S}_k$ is the set of permutations over $k$, then by using the fact that factorial $\Factor a=\Card\{\rho\in\mathfrak S_k \mid \forall i\, b_i=b_{\rho(i)}\}$, by denoting the Kronecker symbol as $\Kronecker{a}{a'}$ and by the inductive hypothesis, we get: \begin{align*} \mon{\vec\zeta}{\Psem{\Testa a}}_{a'}=\sum_{\rho\in\mathfrak{S}_k}\prod_{i=0}^{k-1}\mon{\vec\zeta^i}{\Psem{\Testa{b_i}}}_{b'_{\rho(i)}}=\Factor a\ \prod_{i=0}^{k-1} \coeffa{b_i}\Kronecker{b_i}{b'_i}=\coeffa a\, \Kronecker{a}{a'}=\coeffa a\, (\Base a)_{a'}\,. \end{align*} \paragraph{ Assume that $\phi=\TENS{\phi_\ell}{\phi_r}$ and that $a=(b_\ell,b_r)$ with $a_i\in\Web{\Tsem{\phi_i}}$.} Let $\vec\zeta\in\Pcoh{\Tsem\Tnat}$ be the concatenation of the finite sequences $\vec\zeta^\ell,\vec\zeta^r\in\Pcoh{\Tsem\Tnat}$ such that the length of $\vec\zeta^i$ is $\Lena{b_i}$. \smallskip We prove~\Eqref{point-testa0}. Let $a'=(b'_\ell,b'_r)\in\Web{\Tsem{\TENS{\phi_\ell}{\phi_r}}}$. By Theorem~\ref{th:pos-types-dense}, $\Fun{\Psem{\Testv a}}_{(a',\ast)}(\vec\zeta)=(\Psem{\Testv a}\,\Prom{\left.\vec\zeta\right.})_{(a',\ast)}\in\Pcoh{\Tsem{\LIMPL{\TENS{\phi_\ell}{\phi_r}}\ONE}}$ is completely determined by the function $u\mapsto \Psem{\Testv a}\,\Prom{\left.\vec\zeta\right.}\,\Prom u$ defined on $\Pcoh{\Psem{\Tens{\phi_\ell}{\phi_r}}}$. Besides, if $u\in\PcohEM{(\Tsemca{\TENS{\phi_\ell}{\phi_r}})}$, then $u=\Tens{u_\ell}{u_r}$ where $u_i=\Projt i(u)\in\PcohEM{(\Tsemca{\phi_i})}$ for $i\in\{\ell,r\}$ (see Lemma~\ref{lemma:sem-values}). Therefore, by inductive hypothesis, $\Fun{\Psem{\Testv a}}_{(a',\ast)}$ depends on finitely many parameters $\Lenv a=\Lenv{b_\ell}+\Lenv{b_r}$, since \begin{align*} \Psem{\Testv a}\Prom{\left.\vec\zeta\right.}u &= \Psem{\Testv{b_\ell}}\Prom{\left.\vec\zeta^\ell\right.}u_\ell\,\Psem{\Testv{b_r}}\Prom{\left.\vec\zeta^r\right.}u_r \quad \text{ and therefore }\quad \mon{\vec\zeta}{ \Psem{\Testv a}}u= \mon{\vec\zeta^\ell}{\Psem{\Testv{b_\ell}}}u_\ell\,\mon{\vec\zeta^r}{\Psem{\Testv{b_r}}}u_r. \end{align*} Hence, by inductive hypothesis $\mon{\vec\zeta}{ \Psem{\Testv a}}u=\coeffv{b_\ell}(u_\ell)_{b_\ell}\,\coeffv{b_r}(u_r)_{b_r}=\coeffv{a}u_{a}$ for $u\in\PcohEM{\Tsemca\phi}$. We conclude by Lemma~\ref{lem:coeff-morph}, that this holds also for $u\in\Pcoh{\Tsem\phi}$. \smallskip We prove~\Eqref{point-testa+}. Let $a'=(b'_\ell,b'_r)\in\Web{\Tsem{\TENS{\phi_\ell}{\phi_r}}}$. By inductive hypothesis, $\Fun{\Psem{\Testa a}}_{a'}$ depends on finitely many parameters $\Lena a=\Lena{b_\ell}+\Lena{b_r}$, since \begin{align*} \Fun{\Psem{\Testa a}}_{a'}(\vec\zeta)= (\Psem{\Testa a}\Prom{\vec\zeta\,})_{a'} = \Tens{(\Psem{\Testa{b_\ell}}\Prom{\left.\vec\zeta^\ell\right.})_{b'_\ell}}{(\Psem{\Testa{b_r}}\Prom{\left.\vec\zeta^r\right.})_{b'_r}} \end{align*} We deduce using inductive hypothesis that \begin{align*} \mon{\vec\zeta}{\Psem{\Testa a}}_{a'} = \mon{\vec\zeta^\ell}{\Psem{\Testa{b_\ell}}}_{b'_\ell}\,\mon{\vec\zeta^r}{\Psem{\Testa{b_r}}}_{b'_r}=\coeffa{b_\ell}\,\Kronecker{b_\ell}{b'_\ell}\ \coeffa{b_r}\,\Kronecker{b_r}{b'_r}=\coeffa{a}\,\Kronecker{a}{a'}. \end{align*} \paragraph{ Assume that $\phi=\PLUS{\phi_\ell}{\phi_r}$ and that $a=(\ell,a_\ell)$ with $a_\ell\in\Web{\Tsem{\phi_\ell}}$}(the case $a=(r,a_r)$ is similar). \smallskip We prove~\Eqref{point-testa0}. Let $a'=(i,a'_i)\in \Web{\Tsem{\PLUS{\phi_\ell}{\phi_r}}}$. By Theorem~\ref{th:pos-types-dense}, $\Fun{\Psem{\Testv a}}_{(a',\ast)}(\vec\zeta)=(\Psem{\Testv a}\,\Prom{\left.\vec\zeta\right.})_{(a',\ast)}\in\Pcoh{\Tsem{\LIMPL{\PLUS{\phi_\ell}{\phi_r}}\ONE}}$ is completely determined by the function $u\mapsto \Psem{\Testv a}\,\Prom{\left.\vec\zeta\right.}\,u$ defined on $\PcohEM{\Tsemca{\PLUS{\phi_\ell}{\phi_r}}}$. Besides, if $u\in\PcohEM{(\Tsemca{\PLUS{\phi_\ell}{\phi_r}})}$, then there is $i\in\{\ell,r\}$ such that $u=\Inj i {u_i}$ with $u_i\in\PcohEM{(\Tsemca{\phi_i})}$ (see Lemma~\ref{lemma:sem-values}). Therefore, by inductive hypothesis, $\Fun{\Psem{\Testv a}}_{(a',\ast)}$ depends on finitely many parameters $\Lenv a=\Lenv{a_\ell}$, since if $i=\ell$, then \begin{align*} \Psem{\Testv a}\Prom{\left.\vec\zeta\right.}u=\Psem{\ABST{x} {\PLUS{\phi_\ell}{\phi_r}}{\CASE{x}{y_\ell} {\LAPP{\Testv{a_\ell}}{y_\ell}}{y_r}{\LOOP\ONE}}}\Prom{\left.\vec\zeta\right.}u=\Psem{\Testv{a_\ell}}\Prom{\left.\vec\zeta\right.}u_\ell \end{align*} and if $i=r$ then $\Psem{\Testv a}\Prom{\left.\vec\zeta\right.}u=\Psem{\Loopt\One}=0$. So we can compute that $\mon{\vec\zeta}{\Psem{\Testv a}}u=\coeffv{a_\ell}(u_\ell)_{a_\ell}=\coeffv a\, u_a$ for $u\in\PcohEM{\Tsemca\phi}$ and this still holds for $u\in\Pcoh{\Tsem\phi}$ by Lemma~\ref{lem:coeff-morph}. \smallskip We prove~\Eqref{point-testa+}. Let $a'=(i,a'_i)\in \Web{\Tsem{\PLUS{\phi_\ell}{\phi_r}}}$. By inductive hypothesis, $\Fun{\Psem{\Testa a}}_{a'}$ depends on finitely many parameters $\Lena a=\Lena{a_\ell}$, since \begin{align*} \Fun{\Psem{\Testa a}}_{a'}(\vec\zeta)= (\Psem{\Testa a}\Prom{\left.\vec\zeta\right.})_{a'}=(\Psem{\IN{\ell}{\Testa{a_\ell}}}\Prom{\left.\vec\zeta\right.})_{(i,a'_i)}=\Injtr{\ell}(\Psem{\Testa{a_\ell}}\Prom{\left.\vec\zeta\right.})_{i,a'_i}=\Kronecker\ell i\, (\Psem{\Testa{a_\ell}}\Prom{\left.\vec\zeta\right.})_{a'_i}. \end{align*} We can therefore compute $ \mon{\vec\zeta}{\Psem{\Testa a}}_{(i,a'_i)} =\Kronecker\ell i\,\mon{\vec\zeta}{\Psem{{\Testa{a_\ell}}}}_{a'_i} =\coeffa a\,\Kronecker{a}{(i,a'_i)} $ by inductive hypothesis. \medskip Finally, for a general type $\sigma$ and $a\in\Web{\Tsem\sigma}$, we prove~\Eqref{point-testa+} and~\Eqref{point-testa-}. \paragraph{If $\sigma=\phi$ is positive,} we have already proved~\Eqref{point-testa+}. Let us prove~\Eqref{point-testa-}. Let $a\in\Web{\Tsem{\phi}}$. Let $a'\in\Web{\Tsem{\EXCL\phi}}$. By Theorem~\ref{th:pos-types-dense} and~Lemma~\ref{lemma:sem-values}, $\Fun{\Psem{\Testt a}}_{(a',\ast)}(\vec\zeta)=(\Psem{\Testt a}\,\Prom{\left.\vec\zeta\right.})_{(a',\ast)}\in\Pcoh{\Tsem{\LIMPL{\EXCL\tau}\ONE}}$ is completely determined by $u\mapsto\Psem{\Testt a}\,\Prom{\left.\vec\zeta\right.}\,\Prom u$ defined on $\Pcoh{\Tsem{\tau}}$. Therefore, by inductive hypothesis, $\Fun{\Psem{\Testt a}}_{(a',\ast)}$ depends on finitely many parameters $\Lent a=\Lenv{a}$, since \begin{align*} \Psem{\Testt a}\Prom{\left.\vec\zeta\right.}\Prom u =\Psem{\Testv a}\Prom{\left.\vec\zeta\right.}u \qquad\text{and therefore}\qquad \mon{\vec\zeta}{\Psem{\Testt a}}\Prom u=\mon{\vec\zeta}{\Psem{\Testv a}}u \end{align*} By inductive hypothesis, $\mon{\vec\zeta}{\Psem{\Testv a}}u= \coeffv a\, u_a=\coefft a\,u_a$. \paragraph{ Last, let $\sigma=\LIMPL\phi\tau$} Let $a=(b,c)\in\Web{\Tsem\sigma}$. \smallskip We prove~\Eqref{point-testa+}. Let $a'=(b',c')\in\Web{\Tsem\sigma}$. Let $\vec\zeta\in\Pcoh{\Tsem\Tnat}$ be the concatenation of the finite sequences $\vec\zeta^1,\vec\zeta^2\in\Pcoh{\Tsem\Tnat}$ such that the length of $\vec\zeta^1$ is $\Lenv{b}$ and the length of $\vec\zeta^2$ is $\Lena{c}$. By inductive hypothesis, for any $u\in\Pcoh{\Tsem\phi}$, \begin{align*} \Fun{\Psem{\Testa a}}(\vec\zeta)u= \Psem{\Testa a}\Prom{\left.\vec\zeta\right.}u=(\Psem{\Testv b}\Prom{\left.\vec\zeta^1\right.}u)_{\ast}\,(\Psem{\Testa c}\Prom{\left.\vec\zeta^2\right.}). \end{align*} Now, let $\epsilon>0$ such that $\epsilon\Bcanon{b'}\in\Pcoh{\Tsem{\phi}}$, we compute \begin{align*} \Fun{\Psem{\Testa a}}_{(b',c')}(\Prom{\left.\vec\zeta\right.})=\tfrac 1\epsilon (\Psem{\Testa a}\Prom{\left.\vec\zeta\right.} \,\epsilon\Bcanon{b'})_{c'}=\tfrac 1\epsilon(\Psem{\Testv b}\Prom{\left.\vec\zeta^1\right.}\,\epsilon\Bcanon{b'})_{\ast}\,(\Psem{\Testa c}\Prom{\left.\vec\zeta^2\right.})_{c'}=\Fun{\Psem{\Testv b}}_{(b',\ast)}(\vec\zeta^1)\,\Fun{\Psem{\Testa c}}_{c'}(\vec\zeta^2). \end{align*} Therefore, by inductive hypothesis, $\Fun{\Psem{\Testa a}}_{(b',c')}$ depends on finitely many coefficients $\Lena a=\Lenv b+\Lena c$. We compute using inductive hypothesis that \begin{align*} \mon{\vec\zeta}{\Psem{\Testa a}}_{(b',c')}=\mon{\vec\zeta^1}{\Psem{\Testv b}}_{(b',\ast)}\,\mon{\vec\zeta^2}{\Psem{\Testa c}}_{c'}=\coeffv b\,\Kronecker{b}{b'}\,\coeffa c\,\Kronecker{c}{c'}. \end{align*} We conclude that $\mon{\vec\zeta}{\Psem{\Testa a}}=\coeffv b\,\coeffa c\,\Bcanon{b,c}=\coeffa a\,\Bcanon a$. \smallskip We prove~\Eqref{point-testa-}. Let $a'=[(b'_0,c'_0),\dots,(b'_{k-1},c'_{k-1})])\in\Web{\Tsem{\EXCL\sigma}}$. Let $\vec\zeta\in\Pcoh{\Tsem\Tnat}$ be the concatenation of the finite sequences $\vec\zeta^1,\vec\zeta^2\in\Pcoh{\Tsem\Tnat}$ such that the length of $\vec\zeta^1$ is $\Lena{b}$ and the length of $\vec\zeta^2$ is $\Lent{c}$. For any $w\in\Pcoh{\Tsem{\EXCL{(\LIMPL{\phi}\tau}})}$, we have: \begin{align*} \Psem{\Testt a}\Prom{\left.\vec\zeta\right.} w = \Psem{\Testt c}\Prom{\left.\vec\zeta^2\right.}\Prom{\left(\Derel{\Tsem{\LIMPL\phi\tau}}(w)\Psem{\Testa b}\Prom{\left.\vec\zeta^1\right.}\right)}. \end{align*} Let $\epsilon>0$ such that $\epsilon\Bcanon{a'}\in\Pcoh{\Tsem{\EXCL{(\LIMPL\phi\tau})}}$, then \begin{align*} \Fun{\Psem{\Testt a}}_{(a',\ast)}(\vec\zeta)=\tfrac 1\epsilon(\Psem{\Testt a}\Prom{\left.\vec\zeta\right.}\epsilon\Bcanon{a'})_\ast=\tfrac 1\epsilon(\Psem{\Testt c}\Prom{\left.\vec\zeta^2\right.}\Prom{\left(\Derel{\Tsem{\LIMPL\phi\tau}}(\epsilon\Bcanon{a'})\Psem{\Testa b}\Prom{\left.\vec\zeta^1\right.}\right)})_\ast. \end{align*} By inductive hypothesis, we get that $\Fun{\Psem{\Testt a}}_{(a',\ast)}$ depends on $\Lent a=\Lenv b+\Lent c$ coefficients. Let now $u\in\Pcoh{\Psem{\LIMPL\phi\tau}}$, then by~Lemma~\ref{lemma:sem-values} $\Derel{\Tsem{(\LIMPL\phi\tau)}}(\Prom u)=u$ and we compute: \begin{align*} \mon{\vec\zeta}{\Psem{\Testt a}}{\Prom u}=\mon{\vec\zeta^1}{\mon{\vec\zeta^2}{\Psem{\Testt c}}\Prom{\left({u\Psem{\Testa b}\Prom{\left.\vec\zeta^1\right.}}\right)}}\,. \end{align*} By inductive hypothesis, we have $\mon{\vec\zeta^2}{\Psem{\Testt c}}\Prom{({u\Psem{\Testa b}\Prom{\left.\vec\zeta^1\right.}})}=\coefft c\, (u\Psem{\Testa b}\Prom{\left.\vec\zeta^1\right.})_c$. Moreover, notice that $u\in\Pcoh{\Tsem{\LIMPL\phi\tau}}$, seen as a morphism in $\PCOH(\Tsem\phi,\Tsem\tau)$ is linear, and there is $\epsilon>0$ such that $\epsilon \Bcanon b\in\Pcoh{\Tsem\phi}$), so that we can apply $u$ to $\Bcanon b$. Now, by using inductive hypothesis, we get that $\mon{\vec\zeta^1}{u\Psem{\Testa b}}_c=(u\,\mon{\vec\zeta^1}{\Psem{\Testa b}})_c= (u\,\coeffa b\,e_{b})_c=\coeffa b\,u_{(b,c)}$. Therefore, we have $\mon{\vec\zeta}{\Psem{\Testt a}}\Prom u=\coeffa b\,\coefft c\,u_{(b,c)}=\coefft a\, u_{a}$. \end{proof} \begin{theorem}[Full Abstraction]\label{thm:fa} \hspace{1cm} If $\TSEQ{}{M_1}{\sigma}$ and $\TSEQ{}{M_2}{\sigma}$ satisfy $M_1\Rel\Obseq M_2$ then $\Psem{M_1}=\Psem{M_2}$. \end{theorem} \begin{proof} Towards a contradiction, assume that $\Psem{M_1}\not=\Psem{M_2}$. There is $a\in\Web{\Tsem\sigma}$ such that $\Psem{M_1}_a\neq \Psem{M_2}_a$. Then by Lemma~\ref{lem:point-test}, $\Psem{\ABST x{\EXCL\Tnat}{\LAPP{\LAPP{\Testt a}x}{\STOP{M_i}}}}$, for $i\in \{1,2\}$, are power series with different coefficients, namely the coefficients of the monomial $\Listbis \zeta 0{\Lent a-1}$ are $\coefft a\,\Psem{M_i}_a$ for $i\in\set{1,2}$ as $\Psem{\ABST x{\EXCL\Tnat}{\LAPP{\LAPP{\Testt a}x}{\STOP{M_i}}}}{\Prom{\left.\Vect\zeta\right.}}=\Psem{\Testt a}{\Prom{\left.\Vect\zeta\right.}}{\Prom{\Psem{M_i}}}$. There is $\vec\zeta=(\List\zeta0{\Lent a-1})\in\Pcoh{\Tsem\Tnat}$ with $\zeta_i\in\mathbb Q\cap[0,1]$ such that $\Psem{\Testt a}\Prom{\left.\vec\zeta\right.}\Prom{\Psem{M_1}}\neq \Psem{\Testt a}\Prom{\left.\vec\zeta\right.}\Prom{\Psem{M_2}}$. Yet, $\Psem{\LAPP{\LAPP{\Testt a}{\STOP{\Ran{\Vect\zeta}}}}{\STOP{M_i}}}= \Psem{\Testt a}\Prom{\left.\vec\zeta\right.}({\Psem{M_i}})$. By Theorem~\ref{th:rel-ad-lemma}, we get that $\LAPP{\LAPP{\Testt a}{\STOP{\Ran{\Vect\zeta}}}}{\STOP{M_1}}$ and $\LAPP{\LAPP{\Testt a}{\STOP{\Ran{\Vect\zeta}}}}{\STOP{M_2}}$ converge to $\ONELEM$ with different probabilities. It follows that $M_1\Rel{\not\Obseq}M_2$. \end{proof} \subsection*{Acknowledgements} We would like to thank the referees for their many useful and constructive comments and suggestions. We are also grateful to Michele Pagani and Rapha\"elle Crubill\'e for numerous and deep discussions. This work has been partly funded by the ANR Project RAPIDO ANR-14-CE25-0007, by the French-Chinese project ANR-11-IS02-0002 and NSFC 61161130530 \emph{Locali}. \bibliographystyle{plain}
{'timestamp': '2017-11-27T02:13:38', 'yymm': '1607', 'arxiv_id': '1607.04690', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04690'}
arxiv
\section{Introduction} In information theory, the \emph{index coding} problem~\cite{BK98a,BBJK06} is the following: A sender wishes to \emph{broadcast} over a noiseless channel an $n$-symbol string $x\in \mathbb{F}^n$ to a group of $n$ receivers $R_1,\ldots,R_n$, each equipped with some \emph{side information}, namely, a subvector $x_{K_i}$ of $x$ indexed by a subset ${K_i} \subseteq \{x_1,\ldots ,x_n\}$. The index coding problem asks what is the minimum length $m$ of a broadcast message that allows each receiver $R_i$ to retrieve the $i$th symbol $x_i$, given his side-information $x_{K_i}$ and the broadcasted message. The side information of the receivers can be modeled by a directed graph $\mathcal{K}_n$, in which $R_i$ observes % the symbols $K_i := \{ x_j \; : \; (i,j) \in E(\mathcal{K}_n) \}$. $\mathcal{K}_n$ is sometimes called the \emph{knowledge graph}. A canonical example is where $\mathcal{K}_n$ is the complete graph (with no self-loops) on the vertex set $[n]$, i.e., each receiver observes all but his own symbol. In this simple case, broadcasting the sum $\sum_{i=1}^n x_i$ (in $\mathbb{F}$) allows each receiver to retrieve his own symbol, hence $m= 1$. This problem is motivated by applications to distributed storage~\cite{AK15b}, on-demand video streaming (ISCOD, \cite{BirkK06}) and wireless networks (see, e.g., \cite{YZ99a}), where a typical scenario is that clients miss information during transmissions of the network, and the network is interested in minimizing the retransmission length by exploiting the side information clients already possess. In theoretical computer science, index coding is related to some important % communication models and problems in which players have overlapping information, such as the \emph{one-way} communication complexity of the index function~\cite{KNR01} and the more general problem of \emph{network coding}~\cite{Ashwede,ERL15}. Index coding can also be viewed as an interesting special case of nondeterministic computation in the (notoriously difficult to understand) multiparty \emph{Number-On-Forehead} model, which in turn is a promising approach for proving data structure and circuit lower bounds~\cite{Patrascu10, pudlak1997boolean, JuknaS11}. The minimum length of an index code for a given graph has well-known relations to other important graph parameters. For instance, it is bounded from below by the size of the maximum independent set, and it is bounded from above by the clique-cover number ($\chi(\bar{G})$) since for every clique in $G$, it suffices to broadcast a single symbol (recall the example above). The aforementioned connections also led to algorithmic connections (via convex relaxations) between the computational complexity of graph coloring and that of computing the minimum index code length of a graph \cite{ChlamtacH14}. In the context of circuit lower bounds, Riis \cite{R07} observed that a certain index coding problem is equivalent to the so-called \emph{shift conjecture} of Valiant \cite{V92} (see Subsection \ref{subsec_derendomization} below). If true, % this conjecture would resolve a major open problem of proving superlinear size lower bound for logarithmic-depth circuits. When the encoding function of the index code is \emph{linear} in $x$ (as in the example above), the corresponding scheme is called a \emph{linear index code}. In their seminal paper, Bar-Yossef et al. \cite{BBJK06} showed that the minimum length $m$ of a \emph{linear} index code is characterized precisely by a parameter of the knowledge graph $\mathcal{K}_n$, called the \emph{minrank} ($\mathsf{minrk_{\F}}(\mathcal{K}_n)$), first introduced by Haemers \cite{Haemers79} in the context of Shannon capacity of graphs.% \footnote{To be precise, this holds only for graphs without self-loops. We will ignore this minor issue in this paper as it will not affect any of our results.} Namely, $\mathsf{minrk_{\F}}(\mathcal{K}_n)$ is the minimum rank (over $\mathbb{F}$) of an $n\times n$ matrix $M$ that ``represents'' $\mathcal{K}_n$. By ``represents'' we mean a matrix $M$ that contains a zero in all entries corresponding to \emph{non-edges}, and non-zero entries on the diagonal. Entries corresponding to edges are arbitrary. (Over $\mathbb{F}_2$ this is equivalent to being the adjacency matrix of a subgraph of $\mathcal{K}_n$, with diagonal entries set to one.) Note that without the ``diagonal constraint", the above minimum would trivially be $0$, and indeed this constraint is what makes the problem interesting and hard to analyze. While linear index codes are in fact optimal for a large class of knowledge graphs (including directed acyclic graphs, perfect graphs, odd ``holes" and odd ``anti-holes" % \cite{BBJK06}), there are examples where non-linear codes outperform their linear counterparts~\cite{LU07}. In the same paper, Lubetzky and Stav \cite{LU07} posed the following question about \emph{typical} knowledge graphs, namely, \begin{quote} \emph{What is the minimum length of an index code for a random knowledge graph $\mathcal{K}_n=\mathcal{G}_{n,p}$? } % \end{quote} \noindent Here, $\mathcal{G}_{n,p}$ denotes a random Erd{\H o}s-R{\'e}nyi directed graph, i.e., a graph on $n$ vertices in which each arc is taken independently with probability $p$. In this paper, we partially answer this open problem by determining the optimal length of \emph{linear} index codes for such graphs. In other words, we prove a tight lower bound on the minrank of $\mathcal{G}_{n,p}$ for all values of $p\in[0,1]$. In particular, \begin{theorem}[Main theorem, informal] \label{thm_main_informal} For any constant $0<p<1$ and any field $\mathbb{F}$ of cardinality $|\mathbb{F}|<n^{O(1)}$, it holds with high probability that \[ \mathsf{minrk_{\F}}(\mathcal{G}_{n,p}) = \Theta\left( \frac{n}{\log n} \right) \; . % \] \end{theorem} The formal quantitative statement of our result can be found in Corollary \ref{cor_main_thm_const_p} below. We note that our general result (see Theorem \ref{thm_mrk_gnp}) extends beyond the constant regime to \emph{subconstant} values of $p$, and this feature of our lower bound is crucial for potential applications of our result to circuit lower bounds (we elaborate on this in the next subsection). Theorem \ref{thm_main_informal} gives a near quadratic improvement over the previously best lower bound of $\Omega(\sqrt{n})$~\cite{LU07,HL12}, and settles the linear index coding problem for random knowledge graphs, as an $O_p(n/\log n)$ linear index coding scheme is achievable via the clique-covering solution (see Section \ref{sec_proof_overview}). In the following subsection, we propose a concrete (yet admittedly still quite challenging) approach for proving superlinear circuit lower bounds based on a potential ``derandomization" of Theorem \ref{thm_main_informal}. \subsection{Connections to circuit lower bounds for semilinear circuits} \label{subsec_derendomization} \paragraph{General log-depth circuits.} In his seminal line of work, Valiant \cite{V77,V83,V92} proposed a path for proving superlinear lower bounds on the size of % circuits with logarithmic depth, one of the main open questions in circuit complexity. Informally speaking, Valiant's ``depth reduction" method~\cite{V77,V09} allows, for any constant $\varepsilon$, to reduce any circuit of size $O(n)$ and depth $O(\log n)$ (with $n$ inputs and $n$ outputs), to a new circuit % with the same inputs and outputs, where now each output gate is an (arbitrary) Boolean function of $(i)$ at most $n^{\varepsilon}$ inputs which are ``hard-wired" to this output gate, and $(ii)$ an additional fixed set of $m=O_{\varepsilon}(n/\log\log n )$ ``common bits" $b_1(x),\ldots, b_m(x)$ which in general may be arbitrary Boolean functions of the input $x=x_1,\ldots, x_n$. Therefore, if one could exhibit a function that cannot be computed in this model using $O(n/\log\log n)$ common bits, this would imply a superlinear circuit lower bound for logarithmic depth circuits. Valiant~\cite{V92} proposed a concrete candidate hard function for this new model, namely the function whose input is an $n$-bit string $x$ and a number $i \in \{0,\ldots,n-1\}$ and whose output is the $i$th cyclic shift of $x$. Valiant conjectured that no ``pre-wired" circuit as above can realize \emph{all} $n$ cyclic shifts using $m=O(n/\log\log n)$ common bits (in fact, Valiant postulated that $m=\Omega(n)$ common bits are required, and this still seems plausible). This conjecture is sometimes referred to as \emph{Valiant's shift conjecture}. As noted earlier in the introduction, Riis \cite{R07} observed that a certain index coding problem is equivalent to this conjecture. Let $G=(V,A)$ be a directed graph, and $i\in\{0,\ldots,n-1\}$. We denote by $G^i$ the graph with vertex set $V$ and arc set $A^i=\{(u,v+i (\bmod~n)): (u,v)\in A\}$. Riis \cite{R07} showed that the following conjecture is equivalent to Valiant's shift conjecture: \begin{conjecture}\label{conj_riis} There exists $\varepsilon>0$ such that for all sufficiently large $n$ and every graph $G$ on $n$ vertices with max-out-degree at most $n^{\varepsilon}$, there exists a shift $i$ such that the minimum length of an index coding scheme for $G^i$ (over $\mathbb{F}_2$) is $\omega(n/\log\log n)$. \end{conjecture} \paragraph{Semilinear log-depth circuits.} Let us consider a function $f(x,p)$ whose input is partitioned into two parts, $x\in\{0,1\}^k$ and $p\in\{0,1\}^t$. We say that the function $f$ is \emph{semilinear} if for every fixed value of $p=p_0$, the function $f(x,p_0)$ is a linear function (over $\mathbb{F}_2$) of $x$. The class of semilinear functions is quite rich, and includes for instance bilinear functions in $x$ and $p$ (such as matrix multiplication) and permutations $\pi_p(x)$ of $x$ that may depend arbitrarily on $p$. A circuit $G$ is called \emph{semilinear} if for every fixed value of $p=p_0$, one can assign linear functions to the gates of $G$, so that $G$ computes $f(x,p_0)$. So it is only the circuit's topology that is fixed, and the linear functions computed by the gates may depend arbitrarily on $p$. It is easy to see that a semilinear function with a one-bit output can always be computed by a linear-size log-depth semilinear circuit (namely, the full binary tree). However, if we consider semilinear functions with $O(n)$ output bits, then the semilinear circuit complexity of a random function is $\Omega(n^2/\log{n})$ with high probability. It is an open problem to prove a superlinear lower bound against log-depth semilinear circuits~\cite{pudlak1997boolean}. This would follow from the semilinear variant of Valiant's shift conjecture, which is equivalent to the following slight modification of Conjecture~\ref{conj_riis}~\cite{pudlak1997boolean,R07}. \begin{conjecture}\label{conj_riis_semilinear} There exists $\varepsilon>0$ such that for all sufficiently large $n$ and every graph $G$ on $n$ vertices with max-out-degree at most $n^{\varepsilon}$, there exists a shift $i$ such that the minimum length of a \emph{linear} index coding scheme for $G^i$ (over $\mathbb{F}_2$) is $\omega(n/\log\log n)$. Equivalently, \[ \forall \; G \text{ of out-degrees at most $n^{\varepsilon}$} \;\; \exists \;\; i\in [n] \;\; \mathsf{minrk_{2}}(G^i) = \omega(n/\log\log n) \; .\] \end{conjecture} Theorem~\ref{thm_main_informal} (and the more precise concentration bound we prove in Theorem \ref{thm_mrk_gnp}) asserts that % with high probability, a graph chosen from $\mathcal{G}_{n,p}$ (with $p=n^{\varepsilon-1}$ for the expected degree of each vertex to be $n^{\varepsilon}$) has minrank $\Omega(n)$. Conjecture~\ref{conj_riis_semilinear} would follow from a ``derandomization'' of Theorem~\ref{thm_main_informal} in which we replace the distribution $\mathcal{G}_{n,p}$ with a random shift of an arbitrary given graph of the right degree. In fact, for the purpose of circuit lower bounds, one could replace cyclic shifts with any (efficiently computable) set of at most $\exp(O(n))$ permutations. (Since the permutation itself is part of the input, its description size must be linear in $n$.) \paragraph{Semilinear series-parallel circuits.} Finally, we mention one last circuit class for which the above ``derandomization" approach might be easier. Here we replace the depth restriction by another restriction on the topology of the circuit. Namely, a circuit $G=(V,A)$ is called \emph{Valiant series-parallel (VSP)}, if there is a labeling of its vertices $l\colon V \to \mathbb{R}$, such that for every arc $(u,v)\in A$, $l(u)<l(v)$, but there is no pair of arcs $(u,v),(u',v')\in A$, such that $l(u)<l(u')<l(v)<l(v')$. Most of the known circuit constructions (i.e., circuit upper bounds) are VSP circuits. Thus, it is also a big open question in circuit complexity to prove a superlinear lower bound on the size of semilinear VSP circuits (of arbitrary depth). Valiant~\cite{V77}, Calabro~\cite{C08}, and Riis~\cite{R07} show that in order to prove a superlinear lower bound for semilinear VSP circuits, it suffices to show that for a sufficiently large \emph{constant} $d$, for every graph $G$ of max-out-degree at most $d$, the minrank of one of its shifts is at least $n/100$. We note that Theorem~\ref{thm_main_informal} for this regime of $p=d/n$ gives a lower bound of $n/20$. Thus, derandomization of the theorem in this regime would imply a superlinear lower bound. Note that in the case of $p=O(n^{-1})$, the entropy of a random graph is only $O(n\log{n})$ bits, hence, information-theoretically it seems easier to derandomize than the case of $p=n^{\varepsilon-1}$. \subsection{Proof overview of Theorem \ref{thm_main_informal}} \label{sec_proof_overview} In \cite{LU07}, Lubetzky and Stav showed that for any field $\mathbb{F}$ and a directed graph $G$, $$\mathsf{minrk_{\F}}{(G)}\cdot\mathsf{minrk_{\F}}{(\bar{G})} \geq n \; .$$ This inequality gives a lower bound of $\Omega(\sqrt{n})$ on the expected value of the minrank of $\mathcal{G}_{n,1/2}$. (Indeed, the random variables $\mathcal{G}_{n,1/2}$ and $\bar{\mathcal{G}}_{n,1/2}$ have identical distributions). Since $\mathsf{minrk_{\F}}(\mathcal{G}_{n,p})$ is monotonically non-increasing in $p$, the same bound holds for any $p\leq 1/2$. Haviv and Langberg~\cite{HL12} improved this result by proving a lower bound of $\Omega(\sqrt{n})$ for all constant $p$ (and not just $p \le 1/2$), and also by showing that the bound holds with high probability. We now outline the main ideas of our proof. For simplicity we assume that $\mathbb{F}=\mathbb{F}_2$ and $p=1/2$. To prove that $\mathsf{minrk}_2(\mathcal{G}_{n,p}) \geq k $, we need to show that with high probability, $\mathcal{G}_{n,p}$ has no representing matrix (in the sense of Definition \ref{def_mrk}) whose rank is less than $k$. As a first attempt, we can show that any \emph{fixed} matrix $M$ with $1$s on the diagonal of rank less than $k$ has very low probability of representing a random graph in $\mathcal{G}_{n,p}$, and then apply a union bound over all such matrices $M$. Notice that this probability is simply $2^{-s+n}$, where $s$ is the sparsity of $M$ (i.e., the number of non-zero entries) and the $n$ is to account for the diagonal entries. Moreover, we observe that the sparsity $s$ of any rank-$k$ matrix with $1$s on its main diagonal must be\footnote{To see why, notice that any maximal linearly independent set of columns must ``cover'' all coordinates, i.e., there must not be any coordinate that is zero in all vectors, as otherwise we could take the column vector corresponding to that coordinate and it would be linearly independent of our set (due to the nonzero diagonal) in contradiction to maximality. Assuming all columns have roughly the same number of 1s, we obtain that each column has at least $n/k$ 1s, leading to the claimed bound. See Lemma~\ref{lem_rank_vs_sparsity_diagonal} for the full proof.} at least $\approx n^2/k$. Finally, since the number of $n\times n$ matrices of rank $k$ is $\approx 2^{2nk}$ (as a rank-$k$ matrix can be written as a product of $n\times k$ by $k\times n$ matrices, which requires $2nk$ bits to specify), by a union bound, the probability that $\mathcal{G}_{n,p}$ contains a subgraph of rank $<k$ is bounded from above by (roughly) $2^{2nk}\cdot (1/2)^{n^2/k}$, which is $\ll 1$ for $k=O(\sqrt{n})$. This recovers the previous $\Omega(\sqrt{n})$ lower bound of \cite{HL12} (for all constant $p$, albeit with a much weaker concentration bound). To see why this argument is ``stuck'' at $\sqrt{n}$, we observe that we are not overcounting and indeed, there are $2^{n^{3/2}}$ matrices of rank $k \approx n^{1/2}$ and sparsity $s \approx n^{3/2}$. For instance, we can take the rank $n^{1/2}$ matrix that consists of $n^{1/2}$ diagonal $n^{1/2} \times n^{1/2}$ blocks of $1$s (a disjoint union of $n^{1/2}$ equal-sized cliques), and replace the first $n^{1/2}$ columns with arbitrary values. Each such matrix has probability $2^{-n^{3/2}}$ of representing $\mathcal{G}_{n,p}$ (because of its sparsity) and there are $2^{n^{3/2}}$ of them, so the union bound breaks for $k=\Omega(\sqrt{n})$. In order to go beyond $\sqrt{n}$, we need two main ideas. To illustrate the first idea, notice that in the above example, even though individually each matrix has probability $2^{-n^{3/2}}$ of representing $\mathcal{G}_{n,p}$, these ``bad events'' are highly correlated. In particular, each of these events implies that $\mathcal{G}_{n,p}$ must contain $n^{1/2}-1$ disjoint cliques, an event that happens with roughly the same probability $2^{-n^{3/2}}$. Therefore, we see that the probability that the \emph{union} of these bad events happens is only $2^{-n^{3/2}}$, greatly improving on the naive union bound argument. (We remark that this idea of ``bunching together related events'' is reminiscent of the chaining technique as used, e.g., in analyzing Gaussian processes.) More generally, the first idea (and also centerpiece) of our proof is Lemma~\ref{lem_k'_n'_n_k}, which shows that every matrix must % contain a ``nice'' submatrix (in a sense to be defined below). The second and final idea, described in the next paragraph, will be to bound the number of ``nice'' submatrices, from which the proof would follow by a union bound over all such submatrices. Before defining what we mean by ``nice'', we mention the following elementary yet crucial fact in our proof: Every rank $k$ matrix is uniquely determined by specifying some $k$ linearly independent rows, and some $k$ linearly independent columns (i.e., a row basis and a column basis) including the indices of these rows and columns (see Lemma~\ref{lem_basis_determines_matrix}). This lemma implies that we can encode a matrix using only $\approx s_{basis}\cdot \log n$ bits, where $s_{basis}$ is the minimal sparsity of a pair of row and column bases that are guaranteed to exist. This in turn implies that there are only $\approx 2^{s_{basis} \log n}$ such matrices. Now, since the average number of $1$s in a row or in a column of a matrix of sparsity $s$ is $s/n$, one might hope that such a matrix contains a pair of row and column bases of sparsity $k\cdot (s/n)$, and this is precisely our definition of a ``nice'' matrix. (Obviously, not all matrices are nice, and as the previous example shows, there are lots of ``unbalanced'' matrices where the nonzero entries are all concentrated on a small number of columns, hence they have no sparse column basis even though the average sparsity of a column is very low; this is exactly why we need to go to submatrices.) To complete this overview, notice that using the bound on the number of ``nice'' matrices, the union bound yields \[ 2^{ks\log(n)/n}\cdot (1/2)^{s}, \] so one could set the rank parameter $k$ to be as large as $\Theta(n/\log n)$ and the above expression would still be $\ll 1$. A similar bound holds for nice submatrices, completing the proof. \section{Preliminaries} For an integer $n$, we denote the set $\{1,\ldots,n\}$ by $[n]$. For an integer $n$ and $0\le p\le 1$, we denote by $\mathcal{G}_{n,p}$ the probability space over the directed graphs on $n$ vertices where each arc is taken independently with probability $p$. For a directed graph $G$, we denote by $\chi(G)$ the chromatic number of the undirected graph that has the same set of vertices as $G$, and an edge in place of every arc of $G$. By $\bar{G}$ we mean a directed graph on the same set of vertices as $G$ that contains an arc if and only if $G$ does not contain it.\footnote{Throughout the paper we assume that graphs under consideration do not contain self-loops. In particular, neither $G$ nor $\bar{G}$ has self-loops.} Let $\mathbb{F}$ be a finite field. For a vector $v\in \mathbb{F}^n$, we denote by $v^{j}$ the $j$th entry of $v$, and by $v^{\leq j} \in \mathbb{F}^j$ the vector $v$ truncated to its first $j$ coordinates. For a matrix $M\in\mathbb{F}^{n\times n}$ and indices $i,j\in[n]$, let $M_{i,j}$ be the entry in the $i$th row and $j$th column of $M, \mathrm{Col}_i(M)$ be the $i$th column of $M$, $\mathrm{Row}_i(M)$ be the $i$th row of $M$, and $\mathsf{rk}(M)$ be the rank of $M$ over $\mathbb{F}$. By a \emph{principal submatrix} we mean a submatrix whose set of row indices is the same as the set of column indices. By the \emph{leading principal submatrix} of size $k$ we mean a principal submatrix that contains the first $k$ columns and rows. For a matrix $M\in\mathbb{F}^{n \times n}$, the sparsity $s(M)$ is the number of non-zero entries in $M$. We say that a matrix $M\in \mathbb{F}^{n\times n}$ of rank $k$ \emph{contains} an \emph{$s$-sparse column (row) basis}, if $M$ \emph{contains} a column (row) basis (i.e., a set of $k$ linearly independent columns (rows)) with a total of at most $s$ non-zero entries. \begin{definition}[Minrank~\cite{BBJK06, LU07}]\footnote{In this paper we consider the directed version of minrank. Since the minrank of a directed graph does not exceed the minrank of its undirected counterpart, a lower bound for a directed random graph implies the same lower bound for an undirected random graph. The bound is tight for both directed and undirected random graphs (see Theorem~\ref{thm:tight}). }\label{def_mrk} Let $G=(V,A)$ be a graph on $n=|V|$ vertices with the set of directed arcs $A$. A matrix $M \in \mathbb{F}^{n\times n}$ \emph{represents} $G$ if $M_{i,i}\neq0$ for every $i\in[n]$, and $M_{i,j}=0$ whenever $(i,j)\notin A$ and $i\neq j$. The minrank of $G$ over $\mathbb{F}$ is \[ \mathsf{minrk_{\F}}(G)= \min_{M \text{ represents }G} \mathsf{rk}(M) \; . \] \end{definition} \ We say that two graphs \emph{differ at only one vertex} if they differ only in arcs leaving one vertex. Following~\cite{HHMS10,HL12}, to amplify the probability in Theorem~\ref{thm_mrk_gnp}, we shall use the following form of Azuma's inequality for the vertex exposure martingale. \begin{lemma}[Corollary 7.2.2 and Theorem 7.2.3 in~\cite{AS15}]\label{thm:azuma} Let $f(\cdot )$ be a function that maps directed graphs to $\mathbb{R}$. If $f$ satisfies the inequality $|f(H)-f(H')|\le1$ whenever the graphs $H$ and $H'$ differ at only one vertex, then \[ \Pr[\left|f(\mathcal{G}_{n,p})-\mathbb{E}[f(\mathcal{G}_{n,p})]\right|>\lambda\sqrt{n-1}]<2e^{-\lambda^2/2} \; . \] \end{lemma} \section{The Minrank of a Random Graph} \label{sec_minkank_gnp} The following elementary linear-algebraic lemma shows that a matrix $M \in \mathbb{F}^{n\times n}$ of rank $k$ is fully specified by $k$ linearly independent rows, $k$ linearly independent columns, and their $2k$ indices. In what follows, we denote by $\mathcal{M}_{n,k}$ the set of matrices from $ \mathbb{F}^{n\times n}$ of rank $k$. \begin{lemma}[Row and column bases encode the entire matrix] \label{lem_basis_determines_matrix} Let $M \in \mathcal{M}_{n,k}$, and let $R = (\mathrm{Row}_{i_1}(M),\ldots , \mathrm{Row}_{i_k}(M)), C = (\mathrm{Col}_{j_1}(M),\ldots , \mathrm{Col}_{j_k}(M))$ be, respectively, a row basis and a column basis of $M$. Then the mapping $\phi\colon \mathcal{M}_{n,k} \to (\mathbb{F}^{1\times n})^k \times (\mathbb{F}^{n\times 1})^k \times [n]^{2k}$ defined as \[ \phi(M)=(R,C,i_1,\ldots,i_k,j_1,\ldots,j_k) \; , \] is a one-to-one mapping. \end{lemma} \begin{proof} We first claim that the intersection of $R$ and $C$ has full rank, i.e., that the submatrix $M'\in\mathbb{F}^{k\times k}$ obtained by taking rows $i_1,\ldots,i_k$ and columns $j_1,\ldots,j_k$ has rank $k$. This is a standard fact, see, e.g.,~\cite[p20, Section 0.7.6]{HornJohnson}. We include a proof for completeness. Assume for convenience that $(i_1,\ldots,i_k)=(1,\ldots, k)$ % and $(j_1,\ldots,j_k)=(1,\ldots, k)$. % Next, assume towards contradiction that $\mathsf{rk}(M')=\mathsf{rk}(\{\mathrm{Col}_1(M'),\ldots , \mathrm{Col}_{k}(M')\}) = k' < k$. Since $C$ is a column basis of $M$, every column $\mathrm{Col}_i(M)$ is a linear combination of vectors from $C$, and in particular, every $\mathrm{Col}_i(M')$ is a linear combination of $\{\mathrm{Col}_1(M'),\ldots , \mathrm{Col}_{k}(M')\}$. Therefore, the $k\times n$ submatrix $M'' \coloneqq (\mathrm{Col}^{\leq k}_1(M),\ldots , \mathrm{Col}^{\leq k}_{n}(M))$ has rank $k'$. On the other hand, the $k$ rows of $M''\colon \mathrm{Row}_1(M),\ldots , \mathrm{Row}_k(M)$ were chosen to be linearly independent by construction. Thus, $\mathsf{rk}(M'')=k>k'$, which leads to a contradiction. In order to show that $\phi$ is one-to-one, we show that $R$ and $C$ (together with their indices) uniquely determine the remaining entries of $M$. We again assume for convenience that $(i_1,\ldots,i_k)=(1,\ldots, k)$ % and $(j_1,\ldots,j_k)=(1,\ldots, k)$. Consider any column vector $\mathrm{Col}_i(M)$, $i\in [n]\setminus [k]$. By definition, $\mathrm{Col}_i(M) = \sum_{t=1}^k \alpha_{i,t} \cdot \mathrm{Col}_t(M)$ for some coefficient vector $\alpha_i\coloneqq (\alpha_{i,1},\ldots , \alpha_{i,k})\in\mathbb{F}^{k\times1}$. Thus, in order to completely specify all the entries of $\mathrm{Col}_i(M)$, it suffices to determine the coefficient vector $\alpha_i$. But $M'$ has full rank, hence the equation $$ M' \alpha_i^T = \mathrm{Col}^{\leq k}_i(M) $$ has a \emph{unique} solution. Therefore, the coefficient vector $\alpha_i$ is fully determined by $M'$ and $\mathrm{Col}^{\leq k}_i(M)$. Thus, the matrix $M$ can be uniquely recovered from $R, C$ and the indices $\{i_1,\ldots, i_k\}, \{j_1,\ldots,j_k\}$. \end{proof} The following corollary gives us an upper bound on the number of low-rank matrices that contain sparse column and row bases. In what follows, we denote by $\mathcal{M}_{n,k,s}$ the set of matrices over $\mathbb{F}^{n \times n}$ of rank $k$ that contain an $s$-sparse row basis and an $s$-sparse column basis. \begin{corollary}[Efficient encoding of sparse-base matrices]\label{cor_matrix_encoding} \[ \left| \mathcal{M}_{n,k,s} \right| \leq (n\cdot|\mathbb{F}|)^{6s} \; . \] \end{corollary} \begin{proof} Throughout the proof, we assume without loss of generality that $s \geq k$, as otherwise $\left| \mathcal{M}_{n,k,s} \right|=0$ hence the inequality trivially holds. The function $\phi$ from Lemma~\ref{lem_basis_determines_matrix} maps matrices from $\mathcal{M}_{n,k,s}$ to $(R,C,i_1,\ldots, i_k, j_1,\ldots, j_k)$, where $R$ and $C$ are $s$-sparse bases. Therefore, the total number of matrices in $\mathcal{M}_{n,k,s}$ is bounded from above by \[ \left({\binom{kn}{s}} \cdot |\mathbb{F}|^{s}\right)^2 \cdot n^{2k} \leq \left( (n^2)^{s} \cdot |\mathbb{F}|^{s} \right)^2 \cdot n^{2k} \leq (n\cdot|\mathbb{F}|)^{6s} \; , \] where the last inequality follows from $k\leq s$. \end{proof} Now we show that a matrix of low rank with nonzero entries on the main diagonal must contain many nonzero entries. To get some intuition on this, notice that a rank $1$ matrix with nonzero entries on the diagonal must be nonzero everywhere. Also notice that the assumption on the diagonal is crucial -- low rank matrices in general can be very sparse. \begin{lemma}[Sparsity vs.\ Rank for matrices with non-zero diagonal] \label{lem_rank_vs_sparsity_diagonal} For any matrix $M \in \mathbb{F}^{n\times n}$ with non-zero entries on the main diagonal (i.e., $M_{i,i}\neq0$ for all $i\in[n]$), it holds that \[ s(M) \geq \frac{n^2}{4 \mathsf{rk}(M)} \; . \] \end{lemma} \begin{proof} Let $s$ denote $s(M)$. The average number of nonzero entries in a column of $M$ is $s/n$. Therefore, Markov's inequality implies that there are at least $n/2$ columns in $M$ \emph{each of which} has sparsity at most $2s/n$. Assume without loss of generality that these are the first $n/2$ columns of $M$. Now pick a maximal set of linearly independent columns among these columns. We claim that the cardinality of this set is at least $n^2/(4s)$. Indeed, in any set of less than $n^2/(4s)$ columns, the number of coordinates that are nonzero in \emph{any} of the columns is less than \[ \frac{n^2}{4s} \cdot \frac{2s}{n} = \frac{n}{2} \] and therefore there exists a coordinate $i \in \{1,\ldots,n/2\}$ that is zero in all those columns. As a result, the $i$th column, which by assumption has a nonzero $i$th coordinate, must be linearly independent of all those columns, in contradiction to the maximality of the set. We therefore get that \[ \mathsf{rk}(M) \geq n^2/(4s) \; , \] as desired. \end{proof} The last lemma we need is also the least trivial. In order to use Corollary~\ref{cor_matrix_encoding}, we would like to show that any $n \times n$ matrix of rank $k$ has sparse row and column bases, where by sparse we mean that their sparsity is roughly $k/n$ times that of the entire matrix. If the number of nonzero entries in each row and column was roughly the same, then this would be trivial, as we can take any maximal set of linearly independent columns or rows. However, in general, this might be impossible to achieve. E.g., consider the $n \times n$ matrix whose first $k$ columns are chosen uniformly and the remaining $n-k$ columns are all zero. Then any column basis would have to contain all first $k$ columns (since they are linearly independent with high probability) and hence its sparsity is equal to that of the entire matrix. Instead, what the lemma shows is that one can always choose a \emph{principal submatrix} with the desired property, i.e., that it contains sparse row and column bases, while at the same time having relative rank that is at most that of the original matrix. \begin{lemma}[Every matrix contains a principal submatrix of low relative-rank and sparse bases] \label{lem_k'_n'_n_k} Let $M\in \mathcal{M}_{n,k}$ be a matrix. % There exists a principal submatrix $M'\in \mathcal{M}_{n',k'}$ of $M$, such that $k'/n' \leq k/n$, and $M'$ contains a column basis and a row basis of sparsity at most \[ s(M')\cdot\frac{2k'}{n'}\; . % \] \end{lemma} Note that if $M$ contains a zero entry on the main diagonal, the lemma becomes trivial. Indeed, we can take $M'$ to be a $1\times 1$ principal submatrix formed by this zero entry. Thus, the lemma is only interesting for matrices $M$ without zero elements on the main diagonal (i.e., when every principal submatrix has rank greater than $0$). \begin{proof} We prove the statement of the lemma by induction on $n$. The base case $n=1$ holds trivially. Now let $n>1$, and assume that the statement of the lemma is proven for every $m\times m$ matrix for $1\leq m < n$. Let $s(i)$ be the number of nonzero entries in the $i$th column plus the number of non-zero entries in the $i$th row (note that a nonzero entry on the diagonal is counted twice). Let also $s_{\max}=\max_{i}{s(i)}$. By applying the same permutation to the columns and rows of $M$ we can assume that $s(1)\leq s(2)\leq \cdots \leq s(n)$ holds. If for some $1\leq n'<n$, the leading principal submatrix $M'$ of dimensions $n'\times n'$ has rank at most $k'\leq n'k/n$, then we use the induction hypothesis for $M'$. This gives us a principal submatrix $M''$ of dimensions $n''\times n''$ and rank $k''$, such that $M''$ contains a column basis and a row basis of sparsity at most $s(M'')\cdot\frac{2k''}{n''}$. Also, by induction hypothesis $k''/n''\leq k'/n'\leq k/n$, which proves the lemma statement in this case. Now we assume that for all $n'<n$, the rank of the leading principal submatrix of dimension $n'\times n'$ is greater than $n'k/n$. We prove that the lemma statement holds for $M'=M$ for a column basis, and an analogous proof gives the same result for a row basis. For every $0\leq i\leq s_{\max}$, let $a_i=|\{j \,:\, s(j)=i\}|$. Note that \begin{equation}\label{eq:suma} \sum_{i=0}^{s_{\max}} a_i=n \; . \end{equation} Let us select a column basis of cardinality $k$ by greedily adding linearly independent vectors to the basis in non-decreasing order of $s(i)$. Let $k_i$ be the number of selected vectors $j$ with $s(j)=i$. Then \begin{equation}\label{eq:sumk} \sum_{i=0}^{s_{\max}} k_i=k. \end{equation} Next, for any $0 \leq t<s_{\max}$, consider the leading principal submatrix given by indices $i$ with $s(i)\leq t$. The rank of this matrix is at most $k'=\sum_{i=0}^t k_i$, and its dimensions are $n'\times n'$, where $n'=\sum_{i=0}^t a_i < n$. Thus by our assumption $k'/n'\geq k/n$, or equivalently, \begin{equation}\label{eq:ineq_on_t} \sum_{i=0}^tk_i\geq\frac{k}{n}\cdot \sum_{i=0}^ta_i \; . \end{equation} From~\eqref{eq:suma} and \eqref{eq:sumk}, \begin{equation}\label{eq:totalsum} \sum_{i=0}^{s_{\max}}{k_i}=\frac{k}{n}\cdot\sum_{i=0}^{s_{\max}}{a_i} \; . \end{equation} Now, \eqref{eq:ineq_on_t} and~\eqref{eq:totalsum} imply that for all $0\leq t\leq s_{\max}$:\begin{equation}\label{eq:suffix} \sum_{i=t}^{s_{\max}}{k_i} \leq \frac{k}{n}\cdot \sum_{i=t}^{s_{\max}}{a_i} \; . \end{equation} To finish the proof, notice that the sparsity of the constructed basis of $M$ is at most \begin{align*} \sum_{i=1}^{s_{\max}}i\cdot k_i =\sum_{t=1}^{s_{\max}}\sum_{i=t}^{s_{\max}}k_i \stackrel{\eqref{eq:suffix}}{\leq} \frac{k}{n}\cdot\sum_{t=1}^{s_{\max}}\sum_{i=t}^{s_{\max}}a_i =\frac{k}{n}\cdot\sum_{i=1}^{s_{\max}}i\cdot a_i=s(M)\cdot \frac{2k}{n} \; . \end{align*} \end{proof} Now we are ready to prove our main result -- a lower bound on the minrank of a random graph. \begin{theorem} \label{thm_mrk_gnp} \[ \Pr\left[\, \mathsf{minrk_{\F}}(\mathcal{G}_{n,p}) \geq \Omega\left(\frac{n\log(1/p)}{\log{\left(n|\mathbb{F}|/p\right)}}\right) \, \right ] \; \geq \; 1-e^{-\Omega\left(\frac{n\log^2{(1/p)}}{\log^2{\left(n|\mathbb{F}|/p\right)}}\right)} \; . \] \end{theorem} \begin{proof} Let us bound from above probability that a random graph $\mathcal{G}_{n,p}$ has minrank at most $$k := \frac{n\log(1/p)}{C\log{\left(n|\mathbb{F}|/p\right)}},$$ for some constant $C$ to be chosen below. Recall that by Lemma~\ref{lem_k'_n'_n_k}, every matrix of rank at most $k$ contains a principal submatrix $M'\in\mathcal{M}_{n',k'}$ of sparsity $s' = s(M')$ with column and row bases of sparsity at most $$s'\cdot\frac{2k}{n},$$ where $k'/n'\leq k/n$. % By Corollary~\ref{cor_matrix_encoding}, there are at most $(n'\cdot|\mathbb{F}|)^{6(2s'k/n)}$ such matrices $M'$, and (for any $s'$) there are $\binom{n}{n'}$ ways to choose a principal submatrix of size $n'$ in a matrix of size $n\times n$. Furthermore, recall that Lemma~\ref{lem_rank_vs_sparsity_diagonal} asserts that for every $n',k'$, \begin{equation}\label{eq_density_M_prime} s'\geq \frac{n'^2}{4k'}. \end{equation} Finally, since $M'$ contains at least $s'-n'$ off-diagonal non-zero entries, $\mathcal{G}_{n,p}$ contains it with probability at most $p^{s'-n'}$. We therefore have \begin{align} \Pr\left[\mathsf{minrk_{\F}}(\mathcal{G}_{n,p}) \leq k\right]\nonumber\\ &\leq\sum_{k',n',s'}\Pr\left[\mathcal{G}_{n,p} \text{ contains $M'\in\mathcal{M}_{n',k'},$ } s(M')=s', s(\text {bases of }M') \leq s'\cdot\frac{2k}{n}\right] \nonumber\\ &\leq\sum_{k',n',s'} \binom{n}{n'} \cdot p^{s'-n'} \cdot \left(n'\cdot|\mathbb{F}| \right)^{12s'k/n}\nonumber\\ &\leq\sum_{k',n',s'} 2^{n'\log{n}-s'\log(1/p)+n'\log(1/p)+(12s'k/n)\log{(n'|\mathbb{F}|)}} \label{mainbound} \; , \end{align} where all the summations are taken over $n', k'$, s.t. $k'/n' \leq k/n$ and $s'\geq \frac{n'^2}{4k'}$, and the first inequality is again by Lemma~\ref{lem_k'_n'_n_k}. We now argue that for sufficiently large constant $C$, all positive terms in the exponent of \eqref{mainbound} are dominated by the magnitude of the negative term ($s'\log(1/p)$). Indeed: \begin{align*} n'\log{n}+n'\log(1/p)+(12s'k/n)\log{(n'|\mathbb{F}|)} &=n'\log{(n/p)}+(12s'k/n)\log{(n'|\mathbb{F}|)}\\ \leq(4s'k'/n')\log{(n/p)}+(12s'k/n)\log{(n|\mathbb{F}|)} &\leq(16s'k/n)\log{(n|\mathbb{F}|/p)} =(16s'/C)\log{(1/p)} \; , \end{align*} where the first inequality follows from~\eqref{eq_density_M_prime}, and the second one follows from $k'/n' \leq k/n$. Thus, for $C>16$, \begin{align*} \Pr\left[\mathsf{minrk_{\F}}(\mathcal{G}_{n,p}) \leq \frac{n\log(1/p)}{C\log{\left(n|\mathbb{F}|/p\right)}}\right] \leq n^4\cdot 2^{-\Omega(s'\log(1/p))}\leq 2^{-\Omega(\log(n))}. \end{align*} In particular, $\mathbb{E}\left[\mathsf{minrk_{\F}}(\mathcal{G}_{n,p})\right] \geq \frac{n\log(1/p)}{2C\log{\left(n|\mathbb{F}|/p\right)}}$. Furthermore, note that changing a single row (or column) of a matrix can change its minrank by at most $1$, hence the minrank of two graphs that differ in one vertex differs by at most $1$. We may thus apply Lemma~\ref{thm:azuma} with $\lambda=\Theta\left(\frac{\sqrt{n}\log(1/p)}{\log{\left(n|\mathbb{F}|/p\right)}} \right)$ to obtain \[ \Pr\left[\, \mathsf{minrk_{\F}}(\mathcal{G}_{n,p}) \geq \Omega\left(\frac{n\log(1/p)}{\log{\left(n|\mathbb{F}|/p\right)}}\right) \, \right ] \; \geq \; 1-e^{-\Omega\left(\frac{n\log^2{(1/p)}}{\log^2{\left(n|\mathbb{F}|/p\right)}}\right)} \; . \] as desired. \end{proof} \begin{corollary}\label{cor_main_thm_const_p} For a constant $0<p<1$ and a field $\mathbb{F}$ of size $|\mathbb{F}|<n^{O(1)}$, \[ \Pr\left[\, \mathsf{minrk_{\F}}(\mathcal{G}_{n,p}) \geq \Omega(n/\log{n}) \, \right ] \; \geq \; 1-e^{-\Omega\left(n/\log^2{n}\right)} \; . \] \end{corollary} \subsection{Tightness of Theorem~\ref{thm_mrk_gnp}} In this section, we show that Theorem~\ref{thm_mrk_gnp} provides a tight bound for all values of $p$ bounded away from~$1$ (i.e., $p \leq 1-\Omega(1)$). (See also the end of the section for the regime of $p$ close to $1$.) \begin{theorem}\label{thm:tight} For any $p$ bounded away from~$1$, \[ \Pr\left[\, \mathsf{minrk_{\F}}(\mathcal{G}_{n,p}) = O\left(\frac{n\log(1/p)}{{\log{n}+\log(1/p)}}\right) \, \right ] \; \geq \; 1- e^{-\Omega\left(n\right)}\; . \] \end{theorem} \begin{proof} We can assume that $p > n^{-1/8}$ as otherwise the statement is trivial. As we saw in the introduction, in the case of a clique (a graph with an arc between every pair of distinct vertices) it is enough to broadcast only one bit. This simple observation leads to the ``clique-covering'' upper bound: If a directed graph $G$ can be covered by $m$ cliques, then $\mathsf{minrk_{\F}}(G)\leq m$~\cite{haemers1978upper, BBJK06, HL12}. Note that the minimal number of cliques needed to cover $G$ is exactly $\chi(\bar{G})$. Thus, we have the following upper bound: For any field $\mathbb{F}$ and any directed graph $G$, \begin{align}\label{thm:upperbound} \mathsf{minrk_{\F}}(G)\leq \chi(\bar{G}) \; . \end{align} Since the complement of $\mathcal{G}_{n,p}$ is $\mathcal{G}_{n,1-p}$, it follows from~\eqref{thm:upperbound} that an upper bound on $\chi(\mathcal{G}_{n,1-p})$ implies an upper bound on $\mathsf{minrk_{\F}}(\mathcal{G}_{n,p})$. Let $\mathcal{G}^-_{n,p}$ denote a random Erd{\H o}s-R{\'e}nyi % \emph{undirected} graph on $n$ vertices, where each edge is drawn independently with probability $p$. For constant $p$, the classical result of Bollob{\'a}s~\cite{bollobas1988chromatic} asserts that the chromatic number of an undirected random graph satisfies \begin{equation}\label{eq:chiconst} \Pr\left[\chi(\mathcal{G}^-_{n,1-p})\leq \frac{n\log{(1/p)}}{2\log{n}}\left(1+o(1)\right)\right] > 1-e^{-\Omega(n)} \; . \end{equation} In fact, Pudl{\'a}k, R{\"o}dl, and Sgall~\cite{pudlak1997boolean} showed that~\eqref{eq:chiconst} holds for any $p>n^{-1/4}$. Since we define the chromatic number of a directed graph to be the chromatic number of its undirected counterpart, $\chi(\mathcal{G}_{n,1-p})=\chi(\mathcal{G}^-_{n,1-p^2})$. The bound~\eqref{eq:chiconst} depends on $p$ only logarithmically ($\log{(1/p)}$), thus, asymptotically the same bounds hold for the chromatic number of a random directed graph. \end{proof} The lower bound of Theorem~\ref{thm_mrk_gnp} is also almost tight for the other extreme regime of $p=1-\varepsilon$, where $\varepsilon=o(1)$. {\L}uczak~\cite{luczak1991chromatic} proved that for $p=1-\Omega(1/n)$, \begin{equation}\label{eq:chilarge} \Pr\left[\chi(\mathcal{G}^-_{n,1-p})\leq \frac{n(1-p)}{2\log{n(1-p)}}\left(1+o(1)\right)\right] > 1- \left(n(1-p)\right)^{-\Omega(1)} \; . \end{equation} When $p=1-\varepsilon$, the upper bound~\eqref{eq:chilarge} matches the lower bound of Theorem~\ref{thm_mrk_gnp} for $\varepsilon\geq n^{-1+\Omega(1)}$. For $\varepsilon=O(n^{-1})$,~\eqref{eq:chilarge} gives an asymptotically tight upper bound of $O(1)$. Thus, we only have a gap between the lower bound of Theorem~\ref{thm_mrk_gnp} and known upper bounds when $p=1-\varepsilon$ and $\omega(1) \leq n\varepsilon \leq n^{o(1)}$. \section*{Acknowledgements} We would like to thank Ishay Haviv for his valuable comments on an earlier version of this work. \bibliographystyle{alpha}
{'timestamp': '2017-02-17T02:04:40', 'yymm': '1607', 'arxiv_id': '1607.04842', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04842'}
arxiv
\section{Introduction} Network operators continuously upgrade their networks due to increasing demands for ubiquitous communications. As popularities of cloud computing, Internet of Things (IoT), and 5G mobile communications increase, network traffic is becoming heavy and extremely bursty. Thus, just enlarging the network capacity is not an economical choice, while neglecting it will strongly affect the QoS. Also, emerging applications, such as online gaming, data backups and virtual machine migrations, result in heterogeneous demands in telecom networks. Today's network users request more customized services, such as Virtual Private Network (VPN) and Video on Demand (VoD), and more differentiated demands with different prices \cite{he2005}. For some of the traffic which is delay-insensitive and can accept some compromise in bandwidth or other aspects, it can be preempted by more ``important" requests when the network becomes congested. Thus, to maintain cost-effectiveness and customers' loyalty, network operators can provide different grades of service besides sufficient bandwidth, instead of trying to support all the traffic without distinction \cite{muhammad2013}. To address these problems, \emph{degraded provisioning} is proposed to provide a degraded level of service when network congestion occurs instead of no service at all. Generally, degraded provisioning has two approaches: 1) keep total amount of transferred traffic constant by time prolongation or modulation-level adjustment with immediate service access (QoS-assured), or 2) degrade requested bandwidth without time or modulation compensation, or no guarantee for immediate access (QoS-affected). We focus on QoS-assured degraded provisioning in this study. In a multi-layer network, QoS-assured degradation has different implementation methods in different layers. In electric layer, for a delay-insensitive and degradation-tolerant request, when network bandwidth is scarce, we degrade its transmission rate to enlarge the available bandwidth and extend its holding time based on the premise that total traffic amount is unchanged. Note that a traffic request cannot be degraded arbitrarily, and it is constrained by a given deadline \cite{fawaz2010}. In elastic optical layer, degradation refers to decreasing the number of occupied spectrum slots of a lightpath and raising the modulation level to guarantee the capacity. In OFDM-based elastic optical networks, modulation level can be dynamically reconfigured in DSP and DAC/ADC via software \cite{zhang2013}. But optical degradation has a constraint that higher-order modulation has shorter transmission reach \cite{bocoi2009}. Due to the flexibility enabled by degraded provisioning, there exist many studies on this topic in different kinds of optical networks. In WDM networks, Roy \emph{et al.} \cite{roy2008} studied degraded service using multipath routing in a QoS-affected way. Zhang \emph{et al.} \cite{zhang2010} studied reliable multipath provisioning, exploiting flexibility in bandwidth and delay. Andrei \emph{et al.}\cite{Andrei2010} proposed a deadline-driven method to flexibly provision services without immediate access. Savas \emph{et al.} \cite{sedef2014} introduced a dynamic scheme to reduce blocking by exploiting degraded-service tolerance in a QoS-affected way, and they also applied this method to increase network survivability \cite{sedef}. In Mixed-Line-Rate (MLR) networks, Vadrevu \emph{et al.} \cite{vadrevu2014} proposed a QoS-affected degradation scheme using multipath routing considering minimum-cost network design. But the ITU-T grid limit puts constraints on optical layer flexibility. As a major development of optical technology, elastic optical networking enables more flexibility in optical modulation and spectrum allocation. Distance-adaptive spectrum allocation \cite{jinno2010} is a similar approach as optical degradation, but its limitations are that the modulation format of a lightpath is configured at one time and cannot be adjusted based on the fluctuation of traffic. Gkamas \emph{et al.} \cite{Gkamas2015} proposed a dynamic algorithm for joint multi-layer planning in IP-over-flexible-optical networks without considering dynamic adjustment of lightpath modulation. Recent progress in modulation format conversion \cite{huang2012} enables all-optical OOK to 16QAM adjustment, and its advantages in elastic optical networking were demonstrated in Yin \emph{et al.} \cite{Yin2014} with modulation-formats-convertible nodes. Thus, degraded provisioning can be extended to the elastic optical layer, and this important issue has not been fully understood, with no previous studies. We summarize our contributions as follows: 1) to the best of our knowledge, this is the first investigation on QoS-assured degraded provisioning problem in multi-layer networks with optical elasticity; 2) we propose an enhanced multi-layer network architecture and solve the complex dynamic degraded routing problem; and 3) we further propose novel dynamic heuristic algorithms in both layers to achieve degraded resource allocation. Results show that a significant increase of service acceptance can be achieved by multi-layer degradation. \thispagestyle{fancy} \chead{\small Accepted, IEEE Globecom 2016, Optical Networks and Systems (ONS) Symposium, for ArXiv only.} \section{Dynamic Degraded Provisioning Scheme} We decompose the online degraded provisioning problem into two subroutines: 1) degraded routing, and 2) degraded resource allocation. \subsection{Degraded Routing} Degraded routing solves the subproblem of degraded-route computation when conventional routing cannot be performed due to resource shortage. Optical degraded routing acts similarly as electric degraded routing. The term \emph{request} here refers to the \emph{lightpath request} in optical layer, and the \emph{service request} in electric layer. There are two concerns: route hops (RH) and potential degraded requests (PDR). RH denotes the amount of resources occupied by the new request, while PDR denotes how many existing requests may be affected. We define a link in any layer of the multi-layer network as a tuple: $V_{ij,k}=(\mathbf{\Theta}, C)$, which is the $k^{th}$ link from $i$ to $j$. $\mathbf{\Theta}$ is a set that contains existing requests routed on this link, and $C$ is the available capacity of this link. $r_{n}$ is a request, and $\mathcal{P}_{r_n}$ is a degraded route for $r_{n}$ in electric or optical layer. \vspace{-0.3em} \begin{equation} \small \mathcal{P}_{r_n}=\{V_{ij,k}|r_n \in V_{ij,k}.\mathbf{\Theta}\} \vspace{-0.4em} \end{equation} We introduce two metrics to evaluate the route $\mathcal{P}_{r_n}$. Note that the $|\cdot|$ operation returns the number of elements in a set. \vspace{-0.5em} \begin{equation} \small \mathcal{N}_{RH}=|\mathcal{P}_{r_{n}}| \vspace{-0.3em} \end{equation} \begin{equation} \small \mathcal{N}_{PDR}=|\bigcup^{|\mathcal{P}_{r_{n}}|}_{c=1}\mathcal{P}_{r_{n}}[c].\mathbf{\Theta}| \vspace{-0.5em} \end{equation} To calculate a route for minimizing RH, Dijkstra algorithm is applied. However, minimizing PDR is not that easy, because the minimizing-PDR problem aims to obtain a route that has the smallest PDR among all possible routes between a given source-destination $(s,d)$ pair. A straight-forward idea is to list all possible routes between a given $(s,d)$ pair and compare their PDR. But the complexity of this process is $O((N-2)!)$ ($N$ denotes the number of nodes). Here, we propose the enhanced multi-layer network architecture by introducing the auxiliary \emph{service layer}, which lies directly above the electric layer, and we solve the problem in polynomial time. In the enhanced multi-layer architecture (Fig. 1), all nodes in the optical layer are mapped to upper two layers. There are two kinds of directional weighed links, i.e., request link and resource link. Request link weight is equal to a given large number times a binary that indicates whether there are existing requests between the node pair. Resource link weight is binary, which means if there is sufficient resource for this request. Note that, if the upper layer has isolated nodes (no connected edges), and the isolated node happens to be the source or destination of the request, then we replace the isolated node with the originating or terminating nodes of lightpaths (or requests) that bypass the isolated node. For example, in Fig. 1, $e^*$ is bypassed by request \#2 ($a^*$-$e^*$-$c^*$) on service layer. Thus, if we want to compute a degraded route on electric layer with minimized PDR for a new request ($a^*,e^*$), we should replace $e^*$ with $c^*$, and execute a shortest-path algorithm on service layer for the auxiliary request ($a^*,c^*$). Therefore, the \emph{minimizing-PDR problem} on one layer is transformed into a \emph{weighed shortest-path problem} on the upper layer. Finally, an actual route will be acquired based on the computed shortest path on upper layer. \begin{figure}[t] \centering \vspace {-1em} \includegraphics[width=2.5in]{fig1-multilayer.pdf} \vspace {-0.5em} \caption{Illustration of enhanced multi-layer network architecture.} \label{Algorithm graph} \vspace {-1.7em} \end{figure} \begin{figure*}[t] \centering \vspace {-1.8em} \subfigure[Dynamic electric degradation.]{ \label{fig:subfig:a} \hspace{-3em} \includegraphics[width=2in]{fig2-e_degrade.pdf}} \hspace{0.5em} \subfigure[Dynamic optical degradation: on a fiber.]{ \label{fig:subfig:a} \includegraphics[width=2in]{fig2-o_degrade}} \hspace{0.5em} \subfigure[Dynamic optical degradation: along a route.]{ \label{fig:subfig:a} \includegraphics[width=2.4in]{fig2-o_degrade_route}} \hspace{-2.5em} \vspace{-0.4em} \caption{Illustration of multi-layer degradation principle in degraded resource allocation stage.} \label{fig:subfig} \vspace {-1.4em} \end{figure*} \vspace {-1em} \algsetup{ linenosize=\normalsize, linenodelimiter=. } \noindent % \rule [-0.3em] {\linewidth} {0.75pt} \\% \noindent \textbf{Algorithm I}: Minimizing-PDR Algorithm \\ \rule [0.8em]{\linewidth} {0.4pt} \\% \vspace {-2.4em} \begin{algorithmic}[1] \footnotesize \STATE Upper-layer topology$\{t_{i,j}\}=\{0\}$; current layer topology $\{t'_{i,j}\}$; $M$ is a large number; request ($s,d$); \FOR {all requests $r$ \textbf{in} current layer} \STATE $t_{r.source,r.destination}=M$; \ENDFOR \FOR {all $i,j$} \STATE $t_{i,j}=t'_{i,j}$; \ENDFOR \IF {$\sum_{j \in N} t_{s,j}+\sum_{i\in N} t_{i,s}=0\ || \sum_{j \in N} t_{d,j}+\sum_{i\in N} t_{i,d}=0$} \STATE replace $s$ (or $d$) with the originating (or terminating) nodes of lightpaths (or request) that running bypass $s$ (or $d$); \ENDIF \STATE run shortest-path algorithm on upper-layer topology $\{t_{i,j}\}$, acquire $\mathcal{P}$; \FOR {all links $V_{m,n}$ \textbf{in} $\mathcal{P}$} \STATE find a $V_{m,n}$ with the shortest hops (if $m$ or $n$ is the replaced node, use the isolated node to count hops) in lower layer; acquire its route; \ENDFOR \STATE combine all the acquired routes together, cancel loops and return it; \end{algorithmic} \vspace {-1em} % \rule {\linewidth} {0.75pt} Now, we introduce two policies of degraded routing: \subsubsection{Minimize Route Hops (MinRH)} We manage to minimize RH as a primary goal, and then minimize PDR. \subsubsection{Minimize Potential Degraded Requests (MinPDR)} We try to minimize PDR first, then we minimize RH. \vspace{-0.3em} \subsection{Degraded Resource Allocation} When a degraded route $\mathcal{P}^e$ (electric) or $\mathcal{P}^o$ (optical) is acquired, we need to decide which request or requests to degrade, and how much to degrade them. In the multi-layer network, degraded resource allocation refers to different operations in different layers, which should be further studied separately. \subsubsection{Electric Degraded Bandwidth Allocation (ED-BA)} We propose the ED-BA algorithm based on a degraded route $\mathcal{P}^e$. A traffic service request on electric layer is defined as: $r_{n}=(s, d, bw, t, \tau, \eta, \rho)$, which mean source, destination, bandwidth, arrival time point, holding time, prolongation deadline, and priority, respectively. We define a function $AS(S, k)$, which sorts elements in set $S$ in ascending order of $k$. \vspace {-1em} \algsetup{ linenosize=\normalsize, linenodelimiter=. } \noindent % \rule [-0.3em] {\linewidth} {0.75pt} \\% \noindent \textbf{Algorithm II}: ED-BA Algorithm \\ \rule [0.8em]{\linewidth} {0.4pt} \\% \vspace {-2.4em} \begin{algorithmic}[1] \footnotesize \STATE Current time $t_c$, arriving request $r_0$, $flag$ = 1; \FOR {all links $V_n$ \textbf{in} $\mathcal{P}^e$} \IF{$V_n.C < r_0.bw$} \STATE $PDL(V_n)\leftarrow \{r_0\}$; \quad \emph{/*potential degraded links*/} \FOR {all requests $r$ \textbf{in} $V_n.\mathbf{\Theta}$} \IF {$r.\rho \leq r_0.\rho$} \STATE $PDL(V_n).pushback(r)$; \ELSE \STATE continue; \ENDIF \ENDFOR \IF {$\sum_{u \in PDR(V_n)} u.bw\times\frac{u.\eta}{(u.\tau+u.\eta)} \geq r_0.bw$} \STATE $ac\_bw\leftarrow$ 0; \ \emph{/*accumulate available bandwidth*/} \FOR {all requests $x$ \textbf{in} $AS(PDL(V_n), priority)$} \STATE degrade $x.bw$ to its maximum extent $x.bw'$, s.t. $\frac{(x.bw\times x.\tau-(t_c-x.t)\times x.bw)}{x.bw'}+t_c-x.t \leq x.\eta+x.\tau$; \STATE $ac\_bw= ac\_bw+x.bw-x.bw'$; \IF {$ac\_bw > r_0.bw$} \STATE request $r_0$ routed successfully on $V_n$; break; \ENDIF \ENDFOR \ELSE \STATE request $r_0$ blocked; $flag$ = 0; break; \ENDIF \ELSE \STATE continue; \ENDIF \ENDFOR \IF {$flag$ == 1} \STATE request $r_0$ is routed successfully; \ENDIF \end{algorithmic} \vspace {-1em} % \rule {\linewidth} {0.75pt} Fig. 2(a) shows the basic principle of the ED-BA algorithm, that requests with higher priorities can ``preempt" those with no higher priorities. Here, the term ``preempt" means that some existing requests are degraded in transmission rate due to their relatively low priorities. Meanwhile, we manage to degrade the minimal number of requests to provide just-enough bandwidth. \thispagestyle{fancy} \chead{\small Accepted, IEEE Globecom 2016, Optical Networks and Systems (ONS) Symposium, for ArXiv only.} \subsubsection{Optical Degraded Modulation and Spectrum Allocation (OD-MSA)} In an elastic optical network, optical degradation refers to the reduction of occupied-spectrum-slot number of a lightpath, and raise lightpath's modulation level to ensure lightpath capacity under the modulation-distance constraint. Figs. 2(b) and 2(c) show how optical degradation works. The number of spectrum slots in a fiber is $B$. $S_f$ is a binary bitmask that contains $B$ bits to record the availability of each spectrum slot in fiber $f$, e.g., $S_f[p]=1$ means the $p^{th}$ slot is utilized. A lightpath is defined as a tuple: $L=(f, \xi_l, \xi_r, \eta, \delta)$, which denotes the fiber that the lightpath is routed through, left and right indices of occupied spectrum slots, modulation level, and lightpath distance, respectively. Note that $(\xi_r-\xi_l+1)\cdot log_2\eta$ should be constant when performing optical degradation. A lightpath request is defined as a tuple: $l_n=\{i, j, \theta\}$, which denotes source, destination, and requested bandwidth in spectrum slots. We define a function $Q(a)$ to get the transmission reach of modulation level $a$. We define Available Spectrum Slots Intersection (ASSI), which is a set of slots that are available all along the optical degraded route $\mathcal{P}^o$, to evaluate the available resources for the new lightpath before optical degradation. Note that the operator $\lor$ represents the logical OR operation, and $p \in [1,B]$. \vspace {-0.5em} \begin{equation} \small ASSI=\{S_f[p] | \sum_{f =1}^{|\mathcal{P}^o|-1}S_f[p] \lor S_{f+1}[p]=0\} \vspace {-0.5em} \end{equation} We define Slot Border Through Lightpaths (SBTL) to evaluate whether a slot border locates inside the occupied spectrum of a lightpath. $w$ denotes index of spectrum slot borders, and there are $B+1$ borders, thus $w \in [1, B+1]$. We define a decision function $D(x)$ which is equal to 0 if $x$ is positive, or returns 1 if $x$ is negative. \vspace {-0.5em} \begin{equation} \small SBTL=\{w|\sum_{L:L.f\in\mathcal{P}^o}D((w-\frac{1}{2}-L.\xi_l)(w-\frac{1}{2}-L.\xi_r))=0\} \vspace {-0.5em} \end{equation} When a degradation location (available slots or a slot border) is found in the spectrum by ASSI or SBTL, the potential degraded lightpaths are those on both sides of the location. We first try to degrade the left one ($L_1$), which is called \emph{single-side degradation}. And if only $L_1$ degradation cannot provide enough slots, we continue to degrade the right one ($L_2$), which is called \emph{double-side degradation}. Note that, when there are multiple possibilities (choosing an element in ASSI or SBTL), a First-Fit policy is applied to choose the one with smaller index to reduce spectrum fragmentation. On new lightpath establishment, we use the threshold-based grooming approach, which has been demonstrated to achieve lower blocking probability than the fixed-grid IP-over-WDM and elastic-spectrum non-grooming approaches \cite{wan2012}. \vspace {-1em} \algsetup{ linenosize=\normalsize, linenodelimiter=. } \noindent % \rule [-0.3em] {\linewidth} {0.75pt} \\% \noindent \textbf{Algorithm III}: OD-MSA Algorithm \\ \rule [0.8em]{\linewidth} {0.4pt} \\% \vspace {-2.4em} \begin{algorithmic}[1] \footnotesize \STATE Arriving lightpath request $l_0$; \FOR {all fibers $f_n$ \textbf{in} $\mathcal{P}^o$} \STATE scan the spectrum to acquire $ASSI$; \IF{$|ASSI|>0$} \STATE choose consecutive available slots $[l,r]$ with the largest $r-l$ value in $ASSI$; \STATE scan the spectrum to acquire $L_1$ and $L_2$ ($L_1.\xi_r==l-1\ \&\&\ L_2.\xi_l==r+1$); \IF {$Q(log_2a+1)< L_1.\delta \leq Q(log_2a)$ and $Q(log_2b+1)< L_2.\delta \leq Q(log_2b)$} \STATE $L_1.\eta =a$; \quad\quad \emph{/*degrade $L_1$ to modulation level $a$*/} \IF {$(L_1.\xi_r-L_1.\xi_l+1)(1-log_2(\eta_0-a))+(l-r+1)\geq l_0.\theta$} \STATE setup a new lightpath with $l_0.spt$ slots, starting from $L_1.\xi_l+(L_1.\xi_r-L_1.\xi_l+1)log_2(\eta_0-a)$; \ELSIF{$(L_1.\xi_r-L_1.\xi_l+1)(1-log_2(\eta_0-a))+(l-r+1)+(L_2.\xi_r-L_2.\xi_l+1)(1-log_2(\eta_0-b))\geq l_0.\theta$} \STATE $L_2.\eta =b$; \quad\emph{/*degrade $L_2$ to modulation level $b$*/} \STATE setup a new lightpath with $l_0.\theta$ slots, starting from $L_1.lft+(L_1.\xi_r-L_1.\xi_l+1)log_2(\eta_0-a)$; \ELSE \STATE request $l_0$ blocked; break; \ENDIF \ENDIF \ELSIF {$|SBTL|>0$} \STATE choose smallest $w$ in $SBTL$, and perform sentence 7 to 17 (here, let $l=r+1=w$); \ELSE \STATE request $l_0$ blocked; break; \ENDIF \ENDFOR \end{algorithmic} \vspace {-1em} % \rule {\linewidth} {0.75pt} \vspace {-0.6em} \subsection{Complexity Analysis} In degraded routing stage, minimizing-RH problem can be solved with Dijkstra algorithm with $O(N^2)$ complexity in a $N$-node topology. But the minimizing-PDR problem may have a complexity of $O(N^3)$ if both source and destination nodes of the request are isolated nodes\footnote{Here, the isolated nodes in request should be replaced by other nodes of the upper layer in path computation, and the problem becomes an all-pairs shortest-path one, which should be solved via Floyd algorithm ($O(N^3)$).}. In degraded resource allocation stage, the worst case is that the degraded route goes through every node of the topology, and the complexity is $O(N)$. In ED-BA algorithm, we suppose that the maximum number of existing requests on each link is $R$ (related to traffic load), and the time complexity is $O(NR)$. In OD-MSA algorithm, the complexity\footnote{Here, $B$ is the number of spectrum slots, which is a constant parameter.} is $O(NB^2)$. Hence, the complexity of the proposed dynamic degraded provisioning scheme is $O(N^3+NR)$, and is suitable for online decision making in dynamic traffic accommodation. \thispagestyle{fancy} \chead{\small Accepted, IEEE Globecom 2016, Optical Networks and Systems (ONS) Symposium, for ArXiv only.} \section{Illustrative Numerical Evaluations} \begin{figure}[!t] \centering \vspace {-1em} \includegraphics[scale=0.22]{fig3-USNet} \vspace {-1em} \caption{USNet topology with fiber length in kilometers marked on links.} \label{Algorithm graph} \vspace {-1.5em} \end{figure} \subsection{Experimental Setup} Table I summarizes the parameters of different modulation formats based on \cite{bocoi2009} \cite{zhu2013}. We consider the USNet topology (Fig. 3) for dynamic performance simulation. All fibers are unidirectional with 300 spectrum slots, and spectrum width of each slot is 12.5 GHz. Traffic requests are generated between all node pairs, and characterized by Poisson arrivals with negative exponential holding times. Granularities of requests are distributed independently and uniformly from 5 Gbps to 150 Gbps. The maximum acceptable ratio for transmission-rate degradation is uniformly distributed in [25\%, 100\%] \cite{sedef}. There are 5 priorities with equal amount each. The lightpath establishment threshold for grooming is chosen as 150 Gbps, which is equal to the largest request bandwidth and performs the best \cite{wan2012}. An event-driven dynamic simulator has been developed to verify the effectiveness of the heuristic algorithms. Six degradation policies, i.e. OE-MinPDR, O-MinPDR, E-MinPDR, OE-MinRH, O-MinRH, E-MinRH (OE: both-layer degradation, O: optical degradation only, E: electric degradation only) are studied. \begin{figure*}[!t] \centering \vspace{-1em} \hspace{-2em} \subfigure[Requests with all priorities.]{ \label{fig:subfig:a} \includegraphics[width=2.2in]{fig4-overall}} \hspace{0.2em} \subfigure[Requests with highest priority (\#5).]{ \label{fig:subfig:a} \includegraphics[width=2.2in]{fig4-high-priority}} \hspace{0.2em} \subfigure[Requests with lowest priority (\#1).]{ \label{fig:subfig:a} \includegraphics[width=2.2in]{fig4-low-priority}} \hspace{-2em} \vspace{-0.5em} \caption{Bandwidth blocking probability vs. traffic load: different degradation policies.} \label{fig:subfig} \vspace {-1em} \end{figure*} \begin{figure*}[!t] \centering \hspace{-2.5em} \subfigure[Instantaneous network throughput (MinPDR).]{ \label{fig:subfig:a} \includegraphics[width=2.3in]{fig5-trans-PDR}} \hspace{0.15em} \subfigure[Instantaneous network throughput (MinRH).]{ \label{fig:subfig:a} \includegraphics[width=2.3in]{fig5-trans-RH}} \hspace{0.15em} \subfigure[Instantaneous BBP.]{ \label{fig:subfig:a} \includegraphics[width=2.2in]{fig5-trans-bbp}} \vspace{-0.5em} \hspace{-2em} \caption{Transient analysis within 1.5 $hour$ (30 $Erlang$ per node, $\lambda=300\ hour^{-1}, \mu =10\ hour^{-1}$): different degradation policies.} \label{fig:subfig} \vspace {-1.5em} \end{figure*} \begin{table}[htbp] \vspace {-0.6em} \renewcommand{\arraystretch}{1} \vspace {-1em} \caption{Modulation format vs. Data rate vs. Transmission reach} \label{table_example} \centering \vspace {-1em} \begin{tabular}{m{71pt}<{\centering} m{50pt}<{\centering} m{23pt}<{\centering} m{23pt}<{\centering} m{23pt}<{\centering}} \hline Modulation format & BPSK~(default) & QPSK & 8QAM & 16QAM\\ \hline Modulation~level & 2 & 4 & 8 & 16 \\ Bits~per~symbol & 1 & 2 & 3 & 4\\ Slot~bandwidth~(GHz)& 12.5 & 12.5 & 12.5 & 12.5\\ Data~rate~(Gbps)& 12.5 & 25 & 37.5 & 50\\ Transmission~reach~(km) & 9600 & 4800 & 2400 & 1200\\ \hline \end{tabular} \vspace {-1.5em} \end{table} \subsection{Dynamic Analysis} Fig. 4 shows the bandwidth blocking probability (BBP) advantages of our proposed scheme over conventional scheme (threshold-based grooming \cite{wan2012}, no degradation). Fig. 4(a) shows the overall performance of all requests, and we can find there is a crossing point between optical degradation and both-layer degradation. In low-load area (26-34 $Erlang$), both-layer degradation (OE-MinPDR, OE-MinRH) performs the best, up to two orders of magnitude, while in high-load area (36-44 $Erlang$), optical-layer degradation (O-MinPDR, O-MinRH) performs the best. The reason is that, in high-load conditions, electric degradation (E-MinPDR, E-MinRH) achieves worse BBP than no degradation, which affects the blocking reduction by optical degradation in both-layer degradation. Figs. 4(b) and 4(c) show the BBP performance of requests in the highest and lowest priority. And we can conclude that all degradation policies can achieve significant blocking reduction for highest priority, while, for lowest priority, the blocking performance acts similar as requests with all priorities do. We also observe some common patterns in these three graphs. First, optical degradation performs almost the same regardless of priorities, because optical degradation does not involve service priorities as electric degradation does. Second, MinPDR performs better in optical-related degradations (both-layer degradation and optical degradation), while MinRH performs better only in electric degradation. This is because the route MinPDR returns tends to have a smaller number of existing requests, which increases the elements in ASSI or SBTL, thus increasing possibility of successful optical degradation. Also, the route that MinRH returns tends to have more existing requests, which increases the possibility of successful electric degradation. \emph{Actually, different mechanisms of optical degradation and electric degradation determine that MinPDR performs better for optical degradation, while MinRH suits electric degradation better}. The result that both-layer degradation and optical degradation performs similarly reveals that optical degradation has stronger influence on blocking reduction because it can enlarge the network capacity by high-order modulation, while electric degradation just deals with the bandwidth-time exchange to trade time for bandwidth. \vspace {-0.5em} \subsection{Transient Analysis} We conduct transient analysis on instantaneous network throughput and BBP. From Figs. 5(a) and 5(b), we obtain similar conclusions as the dynamic evaluations, that optical-related degradation achieves better compliance with the offered load in MinPDR, while electric degradation accomplishes better improvements in MinRH. Fig. 5(c) shows the instantaneous BBP variance over time, and we observe that different levels of blocking reduction can be achieved by different degradation policies. Both-layer degradation policies have the largest blocking reduction, and OE-MinPDR performs even better (almost zero blocking). \thispagestyle{fancy} \chead{\small Accepted, IEEE Globecom 2016, Optical Networks and Systems (ONS) Symposium, for ArXiv only.} \vspace {-0.2em} \section{Conclusion} In this work, we investigated dynamic QoS-assured degraded provisioning in service-differentiated multi-layer networks with optical elasticity. We proposed and leveraged the enhanced multi-layer architecture to design effective algorithms for network performance improvements. Numerical evaluations showed that we can achieve significant blocking reduction, up to two orders of magnitude. We also conclude that optical-related degradation achieves better with MinPDR, while electric degradation has lower blocking with MinRH due to different mechanisms of multi-layer degradations. \IEEEtriggeratref{20} \bibliographystyle{IEEEtran} \vspace {-0.3em}
{'timestamp': '2017-01-05T02:05:47', 'yymm': '1607', 'arxiv_id': '1607.04695', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04695'}
arxiv
\section{Introduction \label{sec:intro}} \IEEEPARstart{A}{utomatic} speech recognition, music classification, audio indexing, and to a less visible extent biometric voice authentication, have now achieved some degree of commercial success in mass markets. A vast proportion of these applications are supported by PC platforms, cloud computing and powerful smartphones. Nevertheless, a new market is quickly emerging in the domain of the {\em Internet of Things} (IoT) \cite{gubbi2013internet}. In this market, Automatic Environmental Sound Recognition (AESR) \cite{chachada2014environmental} has a significant potential to create value, e.g., for security or home safety applications \cite{istrate2006information,vacher2010challenges,sitte2007non}. However, in this context, industrial reality imposes hard constraints on the available computing power. Indeed, IoT devices can be broadly divided into two classes: (a) devices which are perceived as ``doing only one thing'', thus requiring the use of low cost processors to hit a price point that users are willing to pay for what the device does; (b) embedded devices where sound recognition comes as a bolt-on to add value to an existing product, for example adding audio analytic capabilities to a consumer grade camera or to a set-top box, thus requiring the algorithm to fit into the device's existing design and price points. These two cases rule out the use of higher end processors. Generally speaking, the following features jointly define the financial cost of a processor and the level of constraint imposed on embedded computing: a) the {\em clock speed} is related to energy consumption; b) the {\em instruction set} is related to chip size and manufacturing costs, but in some cases includes special instruction sets to parallelise more operations into a single clock cycle; c) the {\em architecture} defines, e.g., the number of registers, number of cores, presence/absence of a Floating Point Unit (FPU), a Graphical Processing Unit (GPU) and/or a Digital Signal Processing (DSP) unit. These features affect applications in the obvious way of defining an upper limit on the number and the type of operations which can be executed in a given amount of time, thus ruling the possibility to achieve real time audio processing at the proportion of processor load allocated to the AESR application. Finally, {\em onboard memory size} is an important factor related to processor cost, as it affects both the computational performance, where repetitive operations can be cached to trade speed against memory, and the scalability of an algorithm, by imposing upper limits on the number of model parameters that can be stored and manipulated. If trying to work within these limitations, and given that most IoT embedded devices allow Internet connectivity, it could be argued that cloud computing can solve the computational power constraints by abstracting the computing platform and making it virtually as powerful as needed. However, a number of additional design considerations may rule out the use of cloud computing for AESR applications: the {\em latency} introduced by cloud communications can be a problem for, e.g., time critical security applications \cite{bonomi2014fog}; regarding {\em Quality of Service (QoS)}, network interruptions introduce an extra point of failure into the system; regarding {\em privacy} and {\em bandwidth consumption}, respectively, sending alerts rather than streaming audio or acoustic features out of the sound recognition device both rules out any possibility of eavesdropping~\cite{medaglia2010overview} and requires less bandwidth. Thus, the reality of embedded industrial applications is that at the price points acceptable in the marketplace, IoT devices will most likely be devoid of an FPU, will operate in the hundreds of Megahertz clock speed range, won't offer onboard DSP or specialised instruction sets, and may prefer to run AESR on board rather than in the cloud. At the same time, most AESR performance evaluations are still produced with limited interest for the computational cost involved: many experimental results are obtained with floating point arithmetics on powerful computing platforms, and under the assumption that sufficient computing power will sooner or later become available for the algorithm to be practicable in the context of commercial applications. This article aims at crossing this divide, by comparing the performance of three AESR algorithms as a function of their computational cost. In other terms, it seeks which AESR algorithm is able to make the most of a limited amount of computational power. The rest of the paper is organised as follows: Section~\ref{sub:prior} reviews prior art in AESR. Section~\ref{sec:cost} defines the measure of computational cost used in this study, and applies it to a range of popular machine learning algorithms. Section~\ref{sec:perf} defines the other axis of this evaluation, which is the metric used to measure classification performance. The data sets and methodology are detailed in Section~\ref{sec:methodology}, while results are discussed in Section~\ref{sec:results}. \section{Background \label{sub:prior}} Audio or sound recognition research has primarily been focused on speech and music signals. However in the past decade, the problem of classifying and identifying environmental sounds has received more attention \cite{chachada2014environmental}. AESR has applications in content-based search \cite{virtanen2007probabilistic}, robotics \cite{yamakawa2011environmental}, security \cite{istrate2006information} and a host of other tasks. Recognition of environmental sounds is a part of the much broader field of computational auditory scene analysis (CASA) \cite{wang2006computational}. We are interested in the problem of identifying the presence of non-speech, non-music sounds or \emph{environmental sounds} in a given audio recording. Environmental sound recognition involves the study of two closely related problems. Acoustic Scene Classification (ASC) involves selecting an appropriate set of labels that encompasses all the sound events which occur in a recording \cite{stowell2015detection}, e.g., ``crowded train station''. With regards to machine learning, ASC can be seen as a sequence classification task where a set of labels is assigned to a variable length input sequence. A related problem is the problem of Acoustic Event Detection (AED). In addition to identifying the correct label, AED aims to segment the audio recording into regions where the label occurs \cite{stowell2015detection}, e.g., ``stationmaster blowing whistle'' or ``doors closing''. Again with regards to machine learning, AED involves identifying the correct labels and the correct \emph{alignment} of labels with the recording. In this study, we compare Gaussian mixture models (GMMs), support vector machines (SVMs) and deep neural networks (DNNs) in terms of their performance on an AED task as a function of their computational cost. GMMs are generative probabilistic models and have been extensively applied to many problems in speech recognition~\cite{rabiner1993fundamentals}. In a number of cases, GMMs have therefore been considered a sensible starting point for research on the classification of environmental sounds. For example, they have been used to detect gunshot sounds~\cite{clavel2005events} and to discriminate between gunshots and screams~\cite{valenzise2007scream}. Port\^{e}lo et al.~\cite{portelo2009non} have used Gaussian Mixtures as part of a hidden Markov model (HMM) approach to detecting sirens in audio. Elsewhere, Radhakrishnan et al.~\cite{radhakrishnan2005audio} have used GMMs when attempting to develop a model for recognising new `outlier' sounds against a GMM trained to model background sounds. Principi et al.~\cite{Principi2015} proposed another novelty detection system, with an embedded implementation on a Beagle Board~\cite{Bonfigli2014}. Atrey et al.~\cite{atrey2006audio} have used GMMs to classify audio frames into foreground or background sounds, then into vocal or nonvocal sounds and finally into `excited' events (e.g. shouting, running) or `normal' events (e.g. talking, walking). SVMs are non-parametric classifiers that can generalise well given a limited training set and have well defined generalisation bounds~\cite{burges1998tutorial}. Port\^{e}lo et al. \cite{portelo2009non} have experimented with an SVM when attempting to detect events in film audio. They found it to perform well on some sounds (aeroplanes, helicopters) but poorly on others (sirens, cats). By adding new features and applying PCA they found better performance on siren sounds. Moncrieff et al. \cite{moncrieff2001detecting} have also experimented with SVMs when attempting to classify sound events in film audio. Chen et al. \cite{chen2006mixed} have used SVMs to classify audio data into music, speech, environmental sounds, speech mixed with music and environmental sounds mixed with music. Rouas et al. \cite{rouas2006audio} have presented a comparison of SVMs and GMMs when attempting to detect shouting in public transport vehicles. Testing on audio recorded by actors on a train, they find that the SVM achieves a lower false alarm rate whilst the GMM seems better at making positive identifications. More recently, Deep Learning, i.e., artificial neural networks with more than one intermediate hidden layer, have gained much popularity and have achieved impressive results on several machine learning tasks~\cite{lecun2015deep}. However, they do not seem to have been extensively applied to AESR so far. Toyoda et al.~\cite{toyoda2004environmental} have used a neural network to classify up to 45~different environmental sounds. They achieved high recognition accuracies, though it should be mentioned that both the training and test data sets used in their study may appear quite small in comparison to the data sets used nowadays as benchmarks for speech recognition and computer vision research. Baritelli et al.~\cite{beritelli2008pattern} used a DNN to classify 10~different environmental sounds. The authors found that the proposed system, which classified MFCCs directly, performed similarly to other AESR systems which were requiring more complex feature extraction. In~\cite{vidalsound}, the authors used neural networks to estimate the presence or absence of people in a given recording, as well as the number of people and their proximity to the recording device. Gencoglu et al. \cite{gencoglu2014recognition} applied a deep neural network to an acoustic event detection task for classifying $61$ different classes of sounds. Their results showed this classifier to outperform a conventional GMM+HMM classification system. Recently, the problem of AESR has been receiving more attention. Challenges like CLEAR \cite{temko2006clear} and DCASE \cite{stowell2015detection} have been proposed in order to benchmark the performance of different approaches and to stimulate research. But, if drawing a parallel between the evolution of AESR and the evolution of speech recognition, the CLEAR and DCASE data sets could be thought of as being at the stage of the TIMIT era \cite{zue1990speech}: although the TIMIT data set was widely used for many years, it was limited in size to about 5.4 hours of speech data. The subsequent growth in the volume of available speech evaluation data sets has significantly contributed to bringing speech recognition to the levels of performance known today, where modern speech recognition systems are being trained over 1700~hours of data \cite{senior2015context}. AED research is following a similar trend where the domain is now facing a need to collect larger data sets \cite{foster2015chime,Salamon:UrbanSound:ACMMM:14} in order to make larger scale evaluations possible and to foster further technical progress. Many studies explore feature learning to derive useful acoustic features that can be used to classify acoustic events \cite{salamon2015feature,salamon2015unsupervised}. A limited number of publications apply k-Nearest Neighbours (k-NNs) \cite{sawhney1997situational,lukowicz2003soundbutton} or Random Forests \cite{stowell2014automatic} to AESR. However, these models have not been included in our comparative study, which is restricted to GMM, SVM and DNN models: these three types of models can be considered mainstream in terms of having been applied more extensively to a larger range of audio classification tasks which include speech, speaker and music classification and audio event detection. In preliminary experiments, we observed that k-NN classifiers were clearly outperformed by the classifiers included in this study. \section{Computational cost \label{sec:cost}} \subsection{Measure of computational cost used in this article} The fundamental question studied in this paper is that of comparing various machine learning algorithms {\em as a function of their computational cost}. A corollary to this question is to compare the rate of performance degradation that occurs when down-scaling various AESR algorithms by a comparable amount of computing operations: a given class of algorithms might be more resilient to down-scaling than another. While computational cost is related to computational complexity, both notions are distinct: computational cost simply counts the number of operations at a given model dimension, whereas computational complexity expresses the mathematical law according to which the computational cost scales up with the dimension of the input feature space. Computational cost is studied here at the sound recognition stage, known as acoustic decoding. Unless specifically required by the application, it is indeed fairly rare to see the training stage of machine learning being realised directly on-board an embedded device. In most cases, it is possible to design the training as an offline process realised on powerful scientific computing platforms equipped with FPUs and GPUs. Offline training delivers a floating point model which is then quantised according to the needs of fixed point decoding in the embedded system \cite{smith1997scientist}. It is generally accepted that the quantisation error introduced by this operation is unlikely to affect the acoustic modelling performance \cite{gupta2015deep}. The computational cost estimate used in this study simply counts four~types of basic operations: addition, comparison, multiplication, and lookup table retrieval (LUT). {\em Multiply-add} operations are commonly found in dot products, matrix multiplications and FFTs. Correlation operations, linear filtering or the Mahalanobis distance, at the heart of many recognition algorithms, rely solely on multiply-adds. Fixed point precision is fairly straightforward to manage over this type of operation. {\em Divisions}, on the other hand, and in particular matrix inversions, might be more difficult to manage. Regarding matrix inversion, it can happen that quantisation errors add up and make the matrix inversion algorithm unstable \cite{parhami2009computer}. In many cases, it is possible to pre-compute the inversion of key parameters (e.g., variances), possibly offline and in floating point before applying fixed-point quantisation. {\em Non-linear operations} such as logarithms, exponentials, cosines, $N^{th}$~roots etc. are required by some algorithms. Two approaches can commonly be taken to transform non-linear functions into a series of multiply-adds: either Taylor series expansion, or look-up tables (LUTs). LUTs are more memory consuming than Taylor series expansions, but may require a lower number of instructions to achieve the desired precision. Generally speaking, it is important to be aware of the presence of a non-linearity in a particular algorithm, before assessing its cost: algorithms which rely on a majority of multiply-adds are more desirable than algorithms relying more heavily on non-linearities. For all the estimates presented below, it is assumed that these four~types of operations have an equal cost. While this assumption would be true for a majority of processors on the market, it may underestimate the cost of non-linear functions if interpolated LUTs or Taylor series are used instead of simpler direct LUT lookups. In addition to the 4 operations considered here, there are additional costs incurred with other operations (like data handling) in the processor. However, we use the simplifying assumption that the considered operations are running on the same core, thus minimizing data handling overhead. As a case study, let us assume an attempt at running the K-nearest neighbours algorithm on a Cortex-M4 processor running at a clock speed of 80MHz and with 256kB of onboard memory. This is a very common hardware configuration for consumer electronic devices such as video cameras. Assuming that 20\% of the processor activity is needed for general system tasks means that a maximum of 64 million of multiply or adds per second can be used for sound recognition ($80\mbox{MHz} \times 80\% = 64\mbox{MHz}$). Assuming sound sampled at 16kHz and audio feature extracted at, e.g., a window shift of 256 samples, equivalent to 62.5 frames per second, means that the AESR algorithm should use no more than 1,024,000 multiply or adds per analysis frame (64MHz / 62.5Hz = 1\,024K instructions). From there, assuming a K-Nearest neighbour algorithm with a 40 dimensional observation vector $x$, mean vector $\mu$ and a Mahalanobis distance $( x - \mu ) \sigma^{-1} (x - \mu)$ with a diagonal covariance matrix $\sigma$, there would be one~subtraction and two~multiplications per dimension for the Mahalanobis distance calculation, plus one~operation for the accumulation across each dimension: four~operations in total, thus entailing a maximum of 1,024,000 instructions / 4~operations / 40~dimensions = 6\,400 nearest neighbours on this platform to achieve real-time recognition. However, assuming that each nearest neighbour is a 40-dimensional vector of 32\,bits/2\,Bytes values, the memory requirement to store the model would be 512kB, which is double the 256kB available on the considered platform. Again assuming that the code size occupies 20\% of the memory, leaving 80\% of the memory for model storage, a maximum of $256\mbox{kB} \times 80\% \,/\, 40\,\mbox{features} \,/\, 2\mbox{Bytes} = 2\,560$ nearest neighbours only which could be used as the acoustic model. Depending on the choice of algorithm, memory is not always the limiting factor. In the case of highly non-linear algorithms, the computational cost of achieving real-time audio recognition might outweigh the model storage requirements. While only the final integration can tell if the desired computational load and precision are met, estimates can be obtained as illustrated in this case study in order to forecast if an algorithm will fit on a particular platform. \begin{table*}[t!] \newcommand\T{\rule{0pt}{2.6ex}} \newcommand\B{\rule[-1.2ex]{0pt}{0pt}} \renewcommand{\arraystretch}{1.3} \begin{center} \footnotesize \begin{tabular}{| l | c | c | c | c |} \hline \textbf{Feature} & \textbf{Addition} & \textbf{Multiplication} & \textbf{ nonlinearity LUT lookup} \\ \hline \hline GMM & $2(M \cdot (D+1) + M)$ & $2M \cdot 2D$ & $M$ \\ SVM - Linear & $\lambda D + \lambda + 1$ & $\lambda \cdot D$ & 0 \\ SVM - Polynomial & $\lambda D +\lambda + 1$ & $\lambda(D+d)$ & 0 \\ SVM - Radial Basis Function & $2\lambda D + \lambda + 1$ & $\lambda(D+2)$ & $\lambda$ \\ SVM - Sigmoid & $\lambda D + \lambda +1$ & $\lambda(D+1)$ & $\lambda$ \\ DNN - Sigmoid & $H \cdot (1+D+L+(L-1)H)+1$ & $H \cdot (1+D+(L-1)H)$ & $L \cdot H + 1$\\ DNN - ReLU & $H \cdot (1+D+L+(L-1)H)+1$ & $H \cdot (1+D+(L-1)H)$ & $L \cdot H + 1$\\ RNN - Tanh & $H \cdot (2+D+H+2(L-1)(H+1))+1$ & $H \cdot (1+D+H+2(L-1)H)$ & $L \cdot H + 1$\\ \hline \end{tabular} \small \caption{Computational cost per frame of each compared AESR algorithm. $D$ is the dimensionality of the feature vector, $M$ is the number of Gaussian mixtures for a GMM. $\lambda$ is the number of support vectors for a SVM, $d$ is the degree of a polynomial kernel. For the neural networks: $H$ is the number of hidden units in each layer and $L$ is the number of layers. \label{num_ops} } \end{center} \end{table*} \subsection{Computational cost estimates for the compared algorithms} \label{sub:cost} Most AED systems use a common 3-step pipeline \cite{stowell2015detection}. The audio recording is first converted into a time-frequency representation, usually by applying the short-time Fourier transform (STFT) to overlapping windows. This is followed by feature extraction from the time-frequency representation. Typically, Mel Frequency Cepstral Coefficients (MFCCs) have been used as standard acoustic features since the seventies, due to favourable properties when it comes to computing distances between sounds \cite{mermelstein1976}. Then the acoustic features are input into an acoustic model to obtain a classification score, which in some cases is analogous to a posterior probability. The classification score is then thresholded in order to obtain a classification decision. Below, we provide an estimate of the computational cost for each of these operations. \textbf{Feature extraction -} Engineering the right feature space for AESR is essential, since the definition of the feature space affects the separability of the classes of acoustic data. Feature extraction from sound recordings thus forms an additional step in the classification pipeline, which contributes to the overall computational cost. In this study, the GMMs, SVMs and DNNs are trained on a set of input features that are typically used for audio and speech processing (Section \ref{sub:feature_extraction}). Although recent studies demonstrate that neural networks can be trained to jointly learn the features and the classifier \cite{lecun2015deep}, we have found that this method is impractical for most AESR problems where the amount of labelled data for training and testing is limited. Additionally, by training the different algorithms on the same set of features, we study the performance of the various classifiers as a function of computation cost, without having to account for the cost of extracting each type of feature from the raw audio waveform\footnote{For example in preliminary experiments, we observed that DNNs were able to achieve the same performance with log-spectrogram inputs as speech features (Section \ref{sub:feature_extraction}). However, in this case the GMMs and SVMs performed badly making it difficult to clearly compare performance.}. It also allows a fair comparison of the discriminative properties of different classification algorithms on the same input feature space. Therefore, we factor out the computational cost of feature extraction. \textbf{Gaussian Mixture Models -} Given a $D$ dimensional feature vector $x$, a GMM~\cite{reynolds2009gaussian} is a weighted sum of Gaussian component densities which provides an estimate of the likelihood of $x$ being generated by the probability distribution defined by a set of parameters $\theta$: \begin{equation} p(x|\theta) = \sum\limits_{i=0}^{M-1} w_{i} \cdot g(x | \mu_{i}, \Sigma_{i} ) \label{eq:gauss1} \end{equation} where: \begin{equation} g(x | \mu_{i}, \Sigma_{i} ) = \frac{1}{(2\pi)^{\frac{D}{2}} |\Sigma_{i}|^{\frac{1}{2}}} \cdot e^{ -\frac{1}{2} (x - \mu_i)' \Sigma_{i}^{-1} (x - \mu_i)} \label{eq:gauss2} \end{equation} where $\theta = (\mu_{i}, \Sigma_{i}, w_{i})_{0 \leq i < M}$ is the parameter set, $M$ is the number of Gaussian components, $\mu_{i}$ are the means, $\Sigma_{i}$ the covariance matrices and $w_{i}$ the weights of each Gaussian component. In practice, computing the likelihood in the log domain avoids numerical underflow. Furthermore, the covariance matrices are constrained to be diagonal, thus transforming equations~(\ref{eq:gauss1}) and~(\ref{eq:gauss2}) into: \begin{equation} \begin{array}{l} \log p(x|\theta) = \\ \;\; \textrm{logsum}_{i=0}^{M-1} \left\{ \sum_{d=0}^{D-1} \left( x_d - \mu_{i,d} \right)^2 \cdot \sigma_{i,d}^{-1} + w_{i} \right\} + K \end{array} \label{eq:gauss3} \end{equation} where $d$ is the dimension index, constant $K$ can be neglected for classification purposes, and $\textrm{logsum}$ symbolises a recursive version of function $\log(a+b) = \log a + \log(1 + e^{\left( \log b - \log a\right)})$ \cite{logsumexp}, which can be computed using a LUT on non-linearity $\log(1 + e^x)$. Calculating the log likelihood of a $D$-dimensional vector given a GMM with $M$~components therefore requires the following operations: \begin{itemize} \item $D$ subtractions (i.e., additions of negated means) and $2D$ multiplications per Gaussian to calculate the argument of the exponent. \item $1$ extra addition per Gaussian to apply the weight in the log domain. \item $M$ LUT lookups and $M$ additions for the non-linear $\textrm{logsum}$ cumulation across the Gaussian components. \end{itemize} This leads to the computational cost per audio frame expressed in the first row of table~\ref{num_ops}. \textbf{Support Vector Machines -} \label{SVMs} Support Vector Machines (SVMs) \cite{burges1998tutorial} are discriminative classifiers. Given a set of data points belonging to two different classes, the SVM determines the optimal separating hyperplane between the two classes of data. In the linearly separable case, this is achieved by maximising the margin between two hyperplanes that pass through a number of \emph{support vectors}. The optimal separating hyperplane is defined by all points $\textrm{x}$ that satisfy: \begin{equation} \textrm{x} \cdot \textrm{w} + b = 0 \end{equation} where $\textrm{w}$ is a normal vector to the hyperplane and $\frac{|b|}{\|w\|}$ is the perpendicular distance from the hyperplane to the origin. Given that all data points $\textrm{x}_{i}$ satisfy: \begin{equation} \left\{ \begin{array}{ll} \textrm{x}_{i} \cdot \textrm{w} + b \geq 1 & \mbox{for labels $y_{i} = +1$} \\ \textrm{x}_{i} \cdot \textrm{w} + b \leq -1 & \mbox{for labels $y_{i} = -1$} \end{array} \right. \end{equation} It can be shown that the maximum margin is defined by minimising $\frac{\|\textrm{w}\|^2}{2}$. This can be solved using a Lagrangian formulation of the problem, thus producing the multipliers $\alpha_{i}$ and the decision function: \begin{equation} f(\textrm{x}) = \textrm{sgn} \Big( \sum\limits_{i=0}^{N-1} y_{i} \alpha_{i} \textrm{x} \cdot \textrm{x}_i + b \Big) \end{equation} where $N$ is the number of training examples and $\textrm{x}$ is a feature vector we wish to classify. In practice, most of the $\alpha_{i}$ will be zero, and the $\textrm{x}_i$ for non-zero $\alpha_{i}$ are called the \emph{support vectors} of the algorithm. In the case where the data is not linearly separable, a non-linear kernel function $K(\textrm{x}_{i},\textrm{x}_{j})$ can be used to replace the dot products $\textrm{x} \cdot \textrm{x}_i$, with the effect of projecting the data into a higher dimensional space where it could potentially become linearly separable. The decision function then becomes: \begin{equation} \label{SVM_classification} f(\textrm{x}) = \textrm{sgn} \Big( \sum\limits_{i=0}^{N-1} y_{i} \alpha_{i} K(\textrm{x},\textrm{x}_{i}) + b \Big) \end{equation} Commonly used kernel functions include: \medskip \noindent \begin{tabular}{ll} \hspace{-1.5ex} {$\vcenter{\hbox{\tiny$\bullet$}}$} Linear: & \hspace{-2ex} $K(\textrm{x},\textrm{x}_{i}) = \textrm{x} \cdot \textrm{x}_{i}$ \\ \hspace{-1.5ex} {$\vcenter{\hbox{\tiny$\bullet$}}$} Polynomial: & \hspace{-2ex} $K(\textrm{x},\textrm{x}_{i}) = (\textrm{x} \cdot \textrm{x}_{i})^d$ \\ \hspace{-1.5ex} {$\vcenter{\hbox{\tiny$\bullet$}}$} Radial basis function (RBF): & \hspace{-2ex} $K(\textrm{x},\textrm{x}_{i}) = \exp(-\gamma | \textrm{x}-\textrm{x}_{i}|^2)$ \\ \hspace{-1.5ex} {$\vcenter{\hbox{\tiny$\bullet$}}$} Sigmoid: & \hspace{-2ex} $K(\textrm{x},\textrm{x}_{i}) = \tanh(\textrm{x} \cdot \textrm{x}_{i})$ \end{tabular} \medskip \noindent A further refinement to the SVM algorithm makes use of a \emph{soft margin} whereby a hyperplane can still be found even if the data is non-separable (perhaps due to mislabeled examples) \cite{burges1998tutorial}. The modified objective function is defined as follows: \begin{equation} \label{soft_margin} \arg\min_{\textrm{w},\mathbf{\xi}, b } \left\{\frac{1}{2} \|\textrm{w}\|^2 + C \sum_{i=1}^n \xi_i \right\} \end{equation} \vspace{-0.25em} \hspace{1cm} subject to: $ y_i(\mathbf{w}\cdot\mathbf{x_i} - b) \ge 1 - \xi_i, \;\;\xi_i \ge 0$ \vspace{0.5em} \noindent $\xi_i$ are non-negative \emph{slack variables}. The modified algorithm finds the best hyperplane that fits the data while minimising the error of misclassified data points. The importance of these error terms is determined by parameter~$C$, which can control the tendency of the algorithm to over fit or under fit the data. Given a support vector machine with $\lambda$ support vectors, a new $D$-dimensional example can be classified using $\lambda$ additions to sum the dot product results for each support vector, plus a further addition for the bias term. For each dot product, a support vector requires the computation of the kernel function, then $\lambda$ multiplications to apply the $\alpha_i$ multipliers. Some kernels require a number of elementary operations, whereas others require a LUT lookup. Thus, depending on the kernel, the final costs are: \begin{itemize} \item SVM Linear -- $(\lambda \cdot D) + \lambda + 1$ additions and $(\lambda \cdot D) + \lambda$ multiplications. \item Polynomial -- $\lambda(D + d + 2) + 1$ additions and $\lambda(D+2)$ multiplications, where $d$ is the degree of the polynomial. \item Radial Basis Function -- $2\lambda D + \lambda + 1$ additions, $\lambda(D+2)$ multiplications and $\lambda$ exponential functions. \item Sigmoid -- $\lambda(D+2) + 1$ additions and $\lambda(D+2)$ multiplications and $\lambda$ hyperbolic tangent functions. \end{itemize} The computational cost of SVMs per audio frame for these kernels is summarized in Table~\ref{num_ops}. \textbf{Deep Neural Networks -} Two types of neural network architectures are compared in this study: Feed-Forward Deep Neural Networks (DNNs) and Recurrent Neural Networks (RNNs). A {\em Feed-Forward Deep Neural Network} processes the input by a series of non-linear transformations given by: \begin{equation} \label{ffNN} {h}^i = f \left( {W}^i {h}^{i-1}+{b}^i \right) \; \mbox{for} \; 0 \leq i \leq L \end{equation} where ${h}^0$ corresponds to the input $x$, ${W}^i,{b}^i$ are the weight matrix and bias vector for the $i^{th}$ layer, and the output of the final layer ${h}^L$ is the desired output. The non-linearity $f$ in Equation~\ref{ffNN} is usually a sigmoid $f(x) = 1/\left( 1 + e^{-x} \right)$ or a hyperbolic tangent function $\tanh(x)$. However recent research in various domains has showed that the Rectified Linear Unit (ReLU)~\cite{glorot2011deep} non-linearity can lead to faster convergence of models during training. The ReLU function is defined as $f(x) = max(0,x)$, which is simpler than the sigmoid or $\tanh$ activation because it only requires a piecewise linear operator instead of a fixed point sigmoid or $\tanh$ LUT. While feed forward networks are designed for stationary data, {\em Recurrent Neural Networks} (RNNs) are a class of neural networks designed for modelling temporal data. RNNs predict the output $y_t$ given an input $x_t$, at some time $t$ in the following way: \begin{equation} \label{RNN} {h}^i_t = f \left( {W}^i_f {h}^{i-1}_t+{W}^i_r {h}^{i}_{t-1}+{b}^i \right) \; \mbox{for} \; 0 \leq i \leq L \end{equation} where ${W}^i_f,{W}^i_r$ are the forward and recurrent weight matrices for the $i^{th}$ recurrent layer, $b_i$ is bias for layer $i$, and $\theta = \left\{{W}^i_f,{W}^i_r,{b}^i \right\}_0^L$ are the model parameters. The input layer $h^{0}_{t}$ corresponds to the input $x_t$ and the output layer, $h^{L}_{t}$ corresponds to the output $y_t$. In Equation \ref{RNN}, $f$ is the hyperbolic tangent function. The choice of $f$ for the output layer depends on the particular modelling problem. RNNs are characterised by the recurrent connections ${W}^i_r$ between the hidden units. Similar to feed forward neural networks, RNNs can have several recurrent layers stacked on top of each other to learn more complex functions~\cite{graves2013speech}. Due to the recursive structure of the hidden layer, at any time $t$, the RNN makes a prediction conditioned on the entire sequence seen until time $t$: $y_t = f(x_0^t)$. For simplicity, every neural network in this study was constrained to have the same number $H$ of hidden units in each of its $L$ layers. The input dimensionality is denoted by $D$. The forward pass through a feed-forward neural network therefore involves the following computations: \begin{itemize} \item Multiplying a column vector of size $n$ with a matrix of size $n \times k$ involves $n \cdot k$ additions and an equal number of multiplication operations. \item Therefore the first layer involves $\left( D \cdot H \right)$ multiplication operations and $H \cdot \left( D +1 \right)$ additions, where the additional $H$ additions are due to the bias term. \item The remaining $L-1$ layers involve the following computations: $\left( L-1 \right) \cdot \left( H \cdot H\right)$ multiplications and $\left( L-1 \right) \cdot \left( H \cdot (H+1) \right)$ additions. \item The output layer involves $H$ multiplications and $H+1$ additions. \item A non-linearity is applied to the outputs of each layer, leading to a total of $L \cdot H+1$ non-linearities. \item The RNN forward pass includes an additional matrix multiplication due to the recurrent connections. This involves $H \cdot H$ multiplications and an equal number of addition operations. \end{itemize} The computational cost estimates for DNNs and RNNs are summarised in Table~\ref{num_ops}. \section{Performance metrics for sound recognition \label{sec:perf}} Classification systems produce two types of errors: False Negatives (FN), a.k.a. Missed Detections (MD), i.e., target sounds which have not been detected, and False Positives (FP), a.k.a. False Alarms (FA), i.e., non-target sounds which have been mistakenly classified as the target sound~\cite{murphy2012machine}. Their correlates are the True Positives (TP), or correctly detected target sounds, and True Negatives (TN), or correctly rejected non-target sounds. In our experiments, ``sounds'' refer to feature frames associated with a particular sound class label. The above metrics are usually expressed as percentages of the available testing samples. They can be computed \emph{after an operating point or threshold} has been selected \cite{japkowicz2011evaluating} for a given classifier. Indeed, most classifiers output a real valued \emph{score}, which can be, e.g., a log-likelihood ratio, a posterior probability or a distance. The binary target/non-target classification is then made by comparing the score to a threshold. Thus, a system can be made either more permissive, by choosing a threshold which lets through more True Positives at the expense of generating more False Positives, or the system can be made more conservative, if the threshold is set to filter out more False Positives at the expense of rejecting more sounds in general and thus generating more Missed Detections. For example, the operation point of a GMM classifier is defined by choosing a log-likelihood threshold. Ideally, AESR systems should be compared independently of the choice of threshold. This can be achieved through the use of Detection Error Tradeoff (DET) curves~\cite{martin1997det}, which depict the FA/MD compromises achieved across a sweep of operation points. DET curves are essentially equivalent to Receiver Operating Curves (ROC)~\cite{martin1997det}, but plotted into normal deviate scale to linearise the curve, under the assumption that FA and MD scores are normally distributed. Given that the goal is to minimise the FA/MD compromises globally across all possible operation points, a DET curve closer to the origin means a better classifier. DET curve performance can thus be summarised for convenience into a single figure called the Equal Error Rate (EER), which is the point where the DET curve crosses the \%FA = \%MD diagonal line. In other terms, the EER represents the operation point where the system generates an equal rate of FA and MD errors. For GMM based classification systems, the output score is the ratio between the likelihood of the target GMM and the likelihood of the universal background model (UBM): $P(x|\theta_{\mbox{\tiny target sound}})/P(x|\theta_{\mbox{\tiny UBM}})$ \cite{reynolds2009gaussian}. For neural networks, the output layer consists in a single unit followed by a sigmoid function, thus yielding a real-valued class membership probability $P(C=1|x)$ taken as the score value. For SVMs, the score can be defined as the argument of the $\textrm{sgn}()$ function in Equation~\ref{SVM_classification}: whereas the $\textrm{sgn}()$ function always amounts to classifying against a threshold fixed to zero, using its argument as a score suggests a more gradual notion of deviation from the margin defined by the support vectors, or in other terms it suggests a more gradual measure of belonging to one side or the other of the margin. \section{Data sets and methodology \label{sec:methodology}} \subsection{Data sets} For the problem of AED, the training data set consists of audio recordings along with corresponding annotations or ground truth labels. The ground truth labels are usually provided in the form of alignments, i.e. onset times, offset times and the audio event labels. This is in contrast to ASC problems where the ground truth does not include alignments. ASC is similar to the problem of speech recognition where each recording has an associated word-level transcription. The alignments are then obtained as a by-product of the speech recognition model. For the problem of AED, annotating large quantities of data with onset and offset times requires significant effort from human annotators. Historically, relatively small data sets of labelled audio have been used for evaluating AED systems. As a matter of fact, the two most popular benchmarks for AED algorithms known to date are the DCASE challenge \cite{stowell2015detection} and the CLEAR challenge \cite{temko2006clear}. The DCASE challenge data provides 20 examples for each of the 16 event classes. While the data set for the CLEAR challenge contains approximately 60 training instances for each of the 13 classes. The typical approach to AED so far has been to extract features from the audio and then use a classifier or an \emph{acoustic model} to classify the frames into event labels. Additionally, the temporal relationship between acoustic frames and outputs is modelled using HMMs \cite{stowell2015detection}. In this study, we investigate whether a data-driven approach to AED can yield improved performance. Inspired by the recent success of Deep Learning \cite{lecun2015deep}, we investigate whether neural network acoustic models can outperform existing models when trained on sufficiently large data sets. Deep Neural Networks (DNNs) have recently contributed to significant progress in the fields of computer vision, speech recognition, natural language processing and other domains of machine learning. The superior performance of neural networks can be largely attributed to more computational power and the availability of large quantities of labelled data. Neural network models with millions of parameters can now be trained on distributed platforms to achieve good generalisation performance \cite{szegedy2015going}. However, despite the strong motivation to use neural networks for various tasks, their application is limited by the availability of labelled data. For example, we trained many DNN architectures on the DCASE data, but were unable to beat the performance of a baseline GMM system. In order to train large neural network models, we perform experiments using three private data sets made available by Audio Analytic Ltd.\footnote{ {\tt \url{http://www.AudioAnalytic.com}} \\ The data can be made available to selected research partners upon setting suitable contractual agreements.} to support this study. These three data sets are subsets of much larger data collection campaigns led by Audio Analytic Ltd. to support the development of smoke alarm and baby cry detection products. Ground truth annotations with onset and offset times obtained from human annotators were also provided. The motivation for using these data sets is twofold. Firstly, to provide a large number of training and test examples for training models that recognize baby cries and smoke alarm sounds. Secondly, a very large \emph{world} data set of ambient sounds is used as a source of impostor data for training and testing, in a way which emulates the quasi infinite prior probability of the system being exposed to non-target sounds instead of target ones. In other words, there are potentially thousands of impostor sounds which the system must reject in addition to identifying the target sounds correctly. While the DCASE challenge evaluates how an AED system performs at detecting one sound in the presence of 15 impostors or non-target sounds, the world data set allows to evaluate the performance of detecting smoke alarms or baby cries against the presence of over 1000 impostor sounds, in order to reflect a more realistic use case. The \emph{Baby Cry} data subset comprises a proportion of baby cries obtained from two different recording conditions: one through camcorder in a hospital environment, one through uncontrolled hand-held recorders in uncontrolled conditions (both indoors and outdoors). Each recording was from a different baby. The train/test split was done evenly, and set to achieve the same balance of both conditions in both the train and test set (about 3/4 hospital condition and 1/4 uncontrolled condition) without any overlap between sources for training and testing. The recordings in this data set sum up to $4\,822$ seconds of training data and $3\,669$ seconds of test data, from which $224\,076$ feature frames in the training set and $90\,958$ feature frames in the test set correspond to target baby cry sounds. The \emph{Smoke Alarm} data subset comprises recordings of 10 smoke alarm models, recorded through 13 different channels across 3 British homes. While it may be thought that smoke alarms are simple sounds, the variability associated with different tones, different audio patterns, different room responses and different channel responses does require some generalisation capability which either may not be available in simpler fingerprinting or template matching methods, or would require a very large database of templates. The training set comprises recordings from two of the homes, while the test set is composed of recordings from the remaining home. Thus, while the same device can appear in both the training and evaluation sets, the recording conditions are always different. So the results presented over the smoke alarm set focus mainly on the generalisation across room responses and recording conditions. The data set provided for this study consists of $15\,271$ seconds of training data and $5\,043$~seconds of testing data, of which $194\,142$ feature frames in the training set and $114\,753$ feature frames in the test set correspond to target smoke alarm sounds. The \emph{World} data set contains about 900 files covering 10 second samples of a wide variety of complex acoustic scenes recorded from numerous indoor and outdoor locations around the UK, across a wide and uncontrolled range of devices, and potentially covering more than a thousand sound classes. For example, a 10 seconds sample of “train station” scene from the world data set covers, e.g., train noise, speech, departure whistle and more, while a 10 second sample of “supermarket” covers babble noise, till beeps and children’s voices. While it does not seem feasible to enumerate all the specific classes from the World set, assuming that there are more than two classes per file across the 410 files reserved for testing leads to an estimate of more than a thousand classes in the test set. The 500 other files of the world set are used to train a non-target model, i.e., a Universal Background Model (UBM)~\cite{reynolds2009gaussian} in the case of GMMs, or a negative input for neural network and SVM training. It was ensured that the audio files in the both the training and testing world sets were coming from completely disjoint recording sessions. The World data set provided for this study consists of $5\,000$~seconds of training data and $4\,089$ seconds of test data, thus amounting to $312\,500$ feature frames for training and $255\,562$ feature frames for testing. Where necessary, the recordings were converted to 16kHz, 16~bits using a high quality resampling algorithm. No other pre-processing was applied to the waveform before feature extraction. \subsection{Feature Extraction \label{sub:feature_extraction}} For this experiment, Mel-frequency cepstral coefficient (MFCC) features were extracted from the audio. MFCC features are extensively used in speech recognition and in environmental sound recognition \cite{clavel2005events,valenzise2007scream, portelo2009non,radhakrishnan2005audio}. In addition to MFCCs, the spectral centroid \cite{clavel2005events}, spectral flatness \cite{portelo2009non}, spectral rolloff \cite{valenzise2007scream}, spectral kurtosis \cite{valenzise2007scream} and zero crossing rate \cite{valenzise2007scream,atrey2006audio} were also computed. With audio sampled at 16kHz, all the features were calculated with a window size of $512$~samples and a hop size of $256$~samples. The first $13$~MFCCs were used for our experiments. Concatenating all the features thus lead to an $18$ dimensional feature vector of real values. Temporal information was included in the input representation by appending the first and second order differences of each feature. This led to an input representation with $18 \times 3 = 54$~dimensions. It should be noted that the temporal difference features were used as inputs to all models except the RNNs, where only the $18$~dimensional features were used as inputs. This is due to the fact that the RNN is designed to make predictions conditioned on the entire sequence history (Equation \ref{RNN}). Therefore, explicitly adding temporal information to the inputs is unnecessary. The reduction in input dimensionality and related reduction in computational cost is offset by the extra weight matrix in the RNN (Table~\ref{num_ops}). For all the experiments, the data was normalised to have zero mean and unit standard deviation, with the mean and standard deviation calculated over the entire training data independently for each feature dimension. \subsection{Training Methodology \label{training}} \textbf{Gaussian Mixture Models -} GMMs were trained using the expectation maximisation algorithm (EM) \cite{bishop2006pattern}. The covariance matrices were constrained to be diagonal\footnote{In preliminary experiments, we observed that a full covariance matrix did not yield any improvement in performance.}. A grid search was performed to find the optimal number of Gaussians in the mixture, on the training set. The best model with number of components $M \in \{ 1,2,4,8,16,32,64,128,256,512,1024 \}$ was used for evaluation. A validation set was created by randomly selecting 20\% of the training data, while the remaining 80\% of the data was used for parameter estimation. The model that performed the best on the validation set was later used for testing. All the Gaussians were initialised using the k-means++ algorithm \cite{arthur2007k}. A single UBM was trained on the World training data set. One GMM per target class was then trained independently of the UBM. We also performed experiments where GMMs for each class were estimated by adapting the UBM by Maximum A Posteriori (MAP) adaptation \cite{reynolds2000speaker}. We observed that this method yielded inferior results. We also observed worse results when no UBM was used and class membership was determined by thresholding the outputs of individual class GMMs. In the following, results are therefore only reported for the best performing method, which is the likelihood ratio between independently trained UBM and target GMMs. \textbf{Support Vector Machines -} The linear, polynomial, radial basis function (RBF) and sigmoid kernels were compared in our experiments. In addition to optimising the kernel parameters ($d,\gamma$), a grid search was performed over the penalty parameter $C$ (Equation \ref{soft_margin}). In practice, real-world data are often non-separable, thus a soft margin has been used as necessary. Model performance was estimated by evaluating performance on a validation set. The validation set was formed by randomly selecting 20\% of the training data, while the remaining data was used for parameter estimation. Again, the best performing model on the validation set was used for evaluation. SVM training is known not to scale well to very large data sets~\cite{burges1998tutorial}: it has a time-complexity of $O(T^3)$, where $T$ is the number of training examples. As a matter of fact, our preliminary attempts at using the full training data sets led to prohibitive training times. Standard practice in that case is to down-sample the training set by randomly drawing $T$ frames from the target set, and the same number $T$ of frames from the world set as negative examples for training. Results presented in section~\ref{sec:results} with $T \in \left\{ 500,2000 \right\}$ show that contrary to the intuitive thought that down-sampling might have disadvantaged the SVMs by reducing the amount of training data compared to the other machines, such data reduction actually improves SVM performance. As such, down-sampling can be thought of as an integral part of the training process, rather than as a reduction of the training data. \textbf{Deep Neural Networks -} All neural network architectures were trained to output a distribution over the presence or absence of a class, using the backpropagation algorithm and stochastic gradient descent (SGD) \cite{lecun2012efficient}. The training data was divided into a $80/20$ training/validation split to find the optimum training hyper-parameters. All the target frames were used for each class, and an equal number of non-target frames was sampled randomly from the World data set, for both training and validation. For the DNNs, a grid search was performed over the following parameters: number of hidden layers $L \in \left\{ 1,2,3,4 \right\}$, number of hidden units per layer $H \in \left\{ 10,25,50,100,150 \right\}$, hidden activations $act \in \left\{ sigmoid, ReLU \right\}$. In order to minimise parameter tuning, we used ADADELTA \cite{zeiler2012adadelta} to adapt the learning rate over iterations. The networks were trained using mini-batches of size $100$ and training was accelerated using an NVIDIA Tesla K40c GPU. A constant dropout rate \cite{srivastava2014dropout} of $0.2$ was used for all layers. The training was stopped if the cost on the validation set did not decrease after $20$ epochs. For the RNNs, a grid search was performed over the following parameters: number of hidden layers $L \in \left\{ 1,2,3 \right\}$ and number of hidden units per layer $H \in \left\{10,25,50,100,150 \right\}$. An initial learning rate of $0.001$ was used and linearly decreased to $0$ over $1000$ iterations. A constant momentum rate of $0.9$ was used for all the updates. The training was stopped if the error on the validation set did not decrease after $20$ epochs. The training data was further divided into sub-sequences of length $100$ and the networks were trained on these sub-sequences without any mini-batching. Gradient clipping \cite{bengio2013advances} was also used to avoid the exploding gradient problem in the early stages of RNN training. Clipping was triggered if the norm of the gradient update exceeded $10$. \section{Experimental results \label{sec:results}} \begin{figure*}[ht] \begin{center} \begin{tabular}{ccc} \subfloat[Baby Cry data set]{\includegraphics[width=0.42\textwidth,height=0.42\textwidth]{figure_1.png}\label{DET_baby_cry}} & \hspace{1cm} & \subfloat[Smoke Alarm data set]{\includegraphics[width=0.42\textwidth,height=0.42\textwidth]{figure_2.png}\label{DET_smoke_alarms}}\\ \end{tabular} \end{center} \caption{DET curves comparing frame classification performance of the acoustic classifiers.} \label{DET_curves} \end{figure*} \begin{table*} \begin{center} \begin{tabular}{ccc} \scalebox{1.}{ \subfloat[]{ \begin{tabular}{| l | c | c |} \hline \textbf{Best Baby Cry classifiers} & \textbf{EER} & \textbf{\# Ops.} \\ \hline GMM, $M=32$ & 14.0 & 10\,560 \\ \parbox[t]{28ex}{Linear SVM, $T=2000$, \\ $C=1.0$, $\lambda=655$} & 12.9 & 101\,985 \\ \parbox[t]{28ex}{Feed-forward DNN, sigmoid, \\ $L=2$, $H=50$} & 10.8 & 10\,702 \\ \hline \end{tabular} \label{performance_baby_cry} } } & \hspace{1cm} & \scalebox{1.}{ \subfloat[]{ \begin{tabular}{| l | c | c |} \hline \textbf{Best Smoke Alarm classifiers} & \textbf{EER} & \textbf{\# Ops.} \\ \hline GMM, $M=16$ & 2.9 & 5\,280 \\ \parbox[t]{28ex}{Linear SVM, $T=2000$, \\ $C=0.1$, $\lambda=152$} & 3.0 & 46\,655 \\ \parbox[t]{28ex}{Feed-forward DNN, sigmoid, \\ $L=2$, $H=25$} & 1.7 & 4\,102 \\ \hline \end{tabular} \label{performance_smoke_alarms} } } \end{tabular} \caption{Performance of the best classifiers on the Baby Cry and Smoke Alarm data sets.} \label{classifier_performance} \end{center} \end{table*} In this section, classification performance is analysed for the task of recognising smoke alarms and baby cries against the large number of impostor sounds from the world set. Table \ref{classifier_performance} presents the EER for the best performing classifiers of each type and their associated computational cost. Figure \ref{DET_curves} shows the corresponding DET curves. In Figure \ref{scatter_plots} we present a more detailed comparison between the performance of various classifier types against the computational cost involved in classifying a frame of input at test time. \textbf{Baby Cry data set -} From Table \ref{performance_baby_cry} we observe that the best performing GMM has 32 components and achieves an EER of 14.0\% for frame-wise classification. From Figure \ref{baby_cry_scatter} (+ markers) we observe that there is no performance improvement when the number of Gaussian components is increased beyond 32. It should be noted that the best performing GMM (with $32$ components) has lower computational cost compared to any SVM classifier, and a cost comparable on average with DNN classifiers. From Table \ref{performance_baby_cry}, we observe that a SVM with a linear kernel is the best performing SVM classifier, with an EER of $12.9\%$. The SVM was trained on 2000 examples, resulting in 655 support vectors. From Figure \ref{baby_cry_scatter}, we note that the performance of the linear SVM (blue triangles) increases as the computational complexity (number of support vectors) is increased. The number of support vectors can also be controlled by varying the parameter $C$. For the best performing linear SVM, $C=1.0$ yields the best results. We observe that SVMs with a sigmoid kernel (light blue triangles) yield similar results to the linear SVM (Figure \ref{baby_cry_scatter}). The best SVM with a sigmoid kernel yields an EER of 13.5\%, while the second best sigmoid SVM has an EER of 13.9\%. As in the linear case, we observe an improvement in test performance as the computational cost or the number of support vectors is increased. \begin{figure*}[t!] \subfloat[Baby Cry Data set]{\includegraphics[width=0.5\textwidth,height=0.45\textwidth]{figure_3.png}\label{baby_cry_scatter}} \hfill \subfloat[Smoke Alarm Data set]{\includegraphics[width=0.5\textwidth,height=0.45\textwidth]{figure_4.png}\label{smoke_alarm_scatter}} \caption{Acoustic frame classification performance (EER percentage) as a function of the number of operations per frame, for each of the tested models, across the Baby Cry and Smoke Alarms data sets. } \label{scatter_plots} \end{figure*} From Figure \ref{baby_cry_scatter}, we note that SVMs with RBF and polynomial kernels (green and red triangles) are outperformed by linear and sigmoid SVMs, both in terms of \%EER and computational cost. There is also no observable trend between test performance and computational cost. For the polynomial SVM (red triangles), we found a kernel with $d = 3$ yielded the best performance, while low values of gamma $\gamma \in (0.005,0.01)$ provided the best results for the RBF kernel (Section \ref{SVMs}). The number of training examples $T = 2000$ was empirically determined to be the optimal value: adding more training examples did not yield any improvement in performance. Conversely, we tried training the same classifiers with $T = 500$ training examples, since the computational cost of SVMs is determined both by the type of kernel and the number of support vectors, the latter being controlled by varying the number of training examples and the penalty parameter $C$. With $T = 500$ and $C=0.1$, we were able to achieve a minimum EER rate of $13.7\%$ with the linear SVM, while halving the number of operations. From Table \ref{performance_baby_cry}, the best performing neural network architecture, which achieves an EER of $10.8\%$, is a feed-forward DNN with sigmoid activations for the hidden units. Figure \ref{DET_baby_cry} shows that the neural network clearly outperforms all the other models. From Figure \ref{baby_cry_scatter} we observe that the feed forward DNNs (circle and square markers) achieve similar test performance over a wide range of computational costs. This demonstrates that the network performance is not particularly sensitive to the specific number of hidden units in each layer. However, we did observe that networks which were deeper ($>1$ hidden layer) yielded better performance. From Figure \ref{baby_cry_scatter}, we observe that the RNN architectures (hexagonal markers) yield slightly worse performance and are computationally more expensive. An interesting observation from Figure \ref{baby_cry_scatter} is that feed-forward DNNs with both sigmoid and ReLU activations yield similar results. This is a very important factor when deploying these models on embedded hardware, since a ReLU net can be implemented with only linear operations (multiplications and additions), without the need for costly Taylor series expansions or LUTs. \textbf{Smoke Alarm data set -} From Table \ref{performance_smoke_alarms}, we observe that the best performing GMM yields an EER of 2.9\% and uses 16 mixture components. From Figure~\ref{smoke_alarm_scatter} (+ markers), we observe that the GMM performance improves as the computation cost (number of Gaussians) increases till $M=32$. Beyond this, increasing the number of Gaussian components does not improve results. Again, we observe that the best performing GMM with $M=32$ has much lower computational cost compared to SVMs, and a cost comparable on average with DNNs. Similar to the results on the Baby Cry data set, the linear and sigmoid kernel SVMs show the best performance, out of all four SVM kernel types. The best linear SVM has an EER of 3.0\% -- a small improvement over the best GMM approach, but with a small increase in the number of operations. The model used 2000 training examples and $C=1.0$. From Figure \ref{smoke_alarm_scatter} we again observe an improvement in performance, with an increase in computation cost for both the linear and sigmoid kernels (blue triangles). The best sigmoid kernel SVM scored 3.5\% with 2000 training examples, while another configuration scored 3.6\% with $T = 500$ and $C = 1$, at half the number of operations. Again, the polynomial and RBF kernels (red and green triangles) yield lower performance, with no observable trend in terms of performance versus computational cost (Figure \ref{smoke_alarm_scatter}). From Table \ref{performance_smoke_alarms}, we observe that a feed-forward sigmoid DNN yields the best performance, with an EER of $1.6\%$. From the DET curves (Figure \ref{DET_smoke_alarms}), we see that the neural network clearly outperforms the other models. From figure \ref{smoke_alarm_scatter} we note that the neural networks consistently perform better than the other models, over a wide range of computational costs, which correspond to different network configurations (number of layers, number of units in each layer). The ReLU networks perform similarly to the sigmoid networks, while the RNNs perform worse and are computationally more costly. It is worth noting that the performance of all classifiers is significantly better for the smoke alarm sounds, since the smoke alarms are composed of simple tones. On the other hand, baby cries have a large variability and are therefore more difficult to classify. \section{Conclusion \label{sec:conclusion}} In this study, we compare the performance of neural network acoustic models with GMMs and SVMs on an environmental audio event detection task. Unlike other machine learning systems, AESR systems are usually deployed on embedded hardware, which imposes many computational constraints. Keeping this in mind, we compare the performance of the models as a function of their computational cost. We evaluate the models on two tasks, detecting baby cries and detecting smoke alarms against a large number of impostor sounds. These data sets are much larger than the popular data sets found in AESR literature, which enables us to train neural network acoustic models. Additionally, the large number of impostor sounds allows to investigate the performance of the proposed models in a testing scenario that is closer to practical use cases than previously available data sets. Results suggest that GMMs provide a low cost baseline for classification, across both data sets. The GMM acoustic models are able to perform reasonably well at a modest computational cost. SVMs with linear and sigmoid kernels yield similar EER performance compared to GMMs, but their computational cost is overall higher. The computational cost of the SVM is determined by the number of support vectors. Unlike GMMs, SVMs are non-parametric models which do not allow the direct specification of model parameters, although the number of support vectors can be indirectly controlled with regularisation. Finally, our results suggest that deep neural networks consistently outperform both the GMMs and the SVMs on both data sets. The computational cost of DNNs can be controlled by limiting the number of hidden units and the number of layers. While changes in the number of units in the hidden layers did not appear to have a large impact on performance, deeper networks appeared to perform better in all cases. Additionally, neural networks with ReLU activations achieved good performance, while being an attractive choice for deployment on embedded devices because they do not require expensive LUT lookup operations. In the future, we would like to expand the evaluations presented here to include more event classes. However, the lack of large data sets for AESR problems is a major limitation. We hope that studies like this one will encourage collaboration with industry partners to collect large data sets for more rigorous evaluations. We would also like to investigate the performance of acoustic models as a function of the memory efficiency, since memory is an important consideration when designing models for embedded hardware. \section{Acknowledgements} The authors would like to thank the three anonymous reviewers whose comments helped to improve the article. This work was supported by funding from Innovate UK, EPSRC grants EP/M507088/1 \& EP/N014111/1 from the UK Engineering and Physical Sciences Research Council, as well as private funding from Audio Analytic Ltd. \ifCLASSOPTIONcaptionsoff \newpage \fi \bibliographystyle{IEEEtran}
{'timestamp': '2016-07-18T02:08:46', 'yymm': '1607', 'arxiv_id': '1607.04589', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04589'}
arxiv
\section{Introduction} Recent years have witnessed a remarkable convergence of two broad trends. The first of these concerns information i.e.\ data -- rapid technological advances coupled with an increased presence of computing in nearly every aspect of daily life, have for the first time made it possible to acquire and store massive amounts of highly diverse types of information. Concurrently and in no small part propelled by the environment just described, research in artificial intelligence -- in machine learning \cite{Aran2012g,Aran2012h,Aran2015,Aran2015d}, data mining~\cite{BeykAranPhunVenk+2014}, and pattern recognition, in particular -- has reached a sufficient level of methodological sophistication and maturity to process and analyse the collected data, with the aim of extracting novel and useful knowledge~\cite{Aran2015c,BeykAranPhunVenk+2014}. Though it is undeniably wise to refrain from overly ambitious predictions regarding the type of knowledge which may be discovered in this manner, at the very least it is true that few domains of application of the aforesaid techniques hold as much promise and potential as that of medicine and health in general. Large amounts of highly heterogeneous data types are pervasive in medicine. Usually the concept of so-called ``big data'' in medicine is associated with the analysis of Electronic Health Records \cite{ChriElli2016,Aran2015g,Aran2016,VasiAran2016,VasiAran2016a}, large scale sociodemographic surveys of death causes \cite{RGI2009}, social media mining for health related data~\cite{BeykAranPhunVenk+2015} etc. Much less discussed and yet arguably no less important realm where the amount of information presents a challenge to the medical field is the medical literature corpus itself. Namely, considering the overarching and global importance of health (to say nothing of practical considerations such as the availability of funding), it is not surprising to observe that the amount of published medical research is immense and its growth is only continuing to accelerate. This presents a clear challenge to a researcher. Even restricted to a specified field of research, the amount of published data and findings makes it impossible for a human to survey the entirety of relevant publications exhaustively which inherently leads to the question as to what kind of important information or insight may go unnoticed or insufficiently appreciated. The premise of the present work is that advanced machine learning techniques can be used to assist a human in the analysis of this data. Specifically, we introduce a novel methodology based on Bayesian non-parametric inference that achieves this, as well as free software which researchers can use in the analysis of their corpora of interest. \subsubsection{Previous work} A limitation of most models described in the existing literature lies in their assumption that the data corpus is static. Here the term `static' is used to describe the lack of any associated temporal information associated with the documents in a corpus -- the documents are said to be exchangeable~\cite{BleiLaff2006a}. However, research articles are added to the literature corpus in a temporal manner and their ordering has significance. Consequently the topic structure of the corpus changes over time~\cite{Dyso2012,BeykPhunAranVenk2015,BeykAranPhunVenk2015a}: new ideas emerge, old ideas are refined, novel discoveries result in multiple ideas being related to one another thereby forming more complex concepts or a single idea multifurcating into different `sub-ideas' etc. The premise in the present work is that documents are not exchangeable at large temporal scales but can be considered to be at short time scales, thus allowing the corpus to be treated as \emph{temporally locally static}. \section{Proposed approach\label{s:proposed}} In this section we introduce our main technical contributions. We begin by reviewing the relevant theory underlying Bayesian mixture models, and then explain how the proposed framework employs these for the extraction of information from temporally varying document corpora. \subsection{Bayesian mixture models}\label{ss:mixModels} Mixture models are appropriate choices for the modelling of so-called heterogeneous data whereby heterogeneity is taken to mean that observable data is generated by more than one process (source). The key challenges lie in the lack of observability of the correspondence between specific data points and their sources, and the lack of \emph{a priori} information on the number of sources~\cite{RichGree1997}. Bayesian non-parametric methods place priors on the infinite-dimensional space of probability distributions and provide an elegant solution to the aforementioned modelling problems. Dirichlet Process~(DP) in particular allows for the model to accommodate a potentially infinite number of mixture components~\cite{Ferg1973}: \begin{align} p\left(x|\pi_{1:\infty},\phi_{1:\infty}\right)=\sum_{k=1}^{\infty}\pi_{k}f\left(x|\phi_{k}\right). \end{align} where $\text{DP}\left(\gamma,H\right)$ is defined as a distribution of a random probability measure $G$ over a measurable space $\left(\Theta,\mathcal{B}\right)$, such that for any finite measurable partition $\left(A_{1},A_{2},\ldots,A_{r}\right)$ of $\Theta$ the random vector $\left(G\left(A_{1}\right),\ldots,G\left(A_{r}\right)\right)$ is a Dirichlet distribution with parameters $\left(\gamma H\left(A_{1}\right),\ldots,\gamma H\left(A_{r}\right)\right)$. Owing to the discrete nature and infinite dimensionality of its draws, the DP is a useful prior for Bayesian mixture models. By associating different mixture components with atoms $\phi_{k}$, and assuming $x_{i}|\phi_{k}\overset{iid}{\sim}f\left(x_{i}|\phi_{k}\right)$ where $f\left(.\right)$ is the kernel of the mixing components, a Dirichlet process mixture model (DPM) is obtained~\cite{Radf2000}. \subsubsection{Hierarchical DPMs} While the DPM is suitable for the clustering of exchangeable data in a single group, many real-world problems are more appropriately modelled as comprising multiple groups of exchangeable data. In such cases it is desirable to model the observations of different groups jointly, allowing them to share their generative clusters. This so-called ``sharing of statistical strength'' emerges naturally when a hierarchical structure is implemented. The DPM models each group of documents in a collection using an infinite number of topics. However, it is desired for multiple group-level DPMs to share their clusters. The hierarchical DP (HDP)~\cite{TehJordBealBlei2006} offers a solution whereby base measures of group-level DPs are drawn from a corpus-level DP. In this way the atoms of the corpus-level DP are shared across the documents; posterior inference is readily achieved using Gibbs sampling~\cite{TehJordBealBlei2006}. \subsection{Modelling topic evolution over time\label{ss:contrib}} We now show how the described HDP based model can be applied to the analysis of temporal topic changes in a \emph{longitudinal} data corpus. Owing to the aforementioned assumption of a temporally locally static corpus we begin by discretizing time and dividing the corpus into epochs. Each epoch spans a certain contiguous time period and has associated with it all documents with timestamps within this period. Each epoch is then modelled separately using a HDP, with models corresponding to different epochs sharing their hyperparameters and the corpus-level base measure. Hence if $n$ is the number of epochs, we obtain $n$ sets of topics $\boldsymbol{\phi}=\left\{ \boldsymbol{\phi}_{t_{1}},\ldots,\boldsymbol{\phi}_{t_{n}}\right\} $ where $\boldsymbol{\phi}_{t}=\left\{ \theta_{1,t},\ldots,\phi_{K_{t},t}\right\} $ is the set of topics that describe epoch $t$, and $K_{t}$ their number. \subsubsection{Topic relatedness\label{ss:similarity}} Our goal now is to track changes in the topical structure of a data corpus over time. The simplest changes of interest include the emergence of new topics, and the disappearance of others. More subtly, we are also interested in how a specific topic changes, that is, how it evolves over time in terms of the contributions of different words it comprises. Lastly, our aim is to be able to extract and model complex structural changes of the underlying topic content which result from the interaction of topics. Specifically, topics, which can be thought of as collections of memes, can merge to form new topics or indeed split into more nuanced memetic collections. This information can provide valuable insight into the refinement of ideas and findings in the scientific community, effected by new research and accumulating evidence. The key idea behind our tracking of simple topic evolution stems from the observation that while topics may change significantly over time, changes between successive epochs are limited. Therefore we infer the continuity of a topic in one epoch by relating it to all topics in the immediately subsequent epoch which are sufficiently similar to it under a suitable similarity measure -- we adopt the well known Bhattacharyya distance (BHD). This can be seen to lead naturally to a similarity graph representation whose nodes correspond to topics and whose edges link those topics in two epochs which are related. Formally, the weight of the directed edge that links $\phi_{j,t}$, the $j$-th topic in epoch $t$, and $\phi_{k,t+1}$ is $\rho_\text{BHD}\left(\phi_{j,t},\phi_{k,t+1}\right)$ where $\rho_\text{BHD}$ denotes the BHD. In constructing a similarity graph a threshold to used to eliminate automatically weak edges, retaining only the connections between sufficiently similar topics in adjacent epochs. Then the disappearance of a particular topic, the emergence of new topics, and gradual topic evolution can be determined from the structure of the graph. In particular if a node does not have any edges incident to it, the corresponding topic is taken as having emerged in the associated epoch. Similarly if no edges originate from a node, the corresponding topic is taken to vanish in the associated epoch. Lastly when exactly one edge originates from a node in one epoch and it is the only edge incident to a node in the following epoch, the topic is understood as having evolved in the sense that its memetic content may have changed. \begin{figure*}[t] \centering \subfigure[Topic speciation]{\includegraphics[width=0.8\columnwidth]{speciation.pdf}\label{f:speciation}}~~~~~~~~~~~~~~~~~~~~~~~ \subfigure[Topic splitting]{\includegraphics[width=0.8\columnwidth]{splitting.pdf}\label{f:splitting}} \caption{ This paper is the first work to describe the difference between two topic evolution phenomena: (a) topic speciation and (b) topic splitting. } \end{figure*} A major challenge to the existing methods in the literature concerns the detection of topic merging and splitting. Since the connectedness of topics across epochs is based on their similarity what previous work describes as `splitting' or indeed `merging' does not adequately capture these phenomena. Rather, adopting the terminology from biological evolution, a more accurate description would be `speciation' and `convergence' respectively. The former is illustrated in Fig~\ref{f:speciation} whereas the latter is entirely analogous with the time arrow reversed. What the conceptual diagram shown illustrates is a slow differentiation of two topics which originate from the same `parent'. Actual topic splitting, which does not have a biological equivalent in evolution, and which is conceptually illustrated in Fig~\ref{f:splitting} cannot be inferred by measuring topic similarity. Instead, in this work we propose to employ the Kullback-Leibler divergence (KLD) for this purpose. This divergence is asymmetric can be intuitively interpreted as measuring how well one probability distribution `envelops' another. KLD between two probability distributions $p(i)$ and $q(i)$ is defined as follows: \begin{align} \rho_\text{KLD} = \sum_i p(i) \log \frac{p(i)}{q(i)} \end{align} It can be seen that a high penalty is incurred when $p(i)$ is significant and $q(i)$ is low. Hence, we use the BHD to track gradual topic evolution, speciation, and convergence, while the KLD (computed both in forward and backward directions) is used to detect topic splitting and merging. \subsubsection{Automatic temporal relatedness graph construction\label{ss:construction}} Another novelty of the work first described in this paper concerns the building of the temporal relatedness graph. We achieve this almost entirely automatically, requiring only one free parameter to be set by the user. Moreover the meaning of the parameter is readily interpretable and understood by a non-expert, making our approach highly usable. Our methodology comprises two stages. Firstly we consider all inter-topic connections present in the initial fully connected graph and extract the empirical estimate of the corresponding cumulative density function (CDF). Then we prune the graph based on the operating point on the relevant CDF. In other words if $F_\rho$ is the CDF corresponding to a specific initial, fully connected graph formed using a particular similarity measure (BHD or KLD), and $\zeta \in [0, 1]$ the CDF operating point, we prune the edge between topics $\phi_{j,t}$ and $\phi_{k,t+1}$ iff $\rho(\phi_{j,t},\phi_{k,t+1}) < F^{-1}_\rho (\zeta)$. \section{Evaluation and discussion} We now analyse the performance of the proposed framework empirically on a large real world data set. \subsection{Evaluation data}\label{sss:rawData} We used the PubMed interface to access the US National Library of Medicine and retrieve from it scholarly articles. We searched for publication on the metabolic syndrome (MetS) using the keyphrase``metabolic syndrome'' and collected papers written in English. The earliest publication found was that by Berardinelli~\textit{et al.}~\cite{BeraCorddeAlCouc1953}. We collected all matching publications up to the final one indexed by PubMed on 10th Jan 2016, yielding a corpus of 31,706 publications. \subsubsection{Pre-processing\label{sss:preprocessing}} The raw data collected from PubMed is in the form of free text. To prepare it for automatic analysis a series of `pre-processing' steps are required. The goal is to remove words which are largely uninformative, reduce dispersal of semantically equivalent terms, and thereafter select terms which are included in the vocabulary over which topics are learnt. We firstly applied soft lemmatization using the WordNet$^\circledR$ lexicon~\cite{Mill1995} to normalize for word inflections. No stemming was performed to avoid semantic distortion often effected by heuristic rules used by stemming algorithms. After lemmatization and the removal of so-called stop-words, we obtained approximately 3.8 million terms in the entire corpus when repetitions are counted, and 46,114 unique terms. Constructing the vocabulary for our method by selecting the most frequent terms which explain 90\% of the energy in a specific corpus resulted in a vocabulary containing 2,839 terms. \subsection{Results} We stared evaluation by examining whether the two topic relatedness measures (BHD and KLD) are capturing different aspects of relatedness. To obtain a quantitative measure we looked at the number of inter-topic connections formed in respective graphs both when the BHD is used as well as when the KLD is applied instead. The results were normalized by the total number of connections formed between two epochs, to account for changes in the total number of topics across time. Our results are summarized in Fig~\ref{f:common}. A significant difference between the two graphs is readily evident -- across the entire timespan of the data corpus, the number of Bhattacharyya distance based connections also formed through the use of the KLD is less than 40\% and in most cases less than 30\%. An even greater difference is seen when the proportion of the KLD connections is examined -- it is always less than 25\% and most of the time less than 15\%. \begin{figure} \centering \subfigure[BHD-KLD normalized overlap]{\includegraphics[width=0.99\columnwidth]{BH_KLD_overlap.pdf}} \subfigure[KLD-BHD normalized overlap]{\includegraphics[width=0.99\columnwidth]{KLD_BH_overlap.pdf}} \caption{ The proportion of topic connections shared between the BHD and the KLD temporal relatedness graphs, normalized by (a) the number of BHD connections, and (b) the number of KLD connections, in an epoch. } \label{f:common} \end{figure} To get an even deeper insight into the contribution of the two relatedness measures, we examined the corresponding topic graphs before edge pruning. The plot in Fig~\ref{f:smooth} shows the variation in inter-topic edge strengths computed using the BHD and the KLD (in forward and backward directions) -- the former as the $x$ coordinate of a point corresponding to a pair of topics, and the latter as its $y$ coordinate. The scatter of data in the plot corroborates our previous observation that the two similarity measures indeed do capture different aspects of topic behaviour. We performed extensive qualitative analysis which is necessitated by the nature of the problem at hand and the so-called `semantic gap' that underlies it. In all cases we found that our algorithm revealed meaningful and useful information, as confirmed by an expert in the area of metabolic MetS research. Our final contribution comprises a web application which allows users to upload and analyse their data sets using the proposed framework. The application allows a range of powerful tasks to be performed quickly and in an intuitive manner. For example, the user can search for a given topic using keywords (and obtain a ranked list), trace the origin of a specific topic backwards in time, or follow its development in the forward direction, examine word clouds associated with topics, display a range of statistical analyses, or navigate the temporal relatedness graph. \section{Summary and Conclusions} In this work we presented a case for the importance of use of advanced machine learning techniques in the analysis and interpretation of medical literature. We described a novel framework based on non-parametric Bayesian techniques which is able to extract and track complex, semantically meaningful changes to the topic structure of a longitudinal document corpus. Moreover this work is the first to describe and present a method for differentiating between two types of topic structure changes, namely topic splitting and what we termed topic speciation. Experiments on a large corpus of medical literature concerned with the metabolic syndrome was used to illustrate the performance of our method. Lastly, we developed a web application which allows users such as medical researchers to upload their data sets and apply our method for their analysis; the application and its code will be made freely available following publication. \begin{figure} \centering \includegraphics[width=0.99\columnwidth]{KLD_BH_smooth.pdf} \caption{ Relationship between inter-topic edge strengths computed using the BHD and the KLD before the pruning of the respective graphs. } \label{f:smooth} \end{figure} \balance \bibliographystyle{ieee}
{'timestamp': '2016-07-19T02:00:36', 'yymm': '1607', 'arxiv_id': '1607.04660', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04660'}
arxiv
\section{Introduction\label{sec:intro}} In the United States, bladder cancer is the fourth and ninth most widespread cancer among males and females, respectively, whereas in Europe, approximately 50,000 people die from this disease each year \cite{Alcaraz:2007}. Due to the high recurrence rate of $50\%$, lifetime monitoring of patients is required after surgical removal of cancer tumors \cite{Holzbeierlein:2004}. During a cystoscopy, a flexible or rigid endoscope is inserted into the bladder through the urethra, and a video of the epithelium is visualized on a screen. The clinician (urologist or surgeon) scans the epithelium by maintaining the distal tip of the cystoscope close to the internal organ wall. The resulting highly resolved videos yield accurate visualization of the wall through small field of view (FOV) images. However, neither complete regions of interest (multifocal lesions, scares, etc.) nor anatomical landmarks (urethra, ureters, air bubbles) are visible in these images. Therefore, lesion diagnosis and follow-up may be difficult and time-consuming. Extended FOV mosaics can be obtained by superimposing the regions which can be jointly observed in small FOV images. Not only do they facilitate lesion diagnosis and follow-up, but they are also useful for data archiving (videos are highly redundant data) and medical traceability (videos are not easy to interpret by a clinician having not performed the acquisition). \subsection{Bladder image mosaicing} Bi-dimensional (2D) bladder image mosaicing algori\-thms were proposed for the standard white-light modality \cite{Bergen13,Miranda2008} and for the fluorescence modality \cite{Behrens:2008}. A complete mosaicing algorithm consists of \emph{(i)} the registration of consecutive images of the video sequence~\cite{Hernandez:2010}, \emph{(ii)} the correction of image misalignment in the mosaic leading to bladder texture discontinuities \cite{Weibel:2012a}, and \emph{(iii)} the contrast, intensity and/or color correction to handle image blurring, shading effects and/or instrument viewpoint changes \cite{Behrens:2010,Weibel2012b}. In \cite{Weibel:2012a}, it was shown that mosaics covering large bladder surfaces (\emph{e.g.}, half of the organ) can be computed. Although such 2D mosaics (see Fig.~\ref{fig:1}) facilitate lesion diagnosis and follow-up, these representations can be improved. Indeed, only the first image of the mosaic has the original image resolution, the resolution of the other images depending on the instrument trajectory and orientation. Moreover, these images are strongly distorted during their placement into the 2D map due to perspective changes of the endoscope. Both image distortion and changes of resolution lead to mosaics with spatially-varying visual quality. At last, urologists or surgeons represent themselves the bladder in the three-dimensional (3D) space. Mosaics in 3D (\emph{i.e.}, bladder wall surfaces with superimposed 2D image textures) not only match this mental 3D representation, but allow for a bladder texture representation without any image distortion and with preserved resolution. Moreover, virtual navigation inside the reconstructed organ part is possible after clinical examinations using 3D mosaics. The interest of 2D and 3D endoscopic image mosaicing in various medical fields is discussed in the overview paper~\cite{Bergen16}. \subsection{Previous work in 3D endoscopic data mosaicing} In various fields of medical endoscopy, 3D mosaics are built following three kinds of approaches. \begin{figure}[t] \centering \psfig{figure=fig1-eps-converted-to.pdf, width=\linewidth} \caption{Bladder mosaic (clinical data) obtained with the registration algorithm~\cite{Weibel:2012a} and using the algorithm~\cite{Weibel2012b} for correction of illumination discontinuities. The first image of the sequence is at the top right. From this image position, the endoscope first moves downwards in the bright regions (dashed bounding box) with weak textures. Then, its trajectory goes up towards the last image at the top left. Strong perspective and scale changes arise between the first and last images.} \label{fig:1} \end{figure} In the first approach, analytically known surface shapes (representing organs) are used both to limit the 2D registration errors and visualize textured surfaces. In \cite{Behrens:2009a}, bladder hemispheres were approximated by hemi\-cubes whose five sides represent quasi planar bladder regions. A video sequence was then partitioned into image groups, each group corresponding to some hemicube side. The five reconstructed 2D sub-mosaics were then projected onto the hemisphere to obtain a 3D bladder representation. As for the inner esophagus wall~\cite{Carroll:2009}, the organ was approximated by tubular shapes. The registration method aligns endoscopic images using jointly the image colors and a mosaicing surface of known geometry to reduce distortions. This algorithm provides both the endoscope trajectory and a 2D mosaic that can be projected onto the inner cylinder surfaces. Such approach based on 3D prior models is well-suited to the esophagus which can indeed be modelled by tubes, but is less appropriate for 3D bladder mosaicing. Indeed, the bladder shape is hardly predictable, notably since it is deformed by neighboring organs putting pressure on it. Moreover, grouping images with respect to hemicube sides is time-consuming and difficult. In the second approach, no 3D prior information is imposed, \emph{i.e.}, only video-images are taken into account. Different passive vision methods were proposed based on shape from shading (SfS \cite{Wu:2010}, bone surface reconstruction), structure from motion (SfM \cite{Soper2012}, cystoscopy), shape from motion associated to SfS (\cite{Kaufman:2008}, colon surface reconstruction), SfM-factorization based on surgical instrument tracking (\cite{Wu:2007}, surgery) or simultaneous localization and mapping methods (SLAM \cite{Mountney2009}, laparoscopy for minimal invasive surgery). The lack of intensity variation in standard bladder images impedes SfS. However, SfM or SLAM methods may be appropriate in urology. In their 3D bladder mosaicing feasibility study~\cite{Soper2012}, Soper \emph{et al} replaced the endoscope standardly used in urology by an ultrathin fiber. The fiber was translated and rotated in such a way that a complete bladder scan is performed. The acquired image sequence was first used to find point correspondences in image pairs using homologous feature points. Then, the 3D surface was constructed by displacing a set of points initially located on a sphere. Specifically, a bundle adjustment method was used to iteratively determine both fiber tip trajectory and pig bladder phantom surface. The main limitation of this approach for standard cystoscopy is that salient texture points must be extracted from the video-images. In large human bladder regions, textures may be missing or very weakly contrasted for both healthy (see the bottom of the mosaic in Fig.~\ref{fig:1}) and damaged tissues, \emph{e.g.}, due to scares. In such images, SfM or SLAM techniques based on SIFT or SURF approaches for extracting and matching textures thus suffer from a lack of robustness (see \cite{Ali:2013,Hernandez:2010} for a detailed discussion on feature based techniques in cystoscopy). Feature point extraction and matching techniques is also difficult because of illumination changes occurring between images, which are due to strong perspective changes and/or the vignetting effect of endoscopes. Another major limitation of feature-based methods is blur, which is commonly encountered in standard cystoscopy images. A less investigated approach in 3D endoscopy is based on active vision, where surface points are reconstructed in the small FOV of modified endoscopes. In \cite{Chan2003}, a two-channel endoscope was used to reconstruct the inner surface of the mouth. The first channel projects a structured-light pattern whereas the second acquires video-images. Classical triangulation methods were used to reconstruct 3D points. Tests on phantoms have shown that submillimetre point reconstruction accuracy can be reached with a small baseline of 2 mm. Another acquisition setup \cite{Penne2009} consists of a classical CCD-camera and a time of flight (ToF) camera providing a depth map of the FOV. A calibration procedure provides for each pixel both a color and a 3D position with millimetre accuracy. In \cite{Penne2009}, a two-channel endoscope (laparoscope) was used to reconstruct points in a pig stomach. It is noticeable that such camera pair can be used as well for single channel endoscopes such as cystoscopes. Indeed, a ToF camera uses infrared signals that do not interfere with the visible light of a color camera. Shevchenko \emph{et al} proposed a structured-light approach for obtaining extended 3D bladder surfaces~\cite{Shevchenko:2012}. The prototype in~\cite{Shevchenko:2012} consists of an external navigation system (which localizes the endoscope position in the examination room) coupled with an endoscopic system projecting a grid of points on the inspected surface. The 3D surface was built by computing a 2D mosaic from the CCD camera images, and exploiting the information provided by the external system. Knowing the endoscope position and the 2D image correspondence, the 2D mosaic has to be projected onto the reconstructed surface. It is noticeable that in \cite{Agenant:2013}, the authors also proposed a navigation system based method to document the position of a lesion into the bladder during a first cystoscopy. The aim was not 3D image mosaicing, but rather to facilitate follow-up by performing fast localization of lesions in upcoming cystoscopies. In the conference paper \cite{Ben-Hamadou:2010}, we proposed the first active vision based approach for 3D bladder mosaicing. Based on a similar structured light principle as that described later in \cite{Shevchenko:2012}, the proposed solution did however not require any external navigation system for endoscope localization. The 3D surface construction algorithm was based on 2D image registration and on the reconstruction of 3D points in the coordinate system of the endoscope camera. However, the proof of concept of 3D cystoscopy was only partly established in \cite{Ben-Hamadou:2010}. The algorithm was not tested using data (2D images and 3D points) acquired with the structured light principle embedded in a cystoscope. The related data were acquired for a large baseline (distance between the focal lengths of the camera and the light projector) of about 150 mm. This approach was not yet evaluated in the less favorable case of small baselines of 2 to 3 mm, like in cystoscopy. Furthermore, the image processing algorithm in \cite{Ben-Hamadou:2010} needed to be improved. It was based on a registration step, where the squared difference between image grey-levels was minimized. This approach is not robust when textures are weakly contrasted or with high inter- and intra-patient variability. Such similarity measure is also not appropriate to the illumination changes occurring in cystoscopic data. \begin{figure*}[t] \begin{tabular}{cc} \hspace{-1mm}\includegraphics[width=0.45\textwidth]{fig2a-eps-converted-to.pdf} & \hspace{9mm}\includegraphics[width=0.45\textwidth]{fig2b-eps-converted-to.pdf} \\ (a)& (b) \end{tabular} \caption{Acquisition principle~(a) and available data~(b) for 3D mosaicing. The acquisition principle is implemented using the prototype of Section~\ref{sec:ProtoResultsDiscussion}.\, (a) The $i$-th ``projector ray'' is shown in green. The corresponding ``camera ray'' is the black line originating from point $P_{3D}^{i,k}$ of the surface (intersection of the projector and camera rays) and passing through the optical center $O_{c_k}$ of the camera. $P_{2D}^{i,k}$ is the intersection of the camera ray with the plane supporting the acquired image $I_k$.\, (b) The available data are represented for the first and $k$-th acquisitions. The camera coordinate system $\{c_k$\} reads $(O_{c_k}, \protect\overrightarrow{x_{c_k}}, \protect\overrightarrow{y_{c_k}}, \protect\overrightarrow{z_{c_k}})$ and moves together with the prototype. The black line in bold represents the camera focal distance $f$, calibrated as described in \cite{Ben-Hamadou:2013}.} \label{fig:2} \end{figure*} \subsection{Objectives\label{sec:objectives}} The medical objective of the scanning fiber endoscope described in \cite{Soper2012} was to design a procedure where bladder walls can be fully acquired by nurses or ancillary care providers. This allows for sparing the time of urologists who can post-operatively review the bladder data. Such procedure is currently not standard but may be complementary to the usual examination with flexible or rigid cystoscopes. In the present paper, we aim to establish the proof of concept of bladder mosaicing using 3D cystoscopes based on active vision, which is a promising approach as shown in~\cite{Shevchenko:2012}. In \cite{Soper2012}, the distal tip of the fiber follows a spiral shaped trajectory and the distance from the optical center to the bladder wall is in average larger than the acquisition distance with cystoscopes. This allows for the use of the SfM approach. This is no longer true with cystoscopy, since depth disparity is often not guaranteed. Moreover, the lack of textures (as in the bounding box of Fig. \ref{fig:1}) also complicates SfM approaches, which require robust and accurate homologous point correspondence between images. In the present 3D bladder mosaicing feasibility study, an active vision solution is chosen. As compared to \cite{Shevchenko:2012}, our goal is to show that a 3D mosaicing algorithm guided by image registration is useful for retrieving the endoscope displacement between two acquisitions without using external navigation systems. From the instrumentation viewpoint, we show that 3D bladder mosaicing is feasible by simply modifying standard cystoscopes. Although the proposed prototype cannot currently be used in clinical situation, our 3D point reconstruction approach can be implemented on cystoscopes. Furthermore, it was shown that 3D point reconstruction is accurate enough, even for small baselines of point triangulation \cite{Ben-Hamadou:2013,Chan2003}. From the image processing viewpoint, we propose a 3D image mosaicing algorithm for which no assumption has to be made regarding the endoscope trajectory. The unknown endoscope displacement between consecutive image acquisitions is a general combination of a 3D rotation and a 3D translation. Although real-time mosaicing can be of interest, the computation time is not the most critical point in urology. As argued in \cite{Miranda2008,Weibel:2012a}, a mosaicing time of some tens of minutes is acceptable for a second (finer) diagnosis carried out to confirm or modify the first diagnosis during the real-time visualization of the small FOV video-images. Real-time is neither a critical factor for lesion follow-up because the lesion evolution assessment is performed with data from a cystoscopy scheduled some weeks or months after the cystoscopy in progress. The paper is organized as follows. Section \ref{sec:AcquisitionData} introduces the data acquisition principle (for readability reasons, the description of the prototype implementing this measurement principle is deferred to Section~\ref{sec:ProtoResultsDiscussion}). Section~\ref{sec:3Dmosaicing} details the 3D mosaicing algorithm. In Section~\ref{sec:ProtoResultsDiscussion}, the algorithm is tested on phantoms with various shapes allowing for a validation of the algorithm with data acquired by the proposed 3D cystoscope prototype. In Section~\ref{sec:SimulatedDataResultsDiscussion}, simulated data allow for qualitative evaluation on more realistic bladder data, in terms of both 3D surface shape and bladder texture. Section \ref{sec:3DRegistrationError} exhibits the 3D registration errors obtained for both synthetic data and data related to the prototype. Concluding remarks and perspectives are given in Section~\ref{sec:Conclusion}. \section{Acquisition principle and available data \label{sec:AcquisitionData}} The principle of our laser based active vision system is sketched in Fig.~\ref{fig:2}(a). The prototype is equipped with a color camera and a structured laser light projector. The basic idea is to project laser rays, such as the green line of Fig.~\ref{fig:2}(a), onto the bladder epithelial surface. Then, each projector ray is being reflected by the surface. This generates a so-called ``camera ray'' (the black line of Fig.~\ref{fig:2}(a)) passing through the green laser dots visible in image $I_k$. In Fig.~\ref{fig:2}(a), the quadrangle with black background corresponds to diffractive optics, \emph{i.e.}, holographic binary phase lens, designed to project eight laser rays. The latter are located on a cone originating from the projector optical center. Each projector ray passes through one of the eight white dots of the diffractive optics. For readability matters, only one ray is shown in Fig.~\ref{fig:2}(a). The calibration procedure in \cite{Ben-Hamadou:2013} is used to compute the intrinsic and extrinsic camera and projector parameters. The parameters of the projector ray equations are computed in the camera coordinate system $(O_{c_k}, \overrightarrow{x_{c_k}}, \overrightarrow{y_{c_k}}, \overrightarrow{z_{c_k}})$, referred to as $\{c_k$\}, with $O_{c_k}$ the optical center of the camera. Because the projector and camera are rigidly fixed together, the equations of the projector rays in $\{c_k$\} do not depend on $k$. The equations of the camera rays (passing all through $O_{c_k}$) are also computed in $\{c_k$\} given the location $P_{2D}^{i,k}$ of the green dots in image $I_k$ ($i$ stands for the index of the green dots). The green dots can be easy segmented since the hue of the bladder is always reddish or orange, see the real images of Figs.~\ref{fig:1} and \ref{fig:2}(b). The $i$-th laser point on the bladder surface ($P_{3D}^{i,k}$) is the intersection of the projector ray with its corresponding camera ray. The data available for 3D mosaicing are related to a video-sequence with $K$ frames. Each acquisition $k \in \{1,\ldots,K\}$ corresponds to a cystoscope viewpoint and yields: \emph{(i)}~an image $I_k$; \emph{(ii)}~eight laser dots $P_{2D}^{i,k}=(x_{2D}^{i,k}, y_{2D}^{i,k})^T$ given in the coordinate system $(O_{I_k}, \overrightarrow{x_{I_k}},\\ \overrightarrow{y_{I_k}}$) of the plane supporting $I_k$; \emph{(iii)}~eight laser points $P_{3D}^{i,k}=(x_{3D}^{i,k}, y_{3D}^{i,k}, z_{3D}^{i,k})^T$ given in the camera coordinate system $\{c_k$\} (see Fig.~\ref{fig:2}(b)). The barrel distortions in images $I_k$ are corrected using the known intrinsic camera parameters \cite{Ben-Hamadou:2013}. The laser rays ($i \in \{1,\ldots,M\}$ with $M=8$) are projected in the periphery of the circular FOV of the images to minimize the loss of bladder texture and to allow for diagnosis. Although only eight $P_{3D}^{i,k}$ points are available per viewpoint, the video acquisition leads to a large number of points overall due to the high acquisition speed (25 images/s) and the slow endoscope displacements (some mm/s). The algorithm proposed in Section~\ref{sec:3Dmosaicing} aims at placing all points $P_{3D}^{i,k}$ in a common coordinate system, and then computing a polygonal mesh representing the smooth bladder surface, without corners nor sharp edges. The textures of images $I_k$ will finally be projected onto the polygonal mesh. \section{Construction of three-dimensional textured surfaces \label{sec:3Dmosaicing}} The proposed 3D mosaicing method takes as inputs a set of distortion-corrected images $I_k$ and a set of $M=8$ points per viewpoint $k$. Each $P_{3D}^{i,k}$ point is given in the local (moving) coordinate system $\{c_k$\} of the camera. Moreover, their 2D projections $P_{2D}^{i,k}$ in the $k$-th image of the video-sequence ($i=1,\ldots,M$) are known as well. The algorithm for reconstructing the $P_{3D}^{i,k}$ points from the knowledge of their projections $P_{2D}^{i,k}$ can be found in~\cite{Ben-Hamadou:2013}. The mosaicing algorithm requires some geometric prerequisites, which are presented now. \subsection{Geometrical considerations \label{sec:geometry}} The first geometrical transformation involves the intrinsic camera parameters linking the 3D camera coordinate system $\{c_k$\} to the 2D image plane coordinate system $(O_{I_k}, \overrightarrow{x_{I_k}}, \overrightarrow{y_{I_k}}$). In~\eqref{eq:matricePerspective}, the perspective projection matrix ${\mathbf{K}}$ is fully defined from the knowledge of the projection $(u, v)$ of the camera optical center in image $I_k$, the focal length $f$, and the CCD-sensor size $l_x$ and $l_y$ along the $\overrightarrow{x_{I_k}}$ and $\overrightarrow{y_{I_k}}$ axes (see Fig.~\ref{fig:2}(b)): \begin{align} \left[ \setlength\arraycolsep{3.0pt} \begin{array}{c} P_{2D}^{i,k} \\ 1 \end{array}\right] =\, \frac{1}{z_{3D}^{\,i,k}} \, {\mathbf{K}} \, P_{3D}^{i,k} \,\,\, \textrm{with} \,\,\,\, \label{eq:matricePerspective} {\mathbf{K}}= \left[ \setlength\arraycolsep{1.0pt} \begin{array}{ccc} f/l_x & 0 & u \\ 0 & f/l_y & v \\ 0 & 0 & 1 \end{array}\right]. \end{align} The second transformation is a 3D rigid transformation linking consecutive camera viewpoints. It is parameterized by a $3\times 4$ matrix $\mathbf{T}_{3D}^{k-1,k}$. $\mathbf{T}_{3D}^{k-1,k}$ is composed of a $3\times 3$ rotation matrix $\mathbf{R}^{k-1,k}$ and a $3\times 1$ translation vector $D^{k-1,k}$: \begin{align} \hat{P}_{3D}^{i,k-1} = \mathbf{T}_{3D}^{k-1,k} \, \!\!\left[\begin{array}{c} P_{3D}^{\,i,k}\\1 \end{array}\right], \label{eq:matriceTrigidea}% \end{align} with \begin{align} \mathbf{T}_{3D}^{k-1,k} = \left[ \setlength\arraycolsep{2pt} \begin{array}{c|c} \mathbf{R}^{k-1,k} & D^{k-1,k} \end{array}\right]. \label{eq:matriceTrigideb}% \end{align} The coefficients of the rotation matrix are defined from the well-known Euler angles, denoted by $\theta_1^{k-1,k}$, $\theta_2^{k-1,k}$ and $\theta_3^{k-1,k}$. The so-called ``$x$-convention'' is used for these angles: $\theta_1^{k-1,k} \in [0,2\pi]$ is the angle around the $\overrightarrow{z_{c_k}}$-axis, $\theta_2^{k-1,k}\in [0, \pi]$ is around the new (rotated) $\overrightarrow{x_{c_k}}^{\,'}$-axis, while $\theta_3^{k-1,k}\in [0,2\pi]$ is around the rotated $\overrightarrow{z_{c_k}}^{\,''}$-axis. Superscripts $'$ and $''$ respectively refer to the new location of axes $\overrightarrow{x_{c_k}}$ and $\overrightarrow{z_{c_k}}$ after the first and second rotations. The matrix $\mathbf{T}_{3D}^{k-1,k}$ displaces point $P_{3D}^{i,k}$ in $\{c_k\}$ to $\hat{P}_{3D}^{i,k-1}=(\hat{x}_{3D}^{i,k-1}, \hat{y}_{3D}^{i,k-1}, \hat{z}_{3D}^{i,k-1})^T$ in $\{c_{k-1}$\}. It is worth noticing that $\hat{P}_{3D}^{i,k-1}$ are points brought wi\-thin $\{c_{k-1}$\} whereas $P_{3D}^{i,k-1}$ are ``data points'' reconstructed in $\{c_{k-1}\}$ using the calibration parameters and the segmented dots $P_{2D}^{i,k-1}$. Thus, $P_{3D}^{i,k-1}$ and $\hat{P}_{3D}^{i,k-1}$ represent different laser points. The third relationship required by the proposed me\-thod is a homography linking two consecutive images $I_{k}$ and $I_{k-1}$. This 2D relationship is established under several working assumptions. First, the distal tip of the cystoscope is usually close to the inner bladder epithelium. The FOV being very limited, the surfaces viewed in the images are usually small and are assumed to be planar. Second, the bladder is filled by an isotonic saline solution which rigidifies the bladder wall. The acquisition speed being high (25 image/s) and the endoscope displacement speed low (some mm/s), we assume that the common surface part viewed in images $I_{k-1}$ and $I_{k}$ does not warp itself between two consecutive acquisitions. Based on these working assumptions, the homography is well-suited to model the dependence between $I_{k}$ and $I_{k-1}$. This choice was practically validated for numerous algorithms for 2D/2D registration of bladder images: feature-based methods in \cite{Behrens:2009a} (fluorescence modality) and \cite{Bergen13,Soper2012} (white-light modality), the graph-cut method in \cite{Weibel:2012a} and two optical flow methods in \cite{Ali16b,Ali16a}. The homography matrix is defined by: \begin{align} \mathbf{T}_{2D}^{k-1,k} = \left[\begin{array}{ccc} \underbrace{\alpha^{k-1,k}\cos\varphi^{k-1,k}}_{a^{k-1,k}_{1,1}} & \underbrace{-s_x^{k-1,k}\sin\varphi^{k-1,k}}_{a^{k-1,k}_{1,2}} & \underbrace{t^{k-1,k}_{x, 2D}}_{a^{k-1,k}_{1,3}} \\ \underbrace{s_y^{k-1,k}\sin\varphi^{k-1,k}}_{a^{k-1,k}_{2,1}} & \underbrace{\alpha^{k-1,k}\cos\varphi^{k-1,k}}_{a^{k-1,k}_{2,2}} & \underbrace{t^{k-1,k}_{y, 2D}}_{a^{k-1,k}_{2,3}} \\ a_{3,1}^{k-1,k} & a_{3,2}^{k-1,k} & 1 \end{array}\right] \label{eq:matriceHomography} \end{align} where the parameters $\alpha$, $\varphi$, $(s_x, s_y)$ and $(t_{x,2D}, t_{y,2D})$ respectively denote the scale factor, in-plane rotation, shearing and 2D translation changes. In the following and for simplicity reasons, the matrix $\mathbf{T}_{2D}^{k-1,k}$ will be simply described by means of its coefficients $a^{k-1,k}_{r,s}$. Image $I_k$ is registered with $I_{k-1}$ when $\mathbf{T}_{2D}^{k-1,k}$ superimposes homologous points $P_{2D}^{k}$ and $P_{2D}^{k-1}$ of both images, \emph{i.e.}, when \begin{align} \left[\begin{array}{c} P_{2D}^{k-1} \\ 1 \end{array}\right] &\!\!=\! \frac{1}{\beta^{k-1,k}} \,\, \mathbf{T}_{2D}^{k-1,k} \left[\begin{array}{c} P_{2D}^{k} \\ 1 \end{array}\right]. \label{eq:PointsHomologues} \end{align} The normalizing factor $\beta^{k-1, k}$ deduces from the perspective parameters $a_{3,1}^{k-1,k}$ and $a_{3,2}^{k-1,k}$: \begin{align} \beta^{k-1,k}=[a_{3,1}^{k-1,k},a_{3,2}^{k-1,k}]^TP_{2D}^{k}+1. \label{eq:beta} \end{align} Let us stress that \eqref{eq:PointsHomologues} is met for all homologous texture pixels of images $I_k$ and $I_{k-1}$ ($P_{2D}^{k-1}$ and $P_{2D}^{k}$), but not for the laser points $P_{2D}^{i,k}$ and $P_{2D}^{i,k-1}$. Indeed, $P_{2D}^{i,k}$ and $P_{2D}^{i,k-1}$ are not homologous points because the active vision system is moving from viewpoint $k-1$ to viewpoint $k$. Nevertheless, \eqref{eq:PointsHomologues} will be exploited to estimate the parameters of a candidate homography $\mathbf{T}_{2D}^{k-1,k}$ corresponding to a candidate $\mathbf{T}_{3D}^{k-1,k}$ transformation. Moreover, the quality of image superimposition will be assessed based on \eqref{eq:PointsHomologues}, applied to all homologous texture pixels of $I_{k-1}$ and $I_k$. \setcounter{equation}{12} \begin{table*}[bp] \begin{equation} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\left[ \setlength\arraycolsep{8pt} \begin{array}{cccccccc} % x_{2D}^{1,k} & y_{2D}^{1,k} & 1 & 0 & 0 & 0 & -c^{k-1,k}_{1,1}x_{2D}^{1,k} & -c^{k-1,k}_{1,1}y_{2D}^{1,k} \\[.2cm] % 0 & 0 & 0 & x_{2D}^{1,k} & y_{2D}^{1,k} & 1 & -c^{k-1,k}_{2,1}x_{2D}^{1,k} & -c^{k-1,k}_{2,1}y_{2D}^{1,k} \\ % \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\ % x_{2D}^{M,k} & y_{2D}^{M,k} & 1 & 0 & 0 & 0 & -c^{k-1,k}_{1,M}x_{2D}^{M,k} & -c^{k-1,k}_{1,M}y_{2D}^{M,k} \\[.2cm] % 0 & 0 & 0 & x_{2D}^{M,k} & y_{2D}^{M,k} & 1 & -c^{k-1,k}_{2,M}x_{2D}^{M,k} & -c^{k-1,k}_{2,M}y_{2D}^{M,k} \\ \end{array}\right] % % \left[ \setlength\arraycolsep{0pt} \begin{array}{c} a_{1,1}^{k-1,k} \\[.1cm] a_{1,2}^{k-1,k} \\[.1cm] a_{1,3}^{k-1,k} \\[.1cm] a_{2,1}^{k-1,k} \\[.1cm] a_{2,2}^{k-1,k} \\[.1cm] a_{2,3}^{k-1,k} \\[.1cm] a_{3,1}^{k-1,k} \\[.1cm] a_{3,2}^{k-1,k} \end{array}\right] % = % % \left[ \setlength\arraycolsep{0pt} \begin{array}{c} c_{1,1}^{k-1,k} \\[.2cm] c_{2,1}^{k-1,k} \\ \vdots \\ c_{1,M}^{k-1,k} \\[.2cm] c_{2,M}^{k-1,k} \end{array}\right] \label{eq:Lien2D3DMatricielFinal} % \end{equation} \end{table*} \setcounter{equation}{6} \subsection{Consecutive viewpoint registration\label{sec:registration}} \subsubsection{Principle of the registration algorithm} Let us define the displaced projected laser points $\hat{P}_{2D}^{i,k-1}$ as the 2D projections of the laser points $P_{3D}^{i,k}$, displaced from $\{c_{k}$\} to $\{c_{k-1}$\}. Combining~\eqref{eq:matricePerspective} and~\eqref{eq:matriceTrigidea} yields: \begin{align} \setlength\arraycolsep{0.0pt} \left[\begin{array}{c} \hat{P}_{2D}^{i,k-1} \\ 1 \end{array}\right] & = \frac{1}{ \hat{z}_{3D}^{i,k-1}}\; {\mathbf{K}} \mathbf{T}_{3D}^{k-1,k} \left[ \begin{array}{c} P_{3D}^{i,k}\\ 1 \end{array}\right]. \label{eq:PointsTransforme} \end{align} Now, consider an ideal (and searched) $\mathbf{T}_{3D}^{k-1,k}$ transformation, whose related homography $\mathbf{T}_{2D}^{k-1,k}$ superimposes the pixels of $I_k$ and their homologous pixels in $I_{k-1}$. Such $\mathbf{T}_{2D}^{k-1,k}$ transformation not only superimposes homologous texture pixels, but also relates each laser point $P_{2D}^{i,k}$ to its displaced instance $\hat{P}_{2D}^{i,k-1}$: \begin{align} \setlength\arraycolsep{0.0pt} \left[\begin{array}{c} \hat{P}_{2D}^{i,k-1} \\ 1 \end{array}\right] = \frac{1}{\beta^{k-1,k}_i}\:\mathbf{T}_{2D}^{k-1,k} \left[\begin{array}{c} P_{2D}^{i,k} \\ 1 \end{array}\right], \label{eq:PointsHomologuesModif} % \end{align} where the factor $\beta^{k-1,k}$ appearing in \eqref{eq:PointsHomologues} has been replaced by $\beta^{k-1,k}_i$ to stress the dependence upon $i$. Combining~\eqref{eq:PointsTransforme} and \eqref{eq:PointsHomologuesModif} yields: \begin{align} \setlength\arraycolsep{0.0pt} \frac{1}{\beta^{k-1,k}_i}\;\mathbf{T}_{2D}^{\,k-1,k}\left[ \begin{array}{c} P_{2D}^{\,i,k}\\1 \end{array}\right] &=\frac{1}{\hat{z}_{3D}^{\,i,k-1}}\,{\mathbf{K}}\;\mathbf{T}_{3D}^{k-1,k} \left[\begin{array}{c} P_{3D}^{\,i,k}\\1 \end{array}\right] \label{eq:Lien2D3DMatriciel} \end{align} which involves the 2D and 3D laser points related to viewpoint $k$ only. For a given candidate $\mathbf{T}_{3D}^{k-1,k}$, $\hat{z}_{3D}^{i,k-1}$ is known from the last equation of~\eqref{eq:PointsTransforme} and the knowledge of $P_{3D}^{i,k}$. Similarly, $\beta^{k-1,k}_i$ can be deduced from $\mathbf{T}_{2D}^{k-1,k}$ using~\eqref{eq:beta}. Therefore, $\mathbf{T}_{3D}^{k-1,k}$ and $\mathbf{T}_{2D}^{k-1,k}$ are the only unknowns in~\eqref{eq:Lien2D3DMatriciel}. As we will see, $\mathbf{T}_{2D}^{k-1,k}$ can actually be deduced from $\mathbf{T}_{3D}^{k-1,k}$ and the knowledge of the laser points. The proposed registration scheme is designed in such a way that some similarity measure (to be detailed) between both images $I_k$ and $I_{k-1}$ is maximized with respect to the $\mathbf{T}_{3D}^{k-1,k}$ parameters under the constraint formulated in~\eqref{eq:Lien2D3DMatriciel}. Each iteration of the optimization algorithm includes four steps related to the update and evaluation of the candidate $\mathbf{T}_{3D}^{k-1,k}$: \begin{enumerate} \item Update the rigid transformation $\mathbf{T}_{3D}^{k-1,k}$. \item Compute matrix $\mathbf{T}_{2D}^{k-1,k}$ induced by $\mathbf{T}_{3D}^{k-1,k}$ using \eqref{eq:Lien2D3DMatriciel} and the location of the $M$ laser points $(P_{3D}^{i,k},P_{2D}^{i,k})$. \item Superimpose $I_{k-1}$ with $\mathbf{T}_{2D}^{k-1,k}(I_{k})$, which denotes the transformation of image $I_k$ using the computed homography $\mathbf{T}_{2D}^{k-1,k}$; see \eqref{eq:PointsHomologues}. \item Evaluate the similarity measure between images $I_{k-1}$ and $\mathbf{T}_{2D}^{k-1,k}(I_{k})$ (the pixels of both images corresponding to laser dots are not taken into account). \end{enumerate} This process terminates when the similarity measure between the registered images is maximal. This algorithm simultaneously provides the homography $\mathbf{T}_{2D}^{k-1,k}$ and the rigid transformation $\mathbf{T}_{3D}^{k-1,k}$ linking $\{c_{k}$\} to $\{c_{k-1}$\}. Hereafter, we detail how $\mathbf{T}_{2D}^{k-1,k}$ is computed from $\mathbf{T}_{3D}^{k-1,k}$. Then, we define the similarity measure used for assessing the 2D image superimposition quality. Finally, an overview of the optimization algorithm is given (Algorithm~\ref{alg:transformationDetermination}). \subsubsection{Matrix relationship between $\mathbf{T}_{2D}^{k-1,k}$ and $\mathbf{T}_{3D}^{k-1,k}$\label{sec:matrixrelationship}} For a point correspondence $(P_{3D}^{i,k}, P_{2D}^{i,k})$, \eqref{eq:Lien2D3DMatriciel} is a system of three equations. Rearranging the first two equations and replacing $\beta^{k-1,k}_i$ and $\hat{z}_{3D}^{\,i,k-1}$ by their expressions, we obtain: \begin{align} \left\{ \begin{array}{ccc} \frac{\mathbf{T}_{2D,1\raisebox{-0.8ex}{\scalebox{1.8}{$\cdot$}}}^{k-1,k}\left[ \setlength\arraycolsep{1.2pt} \begin{array}{c}P_{2D}^{i,k}\\1\end{array}\right]} {\mathbf{T}_{2D,3\raisebox{-0.8ex}{\scalebox{1.8}{$\cdot$}}}^{k-1,k}\left[\begin{array}{c}P_{2D}^{i,k}\\1\end{array}\right]} & = \frac{ {\mathbf{K}}_{1\raisebox{-0.8ex}{\scalebox{1.8}{$\cdot$}}}\; \mathbf{T}_{3D}^{k-1,k}\left[ \setlength\arraycolsep{1.2pt} \begin{array}{c}P_{3D}^{i,k}\\1\end{array}\right]} {\mathbf{T}_{3D,3\raisebox{-0.8ex}{\scalebox{1.8}{$\cdot$}}}^{k-1,k}\left[ \setlength\arraycolsep{1.2pt} \begin{array}{c}P_{3D}^{i,k}\\1\end{array}\right]} \\[1.0cm] \frac{\mathbf{T}_{2D,2\raisebox{-0.8ex}{\scalebox{1.8}{$\cdot$}}}^{k-1,k}\left[ \setlength\arraycolsep{1.2pt} \begin{array}{c}P_{2D}^{i,k}\\1\end{array}\right]} {\mathbf{T}_{2D,3\raisebox{-0.8ex}{\scalebox{1.8}{$\cdot$}}}^{k-1,k}\left[ \setlength\arraycolsep{1.2pt} \begin{array}{c}P_{2D}^{i,k}\\1\end{array}\right]} & = \frac{ {\mathbf{K}}_{2\raisebox{-0.8ex}{\scalebox{1.8}{$\cdot$}}}\; \mathbf{T}_{3D}^{k-1,k}\left[ \setlength\arraycolsep{1.2pt} \begin{array}{c}P_{3D}^{i,k}\\1\end{array}\right]} {\mathbf{T}_{3D,3\raisebox{-0.8ex}{\scalebox{1.8}{$\cdot$}}}^{k-1,k}\left[ \setlength\arraycolsep{1.2pt} \begin{array}{c}P_{3D}^{i,k}\\1\end{array}\right]} \end{array} \right. \label{eq:Lien2D3DNonMatriciel1} \end{align} where the subscripts $1\raisebox{-0.8ex}{\scalebox{1.8}{$\cdot$}}$, $2\raisebox{-0.8ex}{\scalebox{1.8}{$\cdot$}}$ and $3\raisebox{-0.8ex}{\scalebox{1.8}{$\cdot$}}$ respectively index the first, second and third matrix rows and all column indices. Denoting by $c^{k-1,k}_{1,i}$ and $c^{k-1,k}_{2,i}$ the right-hand sides in~\eqref{eq:Lien2D3DNonMatriciel1}, \eqref{eq:Lien2D3DNonMatriciel1} rewrites: \begin{align} \left\{\begin{array}{ccc} \mathbf{T}_{2D,1\raisebox{-0.8ex}{\scalebox{1.8}{$\cdot$}}}^{k-1,k}\left[\begin{array}{c}P_{2D}^{i,k}\\1\end{array}\right] & = & c^{k-1,k}_{1,i}\;\mathbf{T}_{2D,3\raisebox{-0.8ex}{\scalebox{1.8}{$\cdot$}}}^{k-1,k}\left[\begin{array}{c}P_{2D}^{i,k}\\1\end{array}\right] \\[20pt] \mathbf{T}_{2D,2\raisebox{-0.8ex}{\scalebox{1.8}{$\cdot$}}}^{k-1,k}\left[\begin{array}{c}P_{2D}^{i,k}\\1\end{array}\right] & = & c^{k-1,k}_{2,i}\;\mathbf{T}_{2D,3\raisebox{-0.8ex}{\scalebox{1.8}{$\cdot$}}}^{k-1,k}\left[\begin{array}{c}P_{2D}^{i,k}\\1\end{array}\right] \end{array} \right. \label{eq:Lien2D3DNonMatriciel2} \end{align} with \begin{align*} c^{k-1,k}_{1,i} & = \left ( \textbf{K}_{1\raisebox{-0.8ex}{\scalebox{1.8}{$\cdot$}}}\; \mathbf{T}_{3D}^{k-1,k}\left[ \setlength\arraycolsep{0.0pt} \begin{array}{c}P_{3D}^{i,k}\\1\end{array}\right] \right )/ \left (\mathbf{T}_{3D,3\raisebox{-0.8ex}{\scalebox{1.8}{$\cdot$}}}^{k-1,k}\left[ \setlength\arraycolsep{0.0pt} \begin{array}{c}P_{3D}^{i,k}\\1\end{array}\right] \right ) \\ c^{k-1,k}_{2,i} & = \left ( \textbf{K}_{2\raisebox{-0.8ex}{\scalebox{1.8}{$\cdot$}}}\; \mathbf{T}_{3D}^{k-1,k}\left[ \setlength\arraycolsep{0.0pt} \begin{array}{c}P_{3D}^{i,k}\\1\end{array}\right]\right ) / \left ( {\mathbf{T}_{3D,3\raisebox{-0.8ex}{\scalebox{1.8}{$\cdot$}}}^{k-1,k}\left[ \setlength\arraycolsep{0.0pt} \begin{array}{c}P_{3D}^{i,k}\\1\end{array}\right]}\right ) \end{align*} Replacing the points $P_{3D}^{i,k}$ and $P_{2D}^{i,k}$ by their coordinates, \eqref{eq:Lien2D3DNonMatriciel2} yields a linear system of two equations involving the coefficients $a_{r,s}^{k-1,k}$ in~\eqref{eq:matriceHomography}: \begin{equation} \left\{ \setlength\arraycolsep{1pt} \begin{array}{l} x_{2D}^{i,k}a_{1,1}^{k-1,k}+ y_{2D}^{i,k}a_{1,2}^{k-1,k} + a_{1,3}^{k-1,k}- \ldots \medskip \\ \hspace*{.2cm}c^{k-1,k}_{1,i}x_{2D}^{i,k}a_{3,1}^{k-1,k} - c^{k-1,k}_{1,i}y_{2D}^{i,k}a_{3,2}^{k-1,k} = c^{k-1,k}_{1,i} \bigskip\\ x_{2D}^{i,k}a_{2,1}^{k-1,k} +y_{2D}^{i,k}a_{2,2}^{k-1,k} + a_{2,3}^{k-1,k}- \ldots\medskip \\ \hspace*{.2cm}c^{k-1,k}_{2,i}x_{2D}^{i,k}a_{3,1}^{k-1,k}-c^{k-1,k}_{2,i}y_{2D}^{i,k}a_{3,2}^{k-1,k} =c^{k-1,k}_{2,i} \end{array} \right. \label{eq:Lien2D3DNonMatriciel3} \end{equation} Both equations are valid for all laser points $P^{i,k}_{3D}$ of viewpoint $k$. This yields a linear system of $2M$ equations with eight unknown parameters $a_{r,s}^{k-1,k}$ related to transformation $\mathbf{T}_{2D}^{k-1,k}$: see~\eqref{eq:Lien2D3DMatricielFinal}. For our prototype, $M=8$, so \eqref{eq:Lien2D3DMatricielFinal} is an over-determined system of 16 equations. Notice that when $M \geq 4$, the homography $\mathbf{T}_{2D}^{k-1,k}$ induced by $\mathbf{T}_{3D}^{k-1,k}$ is unique since there are $2M\geq 8$ equations in~\eqref{eq:Lien2D3DMatricielFinal}. \setcounter{equation}{13} \begin{algorithm*} \caption{Data registration of viewpoints $k$ and $k-1$.} \label{alg:transformationDetermination} \KwIn{\begin{itemize}{} \item Source image $I_k$ and target image $I_{k-1}$. \item $M$ laser points of viewpoint $k$ given in 3D and 2D: $\{P_{3D}^{i,k}$, $P_{2D}^{i,k}\}|_{i\in \{1,\ldots,M\}}$. \item Initial simplex given in~\eqref{eq:initialSimplex}, and related similarity values $\varepsilon(V_e)$, $e \in \{1,\ldots,7\}$. \end{itemize}} \KwOut{Geometrical transformation linking viewpoints $k$ and $k-1$: \begin{itemize}{} \item homography matrix $\mathbf{T}_{2D}^{k-1,k}$. \item translation vector $D^{k-1,k}$ and angles $\theta_1^{k-1,k}$, $\theta_2^{k-1,k}$ and $\theta_3^{k-1,k}$ induced by the estimated $3\times 4$ rigid transformation matrix $\mathbf{T}_{3D}^{k-1,k}$. \end{itemize}} \Repeat{the variation of the simplex volume leads to a mean displacement value of $I_{k}$ on $I_{k-1} < 0.1$ pixel} { % \underline{\em Step 1}: Replace the vertex of smallest $\varepsilon(V_e)$ value by a new vertex according to the symmetry rules of the simplex algorithm. % Then, update the entries of $\mathbf{T}_{3D}^{k-1,k}$ (see~\eqref{eq:matriceTrigideb}) from the knowledge of $\theta_1^{k-1,k}$, $\theta_2^{k-1,k}$, $\theta_3^{k-1,k}$, and of the 3D translation vector $D^{k-1,k}$ for the new vertex\; \underline{\em Step 2}: Given~\eqref{eq:Lien2D3DMatricielFinal} and the $M$ points $(P_{3D}^{i,k}, P_{2D}^{i,k})$, compute the 8 parameters of the homography $\mathbf{T}_{2D}^{k-1,k}$ induced by the rigid transformation $\mathbf{T}_{3D}^{k-1,k}$ determined in {\em Step 1}\; \underline{\em Step 3}: Superimpose $I_k$ on $I_{k-1}$ using~\eqref{eq:PointsHomologues} and the homography $\mathbf{T}_{2D}^{k-1,k}$ obtained in {\em step 2}\; \underline{\em Step 4}: For the new vertex, assess the registration quality $\varepsilon(V_e)$ using~\eqref{eq:valVertex} and the images superimposed in {\em step 3}\; } \vspace*{.6mm} % Store the six parameters of the vertex having the largest $\varepsilon(V_e)$ value in $D^{k-1,k}$, $\theta_1^{k-1,k}$, $\theta_2^{k-1,k}$, and $\theta_3^{k-1,k}$\; % \vspace*{0mm} % Fill matrix $\mathbf{T}_{3D}^{k-1,k}$ with the rigid transformation parameters computed from $D^{k-1,k}$, $\theta_1^{k-1,k}$, $\theta_2^{k-1,k}$, and $\theta_3^{k-1,k}$: see~\eqref{eq:matriceTrigideb}; \vspace*{0mm} % Fill matrix $\mathbf{T}_{2D}^{k-1,k}$ with the homography parameters corresponding to $\mathbf{T}_{3D}^{k-1,k}$. \end{algorithm*} \subsubsection{Similarity measure between $I_{k-1}$ and $\mathbf{T}_{2D}^{k-1,k}(I_{k})$ \label{sec:similarityMeasure}} The homography $\mathbf{T}_{2D}^{k-1,k}$ determined with \eqref{eq:Lien2D3DMatricielFinal} is now used to superimpose image $I_k$ on $I_{k-1}$. The hue being constant in bladder images \cite{Miranda2008}, the pixel values of $I_k$ and $I_{k-1}$ are converted into grey-levels for the registration step. As shown in~\cite{Hernandez:2010}, homologous features cannot be systematically extracted from the images due to blur, weak textures or lacking textures in some image parts. Therefore, iconic data are directly used to measure the similarity of the overlapping parts of $I_k$ and $I_{k-1}$. The mutual information, denoted by ${\cal MI}(I_{k-1},\mathbf{T}^{k-1,k}_{2D}(I_{k}))$, is a robust similarity measure \cite{Pluim:2003} which was successfully used for 2D bladder image mosaicing~\cite{Miranda2008}. This statistical measure is notably robust since it is computed with the whole pixels of the common regions of the superimposed images. The mutual information is defined from the grey-level entropies ${\cal H}(I_{k-1})$ and ${\cal H}(\mathbf{T}^{k-1,k}_{2D}(I_{k}))$ and the joint grey-level entropy ${\cal H}_J(I_{k-1},\mathbf{T}^{k-1,k}_{2D}(I_{k}))$ of source image $I_{k}$ and target image $I_{k-1}$: \begin{eqnarray} {\cal MI}\left(I_{k-1},\mathbf{T}^{k-1,k}_{2D}(I_{k})\right) = {\cal H}(I_{k-1}) + \nonumber \qquad \qquad \\ \qquad \qquad {\cal H}(\mathbf{T}^{k-1,k}_{2D}(I_{k})) - {\cal H}_J(I_{k-1},\mathbf{T}^{k-1,k}_{2D}(I_{k})) \label{eq:MutualInformation} \end{eqnarray} with \begin{align*} \left\{\begin{array}{l} {\cal H}(I_{k-1}) = -{\displaystyle\sum_{z_{k-1}} p(z_{k-1})\log p(z_{k-1})}\\ {\cal H}(\mathbf{T}^{k-1,k}_{2D}(I_{k})) = -{\displaystyle\sum_{ z_k} p(z_k)\log p(z_k)} \\ {\cal H}_J(I_{k-1},\mathbf{T}^{k-1,k}_{2D}(I_{k})) = \\ \qquad \quad -{\displaystyle\sum_{z_{k-1}}\sum_{z_k} p_J(z_{k-1},z_k)\log p_J(z_{k-1},z_k)}. \end{array} \right. \end{align*} The grey-levels $z_{k-1}$ and $z_k$ range in $[0, 255]$ because images are single-byte encoded. $p(z_{k-1})$ and $p(z_k)$ are the probability density functions of the overlapping parts of images $I_{k-1}$ and $\mathbf{T}_{2D}^{k-1,k}(I_{k})$ whereas $p_J(z_{k-1},z_k)$ is a joint probability density function. The mutual information is maximal when both images are registered, \emph{i.e.}, when $I_{k-1}$ is statistically correlated with $\mathbf{T}_{2D}^{k-1,k}(I_{k})$. \subsubsection{Registration algorithm\label{sec:simplex}} The mutual information is maximized with respect to the rotation angles $\theta_1^{k-1,k}$, $\theta_2^{k-1,k}$, $\theta_3^{k-1,k}$ and the translation parameter $D^{k-1,k}$ appearing in~\eqref{eq:matriceTrigideb}. The optimization task is done using the simplex algorithm \cite{Nelder:1965} since the cost function~\eqref{eq:MutualInformation} is non-differentiable. Because there are six unknowns, the simplex is composed of seven vertices $V_e$ (with $e \in \{1,\ldots,7\}$) lying in $\mathbb{R}^6$. The similarity measure \begin{align} \varepsilon(V_e) = {\cal MI}(I_{k-1},\mathbf{T}^{k-1,k}_{2D}(I_{k})) \label{eq:valVertex} \end{align} is computed for each vertex $V_e$, where the $\mathbf{T}_{2D}^{k-1,k}$ matrix deduces from $V_e$ as detailed in \S~\ref{sec:matrixrelationship}. At each iteration, the vertex of smallest $\varepsilon(V_e)$ value is replaced by a new vertex whose location in the parameter space is computed with the simplex symmetry rules. The angles and translations associated to the new vertex are used to determine the rigid transformation matrix, compute the related homography matrix, and then measure the image registration quality using~\eqref{eq:valVertex}. By repeating this process, the simplex vertices gradually converge towards the maximizer of \eqref{eq:MutualInformation}. The optimization principle is detailed in Algorithm \ref{alg:transformationDetermination}. The initial simplex size is experimentally set relative to the 25 images/s acquisition rate and the low cystoscope speed, leading to sub-millimetric translations and to rotations smaller than $1^{\circ}$ between two acquisitions. The universal initial simplex is built with 0.3 mm translations and $0.4^{\circ}$ rotation values: \begin{align} \begin{array}{lclccccr} V_1 & = & [\,0 & 0 & 0 & 0 &0 &0\,] \\ V_2 & = & [\,0.3 & 0 & 0 & 0 &0 &0\,] \\ V_3 & = & [\,0 & 0.3 & 0 & 0 &0 &0\,] \\ V_4 & = & [\,0 & 0 & 0.3 & 0 &0 &0\,] \\ V_5 & = & [\,0 & 0 & 0 & 0.4 &0 &0\,] \\ V_6 & = & [\,0 & 0 & 0 & 0 &0.4 &0\,] \\ V_7 & = & [\,0 & 0 & 0 & 0 &0 &0.4\,] \end{array} \label{eq:initialSimplex} \end{align} Each vertex gathers the three translation parameters (first three entries in $D$), and then $\theta_1$, $\theta_2$ and $\theta_3$. The iterative process of Algorithm~\ref{alg:transformationDetermination} is stopped when the mean displacement of the corners of image $I_k$ (displaced in the $I_{k-1}$ domain) becomes smaller than 0.1 pixel. When the optimization task is completed, the geometrical links between consecutive coordinate systems $\{c_{k}$\} and $\{c_{k-1}$\} and consecutive images ($I_k$, $I_{k-1}$) are fully defined by $\mathbf{T}^{k-1,k}_{3D}$ and $\mathbf{T}^{k-1,k}_{2D}$, respectively. \begin{figure*}[!t] \centering \begin{tabular}{c} \includegraphics[width=0.8\textwidth]{fig3a-eps-converted-to.pdf}\\ (a)\\ \includegraphics[width=0.8\textwidth]{fig3b-eps-converted-to.pdf}\\ (b) \end{tabular} \caption{Active vision prototype. (a) Principle of the structured-light prototype. The trajectory of the beam emitted by the laser source is precisely controlled by two mirrors. The adjustable mirror orientations ensure that the laser beam falls on the center of the diffractive lens. This lens projects eight laser rays onto the scene. The laser wavelength and power were set to 532 nm and 10 mW. The green color allows us to have a good contrast between the image textures and the green laser points. The 10 mW power was actually much too strong, therefore optical attenuators were used. The triangulation principle is sketched in Fig.~\ref{fig:2} and described in Section~\ref{sec:AcquisitionData}. The prototype (camera and projector) was calibrated using the generic method described in \cite{Ben-Hamadou:2013}. (b) Prototype corresponding to the sketch in (a). Mirrors 1 and 2 are fixed onto planar metal supports. The orientation of the planar supports is precisely set using three screws. The planar support and two screws are not visible for mirror 2.} \label{fig:3} \end{figure*} \subsection{Data mosaicing\label{sec:mosaicing}} The 3D laser points from all viewpoints $k$ have to be expressed in a common coordinate system. Choosing the camera coordinate system of the first acquisition, the points of viewpoint $k$ are displaced from $\{c_{k}$\} to $\{c_{1}$\} using the ``global'' (g) transformation matrix: \begin{equation} \mathbf{T}_{3D}^{k,g} = \prod_{j=2}^{k} \mathbf{T}_{3D}^{j-1,j} = \mathbf{T}_{3D}^{1,2} \times \mathbf{T}_{3D}^{2,3}\times \hdots \times \mathbf{T}_{3D}^{k-1,k}. \label{eq:discreteSurface} \end{equation} The whole set of points in $\{c_{1}$\} is then exploited to compute a 3D mesh with triangular faces representing the bladder surface~\cite{Kazhdan:2006}. Finally, the textures of images $I_k$ can be projected onto the 3D mesh. Specifically, the color of each triangular face in the 3D mesh is obtained by copying the color of the pixel in the first image of the video in which the triangular face can be seen. This simple choice could be improved using more involved strategies in order to reduce possible texture discontinuities in the 3D mosaic or to smooth the 3D surface by thin-plate interpolation. See \emph{e.g.}, \cite{Weibel2012b} in the 2D case. Similar to the 3D case, a 2D mosaic is built by taking the coordinate system of the first image as reference and using the global 2D matrices: \begin{equation} \mathbf{T}_{2D}^{k,g} = \prod_{j=2}^{k} \mathbf{T}_{2D}^{j-1,j} = \mathbf{T}_{2D}^{1,2} \times \mathbf{T}_{2D}^{2,3}\times \hdots \times \mathbf{T}_{2D}^{k-1,k}. \label{eq:2DMosaic} \end{equation} It has to be noticed that the green laser points cover a small surface in the images and are easy to segment since a simple thresholding of the H (hue) component in the HSV color space robustly separates the green laser points from the reddish or orange bladder epithelium pixels (see \cite{daul:2000} for a detailed description of the HSV color space family). Since images $I_k$ and $I_{k-1}$ include large common scene parts, the missing bladder textures in $I_{k-1}$ can be replaced in the mosaic by the homologous texture pixels of $I_k$. The correspondence between pixel textures hidden by laser dots in image $I_{k-1}$ and the corresponding visible texture pixels in image $I_k$ is given by homography $T_{2D}^{k-1,k}$. This correspondence is used to build 2D and 3D mosaics without laser dot pixels. \begin{figure*}[!t] \centering \begin{tabular}{ccc} \includegraphics[height=4.3cm]{fig4a-eps-converted-to.pdf}& \includegraphics[height=4.3cm]{fig4b-eps-converted-to.pdf}& \includegraphics[height=4.3cm]{fig4c-eps-converted-to.pdf}\\ (a)&(b)&(c) \end{tabular} \caption{Three real phantoms. The planar phantom (a) is used to assess the accuracy of the 3D registration algorithm. The half cylinder~(b) and wave~(c) phantoms allow us to evaluate the ability of the registration method to construct convex and nonconvex surface parts, respectively.} \label{fig:4} \end{figure*} \section{Quantitative results for prototype data \label{sec:ProtoResultsDiscussion}} The goal of this section is to validate on real data that the mosaicing approach of Section~\ref{sec:3Dmosaicing} indeed leads to coherent surface construction results. To do so, an active vision prototype is first proposed. Then, 3D mosaicing results are presented for data acquired with the prototype using three real phantoms, on which pig bladder texture images were stuck. This allows for a first quantitative assessment of the mosaicing accuracy based on ground truths. As mentioned before, our prototype cannot be used in clinical situations yet. It was rather designed for validation of the structured-light approach in combination with a cystoscope and to show the feasibility of 3D cartography. The applicability to clinical situations will be further discussed in Sections~\ref{sec:SimulatedDataResultsDiscussion} and \ref{sec:Conclusion} together with complementary tests on realistic simulated data. \subsection{Prototype and test phantom description \label{sec:ProtoPhantomDescription}} Our active vision prototype is illustrated in Fig.~\ref{fig:3}. The acquisition channel consists of a Karl Storz cystoscope, and the image sequences are acquired with a Basler scout model camera. The image resolution is 768 $\times$ 576 pixels. The diffractive lens is fixed nearby the wide FOV lens of the cystoscope distal tip. The principle of the laser ray projection is sketched in Fig.~\ref{fig:3}(a). This prototype uses the triangulation principle described in Section~\ref{sec:AcquisitionData} and has a geometry equivalent to that of Fig.~\ref{fig:2}(a). The baseline (distance between the camera and projector optical centers, see Fig.~\ref{fig:3}(a)) available for triangulation is about 3 mm. The laser projector wavelength is equal to 520 nm, and the 10 mW power should be adapted for further clinical deployment. High resolution images of an incised and flattened pig bladder were acquired to simulate human bladder textures (see Fig.~\ref{fig:4}(b)). The images were printed on paper sheets and stuck on surfaces with various shapes. First, the planar surface of Fig.~\ref{fig:4}(a) is used to test the 3D mosaicing algorithm. Here, the underlying assumption in the proposed algorithm is perfectly fulfilled: the surfaces viewed in consecutive images are planar. Then, the half cylinder of Fig.~\ref{fig:4}(b) is used to simulate a convex surface. The half cylinder has a radius of 35 mm and allows for simulating a plausible bladder curvature in the direction orthogonal to the main cylinder axis (a non-warped bladder can be approximately thought of as an ellipsoid with a major axis from 80 to 100 mm and minor axes from 30 to 40 mm). The bladder is in contact with other organs is often warped. In this case, the surface includes concave parts due to troughs in the organ wall. As shown in Fig.~\ref{fig:4}(c), a wave phantom was built to simulate warped bladder parts with troughs between waves. The length of the wave (a period of the phantom) is 40 mm and the wave depth (from the trough to the crest of the wave) is 20 mm. This phantom simulates extreme situations since consecutive troughs of large magnitude never arise in practice. All phantoms are positioned and displaced relative to the endoscope prototype using a micrometric positioning table to generate ground truth 3D transformations. \begin{figure*}[!t] \centering \includegraphics[width=0.7\linewidth]{fig5-eps-converted-to.pdf} \caption{Plane construction results. Bottom: 2D mosaic. The green arrows refer to the 8 laser point displacements (constant translation, no rotation) throughout image acquisition. Center: 3D points placed in the common coordinate system $(O_{c_1}, \protect\overrightarrow{x_{c_1}}, \protect\overrightarrow{y_{c_1}}, \protect\overrightarrow{z_{c_1}})$. Top: related mesh with triangular faces on which the 2D mosaic image can be projected.\label{fig:5}} \end{figure*} \subsection{Point reconstruction accuracy and surface construction results \label{sec:ResultsRegisMosaics}} Once the prototype has been calibrated with the method described in~\cite{Ben-Hamadou:2013}, 3D point reconstruction is performed in the local camera coordinate system $\{c_k\}$, and $M=8$ $P_{3D}^{i,k}$ points are then available per viewpoint $k$. In order to evaluate the laser point reconstruction accuracy, a first data acquisition was carried out using the wave phantom. The cystoscope axis was held orthogonal to the translation plane and $K=200$ images were acquired with 1 mm translation steps. The range of $z_{c_k}$-values that were found (in between 20 and 40 mm) for the $P_{3D}^{i,k}$ points matches the wave height, equal to 20 mm. It was further verified that for prototype distal tip-to-surface distances ranging from some millimeters to 5 centimeters, the average reconstruction error on the $z_{c_k}$ coordinate (depth) is close to 0.5 mm and remains submillimetric for all points. When normalizing this 3D reconstruction error by the tip-to-surface distance, the errors are always lower than $3~\%$. This accuracy is by far sufficient for bladder surface mosaicing since the constructed surface shape must only be representative of the organ wall (a precise dimensional measure does not make sense in urology). In the following surface construction tests and without loss of generality, the phantoms were displaced in front of the fixed prototype. This is in contrast with the setup of Section~\ref{sec:3Dmosaicing}, where the instrument is moving inside the organ. However, it is easy to see that the proposed mosaicing algorithm remains valid and unchanged in both settings whatever the moving object (surface or instrument). The simultaneous 2D and 3D data mosaicing results are illustrated in Fig.~\ref{fig:5} for the planar phantom. Here, 100 images were acquired for 99 constant translations of 0.3 mm (with the three components of $D^{k-1,k}$ different from 0) and without 3D rotations. Thus, the magnitude of 3D displacements is equal to: \begin{align} \|D^{k-1,k}\|=0.3 \label{eq:criterionTranslations} \end{align} where $\|\,.\,\|$ stands for the Euclidean norm. \begin{figure*} \centering \psfig{figure=fig6-eps-converted-to.pdf, width=0.8\linewidth} % \caption{Wave construction results. Center: 3D points placed in the common camera coordinate system $(O_{c_1}, \protect\overrightarrow{x_{c_1}}, \protect\overrightarrow{y_{c_1}}, \protect\overrightarrow{z_{c_1}})$ and representing 2.5 wave periods in the phantom of Fig.~\ref{fig:4}(c). Top: mesh surface reconstructed from the first 100 acquisitions (zoom in rectangle). Bottom: textured surface corresponding to the first 100 acquisitions. The cystoscope prototype is roughly oriented along the $\protect\overrightarrow{z_{c_1}}$ axis. The local phantom surface corresponding to the left edge of the zoom in rectangle is the most distant from the camera in contrast with the local surface related to the right edge.\label{fig:6}} \end{figure*} The average translation magnitude and standard deviation computed with the registration algorithm for the 99 consecutive image pairs are 0.27 $\pm$ 0.015 mm, whereas the angles $\theta_1^{k-1,k}$, $\theta_2^{k-1,k}$ and $\theta_3^{k-1,k}$ indeed tend towards $0^{\circ}$. So, the average magnitude of displacement is slightly underestimated with respect to the ground truth (0.3 mm), whereas the $0.015$ mm standard deviation value is very low. These results are a first indication that the nature (translation) of the displacement can be successfully determined using the registration algorithm. Fig.~\ref{fig:5} confirms that accurate results are obtained for the planar phantom. The 2D mosaic built from the estimated $\mathbf{T}_{2D}^{k-1,k}$ homographies is visually coherent, \emph{i.e.}, without texture discontinuities between images. In the textured image of Fig.~\ref{fig:5}, the green arrows represent the trajectory of the eight laser points throughout the video-image acquisition. As could be expected, these trajectories are affine because the camera movement is a pure translation. The 3D points, placed in the common coordinate system $\{c_{1}$\}, all lie on a plane. The constructed mesh with triangular faces is displayed in the top image of Fig.~\ref{fig:5}. \begin{figure*} \begin{tabular}{cc} \setlength{\tabcolsep}{0.05cm} \begin{tabular}{c}\includegraphics[width=10cm]{fig7a-eps-converted-to.pdf}\end{tabular}& \begin{tabular}{c}\includegraphics[width=6cm]{fig7b-eps-converted-to.pdf}\end{tabular}\\ (a)&(b) \end{tabular} \caption{Half cylinder reconstruction results. (a)~3D points placed in the global coordinate system $\{c_{1}$\}. Their locations are consistent with the trajectories sketched in green on the half cylinder phantom~(b). Each green curve represents the trajectory of two very close laser points.} \label{fig:7} \end{figure*} In the following surface construction tests, we aim to address a case where the geometrical link between the surfaces in the FOV of two images is not exactly an homography (working assumption of the 3D registration algorithm) since the local surfaces are not planar anymore. The data of Fig.~\ref{fig:6} were acquired for the wave phantom with the same displacements as before: acquisition of $K=360$ images for 359 constant translations of 0.3 mm and without any rotation. For this phantom, the local surface orientation with respect to the cystoscope optical axis strongly varies throughout the sequence. To quantify the algorithm accuracy, we used again criterion~\eqref{eq:criterionTranslations}. The average magnitude of the 3D translations computed with the registration algorithm for consecutive image pairs is $0.29 \pm 0.03$ mm, and $\theta_1^{k-1,k}=\theta_2^{k-1,k}=\theta_3^{k-1,k} \approx 0^{\circ}$. The magnitude of translations (0.29 mm) is very close to the true average displacement (0.3 mm) whereas the related standard deviation (0.03 mm) remains very close to the ideal zero value. These results show that the translation of the cystoscope prototype can be successfully determined for non-planar surfaces and for varying angles between the local surface and the cystoscope optical axis. The variation of this angle combined with changes of phantom-to-camera distances (see Fig.~\ref{fig:6}) impact the perspective ($a_{3,1}^{k-1,k}$ and $a_{3,2}^{k-1,k}$), shearing ($s_x^{k-1,k}$ and $s_y^{k-1,k}$), and scale ($\alpha^{k-1,k}$) parameters, see~\eqref{eq:matriceHomography}. The blue points in Fig.~\ref{fig:6} represent again the 3D laser points placed in the common coordinate system $(O_{c_1}, \overrightarrow{x_{c_1}}, \overrightarrow{y_{c_1}}, \overrightarrow{z_{c_1}})$. The 360 viewpoints correspond to 2.5 wave periods, \emph{i.e.}, a length of 100 mm. Qualitatively, the global surface indeed corresponds to waves although after 1.5 wave period, the wave surface bends itself instead of remaining straight. However, the results are satisfactory since a wave period represents an organ pushing against the bladder (\emph{e.g.}, a trough), and two or three consecutive troughs are an extreme situation never arising for cystoscopic data. In Fig.~\ref{fig:7}, the cystoscope prototype was approximately held at a 30 mm distance from the half cylinder surface (of radius 190 mm) during the acquisition of 130 images. The surface covered by the cystoscope corresponds to a circular arc of aperture $130^\circ$. The displacements between consecutive acquisitions $k-1$ and $k$ mainly consist of $1^\circ$ rotations around $\overrightarrow{x_{c_1}}$ combined with small translations and rotations around $\overrightarrow{y_{c_1}}$ and $\overrightarrow{z_{c_1}}$. Fig.~\ref{fig:7} shows that the reconstructed points indeed lay on a cylindrical surface. The depth of the cylinder part was used to quantify the surface construction accuracy. Ideally, the dashed line in Fig.~\ref{fig:7}(a) should circumscribe an arc of aperture $130^\circ$. The real depth of the cylinder part corresponding to the $130^\circ$ phantom aperture is 25 mm, whereas the depth computed from the reconstructed data is 21 mm. This error does not alter the visual quality of the surface representation: the phantom shape is indeed cylindrical and no dimensional analysis is required. \subsection{Overview of the results related to prototype data \label{sec:DiscussionProtoDataResults}} The results obtained so far are a first validation that the prototype displacement (\emph{i.e.}, the displacement of the camera coordinate system in between two acquisitions) can be recovered using only the video-image and 8 laser points per acquisition. Indeed, for both phantom types, the deviation of the estimated 3D displacement from the ground truth is small. {\em - Local surface planarity.} Planarity is one of the main differences between the plane and wave phantoms. Indeed, the planar assumption (made for registering two images using an homography) is not fulfilled anymore for the surface parts of the wave. We found that the camera displacements were computed with similar accuracy for both planar and non-planar surfaces. It was already proved in the frame of 2D bladder mosaicing that image registration with homographies is accurate even for regions where the bladder is non-planar~\cite{Weibel:2012a} or contains lesions such as polyps~\cite{Hernandez:2010}. The results of \S~\ref{sec:ResultsRegisMosaics} indicate that homographies linking 2D images are appropriate as well for 3D mosaicing. {\em - 3D point reconstruction accuracy.} Inaccurate 3D laser point reconstruction impacts the precision of 3D camera displacement estimation. The results obtained with real phantoms show that 3D point reconstruction is accurate enough to enable camera motion assessment and 3D mosaicing, even for active vision prototypes having small baselines (3 mm here). {\em - Cystoscope axis orientation.} For tests with wave phantoms, the angle between the cystoscope optical axis and the normal to the local surface is varying: at extreme points (points of minimum or maximum depth) of the wave, the angles are small ($\approx 0^\circ$), whereas for medium points, their value is maximum ($45^{\circ}$). The accuracy of the reconstructed camera displacement is not strongly impacted by the variation of angles. The tests with the plane and wave phantoms involved 3D translations, whereas the viewpoint changes arising in the half-cylinder experiment combined both rotations and translations. In the latter case, no ground truth displacements were available. However, the cylinder depth that was estimated for an $130^\circ$ aperture shows that the surface shape can be accurately recovered. In all tests, images were acquired for a distal tip-to-surface distance ranging from 10 to 40 mm and for surface areas of one to several square centimetres. These dimensions are consistent with real bladder image acquisitions in terms of acquisition distance variation and size of the area viewed in images. For this distance interval, the laser points were systematically visible in the images, and their position could then be reconstructed in the camera coordinate system. \begin{figure}[!t] \centerline{\includegraphics[width=0.8\linewidth]{fig8-eps-converted-to.pdf}} \caption{Simulated bladder volume and simulation of video sequence acquisition with known 3D endoscope displacements. The cone corresponds to the field of view of the camera for one viewpoint. The green dashed curve refers to the trajectory of the virtual cystoscope. The simulated video sequence then contains images related to both convex and nonconvex parts of the virtual bladder. } \label{fig:8} \end{figure} \begin{figure*}[!t] \centering \begin{tabular}{ccc} \includegraphics[width=0.3\linewidth]{fig9a-eps-converted-to.pdf} & \includegraphics[width=0.3\linewidth]{fig9b-eps-converted-to.pdf} & \includegraphics[width=0.3\linewidth]{fig9c-eps-converted-to.pdf} \\[.2cm] (a)&(b)&(c) \end{tabular} \caption{Extraction of an image from each of the three simulated video-sequences. (a) Image with weakly contrasted texture. (b) Image with highly contrasted vessels. (c) Image with blurry texture.} \label{fig:9} \end{figure*} \section{Results for realistic simulated data \label{sec:SimulatedDataResultsDiscussion}} The results presented so far are a first validation of the feasibility of 3D bladder mosaicing. However, similar to the contributions of Soper \emph{et al}~\cite{Soper2012} and Shevchenko \emph{et al}~\cite{Shevchenko:2012}, the method was not tested on patient data (our active vision prototype was not built for patient data acquisition at this stage). In this section, realistic bladder data are simulated to perform complementary mosaicing tests. Not only the bladder volume and texture are closer to human data, but also the simulated endoscope trajectory can be controlled to reproduce all types of cystoscope displacements. \subsection{Simulation of textured bladder data} To simulate a more realistic bladder shape, we considered a (convex) oval volume whose width, height and depth are equal to 110, 100, and 70 mm, respectively (the standard capacity/volume of the bladder ranges in between 400 and 600 ml). The ovoid was then locally deformed to create a nonconvex surface part. This surface, illustrated in Fig.~\ref{fig:8}, was defined in agreement with the Institut de Canc\'erologie de Lorraine. Human bladder textures were extracted from large FOV mosaics built using 2D mosaicing algorithms \cite{Miranda2008,Weibel:2012a}. Three such mosaics were considered (see Fig.~\ref{fig:1}) and mapped on the inner wall of the simulated 3D bladder surface. Blender (a 3D graphics modeling and rendering software~\cite{blender:2014}) was used to simulate the camera and the laser projector while reproducing the geometrical configuration of our prototype. Such 3D representation can be found in Fig.~\ref{fig:8}. Both camera and laser projector parameters (calibrated using~\cite{Ben-Hamadou:2013}) are handled. Moreover, Blender allows us to simulate complex cystoscope trajectories combining rotations and translations. Similar to clinical examinations, the distance between the cystoscope distal tip and the surface is changing. The resulting area seen in images varies from 1 to a few square centimeters. Fig.~\ref{fig:9} displays a sample of the simulated video-sequences obtained for each of the three numerical phantoms using the 3D surface of Fig.~\ref{fig:8}. Each image sequence includes 120 images and covers $24$ cm$^2$ of the phantom surface. Importantly, the texture variability is large from one video-sequence to another. \begin{figure*} \centering { \setlength{\tabcolsep}{-0.2cm} \begin{tabular}{ccc} \includegraphics[width=0.36\textwidth]{fig10a-eps-converted-to.png} & \includegraphics[width=0.36\textwidth]{fig10b-eps-converted-to.png} & \includegraphics[width=0.36\textwidth]{fig10c-eps-converted-to.png} \\[-.4cm] (a)&(b)&(c)\\[.4cm] \includegraphics[width=0.36\textwidth]{fig10d-eps-converted-to.png} & \includegraphics[width=0.36\textwidth]{fig10e-eps-converted-to.png} & \includegraphics[width=0.36\textwidth]{fig10f-eps-converted-to.png} \\[-.4cm] (d)&(e)&(f) \end{tabular} } \caption{Results obtained for the three numerical phantoms related to Fig.~\ref{fig:9}(a,b,c). Top: constructed 3D point cloud (in black) and cystoscope trajectory (magenta curve). The point cloud is displayed along with the ground truth surfaces (grey mesh) to visually assess their overlapping quality. The green dashed curve refers to the ground truth cystoscope trajectory. For readability reasons, the meshed surface generated from the reconstructed 3D points is not shown. Bottom: 3D reconstructed mosaics seen from above (for improved readability). } \label{fig:10} \end{figure*} \subsection{Surface construction results for the simulated data \label{sec:ResNumericalPhantoms}} The proposed 3D mosaicing method was applied to the three simulated data sequences. Fig.~\ref{fig:10}(a,b,c) displays the cloud of reconstructed points $P_{3D}^{i,k}$ for each sequence in the common coordinate system $\{c_1\}$ together with the trajectory of the optical center of the cystoscope prototype (the computed trajectory appears in magenta). The textured surfaces generated from the cloud of 3D points can be found in Fig.~\ref{fig:10}(d,e,f). The surface construction accuracy is assessed by computing the average Euclidean distance between the reconstructed 3D points in $\{c_1\}$ and their ground truth locations on the phantom surface. These distances are ideally equal to 0. The numerical errors obtained for the three phantoms are 0.79$\pm$0.34 mm, 0.78$\pm$0.33 mm, and 0.80$\pm$0.34 mm, respectively. On Fig. \ref{fig:10}, it is noticeable that the shape of the reconstructed surface part (containing the black points) is visually consistent with that of the true surface (grey mesh). The mean error is small ($<1$ mm), confirming that the reconstructed extended FOV surfaces remain accurate for both convex and nonconvex surface parts. \begin{table*}[t!] \begin{center} \begin{tabular}{lccccc} \hline {\bf Phantom} & Planar phantom & Wave phantom & First numerical & Second numerical & Third numerical \\ \vspace*{1mm} {\bf type} & (Fig.~\ref{fig:5}) & (Fig.~\ref{fig:6}) & phantom (Fig.~\ref{fig:10}(a)) & phantom (Fig.~\ref{fig:10}(b)) & phantom (Fig.~\ref{fig:10}(c)) \\ \cline{2-6} {\bf Mean} $\epsilon_{3D}^{k-1,k}$ & 0.016$\pm$0.002 & 0.05$\pm$0.01 & 0.021$\pm$ 0.0023 & 0.023$\pm$ 0.0025& 0.023$\pm$0.0027 \\ \cline{2-6} {\bf Mean} $\epsilon_{2D}^{k-1,k}$ & $0.30\pm$0.29 & 0.85$\pm$0.8 & 0.40$\pm$0.39 & 0.42$\pm$0.37 & 0.43$\pm$0.39 \\ \hline \end{tabular} \caption{Registration errors for five phantoms. The mean (over $k$) and standard deviation ($mean \pm std$) of criteria $\epsilon_{3D}^{k-1,k}$ and $\epsilon_{2D}^{k-1,k}$ are in millimetres and pixels, respectively. \label{Tab:RegistrationError}} \end{center} \end{table*} \subsection{Discussion on the simulated data results} Several conclusions can be drawn. First, the bladder surface of Fig.~\ref{fig:8} was accurately constructed for video-sequences containing various human textures. Second, the average 3D error remains small (less than 1 mm) in all cases. The proposed algorithm was also able to deal with the pig bladder textures (shown in Section~\ref{sec:ProtoResultsDiscussion}), which is another indication of its robustness against bladder texture variations. The use of mutual information as a similarity measure is the main reason behind this robustness. For long video sequences, it may occur that the 3D points $P_{3D}^{i,k}$ substantially diverge from the ground truth surface. This is due to the accumulation of 3D registration errors over the sequence. Error accumulation is a common issue when 2D or 3D transformations between consecutive frames are sequentially estimated. This problem was already encountered for 2D mosaicing algorithms, and efficient solutions were proposed, based on a global texture discontinuity correction over the processed image sequence~\cite{Weibel:2012a}. \section{Assessment of registration accuracy} \label{sec:3DRegistrationError} The quantitative results of Sections \ref{sec:ResultsRegisMosaics} and \ref{sec:ResNumericalPhantoms} are respectively related to the accuracy of the endoscope displacement and surface estimation. This section focusses on the registration accuracy between viewpoints. \subsection{Registration accuracy criteria} In~\eqref{eq:3DRegistrationCriterion}, $\epsilon_{3D}^{k-1,k}$ defines the 3D registration error compu\-ted with the known ground truth transformation $\mathbf{T}_{3D,gt}^{k-1,k}$ and the transformation $\mathbf{T}_{3D}^{k-1,k}$ estimated with the proposed registration algorithm. Criterion $\epsilon_{3D}^{k-1,k}$ computes the mean Euclidean distance in millimetres between the exact and estimated locations of points $P_{3D}^{k,i}$, displaced in the coordinate system $\{c_{k-1}\}$ of viewpoint $k-1$: \begin{align} \epsilon_{3D}^{k-1,k} = \frac{1}{N}\sum_{i=1}^{N}\left \| \hat{P}_{3D,gt}^{i,k-1}-\hat{P}_{3D}^{i,k-1} \right \| \label{eq:3DRegistrationCriterion} \end{align} where the displaced locations are respectively denoted by $\hat{P}_{3D,gt}^{i,k-1}$ and $\hat{P}_{3D}^{i,k-1}$. They are computed from $\hat{P}_{3D}^{i,k}$ using the ground truth and estimated transformations $\mathbf{T}_{3D,gt}^{k-1,k}$ and $\mathbf{T}_{3D}^{k-1,k}$; see~\eqref{eq:matriceTrigidea}. Ideally, $\epsilon_{3D}^{k-1,k}$ equals 0. Similarly, in~\eqref{eq:2DRegistrationCriterion}, criterion $\epsilon_{2D}^{k-1,k}$ computes the mean Euclidean distance in pixels between the projections in image $I_{k-1}$ of the displaced 3D points $\hat{P}_{3D,gt}^{i,k-1}$ and $\hat{P}_{3D}^{i,k-1}$: \begin{align} \epsilon_{2D}^{k-1,k} \hspace*{-.11cm}=\hspace*{-.11cm}\frac{1}{N}\sum_{i=1}^{N}\left \|\frac{1}{\hat{z}_{3D,gt}^{i,k-1}} \mathbf{K}\hat{P}_{3D,gt}^{i,k-1}-\frac{1}{\hat{z}_{3D}^{i,k-1}} \mathbf{K}\hat{P}_{3D}^{i,k-1}\right \| \label{eq:2DRegistrationCriterion} \end{align} $\mathbf{K}\hat{P}_{3D,gt}^{i,k-1}/\hat{z}_{3D,gt}^{i,k-1}$ and $\mathbf{K}\hat{P}_{3D}^{i,k-1}/\hat{z}_{3D}^{i,k-1}$ gather the coordinates in pixel unit of the ground truth and estimated point locations, where $\mathbf{K}$ is the projective matrix coding for the intrinsic camera parameters; see~\eqref{eq:matricePerspective}. Ideally, $\epsilon_{2D}^{k-1,k}$ also equals 0. \subsection{Registration results and accuracy discussion} Table \ref{Tab:RegistrationError} gives the registration errors, \emph{i.e.}, the mean and standard deviation of the $\epsilon_{3D}^{k-1,k}$ and $\epsilon_{2D}^{k-1,k}$ values computed with the data of viewpoint pairs ($k-1$, $k$) for five phantoms. The results obtained for the planar phantom correspond to the inherent accuracy of the algorithm (best possible registration results obtained with the planarity assumption perfectly fulfilled). The mean (0.016 mm) and standard deviation (0.003 mm) of the $\epsilon_{3D}^{k-1,k}$ values show that in such ideal situation, the 3D registration errors between viewpoints are indeed very small. The 2D sub-pixel registration error is $\epsilon_{2D}^{k-1,k}=0.30\pm0.29$ pixels for the planar phantom. The planarity assumption is not fulfilled for the wave phantom: the field of view of the images is wide and visualizes large wave parts whose surfaces strongly deviate from a planar shape. In such an extreme situation, the mean registration error remains small (0.05 mm). Due to these small 3D registration errors, the surface in Fig.~\ref{fig:6} has a correct global wave shape. Moreover, when scanning the wave surface, the angle between the 3D cystoscope prototype and the normal to the local surface takes values ranging in the whole interval [0-45] degrees. The small standard deviation of criterion $\epsilon_{3D}^{k-1,k}$ ($0.01$ mm) indicates that the registration algorithm is robust towards changes of viewing angle. The mean of the 2D registration error (0.85 pixels) remains also small. The 2D and 3D registration errors are quite close for all three numerical phantoms. The unique difference in the three numerical phantoms was the human bladder texture used for the data acquisition simulations (the surface shape and cystoscope trajectory was the same for all simulations). These results show that the registration algorithm is robust towards human bladder texture variability (the mutual information based similarity measure systematically led to comparable registration accuracy). The $\epsilon_{3D}^{k-1,k}$ errors measured for the simulated phantoms are always larger than the $\epsilon_{3D}^{k-1,k}$ score obtained for the planar phantom (most favorable situation) and smaller than the $\epsilon_{3D}^{k-1,k}$ score for the wave phantom (most difficult situation). This is consistent with the fact that the phantom of Fig.~\ref{fig:5} is exactly planar, the wave phantom is highly non-planar, whereas the degree of planarity of the numerical phantoms is intermediate. We would like to stress that the $\epsilon_{3D}^{k-1,k}$ and $\epsilon_{2D}^{k-1,k}$ scores obtained for the simulated phantoms are significantly closer to the error obtained for the plane rather than those of the wave phantom. This is an indication of the ability of the algorithm to reconstruct bladder shapes. \section{Conclusion\label{sec:Conclusion}} The proposed 3D bladder mosaicing algorithm is guided by 2D image registration. One advantage of the proposed approach is that no strong assumption is made on surface shapes. On the one hand, the choice of some initial surface shape is not required. On the other hand, smooth surfaces with both convex and nonconvex parts can be accurately constructed, the latter corresponding to warped bladder parts. Furthermore, the results obtained for pig bladder data and human bladder images highlight the robustness of the approach, since the mutual information based registration can cope with high texture variability. An important feature of our endoscope prototype is that the triangulation geometry for 3D data acquisition and the baseline length of 3 mm are very close to those of the 3D cystoscopes which might be built for clinical use. A current trend in endoscopy is the ``chip on the tip'' technology (\emph{i.e.}, sensors fixed on the distal tip of endoscopes). In this technology, the laser based solution can be used for both rigid and flexible cystoscopes (both the CCD matrix and the diffractive optics can be fixed on the distal tip): the calibration procedure described in \cite{Ben-Hamadou:2013} and the mosaicing algorithm proposed here remain unchanged. For rigid cystoscopes, the calibration and 3D point reconstruction methods are the same for different lens orientations ($0^\circ$ straight looking lens, $30^\circ$ forward-oblique looking lens or $70^\circ$ lateral looking lens). Except for the optics to be implemented on the cystoscope for 3D point reconstruction, the modifications to be done for clinical translation are rather light. This is a key advantage over alternative solutions which rely on external devices~\cite{Shevchenko:2012,Agenant:2013}. This should lead to a drastic reduction of the overall cost of cystoscopy equipment together with a simplification of the technical installations in the examination rooms. Actually, the ``chip on the tip'' technology should allow us to simplify the prototype in future years: the cylindrical tube of Fig.~\ref{fig:3} cannot be used in clinical situations, and it will not be used anymore. Prior to the construction of a 3D cystoscope usable in clinical situation, it was required to validate both the measurement principle and the mosaicing algorithm on phantoms. Our work is the first which shows on phantoms with realistic bladder textures that 3D cystoscopy and mosaicing is feasible while minimally modifying standard endoscopes. This result is an important step in the process towards clinical 3D cystoscopy. The proposed mosaicing algorithm may be improved in several situations. \indent 1) When cystoscope trajectories are crossing, texture and 3D surface misalignments will be visible in the mosaic due to small error accumulation during the mosaicing process. Such crossings have to be automatically detected so that the surface, texture and color discontinuities can be corrected. Global 2D mosaic correction methods (such as the one proposed in~\cite{Weibel:2012a}) may be adapted to improve the visual quality of 3D textured surfaces, but such approaches will not improve the 3D mosaics from the dimensional (accuracy) point of view. 2) It was shown in recent studies \cite{Ali16b,Ali16a} that optical flow can provide an accurate dense correspondence between homologous points of bladder images with strong illuminations variations, large displacements or perspective changes, blur or weak textures. Thus, a perspective of this work is to elaborate an optical flow method with energies allowing for simultaneous optimization of the vector field and the parameters of the transformation $T_{3D}^{k-1,k}$. 3) The implementation of our algorithm may be improved as well in specific cases. When texture features are available and well spread over the images, they can be fastly detected \cite{Ali:2013}. Then, the distance between homologous texture points can be used as a similarity measure for a given $\mathbf{T}_{2D}^{k-1,k}$, instead of the mutual information in (14). When textures are lacking as in Fig.~\ref{fig:1}, the mutual information has to be used. Second, the processing time can obviously be reduced by replacing the sequential implementation of image registration (viewpoints $k-1$ and $k$ for $k=1,2,\ldots$) by a parallel implementation \emph{e.g.}, on a GPU graphical card. By coupling fast implementations with future clinical endoscopes based on the current proof-of-concept, we expect that the image processing time will remain moderate as compared to the times for acquiring images, for file transfers, and for archiving and retrieving data. The registration algorithm was designed for bladder lesion diagnosis. It can be adapted to minimal invasive surgery in the abdominal cavity, \emph{e.g.}, for computing extended FOV surfaces of the stomach. Indeed, the external stomach wall is smooth and contains textures close to bladder textures. Moreover, a laparoscope associated to a structured-light projector can be calibrated similar to a cystoscope. Increasing the FOV and providing 3D information facilitates a surgical intervention. For this application, real-time mosaicing must be reached. \begin{acknowledgements} This work was sponsored by the R\'egion Lorraine and the Centre National de la Recherche Scientifique (CNRS) under contract PEPS Biotechno et Imagerie de la Sant\'e. The authors would also like to thank the Centre Hospitalier Universitaire Nancy-Brabois for providing pig bladders and Prof. Fran\c{c}ois Guillemin from the Institut de Canc\'erologie de Lorraine for his expertise in urology. \end{acknowledgements} \bibliographystyle{spmpsci}
{'timestamp': '2016-07-19T02:04:58', 'yymm': '1607', 'arxiv_id': '1607.04773', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04773'}
arxiv
\section{Introduction} Let $X_{1},X_{2},....$ be a sequence of independent random variables with common distribution function $F$ and for each integer $n\geq 1$, let X_{1,n}\leq ...\leq X_{n,n}$ denote the order statistics based on the first n$ of these random variables. Cs\"{o}rg\H{o} and Mason (1985, 1986) have recently shown among other results that if \begin{equation} 1-F(x)=L^{\ast }(x)x^{-a}\text{ }as\text{ }x\longrightarrow \infty, \label{r1} \end{equation} \noindent where $L^{*}$ is a slowly varying function at infinity and $a\geq 2$, or if $F$ has exponential-like upper tails, meaning \begin{equation} \int_{x}^{+\infty }(1-F(y))dy/(1-F(x))\rightarrow c\text{ }as\text{ x\longrightarrow \infty , \label{r2} \end{equation} \noindent where $0<c<+\infty$, then for any sequence of integers satisfying \begin{equation*} 1\leq k_{n}\leq n,\text{ }k_{n}\rightarrow +\infty \text{ }and\text{ }k_{n}/n\rightarrow 0\text{ }as\text{ }n\rightarrow +\infty, \tag{K} \end{equation*} \noindent there exist sequences $A_{n}>0$ of normalizing constants and $C_{n}$ of centering constants such tha \begin{equation} A_{n} \left(\sum_{i=1}^{k_{n}}X_{n-i+1n}-C_{n}\right)\overset{d}{\longrightarrow }N(0,1 \text{ }as\text{ }n\rightarrow +\infty. \label{r3} \end{equation} \noindent The case \eqref{r1} is contained in the theorem of Cs\"{o}rg\H{o} and Mason (1986) and the case \eqref{r2} is Theorem 1.5 of Cs\"{o}rg\H{o} and Mason (1985). An application of Theorem 2.4.1 of de Haan (1970) (Lemma \ref{l1} below) combined with Fact 1.4 of Cs\"{o}rg\H{o} and Mason (1985) shows that \eqref{r2} implies the existence of sequences of normalizing constants $a_{n}$ and centering constants $b_{n}$, such that \begin{equation} a_{n}^{-1}(X_{n,n}-b_{n})\overset{d}{\longrightarrow }G\text{ }as\text{ n\rightarrow +\infty , \label{r4} \end{equation} \noindent where $G$ is a Gumbel random variable with distribution functio \begin{equation*} P(G\leq x)=\exp (-e^{-x})\text{ for }-\infty <x<+\infty . \end{equation*} \noindent Whenever such sequences of constants can be chosen so that \eqref{r4} holds, we say that $F$ is in the domain of attraction of a Gumbel law, written F\in D(\Lambda)$.\\ \noindent One of the purposes of this note is to show that \eqref{r3} holds more generally than under condition \eqref{r2}, that is, $F\in D(\Lambda)$ is sufficient for \eqref{r3} to hold. This will be a consequence of our main results stated in the next section. We shall also obtain some further extensions of the results of Cs\"{o}rg\H{o} and and Mason. The proofs are given in Section \ref{sec3}.\\ \section{Statement of main results} \label{sec2} First we introduce some notations. Let \begin{equation*} Q(s)=inf\{x:F(x)\geq s),\text{ for }0<s\leq 1, \end{equation*} \bigskip \noindent with $Q(0)=Q(0+)$, denote the inverse or quantile function of $F$. Write \begin{equation*} \sigma ^{2}=\int_{1-s}^{1}\int_{1-s}^{1}(\min (u,v)-uv)dQ(u)dQ(v),\text{ for }0\leq s\leq 1. \end{equation*} \noindent For any $0<\beta <\infty $, set \begin{equation*} c(s,\beta )=s^{-\beta }\int_{1-s}^{1}(1-u)^{\beta }dQ(u),\text{ for }0\leq s\leq 1. \end{equation*} \noindent For convenience, when $\beta =1$, we set $c(s)=c(s,1)$. (Refer to the next section for our integral convention).\\ \noindent Let $D^{\ast }(\Lambda )$ denote the subclass of $D(\Lambda )$ consisting of all distribution functions $F$ whose quantile function $Q$ satisfie \begin{equation*} Q(1-s)=a+\int_{s}^{1}u^{-\beta }r(u)du, \end{equation*} \noindent for all $s\geq 0$ sufficiently small, $a$ is a fixed constant and $r$ is a strictly positive function slowly varying at zero. The fact that $D^{\ast }(\Lambda )$ is a subclass of $D(\Lambda )$ follows from Theorem 2.4.1 of de Haan (1970).\\ \noindent For any sequence of positive integers $k_{n}$, such that $(K)$ holds and F\in D(\Lambda )$, set for $n=1,2,...,$ \begin{equation*} \mu _{n}(k_{n})=\int_{1-k_{n}/n}^{1}Q(s)ds. \end{equation*} \noindent The following theorem contains our main results.\\ \noindent \textbf{Theorem}. \textit{On a rich enough probability space, there exist a sequence of independent random variables $X_{1},X_{2},....,$ with common distribution function $F$ and a sequence of Brownian bridges $B_{1},$ $B_{2},$, . . . , such that for any sequence $k_{n}$ satisfying $(K)$, whenever $F\in D(\Lambda )$}, \begin{eqnarray} &&k_{n}^{1/2}c(k_{n}/n)^{-1}\left\{ \sum_{i=1}^{k_{n}}X_{n-i+1n}-\mu _{n}(k_{n})\right\} \label{r5} \\ &=&-(n/k_{n})^{1/2}c(k_{n}/n)^{-1 \int_{1-k_{n}/n}^{1}B_{n}(s)dQ(s)+o_{P}(1):=Z_{n}+o_{P}(1), \notag \end{eqnarray \textit{and whenever} $F\in D^{\ast }(\Lambda ), \begin{eqnarray} &&k_{n}^{-1/2}c(k_{n}/n)^{-1}\left\{ \sum_{i=1}^{k_{n}}X_{n-i+1n}-Q(1-k_{n}/n)\right\} \label{r6} \\ &=&-(n/k_{n})^{1/2}c(k_{n}/n)^{-1}B_{n}(1-k_{n}/n)+o_{P}(1):=Y_{n}+o_{P}(1), \notag \end{eqnarray} \noindent \textit{and} $$ k_{n}^{-1/2}c(k_{n}/n)^{-1}\left\{ \sum_{i=1}^{k_{n}}X_{n-i+1n}-k_{n}X_{n-k_{n},n}- \int_{1-k_{n}/n}^{1}r(1-s)ds)\right\} $$ \begin{equation} =Z_{n}-Y_{n}+o_{P}(1). \label{r7} \end{equation} \noindent\textit{ Furthermore, the random variables on the left side of \eqref{r5}, \eqref{r6} and \eqref{r7}, respectively, converge in distribution to $N(0,2)$, $N(0,1)$ and $N(0,1)$, respectively, as $n\rightarrow +\infty$.}\\ \noindent \textbf{Remark}. With the choice $A_{n}=\left( 2k_{n}\right) ^{-1/2}c(k_{n}/n)^{-1}$ and $C_{n}=\mu _{n}(k_{n}),$ we see that our theorem implies \eqref{r3} whenever $D(\Lambda)$. Our theorem also extends Theorem 1.5, 1.7 and 2.1 and Corollary 2.5 of Cs\"{o}rg\H{o} and Mason (1985). The random variable on the left side of \eqref{r7} is related to the Hill (1975) estimator of the tail index of a distribution for this random variable was motivated by the work of Mason (1982) (see also Deheuvels, Haeusler and Mason (1988)). \section{Proof of the theorem} \label{sec3} We use the following integral convention : When $0\leq a\leq b\leq 1,$ g is left-continuous and f is right-continuous, \begin{equation*} \int_{b}^{a}fdg=\int_{(a,b)}fdg\text{ and }\int_{a}^{b}gdf=\int_{(a,b)}gdf \end{equation*} \noindent whenever these integrals make sense as Lebesgue-Stieltjes integrals. In this case, the usual integration by parts formula \bigskip \begin{equation*} \int_{a}^{b}fdg+\int_{a}^{b}gdf=g(b)f(b)-g(a)f(a) \end{equation*} \noindent is valid.\\ \noindent The proof of our theorem will follow closely the proofs of the results of Cs\"{o}rg\H{o} and Mason (1985), substituting their technical lemmas concerning properties of the quantile functions of distribution functions satisfying \eqref{r2}, by those describing properties of the quantile functions of $F\in D(\Lambda ).$ We therefore begin with these technical lemmas.\\ \bigskip \begin{lemma} \label{l1} $F\in D(\Lambda )$ if and only if for each choice of $0\leq x,y,w,z<\infty $ \ fixed, $y\neq w, \begin{equation} \frac{Q\left( 1-sx\right) -Q\left( 1-sz\right) }{Q\left( 1-sy\right) -Q\left( 1-sw\right) }\rightarrow \frac{\log x-\log z}{\log y-\log w}\text{ \ as s}\downarrow 0. \label{r8} \end{equation} \end{lemma} \noindent This is Theorem 2.4.1 of de Haan (1970).\\ \begin{lemma} \label{l2} Whenever $F\in D(\Lambda ),$ $c(s,\beta )$ is slowly varying at zero for each choice of $0<\beta <\infty $ . \end{lemma} \noindent \textbf{Proof}. We have to show that for each $0<\lambda <\infty $ and 0<\beta <\infty , \begin{equation} c(\lambda s,\beta )/c(s,\beta )\rightarrow 1\ \text{as \ }s\downarrow 0. \label{r9} \end{equation} \noindent Choose any $0<\lambda <\infty $ \ and $0<\theta <1.$ Then for all $s>0$ small enough we hav \begin{eqnarray} \int_{1-\lambda s}^{1}\left( 1-u\right) ^{\beta }dQ\left( u\right) &=&\sum\limits_{i=0}^{\infty }\int_{1-\lambda s\theta ^{i}}^{1-\lambda s\theta ^{i+1}}\left( 1-u\right) ^{\beta }dQ\left( u\right) \notag \\ &\leq &\sum\limits_{i=0}^{\infty }\lambda ^{\beta }s^{\beta }\theta ^{i\beta }\left\{ Q\left( 1-\lambda s\theta ^{i+1}\right) -Q\left( 1-\lambda s\theta ^{i}\right) \right\} \label{r10} \end{eqnarray} \noindent Applying Lemma \ref{l1} gives \begin{equation} \frac{Q\left( 1-\lambda \theta u\right) -Q\left( 1-\lambda u\right) } Q\left( 1-\theta u\right) -Q\left( 1-u\right) }\rightarrow 1\text{ as s \downarrow 0. \label{r11} \end{equation} \noindent Select any \ $0<\varepsilon <\infty$. From \eqref{r11} we have that, for all $s>0$ sufficiently small, expression \eqref{r10} is \begin{eqnarray*} &\leq &\left( 1+\varepsilon \right) \sum\limits_{i=0}^{\infty }\lambda ^{\beta }s^{\beta }\theta ^{i\beta }\left\{ Q\left( 1-\lambda s\theta ^{i+1}\right) -Q\left( 1-\lambda s\theta ^{i}\right) \right\} \\ &\leq &\frac{\left( 1+\varepsilon \right) \lambda ^{\beta }}{\theta ^{\beta }\sum\limits_{i=0}^{\infty }\theta ^{\left( i+1\right) \beta }\int_{1-s\theta ^{i}}^{1-s\theta ^{i+1}}dQ\left( u\right) \\ &\leq &\frac{\left( 1+\varepsilon \right) \lambda ^{\beta }}{\theta ^{\beta }\int_{1-s}^{1}\left( 1-u\right) dQ\left( u\right). \end{eqnarray*} \noindent Thus for all $s>0$ sufficiently small, \begin{equation} c(\lambda s,\beta )\leq \frac{\left( 1+\varepsilon \right) }{\theta ^{\beta }c(s,\beta ). \label{r12} \end{equation} \noindent Observing that for all $s>0$ small enough \begin{equation*} \int_{1-\lambda s}^{1}\left( 1-u\right) ^{\beta }dQ\left( u\right) \geq \sum\limits_{i=0}^{\infty }\lambda ^{\beta }s^{\beta }\theta ^{\left( i+1\right) \beta }\left\{ Q\left( 1-\lambda s\theta ^{i+1}\right) -Q\left( 1-\lambda s\theta ^{i}\right) \right\} , \end{equation*} \noindent we see that by an argument very much like the one just given, we have for all $s>0$ sufficiently small, \begin{equation} c(\lambda s,\beta )\geq \left( 1+\epsilon \right) \theta ^{\beta }c(s,\beta). \label{r13} \end{equation} \noindent Assertion \eqref{r9} now follows from inequalities \eqref{r12} and \eqref{r13} by the fact that $\theta $ can be chosen arbitrarily close to one and $\varepsilon$ arbitrarily close to zero. This completes the proof of Lemma \ref{l2}.\\ \noindent The following lemma is related to Theorem 1.4.3.d of de Haan (1970) and its proof is based on a modification of the techniques used to prove this theorem. For details see Deheuvels \textit{et al.} (1986).\\ \begin{lemma} \label{l3} Whenever $F\in D(\Lambda )$, there exists a constant \ $-\infty <b<+\infty $ \ such that for all \ $0<s\leq 1/2,$ \begin{equation} Q\left( 1-s\right) =b-c(s)+\int_{s}^{1}u^{-1}c(u)du. \label{r14} \end{equation} \end{lemma} \bigskip \begin{lemma} \label{l4} Whenever $F\in D(\Lambda )$, for each \ $0<x<+\infty ,$ \begin{equation} \lim_{s\downarrow 0}\frac{Q\left( 1-xs\right) -Q\left( 1-s\right) }{c(s) =-\log x. \label{r15} \end{equation} \end{lemma} \bigskip \noindent \textbf{Proof}. Applying Lemma \ref{l3}, we have for any $0<x<+\infty$ and for all $s$ sufficiently smal \begin{equation*} \frac{Q\left( 1-xs\right) -Q\left( 1-s\right) }{c(s)}=\frac{c(s)-c(xs)}{c(s) +\int_{xs}^{s}\frac{c(u)}{u}du. \end{equation*} \noindent Since $c$ is slowly varying at zero, both \bigskip \begin{equation*} \inf \left\{ \frac{c(u)}{c(s)}:u\in I(s)\right\} \rightarrow 1 \end{equation*} \noindent and \begin{equation*} \sup \left\{ \frac{c(u)}{c(s)}:u\in I(s)\right\} \rightarrow 1 \end{equation*} \noindent as s$\downarrow 0$ \ where $I(s)$ is the closed interval formed by $xs$ and s$. From these two facts the proof of Lemma \ref{l4} follows immediately. \begin{lemma} \label{l5} Whenever $F\in D(\Lambda )$, for each \ $0<\beta <+\infty \begin{equation} c(s,\beta )/c(s)\rightarrow 1/\beta \text{ as s}\downarrow 0. \label{r16} \end{equation} \end{lemma} \bigskip \noindent \textbf{Proof}. Let $\widehat{Q}(1-s)=$ $Q(1-s^{1/\beta })$. Since by Lemma \ref{l1} for any choice of $0<x,y<\infty ,$ $y\neq 1, \begin{equation*} \frac{\widehat{Q}(1-xu)-\widehat{Q}(1-u)}{\widehat{Q}(1-yu)-\widehat{Q}(1-u)}=\frac{{Q}(1-x^{1/\beta }u^{1/\beta })-Q(1-u^{1/\beta })}{Q(1-y^{1/\beta }u^{1/\beta })-Q(1-u^{1/\beta })} \end{equation*} \noindent converges as $u\downarrow 0$ to $\log x/\log y$, we conclude that $\widehat{Q}\in D(\Lambda)$. Let \begin{equation*} \widehat{c}(s)=s^{-1}\int_{1-s}^{1}\left( 1-u\right) d\widehat{Q},\text{ \ \ \ for }0<s<1. \end{equation*} \noindent A change of variables shows that $\widehat{c}(s^{\beta})=c(s,\beta )$ \ for $0<s<1$. Thus \begin{eqnarray*} \frac{c(s,\beta )}{c(s)} &=&\frac{\widehat{c}(s^{\beta })}{c(s)} \\ &=&\frac{Q(1-2s)-Q(1-s)}{c(s)}\times \frac{\widehat{Q}(1-\left( 2s\right) ^{\beta })-\widehat{Q}(1-s^{\beta })}{Q(1-2s)-Q(1-s)} \\ &&\times \frac{\widehat{c}(s^{\beta })}{\widehat{Q}(1-\left( 2s\right) ^{\beta })-\widehat{Q}(1-s^{\beta })}, \end{eqnarray*} \noindent which by Lemmas \ref{l1} and \ref{l4} converges to $1/\beta $ as s$\downarrow 0$, completing the proof of Lemma \ref{l5}. \bigskip \begin{lemma} \label{l6} Whenever $F\in D(\Lambda )$ \begin{equation} \sigma ^{2}(s)/\left( 2sc^{2}(s)\right) \rightarrow 1\text{, \ \ as s\downarrow 0. \label{r17} \end{equation} \end{lemma} \bigskip \noindent \textbf{Proof. }The proof is based on Lemma \ref{l5} and follows almost exactly as the proof of Lemma 3.3 of Cs\"{o}rg\H{o} and Mason (1985). Therefore, the details are omitted. The proof of the following lemma is an easy consequence of the Karamata representation for a slowly varying function. \begin{lemma} \label{l7} Let $a_{n}$ be any sequence of positive constants such that a_{n}\rightarrow 0$ and \ $na_{n}\rightarrow \infty .$ Also let $L$ be any slowly varying function at zero. Then for any $0<\beta <\infty , \begin{equation} n^{-\beta }L\left( 1/n\right) /\left( \left( a_{n}\right) ^{\beta }L\left( a_{n}\right) \right) \rightarrow 0\text{ \ \ as }n\downarrow \infty. \label{r18} \end{equation} \end{lemma} \bigskip \noindent We now describe the probability space on which the assertions of the theorem are assumed to hold. M. Cs\"{o}rg\H{o}, S. Cs\"{o}rg\H{o} , Horv\'{a}th and Mason (1986) have constructed a probability space $(\Omega ,\mathcal{A},\mathbb{P})$ carrying a sequence $U_{1},U_{2},...$ of independent random variables uniformly distributed on $(0,1)$ and a sequence $B_{1},B_{2},...$ of Brownian bridges such that for the empirical process \begin{equation*} \alpha _{n}(s)=n^{1/2}\left\{ G_{n}\left( s\right) -s\right\} ,\text{ }0\leq s\leq 1, \end{equation*} \noindent and the quantile process \begin{equation*} \beta _{n}(s)=n^{1/2}\{s-U_{n}(s)\},0\leq s\leq 1, \end{equation* where \begin{equation*} G_{n}(s)=n^{-1}\{k:1\leq k\leq n,U_{k}\leq s\}, \end{equation*} \noindent and, with $U_{1,n}\leq \ldots \leq U_{n,n}$ denoting the order statistics corresponding to $U_{1},\ldots ,U_{n}.$, \begin{equation*} U_{n}(s)=\left\{ \begin{tabular}{lll} $U_{k,n}$ & $if$ & $(k-1)/n<s\leq k/n,k=1,\ldots ,n,$ \\ $U_{1,n}$ & $if$ & $s=0 \end{tabular \right. \end{equation*} \noindent we have \begin{equation} \sup_{0\leq s\leq 1}n^{\nu _{1}}|\alpha _{n}(s)-\bar{B}_{n}(s)|/(1-s)^{-\nu _{1}+1/2}=O_{p}(1) \label{r19} \end{equation} \noindent with $\bar{B}_{n}(s)=B_{n}(s)$ for $1/n\leq s\leq 1-1/n$ and zero elsewhere and \begin{equation} \label{r20} \sup_{0\leq s \leq 1-1/n }n^{\nu_2}|\beta_n(s)-B_n(s)|/(1-s)^{-\nu_2 +1/2} =O_p(1) \end{equation} \noindent where $\nu_1$, and $\nu_2$ are any fixed number such that $0\leq \nu_1<1/4$ and $0 \leq \nu_2\leq 1/2$. The statement in \eqref{r19} follows from Theorem 2.1, while the statement in \eqref{r20} is easily inferred from Corollaries 2.1 and 4.2.2 of the above paper.\\ \noindent Thoughout the remainder of the proof of our theorem, we assume that we are on the probability space of Cs\"{o}rg\H{o} et al.(1986). Since the sequence of random variables $X_1, X_2,\ldots,$ is equal in distribution to $Q(U_1), Q(U_2,),\ldots$, we can and do assume that the first sequence is equal to the second.\\ \noindent First assume $F\in D(\Lambda )$. We shall establish \eqref{r5}. Applying integration by parts we see that the left side of \eqref{r5} equals $$ -(n/k_n)^{1/2}c(k_n/n)^{-1}\int_{1-k_n/n}^1\alpha_n(s)dQ(s) $$ $$ +nk_n^{-1/2 \int_{U_n-k_n/n}^{1-k_n/n}(1-G_n(s)-k_n/n )\frac{dQ(s)}{c(k_n/n)} $$ $$ :=\Delta_{1,n}+\Delta_{2,n}. $$ \noindent We shall first show that \begin{equation*} \Delta_{1,n}=Z_n+R_n \end{equation*} \noindent with $R_n=o_p(1)$. From \eqref{r19} we have for any $0<\nu<1/4$, \begin{equation} \label{r21} \sup_{ 0\leq s\leq 1 }n^{\nu_1}|\alpha_n(s)-\bar{B}_n(s)|/(1-s)^{-\nu_1 +1/2}=O_p(n^{-\nu}). \end{equation} \noindent Notice that for any such $\nu$, \begin{eqnarray*} && |R_n|\leq \sup_{ 0\leq s\leq 1 } \frac{|\alpha_n(s)-\bar{B}_n(s)|} (1-s)^{-\nu_1 +1/2}}\left( \frac{n}{k_n}\right)^{1/2}\int_{1-k_n/n}^1( 1-s)^{-\nu_1 +1/2}dQ(s)/c(k_n/n) \\ &&+ \left\vert \left( \frac{n}{k_n}\right)^{1/2}\int_{1-1/n}^1 B_n(s)dQ(s)/c(k_n/n)\right \vert :=R_{1,n}+R_{2,n}. \end{eqnarray*} \noindent From \eqref{r21}, we obtain \begin{equation*} R_{1,n}=O_p(n^{-\nu}n^\nu \frac{c(k_n/n,1/2-\nu)}{c(k_n/n)}k_n^{-\nu}, \end{equation*} \noindent which by Lemma \ref{l5} equals $o_p(1)$. Also \begin{equation*} E R_{2,n}^2=\sigma^2(1/n)/\left(\frac{k_n}{n}c_n^2\left(\frac{k_n}{n}\right) \right) \end{equation*} \noindent which by Lemma \ref{l6} is \begin{equation*} \sigma ^{2}(1/n)/\sigma ^{2}(k_{n}/n)\ \ as\ n\rightarrow \infty. \end{equation*} \noindent From Lemmas \ref{l2} and \ref{l6} we infer that $\sigma^2(s)$ is regularly varying of exponent one at zero. Hence, by Lemma \ref{l7}, \begin{equation*} \sigma ^{2}(1/n)/\sigma ^{2}(k_{n}/n)\rightarrow 0\ \ as\ n\rightarrow \infty \end{equation*} \bigskip \noindent which yields $R_{2,n}=o_p(1)$. Thus we have proved $R_{n}=o_p(1)$.\newline Next we show that $\Delta_{2,n}=o_p(1)$. Choose any $1 <\lambda<\infty$ and set \begin{equation*} T_{n}(\lambda )=nk_{n}^{-1/2}c(k_{n}/n)^{-1}|1-G_{n}(1-k_{n}/n)-k_{n}/n|\{Q(r_{n}^{+} \lambda ))-Q(r_{n}^{-}(\lambda ))\}, \end{equation* \begin{equation*} r_{n}^{-}(\lambda ))=1-\frac{\lambda k_{n}}{n}\ \ and\ r_{n}^{+}(\lambda ))=1-\frac{k_{n}}{\lambda n}. \end{equation*} \noindent Notice that since for all $s$ in the closed interval formed by U_{n-k_{n},n}$ and $1-k_{n}/n$, \begin{equation*} |1-G_{n}(s)-k_{n}/n|\leq |1-G_{n}(1-k_{n}/n)-k_{n}/n| \end{equation*} \noindent we have for any $1<\lambda <\infty $ \begin{equation*} \liminf_{n\rightarrow \infty }P(|\Delta _{2,n}|\leq T_{n}(\lambda )|\geq \liminf_{n\rightarrow \infty }P(r_{n}^{-}(\lambda )\leq U_{n-k_{n},n}\leq r_{n}^{+}(\lambda )). \end{equation*} \noindent Since $(K)$ implies (cf. Balkema and de Haan (1975)) that \begin{equation} n(l-U_{n-k_{n},n)/k_{n}}\rightarrow ^{P}1\text{ as } n\rightarrow \infty: \label{r22} \end{equation} \noindent the lower bound in the above inequality equals one. Hence for each 1<\lambda <\infty $, \begin{equation} \lim_{n\rightarrow }P(|\Delta _{2,n}|\leq |T_{n}(\lambda )|)=1. \label{r23} \end{equation} \noindent Observe for each $1<\lambda <\infty $ \begin{equation*} E(T_{n}(\lambda )\leq \left\{ Q\left( 1-\frac{k_{n}}{\lambda _{n}}\right) -Q\left( 1-\frac{\lambda k_{n}}{n}\right) \right\} /c(k_{n}/n). \end{equation*} \noindent Applying Lemma \ref{l4} we see that this last expression converges to $2\log \lambda $, which yields \begin{equation} \lim_{\lambda \downarrow 1}\limsup_{n\rightarrow \infty }E(T_{n}(\lambda )=0. \label{r24} \end{equation} \noindent The fact that $\Delta _{2,n}=o_{p}(1)$ now follows by an elementary argument based on \eqref{r23} and \eqref{r24}. This completes the proof of \eqref{r5}.\\ \noindent Next consider \eqref{r6}. Notice that since $F\in D^{\star }(\Lambda )$, \begin{equation*} c(s)=s^{-1}\int_{1-s}^1r(1-u)du. \end{equation*} \noindent Thus since $r>0$ and slowly varying at zero Theorem 1.2.1 of de Haan (1970) gives \begin{equation} \label{r25} r(s)/c(s) \rightarrow 1 \ \ \mbox{as}\ \ s\downarrow 0 \end{equation} \noindent The left side of \eqref{r6} equals \begin{eqnarray*} && -\frac{k_n^{1/2}}{c(k_n/n}\int_{k_n/n}^{1-U_{n-k_n/n}}\frac{r(u)}{u du=-k_n^{1/2}\frac{r(k_n/n)}{c(k_n/n)}\{\log(1-U_{n-k_n/n}\} \\ && \ \ \ \ - \ \ \frac{k_n^{1/2}}{c(k_n/n \int_{k_n/n}^{1-U_{n-k_n/n}}(r(u)-r(k_n/n))\frac{du}{u}:=\Delta_{1,n}^\star +\Delta_{2,n}^\star \end{eqnarray*} \noindent The same argument based on \eqref{r20} as given in Cs\"{o}rg\H{o} and Mason (1985) shows that \begin{equation*} -k_n^{1/2}(\log(1-U_{n-k_n/n})-\log(k_n/n))=Y_n+o_p(1). \end{equation*} \noindent Therefore by \eqref{r25} and the fact that $Y_n=o_p(1)$ we have \begin{equation*} \Delta_{1,n}^\star =Y_n +o_p(1). \end{equation*} \noindent Since $r$ is slowly varying at zero, we get for each $1<\lambda <\infty$ as n \rightarrow \infty$, \begin{equation} \sup\left\{|r(s)-r(k_n/n)/c(k_n/n):\frac{k_n}{\lambda_n}\leq s \leq \frac \lambda k_n}{n} | \right\} \rightarrow 0 \label{r26} \end{equation} \noindent The fact that $\Delta_{2,n}^\star=o_p(1)$ now follows easily from $Y_n=o_p(1) $, \eqref{r22},\eqref{r26} completing the proof of \eqref{r6}.\\ \noindent Since $F\in D^\star(\Gamma)$ we have \begin{equation*} \mu_n(k_n)-k_nQ(1-k_n/n)=\int_{1-k_n/n}^1r(1-s)ds. \end{equation*} \noindent Assertion (7) is now a direct consequence of \eqref{r5} and \eqref{r6}.\\ \noindent Finally we prove the convergence in distribution of $Z_n$, $Y_n$, and $Z_n- Y_n$,, to $N(0,2), N(0,1)$ and $N(0,1)$, respectively, as $n \rightarrow \infty$. Notice that the $Z_n$, random variable in \eqref{r5} is normal with mean zero and second moment $\sigma^2(k_n/n)/(k_nc^2(k_n)/n),$, which by Lemma \ref{l6} converges to $1$ as $n\rightarrow \infty$. The $Y_n$, random variable in \eqref{r6} is normal with mean zero and second moment $1-k_n/n \rightarrow 1$ as $n\rightarrow \infty$.\\ \noindent The $Z_{n}-Y_{n}$ random variable in \eqref{r7} is normal with mean zero. Applying Lemmas \ref{l5} and \ref{l6} it is easy to verify that $E(Z_{n}-Y_{n})^{2 \rightarrow 1$ and $n\rightarrow \infty $. This completes the proof of the theorem. \bigskip \noindent{\textbf{Acknowledgement}}.\newline \noindent The author is extremely grateful to David Mason, Erich Haeusler and Paul Deheuvels, for helping him to complete this work.
{'timestamp': '2016-07-19T02:06:59', 'yymm': '1607', 'arxiv_id': '1607.04848', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04848'}
arxiv
\section{Introduction} \label{intro} Deep neural networks (DNNs) have been successful in modeling many aspects of natural language including word meanings \cite{mikolov}\cite{le}, machine translation \cite{sutskever}, syntactic parsing \cite{vinyals_grammar}, language modeling \cite{jozefowicz} and image captioning \cite{vinyals_caption}. Given sufficient training data, DNNs are highly accurate and can be trained end-to-end without the need for intermediate knowledge representations or explicit feature extraction. With recent interest in conversational user interfaces such as virtual assistants and chatbots, the application of DNNs to facilitate meaningful conversations is an area where more progress is needed. While sequence to sequence models based on recurrent neural networks (RNNs) have shown initial promise in creating intelligible conversations \cite{vinyals_conversation}, it has been noted that more work is needed for these models to fully capture larger aspects of human communication including conversational goals, personas, consistency, context, and word knowledge. Since discourse analysis considers language at the conversation-level, including its social and psychological context, it is a useful framework for guiding the extension of end-to-end neural conversational models. Drawing on concepts from discourse analysis such as \textit{coherence} and \textit{cohesion} \cite{halliday}, we can codify what makes conversations more intelligent in order to design more powerful neural models that reach beyond the sentence and utterance level. For example, by looking for features that indicate deixis, anaphora, and logical consequence in the machine-generated utterances we can benchmark the level of coherence and cohesion with the rest of the conversation, and then make improvements to models accordingly. In the long run, if neural models can encode the long-range structure of conversations, they may be able to express conversational discourse similar to the way the human brain does, without the need for explicitly building formal representations of discourse theory into the model. To that end, we explore RNN-based sequence to sequence architectures that can capture long-range relationships between multiple utterances in conversations and look at their ability to exhibit discourse relationships. Specifically, we look at 1) a baseline RNN encoder-decoder with attention mechanism and 2) a model with an additional discourse RNN that encodes a sequence of multiple utterances. Our contributions are as follows: \begin{itemize} \item We examine two RNN models with attention mechanisms to model discourse relationships across different utterances that differ somewhat compared to what has been done before \item We carefully construct controlled experiments to study the relative merits of different models on multi-turn conversations \item We perform a sensitivity analysis on how the amount of context provided by previous utterances affects model performance \item We quantify how neural conversational models display coherence by measuring the prevalence of specific syntactical features indicative of deixis, anaphora, and logical consequence. \end{itemize} \section{Related Work} \label{relatedwork} Building on work done in machine translation, sequence to sequence models based on RNN encoder-decoders were initially applied to generate conversational outputs given a single previous message utterance as input\cite{shang}\cite{vinyals_conversation}. In \cite{sordoni} several models were presented that included a ``context'' vector (for example representing another previous utterance) that was combined with the message utterance via various encoding strategies to initialize or bias a single decoder RNN. Some models have also included an additional RNN tier to capture the context of conversations. For example, \cite{serban} includes a hierarchical ``context RNN'' layer to summarize the state of a dialog, while \cite{yao} includes an RNN ``intension network'' to model conversation intension for dialogs involving two participants speaking in turn. Modeling the ``persona'' of the participants in a conversation by embedding each speaker into a $K$-dimensional embedding was shown to increase the consistency of conversations in \cite{li_persona}. Formal representations such as Rhetorical Structure Theory (RST) \cite{mann} have been developed to identify discourse structures in written text. Discourse parsing of cue phrases \cite{marcu} and coherence modeling based on co-reference resolution of named-entities \cite{barzilay}\cite{kibble} have been applied to tasks such as summarization and text generation. Lexical chains \cite{morris} and narrative event chains \cite{chambers} provide directed graph models of text coherence by looking at thesaurus relationships and subject-verb-temporal relationships, respectively. Recurrent convolutional neural networks have been used to classify utterances into discourse speech-act labels \cite{kalchbrenner} and hierarchical LSTM models have been evaluated for generating coherent paragraphs in text documents \cite{li} . Our aim is to develop end-to-end neural conversational models that exhibit awareness of discourse without needing a formal representation of discourse relationships. \subsection{Models} \label{models} Since conversations are sequences of utterances and utterances are sequences of words, it is natural to use models based on an RNN encoder-decoder to predict the next utterance in the conversation given $N$ previous utterances as source input. We compare two types of models: \textbf{seq2seq+A}, which applies an attention mechanism directly to the encoder hidden states, and \textbf{Nseq2seq+A}, which adds an additional RNN tier with its own attention mechanism to model discourse relationships between $N$ input utterances. In both cases the RNN decoder predicts the output utterance and the RNN encoder reads the sequence of words in each input utterance. The encoder and decoder each have their own vocabulary embeddings. As in \cite{vinyals_grammar} we compute the attention vector at each decoder output time step $t$ given an input sequence $(1,...,T_{A})$ using: \begin{eqnarray} u_{i}^{t} & = & v^{T}tanh(W_{1} h_{i} + W_{2} d^{t}) \nonumber \\ a_{i}^{t} & = & softmax(u_{i}^{t}) \nonumber \\ c^{t} & = & \sum_{i=1}^{T_{A}} a_{i}^{t} h_{i} \nonumber \end{eqnarray} where the vector $v$ and matrices $W_{1}$, and $W_{2}$ are learned parameters. $d^{t}$ is the decoder state at time $t$ and is concatenated with $c^{t}$ to make predictions and inform the next time step. In \textbf{seq2seq+A} the $h_{i}$ are the hidden states of the encoder $e_{i}$, and for \textbf{Nseq2seq+A} they are the $N$ hidden states of the discourse RNN (see Fig. \ref{schematic}.) Therefore, in \textbf{seq2seq+A} the attention mechanism is applied at the word-level, while in \textbf{Nseq2seq+A} attention is applied at the utterance-level. \begin{figure*}[t] \centerline{\includegraphics[width=12cm]{Figure1.pdf}} \caption{Schematic of \textbf{seq2seq+A} and \textbf{Nseq2seq+A} models for multiple turns of conversation. An attention mechanism is applied either directly to the encoder RNN or to an intermediate discourse RNN.} \label{schematic} \end{figure*} \subsection{seq2seq+A} \label{seq2seq} As a baseline starting point we use an attention mechanism to help model the discourse by a straightforward adaptation of the RNN encoder-decoder conversational model discussed in \cite{vinyals_conversation}. We join multiple source utterances using the \textit{EOS} symbol as a delimiter, and feed them into the encoder RNN as a single input sequence. As in \cite{sutskever}, we reversed the order of the tokens in each of the individual utterances but preserved the order of the conversation turns. The attention mechanism is able to make connections to any of the words used in earlier utterances as the decoder generates each word in the output response. \subsection{Nseq2seq+A} \label{Nseq2seq} Since conversational threads are ordered sequences of utterances, it makes sense to extend an RNN encoder-decoder by adding another RNN tier to model the discourse as the turns of the conversation progress. Given $N$ input utterances, the RNN encoder is applied to each utterance one at a time as shown in Fig. \ref{schematic} (with tokens fed in reverse order.) The output of the encoder from each of the input utterances forms $N$ time step inputs for the discourse RNN. The attention mechanism is then applied to the $N$ hidden states of the discourse RNN and fed into the decoder RNN. We also considered a model where the output of the encoder is also combined with the output of the discourse RNN and fed into the attention decoder, but found the purely hierarchical architecture performed better. \subsection{Learning} \label{learning} For each model we chose identical optimizers, hyperparameters, etc. in our experiments in order to isolate the impact of specific differences in the network architecture, also taking computation times and available GPU resources into account. It would be straightforward to perform a grid search to tune hyperparameters, try LSTM cells, increase layers per RNN, etc. to further improve performance individually for each model beyond what we report here. For each RNN we use one layer of Gated Recurrent Units (GRUs) with 512 hidden cells. Separate embeddings for the encoder and decoder, each with dimension 512 and vocabulary size of 40,000, are trained on-the-fly without using predefined word vectors. We use a stochastic gradient descent (SGD) optimizer with $L2$ norms clipped at $5.0$, an initial learning rate of $0.5$, and a learning rate decay factor of $0.99$ is applied when needed. We trained with mini-batches of 64 randomly selected examples, and ran training for approximately 10 epochs until validation set loss converged. \section{Experiments} \label{experiments} We first present results comparing our neural discourse models trained on a large set of conversation threads based on the OpenSubtitles dataset \cite{tiedemann}. We then examine how our models are able to produce outputs that indicate enhanced coherence by searching for discourse markers. \subsection{OpenSubtitles dataset} \label{opensubtitles} A large-scale dataset is important if we want to model all the variations and nuances of human language. From the OpenSubtitles corpus we created a training set and validation set with 3,642,856 and 911,128 conversation fragments, respectively\footnote{The training and validation sets consisted of $320M$ and $80M$ tokens, respectively}. Each conversation fragment consists of 10 utterances from the previous lines of the movie dialog leading up to a target utterance. The main limitation of the OpenSubtitles dataset is that it is derived from closed caption style subtitles, which can be noisy, do not include labels for which actors are speaking in turn, and do not show conversation boundaries from different scenes. We considered cleaner datasets such as the Ubuntu dialog corpus \cite{lowe}, Movie-DiC dialog corpus \cite{banchs}, and SubTle corpus \cite{ameixa} but found they all contained orders of magnitude fewer conversations and/or many fewer turns per conversation on average. Therefore, we found the size of the OpenSubtitles dataset outweighed the benefits of cleaner smaller datasets. This echoes a trend in neural networks where large noisy datasets tend to perform better than small clean datasets. The lack of a large-scale clean dataset of conversations is an open problem in the field. \subsection{Results} \label{results} We compared models and performed a sensitivity analysis by varying the number of previous conversation turns fed into the encoder during training and evaluation. \begin{table*}[!htbp] \caption{Results on OpenSubtitles dataset. Perplexity vs. number of previous conversation turns.} \label{perplexity} \begin{center} \begin{tabular}{cll} \hline \textbf{Previous conversation turns} & \textbf{seq2seq+A} & \textbf{Nseq2seq+A} \\ \hline $N=1$ & 13.84$\pm$0.02 & 13.71$\pm$0.03 \\ $N=2$ & 13.49$\pm$0.03 & 13.40$\pm$0.04 \\ $N=3$ & 13.44$\pm$0.05 & 13.31$\pm$0.03 \\ $N=5$ & - & 13.14$\pm$0.03 \\ $N=7$ & - & 13.08$\pm$0.03 \\ \hline \end{tabular} \end{center} \end{table*} \begin{figure*}[t] \centerline{\includegraphics[width=11cm]{Figure2.pdf}} \caption{Sensitivity analysis of perplexity vs. number of previous conversations turns.} \label{sensitivity} \end{figure*} In Table \ref{perplexity} we report the average perplexity\footnote{We use perplexity as our performance metric, because it is simple to compute and correlates with human judgements, though it has well-known limitations.} on the validation set at convergence for each model. For $N=1,2,3$ we found that \textbf{Nseq2seq+A} shows a modest but significant performance improvement over the baseline \textbf{seq2seq+A}. We only ran \textbf{Nseq2seq+A} on larger values of $N$, assuming it would continue to outperform. In Fig. \ref{sensitivity} we show that increasing the amount of context from previous conversation turns significantly improves model performance, though there appear to be diminishing returns. \subsection{Discourse analysis} \label{discourse} Since a large enough dataset tagged with crisp discourse relationships is not currently available, we seek a way to quantitatively compare relative levels of coherence and cohesion. As an alternative to a human-rated evaluation we performed simple text analysis to search for specific discourse markers \cite{fraser} that indicate enhanced coherence in the decoder output as follows: \begin{itemize} \item \textbf{Deixis:} contains words or phrases\footnote{here, there, then, now, later, this, that} referring to previous context of place or time \item \textbf{Anaphora:} contains pronouns\footnote{she, her, hers, he, him, his, they, them, their, theirs} referring to entities mentioned in previous utterances \item \textbf{Logical consequence:} starts with a cue phrase\footnote{so, after all, in addition, furthermore, therefore, thus, also, but, however, otherwise, although, if, then} forming logical relations to previous utterances \end{itemize} \begin{table*}[!htbp] \caption{Discourse analysis of \textbf{Nseq2seq+A} decoder output. Likelihood of discourse markers vs. number of previous conversation turns used as input.} \label{cohesion} \begin{center} \begin{tabular}{llllll} \hline & $N=1$ & $N=2$ & $N=3$ & $N=5$ & $N=7$ \\ \hline deixis & 4.0\% & 3.4\% & 16.3\% & 5.1\% & 5.0\% \\ anaphora & 4.4\% & 6.1\% & 9.9\% & 7.2\% & 9.3\% \\ logical consequence & 0.03\% & 0.05\% & 0.08\% & 0.34\% & 0.12\% \\ \hline \end{tabular} \end{center} \end{table*} In Table \ref{cohesion} we show how $N$, the number of previous conversation turns used as input, affects the likelihood that these discourse markers appear in the decoder output. The percentage of output utterances containing discourse markers related to deixis, anaphora, and logical consequence are reported from a sample of 100,000 validation set examples. In general, we find that more context leads to a higher likelihood of discourse markers indicating that long-range discourse relationships are indeed being modeled. The results show a potentially interesting sensitivity to the value of $N$, require further study, and are likely to be dependent on different conversational styles and domains. \subsection{Examples} \label{examples} In Table \ref{cohesion} we show a few examples comparing decoder outputs of the \textbf{Nseq2seq+A} model using either 1 or 5 previous conversation turns as input. Qualitatively we can see that this neural discourse model is capable of producing increased cohesion when provided with more context. \begin{table*}[!htbp] \caption{Example responses comparing \textbf{Nseq2seq+A} with either 1 or 5 previous conversation turns as input. Output words exhibiting cohesion with previous conversation turns are indicated in bold.} \label{responses} \begin{center} \begin{tabular}{|l|l|} \hline \textbf{Previous Lines of Conversation Input} & \textbf{Decoder Output} \\ \hline \hline can ' t see a number plate , even . & \textit{i ' m sorry .} \\ \hline then there ' s this . & \\ five streets away from UNK ' s flat , it ' s the night we broke in . & \\ it ' s him , it ' s the man we disturbed . & \\ we can ' t identify him from this . & \\ can ' t see a number plate , even . & \textit{we ' re not going to get rid of \textbf{him} .} \\ \hline \hline but he was such a puppy ! & \textit{i was so scared .} \\ \hline how time flies !& \\ it only seems like yesterday since i put 00 candles on his birthday cake . & \\ he was such a tall boy !& \\ nearly six feet . & \\ but he was such a puppy ! & \textit{he was a \textbf{young man} !} \\ \hline \hline now just two months ago right here & \textit{and the other ?} \\ \hline would you swear to that ?& \\ yes , sir , we swear to that . & \\ there you are , an UNK alibi .& \\ serena robbins , you come down here ! & \\ now just two months ago right here & \textit{\textbf{we ' re} on the \textbf{way down} .} \\ \hline \end{tabular} \end{center} \end{table*} \section{Conclusions} \label{conclusions} We studied neural discourse models that can capture long distance relationships between features found in different utterances of a conversation. We found that a model with an additional discourse RNN outperforms the baseline RNN encoder-decoder with an attention mechanism. Our results indicate that providing more context from previous utterances improves model performance up to a point. Qualitative examples illustrate how the discourse RNN produces increased coherence and cohesion with the rest of the conversation, while quantitative results based on text mining of discourse markers show that the amount of deixis, anaphora, and logical consequence found in the decoder output can be sensitive to the size of the context window. In future work, it will be interesting to train discourse models on even larger corpora and compare conversations in different domains. By examining the attention weights it should be possible to study what discourse markers the models are ``paying attention to'' and possibly provide a powerful new tool for analyzing discourse relationships. By applying multi-task sequence to sequence learning techniques as in \cite{luong} we may be able to combine the conversational modeling task with other tasks such as discourse parsing and/or world knowledge modeling achieve better overall model performance. Not just for conversations, neural discourse modeling could also be applied to written text documents in domains with strong patterns of discourse such as news, legal, healthcare.
{'timestamp': '2016-07-18T02:08:34', 'yymm': '1607', 'arxiv_id': '1607.04576', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04576'}
arxiv
\section{Multi-threading} We measure the performance of the obtained word vectors on the word similarity task, when the number of threads used for training change. In Table~\ref{tab:threads} we report the correlation with human judgement for models trained on \texttt{small} for threads ranging from 1 to 32. In Table~\ref{tab:threads-large} we report the correlation with human judgement for models trained on \texttt{large} for threads ranging from 15 to 30. \begin{table} \centering \begin{tabular}{rcccccc} \toprule & 1 & 2 & 4 & 8 & 16 & 32 \\ \midrule de-gur350 & 68 & 67 & 69 & 67 & 68 & 69 \\ de-gur65 & 70 & 62 & 70 & 69 & 67 & 68 \\ de-zg222 & 49 & 41 & 43 & 44 & 45 & 48 \\ en-rw & 46 & 47 & 47 & 47 & 46 & 46 \\ en-ws353 & 62 & 63 & 63 & 64 & 63 & 64 \\ es-ws353 & 48 & 48 & 50 & 49 & 46 & 49 \\ fr-rg65 & 57 & 57 & 61 & 58 & 55 & 59 \\ \bottomrule \end{tabular} \caption{ Correlation between human judgement and our similarity for models trained on small with various number of threads. } \label{tab:threads} \end{table} \begin{table} \centering \begin{tabular}{rcccccc} \toprule & 15 & 20 & 25 & 30 \\ \midrule de-gur350 & 68 & 68 & 67 & 68 \\ de-gur65 & 72 & 77 & 74 & 75 \\ de-zg222 & 41 & 40 & 44 & 43 \\ en-rw & 46 & 46 & 46 & 46 \\ en-ws353 & 65 & 66 & 67 & 66 \\ es-ws353 & 53 & 53 & 51 & 53 \\ fr-rg65 & 56 & 58 & 55 & 55 \\ \bottomrule \end{tabular} \caption{ Correlation between human judgement and our similarity for models trained on large with various number of threads. } \label{tab:threads-large} \end{table} \section{Experimental setup} \subsection{Baseline} In most experiments (except in Sec.~\ref{sec:sota}), we compare our model to the C implementation of the \texttt{skipgram} and \texttt{cbow} models from the \texttt{word2vec}\footnote{\smaller\relax\url{https://code.google.com/archive/p/word2vec}} package. \subsection{Optimization} We solve our optimization problem by performing stochastic gradient descent on the negative log likelihood presented before. As in the baseline \texttt{skipgram} model, we use a linear decay of the step size. Given a training set containing $T$ words and a number of passes over the data equal to $P$, the step size at time $t$ is equal to $\gamma_0 (1 - \frac{t}{TP})$, where $\gamma_0$ is a fixed parameter. We carry out the optimization in parallel, by resorting to Hogwild~\cite{recht2011hogwild}. All threads share parameters and update vectors in an asynchronous manner. \subsection{Implementation details} For both our model and the baseline experiments, we use the following parameters: the word vectors have dimension $300$. For each positive example, we sample $5$ negatives at random, with probability proportional to the square root of the uni-gram frequency. We use a context window of size $c$, and uniformly sample the size $c$ between $1$ and $5$. In order to subsample the most frequent words, we use a rejection threshold of $10^{-4}$ (for more details, see \cite{mikolov2013distributed}). When building the word dictionary, we keep the words that appear at least $5$ times in the training set. The step size $\gamma_0$ is set to $0.025$ for the \texttt{skipgram} baseline and to $0.05$ for both our model and the \texttt{cbow} baseline. These are the default values in the \texttt{word2vec} package and work well for our model too. Using this setting on English data, our model with character $n$-grams is approximately $1.5 \times$ slower to train than the \texttt{skipgram} baseline. Indeed, we process $105$k words/second/thread versus $145$k words/second/thread for the baseline. Our model is implemented in C++, and is publicly available.\footnote{\smaller\relax\url{https://github.com/facebookresearch/fastText}} \subsection{Datasets} Except for the comparison to previous work~(Sec.~\ref{sec:sota}), we train our models on Wikipedia data.\footnote{\smaller\relax\url{https://dumps.wikimedia.org}} We downloaded Wikipedia dumps in nine languages: Arabic, Czech, German, English, Spanish, French, Italian, Romanian and Russian. We normalize the raw Wikipedia data using Matt Mahoney's pre-processing perl script.\footnote{\smaller\relax\url{http://mattmahoney.net/dc/textdata}} All the datasets are shuffled, and we train our models by doing five passes over them. \section{Results} We evaluate our model in five experiments: an evaluation of word similarity and word analogies, a comparison to state-of-the-art methods, an analysis of the effect of the size of training data and of the size of character $n$-grams that we consider. We will describe these experiments in detail in the following sections. \subsection{Human similarity judgement} \label{sec:wordsim} We first evaluate the quality of our representations on the task of word similarity / relatedness. We do so by computing Spearman's rank correlation coefficient~\cite{spearman04proof} between human judgement and the cosine similarity between the vector representations. For German, we compare the different models on three datasets: \textsc{Gur65}, \textsc{Gur350} and \textsc{ZG222}~\cite{gurevych2005using,zesch2006automatically}. For English, we use the \textsc{WS353} dataset introduced by \newcite{finkelstein2001placing} and the rare word dataset (\textsc{RW}), introduced by \newcite{luong2013better}. We evaluate the French word vectors on the translated dataset \textsc{RG65}~\cite{joubarne2011comparison}. Spanish, Arabic and Romanian word vectors are evaluated using the datasets described in~\cite{hassan2009cross}. Russian word vectors are evaluated using the \textsc{HJ} dataset introduced by \newcite{panchenko2016human}. \begin{table}[t] \centering \begin{tabular}{@{}rrcccc@{}} \toprule && \texttt{sg} & \texttt{cbow} & \texttt{sisg-} & \texttt{sisg} \\ \midrule \textsc{Ar} & \textsc{WS353} & 51 & 52 & 54 & \textbf{55} \\ \midrule \multirow{ 3}{*}{\textsc{De}} & \textsc{Gur350} & 61 & 62 & 64 & \textbf{70} \\ & \textsc{Gur65} & 78 & 78 & \textbf{81} & \textbf{81} \\ & \textsc{ZG222} & 35 & 38 & 41 & \textbf{44} \\ \midrule \multirow{ 2}{*}{\textsc{En}} & \textsc{RW} & 43 & 43 & 46 & \textbf{47} \\ & \textsc{WS353} & 72 & \textbf{73} & 71 & 71 \\ \midrule \textsc{Es} & \textsc{WS353} & 57 & 58 & 58 & \textbf{59} \\ \midrule \textsc{Fr} & \textsc{RG65} & 70 & 69 & \textbf{75} & \textbf{75} \\ \midrule \textsc{Ro} & \textsc{WS353} & 48 & 52 & 51 & \textbf{54} \\ \midrule \textsc{Ru} & \textsc{HJ} & 59 & 60 & 60 & \textbf{66} \\ \bottomrule \end{tabular} \caption{ Correlation between human judgement and similarity scores on word similarity datasets. We train both our model and the \texttt{word2vec} baseline on normalized Wikipedia dumps. Evaluation datasets contain words that are not part of the training set, so we represent them using null vectors (\texttt{sisg-}). With our model, we also compute vectors for unseen words by summing the $n$-gram vectors (\texttt{sisg}). } \label{tab:wordsim} \end{table} We report results for our method and baselines for all datasets in Table~\ref{tab:wordsim}. Some words from these datasets do not appear in our training data, and thus, we cannot obtain word representation for these words using the \texttt{cbow} and \texttt{skipgram} baselines. In order to provide comparable results, we propose by default to use null vectors for these words. Since our model exploits subword information, we can also compute valid representations for out-of-vocabulary words. We do so by taking the sum of its $n$-gram vectors. When OOV words are represented using null vectors we refer to our method as \texttt{sisg-} and \texttt{sisg} otherwise (Subword Information Skip Gram). First, by looking at Table~\ref{tab:wordsim}, we notice that the proposed model (\texttt{sisg}), which uses subword information, outperforms the baselines on all datasets except the English \textsc{WS353} dataset. Moreover, computing vectors for out-of-vocabulary words (\texttt{sisg}) is always at least as good as not doing so (\texttt{sisg-}). This proves the advantage of using subword information in the form of character $n$-grams. Second, we observe that the effect of using character $n$-grams is more important for Arabic, German and Russian than for English, French or Spanish. German and Russian exhibit grammatical declensions with four cases for German and six for Russian. Also, many German words are compound words; for instance the nominal phrase ``table tennis'' is written in a single word as ``Tischtennis''. By exploiting the character-level similarities between ``Tischtennis'' and ``Tennis'', our model does not represent the two words as completely different words. Finally, we observe that on the English Rare Words dataset (\textsc{RW}), our approach outperforms the baselines while it does not on the English \textsc{WS353} dataset. This is due to the fact that words in the English \textsc{WS353} dataset are common words for which good vectors can be obtained without exploiting subword information. When evaluating on less frequent words, we see that using similarities at the character level between words can help learning good word vectors. \subsection{Word analogy tasks} \begin{table}[t] \centering \begin{tabular}{rrccc} \toprule & & \texttt{sg} & \texttt{cbow} & \texttt{sisg} \\ \midrule \multirow{ 2}{*}{\textsc{Cs}} & Semantic & 25.7 & 27.6 & 27.5 \\ & Syntactic & 52.8 & 55.0 & 77.8 \\ \midrule \multirow{ 2}{*}{\textsc{De}} & Semantic & 66.5 & 66.8 & 62.3 \\ & Syntactic & 44.5 & 45.0 & 56.4 \\ \midrule \multirow{ 2}{*}{\textsc{En}} & Semantic & 78.5 & 78.2 & 77.8 \\ & Syntactic & 70.1 & 69.9 & 74.9 \\ \midrule \multirow{ 2}{*}{\textsc{It}} & Semantic & 52.3 & 54.7 & 52.3 \\ & Syntactic & 51.5 & 51.8 & 62.7 \\ \bottomrule \end{tabular} \caption{ Accuracy of our model and baselines on word analogy tasks for Czech, German, English and Italian. We report results for semantic and syntactic analogies separately. } \label{tab:wordanalogy} \end{table} We now evaluate our approach on word analogy questions, of the form $A$ is to $B$ as $C$ is to $D$, where $D$ must be predicted by the models. We use the datasets introduced by \newcite{mikolov2013efficient} for English, by \newcite{svoboda2016new} for Czech, by \newcite{koper2015multilingual} for German and by \newcite{berardi2015word} for Italian. Some questions contain words that do not appear in our training corpus, and we thus excluded these questions from the evaluation. \begin{table*}[t] \centering \begin{tabular}{rcccccccccc} \toprule && \multicolumn{2}{c}{\textsc{De}} && \multicolumn{2}{c}{\textsc{En}} && \multicolumn{1}{c}{\textsc{Es}} && \multicolumn{1}{c}{\textsc{Fr}} \\ \cmidrule{3-4} \cmidrule{6-7} \cmidrule{9-9} \cmidrule{11-11} && \textsc{Gur350} & \textsc{ZG222} && WS353 & RW && WS353 && RG65 \\ \midrule \newcite{luong2013better} && - & - && 64 & 34 && - && - \\ \newcite{qiu2014colearning} && - & - && 65 & 33 && - && - \\ \newcite{soricut2015unsupervised} && 64 & 22 && 71 & 42 && 47 && 67 \\ \texttt{sisg} && 73 & 43 && 73 & 48 && 54 && 69 \\ \midrule \newcite{botha2014compositional} && 56 & 25 && 39 & 30 && 28 && 45 \\ \texttt{sisg} && 66 & 34 && 54 & 41 && 49 && 52 \\ \bottomrule \end{tabular} \caption{ Spearman's rank correlation coefficient between human judgement and model scores for different methods using morphology to learn word representations. We keep all the word pairs of the evaluation set and obtain representations for out-of-vocabulary words with our model by summing the vectors of character $n$-grams. Our model was trained on the same datasets as the methods we are comparing to (hence the two lines of results for our approach). } \label{tab:comparison} \end{table*} We report accuracy for the different models in Table~\ref{tab:wordanalogy}. We observe that morphological information significantly improves the syntactic tasks; our approach outperforms the baselines. In contrast, it does not help for semantic questions, and even degrades the performance for German and Italian. Note that this is tightly related to the choice of the length of character $n$-grams that we consider. We show in Sec.~\ref{sec:ngram-size} that when the size of the $n$-grams is chosen optimally, the semantic analogies degrade less. Another interesting observation is that, as expected, the improvement over the baselines is more important for morphologically rich languages, such as Czech and German. \subsection{Comparison with morphological representations} \label{sec:sota} We also compare our approach to previous work on word vectors incorporating subword information on word similarity tasks. The methods used are: the recursive neural network of \newcite{luong2013better}, the morpheme \texttt{cbow} of \newcite{qiu2014colearning} and the morphological transformations of \newcite{soricut2015unsupervised}. In order to make the results comparable, we trained our model on the same datasets as the methods we are comparing to: the English Wikipedia data released by \newcite{shaoul2010westbury}, and the news crawl data from the 2013 WMT shared task for German, Spanish and French. We also compare our approach to the log-bilinear language model introduced by \newcite{botha2014compositional}, which was trained on the Europarl and news commentary corpora. Again, we trained our model on the same data to make the results comparable. Using our model, we obtain representations of out-of-vocabulary words by summing the representations of character $n$-grams. We report results in Table~\ref{tab:comparison}. We observe that our simple approach performs well relative to techniques based on subword information obtained from morphological segmentors. We also observe that our approach outperforms the \newcite{soricut2015unsupervised} method, which is based on prefix and suffix analysis. The large improvement for German is due to the fact that their approach does not model noun compounding, contrary to ours. \subsection{Effect of the size of the training data} \label{sec:exp-data-size} Since we exploit character-level similarities between words, we are able to better model infrequent words. Therefore, we should also be more robust to the size of the training data that we use. In order to assess that, we propose to evaluate the performance of our word vectors on the similarity task as a function of the training data size. To this end, we train our model and the \texttt{cbow} baseline on portions of Wikipedia of increasing size. We use the Wikipedia corpus described above and isolate the first $1$, $2$, $5$, $10$, $20$, and $50$ percent of the data. Since we don't reshuffle the dataset, they are all subsets of each other. We report results in Fig.~\ref{fig:gulllss}. \begin{figure*}[t] \centering \begin{subfigure}[b]{0.43\textwidth} \includegraphics[width=\textwidth]{figures/figure-de-gur350.pdf} \caption{\textsc{De-Gur350}} \end{subfigure} \qquad \begin{subfigure}[b]{0.43\textwidth} \includegraphics[width=\textwidth]{figures/figure-en-rw.pdf} \caption{\textsc{En-RW}} \end{subfigure} \caption{ Influence of size of the training data on performance. We compute word vectors following the proposed model using datasets of increasing size. In this experiment, we train models on a fraction of the full Wikipedia dump. } \label{fig:gulllss} \end{figure*} As in the experiment presented in Sec.~\ref{sec:wordsim}, not all words from the evaluation set are present in the Wikipedia data. Again, by default, we use a null vector for these words (\texttt{sisg-}) or compute a vector by summing the $n$-gram representations (\texttt{sisg}). The out-of-vocabulary rate is growing as the dataset shrinks, and therefore the performance of \texttt{sisg-} and \texttt{cbow} necessarily degrades. However, the proposed model (\texttt{sisg}) assigns non-trivial vectors to previously unseen words. First, we notice that for all datasets, and all sizes, the proposed approach (\texttt{sisg}) performs better than the baseline. However, the performance of the baseline \texttt{cbow} model gets better as more and more data is available. Our model, on the other hand, seems to quickly saturate and adding more data does not always lead to improved results. Second, and most importantly, we notice that the proposed approach provides very good word vectors even when using very small training datasets. For instance, on the German \textsc{Gur350} dataset, our model (\texttt{sisg}) trained on $5\%$ of the data achieves better performance ($66$) than the \texttt{cbow} baseline trained on the full dataset ($62$). On the other hand, on the English \textsc{RW} dataset, using $1\%$ of the Wikipedia corpus we achieve a correlation coefficient of $45$ which is better than the performance of \texttt{cbow} trained on the full dataset ($43$). This has a very important practical implication: well performing word vectors can be computed on datasets of a restricted size and still work well on previously unseen words. In general, when using vectorial word representations in specific applications, it is recommended to retrain the model on textual data relevant for the application. However, this kind of relevant task-specific data is often very scarce and learning from a reduced amount of training data is a great advantage. \subsection{Effect of the size of $n$-grams} \label{sec:ngram-size} The proposed model relies on the use of character $n$-grams to represent words as vectors. As mentioned in Sec.~\ref{sec:model-ngrams}, we decided to use $n$-grams ranging from $3$ to $6$ characters. This choice was arbitrary, motivated by the fact that $n$-grams of these lengths will cover a wide range of information. They would include short suffixes (corresponding to conjugations and declensions for instance) as well as longer roots. In this experiment, we empirically check for the influence of the range of $n$-grams that we use on performance. We report our results in Table~\ref{tab:nsize} for English and German on word similarity and analogy datasets. \begin{table*}[t] \centering \begin{subtable}[b]{0.31\textwidth} \begin{tabular}{c c c c c c} \toprule & 2 & 3 & 4 & 5 & 6 \\ \midrule 2 & 57 & 64 & 67 & 69 & 69 \\ 3 & & 65 & 68 & 70 & 70 \\ 4 & & & 70 & 70 & \textbf{71} \\ 5 & & & & 69 & \textbf{71} \\ 6 & & & & & 70 \\ \bottomrule \end{tabular} \caption{\textsc{De-Gur350}} \end{subtable} \begin{subtable}[b]{0.31\textwidth} \begin{tabular}{c c c c c c} \toprule & 2 & 3 & 4 & 5 & 6 \\ \midrule 2 & 59 & 55 & 56 & 59 & 60 \\ 3 & & 60 & 58 & 60 & 62 \\ 4 & & & 62 & 62 & 63 \\ 5 & & & & 64 & 64 \\ 6 & & & & & \textbf{65} \\ \bottomrule \end{tabular} \caption{\textsc{De} Semantic} \end{subtable} \begin{subtable}[b]{0.31\textwidth} \centering \begin{tabular}{c c c c c c} \toprule & 2 & 3 & 4 & 5 & 6 \\ \midrule 2 & 45 & 50 & 53 & 54 & 55 \\ 3 & & 51 & 55 & 55 & \textbf{56} \\ 4 & & & 54 & \textbf{56} & \textbf{56} \\ 5 & & & & \textbf{56} & \textbf{56} \\ 6 & & & & & 54 \\ \bottomrule \end{tabular} \caption{\textsc{De} Syntactic} \end{subtable} \vspace{1em} \begin{subtable}[b]{0.31\textwidth} \centering \begin{tabular}{c c c c c c} \toprule & 2 & 3 & 4 & 5 & 6 \\ \midrule 2 & 41 & 42 & 46 & 47 & \textbf{48} \\ 3 & & 44 & 46 & \textbf{48} & \textbf{48} \\ 4 & & & 47 & \textbf{48} & \textbf{48} \\ 5 & & & & \textbf{48} & \textbf{48} \\ 6 & & & & & \textbf{48} \\ \bottomrule \end{tabular} \caption{\textsc{En-RW}} \end{subtable} \begin{subtable}[b]{0.31\textwidth} \centering \begin{tabular}{c c c c c c} \toprule & 2 & 3 & 4 & 5 & 6 \\ \midrule 2 & 78 & 76 & 75 & 76 & 76 \\ 3 & & 78 & 77 & 78 & 77 \\ 4 & & & 79 & 79 & 79 \\ 5 & & & & \textbf{80} & 79 \\ 6 & & & & & \textbf{80} \\ \bottomrule \end{tabular} \caption{\textsc{En} Semantic} \end{subtable} \begin{subtable}[b]{0.31\textwidth} \centering \begin{tabular}{c c c c c c} \toprule & 2 & 3 & 4 & 5 & 6 \\ \midrule 2 & 70 & 71 & 73 & 74 & 73 \\ 3 & & 72 & 74 & \textbf{75} & 74 \\ 4 & & & 74 & \textbf{75} & \textbf{75} \\ 5 & & & & 74 & 74 \\ 6 & & & & & 72 \\ \bottomrule \end{tabular} \caption{\textsc{En} Syntactic} \end{subtable} \caption{ Study of the effect of sizes of $n$-grams considered on performance. We compute word vectors by using character $n$-grams with $n$ in $\{i, \dots, j\}$ and report performance for various values of $i$ and $j$. We evaluate this effect on German and English, and represent out-of-vocabulary words using subword information. } \label{tab:nsize} \end{table*} We observe that for both English and German, our arbitrary choice of $3$-$6$ was a reasonable decision, as it provides satisfactory performance across languages. The optimal choice of length ranges depends on the considered task and language and should be tuned appropriately. However, due to the scarcity of test data, we did not implement any proper validation procedure to automatically select the best parameters. Nonetheless, taking a large range such as $3-6$ provides a reasonable amount of subword information. This experiment also shows that it is important to include long $n$-grams, as columns corresponding to $n \leq 5$ and $n \leq 6$ work best. This is especially true for German, as many nouns are compounds made up from several units that can only be captured by longer character sequences. On analogy tasks, we observe that using larger $n$-grams helps for semantic analogies. However, results are always improved by taking $n \geq 3$ rather than $n \geq 2$, which shows that character $2$-grams are not informative for that task. As described in Sec.~\ref{sec:model-ngrams}, before computing character $n$-grams, we prepend and append special positional characters to represent the beginning and end of word. Therefore, $2$-grams will not be enough to properly capture suffixes that correspond to conjugations or declensions, since they are composed of a single proper character and a positional one. \subsection{Language modeling} In this section, we describe an evaluation of the word vectors obtained with our method on a language modeling task. We evaluate our language model on five languages (\textsc{Cs}, \textsc{De}, \textsc{Es}, \textsc{Fr}, \textsc{Ru}) using the datasets introduced by \newcite{botha2014compositional}. Each dataset contains roughly one million training tokens, and we use the same preprocessing and data splits as \newcite{botha2014compositional}. Our model is a recurrent neural network with $650$ LSTM units, regularized with dropout (with probability of $0.5$) and weight decay (regularization parameter of $10^{-5}$). We learn the parameters using the Adagrad algorithm with a learning rate of $0.1$, clipping the gradients which have a norm larger than~$1.0$. We initialize the weight of the network in the range $[-0.05, 0.05]$, and use a batch size of $20$. Two baselines are considered: we compare our approach to the log-bilinear language model of \newcite{botha2014compositional} and the character aware language model of \newcite{kim2016character}. We trained word vectors with character $n$-grams on the training set of the language modeling task and use them to initialize the lookup table of our language model. We report the test perplexity of our model without using pre-trained word vectors (\texttt{LSTM}), with word vectors pre-trained without subword information (\texttt{sg}) and with our vectors (\texttt{sisg}). The results are presented in Table~\ref{tab:lm}. \begin{table}[t] \centering \begin{tabular}{rccccc} \toprule & \textsc{Cs} & \textsc{De} & \textsc{Es} & \textsc{Fr} & \textsc{Ru} \\ \midrule Vocab. size & 46k & 37k & 27k & 25k & 63k \\ \midrule \textsc{CLBL} & 465 & 296 & 200 & 225 & 304 \\ \textsc{CANLM} & 371 & 239 & 165 & 184 & 261 \\ \midrule \texttt{LSTM} & 366 & 222 & 157 & 173 & 262 \\ \texttt{sg} & 339 & 216 & 150 & 162 & 237 \\ \texttt{sisg} & \textbf{312} & \textbf{206} & \textbf{145} & \textbf{159} & \textbf{206} \\ \bottomrule \end{tabular} \caption{ Test perplexity on the language modeling task, for 5 different languages. We compare to two state of the art approaches: \textsc{CLBL} refers to the work of \protect\newcite{botha2014compositional} and \textsc{CANLM} refers to the work of \protect\newcite{kim2016character}. } \label{tab:lm} \end{table} \begin{table}[t] \centering \small \begin{tabular}{rrrrr} \toprule & word & \multicolumn{3}{c}{$n$-grams} \\ \midrule & autofahrer & fahr & fahrer & auto \\ & freundeskreis & kreis & kreis> & <freun \\ \textsc{De} & grundwort & wort & wort> & grund \\ & sprachschule & schul & hschul & sprach \\ & tageslicht & licht & gesl & tages \\ \midrule & anarchy & chy & <anar & narchy \\ & monarchy & monarc & chy & <monar \\ & kindness & ness> & ness & kind \\ & politeness & polite & ness> & eness> \\ \textsc{En} & unlucky & <un & cky> & nlucky \\ & lifetime & life & <life & time \\ & starfish & fish & fish> & star \\ & submarine & marine & sub & marin \\ & transform & trans & <trans & form \\ \midrule & finirais & ais> & nir & fini \\ \textsc{Fr} & finissent & ent> & finiss & <finis \\ & finissions & ions> & finiss & sions> \\ \bottomrule \end{tabular} \caption{ Illustration of most important character $n$-grams for selected words in three languages. For each word, we show the $n$-grams that, when removed, result in the most different representation. } \label{tab:morphemes} \end{table} We observe that initializing the lookup table of the language model with pre-trained word representations improves the test perplexity over the baseline LSTM. The most important observation is that using word representations trained with subword information outperforms the plain skipgram model. We observe that this improvement is most significant for morphologically rich Slavic languages such as Czech (8\% reduction of perplexity over \texttt{sg}) and Russian (13\% reduction). The improvement is less significant for Roman languages such as Spanish (3\% reduction) or French (2\% reduction). This shows the importance of subword information on the language modeling task and exhibits the usefulness of the vectors that we propose for morphologically rich languages. \section{Qualitative analysis} \subsection{Nearest neighbors.} We report sample qualitative results in Table~\ref{tab:nn}. For selected words, we show nearest neighbors according to cosine similarity for vectors trained using the proposed approach and for the \texttt{skipgram} baseline. As expected, the nearest neighbors for complex, technical and infrequent words using our approach are better than the ones obtained using the baseline model. \subsection{Character $n$-grams and morphemes} We want to qualitatively evaluate whether or not the most important $n$-grams in a word correspond to morphemes. To this end, we take a word vector that we construct as the sum of $n$-grams. As described in Sec.~\ref{sec:model-ngrams}, each word $w$ is represented as the sum of its $n$-grams: $u_w = \sum_{g \in \mathcal{G}_w} z_g$. For each $n$-gram~$g$, we propose to compute the restricted representation~$u_{w \backslash g}$ obtained by omitting $g$: \begin{equation} u_{w \backslash g} = \sum_{g' \in \mathcal{G} - \{g\}} z_{g'}.\nonumber \end{equation} We then rank $n$-grams by increasing value of cosine between $u_w$ and $u_{w \backslash g}$. We show ranked $n$-grams for selected words in three languages in Table~\ref{tab:morphemes}. For German, which has a lot of compound nouns, we observe that the most important $n$-grams correspond to valid morphemes. Good examples include \emph{Autofahrer} (car driver) whose most important $n$-grams are \emph{Auto} (car) and \emph{Fahrer} (driver). We also observe the separation of compound nouns into morphemes in English, with words such as \emph{lifetime} or \emph{starfish}. However, for English, we also observe that $n$-grams can correspond to affixes in words such as \emph{kindness} or \emph{unlucky}. Interestingly, for French we observe the inflections of verbs with endings such as \emph{ais>}, \emph{ent>} or \emph{ions>}. \subsection{Word similarity for OOV words} As described in Sec.~\ref{sec:model-ngrams}, our model is capable of building word vectors for words that do not appear in the training set. For such words, we simply average the vector representation of its $n$-grams. In order to assess the quality of these representations, we analyze which of the $n$-grams match best for OOV words by selecting a few word pairs from the English RW similarity dataset. We select pairs such that one of the two words is not in the training vocabulary and is hence only represented by its $n$-grams. For each pair of words, we display the cosine similarity between each pair of $n$-grams that appear in the words. In order to simulate a setup with a larger number of OOV words, we use models trained on~$1\%$ of the Wikipedia data as in Sec.~\ref{sec:exp-data-size}. The results are presented in Fig.~\ref{fig:ngram-match}. We observe interesting patterns, showing that subwords match correctly. Indeed, for the word \emph{chip}, we clearly see that there are two groups of $n$-grams in \emph{microcircuit} that match well. These roughly correspond to \emph{micro} and \emph{circuit}, and $n$-grams in between don't match well. Another interesting example is the pair \emph{rarity} and \emph{scarceness}. Indeed, \emph{scarce} roughly matches \emph{rarity} while the suffix \emph{-ness} matches \emph{-ity} very well. Finally, the word \emph{preadolescent} matches \emph{young} well thanks to the \emph{-adolesc-} subword. This shows that we build robust word representations where prefixes and suffixes can be ignored if the grammatical form is not found in the dictionary. \begin{table*}[p] \centering \begin{tabular}{lcccccc} \toprule query & tiling & tech-rich & english-born & micromanaging & eateries & dendritic \\ \midrule \texttt{sisg} & tile & tech-dominated & british-born & micromanage & restaurants & dendrite \\ & flooring & tech-heavy & polish-born & micromanaged & eaterie & dendrites \\ \midrule \texttt{sg} & bookcases & technology-heavy & most-capped & defang & restaurants & epithelial \\ & built-ins & .ixic & ex-scotland & internalise & delis & p53 \\ \bottomrule \end{tabular} \caption{ Nearest neighbors of rare words using our representations and \texttt{skipgram}. These hand picked examples are for illustration.} \label{tab:nn} \end{table*} \begin{figure*}[p] \begin{minipage}[t]{.45\textwidth} \vspace{0pt} \includegraphics[width=\linewidth]{figures/ngram-matching/scarceness-1-rarity-0.pdf} \vspace{0.5em} \\ \includegraphics[width=\linewidth]{figures/ngram-matching/asphaltic-1-paving-0.pdf} \vspace{0.5em} \\ \includegraphics[width=\linewidth]{figures/ngram-matching/interlink-1-connect-0.pdf} \end{minipage} \hspace{2.5em} \begin{minipage}[t]{.475\textwidth} \vspace{0pt} \includegraphics[width=\linewidth]{figures/ngram-matching/preadolescent-1-young-0.pdf} \vspace{0.5em} \\ \includegraphics[width=\linewidth]{figures/ngram-matching/microcircuit-1-chip-0.pdf} \vspace{0.5em} \\ \includegraphics[width=\linewidth]{figures/ngram-matching/piquancy-1-spiciness-0.pdf} \end{minipage} \caption{ Illustration of the similarity between character $n$-grams in out-of-vocabulary words. For each pair, only one word is OOV, and is shown on the $x$ axis. Red indicates positive cosine, while blue negative. } \label{fig:ngram-match} \end{figure*} \section{Model} In this section, we propose our model to learn word representations while taking into account morphology. We model morphology by considering subword units, and representing words by a sum of its character $n$-grams. We will begin by presenting the general framework that we use to train word vectors, then present our subword model and eventually describe how we handle the dictionary of character $n$-grams. \subsection{General model} We start by briefly reviewing the continuous skipgram model introduced by \newcite{mikolov2013distributed}, from which our model is derived. Given a word vocabulary of size $W$, where a word is identified by its index $w~\in~\{1, ..., W\}$, the goal is to learn a vectorial representation for each word $w$. Inspired by the distributional hypothesis~\cite{harris1954distributional}, word representations are trained to \emph{predict well} words that appear in its context. More formally, given a large training corpus represented as a sequence of words $w_1, ..., w_T$, the objective of the skipgram model is to maximize the following log-likelihood: \begin{equation*} \sum_{t=1}^T \ \sum_{c \in \mathcal{C}_t} \ \log p(w_c \ | \ w_t), \end{equation*} where the context $\mathcal{C}_t$ is the set of indices of words surrounding word $w_t$. The probability of observing a context word $w_c$ given $w_t$ will be parameterized using the aforementioned word vectors. For now, let us consider that we are given a scoring function~$s$ which maps pairs of (word, context) to scores in~$\mathbb{R}$. One possible choice to define the probability of a context word is the softmax: \begin{equation*} p(w_c \ | \ w_t) = \frac{e^{s(w_t,\ w_c)}}{\sum_{j=1}^W e^{s(w_t,\ j)}}. \end{equation*} However, such a model is not adapted to our case as it implies that, given a word $w_t$, we only predict one context word $w_c$. The problem of predicting context words can instead be framed as a set of independent binary classification tasks. Then the goal is to independently predict the presence (or absence) of context words. For the word at position $t$ we consider all context words as positive examples and sample negatives at random from the dictionary. For a chosen context position $c$, using the binary logistic loss, we obtain the following negative log-likelihood: \begin{equation*} \log \left(1 + e^{-s(w_t,\ w_c)} \right) + \sum_{n \in \mathcal{N}_{t, c}} \log \left(1 + e^{s(w_t,\ n)}\right), \end{equation*} where $\mathcal{N}_{t,c}$ is a set of negative examples sampled from the vocabulary. By denoting the logistic loss function $\ell: x \mapsto \log(1 + e^{-x})$, we can re-write the objective as: \begin{equation*} \sum_{t=1}^{T} \left [ \sum_{c \in \mathcal{C}_t} \ell(s(w_t,\ w_c)) + \sum_{n \in \mathcal{N}_{t,c}} \ell(-s(w_t,\ n)) \right ]. \end{equation*} A natural parameterization for the scoring function $s$ between a word $w_t$ and a context word $w_c$ is to use word vectors. Let us define for each word $w$ in the vocabulary two vectors $u_w$ and $v_w$ in $\mathbb{R}^d$. These two vectors are sometimes referred to as \emph{input} and \emph{output} vectors in the literature. In particular, we have vectors $\mathbf{u}_{w_t}$ and $\mathbf{v}_{w_c}$, corresponding, respectively, to words $w_t$ and $w_c$. Then the score can be computed as the scalar product between word and context vectors as $s(w_t, w_c) = \mathbf{u}_{w_t}^{\top} \mathbf{v}_{w_c}$. The model described in this section is the skipgram model with negative sampling, introduced by \newcite{mikolov2013distributed}. \subsection{Subword model} \label{sec:model-ngrams} By using a distinct vector representation for each word, the skipgram model ignores the internal structure of words. In this section, we propose a different scoring function $s$, in order to take into account this information. Each word $w$ is represented as a bag of character $n$-gram. We add special boundary symbols \texttt{<} and \texttt{>} at the beginning and end of words, allowing to distinguish prefixes and suffixes from other character sequences. We also include the word $w$ itself in the set of its $n$-grams, to learn a representation for each word (in addition to character $n$-grams). Taking the word \emph{where} and $n=3$ as an example, it will be represented by the character $n$-grams: \begin{center} \texttt{<wh, whe, her, ere, re>} \end{center} and the special sequence \begin{center} \texttt{<where>}. \end{center} Note that the sequence \texttt{<her>}, corresponding to the word \emph{her} is different from the tri-gram \texttt{her} from the word \emph{where}. In practice, we extract all the $n$-grams for $n$ greater or equal to 3 and smaller or equal to $6$. This is a very simple approach, and different sets of $n$-grams could be considered, for example taking all prefixes and suffixes. Suppose that you are given a dictionary of $n$-grams of size $G$. Given a word $w$, let us denote by $\mathcal{G}_w \subset \{1, \dots, G \}$ the set of $n$-grams appearing in $w$. We associate a vector representation $\mathbf{z}_g$ to each $n$-gram $g$. We represent a word by the sum of the vector representations of its $n$-grams. We thus obtain the scoring function: \begin{equation*} s(w, c) = \sum_{g \in \mathcal{G}_w} \mathbf{z}_g^\top \mathbf{v}_c. \end{equation*} This simple model allows sharing the representations across words, thus allowing to learn reliable representation for rare words. In order to bound the memory requirements of our model, we use a hashing function that maps $n$-grams to integers in 1 to $K$. We hash character sequences using the Fowler-Noll-Vo hashing function (specifically the \texttt{FNV-1a} variant).\footnote{\smaller\relax\url{http://www.isthe.com/chongo/tech/comp/fnv}} We set $K = 2.10^6$ below. Ultimately, a word is represented by its index in the word dictionary and the set of hashed $n$-grams it contains. \section{Related work} \paragraph{Morphological word representations.} In recent years, many methods have been proposed to incorporate morphological information into word representations. To model rare words better, \newcite{alexandrescu2006factored} introduced factored neural language models, where words are represented as sets of features. These features might include morphological information, and this technique was succesfully applied to morphologically rich languages, such as Turkish~\cite{sak2010morphology}. Recently, several works have proposed different composition functions to derive representations of words from morphemes~\cite{lazaridou2013compositional,luong2013better,botha2014compositional,qiu2014colearning}. These different approaches rely on a morphological decomposition of words, while ours does not. Similarly, \newcite{chen2015joint} introduced a method to jointly learn embeddings for Chinese words and characters. \newcite{cui2015knet} proposed to constrain morphologically similar words to have similar representations. \newcite{soricut2015unsupervised} described a method to learn vector representations of morphological transformations, allowing to obtain representations for unseen words by applying these rules. Word representations trained on morphologically annotated data were introduced by \newcite{cotterell2015morphological}. Closest to our approach, \newcite{schutze1993word} learned representations of character four-grams through singular value decomposition, and derived representations for words by summing the four-grams representations. Very recently, \newcite{wieting2016charagram} also proposed to represent words using character $n$-gram count vectors. However, the objective function used to learn these representations is based on paraphrase pairs, while our model can be trained on any text corpus. \paragraph{Character level features for NLP.} Another area of research closely related to our work are character-level models for natural language processing. These models discard the segmentation into words and aim at learning language representations directly from characters. A first class of such models are recurrent neural networks, applied to language modeling~\cite{mikolov2012subword,sutskever2011generating,graves2013generating,bojanowski2015alternative}, text normalization~\cite{chrupala2014normalizing}, part-of-speech tagging~\cite{ling2015finding} and parsing~\cite{ballesteros2015improved}. Another family of models are convolutional neural networks trained on characters, which were applied to part-of-speech tagging~\cite{santos2014learning}, sentiment analysis~\cite{santos2014deep}, text classification~\cite{zhang2015character} and language modeling~\cite{kim2016character}. \newcite{sperr2013letter} introduced a language model based on restricted Boltzmann machines, in which words are encoded as a set of character $n$-grams. Finally, recent works in machine translation have proposed using subword units to obtain representations of rare words~\cite{sennrich2016neural,luong2016hybrid}. \section{Introduction} Learning continuous representations of words has a long history in natural language processing~\cite{rumelhart1988learning}. These representations are typically derived from large unlabeled corpora using co-occurrence statistics~\cite{deerwester1990indexing,schutze1992dimensions,lund1996producing}. A large body of work, known as distributional semantics, has studied the properties of these methods~\cite{turney2010frequency,baroni2010distributional}. In the neural network community, \newcite{collobert2008unified} proposed to learn word embeddings using a feedforward neural network, by predicting a word based on the two words on the left and two words on the right. More recently, \newcite{mikolov2013distributed} proposed simple log-bilinear models to learn continuous representations of words on very large corpora efficiently. Most of these techniques represent each word of the vocabulary by a distinct vector, without parameter sharing. In particular, they ignore the internal structure of words, which is an important limitation for morphologically rich languages, such as Turkish or Finnish. For example, in French or Spanish, most verbs have more than forty different inflected forms, while the Finnish language has fifteen cases for nouns. These languages contain many word forms that occur rarely (or not at all) in the training corpus, making it difficult to learn good word representations. Because many word formations follow rules, it is possible to improve vector representations for morphologically rich languages by using character level information. In this paper, we propose to learn representations for character $n$-grams, and to represent words as the sum of the $n$-gram vectors. Our main contribution is to introduce an extension of the continuous skipgram model~\cite{mikolov2013distributed}, which takes into account subword information. We evaluate this model on nine languages exhibiting different morphologies, showing the benefit of our approach. \input{relatedwork} \input{model} \input{experiments} \section{Conclusion} In this paper, we investigate a simple method to learn word representations by taking into account subword information. Our approach, which incorporates character $n$-grams into the skipgram model, is related to an idea that was introduced by \newcite{schutze1993word}. Because of its simplicity, our model trains fast and does not require any preprocessing or supervision. We show that our model outperforms baselines that do not take into account subword information, as well as methods relying on morphological analysis. We will open source the implementation of our model, in order to facilitate comparison of future work on learning subword representations. \subsection*{Acknowledgements} We thank Marco Baroni, Hinrich Schütze and the anonymous reviewers for their insightful comments.
{'timestamp': '2017-06-20T02:14:36', 'yymm': '1607', 'arxiv_id': '1607.04606', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04606'}
arxiv
\section{Introduction and Related Work} Automatic analysis of urban traffic activities is an urgent need due to essential traffic management and increased vehicle violations. Among many traffic surveillance techniques, computer vision-based methods have attracted a great deal of attention and made great contributions to realistic applications such as vehicle counting, target vehicle retrieval and behavior analysis. In these research areas, efficient and accurate vehicle detection and attributes annotation is the most important component of traffic surveillance systems. Vehicle detection is a fundamental objective of traffic surveillance. Traditional vehicle detection methods can be categorized into frame-based and motion-based approaches~\cite{sivaraman2013looking,buch2011review}. For motion-based approaches, frames subtraction \cite{park2007video}, adaptive background modeling \cite{stauffer1999adaptive} and optical flow \cite{martinez2008driving,liu2013learning} are often utilized. However, some non-vehicle moving objects will be falsely detected with motion-based approaches since less visual information is exploited. To achieve higher detection performance, recently, the deformable part-based model (DPM) \cite{felzenszwalb2010object} employs a star-structured architecture consisting of root and parts filters with associated deformation models for object detection. DPM can successfully handle deformable object detection even when the target is partially occluded. However, it leads to heavy computational costs due to the use of the sliding window precedure for appearance features extraction and classification. With the wide success of deep networks on image classification \cite{krizhevsky2012imagenet,karpathy2014large,wu2016deep,wu2014leveraging,dong2015deep}, a Region-based CNN (RCNN) \cite{girshick2014rich} combines object proposals, CNN learned features and an SVM classifier for accurate object detection. To further increase the detection speed and accuracy, Fast RCNN \cite{girshick2015fast} adopts a region of interest (ROI) pooling layer and the multi-task loss to estimate object classes while predicting bounding-box positions. ``Objectness" proposal methods such as Selective Search \cite{uijlings2013selective} and Edgeboxes \cite{zitnick2014edge} can be introduced in RCNN and Fast RCNN to improve the efficiency compared to the traditional sliding window fashion. Furthermore, Faster RCNN \cite{ren2015faster} employs a Region Proposal Network (RPN) with shared convolutional features to enable cost-free effective proposals. All these deep models target general object detection. In our task, we aim for real-time detection of a special object type, vehicle. Besides, in urban traffic surveillance, another interesting and valuable task is to extract more diverse information from detected vehicles - we call it vehicle attributes annotation. Each individual vehicle on the road has its special attributes: travel direction (i.e., pose), inherent color, type and other more fine-grained information with respect to the headlight, grille and wheel. It is extremely beneficial to annotate a target vehicle's attributes accurately. Lin et al. \cite{yang2014object} presents an auto-masking neural network for vehicle detection and pose estimation. In \cite{li2010vehicle}, an approach by vector matching of template is introduced for vehicle color recognition. In \cite{dong2014vehicle}, unsupervised convolutional neural network is adopted for vehicle type classification from frontal view images. However, independent analysis of different attributes makes visual information not well explored and the process inefficient, and little work has been done for annotating these vehicle attributes simultaneously. Actually, there exist strong correlations between these vehicle attributes learning tasks. For example, vehicle type classification based on visual structures is very dependent on the viewpoint. Therefore, we believe multi-task learning \cite{shao2015deeply,liu2016dap3d} can be helpful since such joint learning schemes can implicitly learn the common features shared by these correlated tasks. Moreover, a unified multi-attributes inference model can also significantly improve the efficiency. \begin{figure}[t] \centering \includegraphics[width=1\textwidth]{system.jpg}\\ \caption{\scriptsize{ \textbf{Illustration of DAVE}. Vehicle detection and corresponding pose, color and type annotation can be simultaneously achieved by DAVE as shown in the right sub-figure.}} \label{exampless} \vspace{-3ex} \end{figure} Inspired by the advantages and drawbacks of previous work, in this paper, we propose a fast framework DAVE based on convolutional neural networks (CNNs), as shown in Fig. 1, for vehicle detection and attributes annotation in urban traffic surveillance. In particular, DAVE consists of two CNNs: fast vehicle proposal network (FVPN) and attributes learning network (ALN). The FVPN is a shallow\emph{ fully convolutional network} which is able to predict all the bounding-boxes of vehicle-like objects in real-time. The latter ALN configured with a very deep structure can precisely verify each proposal and infer pose, color and type information for positive vehicles, simultaneously. It is noteworthy that informative features learned from the deep ALN can be regarded as latent data-driven knowledge to guide the training of the shallow FVPN, thus we bridge the ALN and FVPN with such knowledge guidance and jointly optimize these two CNNs at the same time in our architecture. In this way, more exhaustive vehicle descriptions learned from the ALN as helpful supervision benefits the FVPN with better performance. Once the joint training is finished, a two-stage inference scheme will be adopted for final vehicle annotation. The main contributions of our work are highlighted as follows: \textbf{1.} We unify multiple vehicle-related tasks into one deep vehicle annotation framework DAVE which can effectively and efficiently annotate each vehicle's bounding-box, pose, color and type simultaneously. \textbf{2.} Two CNNs proposed in our method, i.e., the Fast Vehicle Proposal Network (FVPN) and the vehicle Attributes Learning Network (ALN), are optimized in a joint manner by bridging two CNNs with latent data-driven knowledge guidance. In this way, the deeper ALN can benefit the performance of the shallow FVPN. \textbf{3.} We introduce a new Urban Traffic Surveillance (UTS) vehicle dataset consisting of six $1920\times1080$ (FHD) resolution videos with varying illumination conditions and viewpoints. \section{Detection and Annotation for Vehicles (DAVE)} We unify vehicle detection and annotation of pose, color and type into one framework: DAVE. As illustrated in Fig. 2, DAVE consists of two convolutional neural networks called fast vehicle proposal network (FVPN) and attributes learning network (ALN), respectively. FVPN aims to predict all the positions of vehicle-like objects in real-time. Afterwards, these vehicle proposals are passed to the ALN to simultaneously verify all the positive vehicles and infer their corresponding poses, colors and types. In the training phase, FVPN and ALN are optimized jointly, while two-stage inference is used in the test phase. Specifically, training our DAVE is inspired by \cite{hinton2015distilling} that knowledge learned from solid deep networks can be distilled to teach shallower networks. We apply latent data-driven knowledge from the deep ALN to guide the training of the shallow FVPN. This method proves to be able to enhance the performance of the FVPN to some extent through experiments. The architecture of FVPN and ALN will be described in the following subsections. \begin{figure}[t] \centering \includegraphics[width=0.975\textwidth]{learning.jpg}\\ \caption{ \textbf{Training Architecture of DAVE.} Two CNNs: FVPN and ALN are simultaneously optimized in a joint manner by bridging them with latent data-driven knowledge guidance.} \label{exampless} \end{figure} \subsection{Fast Vehicle Proposal Network (FVPN)} Searching the whole image to locate potential vehicle positions in a sliding window fashion is prohibitive for real-time applications. Traditional object proposal methods are put forward to alleviate this problem, but thousands of proposals usually contain numerous false alarms and duplicate predictions which heavily lower the efficiency. Particularly for one specific object, we expect very fast and accurate proposal performance can be achieved. Our proposed fast vehicle proposal network (FVPN) is a shallow \emph{fully convolutional network}, which aims to precisely localize all the vehicle-like objects in real-time. We are interested in exploring whether or not a small scale CNN is enough to handle the single object proposal task. A schematic diagram of the FVPN is depicted in the bottom part of Fig. 2. The first convolutional layer (\emph{conv\_1}) filters the $60\times60$ training images with 32 kernels of size $5\times5$. The second convolutional layer (\emph{conv\_2}) takes as input the feature maps obtained from the previous layer and filters them with 64 kernels of size $5\times5$. Max pooling and Rectified Linear Units (ReLU) layers are configured after the first two convolutional layers. The third convolutional layer (\emph{conv\_3}) with 64 kernels of size $3\times3$ is branched into three sibling $1\times1$ convolutional layers transformed by traditional fully connected layers. In detail, \emph{Conv\_fc\_class} outputs softmax probabilities of positive samples and the background; \emph{Conv\_fc\_bbr} encodes bounding-box coordinates for each positive sample; \emph{Conv\_fc\_knowledge} is configured for learning latent data-driven knowledge distilled from the ALN, which makes the FVPN be trained with more meticulous vehicle features. Inspired by \cite{long2015fully}, these $1\times1$ convolutional layers can successfully lead to differently purposed heatmaps in the inference phase. This property will directly achieve real-time vehicle localization from whole images/frames by our FVPN. We employ different loss supervision layers for three corresponding tasks in the FVPN. First, discrimination between a vehicle and the background is a simple binary classification problem. A softmax loss layer is applied to predict vehicle confidence, $p^c=\{p_{ve}^c,p_{bg}^c\}$. Besides, each bounding-box is encoded by 4 predictions: $x$, $y$, $w$ and $h$. $x$ and $y$ denote the left-top coordinates of the vehicle position, while $w$ and $h$ represent the width and height of the vehicle size. We normalize all the 4 values relative to the image width and height so that they can be bounded between 0 and 1. Note that all bounding boxes' coordinates are set as \emph{zero} for background samples. Following \cite{girshick2015fast}, a smooth L1 loss layer is used for bounding-box regression to output the refined coordinates vector, $loc=(\hat{x},\hat{y},\hat{w},\hat{h})$. Finally, for guiding with latent data-driven knowledge of an N-dimensional vector distilled from a deeper net, the cross-entropy loss is employed for $p^{know}=\{p_0^{know}\ldots p_{N-1}^{know}\}$. We adopt a multi-task loss $L_{FVPN}$ on each training batch to jointly optimize binary classification of a vehicle against background, bounding-box regression and learning latent knowledge from a deeper net as the following function: \begin{equation} \label{eq:e1} \small L_{FVPN}(loc, p^{bic},p^{know})=L_{bic}(p^{bic})+\alpha L_{bbox}(loc)+\beta L_{know}(p^{know}), \end{equation} where $L_{bic}$ denotes the softmax loss for binary classification of vehicle and background. $L_{bbox}$ indicates a smooth $\ell_1$ loss defined in \cite{girshick2015fast} as: \begin{equation} \label{eq:e1} \small L_{bbox}(loc)=f_{L1}(loc-loc_{t}),\ \mathrm{where}\ f_{L1}(x) = \left\{\begin{array}{l} 0.5x^{2},~ \text{if}\ |x|<1 \\ |x|-0.5,~ \text{otherwise} \end{array} \right. \end{equation} Furthermore, the cross entropy loss $L_{know}$ is to guide the training of the FVPN by a latent N-dimensional feature vector $t^{know}$ learned from a more solid net, which is defined as: \begin{equation} \small L_{know}(p^{know})=-\frac{1}{N}\sum_{i}^{N}t^{know}_{i}\log p^{know}_{i}+(1-t^{know}_{i})\log (1-p^{know}_{i}). \end{equation} It is noteworthy that a bounding-box for the background is meaningless in the FVPN back-propagation phase and will cause training to diverge early \cite{redmon2015you}, \emph{thus we set $\alpha=0$ for background samples, otherwise $\alpha=0.5$.} Besides, $\beta$ is fixed to $0.5$. \subsection{Attributes Learning Network (ALN)} Modeling vehicle pose estimation, color recognition and type classification separately is less accurate and inefficient. Actually, relationships between these tasks can be explored, so that designing a multi-task network is beneficial for learning shared features which can lead to extra performance gains. The attribute learning network (ALN) is a unified network to verify vehicle candidates and annotate their poses, colors and types. The network architecture of the ALN is mainly inspired by the GoogLeNet \cite{szegedy2015going} model. Specifically, we design the ALN by adding 4 fully connected layers to extend the GoogLeNet into a multi-attribute learning model. The reason to adopt such a very deep structure here is because vehicle annotation belongs to fine-grained categorization problems and a deeper net has more powerful capability to learn representative and discriminative features. Another advantage of the ALN is its high-efficiency inherited from the GoogLeNet which has lower computation and memory costs compared with other deep nets such as the VGGNet \cite{simonyan2014very}. The ALN is a multi-task network optimized with four softmax loss layers for vehicle annotation tasks. Each training image has four labels in $V$, $P$, $C$ and $T$. $V$ determines whether a sample is a vehicle. If $V$ is a true vehicle, the remaining three attributes $P$, $C$ and $T$ represent its pose, color and type respectively. However, if $V$ is the background or a vehicle with a catch-all\footnote{``Catch-all" indicates other undefined types and colors which are not included in our training model.} type or color, $P$, $C$ and $T$ are set as \emph{zero} denoting attributes are unavailable in the training phase. The first softmax loss layer $L_{verify} (p^V)$ for binary classification (vehicle vs. background) is the same as $L_{bic} (p^c)$ in the FVPN. The softmax loss $L_{pose} (p^P)$, $L_{color} (p^C)$ and $L_{type} (p^T)$ are optimized for pose estimation, color recognition and vehicle type classification respectively, where $p^P=\{p_1^P,\ldots,p_{np}^P\}$, $p^C=\{p_1^C,\ldots,p_{nc}^C\}$ and $p^T=\{p_1^T,\ldots, p_{nt}^T\}$. \{$np$, $nc$, $nt$\} indicate the number of vehicle poses, colors and types respectively. The whole loss function is defined as follows: \begin{equation} \label{eq:e1} \small L_{ALN}(p^{V},p^{P},p^{C},p^{T})=L_{verify}(p^{V})+\lambda_{1} L_{pose}(p^{P})+\lambda_{2} L_{color}(p^{C})+\lambda_{3} L_{type}(p^{T}), \end{equation} where all the four sub loss functions are softmax loss for vehicle verification (\emph{\textbf{``verification" in this paper means confirming whether a proposal is vehicle}}), pose estimation, color recognition and type classification. \emph{Following the similar case of $\alpha$ in Eq. (1), parameters $\{\lambda_1,\lambda_2,\lambda_3\}$ are all fixed as 1 for the positive samples, otherwise as 0 for the background.} \subsection{Deep Nets Training} \subsubsection{Training Dataset and Data Augmentation} We adopt the large-scale CompCars dataset \cite{yang2015large} with more than 100,000 web-nature data as the positive training samples which are annotated with tight bounding-boxes and rich vehicle attributes such as pose, type, make and model. In detail, the web-nature part of the CompCars dataset provides five viewpoints as \emph{front}, \emph{rear}, \emph{side}, \emph{frontside} and \emph{rearside}, twelve vehicle types as \emph{MPV, SUV, sedan, hatchback, minibus, pickup, fastback, estate, hardtop-convertible, sports, crossover} and \emph{convertible}. To achieve an even training distribution, we discard less common vehicle types with few training images and finally select six types with all the five viewpoints illustrated in Fig. 3(a) to train our model. Besides, since color is another important attribute of a vehicle, we additionally annotate colors on more than 10,000 images with five common vehicle colors as \emph{black, white, silver, red} and \emph{blue} to train our final model. Apart from positive samples, about 200,000 negative samples without any vehicles are cropped from Google Street View Images to compose our training data. For data augmentation, we first triple the training data with increased and decreased image intensities for making our DAVE more robust under different lighting conditions. In addition, image downsampling up to 20\% of the original size and image blurring are introduced to enable that detected vehicles with small sizes can be even annotated as precisely as possible. \subsubsection{Jointly Training with Latent Knowledge Guidance} The entire training structure of DAVE is illustrated in Fig. 2. We optimize the FVPN and the ALN jointly but with different sized input training data at the same time. The input resolution of the ALN is $224\times224$ for fine-grained vehicle attributes learning, while it is decreased to $60\times60$ for the FVPN to fit smaller scales of the test image pyramid for efficiency in the inference phase. In fact, the resolution of $60\times60$ can well guarantee the coarse shape and texture of a vehicle is discriminative enough against the background. Besides, another significant difference between the ALN and the FVPN is that input vehicle samples for the ALN are tightly cropped, however, for the FVPN, uncropped vehicles are used for bounding-box (labeled as $loc_t$ in Eq. (2)) regressor training. \begin{figure*}[t] \centering \begin{tabular}{cc} \includegraphics[width=0.49\textwidth,height=0.22\textheight]{data.jpg} &\includegraphics[width=0.49\textwidth,height=0.22\textheight]{training_loss.JPG}\\ \footnotesize (a) &\footnotesize (b) \\ \end{tabular} \caption{ \textbf{}(a) Examples of training data (columns indicate vehicle types, while rows indicate poses and colors), (b) Training loss with/without knowledge learning.} \label{nasaacc} \end{figure*} The pre-trained GoogLeNet model for 1000-class ImageNet classification is used to initialize all the convolutional layers in the ALN, while the FVPN is trained from scratch. A 1024-dimensional feature vector of the \emph{pool5/7$\times$7\_s1} layer in the ALN, which can exhaustively describe a vehicle, is extracted as the latent data-driven knowledge guidance to supervise the same dimensional \emph{Conv\_fc\_knowledge} layer in the FVPN by cross entropy loss. We first jointly train ALN and FVPN for about 10 epochs on the selected web-nature data that only contains pose and type attributes from the CompCars. In the next 10 epochs, we fine-tune the models by a subset with our complemented color annotations. Throughout the training process, we set the batch size as 64, and the momentum and weight decay are configured as 0.9 and 0.0002, respectively. Learning rate is scheduled as $10^{-3}$ for the first 10 epochs and $10^{-4}$ for the second 10 epochs. To make our method more convincing, we train two models with and without knowledge guidance, respectively. During training, we definitely discover that knowledge guidance can indeed benefit training the shallow FVPN to obtain lower training losses. Training loss curves for the first 10 epochs are depicted in Fig. 3(b). \begin{figure} [t] \centering \includegraphics[width=0.975\textwidth]{inference_phase.jpg}\\ \caption{ \textbf{A two-stage inference phase of DAVE.} Vehicle proposals are first obtained from FVPN in real-time. Afterwards, we use ALN to verify each proposal and annotate each positive one with the vehicle pose, color and type.} \label{exampless} \end{figure} \subsection{Two-stage Deep Nets Inference} Once the joint training is finished, a two-stage scheme is implemented for inference of DAVE. First, the FVPN takes as input the 10-level test image Gaussian pyramid. For each level, the FVPN is operated over the input frame to infer \emph{Conv\_fc\_class} and \emph{Conv\_fc\_bbr} layers as corresponding heatmaps. All the 10 \emph{Conv\_fc\_class} heatmaps are unified into one map by rescaling all the channels to the largest size among them and keeping the maximum along channels, while the index of each maximum within 10 channels is used to obtain four unified \emph{Conv\_fc\_bbr} heatmaps (10 levels by similar rescaling). After unifying different levels \emph{Conv\_fc\_class} heatmaps into the final vehicle proposal score map, we first filter the score map with threshold $thres$ to discard low hot spots, and then local peaks on the map are detected by a circle scanner with tuneable radius $r$. In all our experiments, $r = 8$ and $thres = 0.5$ are fixed. Thus, these local maximal positions are considered as the central coordinates of proposals, ($\hat{x_i}$ ,$\hat{y_i}$). Coarse width and height of each proposal can be simply predicted based on the bounding-box of its corresponding hot spot centered on each local peak. If one hot spot contains multiple peaks, the width and height will be shared by these peaks (i.e. proposals). For preserving the complete vehicle body, coarse width and height are multiplied by fixed parameter $m = 1.5$ to generate ($\hat{w}_i^{nobbr}$ ,$\hat{h}_i^{nobbr}$). Thus, a preliminary bounding-box can be represented as ($\hat{x_i}$,$\hat{y_i}$,$\hat{w}_i^{nobbr}$ ,$\hat{h}_i^{nobbr}$). Finally, bounding-box regression offset values (within [0,1]) are extracted from four unified heatmaps of \emph{Conv\_fc\_bbr} at those coordinates ($\hat{x_i}$,$\hat{y_i}$) to obtain the refined bounding-box. Vehicle proposals inferred from the FVPN are taken as inputs into the ALN. Although verifying each proposal and annotation of attributes are at the same stage, we assume that verification has a higher priority. For instance, in the inference phase, if a proposal is predicted as a positive vehicle, it will then be annotated with a bounding-box and inferred pose, color and type. However, a proposal predicted as the background will be neglected in spite of its inferred attributes. Finally, we perform non-maximum suppression as in RCNN \cite{girshick2014rich} to eliminate duplicate detections. The full inference scheme is demonstrated in Fig. 4. At present, it is difficult to train a model that has the capability to annotate all the vehicles with enormously rich vehicle colors and types. During inference, a vehicle with untrained colors and types is always categorized into similar classes or a catch-all ``others" class, which is a limitation of DAVE. In future work, we may expand our training data to include more abundant vehicle classes. \section{Experiments and Results} In this section, we evaluate our DAVE for detection and annotation of pose, color and type for each detected vehicle. Experiments are mainly divided as two parts: vehicle detection and attributes learning. DAVE is implemented based on the deep learning framework Caffe \cite{jia2014caffe} and run on a workstation configured with an NVIDIA TITAN X GPU. \subsection{Evaluation of Vehicle Detection} To evaluate vehicle detection, we train our models using the large-scale CompCars dataset as mentioned before, and test on three other vehicle datasets. We collect a full high definition ($1920\times1080$) Urban Traffic Surveillance (UTS) vehicle dataset with six videos which were captured from different viewpoints and illumination conditions. Each video sequence contains 600 annotated frames. To be more convincing, we also compare our method on two other public datasets: the PASCAL VOC2007 car dataset \cite{everingham2010pascal} and the LISA 2010 dataset \cite{sivaraman2010general} with four competitive models: DPM \cite{felzenszwalb2010object}, RCNN \cite{ren2015faster}, Fast RCNN \cite{girshick2015fast} and Faster RCNN \cite{ren2015faster}. These four methods obtain state-of-the-art performances on general object detection and the codes are publicly available. We adopt the trained car model in voc-release5 \cite{voc-release5} for DPM, while train models (VGG-16 version) for RCNN, Fast RCNN and Faster RCNN ourselves on the CompCars dataset to implement vehicle detection as our DAVE. The vehicle detection evaluation criterion is the same as PASCAL object detection \cite{everingham2010pascal}. Intersection over Union (IoU) is set as 0.7 to assess correct localization. \subsubsection{Testing on the UTS dataset} Since our FVPN can be considered as a high-accuracy proposal model for a single specific object, we test it independently. Then, results from vehicle verification by the deeper ALN (i.e., FVPN+verify in Fig. 5) are shown as our final accuracies. The detection accuracy as average precision (AP) and speed as frames-per-second (FPS) are compared in the left column of Table 1. Our model outperforms all the other methods with obvious improvements. Specifically, our method obtains an increased AP of 3.03\% compared to the best model Faster RCNN, and the shallow proposal network FVPN independently achieves 57.28\% which is only lower than Faster RCNN. The other two deep models, RCNN and Fast RCNN, do not produce satisfactory results mainly due to the low-precision proposals extracted by Selective Search \cite{uijlings2013selective}. Mixture-DPM with bounding-box prediction (MDPM-w-BB \cite{felzenszwalb2010object}) significantly improve the performance compared to MDPM-w/o-BB \cite{felzenszwalb2010object} by 10.77\%. For the evaluation of efficiency, our FVPN with a shallow and thin architecture can achieve real-time performance with 30 fps on FHD video frames. Although the deeper ALN slows the entire detection framework, 2 fps performance still shows competitive speed with Faster RCNN (4 fps). We also test the FVPN trained without knowledge guidance, the AP decreases by 2.37\%, which explains the significant advancement of knowledge guidance. In addition, experiments are carried out to demonstrate that bounding-box regression can be helpful with the AP increased by 0.96\%. \begin{table} \center \newcommand{\tabincell}[2]{\begin{tabular}{@{}#1@{}}#2\end{tabular}} \caption{\small \textbf{Vehicle detection AP (\%) and speed (fps) comparison on the UTS, PASCAL VOC2007 and LISA 2010 datasets}} \label{table:t1} \resizebox{1\textwidth}{!}{ \begin{tabular}{|c||c|c||c|c||c|c|} \cline{1-7} \multirow{3}{*}{\textbf{\tabincell{c}{Methods}}}&\multicolumn{2}{c||}{\textbf{UTS}} &\multicolumn{2}{c||}{\textbf{PASCAL VOC2007}}&\multicolumn{2}{c|}{\textbf{LISA 2010}} \\ \cline{2-7} & \textbf{\tabincell{c}{Average\\ Precision (AP)}} & \textbf{\tabincell{c}{Processing\\ Speed (fps)}} & \textbf{\tabincell{c}{Average\\ Precision (AP)}} &\textbf{\tabincell{c}{Processing\\ Speed (fps)}}& \textbf{\tabincell{c}{Average\\ Precision (AP)}} &\textbf{\tabincell{c}{Processing\\ Speed (fps)}}\\ \hline \hline MDPM-w/o-BB&41.96\% &0.25 &48.44\% &1.25 &63.61\% &0.7 \\ \hline MDPM-w-BB&52.73\% &0.2 &57.14\% &1.25 &72.89\% &0.7 \\ \hline RCNN&44.87\% &0.03 &38.52\% &0.08 &55.37\% &0.06 \\ \hline FastRCNN&51.58\% &0.4 &52.95\% &0.5 &53.37\% &0.5 \\ \hline FasterRCNN&59.82\% &\textbf{4} &63.47\% &\textbf{6} &77.09\% &\textbf{6} \\ \hline \hline FVPN-w/o-knowledge guide &54.91\% &30 &58.12\% &46 &72.37\% &42 \\ \hline FVPN-w/o-bbr&56.32\% &30 &58.93\% &46 &71.82\% &42 \\ \hline \textbf{FVPN}&57.28\% &\textbf{30} &60.05\% &\textbf{46} &73.46\% &\textbf{42} \\ \hline \textbf{FVPN+Verify}&\textbf{62.85\%} &2 &\textbf{64.44\% }&4 &\textbf{79.41\%} &4 \\ \hline \end{tabular} }\tiny \\``bbr" indicates the bounding-box regressor used in our model, while ``BB" denotes bounding-box prediction used in DPM model. ``w" and ``w/o" are the abbreviations of ``with" and ``without", respectively. ``Verify" denotes the vehicle verification in the ALN. \vspace{-4ex} \end{table} \subsubsection{Testing on the PASCAL VOC2007 car dataset and the LISA 2010 dataset} To make our methods more convincing, we also evaluate on two public datasets. All the images containing vehicles in the trainval and test sets (totally 1434 images) in the PASCAL VOC 2007 dataset are extracted to be evaluated. In addition, the LISA 2010 dataset contains three video sequences with low image quality captured from a on-board camera. All the results are shown in the middle and right columns of Table 1. For the PASCAL VOC2007 dataset, our model (FVPN+verify) achieves 64.44\% in AP, which outperforms MDPM-w-BB, RCNN, FastRCNN and Faster RCNN by 7.3\%, 25.92\%, 11.49\% and 0.97\%, respectively. Likewise, our FVPN can even obtain a high AP of 60.05\%. For the LISA 2010 dataset, the highest accuracy of 79.41\% by our model beats all other methods as well. Therefore, it demonstrates that our method is able to stably detect vehicles with different viewpoints, occlusions and image qualities. Fig. 5 presents the precision-recall curves of all the compared methods on UTS, PASCAL VOC2007 car dataset and the LISA 2010 dataset, respectively. From all these figures, we can further discover that, for all three datasets, FVPN+Verify achieves better performance than other detection methods by comparing Area Under the Curve (AUC). Besides, some qualitative detection results including successful and failure cases are shown in Fig. 6. It can be observed that the FVPN cannot handle highly occluded cases at very small sizes, since local peaks on the FVPN heatmap for vehicles in those cases will be overlapped. The similar situation also exists in most of the deep networks based detection approaches \cite{girshick2014rich,girshick2015fast,redmon2015you,ren2015faster}. \begin{figure*} [t] \centering \begin{tabular}{ccc} \includegraphics[width=0.33\textwidth,height=0.18\textheight]{UTS.JPG} &\includegraphics[width=0.33\textwidth,height=0.18\textheight]{Pas.JPG}&\includegraphics[width=0.33\textwidth,height=0.18\textheight]{Lisa.JPG}\\ \footnotesize (a) &\footnotesize (b) &\footnotesize (c)\\ \end{tabular} \caption{ \textbf{}Precision-recall curves on three vehicle datasets} \label{nasaacc} \end{figure*} \begin{figure} [t] \centering \includegraphics[width=0.95\textwidth]{qualitative_results.pdf}\\ \caption{ \textbf{}Examples of successful and failure cases for detection (a green box denotes correct localization, a red box denotes false alarm and a blue box denotes missing detection)} \label{exampless} \end{figure} \subsection{Evaluation of Attributes Learning} The experiments and analysis of the ALN are mainly based on the CompCars dataset and the UTS dataset. The web-nature data in the CompCars dataset are labeled with five viewpoints and twelve types about 136000 and 97500 images, respectively. We neglect those images without type annotation and randomly split the remaining data into the training and validation subsets as 7:3. In addition to pose estimation and type classification, we complement the annotation of five common vehicle colors on about 10000 images for evaluation of color recognition. Besides, for type classification, we compare the results of both the selected 6 common vehicle types and the total 12 types as mentioned in Section 3. 3. Vehicle verification (i.e., binary classification of vehicle and background) is evaluated in all the experiments as well. In the following subsections, we implement four different experiments to investigate the gain of the multi-task architecture, the accuracy by inputs with different image qualities, the effect of layer depths and the difficulty of fine-grained classification under different viewpoints. \begin{table} \center \newcommand{\tabincell}[2]{\begin{tabular}{@{}#1@{}}#2\end{tabular}} \caption{\small \textbf{Evaluation (\%) of attributes annotation for vehicles on the UTS dataset}} \label{table:t1} \resizebox{0.975\textwidth}{!}{ \begin{tabular}{|c|c|c|c|c|c|} \cline{1-6} \multirow{2}{*}{\textbf{\tabincell{c}{Tasks}}}&\multirow{2}{*}{\textbf{Vehicle Verification}} &\multirow{2}{*}{\textbf{Pose Estimation}}&\multicolumn{2}{c|}{\textbf{\tabincell{c}{Vehicle Type\\ Classification}}}&\multirow{2}{*}{\textbf{Color Recognition}} \\ \cline{4-5} & & & \tabincell{c}{\textbf{12 types}} & \tabincell{c}{\textbf{6 types}} &\\ \hline \hline \multicolumn{6}{|c|}{\textbf{Comparison of single-task learning (STL) and multi-task learning (MTL) for attributes prediction}}\\ \hline STL &98.73 &96.94 &60.37 &88.32 &78.33 \\ MTL &\textbf{99.45} &98.03 &69.64 &94.91 &\textbf{79.25 }\\ STL feature+SVM& 99.11&97.12 & 60.86&90.75 & 78.06\\ MTL feature+SVM&99.36 &\textbf{98.10} &\textbf{69.86} &\textbf{95.12} &79.19 \\ \hline \hline \multicolumn{6}{|c|}{\textbf{Comparison of Attributes prediction with different sizes of vehicle images}}\\ \hline $28\times28$&90.45 &83.49 &37.52 &53.66 &49.73 \\ $56\times56$&98.12 &91.33 &52.02 &77.02 &66.14 \\ $112\times112$&99.37 &96.56 &63.41 &90.67 &\textbf{80.31} \\ $224\times224$&\textbf{99.45 }&\textbf{98.03} & \textbf{69.64}&\textbf{94.91} &79.25 \\ \hline \hline \multicolumn{6}{|c|}{\textbf{Comparison of Attributes prediction with different deep models}}\\ \hline ALN based on FVPN ($depth=4$)&95.96 &81.21 &27.26 &43.12 &65.12 \\ ALN based on AlexNet ($depth=8$)&\textbf{99.51} &95.76 &66.01 &89.25 & 77.90\\ ALN based on GoogLeNet ($depth=22$)&99.45 &\textbf{98.03} &\textbf{69.04} &\textbf{94.91} &\textbf{79.25} \\ \hline \end{tabular} } \end{table} \subsubsection{Single-task learning or multi-task learning? } We first compare the multi-task ALN with the case of training networks for each attribute separately (i.e., single task). In addition, results by the combination of deep learned features and an SVM classifier are compared as well. All the model architectures are based on the GoogLeNet, and 1024-dimensional features are extracted from layer \emph{pool5/7$\times7$\_s1} to train the corresponding SVM classifier \cite{CC01a}. As shown in the top part of Table 2, the multi-task model consistently achieves higher accuracies on four different tasks, which reveals the benefit of joint training. Although the combination of extracted features and SVM classifiers sometimes can lead to a small increase, we still prefer the proposed end-to-end model because of its elegance and efficiency. \subsubsection{How small a vehicle size can DAVE annotate?} Since vehicles within surveillance video frames are usually in different sizes. Visual details of those vehicles far from the camera are significantly unclear. Although they can be selected by the FVPN with coarse requirements, after rescaling to $224\times224$, these vehicle proposals with low image clarity are hard to be annotated with correct attributes by the ALN. To explore this problem, we test vehicle images with original sizes of 224, 112, 56 and 28 using the trained ALN. The middle part of Table 2 illustrates that the higher resolution the original input size is, the better accuracy it can achieve. \subsubsection{Deep or shallow?} How deep of the network is necessary for vehicle attributes learning is also worth to be explored. Since our ALN can be established on different deep models, we compare popular deep networks: AlexNet \cite{krizhevsky2012imagenet} and GoogLeNet with 8 layers and 22 layers, respectively. As VGGNet (16 layers version) \cite{simonyan2014very} configured with numerous parameters requires heavy computation and large memory, we do not expect to employ it for our ALN. Besides, our proposed shallow FVPN with 4 layers is also used for attributes learning. From the bottom part of Table 2, we can see that a deeper network does not obtain much better performance on vehicle verification compared to a shallow one. However, for pose estimation, type classification and color recognition, the deepest GoogLeNet consistently outperforms other nets with obvious gaps. Particularly for type classification which belongs to fine-grained categorization, the shallow FVPN gives extremely poor results. It illustrates that a deeper network with powerful discriminative capability is more suitable for fine-grained vehicle classification tasks. \subsubsection{Fine-grained categorization in different views.} Finally, since vehicle type classification belongs to fine-grained categorization, we are interested in investigating its difficulty in different views due to its importance for our future work such as vehicle re-identification. As demonstrated in Table 3, for both 12-type and 6-type classification, higher precision is easier to be achieved from side and rearside views, while it is difficult to discriminate vehicle types from the front view. In other words, if we aim to re-identify a target vehicle from two different viewpoints, the type annotation predicted from a side view is more credible than that from a front view. \begin{table} \center \newcommand{\tabincell}[2]{\begin{tabular}{@{}#1@{}}#2\end{tabular}} \caption{\small \textbf{Evaluation (\%) of fine-grained vehicle type classification on the UTS dataset}} \label{table:t1} \resizebox{0.65\textwidth}{!}{ \begin{tabular}{|c|c|c|c|c|c|} \hline Number of vehicle type&Front &Rear &Side &FrontSide &RearSide \\ \hline 12&58.02 &60.37 &66.73 &61.28 &64.90 \\ \hline 6&79.42 &84.60 &92.93 &86.77 &92.53 \\ \hline \end{tabular} } \end{table} Fig. 7 shows the qualitative results of our DAVE evaluated on the UTS vehicle dataset. It demonstrates that our model is robust to detect vehicles and annotate their poses, colors and types simultaneously for urban traffic surveillance. The failure cases mainly take place on incorrect colors and types. \begin{figure} \centering \includegraphics[width=0.95\textwidth]{annotation_results.pdf}\\ \caption{\footnotesize \textbf{}Qualitative results of attributes annotation. Red marks denote incorrect annotation, and N/A(C) means a catch-all color.} \label{exampless} \end{figure} \section{Conclusion} In this paper, we developed a unified framework for fast vehicle detection and annotation: DAVE, which consists of two convolutional neural networks FVPN and ALN. The proposal and attributes learning networks predict bounding-boxes for vehicles and infer their attributes: pose, color and type, simultaneously. Extensive experiments show that our method outperforms state-of-the-art frameworks on vehicle detection and is also effective for vehicle attributes annotation. In our on-going work, we are integrating more vehicle attributes such as make and model into the ALN with high accuracy, and exploiting these attributes to investigate vehicle re-identification tasks. \bibliographystyle{splncs}
{'timestamp': '2016-08-02T02:11:40', 'yymm': '1607', 'arxiv_id': '1607.04564', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04564'}
arxiv
\section{Introduction} Increasing the number of cellular base stations~(BSs) to serve a given area, also known as network densification, is foreseen to be a necessary solution to address the large data rate demands of the future fifth-generation~(5G) wireless communication networks~\cite{andrews-etal2014what,bhushan-etal2014network}. Cloud radio access network~(CRAN) provides a cost-effective way to achieve network densification, by replacing the conventional BSs with low-power distributed remote radio heads~(RRHs) that are deployed close to the users and coordinated by a central processor~(CP)~\cite{andrews-etal2014what}. CRAN significantly improves both the spectral efficiency and energy efficiency compared to conventional cellular networks, due to the centralized resource allocation and joint signal processing over the RRHs at the CP~\cite{park-etal2013joint,zhou-yu2014optimized,liu-zhang2015optimized,jain-etal2016backhaul,zhuang-lau2014backhaul,dai-yu2014sparse,shi-etal2014group,fan-etal2016randomized,luo-etal2015downlink,tao-etal2016content,shi-etal2016smoothed,fan-etal2016dynamic,peng-etal2016recent,liu-etal2015joint,stephen-zhang2016green}. Combining a dense network with centralized joint processing as in the CRAN leads to a powerful new network architecture termed ultra-dense CRAN~(UD-CRAN)~\cite{shi-etal2015large,stephen-zhang2017joint}, in which the number of RRHs can even exceed the number of users being served in a given area to support wireless connectivity of ultra-high throughput. In a UD-CRAN, the RRHs exchange data and control signals with the CP via high-speed wired or wireless links which are referred to as the fronthaul. With a fully centralized architecture, where the CP performs all the encoding/decoding operations, the RRHs in a UD-CRAN can be simple relay nodes that transmit or receive quantized/compressed baseband signals over the fronthaul links~\cite{park-etal2013joint,zhou-yu2014optimized,liu-etal2015joint,liu-zhang2015optimized,jain-etal2016backhaul}. Although such an architecture provides the maximum joint signal processing gains, the fronthaul links can get saturated easily by the large volume of signals that need to be transmitted over them, especially in UD networks. On the other hand, in traditional cellular networks, the BSs themselves have encoding/decoding capability, and only the user messages are sent over the backhaul, which typically requires much less capacity compared to sending quantized signals over the fronthaul in CRAN. However, in such networks, the performance gains due to joint signal processing are compromised. This motivates an alternative \emph{hybrid} architecture for UD-CRAN as proposed in~\cite{bi-etal2015wireless}, by which the benefits of both the BS-centric local processing in conventional cellular networks and the centralized processing in CRAN can be achieved by adaptively switching between the two, based on e.g., the wireless channel conditions, the user rate requirements and the fronthaul constraints of the RRHs. In this paper, we consider the uplink transmission in an orthogonal frequency division multiple access~(OFDMA)-based UD-CRAN with hybrid decoding on each sub-channel~(SC), as shown in~\cref{F:SysModel}. On each SC, the RRHs can choose either to: decode the assigned user's message locally and then forward it to the CP~(namely, decode-and-forward~(DaF)), or simply quantize the signal and forward it to the CP for joint decoding~(termed forward-and-decode~(FaD)), or not process the received signal at all~(to save fronthaul capacity). Most of the existing work on CRAN considers single-channel systems~\cite{park-etal2013joint,zhou-yu2014optimized,liu-zhang2015optimized,jain-etal2016backhaul,zhuang-lau2014backhaul,dai-yu2014sparse,shi-etal2014group,fan-etal2016randomized,luo-etal2015downlink,tao-etal2016content,shi-etal2016smoothed,fan-etal2016dynamic,peng-etal2016recent}, where all the users transmit in the same bandwidth. Previously, a hybrid compression and message-sharing strategy was considered in~\cite{patil-yu2014hybrid} for the downlink transmission in a single-channel CRAN, where the CP shares the uncompressed messages of some users to a subset of RRHs, in addition to transmitting compressed messages of all users to each RRH. In contrast, in this paper we consider the OFDMA-based UD-CRAN with multiple SCs for the uplink transmission with hybrid decoding on each SC. Although allowing multiple users to transmit on the same SC can potentially increase the system throughput, it would require the more complex successive interference cancellation receiver on each SC at the CP and/or the RRHs, compared to the simple single-user decoder considered in this paper. The uplink transmission in an OFDMA-based CRAN, with only FaD processing on each SC was considered in~\cite{liu-etal2015joint}. In contrast, with the hybrid decoding considered in this paper, each RRH can choose to first decode the message in an SC locally, before forwarding it to the CP, in addition to quantizing and forwarding the signal to the CP as in~\cite{liu-etal2015joint}. For the downlink of a multi-hop fronthaul CRAN, it has been shown in~\cite{liu-yu2017cross} that multicasting user messages with the help of network coding can perform better than unicasting compressed messages with simple routing. Specifically, we consider a cluster of $M$ RRHs and $K$ users, both with single-antennas, in an OFDMA-based UD-CRAN with $N$ orthogonal SCs, as shown in~\cref{F:SysModel}. The signal transmitted by the user assigned to each SC can be either quantized and forwarded by a subset of RRHs for joint decoding at the CP, or instead, locally decoded and forwarded by a single RRH. Jointly decoding the message of a user assigned to any SC at the CP provides a receive-combining gain from multiple RRHs over the local decoding at a single RRH, and hence achieves a higher transmission rate for the user in general. However, to achieve this rate improvement, the participating RRHs need to forward the quantized signals with sufficiently low error to the CP, which consumes more of their fronthaul capacities compared to a decoded message forwarded by a single RRH. On the other hand, when an RRH forwards a decoded message, the fronthaul capacity is significantly saved, but the receive-combining gain achievable with centralized decoding at the CP is compromised, and only a selection diversity gain over the RRHs can be attained. Besides the selection of DaF or FaD processing modes, the achievable rate for each SC also depends on the user-SC assignment and transmit power allocations by the users. Thus, the RRHs' processing mode~(DaF/FaD/no processing) selections on each SC should be jointly optimized along with the resource allocation in the network. The main results of this paper are summarized as follows. \begin{itemize} \item We study a joint resource allocation problem in UD-CRAN, including the RRHs' processing mode selections, user-SC assignments and the users' transmit power allocations for OFDMA transmission, to maximize the users' weighted-sum-rate in the uplink transmission. To the best of our knowledge, this problem has not been considered yet in the literature. The problem, however, is non-convex, and an exhaustive search over all possible solutions would incur an exponential complexity of $O((K(2^M+M))^N)$, which is evidently not practically affordable in a UD-CRAN with large values of $N$ and/or $M$. \item Hence, we propose a Lagrange duality based algorithm, which can achieve the optimal solution asymptotically when the number of SCs is large, at a much reduced complexity of $O(NK(2^M+M))$. \item To further reduce the complexity in UD networks, we propose a greedy algorithm to obtain a suboptimal solution, which has a lower complexity of only $O(NK(M^2+M))$, and is shown to be able to achieve close-to-optimal throughput performance under various practical setups by simulations. \item Finally, we compare the proposed optimal and suboptimal algorithms with hybrid decoding to both the conventional CRAN that performs FaD processing on all SCs, and a cellular network that performs DaF processing on all SCs by simulations, which show promising throughput gains by the proposed algorithms. \end{itemize} {\it Notation}: In this paper, scalars are denoted by lower-case letters, e.g., $x$, while vectors are denoted by bold-face lower-case letters, e.g., $\bm x$. The set of real numbers, complex numbers, and integers are denoted by $\mathbbm{R}$, $\mathbbm{C}$ and $\mathbbm{Z}$, respectively. Similarly, $(\cdot)^{x\times 1}$ denotes the corresponding space of $x$-dimensional column vectors, while $\mathbbm{R}_+$ and $\mathbbm{Z}_{++}$ denote the sets of non-negative real numbers and positive integers respectively. For a real scalar $x\in\mathbbm{R}$, $[x]^+\triangleq\max\{x,0\}$, and for a complex scalar $x\in\mathbbm{C}$, $|x|\geq 0$ denotes the magnitude of $x$. For a vector $\bm x$, $\bm x^\mathsf{T}$ denotes its transpose. Vectors with all elements equal to $1$ and $0$ are denoted by $\bm 1$ and $\bm 0$, respectively. For real vectors $\bm x,\bm y\in\mathbbm{R}^{M\times 1}$, $\bm x\succeq\bm y$ denotes the component-wise inequalities $x_i\geq y_i, i=1,\dotsc,M$. Finally, $\mathcal{CN}(\mu,\sigma^2)$ denotes a circularly symmetric complex Gaussian~(CSCG) random variable with mean $\mu$ and variance $\sigma^2$, and the symbol $\sim$ is used to mean ``distributed as". \section{System Model}\label{Sec:SysMod} \begin{figure}[t] \centering \includegraphics[width=\linewidth]{Fig1_SysMod} \caption{OFDMA-based uplink CRAN with hybrid-decoding RRHs.}\label{F:SysModel} \end{figure} We study the uplink transmission in a UD-CRAN cluster that consists of $M$ single-antenna RRHs, denoted by the set $\mathcal{M}\triangleq\{1,\dotsc,M\}$, and $K$ single-antenna users, denoted by $\mathcal{K}\triangleq\{1,\dotsc,K\}$, as shown in~\cref{F:SysModel}. The users transmit their signals in the uplink using OFDMA over a total bandwidth of $B$~Hz which is equally divided into $N$ orthogonal SCs, denoted by the set $\mathcal{N}\triangleq\{1,\dotsc,N\}$. These signals are received by the RRHs, and are then forwarded to the CP via the individual fronthaul links of the RRHs. As the fronthaul link capacity is practically limited for each RRH, one of the following operations are chosen to be performed on each SC $n\in\mathcal{N}$ by each RRH $m\in\mathcal{M}$: \begin{itemize} \item The user's message is decoded and forwarded to the CP~(DaF); \item The user's signal is quantized and forwarded to the CP, which then decodes the message~(FaD); or \item The received signal is not processed. \end{itemize} For example, an illustration is given in~\cref{F:SysModel} with 5~RRHs and 2~users, where the SCs~1 and~3 are assigned to user~1, while SCs~2 and~4 are assigned to user~2. In this case, RRH~2 which is nearest to user~1, decodes the message in SC~3 and forwards it to the CP. Since this message is decoded by RRH~2, the other RRHs do not process the signal on SC~3. On the other hand, user~1's signal in SC~1 is quantized independently by each of the RRHs~2~and~4, and forwarded to the CP, which then decodes the message in SC~1 by combining the quantized signals from these two RRHs. Similarly for user~2, while RRH~1 locally decodes and forwards the message in SC~4, RRHs~1, 4~and~5 quantize and forward their respective received signals in SC~2. Notice that RRH~1, despite its proximity to user~1, does not process user~1's signal on SC~1, since its fronthaul is already fully consumed by user~2's quantized signal in SC~2 and the decoded message in SC~4. In order to describe the choice of operations outlined above completely, we introduce the following decision variables. First, to indicate whether an RRH $m$ processes the signal on SC $n$ or not, we define the variables $\alpha_{m,n}$ as \begin{align} \alpha_{m,n}\triangleq\begin{cases}1&\text{if RRH}~m~\text{processes the signal on SC}~n\\ 0&\text{otherwise,}\end{cases \label{E:ProcSel} \end{align} $m\in\mathcal{M}$ and $n\in\mathcal{N}$. The collection of these variables for all RRHs at each SC $n\in\mathcal{N}$ is denoted by the vector $\bm\alpha_n\triangleq\begin{bsmallmatrix}\alpha_{1,n}&\cdots&\alpha_{M,n}\end{bsmallmatrix}^\mathsf{T}\in\{0,1\}^{M\times 1}$. Next, to indicate the mode of processing chosen for SC $n$, i.e. whether the message in SC $n$ is decoded by an RRH or instead the signal in SC $n$ is quantized and forwarded to the CP, we define the mode selection variable $\delta_n$ as \begin{align} \delta_n\triangleq\begin{cases}1&\text{if the message in SC}~n~\text{is decoded }\\ 0&\text{if the signal in SC}~n~\text{is quantized, }\end{cases}\label{E:ModeSel \end{align} $n\in\mathcal{N}$. In the DaF mode~$(\delta_n=1)$, at most one RRH in the network processes the signal in SC $n$, and hence we impose the condition $\bm 1^\mathsf{T}\bm\alpha_n\leq 1$. On the other hand, in the FaD mode $(\delta_n=0)$, a subset $\mathcal{A}_n\subseteq\mathcal{M}$ consisting of one or more RRHs, independently quantize and forward the signals in SC $n$, where $\mathcal{A}_n\triangleq\{m\in\mathcal{M}|\alpha_{m,n}=1\},~n\in\mathcal{N}$. Finally, we define the variable $\nu_{k,n}$ to indicate whether an SC $n$ is assigned to a user $k$ or not, i.e., \begin{align} \nu_{k,n}\triangleq\begin{cases}1&\text{if SC}~n~\text{is assigned to user}~k\\ 0&\text{otherwise}, \end{cases}\label{E:UserSel} \end{align} $k\in\mathcal{K},n\in\mathcal{N}$. The vector $\bm\nu_n\triangleq\begin{bsmallmatrix} \nu_{1,n}&\cdots&\nu_{K,n} \end{bsmallmatrix}^\mathsf{T}\in\{0,1\}^K$ specifies the user assignment for SC $n$. According to OFDMA, each SC $n\in\mathcal{N}$ is assigned to at most one user for uplink transmission, and thus $\bm\nu_n$ must satisfy the condition $\bm 1^\mathsf{T}\bm\nu_n\leq 1,\forall n\in\mathcal{N}$. Also, we denote the set of SCs assigned to user $k\in\mathcal{K}$ by $\mathcal{N}_k\triangleq\{n|\nu_{k,n}=1\}\subseteq\mathcal{N}$, so that $\mathcal{N}_j\cap\mathcal{N}_k=\emptyset,\ \forall j\neq k,\ j,k\in\mathcal{K}$. Let $h_{m,k,n}\in\mathbbm{C}$ denote the complex wireless channel coefficient from the user $k\in\mathcal{K}$ to RRH $m\in\mathcal{M}$, for SC $n\in\mathcal{N}$. We assume that all the channel coefficients $h_{m,k,n}$'s are known at the CP. Let $p_{k,n}\geq 0$ denote the uplink transmit power allocated by the user $k\in\mathcal{K}$ to SC $n\in\mathcal{N}$ and the vector $\bm p_n\triangleq\begin{bsmallmatrix} p_{1,n}&\cdots&p_{K,n} \end{bsmallmatrix}^\mathsf{T}\in\mathbbm{R}_+^K$ denote the transmit powers of all the users on SC $n\in\mathcal{N}$. Then, the signal received at RRH $m$ in SC $n\in\mathcal{N}_k$ is given by \begin{align} y_{m,n}=h_{m,k,n}\sqrt{p_{k,n}}s_{k,n}+z_m \label{E:RxSig} \end{align} where $s_{k,n}\sim\mathcal{CN}(0,1)$ denotes user $k$'s information-bearing signal that is assumed to be complex Gaussian and $z_m\sim\mathcal{CN}(0,\sigma_m^2)$ is the additive-white-Gaussian-noise~(AWGN), with $\sigma_m^2$ denoting the receiver noise power at RRH $m$~(assumed to be equal for all SCs). \subsection{Forward-and-Decode~(FaD) Processing}\label{SS:JD} When FaD processing~$(\delta_n=0)$ is performed on an SC $n\in\mathcal{N}_k$, the following operations take place. First, the RRHs $m\in\mathcal{A}_n$, i.e. with $\alpha_{m,n}=1$, quantize the received baseband signals $y_{m,n}$'s in SC $n$ given by~\eqref{E:RxSig}. Then, the RRHs encode these quantized values into digital codewords, and forward them to the CP. The CP recovers the quantized signals from these digital codewords, and decodes user $k$'s message on SC $n\in\mathcal{N}_k$, by combining the quantized signals from the RRHs. As the received signals at the RRHs in all the SCs are independent of each other and each RRH is assumed to perform signal quantization independently, a simple scalar quantization~(SQ) on the received signals $y_{m,n}$'s is performed~\cite{liu-etal2015joint}, and the baseband signal after SQ can be expressed as \begin{align} \hat{y}_{m,n}=y_{m,n}+e_{m,n},\ m\in\mathcal{M},n\in\mathcal{N},\label{E:QuantRxSig} \end{align} where $e_{m,n}$ denotes the complex-valued error induced by the SQ, which is assumed to have zero mean and a variance denoted by $q_{m,n}$. The errors $e_{m,n}$'s are independent over $m$ and $n$ due to the independent SQ in each SC by each RRH. A practical method for SQ is to represent the in-phase~(I) and quadrature~(Q) components of the received complex baseband signal $y_{m,n}$ in~\eqref{E:RxSig} using $\beta_m\in\mathbbm{Z}_{++}$ bits for each.\footnote{It is assumed that the resolution of the SQ, $\beta_m$, is fixed, and is the same on all SCs for a given RRH $m\in\mathcal{M}$.} In other words, each of the I~and~Q components of $y_{m,n}$ are uniformly quantized into one of $2^{\beta_m}$ levels~\cite{liu-etal2015joint}. With such a uniform SQ, the variance $q_{m,n}$ of the quantization error $e_{m,n}$ in~\eqref{E:QuantRxSig} on SC $n\in\mathcal{N}_k$ at RRH $m\in\mathcal{M}$ can be approximated as~\cite{liu-etal2015joint} \begin{align} q_{m,n}=3(|h_{m,k,n}|^2p_{k,n}+\sigma_m^2)2^{-2\beta_m} .\label{E:QNVar} \end{align} Next, each RRH $m\in\mathcal{A}_n$ transmits the digital code-words corresponding to the quantization levels to the CP via its fronthaul link. Since each I and Q component of the signal in an SC is represented by a $\beta_m$-bit codeword, it is not difficult to show that the transmission rate in bits-per-second~(bps) required on the fronthaul link of RRH $m$ to forward the quantized signal in any SC $n$ is given by $2B\beta_m/N$. Upon receiving the digital code-words, the CP first recovers the baseband quantized signals $\hat{y}_{m,n}$'s based on the quantization code-books used by each RRH. Further, to decode the message in SC $n$, the CP applies a linear combining to $\hat{y}_{m,n}$'s. When the optimal combining weights that maximize the signal-to-noise ratio~(SNR) are used, the received SNR for decoding at the CP on SC $n\in\mathcal{N}_k$ can be expressed as~\cite{liu-etal2015joint} \begin{align} \gamma^Q_{k,n}(\bm\alpha_n,p_n)&=\sum_{m\in\mathcal{M}}\frac{\alpha_{m,n}|h_{m,k,n}|^2p_n}{\sigma_m^2+q_{m,n}}\notag\\ &=\sum_{m\in\mathcal{M}}\alpha_{m,n}\gamma^Q_{m,k,n}(p_{k,n}), \label{E:RxSNRJD} \end{align} where $q_{m,n}$ is given by~\eqref{E:QNVar} and $\gamma^Q_{m,k,n}(p_{k,n})$ denotes the contribution of each RRH $m$ to the SNR at the CP in SC $n$. Note that if $\alpha_{m,n}=0$ for some RRH $m\in\mathcal{M}$, it means RRH $m$ does not process the signal on SC $n$ and hence does not contribute to the received SNR at the CP. Using~\eqref{E:QNVar} in~\eqref{E:RxSNRJD}, $\gamma^Q_{m,k,n}(p_{k,n})$ can be expressed as \begin{align} \gamma^Q_{m,k,n}(p_{k,n})=\frac{|h_{m,k,n}|^2p_{k,n}}{\sigma_m^2+3\left(|h_{m,k,n}|^2p_{k,n}+\sigma_m^2\right)2^{-2\beta_m}} \label{E:PartSNR} \end{align} $m\in\mathcal{M},k\in\mathcal{K},n\in\mathcal{N}_k$. If the quantization error $e_{m,n}$ is assumed to be the worst-case Gaussian distributed, then a lower bound on the achievable rate in bps with FaD processing for SC $n\in\mathcal{N}_k$ is given by \begin{align} &r^Q_{k,n}(\bm\alpha_n,p_{k,n})=(B/N)\log_2(1+\gamma^Q_{k,n}(\bm\alpha_n,p_{k,n})) .\label{E:SCRJ} \end{align} Next, we present the following lemma. \begin{lemma}\label{L:rknQConc} With given RRH selection $\bm\alpha_n$, $r^Q_{k,n}(\bm\alpha_n,p_{k,n})$ defined in~\eqref{E:SCRJ} is concave in $p_{k,n}\geq 0$. \end{lemma} \begin{proof} Please refer to~appendix~\ref{App:ProofLrknQConc}. \end{proof} \cref{L:rknQConc} indicates that on each SC $n$, the achievable rate with FaD processing is a concave function of the assigned user's transmit power. \subsection{Decode-and-Forward~(DaF) Processing} Instead of having the CP perform the decoding by combining the quantized signals from the RRHs, any single selected RRH $m$ can also decode the message in SC $n$ locally, and then forward this message to the CP. The maximum achievable rate in bps for SC $n\in\mathcal{N}_k$ when RRH $m$ locally decodes user $k$'s message is given by \begin{align} r^D_{m,k,n}(p_{k,n})=(B/N)\log_2(1+|h_{m,k,n}|^2p_{k,n}/\sigma_m^2) .\label{E:SCRL} \end{align} In this case, RRH $m$ forwards the decoded message on SC $n\in\mathcal{N}_k$ to the CP over its fronthaul link at the rate of at least $r^D_{m,k,n}(p_{k,n})$. Also, notice that if some RRH $m\in\mathcal{M}$ locally decodes the message in SC $n$ and forwards it to the CP, no other RRHs need to process the signal on this SC. \subsection{Hybrid Decoding} Here, we present the proposed hybrid decoding scheme, where either a subset of RRHs $\mathcal{A}_n\subseteq\mathcal{M}$ quantize and forward their received signals to be jointly decoded at the CP as in a conventional CRAN, or a single RRH $m\in\mathcal{M}$ locally decodes a user's message on SC $n$ and forwards it to the CP. Combining the expressions for the achievable rates in these two cases as given in~\cref{E:SCRJ,E:SCRL} with the indicator variables defined in~\cref{E:ModeSel,E:ProcSel}, the achievable rate with hybrid decoding on an SC $n\in\mathcal{N}_k,\,k\in\mathcal{K},$ is given by \begin{align r_{k,n}(\delta_n,\bm\alpha_n,p_{k,n})&=\delta_n\sum_{m\in\mathcal{M}}\alpha_{m,n}r^D_{m,k,n}(p_{k,n})\notag\\ &\quad+(1-\delta_n)r^Q_{k,n}(\bm\alpha_n,p_{k,n}) \label{E:SCR} \end{align} Note that if $\bm\alpha_n=\bm 0$, no RRH processes the received signals and the achievable rate on SC $n$ will be zero, irrespective of the value of $\delta_n$. Also, for an SC $n\in\mathcal{N}_k$, if $p_{k,n}=0$, we assume $\bm\alpha_n=\bm 0$ without loss of generality. Let $\bar{R}_m$ denote the fronthaul capacity of the link connecting RRH $m$ to the CP in bps. Then, the total rate at which RRH $m$ forwards the processed signals~(decoded and/or quantized) over all the $N$ SCs from the users to the CP must satisfy the constraints \begin{align &\sum_{n\in\mathcal{N}}\bigg(\delta_n\alpha_{m,n}\sum_{k\in\mathcal{K}}\nu_{k,n}r^D_{m,k,n}(p_{k,n})\notag\\ &\qquad+(1-\delta_n)\frac{2B\beta_m\alpha_{m,n}}{N}\bigg)\leq \bar{R}_m,\,\forall m\in\mathcal{M}. \label{E:IFHRC} \end{align} The left-hand side of~\eqref{E:IFHRC} represents the total rate at which the signals processed by RRH $m$ must be forwarded to the CP, where $r^D_{m,k,n}(p_{k,n})$ is defined in~\eqref{E:SCRL}, and $2B\beta_m/N$ is the rate in bps corresponding to the resolution $\beta_m$ of the SQ performed by RRH $m$. In the next section, we formulate the joint uplink resource allocation optimization problem for the OFDMA-based UD-CRAN with hybrid decoding. \section{Problem Formulation}\label{Sec:ProbForm} We aim to maximize the weighted-sum-rate of the users in the uplink over all the SCs, by jointly optimizing the processing mode and RRH selections, which are collectively represented by the variables $\{\delta_n,\bm\alpha_n\}_{n\in\mathcal{N}}$, the user-SC assignments $\{\bm\nu_n\}_{n\in\mathcal{N}}$, and the users' transmit power allocations $\{\bm p_n\}_{n\in\mathcal{N}}$, subject to the fronthaul constraints~\eqref{E:IFHRC}, and the total power constraints at each of the users, which we denote by $\bar{P}_k,\ k\in\mathcal{K}$. Let $\omega_k\geq 0$ denote the rate weight for user $k\in\mathcal{K}$. Then the problem can be formulated as given below. \begin{subequations} \label{P:ULHybMain} \begin{align} \mathop{\mathrm{maximize}}_{\{\bm p_n,\bm\alpha_n,\bm\nu_n,\delta_n\}_{n\in\mathcal{N}} }&\sum_{k\in\mathcal{K}}\omega_k\sum_{n\in\mathcal{N}}\nu_{k,n}r_{k,n}(\delta_n,\bm\alpha_n,p_{k,n})\tag{\ref{P:ULHybMain}}\\ \mathrm{subject}~\mathrm{to}\notag\\ &\ \text{\cref{E:IFHRC}}\notag\\ &\ \sum_{n\in\mathcal{N}} p_{k,n}\leq\bar{P}_k\quad\forall k\in\mathcal{K} \label{C:PCULHybMain}\\ &\ p_{k,n}\geq 0\quad\forall k\in\mathcal{K},\forall n\in\mathcal{N}\label{C:PosPowULHybMain}\\ &\ \delta_n(\bm 1^\mathsf{T}\bm \alpha_n)\leq 1\quad\forall n\in\mathcal{N}\label{C:LDConstULHybMain}\\ &\ \alpha_{m,n}\in\{0,1\}\quad\forall m\in\mathcal{M},\forall n\in\mathcal{N}\label{C:RRHSelULHybMain}\\ &\ \bm 1^\mathsf{T}\bm\nu_n\leq 1\quad\forall n\in\mathcal{N}\label{C:UASUULHybMain}\\ &\ \nu_{k,n}\in\{0,1\}\quad\forall k\in\mathcal{K},\forall n\in\mathcal{N}\label{C:UAVectULHybMain}\\ &\ \delta_n\in\{0,1\}\quad\forall n\in\mathcal{N}.\label{C:ModeSelULHybMain} \end{align} \end{subequations} The constraint~\eqref{C:LDConstULHybMain} ensures that when DaF processing is performed~$\left(\delta_n=1\right)$, at most one RRH processes the signal on SC $n$, i.e. at most one $\alpha_{m,n}=1$, and all other $\alpha_{m,n}$'s are zero. In the case of FaD processing $\left(\delta_n=0\right)$, no such restriction is imposed on $\bm\alpha_n$. The above weighted-sum-rate maximization problem is non-convex due to the integer constraints~\cref{C:RRHSelULHybMain,C:ModeSelULHybMain} and the coupled variables in the objective, as well as in constraints~\cref{E:IFHRC,C:LDConstULHybMain}. Notice that if $\delta_n=0\ \forall n\in\mathcal{N}$, then problem~\cref{P:ULHybMain} reduces to the special case where all RRHs quantize and forward their signals to the CP as in an OFDMA-based CRAN with only centralized decoding at the CP~\cite{liu-etal2015joint}. On the other hand, if $\delta_n=1\ \forall n\in\mathcal{N}$, problem~\cref{P:ULHybMain} reduces to the special case of an OFDMA-based cellular network where the user messages on different SCs can be decoded by different RRHs in general and then forwarded to the CP over the fronthauls. This is unlike the conventional cellular network where each user's signal is decoded by only the single BS to which it is associated. In the general case, the optimal solution to the above problem could have $\delta_n=0$ only on a subset of SCs, and $\delta_n=1$ for other SCs, in order to maximally exploit the hybrid decoding capability. It is worth noting that in the solution to problem~\eqref{P:ULHybMain}, if $p_{k,n}=0,~\forall n\in\mathcal{N}$ for some user $k$, it means that user $k$ is not served at all in the current scheduling interval. The resulting fairness issue can be overcome in practice by selecting the user rate-weights $\omega_k$'s in problem~\eqref{P:ULHybMain} appropriately. For example, if one user receives very low rate in the current scheduling interval, its priority weight can be increased to ensure that it gets a higher rate in the next interval. The user weights can thus be manipulated to ensure that all the users in the network are fairly served in the long term. \section{Proposed Solutions}\label{Sec:PropSol} \subsection{Optimal Solution}\label{SS:OptSol} Although problem~\eqref{P:ULHybMain} is non-convex, its duality gap diminishes to zero as the number of SCs $N$ goes to infinity, as under this condition such non-convex problems are shown to satisfy the ``time-sharing" property~\cite{yu-lui2006dual}. Since $N$ is typically large in practice, we propose to apply the Lagrange duality method to obtain an asymptotically optimal solution to problem~\eqref{P:ULHybMain}.\footnote{However, from the simulations in~\cref{Sec:SimResults}, we observe that the duality gap is negligible even for a moderate value of $N=64$.} Let $\lambda_m\geq 0,\ m\in\mathcal{M}$ denote the dual variables associated with the $M$ constraints in~\eqref{E:IFHRC}, and $\mu_k\geq 0,\ k\in\mathcal{K}$, denote the dual variables for the $K$ constraints in~\eqref{C:PCULHybMain}. Also let the vectors $\bm \lambda\triangleq\begin{bsmallmatrix}\lambda_1&\cdots&\lambda_M\end{bsmallmatrix}^\mathsf{T}\in\mathbbm{R}_+^{M\times 1}$ and $\bm\mu\triangleq\begin{bsmallmatrix} \mu_1&\cdots&\mu_K \end{bsmallmatrix}^\mathsf{T}\in\mathbbm{R}_+^{K\times 1}$ denote the collections of these dual variables. Then, the~(partial) Lagrangian of problem~\eqref{P:ULHybMain} is given by \begin{align &L\left(\{\delta_n,\bm\nu_n,\bm\alpha_n,\bm p_n\}_{n\in\mathcal{N}},\bm\lambda,\bm\mu\right)\notag\\ &=\sum_{k\in\mathcal{K}}\omega_k\sum_{n\in\mathcal{N}}\nu_{k,n}r_{k,n}(\delta_n,\bm\alpha_n,p_{k,n} -\sum_{m\in\mathcal{M}}\lambda_m\notag\\ &\quad\cdot\Bigg(\frac{1}{\bar{R}_m}\sum_{n\in\mathcal{N}}\Big(\delta_n\alpha_{m,n}\sum_{k\in\mathcal{K}}\nu_{k,n}r^D_{m,k,n}(p_{k,n})\notag\\ &\quad+(1-\delta_n)\frac{2B\beta_m\alpha_{m,n}}{N}\Big)-1\Bigg -\sum_{k\in\mathcal{K}}\mu_k\bigg(\sum_{n\in\mathcal{N}} p_{k,n}-\bar{P}_k\bigg)\notag\\ &=\sum_{n\in\mathcal{N}} L_n(\delta_n,\bm\nu_n,\bm\alpha_n,\bm p_n,\bm\lambda,\bm\mu)+\sum_{m\in\mathcal{M}}\lambda_m+\sum_{k\in\mathcal{K}}\mu_k\bar{P}_k, \label{E:LagW} \end{align} where each term in the first summation in~\eqref{E:LagW} is \begin{align &L_n\left(\delta_n,\bm\nu_n,\bm\alpha_n,\bm p_n,\bm\lambda,\bm\mu\right)\notag\\ &\triangleq\sum_{k\in\mathcal{K}}\omega_k\nu_{k,n}\bigg(\delta_n\sum_{m\in\mathcal{M}}\alpha_{m,n}r^D_{m,k,n}(p_{k,n})\notag\\ &\quad+(1-\delta_n)r^Q_{k,n}(\bm\alpha_n,p_{k,n})\bigg -\sum_{m\in\mathcal{M}}\frac{\lambda_m}{\bar{R}_m}\notag\\ &\quad\cdot\bigg(\delta_n\alpha_{m,n}\sum_{k\in\mathcal{K}}\nu_{k,n}r^D_{m,k,n}(p_{k,n})+(1-\delta_n)\frac{2B\beta_m\alpha_{m,n}}{N}\bigg)\notag\\ &\quad-\sum_{k\in\mathcal{K}}\mu_k p_{k,n},\quad n\in\mathcal{N}.\label{E:Lagn} \end{align} The Lagrange dual function can thus be expressed as \begin{subequations} \label{E:DualFunc} \begin{align} g(\bm\lambda,\bm\mu)=\max_{\substack{\{\bm p_n,\bm\alpha_n,\\ \bm\nu_n,\delta_n\}_{n\in\mathcal{N}}}}&\,L\left(\{\delta_n,\bm\nu_n,\bm\alpha_n,\bm p_n,\}_{n\in\mathcal{N}},\bm\lambda,\bm\mu\right)\tag{\ref{E:DualFunc}}\\ \mathrm{s.t.}&\,\text{\cref{C:PosPowULHybMain,C:LDConstULHybMain,C:ModeSelULHybMain}}.\notag \end{align} \end{subequations} The maximization problem in~\eqref{E:DualFunc} can be decomposed into $N$ parallel sub-problems using~\eqref{E:LagW}, where each sub-problem corresponds to a single SC $n$, and has the following structure, \begin{subequations} \label{P:DualFuncn} \begin{align} \max_{\bm p_n,\bm\alpha_n,\bm\nu_n,\delta_n}&\:L_n(\delta_n,\bm\nu_n,\bm\alpha_n,\bm p_n,\bm\lambda,\bm\mu)\tag{\ref{P:DualFuncn}}\nonumber\\ \mathrm{s.t.}&\:\bm p_n\succeq\bm 0\label{C:PNZDFn}\\ &\ \delta_n(\bm 1^\mathsf{T}\bm\alpha_n)\leq 1\label{C:ModeRRHSelDFn}\\ &\ \bm\alpha_n\in\{0,1\}^{M\times 1}\label{C:RRHSelVectDFn}\\ &\ \bm 1^\mathsf{T}\bm\nu_n\leq 1\label{C:UASUDFn}\\ &\ \bm\nu_n\in\{0,1\}^{K\times 1}\label{C:UAVectDFn}\\ &\ \delta_n\in\{0,1\},\label{C:ModeDFn} \end{align} \end{subequations} with the objective function given by~\eqref{E:Lagn}. Problem~\eqref{P:DualFuncn} is non-convex due to the integer constraints~\cref{C:RRHSelVectDFn,C:UAVectDFn,C:ModeDFn} and also due to the coupled variables in the objective and the constraint~\eqref{C:ModeRRHSelDFn}. However, since the processing mode selection variable $\delta_n$ takes on only two values 0 or 1, we solve problem~\eqref{P:DualFuncn} for each of these two cases separately, and then choose the value of $\delta_n$ that gives the maximum objective value for SC $n$. Specifically, let $\bar{L}^Q_n$ denote the optimal value of problem~\eqref{P:DualFuncn} for the FaD mode~$(\delta_n=0)$ and $\bar{L}^D_n$ denote the corresponding value for the DaF mode~$(\delta_n=1)$. Then, for given dual variables $\bm\lambda$ and $\bm\mu$, the optimal processing mode selection $\bar{\delta}_n$ for problem~\eqref{P:DualFuncn} is given by \begin{align} \bar{\delta}_n=\begin{cases} 0&\text{if }\bar{L}^{Q}_n>\bar{L}^{D}_n\\ 1&\text{otherwise.}\label{E:OptModeDFn} \end{cases} \end{align} In the following two subsections, we explain in detail how to solve problem~\eqref{P:DualFuncn} for each processing mode, in order to obtain $\bar{L}^{Q}_n$ and $\bar{L}^{D}_n$. \subsubsection{The Case of FaD Processing~$\left(\delta_n=0\right)$}\label{SS:FD} With $\delta_n=0$, problem~\eqref{P:DualFuncn} reduces to \begin{subequations} \label{P:DFnJD} \begin{align} \max_{\bm p_n,\bm\alpha_n,\bm\nu_n}&\ L^Q\left(\bm\nu_n,\bm\alpha_n,\bm p_n,\bm\lambda,\bm\mu\right)\tag{\ref{P:DFnJD}}\\ \mathrm{s.t.}&\ \text{\cref{C:PNZDFn,C:RRHSelVectDFn,C:UASUDFn,C:UAVectDFn}},\notag \end{align} \end{subequations} where the objective function is given by \begin{align &L^Q(\bm\nu_n,\bm\alpha_n,\bm p_n,\bm\lambda,\bm\mu)\notag\\ &\triangleq\sum_{k\in\mathcal{K}}\nu_{k,n}\omega_kr_{k,n}^Q\left(\bm\alpha_n,p_{k,n}\right) -\frac{2B}{N}\sum_{m\in\mathcal{M}}\frac{\beta_m\lambda_m\alpha_{m,n}}{\bar{R}_m}\notag\\ &\quad-\sum_{k\in\mathcal{K}}\mu_k p_{k,n}\label{E:ObjDFnJD} \end{align} Now, let the user assignment on SC $n$ be fixed as $\bm\nu_n=\hat{\bm\nu}_n$. If no user is assigned to SC $n$, i.e. $\hat{\bm\nu}_n=\bm 0$, it is evident from~\eqref{E:ObjDFnJD} that the objective of problem~\cref{P:DFnJD} is maximized by setting $\bm p_n=\bm 0$ and $\bm\alpha_n=\bm 0$, i.e. the power allocation is zero and no RRH processes the signal, as expected. Otherwise, if SC $n$ is assigned to a user $\hat{k}_n\in\mathcal{K}$, so that $\hat{\nu}_{\hat{k}_n,n}=1$, and $\hat{\nu}_{k,n}=0~\forall k\neq\hat{k}_n$, then problem~\eqref{P:DFnJD} can be written as \begin{subequations \label{P:DFnJDFixUA} \begin{align} \max_{\substack{p_{\hat{k}_n,n}\geq 0,\\ \bm\alpha_n\in\{0,1\}^M}}&\,\omega_{\hat{k}_n}r_{\hat{k}_n,n}^Q\big(\bm\alpha_n,p_{\hat{k}_n,n}\big)-\frac{2B}{N}\sum_{m\in\mathcal{M}}\frac{\beta_m\lambda_m\alpha_{m,n}}{\bar{R}_m}\notag\\ &\,-\mu_{\hat{k}_n}p_{\hat{k}_n,n}.\tag{\ref{P:DFnJDFixUA}} \end{align} \end{subequations} Although the above problem~\eqref{P:DFnJDFixUA} is non-convex due to the integer variables $\bm\alpha_n$ and the coupled variables in the objective, when the selection of RRHs is also fixed as $\bm\alpha_n=\tilde{\bm\alpha}_n$, it reduces to the problem \begin{subequations} \label{P:DFnJDFUARRHSel} \begin{align} \max_{p_{\hat{k}_n,n}\geq 0}&\:\omega_{\hat{k}_n}r_{\hat{k}_n,n}^Q\big(\tilde{\bm\alpha}_n,p_{\hat{k}_n,n}\big)-\mu_{\hat{k}_n} p_{\hat{k}_n,n},\tag{\ref{P:DFnJDFUARRHSel}} \end{align} \end{subequations} which is convex due to~\cref{L:rknQConc}. In the special case when only one RRH quantizes and forwards the signal in SC $n$, i.e. when $\bm 1^\mathsf{T}\tilde{\bm\alpha}_n=1$, the optimal user power allocation $\tilde{p}_{\hat{k}_n,n}$ that solves problem~\eqref{P:DFnJDFUARRHSel} can be obtained in a closed-form as given by the following proposition. \begin{proposition}\label{Prop:OptPASRRHQ} Let $\tilde{m}_n\in\mathcal{M}$ be the single RRH that quantizes and forwards the signal in SC $n$, so that $\tilde{\alpha}_{\tilde{m}_n,n}=1$ and $\tilde{\alpha}_{m,n}=0\ \forall m\neq\tilde{m}_n$. Then, the optimal power allocation that solves problem~\eqref{P:DFnJDFUARRHSel} is given by \begin{align \tilde{p}_{\hat{k}_n}&=\frac{\left(\theta_{\tilde{m}_n}+2\right)\sigma_{\tilde{m}_n}^2}{2|h_{\tilde{m}_n,\hat{k}_n,n}|^2}\Bigg(\bigg(1+\frac{4}{\left(\theta_{\tilde{m}_n}+2\right)^2}\notag\\ &\quad\cdot\bigg[\frac{\omega_{\hat{k}_n} B|h_{\tilde{m}_n,\hat{k}_n,n}|^2\theta_{\tilde{m}_n}}{\sigma_{\tilde{m}_n}^2\mu_{\hat{k}_n} N\ln 2}-\left(\theta_{\tilde{m}_n}+1\right)\bigg]^+\bigg)^{\frac{1}{2}}-1\Bigg),\label{E:OptPASingleRRH} \end{align} where $\theta_{\tilde{m}_n}\triangleq 2^{2\beta_{\tilde{m}_n}}/3>0$. \end{proposition} \begin{proof} Please refer to appendix~\ref{App:ProofOptPASRRHQ}. \end{proof} \cref{Prop:OptPASRRHQ} shows that the optimal user power allocation in the case of FaD processing with a single RRH selection has a threshold structure and is non-zero only if $\tfrac{|h_{\tilde{m}_n,\hat{k}_n,n}|^2}{\sigma_{\tilde{m}_n}^2}>\tfrac{\mu_{\hat{k}_n} N\ln 2}{\omega_{\hat{k}_n}B}\big(1+\tfrac{1}{\theta_{\tilde{m}_n}}\big)$. On the other hand, if more than one RRHs quantize and forward the signal in SC $n$, i.e. if $\bm 1^\mathsf{T}\tilde{\bm\alpha}_n>1$, then the optimal user power allocation $\tilde{p}_{\hat{k}_n,n}$ for problem~\eqref{P:DFnJDFUARRHSel} can be efficiently obtained by a one-dimensional line search whose complexity does not depend on the number of RRHs $M$. Thus, for a fixed RRH selection $\tilde{\bm\alpha}_n$, $\tilde{p}_{\hat{k}_n,n}$ can be efficiently obtained either using~\eqref{E:OptPASingleRRH} when $\bm 1^\mathsf{T}\tilde{\bm\alpha}_n=1$, or via a one-dimensional line search, when $\bm 1^\mathsf{T}\tilde{\bm\alpha}_n>1$. The optimal solution to the joint RRH selection and user power allocation problem~\eqref{P:DFnJDFixUA} can thus be obtained by solving problem~\eqref{P:DFnJDFUARRHSel} for all the $2^M$ possible RRH selections $\tilde{\bm\alpha}_n\in\{0,1\}^M$, and then choosing the RRH selection with the corresponding optimal user power allocation that gives the largest objective value for~\eqref{P:DFnJDFixUA}. Since the optimal user power allocation can be obtained either in closed-form using~\eqref{E:OptPASingleRRH} when $\bm 1^\mathsf{T}\tilde{\bm\alpha}_n=1$, or using a one-dimensional line search whose complexity does not depend on $M$, when $\bm 1^\mathsf{T}\tilde{\bm\alpha}_n>1$, the overall complexity of optimally solving problem~\eqref{P:DFnJDFixUA} is $O\left(2^M\right)$. Finally, after solving problem~\eqref{P:DFnJDFixUA} for each user assignment $\hat{k}_n\in\mathcal{K}$, the optimal solution to problem~\eqref{P:DFnJD} for the FaD mode can be obtained by choosing the user assignment and corresponding RRH selection and power allocation that maximizes the objective in~\eqref{P:DFnJD}. Thus, the overall complexity of solving problem~\eqref{P:DFnJD} optimally is $O\left(K2^M\right)$. The next section describes how to solve problem~\eqref{P:DualFuncn} for the other DaF processing mode~$(\delta_n=1)$. \subsubsection{The Case of DaF Processing~$\left(\delta_n=1\right)$}\label{SS:DF} In the DaF mode, $\delta_n=1$ and problem~\eqref{P:DualFuncn} reduces to \begin{subequations} \label{P:DFnLD} \begin{align} \max_{\bm p_n\succeq\bm 0,\bm\alpha_n\in\{0,1\}^M}&\,L^D(\bm\nu_n,\bm\alpha_n,\bm p_n,\bm\lambda,\bm\mu)\tag{\ref{P:DFnLD}}\\ \mathrm{s.t. &\,\bm 1^\mathsf{T}\bm\alpha_n\leq 1,\label{C:RRHSelDFnLD} \end{align} \end{subequations} where the objective function is given by \begin{align &L^D(\bm\nu_n,\bm\alpha_n,\bm p_n,\bm\lambda,\bm\mu)\notag\\ &\triangleq\sum_{k\in\mathcal{K}}\omega_k\nu_{k,n}\sum_{m\in\mathcal{M}}\alpha_{m,n}r^D_{m,k,n}(p_{k,n})-\sum_{m\in\mathcal{M}}\frac{\lambda_m\alpha_{m,n}}{\bar{R}_m}\notag\\ &\quad\cdot\sum_{k\in\mathcal{K}}\nu_{k,n}r^D_{m,k,n}(p_{k,n} -\sum_{k\in\mathcal{K}}\mu_k p_{k,n}. \end{align} Similar to the case of FaD processing in~\cref{SS:FD}, if no user is assigned to SC $n$, it is evident that the optimal power allocation for problem~\eqref{P:DFnLD} is $\bm p_n=\bm 0$, while it can be assumed without loss of generality that no RRH is selected for processing the signal, i.e. $\bm\alpha_n=\bm 0$, in this case. On the other hand, if SC $n$ is assigned to a user $\hat{k}_n\in\mathcal{K}$, then problem~\eqref{P:DFnLD} reduces to \begin{subequations \label{P:DFnLDFixUA} \begin{align} \max_ p_{\hat{k}_n,n}\geq 0 \bm\alpha_n\in\{0,1\}^ }&\,\sum_{m\in\mathcal{M}}\alpha_{m,n}\Big(\omega_{\hat{k}_n}-\frac{\lambda_m}{\bar{R}_m \Big)r^D_{m,\hat{k}_n,n}\big(p_{\hat{k}_n,n}\big)\notag\\ &\,-\mu_{\hat{k}_n} p_{\hat{k}_n,n}\tag{\ref{P:DFnLDFixUA}}\\ \mathrm{s.t.}&\,\eqref{C:RRHSelDFnLD}.\notag \end{align} \end{subequations} Problem~\eqref{P:DFnLDFixUA} is non-convex due to the integer constraints on the RRH selection $\bm\alpha_n$ and hence difficult to solve directly to find the optimal power allocation for user $\hat{k}_n$ and the optimal RRH that should locally decode this user's signal. Thus, similar to the procedure in~\cref{SS:FD}, we first assume that an RRH $\tilde{m}_n\in\mathcal{M}$ is chosen to decode user $\hat{k}_n$'s message in SC $n$ i.e., $\alpha_{\tilde{m}_n,n}=1$ and $\alpha_{m,n}=0\ \forall m\neq\tilde{m}_n$, which reduces problem~\eqref{P:DFnLDFixUA} to \begin{subequations} \label{P:DFnLDFUARRHSel} \begin{align} \max_{p_{\hat{k}_n,n}\geq 0}&\,\Big(\omega_{\hat{k}_n} \frac{\lambda_{\tilde{m}_n}}{\bar{R}_{\tilde{m}_n}} \Big)r^D_{\tilde{m}_n,n}\big(p_{\hat{k}_n,n}\big)-\mu_{\hat{k}_n} p_{\hat{k}_n,n}\tag{\ref{P:DFnLDFUARRHSel}}. \end{align} \end{subequations} The optimal solution to the above problem~\eqref{P:DFnLDFUARRHSel} is given by the following proposition. \begin{proposition}\label{Prop:OptPDFnLDFUARRHSel} The optimal power allocation $\tilde{p}_{\hat{k}_n,n}$ that solves problem~\eqref{P:DFnLDFUARRHSel} is given by \begin{align} \tilde{p}_{\hat{k}_n,n}=\Bigg[\frac{B}{\mu N\ln 2}\Big(\omega_{\hat{k}_n}-\frac{\lambda_{\tilde{m}_n}}{\bar{R}_{\tilde{m}_n}}\Big)-\frac{\sigma_{\tilde{m}_n}^2}{|h_{\tilde{m}_n,\hat{k}_n,n}|^2}\Bigg]^+.\label{E:OptPALD} \end{align} \end{proposition} \begin{proof} The proof is similar to that for the standard water-filling power allocation for parallel AWGN channels~\cite{goldsmith2005wireless}. \end{proof} The optimal power allocation in~\eqref{E:OptPALD} for a fixed user assignment and RRH selection has the same form as the classic water-filling solution~\cite{goldsmith2005wireless}. However, in general the water levels are different for different SCs, and are determined by the user $\hat{k}_n$ to which SC $n$ is assigned to, as well as the RRH $\tilde{m}_n$ that is chosen to decode user $\hat{k}_n$'s message, through the parameters $\omega_{\hat{k}_n}$, $\lambda_{\tilde{m}_n}$, $\bar{R}_{\tilde{m}_n}$ and $h_{\tilde{m}_n,\hat{k}_n,n}$. The water-level on SC $n$ can be negative if $\lambda_{\tilde{m}_n}/\bar{R}_{\tilde{m}_n}\geq \omega_{\hat{k}_n}$, which implies that no power should be allocated to user $\hat{k}_n$ on SC $n$ in this case. The optimal solution to the joint RRH selection and user power allocation problem~\eqref{P:DFnLDFixUA} can thus be obtained by computing $\tilde{p}_{\hat{k}_n,n}$ as given in~\eqref{E:OptPALD} for all the RRHs $\tilde{m}_n\in\mathcal{M}$, and then selecting the RRH that gives the highest objective value for problem~\eqref{P:DFnLDFixUA}. This procedure incurs a complexity of $O\left(M\right)$ and is performed for each user assignment $\hat{k}_n\in\mathcal{K}$. Then the optimal solution to problem~\eqref{P:DFnLD} for the DaF mode can be found by choosing the user that gives the highest objective value in~\eqref{P:DFnLD}. The overall complexity of optimally solving problem~\eqref{P:DFnLD} on each SC $n$ for the DaF processing mode is thus $O(KM)$. Finally, after solving the problems~\cref{P:DFnJD,P:DFnLD} for the FaD and DaF processing modes to obtain the maximal objective values $\bar{L}^Q_n$ and $\bar{L}^D_n$, respectively, the optimal solution to problem~\eqref{P:DualFuncn} can be found by selecting the processing mode that maximizes the objective in~\eqref{E:Lagn}, according to~\eqref{E:OptModeDFn}. Thus, for given dual variables $\bm\lambda$ and $\bm\mu$, problem~\eqref{P:DualFuncn} can be solved for each SC $n\in\mathcal{N}$ optimally, incurring a worst-case complexity of $O(K(2^M+M))$. Next, we consider the dual problem corresponding to~\eqref{P:ULHybMain}, given by \begin{align} \min_{\bm\lambda\succeq\bm 0,\bm\mu\succeq\bm 0}g(\bm\lambda,\bm\mu).\label{E:DualProb} \end{align} The above dual problem~\eqref{E:DualProb} is convex and can be solved efficiently by using e.g., the ellipsoid method~\cite{boyd2014ellipsoid} to find the optimal dual variables $\bm\lambda^\star$ and $\bm\mu^\star$. Then, the optimal solution to problem~\eqref{P:DualFuncn} on each SC $n\in\mathcal{N}$ is given by $(\delta^\star_n,\bm\nu^\star_n,\bm\alpha_n^\star,\bm p_n^\star)$, computed as explained above with the optimal dual variables $\bm\lambda^\star$ and $\bm\mu^\star$. The overall algorithm for solving the joint uplink resource allocation problem~\eqref{P:ULHybMain} is thus summarized in~\cref{A:Overall}. Since the complexity of the ellipsoid method to find the optimal dual variables depends only on the size of the initial ellipsoid and the maximum length of the sub-gradients over the intial ellipsoid~\cite{boyd2014ellipsoid}, it follows from the above discussion that an asymptotically optimal solution to problem~\eqref{P:ULHybMain} for large $N$ can be efficiently computed with an overall complexity of $O(NK(2^M+M))$ using the algorithm in~\cref{A:Overall}. \begin{table}[h] \centering \caption{Algorithm for problem~\eqref{P:ULHybMain}}\label{A:Overall} \begin{framed} \begin{algorithmic}[1] \State Initialization: $\bm\lambda\succeq\bm 0$, $\bm\mu\succeq\bm 0$ \Repeat \For {each SC $n\in\mathcal{N}$} \State With $\delta_n=0$, for each user $\hat{k}_n\in\mathcal{K}$ and each RRH selection $\tilde{\bm\alpha}_n\in\{0,1\}^M$, find optimal user power allocation by solving~\eqref{P:DFnJDFUARRHSel}\label{AL:JDOptRRHPA} \State Choose RRH selection and corresponding user power allocation that maximizes objective in~\eqref{P:DFnJDFixUA} \State Choose user with optimal RRH selection and power allocation that gives maximum value $\bar{L}^Q_n$ of objective in~\eqref{P:DFnJD} \State With $\delta_n=1$, for each user $\hat{k}_n\in\mathcal{K}$ and each RRH $\tilde{m}_n\in\mathcal{M}$, find optimal user power allocation using~\cref{E:OptPALD} \State Choose RRH and corresponding user power allocation that maximizes objective in~\eqref{P:DFnLDFixUA} \State Choose user with optimal RRH and power allocation that gives maximum value $\bar{L}^D_n$ of objective in~\eqref{P:DFnLD} \State Find optimal mode selection $\bar{\delta}_n$ using~\eqref{E:OptModeDFn} \EndFor \State Update dual variables $\bm\lambda$, $\bm\mu$ using the ellipsoid method \Until ellipsoid algorithm converges to desired accuracy \end{algorithmic} \end{framed} \end{table} \subsection{Suboptimal Solution}\label{SS:SubOptSubP} In~\cref{SS:OptSol}, it is observed that optimally solving the problem~\eqref{P:DFnJDFixUA} for the FaD mode on each SC $n$ for a fixed user assignment requires an exhaustive search over all possible RRH selections, incurring a complexity of $O(2^M)$, which may be unsuitable for dense networks with large values of $M$. In order to reduce this complexity, we propose an alternative way to solve problem~\eqref{P:DFnJDFixUA} suboptimally, via a greedy algorithm, in this subsection. The objective function of problem~\eqref{P:DFnJDFixUA} can be written in terms of the set of selected RRHs $\mathcal{A}_n$, as \begin{align f\big(\mathcal{A}_n,p_{\hat{k}_n,n}\big)&\triangleq\omega_kr_{\hat{k}_n,n}^Q\big(\mathcal{A}_n,p_{\hat{k}_n,n}\big)-\frac{2B}{N}\sum_{m\in\mathcal{A}_n}\frac{\beta_m\lambda_m}{\bar{R}_m}\notag\\ &\quad-\mu_{\hat{k}_n}p_{\hat{k}_n,n}.\label{E:ObjFixUASet} \end{align} Let $p_{\hat{k}_n,n}(\mathcal{A}_n)$ denote the optimal power allocation for user $\hat{k}_n$ that solves problem~\eqref{P:DFnJDFUARRHSel} when the selected set of RRHs is $\mathcal{A}_n$, which can be obtained using~\eqref{E:OptPASingleRRH} when $|\mathcal{A}_n|=1$, or by a line-search otherwise. Then, we construct a suboptimal set $\check{\mathcal{A}}_n$ and find the corresponding user power allocation $\check{p}_{\hat{k}_n,n}\triangleq p_{\hat{k}_n,n}\big(\check{\mathcal{A}_n}\big)$ for problem~\eqref{P:DFnJDFixUA} using a greedy algorithm as follows. Let $\mathcal{A}_{n,i}$ denote the set of selected RRHs on SC $n$ at the start of an iteration $i$, and $f_i\triangleq f\big(\mathcal{A}_{n,i},p_{\hat{k}_n,n}(\mathcal{A}_{n,i})\big)$ denote the corresponding maximum objective value of problem~\eqref{P:DFnJDFixUA} as given by~\eqref{E:ObjFixUASet}. We assume that initially, $\mathcal{A}_{n,1}=\emptyset$, and $f_1=0$. At each iteration $i=1,\dotsc,M$, we first find an RRH $j_i\in\mathcal{M}\setminus\mathcal{A}_{n,i}$, which is not currently selected and when added to the current set of RRHs $\mathcal{A}_{n,i}$, maximizes the objective in~\eqref{E:ObjFixUASet} among all the currently un-selected RRHs, i.e., \begin{align} j_i=\mathop{\arg\max}_{\ell\in\mathcal{M}\setminus\mathcal{A}_{n,i}}f\big(\mathcal{A}_{n,i}\cup\{\ell\},p_{\hat{k}_n,n}(\mathcal{A}_{n,i}\cup\{\ell\})\big).\label{E:MaxRRHji} \end{align} If RRH $j_i$ improves the current maximum objective value $f_{i-1}$, we add it to the current set of selected RRHs $\mathcal{A}_{n,i}$, i.e., if \begin{align} f\big(\mathcal{A}_{n,i}\cup\{j_i\},p_{\hat{k}_n,n}(\mathcal{A}_{n,i}\cup\{j_i\})\big)>f_i \label{E:NewObjGreater} \end{align} holds, the set of selected RRHs is updated as $\mathcal{A}_{n,i+1}=\mathcal{A}_{n,i}\cup\{j_i\}$, and the current maximum objective value is updated as \begin{align} f_{i+1}=f\big(\mathcal{A}_{n,i}\cup\{j_i\},p_{\hat{k}_n,n}(\mathcal{A}_{n,i}\cup\{j_i\})\big).\label{E:UpdCObj} \end{align} This procedure is continued until no RRH $j_i$ can be found which satisfies~\eqref{E:NewObjGreater}, or there is no more remaining RRH to be searched, i.e. $i=M$. If the algorithm stops at iteration $i$, the final suboptimal RRH selection and corresponding user power allocation are given by $\check{\mathcal{A}}_n=\mathcal{A}_{n,i}$ and $\check{p}_{\hat{k}_n,n}=p_{\hat{k}_n,n}(\mathcal{A}_{n,i})$. Notice that the greedy algorithm would recover the optimal solution to problem~\eqref{P:DFnJDFixUA} whenever the optimal RRH selection consists of at most two RRHs. However, in general, for given dual variables $\bm\lambda$ and $\bm\mu$, the greedy algorithm gives only a suboptimal solution $\check{\bm\alpha}_n,\check{\bm p}_n$ to problem~\eqref{P:DFnJDFixUA}. An outline of the algorithm is given in~\cref{A:GreedyRRHSel}. \begin{table}[h] \centering \caption{Greedy algorithm for problem~\eqref{P:DFnJDFixUA}}\label{A:GreedyRRHSel} \begin{framed} \begin{algorithmic}[1] \State Initialization: Iteration $i=1$, set of selected RRHs $\mathcal{A}_{n,1}=\emptyset$, maximum objective value $f_1=0$ \For {each $i=1,\dotsc,M$} \State Find the RRH $j_{i}\in\mathcal{M}\setminus\mathcal{A}_{n,i}$, according to~\eqref{E:MaxRRHji} \If {$j_i$ satisfies condition~\eqref{E:NewObjGreater}} \State Update selected set as $\mathcal{A}_{n,i+1}=\mathcal{A}_{n,i}\cup\left\{j_{i}\right\}$ \State Update current maximum objective value $f_{i+1}$ according to~\cref{E:UpdCObj} \Else \State Stop and return RRH set $\check{\mathcal{A}}_n=\mathcal{A}_{n,i}$ and corresponding user power allocation $\check{p}_{\hat{k}_n,n}=p_{\hat{k}_n,n}(\mathcal{A}_{n,i})$ \EndIf \EndFor \end{algorithmic} \end{framed} \end{table} From~\eqref{E:MaxRRHji}, it can be seen that in each iteration $i=1,\dotsc,M$, the greedy algorithm searches over the set of RRHs $\mathcal{M}\setminus\mathcal{A}_{n,i}$, which has size $M-(i-1)$ to find the RRH $j_i$ according to~\eqref{E:MaxRRHji}. Since there can be at most $M$ iterations, the worst-case complexity of the greedy algorithm is $\sum_{i=1}^{M}M-i+1=M(M+1)/2$, which is $O(M^2)$. Since the complexity of finding the user power allocation in each iteration does not depend on $M$, the overall complexity of using the greedy algorithm to solve problem~\eqref{P:DFnJDFixUA} on each SC $n$ is $O(M^2)$, which is only quadratic in $M$, compared to the exponential complexity of the exhaustive search over all possible RRH selections. Thus, in the algorithm in~\cref{A:Overall}, if problem~\eqref{P:DFnJDFixUA} is solved using the suboptimal greedy algorithm in~\cref{A:GreedyRRHSel} instead of the optimal exhaustive search, the worst-case complexity of the algorithm in~\cref{A:Overall} is reduced to $O(NK(M^2+M))$. However, using the greedy algorithm, a convergence to the optimal dual variables $\bm\lambda^\star$ and $\bm\mu^\star$ cannot be guaranteed and the primal solution obtained for problem~\eqref{P:ULHybMain} by this method need not always be feasible. In this case, the power allocations can be made feasible by scaling each of the power constraints in~\eqref{C:PCULHybMain}. Similarly, the constraint in~\eqref{E:IFHRC} can be made feasible by considering each SC in increasing order of the rates achieved. If the DaF mode was selected on an SC, we make the user power allocation zero on this SC. Otherwise, if the FaD mode was selected with more than one RRH processing the signal in the SC, the RRHs are de-selected in increasing order of their contribution to the SNR on each SC, until~\eqref{E:IFHRC} is satisfied. Thus, a feasible solution to problem~\eqref{P:ULHybMain} can always be obtained. However, in~\cref{Sec:SimResults}, it is shown through extensive simulations that there is only a negligible difference between the performance of the greedy algorithm and the exhaustive search for $\bm\alpha_n$'s in several practical scenarios. Thus, in practice, the joint resource allocation problem~\eqref{P:ULHybMain} may be solved close to optimally at a worst-case complexity of $O(NK(M^2+M))$ by using the greedy algorithm, which is a large reduction compared to a complexity of $O(NK(2^M+M))$ for the optimal algorithm. \section{Simulation Results}\label{Sec:SimResults} For the simulation setup, we first consider a UD-CRAN cluster with $M=5$ RRHs and $K=3$ users. One RRH is located in the center of a square region with side 375 meters~(m), while the others are located on the vertices. The users are randomly located within a larger square region of side 750~m, and whose center coincides with that of the RRH square region. The fronthaul links of all the RRHs are assumed to have the same capacity $\bar{R}_m=\bar{R}~\forall m\in\mathcal{M}$, and all the RRHs use the same resolution of $\beta_m=\beta,~\forall m\in\mathcal{M}$ bits for the uniform SQ in the FaD processing mode. The wireless channel is centered at a frequency of $2$~GHz with a bandwidth $B=20$~MHz, following the Third Generation Partnership Project~(3GPP) Long Term Evolution-Advanced~(LTE-A) standard~\cite{3gpp36211}, and is divided into $N=64$ SCs using OFDMA. The combined path loss and shadowing is modeled as $38+30\log_{10}(d_{m,k})+X$ in dB~\cite{3gpp36931}, where $d_{m,k}$ is the distance between RRH $m$ and user $k$ in meters, and $X$ is the shadowing random variable, which is normally distributed with a standard deviation of $6$~dB. The multi-path on each wireless channel is modeled using an exponential power delay profile with $N/4$ taps and the small-scale fading on each tap is assumed to follow the Rayleigh distribution. The AWGN is assumed to have a power spectral density of $-174$~dBm/Hz with an additional noise figure of $6$~dB at each RRH, while the total transmit power at each user is $\bar{P}_k=23~\text{dBm}\,\forall k\in\mathcal{K}$, unless mentioned otherwise. The proposed algorithm for hybrid decoding is compared to the following two benchmark schemes: \begin{itemize} \item \textbf{FaD processing on all SCs}: In this case, we solve problem~\eqref{P:ULHybMain} with $\delta_n=0\ \forall n\in\mathcal{N}$ using a similar algorithm as given in~\cref{A:Overall}. \item \textbf{DaF processing on all SCs}: In this case, we solve problem~\eqref{P:ULHybMain} with $\delta_n=1\ \forall n\in\mathcal{N}$. \end{itemize} For simplicity, we consider maximization of the sum rate in problem~\eqref{P:ULHybMain}, i.e., the user rate weights $\omega_k=1~\forall k\in\mathcal{K}$, and the values averaged over many random user locations and channels are plotted against various system parameters. \begin{figure}[h] \centering \includegraphics[width=\linewidth]{Fig2_SRvbits} \caption{Users' sum-rate vs.\ number of SQ bits for system with $M=5$, $K=3$, $B=20$~MHz, $N=64$ and $\bar{R}=250$~Mbps.}\label{F:SRvQ} \end{figure} \cref{F:SRvQ} plots the sum-rate against the number of bits $\beta$ used for the SQ at each RRH, when the common fronthaul capacity of the RRHs is $\bar{R}=250$~Mbps. From~\cref{F:SRvQ}, it is observed that the hybrid decoding with the proposed optimal and suboptimal algorithms outperforms both the benchmark schemes described above. Moreover, there is a negligible difference between the optimal and suboptimal hybrid decoding schemes, which implies that in practical UD-CRAN systems, the hybrid decoding gains can be achieved with the suboptimal greedy algorithm at a much lower complexity compared to the optimal algorithm. At lower values of $\beta$, the FaD scheme performs worse than the DaF scheme, since in this case the SQ is coarse, which reduces the achievable rate on each SC as given by~\eqref{E:SCRJ}, even though the fronthaul is able to support this rate. On the other hand, when $\beta$ is very high, the higher achievable rates given by~\eqref{E:SCRJ} cannot be supported by the limited fronthaul capacity of the RRHs, which again restricts the performance of the FaD scheme. However, for values of $\beta$ in between these two extremes, the FaD scheme outperforms the DaF scheme, while the proposed hybrid decoding offers the maximum advantage for all values of $\beta$. \begin{figure}[h] \centering \includegraphics[width=\linewidth]{Fig3_SRvPow} \caption{Users' sum-rate vs.\ per user total transmit power constraint for system with $M=5$, $K=3$, $B=20$~MHz, $N=64$, $\bar{R}=250$~Mbps and $\beta=10$.}\label{F:SRvP} \end{figure} \cref{F:SRvP} plots the sum-rate against the maximum transmit power constraint $\bar{P}$ at each user, when the common fronthaul capacity of the RRHs is $\bar{R}=250$~Mbps, and $\beta=10$. Again, from~\cref{F:SRvP}, it is observed that the proposed hybrid decoding outperforms both the benchmark schemes above, while the performance of the proposed optimal and suboptimal algorithms are similar. In addition to the proposed algorithms and the benchmark schemes listed above,~\cref{F:SRvQ,F:SRvP} also plot the dual upper bound to problem~\eqref{P:ULHybMain} given by the optimal value of the dual function $g(\bm\lambda^\star,\bm\mu^\star)$. It can be observed that the difference between the proposed optimal and suboptimal solutions and the dual upper bound is negligible even for $N=64$. Since the duality gap diminishes with $N$, this implies that the proposed algorithms are nearly optimal for practical values of $N$. Next, we consider a large network with $M=125$ RRHs whose locations are fixed as shown in~\cref{F:MU125M120KL}, and $K=120$ users randomly located within a square region of side $2$~km. Since the users that are far away from an RRH do not contribute to its achievable rate, to reduce the complexity of our proposed algorithms, we assume that the network is divided into $25$ square clusters of $5$ RRHs each, as shown in~\cref{F:MU125M120KL}. We assume that proper frequency reuse has been assigned over adjacent clusters and thus neglect the inter-cluster interference for simplicity. Then, the algorithms in~\cref{A:Overall,A:GreedyRRHSel} can be executed in parallel in each cluster. \cref{F:SRvFHR} plots the sum-rate of the users, averaged over random channel realizations, against the common fronthaul capacity of the RRHs, with $\beta=10$ bits. When the fronthaul capacity is low, the DaF scheme performs better than the FaD scheme, and its performance matches that of the proposed hybrid decoding, since in this case the fronthaul cannot support the transmission of accurately quantized signals from multiple RRHs in any SC. On the other hand, when the fronthaul capacity is sufficiently large, FaD outperforms DaF, and its sum-rate approaches that achieved by hybrid decoding. In this case, most or all the RRHs can participate in the joint decoding on each SC, which provides a joint signal processing gain. In between these two extremes, the proposed hybrid decoding offers significant gains over both the DaF and FaD schemes. In this regime, by performing DaF processing on some of the SCs, the hybrid decoding saves the fronthaul capacities of the respective RRHs, which can in turn be used for carrying quantized signals for FaD processing on other SCs, thus performing better than both the benchmarks. Thus, under practical setups with finite fronthaul capacities, even the suboptimal hybrid decoding algorithm with a low complexity of $O(NK(M^2+M))$ can offer significant throughput gains over the conventional CRAN with FaD processing at all SCs, as well as a cellular network with DaF processing at all SCs. \begin{figure}[h] \centering \includegraphics[width=\linewidth]{Fig4_125M120KLayout} \caption{Example UD-CRAN layout with $M=125$ and $K=120$.}\label{F:MU125M120KL} \end{figure} \begin{figure}[h] \centering \includegraphics[width=\linewidth]{Fig5_SRvFHR} \caption{Users' sum-rate vs.\ per-RRH fronthaul capacity for system with $M=125$, $K=120$, $B=20$~MHz, $N=64$ and $\beta=10$.}\label{F:SRvFHR} \end{figure} \section{Conclusion}\label{Sec:Conc} In this paper, we have studied the uplink transmission in an OFDMA-based UD-CRAN with hybrid decoding at the RRHs. We formulated a joint RRHs' processing mode selection, user-SC assignment, and users' power allocation problem to maximize the weighted-sum-rate of the users over all SCs subject to the given RRHs' individual fronthaul capacity constraints and the individual transmit power constraints at the users. Although the problem is non-convex, we propose two efficient solutions based on the Lagrange duality technique. Through numerical simulations, it is shown that the proposed algorithms for hybrid decoding with optimized resource allocation outperform both state-of-the-art CRAN with FaD processing and conventional cellular network with DaF processing. \appendices \section{Proof of~\cref{L:rknQConc}}\label{App:ProofLrknQConc} In this proof, we drop the user and SC sub-scripts $k$ and $n$ for convenience. Then, by direct differentiation, it can be shown that the second-order derivative of $\gamma^Q_m(p)$ in~\eqref{E:PartSNR} with respect to~(w.r.t.) $p$ satisfies $\od[2]{\gamma^Q_m(p)}{p}\leq 0,\,\forall p\geq 0$, which implies that $\gamma^Q_m(p)$ in~\eqref{E:PartSNR} is concave for $p\geq 0$. For a given $\bm\alpha$, since $\gamma^Q(\bm\alpha,p)$ in~\eqref{E:RxSNRJD} is the non-negative sum of the concave functions $\gamma^Q_m(p),\,m\in\mathcal{A}_n$, it follows that $\gamma^Q(\bm\alpha,p)$ is also concave in $p$~\cite{boyd2004convex}. Now, the logarithm function is concave and its extended value extension on the real line is non-decreasing. Thus, for given $\bm\alpha$, $r^Q(\bm\alpha,p)=(B/N)\log_2(1+\gamma^Q(\bm\alpha,p))$ according to~\eqref{E:SCRJ} is the composition of the concave function $\gamma^Q(\bm\alpha,p)$ with a concave and non-decreasing function, and hence $r^Q\left(\bm\alpha,p\right)$ is also concave for $p\geq 0$~\cite{boyd2004convex}, which completes the proof. \section{Proof of~\cref{Prop:OptPASRRHQ}}\label{App:ProofOptPASRRHQ} In this proof, we drop the user and SC sub-scripts for convenience. Since the objective of problem~\eqref{P:DFnJDFUARRHSel} is concave in $p$, the user power allocation that maximizes its value can be found by differentiating the objective w.r.t. $p$ and setting the derivative equal to zero; this leads to the equation, \begin{align &\frac{-\mu\theta_{\tilde{m}_n}|h_{\tilde{m}_n}|^2}{\sigma_{\tilde{m}_n}^2}p^2-\frac{\mu(2\theta_{\tilde{m}_n}+1)|h_{\tilde{m}_n}|^2}{\sigma_{\tilde{m}_n}^2}p -\mu(\theta_{\tilde{m}_n}+1)\notag\\ &+\frac{\omega B|h_{\tilde{m}_n}|^2}{\sigma_{\tilde{m}_n}^2N\ln 2}=0.\label{E:DiffPASRRHQ} \end{align} Further, it can be observed that the user power allocation $\tilde{p}$ that maximizes the objective of problem~\eqref{P:DFnJDFUARRHSel} is given by the right-hand root of the quadratic equation~\eqref{E:DiffPASRRHQ}, which can be expressed as \begin{align \tilde{p}&=\frac{(\theta_{\tilde{m}_n}+2)\sigma_{\tilde{m}_n}^2}{2|h_{\tilde{m}_n}|^2}\Bigg(\bigg(1+\frac{4}{\left(\theta_{\tilde{m}_n}+2\right)^2}\notag\\ &\quad\cdot\Big(\frac{\omega B|h_{\tilde{m}_n}|^2\theta_{\tilde{m}_n}}{\sigma_{\tilde{m}_n}^2\mu N\ln 2}-(\theta_{\tilde{m}_n}+1)\Big)\bigg)^{\frac{1}{2}}-1\Bigg).\label{E:OptPAJDProof} \end{align} Also, since we require $\tilde{p}\geq 0$, from~\eqref{E:OptPAJDProof} we have \begin{align} \frac{\omega B|h_{\tilde{m}_n}|^2\theta_{\tilde{m}_n}}{\sigma_{\tilde{m}_n}^2\mu N\ln 2}-(\theta_{\tilde{m}_n}+1)\geq 0.\label{E:CondOptPAJDProof} \end{align} Combining~\eqref{E:CondOptPAJDProof} with~\eqref{E:OptPAJDProof} gives the expression in~\eqref{E:OptPASingleRRH}, which completes the proof. \bibliographystyle{IEEEtran_mod}
{'timestamp': '2017-06-06T02:07:57', 'yymm': '1607', 'arxiv_id': '1607.04931', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04931'}
arxiv
\section{Introduction} When dealing with large data sets, it is often crucial to be able to extract a smaller well-diversified subset of the data. This is a classic problem in information retrieval, and appears in many natural settings. For example, a news website often presents the reader with a small list of highlighted stories that should be as relevant as possible to the reader. However, at the same time, the shown news stories should exhibit a certain diversity. The analogous problem appears in the context of search engines, showing a small set of hits that are at the same time relevant and diverse. Similarly, to get a better overview of a large dataset, it is often of interest to exhibit a small set of entries that reflect the typical entries found in the data set. Again, a relevant and diverse subsample is desired. Not surprisingly, diversity maximization became an important concept in information retrieval, computational geometry and operations research. In this paper we focus on one classic diversity measure, namely the \emph{dispersion}, which has been studied in the operations research community~\cite{hassin1997approximation,ravi1994heuristic,birnbaum2009improved,fekete2004maximum} and is currently receiving considerable attention in the information retrieval literature~\cite{gollapudi2009axiomatic,bhattacharya2011consideration,borodin2012max}. More formally, we are given a finite ground set $X$ of size $n$ and a symmetric nonnegative function $d:X\times X \rightarrow \mathbb{R}_{\geq 0}$ between pairs of $X$ satisfying $d(a,a)=0$ for $a\in X$. Such a function $f$ is called a \emph{distance function}, and we highlight that it does not necessarily have to be metric. The dispersion of a set $A\subseteq X$ is the sum of all pair-wise distances within $A$; in short, we denote the dispersion of $A$ by \begin{equation*} d(A) \coloneqq \sum_{\{a,b\}\subseteq A} d(a,b)\enspace. \end{equation*} Diversity maximization problems with respect to the dispersion are known under several names, in particular \emph{max-sum diversification} (in short \MSD ), \emph{max dispersion} or \emph{remote clique}. In its most basic form, the task is to maximize the dispersion under a cardinality constraint of rank $k$, i.e. \begin{equation*} \max\{d(A) \mid A\subseteq X, |A| \leq k\}\enspace. \end{equation*} For brevity, we denote this max-sum diversification problem under a cardinality constraint by $\MSD_k$. A natural generalization of $\MSD_k$ is obtained by replacing the cardinality constraint with the requirement that the set $A$ must be independent in a given matroid $M=(X,\mathcal{I})$ which, as is usual, is assumed to be given by an independence oracle.\footnote{We recall that a matroid $M=(X,\mathcal{I})$ consists of a finite ground set $X$ and a non-empty family $\mathcal{I}\subseteq 2^X$ of subsets called \emph{independent sets}, satisfying: \begin{enumerate*}[label=(\roman*)] \item if $A\in \mathcal{I}, B\subseteq A \Rightarrow B \in \mathcal{I}$, and \item if $A,B\in \mathcal{I}$ with $|A| > |B|$ $\Rightarrow \exists a\in A\setminus B$ such that $B\cup \{a\}\in \mathcal{I}$ \end{enumerate*}. For more information related to matroids we refer to~\cite{schrijver2003combinatorial}.} Matroid constraints cover natural relevant cases, for instance the items in $X$ can be partitioned into several subgroups, and a certain number of elements have to be chosen in each subgroup. A wide set of distance functions $d$ have been considered in this context. A very common distance type is obtained by first representing the elements of the ground set $X$ by vectors in a high-dimensional space $\mathbb{R}^q$, and then selecting a norm in $\mathbb{R}^q$ and using the corresponding induced distances (see, e.g., \cite{manning2008introduction,salton1983introduction}). Recently, many results have been developed for various combinations of constraints, distances, and objectives. In particular, constant-factor approximations have been obtained for $\MSD_k$ for metric distances $d$. More precisely, Ravi, Rosenkrantz and Tayi~\cite{ravi1994heuristic} showed that a natural greedy procedure is a $4$-approximation, which was later shown by Birnbaum and Goldman~\cite{birnbaum2009improved} to even achieve an approximation factor of $2$, asymptotically. Prior to this improved analysis, Hassin, Rubinstein and Tamir~\cite{hassin1997approximation} presented a different $2$-approximation. An approximation factor of $2$ is tight for this problem assuming that the \emph{planted clique} problem~\cite{alon2011inapproximability} is hard (see~\cite{borodin2012max}). Moreover, Fekete and Meijer~\cite{fekete2004maximum} showed that if the distance $d$ stems from the $\ell_1$-norm in a constant-dimensional space, then a PTAS can be obtained.\footnote{We recall that a polynomial-time approximation scheme (PTAS) is an algorithm that, for any fixed $\epsilon >0$, returns a $(1-\epsilon)$-approximation in polynomial time.} For \MSD under a matroid constraint, Abbassi, Mirrokni and Thakur~\cite{abbassi2013diversity} and Borodin, Lee, and Ye~\cite{borodin2012max} recently obtained $\frac{1}{2}$-approximations if $d$ is metric, which were the first constant-factor approximations for this setting. The approximation factor of $\frac{1}{2}$ is as well tight here, because this setting captures $\MSD_k$ with metric distances. Motivated by various applications, interest also arose in generalized objective functions. In particular Bhattacharya, Gollapudi and Munagala~\cite{bhattacharya2011consideration} considered an objective that consists of the dispersion plus an additive linear term, which allowed for also representing \emph{scores of documents}. Even more generally, Borodin, Lee, and Ye~\cite{borodin2012max} studied the sum of the dispersion function with a monotone submodular function, and showed that even for this generalization a $\frac{1}{2}$-approximation can be achieved for this objective under a matroid constraint via local search. Very recently, the authors showed~\cite{cevallos_2016_max-sum} that considerably stronger results can be achieved under a matroid constraint for many frequently used distances $d$ that have the property of being of \emph{negative type}, which is defined as follows. Let $D\in \mathbb{R}_{\geq 0}^{n\times n}$ be the distance matrix corresponding to $d$, i.e., $D_{a,b}=d(a,b)$ for $a,b\in X$. Then, $d$ is of negative type if \begin{equation*} x^T D x \leq 0 \qquad \forall x\in \mathbb{R}^n \text{ with } \sum_{i=1}^n x_i=0\enspace. \end{equation*} Commonly used distances of negative type include the ones induced by $\ell_1$ and $\ell_2$ norms, the cosine distance or the Jaccard distance~\cite{Pekalska:2005:DRP:1197035}. For more information on negative type distances, we refer the interested reader to~\cite{schoenberg1938metricI,schoenberg1938metricII,deza1990metric,DezaLaurent97}. Norms corresponding to negative distance types have as well been used for similarity measures via lower-dimensional bit vectors stemming from sketching techniques~\cite{charikar2002similarity}. For negative type distances, a PTAS for \MSD can be achieved under a matroid constraint, based on rounding solutions obtained by a convex relaxation of the problem~\cite{cevallos_2016_max-sum}. Whereas this is essentially optimal in terms of approximation quality, the employed technique requires to solve $n$-dimensional convex optimization problems, which is impractical for large data sets and large data sets are usually to be dealt with in web-search and information retrieval. This motivates the guiding questions of this paper. \begin{enumerate} \item Can one profit from the additional structure of negative type distances to obtain \emph{efficient} PTASs that are suitable for \emph{large-scale} problems? \item Can one obtain such algorithms in other, more general relevant settings, beyond matroid constraints? \end{enumerate} \subsection*{Our results} Our key contribution is the analysis of conceptually simple and classic local search techniques for \MSD with negative type distances. These procedures are easy to implement and considerably faster than the convex optimization approach suggested in~\cite{cevallos_2016_max-sum}. First, this gives us a strong approximation algorithm for matroid constraints, which implies a PTAS. \begin{theorem}\label{thm:PTASmat} There is a $(1-\frac{5}{k})$-approximation for \MSD with negative type distances subject to a matroid constraint of rank $k$, running in $O(n k^2 \log k)$ time, when counting distance evaluations and calls to the independence oracle as unit time. \end{theorem} The above theorem indeed implies a PTAS: This is clear if $k\geq \frac{5}{\epsilon}$, where $\epsilon>0$ is the error parameter; otherwise, feasible solutions only have constant size and one can enumerate over all possible solutions. This running time is \emph{linear} in $n$. In light of the fact that $k$ is much smaller than $n$ this running time is very desirable for large $n$. \medskip Furthermore, our techniques show that local search yields a PTAS for \MSD with negative type distances even for matroid intersection constraints. Whether a PTAS exists in this setting was not known before. \begin{theorem}\label{thm:PTASmatInt} There is a PTAS for \MSD with negative type distances subject to a matroid intersection constraint. \end{theorem} Our PTAS is a variation of a classic local search technique, which was used by Lee, Sviridenko, and Vondr\'ak~\cite{lee_2010_submodular} in the context of submodular maximization, which considers at each iteration exchanges of constant size. This is the first non-trivial approximation result for matroid intersection constraints in this context, and its purpose is mainly to show that very strong approximation guarantees are possible for this constraint type. However, due to these larger-size exchanges, the suggested algorithm may have a large (polynomial) running time, depending on the size of the problem and the error parameter. \medskip Finally, by combining our results with recent non-oblivious local search techniques by Filmus and Ward~\cite{filmus2014monotone}, and Sviridenko, Vondr{\'a}k and Ward~\cite{sviridenko2015optimal}, we obtain close-to-optimal approximation guarantees for \MSD with an objective function being a sum of the dispersion for negative type distances and a monotone submodular function, subject to a matroid constraint. Such objectives allow for balancing diversity and \emph{relevance}. Combinations of diversity and a linear function have been studied previously, see~\cite{bhattacharya2011consideration,borodin2012max}. The approximation factor we obtain depends on the \emph{curvature} of the submodular function, which yields a smooth interpolation between linear functions and submodular functions. We give a formal definition of curvature in Section~\ref{sec:submodObj}. \begin{theorem}\label{thm:msd+f} Consider \MSD subject to a matroid constraint of rank $k$, with respect to an objective $g=d+f$, where $d$ is the dispersion for a negative type distance and $f$ is a nonnegative, monotone submodular function of curvature $c$. Let $\lambda_d=\frac{d(\OPT)}{g(\OPT)}$ and $\lambda_f=\frac{f(\OPT)}{g(\OPT)}$, where $\OPT$ is an optimal solution to the problem of maximizing $g$ subject to the matroid constraint. Then, for any $\epsilon >0$, there is an efficient algorithm returning a solution of approximation guarantee \begin{equation*} 1-\lambda_d \frac{4}{k}-\lambda_f \frac{c}{e} - \epsilon \geq 1-\max\left\{\frac{4}{k}, \frac{c}{e}\right\} - \epsilon \enspace. \end{equation*} \end{theorem} The above result implies a PTAS for the case of $f$ being linear. This greatly improves upon the known $1/2$-approximation~\cite{bhattacharya2011consideration,borodin2012max} if the distances are of negative type. If $k$ is large enough, the result yields an approximation factor of $1-\frac{c}{e}-\epsilon$, which is known to be optimal even for the special case of maximizing a monotone submodular function with curvature $c$ over a matroid constraint~\cite{sviridenko2015optimal}. \subsection*{Further related results and implications} A further approach to deal with diversity maximization in large data sets is the computation of so-called \emph{core-sets}. A core-set is a small subset of the data such that an optimal solution to certain optimization problems, when applied only on the elements of the core-set, is close to the global optimal solution. Core-sets and the generalized notion of \emph{composable core-sets} have recently received considerable attention in the context of diversity maximization, and allow for transforming sequential algorithms into algorithms that run in MapReduce and Streaming models. We refer the interested reader to~\cite{indyk2014composable} and~\cite{ceccarello2016mapreduce} and references therein. We only mention the following direct consequence of the results in~\cite{ceccarello2016mapreduce} and Theorem~\ref{thm:PTASmat}. \begin{corollary} Consider $\MSD_k$ on distances of negative type and doubling dimension $q$, such as Euclidean or Manhattan distances in $\mathbb{R}^q$. Then, for any $\epsilon >0$, there is a single-pass streaming algorithm that achieves an approximation guarantee of $1-\frac{5}{k}-\epsilon$, in space $O(\epsilon^{-q}k^2)$. \end{corollary} A related geometric measure of dispersion in $\mathbb{R}^q$ is the \emph{volume} of the selected data set. An optimal constant factor approximation algorithm for this measure was recently given by Nikolov~\cite{nikolov2015randomized}. \subsection*{Organization of the paper} In Section~\ref{sec:matConstraints}, we present our results for \MSD with respect to negative type distances and subject to a matroid constraint. In particular, this section highlights the main strategy we employ to exploit the property of negative type distances. Section~\ref{sec:matIntConstraints} presents a PTAS for matroid intersection constraints. Finally, Section~\ref{sec:submodObj} contains our results for generalized objective functions, being a sum of the dispersion and a nonnegative, monotone submodular function. \section{A local-search based PTAS for matroid constraints} \label{sec:matConstraints} Recall that the dispersion of a set $A\in X$ is $d(A):=\sum_{\{a,a'\}\subseteq A} d(a,a')=\frac{1}{2} \sum_{a,a'\in A} d(a,a')$. And we define the following auxiliary function, which represents the total sum of distances between two sets: For sets $A,B\in X$, let $$d(A,B):= \sum_{a\in A, b\in B} d(a,b).$$ Notice in particular that $d(A,A)=2d(A)$ for any $A\in X$. Throughout this section, we consider a matroid $M=(X,\mathcal{I})$ of rank $k\in \mathbb{Z}_{\geq 2}$. The algorithm we analyze in this section, highlighted below as Algorithm~\ref{alg:localSearchMat}, is a well-known canonical local search algorithm that starts with a basis $A$ and iteratively considers exchanges of a single element, always maintaining a basis. For brevity we use the shorthand $A-a+b$ for $(A\setminus \{a\})\cup \{b\}$, where $A$ is a set and $a,b$ are two elements. \smallskip { \begin{algorithm}[H] \For{$i=1 \ldots \ell$}{ \If{$\exists$ pair $(a,b)\in A\times (X\setminus A)$ such that $A-a+b\in \mathcal{I}$ and $d(A-a+b)>d(A)$}{ \smallskip Find such a pair $(a,b)$ maximizing $d(A-a+b)$.\\ Set $A=A-a+b$. } } \textbf{return} $A$. \smallskip \caption{Local search for matroids, starting with a basis $A$ and running for $\ell$ iterations.} \label{alg:localSearchMat} \end{algorithm} \medskip The following lemma provides a key inequality for negative type distances that we exploit. As an intuitive special case, the inequality says that for any two sets $A$ and $B$ of same cardinality, the dispersion within $A$ plus the dispersion within $B$ is no more than the sum of all distances between $A$ and $B$. \begin{lemma} \label{lem:negTypeIneq} Let $d:X\times X \rightarrow \mathbb{R}_{\geq 0}$ be a distance of negative type and $D \in \mathbb{R}_{≥0}^{X \times X}$ be the corresponding matrix, i.e., $D_{a,b}=d(a,b)$ for $a,b\in X$. For any two non-zero vectors $x,y \in \mathbb{R}^X_{≥0}$ one has \begin{equation} \label{eq:negTypeIneqVec} \frac{\|y\|_1}{\|x\|_1} x^T Dx + \frac{\|x\|_1}{\|y\|_1}y^T Dy \leq 2 x^T D y\enspace, \end{equation} and consequently for two non-empty sets $A,B \subseteq X$ \begin{equation} \label{eq:negTypeIneqSet} \frac{|B|}{|A|} d(A) + \frac{|A|}{|B|} d(B) \leq d(A,B)\enspace . \end{equation} \end{lemma} \begin{proof} Let $z=\|y\|_1 x - \|x\|_1 y$. Notice that $\sum_{a\in X}z(a)=0$. Hence, by the fact that $D$ is a distance of negative type we have \begin{align*} 0 \geq z^T D z = \|y\|_1^2 x^T D x - 2 \|x\|_1 \|y\|_1 x^T D y + \|x\|_1^2 y^T D y. \end{align*} Inequality~\eqref{eq:negTypeIneqVec} now follows by dividing both sides of the above inequality by $\|x\|_1\|y\|_1$ and rearranging terms. Inequality~\eqref{eq:negTypeIneqSet} follows from~\eqref{eq:negTypeIneqVec} by setting $x=\chi^A$ and $y=\chi^B$ to the characteristic vectors of $A$ and $B$, respectively, and dividing both the left-hand side and right-hand side by $2$. \end{proof} To analyze Algorithm~\ref{alg:localSearchMat}, we will consider a pairing of the elements of $A$ with the elements of an optimal solution $\OPT$ to the problem. It is well known that for any two bases $A,B$ of a matroid, there exists a pairing that can be used for exchanges in $A$. More precisely, removing any element of $A$ and adding its paired counterpart in $B$ will again lead to a basis. We denote such a pairing, which can be formalized as a bijection $\pi: A \rightarrow B$ and whose properties are stated in the lemma below, a \emph{Brualdi bijection}. \begin{lemma}[Brualdi~\cite{brualdi1969comments}]\label{lem:brualdi} For any two independent sets $A,B\in \mathcal{I}$ of equal cardinality, there is a bijection $\pi:A\rightarrow B$ such that for any $a\in A$, we have $A-a+\pi(b)\in \mathcal{I}$. In particular, such a bijection satisfies that it is the identity mapping on $A\cap B$. \end{lemma} To show that Algorithm~\ref{alg:localSearchMat} makes sufficient progress as long as $d(A)$ is much smaller than $d(\OPT)$, we consider a Brualdi bijection between $A$ and $\OPT$. As our analysis later shows, the distances between the pairs of a Brualdi bijection will be an error term that we have to bound. This is done by the following lemma. \begin{lemma}\label{lem:cheapMatching} For any two sets $A,B\subseteq X$ of equal cardinality $k$, and any bijection $\pi:A \rightarrow B$, \begin{equation*} \sum_{a\in A} d(a,\pi(a))\leq \frac{2}{k}d(A,B). \end{equation*} \end{lemma} \begin{proof} For any $a\in A$ with $a\neq \pi(a)$, Lemma~\ref{lem:negTypeIneq} implies \begin{equation*} d(A,a)+d(A,\pi(a))=d(A,\{a,\pi(a)\})\geq \frac{2}{k}d(A) +\frac{k}{2}d(a,\pi(a)). \end{equation*} Notice that the above inequality is also true if $a=\pi(a)$, in which case the inequality reduces to $d(A,a) \geq \frac{1}{k}d(A)$, which is again a direct consequence of Lemma~\ref{lem:negTypeIneq}. Summing these inequalities over $A$ gives \begin{equation*} d(A,A)+d(A,B)\geq 2d(A)+\frac{k}{2}\sum_{a\in A} d(a,\pi(a))\enspace . \end{equation*} The terms $d(A,A)$ and $2d(A)$ cancel out, and the claim follows. \end{proof} The following lemma shows that a locally optimal solution with respect to the considered exchange steps is a $(1-\frac{4}{k})$-approximation, without going into the details of how fast we will approach a local optimum. \begin{lemma}\label{lem:matAverageImp} Let $A$ and $B$ be bases of $M$, and let $\pi:A\rightarrow B$ be a bijection satisfying $\pi(a) = a$ for $a\in A\cap B$. Then \begin{align} \sum_{a\in A}\left( d(A-a+\pi(a)) - d(A)\right) &\geq \left(1-\frac{2}{k}\right) d(B) - \left(1+\frac{2}{k}\right)d(A)\enspace,\label{eq:matAverageImpDetailed}\\ \intertext{which, if $d(B) \geq d(A)$, implies} \sum_{a\in A}\left( d(A-a+\pi(a)) - d(A)\right) &\geq \left(1-\frac{4}{k}\right) d(B) - d(A)\enspace. \label{eq:matAverageImpOpt} \end{align} \end{lemma} \begin{proof} We first observe that \begin{equation}\label{eq:expandUpdate} d(A-a+b) = d(A) + d(A,b) - d(a,b) - d(a,A) \qquad \forall a\in A, b\in X\setminus (A-a)\enspace. \end{equation} The above equation clearly holds if $a=b$, and for $a\neq b$ it can easily be checked by observing that the distance of any pair is counted the same number of times in the right-hand side and left-hand side of the equation (see Figure~\ref{fig:dAmapb}). \begin{figure}[h] \begin{center} \input{dAmapb.tikz} \end{center} \caption{Graphical highlighting of the edges counted in the different terms of~\eqref{eq:expandUpdate}, for $a\neq b$. One can easily observe that each edge is counted the same number of times in the left-hand side and right-hand side of~\eqref{eq:expandUpdate}.}\label{fig:dAmapb} \end{figure} We finally obtain \begin{align*} \sum_{a\in A} \left( d(A-a+\pi(a)) - d(A)\right) &= \sum_{a\in A} \left( d(A,\pi(a)) - d(a,\pi(a)) - d(a,A) \right) && \text{(by~\eqref{eq:expandUpdate})}\\ &= d(A,B) - d(A,A) - \sum_{a\in A}d(a,\pi(a))\\ &\geq \left(1-\frac{2}{k}\right) d(A,B) - d(A,A) && \text{(by Lemma~\ref{lem:cheapMatching})}\\ &\geq \left(1-\frac{2}{k}\right) (d(A) + d(B)) - 2d(A) && \text{(by~\eqref{eq:negTypeIneqSet})}\\ &= \left(1-\frac{2}{k}\right) d(B) - \left(1+\frac{2}{k}\right) d(A). \end{align*} Inequality~\eqref{eq:matAverageImpOpt}, valid for $d(B) \geq d(A)$, now easily follows by replacing in the right-hand side the term $-\frac{2}{k} d(A)$ by $-\frac{2}{k} d(B)$. \end{proof} The next theorem is a mostly standard argument showing exponentially fast convergence of the local search algorithm. \begin{theorem}\label{thm:convLSMat} Let $A$ be any basis of $M$. Running Algorithm~\ref{alg:localSearchMat} for $\ell\in \mathbb{Z}_{\geq 0}$ iterations, a basis $A_\ell$ is returned such that \begin{equation*} d(A_\ell) \geq \left( 1 - \left(1-\frac{1}{k}\right)^\ell \right) \left(1-\frac{4}{k}\right)\cdot d(\OPT) \enspace . \end{equation*} \end{theorem} \begin{proof} Let $A_0 = A$ be the starting basis and we denote by $A_i$ for $i\in \{0,\ldots, \ell\}$ the basis obtained after $i$ iterations of the local search algorithm. Let $i\in \{0,\ldots, \ell-1\}$, and we consider the improvement from $A_i$ to $A_{i+1}$. Let $\pi: A_i \rightarrow \OPT$ be a Brualdi bijection. By inequality~\eqref{eq:matAverageImpOpt} in Lemma~\ref{lem:matAverageImp}, the average improvement in the dispersion of $A_i$ over the exchanges corresponding to $\pi$ is at least \begin{equation*} \frac{1}{k} \sum_{a\in A_i}\left(d(A_i-a+\pi(a)) - d(A_i) \right) \geq \frac{1}{k}\left(\left(1-\frac{4}{k}\right) d(\OPT) - d(A_i)\right) \enspace. \end{equation*} Since our local search algorithm does an exchange that maximizes $d(A_{i+1}) - d(A_i)$, we have \begin{equation*} d(A_{i+1}) - d(A_i) \geq \frac{1}{k}\left(\left(1-\frac{4}{k}\right) d(\OPT) - d(A_i)\right) \enspace , \end{equation*} which, by regrouping terms, leads to \begin{equation*} \left(1 - \frac{4}{k}\right)d(\OPT) - d(A_{i+1}) \leq \left(1-\frac{1}{k}\right) \left( \left(1-\frac{4}{k}\right) d(\OPT) - d(A_i) \right) \quad \forall i\in \{0,\ldots, \ell-1\} \enspace . \end{equation*} The above family of inequalities implies \begin{align*} \left(1-\frac{4}{k}\right) d(\OPT) - d(A_{\ell}) &\leq \left(1 - \frac{1}{k}\right)^\ell \left( \left(1-\frac{4}{k}\right) d(\OPT) - d(A_0) \right)\\ &\leq \left(1-\frac{1}{k}\right)^\ell \left(1-\frac{4}{k}\right) d(\OPT), \end{align*} which shows the theorem. \end{proof} Putting all ingredients together, we get our main result for \MSD with negative type distances and subject to a matroid constraint, which shows Theorem~\ref{thm:PTASmat}. \begin{theorem} It suffices to run Algorithm~\ref{alg:localSearchMat} for $O(k \log k)$ iterations starting with an arbitrary basis to obtain a $(1-\frac{5}{k})$-approximation for \MSD with respect to a negative type distance and subject to a matroid constraint of rank $k$. Moreover, this algorithm can be implemented to run in $O(n k^2 \log k)$ time, when counting distance evaluations and calls to the independence oracle as unit time. \end{theorem} \begin{proof} By Theorem~\ref{thm:convLSMat}, to obtain a $(1-\frac{5}{k})$-approximation, it suffices to choose the number of iterations $\ell$ of Algorithm~\ref{alg:localSearchMat} such that $(1-\frac{1}{k})^\ell \leq \frac{1}{k}$, which can be achieved by setting $\ell= O(k \log k)$. To complete the proof, it remains to show that each iteration can be performed in $O(nk)$ time. One way to implement our local search algorithm to get the $O(nk)$ running time per iteration is as follows. At the beginning of each iteration, with current set $A$, we compute $d(A)$, and also $d(A,a)$ for each $a\in A$. For this we need $O(k^2)$ distance evaluations; we recall that $O(k^2)=O(n k)$ because $k\leq n$. We then go through the elements $b\in X\setminus A$, and for each $b\in X\setminus A$, we consider all sets $A-a+b$ for $a\in A, a \neq b$. Since $|X\setminus A| = O(n)$, it suffices to show that for a fixed $b\in X\setminus A$, we can compute the best exchange step involving $b$ in $O(k)$ time. For a fixed $b$, we first compute $d(A,b)$ in $O(k)$ time. Then, for each $a\in A,a\neq b$ we first call the independence oracle to determine whether $A-a+b\in \mathcal{I}$, and if so we compute $d(A-a+b)$ using~\eqref{eq:expandUpdate}, i.e., \begin{equation*} d(A-a+b) = d(A) + d(A,b) - d(a,b) - d(a,A)\enspace . \end{equation*} The only quantity on the right-hand side that we did not compute so far is $d(a,b)$, which is obtained by a single distance evaluation. Hence, computing $d(A-a+b)$ for all $a\in A,a\neq b$ for which $A-a+b\in \mathcal{I}$, takes $O(k)$ time as desired, when counting distance evaluations and calls to the independence oracle as unit time. \end{proof} \section{A PTAS for matroid intersection} \label{sec:matIntConstraints} Throughout this section, $M_1=(X,\mathcal{I}_1)$ and $M_2=(X,\mathcal{I}_2)$ are two matroids on the same ground set $X$, and $k$ is the maximum cardinality of a common independent set. The algorithm we analyze is a natural local search algorithm considering exchanges up to a certain size. It is almost identical to a procedure suggested by Lee, Sviridenko and Vondr\'{a}k~\cite{lee_2010_submodular}, designed for maximizing a monotone submodular function subject to multiple matroid constraints. The only difference is that after each exchange step, we augment the current set $A$ to a (inclusion-wise) maximal set in $\mathcal{I}_1 \cap \mathcal{I}_2$, i.e., we replace $A$ by a maximal set $A'\in \mathcal{I}_1\cap \mathcal{I}_2$ that contains $A$. It is well-known that any maximal common independent set has cardinality at least $\frac{k}{2}$. This is a property we exploit in our analysis. For better readability, we did not try to optimize constants and often use rather loose bounds for simplicity. \medskip { \begin{algorithm}[H] \For{$i=1 \ldots \ell$}{ \If{$\exists$ pair $(S,T)\in 2^A\times 2^{X\setminus A}$ with \begin{enumerate}[label=(\roman*), nosep, leftmargin=3em] \item $|S|\leq p, |T|\leq p-1$, \item $(A\setminus S) \cup T \in \mathcal{I}_1\cap \mathcal{I}_2$, and \item $d((A\setminus S)\cup T)>d(A)$, \end{enumerate} } { \smallskip Find such a pair $(S,T)$ maximizing $d((A\setminus S)\cup T)$.\\ \smallskip Set $A=(A\setminus S) \cup T$.\\ \smallskip Augment $A$ to a maximal element in $\mathcal{I}_1\cap \mathcal{I}_2$. } } \textbf{return} $A$. \smallskip \caption{Local search for matroid intersection with exchange parameter $p\in \mathbb{Z}_{\geq 2}$, starting with $A\in \mathcal{I}_1 \cap \mathcal{I}_2$ and running for $\ell$ iterations.} \label{alg:localSearchMatInt} \end{algorithm} \medskip Our analysis heavily relies on recently developed exchange properties for matroid intersection. The following lemma was shown in~\cite{chekuri_2011_multibudgeted} building up on previous work~\cite{lee_2010_submodular,chekuri_2010_dependent}. We state a slightly simplified version of the lemma. The original lemma provided further properties on the sets $P_i$ and also guaranteed that such sets can be found efficiently. These are properties we do not need in our analysis. The set operator $\Delta$ denotes the symmetric difference, i.e., $A\Delta B = (A\setminus B) \cup (B \setminus A)$. \begin{lemma}[{\cite[Lemma 3.3]{chekuri_2011_multibudgeted}}] \label{lem:matIntExchange} Let $p\in \mathbb{Z}_{\geq 2}$, and let $A, B \in \mathcal{I}_1\cap \mathcal{I}_2$ with $|A|=|B|$. Then there exists a family of nonempty sets $P_1, \dots, P_m\subseteq X$ with $|P_i\cap A|\leq p$ and $|P_i\cap B|\leq p-1$ for $i\in [m]:=\{1,\ldots m\}$, and coefficients $\lambda_i > 0$ such that \begin{enumerate}[label=(\roman*),itemsep=0em] \item $A\Delta P_i \in \mathcal{I}_1\cap \mathcal{I}_2$ \;$\forall i \in [m]$, and \item $\sum_{i=1}^m \lambda_i \chi^{P_i} = \frac{p}{p-1} \chi^{A\setminus B} + \chi^{B\setminus A}$. \end{enumerate} \end{lemma} It is not hard to see that the requirement $|A|=|B|$ in Lemma~\ref{lem:matIntExchange} is not necessary. This condition was important in the original (stronger) lemma presented in~\cite{chekuri_2011_multibudgeted} which contained further properties that relied on it. For completeness, we state the lemma without the equal cardinality requirement below and provide a short proof for it. \begin{lemma}\label{lem:matIntExchangeGen} Let $p\in \mathbb{Z}_{\geq 2}$, and let $A, B \in \mathcal{I}_1\cap \mathcal{I}_2$. Then there exists a family of nonempty sets $P_1, \dots, P_m\subseteq X$ with $|P_i\cap A|\leq p$ and $|P_i\cap B|\leq p-1$ for $i\in [m]$, and coefficients $\lambda_i > 0$ such that \begin{enumerate}[label=(\roman*),itemsep=0em] \item $A\Delta P_i \in \mathcal{I}_1\cap \mathcal{I}_2$ \;$\forall i \in [m]$, and \item\label{item:exchangeLoad} $\sum_{i=1}^m \lambda_i \chi^{P_i} = \frac{p}{p-1} \chi^{A\setminus B} + \chi^{B\setminus A}$. \end{enumerate} \end{lemma} \begin{proof} To prove the lemma, we will first ``lift'' the sets $A,B\in \mathcal{I}_1\cap \mathcal{I}_2$, which may have different sizes, to larger sets $A',B'$ of the same size that are common independent sets of two auxiliary matroids $M_1'$ and $M_2'$. We can then apply Lemma~\ref{lem:matIntExchange} to $A',B'$ with respect to these auxiliary matroids, which will imply Lemma~\ref{lem:matIntExchangeGen}. Let $k$ be the maximum cardinality of a common independent set in $M_1$ and $M_2$, i.e., $k=\max\{|I| \mid I\in \mathcal{I}_1\cap \mathcal{I}_2\}$. Let $\bar{X}$ be a finite set of size $k$ that is disjoint from $X$. We define two auxiliary matroids $M_1'=(X',\mathcal{I}_1')$ and $M_2'=(X',\mathcal{I}_2')$ on ground set $X' = X\cup \bar{X}$. To this end, let $\bar{M}=(\bar{X},\bar{\mathcal{I}})$ be the free matroid over $\bar{X}$, i.e., $\bar{\mathcal{I}} = 2^{\bar{X}}$. For $j\in \{1,2\}$, the matroid $M'_j$ is defined to be the disjoint union of $M_j$ and $\bar{M}$. More formally, for $j\in \{1,2\}$ we have \begin{equation*} \mathcal{I}_j' = \{ I_j \cup \bar{I} \mid I_j \in \mathcal{I}_j, \bar{I}\in \bar{\mathcal{I}}\}. \end{equation*} The thus defined $M_1'$ and $M_2'$ are indeed matroids because the union of matroids again leads to a matroid (see, e.g.,~\cite[volume B]{schrijver2003combinatorial}). Given $A,B\in \mathcal{I}_1\cap \mathcal{I}_2$, let $A'=A\cup \bar{S}_A$ and $B'=B\cup \bar{S}_B$, where $\bar{S}_A$ and $\bar{S}_B$ are arbitrary subsets of $\bar{X}$ of size $k-|A|$ and $k-|B|$, respectively. Clearly, we have $A',B'\in \mathcal{I}_1'\cap \mathcal{I}_2'$, and $|A'|=|B'|=k$. We can thus apply Lemma~\ref{lem:matIntExchange} to $A'$ and $B'$ with respect to the matroids $M_1'$ and $M_2'$ to obtain a family $P_1',\dots P_m'\subseteq X'$ with coefficients $\lambda_i > 0$ for $i\in [m]$ satisfying the properties stated in Lemma~\ref{lem:matIntExchange}. It remains to observe that the family defined by $P_i = P'_i \cap X$ for $i\in [m]$ (after removing empty sets), satisfies the properties of Lemma~\ref{lem:matIntExchangeGen}. This immediately follows from the definitions of $M_1'$ and $M_2'$ which imply that for any $S'\in \mathcal{I}'_1\cap \mathcal{I}'_2$, we have $S'\cap X \in \mathcal{I}_1\cap \mathcal{I}_2$. \end{proof} As in the previous section, the dispersion within the exchange sets we consider will appear as an error term in our analysis. The following lemma bounds this quantity. \begin{lemma}\label{lem:boundWithinPi} Let $p\in \mathbb{Z}_{\geq 2}$, and let $A,B\in \mathcal{I}_1\cap \mathcal{I}_2$. Moreover, let $P_i\subseteq X$ for $i\in [m]$ and $\lambda_i > 0$ for $i\in [m]$ be a family of sets and coefficients satisfying the conditions of Lemma~\ref{lem:matIntExchangeGen}. Then \begin{equation*} \frac{|A|}{2p-1}\sum_{i=1}^m \lambda_i \cdot d(P_i) \leq \frac{p}{p-1} d(A,A) + d(A,B)\enspace. \end{equation*} \end{lemma} \begin{proof} For $i\in [m]$ we have \begin{align*} d(A,P_i \cap A) + d(A, P_i \cap B) &= d(A, P_i) \geq \frac{|P_i|}{|A|} d(A) + \frac{|A|}{|P_i|} d(P_i), \end{align*} where the inequality follows from~\eqref{eq:negTypeIneqSet}. Multiplying both the left-hand side and right-hand side by $\lambda_i$, and summing the resulting inequality over all $i\in [m]$, we get the following inequality, which follows from property~\ref{item:exchangeLoad} of Lemma~\ref{lem:matIntExchangeGen}: \begin{align*} \frac{p}{p-1} d(A,A\setminus B) + d(A, B\setminus A) &\geq \frac{\frac{p}{p-1} |A\setminus B| + |B\setminus A|}{|A|} d(A) + \frac{|A|}{2p-1} \sum_{i=1}^m \lambda_i \cdot d(P_i) \\ &\geq \frac{|A|}{2p-1} \sum_{i=1}^m \lambda_i \cdot d(P_i). \end{align*} The desired statement now follows because $d(A,A) \geq d(A,A\setminus B)$ and $d(A, B) \geq d(A,B\setminus A)$. \end{proof} The following lemma shows that the local search algorithm will go towards a set $A$ such that $\sqrt{d(A)}$ approaches $(1-\frac{2}{p-1}-\frac{24p}{k})\sqrt{d(\OPT)}$, and hence $d(A)$ approaches $(1-\frac{2}{p-1}-\frac{24p}{k})^2 d(\OPT)$. Notice that for large enough $k$, one can choose a $p$ such that this approximation factor gets arbitrarily small. \begin{lemma}\label{lem:matIntAverageImp} Let $p\in \mathbb{Z}_{\geq 2}$ with $8p \leq k$, where $k$ is the cardinality of a maximum cardinality set in $\mathcal{I}_1\cap \mathcal{I}_2$. Let $A\in \mathcal{I}_1\cap \mathcal{I}_2$ with $|A|\geq \sfrac{k}{2}$, and let $P_i\subseteq X$ for $i\in [m]$ and $\lambda_i > 0$ for $i\in [m]$ be a family of sets and coefficients satisfying the conditions of Lemma~\ref{lem:matIntExchangeGen} for the sets $A$ and $\OPT$. Then \begin{align*} \frac{1}{\sum_{i=1}^m \lambda_i}&\sum_{i=1}^m \lambda_i \cdot \left(d(A \Delta P_i) - d(A)\right)\\ &\geq \begin{cases} \frac{1}{3k}\sqrt{d(A)} \left( \sqrt{d(\OPT)} \cdot (1-\frac{2}{p-1}-\frac{24p}{k}) - \sqrt{d(A)}\right) &\text{if } d(A) > \frac{1}{50}d(\OPT),\\ \frac{1}{24k} d(\OPT) &\text{if } d(A) \leq \frac{1}{50}d(\OPT)\enspace . \end{cases} \end{align*} \end{lemma} \begin{proof} For brevity, let $S_i=P_i\cap A$ and $T_i = P_i \cap \OPT$ for $i\in [m]$. We have for $i\in [m]$, \begin{align*} d(A\Delta P_i) &= d((A\setminus S_i) \cup T_i) = d(A\setminus S_i) + d(T_i) + d(A\setminus S_i, T_i)\\ &= d(A) + d(S_i) - d(A,S_i) + d(T_i) + d(A,T_i) - d(S_i,T_i)\\ &\geq d(A) - d(A,S_i) + d(A,T_i) - d(S_i, T_i)\enspace. \end{align*} Let $\alpha = \frac{2p-1}{|A|}$ and $\lambda= \sum_{i=1}^m \lambda_i$. Multiplying the above inequality by $\lambda_i$ and summing it over all $i\in [m]$, we obtain the inequality below, which follows from property~\ref{item:exchangeLoad} of Lemma~\ref{lem:matIntExchangeGen}: \begin{equation}\label{eq:preBoundSymDiff} \begin{aligned} \sum_{i=1}^m \lambda_i \cdot d(A\Delta P_i) &\geq \lambda\cdot d(A) - \frac{p}{p-1} d(A,A\setminus \OPT) + d(A, \OPT\setminus A) - \sum_{i=1}^m \lambda_i \cdot d(S_i, T_i)\\ &\geq \lambda\cdot d(A) - \frac{p}{p-1} d(A,A) + d(A,\OPT) - \sum_{i=1}^m \lambda_i \cdot d(S_i,T_i)\\ &\geq \lambda\cdot d(A) - \frac{p}{p-1} d(A,A) + d(A,\OPT) - \sum_{i=1}^m \lambda_i \cdot d(P_i)\\ &\geq \lambda\cdot d(A) - \frac{p}{p-1} (1+\alpha) d(A,A) + (1-\alpha) d(A,\OPT)\\ &\geq \lambda\cdot d(A) - \frac{2 p}{p-1} (1+\alpha) d(A) + (1-\alpha) \left(\frac{|\OPT|}{|A|} d(A) + \frac{|A|}{|\OPT|} d(\OPT) \right), \end{aligned} \end{equation} where the second-to-last inequality follows by Lemma~\ref{lem:boundWithinPi}, and the last one by~\eqref{eq:negTypeIneqSet}. We continue the expansion of inequality~\eqref{eq:preBoundSymDiff} in two different ways, depending on whether we are in the case $d(A) \leq \frac{1}{50}d(\OPT)$ or $d(A) > \frac{1}{50}d(\OPT)$. \medskip \noindent\textbf{Case $d(A) \leq \frac{1}{50} d(\OPT)$:} To lower bound $(\sfrac{|\OPT|}{|A|}) d(A) + (\sfrac{|A|}{|\OPT|}) d(\OPT)$, consider the coefficients in front of $d(A)$ and $d(\OPT)$. For brevity, let $q=\sfrac{|\OPT|}{|A|}$. Notice that $q + q^{-1} \geq 2$, no matter how large $|A|$ and $|\OPT|$ are, assuming they are both at least one. Moreover, since $\OPT$ and $A$ are maximal sets in $\mathcal{I}_1\cap \mathcal{I}_2$, we have $\frac{k}{2} \leq |A|,|\OPT| \leq k$, which implies $q,q^{-1} \geq \frac{1}{2}$. Now consider the expression $q_1 \cdot d(A) + q_2 \cdot d(\OPT)$ under the constraints $q_1+q_2 \geq 2$ and $q_2\geq \sfrac{1}{2}$. This expression is minimized for $q_1=\sfrac{3}{2}$ and $q_2=\sfrac{1}{2}$ because $d(\OPT) \geq d(A)$, and hence \begin{equation*} \frac{|\OPT|}{|A|} d(A) + \frac{|A|}{|\OPT|} d(\OPT) \geq \frac{3}{2} d(A) + \frac{1}{2} d(\OPT)\enspace. \end{equation*} Using the above inequality, we can now further expand~\eqref{eq:preBoundSymDiff} as shown below. Moreover, we use $\alpha = \frac{2p-1}{|A|} \leq \frac{1}{2}$, which follows from $|A|\geq \frac{k}{2}$ and $8p\leq k$. \begin{align*} \sum_{i=1}^{m} \lambda_i \left(d(A\Delta P_i) - d(A) \right) &\geq -\frac{2p}{p-1}(1+\alpha) d(A) + (1-\alpha) \left(\frac{3}{2}d(A) + \frac{1}{2} d(\OPT) \right)\\ &\geq -\frac{3p}{p-1} d(A) + \frac{3}{4} d(A) + \frac{1}{4} d(\OPT) && \text{($\alpha \geq \sfrac{1}{2}$)}\\ &\geq -6 d(A) + \frac{3}{4} d(A) + \frac{1}{4}d(\OPT) && \text{($p\geq 2$)}\\ &= -\frac{21}{4} d(A) + \frac{1}{4} d(\OPT)\\ &\geq \frac{1}{8} d(\OPT)\enspace. &&\hspace*{-2cm}\text{(using $d(A) \leq \sfrac{1}{50}\cdot d(\OPT)$)} \end{align*} The result for this case now follows by dividing both sides by $\lambda$ and observing that $\lambda \leq 3k$, which holds due to \begin{align*} \lambda &\leq \left\|\sum_{i=1}^m \lambda_i \chi^{P_i} \right\|_1 && \text{(using $P_i\neq\emptyset$ for $i\in [m]$)}\\ &= \left\|\frac{p}{p-1}\chi^{A\setminus B} + \chi^{B\setminus A} \right\|_1 && \text{(by point~\ref{item:exchangeLoad} of Lemma~\ref{lem:matIntExchangeGen})}\\ &\leq \frac{p}{p-1} k + k \leq 3k. \end{align*} \medskip \noindent\textbf{Case $d(A) > \frac{1}{50} d(\OPT)$:} The minimum of the function $f(q) = q\cdot d(A) + \sfrac{1}{q}\cdot d(\OPT)$ for $q >0$ is achieved at $q=\sqrt{\sfrac{d(B)}{d(A)}}$, and leads to a value of $2 \sqrt{d(A) d(\OPT)}$. Hence \begin{equation*} \frac{|\OPT|}{|A|} d(A) + \frac{|A|}{|\OPT|} d(\OPT) \leq 2 \sqrt{d(A) d(\OPT)}. \end{equation*} Using the above inequality to further expand~\eqref{eq:preBoundSymDiff} we obtain \begin{equation}\label{eq:preBoundSymDiff2} \begin{aligned} \sum_{i=1}^m \lambda_i (d(A\Delta P_i) - d(A)) &\geq - \frac{2p}{p-1} (1+\alpha) d(A) + 2 (1-\alpha) \sqrt{d(A) d(\OPT)}\\ &= \sqrt{d(A)} \left( \left(1-\frac{2p}{p-1}(1+\alpha)\right)\sqrt{d(A)} + 2(1-\alpha) \sqrt{d(\OPT)} - \sqrt{d(A)} \right)\\ &\geq \sqrt{d(A)} \left( \left(1-\frac{2p}{p-1}(1+\alpha) + 2(1-\alpha) \right)\sqrt{d(\OPT)} - \sqrt{d(A)} \right), \end{aligned} \end{equation} where we used $d(A) \leq d(\OPT)$ and $1-\frac{2p}{p-1}(1+\alpha) < 0$ for the last inequality. It remains to simplify the coefficient of $\sqrt{d(\OPT)}$ within the parentheses. \begin{align*} -\frac{2p}{p-1}(1+\alpha) + 2(1-\alpha) &= -\frac{2}{p-1}(1+\alpha) - 4\alpha\\ &= -\frac{2}{p-1} - \frac{2p-1}{|A|} \cdot \left(\frac{2}{p-1} + 4\right) && \text{(using $\alpha = \sfrac{(2p-1)}{|A|}$)} \\ &\geq -\frac{2}{p-1} -\frac{2p}{|A|} \cdot \frac{4p-2}{p-1}\\ &\geq -\frac{2}{p-1} - \frac{12p}{|A|} && \text{($\sfrac{(4p-2)}{(p-1)}\leq 6$ for $p\geq 2$)}\\ &\geq -\frac{2}{p-1} - \frac{24p}{k}\enspace. && \text{(using $|A|\geq \sfrac{k}{2}$)} \end{align*} The result for this case now follows by using the above inequality in~\eqref{eq:preBoundSymDiff2}, dividing both sides by $\lambda$, which satisfies $\lambda\leq 3k$ as shown in the first case. \end{proof} The next theorem shows that convergence happens fast. This readily follows by Lemma~\ref{lem:matIntAverageImp}, because as long as $d(A)$ is small, the second case of Lemma~\ref{lem:matIntAverageImp} guarantees an improvement of at least $(\sfrac{1}{24k})d(\OPT)$. Hence, this case can only happen during $O(k)$ iterations. Later, the first case of Lemma~\ref{lem:matIntAverageImp} applies, which guarantees a very fast convergence towards $(1-\frac{2}{p-1}-\frac{24p}{k})^2 d(\OPT)$. \begin{theorem}\label{thm:convLocalSearchMatInt} Let $p\in \mathbb{Z}_{\geq 2}$ such that $8p\leq k$, where $k$ is the cardinality of a maximum cardinality set in $\mathcal{I}_1 \cap \mathcal{I}_2$, and $1 - \frac{2}{p-1} - \frac{24p}{k} > 0$. Let $A\in \mathcal{I}_1\cap \mathcal{I}_2$ with $|A|\geq \sfrac{k}{2}$. Then, letting Algorithm~\ref{alg:localSearchMatInt} run for $\ell \geq k$ iterations with starting set $A$ and parameter $p$, leads to a set $A_\ell \in \mathcal{I}_1\cap \mathcal{I}_2$ satisfying \begin{equation*} d(A_{\ell}) \geq \left( \left(1-\frac{2}{p-1} - \frac{24p}{k}\right)^2 - 2 \left(1 - \frac{1}{60 k} \right)^{\ell-k} \right) d(\OPT)\enspace. \end{equation*} \end{theorem} \begin{proof} For brevity, let $\beta = 1-\frac{2}{p-1} - \frac{24p}{k}$. Let $A_0 = A$ be the set at the beginning of the algorithm, and for $j\in [\ell]$ we denote by $A_j\in \mathcal{I}_1\cap \mathcal{I}_2$ the common independent set after $j$ iterations of Algorithm~\ref{alg:localSearchMatInt}. Lemma~\ref{lem:matIntAverageImp} shows a lower bound on the average improvement induced by the exchanges $A\Delta P_i$. Since $A_{j+1}$ corresponds to the best exchange for parameter $p$, the difference $d(A_{j+1}) - d(A_j)$ is at least as high as this lower bound. Thus, as long as $d(A_j)\leq \frac{1}{50}d(\OPT)$, the second case of Lemma~\ref{lem:matIntAverageImp} implies that we have $d(A_{j+1})) \geq d(A_j) + \frac{1}{24k} d(\OPT)$. Hence after at most $k$ steps, we have a set of value strictly more than~$\frac{1}{50} d(\OPT)$, i.e., \begin{equation}\label{eq:lateAjsLarge} d(A_j) > \frac{1}{50} d(\OPT) \qquad \forall j\in \{k,\ldots \ell\}\enspace. \end{equation} hus, for the iterations $k+1, k+2 ,\ldots, \ell$, the first case of Lemma~\ref{lem:matIntAverageImp} applies, which implies for $j\in \{k,\ldots, \ell-1\}$: \begin{align*} d(A_{j+1}) - d(A_j) &\geq \frac{1}{3k} \sqrt{d(A_j)} \left( \beta \sqrt{d(\OPT)} - \sqrt{d(A_j)} \right)\\ &\geq \frac{1}{30 k} \sqrt{d(\OPT)} \left( \beta \sqrt{d(\OPT)} - \sqrt{d(A_j)} \right), \end{align*} where the second inequality follows from~\eqref{eq:lateAjsLarge}. Dividing both sides by $\sqrt{d(A_{j+1})} + \sqrt{d(A_j)}$ we get \begin{align*} \sqrt{d(A_{j+1})} - \sqrt{d(A_j)} &\geq \frac{1}{30k} \frac{\sqrt{d(\OPT)}}{\sqrt{d(A_{j+1})} + \sqrt{d(A_j)}} \left( \beta \sqrt{d(\OPT)} - \sqrt{d(A_j)} \right)\\ &\geq \frac{1}{60k} \left( \beta \sqrt{d(\OPT)} - \sqrt{d(A_j)} \right)\enspace, \end{align*} where the second inequality follows from $d(A_{j+1}), d(A_j)\leq d(\OPT)$. The above inequality can be rewritten as follows \begin{align*} \beta \sqrt{d(\OPT)} - \sqrt{d(A_{j+1})} &\leq \left( 1- \frac{1}{60k} \right) \left(\beta \sqrt{d(\OPT)} - \sqrt{d(A_j)} \right) \qquad \forall j\in \{k,\ldots, \ell-1\}\enspace. \end{align*} Hence, \begin{align*} \beta \sqrt{d(\OPT)} - \sqrt{d(A_{\ell})} &\leq \left( 1- \frac{1}{60k} \right)^{\ell-k} \left(\beta \sqrt{d(\OPT)} - \sqrt{d(A_k)} \right)\\ &\leq \left( 1- \frac{1}{60k} \right)^{\ell-k} \beta \sqrt{d(\OPT)}\enspace. \end{align*} Multiplying both sides with $\beta\sqrt{d(\OPT)} + \sqrt{d(A_\ell)}$ we get \begin{align*} \beta^2 d(\OPT) - d(A_{\ell}) &\leq \left( 1- \frac{1}{60k} \right)^{\ell-k} \beta \sqrt{d(\OPT)} \left(\beta \sqrt{d(\OPT)} + \sqrt{d(A_\ell)}\right)\\ &\leq \left( 1- \frac{1}{60k} \right)^{\ell-k} d(\OPT) \beta(\beta+1)\\ &\leq 2 \left( 1- \frac{1}{60k} \right)^{\ell-k} d(\OPT)\enspace , && \text{(using $\beta\leq 1$)} \end{align*} which implies the desired result. \end{proof} To obtain a PTAS, and therefore prove Theorem~\ref{thm:PTASmatInt}, it remains to choose the right value for $p$ in Theorem~\ref{thm:convLocalSearchMatInt} if $k$ is large enough. For small $k$, one can simply enumerate over all (polynomially many) feasible solutions. This leads to Theorem~\ref{thm:PTASmatInt}, which we repeat below for completeness. \begin{reptheorem}{thm:PTASmatInt} There is a PTAS for \MSD with negative type distances subject to a matroid intersection constraint. \end{reptheorem} \begin{proof} Let $M_j=(X,\mathcal{I}_j)$ for $j\in \{1,2\}$ be the two matroids imposing the matroid intersection constraint to the \MSD problem. As usual, let $k$ be the cardinality of a maximum cardinality set in $\mathcal{I}_1\cap \mathcal{I}_2$. Let $\epsilon > 0$ be our error tolerance, i.e., we want to obtain a $(1-\epsilon)$-approximation. If $k < \frac{144}{\epsilon} \left( \lceil \frac{12}{\epsilon} \rceil +1 \right)$, then we can enumerate over all sets in $\mathcal{I}_1\cap \mathcal{I}_2$, since there are only polynomially many such sets. In what follows, we therefore assume $k \geq \frac{144}{\epsilon} \left( \lceil \frac{12}{\epsilon} \rceil +1 \right)$. We set $p=\lceil\frac{12}{\epsilon}\rceil + 1$ and let $A$ be any set in $\mathcal{I}_1\cap \mathcal{I}_2$ of cardinality $|A|\geq \sfrac{k}{2}$. Now we let Algorithm~\ref{alg:localSearchMatInt} run with starting set $A$, parameter $p$, and for a number $\ell \geq k$ of iterations satisfying \begin{equation}\label{eq:downToE3} 2 \left( 1- \frac{1}{60 k} \right)^{\ell - k} \leq \frac{\epsilon}{3}\enspace. \end{equation} Notice that the above inequality is satisfied for a value $\ell=O(k \log \sfrac{1}{\epsilon})$, which is polynomially bounded. Since moreover $p = O(1)$, Algorithm~\ref{alg:localSearchMatInt} runs in polynomial time returning some set $A_\ell \in \mathcal{I}_1\cap \mathcal{I}_2$. By Theorem~\ref{thm:convLocalSearchMatInt}, the dispersion of $A_\ell$ satisfies \begin{align*} d(A_{\ell}) &\geq \left( \left( 1- \frac{2}{p-1} - \frac{24p}{k} \right)^2 - 2 \left( 1- \frac{1}{60k} \right)^{\ell - k} \right) d(\OPT)\\ &\geq \left( \left( 1- \frac{2}{p-1} - \frac{24p}{k} \right)^2 -\frac{\epsilon}{3} \right) d(\OPT) && \text{(by~\eqref{eq:downToE3})}\\ &\geq \left( \left( 1- \frac{\epsilon}{6} - \frac{24(\lceil\frac{12}{\epsilon}\rceil+1)}{k} \right)^2 - \frac{\epsilon}{3} \right) d(\OPT) && \text{(using~$p=\lceil\sfrac{12}{\epsilon}\rceil + 1$)}\\ &\geq \left( \left(1-\frac{\epsilon}{3}\right)^2 - \frac{\epsilon}{3} \right) d(\OPT) && \text{(using $k\geq \sfrac{144}{\epsilon} (\lceil\sfrac{12}{\epsilon}\rceil + 1)$)}\\ &\geq \left( 1 - \epsilon \right) d(\OPT)\enspace, \end{align*} as desired. \end{proof} \section{Combinations with submodular objectives} \label{sec:submodObj} In this section, we are interested in generalized diversity measures, which extend the dispersion function considered previously, by adding a monotone submodular function $f: 2^X \rightarrow \mathbb{Q}_{\geq 0}$ to it. Our goal is to maximize the objective $g(A) = d(A) + f(A)$ subject to a matroid constraint $M=(X,\mathcal{I})$. For brevity, we denote this problem by \MSDf. Throughout this section, we assume that $f$ is a nonnegative monotone submodular function on $X$ that is normalized, i.e., $f(\emptyset) = 0$. Notice that $f$ being normalized is an assumption without loss of generality, because any (non-normalized) function $f$ can be replaced by the normalized submodular function $h(S) = f(S) - f(\emptyset)$. Submodular functions capture many natural diversity functions. One classic example is to count how many different ``types'' are covered by a set of elements. Here, one can define an arbitrary family $T_1,\dots,T_p \subseteq X$ of subsets of the ground set, where each $T_i$ can be thought of items sharing a particular property, and elements in $T_i$ are said to be of type $T_i$. Notice that the same element can be part of many different types. The function that assigns to each set $A\subseteq X$, the number of different types that are contained in $A$ is a well-known example of a submodular function, which is called a coverage function. The problem of maximizing the sum of the dispersion and a monotone submodular function has previously been considered by Borodin et al.~\cite{borodin2012max}, who considered metric distance spaces. We recall that for metric distance spaces, a locally optimal solution is (only) a $\sfrac{1}{2}$-approximation. As we briefly explain below, our stronger analysis for negative type distances is compatible with their analysis and leads to stronger results for the case of negative type distances. Moreover, we show that these results can be combined with recent results on local search algorithms for maximizing submodular functions, leading to approximation guarantees that are asymptotically optimal for a wide range of problems. For simplicity, we will focus on the approximation guarantee of solutions that are locally optimal with respect to our local search algorithm, without going into details on how to efficiently compute a solution whose objective value is no more than a factor $1+\epsilon$ larger than the objective value of a locally optimal solution, for a fixed error $\epsilon >0$. The steps to show fast convergence of the local search algorithm are standard, and can also be done analogously to our analysis in Section~\ref{sec:matConstraints}. We start by giving a very brief overview of some recent results on which we build up. More precisely, we first give a quick overview of local search results by Borodin et al.~\cite{borodin2012max}, which we strengthen in the following. We then recap a non-oblivious local search algorithm by Filmus and Ward~\cite{filmus2014monotone} to obtain an optimal approximation guarantee for submodular maximization under a matroid constraint, and an extension of it by Sviridenko et al.~\cite{sviridenko2015optimal} to submodular functions with bounded curvature. Our strengthened results then readily follow by combining these previous approaches together with our stronger analysis for distances of negative type. Throughout this section, $A,B\subseteq X$ are bases of $M$, and $\pi: A \rightarrow B$ is a Brualdi bijection between $A$ and $B$, if not stated otherwise. \subsection*{Local search results by Borodin et al.~\cite{borodin2012max}} Borodin et al.~\cite{borodin2012max} study the \MSDf problem for metric distance spaces. They show that the local search algorithm achieves an approximation guarantee of $\frac{1}{2}$ for each objective function individually, and they prove that the same result carries over to the combined objective function. More specifically, in \cite[Lemmas 5 and 7]{borodin2012max} it is proven that,\footnote{Some results cited in this section are originally stated in less generality, but their original proofs carry on directly to the more general versions.} if $d$ is metric, and $f$ is submodular, monotone and normalized, then \begin{align} d(A)&\geq \frac{1}{2}d(B)+\frac{1}{2}\sum_{a\in A}\left(d(A)-d(A-a+\pi(a))\right), \ \text{ and} \label{ineq:metric} \\ f(A)&\geq \frac{1}{2}f(B)+\frac{1}{2}\sum_{a\in A}\left(f(A)-f(A-a+\pi(a))\right). \label{ineq:submod} \end{align} Inequality~\eqref{ineq:metric} only holds if the rank $k$ of the underlying matroid is at least $3$. For simplicity, we assume $k\geq 3$ in what follows. Summing up~\eqref{ineq:metric} and~\eqref{ineq:submod}, one immediately obtains $$g(A)\geq \frac{1}{2}g(B)+\frac{1}{2}\sum_{a\in A}\left(g(A)-g(A-a+\pi(a))\right).$$ From each of these lines, one can easily derive that any local optimum has an approximation guarantee of $\frac{1}{2}$ for the corresponding objective function. This approximation is tight for function $d$, as we mentioned in the introduction, assuming that the planted clique problem is hard; and for function $f$ this approximation is known to match the locality gap of this local search algorithm. \subsection*{Non-oblivious local search by Filmus and Ward~\cite{filmus2014monotone}} When trying to maximize a function $f$, sometimes it is convenient to define an auxiliary potential function $F:2^X \rightarrow \mathbb{R}_{\geq 0}$, and run a local search algorithm over $F$ instead of $f$. More precisely, an exchange step is done if it leads to a strict improvement of the function value of $F$ instead of $f$. Such an algorithm is called \emph{non-oblivious}. Filmus and Ward \cite[Theorem 5.1]{filmus2014monotone} prove that there is a potential function $F: 2^X \rightarrow \mathbb{R}_{\geq 0}$ for $f$ such that \begin{equation}\label{ineq:filmus} f(A)\geq \left(1-\frac{1}{e}\right)f(B)+\left(1-\frac{1}{e}\right)\sum_{a\in A}\left(F(A) - F(A-a+\pi(a))\right)\enspace. \end{equation} From this, they conclude that the non-oblivious algorithm associated to $F$ offers an approximation guarantee of $1-\frac{1}{e}-\epsilon$ for the matroid-constrained maximization of a monotone, normalized submodular function. This is best possible, as it is proven by Feige \cite{feige1998threshold} that improving the bound $1-\frac{1}{e}$ is NP-hard even if $f$ is an explicitly given coverage function. And Nemhauser and Wolsey \cite{nemhauser1978best} show that improving upon this bound requires an exponential number of queries in the value oracle model. We remark that an exact evaluation of the potential function $F$ defined in~\cite{filmus2014monotone} requires a superpolynomial number of evaluations of $f$. However, the authors prove that all the necessary evaluations of $F$ during the execution of the algorithm can be approximated efficiently, in such a way that with high probability, the ensuing loss in the approximation ratio is arbitrarily small. For clarity of exposition, we assume in this paper that we have access to a value oracle for $F$. It is also proven in~\cite{filmus2014monotone} that $F$ has further properties which are sufficient for the non-oblivious algorithm to converge fast. \subsection*{Submodular maximization with bounded curvature by Sviridenko et al.~\cite{sviridenko2015optimal}} Conforti and Cornu\'ejols \cite{conforti1984submodular} define the \emph{curvature} of a monotone submodular function $f$ as $$c=1-\min_{x\in X}\frac{f(X)-f(X-x)}{f(x)-f(\emptyset)}.$$ The curvature is a coefficient between 0 and 1 that measures how close the function is to being linear, where $c=0$ corresponds to a linear function and $c=1$ to an arbitrary submodular function. For a monotone submodular function $f$ of curvature $c$, Sviridenko et al.~\cite{sviridenko2015optimal} consider the decomposition $f=l+f'$, where $l(A)=f(\emptyset)+\sum_{a\in A} (f(X)-f(X-a))$, and $f'(A)=f(A)-l(A)$, for each $A\subseteq X$. They prove that $l$ is linear, $f'$ is submodular, monotone and normalized, and $f'(A)\leq c \cdot f(A)$ for each $A\subseteq X$. It is easy to see that for any linear function $l$, \begin{equation}\label{eq:linear} l(A)= l(B)+\sum_{a\in A}\left(l(A)-l(A-a+\pi(a))\right). \end{equation} Hence, if we define a potential function $F'$ for $f'$ as in inequality (\ref{ineq:filmus}) (see \cite{filmus2014monotone}), and use it to define the potential function $F=l+\left(1-\frac{1}{e}\right)F'$ for $f$, the sum of inequality (\ref{ineq:filmus}) and equation (\ref{eq:linear}) gives for any $A,B\in \mathcal{I}$ \begin{align}\label{ineq:sviridenko} f(A) &\geq f(B) -\frac{1}{e}f'(B)+\sum_{a\in A}\left(F(A) - F(A-a+\pi(a))\right)\nonumber\\ & \geq \left(1-\frac{c}{e}\right)f(B)+\sum_{a\in A}\left(F(A)-F(A-a+\pi(a))\right). \end{align} Thus, in \cite{sviridenko2015optimal} they conclude that, for a monotone submodular function $f$ of curvature $c$, the local search algorithm associated to the potential function $F$ offers an approximation guarantee of $1-\frac{c}{e} - \epsilon$. Moreover, they extend the negative result of \cite{nemhauser1978best} to prove that this bound is best possible; namely they prove that, for each $c\in [0,1]$, improving upon the bound of $1-\frac{c}{e}$ requires an exponential number of queries in the value oracle model. \subsection*{Putting things together} By combining our stronger analysis for local search subject to negative distance spaces with the results highlighted above, we obtain our main result which leads to Theorem~\ref{thm:msd+f}. \begin{theorem}\label{thm:d+f_NT} Consider \MSDf over a rank $k$ matroid constraint, where $d$ is of negative type and $f$ has curvature $c$. Let $\lambda_d=\frac{d(\OPT)}{g(\OPT)}$ and $\lambda_f=\frac{f(\OPT)}{g(\OPT)}$. Then, there is a non-oblivious local search algorithm such that any locally optimal solution has an approximation guarantee of $$1-\lambda_d \frac{4}{k}-\lambda_f \frac{c}{e}\geq 1-\max\left\{\frac{4}{k}, \frac{c}{e}\right\}.$$ \end{theorem} \begin{proof} For the function $f$, consider the potential function $F$ as defined in inequality (\ref{ineq:sviridenko}) (see \cite{sviridenko2015optimal}); and for $g = d + f$, define the potential function $G=\left(1-\frac{2}{k}\right)d + F$. Notice that inequality~\eqref{eq:matAverageImpDetailed} implies \begin{equation*} d(A) \geq \left(1-\frac{4}{k}\right) d(\OPT) + \left(1-\frac{2}{k}\right)\sum_{a\in A}\left( d(A) - d(A-a+\pi(a))\right)\enspace, \end{equation*} which follows by multiplying~\eqref{eq:matAverageImpDetailed} by $1-\frac{2}{k}$, rearranging terms, and using $(1-\sfrac{2}{k})^2 \geq 1-\sfrac{4}{k}$, and $(1+\sfrac{2}{k})\cdot (1-\sfrac{2}{k}) \leq 1$. Combining the above inequality with \eqref{ineq:sviridenko}, we obtain for any basis $A$ of $M$ \begin{equation*} g(A)\geq g(\OPT) - \frac{4}{k} d(\OPT)-\frac{c}{e} f(\OPT) +\sum_{a\in A} \left(G(A)-G(A-a+\pi(a))\right)\enspace, \end{equation*} where $\pi:A\rightarrow \OPT$ is a Brualdi bijection between $A$ and $\OPT$. We run the non-oblivious local search algorithm with respect to the potential $G$. Let $A$ be a local optimum with respect to $G$. The local optimality of $A$ implies $G(A)-G(A-a+\pi(a))\geq 0$, which, by the above inequality, implies \begin{equation*} g(A)\geq \left(1-\lambda_d \frac{4}{k}-\lambda_f \frac{c}{e}\right)g(\OPT)\enspace. \end{equation*} To complete the proof, notice that this approximation ratio is a convex combination of $1-\frac{4}{k}$ and $1-\frac{c}{e}$, and hence it is larger than the smaller of the two values. \end{proof} For completeness, we highlight that even for metric distances $d$, the recent non-oblivious local search procedures presented in \cite{filmus2014monotone,sviridenko2015optimal} lead to a strengthening of the result of Borodin et al.~\cite{borodin2012max}. \begin{theorem}\label{thm:d+f_metric} Consider \MSDf over a matroid constraint, where $d$ is metric, and $f$ has curvature $c$. Let $\lambda_d\geq 0$ such that $\frac{d(O)}{g(O)}\leq \lambda_d$. Then, there is a non-oblivious local search algorithm such that any locally optimal solution has an approximation guarantee of \begin{equation*} 1-\lambda_d \frac{1}{2}-(1-\lambda_d)\frac{c}{e}\enspace. \end{equation*} \end{theorem} \begin{proof} The proof is analogous to the previous one, except that we add up inequalities (\ref{ineq:metric}) and (\ref{ineq:sviridenko}) instead of the inequality provided by Lemma~\ref{lem:matAverageImp} and~\eqref{ineq:sviridenko}; and consequently for $g=d+f$ we define the potential function $G=\frac{1}{2}d + F.$ \end{proof} \bibliographystyle{plain}
{'timestamp': '2016-07-18T02:07:59', 'yymm': '1607', 'arxiv_id': '1607.04557', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04557'}
arxiv
\section{Introduction} \label{sec-1} ``The devil is in the tails" is the title of the paper by Donnelly and Embrechts (2010) who refute the harsh criticism of mathematics (Salmon, 2012) in general, and of the Gaussian copula-based credit risk model of Li (2000) in particular. As a member of the unholy trinity (Kousky and Cooke, 2009), the notion of tail dependence is in the very center of this controversy. Speaking plainly, tail dependence is about the clustering of extreme events, and it is a rather daunting phenomenon in the context of risk management. For example, it implies that devastating losses within portfolios of risks as well as defaults of financial enterprises in credit risk portfolios occur together (R\"{u}schendorf, 2013; Wang et al., 2013; Puccetti and R\"{u}schendorf, 2014). Mathematically, there exist a variety of ways to quantify the extent of tail dependence in bivariate random vectors with dependence structures given by copula functions $C:[0,\ 1]^2\rightarrow [0,\ 1]$ (see, e.g., Nelsen, 2006; Durante and Sempi, 2015, for reviews of the theory of copulas). Arguably the most popular measure of lower tail dependence is nowadays attributed to Joe (1993) (also Sibuya, 1959) and given by \begin{eqnarray} \label{lambda} \lambda_L:=\lambda_L(C)= \lim_{u \downarrow 0} {C(u,u)\over u}. \end{eqnarray} Non-zero (more precisely $(0,\ 1]$) values of index (\ref{lambda}) suggest lower tail dependence in $C$. Just like other synthetic measures, $\lambda_L$ is not always reliable because it sometimes underestimates the extent of lower tail dependence in copulas as the next example demonstrates. \begin{example} \rm \label{ExC1} Consider the following copula (Nelsen, 2006, Example 3.3) \[ C_{\theta}(u,\ v)=\left\{ \begin{array}{ll} u, & 0\leq u\leq \theta v\leq \theta, \\ \theta v, & 0\leq \theta v< u < 1- (1-\theta)v, \\ u+v - 1, & \theta \leq 1- (1-\theta) v\leq u\leq 1, \end{array} \right. \] parametrized by $\theta \in [0,1]$. This copula has two singularities, and it is fully {co-monotonic} (fully {counter-monotonic}) for $\theta=1$ ($\theta=0$, respectively). It is easy to see that \[ \lambda_L(C_\theta)=\lim_{u\downarrow 0}\frac{\theta u}{u}=\theta. \] Let $\lambda_L^\ast(C_{\theta})$ be the measure as in (\ref{lambda}) but now along the path $\left(u\sqrt{\theta},\ u/\sqrt{\theta}\right)_{0\leq u\leq 1}$ rather than along the diagonal $(u,u)$. Clearly in this case \[ \lambda_L^\ast(C_\theta)=\lim_{u \downarrow 0}\frac{C(u\sqrt{\theta},u/\sqrt{\theta})}{u}= \sqrt{\theta}>\theta=\lambda_L(C_\theta), \] for every $\theta\in(0,\ 1)$. \end{example} On a different note, when limit (\ref{lambda}) is zero, it is often useful to rely on the somewhat more delicate index of weak tail dependence $\chi_L\in[-1,\ 1]$ (Coles et al., 1999; Fischer and Klein, 2007) that is given by \begin{equation}\label{ind-cl} \chi_{L}:=\chi_L(C)=\lim_{u\downarrow 0}\frac{2\log u }{\log C(u,u)}-1 , \end{equation} and/or to the index of tail dependence $\kappa_L:=\kappa_L(C)\in[1,\ 2]$ (Ledford and Tawn, 1996) that solves the equation \begin{equation}\label{ind-kl} C(u,u)= \ell(u) u^{\kappa_L} \quad \textrm{when} \quad u\downarrow 0, \end{equation} assuming that we can find a slowly varying at $0$ function $\ell(u)$. The following example demonstrates that $\kappa_L$ can also be misleading in a similar way to that of Example \ref{ExC1}. \begin{example} \label{ExMO1} \rm Recall that the Marshall-Olkin copula is given by \begin{equation}\label{copula-mo} C_{a,b}(u,v)=\min(u^{1-a}v,uv^{1-b}) \quad \textrm{for} \quad 0\le u,v\le 1, \end{equation} where $a,b\in [0,1]$ are parameters (Cherubini et al., 2013). Denote by $\kappa_L^\ast(C_{a,b})$ a measure {mimicking} (\ref{ind-kl}) that verifies the tail dependence of $C_{a,b}$ along the path $\left(u^{2a/(a+b)},u^{2b/(a+b}\right)_{0\leq u\leq 1}$. We readily check that \[ \kappa_L^\ast(C_{a,b})=2-\frac{2ba}{a+b}\leq 2-\min(a,b)=\kappa_L(C_{a,b}), \] where the equality holds only if $a=b$. \end{example} Speaking generally, indices (\ref{lambda}), (\ref{ind-cl}) and (\ref{ind-kl}) may underestimate the amount of tail dependence even in copulas that are symmetric and do not have singularities (Furman et al., 2015). The reason is that all the aforementioned indices of lower tail dependence rely entirely on the behavior of copulas along their main diagonal $(u,\ u)_{0\leq u\leq 1}$. However, the tail dependence of copulas can be substantially stronger along the paths other than the main diagonal. This can be a serious disadvantage, as reported by, e.g., Schmid and Schmidt (2007), Zhang (2008), Li et al. (2014), and Furman et al. (2015). When it comes to the bivariate Gaussian copula, henceforth denoted by $C_{\rho}$, which has become a synonym of the recent subprime mortgage crisis, it can be shown that indices (\ref{lambda}), (\ref{ind-cl}) and (\ref{ind-kl}) are equal to $0,\ \rho$ and $2/(1+\rho)$, respectively, where $\rho\in(0,\ 1)$ is the correlation coefficient. In the light of discussion hitherto, the following most natural problem arises: \begin{problem} \label{pr} Let $\psi,\varphi:[0,\ 1]\rightarrow [0,\ 1]$ be functions yielding an admissible path $(\psi(u),\ \varphi(u))_{0\leq u\leq 1}$ in $[0,\ 1]^2$, and let $\lambda_L^\ast$, $\chi_L^\ast$ and $\kappa_L^\ast$ be the counterparts of (\ref{lambda}), (\ref{ind-cl}) and (\ref{ind-kl}), respectively, calculated along the noted path. Is there an admissible path such that any of the following bounds holds \begin{equation} \label{pr-lim} \lambda_L^\ast(C_\rho)>\lambda_L(C_\rho),\textnormal{ } \chi_L^\ast(C_\rho)>\chi_L(C_\rho) \textnormal{ and/or } \kappa_L^\ast(C_\rho)<\kappa_L(C_\rho)? \end{equation} \end{problem} \noindent A positive answer to this question would reinstate to an extent the Gaussian copula in public favor, whereas a negative answer would mean that index (\ref{lambda}) is maximal in the Gaussian case, which of course does not imply the same conclusion for other copulas. In this paper we investigate the aforementioned problem. To this end, in Section \ref{sec-2} we set out to formally define the class of `admissible' path functions as well as the collection of `admissible' paths mentioned in Problem \ref{pr}. In Section \ref{sec-3}, we then provide a complete solution to Problem \ref{pr}. Our proofs rely on subtle geometric arguments involving intersections of convex curves with their rotations. Section \ref{sec-4} concludes the paper. \section{Paths and indices of maximal tail dependence} \label{sec-2} Our main goal in this section is to describe admissible paths $(\psi(u),\ \varphi(u))_{0\leq u\leq 1}$ formally. We borrow heavily from Furman et al. (2015). \begin{definition} \label{paths} A function $\varphi: [0,1] \to [0,1]$ is called {\it admissible} if it satisfies the following conditions: \begin{enumerate}[\rm (1)] \item [(C1)] $\varphi(u) \in [u^2,1] $ for every $u\in [0,1] $; \item [(C2)] $\varphi(u)$ and $u^2/\varphi(u) $ converge to $0$ when $u\downarrow 0$. \end{enumerate} Then the path $(\varphi(u),u^2/\varphi(u))_{0\le u \le 1}$ is admissible whenever the function $\varphi $ is admissible. Also, we denote by $\mathcal{A}$ the set of all admissible functions $\varphi$. \end{definition} A number of observations are instrumental to clarify the definition. First, condition (C1) makes sure that $\varphi(u)\in[0,\ 1]$ and $u^2/\varphi(u) \in [0,\ 1]$, whereas condition (C2) is motivated by the fact that we are interested in the behavior of the copula $C$ near the lower-left vertex of its domain of definition. Second, the function $\varphi_0(u)=u,\ u\in[0,\ 1]$, is admissible and yields the main diagonal $(u,\ u)_{0\leq u\leq 1}$. Third, for the independence copula {$C^{\perp}$}, it holds that $C^{\perp}(\varphi(u),u^2/\varphi(u))=u^2,\ u\in[0,\ 1]^2$, which is path-independent as expected, thus warranting the choice $\psi(u)=u^2/\varphi(u),\ u\in [0,\ 1]$. In order to determine the strongest extreme co-movements of risks for any copula $C$, we search for functions $\varphi\in\mathcal{A}$ that maximize the probability \[ \Pi_{\varphi }(u) =C\big (\varphi(u),u^2/\varphi(u)\big ), \;\;\; u \in (0,1), \] or, equivalently, the function \[ d_\varphi(C,C^\perp)(u)=C\big (\varphi(u),u^2/\varphi(u)\big )- C^\perp (\varphi(u),u^2/\varphi(u)\big ), \;\;\; u \in (0,1), \] which is non-negative for positively quadrant dependent (PQD) (Lehmann, 1966) copulas $C$. Then an admissible function $\varphi^* \in \cal{A} $ is called {\it a function of maximal dependence} if \begin{equation} \label{Pi-m} \Pi_{\varphi^* }(u)=\max_{\varphi \in \cal{A} }\Pi_{\varphi }(u) \end{equation} for all $u\in (0,1)$. The corresponding admissible path $(\varphi^*(u),u^2/\varphi^*(u))_{0\leq u\leq 1}$ is called {\it a path of maximal dependence}. Generally speaking, the path $\varphi^\ast$ is not unique, but for each such path the value of $\Pi_{\varphi^\ast}$ is the same. In what follows, we use the notation $\Pi^*(u)$ instead of $\Pi_{\varphi^* }(u)$. Given the new paradigm of prudence that has taken the world of quantitative risk management by storm (OSFI, 2015), it is sensible to introduce conservative variants of indices (\ref{lambda}), (\ref{ind-cl}) and (\ref{ind-kl}) that would rely on path of maximal dependence (\ref{Pi-m}), rather than on the main diagonal path of the copula $C$. Namely, we suggest \begin{equation} \lambda_L^*:=\lambda_L^*(C)= \lim_{u \downarrow 0} {\Pi^*(u)\over u} \textnormal{ instead of } \lambda_{L}(C)=\lim_{u \downarrow 0} \frac{C(u,u)}{u}, \end{equation} and \begin{equation*} \label{chai} \chi_L^*:=\chi_L^*(C)=\lim_{u\downarrow 0}\frac{2\log u }{\log \Pi^*(u)}-1 \textnormal{ instead of } \chi_L=\lim_{u\downarrow 0}\frac{2\log u }{\log C(u,\ u)}-1, \end{equation*} subject to the existence of the limits, and also \begin{equation*} \label{mo-1b} \Pi^*(u)=\ell^*(u) u^{\kappa_L^*},\ u\downarrow 0 \textnormal{ instead of } \Pi(u)=\ell(u) u^{\kappa_L},\ \quad u\downarrow 0, \end{equation*} assuming that there exist slowly varying at zero functions $\ell^\ast(u)$ and $\ell(u)$ (Ledford and Tawn, 1996). These new indices of tail dependence provide a more prudent estimation of the extent of tail dependence in copulas and, in conjunction with tail-based risk measures, are capable of distinguishing between risky positions in situations where the classical indices of tail dependence fail to do so (Furman et al., 2015, Section 3). A useful technique for deriving function(s) of maximal dependence, and thus in turn of the corresponding indices, consists of three steps: \begin{enumerate} \item [(S1)] searching for critical points of the function $x \mapsto C(x,u^2/x)$ over the interval $[u^2,1]$ and for each $u\in [0,\ 1]$; \item [(S2)] checking which solution(s) is/are global maximum/maxima; \item [(S3)] verifying that the function $u\mapsto \varphi^*(u)$ is in $\mathcal{A}$. \end{enumerate} Accomplishing these tasks sometimes results in explicit formulas for maximal dependence functions, while in some other cases obtaining closed-form solutions may not be possible. {For example, as we see from Furman et al. (2015), for the Farlie-Gumbel-Morgenstern (FGM) copula this task is doable, whereas for the generalized Clayton copula there is no closed-form solution. We refer the reader to, respectively, Sections 4 and 6 in Furman et al. (2015) for more technical discussions.} Sometimes, especially when formulas for conditional copulas are readily available, it is useful to recall that partial derivatives of copulas are conditional copulas, and thus the task of determining the set of critical points becomes equivalent to finding all the solutions in $x\in[u^2,\ 1]$ to the equation \begin{equation} \label{cond_c} xC_{2|1}\left(\frac{u^2}{x}|x\right)= \frac{u^2}{x}C_{1|2}\left(x|\frac{u^2}{x}\right). \end{equation} {Interestingly, as has been also pointed out by one of the referees, there are symmetric copulas whose paths of maximal dependence are diagonal: e.g., the FGM and Clayton copulas, as well as the symmetric subclass of the Marshall-Olkin copulas (see, Furman et al., 2015). Hence, a natural question is whether or not the path of maximal dependence always coincides with the diagonal when the copula function is symmetric? Unfortunately, the answer to this question is not always positive, as we illustrate next. First, we recall from Furman et al. (2015) that there are symmetric copulas whose paths of maximal dependence are not diagonal, such as the $0.5/0.5$ mixture of two `mirrored' Marshall-Olkin copulas. Next we present an example showing that this argument also holds for the absolutely continuous subclass of symmetric copulas. For this, we recall the bivariate extreme value copula (Pickands, 1981; Guillotte and Perron, 2016) \[ C_A(u,v)=\exp\left\{\ln(uv){A\left(\frac{\ln v}{\ln uv} \right)}\right\}, \] where $A:[0,1]\rightarrow [0.5,1]$ is the Pickands dependence function, which is convex and satisfies the bounds $(1-t)\vee t \leq A(t) \leq 1$ for $t\in [0,1]$. Define the $0.5/0.5$ mixture of two `mirrored' extreme value copulas by \begin{eqnarray} \label{mix-extreme-c} C_{A_1,A_2}(u,v)=\frac{1}{2}\big(C_{A_1}(u,v)+C_{A_2}(u,v) \big), \end{eqnarray} where $A_1$ and $A_2$ are two Pickands dependence functions such that $A_1(t)=A_2(1-t)$ for $t\in [0,1]$. It is not difficult to see that copula (\ref{mix-extreme-c}) is PQD, symmetric around the diagonal, and absolutely continuous when the Pickands dependence functions $A_1$ and $A_2$ are differentiable. To prove that the path of maximal dependence for the just defined copula may not be diagonal, it is sufficient to show that there exists $A_1$ such that \begin{eqnarray} \label{ineqn-extreme-c} \frac{\partial^2}{\partial x^2}C_{A_1,A_2}(x,u^2/x)\Big|_{x=u} > 0. \end{eqnarray} Equivalently, we need to verify that for $\psi(t,u)=u^{A_1(1-t)}+u^{A_1(t)}$ and $u\in [0,\ 1]$ we have \begin{eqnarray} \frac{\partial^2}{\partial t^2} \psi(t,u)\big|_{t=0.5} =2 u^{A_1(1/2)}\ln (u)\left( (A_1^{(1)}(1/2))^2\ln u+A_1^{(2)}(1/2) \right) >0, \label{deriv-3} \end{eqnarray} where $A_1^{(k)}$ is the $k$-th derivative of $A_1$. Hence, unless the function $A_1$ attains its minimum at $t=0.5$, there exists $u^\ast\in[0,\ 1]$ such that statement (\ref{deriv-3}) holds for all $u\in[0,\ u^\ast]$. This suggests that $x\mapsto C(x,\ u^2/x)$ is convex at $x=u$ for $u\in[0,\ u^\ast]$, and so the path of maximal dependence cannot coincide with the diagonal on the aforementioned interval, that is, $\varphi^\ast(u)\neq u$ for $u\in[0,\ u^\ast]$. We conclude this section by noting that other scholars have also considered other than the diagonal paths when measuring tail dependence. For example, Asimit et al. (2016) use the conditional Kendall's tau to measure tail dependence. Joe et al. (2010) introduce the tail dependence function $b(w_1,w_2;C)=\lim_{u\downarrow 0}C(uw_1,uw_2)/u$ for $w_1,w_2>0$ to measure tail dependence via different directions. Hua and Joe (2014) use the excess-of-loss economic pricing functional to study tail dependence. All of these measures as well as the notion of maximal tail dependent discussed in the present paper provide complementary ways for understanding tail dependence. } \section{Main results} \label{sec-3} The bivariate Gaussian copula arises from the bivariate normal distribution. As such, it is arguably the most popular and well-studied copula, extensively used in financial and insurance mathematics (MacKenzie and Spears, 2014). We recall that the Gaussian copula $C_{\rho}(u,v)$ is defined, for $0\leq u,v\leq 1$, as follows \begin{equation}\label{def_CG} C_{\rho}(u,v)=\Phi_2(\Phi^{-1}(u),\Phi^{-1}(v);\rho), \end{equation} where $\Phi(u)$ and $\Phi^{-1}(u)$ are the standard-normal distribution function and its inverse, and \begin{equation}\label{def_Phi2} \Phi_2(s,t;\rho)=\int_{-\infty}^{s} \int_{-\infty}^{t} \frac{1}{{2\pi}\sqrt{1-\rho^2}}\exp \left \{-\frac{x^2-2\rho x y +y^2}{2(1-\rho^2)}\right \}dy dx \end{equation} is the distribution function of the bivariate normal distribution with correlation parameter $\rho\in (-1,1)$, defined for all $s,t\in\mathbb{R}$. \begin{theorem}\label{th} For the Gaussian copula $C_{\rho}$, \begin{enumerate}[\rm (I)] \item \label{th-a} when $\rho \in (-1,0)$, there is no admissible path of maximal dependence; \item \label{th-b} when $\rho=0$, every admissible path is a path of maximal dependence; \item \label{th-c} when $\rho \in (0,1)$, the only path of maximal dependence is the diagonal $(u,u)_{0\leq u \leq 1}$. \end{enumerate} \end{theorem} \begin{corollary}\label{cor} For the Gaussian copula $C_{\rho}$, when $\rho \in [0,1)$ we have \begin{enumerate}[\rm (A)] \item $\lambda_L^*(C_{\rho})=\lambda_L(C_{\rho})=0$; \item $\chi_L^*(C_{\rho})=\chi_L(C_{\rho})=\rho$; \item $\kappa_L^*(C_{\rho})=\kappa_L(C_{\rho})=2/(1+\rho)$. \end{enumerate} \end{corollary} \begin{proof}[Proof of Theorem \ref{th}] The proof of parts (\ref{th-a}) and (\ref{th-b}) of Theorem \ref{th} is simple. When $\rho \in (-1,0)$ we have $C_{\rho}(u,v)< uv$ for all $u,v\in (0,1)$. Therefore, $\Pi_{\varphi }(u)$ achieves its maximum at either $\varphi(u)=u^2$ or $\varphi(u)=1$. However, the two paths $(u^2,1)_{0\leq u \leq 1}$ and $(1,u^2)_{0 \leq u \leq 1}$ are not admissible, which establishes statement (\ref{th-a}). Statement (\ref{th-b}) follows from the fact that in the case $\rho=0$ the Gaussian copula $C_{\rho} $ reduces to the independence copula $C^\perp(u,\ v)=uv,\ 0\leq u,v,\leq 1$. The proof of part (\ref{th-c}) of Theorem \ref{th} is much more involved, and it requires several auxiliary results. Our first goal is to rephrase the statement about the location of paths of maximal dependence as a geometric statement about certain curves. To this end, for $\alpha \in (0,1)$, we define \begin{equation}\label{def_C_alpha} {\cal{C}}_{\alpha}:=\left \{(w,z) \;:\; \Phi(w)\Phi(z)=\alpha \right \} \subset {\mathbb R}^2. \end{equation} These are the level sets of the function of two variables $(w,z) \mapsto \Phi(w) \Phi(z)$, and these sets play a pivotal role in our proof. Given a point $(x_1,x_2) \in {\mathbb R}^2$, we denote by ${}^{\beta}(x_1,x_2)$ the point $(y_1,y_2)$ obtained from $(x_1,x_2)$ by rotation by angle $\beta$ counter-clockwise, that is \begin{align*} y_1&=\cos(\beta)x_1 - \sin(\beta) x_2, \\ y_2&=\sin(\beta)x_1 +\cos(\beta) x_2. \end{align*} Similarly, for any set $\gamma \subset {\mathbb R}^2$ we denote by ${}^{\beta} \gamma$ the result of rotating the set $\gamma$ counter-clockwise by angle $\beta$. Consider the following statement: \begin{align}\label{condition} &{\textnormal{ \it For any $\alpha \in (0,1)$ and $\beta \in (0,\pi/2)$, the intersection ${\cal{C}}_{\alpha}\cap {^{\beta}}{\cal{C}}_{\alpha}$}}\\ \nonumber &\qquad \qquad\qquad \;\;{\textnormal{\it consists of a unique point.} } \end{align} We next prove that the statement above is in fact stronger than statement (\ref{th-c}) of Theorem \ref{th}. Thus proving \eqref{condition} automatically completes the proof of Theorem \ref{th}(\ref{th-c}). \begin{lemma}\label{lemma1} Statement \eqref{condition} implies part (\ref{th-c}) of Theorem \ref{th}. \end{lemma} \begin{proof} Finding a path of maximal dependence is equivalent to solving the following optimization problem: For every (fixed) $u \in (0,1)$ we want to find the maximum of the function $[u^2,1]\ni x \mapsto C_{\rho}(x,u^2/x)$. First of all, note that the restriction $\rho \in (0,1)$ implies $C_{\rho}(u,v)> uv$ for all $u,v\in (0,1)$. From this result we see that $C_{\rho}(x,u^2/x)>u^2$ for all $x\in (u^2,1)$, and since $C_{\rho}(x,u^2/x)=u^2$ for $x=u^2$ or $x=1$, we conclude that the function $x \mapsto C_{\rho}(x,u^2/x)$ achieves the global maximum for some $\tilde x$ in the open interval $(u^2,1)$. Since the function $x \mapsto C_{\rho}(x,u^2/x)$ is smooth in the interval $(u^2,1)$, the global maximum must be one of its critical points, so that $\frac{\d}{\d x} C_{\rho}(x,u^2/x)=0$ at the maximum point $x=\tilde x$. To find the critical points, we solve the following equation: \begin{equation}\label{eqn_hprime_1} x\Phi\left(\frac{1}{\sqrt{1-\rho^2}}(\Phi^{-1}(u^2/x)-\rho\Phi^{-1}(x) ) \right) =\frac{u^2}{x}\Phi\left(\frac{1}{\sqrt{1-\rho^2}} (\Phi^{-1}(x)-\rho\Phi^{-1}(u^2/x)) \right) \end{equation} in $x\in(u^2,\ 1)$ for $u\in (0,\ 1)$, which was derived by using equation (3.1) and (3.2) in Meyer (2013) (also Fung and Seneta, 2011; McNeil et al., 2005) as well as \eqref{cond_c}, \eqref{def_CG} and \eqref{def_Phi2} in the current paper. Note that $x=u$ is clearly a solution of equation (\ref{eqn_hprime_1}). Thus to establish our main result, it is enough to prove that for every fixed $u \in (0,1)$ there are no other solutions to \eqref{eqn_hprime_1} except for $x=u$. Also, we introduce the following change of variables: let $\Lambda$ be the map that sends any point $(u,x)$ from the domain \begin{equation*} D=\{ 0 < u < 1, \; \; u^2 < x < 1\} \subset {\mathbb R}^2 \end{equation*} into another point $\Lambda (u,x)=(w,z) \in {\mathbb R}^2$ according to the rule: \begin{equation}\label{def_w_z} w = \Phi^{-1}(x) \;\; \textnormal{ and } \;\; z = \frac{1}{\sqrt{1-\rho^2}}\Phi^{-1}(u^2/x)-\frac{\rho}{\sqrt{1-\rho^2}}\Phi^{-1}(x). \end{equation} It is easy to see that $\Lambda$ is a diffeomorphism of $D$ onto ${\mathbb R}^2$, with the inverse map $(u,x)=\Lambda^{-1} (w,z)$ given by \begin{equation}\label{inverse_Lambda} u=\left[\Phi(w) \Phi(\rho w + \sqrt{1-\rho^2} z )\right]^{1/2}, \;\;\; x=\Phi(w). \end{equation} Using (\ref{def_w_z}) it is easy to check that the diagonal $(u,u)$ of the set $D$ is mapped onto the straight line $$ l:=\left\{ (z,w) \in {\mathbb R}^2 \; : \; z = \frac{1-\rho}{\sqrt{1-\rho^2}} w \right\}. $$ >From \eqref{inverse_Lambda} we find $$ u^2/x=\Phi(\rho w + \sqrt{1-\rho^2} z) $$ and $$ \frac{1}{\sqrt{1-\rho^2}} (\Phi^{-1}(x)-\rho\Phi^{-1}(u^2/x))=\sqrt{1-\rho^2} w - \rho z. $$ Combining the above formulas we conclude that equation \eqref{eqn_hprime_1} is equivalent to $$ \Phi(w) \Phi(z)=\Phi(\sqrt{1-\rho^2} w - \rho z) \Phi(\rho w + \sqrt{1-\rho^2} z). $$ Finally, we denote $\beta=\arcsin(\rho)$, so that $\rho=\sin(\beta)$ and $\sqrt{1-\rho^2}=\cos(\beta)$, and rewrite the above equation as \begin{equation}\label{eqn_phiz_phiw} \Phi(w)\Phi(z)=\Phi(w') \Phi(z'), \end{equation} where $w'=\cos(\beta)w-\sin(\beta) z$ and $z'=\sin(\beta) w + \cos(\beta) z$. Note that $\beta \in (0,\pi/2)$ and the point $(w',z')$ is obtained from the point $(w,z)$ by rotation by the angle $\beta$ counter-clockwise. Using our previous notation we can write $(w',z')={}^{\beta} (w,z)$. To summarize, we have shown that after a change of variables $\Lambda: D \mapsto {\mathbb R}^2$ equation \eqref{eqn_hprime_1} is equivalently transformed into equation \eqref{eqn_phiz_phiw}. The latter equation has a simple geometric interpretation: a point $(w,z)$ satisfies \eqref{eqn_phiz_phiw} if and only if $(w,z) \in {\cal C}_{\alpha} \cap {}^{\beta}{\cal C}_{\alpha}$, where $\alpha=\Phi(z)\Phi(w)$ and ${\cal C}_{\alpha}$ is the level set defined in \eqref{def_C_alpha}. Next, all points on the straight line $l$ defined above are the solutions of \eqref{eqn_phiz_phiw}; this is easy to check directly, and it also follows at once from the fact that the points on $l$ are the images $(w,z)=\Lambda(u,u)$ of points on the diagonal of $D$, which do satisfy the equivalent equation \eqref{eqn_hprime_1}. Therefore, we have shown that for every $\alpha \in (0,1)$ there is {\it at least one} point in the intersection ${\cal C}_{\alpha} \cap {}^{\beta}{\cal C}_{\alpha}$. If we assume that for every $\alpha \in (0,1)$ there exists a {\it unique} point in the intersection ${\cal C}_{\alpha} \cap {}^{\beta}{\cal C}_{\alpha}$, this would imply that there are no other solutions to \eqref{eqn_phiz_phiw} except for those on the line $l$, which in turn implies that the diagonal points $(u,u) \in D$ are the only solutions to \eqref{eqn_hprime_1}. Recall that the solutions to equation \eqref{eqn_hprime_1} give us the critical points of the function $x \mapsto C_{\rho}(x,u^2/x)$. Therefore, if there are no other critical points except for the diagonal ones, then the path of maximal dependence must be diagonal. \end{proof} As we demonstrate next, each level set ${\cal C}_{\alpha},\ \alpha\in(0,\ 1)$ is in fact a smooth curve in ${\mathbb R}^2$ and a boundary of a convex set. Some of these curves are shown in Figure \ref{fig1}. \begin{figure} \centering \includegraphics[height =7cm]{p1} \caption{The curve ${\cal{C}}_{\alpha}$ for $\alpha = 1/10$ (blue), 1/4 (red), 1/3 (black), and 3/5 (green).} \label{fig1} \end{figure} \begin{lemma}\label{lemma_C_properties} For every $\alpha \in (0,\ 1)$, the following properties hold: \begin{enumerate} \item [\textnormal{(P1)}] \label{prop-a} ${\cal{C}}_{\alpha}$ is a smooth curve in ${\mathbb R}^2$; \item [\textnormal{(P2)}] \label{prop-c} ${\cal{C}}_{\alpha}$ is symmetric with respect to the diagonal line $\{(w,z) : w=z\}\subset {\mathbb R}^2$; \item [\textnormal{(P3)}] \label{prop-b} ${\cal{C}}_{\alpha}$ is the boundary of a convex set which lies in $\{w > \Phi^{-1}(\alpha)\} \cap \{z > \Phi^{-1}(\alpha)\}$. The lines $z=\Phi^{-1}(\alpha)$ and $w=\Phi^{-1}(\alpha)$ are the asymptotes of ${\cal C}_{\alpha}$. \end{enumerate} \end{lemma} \begin{proof} First of all, we note that the equation $\Phi(w)\Phi(z)=\alpha$ can be solved for $z$ in terms of $w$ as follows \begin{equation}\label{fn_z_w} z(w)=\Phi^{-1}(\alpha/\Phi(w)). \end{equation} The level set ${\cal C}_{\alpha}$ is simply the graph of $z(w)$, which is clearly a smooth function defined for $w>\Phi^{-1}(\alpha)$. This proves property (P1). The symmetry with respect to interchanging $w \leftrightarrow z$ follows at once from definition \eqref{def_C_alpha}. This proves property (P2). Since $$ z(w) \to \Phi^{-1} (\alpha),\ {\text{for}}\ w\to +\infty, $$ the horizontal line $z=\Phi^{-1}(\alpha)$ is an asymptote, and the vertical asymptote $w=\Phi^{-1}(\alpha)$ follows from the above-mentioned symmetry with respect to $z\leftrightarrow w$. The function $z(w)$ given by \eqref{fn_z_w} is convex. An easy way to prove this is via the fact that $\Phi(w)$ is log-concave, which implies that the function of two variables $(w,z) \mapsto \ln(\Phi(z)\Phi(w))$ is concave. Therefore, its upper set \begin{equation}\label{def_U_alpha} {\cal U}_{\alpha}:=\{ (w,z) \in {\mathbb R}^2 \; : \; \ln(\Phi(z)\Phi(w))>\ln(\alpha)\} \end{equation} must be convex. It is clear that ${\cal C}_{\alpha}$ is the boundary of ${\cal U}_{\alpha}$. This proves property (P3) and completes the proof of Lemma \ref{lemma_C_properties}. \end{proof} We recall that for any set $\gamma \subset {\mathbb R}^2$ we denote by ${}^{\beta} \gamma$ the rotation of $\gamma$ by angle $\beta$ counter-clockwise. In particular, if $\gamma$ is a curve which can be written in polar coordinates $(r, \theta )$ as \begin{equation}\label{curve-0} \gamma=\left \{ (r(\theta)\cos(\theta), r(\theta) \sin(\theta)) \; : \; \theta \in (\theta_1, \theta_2) \right \} , \end{equation} then ${^{\beta}}\gamma$ is also a curve whose expression in polar coordinates is given by \begin{equation}\label{curve-1} {^{\beta}}\gamma=\left \{(r(\theta-\beta)\cos(\theta), r(\theta-\beta) \sin(\theta)) \; : \; \theta \in (\theta_1+\beta, \theta_2+\beta) \right \}. \end{equation} \begin{figure} \centering \includegraphics[height =7cm]{p3} \caption{Illustration to the proof of Lemma \ref{lemma_inter-point}(i): the curves $\gamma$ (red) and ${}^{\beta}\gamma$ (blue) in polar coordinates ($\theta$ is on x-axis, and $r$ is on y-axis).} \label{fig2} \end{figure} \begin{lemma}\label{lemma_inter-point} ${}$ \begin{itemize} \item[\textnormal{(i)}] Assume that a curve $\gamma $ is written in polar coordinates in form (\ref{curve-0}). If the function $r(\theta)$ is strictly decreasing on $(\theta_1,\tilde \theta)$ and strictly increasing on $(\tilde \theta, \theta_2)$ for some $\tilde \theta \in (\theta_1, \theta_2)$ then for every $\beta \in (0,2\pi-\theta_2+\theta_1)$ there is at most one point of intersection of $\gamma$ and ${}^{\beta}\gamma$. \item[\textnormal{(ii)}] Assume that a curve $\gamma$ is given in the parametric form $(w(t),z(t))$, $t\in I$, where $I\subset {\mathbb R}$ is an interval. If $r(t)=\sqrt{w(t)^2+z(t)^2}$ is nonzero and strictly monotone for $t\in I$, then for any $\beta \in (0,2\pi)$ the curves $\gamma$ and ${}^{\beta} \gamma$ do not intersect. \end{itemize} \end{lemma} \begin{proof} While the proof of part (i) is quite obvious from Figure \ref{fig2}, we present the details of the proof for mathematical rigour. When $\theta_1+\beta>\theta_2$, then it is clear that ${^{\beta}}\gamma \cap \gamma=\emptyset$ because these curves lie in non-intersecting sectors. We are left with the case when $\theta_1+\beta<\theta_2$. We further restrict ourselves to the case $\theta_1+\beta<\tilde{\theta}$; the argument in the case $\theta_1+\beta \in [\tilde \theta, \theta_2)$ is identical. Denote $r_1(\theta)=r(\theta)$ and $r_2(\theta)=r(\theta-\beta)$. Since $r_1(\theta)$ is decreasing on $(\theta_1,\tilde \theta)$ we have $r_2(\theta)>r_1(\theta)$ for $\theta \in (\theta_1+\beta,\tilde \theta)$. Therefore, the curves $\gamma$ and ${^{\beta}}\gamma$ do not intersect when $\theta \in (\theta_1+\beta,\tilde \theta)$. When $\theta \in (\tilde \theta, \min(\theta_2, \tilde\theta+\beta))$, the function $r_1(\theta)$ is strictly increasing while $r_2(\theta)$ is strictly decreasing. By considering the values of these two functions at the endpoints of the interval we conclude that there exists a unique number $\theta^*$ for which $r_1(\theta^*)=r_2(\theta^*)$. The point with polar coordinates $(r_1(\theta^*),\theta^*)$ then gives us the unique point of intersection of $\gamma$ and ${^{\beta}}\gamma$. On the interval $\theta \in [\tilde \theta+\beta,\theta_2)$ we have the inequality $r_1(\theta)>r_2(\theta)$, and so the curves $\gamma$ and ${^{\beta}}\gamma$ do not intersect in this sector. Hence, we have shown that there exists a unique point of intersection of $\gamma$ and ${^{\beta}}\gamma$ when $\theta_1+\beta<\theta_2$. To establish part (ii), let us assume that $(\tilde w, \tilde z) \in \gamma \cap {}^{\beta} \gamma$. This condition implies that a circle $B_R$ with radius $R=\sqrt{\tilde w^2+ \tilde z^2}$ and center at the origin must intersect the curve $\gamma$ at two distinct points. However, this contradicts the condition that the radius $r(t)$ is strictly monotone along the curve $\gamma$. Thus we have arrived at a contradiction. Therefore, the intersection of $\gamma$ and ${}^{\beta} \gamma$ must be empty. \end{proof} \begin{lemma}\label{lemma3} Let $z=f(w)$ be a function defined on $0<w<w_0$ (where $w_0$ can be $+\infty$). Assume that $f(w)$ is smooth, decreasing, convex and its graph $\gamma=\{(w,f(w)) \; : \; 0<w<w_0\}$ is symmetric with respect to the line $z=w$. Then the curve $\gamma$ can be written in polar coordinates in form \eqref{curve-0}, and $r(\theta)$ is strictly decreasing on the interval $(0,\pi/4)$ and strictly increasing on the interval $(\pi/4,\pi/2)$. \end{lemma} \begin{proof} Note that the condition that $\gamma$ is symmetric with respect to the line $z=w$ implies $f(w_0)=0$. This result and the fact that $f(w)/w$ is strictly decreasing allows us to represent $\gamma$ in polar coordinates in form \eqref{curve-0} with $\theta_1=0$ and $\theta_2=\pi/2$. Let $(w_0,z_0)$ be the point of intersection of $\gamma$ and the line $z=w$, so that $z_0=f(w_0)$. The part of the graph with $w>w_0$ corresponds to the polar coordinate representation with $\theta \in (0,\pi/4)$. The symmetry of $\gamma$ with respect to $z=w$ implies $f'(w_0)=-1$, and since the function $f(w)$ is convex we see that $f'(w)>-1$ for $w>w_0$. The radius in polar coordinates is given by $r=\sqrt{w^2+f(w)^2}$. Thus for $w>w_0$, $$ \frac{\d r}{\d w}=r^{-1} \left(w+f(w)f'(w)\right)>r^{-1} (w-f(w))>r^{-1} (w-f(w_0))=r^{-1}(w-w_0)>0, $$ where we have used the fact that $f(w)$ is strictly decreasing. This result combined with the fact that $\d w/\d \theta<0$ for $\theta \in (0,\pi/2)$ shows that $\d r/\d \theta<0$ for $\theta \in (0,\pi/4)$. The fact that $\d r/\d \theta>0$ for $\theta \in (\pi/4,\pi/2)$ follows by symmetry. \end{proof} We are now ready to complete the proof of part (\ref{th-c}) of Theorem \ref{th}. According to Lemma \ref{lemma1}, it is enough to establish the validity of statement \eqref{condition}. We do this in four steps, depending on the value of $\alpha\in(0,\ 1)$. \vspace{0.35cm} \noindent {\bf Proof of statement \eqref{condition} for $\alpha \in (0,1/4)$:} \begin{figure} \centering \includegraphics[height =7cm]{pic1} \caption{Illustration to the proof of statement \eqref{condition} for $\alpha \in (0,1/4)$.} \label{pic1} \end{figure} \noindent We begin by noting that if $\alpha \in (0,1/4)$ then the origin belongs to the convex set ${\cal U}_{\alpha}$ defined above in \eqref{def_U_alpha}. Given this fact and the properties of ${\cal C}_{\alpha}$ which were described in Lemma \ref{lemma_C_properties}, it is clear that the curve ${\cal C}_{\alpha}$ must lie in the second, third and fourth quadrants; see Figure \ref{pic1} or the blue curve in Figure \ref{fig1}). We can express this curve in polar coordinates as follows \[ {\cal{C}}_{\alpha}=\left \{(r(\theta)\cos(\theta),r(\theta) \sin(\theta)) \; : \; \pi/2 < \theta <2\pi \right \}, \] and then divide it into three parts $\gamma_1$, $\gamma_2$ and $\gamma_3$, which lie respectively in the fourth, third and second quadrants (see Figure \ref{pic1}). First we consider the curve $\gamma_1$. We claim that the radius (the distance from the origin) strictly increases as we move along this curve to the right. To see this, we parametrize points on $\gamma_1$ by $(w,z(w))$ for $w>0$, where $z(w)$ is given by \eqref{fn_z_w}. For $w>0$ the function $z(w)$ is negative and strictly decreasing, which shows that $r(w)=\sqrt{w^2+z(w)^2}$ is strictly increasing. Next, we consider the curve $\gamma_2$ parametrized by polar coordinates $(r,\theta)$, $\theta \in (\pi,3\pi/2)$. Our goal is to prove that $r(\theta)$ is strictly decreasing on the interval $(\pi,5\pi/4)$ and strictly increasing on the interval $(5\pi/4,3\pi/2)$. Note that the function $r(\theta)$ satisfies the equation $$ \Phi(r(\theta) \cos(\theta))\Phi(r(\theta) \sin(\theta))=\alpha, \;\;\; \pi/2 < \theta <2\pi. $$ Differentiating both sides of this equation with respect to $\theta$ we obtain \begin{equation}\label{r_prime_over_r} \frac{1}{r}\frac{\d r}{\d \theta}= \frac{\Phi(w)w e^{-z^2/2}-\Phi(z)ze^{-w^2/2}}{\Phi(w)z e^{-z^2/2}+\Phi(z)we^{-w^2/2}}, \end{equation} where we denoted $w=r \cos(\theta)$ and $z=r\sin(\theta)$. The denominator on the right-hand side of \eqref{r_prime_over_r} is strictly negative in the third quadrant. Thus to prove our claim about the increase/decrease of $r(\theta)$ it is enough to demonstrate that the numerator on the right-hand side of \eqref{r_prime_over_r} satisfies \begin{align}\label{numerator} &\Phi(w)w e^{-z^2/2}-\Phi(z)ze^{-w^2/2} >0 \quad \textrm{if} \quad w>z ,\\ \nonumber &\Phi(w)w e^{-z^2/2}-\Phi(z)ze^{-w^2/2} <0 \quad \textrm{if} \quad w<z . \end{align} This is indeed true because the function $h(w)=w e^{w^2/2} \Phi(w)$ is strictly increasing for all $w\in\mathbb{R}$. The monotonicity of $h(w)$ is obvious for $w>0$ and follows from Pinelis (2002), in which the monotonicity of $-h(-w)=w e^{w^2/2} {(1-{\Phi}(w))}$ was studied. Let us summarize what we have established so far about the curve ${\cal C}_{\alpha}=\gamma_1 \cup \gamma_2 \cup \gamma_3$. As we move along this curve, starting in its upper part, the radius strictly decreases until it reaches its global minimum at the point of intersection of ${\cal C}_{\alpha}$ and the line $z=w$, and afterwards the radius strictly increases. Now we are ready to prove that there exists a unique point of intersection between ${\cal C}_{\alpha}$ and ${}^{\beta}{\cal C}_{\alpha}$. Let us denote $R=-\Phi^{-1}(2\alpha)$, so that $(0,-R)$ is the point of intersection of ${\cal C}_{\alpha}$ and the $z$-axis; this follows from \eqref{fn_z_w}. The monotonicity properties of the radius imply that the curves $\gamma_1$ and $\gamma_3$ lie outside of the circle $B_R$ with the center at the origin and the radius $R$, while the curve $\gamma_2$ lies completely inside this circle (of course the boundaries of these curves meet at the circle). Let us see what happens when we rotate the curve ${\cal C}_{\alpha}=\gamma_1 \cup \gamma_2 \cup \gamma_3$ by angle $\beta \in (0, \pi/2)$ counter-clockwise. The intersection of $\gamma_1 \cap {}^{\beta} \gamma_1$ and $\gamma_3 \cap {}^{\beta} \gamma_3$ is empty due to Lemma \ref{lemma_inter-point}(ii). The curves ${}^{\beta}\gamma_1$ and $\gamma_3$ (and, similarly, $\gamma_1$ and ${}^{\beta} \gamma_3$) do not intersect since $\gamma_1$ and $\gamma_3$ lie in the fourth and second quadrants and the angle of rotation $\beta$ is strictly less than $\pi/2$. The intersection $\gamma_1 \cap {}^{\beta} \gamma_2$ and ${\gamma_3} \cap {}^{\beta} \gamma_2$ is empty since these curves lie in different regions separated by the circle $B_R$ (one is inside and the other one is outside of this circle). And finally, the intersection $\gamma_2 \cap {}^{\beta} \gamma_2$ consists of at most one point due to Lemma \ref{lemma_inter-point}(i). In fact, such a point of intersection must exist since we know that the curves ${\cal C}_{\alpha}$ and ${}^{\beta} {\cal C}_{\alpha}$ do intersect; see the last paragraph of the proof of Lemma \ref{lemma1}. Thus we have proved that for any $\alpha \in (0,1/4)$ and any $\beta \in (0,\pi/2)$ there exists a unique point of intersection ${\cal C}_{\alpha} \cap {}^{\beta} {\cal C}_{\alpha}$. \qed \vspace{0.25cm} \noindent {\bf Proof of statement \eqref{condition} for $\alpha=1/4$:} \noindent The curve ${\cal{C}}_{1/4}$ contains the origin; see the red curve in Figure \ref{fig1}. The proof of statement \eqref{condition} is the same as the proof above in the case $\alpha \in (0,1/4)$, except that now the curve $\gamma_2$ degenerates to a single point $(0,0)$ so that ${\cal C}_{1/4} \cap {}^{\beta} {\cal C}_{1/4}=\{(0,0)\}$. \qed \vspace{0.25cm} \noindent {\bf Proof of statement \eqref{condition} for $\alpha \in (1/4,1/2)$:} \begin{figure} \centering \includegraphics[height =7cm]{pic2} \caption{Illustration to the proof of statement \eqref{condition} for $\alpha \in (1/4,1/2)$.} \label{pic2} \end{figure} \noindent When $\alpha \in (1/4,1/2)$ the curve ${\cal C}_{\alpha}$ lies in the first, second and fourth quadrants; see Figure \ref{pic2} or the black curve in Figure \ref{fig1}. The proof of statement \eqref{condition} is the same as in the case $\alpha \in (0,1/4)$, except that we now use Lemma \ref{lemma3} to prove that the radius $r(\theta)$ is strictly decreasing for $\theta \in (0,\pi/4)$ and strictly increasing for $\theta \in (\pi/4,\pi/2)$. \qed \vspace{0.25cm} \noindent {\bf Proof of statement \eqref{condition} for $\alpha \in [1/2,1)$:} \noindent When $\alpha \in [1/2,1)$ the curve ${\cal C}_{\alpha}$ lies entirely in the first quadrant; see the green curve in Figure \ref{fig1}. In this case the proof of statement \eqref{condition} follows from Lemma \ref{lemma_inter-point}(i) and Lemma \ref{lemma3}. \qed This ends the proof of statement (\ref{condition}), and according to Lemma \ref{lemma1}, the proof of Theorem \ref{th} is now complete. \end{proof} \section{Concluding comments} \label{sec-4} Traditional methods in insurance and finance work well for symmetric and light-tailed risks. It is however a well-known empirical fact that in reality risks are skewed (Graham and Harvey, 2001), and it is exactly the severe tail risks that drive economic capital allocations in portfolios of risks. It is not surprising therefore that the notions of asymmetry and `fat tails' have been gaining unprecedented popularity among theoreticians and practitioners (e.g., Staudt, 2010). The phenomenon of dependent tail risks is equally subtle. In this respect, the not-too-distant financial crisis doubtlessly demonstrated that, e.g., dependent defaults may be disastrous for economies of entire countries. However, the quantification of tail dependence is not a simple problem. In fact, the classical approaches that are nowadays commonly employed seem to often underestimate the amount of tail dependence, as they rely solely on the main diagonal of the copula whereas the copula's (tail) behavior can be very different otherwise. For this reason, the aforementioned approaches can miss the so-called maximal tail dependence even in some symmetric dependence structures. Many, if not the majority, of the models in financial theory have been built with the Gaussian distribution in mind, for which in this paper we have established that all of the classical indices of tail dependence (Joe, 1993; Ledford and Tawn, 1996; Coles et al., 1999; Fischer and Klein, 2007) are maximal and thus conform to the prudence-oriented character of current regulations (e.g., OSFI, 2015). As the Gaussian copula has been very popular, and it will likely remain such in the foreseeable future (e.g., MacKenzie and Spears, 2014), our findings are reassuring news for practitioners. \section*{Acknowledgments} { We thank the anonymous referees for valuable comments and suggestions that improved the work and resulted in a better presentation of the material. We are grateful to Prof. Dr. Paul Embrechts and all participants of the ETH Series of Talks in Financial and Insurance Mathematics for feedback and insights. Our research has been supported by the Natural Sciences and Engineering Research Council (NSERC) of Canada. Jianxi Su also acknowledges the financial support of the Government of Ontario and MITACS Canada via, respectively, the Ontario Graduate Scholarship program and the Elevate Postdoctoral fellowship.} \section*{References} \def\hang{\hangindent=\parindent\noindent} \hang {Asimit, V., Gerrard, R., Yanxi, H., Peng, L., 2016. Tail dependence measure for examining financial extreme co-movements. Journal of Econometrics, forthcoming.} \hang Cherubini, U., Durante, F., Mulinacci, S. (Eds.), 2013. Marshall--Olkin Distributions - Advances in Theory and Applications. Springer, {Switzerland}. \hang Coles, S., Heffernan, J., Tawn, J., 1999. Dependence measures for extreme value analyses. Extremes 2 (4), 339--365. \hang Donnelly, C., Embrechts, P., 2010. The devil is in the tails: Actuarial mathematics and the subprime mortgage crisis. ASTIN Bulletin 40 (1), 1--33. \hang Durante, F., Sempi, C., 2015. Principles of Copula Theory. Chapman and Hall/CRC, London. \hang Fischer, M.J., Klein, I., 2007. Some results on weak and strong tail dependence coefficients for means of copulas. Diskussionspapiere No. 78/2007 // Friedrich-Alexander-Universit\"{a}t Erlangen-N\"{u}rnberg, Lehrstuhl f\"{u}r Statistik und \"{O}konometrie, {available at http://econstor.eu/bitstream/10419/29623/1/614058171.pdf, accessed on March 3, 2016}. \hang Fung, T. and Seneta, E., 2011. The bivariate normal copula is regularly varying. Statistics and Probability Letters 81 (11), 1670--1676. \hang Furman, E., Su, J., Zitikis, R., 2015. Paths and indices of maximal tail dependence. ASTIN Bulletin, forthcoming. \hang Graham, J.R., Harvey, C.R., 2001. Expectations of equity risk premia, volatility and asymmetry from a corporate finance perspective. Working Paper No. 8678, National Bureau of Economic Research. \hang {Guillotte, S., Perron, F., 2016. Polynomial Pickands functions. Bernoulli 22 (1), 213-241.} \hang { Hua, L., Joe, H., 2014. Strength of tail dependence based on conditional tail expectation. Journal of Multivariate Analysis 123, 143--159.} \hang Joe, H., 1993. Parametric families of multivariate distributions with given margins. Journal of Multivariate Analysis 46 (2), 262--282. \hang {Joe, H., Li, H., Nikoloulopoulos, A.K., 2010. Tail dependence functions and vine copulas. Journal of Multivariate Analysis 101, 252--270.} \hang Kousky, C., Cooke, R.M., 2009. The unholy trinity: Fat tails, tail dependence, and micro-correlations. Discussion Paper, Resources for the Future, Washington DC. \hang Ledford, A.W., Tawn, J.A., 1996. Statistics for near independence in multivariate extreme values. Biometrika 83 (1), 169--187. \hang Lehmann, E., 1966. Some concepts of dependence. Annals of Mathematical Statistics 37 (5), 1137--1153. \hang Li, D.X., 2000. On default correlation: a copula function approach. Journal of Fixed Income 9 (4), 43--54. \hang Li, L., Yuen, K.C., Yang, J., 2014. Distorted mix method for constructing copulas with tail dependence. Insurance: Mathematics and Economics 57, 77--89. \hang MacKenzie, D., Spears, T., 2014. `A device for being able to book P\&L': The organizational embedding of the Gaussian copula. Social Studies of Science 44 (3), 418--440. \hang McNeil, A.J., Frey, R., Embrechts, P., 2005. Quantitative Risk Management. Princeton University Press, Princeton. \hang Meyer, C., 2013. The bivariate normal copula. Communications in Statistics - Theory and Methods 42 (13), 2402--2422. \hang Nelsen, R.B., 2006. An Introduction to Copulas, second edition. Springer, New York. \hang OSFI, 2015. Own risk and solvency assessment (ORSA). Office of the Superintendent of Financial Institutions, Government of Canada, Ottawa, available at http://www.osfi-bsif.gc.ca/eng/fi-if/rg-ro/gdn-ort/gl-ld/Pages/e19.aspx, accessed on June 17, 2015. \hang {Pickands, J., 1981. Multivariate extreme value distributions. Bulletin of the International Statistical Institute 49, 859--878.} \hang Pinelis, I., 2002. Monotonicity properties of the relative error of a pad\'{e} approximation for {Mills'} ratio. Journal of Inequalities in Pure and Applied Mathematics 3 (2), 1--8. \hang Puccetti, G., R\"{u}schendorf, L., 2014. Asymptotic equivalence of conservative value-at-risk and expected shortfall-based capital charges. Journal of Risk 16 (3), 3--22. \hang R\"{u}schendorf, L., 2013. Mathematical Risk Analysis. Springer, Berlin. \hang Salmon, F., 2012. The formula that killed Wall Street. Significance 9 (1), 16--20. \hang Schmid, F., Schmidt, R., 2007. Multivariate conditional versions of Spearman's rho and related measures of tail dependence. Journal of Multivariate Analysis 98 (6), 1123--1140. \hang Sibuya, M., 1959. Bivariate extreme statistics. Annals of the Institute of Statistical {Mathematics} 11 (2), 195--210. \hang Staudt, A., 2010. Tail risk, systemic risk and copulas. Casualty Actuarial Society E-Forum 2, 1--23. \hang Wang, R., Peng, L., Yang, J., 2013. Bounds for the sum of dependent risks and worst value-at-risk with monotone marginal densities. Finance and Stochastics 17 (2), 395--417. \hang Zhang, M-H., 2008. Modelling total tail dependence along diagonals. Insurance: Mathematics and Economics 42 (1), 73--80. \end{document}
{'timestamp': '2016-07-19T02:03:59', 'yymm': '1607', 'arxiv_id': '1607.04736', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04736'}
arxiv
\section*{Appendix} \subsection{Proof of Lemma \ref{lem:sigmak}} \begin{IEEEproof} We first state the following result that will be used in the proof. \begin{lemma}[Ger\v{s}hgorin circle theorem \cite{HJ12}] Let A be a complex $n \times n$ matrix, with entries $a_{ij}$. Then, every eigenvalue of A lies within at least one of the Ger\v{s}hgorin discs $D_i(A) (i=1,...,n)$, where $D_i(A):=\{ z \in \C: |z-a_{ii}| \leq \sum_{j\neq{i}} \left|a_{ij}\right|\}$. \end{lemma} For any given $\I$ with $|\I| \leq k$, since $W$ has unit-norm columns, and $|W^\dag_iW_j|\leq \mu$ for all $i \neq j$, from Ger\v{s}hgorin circle theorem, we have $\|I- W^\dag_{\I}W_{\I}\|\leq (k-1)\mu <1$, where the last inequality follows from $k\mu<1$. Then, \begin{align*} \|(W^\dag_{\I}W_{\I})^{-1}\| = &\|\sum_{i=0}^\infty (I- W^\dag_{\I}W_{\I})^i\| \leq \sum_{i=0}^\infty \|(I- W^\dag_{\I}W_{\I})^i\|\nonumber \\ \leq & 1/(1-(k-1)\mu)\nonumber. \end{align*} The lemma follows from the definition of $\sigma_k$. \end{IEEEproof} \subsection{Proof of Lemma \ref{lem:cond}} \begin{IEEEproof} For any $\Delta \in \C^{t\times n}$, $\langle L'+\Delta W^T, C'-\Delta \rangle$ is feasible to (\ref{eqn:opt}). Let $G$ be such that $\|G\|=1$, $\left\langle G, \P_{T'^{\perp}}(\Delta W^T) \right\rangle = \|\P_{T'^{\perp}}(\Delta W^T)\|_{*}$ and $\P_{T'}(G)=0$. Then $\P_{T'}(Q)+G$ is a subgradient of $\|L'\|_{*}$. Let $F$ be such that $F_i=-\Delta_i/\|\Delta_i\|_2$ if $i \in \bar{\I}^c$ and $\Delta_i \neq \bm0$, and $F_i=\bm0$ otherwise. Then $\P_{\bar{\I}} (QW^{\ddagger})/\lambda +F$ is a subgradient of $\|C'\|_{1,2}$. Then \begin{equation}\label{eqn:worse} \begin{aligned} &\|L'+ \Delta W^T\|_{*}+\lambda \|C'-\Delta\|_{1,2}-\|L'\|_{*}-\lambda\|C'\|_{1,2} \\ \geq & \langle \P_{T'}(Q)+G, \Delta W^T \rangle -\lambda \langle \P_{\bar{\I}} (QW^{\ddagger})/\lambda +F, \Delta\rangle\\ =& \|\P_{T'^{\perp}}(\Delta W^T)\|_{*} + \lambda \|\P_{\bar{\I}^c}(\Delta)\|_{1,2} + \langle Q-\P_{T'^\perp}(Q), \Delta W^T \rangle \\ &-\langle QW^{\ddagger}-\P_{\bar{\I}^c} (QW^{\ddagger}), \Delta\rangle \\ \geq & (1-\|\P_{T'^\perp}(Q)\|)\|\P_{T'^{\perp}}(\Delta W^T)\|_{*} \\ &+(\lambda-\|(QW^{\ddagger})_{\bar{\I}^c}\|_{\infty,2} )\|\P_{\bar{\I}^c}(\Delta)\|_{1,2}\\ \geq & 0 \end{aligned} \end{equation} From (\ref{eqn:worse}), $\langle L', C'\rangle$ is an optimal solution to (\ref{eqn:opt}). If (\ref{eqn:cond}) holds with strict inequality, the last inequality of (\ref{eqn:worse}) is strict unless \begin{equation}\label{eqn:temp1} \|\P_{T'^{\perp}}(\Delta W^T)\|_{*}= \|\P_{\bar{\I}^c}(\Delta)\|_{1,2}=0. \end{equation} (\ref{eqn:temp1}) implies that $ \Delta W^T \in \P_{T'}$ and $\Delta \in \P_{\bar{\I}}$. Note that $\Delta \in \P_{\bar{\I}}$ implies that $\Delta W^T \in \P_{\bar{\J}}$. Then \begin{align}\label{eqn:med} \P_{\bar{\J}}(\Delta W^T)&=\Delta W^T =\P_{T'}(\Delta W^T) \nonumber\\ &=\P_{U'}(\Delta W^T)+\P_{V'}\P_{U'^\perp}(\Delta W^T)\nonumber\\ &= \P_{\bar{\J}}\P_{U'}(\Delta W^T)+\P_{V'}\P_{U'^\perp}(\Delta W^T), \end{align} where the last equality holds since $\P_{\bar{\J}}(\Delta W^T)=\Delta W^T$. Thus, from (\ref{eqn:med}) we have $\P_{\bar{\J}}\P_{U'^{\perp}}(\Delta W^T)=\P_{V'}\P_{U'^\perp}(\Delta W^T)$, which means $\P_{U'^\perp}(\Delta W^T) \in \P_{\bar{\J}} \cap \P_{V'}$. Then $\P_{U'^\perp}(\Delta W^T)$ is $0$ from the assumption. Then, $\P_{\bar{U}}(\Delta W^T)=\P_{U'}(\Delta W^T) =\Delta W^T$, where the first equality holds from (\ref{eqn:UU'}). Therefore, for any optimal solution $\langle L'+\Delta W^T, C'-\Delta \rangle$ for some $\Delta \neq 0$ to (\ref{eqn:opt}), $\Delta W^T \in \P_{\bar{U}}$, and $\Delta \in \P_{\bar{\I}}$. The claim follows. \end{IEEEproof} \subsection{Construction of $Q$} Here we demonstrate that $Q$ in (\ref{eqn:Q}) is well defined. The key is to show (a) there exists $\hat{H} \in \G(C')$ such that (\ref{eqn:hath}) holds, and (b) the infinite sum in (\ref{eqn:delta2}) converges. We prove these two properties through the following lemmas. \begin{lemma}\label{lem:convex} There exists $\hat{H} \in \G(C')$ such that (\ref{eqn:hath}) holds. \end{lemma} \begin{proof} Since $\langle L', C' \rangle$ is an optimal solution to the Oracle problem (\ref{eqn:oracle}), there exists $G',A' \in \C ^{t \times p}$, $B',Z \in \C^{t \times n}$, and some $\hat{H} \in \G (C)$ such that \begin{equation}\label{eqn:seq1} (\bar{U}\hat{V}^\dag + G'+ \P_{\bar{U}^\perp} (A'))W^{\ddagger}= \lambda (\hat{H}+Z)+\P_{\I^c}(B'), \end{equation} where $\P_{T'^\perp}(G')=0$ and $\P_{\I}(Z)=0$. Then \begin{equation}\label{eqn:seq2} \P_{\bar{U}}\P_{\bar{\I}}(((\bar{U}\hat{V}^\dag + G'+ \P_{\bar{U}^\perp} (A'))W^{\ddagger}) =\bar{U}\hat{V}^\dag W^{\ddagger}_{\bar{\I}}, \end{equation} \begin{equation}\label{eqn:seq3} \P_{\bar{U}}\P_{\bar{\I}}( \lambda (\hat{H}+Z)+\P_{\I^c}(B'))= \lambda \P_{\bar{U}}\P_{\bar{\I}}(\hat{H}) =\lambda\bar{U}\bar{U}^\dag \hat{H} \end{equation} Combining (\ref{eqn:seq1})-(\ref{eqn:seq3}), we have \begin{equation}\label{eqn:multiu} \bar{U}\hat{V}^\dag W^{\ddagger}_{\bar{\I}} = \lambda\bar{U}\bar{U}^\dag \hat{H}. \end{equation} By multiplying $\bar{U}^\dag$ to both sides of (\ref{eqn:multiu}), we obtain Lemma \ref{lem:convex}. \end{proof} \begin{lemma}\label{lem:psi} \begin{equation} \nonumber \psi:=\|\P_{\hat{V}}\P_{W_{\bar{\I}}}\P_{\hat{V}}\| \leq \tilde{\psi}<1 \end{equation} \end{lemma} \begin{proof} \begin{align}\nonumber &\|\P_{\hat{V}}\P_{W_{\bar{\I}}}\P_{\hat{V}}(X)\| \\\nonumber =&\|X\hat{V}\hat{V}^\dag W^{\ddagger}_{\bar{\I}}(W_{\bar{\I}}^T W^{\ddagger}_{\bar{\I}})^{-1}W_{\bar{\I}}^T \hat{V}\hat{V}^\dag\| \\\nonumber \stackrel{(\rm{a})}{=}&\|X\hat{V}(\lambda\bar{U}^\dag \hat{H})(W_{\bar{\I}}^T W^{\ddagger}_{\bar{\I}})^{-1}(\lambda\bar{U}^\dag \hat{H})^\dag\hat{V}^\dag\| \\\nonumber \leq & \|X\|\|\hat{V}\bar{U}^\dag\| \|\lambda \hat{H}\|\|(W_{\bar{\I}}^\dag W_{\bar{\I}})^{-1}\|\|\lambda\hat{H}^\dag \|\|\bar{U}\hat{V}^\dag\|\\\nonumber \stackrel{(\rm{b})}{\leq} & \|X\| \cdot 1 \cdot\lambda \sqrt{k} \cdot \sigma_k \cdot \lambda \sqrt{k}\cdot 1\\\nonumber \stackrel{(\rm{c})}{\leq} & \|X\| \lambda_{\max} \tilde{k} \sigma_{\tilde{k}} \stackrel{(\rm{d})}{=} \|X\| \tilde{\psi}, \end{align} where (a) follows from Lemma \ref{lem:convex}, (b) follows from the fact that $\hat{H}$ has at most $k$ nonzero columns with unit-norm, (c) follows from the property that $\lambda \leq \lambda_{\max}$, $k \leq \tilde{k}$ and $\sigma_{k} \leq \sigma_{\tilde{k}}$, and (d) follows from the definition of $\tilde{\psi}$. Then Lemma \ref{lem:psi} follows. \end{proof} \begin{lemma}\label{lem:inverse} $\P_{\hat{V}} (I-\P_{W_{\bar{\I}}})\P_{\hat{V}}$ is an injection from $\P_{\hat{V}}$ to $\P_{\hat{V}}$, and its inverse operation is $(I+\sum_{i=1}^\infty (\P_{\hat{V}}\P_{W_{\bar{\I}}}\P_{\hat{V}})^i)$. \end{lemma} \begin{proof} Since $\|\P_{\hat{V}}\P_{W_{\bar{\I}}}\P_{\hat{V}}\| <1$ from Lemma \ref{lem:psi}, then $(I+\sum_{i=1}^\infty (\P_{\hat{V}}\P_{W_{\bar{\I}}}\P_{\hat{V}})^i)$ is well defined. For any $X \in \P_{\hat{V}}$, we have \begin{align} &\P_{\hat{V}}(I-\P_{W_{\bar{\I}}})\P_{\hat{V}}(I+\sum_{i=1}^\infty (\P_{\hat{V}}\P_{W_{\bar{\I}}}\P_{\hat{V}})^i)(X)\nonumber\\=&\P_{\hat{V}}(I-\P_{\hat{V}}\P_{W_{\bar{\I}}}\P_{\hat{V}})(I+\sum_{i=1}^\infty (\P_{\hat{V}}\P_{W_{\bar{\I}}}\P_{\hat{V}})^i)(X)\nonumber\\ =& \P_{\hat{V}}(X)=X. \end{align} Then the lemma follows. \end{proof} \subsection{Proof of Lemma \ref{lem:certificate}} \begin{proof} We need to show that $Q$ defined in (\ref{eqn:Q}) satisfies all the conditions in (\ref{eqn:cond}). We first summarize some properties that will be used in the proof. Since $W$ has unit-norm columns, $|W^\dag _i W_j| \leq \mu$ for all $i \neq j$, and $|\bar{\I}|\leq k$, we have \begin{equation}\label{eqn:WI} \|W_{\bar{\I}}\|=\sqrt{\lambda_{\max}(W_{\bar{\I}}^\dag W_{\bar{\I}})} \leq \sqrt{1+(k-1)\mu}, \end{equation} where the inequality follows from the Ger\v{s}hgorin circle theorem. From $|\bar{\I}|\leq k$ and $|W^\dag _i W_j| \leq \mu$ for all $i \neq j$, we have $\|(W_{\bar{\I}}^\dag W_{\bar{\I}^c})\|_{\infty,2} \leq \sqrt{k} \mu$. Since $\hat{H}$ has at most $k$ unit-norm columns while other columns are zero, we have \begin{equation}\label{eqn:lambdaH} \|\lambda \hat{H} \| \leq \lambda \sqrt{k}. \end{equation} Step 1: verification of (a) of (\ref{eqn:cond}). \begin{equation}\label{eqn:U} \P_{U'}(Q)\stackrel{(\rm{a})}{=}\P_{\bar{U}}(Q)= \bar{U}\hat{V}^\dagger+\P_{\bar{U}}(\Phi)-\P_{\bar{U}}(\Phi)-0= \bar{U}\hat{V}^\dagger, \end{equation} where (a) follows from (\ref{eqn:space}). From (\ref{eqn:UU'}), we have \begin{equation} \nonumber \hat{V}\hat{V}^\dag =V' U'^\dag \bar{U} \bar{U}^\dag U' V'^\dagger\stackrel{(\rm{b})}{=}V' U'^\dag U'U'^\dag U' V'^\dagger=V'V'^\dagger, \end{equation} where (b) follows from (\ref{eqn:UU'}). Thus, $\P_{V'}(\cdot)=\P_{\hat{V}}(\cdot)$. Then \begin{align}\label{eqn:V} \P_{V'}(Q)&=\P_{\hat{V}}(Q)\stackrel{(\rm{c})}{=} \bar{U}\hat{V}^\dagger+\P_{\hat{V}}(\Phi)-\P_{\hat{V}}\P_{\bar{U}}(\Phi) \nonumber\\&- \P_{\hat{V}} (I-\P_{W_{\bar{\I}}})\P_{\hat{V}}(I+\sum_{i=1}^\infty (\P_{\hat{V}}\P_{W_{\bar{\I}}}\nonumber\\ & \P_{\hat{V}})^i)\P_{\hat{V}} \P_{\bar{U}^\perp}(\Phi)\nonumber\\ &\stackrel{(\rm{d})}{=} \bar{U}\hat{V}^\dagger+\P_{\hat{V}}(\Phi)-\P_{\hat{V}}\P_{\bar{U}}(\Phi)-\P_{\hat{V}} \P_{\bar{U}^\perp}(\Phi) \nonumber\\ &=\bar{U}\hat{V}^\dagger. \end{align} (c) follows since $\P_{W_{\bar{\I}}}$, $\P_{\hat{V}}$, and $\P_{\hat{V}}\P_{W_{\bar{\I}}}\P_{\hat{V}}$ are all given by right matrix multiplication, while $\P_{\bar{U}^\perp}$ is given by left matrix multiplication. (d) follows from Lemma \ref{lem:inverse}. Combining (\ref{eqn:U}) and (\ref{eqn:V}), we obtain that (a) of (\ref{eqn:cond}) holds. Step 2: verification of (b) of (\ref{eqn:cond}). \begin{align}\label{eqn:stp2} &\|\P_{T'^{\perp}}(Q)\|=\|\P_{\hat{V}^{\perp}}\P_{\bar{U}^{\perp}}(\Phi)-\nonumber \\ & \quad \P_{\bar{U}^{\perp}}\P_{\hat{V}^\perp}(I-\P_{W_{\bar{\I}}})\P_{\hat{V}}(I+\sum_{i=1}^\infty (\P_{\hat{V}}\P_{W_{\bar{\I}}}\P_{\hat{V}})^i)\P_{\hat{V}}(\Phi)\|\nonumber \\ \leq & \|\Phi\|+ (1+\sum_{i=1}^{\infty}\psi^i)\|\Phi\| = \frac{2-\psi}{1-\psi} \|\Phi\|\nonumber\\ \stackrel{(\rm{e})}{\leq} & \frac{2-\psi}{1-\psi} \|\lambda\hat{H} \|\|(W_{\bar{\I}}^\dag W_{\bar{\I}})^{-1}\| \|W_{\bar{\I}}^T\| \nonumber\\ \stackrel{(\rm{f})}{\leq} & \frac{2-\psi}{1-\psi}\lambda \sqrt{k} \sigma_k \sqrt{1+(k-1)\mu}\\ \stackrel{(\rm{g})}{\leq} & \frac{2-\tilde{\psi}}{1-\tilde{\psi}} \sqrt{\frac{\tilde{\psi}}{\tilde{k}\sigma_{\tilde{k}}}} \sqrt{\tilde{k}} \sigma_{\tilde{k}} \sqrt{1+(\tilde{k}-1)\mu}\\ \stackrel{(\rm{h})}{\leq}& \frac{2-\tilde{\psi}}{1-\tilde{\psi}} \sqrt{\tilde{\psi}} \sqrt{\frac{1+(\tilde{k}-1)\mu}{1-(\tilde{k}-1)\mu}}\\ \stackrel{(\rm{i})}{\leq} & \frac{2-\tilde{\psi}}{1-\tilde{\psi}} \sqrt{\tilde{\psi}} \sqrt{\frac{1+c}{1-c}} \stackrel{(\rm{j})}{\leq} 1 \nonumber. \end{align} where (e) follows from the definition of $\Phi$, and (f) follows from (\ref{eqn:WI}) and (\ref{eqn:lambdaH}). (g) follows from the property that $\psi \leq \tilde{\psi}$, $1 \leq k \leq \tilde{k}$, $\lambda \leq \lambda_{\max,\tilde{k}}$, and $\sigma_k \leq \sigma_{\tilde{k}}$. (h) follows from Lemma \ref{lem:sigmak}. (i) follow from $\tilde{k}\mu \leq c$, and (j) follows from (\ref{eqn:psistar}). Then (b) of (\ref{eqn:cond}) holds. Step 3: verification of (c) of (\ref{eqn:cond}). First consider \begin{align} &(\Delta_2W^{\ddagger})_{\bar{\I}}\nonumber\\ =& (\P_{\bar{U}^\perp}(I-\P_{W_{\bar{\I}}})\P_{\hat{V}}(I+\sum_{i=1}^\infty (\P_{\hat{V}}\P_{W_{\bar{\I}}}\P_{\hat{V}})^i)\P_{\hat{V}}(\Phi) W^{\ddagger})_{\bar{\I}}\nonumber\\ \stackrel{(\rm{k})}{=}& (\P_{\bar{U}^\perp}\P_{\hat{V}}(I+\sum_{i=1}^\infty (\P_{\hat{V}}\P_{W_{\bar{\I}}}\P_{\hat{V}})^i)\P_{\hat{V}}(\Phi))(I-\nonumber\\ & W^{\ddagger}_{\bar{\I}}(W_{\bar{\I}}^T W^{\ddagger}_{\bar{\I}})^{-1}W_{\bar{\I}}^T)W^{\ddagger}_{\bar{\I}} =0 \nonumber \end{align} where (k) holds since $\P_{W_{\bar{\I}}}$, $\P_{\hat{V}}$, and $\P_{\hat{V}}\P_{W_{\bar{\I}}}\P_{\hat{V}}$ are all given by right matrix multiplication, while $\P_{\bar{U}^\perp}$ is given by left matrix multiplication. Then \begin{align} (QW^{\ddagger})_{\bar{\I}}&=(\bar{U}\hat{V}W^{\ddagger}+\Phi W^{\ddagger} -\P_{\bar{U}}(\Phi)W^{\ddagger})_{\bar{\I}}-(\Delta_2W^{\ddagger})_{\bar{\I}}\nonumber \\ &= \bar{U}\hat{V} W^{\ddagger}_{\bar{\I}}+\Phi W^{\ddagger}_{\bar{\I}}-\P_{\bar{U}}(\Phi)W^{\ddagger}_{\bar{\I}}-0\nonumber\\ &\stackrel{(\rm{l})}{=} \lambda \bar{U}\bar{U}^\dag \hat{H}+\lambda \hat{H}- \lambda \bar{U}\bar{U}^\dag \hat{H}\nonumber\\ &=\lambda \hat{H} \in \lambda \G(C'), \end{align} where (l) follows from Lemma \ref{lem:convex} and the definition of $\Phi$ in (\ref{eqn:phi}). Then (c) of (\ref{eqn:cond}) holds. Step 4: verification of (d) of (\ref{eqn:cond}). First consider \begin{align} &\|(\Delta_2W^{\ddagger})_{\bar{\I}^c}\|_{\infty,2}\nonumber\\ =& \|\P_{\bar{U}^\perp}\P_{\hat{V}}(I+\sum_{i=1}^\infty (\P_{\hat{V}}\P_{W_{\bar{\I}}}\P_{\hat{V}})^i)\nonumber \\ & \cdot \Phi\hat{V}\hat{V}^\dag(I- W^{\ddagger}_{\bar{\I}}(W_{\bar{\I}}^T W^{\ddagger}_{\bar{\I}})^{-1}W_{\bar{\I}}^T )W^{\ddagger}_{\bar{\I}^c}\|_{\infty,2}\nonumber\\ =& \|\P_{\bar{U}^\perp}\P_{\hat{V}}(I+\sum_{i=1}^\infty (\P_{\hat{V}}\P_{W_{\bar{\I}}}\P_{\hat{V}})^i)\Phi(\hat{V}\hat{V}^\dag W^{\ddagger}_{\bar{\I}^c}- \nonumber\\& \hat{V}\hat{V}^\dag W^{\ddagger}_{\bar{\I}}(W_{\bar{\I}}^T W^{\ddagger}_{\bar{\I}})^{-1}W_{\bar{\I}}^T )W^{\ddagger}_{\bar{\I}^c}\|_{\infty,2}\nonumber\\ \leq & \|I+\sum_{i=1}^\infty (\P_{\hat{V}}\P_{W_{\bar{\I}}}\P_{\hat{V}})^i\|\|\Phi\|\Big(\|\hat{V}\| \|\hat{V} W^{\ddagger}_{\bar{\I}^c}\|_{\infty,2}\nonumber\\ &+ \| \hat{V}\|\hat{V}^\dag W^{\ddagger}_{\bar{\I}}\|\|(W_{\bar{\I}}^\dag W_{\bar{\I}})^{-1}\|\|W_{\bar{\I}}^T W^{\ddagger}_{\bar{\I}^c}\|_{\infty,2}\Big)\nonumber\\ \leq & \frac{\|\Phi\|(\epsilon + \lambda \sqrt{k}\sigma_{k} \sqrt{k}\mu)}{1-\psi}\leq \frac{\epsilon + \lambda k \sigma_{k} \mu}{2-\psi} \leq \frac{\epsilon + \lambda k\sigma_{k}\mu}{2-\tilde{\psi}}, \nonumber \end{align} where the second to last inequality follows from (e) to (j) in step 2. \begin{align} &\|(QW^{\ddagger})_{\bar{\I}^c}\|_{\infty,2}\nonumber\\ =&\|(\bar{U}\hat{V}W^{\ddagger}+\Phi W^{\ddagger} -\P_{\bar{U}}(\Phi)W^{\ddagger}-\Delta_2W^{\ddagger})_{\bar{\I}^c}\|_{\infty,2} \nonumber\\ =& \|\bar{U}\hat{V} W^{\ddagger}_{\bar{\I}^c}+\P_{\bar{U}^\perp}(\Phi)W^{\ddagger}_{\bar{\I}^c}-(\Delta_2W^{\ddagger})_{\bar{\I}^c}\|_{\infty,2}\nonumber\\ \leq &\|\bar{U}\hat{V} W^{\ddagger}_{\bar{\I}^c}\|_{\infty,2}+ \| (I-\bar{U}\bar{U})^\dag \lambda \hat{H} (W_{\bar{\I}}^T W^{\ddagger}_{\bar{\I}})^{-1}W_{\bar{\I}}^T W^{\ddagger}_{\bar{\I}^c} \|_{\infty,2}\nonumber\\ & +\|(\Delta_2W^{\ddagger})_{\bar{\I}^c}\|_{\infty,2}\nonumber\\ \leq &\|\bar{U}\| \|\hat{V} W^{\ddagger}_{\bar{\I}^c}\|_{\infty,2} + \nonumber\\ & \|(I- \bar{U}\bar{U})^\dag \|\|\lambda \hat{H}\|\|(W_{\bar{\I}}^\dag W_{\bar{\I}})^{-1}\|\| W_{\bar{\I}}^T W^{\ddagger}_{\bar{\I}^c} \|_{\infty,2} +\nonumber\\ & \|(\Delta_2W^{\ddagger})_{\bar{\I}^c}\|_{\infty,2}\nonumber\\ \leq & \epsilon+ \lambda \sqrt{k} \sigma_k \sqrt{k}\mu +\nonumber \\ & \frac{\lambda \sigma_{k} \sqrt{k+(k^2-k)\mu} (\epsilon + \sigma_{k} \mu\sqrt{k+(k^2-k)\mu})}{1-\psi}\nonumber\\ \leq & (1+\frac{1}{2-\tilde{\psi}})(\epsilon+ \lambda k \sigma_k \mu) , \nonumber\\ \leq & (1+\frac{1}{2-\tilde{\psi}})(\epsilon+ \lambda \tilde{k} \sigma_{\tilde{k}} \mu), \label{eqn:stp4}\\ \leq & \lambda\nonumber, \end{align} where the last inequality follows from $\lambda \geq \lambda_{\min,\tilde{k}}$. Then (d) of (\ref{eqn:cond}) holds. \end{proof} \subsection{Proof of Lemma \ref{lem:cond1}} \begin{proof} We define \begin{equation*} \tilde{C} = \bar{C}+\P_{\bar{\I}}\P_{\bar{U}}(C^*-\bar{C}) \text{ and } \tilde{L} = \bar{L}-\P_{\bar{\I}}\P_{\bar{U}}(C^*-\bar{C})W^T. \end{equation*} Note that $\P_{\bar{U}}(\tilde{L})=\tilde{L}$, $\P_{\bar{\I}}(\tilde{C})=\tilde{C}$ and $\bar{L}+\bar{C}W^T=\tilde{L}+\tilde{C}W^T$. We further define $N_L=L^*-\bar{L}$, $N_C=C^*-\bar{C}$, and $N^+_C = C^*-\tilde{C}$. Note that $\P_{\bar{\I}^c}(N_C^+)=\P_{\bar{\I}^c}(N_C)$ from the definition of $N^+_C$. Let $E=N_L+N_CW^T$. We have \begin{align}\label{eqn:E} &\|E\|_F = \|L^*+C^*W^T-(\bar{L}+\bar{C}W^T)\|_F \nonumber\\ \le & \|L^*+C^*W^T-M\|_F+\|N\|_F \le 2\eta, \end{align} where the last inequality holds since ($L^*$, $C^*$) is the solution to (\ref{eqn:opt}) and $\|N\|_F \le \eta$. Let $G$ be such that $\|G\|=1$, $\left\langle G, \P_{T^{*{\perp}}}(\Delta W^T) \right\rangle = \|\P_{T^{*{\perp}}}(\Delta W^T)\|_{*}$ and $\P_{T^*}(G)=0$. Let $F$ be such that $F_i=\Delta_i/\|\Delta_i\|_2$ if $i \in \bar{\I}$ and $\Delta_i \neq 0$, and $F_i=0$ otherwise. Then \begin{equation}\label{eqn:worse1} \begin{aligned} &\|\bar{L}\|_*+\lambda\|\bar{C}\|_{1,2} \stackrel{(\rm{m})}{\ge} \|L^*\|_*+\lambda\|C^*\|_{1,2} \\ \stackrel{(\rm{n})}{\ge} & \|\bar{L}\|_*+\lambda\|\bar{C}\|_{1,2}+\langle \P_{\bar{T}}(Q)+G,N_L\rangle+\lambda\langle \P_{\bar{\I}}(QW^{\ddagger})/\lambda \\ &+F,N_C\rangle \\ = & \|\bar{L}\|_*+\lambda\|\bar{C}\|_{1,2}+\|\P_{\bar{T}^{\perp}}(N_L)\|_*+\langle \P_{\bar{T}}(Q),N_L \rangle\\ &+\lambda\|\P_{\bar{\I}^c}(N_C)\|_{1,2}+\langle \P_{\bar{\I}}(QW^{\ddagger}),N_C \rangle \\ = & \|\bar{L}\|_*+\lambda\|\bar{C}\|_{1,2}+\|\P_{\bar{T}^{\perp}}(N_L)\|_*+\lambda\|\P_{\bar{\I}^c}(N_C)\|_{1,2} \\ &-\langle \P_{\bar{T}^{\perp}}(Q),N_L \rangle-\langle \P_{\bar{\I}^c}(QW^{\ddagger}),N_C \rangle+ \langle Q,N_L+N_CW^T \rangle \\ \ge & \|\bar{L}\|_*+\lambda\|\bar{C}\|_{1,2}+(1-\|\P_{\bar{T}^{\perp}}(Q)\|)\|\P_{\bar{T}^{\perp}}(N_L)\|_* \\ &+(\lambda-\|\P_{\bar{\I}^c}(QW^{\ddagger})\|_{\infty,2})\|\P_{\bar{\I}^c}(N_C)\|_{1,2}+\langle Q,E \rangle \\ \ge & \|\bar{L}\|_*+\lambda\|\bar{C}\|_{1,2}+\frac{1}{2}\|\P_{\bar{T}^{\perp}}(N_L)\|_*+\frac{\lambda}{2}\|\P_{\bar{\I}^c}(N_C)\|_{1,2}\\ &-2\eta\|Q\|_F, \end{aligned} \end{equation} where (m) holds because of the optimality of ($L^*$, $C^*$) and (n) holds because of the convexity of the objective function of (\ref{eqn:opt}). We can see that the last inequality of (\ref{eqn:worse1}) follows from (b) and (d) of (\ref{eqn:cond1}). Then we have \begin{equation}\label{eqn:inequa1} \frac{1}{2}\|\P_{\bar{T}^{\perp}}(N_L)\|_*+\frac{\lambda}{2}\|\P_{\bar{\I}^c}(N_C)\|_{1,2}-2\eta\|Q\|_F \le 0. \end{equation} Note that \begin{align} & \|Q\|_F = \|\P_{\bar{T}}(Q)+\P_{\bar{T}^{\perp}}(Q)\|_F \nonumber \\ = & \sqrt{\|\P_{\bar{T}}(Q)\|^2_F+\|\P_{\bar{T}^{\perp}}(Q)\|^2_F} \nonumber\\ = & \sqrt{\|\bar{U} \bar{V}^{\dagger}\|^2_F+\|\P_{\bar{T}^{\perp}}(Q)\|^2_F} \stackrel{(\rm{o})}{\leq} \frac{1}{2}\sqrt{\min(t,p)+3r}, \label{eqn:QF} \end{align} where the last equality follows from (a) of (\ref{eqn:cond1}). The inequality (o) holds from $\|\bar{U} \bar{V}^{\dagger}\|_F = \sqrt{\rm{trace}(\bar{V}\bar{U}^{\dagger}\bar{U}\bar{V}^{\dagger})}=\sqrt{r}$, and \begin{equation}\nonumber \|\P_{\bar{T}^{\perp}}(Q)\|_F \le \textrm{rank}(\P_{\bar{T}^{\perp}}(Q))\cdot\|\P_{\bar{T}^{\perp}}(Q)\|\leq \frac{\sqrt{\min(t,p)-r}}{2}. \end{equation} Since $\theta = \min(t,p)$, combining (\ref{eqn:inequa1}) and (\ref{eqn:QF}), we have \begin{equation}\label{eqn:PNL} \|\P_{\bar{T}^{\perp}}(N_L)\|_F \le \|\P_{\bar{T}^{\perp}}(N_L)\|_* \le 2\eta\sqrt{\theta+3r}, \end{equation} \begin{equation}\label{eqn:PNC} \|\P_{\bar{\I}^c}(N_C)\|_F \le \|\P_{\bar{\I}^c}(N_C)\|_{1,2} \le \frac{2}{\lambda}\eta\sqrt{\theta+3r}. \end{equation} From the definition of $\P_{W_{\bar{\I}}}$ in (\ref{eqn:PWI}), one can check that \begin{equation}\label{eqn:PWIWI} \P_{W_{\bar{\I}}}(\P_{\bar{\I}}(W)^T)= \P_{\bar{\I}}(W)^T. \end{equation} Then we have \begin{equation}\label{eqmain} \begin{aligned} & \P_{\bar{\I}}(N_C^+)W^T = \P_{\bar{\I}}(N_C^+)\P_{\bar{\I}}(W)^T\\ = & \P_{\bar{\I}}(N_C^+)\P_{W_{\bar{\I}}}(\P_{\bar{\I}}(W)^T)=\P_{\bar{\I}}(N_C^+)\P_{W_{\bar{\I}}}(W^T)\\ = & \P_{W_{\bar{\I}}}(N_C^+W^T-\P_{\bar{\I}^c}(N_C^+)W^T)\\ \stackrel{(\rm{p})}{=} & \P_{W_{\bar{\I}}}(E-\P_{\bar{T}^{\perp}}(N_L)-\P_{\bar{T}}(N_L)-\P_{\bar{\I}}\P_{\bar{U}}(N_C)W^T \\ & -\P_{\bar{\I}^c}(N_C^+)W^T)\\ \stackrel{(\rm{q})}{=} & \P_{W_{\bar{\I}}}(E-\P_{\bar{T}^{\perp}}(N_L)-\P_{\bar{T}}(E)+\P_{\bar{T}}(N_CW^T)\\ & -\P_{\bar{\I}}\P_{\bar{U}}(N_C)W^T-\P_{\bar{\I}^c}(N_C^+)W^T) \\ = & \P_{W_{\bar{\I}}}(\P_{\bar{T}^{\perp}}(E)-\P_{\bar{T}^{\perp}}(N_L)-\P_{\bar{\I}^c}(N_C)W^T\\ & +\P_{\bar{T}}(\P_{\bar{\I}}(N_C)W^T)+\P_{\bar{T}}(\P_{\bar{\I}^c}(N_C)W^T)\\ &-\P_{\bar{\I}}\P_{\bar{U}}(N_C)W^T)\\ \stackrel{(\rm{r})}{=} & \P_{W_{\bar{\I}}}(\P_{\bar{T}^{\perp}}(E)-\P_{\bar{T}^{\perp}}(N_L)-\P_{\bar{\I}^c}(N_C)W^T+\\ & \P_{\bar{T}}(\P_{\bar{\I}^c}(N_C)W^T)+\P_{\bar{U}}(\P_{\bar{\I}}(N_C)W^T)+\\ &\P_{\bar{V}}(\P_{\bar{\I}}(N_C)\P_{\bar{\I}}(W)^T)-\P_{\bar{U}}\P_{\bar{V}}(\P_{\bar{\I}}(N_C)W^T)\\ &-\P_{\bar{\I}}\P_{\bar{U}}(N_C)W^T)\\ \stackrel{(\rm{s})}{=} & \P_{W_{\bar{\I}}}(\P_{\bar{T}^{\perp}}(E)-\P_{\bar{T}^{\perp}}(N_L)-\P_{\bar{\I}^c}(N_C)W^T+\\ & \P_{\bar{T}}(\P_{\bar{\I}^c}(N_C)W^T)+\P_{\bar{V}}(N_C\P_{\bar{\I}}(W)^T)-\P_{\bar{V}}(\P_{\bar{\I}^c}(N_C)\\ & \P_{\bar{\I}}(W)^T) - \P_{\bar{U}}\P_{\bar{V}}(\P_{\bar{\I}}(N_C)W^T))\\ \stackrel{(\rm{t})}{=} & \P_{W_{\bar{\I}}}(\P_{\bar{T}^{\perp}}(E)-\P_{\bar{T}^{\perp}}(N_L)-\P_{\bar{\I}^c}(N_C)W^T+\\ & \P_{\bar{T}}(\P_{\bar{\I}^c}(N_C)W^T)+\P_{\bar{V}}(N_C^+\P_{\bar{\I}}(W)^T)). \end{aligned} \end{equation} where (p) and (q) follow from the definition $E=N_L+N_CW^T$ and $N^+_C = N_C - \P_{\bar{\I}}\P_{\bar{U}}(N_C)$. (r) follows the definition of $\P_{\bar{T}}$. (s) holds because $\P_{\bar{U}}(\P_{\bar{\I}}(N_C)W^T)=\P_{\bar{\I}}\P_{\bar{U}}(N_C)W^T$. (t) holds because of the equality (\ref{eqn:sec2}) shown as follows: \begin{equation}\label{eqn:sec2} \begin{aligned} & \P_{\bar{V}}(N_C\P_{\bar{\I}}(W)^T)-\P_{\bar{U}}\P_{\bar{V}}(\P_{\bar{\I}}(N_C)\P_{\bar{\I}}(W)^T) \\ = & \P_{\bar{V}}(N_C\P_{\bar{\I}}(W)^T-\P_{\bar{\I}}\P_{\bar{U}}(N_C)\P_{\bar{\I}}(W)^T) \\ = & \P_{\bar{V}}(N_C^+\P_{\bar{\I}}(W)^T) \end{aligned} \end{equation} Note that \begin{align} & \|\P_{W_{\bar{\I}}}\P_{\bar{V}}(N_C^+\P_{\bar{\I}}(W)^T)\|_F\nonumber\\ = & \|\P_{W_{\bar{\I}}}\P_{\bar{V}}(N_C^+\P_{W_{\bar{\I}}}\P_{\bar{\I}}(W)^T)\|_F\nonumber\\ = & \|N_C^+\P_{\bar{\I}}(W)^TW^{\ddagger}_{\bar{\I}}(W_{\bar{\I}}^{T}W^{\ddagger}_{\bar{\I}})^{-1}W_{\bar{\I}}^{T}\bar{V}\bar{V}^{\dagger}W^{\ddagger}_{\bar{\I}}(W_{\bar{\I}}^{T}W^{\ddagger}_{\bar{\I}})^{-1}W_{\bar{\I}}^{T}\|_F\nonumber\\ \stackrel{(\rm{u})}{\leq} & \|N_C^+\P_{\bar{\I}}(W)^T\|_F\| \bar{V}^{\dagger}W^{\ddagger}_{\bar{\I}}(W_{\bar{\I}}^{T}W^{\ddagger}_{\bar{\I}})^{-1}W_{\bar{\I}}^{T}\bar{V}\|\nonumber\\ = & \|N_C^+\P_{\bar{\I}}(W)^T\|_F\|\bar{V}\bar{V}^{\dagger}W^{\ddagger}_{\bar{\I}}(W_{\bar{\I}}^{T}W^{\ddagger}_{\bar{\I}})^{-1}W_{\bar{\I}}^{T}\bar{V}\bar{V}^{\dagger}\|\nonumber\\ = & \psi\|\P_{\bar{\I}}(N_C^+)W^T\|_F \leq \tilde{\psi}\|\P_{\bar{\I}}(N_C^+)W^T\|_F, \nonumber \end{align} where the first equality holds from (\ref{eqn:PWIWI}), and (u) holds because $\|AB\|_F \leq \|A\|_F\|B\|$ and $\|A^\dag A\|=\|AA^\dag\|$ for matrices $A$ and $B$. From (\ref{eqmain}), we have \begin{align} & \|\P_{\bar{\I}}(N_C^+)W^T\|_F \nonumber \\ \le & (\|\P_{\bar{T}^{\perp}}(E)\|_F+\|\P_{\bar{T}^{\perp}}(N_L)\|_F+\|\P_{\bar{T}^{\perp}}(\P_{\bar{\I}^c}(N_C)W^T)\|_F) \nonumber\\ & \|W^{\ddagger}_{\bar{\I}}(W_{\bar{\I}}^{T}W^{\ddagger}_{\bar{\I}})^{-1}W_{\bar{\I}}^{T}\|+\tilde{\psi}\|\P_{\bar{\I}}(N_C^+)W^T\|_F \nonumber\\ \le & \|E\|_F+\|\P_{\bar{T}^{\perp}}(N_L)\|_F+\|\P_{\bar{\I}^c}(N_C)\|_F\|W\| +\nonumber\\ & \tilde{\psi}\|\P_{\bar{\I}}(N_C^+)W^T\|_F, \label{eqn:PINCW} \end{align} where the last inequality uses the property that $\|W^{\ddagger}_{\bar{\I}}(W_{\bar{\I}}^{T}W^{\ddagger}_{\bar{\I}})^{-1}W_{\bar{\I}}^{T}\|=1$. From similar arguments as in (\ref{eqn:WI}), we have $\|W\| \le \sqrt{1+(n-1)\mu}$. Then combining (\ref{eqn:E}), (\ref{eqn:PNL}), (\ref{eqn:PNC}), and (\ref{eqn:PINCW}), we obtain \begin{align}\label{eqn:PNCW} & \|\P_{\bar{\I}}(N_C^+)W^T\|_F \le (1+\frac{\lambda+\sqrt{1+(n-1)\mu}}{\lambda}\sqrt{\theta+3r})\frac{2\eta}{1-\tilde{\psi}}. \end{align} Furthermore, \begin{equation}\label{eqn:ineq1}\nonumber \begin{aligned} & \|\P_{\bar{\I}}(N^+_C)\|_F = \|\P_{\bar{\I}}(N^+_C)W^TW^{\ddagger}_{\bar{\I}}(W^T_{\bar{\I}}W^{\ddagger}_{\bar{\I}})^{-1}\|_F\\ \le & \|\P_{\bar{\I}}(N^+_C)W^T\|_F\|W^{\ddagger}_{\bar{\I}}\|\|(W^T_{\bar{\I}}W^{\ddagger}_{\bar{\I}})^{-1}\|\\ \le & (1+\frac{\lambda+\sqrt{1+(n-1)\mu}}{\lambda}\sqrt{\theta+3r})\frac{2\eta\sigma_k\sqrt{1+(k-1)\mu}}{1-\tilde{\psi}}, \end{aligned} \end{equation} where the last inequality follows from (\ref{eqn:PNCW}), (\ref{eqn:WI}), and (\ref{eqn:sigmak}). We also have \begin{equation}\label{eqn:ineq2}\nonumber \begin{aligned} & \|N^+_CW^T\|_F = \|\P_{\bar{\I}^c}(N_C)W^T+\P_{\bar{\I}}(N^+_C)W^T\|_F\\ \le & \|\P_{\bar{\I}^c}(N_C)W^T\|_F+\|\P_{\bar{\I}}(N^+_C)W^T\|_F\\ \le & \|\P_{\bar{\I}^c}(N_C)\|_F\|W\|+\|\P_{\bar{\I}}(N^+_C)W^T\|_F\\ \le & (1+\frac{\lambda+(2-\tilde{\psi})\sqrt{1+(n-1)\mu}}{\lambda}\sqrt{\theta+3r})\frac{2\eta}{1-\tilde{\psi}}. \end{aligned} \end{equation} Finally, we have \begin{align} & \|C^*-\tilde{C}\|_F = \|\P_{\bar{\I}^c}(N_C)+\P_{\bar{\I}}(N^+_C)\|_F\nonumber\\ \le & \|\P_{\bar{\I}^c}(N_C)\|_F+\|\P_{\bar{\I}}(N^+_C)\|_F\nonumber\\ \le & (1+(\frac{\lambda+\sqrt{1+(n-1)\mu}}{\lambda}+\frac{1-\tilde{\psi}}{\lambda\sigma_k\sqrt{1+(k-1)\mu}})\sqrt{\theta+3r})\nonumber\\ & \frac{2\eta\sigma_k\sqrt{1+(k-1)\mu}}{1-\tilde{\psi}},\nonumber \end{align} and \begin{align} & \|L^*-\tilde{L}\|_F = \|L^*-\bar{L}+\tilde{C}W^T-\bar{C}W^T\|_F \nonumber\\ = & \|L^*-\bar{L}+C^*W^T-\bar{C}W^T+\tilde{C}W^T-C^*W^T\|_F\nonumber\\ = & \|E-N^+_CW^T\|_F\nonumber \le \|E\|_F+\|N^+_CW^T\|_F\nonumber\\ \le & (2-\tilde{\psi}+\frac{\lambda+(2-\tilde{\psi})\sqrt{1+(n-1)\mu}}{\lambda}\sqrt{\theta+3r})\frac{2\eta}{1-\tilde{\psi}}.\nonumber \end{align} \end{proof} \subsection{Proof of Lemma \ref{lem:certificate1}} \begin{proof} Since equalities (a) and (c) of (\ref{eqn:cond1}) are the same as those in (\ref{eqn:cond}) and the construction of $Q$ remains the same, then (a) and (c) of (\ref{eqn:cond1}) have been proved in step 1 and 3 of the proof of Lemma \ref{lem:certificate}. We only need to show that (b) and (d) hold when $\lambda$ belongs to [$\lambda'_{\text{min},\tilde{k}}$, $\lambda'_{\text{max},\tilde{k}}$]. From (\ref{eqn:stp2}), that is proved in the proof of Lemma \ref{lem:certificate}, and $\lambda \leq \lambda'_{\text{max},\tilde{k}}$, we have \begin{equation}\nonumber \|\P_{T'^{\perp}}(Q)\| \leq \frac{2-\tilde{\psi}}{1-\tilde{\psi}}\lambda \sigma_{\tilde{k}} \sqrt{\tilde{k}+(\tilde{k}^2-\tilde{k})\mu} \leq \frac{1}{2}. \end{equation} From (\ref{eqn:stp4}) and $\lambda \geq \lambda'_{\text{min},\tilde{k}}$, we have \begin{equation}\nonumber \|(QW^{\ddagger})_{\bar{\I}^c}\|_{\infty,2} \leq (1+\frac{1}{2-\tilde{\psi}})(\epsilon+ \lambda \tilde{k} \sigma_{\tilde{k}} \mu) \leq \frac{\lambda}{2}. \end{equation} \end{proof} \section{Conclusion}\label{sec:con} We address the problem of detecting successive unobservable cyber data attacks to PMU measurements. We formulate the identification problem as a matrix decomposition problem of a low-rank matrix and a transformed column-sparse matrix. We propose a convex-optimization-based method and provide its theoretical guarantee. Although motivated by power system monitoring, our results on matrix decomposition can be applied to other scenarios. One future direction is the analysis of the detection performance when some of the measurements are lost during the communication to the central operator. \section*{Acknowledgement} We thank New York Power Authority for providing PMU data for the Central NY Power System. This research is supported in part by the ERC Program of NSF and DoE under the supplement to NSF Award EEC-1041877 and the CURENT Industry Partnership Program, and in part by NSF Grant 1508875, NYSERDA Grants \#36653 and \#28815. \section{Introduction}\label{sec:intro} \IEEEPARstart{T}{he} integration of cyber infrastructures into future smart grids greatly enhances the monitoring, dispatch, and scheduling of power systems. Such integration, however, makes the power systems more susceptible to cyber attacks. It is reported that cyber spies have penetrated U.S. electrical grid \cite{meserve07}. Researchers have also launched an experimental cyber attack that caused a generator to self-destruct \cite{HLEO09}. State estimation \cite{AE04} is a critical component of power system monitoring. System state is estimated based on the obtained measurements across the system. Bad data can affect the state estimation and mislead the system operator. Many efforts have been devoted to develop methods that can identify bad data, see e.g., \cite{CA06,HSKF75,MG83,MS71,XWCT13}. Cyber data attacks (firstly studied in \cite{LNR11}) can be viewed as ``the worst interacting bad data injected by an adversary''\cite{KJTT10}. Malicious intruders with system configuration information can simultaneously manipulate multiple measurements so that these attacks cannot be detected by any bad data detector. Because the removal of affected measurements would make the system unobservable, these attacks are termed as ``unobservable attacks''\footnote{The term ``unobservable'' is used in this sense throughout the paper.} in \cite{KJTT10}. State estimation in the presence of cyber data attacks has attracted much research attention recently \cite{BRWKNO10,DS10,KJTT10,LEDEH14,LNR11,SJ13,STJ10,TKPC11}. Existing approaches include protecting a small number of key measurement units such that the intruders cannot inject unobservable attacks without hacking protected units \cite{BRWKNO10,DS10,KP11}, as well as detectors designed for attacks in the observable regime \cite{KJTT10}. The research on the detection of unobservable attacks is still limited. Refs. \cite{SJ13,LEDEH14} proposed different methods to detect unobservable attacks in Supervisory Control and Data Acquisition (SCADA) system. The method in \cite{SJ13} relies critically on the assumption that the measurements at different time instants are i.i.d. samples of random variables. This assumption might not hold when the system is under disturbance. Ref. \cite{LEDEH14} focused on the scenarios that an intruder attacks a different set of measurements at each time instant, and no theoretical analysis of the detection performance is provided in \cite{LEDEH14}. This paper considers cyber data attacks to PMU measurements. It focuses on the case when an intruder injects unobservable data attacks to the same set of PMUs constantly. Because PMUs under attack do not provide any accurate measurement at any time instant to the operator, the attack identification in this case is very challenging and has not been addressed before. We propose a method that can identify the successive unobservable cyber data attacks and provide the theoretical guarantee even when the system is under disturbance. The intuition is that even though an intruder can constantly inject data attacks that are consistent with each other at each time instant, as long as the intruder does not know the system dynamics, one can identify the attacks by comparing time series of different PMUs and locating the PMUs that exhibit abnormal dynamics. Because PMU measurements are synchronized and correlated, the high-dimensional PMU data matrix exhibits low-rank property \cite{CXK13,DKM12,GWGC14,WGGCFSR14}. We formulate the identification problem as a matrix decomposition problem of a low-rank matrix plus a transformed column-sparse matrix. The matrix decomposition problem has attracted much research attention recently, see e.g., \cite{CLMW11,CSPW11,RFP10,XCS12}, and have wide applications in areas like Internet monitoring \cite{LCD04,MMG13,TJ03}, medical imaging \cite{FNDRL06,GCSZ11}, and image processing \cite{BJ03}. The situation that one component is a transformed column-sparse matrix, however, has not been addressed before. The contributions of this paper are threefold. (1) We propose the idea of exploiting spatial-temporal correlations in PMU measurements to identify unobservable data attacks. (2) We formulate the identification problem into a matrix decomposition problem and propose a computationally efficient method that does not require the modeling of power system dynamics. (3) We provide theoretical guarantees of attack detection, as well as the general matrix decomposition problem. The rest of the paper is organized as follows. We formulate our problem and point out its connection to other applications in Section \ref{sec:model}. We describe our detection method and analyze its theoretical guarantee with both noiseless (Section \ref{sec:method}) and noisy measurements (Section \ref{sec:method1}). Section \ref{sec:simu} records our numerical experiments. We conclude the paper in Section \ref{sec:con}. \section{Attack Identification without Noise}\label{sec:method} \subsection{Identification method and guarantee}\label{sec:analysis} \floatname{algorithm}{Method} \begin{algorithm} \begin{algorithmic} \REQUIRE PMU measurements $M$ in $t$ instants; coefficient $\eta$; the set $\Omega$ of the locations $(i,j)$ of the observed entries. \STATE Find ($L^*$, $C^*$), the optimum solution to the following optimization problem \begin{equation} \label{eqn:opt1} {\hspace{-0.2in}\min\limits_{L \in \C^{t\times p}, C\in \C^{t \times n}} \| L\|_{*} + \lambda \|C\|_{1,2} } \end{equation} \begin{equation}\label{eqn:opt} \textrm{s.t.} \quad \sum_{i,j \in \Omega}|M_{ij}-L_{ij}-(CW^T)_{ij}|^2 \le \frac{|\Omega|}{tp}\eta^2 \end{equation} \STATE Compute the SVD of $L^*=U^* \Sigma^* V^{* \dagger}$. \STATE Find column support of $D^*=C^*W^T$, denoted by $\J^*$. \RETURN $L^*$, $C^*$, $L^*_{\J^{*c}}$, $U^*$ and $\J^*$. \end{algorithmic} \caption{Unobservable cyber attack identification method} \end{algorithm} We first consider noiseless measurements ($\eta=0$). We assume a complete set of measurements for analysis, but our method can be extended to cases when measurements are partially lost. Moreover, although we consider attack patterns in (\ref{eqn:state}), our method can be generalized to detect combined attacks. In this case, $\bar{D}$ is generalized to \begin{equation}\label{eqn:Dg} \bar{D}=\bar{C}W^T+\bar{S}, \end{equation} where a sparse matrix $\bar{S}$ represents attacks (observable and/or unobservable) that have different locations across time. Then (\ref{eqn:opt1})-(\ref{eqn:opt}) are generalized to \begin{equation} \label{eqn:opt3} {\hspace{-0.2in}\min\limits_{L \in \C^{t\times p}, C\in \C^{t \times n}, S \in \C^{t\times p}} \| L\|_{*} + \lambda_1 \|C\|_{1,2} } + \lambda_2 \sum_{ij} |S_{ij} | \end{equation} \begin{equation}\label{eqn:opt4} \textrm{s.t.} \quad \sum_{i,j \in \Omega}|M_{ij}-L_{ij}-(CW^T)_{ij}-S_{ij}|^2 \le \frac{|\Omega|}{tp}\eta^2, \end{equation} with given positive constants $\lambda_1$, $\lambda_2$. We study this extension numerically in Section \ref{sec:compare}. To formally present the theoretical result, we need the following definitions. Given $\bar{L}=\bar{U}\bar{\Sigma}\bar{V}^\dagger$ and $W$, we define \begin{equation} \epsilon:=\|\bar{V}^\dag W^{\ddagger}\|_{\infty,2}, \text{ } \mu:=\max_{i \neq j}\|W_i^{\dagger} W_j\|, \end{equation} \begin{equation} \label{eqn:sigmak} \text{ and } \sigma_k:=\max_{\I: |\I| \leq k}\| (W^{\dagger}_\I W_\I)^{-1}\|. \end{equation} Note that $\sigma_1=1$ as $W$ has unit-norm columns, and $\epsilon$ depends on the rank $r$ of $\bar{L}$, since $\|\bar{V}\|_{F}^2=r$. Pick any constants $\tilde{\psi}$ and $c$ in $(0,1)$ such that \begin{equation}\label{eqn:psistar} (2-\tilde{\psi})\sqrt{\tilde{\psi}}/(1-\tilde{\psi}) \leq \sqrt{(1+c)/(1-c)}. \end{equation} For any integer $k$, define \begin{equation}\label{eqn:lambdamin} \lambda_{\min,k}=\frac{(1+(2-\tilde{\psi})^{-1})\epsilon}{1-(1+(2-\tilde{\psi})^{-1})k\sigma_k\mu} \end{equation} \begin{equation}\label{eqn:lambdamax} \text{ and } \lambda_{\max,k}=\sqrt{\tilde{\psi}/(k\sigma_k)}. \end{equation} Our detection method is summarized in Method 1. (\ref{eqn:opt}) is a convex program and can be solved efficiently by generic solvers such as CVX\cite{CVX}. Its recovery guarantee is as follows. \begin{theorem}\label{thm:recover} Suppose there exists nonzero $\tilde{k}$ such that \begin{equation} \tilde{k} \mu \leq c, \textrm{ and } \lambda_{\min,\tilde{k}} \leq \lambda_{\max,\tilde{k}}, \end{equation} with $c$, $\lambda_{\min,\tilde{k}}$, and $\lambda_{\max,\tilde{k}}$ defined in (\ref{eqn:psistar})-(\ref{eqn:lambdamax}). Then as long as the column support of $\bar{C}$ has size at most $\tilde{k}$, for any $\lambda \in [\lambda_{\min,\tilde{k}}, \lambda_{\max,\tilde{k}}]$, the output of Method 1 satisfies \begin{equation} \label{eqn:space} U^*U^{*\dag}=\bar{U} \bar{U}^\dag, \end{equation} \begin{equation} \J^*=\bar{\J}\label{eqn:index} \text{ and } L^*_{\J^{*c}}=\bar{L}_{\bar{\J}^{c}}. \nonumber \end{equation} \end{theorem} Theorem \ref{thm:recover} guarantees that the affected PMUs can be correctly located and thus, the ``clean'' PMU measurements could be identified. Furthermore, the subspace spanned by the actual phasors can be recovered. Since we do not obtain any actual measurements from PMUs that are under attack, it is impossible to recover the exact measurements in the affected PMUs without further regularization. Under the conditions of Theorem \ref{thm:recover}, the recovery is also successful when the column support of $\bar{C}$ is zero. Thus, the false alarm rate is zero. Method 1 is motivated by \cite{XCS12}. In fact, after post-multiplying $W^{\ddagger} (W^TW^{\ddagger})^{-1}$ to both sides of (\ref{eqn:M}), we have \begin{equation} \nonumber MW^{\ddagger} (W^TW^{\ddagger})^{-1}=\bar{L}W^{\ddagger} (W^TW^{\ddagger})^{-1} + \bar{C} + NW^{\ddagger} (W^TW^{\ddagger})^{-1} \end{equation} where the right-hand side is the sum of a low-rank matrix plus a column-sparse matrix and noise. Then, the results of \cite{XCS12} can be directly applied to our problem. We do not follow this path due to two reasons. First, $MW^{\ddagger}(W^TW^{\ddagger})^{-1}$ cannot be computed if some entries of $M$ are missing, while Method 1 can be easily extended to scenarios with missing data by restricting the constraints in (\ref{eqn:opt}) to the observed measurements. Second, $(W^TW^{\ddagger})^{-1}$ does not exist when $W$ is a flat matrix, i.e., $p < n$, while Method 1 and Theorem \ref{thm:recover} can be applied to an arbitrary $W$. \subsection{Discussion of $\lambda$ and $\tilde{k}$}\label{sec:lambda} We remark that due to the slackness in the proof, $\lambda \in [\lambda_{\min,\tilde{k}}, \lambda_{\max,\tilde{k}}]$ in Theorem \ref{thm:recover} is sufficient but not necessary\footnote{Specially, the requirements on dual certificate in Lemma \ref{lem:certificate} are sufficient but not necessary. Furthermore, we use loose bounds in the proofs to simplify analysis. $\epsilon$, $\mu$, and $\sigma_k$ are in turn defined based on worst-case scenarios.}. There may exist $\lambda$ outside $[\lambda_{\min,\tilde{k}}, \lambda_{\max,\tilde{k}}]$ that can still lead to correct recovery. We observe from numerical experiments that recovery performance is generally much better than the bound in Theorem \ref{thm:recover}. Furthermore, when $L$ is fixed, as $\tilde{k}$ decreases, $\lambda_{\min,\tilde{k}}$ decreases, and $\lambda_{\max,\tilde{k}}$ increases. Thus, intuitively, if the number of affected PMUs decreases, a wider range of $\lambda$ is proper for Method 1. For a detailed discussion, we state the following lemma and defer its proof to the Appendix. \begin{lemma}\label{lem:sigmak} Suppose $k\mu < 1$, then $\sigma_k \leq (1-(k-1)\mu)^{-1}$. \end{lemma} Since $\sigma_k$ increases in $k$, $\sigma_1 \geq 1$, and $k \mu \leq c<1$, together with Lemma \ref{lem:sigmak}, we know $\sigma_{\tilde{k}} = \Theta(1)$\footnote{We use the notations $g(n)\in O(h(n))$, $g(n) \in \Omega(h(n))$, or $g(n)=\Theta(h(n))$ if as $n$ goes to infinity, $g(n) \leq c \cdot h(n)$, $g(n) \geq c \cdot h(n)$ or $c_1 \cdot h(n) \leq g(n) \leq c_2 \cdot h(n)$ eventually holds for some positive constants $c$, $c_1$ and $c_2$ respectively.}. Since $\tilde{\psi}$ is a constant, one can check that $\lambda_{\min,\tilde{k}}= \Theta(\epsilon)$, and $\lambda_{\max,\tilde{k}}= \Theta(\sqrt{1/\tilde{k}})$. Note that $\|\bar{V}^ {\dagger}\|_F^2 =r$. We assume that $\|\bar{V}^ {\dagger}\|$ is column-incoherent \cite{XCS12} with some positive constant $\rho>1$, i.e., \begin{equation}\label{eqn:rho} \|\bar{V}^ {\dagger}\|_{\infty, 2} \le \sqrt{\rho r/p}. \end{equation} We assume the number of PMU channels incident to each bus is in the range of $[d, Cd]$ for some $d>0$ and some constant $C$. This is also the number of nonzero entries in each column of $W$ with unit column-norm. Then $p=\Theta(dn)$, and we have \begin{align} \epsilon = \|\bar{V}^\dag W^{\ddagger}\|_{\infty,2} \leq & \sqrt{\frac{\rho r}{p}} \max_{i} \sum_{j} |W_{ij}| = O(\sqrt{\frac{r}{n}}). \label{eqn:ep} \end{align} Therefore, as long as $\tilde{k} =O(n/r)$, when $n$ is sufficiently large, $\lambda_{\min,\tilde{k}} \leq \lambda_{\max,\tilde{k}}$. $\tilde{k} \mu \leq c$ requires that $\tilde{k} =O(1/\mu)$. Note that $\mu= \Theta(\frac{1}{d})$. Thus, if both $\tilde{k} =O(n/r)$ and $\tilde{k}=O(d)$ hold, then a proper $\lambda$ exists, and Theorem \ref{thm:recover} holds. In the case that $d= \Theta(n)$, $\tilde{k}$ could be $\Theta(n/r)$. If $r$ is a constant, our method succeeds even when a constant fraction of bus voltages are corrupted. Also consider the case that $\tilde{k}=1$. We pick $\tilde{\psi}$ and $c$ in (\ref{eqn:psistar}) arbitrarily close to one, then $\lambda=1$ is a proper choice (see Fig. \ref{fig:case2} for results on actual PMU data) provided that $\epsilon +\mu \leq 0.5$. Since $\epsilon$ scales as $1/\sqrt{n}$ and $\mu$ scales as $1/d$, the condition will be met in large systems that are tightly connected. Intuitively, $\mu$ is small if the bus degree is high, and the line impedances are in the same range. \begin{figure}[h] \begin{center} \includegraphics[height=0.4\linewidth]{Mesh_ring.eps} \caption{$n$-bus ring network} \label{fig:mesh} \end{center} \end{figure} We next use an example to illustrate the existence of proper $\lambda$. Consider an $n$-bus ($n$ is even) ring network in Fig.~\ref{fig:mesh}. Each odd-numbered bus is connected to all even-numbered buses. There is no connection among odd buses and no connection among even-numbered buses. A PMU is installed on each odd bus and measures the corresponding voltage phasor and all incident line current phasors. For the simplicity of analysis, we assume $Z^{ij}=1$ and $Y^{ij}=0$ in this ring network. $W$ is a $(\frac{n^2}{4}+\frac{n}{2}) \times n$ matrix with unit norm columns. Specifically, for every integer $k$, $W_{ij} = \begin{cases} \sqrt{2/(n+2)}, & \mbox{if }i\in \mathcal{I}_{k1}\mbox{ and }j=2k-1 \\ -\sqrt{2/n}, & \mbox{if }i\in \mathcal{I}_{k2}\mbox{ and }j=2k \\ 0, & \mbox{otherwise} \end{cases}$, \noindent where \begin{equation*} \mathcal{I}_{k1}:=\left\{ k+(k-1)\frac{n}{2}+k' ~|~ \textrm{interger } k'=0,1,2,...,\frac{n}{2} \right\}, \end{equation*} \begin{equation*} \mathcal{I}_{k2}:=\left\{ k+1+(\frac{n}{2}+1)k' ~|~ \textrm{interger }k'=0,1,2,...,\frac{n}{2}-1 \right\}. \end{equation*} Note that $|\I_{k1}|=\frac{n}{2}+1$, $|\I_{k2}|=\frac{n}{2}$ for all $k$. Here, $\mu=2/\sqrt{n^2+2n}$. Then we have \begin{equation}\label{eqn:column} (V^{\dagger}W^{\ddagger})_j = \begin{cases} \sqrt{2/(n+2)}\sum_{i\in \mathcal{I}_{k1}}(V^{\dagger})_i, & \mbox{if }j=2k-1 \\ -\sqrt{2/n}\sum_{i\in \mathcal{I}_{k2}}(V^{\dagger})_i, & \mbox{if }j=2k \end{cases}, \end{equation} where $V \in \C^{(\frac{n^2}{4}+\frac{n}{2}) \times r}$ contains the right singular vectors of the rank-$r$ measurement matrix $\bar{L} \in \C^{t \times (\frac{n^2}{4}+\frac{n}{2})}$. If $\|\bar{V}^ {\dagger}\|$ is column-incoherent \cite{XCS12} with some positive constant $\rho$, then \begin{align} \epsilon = \|\bar{V}^\dag W^{\ddagger}\|_{\infty,2} \leq & \max \big(\sqrt{\frac{2}{n+2}} |\I_{k1}|, \sqrt{\frac{2}{n}} |\I_{k2}|\big) \cdot\|\bar{V}^ {\dagger}\|_{\infty, 2} \nonumber \\ \leq & \sqrt{\frac{n+2}{2} }\cdot \sqrt{\frac{\rho r}{(\frac{n}{2}+1)\frac{n}{2}}} \leq \sqrt{\frac{2\rho r}{n}}, \label{eqn:ep1} \end{align} where the first inequality follows from (\ref{eqn:column}), and the second inequality follows from (\ref{eqn:rho}). To find $\lambda$, we pick $c=1/4$ and $\tilde{\psi}=1/8$. We choose $\tilde{k} = \frac{n}{48\rho r}$. One can check that (\ref{eqn:psistar}) follows. Then \begin{equation} \tilde{k} \mu = \frac{n}{48\rho r} \times \frac{2}{\sqrt{n^2+2n}} \leq \frac{1}{24 \rho r} \leq \frac{1}{24} \leq \frac{1}{4}=c, \end{equation} where the last inequality follows since $\rho>1$ and $r \geq 1$. Then from Lemma \ref{lem:sigmak}, we have \begin{equation} \sigma_{\tilde{k}} \leq (1-(\tilde{k}-1)\mu)^{-1} \leq (1-\tilde{k} \mu)^{-1} \leq 24/23. \end{equation} From (\ref{eqn:lambdamin}) and (\ref{eqn:lambdamax}), \begin{equation} \lambda_{\min,\tilde{k}}\leq \frac{(1+(2-\tilde{\psi})^{-1})\epsilon}{1-(1+(2-\tilde{\psi})^{-1})\tilde{k}\mu \sigma_{\tilde{k}}} \leq \frac{23\epsilon}{14} \leq \frac{23}{14}\sqrt{\frac{2\rho r}{n}} . \end{equation} \begin{equation} \lambda_{\max,\tilde{k}}= \sqrt{\frac{1/8}{\frac{n}{48\rho r} \sigma_{\tilde{k}}}} \geq \frac{1}{2} \sqrt{\frac{23\rho r}{n}}. \end{equation} Since $\frac{23}{14}\sqrt{\frac{2\rho r}{n}} <\frac{1}{2}\sqrt{\frac{23\rho r}{n}}$, then $\lambda_{\min,\tilde{k}}<\lambda_{\max,\tilde{k}}$. Then there exists $\lambda$ such that Method 1 correctly identifies the corruptions in up to $\tilde{k} = \frac{n}{48\rho r}$ bus voltages. In fact, any $\lambda \in [\frac{23}{14}\sqrt{\frac{2\rho r}{n}},\frac{1}{2}\sqrt{\frac{23\rho r}{n}}]$ suffices. Note that for a constant $r$, $\tilde{k}$ is linear in $n$, the total number of buses. \subsection{Proof sketch of Theorem \ref{thm:recover}} The proof of Theorem \ref{thm:recover} follows the same line as the proof of Theorem 1 in \cite{XCS12}. With the additional projection matrix $W$, our proof is more involved than the one in \cite{XCS12}. Like \cite{XCS12}, we design the following Oracle Problem (\ref{eqn:oracle}) by adding explicit constraints that the solution pair should have the correct column space of $\bar{L}$ and the correct column support of $\bar{C}$. The major step is to show that an optimal solution ($L^*$,$C^*$) to (\ref{eqn:opt}) is also an solution to the Oracle problem (\ref{eqn:oracle}). Note that Oracle problem is only designed for analysis, since $\bar{U}$ and $\bar{\I}$ are unknown to the operator. \begin{equation}\label{eqn:oracle} \begin{tabular}{p{0.9in}p{0.1 in}p{1.6 in}} Oracle Problem & $\min\limits_{L, C}$ & $\| L\|_{*} + \lambda \|C\|_{1,2}$ \\ & s.t. & $M = L+ C W^T $\\ && $\P_{\bar{U}}(L)=L$, $\P_{\bar{\I}}(C)=C$. \end{tabular} \end{equation} Let $(L', C')$ be an optimal solution to the Oracle problem (\ref{eqn:oracle}). We define $\P_{T'} := \P_{U'} +\P_{V'}-\P_{U'}\P_{V'}$, where the SVD of $L'= U' \Sigma' V'^{\dag}$. Define \begin{align}\nonumber \G(C'):=\{ H \in \C^{t \times k} ~|~ \forall i\in \I' : H_i= C_i'/\|C_i'\| ; \\ \forall i \in \bar{\I} \cap (\I')^c: \|H_i\|_2 \leq 1\},\nonumber \end{align} where $\I'$ is the column support of $C'$. We have \begin{lemma}[Lemma 4 and Lemma 5 of \cite{XCS12}] \begin{equation} \nonumber U'U'^\dag=\bar{U}\bar{U}^\dag. \end{equation} There exists an orthonormal matrix $\hat{V} \in \C ^{t \times p}$ such that \begin{equation}\label{eqn:UU'} U' V'^\dag =\bar{U} \hat{V}^\dag. \end{equation} Also, we have \begin{equation}\nonumber \P_{T'}:= \P_{U'}+\P_{V'}-\P_{U'}\P_{V'}=\P_{\bar{U}}+\P_{\hat{V}}-\P_{\bar{U}}\P_{\hat{V}}. \end{equation} \end{lemma} The following lemma establishes that the solution to the Oracle problem (\ref{eqn:oracle}) is also a solution to (\ref{eqn:opt}), \begin{lemma}\label{lem:cond} An optimal solution $(L', C')$ to (\ref{eqn:oracle}) is an optimal solution to (\ref{eqn:opt}) if there exists $Q \in \C^{t\times p}$ that satisfies \begin{equation}\label{eqn:cond} \begin{aligned} &(a) \P_{T'} (Q) = U' V'^{\dagger}, \quad\quad (b) \| \P_{T'^{\perp}} (Q)\| \leq 1 ,\\ &(c) (QW^{\ddagger})_{\bar{\I}}/\lambda \in \G(C'), \quad \textrm{and }(d) \|(QW^{\ddagger})_{\bar{\I}^c} \|_{\infty,2} \leq \lambda. \end{aligned} \end{equation} If both (b) and (d) are strict, and $\P_{\bar{\J}} \cap \P_{V'}=\{0\}$, then any optimal solution $(L^*,C^*)$ to (\ref{eqn:opt}) satisfies $\P_{\bar{U}}(L^*)=L^*$, $\P_{\bar{\I}}(C^*)=C^*$. \end{lemma} The major technical step is to construct $Q$, called the \textit{dual certificate}, that satisfies (\ref{eqn:cond}). Our construction method is as follows. Pick $\hat{H} \in \G(C')$ that satisfies \begin{equation}\label{eqn:hath} \hat{V}^\dag W^{\ddagger}_{\bar{\I}} = \lambda\bar{U}^\dag \hat{H}. \end{equation} Define \begin{equation}\label{eqn:phi} \Phi := \lambda \hat{H} (W_{\bar{\I}}^{T}W^{\ddagger}_{\bar{\I}})^{-1}W_{\bar{\I}}^{T}, \text{ } \Delta_1:=\P_{\bar{U}}(\Phi), \end{equation} \begin{equation} \label{eqn:delta2} \Delta_2:=\P_{\bar{U}^\perp}(I-\P_{W_{\bar{\I}}})\P_{\hat{V}}(I+\sum_{i=1}^\infty (\P_{\hat{V}}\P_{W_{\bar{\I}}}\P_{\hat{V}})^i)\P_{\hat{V}}(\Phi), \end{equation} \begin{equation} \label{eqn:PWI} \text{ where } \P_{W_{\bar{\I}}}(X):= X W^{\ddagger}_{\bar{\I}}(W_{\bar{\I}}^{T}W^{\ddagger}_{\bar{\I}})^{-1}W_{\bar{\I}}^{T}. \end{equation} \begin{equation}\label{eqn:Q} \quad \quad Q:= \bar{U} \hat{V}^\dag +\Phi-\Delta_1-\Delta_2. \end{equation} We show that $Q$ in (\ref{eqn:Q}) is well defined in Appendix-B. Lemma \ref{lem:certificate} shows that $Q$ in (\ref{eqn:Q}) is the desired dual certificate. \begin{lemma}\label{lem:certificate} Suppose there exists nonzero $\tilde{k}$ such that $\tilde{k} \mu \leq c$ for $c$ in (\ref{eqn:psistar}), and $\lambda_{\min,\tilde{k}} \leq \lambda_{\max,\tilde{k}}$ with $\lambda_{\min,\tilde{k}}$ and $\lambda_{\max,\tilde{k}}$ defined in (\ref{eqn:lambdamin}) and (\ref{eqn:lambdamax}). Then as long as the column support of $\bar{C}$ has size at most $\tilde{k}$, for any $\lambda \in [\lambda_{\min,\tilde{k}}, \lambda_{\max,\tilde{k}}]$, $Q$ defined in (\ref{eqn:Q}) satisfies (\ref{eqn:cond}). \end{lemma} Theorem \ref{thm:recover} follows when we combine Lemmas \ref{lem:cond} and \ref{lem:certificate}. Please refer to the Appendix for the proofs. \section{Problem Formulation and Related Work} \label{sec:model} \subsection{Low-rankness of PMU measurements}\label{sec:pmu} Consider a $n$-bus power grid with PMUs installed on some buses. Let $p$ denote the total number of PMU channels that measure bus voltage and line current phasors\footnote{In three phase AC systems, a phasor is defined as a complex number that represents both the magnitude and phase angle of the sinusoidal waveforms.}. Phasors are expressed in Cartesian coordinates throughout the paper. Matrix $M \in \C^{t\times p}$ contains the collected phasor measurements in $t$ synchronized time instants. $\bar{\J} \in \lsem p \rsem$ denotes the set of PMU channels that are under data attacks. The observed measurement matrix can be presented as \begin{equation}\label{eqn:M} M=\bar{L}+\bar{D}+N, \end{equation} where $\bar{L} \in \C^{t\times p}$ represents the actual phasors without data attacks, $\bar{D}\in \C^{t\times p}$ represents the additive errors introduced by an intruder, and $N$ represents the measurement noise. High-dimensional PMU data matrices exhibit low-rank property \cite{CXK13,DKM12,GWGC14,WGGCFSR14}. We analyzed actual PMU data from six multi-channel PMUs deployed in the Central New York (NY) Power System (Fig.~\ref{fig:NY}). Six PMUs measure twenty-three voltage and current phasors, and the data rate is thirty samples per second per channel. Fig.~\ref{fig:current} shows the current magnitudes of PMU data in twenty seconds. An event occurs around $2.5$s. The obtained data are collected into a $600 \times 23$ matrix. Fig.~\ref{fig:svd} plots the singular values of the matrix with the ten largest ones being 832.8, 194.8, 35.1, 18.1, 4.3, 2.5, 2.1, 1.3, 1.2, 0.5. Therefore, we can approximate the $600 \times 23$ matrix by a low-rank matrix with little approximation error. \begin{figure}[h] \begin{center} \includegraphics[height=0.43 \linewidth]{CNYPS.eps} \caption{PMUs in the Central NY Power System. (Circles and lines represent buses and transmission lines. A PMU measures the voltage phasor and the incident current phasors of the bus where it is located.)} \label{fig:NY} \end{center} \end{figure} \begin{figure}[h] \begin{center} \psfrag{Current Magnitude}[][][0.7]{Current magnitude} \psfrag{Time(s)}[][][0.7]{Time(s)} \vspace{-5mm} \includegraphics[height=0.28\linewidth]{Mag_and_angle.eps} \caption{Visualization of Partial PMU data (Magnitude of nine current phasors)} \label{fig:current}\vspace{-5mm} \end{center} \end{figure} \begin{figure}[t] \begin{center} \psfrag{Singular value index}[][][0.7]{Singular value index} \psfrag{Singular values}[][][0.7]{Singular values} \includegraphics[height=0.28\linewidth]{Low_Rank_new.eps} \caption{Singular values of PMU data matrix in decreasing order} \label{fig:svd} \end{center} \end{figure} The Singular Value Decomposition (SVD) of $\bar{L}$ is \begin{equation} \bar{L}=\bar{U}\bar{\Sigma}\bar{V}^ {\dagger}, \end{equation} where $\bar{U}\in \C^{t\times r}$, $\bar{\Sigma}\in \C^{r\times r}$, $\bar{V}\in \C^{p \times r}$ ($r \ll t, p$). We assume throughout the paper that nonzero columns of $\bar{D}$ do not lie in the column space of $\bar{L}$ ($\bar{D} \neq \bar{U} \bar{U}^\dag \bar{D}$). It is a legitimate assumption when the intruders do not have full information about the system dynamics. The notations are summarized in Table \ref{tbl:notation}. Matrix $A$ is \textit{column-sparse} if it contains a small fraction of non-zero columns. We call the set of indices of nonzero columns the \textit{column support} of $A$. \begin{table}[h] \caption{Notations} \begin{tabular}{|p{0.55in} p{2.71in}|} \hline $A_i$, $A_{i,:}$ & the $i$th column and the $i$th row of matrix $A$, respectively. \\ \hline $A_{\I}$ & the submatrix of $A$ with column indices in set $\I$. \\ \hline $A^{\ddagger}$, $A^{\dagger}$ & the conjugate and conjugate transpose matrix of $A$.\\ \hline $\P_{\I}(A)$ & matrix obtained from $A$ by setting $A_i$ to zero for all $i \notin \I$. \\ \hline $A \in \P_{\I}$ & if and only if $\P_{\I}(A)=A$.\\ \hline $\|A\|$, $\|A\|_{F}$ & the spectral and Frobenius norm of $A$, respectively. \\ \hline $\|A\|_{*}$ & the nuclear norm of $A$, which is the sum of singular values. \\ \hline $\|A\|_{1,2}$ & the sum of $\ell_2$ norms of the columns of $A$. \\ \hline $\|A\|_{\infty, 2}$ & the largest $\ell_2$ norm of the columns. \\ \hline $\P_{U} (A)$ & $:= U U^\dag A$, the projection of $A$ onto the column space of $L$. \\ \hline $\P_{V} (A)$ & $:= A V V^\dag$, the projection of $A$ onto the row space. \\ \hline $\P_{T} (\cdot)$ & $:=\P_{U} (\cdot)+\P_{V} (\cdot) - \P_{U}\P_{V}(\cdot)$. \\ \hline $\P_{U^\perp} (A)$ & $:= (I-U U^\dag)A$. \\ \hline $\P_{V^\perp} (A)$ & $:= A(I- V V^\dag)$. \\ \hline $\P_{T^\perp} (A)$ & $:= \P_{U^\perp}\P_{V^\perp} (A)$.\\ \hline $A \in \P_{T}$ & if and only if $\P_{T}(A)=A$.\\ \hline $\I^c$ & the complimentary set of set $\I$. \\ \hline \end{tabular} \label{tbl:notation} \end{table} \subsection{Unobservable cyber data attacks and problem formulation} We use bus voltage phasors as state variables, and let $X \in \C^{t\times n}$ contain the state variables at $t$ instants. We use the $\pi$ equivalent model to represent a transmission line (Fig.~\ref{fig:pi}). $Z^{ij}$ and $Y^{ij}$ denote the impedance and admittance of the transmission line between bus $i$ and bus $j$. Current $I^{ij}$ from bus $i$ to bus $j$ is related to bus voltage $V^i$ and $V^j$ by \begin{equation} I^{ij}=\frac{V^i- V^j}{Z^{ij}}+V^i \frac{Y^{ij}}{2}. \end{equation} \begin{figure}[h] \begin{center} \includegraphics[height=0.2\linewidth]{Pi_model.eps} \caption{$\pi$ model of a transmission line} \label{fig:pi} \vspace{-3 mm} \end{center} \end{figure} We define $\bar{W} \in \C^{p \times n}$ as follows. If the $k$th PMU channel measures the voltage phasor of bus $j$, $\bar{W}_{kj}=1$; if it measures the current phasor from bus $i$ to bus $j$, then $\bar{W}_{ki}=1/Z^{ij}+Y^{ij}/2$, $\bar{W}_{kj}=-1/Z^{ij}$; $\bar{W}_{kj}=0$ otherwise. The PMU measurements and the state variables are related by \begin{equation}\label{eqn:linear} \bar{L}= X \bar{W}^T. \end{equation} The attack at time $t$, denoted by data injection $\bar{D}_{t,:}$, is called \textit{unobservable}\footnote{\cite{LNR11} focuses on DC model where power measurements and state variables are approximately related by linear equations. Here PMU measurements and state variables are accurately related by linear equation (\ref{eqn:linear}).} if and only if \begin{align} & \bar{D}_{t,:}=c^t\bar{W}^T \end{align} holds for some nonzero row vector $c^t \in \C^{1\times n}$. In this case, \begin{align} &\bar{L}_{t,:}+\bar{D}_{t,:}=(X_{t,:}+ c^t) \bar{W}^T, \end{align} and the operator would have the wrong impression that the state is $X_{t,:}+ c^t$. We focus on the cases that the attacks from time 1 to $t$ are all unobservable\footnote{ Our detection method can be extended to cases that both unobservable and observable attacks exist. See the beginning of Section \ref{sec:analysis}}, then we have \begin{equation} \label{eqn:state} \bar{D}=\left[\begin{array}{c} c^1\\ \vdots\\ c^t \end{array}\right]\bar{W}^T:= \bar{C} W^T, \end{equation} where $W_j=\bar{W}_j/\|\bar{W}_j\|$. $\bar{C}$ represents the additive error (up to a scaling factor) to bus voltages due to data attacks, i.e., $\|\bar{W}_j\|\bar{C}_j$ is the error to bus voltage $V^j$. Let $\bar{\I} \in \lsem n \rsem$ denote the column support of $\bar{C}$. We assume $\bar{C}$ is column-sparse because intruders might only alter some of the state variables due to resource constraints. With increasing installation of PMUs, we anticipate that the total number of PMU channels $p$ will be larger than the number of buses $n$. The transform in (\ref{eqn:state}) reduces the degree of freedom in $\bar{D}$. Combining (\ref{eqn:M}) and (\ref{eqn:state}), the obtained measurements under attack can be written as \begin{equation}\label{eqn:problem} M=\bar{L}+\bar{C}W^T+N. \end{equation} The attack identification problem is formulated as follows. Given $M$ and $W$, is it possible to separate $\bar{L}$ and $\bar{C}$? We assume noise level is bounded and given, i.e., $\|N\|_{F}\leq \eta$. We say a method can \textit{identify} an unobservable attack if it successfully determines the set of PMU channels that are under attack and recovers measurements that are not attacked. Although cannot be detected at a given time instant, the unobservable attacks can be detected if the time series in the affected PMU channels exhibit dynamics different from those of unaffected PMUs. Mathematically, the matrix decomposition is possible if columns in $\bar{D}$ do not belong to the column space of $\bar{L}$. \begin{figure}[h] \begin{center} \includegraphics[height=0.45\linewidth]{PMU_model.eps} \caption{Three-bus example. PMUs are installed at bus 1 and bus 2 measuring the corresponding voltage phasors and incident line current phasors. } \label{fig:example} \vspace{-5mm} \end{center} \end{figure} We use a three-bus network (Fig.~\ref{fig:example}) to illustrate the notations. Let $\V^i$ and $\bfI^{ij}$ ($i,j\in\{1,2,3\}$) in $\C^{t \times 1}$ denote the bus voltages and line currents in $t$ instants. Then \begin{align} \bar{L} &= [\bfV^1 \ \bfI^{12} \ \bfI^{13} \ \bfV^2 \ \bfI^{21} \ \bfI^{23}]= [\V^1 \ \V^2 \ \V^3] \bar{W}^T \end{align} where $\bar{W}^T$ is \begin{equation}\nonumber \notag \left[ \begin{array}{ccccccc} 1 & \frac{1}{Z^{12}}+\frac{Y^{12}}{2} & \frac{1}{Z^{13}}+\frac{Y^{13}}{2} & 0 & -\frac{1}{Z^{12}} & 0\\ 0 & -\frac{1}{Z^{12}} & 0 & 1 & \frac{1}{Z^{12}}+\frac{Y^{12}}{2}& \frac{1}{Z^{23}}+\frac{Y^{23}}{2}\\ 0 & 0 & -\frac{1}{Z^{13}} & 0 & 0 & -\frac{1}{Z^{23}} \end{array}\right]. \end{equation} Suppose the intruder manipulates measurements in all channels of PMU 1 and the channel of PMU 2 that measures $\bfI^{21}$ and $\bfI^{23}$ so that the system operator would have the wrong impression that the system states are $[\V^1 +\bm\beta^1 \ \V^2 \ \V^3+\bm\beta^2]$ for any nonzero $\bm\beta^1$, $\bm\beta^2 \in \C^{t\times 1}$. In this case, the observed measurements under attacks when there is no noise are \begin{align} &M = [\V^1 +\bm\beta^1 \ \ \V^2 \ \ \V^3+\bm\beta^2] \bar{W}^T \nonumber \\ & = [\V^1 +\bm\beta^1 \ \ \bfI^{12}+\frac{\bm\beta^1}{Z^{12}}+\frac{\bm\beta^1Y^{12}}{2} \ \ \bfI^{13}+\frac{\bm\beta^1-\bm\beta^2}{Z^{13}}+\frac{\bm\beta^1Y^{13}}{2}\nonumber \\ & \quad \quad \V^2 \ \ \bfI^{21}-\bm\beta^1/Z^{12} \ \ \bfI^{23}-\bm\beta^2/Z^{23}]. \end{align} The additive errors due to attacks are \begin{align} \bar{D} =[ \bm\beta^1 \ \ \bm 0 \ \ \bm\beta^2]\bar{W}^T= [\|\bar{W}_1\|\bm\beta^1 \ \ \bm 0 \ \ \|\bar{W}_3\|\bm\beta^2]W^T. \end{align} \subsection{Connections to existing work}\label{sec:app} The detection of unobservable cyber data attacks has not been much addressed. \cite{SJ13} and \cite{LEDEH14} considered the detection of unobservable attacks to SCADA data and provided numerical results. \cite{SJ13} assumes the measurements across time are i.i.d. distributed and detects the attacks based on statistical learning. \cite{LEDEH14} assumes the SCADA measurements under DC power flow model are low-rank and proposes to detect the attacks by decomposing a low-rank matrix and a sparse matrix from their sum. Our work differs from \cite{LEDEH14} in that we assume the intruder constantly injects data attacks to the same set of PMUs, while \cite{LEDEH14} assumes the intruder attacks different PMUs at different time instants. Furthermore, we provide the theoretical guarantee of our detection method. Our problem formulation of matrix decomposition is closely related to those in \cite{XCS12} and \cite{MMG13}. When $W$ is an identity matrix, our problem reduces to the one in \cite{XCS12}. The difference between our model and the one in \cite{MMG13} is that the sparse matrix $\bar{C}$ in \cite{MMG13} has nonzero entries located independent of each other, while $\bar{C}$ here is a column-sparse matrix. Our method and analysis are built up those in \cite{XCS12}, but we consider a more general framework of matrix decomposition through the introduction of the transform matrix $W$. The significance of our work is twofold. First, we for the first time consider the case that the additive error matrix $\bar{D}$ can be dense (i.e., $W$ is a dense matrix), while the error matrices in \cite{XCS12} and \cite{MMG13} are sparse. We show through both theoretical analysis and numerical experiments that it is possible to achieve matrix decomposition with dense $\bar{D}$. Second, when $\bar{D}$ is a column-sparse matrix itself (i.e., $W$ is sparse), our decomposition method outperforms those in \cite{XCS12} and \cite{MMG13} (see Section \ref{sec:compare} and \ref{sec:PMU}) in the sense that our recovery method can tolerate a higher level of corruption (i.e., large support size of $\bar{D}$). This advance results from exploiting (\ref{eqn:state}), which reduces the degree of freedom of $\bar{D}$. Note that our method and analysis hold for an arbitrary $W$ and can be applied to other domains that involve decomposing a matrix as in (\ref{eqn:problem}). As discussed in \cite{MMG13}, applications include unveiling network traffic anomalies \cite{LCD04,TJ03}, dynamic magnetic resonance imaging \cite{FNDRL06,GCSZ11}, face recognition \cite{BJ03}, and music analysis \cite{LGWWCM09,LW07}. \section{Attack Identification with Noise}\label{sec:method1} We now analyze the detection performance when $M$ contains noise ($N \neq 0$) with $\|N\|_F \le \eta$. Given $k$, define \begin{equation}\nonumber \lambda'_{\min,k}=\frac{(1+(2-\tilde{\psi})^{-1})\epsilon}{1/2-(1+(2-\tilde{\psi})^{-1})k\sigma\mu}, \text{ and } \lambda'_{\max,k}= \frac{1}{2}\sqrt{\frac{\tilde{\psi}}{k\sigma_k}}. \end{equation} \begin{theorem}\label{thm:recover1} Suppose there exists nonzero $\tilde{k}$ such that $\tilde{k} \mu \leq c$ for $c$ in (\ref{eqn:psistar}), and $\lambda'_{\min,\tilde{k}} \leq \lambda'_{\max,\tilde{k}}$. Then if column support size of $\bar{C}$ is at most $\tilde{k}$, for any $\lambda \in [\lambda'_{\min,\tilde{k}}, \lambda'_{\max,\tilde{k}}]$, there exists a pair $(\tilde{L}$, $\tilde{C})$, where $\tilde{L}+\tilde{C}W^T = \bar{L}+\bar{C}W^T$, $\P_{\bar{U}}(\tilde{L})=\tilde{L}$ and $\P_{\bar{\I}}(\tilde{C})=\tilde{C}$, such that the output of Method 1 satisfies \begin{align}\label{eqn:L}\nonumber & \|L^*-\tilde{L}\|_F \\ \le & (2-\tilde{\psi}+\frac{\lambda+(2-\tilde{\psi})\sqrt{1+(n-1)\mu}}{\lambda}\sqrt{\theta+3r})\frac{2\eta}{1-\tilde{\psi}}, \end{align} \vspace{-5mm} \begin{align}\label{eqn:C}\nonumber &\text{and }\|C^*-\tilde{C}\|_F \\ \nonumber \le & (1+(\frac{\lambda+\sqrt{1+(n-1)\mu}}{\lambda}+\frac{1-\tilde{\psi}}{\lambda\sigma_k\sqrt{1+(k-1)\mu}})\sqrt{\theta+3r})\\ & \frac{2\eta\sigma_k\sqrt{1+(k-1)\mu}}{1-\tilde{\psi}}, \end{align} where $\theta := \min(t, p)$. \end{theorem} The discussion of the existence of $\lambda$ is very similar to the discussion for Theorem \ref{thm:recover}, so we skip it. If $\tilde{k} \mu \leq c$ and $\tilde{k}=O(n/r)$ hold, then a proper $\lambda$ exists. Theorem \ref{thm:recover1} guarantees that ($L^*$, $C^*$) returned by Method 1 is ``close'' to a pair that has the correct column space and column support, and the distance measured by Frobenius norm is proportional to the noise level $\eta$. The proof of Theorem \ref{thm:recover1} follows the same line as the proof of Theorem 2 in \cite{XCS12} mostly with modifications to address the projection matrix $W$. We establish Lemma \ref{lem:cond1}, a counterpart in the noisy case of Lemma \ref{lem:cond}, that demonstrates that Method 1 succeeds if there exists a dual certificate $Q$ with tighter requirements than that in the noiseless case. \begin{lemma}\label{lem:cond1} There exists $(\tilde{L}$, $\tilde{C})$ where $\tilde{L}+\tilde{C}W^T = \bar{L}+\bar{C}W^T$, $\P_{\bar{U}}(\tilde{L})=\tilde{L}$, $\P_{\bar{\I}}(\tilde{C})=\tilde{C}$, such that the output of Method 1 satisfies (\ref{eqn:L}) and (\ref{eqn:C}), if there exists $Q \in \C^{t\times p}$ that satisfies \begin{equation}\label{eqn:cond1} \begin{aligned} &(a) \P_{\bar{T}} (Q) = \bar{U} \bar{V}^{\dagger}, \quad\quad (b) \| \P_{\bar{T}^{\perp}} (Q)\| \leq 1/2 ,\\ &(c) (QW^{\ddagger})_{\bar{\I}}/\lambda \in \G(\bar{C}), \quad \textrm{and }(d) \|(QW^{\ddagger})_{\bar{\I}^c} \|_{\infty,2} \leq \lambda/2. \end{aligned} \end{equation} \end{lemma} The construction of $Q$ is the same as that in Section \ref{sec:method} (equations (\ref{eqn:hath}) to (\ref{eqn:Q})). We show that $Q$ is the desire dual certificate if $\lambda$ belongs to $[\lambda'_{\min}, \lambda'_{\max}]$ in Lemma \ref{lem:certificate1}. \begin{lemma}\label{lem:certificate1} If the column support size of $\bar{C}$ is at most $\tilde{k}$, then for any $\lambda \in [\lambda'_{\min}, \lambda'_{\max}]$, $Q$ defined in (\ref{eqn:Q}) satisfies (\ref{eqn:cond1}). \end{lemma} Theorem \ref{thm:recover1} follows when we combine Lemmas \ref{lem:cond1} and \ref{lem:certificate1}. Please refer to the Appendix for the proofs. \section{Simulation}\label{sec:simu} We explore the performance of data attack identification methods on both synthetic data and actual PMU data from the Central NY power system. We use CVX \cite{CVX} to solve (\ref{eqn:opt}). We identify a column of $C^*$ to be nonzero if its $\ell_2$ norm exceeds the predefined threshold $\epsilon_1$. Method 1 succeeds if $\|U^*U^{*\dagger}-\bar{U}\bar{U}^{\dagger}\|\leq \epsilon_2$ for some small positive $\epsilon_2$, and the column supports of $\bar{C}$ and $C^*$ are the same. \subsection{Performance on synthetic data} Fix $t=p=50$. Given rank $r$, we generate matrices $A$ $\in$ $\R^{t \times r}$ and $B$ $\in$ $\R^{p \times r}$ with each entry independently drawn from Gaussian $\mathcal{N}(0,1)$ and set $\bar{L} := A B^{T}$. We generate matrix $W$ $\in$ $\R^{p \times n}$ with independent $\mathcal{N}(0,1)$ entries. To generate a column-sparse matrix $\bar{C} \in \R^{t \times n}$, we randomly select the column support and set the nonzero entries to be independent $\mathcal{N}(0,1)$. We vary $r$ and the number of corrupted columns, and take 100 runs for each case. $\lambda$ is set to be 0.95. \subsubsection{Noiseless formulation} We simulate the observed measurement matrix $M$ according to (\ref{eqn:problem}) with $N=0$. We apply Method 1 to obtain the estimation $(L^*,C^*)$. We set $\epsilon_1$ and $\epsilon_2$ to be 0.002 and 0.01, respectively. Fig.~\ref{fig:gray} shows the transition property of Method 1 in gray scale. White stands for 100\% success while black denotes 100\% failure. When $n$ is 25, $W$ is a tall matrix ($p>n$). When $n$ is 100, $W$ is a flat matrix ($p<n$). For both simulations, the identification is successful even when rank $r$ is six, and $\bar{C}$ has two nonzero columns. \begin{figure}[h] \begin{center} \includegraphics[height=0.43\linewidth]{Gray.eps} \caption{Matrix decomposition performance for different $n$} \label{fig:gray} \vspace{-3 mm} \end{center} \end{figure} We further assume some of the observations are missing. We generate $M$ as before and then delete some randomly selected entries. Fig. \ref{fig:graynew} shows the decomposition performance of Method 1 for partial observation. We can see that the successful decomposition rate is close to the complete observation case even only 80\% of the entries are observed. \begin{figure}[h] \begin{center} \includegraphics[height=0.43\linewidth]{Gray_new.eps} \caption{Matrix decomposition performance for different $n$ with 80\% observed entries} \label{fig:graynew} \vspace{-7mm} \end{center} \end{figure} \subsubsection{Noisy formulation} We generate matrix $N \in \R^{t \times p}$ with independent Gaussian $\mathcal{N}(0,\sigma^2)$ entries. We fix the matrix rank $r$ to be 3 and the number of corrupted columns to be 3. We simulate the observed measurement matrix $M$ according to (\ref{eqn:problem}). We set $\eta$ to be $\|N\|_F$ and apply Method 1 to obtain the estimation $(L^*,C^*)$. $\epsilon_1$ is set to be 0.001. \begin{figure}[h] \begin{center} \psfrag{Noise level sigma}[][][0.65]{Noise level $\sigma$} \psfrag{noise level sigma}[][][0.65]{Noise level $\sigma$} \psfrag{Succeed rate}[][][0.65]{Succeed rate} \psfrag{Difference of the column space}[][][0.48]{Difference of the column space} \psfrag{(a) Column space}[][][0.65]{(a) Column space} \psfrag{(b) Set of corrupted columns}[][][0.65]{(b) Set of corrupted columns} \psfrag{difference}[][][0.6]{$\|U^*U^{*\dagger}-\bar{U}\bar{U}^{\dagger}\|$} \includegraphics[height=0.3\linewidth]{U_diff.eps} \caption{Performance of Method 1 for different noise level $\sigma$} \label{fig:udiff} \vspace{-2mm} \end{center} \end{figure} Fig. \ref{fig:udiff} shows the difference between the original and reconstructed column space ($\|U^*U^{*\dagger}-\bar{U}\bar{U}^{\dagger}\|$) and the succeed rate for determining the set of corrupted columns according to different noise level $\sigma$. We can see that Method 1 can successfully identify the corrupted columns when the noise level $\sigma$ is below 0.25. Method 1 can recover the column space with small errors when $\sigma$ is smaller than 0.1. \subsection{Comparison with other methods on synthetic data}\label{sec:compare} \subsubsection{{\small $\bar{D}=\bar{C}W^T$} is column-sparse} Refs. \cite{XCS12} \cite{LEDEH14} considered matrix decomposition problem when $\bar{D}$ is column-sparse and scattered-sparse, respectively. We compare our method with them in the special case that $\bar{D}=\bar{C}W^T$ is column-sparse. Fix $t=p=50$, $n=20$, and $r=2$. We generate $\bar{L}$ and $\bar{C}$ with the same rules as in Section V-A. We generate a binary matrix $W$ $\in$ $\R^{p \times n}$ with two `1's each row and five `1's each column. Then the ratio of support sizes of $\bar{D}$ and $\bar{C}$ is about five. $\bar{D}$ is column-sparse when $\bar{C}$ is column-sparse. We simulate the measurement matrix $M$ according to (\ref{eqn:problem}) with $N=0$. $\lambda$ in our method is set to be 0.9. $\lambda$'s in methods of \cite{XCS12} and \cite{LEDEH14} are set to be 0.5 and 0.1, respectively. \begin{figure}[h] \begin{center} \psfrag{Number of outliers}[][][0.7]{Number of corrupted columns in $\bar{C}$} \psfrag{success rate}[][][0.7]{Success rate} \includegraphics[height=0.35\linewidth]{Compare_new.eps} \caption{Success rates when $\bar{D}=\bar{C}W^T$ is column-sparse.} \label{fig:compare} \vspace{-5mm} \end{center} \end{figure} Fig.~\ref{fig:compare} shows the success rates of three methods with different support sizes of $\bar{C}$. Our method performs the best since we exploit the structure $\bar{D}=\bar{C}W^T$ besides sparsity. The false alarm rate of our method is zero. \subsubsection{Combination of attack patterns.} We consider the general case that the attacks satisfy (\ref{eqn:Dg}). We use the generalized version in (\ref{eqn:opt3})-(\ref{eqn:opt4}) to detect combined attacks. $\lambda_1$ and $\lambda_2$ in (\ref{eqn:opt3}) are set to be 1 and 0.1, respectively. $\lambda$'s in methods of \cite{XCS12} and \cite{LEDEH14} are set to be 0.5 and 0.1, respectively. $\bar{L}$, $\bar{C}$, and $W$ are generated the same as above. $\bar{S}$ is a sparse matrix with nonzero entries independently drawn from $\mathcal{N}(0,1)$. We define the correct estimation of the column space of $\bar{L}$ as a successful recovery. Fig.~\ref{fig:compare2} compares the methods when $\bar{C}$ is a zero matrix. The attacks are scattered-sparse, and our method performs as well as that in \cite{LEDEH14}. Fig.~\ref{fig:compare3} compares the methods when both column-sparse and scattered-sparse attacks exist. Besides a sparse $\bar{S}$, we randomly select two columns in $\bar{C}$ and select their entries independently from $\mathcal{N}(0,1)$. Only our method succeeds when both attacks exist. \begin{figure}[h] \begin{center} \psfrag{Average corruption rate}[][][0.7]{Percentage of corrupted entries in $\bar{S}$} \psfrag{success rate}[][][0.7]{Success rate} \includegraphics[height=0.35\linewidth]{Compare2_new.eps} \caption{Success rates when $\bar{D}=\bar{S}$ is scattered-sparse.} \label{fig:compare2}\vspace{-7mm} \end{center} \end{figure} \begin{figure}[h] \begin{center} \psfrag{Average corruption rate}[][][0.7]{Percentage of corrupted entries in $\bar{S}$ when $\bar{C}$ has two nonzero columns} \psfrag{success rate}[][][0.7]{Success rate} \includegraphics[height=0.35\linewidth]{Compare3.eps} \caption{Success rates when $\bar{D}=\bar{C}W^T+\bar{S}$.} \label{fig:compare3}\vspace{-7mm} \end{center} \end{figure} \subsection{Performance comparison on actual PMU data}\label{sec:PMU} We consider the PMU data shown in Section \ref{sec:pmu}. Two two-second PMU datasets are tested. One contains ambient data, and the other contains an abnormal event ($t = 17-19s$ and $t = 2-4s$ in Fig. \ref{fig:current}, respectively). We first inject data attacks as an intruder and then use Method 1 to detect the attacks. We consider the scenario that an intruder alters the PMU channels that measure $I^{12}$,$I^{52}$,$I^{13}$ and $I^{43}$ in order to corrupt voltage estimations of Buses 2 and 3. Fig.~\ref{fig:attack} visualizes the actual PMU data and the data after the injection of attacks for two 2-second datasets. $\eta$ and $\lambda$ are set to be 5 and 1 respectively in Method 1. Fig.~\ref{fig:PMUfig2} shows the $\ell_2$ norm of each column of the resulting $\bar{D}$ matrix. The columns with significant $\ell_2$ norm correspond to channels that measure $I^{12}$,$I^{52}$,$I^{13}$ and $I^{43}$. Therefore, our method successfully identifies the four PMU channels under attack. We repeat the same experiment when an intruder alters the channels that measure $V^{5}$, $I^{52}$, $I^{54}$, $I^{59}$, and $I^{45}$ to corrupt voltage estimation of Buses 5. Fig.~\ref{fig:PMUfig3} shows the $\ell_2$ norm of each column of the resulting $\bar{C}$ matrix in this case. The column with significant $\ell_2$ norm corresponds Bus 5. Thus the recovery is also successful. \begin{figure}[h] \begin{center} \includegraphics[height=0.33\linewidth]{PMU_attack.eps} \caption{The actual PMU data and PMU data under attack} \label{fig:attack} \vspace{-5mm} \end{center} \end{figure} \begin{figure}[h] \begin{center} \begin{psfrags} \psfrag{l2 norm of the column}[][][0.6]{$\ell_2$ norm of the column} \includegraphics[height=0.33\linewidth]{PMU_fig_3_new.eps} \caption{$\ell_2$ norm of each column of $\bar{D}$} \label{fig:PMUfig2} \vspace{-5 mm} \end{psfrags} \end{center} \end{figure} \begin{figure}[h] \begin{center} \psfrag{l2 norm of the column}[][][0.6]{$\ell_2$ norm of the column} \includegraphics[height=0.33\linewidth]{PMU_fig_5_new.eps} \caption{$\ell_2$ norm of each column of $\bar{C}$} \label{fig:PMUfig3} \vspace{-5 mm} \end{center} \end{figure} {Fig. \ref{fig:case2} compares our method and that in \cite{XCS12} on the ambient PMU data. Given support size of $\bar{C}$, the result is averaged over all possible attack locations. Our method outperforms \cite{XCS12} because we exploit (\ref{eqn:state}) to reduce the degree of freedom in $\bar{D}$. For example, 7 out of 23 channels needs to be attacked to change the state of Bus 1. That means 30\% of the columns of $\bar{D}$ are nonzero. This high percentage of corruption in $\bar{D}$ cannot be handedly by \cite{XCS12}. \begin{figure}[h] \begin{center} \begin{psfrags} \psfrag{Number of buses under attack}[][][0.7]{Number of buses under attack} \psfrag{Success rate}[][][0.7]{Success rate} \includegraphics[height=0.33\linewidth]{case2.eps} \caption{Success rates with varying support size of $\bar{C}$, or equivalently, the number of affected system states. } \label{fig:case2} \end{psfrags} \end{center} \end{figure}
{'timestamp': '2016-07-19T02:05:07', 'yymm': '1607', 'arxiv_id': '1607.04776', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04776'}
arxiv
\section{Introduction}\label{sec:introduction} Quantitative investigations in logic, where properties and behaviour of typical objects are studied, form a rich and well-established branch of mathematics on the border of logic, combinatorics and theoretical computer science. From a combinatorial point of view, logical formulae are objects with finite representations and, sometimes several, naturally associated notions of size. In cases when the assumed size notion imposes finitely many objects of any size, we can consider uniformly random formulae within such a family of objects. Analysing the asymptotic behaviour of the probability that a uniformly random object of size $n$ satisfies a certain property~$P$ as $n$ tends to infinity, yields the notion of asymptotic density of $P$ and, in consequence, leads to investigations how certain natural properties, such as satisfiability etc., behave in the case of typical formulae. There is a long history of using this kind of asymptotic approach applied to logic (see, e.g.~\cite{mtz00, kos-zaionc03, FGGZ07, GK2012}) and recently its computational aspects. In~\cite{dgkrtz}, David et al. initiated quantitative investigations in lambda calculus and combinatory logic. Considering the set of closed $\lambda$-terms in a canonical representation where variables do not contribute to the term size, David et al. showed that typical $\lambda$-terms are strongly normalising whereas in the case of $\S \mathbf{K}$-combinators the situation is precisely opposite -- asymptotically almost no $\S \mathbf{K}$-combinator is strongly normalising. Somewhat contrary to their result, Bendkowski et al. in~\cite{Bendkowski16} considered a different representation of $\lambda$-terms with de~Bruijn indices, showing that similarly to the case of $\S \mathbf{K}$-combinators, asymptotically almost no $\lambda$-term is strongly normalising. Despite many efforts, the associated counting problem for closed $\lambda$-terms is still one of the remaining major open problems. Throughout the years, different variants of lambda calculus have been considered. In~\cite{BGGJ2013}, Bodini et al. studied the enumeration of BCI $\lambda$-terms. John Tromp in~\cite{T2014}, as well as Grygiel and Lescanne in~\cite{JFP:10090684}, considered the counting problem in the so called binary lambda calculus. Recently, in~\cite{gittenberger_et_al:LIPIcs:2016:5741} Gittenberger and Gołębiewski considered $\lambda$-terms in the de~Bruijn notation with various size notions, giving tight lower and upper asymptotic bounds on the number of closed $\lambda$-terms. Due to the lack of bound variables, combinatory logic circumvents the intrinsic issues present in lambda calculus, serving as a minimalistic formalism capable of expressing all lambda-definable functions. Its simple syntax yields a natural representation using plane binary trees with labelled leaves, which greatly facilitates the analysis of asymptotic properties. The paper is organised as follows. In~\autoref{sec:combinatory-logic} we recall preliminary definitions and notation regarding combinatory logic. In the following sections~\ref{sec:combinatorial-classes} and~\ref{sec:generating-functions-and-analytic-tools}, we state basic notions of combinatorial classes and generating functions, listing main tools used to study asymptotic properties of combinators, in particular, the analytic methods of singularity analysis. In~\autoref{sec:basis-independent-results} we study the class of plane binary trees with labelled leaves, deriving basis-independent combinatory logic results as easy corollaries. In~\autoref{sec:sk-combinators} we focus on the $\S \mathbf{K}$-basis proving, inter alia, that for each positive $n$, the set of combinators reducing in $n$ normal-order reduction steps has positive asymptotic density. Finally, in~\autoref{sec:experimental-results} we discuss some experimental results. \section{Combinatory logic}\label{sec:combinatory-logic} Let $\mathcal{B}$ be a finite \emph{basis} of primitive combinators. The set $\class{\mathcal{B}}$ of \emph{$\mathcal{B}$-combinators} is defined inductively as follows. If $\comb{X} \in \mathcal{B}$, then $\comb{X} \in \class{\mathcal{B}}$. If $N, M \in \class{\mathcal{B}}$, then $(N M) \in \class{\mathcal{B}}$. In the latter case, we say that $(N M)$ is an \emph{application} of $N$ to $M$. If the underlying basis is clear from the context, we simply write \emph{combinators} instead of $\mathcal{B}$-combinators. Following standard notational conventions (see, e.g.~\cite{BAR84}), we omit outermost parentheses and drop parentheses from left-associated combinators, e.g.~instead of writing $((M N) (P Q))$ we write $M N (P Q)$. Each primitive combinator $\comb{X} \in \mathcal{B}$ contributes a \emph{reduction rule} of the form \begin{equation*} \comb{X} N_1 \ldots N_m \to M \end{equation*} where $m \geq 1$, $M \in \class{\set{N_1, \ldots, N_m}}$ and $N_1 \ldots N_m$ are arbitrary combinators. In other words, $\comb{X} N_1 \ldots N_m$ \emph{reduces} to some determined combinator $M$ built from $N_1,\ldots,N_m$ and term application. The reduction relation $\to$ is then extended onto all combinators such that if $P \to Q$, then $PR \to QR$ and $RP \to RQ$ for each combinator $R$. Let $P$ be a combinator. If there exists no combinator $Q$ such that $P \to Q$, then $P$ is said to be in \emph{normal form}. If there exists a finite sequence of combinators $P_0,P_1,\ldots,P_k$ such that $P = P_0 \to P_1 \to \ldots \to P_k$ and $P_k$ is in normal form, then $P$ is \emph{weakly normalising}, or simply \emph{normalising}. If there does not exist an infinite sequence of combinators $P_0,P_1,\ldots$ such that $P=P_0 \to P_1 \to \ldots$, then we say that $P$ is \emph{strongly normalising}. Naturally, strong normalisation implies weak normalisation. A major part of combinatory logic is devoted to its simple type theory corresponding to the implicational fragment of minimal logic (see, e.g.~\cite{BAR84}) and hence also to simply typed $\lambda$-calculus (see \cite{Hindley}). In its most common basis $\mathcal{B} = \set{\comb{S},\comb{K}}$, the type-assignment deduction system $TA_{\comb{S} \comb{K}}$ is given by the following two axiom schemes for $\comb{S}$ and $\comb{K}$, with a single \emph{modus ponens} inference rule. \begin{equation}\tag{Axiom $\comb{S}$} \begin{mathprooftree} \AxiomC{} \UnaryInf$\comb{S} : (\alpha \to \beta \to \gamma) \to (\alpha \to \beta) \to \alpha \to \gamma \fCenter$ \end{mathprooftree} \end{equation} \begin{equation}\tag{Axiom $\comb{K}$} \begin{mathprooftree} \AxiomC{} \UnaryInf$\comb{K} : \alpha \to \beta \to \alpha\fCenter$ \end{mathprooftree} \end{equation} \begin{equation}\tag{Modus ponens} \begin{mathprooftree} \AxiomC{$N : \alpha \to \beta$} \AxiomC{$M : \alpha$} \BinaryInf$(N M) : \beta\fCenter$ \end{mathprooftree} \end{equation} The primitive combinators $\comb{S}$ and $\comb{K}$ can be assigned any types fitting to their axiom schemes. On the other hand, an application $(N M)$ can be assigned a type $\beta$, denoted $(N M) : \beta$, if and only if $N : \alpha \to \beta$, whereas $M : \alpha$. If $P : \alpha$ for some type $\alpha$, we say that $P$ is \emph{typeable}. Naturally, not every combinator is typeable, e.g.~$\omega := \comb{S} \comb{I} \comb{I}$, where $\comb{I} := \comb{S} \comb{K} \comb{K}$. Though not all strongly normalising combinators are typeable, the converse implication holds, i.e.~each typeable combinator is strongly normalising. In this paper, we focus mostly on bases which are capable of expressing all computable functions. A sufficient and necessary condition for a basis $\mathcal{B}$ to be \emph{Turing-complete} is to span $\mathcal{B}$-combinators extensionally-equivalent to $\comb{S}$ and $\comb{K}$. In such a case, we make the natural assumption that $\mathcal{B}$ defines a set of axiom schemes, one for each primitive combinator, in such a way that when enriched with the modus ponens inference rule, $TA_{\mathcal{B}}$ constitutes a sound typing system -- if $N$ is extensionally-equivalent to either $\comb{S}$ or $\comb{K}$, then the types of $N$ in $TA_{\mathcal{B}}$ are the same as the types of, respectively, $\comb{S}$ or $\comb{K}$ in $TA_{\comb{S} \comb{K}}$. Throughout the paper, we use the over line notation $\overline{\comb{X}}$ to denote arbitrary terms extensionally-equivalent to $\comb{X}$. We refer the reader to~\cite{curry-feys} or~\cite{BAR84} for a more detailed exposition of combinatory logic. \section{Combinatorial classes}\label{sec:combinatorial-classes} Let $B$ be a countable set of objects with an associated \emph{size} function $f \colon B \to \mathbb{N}$. If for each $n \in \mathbb{N}$ the set of $B$'s objects of size $n$ is finite, then $B$ together with $f$ forms a \emph{combinatorial class} (see, e.g.~\cite{FlajoletSedgewick2009}). In such a case, we can associate a \emph{counting sequence} $\set{b_n}_{n \in \mathbb{N}}$ of natural numbers $b_n$ capturing the number of objects in $B$ of size $n$. Naturally, if $A \subseteq B$, then $A$ is a combinatorial class as well with $a_n \leq b_n$ for each $n \in \mathbb{N}$. Assuming that $b_n > 0$ for each $n\in \mathbb{N}$, we can then define the \emph{asymptotic density} $\density{A}{B}$ of $A$ in $B$ as \begin{equation*} \density{A}{B} = \lim_{n\to\infty} \frac{a_n}{b_n}. \end{equation*} Note that if it exists, we can interpret $\density{A}{B}$ as the asymptotic probability of finding an object of $A$ in the class of objects $B$. In other words, the likelihood that $A$ represents `typical' objects in $B$. Unfortunately, sometimes we do not know whether the asymptotic density of $A$ in $B$ exists, however we can use the \emph{lower} and \emph{upper limits} defined as \begin{equation*} \densityminus{A}{B} = \liminf_{n\to\infty} \frac{a_n}{b_n} \quad \text{and} \quad \densityplus{A}{B} = \limsup_{n\to\infty} \frac{a_n}{b_n}. \end{equation*} As $0 \leq \frac{a_n}{b_n} \leq 1$, these two numbers are well defined for any set $A$, even when the limiting ratio $\density{A}{B}$ is not known to exist. Henceforth, given a combinatorial class $A$, we use $a_n$ to denote the number of objects in $A$ of size $n$. \section{Generating functions and analytic tools}\label{sec:generating-functions-and-analytic-tools} Let $A$ be a combinatorial class. The formal power series $A(z) = \sum_{n \geq 0} a_n z^n$ with $A$'s counting sequence $\set{a_n}_{n\in \mathbb{N}}$ as coefficients, is called the \emph{ordinary generating function} of $A$. Using the powerful theory of \emph{Analytic Combinatorics} developed by Flajolet and Sedgewick~\cite{FlajoletSedgewick2009}, many questions concerning the asymptotic behaviour of $\set{a_n}_{n \in \mathbb{N}}$ can be efficiently resolved by analysing the behaviour of $A(z)$ viewed as an analytic function in some neighbourhood around the complex plane origin. This is the approach we take to study the asymptotic fractions of interesting combinatory logic terms. Throughout the paper we use $A(z)$ to denote the ordinary generating function associated with the combinatorial class $A$. We write $[z^n]A(z)$ to denote the coefficient standing by $z^n$ in the Taylor series expansion of $A(z)$ around $z = 0$. We say that two sequences $\set{a_n}_{n \in \mathbb{N}}$ and $\set{b_n}_{n \in \mathbb{N}}$ are \emph{asymptotically equivalent} if $\lim_{n \to \infty} \frac{a_n}{b_n} = 1$. In such a case we write $a_n \sim b_n$. \subsection{Main tools}\label{subsec:main-tools} In our endeavour to study the asymptotic behaviour of `typical' classes of combinatory logic terms, we use the method of \emph{singularity analysis}~\cite{FlajoletSedgewick2009}. Starting with a particular class $A$ of combinators, we find its corresponding generating function $A(z)$. The location of $A(z)$'s dominant singularities determines the exponential growth rate of $\set{a_n}_{n \in \mathbb{N}}$ as dictated by the following theorem. \begin{theorem}[Exponential Growth Formula, see {\cite[Theorem IV.7]{FlajoletSedgewick2009}}]\label{thm:exponential-growth-formula} If $A(z)$ is analytic at $0$ and $R$ is the modulus of a singularity nearest to the origin in the sense that \[ R = \sup \{ r \geq 0 ~:~ A(z) \text{ is analytic in } |z| < r \} ,\] then the coefficient $a_n = [z^n] A(z)$ satisfies \[ a_n = R^{-n} \theta(n) \quad \text{with} \quad \limsup |\theta(n)|^{\frac{1}{n}} = 1 .\] \end{theorem} In the case of analytic functions derived from combinatorial classes, the location of dominant singularities is significantly simplified as it suffices to look for singularities on the real line. \begin{theorem}[Pringsheim, see {\cite[Theorem~IV.6]{FlajoletSedgewick2009}}] \label{th:pringsheim} If $A(z)$ is representable at the origin by a series expansion that has non-negative coefficients and radius of convergence $R$, then the point $z = R$ is a singularity of $A(z)$. \end{theorem} The sub-exponential factors determining the asymptotic growth rate of $\set{a_n}_{n \in \mathbb{N}}$ can be then further established using, in our case, the standard function scale for algebraic singularities of square-root type. \begin{theorem}[Standard function scale, see~{\cite[Theorem~VI.1]{FlajoletSedgewick2009}}]\label{th:standard-func-scale} Let $\alpha \in \mathbb{C} \setminus \mathbb{Z}_{\leq 0}$. Then $f(z) = {(1 - z)}^{-\alpha}$ admits for large $n$ a complete asymptotic expansion in form of \begin{equation*} [z^n]f(z) = \frac{n^{\alpha-1}}{\Gamma(\alpha)} \left( 1 + \frac{\alpha(\alpha-1)}{2n} + \frac{\alpha(\alpha-1)(\alpha-2)(3\alpha-1)}{24n^2} + O(\frac{1}{n^3}) \right) \end{equation*} where $\Gamma$ is the Euler Gamma function. \end{theorem} \begin{theorem}[Newton-Puiseux, see~{\cite[Theorem~VII.7]{FlajoletSedgewick2009}}] Let $f(z)$ be a branch of an algebraic function $P(z, f(z)) = 0$. Then in a circular neighbourhood of a singularity $\zeta$ slit along a ray emanating from $\zeta$, $f(z)$ admits a fractional series expansion that is locally convergent and of the form \begin{equation*} f(z) = \sum_{k \geq k_0} c_k {\left( z - \zeta \right)}^{\nicefrac{k}{\kappa}} \end{equation*} where $k_0 \in \mathbb{Z}$ and $\kappa \geq 1$. \end{theorem} Finally, combining the scaling rule for Taylor expansions and the Newton-Puiseux expansion of algebraic functions with unique dominating singularities, we obtain the following corollary theorem. \begin{theorem}[Algebraic singularity analysis]\label{th:singularity-analysis} Let $f(z) = {(1 - \zeta^{-1} z)}^{\nicefrac{1}{2}} g(z) + h(z)$ be an algebraic function, analytic at $0$, having a unique dominant singularity $z = \zeta$. Assume that $g(z)$ and $h(z)$ are analytic in the disk $|z| < \zeta + \eta$ for some $\eta > 0$. Then the coefficient $[z^n]f(z)$ satisfies the following asymptotic approximation \begin{equation*} [z^n]f(z) \sim \zeta^{-n} \frac{\overline{C} n^{-\nicefrac{3}{2}}}{\Gamma(-\frac{1}{2})} \end{equation*} where $\overline{C}$ is the coefficient standing by $\sqrt{1 - \zeta^{-1} z}$ in the Newton-Puiseux expansion of $f(z)$, i.e.~$g(\zeta)$. \end{theorem} \begin{proof} See~\cite{FlajoletSedgewick2009}, Theorem VII.8. \end{proof} In order to simplify the reasoning about the type and location of singularities of generating functions given without explicit closed-form solutions, we use the following technical lemma guaranteeing certain natural closure properties of analytic functions with a single square-root type dominating singularity. \begin{lemma}\label{lem:sqrt-commutative-ring} Let $\Omega$ be the open disk $|z| < \zeta + \eta$ for some $0 < \zeta < 1$ and $\eta > 0$. Let $F$ denote the set of functions $f \colon (0,\zeta) \to \mathbb{C}$ in form of $f(z) = \sqrt{1-\zeta^{-1} z}\, P(z) + Q(z)$ for arbitrary $P(z)$ and $Q(z)$ analytic in $\Omega \setminus \set{0}$. Then $F$ with natural function addition and multiplication forms a commutative ring. \end{lemma} \begin{proof} Note that it suffices to show that $F$ is closed under addition and multiplication, as the commutative ring laws are clearly preserved. Let $(U, +, \times)$ be the commutative ring of functions analytic in $\Omega \setminus \set{0}$. Consider arbitrary $f,g \in F$ given by $f(z) = \sqrt{1-\zeta^{-1} z}\, P_f(z) + Q_f(z)$ and $g(z) = \sqrt{1-\zeta^{-1} z}\, P_g(z) + Q_g(z)$. Let us start with $f(z) + g(z)$. Note that \begin{equation*} f(z) + g(z) = \sqrt{1-\zeta^{-1} z}\, \big(P_f(z) + P_g(z)\big) + Q_f(z) + Q_g(z). \end{equation*} Clearly, $f(z) + g(z) = \sqrt{1-\zeta^{-1} z}\, \overline{P}(z) + \overline{Q}(z)$ where both $\overline{P}(z) \in U$ and $\overline{Q}(z) \in U$. Hence, $f(z) + g(z) \in F$. Now, let us consider $f(z)\cdot g(z)$. By rewriting, we obtain \begin{eqnarray}\label{eq:sqrt-mult-eq} f(z)\cdot g(z) &=& \sqrt{1-\zeta^{-1} z} \big(P_g(z) Q_f(z)+P_f(z) Q_g(z)\big)\\ \nonumber && +(1-\zeta^{-1}z)P_f(z) P_g(z) +Q_f(z) Q_g(z). \end{eqnarray} Clearly, $f(z)\cdot g(z) \in F$. \end{proof} \subsection{Removable singularities}\label{subsec:removable-singularities} In order to apply~\autoref{th:singularity-analysis} to the analysis of a generating function $A(z)$, we have to guarantee that $A(z)$ is analytic at $z = 0$. If it is not the case, yet $A(z)$ has a \emph{removable pole singularity} at $z = 0$, we can consider its analytic extension $\widetilde{A}(z)$, instead of $A(z)$. The following theorem due to Bernhard Riemann provides a sufficient and necessary condition to determine whether $A(z)$'s pole singularity at $z = 0$ can be removed. \begin{theorem}[Riemann's Removable Singularities Theorem, see e.g.~\cite{Krantz1999}]\label{th:riemann-rem-sing} Let $f$ be analytic on the punctured disk $\Omega \setminus \set{z_0}$ of the complex plane. Then $f$ has an analytic extension on $\Omega$ if and only if $\lim_{z \to z_0} (z - z_0) f(z) = 0$. \end{theorem} As a direct consequence, we obtain the following technical lemma. \begin{lemma}\label{lem:sing-powers} Let $\Omega \setminus \set{z_0}$ be a punctured disk on the complex plane. Suppose that $f$ is analytic on $\Omega \setminus \set{z_0}$ and has an analytic continuation at $z = z_0$. Then for each $n \geq 2$, the function ${f(z)}^n$ has an analytic extension on $\Omega$. \end{lemma} \section{Basis-independent results}\label{sec:basis-independent-results} In this section we are interested in universal basis-independent asymptotic properties of combinatory logic. We prove certain general results about labelled plane binary trees, deriving the combinatory logic results as immediate corollaries. \begin{definition} Suppose that $L$ is a finite set of $d$ distinct \emph{labels}. Then, the set of $L$-trees consists of plane binary trees where each leaf has a corresponding label in the set $L$. We use $\T{L}$ to denote the set of $L$-trees. \end{definition} Let us notice that the asymptotic growth rate of $L$-trees greatly depends on the asymptotic approximation of Catalan numbers $\catalan{n}$ counting the number of plane binary trees with $n$ inner nodes. It is well known that \begin{equation*} \catalan{n} = \frac{1}{n+1}{2n \choose n} \qquad \text{and} \qquad \catalan{n} = 4^n \frac{n^{-\nicefrac{3}{2}}}{\sqrt{\pi}}. \end{equation*} \begin{prop} Let $\T{L}$ be the set of $L$-trees over a set $L$ of size $d$. Suppose that $|\cdot| \colon \T{L} \to \mathbb{N}$ is a function assigning each $L$-tree $t$ the number of binary nodes in $t$. Then $(\T{L}, |\cdot|)$ forms a combinatorial class. \end{prop} \begin{proof} Let us start with noticing that $t \in \T{L}$ has $|t| + 1$ leaves. Fix $n \in \mathbb{N}$. The number of plane binary trees with $n$ inner nodes is counted by the $n$th Catalan number $\catalan{n}$. Taking into account all possible $L$-labellings of $n+1$ leaves and using the closed-form expression for $\catalan{n}$, we derive the following formula counting the number $\T{L,n}$ of $L$-terms of size $n$. \begin{equation*} \T{L,n} = d^{n+1} \catalan{n} = \frac{d^{n+1}}{n+1}\binom{2n}{n}. \end{equation*} \end{proof} \subsection{Counting $L$-trees containing fixed $L$-trees as subtrees}\label{subsec:counting-l-trees} Suppose that $t \in \T{L}$. Let $\overline{\T{L}}(z)$ denote the generating function counting the cardinalities of $L$-trees containing $t$ as a subtree. In the following series of propositions, we derive the closed-form solution for $\overline{\T{L}}(z)$ and check the conditions of~\autoref{th:singularity-analysis} used subsequently to show that in fact $[z^n]\overline{\T{L}}(z) \sim [z^n]\T{L}(z)$, independently of $L$. \begin{prop} Let $\T{L}$ be the set of $L$-trees where $|L| = d$. Then its counting sequence ${\set{\T{L,n}}}_{n \in \mathbb{N}}$ has a corresponding generating function $\T{L}(z)$ given by \begin{equation}\label{eq:TL(z)-closed-form-solution} \T{L}(z) = \frac{1-\sqrt{1-4 d z}}{2 z}. \end{equation} \end{prop} \begin{proof} Note that $\T{L}$ can be defined as $\T{L} = L + \T{L} \times \T{L}$, which translates into the following function equation defining $\T{L}(z)$: \begin{equation}\label{eq:TL(z)-fun-eq} \T{L}(z) = d + z {\T{L}(z)}^2. \end{equation} Solving~\eqref{eq:TL(z)-fun-eq} for $\T{L}(z)$, we obtain two possible solutions: \begin{equation*} \T{L}(z) = \frac{1 \pm \sqrt{1-4 d z}}{2 z}. \end{equation*} Since the number of $L$-trees of size $0$ is equal to $d$, the limit $\lim_{z \to 0} \T{L}(z) = d$. It follows that~\eqref{eq:TL(z)-closed-form-solution} is indeed the desired solution. \end{proof} \begin{prop} Let $L$ be a set of $d$ distinct labels. Assume that $t \in \T{L}$ is an $L$-tree of size $p \geq 1$. Then the set of $L$-trees containing $t$ as a subtree, denoted as $\overline{\T{L}}$, has the following generating function: \begin{equation}\label{eq:overline-TL(z)-closed-form-solution} \overline{\T{L}}(z) = \frac{-\sqrt{1-4 d z} + \sqrt{1 - 4 d z+4 z^{p+1}}}{2 z}. \end{equation} \end{prop} \begin{proof} Let us start with noticing that any $L$-tree containing $t$ as a subtree is either equal to $t$, or one of its left or right subtrees contains $t$ whereas the other one is a tree in $\T{L}$. However, since trees in $\T{L}$ may contain $t$ as a subtree, we have to subtract trees containing $t$ in both branches to avoid double counting. This specification allows us to write down the following functional equation defining $\overline{\T{L}}(z)$: \begin{equation}\label{eq:TL(z)-fixed-term-fun-eq} \overline{\T{L}}(z) = z^{p} + 2 z \T{L}(z) \overline{\T{L}}(z) - z {\overline{\T{L}}(z)}^{2}. \end{equation} Solving~\eqref{eq:TL(z)-fixed-term-fun-eq} for $\overline{\T{L}}(z)$ we obtain two possible solutions: \begin{equation*} \frac{-\sqrt{1-4 d z} \pm \sqrt{1 - 4 d z+4 z^{p+1}}}{2 z}. \end{equation*} Note that $p \geq 1$ and hence there are no $L$-trees of size $0$ containing $t$ as a subterm. It follows that $\lim_{z \to 0} \overline{\T{L}}(z) = 0$, yielding the desired solution. \end{proof} \begin{prop}\label{prop:T(z)-rho-only-sing} Let $\zeta = \frac{1}{4d}$. Then $\zeta$ is the only singularity on both $\T{L}(z)$ and $\overline{\T{L}}(z)$'s circle of convergence. \end{prop} \begin{proof} From~\eqref{eq:TL(z)-closed-form-solution} it is clear that $\zeta$ is the only singularity of $\T{L}(z)$ on the circle $|z| < \zeta$. Moreover, since $\sqrt{1 - 4d}$ is a part of $\overline{\T{L}}(z)$'s closed-form expression~\eqref{eq:overline-TL(z)-closed-form-solution}, it suffices to check that $F(z) = 1 - 4 d z+4 z^{p+1}$ has no complex roots of modulus $\zeta$. Note that we can rewrite~\eqref{eq:overline-TL(z)-closed-form-solution} as \begin{eqnarray*} \overline{\T{L}}(z) &=& \frac{1 -\sqrt{1-4 d z} - \left( 1 - \sqrt{1 - 4 d z+4 z^{p+1}} \right)}{2 z}\\ &=& \T{L}(z) - \frac{1 - \sqrt{1 - 4 d z+4 z^{p+1}}}{2 z}. \end{eqnarray*} Both $\T{L}(z)$ and $\overline{\T{L}}(z)$ are generating functions counting sequences of non-negative integers, hence the coefficients in the Maclaurin series of $\frac{1 - \sqrt{1 - 4 d z+4 z^{p+1}}}{2 z}$ are non-negative integers as well. To finish the proof we notice that \begin{equation*} F(\zeta) = 4^{-p} \left(\frac{1}{d}\right)^{p+1} > 0 \end{equation*} and hence due to~\hyperref[th:pringsheim]{Pringsheim's Theorem}, $F(z)$ cannot have complex roots of modulus $\zeta$. \end{proof} The generating functions $\T{L}(z)$ and $\overline{\T{L}}(z)$ are not defined at $z = 0$, however due to~\autoref{th:riemann-rem-sing}, both have analytic extensions to functions analytic in the origin and we can consider them instead of $\T{L}(z)$ and $\overline{\T{L}}(z)$ in the subsequent theorem. \begin{theorem}\label{th:TL(z)-asymptotic-approx} Both $[z^n]\T{L}(z)$ and $[z^n]\overline{\T{L}}(z)$ admit for large $n$ the following asymptotic approximation: \begin{equation}\label{eq:TL(z)-asymptotic-approx} [z^n]\T{L}(z) \sim [z^n]\overline{\T{L}}(z) \sim {(4 d)}^n \frac{-2d n^{-\nicefrac{3}{2}}}{\Gamma(-\frac{1}{2})}. \end{equation} \end{theorem} \begin{proof} Let us rewrite the closed-form solutions of $\T{L}(z)$~\eqref{eq:TL(z)-closed-form-solution} and $\overline{\T{L}}(z)$~\eqref{eq:overline-TL(z)-closed-form-solution} as \begin{eqnarray*} \T{L}(z) &=& \sqrt{1-4 d}\left( -\frac{1}{2z} \right) + \frac{1}{2z}, \quad \text{and}\\ \overline{\T{L}}(z) &=& \sqrt{1-4 d}\left( -\frac{1}{2z} \right) + \frac{\sqrt{1 - 4 d z+4 z^{p+1}}}{2 z}. \end{eqnarray*} As all the assumptions hold, the result follows now easily by applying~\autoref{th:singularity-analysis}. \end{proof} Immediately, we obtain the following corollary theorem. \begin{theorem} Let $t \in T_L$. Then asymptotically almost all $L$-trees contain $t$ as a subtree. \end{theorem} \begin{proof} In the case of $|t| \geq 1$, our claim follows directly from~\autoref{th:TL(z)-asymptotic-approx}. Suppose that $|t| = 0$, i.e.~$t$ is a primitive combinator. We can assume that $|L| > 1$, as otherwise our claim is trivial. Let us consider the set $\T{L \setminus \set{t}}$ of $L$-trees avoiding $t$. Note that from~\eqref{eq:TL(z)-closed-form-solution}, we have $[z^n]\T{L \setminus \set{t}}(z) \sim c_1 4^n(d-1)^n n^{-3/2}$, whereas $[z^n]\T{L}(z) \sim c_2 (4d)^n n^{-3/2}$ for some constants $c_1$ and $c_2$. It follows that asymptotically almost no $L$-tree avoids the primitive combinator $t$, finishing the proof. \end{proof} The above theorem provides a general result showing that `local' properties of $L$-trees propagating to supertrees, span asymptotically almost the whole set of $L$-trees. Using the natural bijection between $\mathcal{B}$-combinators and $\mathcal{B}$-trees, we can reinterpret this observation in the language of combinatory logic and state that each `local' property of $\mathcal{B}$-combinators closed under taking superterms is typical, i.e.~has asymptotic probability $1$ in the set of all $\mathcal{B}$-combinators. In particular, we obtain the following corollaries generalising the results in~\cite{dgkrtz}. \begin{cor}\label{cor:subterm-prop} For each Turing-complete basis of primitive combinators $\mathcal{B}$, asymptotically almost no $\mathcal{B}$-combinator is in normal form, simply typeable nor strongly normalising. \end{cor} \begin{proof} Fix $t := \overline{\comb{S}} \comb{I} \comb{I} (\overline{\comb{S}} \comb{I} \comb{I})$ where $\comb{I} := \overline{\comb{S} \comb{K} \comb{K}}$. \end{proof} \subsection{Counting normalising combinators}\label{subsec:counting-normalizing-combinators} Let $\mathcal{B}$ be a Turing-complete set of primitive combinators. Let us start with the classical observation is that the set of normalising $\mathcal{B}$-combinators is undecidable. It follows that its corresponding generating function has no computable closed-form solution. For that reason we take the following approach. We find feasible subclasses of normalising and non-normalising $\mathcal{B}$-combinators and use them to bound the density of normalising combinators $\mathcal{WN}_\mathcal{B}$. Let us start with recalling the famous standardisation theorem. \begin{theorem}[Standardisation theorem, see e.g.~\cite{curry-feys}]\label{th:standardization-theorem} If $M$ is normalising, then the leftmost outermost reduction always leads to $M$'s normal form. \end{theorem} Although usually stated in the $\S \mathbf{K}$-basis, the standardisation theorem easily generalises to every Turing-complete basis of combinators, e.g.~through the classical translation to $\lambda$-calculus (see, e.g.~\cite{BAR84}). Hence, we obtain the following result. \begin{theorem} Let $\mathcal{B}$ be a Turing-complete basis of primitive combinators. Then \begin{equation*} 0 < \densityminus{\mathcal{WN}_\mathcal{B}}{\class{B}} \quad \text{and} \quad \densityplus{\mathcal{WN}_\mathcal{B}}{\class{B}} < 1. \end{equation*} \end{theorem} \begin{proof} Let us start with the lower bound. Since $\mathcal{B}$ is Turing-complete, there exists a combinator $\overline{\comb{K}} \in \class{\mathcal{B}}$ extensionally equivalent to $\comb{K}$. Let us consider the set $L$ of combinators in form of $\overline{\comb{K}} \comb{X} M$ where $\comb{X} \in \mathcal{B}$ is a primitive combinator and $M \in \class{\mathcal{B}}$. Notice that if $t \in L$, then $t$ has a normal form. Hence $L \subset \mathcal{WN}_\mathcal{B}$. Let us fix $p := |\overline{\comb{K}}|$. Then \begin{eqnarray*} \density{L}{\class{\mathcal{B}}} &=& \lim_{n \to \infty} \frac{|L_n|}{|\class{\mathcal{B},n}|} = \lim_{n \to \infty} \frac{d \cdot |\class{\mathcal{B},n-p-2}|}{|\class{\mathcal{B},n}|}\\ &=& \lim_{n \to \infty} \frac{d^{n-p} \cdot C_{n-p-2}}{d^{n+1} \cdot C_n} = \frac{1}{d^{p+1} \cdot 4^{p+2}} > 0. \end{eqnarray*} Naturally we have \begin{equation*} \density{L}{\class{\mathcal{B}}} \leq \densityminus{\mathcal{WN}_\mathcal{B}}{\class{\mathcal{B}}} \end{equation*} hence indeed, the lower bound holds. Now, let us consider the upper bound. Let $\omega = \overline{\comb{S} \comb{I} \comb{I}}$. Since $\comb{S} \comb{I} \comb{I} x \to_w x x$, we know that $\comb{S} \comb{I} \comb{I} (\comb{S} \comb{I} \comb{I})$ has no normal form. Immediately, nor does $\omega \omega$. Consider the transformation $\Phi \colon \class{\mathcal{B}} \to \class{\mathcal{B}}$ which for a given $\mathcal{B}$-combinator substitutes $\omega \omega$ for its leftmost primitive combinator $\comb{X}$ (see~\autoref{fig:U-transform}). \begin{figure}[th!] \resizebox{.75\linewidth}{!}{ \begin{subfigure}{.3\textwidth} \centering \begin{tikzpicture}[triangle/.style = {regular polygon, regular polygon sides=3 }, level1/.style ={level distance=1cm},] \node [circle,draw,fill=black,scale=0.5] (a) {} child[level1] {node [circle,draw,fill=black,scale=0.5] (b) {} child[level1] {node {$\vdots$} child[level1] {node [label={[yshift=-8mm]$\comb{X}$},circle,draw,fill=black,scale=0.5] (d) {}} child[level1] { node {$\vdots$} } } child[level1] { node {$\vdots$} } } child[level1] { node {$\vdots$} }; \end{tikzpicture} \end{subfigure} \begin{subfigure}{.2\textwidth} \[ \mathrel{\overset{\makebox[0pt]{\mbox{$\Phi$}}}{\longmapsto}} \] \end{subfigure} \begin{subfigure}{.3\textwidth} \centering \tikzset{ itria/.style={ draw,shape border uses incircle, scale=0.75, isosceles triangle,shape border rotate=90,yshift=-1.45cm} } \begin{tikzpicture}[triangle/.style = {regular polygon, regular polygon sides=3 }, level1/.style ={level distance=1cm},] \node [circle,draw,fill=black,scale=0.5] (a) {} child[level1] {node [circle,draw,fill=black,scale=0.5] (b) {} child[level1] {node {$\vdots$} child[level1] { node [circle,draw,fill=black,scale=0.5] (q) {} node[itria] {$\comb{\omega \omega}$}} child[level1] { node {$\vdots$} } } child[level1] { node {$\vdots$} } } child[level1] { node {$\vdots$} }; \end{tikzpicture} \end{subfigure} } \caption{Transformation $\Phi$} \label{fig:U-transform} \end{figure} Let $U$ be the image of $\class{\mathcal{B}}$ through $\Phi$. By~\autoref{th:standardization-theorem}, we know that $U$ is a set of non-normalising combinators. In other words, we have $\mathcal{WN}_\mathcal{B} \subset \class{\mathcal{B}} \setminus U$. Let $M$ be an arbitrary combinator in $U$. Note that since there are $d$ primitive combinators, the map $\Phi$ sends exactly $d$ distinct combinators to $M$. For convenience, let us set $p := |\omega \omega|$. Then we obtain \begin{eqnarray*} \density{U}{\class{\mathcal{B}}} &=& \lim_{n \to \infty} \frac{|U_n|}{|\class{\mathcal{B},n}|} = \lim_{n \to \infty} \frac{d \cdot |\class{\mathcal{B},n-p}|}{|\class{\mathcal{B},n}|}\\ &=& \lim_{n \to \infty} \frac{d^{n-p+2} \cdot C_{n-p}}{d^{n+1} \cdot C_n} = \frac{d}{{(4 d)}^{p}} > 0. \end{eqnarray*} Since $\mathcal{WN}_\mathcal{B} \subset \class{\mathcal{B}} \setminus U$, we have \begin{equation*} \densityplus{\mathcal{WN}_\mathcal{B}}{\class{\mathcal{B}}} \leq 1 - \density{U}{\class{\mathcal{B}}}, \end{equation*} and thus the upper bound holds as well, finishing the proof. \end{proof} Using the fact that asymptotically no $\mathcal{B}$-combinator is strongly normalising (see~\autoref{cor:subterm-prop}), we obtain the following corollary generalising the result in~\cite{Bendkowski2015}. \begin{cor} For each Turing-complete basis $\mathcal{B}$ of primitive combinators, asymptotically every weakly normalising $\mathcal{B}$-combinator is not strongly normalising. \end{cor} \section{SK-combinators}\label{sec:sk-combinators} In this section we address the problem of estimating the asymptotic density of normalising $\comb{S}\comb{K}$-combinators in the set of all $\comb{S}\comb{K}$-combinators. In~\cite{Bendkowski2015} authors provided the following bounds: \begin{equation*} \frac{1}{32} \leq \densityminus{\mathcal{WN}_{\comb{S}\comb{K}}}{\class{\comb{S}\comb{K}}} \quad \text{and} \quad \densityplus{\mathcal{WN}_{\comb{S}\comb{K}}}{\class{\comb{S}\comb{K}}} \leq 1 - \frac{1}{2^{18}}. \end{equation*} Here, we prove that $\comb{S}\comb{K}$-combinators reducing in exactly $n>0$ normal-order reduction steps (leftmost outermost redex first, see~\autoref{th:standardization-theorem}) have positive asymptotic density in the set of all $\comb{S}\comb{K}$-combinators. We provide a constructive method of finding their asymptotic approximations and related densities, yielding a systematic approach to improving the above lower bound. For simplicity, we use $\class{\comb{S}\comb{K}}$ and $\rg{0}$ to denote the set of $\comb{S}\comb{K}$-combinators and the set of normal forms, respectively. Let us start with a few technical propositions regarding the generating functions $C(z)$ and $\rgf{0}$. \begin{prop}[see, e.g.~\cite{Bendkowski2015}] The generating function $C(z)$ enumerating $\S \mathbf{K}$-terms and its corresponding dominating singularity $\domsing{C}$ are given by \begin{equation}\label{eq:c(z)} C(z) = \frac{1-\sqrt{1-8z}}{2z} \quad \text{and} \quad \domsing{C} = \frac{1}{8}. \end{equation} \end{prop} \begin{prop}\label{prop:c(z)-properties} Let $n \geq 1$. Then ${C(z)}^n = \sqrt{1-8z}\, P(z) + Q(z)$ for some rational functions $P(z)$ and $Q(z)$ analytic in $\mathbb{C} \setminus \set{0}$. Moreover, ${C(z)}^n$ has a single removable singularity at $z = 0$ in the disk $|z| < \domsing{C}$. \end{prop} \begin{proof} From equation~\eqref{eq:c(z)}, $C(z)$ can be rewritten as \[ C(z) = \sqrt{1-8z}\, P(z) + Q(z) \quad \text{where} \quad P(z) = -\frac{1}{2z} \quad \text{and} \quad Q(z) = \frac{1}{2z}. \] Both $P(z)$ and $Q(z)$ are rational and hence also analytic in the complex plane except the origin. From~\autoref{lem:sqrt-commutative-ring}, ${C(z)}^n$ can be expressed as \[ {C(z)}^n = \sqrt{1-8z}\, \overline{P}(z) + \overline{Q}(z) \] for some $\overline{P}(z)$ and $\overline{Q}(z)$ analytic in $\mathbb{C} \setminus \set{0}$. Moreover, following~\eqref{eq:sqrt-mult-eq} and the closure properties of rational functions, it is clear that $\overline{P}(z)$ and $\overline{Q}(z)$ are also rational. As $\lim_{z \to 0} z C(z) = 0$, \autoref{th:riemann-rem-sing} guarantees that $C(z)$ has an analytic extension at $z = 0$ and, in consequence of~\autoref{lem:sing-powers}, so does ${C(z)}^n$, finishing the proof. \end{proof} \begin{prop}[see~\cite{Bendkowski2015}] The generating function $\rgf{0}$ enumerating $\S \mathbf{K}$-terms in normal form and its corresponding dominating singularity $\domsing{0}$ are given by \begin{equation}\label{eq:r0(z)} \rgf{0} = \frac{1 - 2z - \sqrt{1-4z-4z^2}}{2z^2} \quad \text{and} \quad \domsing{0} = \frac{1}{2}\left(\sqrt{2}-1\right) \approx 0.207107. \end{equation} \end{prop} \begin{prop}\label{prop:r0(z)-properties} Let $n \geq 1$. Then ${R_0(z)}^n = \sqrt{1-4z-4z^2}\, P(z) + Q(z)$ for some rational functions $P(z)$ and $Q(z)$ analytic in $\mathbb{C} \setminus \set{0}$. Moreover, ${R_0(z)}^n$ has a single removable singularity at $z = 0$ in the disk $|z| < \domsing{0}$. \end{prop} \begin{proof} From the shape of equation~\eqref{eq:r0(z)} we can write \[ R_0(z) = \sqrt{1-4z-4z^2}\, P(z) + Q(z) \quad \text{where} \quad P(z) = -\frac{1}{2z^2} \quad \text{and} \quad Q(z) = \frac{1-2z}{2z^2}. \] Clearly, both $P(z)$ and $Q(z)$ are rational and analytic in $\mathbb{C} \setminus \set{0}$. The result follows now from the same arguments as in~\autoref{prop:c(z)-properties}. \end{proof} Our method relies on the effective computation and asymptotic properties of \emph{normal-order reduction grammars} $\set{\rg{n}}_{n\in\mathbb{N}}$. In~\cite{Bendkowski16} the author provided a recursive algorithm, which for given $n \geq 1$, constructs the $n$th normal-order reduction grammar $\rg{n}$ defining the set of $\S \mathbf{K}$-combinators reducing in exactly $n$ normal-order reduction steps. Applying the Symbolic Method of Flajolet and Sedgewick~\cite{FlajoletSedgewick2009}, $\rg{n}$ is then translated into a functional equation \begin{equation}\label{eq:rgf-gen-fun-eq-psi} \rgf{n} = \Psi(\rgf{n},z) \end{equation} involving the generating function $\rgf{n}$ and its formal parameter $z$. Due to the specific structure of $\Phi(\rg{n})$ -- the set of productions $\alpha \in \rg{n}$ not referencing $\rg{n}$ --~\eqref{eq:rgf-gen-fun-eq-psi} turns out to be linear in $\rgf{n}$, yielding a unique closed-form solution. \begin{theorem}[see~\cite{Bendkowski16}]\label{th:reduction-grammars} Let $n \geq 0$. Then there exists a computable unambiguous regular tree grammar $\rg{n}$ defining the set of $\S \mathbf{K}$-combinators reducing in exactly $n$ normal-order reduction steps. Moreover, $\rg{n}$ has a computable generating function $\rgf{n}$ of the following closed-form solution: \begin{equation}\label{eq:rn(z)-fun-eq-simplified} \rgf{n} = \frac{1}{\sqrt{1-4 z - 4 z^2}} \sum_{\alpha \in \Phi(\rg{n})} R_{\alpha}(z), \end{equation} where \begin{equation}\label{eq:ralpha-fun-eq} R_{\alpha}(z) = z^{k(\alpha)} {C(z)}^{c(\alpha)} \prod_{i=0}^{n-1} {R_i(z)}^{r_i(\alpha)} \end{equation} and $k(\alpha)$, $c(\alpha)$, $r_i(\alpha)$ are some non-negative integers depending on $\alpha$. \end{theorem} In the reminder of this section, we exploit the structure of the normal-order reduction grammars, showing the following main result. \begin{theorem}\label{th:main} Let $k \geq 1$. Then the asymptotic growth rate of $[z^n]\rgf{k}$ is given by \[ [z^n]\rgf{k} \sim 8^n \frac{\overline{C}_k n^{-\nicefrac{3}{2}}}{\Gamma(-\nicefrac{1}{2})}, \] where $\overline{C}_k$ is a constant depending on $k$. \end{theorem} Before we provide a proof, let us present two propositions preparing the background for~\autoref{th:singularity-analysis}. \begin{prop}\label{prop:sing-at-0} Let $n \geq 0$. Then each $\rgf{n}$ has a removable singularity at $z = 0$. \end{prop} \begin{proof} Induction over $n$. Following~\autoref{th:riemann-rem-sing}, $\rgf{n}$ has a removable singularity at $z = 0$ if and only if the limit $\lim_{z \to 0} z \rgf{n}$ exists and is equal to $0$. In particular, from~\eqref{eq:rn(z)-fun-eq-simplified} \begin{equation}\label{eq:rn(z)-rem-sing-form} \lim_{z \to 0} \frac{z}{\sqrt{1-4 z - 4 z^2}} \bigg( z^{k(\alpha)} {C(z)}^{c(\alpha)} \prod_{i=0}^{n-1} {R_i(z)}^{r_i(\alpha)} \bigg) = 0 \end{equation} for each $\alpha \in \Phi(\rg{n})$. Let us start with $n = 0$. In this case the product $\prod_{i=0}^{n-1} {R_i(z)}^{r_i(\alpha)}$ vanishes, simplifying~\eqref{eq:rn(z)-rem-sing-form} to \begin{equation}\label{eq:rn(z)-rem-sing-form-2} \lim_{z \to 0} \frac{z^{k(\alpha)+1} {C(z)}^{c(\alpha)}}{\sqrt{1-4 z - 4 z^2}} = 0. \end{equation} Due to~\autoref{prop:r0(z)-properties}, ${C(z)}^{c(\alpha)}$ has an analytic extension at $z = 0$. It follows that $\lim_{z \to 0} {C(z)}^{c(\alpha)}$ exists, indeed satisfying equation~\eqref{eq:rn(z)-rem-sing-form-2}. Now, suppose that $n > 0$. Due to the induction hypothesis all $\rgf{0},\ldots,\rgf{n-1}$ have removable singularities at $z = 0$. Using~\autoref{lem:sing-powers}, we can moreover state that so do their powers ${\rgf{0}}^{r_0(\alpha)},\ldots,{\rgf{n-1}}^{r_{n-1}(\alpha)}$. Together with our previous observation that ${C(z)}^{c(\alpha)}$ has an analytic extension at $z = 0$, we conclude that~\eqref{eq:rn(z)-rem-sing-form} is satisfied, finishing the proof. \end{proof} \begin{definition} Let $\alpha \in \Phi(\rg{n})$ for some $n \geq 1$. We say that $\alpha$ is \emph{major} if and only if $\alpha$ references either $\class{\comb{S} \comb{K}}$ or some $\rg{i}$ for $i \in \set{1,\ldots,n-1}$. Otherwise, we say that $\alpha$ is \emph{minor}. \end{definition} In the following proposition we use the notions of major and minor productions, showing that major productions contribute to the asymptotic growth rate of $\rgf{n}$'s counting sequence, whereas minor ones are asymptotically negligible. \begin{prop}\label{prop:form-of-rn(z)} Let $n \geq 1$. Then each $\rgf{n}$ is in form of $\sqrt{1-8z}\, P(z) + Q(z)$ where both $P(z)$ and $Q(z)$ are analytic in the disk $|z| < \zeta_0 = \frac{\sqrt{2}-1}{2}$ but at $z = 0$. \end{prop} \begin{proof} Induction over $n$. Consider the base case $n=1$. Let us divide $\Phi(\rg{1})$ into two groups, i.e.~major and minor productions. Suppose that $\alpha \in \rg{1}$ is a major production. Since $\alpha \in \Phi(\rg{1})$, its corresponding generating function~\eqref{eq:ralpha-fun-eq} $\rgf{\alpha}$ is in form of \begin{equation}\label{eq:rn(z)-asymptotic-form-1} \rgf{\alpha} = z^{k(\alpha)} {C(z)}^{c(\alpha)} {R_0(z)}^{r_0(\alpha)}, \end{equation} where in addition $c(\alpha) \geq 1$. Using Propositions~\ref{prop:c(z)-properties} and~\ref{prop:r0(z)-properties}, we can further rewrite~\eqref{eq:rn(z)-asymptotic-form-1} as \begin{equation*} \rgf{\alpha} = \sqrt{1-8z}\, \overline{P}(z) + \overline{Q}(z) \end{equation*} for functions $\overline{P}(z)$ and $\overline{Q}(z)$ analytic in the disk $|z| < \zeta_0$ but at $z=0$. Similarly, if $\alpha \in \Phi(\rg{1})$ is minor, we can rewrite its generating function as \begin{equation*} \rgf{\alpha} = \sqrt{1-4z-4z^2}\, \widehat{P}(z) + \widehat{Q}(z) \end{equation*} where $\widehat{P}(z)$ and $\widehat{Q}(z)$ are analytic in some disk $|z| < \zeta_0 + \varepsilon$ for $\varepsilon > 0$ but at $z=0$. The requested form of $\rgf{1}$ follows now from~\autoref{lem:sqrt-commutative-ring} and the fact that $\zeta_1 < \zeta_0$. Now, suppose that $n > 1$. Again, let us consider an arbitrary major $\alpha \in \Phi(\rg{n})$. Using the induction hypothesis and~\eqref{eq:ralpha-fun-eq}, we can rewrite $\rgf{\alpha}$ as \begin{equation}\label{eq:rn(z)-asymptotic-form-2} \rgf{\alpha} = z^{k(\alpha)} {C(z)}^{c(\alpha)} {\rgf{0}}^{r_0(\alpha)} \prod_{i=1}^{n-1} {\bigg(\sqrt{1-8z}\, \overline{P_i}(z) + \overline{Q_i}(z)\bigg)}^{r_i(\alpha)}. \end{equation} Using Propositions~\ref{prop:c(z)-properties} and~\ref{prop:r0(z)-properties}, we can further rewrite~\eqref{eq:rn(z)-asymptotic-form-2} as \begin{equation}\label{eq:rn(z)-asymptotic-form-3} \rgf{\alpha} = \bigg(\sqrt{1-8z}\, \overline{P}(z) + \overline{Q}(z)\bigg) \prod_{i=1}^{n-1} {\bigg(\sqrt{1-8z}\, \overline{\overline{P_i}}(z) + \overline{\overline{Q_i}}(z)\bigg)}^{r_i(\alpha)}. \end{equation} The result follows now easily from~\autoref{lem:sqrt-commutative-ring}. \end{proof} Now we are in a position to prove \autoref{th:main}. \begin{proof}{(\autoref{th:main})} Let $k>0$. Due to \autoref{prop:form-of-rn(z)}, every function $R_k(z)$ is in form of $\sqrt{1-8z}P_k(z) + Q_k(z)$ for some algebraic functions $P_k(z)$ and $Q_k(z)$ that are analytic in the disk $|z|<\frac{\sqrt{2}-1}{2}$ but at $z=0$. By \autoref{prop:sing-at-0}, every $R_k(z)$ has a removable singularity at $z=0$. Therefore, every function $R_k(z)$ satisfies the assumptions of \autoref{th:singularity-analysis}. Hence \[ [z^n]\rgf{k} \sim 8^n \frac{\overline{C}_k n^{-\nicefrac{3}{2}}}{\Gamma(-\nicefrac{1}{2})}\] for some constant $\overline{C}_k$. \end{proof} As $\domsing{m} = \nicefrac{1}{8}$ for every $m \geq 1$, we can easily compute the coefficients $\overline{C}_m$ in the asymptotic approximation of $[z^n]\rgf{m}$ using available computer algebra systems, e.g. Mathematica \textregistered~\cite{mathematicaSoft}. The quotient $\nicefrac{\overline{C}_m}{-4}$ (see~\autoref{eq:TL(z)-asymptotic-approx}) yields the desired asymptotic density of $\S \mathbf{K}$-combinators normalising in $m$ normal-order reduction steps in the set of all $\S \mathbf{K}$-combinators. Hence, we obtain the following corollary. \begin{cor} For each $m \in \mathbb{N}$, finding the asymptotic density of combinators normalising in $m$ steps in the set of all $\S \mathbf{K}$-combinators is computable. \end{cor} Using an implementation of the normal-order reduction grammar algorithm together with Mathematica \textregistered~we were able to compute the densities of combinators reducing in $m$ normal-order reduction steps $\rg{m}$ in $C_{\S \mathbf{K}}$ for $m = 1,\ldots,7$. The results are summarised in the following figure. \begin{figure}[th!] \begin{displaymath} \begin{array}{r|l} m & \density{\rg{m}}{C_{\S \mathbf{K}}} \\\hline 1 & 0.08961233291075565\\\hline 2 & 0.06417374404832035\\\hline 3 & 0.0501056553007704\\\hline 4 & 0.04131967414765603\\\hline 5 & 0.03570996929825453\\\hline 6 & 0.03119525702124082\\\hline 7 & 0.027987393260263862\\ \end{array} \end{displaymath} \caption{Density of $\rg{m}$ in $\class{\S \mathbf{K}}$ for $m=1,\ldots,7$} \end{figure} And so, exploiting the finite additivity of asymptotic density we obtain the following improved lower bound: \begin{equation*} 0.34010402598726164 \leq \densityminus{\mathcal{WN}_{\comb{S}\comb{K}}}{\class{\comb{S}\comb{K}}}. \end{equation*} Clearly, the above lower bound can be further improved if we compute the next asymptotic densities $\density{\rg{8}}{\class{\S \mathbf{K}}},\density{\rg{9}}{\class{\S \mathbf{K}}},\density{\rg{10}}{\class{\S \mathbf{K}}}$, etc. Unfortunately, due to the sheer amount of major productions, this process is immensely time and memory consuming, quickly requiring resources exceeding current desktop computer capabilities. Nevertheless, $\density{\rg{m}}{\class{\S \mathbf{K}}} \leq 1$ for each $m$ and hence $\sum_{m \geq 0} \density{\rg{m}}{\class{\S \mathbf{K}}}$ is necessarily convergent to some value $0 < \zeta < 1$. Moreover, if $\density{\mathcal{WN}_{\comb{S}\comb{K}}}{\class{\S \mathbf{K}}}$ exists, then we have $\zeta \leq \density{\mathcal{WN}_{\comb{S}\comb{K}}}{\class{\S \mathbf{K}}}$. The intriguing problem of determining whether the inequality can be replaced by the equality still remains open. \section{Experimental results}\label{sec:experimental-results} Our method developed in~\autoref{sec:sk-combinators} allows us to improve the lower bound on $\densityminus{\mathcal{WN}_{\comb{S}\comb{K}}}{\class{\comb{S}\comb{K}}}$, provided we have enough computational resources to find and manipulate generating functions $\rgf{m}$ for higher $m$. Unfortunately, the current gap between the lower and upper bound on the density of normalising combinators is still quite significant. In this section we present some experimental results regarding the aforementioned density as well as numerical evaluations of the obtained approximation error. \subsection{Super-computer results}\label{subsec:super-computer-results} Consider the following experiment scheme $G(s,n,r)$ with three positive integer parameters $s,n,r$. We draw $s$ uniformly random $\S \mathbf{K}$-combinators of size $n$ using, e.g.~R{\'e}my's algorithm (see~\cite{DBLP:journals/ita/Remy85,Knuth:2006:ACP:1121689}) -- drawing a uniformly random plane binary tree with $n$ inner nodes -- combined with a random $\S \mathbf{K}$-labelling. Then we reduce each of the $s$ samples using up to $r$ normal-order reduction steps. We record then the number of normalised samples, with their corresponding reduction lengths. For samples which did not normalise in $r$ reduction steps, we artificially record their reduction lengths as $-1$. Afterwards, we collect the reduction lengths, plotting the obtained function mapping reduction lengths to the number of samples attaining the given reduction length. We preformed our experiments on the \emph{Prometheus \textregistered}~super-computer cluster granted by ACC Cyfronet AGH in Kraków, Poland (\nth{48} out of 500 world's most powerful supercomputer in 2016, with theoretical computational power of 2.4 Pflops)~\cite{prometheus}. The following figure summarises the experiment result for $G(s = 1200,n = 50000000,r = 1000)$. \begin{figure}[th!]\label{fig:experiment} \centering \resizebox {200px} {!} { \begin{tikzpicture} \begin{axis}[ xlabel={normal-order reductions}, ylabel={Number of samples}, xmin=-1, xmax=868, ymin=0, ymax=176, legend pos=north west, ymajorgrids=true, grid style=dashed, ] \addplot[ color=blue, mark=*, ] coordinates { (-1,176) (1,110) (2,92) (3,57) (4,47) (5,33) (6,24) (7,35) (8,30) (9,21) (10,25) (11,25) (12,33) (13,19) (14,17) (15,16) (16,13) (17,12) (18,10) (19,18) (20,18) (21,12) (22,12) (23,6) (24,12) (25,15) (26,8) (27,9) (28,10) (29,8) (30,8) (31,12) (32,10) (33,6) (34,4) (35,8) (36,9) (37,6) (38,9) (39,10) (40,2) (41,5) (42,9) (43,3) (44,5) (45,3) (46,8) (47,8) (48,4) (49,4) (50,2) (51,1) (52,1) (53,4) (54,4) (55,3) (56,3) (57,4) (58,4) (59,2) (60,1) (61,8) (62,2) (63,2) (64,1) (65,2) (66,2) (67,1) (68,2) (69,1) (70,2) (72,2) (75,1) (76,2) (77,1) (78,1) (79,2) (81,2) (83,2) (84,2) (85,1) (89,2) (90,1) (91,1) (93,2) (95,3) (96,3) (97,2) (98,1) (100,2) (102,1) (103,1) (108,1) (109,2) (110,1) (111,3) (112,1) (114,3) (116,1) (119,1) (120,1) (126,3) (129,1) (135,1) (136,1) (137,1) (141,1) (167,1) (170,1) (183,2) (192,1) (193,1) (195,1) (208,2) (216,1) (218,1) (219,1) (223,1) (234,1) (236,1) (237,1) (245,1) (279,2) (282,1) (289,1) (290,1) (301,1) (314,1) (316,1) (329,1) (401,1) (469,1) (478,1) (490,1) (601,1) (684,1) (693,1) (698,1) (868,1) }; \legend{samples} \end{axis} \end{tikzpicture}} \caption{$G(1200, 50000000, 1000)$} \end{figure} Even though the number $r = 1000$ bounding the number of performed reductions was significantly smaller than the size of considered samples, the experiment revealed that normalising combinators have short reduction lengths. In fact, the mean reduction length $E(X)$ over all normalising samples is approximately $E(X) \approx 31.5810$, whereas $\log_2 n \approx 25.5754$. Out of $1200$ samples, only $176$ did not normalise in $r$ steps, yielding approximately $0.146$ percent of all considered samples. Similar results were obtained with different experiment parameters, suggesting that the ratio of normalising $\S \mathbf{K}$-combinators should be approximately equal to $85\%$, whereas the mean reduction length of normalising terms is $\Theta(\log_2 n)$. Our Haskell implementation of the program, as well as all the obtained data sets are available at~\cite{mb-haskell-implementation-experiments}. \subsection{Approximation error}\label{subsec:approximation-error} In~\autoref{sec:sk-combinators} we showed that $[z^n]\rgf{m} = \Theta([z^n]C(z))$ for $m \geq 1$. Nonetheless, techniques used to obtain this result do not yield the convergence rate of sequences in question. Using Mathematica \textregistered~we compared $[z^n]\rgf{m}$ with its approximation $8^n \widetilde{C}_m n^{-\nicefrac{3}{2}}$. The following figures summarise values for $[z^n]\rgf{1}$ and their relative error $\delta([z^n]\rgf{1})$. \begin{figure}[th!] \centering \begin{displaymath} \begin{array}{r|r|r|r|r} n & [z^n]C(z) & [z^n]\rgf{1} & \lfloor 8^n \widetilde{C}_1 n^{-\nicefrac{3}{2}} \rfloor & \delta([z^n]\rgf{1}) \\\hline 2 & 16 & 4 & 2 & 0.5 \\ 3 & 80 & 32 & 9 & 0.71875 \\ 4 & 448 & 200 & 51 & 0.745 \\ 5 & 2688 & 1152 & 296 & 0.7430555555555556 \\ 6 & 16896 & 6528 & 1803 & 0.7238051470588235 \\ 7 & 109824 & 37184 & 11450 & 0.6920718588640276 \\ 8 & 732160 & 215328 & 74973 & 0.6518195497102095 \\ 9 & 4978688 & 1275520 & 502653 & 0.6059230745107878 \\ 10 & 34398208 & 7753472 & 3433386 & 0.5571808345990029 \\ 11 & 240787456 & 48412416 & 23808041 & 0.5082244810917926 \\ 12 & 1704034304 & 310294272 & 167159405 & 0.4612874935699748 \\ 13 & 12171673600 & 2037696512 & 1185980764 & 0.4179796858777761 \\ 14 & 87636049920 & 13675532288 & 8489666053 & 0.3792076334425748 \\ 15 & 635361361920 & 93532264448 & 61240081391 & 0.3452518042579103 \\ 16 & 4634400522240 & 650108973568 & 444715903783 & 0.3159363708790836 \\ 17 & 33985603829760 & 4580578080768 & 3248472837654 & 0.2908159668114757 \\ 18 & 250420238745600 & 32644683026432 & 23852497067944 & 0.2693298002424797 \\ 19 & 1853109766717440 & 234890688573440 & 175955235773882 & 0.2509058709712602 \\ 20 & 13765958267043840 & 1703833526784000 & 1303399617705108 & 0.2350193858637788 \end{array} \end{displaymath} \caption{$[z^n]\rgf{1} \sim 8^n \widetilde{C}_1 n^{- \nicefrac{3}{2}}$ with $\widetilde{C}_1 \approx 0.10111668957132425$.} \end{figure} \begin{figure}[th!] \centering \begin{subfigure}{.6\textwidth} \centering \begin{tikzpicture} \begin{axis}[ title={Relative error $\delta([z^n]\rgf{1})$ for $2 \leq n \leq 20$}, xlabel={$n$}, xmin=2, xmax=20, ymin=0, ymax=1, legend pos=north west, ymajorgrids=true, grid style=dashed, ] \addplot[ color=blue, mark=*, ] coordinates { (2,0.5) (3, 0.71875) (4, 0.745) (5,0.7430555555555556) (6,0.7238051470588235) (7,0.6920718588640276) (8,0.6518195497102095) (9,0.6059230745107878) (10,0.5571808345990029) (11,0.5082244810917926) (12,0.4612874935699748) (13,0.4179796858777761) (14,0.3792076334425748) (15,0.3452518042579103) (16,0.3159363708790836) (17,0.29081596681147576) (18,0.26932980024247977) (19,0.2509058709712602) (20,0.2350193858637788) }; \legend{$\delta([z^n]\rgf{1})$} \end{axis} \end{tikzpicture} \end{subfigure \begin{subfigure}{.4\textwidth} \centering \begin{displaymath} \begin{array}{r|l} n & \delta([z^n]\rgf{1}) \\\hline 20 & 0.2350193858637788 \\ 40 & 0.10914523244529438 \\ 60 & 0.07194386101679777 \\ 80 & 0.053697148923235606 \\ 100 & 0.042841972392710106 \\ 120 & 0.03564026685975644 \\ 140 & 0.03051237282492831 \\ 160 & 0.026674947319897818 \\ 180 & 0.023695169712517998 \\ 200 & 0.021314357312846963 \\ 220 & 0.019368374581756907 \\ 240 & 0.017748046896721537 \\ 260 & 0.01637792978607196 \\ 280 & 0.015204215010418284 \\ 300 & 0.014187492529606827 \end{array} \end{displaymath} \end{subfigure \end{figure} Since $[z^n]\rgf{1} \sim 8^n \widetilde{C}_1 n^{-\nicefrac{3}{2}}$, the relative error $\delta([z^n]\rgf{1})$ is inevitably tending to $0$ as $n \to \infty$. Remarkably, the error $\delta([z^n]\rgf{1})$ converges much slower than one would expect. With $n = 300$ the error is just of order $10^{-2}$. We observed similar results in the relative errors for higher $n$, where the convergence rate is even slower than in the case of $[z^n]\rgf{1}$. Our Mathematica \textregistered~scripts and an implementation of the algorithm computing $\rgf{m}$ are available at~\cite{mb-haskell-implementation}. \section{Conclusion}\label{sec:conclusion} We presented several basis-independent results regarding asymptotic properties of combinatory logic. In particular, we generalised previously known results for $\S \mathbf{K}$-combinators from~\cite{Bendkowski2015,dgkrtz}, showing that they span to arbitrary Turing-complete combinator bases. Exploiting the results of~\cite{Bendkowski16}, we gave a systematic approach to finding better lower bounds on the density of normalising $\S \mathbf{K}$-combinators, improving the previously best known lower bound from about $3\%$ to approximately $34\%$. Performed super-computer experiments suggest that the searched density, if it exists, should be approximately $85\%$, conjecturing that both lower and upper bounds are still quite far from the actual density. Naturally, the following interesting question emerges -- is our approach converging to the actual density? As the asymptotic density is always bounded, the series $\sum_{m\geq 0} \density{R_m}{\class{\comb{S}\comb{K}}}$ converges to some value $\zeta \in (0,1)$. Is $\zeta$ the desired asymptotic density of normalising $\S \mathbf{K}$-combinators? If not, how far is it from the actual density? Due to the immense computational resources required in the computations and the sheer amount of major normal-order reduction grammar productions, our approach renders brute-force methods of closing the density gap virtually impossible. We expect that more sophisticated techniques are required in order to address this intriguing open problem. \bibliographystyle{plain}
{'timestamp': '2016-07-19T02:08:36', 'yymm': '1607', 'arxiv_id': '1607.04908', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04908'}
arxiv
\section{Introduction} Consider the standard stochastic approximation scheme given by, \begin{equation}\label{recstd} X_{n+1}=X_n+a(n)\left(h(X_n)+M_{n+1}\right) \end{equation} where $\left\{X_n\right\}_{n\geq0}$ is a sequence of $\mathbb{R}^d$-valued random variables, $h:\mathbb{R}^d\rightarrow\mathbb{R}^d$ is a Lipschitz continuous drift function and $\left\{M_{n}\right\}_{n\geq1}$ is a sequence of $\mathbb{R}^d$-valued random variables which denote the additive noise terms. In \cite{benaim2}, it was shown that under certain assumptions the asymptotic behavior of recursion \eqref{recstd} can be determined by the asymptotic behavior of the \it{o.d.e.}\rm \begin{equation*} \frac{dx}{dt}=h(x). \end{equation*} This method is known as the ODE method and the central idea of this method is to show that the linearly interpolated trajectory of recursion \eqref{recstd} \it{``tracks'' }\rm the flow of the o.d.e. This idea was later generalized in \cite{benaim3} to analyze the asymptotic behavior of stochastic processes with continuous sample paths for which a tracking argument as in the ODE method could be established. It was here that the notion of \it{asymptotic pseudotrajectory} \rm was introduced. For a precise definition we refer the reader to chapter 3 of \cite{benaim3}. In many applications arising in machine learning and optimization, the drift function $h$ is set-valued or is single-valued and does not satisfy the assumption of Lipschitz continuity (or even continuity). In such cases the recursion studied takes the form, \begin{equation}\label{recsvm} X_{n+1}-X_{n}-a(n)M_{n+1}\in a(n)H(X_n), \end{equation} where $H:\mathbb{R}^d\rightarrow\left\{\text{subsets of }\mathbb{R}^d\right\}$ is a set-valued map satisfying certain assumptions. Such recursions were first studied in \cite{benaim1} by showing that the linearly interpolated trajectory of recursion \eqref{recsvm} \it{``tracks'' }\rm the flow of the differential inclusion given by, \begin{equation*} \frac{dx}{dt}\in H(x). \end{equation*} The notion of asymptotic pseudotrajectory was also extended to the set-valued case and a limit set theorem established. In many applications such as methods relying on Monte Carlo simulation where sampling exactly from a distribution (or family of distributions) is not possible and instead Markov chain Monte Carlo methods are used, the recursion consists of an additional non-additive iterate-dependent Markov noise component. The recursion takes the general form, \begin{equation}\label{recmark1} X_{n+1}-X_n=a(n)\left(h(X_n,S_n)+M_{n+1}\right), \end{equation} where $\{S_n\}_{n\geq0}$ denotes the Markov noise component. The other quantities in the above recursion have the same interpretation as those in \eqref{recstd}. The analysis of such a recursion was first performed in \cite{benven}. In \cite{benven}, the analysis is carried out under the assumptions that the drift function $h$ is continuous, the Markov chain defined by the transition kernel associated with the Markov noise terms in the recursion admits a unique stationary distribution as well as a solution to the Poisson equation among others. The case with discontinuities in the drift function was considered in \cite{tadic} but the analysis required the function $h(\cdot,s)$ to be Holder continuous. Recently in \cite{matti}, such a recursion has been analyzed when the drift function is just measurable. In all the above references, however, the Markov noise terms are assumed to have a unique stationary distribution and the assumptions imply an existence of a solution to the Poisson equation. Another set of assumptions on the Markov noise terms under which the recursion \eqref{recmark1} is studied can be found in \cite{borkarmark}. In \cite{borkarmark}, the transition kernel defining the Markov noise terms is required to be continuous in both the iterate and the state variables. The advantage in this case is that the set of stationary distributions need not be unique and one does not need the Markov chain associated with the transition kernel for every value of the iterate, to be aperiodic and irreducible. Further the analysis in \cite{borkarmark} enables one to study the recursion \eqref{recmark1} when the noise terms are not Markov by themselves, but their lack of Markov property comes through the dependence on a control sequence. In this paper we extend the above to the case where the drift function $h$ in recursion \eqref{recmark1}, is a set-valued map. The recursion now takes the form, \begin{equation*} X_{n+1}-X_n-a(n)M_{n+1}\in a(n)H(X_n,S_n), \end{equation*} where $H:\mathbb{R}^d\times\mathcal{S}\rightarrow\left\{\text{subsets of }\mathbb{R}^d\right\}$ is a set-valued map and $\mathcal{S}$ denotes the state space of the Markov noise terms which we assume to be a compact metric space. The assumption on the Markov noise terms is similar to \cite{borkarmark}. We shall show that the linearly interpolated trajectory of the above recursion is an asymptotic pseudotrajectory for the flow of a limiting differential inclusion obtained by averaging the set-valued map w.r.t. the stationary distributions of the Markov noise terms. The main idea is to approximate the set-valued drift function with continuous set-valued maps which admit a single-valued parametrization, there by enabling us to write the recursion as a standard stochastic approximation scheme with single-valued maps for which an asymptotic pseudotrajectory argument is easy to establish. Later we invoke the limit set theorem in \cite{benaim1} to characterize the limit set of the above recursion.\newline \it{Organization of the paper:}\rm In section \ref{rec_ass}, we formally define the recursion and state the assumptions imposed, which is then followed by a brief discussion on each of the assumptions. In section \ref{backgrd}, we review certain results from set-valued analysis which will be used later to analyze the recursion and define the limiting differential inclusion. In section \ref{ldi}, the limiting differential inclusion is defined and properties of the same are established. In section \ref{sopmvf}, we define the space of probability measure valued functions and define an appropriate topology on this space. A metrization lemma for the above mentioned space is stated and a continuous function on such a space needed later in analyzing the recursion is defined. In section \ref{recanal}, we first state some preliminaries and later state our main result followed by the limit set theorem. In section \ref{siacmnc}, we state two variants of the Markov noise assumption under which the analysis of the stochastic approximation scheme can be carried out along similar lines. In section \ref{app}, we state four applications where the recursion analyzed in this paper naturally appears. We finally conclude in section \ref{cadffw} by providing a few interesting directions for future work. \section{Proof of the continuous embedding lemma (Lemma \ref{ctem})} \label{prf_ctem} The proof of this lemma is similar to the proof of Theorem 1, chapter 1, section 13 of \cite{aubindi}. We shall provide a brief outline here for the sake of completeness. For any $\epsilon>0$, for every $(x_0,s_0)\in\mathbb{R}^d\times\mathcal{S}$, let $B(\epsilon,x_0,s_0):=\left\{(x,s):\parallel x-x_0\parallel<\epsilon,\ d_{\mathcal{S}}(s,s_0)<\epsilon\right\}$. Let $\left\{\epsilon_l:=\frac{1}{3^l}\right\}_{l\geq1}$. Then for every $l\geq1$, $\mathscr{C}_l:=\left\{B(\epsilon_l,x_0,s_0):(x_0,s_0)\in \mathbb{R}^d\times\mathcal{S}\right\}$ is an open covering of $\mathbb{R}^d\times\mathcal{S}$. Since $\mathbb{R}^d\times\mathcal{S}$ is a metric space, it is paracompact (see Defn. 4 and Theorem 1 in chapter 0, section 1 of \cite{aubindi}). Therefore for every $l\geq1$, there exists a locally finite open refinement of the covering $\mathscr{C}_l$ and let it be denoted by $\tilde{\mathscr{C}}_l:= \left\{C_i^l\right\}_{i\in I^{l}}$ where $I^l$ is an arbitrary index set. By Theorem 2, chapter 0, section 1 of \cite{aubindi}, there exists a continuous partition of unity, $\left\{\psi_i^{l}\right\}_{i\in I^l}$, subordinated to the covering $\tilde{\mathscr{C}}_l$. Therefore, for every $l\geq1$, for every $i\in I^l$, there exists $(x_i^l,s_i^l)$, such that $support(\psi_i^l)\subseteq C_i^l\subseteq B(\epsilon_l,x_i^l,s_i^l)$. For every $l\geq1$, for every $(x,s)$, let $I^l(x,s):=\left\{i\in I^l:\psi_i^l(x,s)>0\right\}$ and by definition of $\psi_i^l$, we have that $|I^l(x,s)|<\infty$ and $\sum_{i\in I^l(x,s)}\psi_i^l(x,s)=1$. For every $l\geq1$, define the set valued map $H^{(l)}:\mathbb{R}^d\times\mathcal{S}\rightarrow\left\{\text{subsets of }\mathbb{R}^d\right\}$, such that for every $(x,s)$, $H^{(l)}(x,s):=\sum_{i\in I^l(x,s)}\psi_i^{l}(x,s)A_i^{l}$, where $A_i^{l}:=\bar{co}\left(H\left(B\left(2\epsilon_l, x_i^l,s_i^l\right)\right)\right)$. Fix $l\geq1$. For every $i\in I^l$, by assumption $(A1)(ii)$, $\sup_{z\in H\left(B\left(2\epsilon_l,x_i^l,s_i^l\right)\right)}\parallel z \parallel\leq K(1+\parallel x_i^l\parallel +2\epsilon_l)$ from which we can deduce that $\sup_{z\in A_i^l}\parallel z\parallel \leq K(1+\parallel x_i^l\parallel+2\epsilon_l)$. Hence $A_i^l$ is convex and compact. Therefore $H^{(l)}(x,s)$ is a convex combination of compact and convex subsets of $\mathbb{R}^d$ and hence is \bf{convex and compact}\rm. Fix $l\geq1$ and $(x,s)$. Then for every $i\in I^l(x,s)$, $(x,s)\in support(\psi_i^l)\subseteq C_i^l\subseteq B(\epsilon_l,x_i^l,s_i^l)\subseteq B(2\epsilon_l,x_i^l,s_i^l)$. Therefore for every $i\in I^l(x,s)$, $H(x,s)\subseteq H\left(B\left(2\epsilon_l,x_i^l,s_i^l\right)\right)\subseteq A_i^l$ and since $H(x,s)$ is convex we have that $H(x,s)=\sum_{i\in I^l(x,s)}\psi_i^l(x,s)H(x,s)\subseteq\sum_{i\in I^l(x,s)}\psi_i^l(x,s)A_i^l= H^{(l)}(x,s)$. Thus $\bf{H(x,s)\subseteq H^{(l)}(x,s)}\rm$. Fix $l\geq1$ and $(x,s)$. Then for every $i\in I^{l+1}(x,s)$, $\parallel x-x_i^{l+1}\parallel<\epsilon_{l+1}$ and $d_{\mathcal{S}}(s,s_i^{l+1}) <\epsilon_{l+1}$. Similarly for every $j\in I^{l}(x,s)$, $\parallel x-x_j^{l}\parallel<\epsilon_{l}$ and $d_{\mathcal{S}}(s,s_j^{l}) <\epsilon_{l}$. Therefore for every $i\in I^{l+1}(x,s)$, for every $j\in I^l(x,s)$, $\parallel x_i^l-x_i^{l+1}\parallel<\epsilon_l+\epsilon_{l+1}= \epsilon_l+\frac{\epsilon_l}{3}=\frac{4\epsilon_l}{3}$ and $d_{\mathcal{S}}(s_i^l,s_i^{l+1})<\frac{4\epsilon_l}{3}$. For every $i\in I^{l+1}(x,s)$, for every $j\in I^{l}(x,s)$, for every $(x',s')\in B(2\epsilon_{l+1},x_i^{l+1},s_i^{l+1})$, $\parallel x'-x_j^{l}\parallel\leq \parallel x'-x_i^{l+1}\parallel+\parallel x_i^{l+1}-x_j^l\parallel<2\epsilon_{l+1}+\frac{4\epsilon_l}{3}=\frac{2\epsilon_l}{3}+ \frac{4\epsilon_l}{3}=2\epsilon_l$ and $d_{\mathcal{S}}(s',s_j^{l})<2\epsilon_l$. Thus for every $i\in I^{l+1}(x,s)$, for every $j\in I^{l}(x,s)$, for every $(x',s')\in B(2\epsilon_{l+1},x_i^{l+1},s_i^{l+1})$, $H(x',s')\subseteq H\left(B\left(2\epsilon_l, x_j^l,s_j^l\right)\right)\subseteq A_j^l$. Therefore for every $i\in I^{l+1}(x,s)$, for every $j\in I^{l}(x,s)$, $A_i^{l+1}\subseteq A_j^l$ and by using convexity of $A_i^{l+1}$ we get that for every $i\in I^{l+1}(x,s)$, $A_i^{l+1}=\sum_{j\in I^{l}(x,s)}\psi_j^{l}(x,s)A_i^{l+1}\subseteq \sum_{j\in I^{l}(x,s)}\psi_j^{l}(x,s)A_j^{l}=H^{(l)}(x,s)$. By using convexity of $H^{(l)}(x,s)$ we get that $H^{(l+1)}(x,s)=\sum_{i\in I^{l+1}(x,s)}\psi_i^{l+1}(x,s)A_i^{l+1}\subseteq\sum_{i\in I^{l+1}(x,s)}\psi_i^{l+1}(x,s)H^{(l)}(x,s)=H^{(l)}(x,s)$. Therefore, $\bf{H^{(l+1)}(x,s)\subseteq H^{(l)}(x,s)}\rm$. Fix $(x,s)$. Clearly $H(x,s)\subseteq \cap_{l\geq1}H^{(l)}(x,s)$. By u.s.c. of $H$, we have that for every $\epsilon>0$, there exists $\delta(\epsilon,x,s)>0$ such that for every $(x',s')$ satisfying $\parallel x'-x\parallel<\delta(\epsilon,x,s)$ and $d_{\mathcal{S}}(s',s)< \delta(\epsilon,x,s)$ we have $H(x',s')\subseteq H(x,s)+\epsilon U$. Clearly we can find $L$ such that for every $l\geq L$, $3\epsilon_l< \delta(\epsilon,x,s)$. Therefore for every $\epsilon>0$, for $L$ as above, we have that for every $l\geq L$, for every $i\in I^l(x,s)$, $H\left(B\left(2\epsilon_l,x_i^l,s_i^l\right)\right)\subseteq H(x,s)+\epsilon U$. Since $H(x,s)+\epsilon U$ is convex we get, for every $\epsilon>0$, there exists $L$ such that for every $l\geq L$, for every $i\in I^l(x,s)$, $A_i^l\subseteq H(x,s)+\epsilon U$. Again by convexity of $H(x,s)+\epsilon U$, we have that for every $\epsilon>0$, there exists $L$ such that $l\geq L$, $H^{(l)}(x,s)=\sum_{i\in I^l(x,s)} \psi^l_i(x,s)A_i^l\subseteq H(x,s)+\epsilon U$. Therefore for every $\epsilon>0$, $\cap_{l\geq1}H^{(l)}(x,s)\subseteq H(x,s)+\epsilon U$. Now it follows that $\bf{H(x,s)=\cap_{l\geq1}H^{(l)}(x,s)}\rm$. Fix $l\geq1$ and $(x,s)$. We have already shown that for every $i\in I^l(x,s)$, $\sup_{z\in A_i^l}\parallel z\parallel\leq K(1+\parallel x_i^l \parallel+2\epsilon_l)$. Using the fact that for every $i\in I^l(x,s)$, $\parallel x_i^l-x\parallel<\epsilon_l$ we get that for every $i\in I^l(x,s)$, $\sup_{z\in A_i^l}\parallel z\parallel\leq K(1+\parallel x\parallel+3\epsilon_l)$. Since $\left\{\psi_i^l(x,s)\right\}_{i\in I^l(x,s)}$ are convex combining coefficients, we get that $\bf{\sup_{z\in H^{(l)}(x,s)}\parallel z\parallel\leq K^{(l)}(1+\parallel x \parallel)}\rm$, where $K^{(l)}:=K+3\epsilon_l$. Fix $l\geq1$ and $(x,s)$. Since $\tilde{\mathscr{C}}_l$ is a locally finite open covering of $\mathbb{R}^d\times\mathcal{S}$, there exists $\delta>0$ such that $|I^l(\delta,x,s)|<\infty$ where $I^l(\delta,x,s):=\left\{i\in I^l:C_i^l\cap B(\delta,x,s)\neq\emptyset\right\}$. Since for every $i\in I^l$, $support(\psi_i^l)\subseteq C_i^l$, for every $(x',s')\in B(\delta,x,s)$ we have that $H^{(l)}(x',s')=\sum_{i\in I^l(\delta,x,s)}\psi_i^l(x',s')A_i^l$. Let $z\in H^{(l)}(x,s)$ and $\left\{\left(x_n,s_n\right)\right\}_{n\geq1}$ be some sequence converging to $(x,s)$. Then for every $i\in I^l(\delta,x,s)$ there exists $a_i^l\in A_i^l$ such that $z=\sum_{i\in I^l(\delta,x,s)}\psi_i^l(x,s)a_i^l$ and there exists $N$, such that for every $n\geq N$, $(x_n,s_n)\in B(\delta,x,s)$. For every $n\leq N$, define $z_n$ to be any value in $H^{(l)}(x_n,s_n)$ and for every $n\geq N$, define $z_n=\sum_{i\in I^l(\delta,x,s)}\psi_i^l(x_n,s_n)a_i^l\in H^{(l)}(x_n,s_n)$ where $a_i^l$ are as defined above. Then clearly for every $n\geq1$, $z_n\in H^{(l)}(x_n,s_n)$ and $\left\{z_n\right\}_{n\geq1}$ converges to $z$. Thus $H^{(l)}$ is l.s.c. at $(x,s)$. Upper simecontinuity of the map $H^{(l)}$ at $(x,s)$ follows from Theorem 1, chapter 1, section 13 of \cite{aubindi}. Since $(x,s)$ is arbitrary the map $H^{(l)}$ is both u.s.c. and l.s.c at every $(x,s)$ and hence is \bf{continuous}\rm. \section{Measurability of set-valued map $G$ in Lemma \ref{chint}} \label{prf_msb} Recall that $G:\mathcal{S}\rightarrow\left\{\text{subsets of }U\right\}$ is such that for every $s\in\mathcal{S}$, $G(s):=\left\{u\in U: h^{(l)}(x,s,u)=f(s)\right\}$. Let $C\subseteq U$ be a closed subset. Then $G^{-1}(C)=\left\{s\in\mathcal{S}:G(s)\cap C\neq\emptyset\right\}$. Thus $s\in G^{-1}(C)$ if and only if there exists $u\in C$, such that $h^{(l)}(x,s,u)=f(s)$ or equivalently $s\in G^{-1}(C)$ if and only if $f(s)\in h^{(l)}(x,s,C)$, where $h^{(l)}(x,s,C):=\left\{h^{(l)}(x,s,u):u\in C\right\}$. Since $h_x^{(l)}:\mathcal{S}\times C\rightarrow \mathbb{R}^d$ is continuous, by Proposition 1, chapter 1, section 2 of \cite{aubindi}, the set valued map $s\rightarrow h_x^{(l)}(s,C) $ is continuous and its measurability now follows from arguments similar to Lemma \ref{msble}(ii). Therefore, $G^{-1}(C)=\left\{s\in\mathcal{S} :f(s)\in h^{(l)}(x,s,C)\right\}=\left\{s\in\mathcal{S}:d(f(s),h^{(l)}(x,s,C))=0\right\}$. By Lemma \ref{mtool}, $\left\{s\in\mathcal{S}:d(f(s),h^{l}(x,s,C))=0\right\}\in\mathscr{B}(\mathcal{S})$ and hence $G^{-1}(C)\in\mathscr{B}(\mathcal{S})$. \section{Proof of uniform convergence in Lemma \ref{march1}(iii)} \label{prf_conv} Since $\left\{x_{n_k}\right\}_{k\geq1}$ converges to $x$, there exists $r>0$, such that $\sup_{k\geq1}\parallel x_{n_k}\parallel\leq r$. Fix $\epsilon>0$. We know that $h^{(l)}(\cdot)|_{2rU\times \mathcal{S}\times U}$ is uniformly continuous and hence there exists $\delta>0$ (depending on $\epsilon$), such that for every $x'\in\mathbb{R}^d$ satisfying $\parallel x'-x\parallel<\delta$, $\sup_{(s,u)\in\mathcal{S}\times U}\parallel h_x'^{(l)}(s,u)-h_x^{(l)}(s,u)\parallel<\epsilon$. Hence there exists $K$, such that for every $k\geq K$, $\parallel x_{n_k}-x\parallel<\delta$ and therefore for every $k\geq K$, $\sup_{(s,u)\in\mathcal{S}\times U}\parallel h_{x_{n_k}}^{(l)}(s,u)-h_x^{(l)}(s,u)\parallel<\epsilon$. \section{Applications} \label{app} In this section we consider four applications of the foregoing. These applications presented are natural extensions of the ones presented in chapter 5.3 of \cite{borkartxt} to the case with Markov noise. All the applications presented in this section are stated with Markov noise terms $\left\{S_n\right\}_{n\geq0}$ satisfying assumption $(A2)$. One may also consider the applications presented here with the Markov noise terms satisfying assumptions $(A2)'$ or $(A2)''$ as well. \subsection{Controlled stochastic approximation} Consider the iteration \begin{equation}\label{reccsa} X_{n+1}-X_n-a(n)M_{n+1}=a(n)h(X_n,Z_n,S_n), \end{equation} where, $\{Z_n\}_{n\geq0}$ is a random sequence taking values in a compact metric space $\mathcal{Z}$ and $h:\mathbb{R}^d\times\mathcal{Z} \times\mathcal{S}\rightarrow\mathbb{R}^d$ is continuous and Lipschitz in the first argument uniformly w.r.t. the second and third, i.e., there exists $L>0$ such that, for every $(z,s)\in\mathcal{Z}\times\mathcal{S}$ and for every $x_1,x_2\in\mathbb{R}^d$, \begin{equation*} \parallel h(x_1,z,s)-h(x_2,z,s)\parallel\leq L\parallel x_1-x_2\parallel. \end{equation*} $\{Z_n\}_{n\geq0}$ is viewed here as a control sequence, that is, $Z_n$ is chosen by the agent running the algorithm at time $n\geq0$ based on the observed history and possibly extraneous independent randomization as is usual in stochastic control problems. It could also be an unknown random process that affects the measurements in addition to the additive noise $\{M_n\}_{n\geq0}$. We shall assume that assumptions $(A2)-(A5)$ hold. Define the set valued map $H:\mathbb{R}^d\times\mathcal{S}\rightarrow\{\text{subsets of }\mathbb{R}^d\}$ such that, for every $(x,s)\in \mathbb{R}^d\times\mathcal{S}$, \begin{equation*} H(x,s):=\bar{co}(\left\{h(x,z,s):z\in\mathcal{Z}\right\}). \end{equation*} Then it can be shown that the set valued map $H$ satisfies assumption $(A1)$ (see Lemma 5 in chapter 5.3 of \cite{borkartxt}). Then recursion \eqref{reccsa} can be written as, \begin{equation*} X_{n+1}-X_n-a(n)M_{n+1}\in a(n)H(X_n,S_n) \end{equation*} and the asymptotic behavior of the same can be analyzed as in section \ref{recanal} of this paper. \subsection{Stochastic subgradient descent of a parametrized convex function} Consider the function, $J:\mathbb{R}^d\times\mathcal{S}\rightarrow\mathbb{R}$, continuous and for every $s\in\mathcal{S}$, $J(\cdot,s)$ is a convex function. Suppose $J(\cdot,s)$ is not continuously differentiable everywhere, so that $\nabla J(x,s)$ is not defined at all $x\in\mathbb{R}^d$, where $\nabla$ denotes gradient w.r.t. $x$. A natural generalization of gradient to this non-smooth case is the notion of subdifferential w.r.t. $x$ denoted by $\partial J(x,s)$, defined as the set of all $y\in\mathbb{R}^d$ such that for every $z\in\mathbb{R}^d$, \begin{equation*} J(z,s)\geq J(x,s)+\langle y,z-x\rangle. \end{equation*} Then for every $(x,s)\in\mathbb{R}^d\times\mathcal{S}$, $\partial J(x,s)$ is nonempty, convex and compact (see Proposition 5.4.1 in \cite{bertsekas}). From the definition of subdifferential and the continuity of function $J(\cdot)$, it can be easily shown that the set valued map $(x,s)\rightarrow\partial J(x,s)$ has a closed graph. Define the set valued map $H:\mathbb{R}^d\times\mathcal{S}\rightarrow\{\text{subsets of }\mathbb{R}^d\}$, such that for every $(x,s)\in\mathbb{R}^d\times\mathcal{S}$, \begin{equation}\label{sbgrd} H(x,s)=-\partial J(x,s). \end{equation} We further assume that the set valued map $H$ satisfies the linear growth property (that is assumption $(A1)(ii)$). Then by arguments in the preceding paragraph the set valued map $H$ satisfies assumption $(A1)$. Consider the recursion \eqref{rec} with the set valued map defined above. The recursion, \begin{equation*} X_{n+1}-X_{n}-a(n)M_{n+1}\in a(n)H(X_n,S_n), \end{equation*} where $\{M_{n}\}_{n\geq1}$ can be interpreted as subgradient estimation error. One case of interest where assumption $(A4)$ associated with the additive noise terms is satisfied is when $M_n$ are i.i.d. zero mean with finite variance (more generally martingale difference terms satisfying assumption $(A3)$ in chapter 2.1 of \cite{borkartxt}). Suppose the assumptions $(A2)-(A5)$ are satisfied then the asymptotic behavior of the above recursion can be analyzed as in section \ref{recanal} of this paper. If in addition to assumption $(A2)$, we know that for every $x\in\mathbb{R}^d$, $|D(x)|=1$ (that is the stationary distribution is unique for every $x$), then the set valued map associated with the limiting DI, $\hat{H}$ as defined in \eqref{lim1} is such that for every $x\in\mathbb{R}^d$, \begin{equation*} \hat{H}(x)\subseteq-\partial\mathbb{E}_{s}[J(\cdot);\mu_x](x), \end{equation*} where $\{\mu_x\}=D(x)$, $\mathbb{E}_{s}[J(\cdot);\mu_x]$ denotes a real valued map on $\mathbb{R}^d$ such that, for every $y\in\mathbb{R}^d$, $\mathbb{E}_{s}[J(\cdot);\mu_x](y)=\int_{\mathcal{S}}J(y,s)\mu_x(ds)$ (which is clearly a convex function) and $\partial\mathbb{E}_{s}[J(\cdot);\mu_x](x)$ denotes the subdifferential of the above defined map at $x$. If in addition we have that the state space of the Markov noise is finite (that is $|\mathcal{S}|<\infty$) then by Proposition 5.4.6 in \cite{bertsekas} we have that for every $x\in\mathbb{R}^d$, \begin{equation*} \hat{H}(x)=-\partial\mathbb{E}_{s}[J(\cdot);\mu_x](x). \end{equation*} As a consequence of the above we have that the global attractor of the DI, \begin{equation*} \frac{dx}{dt}\in-\partial\mathbb{E}_{s}[J(\cdot);\mu_x](x), \end{equation*} is also a global attractor of the limiting DI (that is DI \eqref{di2})and hence by the limit set theorem (that is Theorem \ref{ls}), we can conclude that the iterates $\{X_n\}_{n\geq0}$ will almost surely converge to such an attractor. Another important application is the minimization of the convex function obtained by averaging the parameter w.r.t. a particular probability distribution say, $\mu\in\mathcal{P}(\mathcal{S})$. Formally the minimization of function $J_{\mu}:\mathbb{R}^d\rightarrow \mathbb{R}$, where for every $x\in\mathbb{R}^d$, $J_{\mu}(x):=\int_{\mathcal{S}}J(x,s)\mu(ds)$. Consider recursion \eqref{rec}, where the set-valued map $H$ is as in equation \eqref{sbgrd} and Markov noise terms (that is $\{S_n\}_{n\geq0}$) satisfy assumption $(A2)$ with the additional condition that for every $x\in\mathbb{R}^d$, $D(x)=\{\mu\}/D_{\phi}(x)=\{\mu\}$. Then under additional assumptions of $(A1),(A3)-(A5)$ we have that the linearly interpolated trajectory of recursion \eqref{rec} is an APT for the flow of DI \eqref{di2}. The set valued map $\hat{H}$ associated with DI \eqref{di2}, can be shown to satisfy, \begin{equation*} \hat{H}(x)\subseteq-\partial J_{\mu}(x), \end{equation*} for every $x\in\mathbb{R}^d$. Further if the state space of the Markov noise is finite (that is $|\mathcal{S}|<\infty$) then by Proposition 5.4.6 in \cite{bertsekas} we have that for every $x\in\mathbb{R}^d$, \begin{equation*} \hat{H}(x)=-\partial J_{\mu}(x). \end{equation*} \subsection{Approximate drift problem} Consider the continuous function $h:\mathbb{R}^d\times\mathcal{S}\rightarrow\mathbb{R}^d$, satisfying the linear growth property, that is, there exists $K>0$, such that for every $(x,s)\in\mathbb{R}^d\times\mathcal{S}$, $\parallel h(x,s)\parallel\leq K(1+\parallel x\parallel)$. In many applications one wishes to implement the recursion, \begin{equation*} X_{n+1}-X_{n}-a(n)M_{n+1}=a(n)h(X_n,S_n), \end{equation*} where assumptions $(A2)/(A2)'/(A2)'',(A3)-(A5)$ are assumed to hold. But in practice one has access only to approximate value of the function $h(\cdot)$. Further the magnitude of the error in approximation of $h(\cdot)$ is only known to be bounded by a constant, say $\epsilon>0$. Then the recursion implemented becomes, \begin{equation}\label{recapd} X_{n+1}-X_{n}-a(n)M_{n+1}=a(n)(h(X_n,S_n)+\eta_n), \end{equation} where $\eta_n$ represents the error in estimation of $h(\cdot)$ and we have that for every $n\geq0$, $\parallel\eta_n\parallel\leq \epsilon$. Define the set valued map $H:\mathbb{R}^d\times\mathcal{S}\rightarrow\{\text{subsets of }\mathbb{R}^d\}$ such that for every $(x,s)\in \mathbb{R}^d\times\mathcal{S}$, \begin{equation}\label{hapd} H(x,s):=h(x,s)+\epsilon U, \end{equation} where $U$ denotes the closed unit ball in $\mathbb{R}^d$. Then recursion \eqref{recapd} can be written as, \begin{equation*} X_{n+1}-X_{n}-a(n)M_{n+1}\in a(n)H(X_n,S_n), \end{equation*} where the set valued map $H$ is as defined in equation \eqref{hapd}. It can be easily shown that the set valued map $H$ satisfies assumption $(A1)$. Under assumptions $(A2)-(A5)$ one may analyze the asymptotic behavior of recursion \eqref{recapd} as in section \ref{recanal} of this paper. \subsection{Discontinuous dynamics} Consider the recursion, \begin{equation}\label{recdd} X_{n+1}-X_{n}-a(n)M_{n+1}=a(n)h(X_n,S_n), \end{equation} where $h(\cdot)$ is merely measurable, satisfying the linear growth property that is there exists $K>0$, such that for every $(x,s)\in\mathbb{R}^d\times\mathcal{S}$, $\parallel h(x,s)\parallel\leq K(1+\parallel x\parallel)$. Define the set valued map $H:\mathbb{R}^d\times\mathcal{S}\rightarrow\{\text{subsets of }\mathbb{R}^d\}$ such that for every $(x,s)\in \mathbb{R}^d\times\mathcal{S}$, \begin{equation}\label{hdd} H(x,s):=\cap_{\epsilon>0}\bar{co}\left(\left\{h(y,s'):\parallel x-y\parallel<\epsilon,\ d_{\mathcal{S}}(s,s')<\epsilon\right\}\right). \end{equation} Then the set valued map defined above can be shown to satisfy assumption $(A1)$. Now the recursion \eqref{recdd} can be written in the form of recursion \eqref{rec} with the set valued map $H$ as defined in equation \eqref{hdd}. Under assumptions $(A2)-(A5)$, one may analyze the asymptotic behavior of recursion \eqref{recdd} as in section \ref{recanal} of this paper. \section{Recursion and assumptions} \label{rec_ass} Let $(\Omega,\mathscr{F},\mathbb{P})$ be a probability space and $\left\{X_n\right\}_{n\geq0}$ be a sequence of $\mathbb{R}^d$-valued random variables on $\Omega$ satisfying \begin{equation}\label{rec} X_{n+1}-X_{n}-a(n)M_{n+1}\in a(n)H(X_n,S_n) \end{equation} where, \begin{itemize} \item [(A1)]$H:\mathbb{R}^d\times\mathcal{S}\rightarrow\left\{\text{subsets of }\mathbb{R}^d\right\}$ is a set valued map on $\mathbb{R}^d\times\mathcal{S}$ where $(\mathcal{S},d_{\mathcal{S}})$ is a compact metric space and the map $H(\cdot)$ satisfies \begin{itemize} \item [(i)] for every $(x,s)\in\mathbb{R}^d\times\mathcal{S}$, $H(x,s)$ is a non-empty, compact, convex subset of $\mathbb{R}^d$, \item [(ii)] there exists $K>0$ such that, for every $(x,s)\in\mathbb{R}^d\times\mathcal{S},\\ \sup_{z\in H(x,s)}\parallel z\parallel\leq K(1+\parallel x\parallel)$, \item [(iii)] for every $\mathbb{R}^d\times\mathcal{S}$ valued sequence, $\left\{\left(x_n,s_n\right)\right\}_{n\geq1}$ converging to $(x,s)$, for every sequence $\left\{z_n\in H(x_n,s_n)\right\}_{n\geq1}$ converging to $z$, we have, $z\in H(x,s)$. \end{itemize} \end{itemize} Throughout this paper $\mathcal{P}(\cdots)$, denotes the set of probability measures on a compact metric space \lq$\cdots$' with the Prohorov topology (see chapter 2 in \cite{borkarap}). \begin{itemize} \item [(A2)]$\left\{S_n\right\}_{n\geq0}$ is a sequence of $\mathcal{S}$ valued random variables on $\Omega$ such that, for every $n\geq0$, for every $A\in \mathscr{B}(\mathcal{S})$, $\mathbb{P}(S_{n+1}\in A|S_m,X_m,m\leq n)= \mathbb{P}(S_{n+1}\in A|S_n,X_n)=\Pi(X_n,S_n)(A)$ $a.s.$ where $\Pi:\mathbb{R}^d\times\mathcal{S}\rightarrow\mathcal{P}(\mathcal{S})$, is continuous. \item [(A3)] $\left\{a(n)\right\}_{n\geq0}$ is a sequence of real numbers satisfying \begin{itemize} \item[(i)]$a(0)\leq1$ and for every $n\geq0$, $a(n)\geq a(n+1)$, \item[(ii)] $\sum_{n\geq0}a(n)=\infty$ and $\sum_{n\geq0}a(n)^2<\infty$. \end{itemize} \item [(A4)] $\left\{M_n\right\}_{n\geq1}$ is a sequence of $\mathbb{R}^d$ valued random variables such that, $a.e. (\omega)$, for every $T>0$ $\\\lim_{n\to\infty}\sup_{n\leq k\leq\tau(n,T)}\parallel\sum_{m=n}^{k}a(m)M_{m+1}\parallel=0$ where, $\tau(n,T):=\min\left\{m>n:\sum_{k=n}^{m-1}a(k)\geq T\right\}$. \item[(A5)] $\mathbb{P}(\sup_{n\geq0}\parallel X_n \parallel<\infty)=1$. \end{itemize} Assumption $(A1)$ is an extension of the assumption imposed on the set valued map for the case without Markov noise in \cite{benaim1} to the case with Markov noise. The only difference is in $(A1)(ii)$, since in our case we expect the constant $K$ to be independent of Markov noise terms. This strengthening of the assumption allows us to obtain integrable measurable selections and also to prove certain properties of the limiting differential inclusion in future sections. Assumption $(A2)$ ensures that for every $x\in \mathbb{R}^d$ the Markov chain defined by the transition kernel $\Pi(x,\cdot)(\cdot)$ possesses weak Feller property (see chapter 6.1.1 of \cite{meyntweed}). In addition to the above, since the state space of the Markov chain is a compact metric space, by Theorem 12.1.2(ii) in \cite{meyntweed}, for every $x\in\mathbb{R}^d$, the Markov chain defined by the transition kernel $\Pi(x,\cdot)(\cdot)$ admits at least one stationary distribution ($\mu\in\mathcal{P}(\mathcal{S})$ is stationary for the Markov chain defined by the transition kernel $\Pi(x,\cdot)(\cdot)$ if, for every $A\in\mathscr{B}(\mathcal{S})$, $\mu(A)=\int_{\mathcal{S}}\Pi(x,s)(A)\mu(ds)$). For every $x\in\mathbb{R}^d$, let $D(x)\subseteq\mathcal{P}(\mathcal{S})$ denote the set of stationary distributions of the Markov chain defined by the transition kernel $\Pi(x,\cdot)(\cdot)$. It can be easily shown that, \begin{itemize} \item [(i)] for every $x\in\mathbb{R}^d$, $D(x)$ is a convex and compact subset of $\mathcal{P}(\mathcal{S})$. \item [(ii)] the map $x\rightarrow D(x)$ has a closed graph, that is the set \begin{equation*} \left\{(x,\mu)\in\mathbb{R}^d\times\mathcal{P}(\mathcal{S}): x\in\mathbb{R}^d,\ \mu\in D(x)\right\}, \end{equation*} is a closed subset of $\mathbb{R}^d\times\mathcal{P}(\mathcal{S})$(for a proof of the above two properties we refer the reader to page 69 in \cite{borkartxt}). \end{itemize} It is worth noting here that for every $x\in\mathbb{R}^d$, we do \it{not }\rm require that the associated Markov chain be aperiodic, irreducible or possess a unique stationary distribution. Assumption $(A3)$ is the standard step size assumption. The assumptions of a non-increasing sequence and square summability are required in the analysis of the Markov noise component. Assumption $(A4)$ is the same additive noise assumption as in Proposition 1.3, section 1.5 of \cite{benaim1}. The assumption ensures that the contribution of the additive noise is eventually negligible. For various sufficient conditions under which $(A4)$ is satisfied we refer the reader to \cite{benaim1}. Assumption $(A5)$ ensures that the sample path of iterates of recursion \eqref{rec} remain bounded. This assumption is known as the stability assumption and sufficient conditions for ensuring the same for the single-valued case (see \cite{borkarmeyn}, \cite{andvih}) and for the set-valued case without Markov noise(see \cite{arunstab}) exist. \section{Background} \label{backgrd} In this section we shall review some results from the theory of set valued maps and their integration. First we shall present a result on approximation of upper semi-continuous set valued maps with continuous set valued maps. We will then use this approximation to obtain single valued maps that represent these approximate continuous set valued maps thus enabling us to rewrite the stochastic recursive inclusion, \eqref{rec}, as a standard stochastic approximation scheme with single valued maps. Secondly, in order to define the set valued map associated with the limiting differential inclusion (also known as mean field) and prove properties of the same we review definitions of measurability of set valued maps, its integral and some properties of the integral. \input{Upper_semicontinuous_set_valued_maps_and_their_approximation} \input{measurable_set_valued_maps_and_integration} \section{Iterate-independent and controlled Markov noise cases} \label{siacmnc} In this section we shall introduce two variants of assumption $(A2)$ under which a similar analysis as presented in the previous section can be carried out (assumptions $(A1),\ (A3)-(A5)$ are assumed to hold). The first case is of iterate-independent Markov noise i.e., where the transition probabilities do not depend on the iterate $x$ while second case is of controlled Markov noise i.e., the so-called noise process is not Markov by itself, but its lack of Markov property comes through its dependence on some possibly imperfectly known time varying process which is viewed as a control for analysis purposes. Throughout this section we assume that $(A1),\ (A3)-(A5)$ hold. \subsection{Iterate-independent Markov noise} First present the iterate-independent Markov noise assumption. \begin{itemize} \item [$(A2)'$] $\left\{S_n\right\}_{n\geq0}$ is a sequence of $\mathcal{S}$ valued random variables on $\Omega$ such that, for every $n\geq0$, for every $A\in \mathscr{B}(\mathcal{S})$, $\mathbb{P}(S_{n+1}\in A|S_m,X_m,m\leq n)= \mathbb{P}(S_{n+1}\in A|S_n)=\Pi(S_n)(A)$ $a.s.$ where $\Pi:\mathcal{S}\rightarrow\mathcal{P}(\mathcal{S})$ is continuous. \end{itemize} Assumption $(A2)'$ and the fact that the state space of Markov noise is a compact metric space gives us that the Markov chain defined by the transition kernel, $\Pi(\cdot)(\cdot)$, admits a stationary distribution ($\mu\in\mathcal{P}(\mathcal{S})$ is stationary for the Markov chain defined by the transition kernel $\Pi(\cdot)(\cdot)$ if, for every $A\in\mathscr{B}(\mathcal{S})$, $\mu(A)=\int_{\mathcal{S}}\Pi(s)(A)\mu(ds)$). Let $D\subseteq\mathcal{P}(\mathcal{S})$ denote the set of stationary distributions of the Markov chain defined by the transition kernel $\Pi(\cdot)(\cdot)$. It is easy to show that $D$ is a convex and compact subset of $\mathcal{P}(\mathcal{S})$. Define the set valued map, $\hat{H}_{i}:\mathbb{R}^d\rightarrow\left\{subsets\ of\ \mathbb{R}^d\right\}$, such that, for every $x\in\mathbb{R}^d$, \begin{equation*} \hat{H}_{i}(x):=\cup_{\mu\in D}\int_{\mathcal{S}}H_x(s)\mu(ds), \end{equation*} where for every $x\in\mathbb{R}^d$, the set valued map $H_x$ is as defined in section \ref{ldi}. Similar to Lemma \ref{march2}, it can be shown that the set valued map $\hat{H}$ defined above is a Marchaud map. By the same set of arguments as in section \ref{recanal}, we obtain the following result. \begin{theorem}\emph{[APT for iterate-independent Markov noise]} Under assumptions $(A1),\ (A2)',\ (A3)-(A5)$, for almost every $\omega$, the linearly interpolated trajectory of recursion \eqref{rec}, is an asymptotic pseudotrajectory for the flow of the DI, \begin{equation}\label{di3} \frac{dx}{dt}\in\hat{H}_{i}(x). \end{equation} \end{theorem} As a consequence of the above theorem, a limit set theorem similar to Theorem \ref{ls} can be established which under assumptions $(A1),(A2)', (A3)-(A5)$ characterizes the limit set of recursion \eqref{rec} in terms of the dynamics of DI\eqref{di3}. \subsection{Controlled Markov noise} Let $\left\{Z_n\right\}_{n\geq0}$ be a sequence of random variables(control sequence) on $\Omega$, taking values in a compact metric space, $\mathcal{Z}$. The controlled Markov noise assumption is as follows. \begin{itemize} \item [$(A2)''$]$\left\{S_n\right\}_{n\geq0}$ is a sequence of $\mathcal{S}$ valued random variables on $\Omega$ such that, for every $n\geq0$, for every $A\in \mathscr{B}(\mathcal{S})$, $\mathbb{P}(S_{n+1}\in A|S_m,Z_m,X_m,m\leq n)= \mathbb{P}(S_{n+1}\in A|S_n,Z_n,X_n)=\Pi(X_n,S_n,Z_n)(A)$ a.s. with $\Pi:\mathcal{S}\rightarrow\mathcal{P}(\mathcal{S})$, satisfying, \begin{itemize} \item [(i)] $\Pi$ is continuous. \item [(ii)] $\left\{Z_n\right\}_{n\geq0}$ is a stationary randomized control, i.e., for every $n\geq0$, for every $A\subseteq\mathscr{B}( \mathcal{Z}$), $\mathbb{P}(Z_n\in A|X_m,S_m,Z_{m-1},m\leq n)=\mathbb{P}(Z_n\in A|S_n)=\phi(S_n)(A)$ $a.s.$ with $\phi:\mathcal{S} \rightarrow\mathcal{P}(Z)$, measurable. \end{itemize} Let $\Pi_{\phi}:\mathbb{R}^d\times\mathcal{S}\rightarrow\mathcal{P}(\mathcal{S})$ be such that for every $x\in\mathbb{R}^d$, for every $s\in\mathcal{S}$, $\Pi_{\phi}(x,s)(ds')=\int_{\mathcal{Z}}\Pi(x,z,s)(ds')\phi(s)(dz)$. \begin{itemize} \item [(iii)] For every $x\in\mathbb{R}^d$ the Markov chain with state space $\mathcal{S}$ defined by the transition kernel, $\Pi_{\phi}(x,\cdot)(\cdot)$ admits a stationary distribution ($\mu\in\mathcal{P}(\mathcal{S})$ is stationary for the Markov chain defined by the transition kernel $\Pi_{\phi}(x,\cdot)(\cdot)$ if, for every $A\in\mathscr{B}(\mathcal{S})$, $\mu(A)=\int_{\mathcal{S}}\Pi_{\phi}(x,s)(A)\mu(ds)$). \end{itemize} \end{itemize} For every $x\in\mathbb{R}^d$, let $D_{\phi}(x)\subseteq\mathcal{P}(\mathcal{S})$ denote the set of stationary distributions of the Markov chain defined by the transition kernel, $\Pi_{\phi}(x,\cdot)(\cdot)$. The convexity, compactness of $D_{\phi}(x)$ and the closed graph property of the set valued map $x\rightarrow D_{\phi}(x)$ follow from arguments similar to those in page 69 of \cite{borkartxt}. Define the set valued map, $\hat{H}_{\phi}:\mathbb{R}^d\rightarrow\left\{\text{subsets of }\mathbb{R}^d\right\}$ such that for every $x\in\mathbb{R}^d$, \begin{equation*} \hat{H}_{\phi}(x):=\cup_{\mu\in D_{\phi}(x)}\int_{\mathcal{S}}H_x(s)\mu(ds), \end{equation*} where for every $x\in\mathbb{R}^d$, the set valued map $H_x$ is as defined in section \ref{ldi}. By a proof similar to Lemma \ref{march2}, one can show that the map $\hat{H}_{\phi}$ is a Marchaud map. Then by a similar set of arguments as in section \ref{recanal}, one obtains the following result. \begin{theorem}\emph{[APT for controlled Markov noise]} Under assumptions $(A1),\ (A2)'',\ (A3)-(A5)$, for almost every $\omega$, the linearly interpolated trajectory of recursion \eqref{rec} is an asymptotic pseudotrajectory for the flow of the DI, \begin{equation}\label{di4} \frac{dx}{dt}\in\hat{H}_{\phi}(x). \end{equation} \end{theorem} As a consequence of the above theorem, a limit set theorem similar to Theorem \ref{ls} can be established which under assumptions $(A1),(A2)'', (A3)-(A5)$ characterizes the limit set of recursion \eqref{rec} in terms of the dynamics of DI\eqref{di4}. \section{Limiting differential inclusion and its properties} \label{ldi} In this section we shall define the limiting differential inclusion (or the mean field) whose flow the iterates of recursion \eqref{rec} are expected to track. Analogous to the single valued case as in \cite{borkarmark}, the set valued map associated with the limiting differential inclusion is nothing but the set valued map obtained by averaging the set valued map $H$ in equation \eqref{rec} w.r.t. the stationary distributions of the Markov noise. The above shall be made precise in this section. Throughout this section we assume that $H$ denotes the set valued map satisfying $(A1)$ and $\left\{H^{(l)}\right\}_{l\geq1}$, $\left\{h^{(l)}\right\}_{l\geq1}$ are as in Lemma \ref{ctem} and Lemma \ref{param} respectively. First we define slices of the set valued maps $H$ and $H^{(l)}$ for every $x\in\mathbb{R}^d$. \begin{definition} For every $x\in \mathbb{R}^d$, define, \begin{itemize} \item [(i)] $H_x:\mathcal{S}\rightarrow\left\{\text{subsets of }\mathbb{R}^d\right\}$ such that, for every $s\in\mathcal{S}$, $H_x(s):=H(x,s)$. \item [(ii)] for every $l\geq1$, $H^{(l)}_x:\mathcal{S}\rightarrow\left\{\text{subsets of }\mathbb{R}^d\right\}$ such that, for every $s\in\mathcal{S}$, $\\H^{(l)}_x(s):=H^{(l)}(x,s)$. \item [(iii)] for every $l\geq1$, $h^{(l)}_x:\mathcal{S}\times U\rightarrow\mathbb{R}^d$ such that, for every $(s,u)\in\mathcal{S}\times U$, $\\h^{(l)}_x(s,u):=h^{(l)}(x,s,u)$. \end{itemize} \end{definition} The lemma below summarizes properties that the set valued maps $H_x$ and $H_x^{(l)}$ inherit from the set valued maps $H$ and $H^{(l)}$ respectively. \begin{lemma}\label{msble} For every $x\in \mathbb{R}^d$, \begin{itemize} \item [(i)] $H_x$ is a measurable set valued map and for every $s\in\mathcal{S}$, $H_x(s)$ is a convex and compact subset of $\mathbb{R}^d$. Further there exists $C_x:=K(1+\parallel x\parallel)>0$, such that $\\\sup_{s\in\mathcal{S}}\sup_{z\in H_x(s)}\parallel z\parallel\leq C_x$ (which means $H_x$ is bounded). \item [(ii)] for every $l\geq1$, $H^{(l)}_x$ is a measurable set valued map and for every $s\in\mathcal{S}$, $H^{(l)}_x(s)$ is a convex and compact subset of $\mathbb{R}^d$. Further for every $l\geq1$, there exists $C^{(l)}_x:=K^{(l)}(1+\parallel x\parallel)>0$, such that $\sup_{s\in\mathcal{S}}\sup_{z\in H^{(l)}_x(s)}\parallel z\parallel\leq C^{(l)}_x$ (which means $H^{(l)}_x$ is bounded). \item [(iii)] For any probability measure $\mu$ on $(\mathcal{S},\mathscr{B}(\mathcal{S}))$, all measurable selections of $H_x$ are $\mu$-integrable and hence $H_x$ is $\mu$-integrable. \item [(iv)] For any probability measure $\mu$ on $(\mathcal{S},\mathscr{B}(\mathcal{S}))$, all measurable selections of $H^{(l)}_x$ are $\mu$-integrable and hence $H^{(l)}_x$ is $\mu$-integrable. \item [(v)] for every $l\geq1$, $h^{(l)}_x$ is continuous, bounded by the constant $C^{(l)}_x$ where $C^{(l)}_x$ is as in part $(ii)$ of this lemma and for every $s\in\mathcal{S}$, $h^{(l)}_x(s,U)=H^{(l)}_x(s)$. \end{itemize} \end{lemma} \begin{proof} Fix some $x\in\mathbb{R}^d$. \begin{itemize} \item [(i)] For every $s\in\mathcal{S}$, the convexity and compactness of $H_x(s)$ follows from the definition of $H_x$ and assumption $(A1)(i)$. Boundedness of $H_x$ follows from the definition of $H_x$ and assumption $(A1)(ii)$. From definition of $H_x$ and assumption $(A1)(iii)$, we deduce that for every sequence $\left\{s_n\right\}_{n\geq1}$ converging to $s$ and for every sequence $\left\{z_n\in H_x(s_n)\right\}_{n\geq1}$ converging to $z$, $z\in H_x(s)$ (which means that the graph of $H_x$ is closed). Let $C$ be some closed subset of $\mathbb{R}^d$. Consider a sequence $\left\{s_n\right\}_{n\geq1}$ converging to $s$ such that for every $n\geq1$, $s_n\in \left\{s\in \mathcal{S}:H_x(s)\cap C\neq \emptyset\right\}$. For every $n\geq1$, let $z_n\in H_x(s_n)\cap C$. Since $H_x$ is bounded, $\left\{z_n\right\}_{n\geq1}$ is a bounded sequence in $\mathbb{R}^d$ and hence has a convergent subsequence, say $\left\{z_{n_k}\right\}_{k\geq1}$ converging to $z$. Since $C$ is closed and for every $k\geq1$, $z_{n_k}\in C$, we have $z\in C$. Since the graph of $H_x$ is closed, we have, $z\in H_x(s)$. Hence $H_x(s)\cap C\neq\emptyset$. Therefore $\left\{s\in \mathcal{S}:H_x(s)\cap C\neq \emptyset\right\}$ is closed and clearly belongs to $\mathscr{B}(\mathcal{S})$, which establishes the measurability of $H_x$. \item [(ii)] Fix some $l\geq1$. For every $s\in\mathcal{S}$, the convexity and compactness of $H^{(l)}_x(s)$ follows from the definition of $H^{(l)}_x$ and Lemma \ref{ctem}$(i)$. Boundedness of $H^{(l)}_x$ follows from the definition of $H^{(l)}_x$ and Lemma \ref{ctem}$(iii)$. Let $\left\{s_n\right\}_{n\geq1}$ be a sequence in $\mathcal{S}$ converging to $s$ and $\left\{z_n\in H^{(l)}_x(s_n)\right\}_{n\geq1}$ converging to $z$. Using the continuity of $H^{(l)}$ and the definition of $H^{(l)}_x$, we have, for every $\epsilon>0$, there exists $\delta>0$ such that $\cup_{\left\{n:d(s_n,s)<\delta\right\}}H^{(l)}_x(s_n)\subseteq H^{(l)}_x(s)+\epsilon U$. Since $H^{(l)}_x(s)+\epsilon U$ is closed, we have, $\overline{\cup_{\left\{n:d(s_n,s)<\delta\right\}}H^{(l)}_x(s_n)}\subseteq H^{(l)}_x(s)+\epsilon U$. Hence for every $\epsilon>0$, $z\in H^{(l)}_x(s)+\epsilon U$. Since $H^{(l)}_x(s)$ is compact we have, $z\in H^{(l)}_x(s)$. Hence the graph of $H^{(l)}_x$ is closed and by argument similar to the one in part $(i)$ of this proof we can prove the measurability of $H^{(l)}_x$. \item [(iii)] Since $H_x$ is bounded, for every $f\in\mathscr{S}(H_x)$, we have $\sup_{s\in\mathcal{S}}\parallel f(s)\parallel\leq C_x$. Hence $\int_{\mathcal{S}}\parallel f(s)\parallel\mu(ds)\leq C_x$. \item [(iv)] Argument is same as in part $(iii)$ of this proof. \item [(v)] Follows from definition of $h^{(l)}_x$ and Lemma \ref{param}.\qed \end{itemize} \end{proof} Recall that $\mathcal{P}(\mathcal{S}\times U)$ denotes the set of probability measures on $(\mathcal{S}\times U,\mathscr{B}(\mathcal{S})\otimes\mathscr{B}(U))$ with the Prohorov's topology. For any probability measure $\nu\in\mathcal{P}(\mathcal{S}\times U)$, let $\nu_{\mathcal{S}}\in\mathcal{P}(\mathcal{S})$ denote the image of $\nu$ under the projection, $\mathcal{S}\times U\rightarrow\mathcal{S}$ (i.e. for every $A\in\mathscr{B}(\mathcal{S})$, $\nu_{\mathcal{S}}(A):=\int_{A\times U}\nu(ds,du)$). The next lemma provides a useful characterization of the integral of set valued maps $H^{(l)}_x$ in terms of their parametrization, $h^{(l)}_x$. \begin{lemma}\label{chint} For every $x\in\mathbb{R}^d$, for every $l\geq1$, for every probability measure $\mu$ on $(\mathcal{S},\mathscr{B}(\mathcal{S}))$, \begin{equation*} \int_{\mathcal{S}}H^{(l)}_x(s)\mu(ds)=\left\{\int_{\mathcal{S}\times U}h^{(l)}_x(s,u)\nu(ds,du): \nu\in \mathcal{P}(\mathcal{S}\times\ U),\ \nu_{\mathcal{S}}=\mu\right\} \end{equation*} \end{lemma} \begin{proof} Fix some $x\in\mathbb{R}^d$, $l\geq1$ and $\mu\in\mathcal{P}(\mathcal{S})$. Let $z\in\int_{\mathcal{S}}H^{(l)}_x(s)\mu(ds)$. There exists $f\in\mathscr{S}(H^{(l)}_x)$ such that, $z=\int_{\mathcal{S}}f(s)\mu(ds)$. Define a set valued map, $G:\mathcal{S}\rightarrow\left\{\text{subsets of }U\right\}$ such that, for every $s\in\mathcal{S}$, $G(s):=\left\{u\in U: h^{(l)}(x,s,u)=f(s)\right\}$. Clearly for every $s\in\mathcal{S}$, $G(s)$ is non-empty and from the continuity of $h^{(l)}$ we have that $G(s)$ is a closed subset of $U$. Moreover $G$ is a measurable set valued map (the proof of measurability has been provided in appendix \ref{prf_msb}). Since $G$ is measurable, by Lemma \ref{msel}$(i)$ we have, $\mathscr{S}(G)\neq\emptyset$. For any $g\in\mathscr{S}(G)$, we have, for every $s\in\mathcal{S}$, $h^{(l)}(x,s,g(s))=f(s)$. Define $\hat{g}:\mathcal{S}\rightarrow\mathcal{S}\times U$ such that, for every $s\in\mathcal{S}$, $\hat{g}(s)=(s,g(s))$. Let $\nu:=\mu\hat{g}^{-1}$ (push-forward measure). Clearly $\nu_{\mathcal{S}}=\mu$ and $\int_{\mathcal{S}\times U}h^{(l)}(x,s,u)\nu(ds,du))=\int_{\mathcal{S}\times U}h^{(l)}(x,s,u)\mu\hat{g}^{-1}(ds,du))= \int_{\mathcal{S}}h^{(l)}(x,\hat{g}(s))\mu(ds)=\int_{\mathcal{S}}h^{(l)}(x,s,g(s))\mu(ds)= \int_{\mathcal{S}}f(s)\mu(ds)=z$. Let $\nu\in\mathcal{P}(\mathcal{S}\times U)$ such that, $\nu_{\mathcal{S}}=\mu$. By Corollary 3.1.2 in \cite{borkarap}, there exists a $\mu$-a.s. unique measurable map $q:\mathcal{S}\rightarrow\mathcal{P}(U)$ such that, $\nu(ds,du)=\mu(ds)q(s,du)$. By definition of $h^{(l)}_x$ and Lemma \ref{param}, we have, for every $s\in\mathcal{S}$, $H^{(l)}_x(s)=h_x^{(l)}(s,U)=\left\{h_x^{(l)}(s,u):u\in U\right\}$ is convex and compact subset of $\mathbb{R}^d$. Hence for every $s\in\mathcal{S}$, $\int_{U}h_x^{(l)}(s,u)q(s,du)\in H^{(l)}_x(s)$. Let $f:\mathcal{S}\rightarrow\mathbb{R}^d$ be such that for every $s\in\mathcal{S}$, $f(s)=\int_{U}h_x^{(l)}(s,u)q(s,du)$. Then, clearly $f$ is measurable and $f\in\mathscr{S}(H^{(l)}_x)$. Therefore, $\int_{\mathcal{S}\times U}h^{(l)}_x(s,u)\nu(ds,du)= \int_{\mathcal{S}}\big{[}\int_{U}h^{(l)}_x(s,u)q(s,du)\big{]}\mu(ds)=\int_{\mathcal{S}}f(s)\mu(ds)\in \int_{\mathcal{S}}H^{(l)}_x(s)\mu(ds)$.\qed \end{proof} Recall that for every $x\in\mathbb{R}^d$, $D(x)$ denotes the set of stationary distributions associated with the Markov chain whose transition probability kernel is given by $\Pi(x,\cdot)(\cdot)$ as in assumption $(A2)$. We shall now define the set valued maps associated with the limiting differential inclusion which is obtained by averaging the set valued map $H$ w.r.t. the stationary distributions of the Markov noise. We shall perform a similar operation on set valued maps $H^{(l)}$ which approximate $H$. \begin{definition}: \begin{itemize} \item [(i)] Define $\hat{H}:\mathbb{R}^d\rightarrow\left\{\text{subsets of }\mathbb{R}^d\right\}$ such that, for every $x\in\mathbb{R}^d$, \begin{equation}\label{lim1} \hat{H}(x):=\cup_{\mu\in D(x)}\int_{\mathcal{S}}H_x(s)\mu(ds). \end{equation} \item [(ii)] For every $l\geq1$, define $\hat{H}^{(l)}:\mathbb{R}^d\rightarrow\left\{\text{subsets of }\mathbb{R}^d\right\}$ such that, for every $x\in\mathbb{R}^d$, \begin{equation}\label{lim2} \hat{H}^{(l)}(x):=\cup_{\mu\in D(x)}\int_{\mathcal{S}}H^{(l)}_x(s)\mu(ds). \end{equation} \end{itemize} \end{definition} For every $l\geq1$, the differential inclusion (DI) associated with the set valued map $\hat{H}^{(l)}$ is given by, \begin{equation}\label{di1} \frac{dx}{dt}\in \hat{H}^{(l)}(x). \end{equation} Similarly the differential inclusion (DI) associated with the set valued map $\hat{H}$ is given by, \begin{equation}\label{di2} \frac{dx}{dt}\in \hat{H}(x). \end{equation} A function $\bf{x}\rm:\mathbb{R}\rightarrow\mathbb{R}^d$ is said to be a \bf{solution }\rm of DI \eqref{di1} (or DI \eqref{di2}) with initial condition $x_0\in\mathbb{R}^d$ if, $\bf{x}\rm$ is absolutely continuous, $\bf{x}\rm(0)=x_0$ and for a.e. $t\in\mathbb{R}$, $\frac{d\bf{x}\rm(t)}{dt}\in\hat{H}^{(l)}(\bf{x}\rm(t))$ (or $\frac{d\bf{x}\rm(t)}{dt}\in\hat{H}(\bf{x}\rm(t))$). For every $l\geq1$, for every initial condition $x_0\in\mathbb{R}^d$, let $\Sigma^{(l)}(x_0)$ denote the set of solutions to DI \eqref{di1} with initial condition $x_0$, that is, \begin{equation*} \Sigma^{(l)}(x_0)=\left\{\bf{x}\rm:\mathbb{R}\rightarrow\mathbb{R}^d: \bf{x}\rm\ is\ a\ solution\ of\ DI\ \eqref{di1},\ \bf{x}\rm(0)=x_0\right\}. \end{equation*} Similarly, let $\Sigma(x_0)$ denote the set of solutions of DI \eqref{di2} with initial condition $x_0\in\mathbb{R}^d$. For any $A\subseteq\mathbb{R}^d$, for every $l\geq1$, $\Sigma^{(l)}(A):=\cup_{x_0\in A}\Sigma^{(l)}(x_0)$ (similarly, $\Sigma(A):=\cup_{x_0\in A}\Sigma(x_0)$). The next lemma establishes some properties of the set valued map $\hat{H}^{(l)}$ which ensure the existence of solutions to DI \eqref{di1}. \begin{lemma}\label{march1} For every $l\geq1$, $\hat{H}^{(l)}$ satisfies the following, \begin{itemize} \item [(i)] for $K^{(l)}$ as in Lemma \ref{ctem}$(iii)$, we have, for every $x\in\mathbb{R}^d$, $\\\sup_{z\in\hat{H}^{(l)}(x)}\parallel z\parallel\leq K^{(l)}(1+\parallel x\parallel)$. \item [(ii)] for every $x\in\mathbb{R}^d$, $\hat{H}^{(l)}(x)$ is a non-empty, convex and compact subset of $\mathbb{R}^d$. \item [(iii)] for every sequence $\left\{x_n\right\}_{n\geq1}$ in $\mathbb{R}^d$ converging to $x$, for every sequence $\left\{z_n\in\hat{H}^{(l)}(x_n)\right\}_{n\geq1}$ converging to $z$, we have, $z\in\hat{H}^{(l)}(x)$. \end{itemize} \end{lemma} \begin{proof} Fix $l\geq1$. \begin{itemize} \item [(i)] For every $x\in\mathbb{R}^d$, from Lemma \ref{msble}$(ii)$, we have, for every $f\in\mathscr{S}(H^{(l)}_x)$, for every $\mu\in D(x)$, $\parallel\int_{\mathcal{S}}f(s)\mu(ds)\parallel\leq\int_{\mathcal{S}}\parallel f(s)\parallel\mu(ds)\leq C^{(l)}_x= K^{(l)}(1+\parallel x\parallel)$. Using the above and from the definition of $\hat{H}^{(l)}$ we have, $\sup_{z\in \hat{H}^{(l)}(x)}\parallel z\parallel=\\\sup_{\mu\in D(x)}\sup_{f\in\mathscr{S}(H^{(l)}_x)}\parallel \int_{\mathcal{S}}f(s)\mu(ds)\parallel\leq K^{(l)}(1+\parallel x\parallel)$. \item [(ii)] For every $x\in\mathbb{R}^d$, $\hat{H}^{(l)}(x)$ is clearly non-empty. Let $z_1,z_2\in\hat{H}^{(l)}(x)$ and $\theta\in(0,1)$. By definition of $\hat{H}^{(l)}$ and by Lemma \ref{chint}, we have that there exist $\nu^{1},\nu^{2}\in \mathcal{P}(\mathcal{S}\times U)$ such that, for $i\in\left\{1,2\right\}$, $z_i=\int_{\mathcal{S}\times U}h^{(l)}_x(s,u)\nu^i(ds,du)$ and $\nu^{i}_{\mathcal{S}}\in D(x)$. Hence, \begin{align*} \theta z_1+(1-\theta)z_2&=\theta\int_{\mathcal{S}\times U}h^{(l)}_x(s,u)\nu^1(ds,du)+ (1-\theta)\int_{\mathcal{S}\times U}h^{(l)}_x(s,u)\nu^2(ds,du)\\ &=\int_{\mathcal{S}\times U}h^{(l)}_x(s,u)(\theta\nu^1+(1-\theta)\nu^2)(ds,du), \end{align*} where, $\theta\nu^1+(1-\theta)\nu^2\in\mathcal{P}(\mathcal{S}\times U)$ such that, for every $A\in\mathscr{B}(\mathcal{S})\otimes \mathscr{B}(U)$, $\\(\theta\nu^1+(1-\theta)\nu^2)(A)=\theta\nu^1(A)+(1-\theta)\nu^2(A)$. Further $(\theta\nu^1+(1-\theta)\nu^2)_{\mathcal{S}}=\theta\nu^1_{\mathcal{S}}+(1-\theta)\nu^2_{\mathcal{S}}$ and it belongs to $D(x)$, since for every $x\in\mathbb{R}^d$, $D(x)$ is convex. By part $(i)$ of this proof, for every $x\in\mathbb{R}^d$, $\hat{H}^{(l)}(x)$ is bounded. Hence in order to show compactness it is enough to prove that for every $x\in\mathbb{R}^d$, $\hat{H}^{(l)}(x)$ is closed. Let $\left\{z_n\right\}_{n\geq1}$ be a sequence in $\hat{H}^{(l)}(x)$ for some $x\in\mathbb{R}^d$, converging to $z$. By Lemma \ref{chint}, we know that for every $n\geq1$, there exists $\nu^n\in\mathcal{P}(\mathcal{S}\times U)$ such that, $z_n=\int_{\mathcal{S}\times U}h^{(l)}_x(s,u)\nu^n(ds,du)$ and $\nu^n_{\mathcal{S}}\in D(x)$. Since $\mathcal{S}\times U$ is a compact metric space, by Prohorov's theorem (see theorem 2.3.1 in \cite{borkarap}), there exists a subsequence $\left\{n_k\right\}_{k\geq1}$ such that, $\left\{\nu^{n_k}\right\}_{k\geq1}$ converges to some $\nu\in\mathcal{P}(\mathcal{S}\times U)$. Clearly $\left\{z_{n_k}\right\}_{k\geq1}$ converges to $z$ and $\left\{\nu^{n_k}_{\mathcal{S}}\right\}_{k\geq1}$ converges to $\nu_{\mathcal{S}}$ in $\mathcal{P}(\mathcal{S})$. Since for every $x\in\mathbb{R}^d$, $D(x)$ is a closed subset of $\mathcal{P}(\mathcal{S})$, we have $\nu_{\mathcal{S}}\in D(x)$. By theorem 2.1.1$(ii)$ in \cite{borkarap} and continuity of $h^{(l)}_x$ we have $\left\{\int_{\mathcal{S}\times U}h^{(l)}_x(s,u)\nu^{n_k}(ds,du)\right\}_{k\geq1}$ converges to $\int_{\mathcal{S}\times U}h^{(l)}_x(s,u)\nu(ds,du)$ and hence $z=\int_{\mathcal{S}\times U}h^{(l)}_x(s,u)\nu(ds,du)$ with $\nu_{\mathcal{S}}\in D(x)$. Therefore $z\in \hat{H}^{(l)}(x)$ and hence $\hat{H}^{(l)}(x)$ is closed. \item [(iii)] Let $\left\{x_n\right\}_{n\geq1}$ be a sequence in $\mathbb{R}^d$ converging to $x$ and $\left\{z_n\in \hat{H}^{(l)}(x_n)\right\}_{n\geq1}$ converging to $z$. By Lemma \ref{chint}, we have, for every $n\geq1$, there exists $\nu^n\in\mathcal{P}(\mathcal{S}\times U)$, such that $z_n=\int_{\mathcal{S}\times U}h_{x_n}^{(l)}(s,u)\nu^n(ds,du)$ and $\nu^n_{\mathcal{S}}\in D(x_n)$. Since $\mathcal{S} \times U$ is a compact metric space, by Prohorov's theorem we have that, there exists a subsequence, $\left\{n_k\right\}_{k\geq1}$ such that, $\left\{\nu^{n_k}\right\}_{k\geq1}$ converges to some $\nu\in\mathcal{P}(\mathcal{S}\times U)$. Since $\left\{x_{n_k}\right\}_{k\geq1}$ converges to $x$, we have $\left\{h^{(l)}_{x_{n_k}}\right\}_{k\geq1}$ converges uniformly to $h^{(l)}_x$ (for a proof see appendix \ref{prf_conv}). By uniform convergence of $h^{(l)}_{x_{n_k}}$ to $h^{(l)}_x$ and Theorem 2.1.1$(ii)$ in \cite{borkarap} we have that the sequence $\left\{\int_{\mathcal{S}\times U}h^{(l)}_{x_{n_k}}(s,u)\nu^{n_k}(ds,du)\right\}_{k\geq1}$ converges to $\int_{\mathcal{S}\times U}h^{(l)}_x(s,u)\nu(ds,du)$. Hence $z=\int_{\mathcal{S}\times U}h^{(l)}_x(s,u)\nu(ds,du)$. Clearly $\left\{\nu^{n_k}_{\mathcal{S}}\right\}_{k\geq1}$ converges to $\nu_{\mathcal{S}}$ and by closed graph property of the map $x\rightarrow D(x)$, we have $\nu_{\mathcal{S}}\in D(x)$. Hence $z=\int_{\mathcal{S}\times U}h^{(l)}_x(s,u)\nu(ds,du)$ and $\nu_{\mathcal{S}}\in D(x)$. Therefore by Lemma \ref{chint} and definition of $\hat{H}^{(l)}$, we have, $z\in \hat{H}^{(l)}(x)$.\qed \end{itemize} \end{proof} The set valued map satisfying properties stated in Lemma \ref{march1}, is called a Marchaud map (see page 62 of \cite{aubinvt}). By Lemma \ref{march1}, we know that for every $l\geq1$, the set valued maps $\hat{H}^{(l)}$ are Marchaud maps. For such maps their associated DIs are known to admit at least one solution through every initial condition (see \cite{aubindi}, chapter 2.1 or \cite{benaim1}, section 1.2). Thus for every $l\geq1$, for every initial condition $x_0\in\mathbb{R}^d$, $\Sigma^{(l)}(x_0)\neq\emptyset$. The next lemma establishes relation between $\hat{H}$ and $\hat{H}^{(l)}$. \begin{lemma}\label{approx1} For every $x\in\mathbb{R}^d$, \begin{itemize} \item [(i)] for every $l\geq1$, $\hat{H}(x)\subseteq\hat{H}^{(l+1)}(x)\subseteq\hat{H}^{(l)}(x)$. \item [(ii)]$\cup_{\mu\in D(x)}\cap_{l\geq1}\int_{\mathcal{S}}H_x^{(l)}(s)\mu(ds)=\cap_{l\geq1}\hat{H}^{(l)}(x)$. \item [(iii)] $\hat{H}(x)=\cap_{l\geq1}\hat{H}^{(l)}(x)$. \end{itemize} \end{lemma} \begin{proof} Fix $x\in\mathbb{R}^d$. \begin{itemize} \item [(i)] Fix $l\geq1$. By Lemma \ref{ctem}$(ii)$, for every $(x,s)\in\mathbb{R}^d\times\mathcal{S}$, $H(x,s)\subseteq H^{(l+1)}(x,s)\subseteq H^{(l)}(x,s)$. Hence, for every $x\in\mathbb{R}^d$, by definition of $H_x$ and $H^{(l)}_x$ we have, for every $s\in\mathcal{S}$, $H_x(s)\subseteq H^{(l+1)}_x(s)\subseteq H^{(l)}_x(s)$. Therefore, $\mathscr{S}(H_x)\subseteq\mathscr{S}(H_x^{(l+1)})\subseteq \mathscr{S}(H^{(l)}_x)$. From the above we obtain that, for every $\mu\in D(x)$, $\int_{\mathcal{S}}H_x(s)\mu(ds)\subseteq \int_{\mathcal{S}}H_x^{(l+1)}(s)\mu(ds)\subseteq\int_{\mathcal{S}}H^{(l)}_x(s)\mu(ds)$ which leads to the desired conclusion. \item [(ii)] Clearly by definition of the set valued map $\hat{H}^{(l)}$ we have that $\cup_{\mu\in D(x)}\cap_{l\geq1}\int_{\mathcal{S}}H_x^{(l)}(s)\mu(ds)\subseteq\cap_{l\geq1}\hat{H}^{(l)}(x)$. Let $z\in\cap_{l\geq1}\hat{H}^{(l)}(x)$. Then for every $l\geq1$, there exists $\mu^{(l)}\in D(x)$ such that $z\in\int_{\mathcal{S}} H^{(l)}_x(s)\mu^{(l)}(ds)$. By Prohorov's theorem the sequence of probability measures $\left\{\mu^{(l)}\right\}_{l\geq1}$ is relatively compact in $\mathcal{P}(\mathcal{S})$ and hence has a limit point, say $\mu$. Let $\left\{\mu^{(l_k)}\right\}_{k\geq1}$ denote a subsequence with $\mu$ as its limit and since $D(x)$ is a closed subset of $\mathcal{P}(\mathcal{S})$, we have that $\mu\in D(x)$. For every $l\geq1$, for every $k$ such that $l_k\geq l$, we have that $\mathscr{S}(H_x^{(l_k)})\subseteq\mathscr{S}(H_x^{(l)})$. Thus for every $l\geq1$, for every $k$ such that $l_k\geq l$, we have that $z\in\int_{\mathcal{S}}H^{(l)}_x(s)\mu^{(l_k)}(ds)$. By Lemma \ref{chint}, we have that for every $l\geq1$, for every $k$ such that $l_k\geq l$, there exists $\nu^{(l,l_k)}\in \mathcal{P}(\mathcal{S}\times U)$ with $\nu^{(l,l_k)}_{\mathcal{S}}=\mu^{(l_k)}$ and $z=\int_{\mathcal{S}\times U}h^{(l)}(x,s,u) \nu^{(l,l_k)}(ds,du)$. Fix $l\geq1$. Since $\mathcal{S}\times U$ is a compact metric space, by Prohorov's theorem we have that the sequence $\left\{\nu^{(l,l_k)}\right\}_{k\geq1}$ is relatively compact in $\mathcal{P}(\mathcal{S}\times U)$. Let $\nu^{(l)}$ denote a limit point of the above sequence and its clear that $\nu^{(l)}_{\mathcal{S}}=\mu$. Then clearly $z=\int_{\mathcal{S}\times U} h^{(l)}(x,s,u)\nu^{(l)}(ds,du)$ and hence by Lemma \ref{chint}, $z\in\int_{\mathcal{S}}H^{(l)}_x(s)\mu(ds)$. Since $l\geq1$ is arbitrary, we get that for $\mu\in D(x)$, for every $l\geq1$, $z\in\int_{\mathcal{S}}H^{(l)}_x(s)\mu(ds)$. Thus $z\in\cup_{\mu\in D(x)}\cap_{l\geq1}\int_{\mathcal{S}}H_x^{(l)}(s)\mu(ds)$ and hence $\cap_{l\geq1}\hat{H}^{(l)}(x)\subseteq \cup_{\mu\in D(x)}\cap_{l\geq1}\int_{\mathcal{S}}H_x^{(l)}(s)\mu(ds)$. \item [(iii)] By part$(i)$ of this lemma we have, for every $x\in\mathbb{R}^d$, $\hat{H}(x)\subseteq\cap_{l\geq1}\hat{H}^{(l)}(x)$. Therefore its enough to show that for every $x\in\mathbb{R}^d$, $\cap_{l\geq1}\hat{H}^{(l)}(x)\subseteq\hat{H}(x)$. Fix $x\in\mathbb{R}^d$ and $\mu\in D(x)$. Let $z\in\cap_{l\geq1}\int_{\mathcal{S}}H^{(l)}_x(s)\mu(ds)$. For every $l\geq1$, there exists $f^{(l)}\in\mathscr{S}(H^{(l)}_x)$ such that $z=\int_{\mathcal{S}}f^{(l)}(s)\mu(ds)$. Let $d(z,\int_{\mathcal{S}}H_x(s)\mu(ds)):=\inf\left\{\parallel z-y\parallel: y\in\int_{\mathcal{S}}H_x(s)\mu(ds)\right\}$. Then, for every $l\geq1$, \begin{align*} d(z,\int_{\mathcal{S}}H_x(s)\mu(ds))&=\inf_{f\in\mathscr{S}(H_x)}\parallel\int_{\mathcal{S}}(f^{(l)}(s)-f(s))\mu(ds)\parallel\\ &\leq\inf_{f\in\mathscr{S}(H_x)}\int_{\mathcal{S}}\parallel f^{(l)}(s)-f(s)\parallel\mu(ds)\\ &=\int_{\mathcal{S}}\inf_{f\in\mathscr{S}(H_x)}\parallel f^{(l)}(s)-f(s)\parallel\mu(ds), \end{align*} where the last equality follows from Lemma 1.3.12 in \cite{shoumei}. By Lemma \ref{msble}$(i)$, $H_x$ is a measurable set valued map and hence by Lemma \ref{msel}$(ii)$, $H_x$ admits a Castaing representation, $\left\{f_n\right\}_{n\geq1}$. Hence for every $s\in\mathcal{S}$, $d(f^{(l)}(s),H_x(s))\leq\inf_{f\in\mathscr{S}(H_x)}\parallel f^{(l)}(s)-f(s)\parallel\leq \inf_{n\geq1}\parallel f^{(l)}(s)-f_n(s)\parallel=d(f^{(l)}(s),H_x(s))$ where $s\rightarrow d(f^{(l)}(s),H_x(s))$ is as in Lemma \ref{mtool}. Therefore, for every $l\geq1$, \begin{equation*} d(z,\int_{\mathcal{S}}H_x(s)\mu(ds))\leq\int_{\mathcal{S}}d(f^{(l)}(s),H_x(s))\mu(ds). \end{equation*} By observation (b) stated after Lemma \ref{ctem}, we have that, for every $s\in\mathcal{S}$, $\\\lim_{l\to\infty}d(f^{(l)}(s),H_x(s))=0$. Further by observation (a) stated after Lemma \ref{ctem}, Lemma \ref{msble}$(i)-(ii)$, we have that, for every $s\in\mathcal{S}$, $d(f^{(l)}(s),H_x(s))\leq(\tilde{K}+K)(1+\parallel x\parallel)$. Thus, by bounded convergence theorem we get, $\lim_{l\to\infty}\int_{\mathcal{S}}d(f^{(l)}(s),H_x(s))\mu(ds)=0$. Hence, $d(z,\int_{\mathcal{S}}H_x(s)\mu(ds))=0$. By Lemma \ref{cldint}, we have that $\int_{\mathcal{S}}H_x(s)\mu(ds)$ is closed. Therefore $z\in\int_{\mathcal{S}}H_x(s)\mu(ds)$. From the arguments in the previous paragraph, we have that for every $x\in\mathbb{R}^d$, for every $\mu\in D(x)$, $\cap_{l\geq1}\int_{\mathcal{S}}H^{(l)}_x(s)\mu(ds)\subseteq\int_{\mathcal{S}}H_x(s)\mu(ds)$. Thus, for every $x\in\mathbb{R}^d$, $\\\cup_{\mu\in D(x)}\cap_{l\geq1}\int_{\mathcal{S}}H^{(l)}_x(s)\mu(ds)\subseteq\cup_{\mu\in D(x)}\int_{\mathcal{S}}H_x(s)\mu(ds)$. Therefore, by part $(ii)$ of this lemma we have that for every $x\in\mathbb{R}^d$, $\cap_{l\geq1}\hat{H}^{(l)}(x)\subseteq\hat{H}(x)$.\qed \end{itemize} \end{proof} In the next lemma we show that the set valued map $\hat{H}$ is a Marchaud map. \begin{lemma}\label{march2} The set valued map $\hat{H}$ satisfies the following: \begin{itemize} \item [(i)] For $K>0$ as in Lemma \ref{msble}$(i)$, for every $x\in\mathbb{R}^d$, $\sup_{z\in\hat{H}(x)}\parallel z\parallel\leq K(1+\parallel x\parallel)$. \item [(ii)] For every $x\in\mathbb{R}^d$, $\hat{H}(x)$ is a non-empty, convex and compact subset of $\mathbb{R}^d$. \item [(iii)] For every sequence $\left\{x_n\right\}_{n\geq1}$ in $\mathbb{R}^d$ converging to $x$, for every sequence $\left\{z_n\in\hat{H}(x_n)\right\}_{n\geq1}$ converging to $z$, we have, $z\in\hat{H}(x)$. \end{itemize} \end{lemma} \begin{proof}: \begin{itemize} \item [(i)] For every $x\in\mathbb{R}^d$, from Lemma \ref{msble}$(i)$, we have, for every $f\in\mathscr{S}(H_x)$, for every $\mu\in D(x)$, $\parallel\int_{\mathcal{S}}f(s)\mu(ds)\parallel\leq\int_{\mathcal{S}}\parallel f(s)\parallel\mu(ds)\leq C_x= K(1+\parallel x\parallel)$. Using the above and from the definition of $\hat{H}$ we have, $\sup_{z\in \hat{H}(x)}\parallel z\parallel=\sup_{\mu\in D(x)}\sup_{f\in\mathscr{S}(H_x)}\parallel \int_{\mathcal{S}}f(s)\mu(ds)\parallel\\\leq K(1+\parallel x\parallel)$. \item [(ii)] For every $x\in\mathbb{R}^d$, by Lemma \ref{msble}$(iii)$, for every $\mu\in D(x)$, $H_x$ is $\mu$-integrable. Hence $\hat{H}_x$ is non-empty. By Lemma \ref{march1}$(ii)$ and Lemma \ref{approx1}$(iii)$, we have that, $\hat{H}(x)$ is a convex and compact subset of $\mathbb{R}^d$. \item [(iii)] Let $\left\{x_n\right\}_{n\geq1}$ be a sequence in $\mathbb{R}^d$, converging to $x$ and $\left\{z_n\in \hat{H}(x_n)\right\}_{n\geq1}$ converging to $z$. By Lemma \ref{approx1}$(i)$, for every $l\geq1$, for every $n\geq1$, $z_n\in\hat{H}^{(l)}(x_n)$. Hence by Lemma \ref{march1}$(iii)$, we have that, for every $l\geq1$, $z\in\hat{H}^{(l)}(x)$. Therefore by Lemma \ref{approx1}$(iii)$, we have, $z\in\hat{H}(x)$.\qed \end{itemize} \end{proof} By Lemma \ref{march2}, we know that the set valued map $\hat{H}$ is a Marchaud map. Hence for every $x_0\in\mathbb{R}^d$, $\Sigma(x_0)\neq\emptyset$. By definition, $\Sigma^{(l)}(x_0)$ and $\Sigma(x_0)$ are subsets of $\mathcal{C}(\mathbb{R},\mathbb{R}^d)$, the space of all $\mathbb{R}^d$ valued continuous functions on $\mathbb{R}$. $\mathcal{C}(\mathbb{R},\mathbb{R}^d)$ is a complete metric space for distance $\bf{D}\rm$, defined by, \begin{equation*} \bf{D}\rm(\bf{x}\rm,\bf{z}\rm):=\sum_{k=1}^{\infty}\frac{1}{2^k}\min(\parallel \bf{x}\rm-\bf{z}\rm\parallel_{[-k,k]},1), \end{equation*} where $\parallel\cdot\parallel_{[-k,k]}$ denotes the sup norm on $\mathcal{C}([-k,k],\mathbb{R}^d)$. The next lemma summarizes some properties of the solutions of DI \eqref{di1},\eqref{di2} and the relation between them. \begin{lemma}\hfill \begin{itemize} \item [(i)] For every $A\subseteq\mathbb{R}^d$ compact, $\Sigma(A)$ and for every $l\geq1$, $\Sigma^{(l)}(A)$ are compact subsets of $\mathcal{C}(\mathbb{R},\mathbb{R}^d)$. \item [(ii)] For every $x_0\in\mathbb{R}^d$, for every $l\geq1$, $\Sigma(x_0)\subseteq\Sigma^{(l+1)}(x_0)\subseteq\Sigma^{(l)}(x_0)$. \item [(iii)] For every $x_0\in\mathbb{R}^d$, $\Sigma(x_0)=\cap_{l\geq1}\Sigma^{(l)}(x_0)$. \end{itemize} \end{lemma} \begin{proof}: \begin{itemize} \item [(i)] Follows from Lemma 3.1 in \cite{benaim1}. \item [(ii)] Fix some $x_0\in\mathbb{R}^d$ and $l\geq1$. Let $\bf{x}\rm\in\Sigma(x_0)$. Then for $a.e.\ t\in\mathbb{R}$, $\frac{d\bf{x}\rm(t)}{dt}\in\hat{H}(\bf{x}\rm(t))$. By Lemma \ref{approx1}$(i)$, we have, for every $t\geq0$, $\hat{H}(\bf{x}\rm(t))\subseteq\hat{H}^{(l)}(\bf{x}\rm(t))$. Therefore, for $a.e.\ t\in\mathbb{R}$, $\frac{d\bf{x}\rm(t)}{dt}\in\hat{H}^{(l)}(\bf{x}\rm(t))$. Hence, $\bf{x}\rm\in\Sigma^{(l)}(x_0)$. A similar argument gives us that, $\Sigma^{(l+1)}(x_0)\subseteq\Sigma^{(l)}(x_0)$. \item [(iii)] By part $(ii)$ of this lemma we have that, for every $x_0\in\mathbb{R}^d$, $\Sigma(x_0)\subseteq\cap_{l\geq1}\Sigma^{(l)}(x_0)$. Therefore, it is enough to show that, for every $x_0\in\mathbb{R}^d$, $\cap_{l\geq1}\Sigma^{(l)}(x_0)\subseteq\Sigma(x_0)$. Let $\bf{x}\rm\in\cap_{l\geq1}\Sigma^{(l)}(x_0)$ for some $x_0\in\mathbb{R}^d$. Then for every $l\geq1$, for $a.e.\ t\in\mathbb{R}$, $\frac{d\bf{x}\rm(t)}{dt}\in\hat{H}^{(l)}(\bf{x}\rm(t))$. Thus for $a.e.\ t\in\mathbb{R}$, $\frac{d\bf{x}\rm(t)}{dt}\in\cap_{l\geq1}\hat{H}^{(l)}(\bf{x}\rm(t))$. By Lemma \ref{approx1}$(iii)$, we have that, for $a.e.\ t\in\mathbb{R}$, $\frac{d\bf{x}\rm(t)}{dt}\in\hat{H}(\bf{x}\rm(t))$. Hence $\bf{x}\rm\in\Sigma(x_0)$.\qed \end{itemize} \end{proof} \subsection{Measurable set valued maps and integration} Let $(\mathcal{Y},\mathscr{F}_{\mathcal{Y}})$ denote a measurable space and $F:\mathcal{Y}\rightarrow\left\{\text{subsets of }\mathbb{R}^d\right\}$ be a set valued map such that, for every $y\in\mathcal{Y}$, $F(y)$ is a non-empty closed subset of $\mathbb{R}^d$. Throughout this section $F$ refers to the set valued map as defined above. \begin{definition} \emph{[measurable set-valued map]} A set valued map $F$ is measurable if for every $C\subseteq \mathbb{R}^d$, closed, \begin{equation*} F^{-1}(C):=\left\{y\in\mathcal{Y}:F(y)\cap C\neq\emptyset\right\}\in \mathscr{F}_{\mathcal{Y}}. \end{equation*} \end{definition} We refer the reader to Theorem 1.2.3 in \cite{shoumei} for other notions of measurability and their relation to the definition above. \begin{definition} \emph{[measurable selection]} A function $f:\mathcal{Y}\rightarrow\mathbb{R}^d$ is a measurable selection of a set valued map $F$ if $f$ is measurable and for every $y\in\mathcal{Y}$, $f(y)\in F(y)$. \end{definition} For a set valued map $F$ let, $\mathscr{S}(F)$ denote the set of all measurable selections. The next lemma summarizes some standard results about measurable set valued maps and their measurable selections. \begin{lemma}\label{msel} For any measurable set valued map $F$, \begin{itemize} \item [(i)] $\mathscr{S}(F)\neq \emptyset$. \item [(ii)] \it{(Castaing representation) }\rm there exists $\left\{f_n\right\}_{n\geq1}\subseteq\mathscr{S}(F)$ such that, for every $y\in\mathcal{Y}$, $F(y)=cl(\left\{f_n(y)\right\}_{n\geq1})$, where $cl(\cdot)$ denotes the closure of a set. \end{itemize} \end{lemma} We refer the reader to Theorem 1.2.6 and Theorem 1.2.7 in \cite{shoumei} for the proofs of Lemma \ref{msel}$(i)$ and $(ii)$ respectively. \begin{definition} \emph{[$\mu$-integrable set-valued map]} Let $\mu$ be a probability measure on $(\mathcal{Y},\mathscr{F}_{\mathcal{Y}})$. A measurable set valued map $F$ is said to be $\mu$-integrable if, there exists $f\in\mathscr{S}(F)$ which is $\mu$-integrable. \end{definition} \begin{definition} \emph{[Aumann's integral]} Let $\mu$ be a probability measure on $(\mathcal{Y},\mathscr{F}_{\mathcal{Y}})$. The integral of an integrable set valued map $F$ is defined as, \begin{equation*} \int_{\mathcal{Y}} F(y)\mu(dy):=\left\{\int_{\mathcal{Y}} f(y)\mu(dy):\ f\in \mathscr{S}(F),\ f\ is\ \mu-integrable\right\}. \end{equation*} \end{definition} The next lemma states a useful result on the properties of the integral of a set valued map which is convex and compact set valued. \begin{lemma}\label{cldint} Let $\mu$ be a probability measure on $(\mathcal{Y},\mathscr{F}_{\mathcal{Y}})$ and $F$ a $\mu$-integrable set valued map such that, for every $y\in\mathcal{Y}$, $F(y)$ is convex and compact. Then, $\int_{\mathcal{Y}} F(y)\mu(dy)$ is a convex and closed subset of $\mathbb{R}^d$. \end{lemma} For a proof of the above lemma we refer the reader to Theorem 2.2.2 in \cite{shoumei}. The next lemma is a useful tool to prove measurability of set valued maps that arise later in this paper. \begin{lemma}\label{mtool} Let $g:\mathcal{Y}\rightarrow\mathbb{R}^d$ be a measurable function and $F$ a measurable set valued map. Then the map $y\rightarrow d(g(y),F(y))$ where $d(g(y),F(y)):=\inf_{z\in F(y)}\parallel g(y)-z \parallel$, is measurable. \end{lemma} \begin{proof} Since $F$ is measurable, there exists $\left\{f_n\right\}_{n\geq1}$ a Castaing representation of $F$. Clearly for every $n\geq1$, the map $y\rightarrow\parallel g(y)-f_n(y)\parallel$ is measurable. Hence, the map $y\rightarrow\inf_{n\geq1}\parallel g(y)-f_n(y)\parallel$ is measurable. Since for every $y\in\mathcal{Y}$, $cl(\left\{f_n(y)\right\}_{n\geq1})=F(y)$ we have, $\inf_{n\geq1}\parallel g(y)-f_n(y)\parallel=d(g(y),F(y))$. Therefore the map $y\rightarrow d(g(y),F(y))$ is measurable.\qed \end{proof} \section{Recursion analysis} \label{recanal} Before we present the analysis of recursion \eqref{rec} we begin with some preliminaries in the next subsection. Later we present the main result of the paper followed by the limit set theorem which characterizes the limit set of the recursion in terms of the dynamics of the limiting DI. Throughout this section we shall assume that assumptions $(A1)-(A5)$ are satisfied. \subsection{Preliminaries}\label{prelim} Define $t(0):=0$ and for every $n\geq1$, $t(n):=\sum_{k=0}^{n-1}a(k)$. Define the stochastic process $\bar{X}:\Omega\times [0,\infty)\rightarrow\mathbb{R}^d$ such that, for every $(\omega,t)\in\Omega\times [0,\infty)$, \begin{equation*} \bar{X}(\omega,t):=\left(\frac{t-t(n)}{t(n+1)-t(n)}\right)X_{n+1}(\omega)+\left(\frac{t(n+1)-t}{t(n+1)-t(n)}\right)X_{n}(\omega), \end{equation*} where $n$ is such that $t\in[t(n),t(n+1))$. Recall that recursion \eqref{rec} is given by, \begin{equation*} X_{n+1}-X_{n}-a(n)M_{n+1}\in H(X_n,S_n), \end{equation*} for every $n\geq0$. By Lemma \ref{ctem}, we have that, for every $l\geq1$, for every $n\geq0$, $H(X_n,S_n)\subseteq H^{(l)}(X_n,S_n)$. Therefore, for every $l\geq1$, recursion \eqref{rec} can be written as, \begin{equation}\label{rec1} X_{n+1}-X_{n}-a(n)M_{n+1}\in H^{(l)}(X_n,S_n), \end{equation} for every $n\geq0$. By Lemma \ref{param}, we know that for every $l\geq1$, the set valued map $H^{(l)}$, admits a parametrization. The next lemma allows us write the recursion in terms of the parametrization of $H^{(l)}$. \begin{lemma} For every $l\geq1$, for every $n\geq0$, there exists a $U$-valued random variable on $\Omega$, say $U^{(l)}_n$, such that, \begin{equation*} X_{n+1}-X_{n}-a(n)M_{n+1}= h^{(l)}(X_n,S_n,U^{(l)}_n), \end{equation*} where $h^{(l)}$ is as in Lemma \ref{param}. \end{lemma} \begin{proof}Fix $l\geq1$ and $n\geq0$. Define a set valued map $G:\Omega\rightarrow\left\{\text{subsets of }U\right\}$, such that, for every $\omega\in\Omega$, $G(\omega):=\left\{u\in U: h^{(l)}(X_n(\omega),S_n(\omega),u)=X_{n+1}(\omega)-X_n(\omega)-a(n)M_{n+1}(\omega)\right\}$. By Lemma \ref{param} and by $\eqref{rec1}$, we have that for every $\omega\in\Omega$, $G(\omega)\neq\emptyset$. By continuity of $h^{(l)}(\cdot)$, we have that for every $\omega\in\Omega$, $G(\omega)$ is closed. For any $C\subseteq U$, closed, $G^{-1}(C)=\left\{\omega\in\Omega:d(X_{n+1}(\omega)-X_n(\omega)-a(n)M_{n+1}(\omega),h^{(l)}(X_n(\omega),S_n(\omega),C))=0\right\}$. Clearly the set valued map $\omega\rightarrow h^{(l)}(X_n(\omega),S_n(\omega),C)$ is measurable and hence by Lemma \ref{mtool}, the map $\omega\rightarrow d(X_{n+1}(\omega)-X_n(\omega)-a(n)M_{n+1}(\omega),h^{(l)}(X_n(\omega),S_n(\omega),C))$ is measurable. Thus $G^{-1}(C)\in\mathscr{F}$. Therefore by Lemma \ref{msel}, $\mathscr{S}(G)\neq\emptyset$. Set $U^{(l)}_n$ to be any measurable selection of $G$.\qed \end{proof} For every $l\geq1$, define $\Gamma^{(l)}:\Omega\times[0,\infty)\rightarrow\mathcal{P}(\mathcal{S}\times U)$, such that, for every $(\omega,t)\in\Omega\times[0,\infty)$, \begin{equation}\label{diracm} \Gamma^{(l)}(\omega,t)=\delta_{S_n(\omega)}\otimes\delta_{U^{(l)}_n(\omega)}, \end{equation} where $n$ is such that $t\in[t(n),t(n+1))$, $\delta_{S_n(\omega)}\in\mathcal{P}(\mathcal{S})$ denotes the Dirac measure in $\mathcal{P}(\mathcal{S})$(i.e. for any $A\in\mathscr{B}(\mathcal{S})$, $\delta_{S_n(\omega)}(A)=1$ if $S_n(\omega)\in A$ or $0$ otherwise) and $\delta_{U^{(l)}_n(\omega)}\in\mathcal{P}(U)$ denotes the Dirac measure in $\mathcal{P}(U)$. For every $l\geq1$, for every $\nu\in\mathcal{P}(\mathcal{S}\times U)$, define $\tilde{h}^{(l)}_{\nu}:\mathbb{R}^d\rightarrow\mathbb{R}^d$, such that for every $x\in\mathbb{R}^d$, $\tilde{h}^{(l)}_{\nu}(x):=\int_{\mathcal{S}\times U}h^{(l)}(x,s,u)\nu(ds,du)$ where $h^{(l)}(\cdot)$ are as in Lemma \ref{param}. The next lemma provides an equicontinuity result used later. \begin{lemma}\label{paramuse} For every $l\geq1$, for every $r>0$, $\left\{\tilde{h}^{(l)}_{\nu}(\cdot)|_{rU}:\nu\in\mathcal{P}(\mathcal{S}\times U)\right\}$ is an equicontinuous family where $\tilde{h}^{(l)}_{\nu}(\cdot)|_{rU}$ denotes the restriction of $\tilde{h}^{(l)}_\nu(\cdot)$ to the closed ball of radius $r$. \end{lemma} \begin{proof} Fix $l\geq1$ and $r>0$. Since $rU\times \mathcal{S}\times U$ is compact, by Heine-Cantor theorem, $h^{(l)}(\cdot)|_{rU\times \mathcal{S}\times U}$ is uniformly continuous. Fix $\epsilon>0$. Then, there exits $\delta>0$ (depending on $l$, $r$ and $\epsilon$), such that, for every $x,x'\in rU$, for every $s,s'\in\mathcal{S}$, for every $u,u'\in U$ satisfying, $\parallel x-x'\parallel<\delta$, $d_{\mathcal{S}}(s,s')<\delta$, $\parallel u-u'\parallel<\delta$, we have, $\parallel h^{(l)}(x,s,u)-h^{(l)}(x',s',u')\parallel<\epsilon$. Therefore for $\delta$ as above, for $x,x'\in rU$ satisfying $\parallel x-x'\parallel<\delta$, we have that for every $\nu\in\mathcal{P}(\mathcal{S}\times U)$, $\parallel \tilde{h}^{(l)}_{\nu}(x)- \tilde{h}^{(l)}_{\nu}(x')\parallel=\parallel \int_{\mathcal{S}\times U}(h^{(l)}(x,s,u)-h^{(l)}(x',s,u))\nu(ds,du)\parallel\leq \\\int_{\mathcal{S}\times U}\parallel h^{(l)}(x,s,u)-h^{(l)}(x',s,u)\parallel\nu(ds,du)<\int_{\mathcal{S}\times U}\epsilon\nu(ds,du)= \epsilon$.\qed \end{proof} For every $l\geq1$, define the stochastic process, $Y^{(l)}:\Omega\times[0,\infty)\rightarrow\mathbb{R}^d$, such that, for every $(\omega,t)\in\Omega\times[0,\infty)$, $Y^{(l)}(\omega,t):=h^{(l)}(X_n(\omega),S_n(\omega),U^{(l)}_n(\omega))$, where $n$ is such that $t\in[t(n),t(n+1))$. In what follows, in the next two subsections, most of the arguments are sample path wise. We omit $\omega$ from our notation and use lower case letters to denote the above defined quantities along a particular sample path, for example, $\bar{x}(t),\ x_n,\ s_n,\ m_n,\ u^{(l)}_n,\ y^{(l)}(t)$ and $\gamma^{(l)}(t)$ are to be understood as $\bar{X}(\omega,t),\ X_n(\omega),\ S_n(\omega),\ M_n(\omega),\ U^{(l)}_n(\omega),\ Y^{(l)}(\omega,t)$ and $\Gamma^{(l)}(\omega,t)$ respectively for some $\omega$ fixed. \subsection{Main result - Asymptotic pseudotrajectory} For every $\omega\in\Omega$, for every $l\geq1$, for every $\tilde{t}\geq0$, let $\tilde{x}^{(l)}(\cdot;\tilde{t})$ denote the solution of the o.d.e., \begin{equation} \label{ode} \dot{\tilde{x}}^{(l)}(t;\tilde{t})=y^{(l)}(t+\tilde{t}), \end{equation} for every $t\geq0$, with initial condition $\tilde{x}^{(l)}(0;\tilde{t})=\bar{x}(\tilde{t})$. First we shall get rid of the additive noise terms, $M_n$. Let \begin{equation*} \Omega_{a,s}:=\left\{\omega\in\Omega: (A4)\ and\ (A5)\ hold\right\}, \end{equation*} i.e., the set of sample paths where the iterates are stable and the additive noise terms are eventually negligible. By assumption $(A4)$ and $(A5)$, we have $\mathbb{P}(\Omega_{a,s})=1$. \begin{lemma}\label{addnois} For every $l\geq1$, almost surely for every $\omega$, for every $T>0$, \begin{equation*} \lim_{t\to\infty}\sup_{0\leq q\leq T}\parallel \bar{x}(t+q)-\tilde{x}^{(l)}(q;t)\parallel=0. \end{equation*} \end{lemma} \begin{proof} Fix $l\geq1$, $\omega\in\Omega_{a,s}$ and $T>0$. We shall prove the claim along the sequence $\left\{t(n)\right\}_{n\geq0}$ as defined in section \ref{prelim}. The general claim easily follows from this special case. Fix $n\geq0$. Let $\tau(n,T):=\min\left\{k>n:t(k)\geq t(n)+T\right\}$. Let $q\in[0,T]$. Then, there exists $k$ such that $t(n)+q\in[t(k),t(k+1))$ and $n\leq k\leq \tau(n,T)-1$. By definition of $\bar{x}(\cdot)$ and $\tilde{x}^{(l)}(\cdot;t(n))$, we have that, $\bar{x}(t(n)+q)=\alpha x_k+(1-\alpha)x_{k+1}$ and $\tilde{x}^{(l)}(q;t(n))=\alpha\tilde{x}^{(l)}(t(k)-t(n);t(n))+\\(1-\alpha) \tilde{x}^{(l)}(t(k+1)-t(n);t(n))$ where $\alpha=\frac{t(k+1)-t(n)-q}{t(k+1)-t(k)}$. Since $\tilde{x}^{(l)}(\cdot;t(n))$ is a solution of the o.d.e. $\eqref{ode}$, we have that, for every $k\geq n$, $\tilde{x}^{(l)}(t(k)-t(n);t(n))=x_n+\sum_{j=n}^{k-1}a(j)h^{(l)}(x_j,s_j,u^{(l)}_j) $ and by Lemma \ref{paramuse}, we have that, for every $k\geq n$, $x_k=\bar{x}(t(k))=x_n+\sum_{j=n}^{k-1}a(j)h^{(l)}(x_j,s_j,u^{(l)}_j)+ \sum_{j=n}^{k-1}a(j)m_{j+1}$. Thus, \begin{align*} \parallel\bar{x}(t(n)+q)-\tilde{x}^{(l)}(q;t(n))\parallel&\leq \parallel\alpha\sum_{j=n}^{k-1}a(j)m_{j+1}+(1-\alpha) \sum_{j=n}^{k}a(j)m_{j+1}\parallel\\ &\leq\alpha\parallel\sum_{j=n}^{k-1}a(j)m_{j+1}\parallel+(1-\alpha)\parallel\sum_{j=n}^{k}a(j)m_{j+1} \parallel\\ &\leq \sup_{n\leq k\leq \tau(n,T)}\parallel\sum_{j=n}^{k}a(j)m_{j+1}\parallel. \end{align*} Since the r.h.s. of the above inequality is independent of $q\in[0,T]$, we have, $\\\sup_{0\leq q\leq T}\parallel\bar{x}(t(n)+q)- \tilde{x}^{(l)}(q;t(n))\parallel\leq\sup_{n\leq k\leq \tau(n,T)}\parallel\sum_{j=n}^{k}a(j)m_{j+1}\parallel$. Therefore, $\\\lim_{n\to\infty}\sup_{0\leq q\leq T}\parallel\bar{x}(t(n)+q)-\tilde{x}^{(l)}(q;t(n))\parallel\leq\lim_{n\to\infty} \sup_{n\leq k\leq \tau(n,T)}\parallel\sum_{j=n}^{k}a(j)m_{j+1}\parallel$. Now the claim follows follows from assumption $(A4)$.\qed \end{proof} \begin{lemma}\label{eqcont} For every $l\geq1$, for almost every $\omega$, $\left\{\tilde{x}^{(l)}(\cdot;t)\right\}_{t\geq0}$ is relatively compact in $\mathcal{C}([0,\infty),\mathbb{R}^d)$. \end{lemma} \begin{proof} Fix $l\geq1$, $\omega\in\Omega_{a,s}$. By assumption $(A5)$, we know that there exists $r>0$ such that $\sup_{n\geq0}\parallel x_n\parallel\leq r$ and hence $\sup_{t\geq0}\tilde{x}^{(l)}(0;t)=\sup_{t\geq0}\bar{x}(t)\leq r$. For any $t\geq0$, let $[t]:=\max\left\{n\geq0:t(n)\leq t\right\}$. For every $t\geq0$ and $q_1,q_2\in[0,\infty)$ (w.l.o.g. assume $q_1<q_2$) we have, \begin{align*} \parallel \tilde{x}^{(l)}(q_1;t)-\tilde{x}^{(l)}(q_2;t)\parallel&=\parallel\int_{q_1}^{q_2}h^{(l)}(x_{[t+q]},s_{[t+q]},u^{(l)}_{[t+q]}) dq\parallel\\ &\leq\int_{q_1}^{q_2}\parallel h^{(l)}(x_{[t+q]},s_{[t+q]},u^{(l)}_{[t+q]})\parallel dq\\ &\leq\int_{q_1}^{q_2}K^{(l)}(1+\parallel x_{[t+q]}\parallel)dq\\ &\leq C^{(l)}(q_2-q_1), \end{align*} where $C^{(l)}:=K^{(l)}(1+r)$ and $r>0$ is such that, $\sup_{n\geq0}\parallel x_n\parallel\leq r$. Thus $\left\{\tilde{x}^{(l)}(\cdot;t)\right\}_{t\geq0}$ is an equicontinuous family. Now the claim follows from Arzella-Ascoli theorem. \qed \end{proof} From Lemma \ref{addnois} and Lemma \ref{eqcont} we conclude the following for almost every $\omega$. \begin{itemize} \item [(1)] The family of functions, \bf{$\left\{\bar{x}(\cdot+t)\right\}_{t\geq0}$ is relatively compact }\rm in $\mathcal{C}([0,\infty),\mathbb{R}^d)$, because if not, there exist $t_n\to\infty$ such that $\left\{\bar{x}(\cdot+t_n)\right\}_{n\geq0}$ does not have a limit point in $\mathcal{C}([0,\infty),\mathbb{R}^d)$. Then by Lemma \ref{addnois}, $\left\{\tilde{x}^{(l)}(\cdot;t_n)\right\}_{n\geq0}$ does not have a limit point in $\mathcal{C}([0,\infty),\mathbb{R}^d)$ which contradicts Lemma \ref{eqcont}. \item [(2)] Since $\left\{\bar{x}(\cdot+t)\right\}_{t\geq0}$ is relatively compact in $\mathcal{C}([0,\infty),\mathbb{R}^d)$, by Arzella-Ascoli theorem, we have that for every $T>0$, $\left\{\bar{x}(\cdot+t)|_{[0,T]}\right\}_{t\geq0}$ is equicontinuous. Set $T=1$ and fix $\epsilon>0$. Then for any $t_0\geq\frac{1}{2}$, there exists $t\geq0$ such that $t+\frac{1}{2}=t_0$. By equicontinuity of $\left\{\bar{x}(\cdot+t)|_{[0,T]}\right\}_{t\geq0}$, we can obtain a $\delta>0$ (independent of $t$ and hence $t_0$) such that, for every $t'$ satisfying $|t'-t_0|<\min\left\{\delta,\frac{1}{2}\right\}$, we have $\parallel \bar{x}(t')-\bar{x}(t_0)\parallel<\epsilon$. Since $\epsilon$ was arbitrary and $\bar{x}(\cdot)|_{[0,\frac{1}{2}]}$ is uniformly continuous we obtain that the function \bf{$\bar{x}(\cdot)$ is uniformly continuous }\rm on $[0,\infty)$. \end{itemize} \begin{proposition}\label{main1} For $a.e.\ \omega$, every limit point $x^*(\cdot)$ of $\left\{\bar{x}(\cdot+t)\right\}_{t\geq0}$ satisfies the following. \begin{itemize} \item [(i)] For every $l\geq1$, there exists $\tilde{\gamma}^{(l)}\in\mathcal{M}(\mathcal{S}\times U)$ such that, for every $t\geq0$, \begin{equation*} x^*(t)=x^*(0)+\int_{0}^{t}\left[\int_{\mathcal{S}\times U}h^{(l)}(x^*(q),s,u)\tilde{\gamma}^{(l)}(q)(ds,du)\right]dq. \end{equation*} \item [(ii)] For every $l\geq1$, $\tilde{\gamma}^{(l)}$ as in part $(i)$ of this lemma is such that, for almost every $t\geq0$, \begin{equation*} \Lambda(\tilde{\gamma}^{(l)})(t)\in D(x^*(t)). \end{equation*} \item [(iii)] $x^*(\cdot)$ is absolutely continuous and for almost every $t\geq0$, \begin{equation*} \frac{dx^*(t)}{dt}\in\hat{H}(x^*(t)). \end{equation*} \end{itemize} \end{proposition} \begin{proof} Fix $\omega\in\Omega_{a,s}$, and let $t_n\to\infty$, such that $\bar{x}(\cdot+t_n)\to x^*(\cdot)$ in $\mathcal{C}([0,\infty),\mathbb{R}^d)$. \begin{itemize} \item [(i)] Fix $l\geq1$. Consider the $\mathcal{M}(\mathcal{S}\times U)$ valued sequence $\left\{\gamma^{(l)}(\cdot+t_n)\right\}_{n\geq1}$. Since $\mathcal{M}(\mathcal{S}\times U)$ is a compact metric space, there exists a subsequence of the above that converges. Set $\tilde{\gamma}^{(l)}(\cdot)$ to be some limit point and w.l.o.g. assume $\left\{\gamma^{(l)}(\cdot+t_n)\right\}_{n\geq1}$ converges to $\tilde{\gamma}^{(l)}(\cdot)$. Since the sequence $\left\{\bar{x}(\cdot+t_n)\right\}_{n\geq1}$ converges to $x^*(\cdot)$, by Lemma \ref{addnois}, we have that $\left\{\tilde{x}^{(l)}(\cdot;t_n)\right\}_{n\geq1}$ also converges to $x^*(\cdot)$ in $\mathcal{C}([0,\infty),\mathbb{R}^d)$. For every $n\geq1$, by definition of $\tilde{x}^{(l)}(\cdot;t_n)$ we have that for every $t\geq0$, \begin{align*} \tilde{x}^{(l)}(t;t_n)&=\bar{x}(t_n)+\int_{0}^{t}y^{(l)}(q)dq\\ &=\bar{x}(t_n)+\int_{0}^{t}h^{(l)}(x_{[t_n+q]},s_{[t_n+q]},u^{(l)}_{[t_n+q]})dq. \end{align*} By definition of $\gamma^{(l)}(\cdot)$(see \eqref{diracm} and recall that $\gamma^{(l)}(\cdot)=\Gamma^{(l)}(\omega,\cdot)$) for every $n\geq1$ and for every $t\geq0$ we can write the above as, \begin{equation*} \tilde{x}^{(l)}(t;t_n)=\bar{x}(t_n)+\int_{0}^{t}\left[\int_{\mathcal{S}\times U}h^{(l)}(x_{[t_n+q]},s,u)\gamma^{(l)}(q+t_n)(ds,du)\right]dq. \end{equation*} Therefore, for every $t\geq0$, \begin{align}\label{tmp0} \lim_{n\to\infty}[\tilde{x}^{(l)}(t;t_n)-\bar{x}(t_n)]&=\lim_{n\to\infty}\int_{0}^{t}\left[\int_{\mathcal{S}\times U} h^{(l)}(x_{[t_n+q]},s,u)\gamma^{(l)}(q+t_n)(ds,du)\right]dq.\nonumber\\ x^*(t)-x^*(0)&=\lim_{n\to\infty}\int_{0}^{t}\left[\int_{\mathcal{S}\times U} h^{(l)}(x_{[t_n+q]},s,u)\gamma^{(l)}(q+t_n)(ds,du)\right]dq. \end{align} Since $\gamma^{(l)}(\cdot+t_n)\to\tilde{\gamma}^{(l)}(\cdot)$ and by our choice of the topology for $\mathcal{M}(\mathcal{S}\times U)$, we have, \begin{equation*} \int_{0}^{t}\left[\int_{\mathcal{S}\times U}\tilde{f}(q,s,u)\gamma^{(l)}(q+t_n)(ds,du)\right]dq- \int_{0}^{t}\left[\int_{\mathcal{S}\times U}\tilde{f}(q,s,u)\tilde{\gamma}^{(l)}(q)(ds,du)\right]dq\to0, \end{equation*} for all bounded continuous $\tilde{f}:[0,t]\times\mathcal{S}\times U\rightarrow\mathbb{R}$ of the form, \begin{equation*} \tilde{f}(q,s,u)=\sum_{m=1}^{N}a_mg_m(q)f_m(s,u), \end{equation*} for some $N\geq1$, scalars $a_m$ and bounded continuous functions $g_m,\ f_m$ on $[0,t],\ \mathcal{S}\times U$ respectively, for $1\leq m\leq N$. By the Stone-Weierstrass theorem, such functions can uniformly approximate any function in $\mathcal{C}([0,t]\times\mathcal{S}\times U,\mathbb{R})$. Thus the above convergence holds true for all real valued continuous functions on $[0,t]\times\mathcal{S}\times U$, implying that $\\t^{-1}\gamma^{(l)}(q+t_n)(ds,du)dq\to t^{-1}\tilde{\gamma}^{(l)}(q)(ds,du)dq$ in $\mathcal{P}([0,t]\times\mathcal{S}\times U)$. Thus, \begin{small} \begin{equation}\label{tmp1} \parallel\int_{0}^{t}\left[\int_{\mathcal{S}\times U}h^{(l)}(x^*(q),s,u)\gamma^{(l)}(q+t_n)(ds,du)\right]dq- \int_{0}^{t}\left[\int_{\mathcal{S}\times U}h^{(l)}(x^*(q),s,u)\tilde{\gamma}^{(l)}(q)(ds,du)\right]dq\parallel\to0 \end{equation} \end{small} as $n\to\infty$. Since $\left\{\bar{x}(\cdot+t_n)|_{[0,t]}\right\}_{n\geq1}$ converges uniformly to $x^*(\cdot)|_{[0,t]}$ we have that, the function $q\rightarrow x_{[t_n+q]}$ converges uniformly to $x^*(\cdot)|_{[0,t]}$ on $[0,t]$. Using the above and by Lemma \ref{paramuse}, we have that for every $\epsilon>0$, there exists $N$ (depending on $\epsilon$) such that, for every $n\geq N$, for every $q\in[0,t]$, we have, \begin{equation}\label{tmp2} \parallel\int_{\mathcal{S}\times U}h^{(l)}(x_{[t_n+q]},s,u)\gamma^{(l)}(q+t_n)(ds,du)- \int_{\mathcal{S}\times U}h^{(l)}(x^*(q),s,u)\gamma^{(l)}(q+t_n)(ds,du)\parallel<\epsilon. \end{equation} Now, \begin{small} \begin{align*} \parallel\int_{0}^{t}\left[\int_{\mathcal{S}\times U}h^{(l)}(x_{[t_n+q]},s,u)\gamma^{(l)}(q+t_n)(ds,du)\right]dq&- \int_{0}^{t}\left[\int_{\mathcal{S}\times U}h^{(l)}(x^*(q),s,u)\tilde{\gamma}^{(l)}(q)(ds,du)\right]dq\parallel\\ &\leq\\ \parallel\int_{0}^{t}\int_{\mathcal{S}\times U}h^{(l)}(x_{[t_n+q]},s,u)\gamma^{(l)}(q+t_n)(ds,du)dq&- \int_{0}^{t}\int_{\mathcal{S}\times U}h^{(l)}(x^*(q),s,u)\gamma^{(l)}(q+t_n)(ds,du)dq\parallel\\ &+\\ \parallel\int_{0}^{t}\left[\int_{\mathcal{S}\times U}h^{(l)}(x^*(q),s,u)\gamma^{(l)}(q+t_n)(ds,du)\right]dq&- \int_{0}^{t}\left[\int_{\mathcal{S}\times U}h^{(l)}(x^*(q),s,u)\tilde{\gamma}^{(l)}(q)(ds,du)\right]dq\parallel. \end{align*} \end{small} Taking limit on both sides as $n\to\infty$ in the above equation and using equations \eqref{tmp1} and \eqref{tmp2} we obtain, \begin{small} \begin{equation*} \lim_{n\to\infty}\parallel\int_{0}^{t}\left[\int_{\mathcal{S}\times U}h^{(l)}(x_{[t_n+q]},s,u)\gamma^{(l)}(q+t_n)(ds,du)\right]dq- \int_{0}^{t}\left[\int_{\mathcal{S}\times U}h^{(l)}(x^*(q),s,u)\tilde{\gamma}^{(l)}(q)(ds,du)\right]dq\parallel\leq\epsilon t, \end{equation*} \end{small} for every $\epsilon>0$. Therefore, for every $t\geq0$, \begin{small} \begin{equation*} \lim_{n\to\infty}\int_{0}^{t}\left[\int_{\mathcal{S}\times U}h^{(l)}(x_{[t_n+q]},s,u)\gamma^{(l)}(q+t_n)(ds,du)\right]dq= \int_{0}^{t}\left[\int_{\mathcal{S}\times U}h^{(l)}(x^*(q),s,u)\tilde{\gamma}^{(l)}(q)(ds,du)\right]dq. \end{equation*} \end{small} Substituting the above limit in equation \eqref{tmp0}, we get, for every $t\geq0$, \begin{equation*} x^*(t)-x^*(0)=\int_{0}^{t}\left[\int_{\mathcal{S}\times U}h^{(l)}(x^*(q),s,u)\tilde{\gamma}^{(l)}(q)(ds,du)\right]dq. \end{equation*} \item [(ii)] The proof of this part is similar to the proof of Lemma 6, chapter 6.3 of \cite{borkartxt}. We shall present a proof here for the sake of completeness. Let $\left\{f_i\right\}$ be a countable set of real valued continuous functions on $\mathcal{S}$ that is a convergence determining class for $\mathcal{P}(\mathcal{S})$. By replacing each $f_i$ by $a_if_i+b_i$ for suitable scalars $a_i,\ b_i>0$, we may suppose that $0\leq f_i(\cdot)\leq 1$ for all $i$. For each $i$, \begin{equation*} \zeta_n^{i}:=\sum_{k=0}^{n-1}a(k)(f_i(S_{k+1})-\int_{\mathcal{S}}f_i(s')\Pi(X_k,S_k)(ds')), \end{equation*} is a square integrable zero mean martingale w.r.t. the filtration $\left\{\mathscr{F}_n:=\sigma(S_k,X_k:0\leq k\leq n-1)\right\}_{n\geq1}$ and for almost every $\omega$, $\sum_{n=1}^{\infty}\mathbb{E}[(\zeta^i_{n+1}-\zeta^i_{n})^2|\mathscr{F}_n]\leq 2\sum_{n=0}^{\infty}a(n)^2<\infty$ . Hence by martingale convergence theorem (see Appendix C, Theorem 11 in \cite{borkartxt}), for almost every $\omega$, $\left\{\zeta_n^i\right\}_{n\geq1}$ converges. Let $\Omega_{m}:=\left\{\omega\in\Omega: \forall i, \left\{\zeta_n^i\right\}_{n\geq1}\ converges\right\}$. Then $\mathbb{P}(\Omega_{m})=1$. Define, \begin{equation} \Omega^*:=\Omega_m\cap\Omega_{a,s} \end{equation} and clearly $\mathbb{P}(\Omega^*)=1$. Recall, that for every $T\geq0$ and $n\geq0$, $\tau(n,T):=\min\left\{k\geq n:t(k)\geq t(n)+T\right\}$. Then for every $\omega\in\Omega^*$, for every $i$, for every $T>0$, as $n\to\infty$, \begin{equation*} \sum_{k=n}^{\tau(n,T)}a(k)(f_i(s_{k+1})-\int_{\mathcal{S}}f_i(s')\Pi(x_k,s_k)(ds'))\to0. \end{equation*} By the choice of $\left\{f_i\right\}_{i\geq1}$ and the fact that $\left\{a(n)\right\}_{n\geq0}$ are non-increasing (see assumption $(A3)(i)$) we get, that for every $\omega\in\Omega^*$, for every $i$, for every $T>0$, as $n\to\infty$, \begin{equation*} |\sum_{k=n}^{\tau(n,T)}(a(k)-a(k+1))f_i(s_{k+1})|\leq a(n)-a(\tau(n,T)+1)\to0. \end{equation*} Thus, for every $\omega\in\Omega^*$, for every $i$, for every $T>0$, as $n\to\infty$, \begin{equation}\label{tmp3} \sum_{k=n}^{\tau(n,T)}a(k)(f_i(s_k)-\int_{\mathcal{S}}f_i(s')\Pi(x_k,s_k)(ds'))\to0. \end{equation} Fix $l\geq1$. Define for every $\omega$, $\mu^{(l)}(\cdot):=\Lambda(\gamma^{(l)})\in\mathcal{M}(\mathcal{S})$. Then by definition of $\gamma^{(l)}(\cdot)$ (see equation \eqref{diracm} and recall $\gamma^{(l)}(\cdot):=\Gamma^{(l)}(\omega,\cdot)$) and $\Lambda(\cdot)$ (see Lemma \ref{lambd}) we have that for every $\omega$, for every $t>0$, $\mu^{(l)}(t)=\delta_{s_n}$ where $n$ is such that, $t\in[t(n),t(n+1))$. Using the definition of $\mu^{(l)}(\cdot)$ in equation \eqref{tmp3}, we get that for every $\omega\in\Omega^*$, for every $i$, for every $T>0$, as $n\to\infty$, \begin{equation*} \int_{0}^{t(\tau(n,T))-t(n)}\int_{\mathcal{S}}\left[f_i(s)-\int_{\mathcal{S}}f_i(s')\Pi(x_{[t(n)+q]},s)(ds')\right]\mu^{(l)}(q+t(n)) (ds)dq\to0, \end{equation*} where, for every $t\geq0$, $[t]:=\max\left\{n\geq0:t(n)\leq t\right\}$. From the above it can easily be shown that for every $\omega\in\Omega^*$, for every $i$, for every $T>0$, \begin{equation*} \lim_{t\to\infty}\int_{0}^{T}\int_{\mathcal{S}}\left[f_i(s)-\int_{\mathcal{S}}f_i(s')\Pi(x_{[t+q]},s)(ds')\right]\mu^{(l)}(q+t)(ds)dq=0. \end{equation*} By assumption $(A2)$, $\Pi(\cdot)|_{2rU\times\mathcal{S}}$ is uniformly continuous, where $r=\sup_{n\geq0}\parallel x_n\parallel$. Thus the function $(x,s)\rightarrow f_i(s)-\int_{\mathcal{S}}f_i(s')\Pi(x,s)(ds')$ is uniformly continuous on $2rU\times\mathcal{S}$ for every $i$. Using the above, the fact that $\lim_{n\to\infty}(t(n+1)-t(n))=0$ and uniform continuity of $\bar{x}(\cdot)$ we get that, for every $\omega\in\Omega^*$, for every $i$, for every $T>0$, \begin{equation*} \lim_{t\to\infty}\int_{0}^{T}\int_{\mathcal{S}}\left[f_i(s)-\int_{\mathcal{S}}f_i(s')\Pi(\bar{x}(t+q),s)(ds')\right]\mu^{(l)}(q+t)(ds) dq=0. \end{equation*} Fix $\omega\in\Omega^*$. From part $(i)$ of this lemma we have a sequence $t_n\to\infty$ such that $\left\{\bar{x}(\cdot+t_n)\right\}_{n\geq1}$ converges to $x^*(\cdot)$ in $\mathcal{C}([0,\infty),\mathbb{R}^d)$ and $\left\{\gamma^{(l)}(\cdot+t_n)\right\}_{n\geq1}$ converges to $\tilde{\gamma}^{(l)}(\cdot)$ in $\mathcal{M}(\mathcal{S}\times U)$. By continuity of the map $\Lambda(\cdot)$ (see Lemma \ref{lambd}), we have that $\mu^{(l)}(\cdot+t_n)\to\tilde{\mu}^{(l)}(\cdot)=\Lambda(\tilde{\gamma}^{(l)})$ in $\mathcal{M}(\mathcal{S})$. Using the convergence above and the fact that the family of functions, $\left\{x\in2rU\rightarrow\int_{\mathcal{S}}\left[f_i(s)-\int_{\mathcal{S}} f_i(s')\Pi(x,s)(ds')\right]\nu(ds):\nu\in\mathcal{P}(\mathcal{S})\right\}$ is equicontinuous (which can be shown by arguments similar to Lemma \ref{paramuse}) we get that for every $i$, for every $T>0$, \begin{equation*} \int_{0}^{T}\int_{\mathcal{S}}\left[f_i(s)-\int_{\mathcal{S}}f_i(s')\Pi(x^*(q),s)(ds')\right]\tilde{\mu}^{(l)}(q)(ds)dq=0. \end{equation*} An application of Lesbesgue's theorem (see chapter 11.1.3 in \cite{borkartxt}), we get that for almost every $t\geq0$, for every $i$, \begin{equation*} \int_{\mathcal{S}}\left[f_i(s)-\int_{\mathcal{S}}f_i(s')\Pi(x^*(t),s)(ds')\right]\tilde{\mu}^{(l)}(t)(ds)=0. \end{equation*} By our choice of $\left\{f_i\right\}_{i\geq1}$, we get that for almost every $t\geq0$, \begin{equation*} \tilde{\mu}^{(l)}(t)(ds)=\int_{\mathcal{S}}\Pi(x^*(t),s')(ds)\tilde{\mu}^{(l)}(t)(ds'). \end{equation*} Therefore for almost every $t\geq0$, $\tilde{\mu}^{(l)}(t)=\Lambda(\tilde{\gamma}^{(l)})(t)\in D(x^*(t))$. \item [(iii)] Fix $l\geq1$. From part $(i)$ of this lemma we have that for every $t\geq0$, \begin{equation*} x^*(t)=x^*(0)+\int_{0}^{t}\left[\int_{\mathcal{S}\times U}h^{(l)}(x^*(q),s,u)\tilde{\gamma}^{(l)}(q)(ds,du)\right]dq. \end{equation*} Clearly $x^*(\cdot)$ is absolutely continuous and for almost every $t\geq0$, \begin{equation}\label{tmp4} \frac{dx^*(t)}{dt}=\int_{\mathcal{S}\times U}h^{(l)}(x^*(t),s,u)\tilde{\gamma}^{(l)}(t)(ds,du). \end{equation} By part $(ii)$ of this lemma we have that for almost every $t\geq0$, $\Lambda(\tilde{\gamma}^{(l)})(t)\in D(x^*(t))$. By definition of the map $\Lambda(\cdot)$ (see Lemma \ref{lambd}), we have that for almost every $t\geq0$, $\tilde{\gamma}^{(l)}_{\mathcal{S}}(t)\in D(x^*(t))$. By Lemma \ref{chint} and by definition of $\hat{H}^{(l)}$ (see equation \eqref{lim2}) we have that for almost every $t\geq0$, \begin{equation*} \int_{\mathcal{S}\times U}h^{(l)}(x^*(t),s,u)\tilde{\gamma}^{(l)}(t)(ds,du)\in \cup_{\mu\in D(x^*(t))}\int_{\mathcal{S}}H^{(l)}_{x^*(t)}(s)\mu(ds)=\hat{H}^{(l)}(x^*(t)). \end{equation*} Using the above in equation \eqref{tmp4} we obtain that for almost every $t\geq0$, \begin{equation*} \frac{dx^*(t)}{dt}\in\hat{H}^{(l)}(x^*(t)). \end{equation*} Since $l\geq1$ that was fixed was arbitrary, the above holds for every $l\geq1$. Therefore, for almost every $t\geq0$, \begin{equation*} \frac{dx^*(t)}{dt}\in\cap_{l\geq1}\hat{H}^{(l)}(x^*(t))=\hat{H}(x^*(t)), \end{equation*} where the equality follows from Lemma \ref{approx1}$(iii)$.\qed \end{itemize} \end{proof} Before we proceed further we shall briefly recall the definition of asymptotic pseudotrajectories (APT) for set-valued dynamics introduced in \cite{benaim1}. The translation flow $\Theta:\mathcal{C}(\mathbb{R},\mathbb{R}^d)\times \mathbb{R}\rightarrow \mathcal{C}(\mathbb{R},\mathbb{R}^d)$ is the flow defined by, \begin{equation*} \Theta^t(\bf{x}\rm)(q):=\bf{x}\rm(q+t). \end{equation*} For every $\omega\in\Omega$, extend $\bar{x}(\cdot)$ to $\mathbb{R}$ by letting $\bar{x}(t)=\bar{x}(0)$ for $t<0$. Then $\bar{x}(\cdot)$ is an APT for the flow of DI \eqref{di2} if, \begin{equation*} \lim_{t\to\infty}\bf{D}\rm(\Theta^t(\bar{x}),\Sigma)=0, \end{equation*} where, $\Sigma:=\cup_{x\in\mathbb{R}^d}\Sigma(x)$ denotes the set of all solutions of DI \eqref{di2}. In what follows we fix $\omega\in\Omega^*$ and let $\bar{x}(\cdot)$ denote the extension to $\mathbb{R}$ as defined above. By uniform continuity of $\bar{x}(\cdot)$, we have that the family $\left\{\Theta^t(\bar{x})\right\}_{t\geq0}$ is equicontinuous and by assumption $(A5)$ is pointwise bounded. Hence $\left\{\Theta^{t}(\bar{x})\right\}_{t\geq0}$ is relatively compact in $\mathcal{C}(\mathbb{R},\mathbb{R}^d)$. Let $x^*(\cdot)$ be a limit point of $\left\{\Theta^{t}(\bar{x})\right\}_{t\geq0}$. Then by Proposition \ref{main1}$(iii)$, we have that $x^*(\cdot)|_{[0,\infty)}$ is a solution on $[0,\infty)$ of DI \eqref{di2}. Usually the negative time argument is omitted since it follows from the positive time argument as follows: Fix $T>0$. Since $x^*(\cdot)$ is a limit point of $\left\{\Theta^{t}(\bar{x})\right\}_{t\geq0}$, there exists $t_n\to\infty$ such that, $\left\{\Theta^{t_n}(\bar{x})\right\}_{n\geq1}$ converges to $x^*(\cdot)$ in $\mathcal{C}(\mathbb{R},\mathbb{R}^d)$. Then $\left\{\Theta^{t_n-T}(\bar{x})\right\}_{n\geq1}$ converges to $x^*(\cdot-T)$. By Proposition \ref{main1}$(iii)$, $x^*(\cdot-T)|_{[0,\infty)}$ is a solution of DI \eqref{di2}. Therefore $x^*(\cdot)|_{[-T,0]}$ is absolutely continuous and for almost every $t\in[-T,0]$, \begin{equation*} \frac{dx^*(t)}{dt}\in\hat{H}(x^*(t)). \end{equation*} Since $T>0$, is arbitrary, we have that $x^*(\cdot)|_{(-\infty,0]}$ is a solution on $(-\infty,0]$ of DI \eqref{di2}. Therefore every limit point of $\left\{\Theta^{t}(\bar{x})\right\}_{t\geq0}$ is in $\Sigma$, the set of solutions of DI \eqref{di2}. Then by Theorem 4.1 in \cite{benaim1} we get the following result. \begin{theorem}\emph{[APT]}\label{apt} Under assumptions $(A1)-(A5)$, for almost every $\omega$, the linearly interpolated trajectory of recursion \eqref{rec}, $\bar{x}(\cdot)$, is an asymptotic pseudotrajectory of DI \eqref{di2}. \end{theorem} \subsection{Characterization of limit sets} For every $\omega$, the limit set of recursion \eqref{rec}, denoted by $L(\bar{x})$ is defined as, \begin{equation} L(\bar{x}):=\cap_{t\geq0}\overline{\left\{\bar{x}(q+t):q\geq0\right\}}. \end{equation} As a consequence of Theorem \ref{apt} we will be able to characterize the limit set of recursion \eqref{rec} in terms of the dynamics induced by $\hat{H}$. The notions of invariance, internal chain transitivity, attracting sets, basin of attraction and attractors are taken from \cite{benaim1}. We shall state here definitions of a few of the notions mentioned above for the sake of completeness. The \bf{flow }\rm of DI$\eqref{di2}$ is given by the set valued map $\Phi:\mathbb{R}^d\times \mathbb{R}\rightarrow \left\{\text{subsets of }\mathbb{R}^d\right\}$, where for every $(x,t)\in\mathbb{R}^d\times\mathbb{R}$, $\Phi(x,t):=\left\{\bf{x}\rm(t):\bf{x}\rm\in\Sigma(\it{x}\rm)\right\}$. For any $C\subseteq\mathbb{R}^d$, let $\omega_{\Phi}(C):=\cap_{t\geq0} \overline{\Phi_{[t,\infty)}(C)}$, where $\Phi_{[t,\infty)}(C):=\cup_{(x,\tau)\in\ C\times[t,\infty)}\Phi(x,\tau)$. For any $A\subseteq\mathbb{R}^d$, its \bf{basin of attraction }\rm denoted by $B(A)$ is defined as, $B(A):=\left\{x\in\mathbb{R}^d: \omega_{\Phi}\left(\left\{x\right\}\right)\subseteq A\right\}$. A set $A\subseteq\mathbb{R}^d$ is said to be \bf{invariant }\rm for DI$\eqref{di2}$ if for all $x\in A$, there exists $\bf{x}\rm\in \Sigma(\it{x}\rm)$ such that for every $t\in\mathbb{R}$, $\bf{x}\rm(t)\in A$. A compact set $A\subseteq\mathbb{R}^d$ is an \bf{attracting set }\rm for the flow of DI$\eqref{di2}$ if there exists a neighborhood $O$ of $A$, with the property that for every $\epsilon>0$ there exists $t_{\epsilon}>0$ such that for every $t\geq t_{\epsilon}$, $\Phi_{t}(O)\subseteq N^{\epsilon}(A)$, where $N^{\epsilon}(A)$ stands for the $\epsilon$-neighborhood of $A$. A compact set $A\subseteq\mathbb{R}^d$ is an \bf{attractor }\rm for the flow of DI$\eqref{di2}$ if it is an attracting set and is invariant. Further if the basin of attraction of attractor $A$ is the whole of $\mathbb{R}^d$, that is $B(A)=\mathbb{R}^d$, then $A$ is a \bf{global attractor}\rm. Given a set $A\subseteq\mathbb{R}^d$ and $x,y\in A$, for any $\epsilon>0$ and $T>0$ there exists an $(\epsilon,T)$ chain from $x$ to $y$ for DI\eqref{di2} if there exists an integer $n\in\mathbb{N}$, solutions $\bf{x}\rm_1,\dots,\bf{x}\rm_n$ to DI\eqref{di2} and real numbers $t_1,\dots,t_n$ greater than $T$ such that \begin{itemize} \item for all $i\in\left\{1,\dots,n\right\}$ and for all $q\in[0,t_i]$, $\bf{x}\rm_i(\it{q}\rm)\in A$, \item for all $i\in\left\{1,\dots,n\right\}$, $\parallel\bf{x}\rm_i(\it{t_i}\rm)-\bf{x}\rm_{i+1}(0)\parallel\leq\epsilon$, \item $\parallel \bf{x}\rm_1(0)-x\parallel\leq\epsilon$ and $\parallel\bf{x}\rm_n(\it{t_n}\rm)-y\parallel\leq\epsilon$. \end{itemize} A compact set $A\subseteq\mathbb{R}^d$ is said to be \bf{internally chain transitive }\rm if for every $x,y\in A$, for every $\epsilon>0$ and for every $T>0$, there exists $(\epsilon,T)$ chain from $x$ to $y$ for the DI\eqref{di2}. \begin{theorem}\emph{[Limit set]}\label{ls} Under assumptions $(A1)-(A5)$, for almost every $\omega$, the following hold. \begin{itemize} \item [(i)] $L(\bar{x})$ is a non-empty, compact subset of $\mathbb{R}^d$ and is internally chain transitive. \item [(ii)] If $A\subseteq\mathbb{R}^d$ is an attracting set for the flow of DI \eqref{di2} with a basin of attraction $B(A)$, such that $L(\bar{x})\cap B(A)\neq\emptyset$, then $L(\bar{x})\subseteq A$. \item [(iii)] If $A\subseteq\mathbb{R}^d$ is a global attractor for the flow of DI \eqref{di2}, then $L(\bar{x})\subseteq A$. \item [(iv)] If $A=\left\{x^*\right\}$ is a global attractor for the flow of DI \eqref{di2}, then $\left\{x_n\right\}_{n\geq0}$ converges to $x^*$. \end{itemize} \end{theorem} \begin{proof}: \begin{itemize} \item [(i)] Follows from Theorem \ref{apt} above and Theorem 4.3 of \cite{benaim1}. \item [(ii)] From part $(i)$ of this theorem we have that $L(\bar{x})$ is internally chain transitive. Now the claim follows from Theorem 3.23 of \cite{benaim1}. \item [(iii)] Follows from part $(i)$ of this theorem and Corollary 3.24 of \cite{benaim1}. \item [(iv)] Follows from part $(iii)$ of this theorem with $A={x^*}$.\qed \end{itemize} \end{proof} \section{Space of probability measure valued functions} \label{sopmvf} In this section we define the space of probability measure valued measurable functions on $[0,\infty)$ and introduce an appropriate topology on this space. Such spaces are used in the theory of existence of optimal control for diffusions and can also be found in \cite{borkarmark} and \cite{borkaropt}. We shall use the following in the analysis of recursion \eqref{rec} presented in the next section. Let $\mathcal{M}(\mathcal{S}\times U)$ denote the set of all functions $\gamma:[0,\infty)\rightarrow\mathcal{P}(\mathcal{S}\times U)$, measurable. Formally, \begin{equation*} \mathcal{M}(\mathcal{S}\times U):=\left\{\gamma:[0,\infty)\rightarrow\mathcal{P}(\mathcal{S}\times U):\ \gamma\ is\ measurable\right\}. \end{equation*} Similarly, define $\mathcal{M}(\mathcal{S})$, the set of all functions $\gamma:[0,\infty)\rightarrow\mathcal{P}(\mathcal{S})$, measurable. Formally, \begin{equation*} \mathcal{M}(\mathcal{S}):=\left\{\gamma:[0,\infty)\rightarrow\mathcal{P}(\mathcal{S}):\ \gamma\ is\ measurable\right\}. \end{equation*} Let $\tau_{\mathcal{S}\times U}$ denote the topology on $\mathcal{M}(\mathcal{S}\times U)$ which is the coarsest topology that renders continuous the maps $\gamma\in\mathcal{M}(\mathcal{S}\times U)\rightarrow\int_{0}^{T}g(t)[\int_{\mathcal{S}\times U}f(s,u) \gamma(t)(ds,du)]dt\in\mathbb{R}$ for all $f\in\mathcal{C}(\mathcal{S}\times U,\mathbb{R})$, for all $T>0$ and for all $g\in\mathbb{L}_2[0,T]$. Similarly let $\tau_{\mathcal{S}}$ denote the topology on $\mathcal{M}(\mathcal{S})$ which is the coarsest topology that renders continuous the maps $\gamma\in\mathcal{M}(\mathcal{S})\rightarrow\int_{0}^{T}g(t)[\int_{\mathcal{S}}f(s)\gamma(t)(ds)]dt\in\mathbb{R}$ for all $f\in\mathcal{C}(\mathcal{S},\mathbb{R})$, for all $T>0$ and for all $g\in\mathbb{L}_2[0,T]$. The next result is a well known metrization lemma for the above defined topological spaces. \begin{lemma} \emph{[Metrization]} \begin{itemize} \item [(i)] The topological space $(\mathcal{M}(\mathcal{S}\times U),\tau_{\mathcal{S}\times U})$ is compact metrizable. \item [(ii)] The topological space $(\mathcal{M}(\mathcal{S}),\tau_{\mathcal{S}})$ is compact metrizable. \end{itemize} \end{lemma} For a proof of the above lemma we refer the reader to Lemma 2.1 in \cite{borkarmark}. The next lemma provides a continuous map from $\mathcal{M}(\mathcal{S}\times U)$ to $\mathcal{M}(\mathcal{S})$ which is used later in this paper. Recall that for any probability measure, $\nu\in\mathcal{P}(\mathcal{S}\times U)$, $\nu_{\mathcal{S}}$ denotes the image of $\nu$ under projection, $\mathcal{S}\times U\rightarrow\mathcal{S}$ (i.e. $\nu_{\mathcal{S}}\in\mathcal{P}(\mathcal{S})$ such that for every $A\in\mathscr{B}(\mathcal{S})$, $\nu_{\mathcal{S}}(A)=\int_{A\times U}\nu(ds,du)$). \begin{lemma}:\label{lambd} \begin{itemize} \item [(i)]The map $\lambda:\mathcal{P}(\mathcal{S}\times U)\rightarrow\mathcal{P}(\mathcal{S})$ such that, for every $\nu\in\mathcal{P}(\mathcal{S}\times U)$, $\lambda(\nu):=\nu_{\mathcal{S}}$, is continuous. \item [(ii)] For every $\gamma\in\mathcal{M}(\mathcal{S}\times U)$, $\lambda\circ\gamma\in\mathcal{M}(\mathcal{S})$. \item [(iii)] The map $\Lambda:\mathcal{M}(\mathcal{S}\times U)\rightarrow\mathcal{M}(\mathcal{S})$ such that, for every $\gamma\in\mathcal{M}(\mathcal{S}\times U)$, $\Lambda(\gamma):=\lambda\circ\gamma$, is continuous. \end{itemize} \end{lemma} \begin{proof}: \begin{itemize} \item [(i)] Let $\left\{\nu^n\right\}_{n\geq1}$ be a sequence in $\mathcal{P}(\mathcal{S}\times U)$ converging to $\nu\in\mathcal{P}(\mathcal{S}\times U)$. Let $\pi:\mathcal{S}\times U\rightarrow\mathcal{S}$ denote the projection map. Then for every $f\in\mathcal{C}(\mathcal{S},\mathbb{R})$, $f\circ\pi\in\mathcal{C}(\mathcal{S}\times U,\mathbb{R})$. By Theorem 2.1.1 $(ii)$ in \cite{borkarap} and the compactness of $\mathcal{S}\times U$, for every $f\in\mathcal{C}(\mathcal{S},\mathbb{R})$, $\int_{\mathcal{S}\times U}\left(f\circ\pi\right)(s,u)\nu^n(ds,du)\to\int_{\mathcal{S}\times U}\left(f\circ\pi\right)(s,u)\nu(ds,du)$ as $n\to\infty$. Hence for every $f\in\mathcal{C}(\mathcal{S},\mathbb{R})$, $\int_{\mathcal{S}}f(s)\nu^n\pi^{-1}(ds)\to\int_{\mathcal{S}}f(s)\nu\pi^{-1}(ds)$. Observing that for every $n\geq1$, $\nu^n\pi^{-1}=\nu^n_{\mathcal{S}}$ and $\nu\pi^{-1}=\nu_{\mathcal{S}}$ gives us that, for every $f\in\mathcal{C}(\mathcal{S},\mathbb{R})$, $\int_{\mathcal{S}}f(s)\nu^n_{\mathcal{S}}(ds)\to\int_{\mathcal{S}}f(s)\nu_{\mathcal{S}}(ds)$ . Hence $\lambda(\nu^n)\to\lambda(\nu)$ in $\mathcal{P}(\mathcal{S})$, which gives us continuity of $\lambda(\cdot)$. \item [(ii)] Composition of two measurable functions is measurable. \item [(iii)] Let $\left\{\gamma_n\right\}_{n\geq1}$ be a sequence in $\mathcal{M}(\mathcal{S}\times U)$ converging to $\gamma\in\mathcal{M}(\mathcal{S}\times U)$. Then, for every $f\in\mathcal{C}(\mathcal{S}\times U,\mathbb{R})$, for every $T>0$ and for every $g\in\mathbb{L}_2[0,T]$, $\int_{0}^{T}g(t)[\int_{\mathcal{S}\times U}f(s,u)\gamma_n(t)(ds,du)]dt\to\int_{0}^{T}g(t) [\int_{\mathcal{S}\times U}f(s,u)\gamma(t)(ds,du)]dt$ as $n\to\infty$. Hence, for every $f\in\mathcal{C}(\mathcal{S},\mathbb{R})$, for every $T>0$ and for every $g\in\mathbb{L}_2[0,T]$, $\int_{0}^{T}g(t)[\int_{\mathcal{S}\times U}\left(f\circ\pi\right)(s,u)\gamma_n(t)(ds,du)]dt\to\\ \int_{0}^{T}g(t)[\int_{\mathcal{S}\times U}\left(f\circ\pi\right)(s,u)\gamma(t)(ds,du)]dt$ as $n\to\infty$. By argument similar to part $(i)$ of this lemma, we have, for every $f\in\mathcal{C}(\mathcal{S},\mathbb{R})$, for every $T>0$ and for every $g\in\mathbb{L}_2[0,T]$, $\int_{0}^{T}g(t)[\int_{\mathcal{S}}f(s)\left(\lambda\circ\gamma_n\right)(t)(ds)]dt\to\int_{0}^{T}g(t) [\int_{\mathcal{S}}f(s)\left(\lambda\circ\gamma\right)(t)(ds)]dt$ as $n\to\infty$. Therefore $\left\{\left(\lambda\circ\gamma_n\right)\right\}_{n\geq1}$ converges to $\left(\lambda\circ\gamma\right)$ in $\mathcal{M}(\mathcal{S})$, which gives us continuity of $\Lambda(\cdot)$.\qed \end{itemize} \end{proof} \section{Conclusions and directions for future work} \label{cadffw} We have shown that almost surely the linearly interpolated trajectory of recursion \eqref{rec} is an asymptotic pseudotrajectory for the flow of DI \eqref{di2}. The asymptotic pseudotrajectory result proved in this paper enables one to characterize limit sets of recursion \eqref{rec} as internally chain transitive sets of the flow of DI \eqref{di2} which in-turn enables us to guarantee convergence of the iterates to attractors of DI \eqref{di2} as stated in Theorem \ref{ls}. We have also stated two variants of the Markov noise assumption where the analysis is very similar to the one presented. Finally applications are presented where the recursion studied in this paper naturally appears and in the case of subgradient descent we have also been able to interpret the set-valued map associated with DI \eqref{di2} as subdifferential of a certain averaged function. Certain extensions and applications which we wish to consider in future are listed below. \begin{itemize} \item [(1)] Stochastic approximation schemes on multiple time scales are extensively studied in literature and find use in several reinforcement learning and optimization applications. For the case without Markov noise, the two time scale stochastic approximation with single valued maps and the case of set-valued maps have already been studied (see chapter 6 in \cite{borkartxt} for the single valued case and \cite{leslep} for the set-valued case). One can extend the analysis presented in this paper to obtain a similar result for two time scale stochastic recursive inclusions with Markov noise. \item [(2)] Throughout this paper we have assumed that the state space of the Markov noise is a compact metric space. In many practical scenarios, the Markov noise terms take values in a general Polish space. For such a case we believe that the analysis presented in the paper can be extended under certain additional assumptions. The idea would be to embed the polish space as a dense subset of a compact metric space and under some additional assumptions which guarantee an upper semicontinuous extension of set-valued map $H$ and tightness of some probability measures one might be able to provide an APT argument as in this paper (see \cite{borkarmark}). \item [(3)] Assumption $(A5)$, which ensures that the iterates are stable usually is hard to verify. The Borkar-Meyn theorem (see \cite{borkarmeyn}) which provides a sufficient condition for stability of iterates for stochastic approximation schemes with single valued maps has been extended to the set-valued case without Markov noise (see \cite{arunstab}) and we believe that a similar extension is possible to the set-valued case with Markov noise. Stability results similar to the one in \cite{andvih} also need to be investigated for possible extension to the set-valued case. \item [(4)] In many applications one encounters the recursion, \begin{equation*} X_{n+1}\in \text{\bf{P}\rm}\left[X_{n}+a(n)(H(X_n,S_n)+M_{n+1})\right], \end{equation*} where \bf{P }\rm denotes the projection of the set $X_{n}+a(n)(H(X_n,S_n)+M_{n+1})$ onto a compact (possibly convex) subset of $\mathbb{R}^d$. Such recursions are of interest also because the assumption of stability (that is $(A5)$) is naturally satisfied. For the single valued case such recursions are studied in \cite{dupuis} and the extension of the same to the recursion above needs to be established. \item [(5)] Another variant of Markov noise assumptions studied for the single valued case is given in \cite{matti}. These set of assumptions enable one to study behavior of stochastic approximation schemes in the single valued case when the state space is a general Euclidean space. Since in this paper we study the set-valued case by converting it to the single valued setting it would be interesting to see if those assumptions can be used for the set-valued case as in this paper. \end{itemize} \subsection{Upper semicontinuous set valued maps and their approximation} First we shall recall the notion of upper semicontinuity, lower semicontinuity and continuity of set valued maps. These notions are taken from chapter 1, section 1 of \cite{aubindi}. \begin{definition} A set valued map $H:\mathbb{R}^d\times\mathcal{S}\rightarrow\left\{\text{subsets of }\mathbb{R}^d\right\}$ is, \begin{itemize} \item \it{Upper semicontinuous }\rm(u.s.c.) if, for every $(x_0,s_0)\in\mathbb{R}^d\times\mathcal{S}$, for every $\epsilon>0$, there exists $\delta>0$ (depending on $(x_0,s_0)$ and $\epsilon$) such that, \begin{equation*} \parallel x-x_0\parallel<\delta,\ d_{\mathcal{S}}(s,s_0)<\delta\implies H(x,s)\subseteq H(x_0,s_0)+\epsilon U, \end{equation*} where $U$ denotes the closed unit ball in $\mathbb{R}^d$. \item \it{Lower semicontinuous }\rm(l.s.c) if, for every $(x_0,s_0)\in\mathbb{R}^d\times\mathcal{S}$, for every $z_0\in H(x_0,s_0)$, for every sequence $\left\{\left(x_n,s_n\right)\right\}_{n\geq1}$ converging to $(x_0,s_0)$, there exists a sequence $\left\{z_n\in H(x_n,s_n)\right\}$ converging to $z_0$. \item \it{Continuous }\rm if, it is both u.s.c. and l.s.c. \end{itemize} \end{definition} For set valued maps taking compact set values we have the above mentioned notion of u.s.c. to be equivalent to the standard notion of u.s.c. (see pg. 45, \cite{aubindi}). In this paper we shall encounter set valued maps which are compact set valued and hence we have chosen to state the above as the definition of upper semicontinuity. Since the set valued map $H$ satisfying assumption $(A1)$ has closed graph (i.e. assumption $(A1)(iii)$ holds), the following lemma follows from Corollary 1 in chapter 1, section 1 of \cite{aubindi}. \begin{lemma} \emph{[u.s.c.]} A set valued map $H$ satisfying $(A1)$ is u.s.c. \end{lemma} The next lemma gives a sequence of decreasing continuous set valued maps which approximate the set valued map $H$ satisfying assumption $(A1)$. The statement of the lemma below can be found in page 39 of \cite{aubindi}. \begin{lemma} \emph{[continuous embedding]}\label{ctem} Let $H$ be a set valued map satisfying $(A1)$. Then there exists a sequence of set valued maps, $\left\{H^{(l)}\right\}_{l\geq1}$ where for every $\ l\geq1$, \begin{itemize} \item [(i)] $H^{(l)}:\mathbb{R}^d\times\mathcal{S}\rightarrow\left\{\text{subsets of }\mathbb{R}^d\right\}$ is continuous and for every $(x,s)\in\mathbb{R}^d\times\mathcal{S}$, $H^{(l)}(x,s)$ is a convex and compact subset of $\mathbb{R}^d$, \item [(ii)] for every $(x,s)\in\mathbb{R}^d\times\mathcal{S}$, $H(x,s)\subseteq H^{(l+1)}(x,s)\subseteq H^{(l)}(x,s)$, \item [(iii)] there exists $K^{(l)}>0$, such that for every $(x,s)\in\mathbb{R}^d\times\mathcal{S},\\ \sup_{z\in H^{(l)}(x,s)}\parallel z\parallel\leq K^{(l)}(1+\parallel x\parallel)$. \end{itemize} Furthermore, for every $(x,s)\in\mathbb{R}^d\times\mathcal{S}$, $H(x,s)=\cap_{\substack{l\geq1}}H^{(l)}(x,s)$. \end{lemma} A brief outline of the proof of the above lemma is provided in appendix \ref{prf_ctem}. The following are some useful observations from the proof of Lemma \ref{ctem}. \begin{itemize} \item [(a)] $\tilde{K}:=\sup_{l\geq1}K^{(l)}$ is finite. \item [(b)] For every $(x,s)\in\mathbb{R}^d\times\mathcal{S}$, for every $\epsilon>0$, there exists $L$ (depending on $\epsilon$ and $(x,s)$), such that, for every $l\geq L$, $H^{(l)}(x,s)\subseteq H(x,s)+\epsilon U$. \end{itemize} The next lemma gives us a continuous parametrization of the continuous set valued maps $H^{(l)}$ as in Lemma \ref{ctem}. This lemma follows from Theorem 2 in chapter 1, section 7 of \cite{aubindi}. \begin{lemma} \emph{[parametrization]}\label{param} For every $l\geq1$, $H^{(l)}$ be a set valued map as in Lemma \ref{ctem}. Then for every $l\geq1$, there exists a continuous function $h^{(l)}:\mathbb{R}^d\times\mathcal{S}\times U\rightarrow\mathbb{R}^d$ such that, \begin{itemize} \item [(i)] for every $(x,s)\in \mathbb{R}^d\times\mathcal{S}$, $H^{(l)}(x,s)=h^{(l)}(x,s,U)$ where $U$ denotes the closed unit ball in $\mathbb{R}^d$ and $h^{(l)}(x,s,U):=\left\{h^{(l)}(x,s,u):u\in U\right\}$, \item[(ii)] for every $(x,s,u)\in\mathbb{R}^d\times\mathcal{S}\times U$, $\parallel h^{(l)}(x,s,u)\parallel\leq K^{(l)}(1+\parallel x\parallel)$ where $K^{(l)}$ is as in Lemma \ref{ctem}\it{(iii)}\rm. \end{itemize} \end{lemma} Combining Lemma \ref{ctem} and Lemma \ref{param} we obtain the approximation theorem stated below. \begin{theorem} \emph{[approximation]} Let $H$ be a set valued map satisfying $(A1)$. Then there exists a sequence of continuous functions, $\left\{h^{(l)}\right\}_{l\geq1}$, such that, for every $l\geq1$, \begin{itemize} \item [(i)] $h^{(l)}:\mathbb{R}^d\times\mathcal{S}\times U\rightarrow \mathbb{R}^d$ is continuous and for every $(x,s)\in\mathbb{R}^d\times\mathcal{S}$, $h^{(l)}(x,s,U)$ is a convex and compact subset of $\mathbb{R}^d$, \item [(ii)] for every $(x,s)\in\mathbb{R}^d\times\mathcal{S}$, $H(x,s)\subseteq h^{(l+1)}(x,s,U)\subseteq h^{(l)}(x,s,U)$, \item [(iii)] there exists $K^{(l)}>0$, such that for every $(x,s,u)\in \mathbb{R}^d\times\mathcal{S}\times U$, $\\\parallel h^{(l)}(x,s,u)\parallel\leq K^{(l)}(1+\parallel x\parallel)$. \end{itemize} Furthermore, for every $(x,s)\in\mathbb{R}^d\times\mathcal{S}$, $H(x,s)=\cap_{l\geq1}h^{(l)}(x,s,U)$. \end{theorem}
{'timestamp': '2016-07-19T02:03:49', 'yymm': '1607', 'arxiv_id': '1607.04735', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04735'}
arxiv
\section{Introduction} Adaptation is often viewed as a cumulative succession of fixations of beneficial mutations, and the waiting time between two successive beneficial mutations is viewed as one of the main factor limiting adaptation rate \citep{fisher1930, crowkimura1965}. This is however not true in general since several beneficial mutations can compete in a single population, which generates different interference phenomena, such as the Muller's ratchet \citep{muller32, muller64} or more generally Hill-Robertson interfences \citep{hillrobertson66}. Competition between several beneficial mutations is especially expected in large asexual populations with high mutation rates and adaptation is then expected to be slowed down, a phenomenon called ``clonal interference'' \citep{gerrishlenski98}. Clonal interference and its consequences on adaptation rates seems general as they have been observed in bacteria, viruses, yeasts or cancer tumors \citep[e.g.][]{mirallesetal99, devisserrozen06, greavesmaley12, langetal13}. \\ Despite the ubiquity and importance of clonal interference, experiments showed that adaptation is not blocked and keep on even after thousands generations \citep[e.g.][]{wiseretal13}. These observations led more recently to the development of an alternative view of clonal interference, considering that beneficial mutations can occur in a single lineage \citep{desaifisher07}, thus increasing fitness gradually. In large populations with high mutation rates, it is expected that adaptation follows a wave \citep{desaifisher07, goodetal12} bounded by the most and the least fit lineages. Adaptation rate is expected to be constant in this model and depends only on the width of the wave, in other words on the genetic variability present in the population. \\ Models of clonal interference have been useful in understanding the dynamics of adaptation in asexual populations, and have known many empirical successes. However, many experiments have shown that the dynamics of beneficial mutations can be much more complex. Different experiments showed that dynamics can be non-linear: lineages can show multiple frequency peaks during the course of adaptation \citep{leemarx13} and different lineages can coexist for a long time in a single population \citep{langetal11, maddamsettietal15}. This suggests that frequency-dependent fitness can occur. Moreover, cooperation between lineages and niche construction have been observed multiple times in tumoral cancers and bacteria \citep{yangetal14, kinnersleyetal14}, which suggests that taking into account different ecological interactions might be important for a global understanding of the evolution of asexual populations with large population size and high mutation rates. \\ Clonal interference has been mostly theoretically studied using population genetics models with strong assumptions: beneficial mutations are assumed to have simple epistatic interactions, the effect of mutations on fitness is assumed to be transitive, selection is assumed not to depend on the mutants frequency, and the environment is assumed constant. Non-transitive fitness and non-linear dynamics are consequently considered as special cases, of less important interest. There is however a large literature dealing with Lotka-Volterra models with more than two species, especially with non-transitive competitive interactions. These studies try to define the conditions for the coexistence of multiple competitive species in a community \citep[e.g.][]{huismanetal01}. Such studies are generally deterministic and investigate the conditions of stability of dynamical systems. When dealing with stochastic dynamics, simulations are generally performed in spatialized context \citep{laird14} again in order to determine the conditions for the coexistence of multiple competing species. Those studies do not however investigate the probability and time of fixation of mutations and are thus of limited interest regarding the effect of competitive interactions between several clones in the course of adaptation, especially on the adaptation rate. \\ Here we propose a stochastic model with three different lineages under competition, where the competitive interactions are not necessarily transitive, thus relaxing one important assumption of the models studying clonal interference so far. Our model embraces a large variety of phenomena observed in the course of adaptation of asexual species. We recover classical results from clonal interference models and we also show that unexpected behaviours are expected. For instance, we show that in some cases competitive interactions between three clones can lead to a higher rate of adaptation. Our results generally show that non-linear dynamics are likely in large clonal populations, which challenges the interpretation of experimental results. \\ \section{Model and methods} \subsection{Definitions and assumptions} We denote $i \in [0,1,2]$ a type of individuals (types can be phenotypes, alleles, strains, clonal species, mutants, etc.). For the sake of simplicity, we will use in the rest of the paper the term \emph{mutant} $i$ when referring to type $i$ individuals. $N(t)=(N_i(t))$ is a vector whose elements are the number of mutants $i$ in the population at time $t$, with $N_i(t)$ a random variable. We assume that the environment has a fixed quantity of available resources: the carrying capacity $K$ modulates the intensity of competition between individuals. We investigate the population dynamics of three clonal types as a birth-death process with competition in continuous time. Each mutant $i$ is characterized by its individual ecological parameters: $\beta_i$ and $\delta_i$ are respectively the individual birth and natural death rates, and $C_{ij}$ is the effect of competition of a single mutant $j$ on a single mutant $i$, assuming $C_{ij} \geq 0$ and $C_{ii}>0$. For simplicity, we assume that competition between individuals affects mortality. The individual death rate of a mutant $i$ thus depends on both an intrinsic component ($\delta_i$) and a component due to competition: $d_i(N(t))=\delta_i+C_{i0} N_0(t)/K +C_{i1}N_1(t)/K+C_{i2}N_2(t)/K$.\\ We suppose that the resident population is only composed of mutants $0$, at its ecological steady-state equilibrium, say $N_0(0)$. A single mutant $1$ is introduced in the population ($N_1(0)=1$). The population of mutants $1$ follows a stochastic dynamics that depends on the ecological parameters and the competitive interactions between mutants $0$ and mutants $1$. The time taken for mutants $1$ to invade the resident population, and eventually get fixed, is of order $\log K$ \citep{champagnat06}. Since the dynamics is stochastic, mutants $1$ can either spread or be lost. Since we are interested in the dynamics of three competing clones, we will focus on cases where neither mutants $0$ nor mutants $1$ are lost when a single mutant $2$ enters the population by mutation (or migration). We assume that the time at which this event occurs is $\alpha \log K$, $\log K$ being the time scale of the whole stochastic dynamics. There are two general cases. Either $\alpha$ is low enough that mutants $1$ are still in too few numbers to affect the invasion of mutants $2$, or $\alpha$ is large enough that mutants $1$ have invaded the population and thus affect the invasion of mutants $2$. We will investigate both situations and show that the time $\alpha \log K$ at which mutant $2$ enters the population is crucial and largely affect the final state of the population.\\ \subsection{The stochastic dynamics is a succession of several phases} When the population is large, the dynamics followed by the population can be divided into a succession of two kinds of phases. First, when a mutation enters a population, say a mutant $j$ enters in an single copy in a $i$ resident population, the dynamics of mutants $j$ is well approximated by a branching birth-death process without interactions until its population size $N(j)$ is large enough, i.e. when it is of order $K$ \citep{fourniermeleard04, champagnat06}. In the case of the joint dynamics of three interacting clones, the dynamics of two mutants $j$ and $k$ in a resident population $i$ is also well approximated by a branching birth-death process without interactions (see the proofs in the companion paper \cite{billiardsmadi}). Second, when two or three mutants have a population size of order $K$, then the stochastic dynamics of these populations is well approximated by a competitive Lotka-Volterra deterministic system \citep{fourniermeleard04, champagnat06, billiardsmadi}. During this phase, if the population size of one of the mutants is of order lower than $K$, then its population size essentially does not change until the deterministic equilibrium is reached. Even though the whole dynamics is stochastic, we will respectively call these two kinds of phases ``stochastic'' and ``deterministic'', for the sake of simplicity (see Fig. \ref{fig:phases}). The dynamics of the population can finally be described as a succession of ``stochastic'' and ``deterministic'' phases. Note that we only give in this paper the relevant biological results and a summarized version of the model (mathematical proofs and detailed computations are given in a companion paper \cite{billiardsmadi}).\\ {\bf Deterministic phases.} We denote by $n_i$ the size of the population of mutants $i$ when dealing with the deterministic dynamics, while we will keep the notation $N_i$ when dealing with stochastic dynamics ($n_i$ is the population size rescaled by the carrying capacity $N_i / K$ when $N_i$ is of order $K$). When the population size of the three mutants are of order $K$, the dynamics of the rescaled process can be well approximated by the following system of ordinary differential equations, \begin{equation} \label{EDO} \left\{\begin{array}{ll} \dot{n}_0=(\beta_0-\delta_0-C_{0,0}n_0-C_{0,1}n_1-C_{0,2}n_2)n_0,\\ \dot{n}_1=(\beta_1-\delta_1-C_{1,0}n_0-C_{1,1}n_1-C_{1,2}n_2)n_1,\\ \dot{n}_2=(\beta_2-\delta_2-C_{2,0}n_0-C_{2,1}n_1-C_{2,2}n_2)n_2. \end{array} \right. \end{equation} Under the assumptions that competitive parameters are $C_{ij} \geq 0$ and $C_{ii}>0$ for all $\{i,j\}$, this system of deterministic equations is a three-dimensions Lotka-Volterra competitive model. Such a three species population shows different possible dynamics: different equilibrium states (either monomorphic or polymorphic, with two or three coexistent mutants), or stable limit cycles \citep{zeeman93,zeemanvandendriessche98,zeemanzeeman03}.\\ The fate of a mutant $i$ entering in a single copy a resident $j$ population is associated to the so-called ``invasion fitness'', denoted $S_{ij}=\beta_i-\delta_i-C_{ij} \bar{n}^j$, where $\bar{n}^j=\frac{\beta_j-\delta_j}{C_{jj}}$ is the population size of mutant $j$ at equilibrium when there are only mutants $j$ in the population. The invasion fitness corresponds to the initial growth rate of the mutant when it is rare. If the resident population is composed of both mutants $i$ and $j$ at equilibrium, then the fate of a mutant $k$ entering in a single copy is associated with the invasion fitness denoted $S_{kij}=\beta_k-\delta_k-C_{ki} \bar{n}^{i}_{ij}-C_{kj} \bar{n}^{j}_{ij}$, where \begin{equation} \label{eqpop} \begin{array}{ll}\\ \bar{n}^i_{ij}=\frac{C_{jj}(\beta_i-\delta_i)-C_{ij}(\beta_j-\delta_j)} {C_{ii}C_{jj}- C_{ij}C_{ji}}, \bar{n}^j_{ij}=\frac{C_{ii}(\beta_j-\delta_j)-C_{ji}(\beta_i-\delta_i)}{C_{ii}C_{jj}- C_{ij}C_{ji}}, \end{array} \end{equation} is the equilibrium of Eq. \ref{EDO} when there are only mutants $i$ and $j$ in the population. If $S_{kij}>0$, mutation $k$ is favorable when rare in the polymorphic resident population $(i,j)$ and can invade. \\ {\bf The stochastic phase.} When the population size of at least one mutant, say $i$, is low (\emph{i.e.} its population size is of order lower than $K$), while the other mutants are at their deterministic steady state (their population size is of order $K$), the dynamics of mutants $i$ is close to a pure birth-death process with birth and death rates respectively $\beta_i$ and $\delta_i+\sum_{j \neq i}C_{ij}n_j$, thus neglicting the effect of the competition between individuals $i$. When a mutant $i$ enters a resident $j$ population in a single copy, the probability of invasion of the mutant $i$, defined as the probability that the population of mutants $i$ reaches a size of order $K$, is $S_{ij}/\beta_i$ when $S_{ij}>0$, and a probability 0 if $S_{ij}\leq 0$. The time taken by a mutant $i$ which enters a $j$ resident population to reach the threshold population size is of order $\log K / S_{ij}$. We can similarly define the probability of invasion of a mutant $k$ in a resident population with both mutants $i$ and $j$ as $S_{kij}/\beta_k$ when $S_{kij}>0$, and a probability 0 if $S_{kij}\leq 0$. The time taken by a mutant $k$ which enters a $i$ and $j$ resident population to reach the threshold population size is of order $\log K / S_{kij}$. In both cases, the stochastic phase ends when the mutant is either lost or reaches a threshold population size of order $K$. \subsection{Stochastic dynamics and final states with three competitive clones} When a single favorable mutant enters a resident population, the stochastic dynamics can be decomposed into three successive phases (see Fig. \ref{fig:phases}a and \ref{fig:phases}b): First, a stochastic phase corresponding to the beginning of the mutant invasion and where the mutant has a population size of order lower than $K$; Second, a deterministic phase when the population size of the new mutant is large enough (of order $K$); Third, a new stochastic phase until the resident mutant is lost (if both mutants do not stably coexist at deterministic equilibrium). In the case of competition between three clones with two mutations entering a resident population, the succession of stochastic and deterministic phases must be decomposed into a higher and not limited number of phases.\\ {\bf What determines the different dynamics and final states when there is competition between three clones?} The different dynamics and final states depend on the ecological parameters and also on the following conditions (see details of computation in Appendix A1 and illustrations in Fig. \ref{fig:phases} and \ref{fig:clonalreinforcement}, simulation algorithm given in Appendix A3):\\ i) Does mutant $2$ enter the population during the first (Fig. \ref{fig:phases}a) or second (Fig. \ref{fig:phases}b) stochastic phase (depending on the time $\alpha \log K$)? If mutant 2 enters the population during the first stochastic phase then mutant 1 has a population size of order lower than $K$. Consequently, mutant 2 suffers the competitive effect of mutants 0 only. If mutant 2 enters the population during the second stochastic phase then, assuming mutant 1 is favorable in the resident population, there are two possibilities: either mutants 0 and 1 stably coexist, in which case mutant 2 suffers the competitive effects of both mutants, either mutant 0 has a population size of order lower than $K$, in which case mutant 2 suffers the competitive effects of mutant 1 only; \\ ii) When mutant 2 enters the population during the first stochastic phase (Fig. \ref{fig:phases}a), does mutant 1 or 2 reaches first a population size of order $K$? Since mutants 1 and 2 have a population size lower than order $K$, the speed at which they invade the resident population only depends on their competitive interactions with the resident mutants 0. Hence, which mutants reaches first a population size of order $K$ depends on their invasion fitness $S_{10}$ and $S_{20}$ and on the time when mutant 2 enters the population $\alpha \log K$. The first mutant which reaches a population size of order $K$ determines the initial state of the succeeding deterministic phase; \\ iii) What is the equilibrium of the first deterministic phase: stable coexistence of two mutants, i.e. two mutants have a population size of order $K$, or a single mutant has a population size of order $K$? This only depends on the sign of the invasion fitnesses (Eq. \ref{EDO}). For instance, mutants 0 and 1 stably coexist if $S_{01}>0$ and $S_{10}>0$. \\ iv) What is the population size of all mutants when the second stochastic phase begins? It depends on whether two mutants stably coexist or not at the end of the deterministic phase (step iii), and on the population size of the mutant which did not invade and still has a size lower than order $K$; \\ v) Does a mutant go extinct before the start of the next deterministic phase? When a mutant has a population size of order lower than $K$ and is deleterious in a given context, it is expected to go extinct. However, its time to extinction can take longer than the time for another rare mutation to reach a population size of order $K$. In this case, a new deterministic phase begins. The ecological context of the deleterious mutation can change before it goes extinct, which changes its fate. \\ vi) Steps ii-v are again applied for the further succeeding phases (when applicable) as often as necessary until a final steady state is reached.\\ {\bf The different possible final states and their hitting times.} Our goal is to investigate how clonal interference might affect the dynamics of mutant populations and thus adaptation. We will thus especially focus on cases where mutation $1$ and $2$ have a positive invasion fitness when 2 enters the population during the first stochastic phase ( $S_{10}>0$and $S_{20}>0$), and on cases where mutation $1$ has a positive invasion fitness( $S_{10}>0$) if mutation 2 enters the population during the second stochastic phase (in the latter case, the invasion fitness of mutant 2 depends on the currect state of the population). All the possible final states and their hitting times are compiled in Tables \ref{tableass1} and \ref{tableass2}. We do not give all detailed calculations for all cases here, we only give one detailed example in Appendix A2 as an illustration (for complete and detailed computations see the companion paper \citet{billiardsmadi}). Roughly, two classes of final states are possible: either one mutant goes to fixation (it can be either 0, 1 or 2), or two or three mutants coexist (in all possible combinations). \subsection{ Likelihood of the final states} We want to estimate the likelihood of the different possible final states assuming ecological parameters are drawn in given prior distributions. The complexity of the model can be reduced to: $\rho_i=\beta_i-\delta_i$, the net individuals reproductive rate of mutants $i$, and $\widetilde{C}_{ij}=\frac{C_{ij}}{C_{jj}}$ the ratio of the between and within competitive interactions. We drew $10^6$ different sets of parameters in prior distributions. For a given set of parameters and a given $\alpha$, the final state is given by Tab. \ref{tableass1} and \ref{tableass2}, which allows to estimate the posterior distribution of the final states among the $10^6$ random sets of parameters. \\ The time $\alpha \log K$ at which the second mutation enters the population has a large impact on the final states. We can determine the final states for a given parameter set for any $\alpha$ using the results of our model (Tab. \ref{tableass1} and \ref{tableass2}). Assuming mutation 2 enters the population during the first stochastic phase, we know that mutant 2 necessarily appears before mutant 1 spreads out, i.e. $\alpha<1/S_{10}$. If mutation 2 enters the population during the second stochastic phase, mutant 2 necessarily appears after mutant 1 spreads out and before mutant 0 goes extinct, i.e. $1/S_{10}<\alpha<1/S_{10}+1/|S_{01}|$. We also know that there are two threshold values $\alpha < 1/S_{10}+1/S_{20}(S_{21}/|S_{01}|-1)$ and $\alpha < S_{02} S_{21}/(S_{10} |S_{12}| |S_{01}|)-1/S_{01}$ (Tab. \ref{tableass1}) which determine which dynamics is followed by the population when mutation 2 enters the population during the first stochastic phase. Similarly, there are two threshold values $1/S_{10}<\alpha < 1/S_{10}+1/|S_{01}|-1/S_{21}$ and $1/S_{10}<\alpha <1/S_{10}+S_{02}/(|S_{12}||S_{01}|)-1/S_{21}$ (Tab. \ref{tableass2}) which determine which dynamics is followed by the population when mutation 2 enters the population during the second stochastic phase (see above). We can thus finally compute the probability of any final states given an ecological parameter set and assuming $\alpha$ is uniformly drawn in the interval $\left[ 0, 1/S_{10}\right]$ or $\left[ 1/S_{10}, 1/S_{10}+1/|S_{01}|\right]$ respectively when mutation 2 enters the population during the first or second stochastic phase. \\ {\bf Effect of mutations on the reproductive rates.} In bacteria, yeasts or some eukaryotes, fitness is generally estimated as the initial growh rate (at low density) of mutants (see Table 2 in \cite{martinlenormand06} and the Appendix in \cite{mannaetal12}). We will thus assume that the effect of mutations on the growth rate of mutant $i$ follows a Fisher's geometric model. Given the net reproduction rate of mutants 0 is $\rho_0$, we assumed that the reproductive rate of mutant $i$ is $\rho_i=\rho_0 + x_i$ with $x_i$, the effect of mutation $i$, being drawn in a shifted negative Gamma distribution which is an approximation of a Fisher's geometric model for adaptation \citep{martinlenormand06}. Note that when mutation 2 enters the population during the second stochastic phase, mutation 2 is assumed to occur in the most frequent mutation at equilibrium: $\rho_2=\rho_1 + x_2$ when mutant 1 is more frequent than mutant 0, $\rho_2=\rho_0 + x_2$ otherwise.\\ {\bf Effect of mutations on competition.} There is, to our knowledge, no theoretical or empirical consensus on the distribution of mutation effects on the competitive abilities $\widetilde{C}_{ij}$. Without any knowledge about the distribution of competitive abilities, we simply assumed that the ratio of competitive interaction $\widetilde{C}_{ij}$ follows arbitrary chosen distributions. First, we assumed that it follows a uniform distribution in the interval $\left[1-\mu, 1+\mu \right]$, with $0 \leq \mu \leq 1$. Second we assumed it follows an exponential distribution with parameter $\mu>0$. When $\mu=0$, all $\widetilde{C}_{ij}=1$, fitnesses are necessarily transitive, while if $\mu>0$, frequency-dependent fitnesses can occur. As $\mu$ increases, the variance of the competitive ratio $\widetilde{C}_{ij}$ also increases, i.e. the more different can the competitive interactions be between mutants. \\ \section{Results } Given that two favorable mutations successively enter in a single copy a resident population 0, Tables \ref{tableass1} and \ref{tableass2} show all possible dynamics and final states, depending on the sign of the invasion fitnesses $S_{ij} \text{ and } S_{ijk}, \{i,j,k\} \in \{0,1,2 \}$, and the time of appearance of the second mutation $\alpha \log K$. When the second mutation enters the population during the first stochastic phase, Tab. \ref{tableass1} shows that six final states are possible: fixation of either mutation 1 or 2, stable polymorphic equilibrium with two (mutants 0 and 1, 1 and 2 or 0 and 2) or three mutants (mutants 0, 1 and 2). Tab. \ref{tableass1} also shows that a given possible final state can be reached under different conditions, and consequently after different durations. For instance, mutant 2 can fix under three different cases (a subcase of B, and cases E and I), with potentially different fixation times. When mutation 2 enters the population during the second stochastic phase, Tab. \ref{tableass2} shows that a seventh final state is possible: the fixation of mutant 0, even if mutants 1 and 2 are advantageous when they enter the population. Interestingly, Rock-Paper-Scissors cyclical dynamics can only occur if the second mutation enters the population during the second stochastic phase. Assuming three co-occuring competing clones, our model can thus capture a large diversity of dynamics and allows to determine their duration, final states and likeliness. In the following, we first show that despite the complexity and variety of the possible stochastic dynamics with three competing clones, six possible general dynamics can be defined. Second, we focus on several special cases of particular interest. We especially argue that our model, despite its simple assumptions, captures a large range of dynamics diversity observed in experiments. \subsection{Beyond clonal interference: Six possible dynamics} Two categories of dynamics have been proposed in the empirical literature to explain observations in experiments with several interacting clones: clonal interference, when adaptation is slowed down because of the interaction between advantageous mutations \citep{gerrishlenski98}, or clonal reinforcement \citep{kinnersleyetal14}, also called niche construction or frequency-dependent selection elsewhere \citep{yangetal14}, when several clones stably coexist. Using our model, focusing on the second mutation (mutant 2), we can embrace the two previous proposed categories, and propose an alternative categorization, with more accurate definitions. \\ Competition between three clones can affect adaptation for three reasons: 1) It can promote or hinder polymorphism maintenance; 2) The invasion probability of mutation 2 can be increased or decreased (relatively to the case where mutant 2 enters alone the resident population, i.e. there are only two interacting clones); 3) In cases where mutation 2 goes to fixation, its fixation time can be be shorter or longer. Hence, dynamics with three competing clones can be classified in six general cases: When clonal interaction promotes polymorphism maintenance, we call the dynamics ``clonal coexistence''. When the mutant 2 goes to fixation, we call ``clonal assistance'' when the duration of the sweep is shorter, and ``clonal interference'' (following \cite{gerrishlenski98}) when it is larger than with only two competing clones. Finally, we call ``soft'' vs. ``hard'' the dynamics depending on wheter the invasion probability of the mutant 2 is lower vs. higher than with only two competing clones. This gives 6 possible general dynamics, summarized in Table \ref{tab:cat}.\\ {\bf Rate of adaptation: fixation time vs. probability of invasion of beneficial mutants.} Clonal interference is viewed in the literature as the phenomenon of the increase in fixation time of co-occuring beneficial mutants in a population, which consequently decreases the rate of adaptation of clonal species. However, the rate of adaptation can be affected also by the rate at which new mutants invade a population, i.e. by their probability of invasion. To our knowledge, in all models dealing with clonal interference so far, derived from population genetics models, the probability of invasion of a new mutant only depends on its own features: in general, a selection coefficient $s$ is arbitrarily assigned to a mutant independently of the composition and state of the resident population when this mutant occurs. Its invasion probability and its time of fixation are approximately $2s$ and $1/s$: increasing $s$ necessarily both increases the probability of fixation and decreases the time of fixation. In our approach, we have a more general point of view: both the fixation time and probability of invasion depend on the state of the population when a mutant enters the population. We thus argue that fixation times and probabilities of invasion should be considered independently in order to evaluate to which extent interaction between various clones can affect rate of adaptation. Interestingly, depending on the state of the population when mutation occurs and on their own ecological specificities, the rate of adaptation can increase: the probability of invasion can be higher or the time to fixation can be shorter, what we propose to call ``hard clonal assistance''. \\ {\bf Clonal coexistence: cooperative interactions are not necessary.} Several experiments of competition between clones have shown stable persistence of different strains in a single well-mixed population, which has been explained by frequency-dependent selection, niche construction or cooperative interactions. Especially, \citet{kinnersleyetal14} introduced the concept of ``clonal reinforcement'' when ``the emergence of one genotype favors the emergence and persistence of other genotypes via cooperative interactions''. Here we show that clones can favor either the emergence (``hard'' vs. ``slow'' dynamics), or the persistence (``clonal coexistence'' vs. ``clonal assistance'' or ``clonal interference'') or both (``hard clonal coexistence''), without any cooperative interactions between clones, but only competition. We do not argue that persistence observed in \citet{kinnersleyetal14} are not effectively due to cooperative interactions, rather we propose an alternative hypothesis: both facilitated emergence and stable persistence of clones can be due to non-transitive competitive interactions, or frequency-dependent selection. It would need specific experimental work to show whether or not clones effectively cooperate. \subsection{Two specific dynamics when the second mutant lately enters the population: Rock-Paper-Scissors or annihilation of adaptation} Two related specific dynamics are encountered only when mutant 2 enters the resident population during the second stochastic phase ($\alpha>1/S_{10}$, Tab. \ref{tableass2}): Rock-Paper-Scissor dynamics (final state J in Tab. \ref{tableass2}), or a return to the initial state, i.e. a population fixed for mutant 0 (final state G in Tab. \ref{tableass2}). These two different dynamics are illustrated in Fig. \ref{fig:phases}b and Fig. \ref{fig:clonalreinforcement}b. Both dynamics have the same parameters, except the time at which mutant 2 enters the population $\alpha \log K$. This illustrates the importance of considering stochastic dynamics: if mutant 2 enters the population early enough that mutant 1 is not extinct when mutant 2 invades, then Rock-Paper-Scissors cyclical dynamics take place, otherwise mutant 0 goes to fixation and adaptation is annihilated despite the occurrence of two beneficial mutations. In a deterministic model, for the same parameters, a mutant can not go extinct and only Rock-Paper-Scissor dynamics is possible. \\ Our results also show that Rock-Paper-Scissors dynamics can be obtained in a narrow set of parameters. In addition to specific parameters values regarding the competitive interactions between the three clones, the second mutant must occur in the population in a narrow time frame. First, it must occur after mutant 1 invaded, since mutant 2 is deleterious in a mutant 0 resident population. Second, if mutant 2 occurs too late during the second stochastic phase, then mutant 0 can be extinct before mutant 2 invades, in which case mutant 1 goes to fixation. These results have important consequences regarding our understanding of empirical Rock-Paper-Scissor dynamics observed in natural populations: either the three types of individuals involved in such stable cycles have effectively entered the population by mutation or migration in a single individual, in which case the third type of individuals has necessarily entered the population in a narrow time frame. Otherwise, the alternative explanation is that the three types of individuals went together in a single population with a sufficiently large enough population size such that the dynamics initially followed an almost-deterministic dynamics, which certainly occurred by a massive migration and mixing of three different and complementary types of individuals \subsection{Likehood of the final states assuming prior distributions of the ecological parameters} Figures \ref{fig:Distrib1} and \ref{fig:Distrib2} show the posterior probability of the dynamics and final states when mutation 2 enters the population during the first and second stochastic phases, assuming that the competition abilities are respectively drawn in an uniform or exponential distribution. When the variance of the distribution of the $\widetilde{C}_{ij}$ is low, all clones have similar competitive abilities ($\widetilde{C}_{ij} \simeq 1$), \emph{i.e.} invasion fitness are mostly transitive. We naturally recover predictions from population genetics models: The likeliest scenari are the fixation either of mutant 1 or 2 (Fig. \ref{fig:Distrib1}c, \ref{fig:Distrib1}d, \ref{fig:Distrib2}c, \ref{fig:Distrib2}d). Rapidly, when the variance of the uniform and exponential distributions increases, polymorphic final states become the likeliest. When the effect of mutation on competitive abilities become large, the likeliness of all dynamics rapidly reaches a plateau when competitive abilities ($\widetilde{C}_{ij}$) are drawn in an uniform distribution (Fig. \ref{fig:Distrib1}). When competitive abilities are drawn in an exponential distribution, the likeliest state is the one with three coexisting clones. Our results suggest that non-transitive fitness are mostly expected to occur when several clones are interacting as soon as mutations affect their competitive abilities. This further supports that clonal coexistence is likely to occur even when considering only competitive interactions: cooperative interactions are not necessary to explain the stable coexistence of several clones. Finally, our results show that Rock-Paper-Scissors dynamics and annihilation of adaptation are weakly probable.\\ Comparing left and right columns in Fig. \ref{fig:Distrib1} and \ref{fig:Distrib2} shows that the time at which mutation 2 enters the population only marginally affects the dynamics and the final states. Interestingly, comparing the final states between cases with two or three interacting clones (Fig.\ref{fig:Distrib2clones}) shows that more polymorphic final states are expected when three clones are interacting, even though the difference is small. Whether a further increase in the number of interacting clones could even more promote the maintenance of polymorphism because of non-transitive fitness. Fig. \ref{fig:Distrib1}, \ref{fig:Distrib2} and \ref{fig:Distrib2clones} also show that the prior distribution of the competitive abilities has important effect: polymorhic final states are more expected when the distribution is exponential.\\ Finally, Fig. \ref{fig:Distrib1}e-f and \ref{fig:Distrib2}e-f show the likeliness of clonal interference \emph{vs.} clonal assistance. When competitive abilities follow an uniform distribution, clonal interference, \emph{i.e.} the slowing down of fixation of beneficial mutation, is the most probable, especially when the competitive abilities are similar between clones (small $\mu$). However, rapidly when the difference between competitive abilities increases (large $\mu$) the likeliness of clonal assistance increases, and reaches a plateau. When mutation 2 enters the population during the second stochastic phase, clonal assistance is even likelier than clonal interference. The situation is different and more complex when competitive abilities follow an exponential distribution, especially when the second mutation enters the population during the second stochastic phase. Contrarily to the uniform distribution, the exponential distribution is asymetrical around the mean, which generates asymetrical invasion fitness distributions and explains the difference observed in our results. Indeed, when the mean $\mu$ is low, the distribution of the invasion fitness is skewed towards negative values, while it is skewed towards positive values when $\mu$ is large (not shown), which explains why polymorphic states are the likeliest for large $\mu$. Globally, our results thus suggest that clonal interference might indeed be an important factor affecting adaptation rate, but clonal assistance can be as important given non-transitive fitnesses are possible. \section{Discussion} Both theory and experimental observations tend to agree regarding the rate of adaptation in evolving large asexual populations: the speed at which new beneficial mutations go to fixation should decrease during the course of adaptation and reach a plateau \cite[e.g.][]{gerrishlenski98, desaifisher07}, what is effectively found in experimental evolution of bacteria \citep{devisserrozen06}. Clonal interference is believed to be the most important factor causing this limit to adaptation: different beneficial mutations occurring simultaneously in competing lineages tend to mutually decrease their probability of fixation and increase their time to fixation, what has been effectively observed in viruses \citep[e.g.][]{panditdeboer14}, bacteria \citep{devisserrozen06} or cancer \citep{greavesmaley12}. This congruence between models and data can be challenged regarding our results. Indeed, by explicitly taking into account competitive interactions between different clones, we showed that the evolutionary dynamics can be much more complex: competitive interactions between clones can either impede or foster adaptation by modifying fixation times and probabilities, and can promote coexistence of clones in the long-term. Our results are different from previous works because in our model non-transitive fitnesses are allowed, giving rise to frequency-dependent selection, non-linear and cyclical dynamics. Our model is in fact more general than previous works since they are a subcase where all competitive interaction abilities are equal ($\widetilde{C}_{ij}=1$). Most importantly, we showed that frequency-dependent selection is very likely when mutations have an effect on competitive interaction abilities (Fig. \ref{fig:Distrib1} and \ref{fig:Distrib2}), giving rise to almost equiprobable dynamics with either clonal interference or clonal assistance, i.e. respectively a decrease or an increase in the rate of adaptation. \\ We might thus wonder why a decreasing rate of adaptation is generally observed in experimental evolution. In other words, why does adaptation in clonal species mostly follow a single subcase of our model where all competitive interaction abilities are almost equal ($\widetilde{C}_{ij} \simeq 1$). Several hypotheses can be made. First, as Lenski and colleagues claimed regarding their long-term experimental evolution, the experiments were designed to avoid frequency-dependent selection: no horizontal gene transfer, a well-mixed environment with no spatial structure and a low concentration of the density-limiting resource \citep{maddamsettietal15}. One can thus imagine that these experimental conditions were effectively fulfilled and their goal is achieved. However, several experiments showed that even in ideal conditions, frequency-dependent selection occurs \citep{maddamsettietal15, kinnersleyetal14, langetal11}. Hence, even if the experimental design limits the occurrence of mutations with non-transitive effects on fitness, it does not obliterate it. A question thus remains: why is frequency-dependent selection so rare in experimental evolution? Second, we only considered three interacting clones in our model, while much more can be competing in a large clonal population. To our knowledge, it is not known whether an increasing number of competing clones decreases the plausibility of non-transitive interactions. However, we showed that non-transitive interactions are more probable with three than two interacting clones (Fig. \ref{fig:Distrib2clones}). Deterministic models with four interacting clones have also shown that even more complex dynamics can be expected, especially chaotic ones \citep{arneodoetal82, vanoetal06}. This suggests that a large number of interacting clones could not be the main cause for the rarity of non-transitive interactions. Third, our estimation of the likeliness of frequency-dependent selection are based on two strong hypotheses: the effect of mutations of competitive interaction abilities follows either an uniform or exponential distribution, and a mutation shows no trade-offs between its effect on the growth rate and the competitive abilities. To our knowledge there is neither empirical nor theoretical treatments about the distribution of the competitive interactions and the trade-offs between species or clones. \citet{maharjanetal06} estimated strength of frequency dependent selection in a limited range of frequencies in a well-mixed environment. They especially showed that non-transitive interactions can have similar extent than transitive interactions. \citet{galletetal12} detected no intransitive interactions between clones three pairs of bacterial clones in a simple experimental sets, suggesting that competitive interactions are weak. Yet, a general treatment is lacking in order to evaluate the potential importance of non-transitive interactions in adaptive populations. Whether non-transitive interactions can be expected to be frequent or not is an important question since it can challenge the generality of the evolutionary dynamics observed in controlled experimental evolution of clonal species. \\ Non-linear dynamics have been observed in various experiments and different explanations and interpretations have been proposed. \citet{langetal11} observed different dynamics in different replicates. They especially observed cases where a lineage showed two successive frequency peaks. They explained this observation by the occurrence of a third cryptic mutation affecting a preexisting lineage, what they called ``multiple mutations'' dynamics. We have shown in our model that such a dynamics can be explained with three interacting clones only: such cyclical dynamics can be observed in cases of Rock-Paper-Scissor. Importantly, we show that such cyclical dynamics can only be observed if the second mutation occurs during the second stochastic phase, i.e. when the first mutation is near fixation. It would be interesting to look thoroughly into the data to challenge this prediction. \citet{maharjanetal06}, \citet{langetal11} and \citet{maddamsettietal15} also showed the possible coexistence of clones in the long-term, which can effectively be explained by negative frequency-dependent selection, as proposed here. \citet{rosenzweigetal1994} and \citet{kinnersleyetal14} showed the long-term coexistence of three lineages derived by mutation from a single initial \emph{Escherichia coli}clone, in a long-run experimental evolution in a chemostat. They interpreted this coexistence as due to cooperative rather than competitive interactions, yet we showed that non-transitive competitive interactions can explain the emergence by mutation and stable coexistence of three clones. \citet{rosenzweigetal1994} showed that the three clones can stably coexist by pairs. Under our framework, it means that $S_{ij}>0$ for all $\{i,j\} \in \{ 0,1,2\}$, and we predict that the three clones should indeed coexist because of non-transitive competitive interactions. The three clones consume the same resources (glucose, acetate, glycerol, \cite{hellingetal87}, \cite{rosenzweigetal1994}) supporting the existence of competitive interactions. However, looking thoroughly at the data, it is not obvious that one of the clones is maintained in coexistence when in competition with another: its frequency is less than 1\% and sometimes even not detected in the experiments (see Fig. 1d in \citet{rosenzweigetal1994}). Taking an opposite point of view than the authors of the experiments, we can conclude that mutant 2 is not maintained when in competition with mutant 1 (\emph{i.e.} $S_{12}<0$). In this case, our model predicts that the three clones can not stably coexist, and consequently cooperation between the three clones can be an exclusive explanation for the observed coexistence. \renewcommand\refname{Literature Cited} \bibliographystyle{amnat2}
{'timestamp': '2016-07-19T02:00:32', 'yymm': '1607', 'arxiv_id': '1607.04656', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04656'}
arxiv
\section{Error Probability Bound}\label{appendix:APPENDIX A} In this section, we give a direct proof for \Cref{direct lemma1}. Specifically, we bound the error probability of the maximum likelihood decoder, and show that under the condition on $T$ in the lemma, the error probability is indeed approaching $0$ as $N \to \infty$. Under the assumption that all items are equality likely to be defective, we consider the error probability given that the first $K$ items are defective, that is, \revisedSr{$S_{w=1}$} is the defective set. Denote this probability by $P_{e|1}$. We have \begin{equation*} P_{e|1} \leq \sum_{i=1}^{K}P(E_i), \end{equation*} where $E_i$ is the event of a decoding error in which the decoder declares a defective set which differs from the true one ($S_1$) in exactly $i$ items. \revisedSr{Note that the discussion below will apply to any defective set $S_w$ of size $K$, hence the probability of error computed decays exponentially for any ``message $W$".} In general, we follow the derivation in \cite{atia2012boolean}. However, there is a key difference. In the code construction suggested in \Cref{LowerBound}, for each item there are $M$ possible codewords (a ``bin" of size $M$). Only one of these codewords is selected by the mixer to decide in which pool tests the item will participate. Thus, when viewing this problem as a channel coding problem, if an item is defective, one and only one codeword out of its bin is actually transmitted (and summed with the codewords of the other $K-1$ defective items). Since the decoder does not know which codewords were selected in each bin (the randomness is known only to the mixer), there are multiple error events to consider. E.g., events where the decoder choose the wrong codeword for some items, yet identified parts of the bins correctly, and, of course, events where the codeword selected was from a wrong bin. This complicates the error analysis significantly. Moreover, we wish to employ the correction suggested in \cite{atia2015correction}, which results in a simpler yet stricter bound. Consider the event $E_i$. Clearly, $E_i$ can be broken down into two disjoint events. The first is $E_i$ \emph{and} the event that the codewords selected for the correct $K-i$ items are the true transmitted ones, and the second is the event of both $E_i$ and the event that \emph{at least one of the codewords selected} for the correct items is wrong. Denote the first event as $E'_i$. Now, consider the case where we have $E_i$, that is, a correct decision on $K-i$ items, yet, out of these $K-i$ items, the decoder identified only $j$ codewords right, $0 \leq j < K-i$, and for the rest, it identified a wrong codeword in the right bin. We claim that the probability for this event is exactly $P(E'_{K-j})$, as the decoder has to mistake $\bf{X'}$ for $\bf{X}_{S_1}$, where both are collections of $K$ codewords, and $\bf{X'}$ shares exactly $j$ codewords with $\bf{X}_{S_1}$. Thus, we have: \begin{eqnarray}\label{E and E'} P_{e|1} &\leq& \sum_{i=1}^{K}P(E_i) \nonumber\\ &=& \sum_{i=1}^{K}\Big( P(E'_i) + \sum_{j=0}^{K-i-1} {K-i-1 \choose j}P(E'_{K-j}) \Big) \nonumber\\ &\leq&\revisedr{2^K} \sum_{i=1}^{K}P(E'_i). \end{eqnarray} The last inequality in \eqref{E and E'} is loose, yet it suffices for the proof in the regime where $K=O(1)$. A more delicate bounding technique might be required if $K$ might grow with $N$. We now bound $P(E'_i)$. Particularly, we will establish the following lemma. \begin{lemma}\label{error lemma2 with E'} The error probability $P(E'_{i})$ is bounded by \begin{equation*} P(E'_{i}) \leq 2^{-T\left(E_{o}(\rho)-\rho\frac{\log\binom{N-K}{i}M^i}{T}-\frac{\log\binom{K}{i}}{T}\right)}, \end{equation*} where the error exponent $E_{o}(\rho)$ is given by \ifdouble \begin{multline} E_{o}(\rho)= -\log \sum_{Y\in \{0,1\}}\sum_{X_{\mathcal{S}^2}\in \{0,1\}}\Bigg[\sum_{X_{\mathcal{S}^1}\in \{0,1\}}P(X_{\mathcal{S}^1})\\ p(Y,X_{\mathcal{S}^2}|X_{\mathcal{S}^1})^{\frac{1}{1+\rho}}\Bigg]^{1+\rho},\text{ } 0 \leq\rho \leq1.\nonumber \end{multline} \else \begin{equation*} E_{o}(\rho)= -\log \sum_{Y\in \{0,1\}}\sum_{X_{\mathcal{S}^2}\in \{0,1\}}\Bigg[\sum_{X_{\mathcal{S}^1}\in \{0,1\}}P(X_{\mathcal{S}^1}) p(Y,X_{\mathcal{S}^2}|X_{\mathcal{S}^1})^{\frac{1}{1+\rho}}\Bigg]^{1+\rho},\text{ } 0 \leq\rho \leq1. \end{equation*} \fi \end{lemma} \begin{proof} Denote by \begin{equation*}\label{weaker_error1} \mathcal{A} = \{w \in \revisedSr{\mathcal{W}} : |S_{1^{c},w}|=i,|S_{w}|=K\} \end{equation*} the set of indices corresponding to sets of $K$ items that differ from the true defective set $S_{1}$ in exactly $i$ items. $S_{1^{c},w}$ for $w \in \revisedSr{\mathcal{W}}$ denotes the set of items which are in $S_w$ but not in $S_1$. We have \ifdouble \begin{eqnarray}\label{weaker_error2} && \Pr[E'_i|w_0=1, \textbf{X}_{\mathcal{S}_1},Y^T]\nonumber\\ & \leq & \sum_{w \in \mathcal{A}} \sum_{\textbf{X}_{\mathcal{S}_{1^{c},w}}} Q({\scriptstyle\textbf{X}_{\mathcal{S}_{1^{c},w}}}) \frac{{\scriptstyle p_{w}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1^{c},w}})^s}} {{\scriptstyle p_{1}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1,w^{c}}})^s}}\\ & \leq & \sum_{\mathcal{S}_{1,w}} \sum_{\mathcal{S}_{1^{c},w}}\sum_{\textbf{X}_{\mathcal{S}_{1^{c},w}}} Q({\scriptstyle \textbf{X}_{\mathcal{S}_{1^{c},w}}})\frac{{\scriptstyle p_{w}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1^{c},w}})^s}} {{\scriptstyle p_{1}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1,w^{c}}})^s}}\nonumber, \end{eqnarray} \else \begin{eqnarray}\label{weaker_error2} \Pr[E'_i|w_0=1, \textbf{X}_{\mathcal{S}_1},Y^T] & \leq & \sum_{w \in \mathcal{A}} \sum_{\textbf{X}_{\mathcal{S}_{1^{c},w}}} Q({\scriptstyle\textbf{X}_{\mathcal{S}_{1^{c},w}}}) \frac{{\scriptstyle p_{w}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1^{c},w}})^s}} {{\scriptstyle p_{1}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1,w^{c}}})^s}}\\ & \leq & \sum_{\mathcal{S}_{1,w}} \sum_{\mathcal{S}_{1^{c},w}}\sum_{\textbf{X}_{\mathcal{S}_{1^{c},w}}} Q({\scriptstyle \textbf{X}_{\mathcal{S}_{1^{c},w}}})\frac{{\scriptstyle p_{w}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1^{c},w}})^s}} {{\scriptstyle p_{1}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1,w^{c}}})^s}}\nonumber, \end{eqnarray} \fi where \eqref{weaker_error2} is exactly \cite[eq. (25)]{atia2012boolean}, as when considering $E'_i$ we assume the decoder not only got $K-i$ items right, but also the correct codeword in each such bin. Hence \ifdouble \begin{eqnarray} &&\hspace{-0.5cm} \Pr[E_i|w_0=1, \textbf{X}_{\mathcal{S}_1},Y^T]\nonumber\\ &\hspace{-0.5cm} \stackrel{(a)}{\leq} &\hspace{-0.4cm} \Big(\sum_{\mathcal{S}_{1,w}} \sum_{\mathcal{S}_{1^{c},w}}\sum_{\textbf{X}_{\mathcal{S}_{1^{c},w}}} Q({\scriptstyle\textbf{X}_{\mathcal{S}_{1^{c},w}}}) \frac{{\scriptstyle p_{w}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1^{c},w}})^s}} {{\scriptstyle p_{1}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1,w^{c}}})^s}}\Big)^{\rho}\nonumber\\ &\hspace{-0.5cm} \stackrel{(b)}{\leq} &\hspace{-0.4cm} \Big(\sum_{\mathcal{S}_{1,w}} {\scriptstyle\binom{N-K}{i}M^{i}}\sum_{\textbf{X}_{\mathcal{S}_{1^{c},w}}} Q({\scriptstyle\textbf{X}_{\mathcal{S}_{1^{c},w}}})\frac{{\scriptstyle p_{w}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1^{c},w}})^s}} {{\scriptstyle p_{1}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1,w^{c}}})^s}}\Big)^{\rho}\nonumber\\ &\hspace{-0.5cm} \stackrel{(c)}{\leq} &\hspace{-0.4cm} {\scriptstyle\binom{N-K}{i}^\rho M^{i\rho}}\sum_{\mathcal{S}_{1,w}}\Big(\sum_{\textbf{X}_{\mathcal{S}_{1^{c},w}}} Q({\scriptstyle\textbf{X}_{\mathcal{S}_{1^{c},w}}})\frac{{\scriptstyle p_{w}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1^{c},w}})^s}} {{\scriptstyle p_{1}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1,w^{c}}})^s}}\Big)^{\rho}\nonumber \end{eqnarray} \else \begin{eqnarray} \Pr[E_i|w_0=1, \textbf{X}_{\mathcal{S}_1},Y^T]&\stackrel{(a)}{\leq} & \Big(\sum_{\mathcal{S}_{1,w}} \sum_{\mathcal{S}_{1^{c},w}}\sum_{\textbf{X}_{\mathcal{S}_{1^{c},w}}} Q({\scriptstyle\textbf{X}_{\mathcal{S}_{1^{c},w}}}) \frac{{\scriptstyle p_{w}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1^{c},w}})^s}} {{\scriptstyle p_{1}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1,w^{c}}})^s}}\Big)^{\rho}\nonumber\\ & \stackrel{(b)}{\leq} & \Big(\sum_{\mathcal{S}_{1,w}} {\scriptstyle\binom{N-K}{i}M^{i}}\sum_{\textbf{X}_{\mathcal{S}_{1^{c},w}}} Q({\scriptstyle\textbf{X}_{\mathcal{S}_{1^{c},w}}})\frac{{\scriptstyle p_{w}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1^{c},w}})^s}} {{\scriptstyle p_{1}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1,w^{c}}})^s}}\Big)^{\rho}\nonumber\\ &\stackrel{(c)}{\leq} & {\scriptstyle\binom{N-K}{i}^\rho M^{i\rho}}\sum_{\mathcal{S}_{1,w}}\Big(\sum_{\textbf{X}_{\mathcal{S}_{1^{c},w}}} Q({\scriptstyle\textbf{X}_{\mathcal{S}_{1^{c},w}}})\frac{{\scriptstyle p_{w}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1^{c},w}})^s}} {{\scriptstyle p_{1}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1,w^{c}}})^s}}\Big)^{\rho}\nonumber \end{eqnarray} \fi for all $s>0$ and $0\leq\rho\leq1$. Note that (a) is since the probability is less than $1$ and can be raised to the power of $\rho$. (b) is critical. It follows from the symmetry of codebook construction, namely, the inner summation depends only on the codewords in $\textbf{X}_{\mathcal{S}_{1^{c},w}}$ but not the ones in $\mathcal{S}_{1^{c},w}$. Due to the code's construction, i.e., its binning structure, there are exactly $\binom{N-K}{i}M^{i}$ possible sets of codewords to consider for $\mathcal{S}_{1^{c},w}$. (c) follows as the sum of positive numbers raised to the $\rho$-th power is smaller than the sum of the $\rho$-th powers. We now continue similar to \cite{atia2012boolean}, substituting the conditional error probability just derived in a summation over all codewords and output vectors. We have \ifdouble \begin{eqnarray} P(E'_i) & = & \sum_{\textbf{X}_{\mathcal{S}_{1}}}\sum_{Y^T}p_1(\textbf{X}_{\mathcal{S}^1},Y^T)\Pr[E'_i|w_0=1, \textbf{X}_{\mathcal{S}_1},Y^T]\nonumber\\ & \leq & {\scriptstyle\binom{N-K}{i}^\rho M^{i\rho}}\sum_{\mathcal{S}_{1,w}}\sum_{Y^T}\sum_{\textbf{X}_{\mathcal{S}_{1}}}p_1({\scriptstyle \textbf{X}_{\mathcal{S}^1},Y^T})\nonumber\\ && \left(\sum_{\textbf{X}_{\mathcal{S}_{1^{c},w}}}Q({\scriptstyle\textbf{X}_{\mathcal{S}_{1^{c},w}}}) \frac{{\scriptstyle p_{w}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1^{c},w}}})^s} {{\scriptstyle p_{1}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1,w^{c}}}})^s}\right)^{\rho}\nonumber. \end{eqnarray} \else \begin{eqnarray} P(E'_i) & = & \sum_{\textbf{X}_{\mathcal{S}_{1}}}\sum_{Y^T}p_1(\textbf{X}_{\mathcal{S}^1},Y^T)\Pr[E'_i|w_0=1, \textbf{X}_{\mathcal{S}_1},Y^T]\nonumber\\ & \leq & {\scriptstyle\binom{N-K}{i}^\rho M^{i\rho}}\sum_{\mathcal{S}_{1,w}}\sum_{Y^T}\sum_{\textbf{X}_{\mathcal{S}_{1}}}p_1({\scriptstyle \textbf{X}_{\mathcal{S}^1},Y^T}) \left(\sum_{\textbf{X}_{\mathcal{S}_{1^{c},w}}}Q({\scriptstyle\textbf{X}_{\mathcal{S}_{1^{c},w}}}) \frac{{\scriptstyle p_{w}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1^{c},w}}})^s} {{\scriptstyle p_{1}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1,w^{c}}}})^s}\right)^{\rho}\nonumber. \end{eqnarray} \fi There are $\binom{K}{K-i}$ sets $\mathcal{S}_{1,w}$, and the summation does not depend on which set is it, hence, we get \ifdouble \begin{multline*} P(E'_i) \leq {\scriptstyle\binom{N-K}{i}^\rho M^{i\rho}\binom{K}{i}}\sum_{Y^T}\sum_{\textbf{X}_{\mathcal{S}_{1}}}p_1({\scriptstyle\textbf{X}_{\mathcal{S}^1},Y^T}) \\ \left(\sum_{\textbf{X}_{\mathcal{S}_{1^{c},w}}}Q({\scriptstyle{\scriptstyle\textbf{X}_{\mathcal{S}_{1^{c},w}}}}) \frac{{\scriptstyle p_{w}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1^{c},w}})^s}} {{\scriptstyle p_{1}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1,w^{c}}})^s}}\right)^{\rho} \end{multline*} \else \begin{equation*} P(E'_i) \leq {\scriptstyle\binom{N-K}{i}^\rho M^{i\rho}\binom{K}{i}}\sum_{Y^T}\sum_{\textbf{X}_{\mathcal{S}_{1}}}p_1({\scriptstyle\textbf{X}_{\mathcal{S}^1},Y^T}) \left(\sum_{\textbf{X}_{\mathcal{S}_{1^{c},w}}}Q({\scriptstyle{\scriptstyle\textbf{X}_{\mathcal{S}_{1^{c},w}}}}) \frac{{\scriptstyle p_{w}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1^{c},w}})^s}} {{\scriptstyle p_{1}(Y^T,\textbf{X}_{\mathcal{S}_{1,w}}|\textbf{X}_{\mathcal{S}_{1,w^{c}}})^s}}\right)^{\rho} \end{equation*} \fi which continue similar to \cite{atia2012boolean}, results in \ifdouble \begin{multline*} P(E'_i) \leq {\scriptstyle\binom{N-K}{i}^\rho M^{i\rho}\binom{K}{i}}\Bigg[\sum_{Y}\sum_{X_{\mathcal{S}_{1,w}}} \\ \Big(\sum_{X_{\mathcal{S}_{1,w^{c}}}}Q({\scriptstyle X_{\mathcal{S}_{1^{c},w}}}) p_1^{1/(1+\rho)}({\scriptstyle X_{\mathcal{S}_{1,w}},Y|X_{\mathcal{S}_{1,w^{c}}}})\Big)^{1+\rho}\Bigg]^T. \end{multline*} \else \begin{equation*} P(E'_i) \leq {\scriptstyle\binom{N-K}{i}^\rho M^{i\rho}\binom{K}{i}}\Bigg[\sum_{Y}\sum_{X_{\mathcal{S}_{1,w}}} \Big(\sum_{X_{\mathcal{S}_{1,w^{c}}}}Q({\scriptstyle X_{\mathcal{S}_{1^{c},w}}}) p_1^{1/(1+\rho)}({\scriptstyle X_{\mathcal{S}_{1,w}},Y|X_{\mathcal{S}_{1,w^{c}}}})\Big)^{1+\rho}\Bigg]^T. \end{equation*} \fi Thus, we have \begin{equation*} P(E'_i) \leq 2^{-T\left(E_0(\rho) -\rho\left(\frac{\log{N-K \choose i}}{T}+\frac{i\log M}{T} \right) -\frac{\log{K \choose i}}{T}\right)}. \end{equation*} \end{proof} \section{Problem Formulation}\label{formulation} In \emph{SGT}, a legitimate user desires to identify a small unknown subset $\mathcal{K}$ of defective items from a larger set $\mathcal{N}$, while \revised{minimizing} the number of measurements $T$ and keeping the eavesdropper, which is able to observe a subset of the tests results, ignorant regarding the status of the $\mathcal{N}$ items. \revised{Let} $N=|\mathcal{N}|$, $K=|\mathcal{K}|$ denote the total number of items, and the number of defective items, respectively. \revised{As formally defined below, the legitimate user should (with high probability) be able to correctly estimate the set $\mathcal{K}$; on the other hand, from the eavesdropper’s perspective, this set should be ``almost" uniformly distributed over all possible ${N}\choose{K}$ sets. We assume that the number $K$ of defective items in $\mathcal{K}$ is known {\it a priori} to all parties - this is a common assumption in the GT literature \cite{macula1999probabilistic}.}\footnote{\revised{If this is not the case, \cite{damaschke2010competitive,damaschke2010bounds} give methods/bounds on how to ``probably approximately" correctly learn the value of $K$ in a single stage with $O(\log N)$ tests.}} \off{The status of the items, defective or not, should be kept secure from the eavesdropper, but detectable to the legitimate user. We assume that the number $K$ of defective items in $\mathcal{K}$ is known a priori. This is a common assumption in the GT literature \cite{macula1999probabilistic}.} Throughout the paper, we use boldface to denote matrices, capital letters to denote random variables, lower case letters to denote their realizations, and calligraphic letters to denote the alphabet. Logarithms are in base $2$ and $h_b(\cdot)$ denotes the binary entropy function. \Cref{figure:secure-group-testing} gives a graphical representation of the model. In general, and regardless of security constraints, \revised{non-adaptive} GT is defined by a testing matrix \begin{equation*} \textbf{X}=[X_{1}^{T};X_{2}^{T};\ldots; X_{N}^{T}] \in \{0,1\}^{N\times T}, \end{equation*} where each row corresponds to a separate item $j\in\{1,\ldots,N\}$, and each column corresponds to a separate pool test $t\in\{1,\ldots,T\}$. For the $j$-th item, \begin{equation*} X_{j}^{T}=\{X_{j}(1),\ldots, X_{j}(T)\} \end{equation*} is a binary row vector, with the $t$-th entry $X_{j}(t)=1$ if and only if item $j$ participates in the $t$-th test. \ifdouble \begin{figure*} \centering \includegraphics[trim=0cm 0cm 0cm 0cm,clip,scale=0.8]{secure-group-testing4.png} \caption{Noiseless non-adaptive secure group-testing setup.} \label{figure:secure-group-testing} \end{figure*} \else \begin{figure*} \centering \includegraphics[trim=0cm 0cm 0cm 0cm,clip,scale=0.78]{secure-group-testing4.png} \caption{Noiseless non-adaptive secure group-testing setup.} \label{figure:secure-group-testing} \end{figure*} \fi If $A_j\in \{0,1\}$ \revised{denotes} an indicator function for the $j$-th item, determining whether it belongs to the defective set, i.e., $A_j=1$ if $j \in \mathcal{K}$ and $A_j = 0$ otherwise, \revised{the (binary) outcome of the $t \in \{1,\ldots,T\}$ pool test $Y(t)$ equals} \begin{equation*} \revised{Y(t)=\bigvee_{j=1}^{N}X_{j}(t)A_j=\bigvee_{d\in \mathcal{K}}X_{d}(t)}, \end{equation*} where $\bigvee$ is used to denote the boolean OR operation. \off{\revised{The second equality follows since only defective items influence whether or not test outcome is positive.}} \off{\revised{In our SGT model, as in the Wyer wiretap-$II$ model, the eavesdropper is allowed to observe {\it any} $\delta T$ test outcomes of its choice. The adversary’s observations are denoted by $Z^{T}=\{Z(1),\ldots, Z(T)\}$, of which $(1-\delta)T$ are {\it erasures}. Specifically, $Z(t) = Y(t)$ if the $t$-th test is not erased, and $Z(t) = ?$ if it is erased.}} In SGT, we assume an eavesdropper \revisedSr{who} observes a noisy vector $Z^{T}=\{Z(1),\ldots, Z(T)\}$, generated from the outcome vector $Y^{T}$. In the erasure case considered in the work, the probability of erasure is $1-\delta$, i.i.d.\ for each test. That is, on average, $T\delta$ outcomes are not erased and are accessible to the eavesdropper via $Z^{T}$. Therefore, in the erasure case, if $B_t\in \{1,?\}$ is an erasure indicator function for the $t$-th pool test, i.e., $B_t=1$ with probability $\delta$, and $B_t=?$ with probability $1-\delta$, the eavesdropper observes \begin{equation*} Z(t)=Y(t)B_t= \revised{\left(\bigvee_{j=1}^{N}X_{j}(t)A_j\right)B_t},\text{ }\text{ } t=1,\ldots,T. \end{equation*} Denote by \revisedSr{$W \in \mathcal{W} \triangleq \{1,\ldots, {N \choose K}\}$} the index of the \emph{subset of defective items}. We assume $W$ is uniformly distributed, that is, there is no \emph{a priori} bias \revised{towards} any specific subset.\footnote{\revised{This is a common probabilistic model for the set of defectives in group-testing. Another model, called {\it Probabilistic Group Testing}, assumes that items are defective with probability $K/N$. Yet another model assumes that any set of size at most K (rather than exactly $K$) instantiates with equal probability. In many group-testing scenarios results for one probabilistic model for the set of defectives can be translated over to other scenarios, so we focus on the model presented above, where {\it exactly} $K$ items are defective.}} Further, denote by $\hat{W}(Y^T)$ the index recovered by the legitimate decoder, after observing $Y^T$. In this work, we assume that the mixer may use a \emph{randomized} testing matrix. In this case, the random bits used are know only to the mixer, and are not assumed to be shared with the decoder. In other words, the ``codebook" which consists of all possible testing matrices is known to all parties, Alice, Bob and Eve. \revisedSr{However, if the mixer choose a specific} $\textbf{X}$, the random value is not shared with Bob or Eve. We refer to the codebook consisting of all possible matrices, together with the decoder at Bob's side as SGT algorithm. \off{We refer to the testing matrix, together with the decoder as a \emph{SGT algorithm}. \revised{Note that all parties (Alice, Bob, and Eve) know the testing matrix {\it a priori}.}} As we are interested in the asymptotic behavior, \revised{i.e., in ``capacity style" results, with a focus on the number of tests $T$ (as a function of $N$ and $K$) required to guarantee high probability of recovery as the number of items $N$ grows without bound. For simplicity, in the first part of this work, we focus primarily on the regime where $K$ is a constant independent of $N$.} In \Cref{efficient_algorithms}, we give an algorithm which applies to any $K$.\footnote{\revised{Following the lead of~\cite{aldridge2017capacity}, in principle, many of our results in this section as well can be extended to the regime where $K = o(N^{1/3})$, but for ease of presentation we do not do so here).}} The following definition lays out the goals of SGT algorithms. \begin{definition} A sequence of SGT algorithms with parameters $N,K$ and $T$ is asymptotically \revised{(in N)} \emph{reliable} and \emph{weakly} or \emph{strongly} secure if, \hspace{-0.3cm}(1) \emph{Reliable}: \revised{The probability (over the index $W$) of incorrect reconstruction of $W$ at the legitimate receiver converges to zero. That is,} \begin{equation*} \lim_{N \to \infty} P(\hat{W}(Y^T) \ne W) = 0. \end{equation*} (2) \emph{Weakly secure}: \revised{One potential security goal is so-called {\it weak information-theoretic security} against eavesdropping. Specifically, if the eavesdropper observes $Z^T$, a scheme is said to be weakly secure if} \begin{equation*} \lim_{T \to \infty} \frac{1}{T}I(W;Z^T) = 0. \end{equation*} (3) \emph{Strongly secure}: \revised{A stronger notion of security is so-called {\it strong information-theoretic security} against eavesdropping. Specifically, if the eavesdropper observes $Z^T$, a scheme is said to be strongly secure if} \begin{equation*} \lim_{T \to \infty}I(W;Z^T) = 0. \end{equation*} \end{definition} \revised{ \begin{remark} Note that strong security implies that in the limit the distribution over $Z^T$ is essentially statistically independent of the distribution over $W$. Specifically, the {\it KL divergence} between $p_{Z^T,W}$ and $p_{Z^T}p_{W}$ converges to $0$. \end{remark} \begin{remark} While weak security is a much weaker notation of security against eavesdropping than strong security, and indeed is implied by strong security, nonetheless we consider it in this work for the following reason. Our impossibility result will show that even guaranteeing weak security requires at least a certain number of tests, and our achievability results will show that essentially the same number of tests suffices to guarantee strong security. Hence both our impossibility and achievability results are with regard to the corresponding ``harder to prove" notion of security. \end{remark} To conclude, the goal in this work is to design (for parameters $N$ and $K$) an $N \times T$ measurement matrix (which is possibly randomized) and a decoding algorithm $Wˆ(Y^T)$, such that on observing $Y^T$, the legitimate decoder can (with high probability over $W$) identify the subset of defective items, and yet, on observing $Z^T$, the eavesdropper learns essentially nothing about the set of defective items. } \off{ To conclude, The goal is to design (for parameters $N$ and $K$) an $N\times T$ measurement matrix and a decoding algorithm $\hat{W}(Y^T)$, such that observing $Y^{T}$, the legitimate user will identify the subset of defective items (with high probability), yet, observing $Z^{T}$, the eavesdropper cannot (asymptotically) identify the status of the items, defective or not. } \section{Conclusions}\label{conc} In this paper, we proposed a novel non-adaptive SGT algorithm, which with parameters $N,K$ and $T$ is asymptotically \emph{reliable} and \emph{secure}. Specifically, when the fraction of tests observed by Eve is $0 \leq \delta <1$, we prove that the number of tests required for both correct reconstruction at the legitimate user (with high probability) and negligible mutual information at Eve's side is $\frac{1}{1-\delta}$ times the number of tests required with no secrecy constraint. We further provide sufficiency and necessity bounds on the number of tests required in the SGT model to obtains both, \emph{reliability} and \emph{secrecy} constraints. Moreover, we analyze in the proposed secure model, computationally efficient algorithms at the legitimate decoder, previously considered for the non-secure GT in the literature which identify the definitely non-defective items. \section{Efficient Algorithms}\label{efficient_algorithms} The achievability result given in \Cref{direct theorem1} uses a random codebook and ML decoding at the legitimate party. The complexity burden in ML, however, prohibits the use of this result for large $N$. In this section, we derive and analyze an efficient decoding algorithm, which maintains the reliability result using a much simpler decoding rule, at the price of only slightly more tests. The secrecy constraint, as will be clear, is maintained by construction, as the codebook and mixing process do not change compared to the achievability result given before. Moreover, the result in this section will hold for any $K$, including even the case were $K$ grows linearly with $N$. Specifically, we assume the same codebook generation and the testing procedure given in \Cref{LowerBound}, and analyze the \emph{Definite Non-Defective} (DND) algorithm, previously considered for the non-secure GT in the literature \cite{chan2014non,aldridge2014group}. The decoding algorithm at the legitimate user is as follows. Bob attempts to match the rows of \textbf{X} with the outcome vector $Y^T$. If a particular row $j$ of \textbf{X} has the property that all locations $t$ where it has $1$, also corresponds to a $1$ in $Y(t)$, then that row \emph{can correspond to a defective item}. If, however, the row has $1$ at a location $t$ where the output has $0$, then it is not possible that the row corresponds to a defective item. The problem, however, when considering the code construction in this paper for SGT, is that the decoder does not know which row from each bin was selected for any given item. Thus, it takes a conservative approach, and declares an item as defective if at least one of the rows in its bin signals it may be so. An item is not defective only if \emph{all the rows in its bin prevent it from being so}. It is clear that this decoding procedure has no false negatives, as a defective item will always be detected. It may have, though, false positives. A false positive may occur if all locations with ones in a row corresponding to a non-defective item are hidden by the ones of other rows corresponding to defective items and selected by the mixer. To calculate the error probability, fix a row of $\textbf{X}$ corresponding to a non-defective item (a row in its bin). Let $j_1;\ldots;j_k$ index the rows of $\textbf{X}$ corresponding to the $K$ defective items, and selected by the mixer for these items (that is, the rows which were actually added by the Boolean channel). An error event associated with the fixed row occurs if at any test where that row has a $1$, at least one of the entries $X_{j_1}(t), \ldots, X_{j_k}(t)$ also has a $1$. The probability for this to happen, per column, is $p(1-(1-p)^K)$. Hence, the probability that a test result in a fixed row is hidden from the decoder, in the sense that it cannot be declared as non defective due to a specific column, is \[ p(1-(1-p)^K)+(1-p) = 1-p(1-p)^K. \] Since this should happen for all $T$ columns, the error probability for a fixed row is $\left(1-p(1-p)^K\right)^T$. Now, to compute the error probability for the entire procedure we take a union bound over all $M(N-K)$ rows corresponding to non-defective items. As a result, we have \ifdouble \begin{eqnarray}\label{eq:PeComp} P_e &\leq& M(N-K)\left(1-p(1-p)^{K}\right)^T \nonumber\\ & \stackrel{(a)}{\leq}& MN\left(1-\frac{y}{K}\left(1-\frac{y}{K}\right)^{K}\right)^{\beta K\log N} \nonumber\\ &=& MN\left(1-\frac{y}{K}\left(1-\frac{y}{K}\right)^{K-1}\left(1-\frac{y}{K}\right)\right)^{\beta K\log N} \nonumber\\ & \stackrel{(b)}{\leq}& MN\left(\left(1-\frac{y\left(1-\frac{y}{K}\right)}{Ke^{y}}\right)^{K}\right)^{\beta\log N} \nonumber\\ & \stackrel{(c)}{\leq}& MNe^{-y\left(1-\frac{y}{K}\right)e^{-y}\beta\log N}\nonumber\\ &\leq& MN^{1-y\left(1-\frac{y}{K}\right)e^{-y}\beta\frac{1}{\ln 2}} \nonumber\\ & \stackrel{(d)}{=}& MN^{1-\frac{1}{2}\beta (1-\frac{\ln2}{K})} \nonumber\\ &\stackrel{(e)}{=}& 2^{\beta (\delta-\epsilon) \log N}N^{1-\frac{1}{2}\beta (1-\frac{\ln2}{K})} \nonumber\\ &=& N^{\beta (\delta-\epsilon)}N^{1-\frac{1}{2}\beta (1-\frac{\ln2}{K})} \nonumber\\ &\leq& N^{1-\beta\left(\frac{1}{2}(1-\frac{\ln 2}{K})-\delta \right)}. \end{eqnarray} \else \begin{eqnarray}\label{eq:PeComp} P_e &\leq& M(N-K)\left(1-p(1-p)^{K}\right)^T \nonumber\\ & \stackrel{(a)}{\leq}& MN\left(1-\frac{y}{K}\left(1-\frac{y}{K}\right)^{K}\right)^{\beta K\log N} \nonumber\\ &=& MN\left(1-\frac{y}{K}\left(1-\frac{y}{K}\right)^{K-1}\left(1-\frac{y}{K}\right)\right)^{\beta K\log N} \nonumber\\ & \stackrel{(b)}{\leq}& MN\left(\left(1-\frac{y\left(1-\frac{y}{K}\right)}{Ke^{y}}\right)^{K}\right)^{\beta\log N} \nonumber\\ & \stackrel{(c)}{\leq}& MNe^{-y\left(1-\frac{y}{K}\right)e^{-y}\beta\log N}\nonumber\\ &\leq& MN^{1-y\left(1-\frac{y}{K}\right)e^{-y}\beta\frac{1}{\ln 2}} \nonumber\\ & \stackrel{(d)}{=}& MN^{1-\frac{1}{2}\beta (1-\frac{\ln2}{K})} \nonumber \end{eqnarray} \begin{eqnarray} &\hspace{-3.4cm} \stackrel{(e)}{=}& 2^{\beta (\delta-\epsilon) \log N}N^{1-\frac{1}{2}\beta (1-\frac{\ln2}{K})} \nonumber\\ &\hspace{-3.4cm}=&N^{\beta (\delta-\epsilon)}N^{1-\frac{1}{2}\beta (1-\frac{\ln2}{K})} \nonumber\\ &\hspace{-3.4cm}\leq&N^{1-\beta\left(\frac{1}{2}(1-\frac{\ln 2}{K})-\delta \right)}. \end{eqnarray} \fi In the above, (a) follows by taking $p=y/K$ and setting $T$ as $\beta K\log N$, for some positive $y$ and $\beta$, to be defined. (b) follows since $e^{-y} \leq (1-y/n)^{n-1}$ for small $y>0$ and any integer $n >0$. In the sequence below, we will use it with $y=\ln 2$, for which it is true. (c) follows since $e^{-x} \ge (1-x/n)^{n}$ for $x>0$ and any integer $n >0$. (d) follows by choosing $y=\ln 2$. (e) is by setting $M=2^{T\frac{\delta-\epsilon}{K}}$ and substituting the value for $T$. The result in \eqref{eq:PeComp} can be interpreted as follows. As long as $\delta$, the leakage probability at the eavesdropper, is smaller than $\frac{1}{2}(1-\frac{\ln 2}{K})$, choosing $T=\beta K \log N$ with a large enough $\beta$ results in an exponentially small error probability. For example, for large enough $K$ and $\delta=0.25$, one needs $\beta > 4$, that is, about $4K\log N$ tests to have an exponentially small (with $N$) error probability while using an efficient decoding algorithm. To see the dependence of the error probability on the number of tests, denote \[ \epsilon = \beta\left(\frac{1}{2}\left(1-\frac{\ln 2}{K}\right)-\delta\right) - 1. \] Then, if the number of tests satisfies \[ T \ge \frac{1+\epsilon}{\frac{1}{2}(1-\frac{\ln 2}{K})-\delta} K \log N \] one has \[ P_e \leq N^{-\epsilon}. \] Thus, while the results under ML decoding (\Cref{direct theorem1}) show that any value of $\delta <1$ is possible (with a $\frac{1}{1-\delta}$ toll on $T$ compared to non-secure GT), the analysis herein suggests that using the efficient algorithm, one can have a small error probability only for $\delta < 1/2$, and the toll on $T$ is greater than $\frac{1}{\frac{1}{2}-\delta}$. This is consistent with the fact that this algorithm is known to achieve only half of the capacity for non-secure GT \cite{aldridge2014group}. However, both these results may be due to coarse analysis, and not necessarily due to an inherent deficiency in the algorithm. \begin{remark}[Complexity] It is easy to see that the algorithm runs over all rows in the codebook, and compares each one to the vector of tests' results. The length of each row is $T$. There are $N$ items, each having about $2^{\frac{\delta}{K}T}$ rows in its bin. Since $T=O(K \log N)$, we have $O(N^2)$ rows in total. Thus, the number of operations is $O(N^2T)=O(KN^2 \log N)$. This should be compared to $O(KN\log N)$ without any secrecy constraint. \end{remark} \Cref{fig:DND_simulation} includes simulation results of the secure DND GT algorithm proposed, compared with ML decoding and the upper and lower bounds on the performance of ML. \ifdouble \begin{figure} \centering \includegraphics[trim= 1.6cm 0.0cm 0cm 0.5cm,clip,scale=0.228]{Success_Prob_of_all_the_DND_ML_items_N_500_K_3_Delta_01_NumIterations_8000_date_2017_3_11_6_54_v3-eps-converted-to.pdf} \caption{\emph{Definite Non-Defective} and ML simulation results.} \label{fig:DND_simulation} \end{figure} \else \begin{figure} \centering \includegraphics[trim= 0cm 0.0cm 0cm 0.5cm,clip,scale=0.4]{Success_Prob_of_all_the_DND_ML_items_N_500_K_3_Delta_01_NumIterations_8000_date_2017_3_11_6_54_v3.eps} \caption{\emph{Definite Non-Defective} and ML simulation results.} \label{fig:DND_simulation} \end{figure} \fi \section{Introduction}\label{intro} The classical version of Group Testing (GT) was suggested during World War II in order to identify syphilis\revised{-}infected draftees while dramatically reducing the number of required tests \cite{dorfman1943detection}. Specifically, when the number of infected draftees, $K$, is much smaller than the population size, $N$, instead of examining each blood sample individually, one can conduct a small number of of \emph{pooled samples}. Each pool outcome is negative if it contains no infected sample, and positive if it contains at least one infected sample. The problem is thus to identify the infected draftees via as few pooled tests as possible. \Cref{basic_testing} (a)-(c) depicts a small example. Since its exploitation in WWII, GT \revised{has been} utilized in numerous fields, including biology and chemistry \cite{du1999combinatorial,macula1999probabilistic}, communications \cite{varanasi1995group,cheraghchi2012graph,wu2015partition,wu2014achievable}, sensor networks \cite{bajwa2007joint}, pattern matching \cite{clifford2007k} and web services \cite{tsai2004testing}. GT \revised{has} also found applications in the emerging field of Cyber Security, e.g., detection of significant changes in network traffic \cite{cormode2005s}, Denial of Service attacks \cite{xuan2010detecting} and indexing information for data forensics \cite{goodrich2005indexing}. Many \revised{scenarios} which utilize GT \revised{involve} sensitive information which should not be revealed if some of the tests leak \revised{(for instance, if one of the several labs to which tests have been distributed for parallel processing is compromised). However, in GT, leakage of even a single pool-test outcome may reveal significant information about the tested items. If the test outcome is negative it indicates that none of the items in the pool is defective;} if it is positive, at least one of the items in the pool is defective (see \Cref{basic_testing} (d) for a short example). Accordingly, \revised{it is critical to} \revisedSr{ensure} that a leakage of a fraction of the pool-tests \revised{outcomes} to undesirable or malicious eavesdroppers does not give them any useful information on the status of the items. It is very important to note that \emph{protecting GT is different from protecting the communication between the parties}. \revisedSr{To protect GT, one should make sure that information about the status of individual items is not revealed if a fraction of the test outcomes leaks.} \off{To protect the communication, one should merely protect the bits transmitted, and can do so by encoding them before the transmission.} However, in GT, we do not want to assume one entity has access to all pool-tests, and can apply some encoding function before they are exposed. We also do not want to assume a mixer can add a certain substance that will prevent a third party from testing the sample. To protect GT, one should make sure that without altering mixed samples, if a fraction of them leaks, either already tested or not, information is not revealed. While the current literature includes several works on the privacy in GT algorithms for digital objects \cite{atallah2008private,goodrich2005indexing,freedman2004efficient,rachlin2008secrecy}, these works are based on cryptographic schemes, assume the testing matrix is not known to all parties, \revisedSr{impose} a high computational burden, and, last but not least, assume the computational power of the eavesdropper is limited \cite{tagkey2004391,C13}. \emph{Information theoretic security} \revised{considered for secure communication} \cite{C2,C13}, on the other hand, if applied appropriately to GT, can offer privacy at the price of \emph{additional tests}, without keys, obfuscation or assumptions on limited power. \revised{Due to the analogy between channel coding and group-testing regardless of security constraints, \cite{atia2012boolean,baldassini2013capacity}, in \Cref{BooleanCompressed} we present an extensive survey of the literature on secure communication as well.} \subsection*{Main Contribution} In this work, we formally define Secure Group Testing (SGT), suggest SGT algorithms based on information\revised{-}theoretic principles and analyse their performance. In the considered model, there is an eavesdropper \revised{Eve who might} observe part of the \revised{vector of pool-tests outcomes}. The goal of the test designer is to design the tests \revised{in a manner} such that a legitimate decoder can decode the status of the items (\revised{whether the items are} defective or not) with an arbitrarily small error probability. \revised{It should {\it also} be the case that as} long as \revised{Eve} the eavesdropper gains only part of the output vector (a fraction $\delta$ \revised{- a bound on the value of $\delta$ is known {\it a priori} to the test designer, but which specific items are observed is not), Eve} cannot (asymptotically, \revised{as the number of items being tested grows without bound}) gain any significant information on the status of \revised{any of} the items. We propose a SGT code and \revised{corresponding decoding} algorithms which \revised{ensure high of reliability (with high probability over the test design, the legitimate decoder should be able to estimate the status of each item correctly)}, as well as \revised{\emph{strong secrecy}} conditions \revised{(as formally defined in \Cref{formulation}) - which ensures that essentially no information about the status of individual items’ leaks to Eve.} \revised{Our first SGT code and corresponding decoding algorithm (based on Maximum Likelihood (ML) decoding) requires a number of tests that is essentially information-theoretically optimal in N, K and $\delta$ (as demonstrated in \Cref{converse} by corresponding information-theoretic converse that we also show for the problem).} \revised{The second code and corresponding decoding algorithm, while requiring a constant factor larger number of tests than is information-theoretically necessary (by a factor that is a function of $\delta$), is computationally efficient. It maintains the reliability and secrecy guarantees, yet requires only O($N^2T$) decoding time, where $T$ is the number of tests.} \ifdouble \begin{figure} \centering \begin{subfigure}[b]{0.24\textwidth} \includegraphics[scale=0.7]{LabPoolTesting2.png} \caption{} \end{subfigure} \begin{subfigure}[b]{0.24\textwidth} \includegraphics[scale=0.7]{LabPoolTesting3.png} \caption{} \end{subfigure} \begin{subfigure}[b]{0.24\textwidth} \includegraphics[scale=0.7]{LabPoolTesting4.png} \caption{} \end{subfigure} \begin{subfigure}[b]{0.24\textwidth} \includegraphics[scale=0.7]{SLabPoolTesting21.png} \caption{} \end{subfigure} \else \begin{figure} \begin{flushleft} \begin{subfigure}[b]{0.232\textwidth} \includegraphics[scale=0.7]{LabPoolTesting2.pdf} \caption{} \end{subfigure} \begin{subfigure}[b]{0.232\textwidth} \includegraphics[scale=0.7]{LabPoolTesting3.pdf} \caption{} \end{subfigure} \begin{subfigure}[b]{0.232\textwidth} \includegraphics[scale=0.7]{LabPoolTesting4.pdf} \caption{} \end{subfigure} \begin{subfigure}[b]{0.232\textwidth} \includegraphics[scale=0.7]{SLabPoolTesting21.pdf} \caption{} \end{subfigure} \end{flushleft} \fi \caption[]{Classical group testing: \textit{An example of test results, a simple decoding procedure at the legitimate decoder and the risk of leakage. The example includes 7 items, out of which at most one defective (the second one in this case; unknown to the decoder). Three pooled tests are conducted. Each row dictates in which pooled tests the corresponding item participates. (a) Since the first result is negative, items 1 and 6 are not defective. (b) The second result is positive, hence at least one of items 2 and 4 is defective. (c) Based on the last result, as item 4 cannot be defective, it is clear that 2 is defective. Note that decoding in this case is simple: any algorithm which will simply rule out each item whose row in the matrix is not compatible with the result will rule out all but the second item, due to the first and last test results being negative, thus identifying the defective item easily. (d) An eavesdropper who has access to part of the results (the first two) can still infer useful information. Our goal is construct a testing matrix such that such an eavesdropper remains ignorant.}} \label{basic_testing} \end{figure} \off{ We further provide sufficiency and necessity bounds on the number of tests required, and show that the code construction, together with Maximum Likelihood (ML) decoding is order-optimal (in $N$, $K$ and $\delta$). The second algorithm, while missing the exact behaviour with respect to $\delta$, is highly efficient, maintains the reliability and secrecy guarantees, yet requires only $O(N^2T)$ operations, where $T$ is the number of tests.} We do so by proposing a model, which is, in a sense, analogous to a \revised{{\it wiretap channel model}}, as depicted in \Cref{figure:group_testing_model}. \revised{In this analogy the subset of defective items (unknown {\it a priori} to all parties) takes the place of a confidential message. The testing matrix (representing the design of the pools - each row corresponds to the tests participated in by an item, and each column corresponds to a potential test) is a succinct representation of the \revisedSr{encoder's} codebook. Rows or disjunctive unions of rows of this testing matrix can be considered as codewords.} The decoding algorithm is analogous to a channel decoding process, and the eavesdropped signal is the output of \textit{an erasure channel}, namely, having only any part of the transmitted signal from the legitimate source to the legitimate receiver. \revised{In classical non-adaptive group-testing, each row of the testing matrix comprises of a length-$T$ binary vector which determines which pool-tests the item is tested in. In the SGT code constructions proposed in this work, each item instead corresponds to a vector chosen uniformly at random from a pre-specified set of random and independent vectors.} Namely, we use \emph{stochastic encoding}, and each vector \revised{corresponds to different sets of} pool-tests \revised{an item may participate in}. For each item the lab picks one of the vectors in its set \revised{(we term the set associated with item $j$ as \revisedSr{``Bin j"})} \revised{uniformly} at random, and the item participates in the pool-tests according to this randomly chosen vector. \revised{The set \revised{(\revisedSr{``}Bin")} is known {\it a priori} to all parties, but the specific vector chosen by the encoder/mixer is only known to the encoder/mixer, and hence is {\it not a shared key/common randomness} in any sense.} A schematic description of our procedure is depicted in \Cref{fig:WiretapCoding}. \off{It is important to note, though, that the randomness is required only at the lab (the ``mixer"), and it is \emph{not a shared key} in any sense.} \ifdouble \begin{figure} \centering \includegraphics[trim=9cm 9.2cm 1cm 9.05cm,clip,scale=0.85]{SecureGroupTestModelE.pdf} \caption{\revised{An analogy between a wiretap erasure channel and the corresponding SGT model.}} \label{figure:group_testing_model} \end{figure} \else \begin{figure} \centering \includegraphics[trim=6cm 9.2cm 0cm 9.05cm,clip,scale=1]{SecureGroupTestModelE.pdf} \caption{\revised{An analogy between a wiretap erasure channel and the corresponding SGT model.}} \label{figure:group_testing_model} \end{figure} \fi Accordingly, by obtaining a pool-test result, without knowing the specific vectors chosen by the lab for each item, the eavesdropper may gain only negligible information regarding the items themselves. Specifically, we show that \revised{by careful design of the testing procedure,} even though the pool-tests in which each item participated \revised{are} chosen randomly and even though the legitimate user does not know \emph{a-priori} in which pool-tests each item has participated, the legitimate user \revised{will, with high probability over the testing procedure, be able to correctly identify the set of defective items,} while the eavesdropper, observing only a subset of the pool-test results, will have no significant information regarding the status of the items. The structure of this work is as follows. In \Cref{BooleanCompressed}, we present an extensive survey and summarize the related work. In \Cref{formulation}, a SGT model is formally described. \Cref{main results} includes our main results, with the direct proved in \Cref{LowerBound} and converse proved in \Cref{converse}. \Cref{efficient_algorithms} describes \revised{a computationally} efficient algorithm, and proves an upper bound on its error probability. \Cref{conc} concludes the paper. \section{Code Construction and a Proof for \Cref{direct theorem1}} \label{LowerBound} In order to keep the eavesdropper, which obtains only a fraction $\delta$ of the outcomes, ignorant regarding the status of the items, we \emph{randomly} map the items to the tests. Specifically, as depicted in \Cref{fig:WiretapCoding}, for each item we generate a bin, containing several rows. The number of such rows \emph{corresponds} to the number of tests that the eavesdropper can obtain, yet, unlike wiretap channels, \emph{it is not identical} to Eve's capacity, and should be normalized by the number of defective items. Then, for the $j$-th item, we randomly select a row from the $j$-th bin. This row will determine in which tests the item will participate. In order to rigorously describe the construction of the matrices and bins, determine the exact values of the parameters (e.g., bin size), and analyze the reliability and secrecy, we first briefly review the representation of the GT problem as a channel coding problem \cite{atia2012boolean}, together with the components required for SGT. A SGT code consists of an index set \revisedSr{$\mathcal{W} =\{1,2,\ldots \binom{N}{K}\}$}, its $w$-th item corresponding to the $w$-th subset $\mathcal{K}\subset \{1,\ldots,N\}$; A discrete memoryless source of randomness $(\mathcal{R},p_R)$, with known alphabet $\mathcal{R}$ and known statistics $p_R$; An encoder, \begin{equation*} f : \revisedSr{\mathcal{W}} \times \mathcal{R} \rightarrow \mathcal{X}_{S_w}\in\{0,1\}^{K\times T} \end{equation*} which maps the index $W$ of the defective items to a matrix $\textbf{X}^{T}_{S_{w}}$ of codewords, each of its rows corresponding to a different item in the index set $S_w$\revisedSr{, $w\in \mathcal{W}$, $|S_w|=K$}. The need for a \emph{stochastic encoder} is similar to most encoders ensuring information theoretic security, as randomness is required to confuse the eavesdropper about the actual information \cite{C13}. Hence, we define by $R_K$ the random variable encompassing the randomness required \emph{for the $K$ defective items}, and by $M$ the number of rows in each bin. Clearly, $M^K=H(R_K)$. At this point, \revisedSr{an} important clarification is in order. The lab, of course, does not know which items are defective. Thus, operationally, it needs to select a row for each item. However, in \emph{the analysis}, since only the defective items affect the output (that is, only their rows are \revisedSr{ORed together} to give $Y^T$), we refer to the ``message" as the index of the defective set $w$ and refer only to the random variable $R_K$ required to choose the rows in their bins. In other words, unlike the analogous communication problem, in GT, \emph{nature} performs the actual mapping from $W$ to $\textbf{X}^{T}_{S_{w}}$. The mixer only mixes the blood samples according to the (random in this case) testing matrix it has. A decoder at the legitimate user is a map \begin{equation*} \hat{W} : \revisedSr{\mathcal{Y}}^{T} \rightarrow \revisedSr{\mathcal{W}}. \end{equation*} The probability of error is $P(\hat{W}(Y^{T})\neq W)$. The probability that an outcome test leaks to the eavesdropper is $\delta$. We assume a memoryless model, i.e., each outcome $Y(t)$ depends only on the corresponding input $X_{S_w}(t)$, and the eavesdropper observes $Z(t)$, generated from $Y(t)$ according to \begin{equation*} p(Y^T,Z^T|X_{S_w})=\prod_{t=1}^{T}p(Y(t)|X_{S_w}(t))p(Z(t)|Y(t)). \end{equation*} We may now turn to the detailed construction and analysis. \ifdouble \begin{figure} \centering \includegraphics[trim= 9.3cm 8cm 2cm 7.6cm,clip,scale=0.9]{Wiretap_coding5_one_col.pdf} \caption{Binning and encoding process for a SGT code.} \label{fig:WiretapCoding} \end{figure} \else \begin{figure} \centering \includegraphics[trim= 6.3cm 8cm 2cm 7.6cm,clip,scale=1]{Wiretap_coding5_one_col.pdf} \caption{Binning and encoding process for a SGT code.} \label{fig:WiretapCoding} \end{figure} \fi \subsubsection{Codebook Generation} \revisedSr{Choose M such that $$\log_2(M) = T(\delta-\epsilon^{\prime})/(K)$$}\off{Set $M = 2^{T\frac{\delta-\revised{\epsilon^{\prime}}}{K}}$.}\revisedSr{for some $\epsilon^{\prime}>0$. $\epsilon^{\prime}$ will affect the equivocation.} Using a distribution $P(X^{T})=\prod^{T}_{i=1}P(x_i)$, for each item generate $M$ independent and identically distributed codewords $x^{T}(m)$, $1 \leq m \leq M$\off{, where $\epsilon$ can be chosen arbitrarily small}. The codebook is depicted in the left hand side of \Cref{fig:WiretapCoding}. Reveal the codebook to Alice and Bob. We assume Eve may have the codebook as well. \subsubsection{Testing} For each item $j$, the mixer/lab selects uniformly at random one codeword $x^{T}(m)$ from the $j$-th bin. Therefore, the SGT matrix contains $N$ randomly selected codewords of length $T$, one for each item, defective or not. Amongst is an unknown subset $X^{T}_{S_{w}}$, with the index $w$ representing the true \revisedSr{defective items}. An entry of the $j$-th random codeword is $1$ if the $j$-item is a member of the designated pool test and $0$ otherwise. \subsubsection{Decoding at the Legitimate Receiver} The decoder looks for a collection of $K$ codewords $X_{S_{\hat{w}}}^{T}$, \textit{one from each bin}, for which $Y^T$ is most likely. Namely, \begin{equation*} P(Y^{T}|X_{S_{\hat{w}}}^{T})>P(Y^{T}|X_{S_{w}}^{T}), \forall w \neq \hat{w}. \end{equation*} Then, the legitimate user (Bob) declares $\hat{W}(Y^T)$ as the set of bins in which the rows $\hat{w}$ reside. \subsection{Reliability} Let $(\mathcal{S}^{1},\mathcal{S}^{2})$ denote a partition of the defective set $S$ into disjoint sets $\mathcal{S}^{1}$ and $\mathcal{S}^{2}$, with cardinalities $i$ and $K-i$, respectively.\footnote{\revisedSr{This partition helps decompose the error events into classes, where in class $i$ one already knows $K-i$ defective items, and the dominant error event corresponds to missing the other $i$. Thus, it is easier to present the error event as one ``codeword" against another. See Appendix~\ref{appendix:APPENDIX A} for the details.}} Let $I(X_{\mathcal{S}^1};X_{\mathcal{S}^2},Y)$ denote the mutual information between $X_{\mathcal{S}^1}$ and $X_{\mathcal{S}^2},Y$, under the i.i.d.\ distribution with which the codebook was generated and remembering that $Y$ is the output of a Boolean channel. The following lemma is a key step in proving the reliability of the decoding algorithm. \begin{lemma}\label{direct lemma1} If the number of tests satisfies \begin{eqnarray*} T \geq (1+\varepsilon)\cdot\max_{i=1,\ldots ,K} \frac{\log\binom{N-K}{i}M^i}{I(X_{\mathcal{S}^1};X_{\mathcal{S}^2},Y)}, \end{eqnarray*} then, under the codebook above, as $N\rightarrow \infty$ the average error probability approaches zero. \end{lemma} Next, we \revisedn{prove} \Cref{direct lemma1}, which extends the results in \cite{atia2012boolean} to the codebook required for SGT. Specifically, to obtain a bound on the required number of tests as given in \Cref{direct lemma1}, we first state Lemma 2, which bounds the error probability of the ML decoder using a Gallager-type bound \cite{gallager1968information}. \revisedn{ \begin{definition} The probability of error event $E_{i}$ in the ML decoder defined, as the event of mistaking the true set for a set which differs from it in exactly $i$ items. \end{definition} \begin{lemma}\label{error lemma2} The error probability $P(E_{i})$ is bounded by \begin{equation*} P(E_{i}) \leq 2^{-T\left(E_{o}(\rho)-\rho\frac{\log\binom{N-K}{i}M^i}{T}-\frac{\log\binom{K}{i}}{T}\revisedr{-\frac{K}{T}}\right)}, \end{equation*} where the error exponent $E_{o}(\rho)$ is given by \ifdouble \begin{multline} E_{o}(\rho)= -\log \sum_{Y\in \{0,1\}}\sum_{X_{\mathcal{S}^2}\in \{0,1\}}\Bigg[\sum_{X_{\mathcal{S}^1}\in \{0,1\}}P(X_{\mathcal{S}^1})\\ p(Y,X_{\mathcal{S}^2}|X_{\mathcal{S}^1})^{\frac{1}{1+\rho}}\Bigg]^{1+\rho},\text{ } 0 \leq\rho \leq1.\nonumber \end{multline} \else \begin{equation*} E_{o}(\rho)= -\log \sum_{Y\in \{0,1\}}\sum_{X_{\mathcal{S}^2}\in \{0,1\}}\Bigg[\sum_{X_{\mathcal{S}^1}\in \{0,1\}}P(X_{\mathcal{S}^1}) p(Y,X_{\mathcal{S}^2}|X_{\mathcal{S}^1})^{\frac{1}{1+\rho}}\Bigg]^{1+\rho},\text{ } 0 \leq\rho \leq1. \end{equation*} \fi \end{lemma} In Appendix \ref{appendix:APPENDIX A} we analyze the bound provided in \Cref{error lemma2}. Note that there are two main differences compared to non-secured GT. First, the decoder has $\binom{N}{K}M^K$ possible subsets of codewords to choose from, $\binom{N}{K}$ for the number of possible bins and $M^K$ for the number of possible rows to take in each bin. Thus, when fixing the error event, there are $\binom{N-K}{i}M^i$ subsets to confuse the decoder. Moreover, due to the bin structure of the code, there are also many ``wrong" codewords which are not the one transmitted on the channel, hence create a decoding error codeword-wise, yet the actual bin decoded may still be the right one.} \begin{proof}[Proof of \Cref{direct lemma1}] \revisedn{ For this lemma, we follow the derivation in \cite{atia2012boolean}. However, due the different code construction, the details are different. Specially, for each item there is a \emph{bin} of codewords, from which the decoder has to choose. Define \begin{equation*} \emph{f}(\rho) = E_{o}(\rho)-\rho\frac{\log\binom{N-K}{i}M^i}{T}-\frac{\log\binom{K}{i}}{T}\revisedr{-\frac{K}{T}}. \end{equation*} We wish to show that $T\emph{f}(\rho)\rightarrow \infty$ as $N \rightarrow \infty$. Note that $\log\binom{K}{i}$ is a constant for the fixed $K$ regime. Thus for large $T$ we have $\lim_{T \rightarrow \infty} \emph{f}(0) = 0$.} Since the function $\emph{f}(\rho)$ is differentiable and has a power series expansion, for a sufficiently small $\alpha$, by Taylor series expansion in the neighborhood of $\rho \in [0,\alpha]$ \revisedn{we have} \begin{equation*} \emph{f}(\rho) = \emph{f}(0) + \rho \frac{d\emph{f}}{d\rho} \mid_{\rho = 0} + \Theta(\rho^2). \end{equation*} \revisedn{Now,} \ifdouble \begin{eqnarray} && \hspace{-0.85cm} \frac{\partial E_{o}}{\partial\rho} |_{\rho = 0}\nonumber\\ &\hspace{-0.7cm} = &\hspace{-0.5cm} \sum_Y \sum_{X_{\mathcal{S}^2}}[\sum_{X_{\mathcal{S}^1}}P(X_{\mathcal{S}^1})p(Y,X_{\mathcal{S}^2}|X_{\mathcal{S}^1})\log p(Y,X_{\mathcal{S}^2}|X_{\mathcal{S}^1})\nonumber\\ &\hspace{-0.7cm} - &\hspace{-0.5cm} \sum_{X_{\mathcal{S}^1}}P(X_{\mathcal{S}^1})p(Y,X_{\mathcal{S}^2}|X_{\mathcal{S}^1}) \sum_{X_{\mathcal{S}^1}}P(X_{\mathcal{S}^1})p(Y,X_{\mathcal{S}^2}|X_{\mathcal{S}^1})]\nonumber\\ &\hspace{-0.7cm} = &\hspace{-0.5cm} \sum_Y \sum_{X_{\mathcal{S}^2}}\sum_{X_{\mathcal{S}^1}}P(X_{\mathcal{S}^1})p(Y,X_{\mathcal{S}^2}|X_{\mathcal{S}^1})\nonumber\\ && \hspace{-0.85cm} \log\frac{p(Y,X_{\mathcal{S}^2}|X_{\mathcal{S}^1})}{\sum_{X_{\mathcal{S}^1}}P(X_{\mathcal{S}^1})p(Y,X_{\mathcal{S}^2}|X_{\mathcal{S}^1}) = I(X_{\mathcal{S}^1};X_{\mathcal{S}^2},Y).\nonumber \end{eqnarray} \else \begin{eqnarray} && \hspace{-0.85cm} \frac{\partial E_{o}}{\partial\rho} |_{\rho = 0}\nonumber\\ &\hspace{-0.7cm} = &\hspace{-0.5cm} \sum_Y \sum_{X_{\mathcal{S}^2}}[\sum_{X_{\mathcal{S}^1}}P(X_{\mathcal{S}^1})p(Y,X_{\mathcal{S}^2}|X_{\mathcal{S}^1})\log p(Y,X_{\mathcal{S}^2}|X_{\mathcal{S}^1})\nonumber\\ &\hspace{-0.7cm} - &\hspace{-0.5cm} \sum_{X_{\mathcal{S}^1}}P(X_{\mathcal{S}^1})p(Y,X_{\mathcal{S}^2}|X_{\mathcal{S}^1}) \sum_{X_{\mathcal{S}^1}}P(X_{\mathcal{S}^1})p(Y,X_{\mathcal{S}^2}|X_{\mathcal{S}^1})]\nonumber\\ &\hspace{-0.7cm} = &\hspace{-0.5cm} \sum_Y \sum_{X_{\mathcal{S}^2}}\sum_{X_{\mathcal{S}^1}}P(X_{\mathcal{S}^1})p(Y,X_{\mathcal{S}^2}|X_{\mathcal{S}^1}) \log\frac{p(Y,X_{\mathcal{S}^2}|X_{\mathcal{S}^1})}{\sum_{X_{\mathcal{S}^1}}P(X_{\mathcal{S}^1})p(Y,X_{\mathcal{S}^2}|X_{\mathcal{S}^1}) = I(X_{\mathcal{S}^1};X_{\mathcal{S}^2},Y).\nonumber \end{eqnarray} \fi \revisedn{ Hence, if \begin{equation*} (1+\varepsilon)\frac{\log\binom{N-K}{i}M^i}{T}<I(X_{\mathcal{S}^1};X_{\mathcal{S}^2},Y) \end{equation*} for some constant $\varepsilon > 0$, the exponent is positive for large enough $T$ and we have $P(E_{i})\rightarrow 0$ as $T\rightarrow \infty$ for $\rho > 0$. Using a union bound one can show that taking the maximum over $i$ will ensure a small error probability in total.} \end{proof} \revisedn{The expression $I(X_{\mathcal{S}^1};X_{\mathcal{S}^2},Y)$ in \Cref{direct lemma1} is critical to understand how many tests are required, yet it is not a function of the problem parameters in any straight forward mannar. We now bound it to get a better handle on $T$.} \begin{claim}\label{InformationClaim} For large $K$, and under a fixed input distribution for the testing matrix $(\frac{\ln(2)}{K},1-\frac{\ln(2)}{K})$, the mutual information between $X_{\mathcal{S}^1}$ and $(X_{\mathcal{S}^2},Y)$ is lower bounded by \begin{equation*} I(X_{\mathcal{S}^1};X_{\mathcal{S}^2},Y)\geq \frac{i}{K}. \end{equation*} \end{claim} \begin{proof}[Proof of \Cref{InformationClaim}]\revisedn{First, note that} \begin{eqnarray*}\label{eq:MutualInfB} I(X_{\mathcal{S}^1};X_{\mathcal{S}^2},Y) &&\hspace{-0.6cm} \stackrel{(a)}{=} I(X_{\mathcal{S}^1};X_{\mathcal{S}^2})+I(X_{\mathcal{S}^1};Y|X_{\mathcal{S}^2})\nonumber\\ &&\hspace{-0.6cm} = H(Y|X_{\mathcal{S}^2})-H(Y|X_{\mathcal{S}})\nonumber\\ &&\hspace{-0.6cm} \stackrel{(b)}{=} q^{K-i}H(q^{i})\nonumber\\ &&\hspace{-0.6cm} = q^{K-i}\left[q^{i}\log\frac{1}{q^{i}} + \left( 1 - q^{i}\right)\log\frac{1}{\left(1- q^{i}\right)}\right], \end{eqnarray*} \revisedn{where equality (a) follows since the rows of the testing matrix are independent, and (b) follows since $H(Y|X_{\mathcal{S}})$ is the uncertainty of the legitimate receiver given $X_{\mathcal{S}}$, thus when observing the noiseless outcomes of all pool tests, this uncertainty is zero. Also, note that the testing matrix is random and i.i.d.\ with distribution $(1-q,q)$, hence the probability for $i$ zeros is $q^i$.} \revisedn{Then, under a fixed input distribution for the testing matrix $(p=\frac{\ln(2)}{K},q=1-\frac{\ln(2)}{K})$ and large $K$ it is easy to verify that the bounds meet at the two endpoint of $i=1$ and $i=K$, yet the mutual information is concave in $i$ thus the bound is obtained. This is demonstrated graphically in \Cref{figure:Mutual_Information_Bound}.} \end{proof} \ifdouble \begin{figure} \centering \includegraphics[trim=2.2cm 14.4cm 1.5cm 7.2cm,clip,scale=0.52]{MATLAB.pdf} \caption{Mutual Information Bound} \label{figure:Mutual_Information_Bound} \end{figure} \else \begin{figure} \centering \includegraphics[trim=2.2cm 14.4cm 1.5cm 7.2cm,clip,scale=0.8]{MATLAB.pdf} \caption{Mutual Information Bound} \label{figure:Mutual_Information_Bound} \end{figure} \fi Applying \Cref{InformationClaim} to the expression in \Cref{direct lemma1}, we have \begin{equation*} \frac{\log\binom{N-K}{i}M^i}{I(X_{\mathcal{S}^1};X_{\mathcal{S}^2},Y)} \leq \frac{\log\binom{N-K}{i}M^i}{\frac{i}{K}}. \end{equation*} Hence, substituting $M=2^{T\frac{\delta-\revised{\epsilon_K}}{K}}$, a sufficient condition for reliability is \begin{eqnarray*} T &\ge& \max_{1 \leq i \leq K}\frac{1+\varepsilon}{\frac{i}{K}}\left[ \log\binom{N-K}{i} + \frac{i}{K}T(\delta-\revised{\epsilon_K}) \right] \end{eqnarray*} Rearranging terms results in \begin{eqnarray}\label{eq:reduce_h} T & \ge & \max_{1 \leq i \leq K} \frac{1}{1-\revised{\delta +\epsilon_K-\varepsilon\delta+\varepsilon\epsilon_K}}\frac{1+\varepsilon}{i/K}\log\binom{N-K}{i},\nonumber \end{eqnarray} \revised{where by reducing $\epsilon_K$ and $\varepsilon\epsilon_K$ we increase the bound on $T$, and with some constant $\varepsilon > 0$.} Noting that this is for large $K$ and $N$, and that $\varepsilon$ is independent of them, achieves the bound on $T$ provided in \Cref{direct theorem1} and reliability is established. \off{ \subsection{Scaling Regime Of $K=o(N)$} \label{K=o(N)} Now, we point out that the result in \Cref{direct lemma1} can be extended to the more general case where both $N$ and $K$ are allowed to scale simultaneously such that $K=o(N)$. From the Lagrange form of the Taylor Series expansion, we can write $E_{o}(\rho)$ in terms of its first derivative evaluated at zero and a remainder term which depends on the second derivative. We have already shown that $E_{o}(0)=0$ and $E_{o}^{\prime}(0)=I(X_{\mathcal{S}^1};Y|X_{\mathcal{S}^2})>0$. Consequently, we need to lower bound $E_{o}(\rho)$ by taking the worst-case second derivative. Establishing this result requires a more careful analysis, and hence, we present it in Appendix \ref{appendix:APPENDIX D}. It is shown that the same sufficient condition on the number of tests in \Cref{direct lemma1} holds up to an extra $polylog(K)$ factor for an arbitrarily small average error probability, thus, \begin{equation*} \lim_{\substack{N \rightarrow \infty\\K=o(N)}}P_e\rightarrow 0. \end{equation*} Namely, \begin{lemma}\label{direct lemma3} If the number of tests satisfies \begin{eqnarray*} T & \geq & \max_{1 \leq i \leq K} \frac{\log\binom{N-K}{i}+(\log\binom{K}{i}K\revisedn{+ K})\log^2(K/i)}{(1/2-\delta)i/K}, \end{eqnarray*} then, under the codebook above, as $N\rightarrow \infty$ and $K=o(N)$ the average error probability approaches zero. \end{lemma} \begin{proof} From the expression of $P(E_i)$ we have that \begin{multline*} \hspace{-0.4cm} \sum_{i}P(E_i) \leq K \max_{i} P(E_i)\leq\max_{i}K \revisedn{\exp K}\\ \exp\left(-T\left(E_{o}(\rho)-\rho\frac{\log\binom{N-K}{i}M^{i}}{T}-\frac{\log\binom{K}{i}}{T}\right)\right). \end{multline*} Consequently, we need to ensure that \begin{equation*} TE_{o}(\rho) \geq \rho\log\binom{N-K}{i}M^{i}+\log\binom{K}{i}+\log K \revisedn{+ K}. \end{equation*} Now using the lower bound for $E_{o}(\rho)$ , we have \begin{eqnarray*} E_{o}(\rho) &\geq& \rho I(X_{\mathcal{S}^1};X_{\mathcal{S}^2},Y)-\frac{\rho^2}{2}|(E_{o}(0))^{\prime\prime}|\\ & \geq & \rho I(X_{\mathcal{S}^1};X_{\mathcal{S}^2},Y)-\frac{\rho^2}{2}\frac{i}{K}\log^2\frac{K}{i}\\ & \geq & \rho \frac{i}{K}-\frac{\rho^2}{2}\frac{i}{K}\log^2\frac{K}{i} \end{eqnarray*} where the last inequality follows from the lower bound for the mutual information in the noiseless case provided in \Cref{InformationClaim}. Substituting this lower bound, we obtain \begin{eqnarray*} T\rho\frac{i}{K}&&\hspace{-0.7cm} \left( 1 -\frac{\rho}{2}\log^2\frac{K}{i} \right)\\ && \geq \rho\log\binom{N-K}{i}M^{i}+\log\binom{K}{i}+\log K \revisedn{+ K}. \end{eqnarray*} Hence, with $M=2^{T\frac{\delta}{K}}$, since $\epsilon$ can be chosen arbitrarily small, we have \begin{eqnarray*} T\rho\frac{i}{K}&&\hspace{-0.7cm} \left( 1-\frac{\rho}{2}\log^2\frac{K}{i} \right)\\ && \geq \rho\log\binom{N-K}{i}2^{T\frac{i\delta}{K}}+\log\binom{K}{i}+\log K \revisedn{+ K}. \end{eqnarray*} By choosing $\rho=\frac{1}{\log^2(K/i)}$ and \begin{eqnarray*} T & \geq & \max_{1 \leq i \leq K} \frac{\log\binom{N-K}{i}+(\log\binom{K}{i}K\revisedn{+ K})\log^2(K/i)}{(1-1/2-\delta)i/K}, \end{eqnarray*} the inequality is satisfied. Noting that this is for $K = o(N)$, achieves the bound on $T$ provided in \Cref{direct lemma3} and the reliability is established. \end{proof} } \subsection{Information Leakage at the Eavesdropper}\label{LowerBoundLeakage} We now prove the security constraint is met. Hence, we wish to show that $I(W;Z^{T})/T\rightarrow 0$, as $T\rightarrow \infty$. Denote by $\mathcal{C}_T$ the random codebook and by $X_{\mathcal{S}}^T$ the set of codewords corresponding to the true defective items. We have, \begin{eqnarray} && \hspace{-0.8cm}\textstyle\textstyle \frac{1}{T}I(W;Z^T|\mathcal{C}_{T}) = \frac{1}{T}\left(I(W,R_K;Z^T|\mathcal{C}_{T})-I(R_K;Z^T|W,\mathcal{C}_{T})\right)\nonumber\\ &\hspace{-0.6cm} \stackrel{(a)}{=} &\hspace{-0.5cm}\textstyle \frac{1}{T}\left(I(X_{\mathcal{S}}^T;Z^T|\mathcal{C}_{T})-I(R_K;Z^T|W,\mathcal{C}_{T})\right)\nonumber\\ &\hspace{-0.6cm} = &\hspace{-0.5cm}\textstyle \frac{1}{T}(I(X_{\mathcal{S}}^T;Z^T|\mathcal{C}_{T})-H(R_K|W,\mathcal{C}_{T})+H(R_K|Z^T,W,\mathcal{C}_{T}))\nonumber\\ &\hspace{-0.6cm} \stackrel{(b)}{=} & \hspace{-0.5cm}\textstyle \frac{1}{T}\left(I(X_{\mathcal{S}}^T;Z^T|\mathcal{C}_{T})-H(R_K)+H(R_K|Z^T,W,\mathcal{C}_{T})\right)\nonumber\\ &\hspace{-0.6cm} \stackrel{(c)}{=}&\hspace{-0.5cm} I(X_{\mathcal{S}};Z|\mathcal{C}_{T}) - \frac{1}{T}K\log M + \frac{1}{T}H(R_K|Z^T,W,\mathcal{C}_{T})\nonumber\\ &\hspace{-0.6cm} \stackrel{(d)}{\leq}&\hspace{-0.5cm} \delta - \frac{1}{T}K\left(T \frac{\delta-\epsilon^{\prime}}{K}\right) + \frac{1}{T}H(R_K|Z^T,W,\mathcal{C}_{T})\stackrel{(e)}{\leq} \epsilon_T + \revisedSr{\epsilon^{\prime}},\nonumber \end{eqnarray} where $\epsilon_T \to 0$ as $T \to \infty$\off{and \revised{$\epsilon_K \to 0$ as $K \to \infty$}}. (a) is since there is a $1:1$ correspondence between $(W,R_K)$ and $X_{\mathcal{S}}^T$; (b) is since $R_K$ is independent of $W$ and $\mathcal{C}_T$; (c) is since in this \emph{direct result} the codebook is defined by the construction and is memoryless, as well as the channel; (d) is since by choosing an i.i.d.\ distribution for the codebook one easily observes that $I(X_{\mathcal{S}};Z| \mathcal{C}_T) \leq \delta$. Finally, (e) is for the following reason: Given $W$ and the codebook, Eve has a perfect knowledge regarding the \emph{bins from which the codewords were selected}. It requires to see whether she can indeed estimate $R_K$. Note that the channel Eve sees in this case is the following \emph{multiple access channel}: each of the defective items can be considered as a ``user" with $M$ messages to transmit. Eve's goal is to decode the messages from all users. This is possible if the rates at which the users transmit are within the capacity region of this MAC. Indeed, this is a (binary) Boolean MAC channel, followed by a simple erasure channel. The sum capacity cannot be larger than $\delta$, and this sum capacity is easily achieved by letting one user transmit at a time, or, in our case, \revised{where the codebook is randomly i.i.d.\ distributed, under a fixed input distribution $p=1-2^{\frac{1}{K}}$. Since actually, we use input distribution for the testing matrix of $(\frac{\ln(2)}{K},1-\frac{\ln(2)}{K})$, and $\lim_{K \to \infty} 1-2^{\frac{1}{K}}/\frac{\ln(2)}{K}=1$, for large $K$, each user obtain the same capacity; namely, each user sees a capacity of $\delta/K$.\off{ Hence Eve may decode if $\frac{1}{T}\log M$ is smaller than that value.}} \off{ \revised{since the codebook is randomly i.i.d.\ distributed, under a fixed input distribution for the testing matrix $(\frac{\ln(2)}{K},1-\frac{\ln(2)}{K})$ and for large $K$, each user obtain the same capacity, namely, each user sees a capacity of $\delta/K$.} Hence Eve may decode if $\frac{1}{T}\log M$ is smaller than that value.} \begin{remark} Under non-secure GT, it is clear that simply adding tests to a given GT code (increasing $T$) can only improve the performance of the code (in terms of reliability). A legitimate decoder can always disregard the added tests. For SGT, however, the situation is different. Simply adding tests to a given code, \emph{while fixing the bin sizes}, might make the vector of results vulnerable to eavesdropping. In order to increase reliability, one should, of course, increase $T$, but also increase the bin sizes proportionally, so the secrecy result above will still hold. This will be true for the efficient algorithm suggested in \Cref{efficient_algorithms} as well. \end{remark} \begin{remark} \revised{To establish the weak secrecy \revisedSr{constraint} we set $M$ to be $2^{T\frac{\delta-\revisedSr{\epsilon^{\prime}}}{K}}$, where the readability is archived without any \revisedSr{constraint} on $\revisedSr{\epsilon^{\prime}}$. However, in Appendix~\ref{strong_secrecy} to establish the strong secrecy \revisedSr{constraint} we require $M$ to be $2^{T\frac{\delta+\revisedSr{\epsilon^{\prime}}}{K}}$.} \end{remark} \begin{remark} \revisedSr{Note that since \begin{eqnarray*} \frac{1}{T}H(R_K|Z^T,W,\mathcal{C}_{T}) \hspace{-0.2cm} &=\hspace{-0.2cm}& \frac{1}{T}H(R_K)-\frac{1}{T}I(R_K;Z^T,W,\mathcal{C}_{T}) \\ \hspace{-0.2cm}&=\hspace{-0.2cm}& \frac{1}{T}\log M - \frac{1}{T}I(R_K;Z^T,W,\mathcal{C}_{T}), \end{eqnarray*} any finite-length approximation for $I(R_K;Z^T,W,\mathcal{C}_{T})$ will give a finite length approximation for the leakage at the eavesdropper. For example, one can use the results in \cite{polyanskiy2010channel}, to show that the leakage can be approximated as $\frac{1}{\sqrt{T}}+\epsilon^{\prime}$}. \end{remark} \section{Main Results}\label{main results} Under the model definition given in \Cref{formulation}, our main results are the following sufficiency (direct) and necessity (converse) conditions, characterizing the maximal number of tests required to guarantee both reliability and security. The proofs are deferred to \Cref{LowerBound} and \Cref{converse}. \subsection{Direct (Sufficiency)} The sufficiency part is given by the following theorem. \begin{theorem}\label{direct theorem1} Assume a SGT model with $N$ items, out of which $K=O(1)$ are defective. For any $0 \leq \delta < 1$, if \begin{equation}\label{main_result_eq} T \geq \max_{i=1,\ldots ,K} \frac{1+\varepsilon}{1-\delta} \frac{K}{i}\log\binom{N-K}{i}, \end{equation} for some $\varepsilon \revisedSr{>} 0$ independent of $N$ and $K$, then there exists a sequence of SGT algorithms which are reliable and secure. That is, as $N\rightarrow \infty$, both the average error probability approaches zero \revisedSr{exponentially} and an eavesdropper with leakage probability $\delta$ is kept ignorant. \end{theorem} The construction of the SGT algorithm, together with the proofs of reliability and secrecy are deferred to Section \ref{LowerBound}. \revisedSr{In fact, in \Cref{LowerBound} we actually prove that the maximal error probability decays to $0$.} However, a few important remarks are in order now. First, rearranging terms in \cref{main_result_eq}, we have \begin{equation*}\label{main_result} T \geq \frac{1}{1-\delta} \max_{i=1,\ldots ,K}\frac{(1+\varepsilon)K}{i}\log\binom{N-K}{i}. \end{equation*} That is, compared to only a reliability constraint, the number of tests required for \emph{both reliability and secrecy} is increased by the multiplicative factor $\frac{1}{1-\delta}$, where, again, $\delta$ is the leakage probability at the eavesdropper. \revisedSr{The result given in \Cref{direct theorem1} uses an ML decoding at the legitimate receiver. The complexity burden in ML, however, prohibits the use of this result for large N. In \Cref{direct theorem5}, we suggest an efficient decoding algorithm, which maintains the reliability and the secrecy results using a much simpler decoding rule, at the price of only slightly more tests.} \revisedSr{Using an upper bound on $\log\binom{N-K}{i}$, the maximization in \Cref{direct theorem1} can be solved easily, leading to simple bound on $T$ with tight scaling and only a moderate constant. \begin{corollary}\label{corollary} For SGT with parameters $K << N$ and $T$, reliability and secrecy can be maintained if \begin{equation*} T \geq \frac{1+\varepsilon}{1-\delta} K \log (N-K)e. \end{equation*} \end{corollary} \begin{proof} Substituting $\log\binom{N-K}{i} \leq i\log \frac{(N-K)e}{i}$, the maximum over $i$ is easily solved. \end{proof} Note that together with the converse below, this suggests $T= \Theta \left(\frac{K\log N}{1-\delta}\right)$, and, a $\Theta \left(K\log N\right)$ result for $\delta$ bounded away from $1$. \off{Finally, we note that while the results in \Cref{direct theorem1} are only for the constant $K$ regime, in principle, using the techniques in \cite{aldridge2017capacity}, can be extended to a larger regime, but for ease of presentation, we focus on the constant regime in this paper.}} \subsection{Converse (Necessity)} The necessity part is given by the following theorem. \begin{theorem}\label{converse theorem} Let $T$ be the minimum number of tests necessary to identify a defective set of cardinality $K$ among population of size $N$ while keeping an eavesdropper, with a leakage probability $\delta < 1$, ignorant regarding the status of the items. Then, \off{for large enough $N$ one must have}\revisedSr{if $\frac{1}{T} I(W;Z^T)<\epsilon$, one must have:} \begin{eqnarray*} T \ge \frac{1-\epsilon_T}{1-\delta}\log\binom{N}{K}, \end{eqnarray*} \revisedSr{where $\epsilon_T = \epsilon +\tilde{\epsilon}_T$, with $\tilde{\epsilon}_T\rightarrow 0$ as $T\rightarrow \infty$.} \end{theorem} \revisedn{The lower bound is derived using Fano's inequality to address reliability, assuming a negligible mutual information at the eavesdropper, thus keeping an eavesdropper with leakage probability $\delta$ ignorant, and information inequalities bounding the rate of the message on the one hand, and the data Eve \emph{does not see} on the other. Compared with the lower bound without security constraints, it is increased by the multiplicative factor $\frac{1}{1-\delta}$.} \subsection{Secrecy capacity in SGT} Returning to the analogy in \cite{baldassini2013capacity} between channel capacity and group testing, one might define by $C_s$ the (asymptotic) minimal threshold value for $\log\binom{N}{K}/T$, above which no reliable and secure scheme is possible. Under this definition, the result in this paper show that $C_s = (1-\delta)C $, where $C$ is the capacity without the security constraint. Clearly, this can be written as \begin{equation*} C_s = C - \delta C, \end{equation*} raising the usual interpretation as the \emph{difference} between the capacity to the legitimate decoder and that to the eavesdropper \cite{C13}. Note that as the effective number of tests Eve sees is $T_e = \delta T$, her GT capacity is $\delta C$. \subsection{Efficient Algorithms} Under the SGT model definition given in \Cref{formulation}, we further consider a computationally efficient algorithm at the legitimate decoder. Specifically, we analyze the \emph{Definite Non-Defective} (DND) algorithm (originally called \emph{Combinatorial Orthogonal Matching Pursuit} (COMP)), considered for the non-secure GT model in the literature \cite{chan2014non,aldridge2014group}. The theorem below states that indeed efficient decoding (with arbitrarily small error probability) and secrecy are possible, at the price of a higher $T$. Interestingly, the theorem applies to any $K$, and not necessarily only to $K = O(1)$. This is, on top of the reduced complexity, an important benefit of the suggested algorithm. \begin{theorem}\label{direct theorem5} Assume a SGT model with $N$ items, out of which $K$ are defective. Then, for any $\delta < \frac{1}{2}\left(1-\frac{\ln 2}{K}\right)$, there exists an efficient decoding algorithm, requiring $O(N^2T)$ operations, such that if the number of tests satisfies \[ T \ge \frac{1+\epsilon}{\frac{1}{2}(1-\frac{\ln 2}{K})-\delta} K \log N \] its error probability is upper bounded by \[ P_e \leq N^{-\epsilon}. \] \end{theorem} The construction of the DND GT algorithm, together with the proofs of reliability and secrecy are deferred to \Cref{efficient_algorithms}. \off{\revisedSr{The efficiency of the result given in \Cref{direct theorem5} gain/larger range of $K$ comes at a cost of an increased number of tests/smaller parameter range of $\delta$ where the results are valid.}} Clearly, the benefits of the algorithm above come at the price of additional tests and a smaller range of $\delta$ it can handle. \off{ We will note that in the same way that we analyze the DND algorithm in \Cref{efficient_algorithms}, where the decoder consider each of the $MN$ codewords separably, as in the non-secure case for the $N$ codewords, without to take into account the binning structure of the code, we suppose that it is possible to analyze the \emph{Definite Defective} (DD) algorithm proposed in \cite{aldridge2014group} for the case where there is eavesdropper which we want to kept ignorant. \subsubsection{Secure Definite defective algorithm} The construction of the Secure-DD GT algorithm, together with the proofs of reliability and secrecy are deferred to Section \ref{DD}. } \section{Background and Related Work}\label{BooleanCompressed} \subsection{Group-testing} \revised{Group-testing comes in various flavours, and the literature on these is vast. At the risk of leaving out much, we reference here just some of the models that have been considered in the literature, and specify our focus in this work.} \subsubsection{Performance Bounds} GT can be \emph{non-adaptive}, where the testing matrix is designed beforehand, \revisedSr{{\it adaptive}}, where each new test can be designed while taking into account previous test \emph{results}, or a combination of the two, where testing is adaptive, yet with batches of non-adaptive tests. It is also important to distinguish between \emph{exact recovery} and a \emph{vanishing probability of error}. \off{\revisedSid{Adaptive versus non-adaptive, exact recovery versus approximate recovery, zero-error reconstruction versus vanishing error reconstruction, noiseless versus noisy test outcomes, binary versus non-binary test outcomes.} \revisedSid{2. Adaptive versus non-adaptive group-testing: The items to be tested in a pool may be chosen as a function of previous test outcomes (this model corresponds to {\it adaptive group-testing}), or chosen independently of prior test outcomes (this model corresponds to {\it adaptive group-testing}). Various computationally efficient algorithms for adaptive group-testing algorithms (see for example \cite{aldridge2014group, damaschke2010competitive})}} To date, the best known lower bound on the number of tests required (non-adaptive, exact recovery) is $\Omega(\frac{K^2}{\log K}\log N)$ \cite{furedi1996onr}. The best known explicit constructions were given in \cite{porat2011explicit}, resulting in $O(K^2 \log N)$. However, focusing on exact recovery requires more tests, and forces a combinatorial nature on the problem. Settling for high probability reconstructions allows one to reduce the number of tests to the order of $K\log N$.\footnote{A simple information theoretic argument explains a lower bound. There are $K$ defectives out of $N$ items, hence $N \choose K$ possibilities to cover: $\log {N \choose K}$ bits of information. Since each test carries at most one bit, this is the amount of tests required. Stirling's approximation easily shows that for $K \ll N$, the leading factor of that is \revisedSr{$K\log(N/K)$}.} For example, see the channel-coding analogy given in \cite{atia2012boolean}. A similar analogy to wiretap channels will be at the basis of this work as well. In fact, probabilistic methods with an error probability guarantee appeared in \cite{sebHo1985two}, without explicitly mentioning GT, yet showed the $O(K \log N)$ bound. Additional probabilistic methods can be found in \cite{scarlett2015limits} for \emph{support recovery}, or in \cite{scarlett2016phase}, when an interesting \emph{phase transition} phenomenon was observed, yielding tight results on the threshold (in terms of the number of tests) between the error probability approaching one or vanishing. \off{Finally, note that the significant difference between exact reconstruction and negligible error probability is also apparent in adaptive GT, e.g., \cite{aldridge2012adaptive}.} \subsubsection{A Channel Coding Interpretation} As mentioned, the analogy to channel coding \revisedSr{has} proved useful \cite{atia2012boolean}. \cite{baldassini2013capacity} defined the notion of \emph{group testing capacity}, that is, the value of $\lim_{N \to \infty} \frac{\log{{N}\choose{K}}}{T}$ under which reliable algorithms exist, yet, over which, no reliable reconstruction is possible. A converse result for the Bernoulli, non-adaptive case was given in \cite{aldridge2017capacity}. Strong converse results were given in \cite{tan2014strong,johnson2015strong}, again, building on the channel coding analogy, as well as converses for noisy GT \cite{scarlett2016converse}. In \cite{aldridge2012adaptive}, adaptive GT was analyzed as a channel coding \emph{with feedback} problem. \subsubsection{Efficient Algorithms} A wide variety of techniques were used to design efficient GT decoders. Results and surveys for early non-adaptive decoding algorithms were given in \cite{chen2008survey,de2005optimal,indyk2010efficiently}. Moreover, although most of the works described above mainly targeted fundamental limits, some give efficient algorithms as well. In the context of this work, it is important to mention the recent COMP \cite{chan2014non}, DD and SCOMP \cite{aldridge2014group} algorithms, concepts from which we will use herein. \off{ \subsubsection*{Noisy Group Testing\off{ and Graph Models}} Since GT has numerous applications, several different models were suggested, with diverse tools being applied to tackle them. Perhaps the most studied extension is that of \emph{noisy} GT. Noisy models can include cases of \emph{false positives}, where with some probability a negative pool is still marked as positive, or \emph{false negatives} if defective items get \emph{diluted}. \cite{atia2012boolean} includes several results in this context. Additional converse results for noisy GT are also in \cite{scarlett2016converse}. Noise level can also depend on the number of items tested in each pool \cite{Goparaju2016polar}. Analysis of noisy GT from a Signal to Noise ratio perspective is given in \cite{malloy2014near}.} \off{ In \emph{threshold group testing} \cite{chen2009nonadaptive,cheraghchi2010improved,chan2013near}, the test results are sensitive to the number of defective items within a test, hence, are not necessarily a Boolean sum. A recent work also allowed the presence of \emph{inhibitors}, which can mask test results \cite{de2005optimal,ganesan2015non}. The capacity of Semi-quantitative group testing was discussed in \cite{6283599}, where the tests' output is not necessarily binary (positive or negative). In a similar context, \cite{sparseGT} considered the case where the testing matrix has to be sparse (either because an item cannot be tested too many times, or because a test cannot include too many items). \cite{damaschke2010competitive} considered the case where the number of defectives, $K$, is unknown in advance. \cite{colbourn1999group} considered the case where the items are ordered, and the defective set is a consecutive subset of the items. Finally, since at the heart of GT stands a binary testing matrix, dictating in which test each item participates, GT also has a clean bipartite graph representation, when the Left set of vertices may stand for the items, and the Right for the tests. Indeed, such a representation gives a very elegant combinatorial result regarding the number of errors a certain testing matrix can withstand \cite{5707017}. Results on \emph{cover-free families} yield lower bounds for GT as well \cite{stinson2000some}. These definitions also lead to a natural definition for \emph{list GT} \cite{cheraghchi2009noise}, where the goal is to output a list containing all defective items, and perhaps additional ones up to the size of the list. Bipartite graphs for GT and noisy GT where also used in \cite{cai2013grotesque,lee2015saffron}. \cite{wadayama2013analysis} considered a more structured graph model, i.e., when the bipartite graph is regular, with items having degree $l$ and tests having degree $r$.} \revised{\subsection{Secure communication} \revised{It is very important to note that {\it making GT secure is different from making communication secure, as \revisedSr{remarked} in \Cref{intro}}. Now, we briefly survey the literature in secure communication, since many of the ideas/models/primitives in secure communication will have analogues in secure group-testing.} \subsubsection{Information-theoretic secrecy} In a secure communication setting, transmitter Alice wishes to send a message $m$ to receiver Bob. To do so, she is allowed to encode $m$ into a (potentially random) function $x = f(m)$, and transmit $x$ over a medium. It is desired that the eavesdropper Eve should glean no information about $m$ from its (potentially noisy) observation $z$. This information leakage is typically measured via the mutual information between $m$ and $z$.\off{(we defer a more detailed discussion on secrecy metrics to Section II).} The receiver Bob should be able to reconstruct $m$ based on its (also potentially noisy) observation of $x$ (and, potentially, a shared secret that both Bob and Alice know, but Eve is ignorant of).} \revised{There are a variety of schemes in the literature for information-theoretically secure communications.}\footnote{\revised{Security in general has many connotations — for instance, in the information-theory literature it can also mean a scheme that is resilient to an {\it active adversary}, for instance a communication scheme that is resilient to jamming against a malicious jammer. In this work we focus our attention on {\it passive eavesdropping adversaries}, and aim to ensure secrecy of communications vis-a-vis such adversaries. We shall thus henceforth use the terms security and secrecy interchangeably.}} \revised{Such schemes typically make one of several assumptions (or combinations of these):} \begin{itemize} \item \revised{{\it Shared secrets/Common randomness/Symmetric-key encryption:} The first scheme guaranteed to provide information-theoretic secrecy was by \cite{C1}, who analyzed the secrecy of one-time pad schemes and showed that they ensure perfect secrecy (no leakage of transmitted message). He also provided lower bounds on the size of this shared key. The primary disadvantage of such schemes is that they require a shared key that is essentially as large as the amount of information to be conveyed, and it be continually refreshed for each new communication. These requirements typically make such schemes untenable in practice.} \item \revised{{\it Wiretap secrecy/Physical-layer secrecy:} Wyner \emph{et al.} \cite{C2,ozarow1984wire} first considered certain communication models in which the communication channel from Alice to Eve is a degraded (noisier) version of the channel from Alice to Bob, and derived the information-theoretic capacity for communication in such settings. These results have been generalized in a variety of directions. See \cite{csiszar2004secrecy,csiszar2008secrecy,C13} for (relatively) recent results. The primary disadvantage of such schemes is that they require that it be possible to instantiate communication channels from Alice to Bob that are better than the communication channel from Alice to Eve. Further, they require that the channel parameters of both channels be relatively well known to Alice and Bob, since the choice of communication rate depends on these parameters. These assumptions make such schemes also untenable in practice, since on one hand Eve may deliberately situate herself to have a relatively clear view of Alice's transmission than Bob, and on the other hand there are often no clear physically-motivated reasons for Alice and Bob to know the channel parameters of the channel to Eve.} \item \revised{{\it Public discussion/Public feedback:} A very nice result by Maurer (~\cite{maurer1993secret} and subsequent work - see \cite{C13} for details) significantly alleviated at least one of the charges level against physical-layer security systems, that they required the channel to Bob to be \revisedSr{``}better" than the channel to Eve. Maurer demonstrated that feedback (even public feedback that is noiselessly observable by Eve) and multi-round communication schemes can allow for information-theoretically secure communication from Alice to Bob even if the channel from Alice to Bob is worse than the channel from Alice to Eve. Nonetheless, such public discussion schemes {\it still} require some level of knowledge of the channel parameters of the channel to Eve.} \end{itemize} \revised{\subsubsection{Cryptographic security} Due to the shortcomings highlighted above, modern communication systems usually back off from demanding information-theoretic security, and instead attempt to instantiate {\it computational security}. In these settings, instead of demanding small information leakage to arbitrary eavesdroppers, one instead assumes bounds on the computational power of the eavesdropper (for instance, that it cannot computationally efficiently invert \revisedSr{``}one-way functions"). Under such assumptions one is then often able to provide conditional security, for instance with a public-key infrastructure ~\cite{kocher1996timing,stinson2005cryptography}.} \revised{Such schemes have their own challenges to instantiate. For one, the computational assumptions they rely on are sometimes unfounded and hence sometimes turn out to be prone to attack \cite{tagkey2004391,C13,dent2006fundamental}. For another, the computational burden of implementing cryptographic primitives with strong guarantees can be somewhat high for Alice and Bob~\cite{bernstein2008attacking}.} \revised{\subsection{Secure Group-Testing} On the face of it, the connection between secure communication and secure group-testing is perhaps not obvious. We highlight below scenarios that make these connections explicit. Paralleling the classification of secure communication schemes above, one can also conceive of a corresponding classification of secure GT schemes.} \subsubsection{\revised{Information-theoretic schemes}} \begin{itemize} \item \revised{{\it Shared secrets/Common randomness/Symmetric-key encryption:} A possible scheme to achieve secure group testing, is to utilize a shared key between Alice and Bob. For example, consider a scenario in which Alice the nurse has a large number of blood samples that need to be tested for the presence of a disease. She sends them to a lab named Eve to be tested. To minimize the number of tests done via the lab, she pools blood samples appropriately. However, while the lab itself will perform the tests honestly, it can't be trusted to keep medical records secure, and so Alice keeps secret the identity of the people tested in each pool. \footnote{Even in this setting, it can be seen that the {\it number} of diseased individuals can still be inferred by Eve. However, this is assumed to be a publicly known/estimable parameter.}} \revised{Given the test outcomes, doctor Bob now desires to identify the set of diseased people. To be able to reconstruct this mapping, a relatively large amount of information (the mapping between individuals' identities and pools tested) needs to be securely communicated from Alice to Bob. As in the one-time pad secure communication setting, this need for a large amount of common randomness makes such schemes unattractive in practice. Nonetheless, the question is theoretically interesting, \revisedSr{and} some interesting results have been recently reported in this direction by \cite{atallah2008private,goodrich2005indexing,freedman2004efficient,rachlin2008secrecy}.} \item \revised{{\it Wiretap secrecy/Physical-layer secrecy:} This is the setting of this paper. Alice does not desire to communicate a large shared key to Bob, and still wishes to maintain secrecy of the identities of the diseased people from \revisedSr{``}honest but curious" Eve. Alice therefore does the following two things: (i) For some $\delta \in (0,1)$, she chooses a $1/\delta$ number of independent labs, and divides the T pools to be tested into $1/\delta$ {\it pool sets} of $T\delta$ pools each, and sends each set to a distinct lab. (ii) For each blood pool, she {\it publicly} reveals to {\it all} parties (Bob, Eve, and anyone else who's interested) a set ${\cal S}(t)$ of {\it possible} combinations of individuals whose blood could constitute that specific pool $t$. As to which specific combination from ${\cal S}(t)$ of individuals the pool actually comprises of, only Alice knows {\it a priori} - Alice generates this private randomness by herself, and does not leak it to anyone (perhaps by destroying all trace of it from her records).} \revised{The twin-fold goal is now for Alice to choose pool-sets and set of ${\cal S}(t)$ for each $t \in [T]$ to ensure that as long as no more than one lab leaks information, there is sufficient randomness in the set of ${\cal S}(t)$ so that essentially no information about the diseased individuals identities leaks, but Bob (who has access to the test reports from all the $1/\delta$ labs) can still accurately estimate (using the publicly available information on ${\cal S}(t)$ for each test $t$) the disease status of each individual. \revisedSr{This scenario closely parallels the scenario in Wyner's Wiretap channel\off{ \revisedSr{II}}. Specifically, this corresponds to Alice communicating a sequence of $T$ test outcomes to Bob, whereas Eve can see only a $\delta$ fraction of test outcomes. To ensure secrecy, Alice injects private randomness (corresponding to which set from ${\cal S}(t)$ corresponds to the combination of individuals that was tested in test $t$) into each test - this is the analogue of the \off{coset-}coding schemes often used for Wyner's wiretap channels.}} \revised{ \begin{remark} It is a natural theoretical question to consider corresponding generalizations of this scenario with other types of broadcast channels from Alice to Bob/Eve (not just degraded erasure channels), especially since such problems are well-understood in a wiretap security context. However, the physical motivation of such generalizations is not as clear as in the scenario outlined above. So, even though in principle the schemes we present in \Cref{formulation} can be generalized to other broadcast channels, to keep the presentation in this paper clean we do not pursue these generalizations here. \end{remark} \begin{remark} Note that there are other mechanisms via which Alice could use her private randomness. For instance, she could {\it deliberately} contaminate some fraction of the tests she sends to each lab with blood from diseased individuals. Doing so might reduce the amount of private randomness required to instantiate secrecy. While this is an intriguing direction for future work, we do not pursue such ideas here. \end{remark} } \item \revised{{\it Public discussion/Public feedback:} The analogue of a public discussion communication scheme in the secure group-testing context is perhaps a setting in which Alice sends blood pools to labs in {\it multiple rounds}, also known as {\it adaptive group testing} in the GT literature. Bob, on observing the set of test outcomes in round $i$, then publicly broadcasts (to Alice, Eve, and any other interested parties) some (possibly randomized) function of his observations thus far. This has several potential advantages. Firstly, adaptive group-testing schemes (e.g.\cite{aldridge2014group}) significantly outperform the best-known non-adaptive group-testing schemes (in terms of smaller number of tests required to identify diseased individuals) in regimes where $K=\omega(N^{1/3})$}. \revised{One can hope for similar gains here. Secondly, as in secure communication with public discussion, one can hope that multi-round GT schemes would enable information-theoretic secrecy even in situations where Eve may potentially have access to {\it more} test outcomes than Bob. Finally, such schemes may offer storage/computational complexity advantages over non-adaptive GT schemes. Hence this is an ongoing area of research, but outside the scope of this paper.} \end{itemize} \revised{\subsubsection{Cryptographic secrecy} As in the context of secure communication, the use of cryptographic primitives to keep information about the items being tested secure has also been explored in sparse recovery problems - see, for instance \cite{atallah2008private,goodrich2005indexing,freedman2004efficient,rachlin2008secrecy}. Schemes based on cryptographic primitives have similar weaknesses in the secure GT context as they do in the communication context, and we do not explore them here.} \section{Information Leakage at the Eavesdropper\\ (Strong Secrecy)}\label{strong_secrecy} We wish to show that $I(W;Z^{T})\rightarrow 0$. Denote by $\mathcal{C}_T$ the random codebook and by $\textbf{X}_{\mathcal{S}_w}^T$ the set of codewords corresponding to the true defective items. We assumed $W \in \{1,\ldots, {N \choose K}\}$ is uniformly distributed, that is, there is no \emph{a-priori} bias to any specific subset. Further, the codebook includes independent and identically distributed codewords. The eavesdropper, observing $Z^T$, wish to decode the true $K$ independent and identically distributed codewords, which correspond to the defective items, one of ${N \choose K}$ subsets. To analyze the information leakage at the eavesdropper, we note that the channel Eve sees in this case is the following \emph{multiple access channel}. Each of the items can be considered as a \revisedSr{``}user" with $M$ specific codewords. Eve's goal is to identify the active users. Note the Eve's channel can be viewed as (binary) Boolean MAC, followed by a BEC$(1-\delta)$. \off{by decode all the transmitted codewords. This is possible if the rates at which the users transmit are within the capacity region of this MAC. Indeed, this is a (binary) Boolean MAC channel, followed by a simple erasure channel.} The sum capacity to Eve cannot be larger than $\delta$. \revised{In fact, since the codebook is randomly i.i.d.\ distributed, under a fixed input distribution for the testing matrix $(\frac{\ln(2)}{K},1-\frac{\ln(2)}{K})$, Eve can obtain from each active user a rate of at most $\delta/K$}. Consequently, Eve may obtain a sub-matrix $\tilde{\textbf{Z}}$ of possibly transmitted codewords, where from each codeword Eve sees at most a capacity of $\delta/K$. However, in this analysis, we help Eve even further to get the true sub-matrix $\tilde{\textbf{Z}}$, with the maximum rate $\delta/K$. That is, we assume Eve gets the full rate, identifies the codewords of the users except for the erasures. We give Eve the power not to be confused from the existence of other, $N-K$ users which did not transmit eventually. \off{that she can obtain in the Boolean MAC channel followed by erasure channel with erasure probability of $1-\delta$.} Providing this information to Eve only makes her stronger and thus a coding scheme that succeeds to keep Eve ignorant, will also succeed against the original Eve. Now, once Eve obtains the true sub-matrix $\tilde{\textbf{Z}}$, since the codebook and the subsets of the items was generated independently and identically, we will analyze the information that leaks at the eavesdropper from each possibly transmitted codeword in $\tilde{\textbf{Z}}$ separately. Namely, per original codeword $X_j^T$, on average, $\frac{\delta}{K}T $ from the $T$ outcomes are not erased and are accessible to the eavesdropper via $\tilde{Z}_{\tilde{j}}^{T}$. Thus, out of the $M$ independent and identically distributed codewords, there is an exponential number of codewords, that from eavesdropper perspective, may have participated in $\textbf{X}_{\mathcal{S}_w}^T$ and could have resulted in the same $\tilde{Z}_{\tilde{j}}^{T}$. These consistent codewords are exactly those that lie in a ball around $\tilde{Z}_{\tilde{j}}^{T}$ of radius $d \approx (1-\frac{\delta}{K}) T$ as depicted in \Cref{figure:StrongSecrecy}. \ifdouble \begin{figure} \centering \includegraphics[trim=0cm 0cm 0cm 0cm,clip,scale=1]{StrongSecrecy3.png} \caption{Codewords exactly lie in a ball around $\tilde{Z}_{\tilde{j}}^{T}$ of radius $d \approx (1-\frac{\delta}{K})T$), where $j$ is the codeword index and $1\leq i \leq N$ is the bin index.} \label{figure:StrongSecrecy} \end{figure} \else \begin{figure} \centering \includegraphics[trim=0cm 0cm 0cm 0cm,clip,scale=1.5]{StrongSecrecy3.png} \caption{Codewords exactly lie in a ball around $\tilde{Z}_{\tilde{j}}^{T}$ of radius $d \approx (1-\frac{\delta}{K})T$), where $j$ is the codeword index and $1\leq i \leq N$ is the bin index.} \label{figure:StrongSecrecy} \end{figure} \fi The eavesdropper does not know what is the codeword $X^T_j$ in $\textbf{X}_{\mathcal{S}_w}^T$, which was selected by the mixer and she even does not know what $d_H = \|X^T_j - \tilde{Z}_{\tilde{j}}^{T}\|$ is exactly (where $\|\cdot\|$ is the hamming distance), other than the fact that $d_H \approx (1-\frac{\delta}{K})T$. However, we help Eve by providing $d$ and by choosing a small yet exponential set of codewords (of size $2^{T\frac{\epsilon}{K}}$, for an appropriately small $\epsilon$) from the codebook $\mathcal{C}$, chosen from the set of all codewords at distance $d$ from $\tilde{Z}_{\tilde{j}}^{T}$, with the additional guarantee that it also contains the true $X^T_j$. We refer to this set as the oracle-given set $\textbf{X}_{\mathcal{O}racel}^T$. Again, providing this information to Eve only makes her stronger and thus a coding scheme that succeeds to keep Eve ignorant, will also succeed against the original Eve. Conditioned on Eve’s view $\tilde{Z}_{\tilde{j}}^{T}$ and $\textbf{X}_{\mathcal{O}racel}^T$, each of the codewords in $\textbf{X}_{\mathcal{O}racel}^T$ is equally likely to have been participated in the pool tests. Nonetheless, Eve still has a reasonable amount of uncertainty about which of the $2^{T\frac{\epsilon}{K}}$ codewords was actually participated indeed, this is the uncertainty that we leverage in our analysis. We define, for any $\tilde{Z}_{\tilde{j}}^{T}$ and $d$, a ball and a shell as \begin{equation*} \mathcal{V}ol(\tilde{Z}_{\tilde{j}}^{T},d)=\{X^T_j:d_H(X^T_j,\tilde{Z}_{\tilde{j}}^{T})\leq d\}, \end{equation*} \begin{equation*} \mathcal{S}h(\tilde{Z}_{\tilde{j}}^{T},d)=\{X^T_j:d_H(X^T_j,\tilde{Z}_{\tilde{j}}^{T})= d\}. \end{equation*} Hence, we define the probability for a codeword to fall in shell as \ifdouble \begin{multline*} Pr(X^T_j \in\mathcal{C} \cap X^T_j\in \mathcal{S}h(\tilde{Z}_{\tilde{j}}^{T},d))\\ = \frac{\mathcal{V}ol(\mathcal{S}h(\tilde{Z}_{\tilde{j}}^{T},d))}{2^T} = \frac{2^{\left(1-\frac{\delta}{K}\right)T}}{2^{T}}. \end{multline*} \else \begin{equation*} Pr(X^T_j \in\mathcal{C} \cap X^T_j\in \mathcal{S}h(\tilde{Z}_{\tilde{j}}^{T},d)) = \frac{\mathcal{V}ol(\mathcal{S}h(\tilde{Z}_{\tilde{j}}^{T},d))}{2^T} = \frac{2^{\left(1-\frac{\delta}{K}\right)T}}{2^{T}}. \end{equation*} \fi For each item we have $M =2^{\left(\frac{\delta+\revised{\revisedSr{\epsilon^{\prime}}}}{K}\right)T}$ codewords. Thus, \emph{on average}, the number of codewords Eve sees on a shell, per defective item is \ifdouble \begin{multline*} |\{w:X^T_j(w)\in \mathcal{S}h(\tilde{Z}_{\tilde{j}}^{T},d)\}|\\ = \frac{2^{\left(\frac{\delta+\revised{\revisedSr{\epsilon^{\prime}}}}{K}\right) T}\cdot 2^{\left(1-\frac{\delta}{K}\right)T}}{2^T} = 2^{T\frac{\revised{\revisedSr{\epsilon^{\prime}}}}{K}}. \end{multline*} \else \begin{equation*} |\{w:X^T_j(w)\in \mathcal{S}h(\tilde{Z}_{\tilde{j}}^{T},d)\}| = \frac{2^{\left(\frac{\delta+\revised{\revisedSr{\epsilon^{\prime}}}}{K}\right) T}*2^{\left(1-\frac{\delta}{K}\right)T}}{2^T} = 2^{T\frac{\revised{\revisedSr{\epsilon^{\prime}}}}{K}}. \end{equation*} \fi Hence, we can conclude that, on average, for every item, Eve has quite a few options in a particular shell. Now that we established that the average number of codewords per item $|\{w:X^T_j(w)\in \mathcal{S}h(\tilde{Z}_{\tilde{j}}^{T},d)\}|$ is $2^{T\frac{\revised{\revisedSr{\epsilon^{\prime}}}}{K}}$, we wish to calculate the probability that the \emph{actual number of options} deviates from the average by more than $\varepsilon$.\off{ is \begin{equation*} (1-\varepsilon)2^{T\frac{\revised{\revisedSr{\epsilon^{\prime}}}}{K}}\leq |\{w:X^T_j(w)\in \mathcal{S}h(\tilde{Z}_{\tilde{j}}^{T},d)\}| \leq (1+\varepsilon)2^{T\frac{\revised{\revisedSr{\epsilon^{\prime}}}}{K}}, \end{equation*} which is the probability that the number of the codewords per item is not in the range.} We define \ifdouble \begin{multline*} \mathcal{E}_{C_1}(\tilde{Z}_{\tilde{j}}^{T},d):= Pr\{ (1-\varepsilon)2^{T\frac{\revised{\revisedSr{\epsilon^{\prime}}}}{K}}\leq \\ |\{w:X^T_j(w)\in \mathcal{S}h(\tilde{Z}_{\tilde{j}}^{T},d)\}| \leq (1+\varepsilon)2^{T\frac{\revised{\revisedSr{\epsilon^{\prime}}}}{K}}\} \end{multline*} \else \begin{equation*} \mathcal{E}_{C_1}(\tilde{Z}_{\tilde{j}}^{T},d):= Pr\{ (1-\varepsilon)2^{T\frac{\revised{\revisedSr{\epsilon^{\prime}}}}{K}}\leq |\{w:X^T_j(w)\in \mathcal{S}h(\tilde{Z}_{\tilde{j}}^{T},d)\}| \leq (1+\varepsilon)2^{T\frac{\revised{\revisedSr{\epsilon^{\prime}}}}{K}}\}. \end{equation*} \fi Let us fix a pair $\tilde{Z}_{\tilde{j}}^{T}$ and $d$ for large enough $T$. By the Chernoff bound, and taking union bound over $\tilde{Z}_{\tilde{j}}^{T}$ and $d$, we have \begin{equation*} Pr(\mathcal{E}_{C_1}(\tilde{Z}_{\tilde{j}}^{T},d)) \geq 1- 2^{-\varepsilon^{\prime}2^{T\frac{\revised{\revisedSr{\epsilon^{\prime}}}}{K}}}. \end{equation*} Due to the super exponential decay in $T$, even when we take a union bound over all the codewords and all shells, we get that the probability that a codeword will have $|\{w:X^T_j(w)\in \mathcal{S}h(\tilde{Z}_{\tilde{j}}^{T},d)\}|$ options significantly different than $2^{T\frac{\revised{\epsilon^{\prime}}}{K}}$ is very small. Actually, with high probability, Eve has almost the same number of options per item. Hence, for Eve\off{, per item $|\{w:X^T_j(w)\in \mathcal{S}h(\tilde{Z}_{\tilde{j}}^{T},d)\}|$,} all the codewords are almost equiprobable.\off{ To conclude, for all the defective items, by the chain rule for entropies, since all the codewords in the codebook are independent: $H(\textbf{X}_{\mathcal{S}_w}^{T}) = \sum_{j \in\mathcal{K}} H(X^T_j(w))$ and $I(W;Z^{T})\rightarrow 0$.} In other words, Eve distribution on the items converges super-exponentially fast to a uniform one, hence $H(W|Z^T)\rightarrow H(W)$ and we have $I(W;Z^{T})\rightarrow 0$. \section{Converse (Necessity)}\label{converse} In this section, we derive the necessity bound on the required number of tests. Let $\bar{Z}$ denote the random variable corresponding to the tests which are not available to the eavesdropper. Hence, $Y = (Z,\bar{Z})$. By Fano's inequality, if $P_e\rightarrow 0$, we have \begin{equation*} H(W|Y) \leq T\epsilon'_T, \end{equation*} where $\epsilon'_T \rightarrow 0$ as $T\rightarrow\infty$. Moreover, the secrecy constraint implies \begin{equation}\label{eq:Necessity19} I(W;Z)\leq T\epsilon''_T, \end{equation} where $\epsilon''_T\rightarrow 0$ as $T\rightarrow \infty$. Consequently, \begin{eqnarray}\label{eq:R_s} \log \binom{N}{K} &=& H(W) \nonumber\\ &=& I(W;Y) + H(W|Y) \nonumber\\ &\stackrel{(a)}{\leq}& I(W;Z,\bar{Z}) + T\epsilon'_T \nonumber\\ &=& I(W;Z) + I(W;\bar{Z}|Z) + T\epsilon'_T \nonumber\\ &\stackrel{(b)}{\leq} & I(W;\bar{Z}|Z) + T\epsilon'_T + T\epsilon''_T \nonumber\\ &\stackrel{(c)}{\leq} & I(\textbf{X}_{\mathcal{S}_w};\bar{Z}|Z) + T(\epsilon'_T + \epsilon''_T) \nonumber\\ &=& H(\bar{Z}|Z) - H(\bar{Z}|\textbf{X}_{\mathcal{S}_w},Z) + T(\epsilon'_T + \epsilon''_T) \nonumber\\ &\stackrel{(d)}{\leq} & H(\bar{Z}) + T(\epsilon'_T + \epsilon''_T) \nonumber \end{eqnarray} where (a) follows from Fano's inequality and since $Y = (Z,\bar{Z})$, (b) follows from \eqref{eq:Necessity19}, (c) follows from the Markov chain $W\rightarrow X_{\mathcal{S}_w}^{T} \rightarrow Y \rightarrow Z$ and (d) is since conditioning reduces entropy. We now evaluate $H(\bar{Z})$. Denote by $\mathcal{\bar{E}}$ the set of tests which are not available to Eve and by $\bar{E}_\gamma$ the event $\{|\mathcal{\bar{E}}| \leq T(1-\delta)(1+\gamma)\}$ for some $\gamma >0$. We have \begin{eqnarray*} H(\bar{Z}) &=& P(\bar{E}_\gamma)H(\bar{Z}| \bar{E}_\gamma) + P(\bar{E}^c_\gamma)H(\bar{Z}| \bar{E}^c_\gamma) \\ &\leq& T(1-\delta)(1+\gamma) + TP(\bar{E}^c_\gamma) \\ & \leq& T(1-\delta)(1+\gamma) + T2^{-T(1-\delta)f(\gamma)}, \end{eqnarray*} where the last inequality follows from the Chernoff bound for i.i.d.\ Bernoulli random variables with parameter $(1-\delta)$ and is true for some $f(\gamma)$ such that $f(\gamma)>0$ for any $\gamma > 0$. Thus, we have \[ \log \binom{N}{K} \leq T(1-\delta)(1+\gamma) + T2^{-T(1-\delta)f(\gamma)} + T(\epsilon'_T + \epsilon''_T). \] That is, \[ T \ge \frac{1-\epsilon_T}{1-\delta}\log \binom{N}{K}, \] for some $\epsilon_T$ such that $\epsilon_T \to 0$ as $T \to \infty$. This completes the converse proof. \off{(e) is assuming $L$ denotes the set of test which leak to Eve, (f) is since each test has a binary output and (g) is by taking a ... where we denote $q_e=1-\delta$, as the erasure probability at the eavesdropper per outcome. Furthermore, we define the event \begin{eqnarray*} &&\hspace{-0.75cm} \mathcal{E}_{\bar{Z}(t)} := \Bigg\{\left(q_e-\epsilon^{\prime}_{T}\right)T \leq \sum_{t=0}^{T} H(\bar{Z}(t)) \leq \left(q_e+\epsilon^{\prime}_{T}\right)T \Bigg\}, \end{eqnarray*} as the probability that the actual erasure probability per outcome deviates from the average by more than $\epsilon^{\prime}$. Thus, by Chernoff bound and taking the union bound over $\sum_{t=0}^{T} H(\bar{Z}(t))$ for large enough $T$, we have, $P_r(\mathcal{E}_{\bar{Z}(t)})\geq 1-2^{-T\epsilon^{\prime}_{T}}$. Due to the exponential decay in $T$, even where we take a union bound over all the outcomes the provability of deviates from the average is very small. Namely, is necessity \begin{equation*}\label{eq:Necessity8a} T \ge \frac{1}{(1-\delta)}\log\binom{N}{K}, \end{equation*} where $\epsilon^{\prime}_{T}\rightarrow 0$, $\varsigma_T\rightarrow 0$ and $\epsilon_T \rightarrow 0$ as $T\rightarrow \infty$. Noting that this achieves the secrecy and the necessity bound on the number of pool tests provided in \Cref{converse theorem}.}
{'timestamp': '2018-01-17T02:06:19', 'yymm': '1607', 'arxiv_id': '1607.04849', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04849'}
arxiv
\section{Introduction} Humanoid robots have been widely studied in the research of robotics. With the recent development of motion capture devices such as RGB-D camera (e.g., Kinect) and wearable sensor system (e.g., Xsens MVN), efforts have been made to generate human-like motions for humanoid robots with high degree-of-freedoms. However, directly applying captured poses of human to humanoids is difficult because of the difference in human's and humanoid's kinematics. Therefore, a variety of kinematics based approaches for humanoid imitation have been investigated, which can be classified into two categories. Many of them perform an offline optimization step to compute the corresponding configurations that conform to the mechanical structures and kinematics of humanoids from input human data\cite{suleiman2008human, chalodhorn2007learning, nakaoka2007learning, ude2004programming, kim2009stable, safonova2003optimizing}. It is obvious that the significant computational overhead in those techniques prevents us from applying them to real-time imitation. Methods in the other thread of research compute online imitation following captured human motion\cite{ott2008motion, dariush2009online, do2008imitation, yamane2010controlling, koenemann2012whole, koenemann2014real}. In this paper, we consider about the problem of realizing real-time human-to-humanoid motion imitation. Unfortunately, it is not an easy task due to: \begin{itemize \item full sampling of human-to-humanoid correspondence often leads to large data size; \item high non-linearity of underlying mechanical rules results in significant computational cost; \item how to find the configuration of a humanoid according to the input poses of human in real-time is not intuitive. \end{itemize Artificial neural networks have been adopted to ease the difficulties, with which a lot of efforts have been made in simulation and for robots with small degree-of-freedoms\cite{morris1997finding, aleotti2004position, neto2009accelerometer, neto2010high, stanton2012teleoperation, van1993control, jung1996neural, larsen2004case, wang2005improving}. A recent work\cite{stanton2012teleoperation} by Stanton et al directly introduced neural networks with particle swarm optimization to find the mapping between human movements and joint angle positions of humanoid. However, there is no measurement presented in their work to evaluate the quality of humanoid poses generated by the trained neural system. On the other aspect, our method is also different from this work in terms of the training data set. We use the sparse correspondence instead of the densely recorded raw data, which can help eliminate the redundancy in data set and improve the training speed. Moreover, only requiring a sparse set of correspondence samples leads to a lower barrier of system implementation. We propose a framework that allows efficient projection of a pose from human's space to the configuration space of humanoid based on sparsely sampled correspondence extracted from recorded raw data, which can be used to realize motion imitation in real time (see Fig. \ref{figWorkflow}). Experimental results show that our framework can be successfully used in the motion imitation of humanoid (see Fig.\ref{figTeleoperation} for an example of tele-operation using a NAO humanoid). \begin{figure}\centering \includegraphics[width=\linewidth]{Teleoperation} \caption{An example of humanoid imitation realized by our framework.} \label{figTeleoperation} \end{figure} \begin{figure*} \centering \captionsetup{justification=centering} \includegraphics[width=\linewidth]{Workflow} \caption{An illustration of our framework for motion imitation using configuration projection.} \label{figWorkflow} \end{figure*} \section{Framework of Configuration Projection} \label{secFramework} \subsection{Problem Definition} \label{subsecProblem} A human pose can be uniquely represented as a point~(abbreviated as $C$-point) $\mathbf{h} \in \mathbb{R}^m$ in the configuration space (abbreviated as $C$-space -- $\mathcal{H}$) of human's motion and its corresponding pose of humanoid can be denoted as a point $\mathbf{r} \in \mathbb{R}^n$ in the $C$-space of humanoid -- $\mathcal{R}$. We assume one-to-one correspondence between the poses of human body and humanoid, i.e. the mapping between human and humanoid's $C$-spaces is bijective. A pair of human's and humanoid's configurations is denoted as $(\mathbf{h}, \mathbf{r}) \in \mathbb{R}^{m+n}$. Given stored correspondence pairs $\{(\mathbf{h}, \mathbf{r})\}$ as the known knowledge and a new input pose $\mathbf{h}^*\in \mathbb{R}^m$, the configuration projection $\Omega(\cdot)$ can be defined as finding a corresponding $\mathbf{r}^* \in \mathbb{R}^n$ that satisfies two basic properties: \begin{itemize} \item \textbf{Identity} -- for any sample pair $(\mathbf{h}_i, \mathbf{r}_i)$ in the data-set, it should have \begin{center} $\Omega(\mathbf{h}_i) = \mathbf{r}_i$. \end{center} \item \textbf{Similarity} -- for an input $C$-point of human $\mathbf{h}^*$, if \begin{displaymath} \max \{ \min_i \|\mathbf{h}_i - \mathbf{h}^*\| \} < \delta \end{displaymath} then it should have \begin{displaymath} \|\Omega(\mathbf{h}^*) - \tilde{\mathbf{r}}(\mathbf{h}^*)\| < \epsilon, \end{displaymath} where $\delta$ and $\epsilon$ are two constant values, and $\tilde{\mathbf{r}}(\mathbf{h}^*)$ is a $C$-point of humanoid that can be obtained by more accurate but computational intensive methods (e.g., inverse kinematics) as the ground truth. \end{itemize} All sample pairs should be repeated with the projection $\Omega(\cdot)$ according to the property of \textit{identity}. The demand on \textit{similarity} indicates that if a new input is close to the known samples, its projected result should not deviate too much from its corresponding ground truth. The main difficulty of finding the projection $\mathbf{r}^*$ lies in the lack of explicit functions to determine the mapping between two $C$-spaces with different dimensions (i.e., degree-of-freedoms). Given sparsely aligned pairs of poses as samples, we try to solve this problem by proposing a strategy of kernel-based projection to find a good approximation for $\mathbf{r}^*$. \subsection{Data Pre-processing}\label{subsecPreprocessing} The knowledge of correspondence $\{(\mathbf{h}, \mathbf{r})\}$ can be established through experiments. Although aligning a pose of human body with a corresponding pose of humanoid can be taken manually, it is a task almost impossible if thousands of such correspondence samples need to be specified. Therefore, in our experiments, we first capture continuous motions of human bodies by using a motion capture system. The data-set obtained in this way often results in large size and redundancy. To resolve this problem, we perform a pre-processing step to extract marker poses from the raw data-set recorded from human's motion. Specifically, mean shift clustering~\cite{comaniciu2002meanshift} is employed to generate the marker set denoted as $\mathcal{H}$. For each sample $\hat{\mathbf{h}}\in \mathcal{H}$, its corresponding pose $\hat{\mathbf{r}}$ in the configuration space of humanoid can be either specified manually (when the number of samples in $\mathcal{H}$ is small) or generated automatically by a sophisticated method (e.g., the inverse kinematics methods). The pairs of correspondence, $\{(\hat{\mathbf{h}}_i,\hat{\mathbf{r}}_i) \}_{i=1,\cdots,N}$, extracted in this way is treated as landmarks to be used in our framework. \subsection{ELM Based Kernels} As the configuration pairs of marker data-set are discrete in space, we define a kernel $\kappa(\cdot)$ on each marker configuration $\hat{\mathbf{h}}_i$ and $\hat{\mathbf{r}}_i$ as a local spatial descriptor using the technique of \textit{Extreme Learning Machine} (ELM) \cite{huang2011extreme}. ELM method has been widely used in regression and classification problems as a \textit{single hidden layer feed-forward network} (SLFN) with its advantageous properties of fast training speed, tuning-free neurons and easiness in implementation (ref.~\cite{huang2012extreme}). Basically, the training formula of ELM can be expressed as $\mathbf{H} \mathbf{b} = \mathbf{T}$, where $\mathbf{H}$ is the hidden layer output matrix of SLFN, $\mathbf{b}$ is the output weight vector to be computed, and $\mathbf{T}$ is the target feature vector. Given a new input $\mathbf{x}$, the prediction function of ELM is $\mathbf{f}(\mathbf{x}) = \mathbf{Q}(\mathbf{x})\mathbf{b}$, where the $\mathbf{Q}(\mathbf{x})$ is the hidden layer feature mapping of $\mathbf{x}$. It has been pointed out in~\cite{huang2011extreme} that the training errors will be eliminated if the number of hidden nodes is not less than the number of training samples, indicating the trained ELM can be used as a fitting function that interpolates all training samples \begin{displaymath} \mathbf{Q}(\hat{\mathbf{h}}_i)\mathbf{b} = \hat{\mathbf{r}}_i, ~~ (i = 1, \cdots, N). \end{displaymath} In this case, the output weight vector is computed as \begin{displaymath} \mathbf{b} = \mathbf{H}^{T}(\mathbf{H}\mathbf{H}^{T})^{-1}\mathbf{T}, \end{displaymath} where $\mathbf{H}^{T}(\mathbf{H}\mathbf{H}^{T})^{-1}$ is the Moore-Penrose generalized inverse of $\mathbf{H}$. Regularized ELM is proposed in\cite{deng2009regularized} to improve its numerical stability, leading to the following training formula with $\lambda$ (a very small value in practice) as the regularization factor \begin{displaymath} \mathbf{b} = \mathbf{H}^{T}(\lambda + \mathbf{H}\mathbf{H}^{T})^{-1}\mathbf{T}. \end{displaymath} With the help of ELM, a kernel $\kappa^h_{i}(\cdot) \in \mathbb{R}^n$ for a human's landmark point $\hat{\mathbf{h}}_i$ can be built with its nearest neighbors. Specifically, we find $k$ spatial nearest neighbors of $\hat{\mathbf{h}}_i$ in the set of human's landmarks as $\{ \hat{\mathbf{h}}_j \}_{j \in \mathcal{N}(\hat{\mathbf{h}}_i)}$, where $\mathcal{N}(\cdot)$ denotes the set of nearest neighbors. Then, the ELM kernel of $\kappa^h_{i}(\cdot)$ is trained using $\{ ( \hat{\mathbf{h}}_j, \hat{\mathbf{r}}_j ) \}_{j \in \mathcal{N}(\hat{\mathbf{h}}_i)}$, which is regarded as an approximate local descriptor of the nearby mapping of $\hat{\mathbf{h}}_i$: $\mathcal{H} \mapsto \mathcal{R}$. When inputting a new human pose $\mathbf{h}^* \in \mathbb{R}^m$, a local estimation of mapping with reference to this kernel can be represented as \begin{displaymath} \kappa^h_{i}(\mathbf{h}^*)=\mathbf{Q}(\mathbf{h}^*) \mathbf{b}. \end{displaymath} This function is called a \textit{forward} kernel. Similarly, for each $C$-point ${r^m}_i$ of a humanoid, an ELM based kernel $\kappa^r_{i}(\cdot) \in \mathbb{R}^m$ can be constructed in the same way for the inverse mapping: $\mathcal{R} \mapsto \mathcal{H}$. $\kappa^r_{i}(\cdot)$ is called a \textit{backward} kernel. These two types of kernel functions will be used in our framework for realizing the projection. \subsection{Projection}\label{subsecFramework} For an input pose $\mathbf{h}^* \in \mathbb{R}^m$, the point determined by the ELM kernel function, $\kappa^h_{i}(\mathbf{h}^*)$, is not guaranteed to satisfy the requirement of bijective mapping (i.e., $\kappa^r_{i}(\kappa^h_{i}(\mathbf{h}^*)) \neq \mathbf{h}^*$). To improve the bijection of mapping, the projection of a human's $C$-point is formulated as determining an optimal point from all candidates generated from different forward kernels. \begin{figure}[t] \centering \includegraphics[width=\linewidth]{Framework} \caption{An illustration of finding an optimal point that minimizes a back-projected deviation (with $L=M=4$). } \label{figFramework} \end{figure} First of all, $L$ nearest neighbors of $\mathbf{h}^*$ are retrieved in $\mathcal{H}$ as $\{\hat{\mathbf{h}}_j\}$ ($j=1,\cdots,L$). From the forward kernel associated with each of these $L$ points in $\mathcal{H}$, a candidate point in $\mathcal{R}$ can be determined by $\mathbf{r}^c_j=\kappa^h_j(\mathbf{h}^*)$. For each $\mathbf{r}^c_j$, we search for its $M$ nearest neighbors in $\mathcal{R}$ as $\mathcal{N}(\mathbf{r}^c_j)=\{\hat{\mathbf{r}}_{j,k}\}$ ($k=1,\cdots,M$). In other words, there are $M$ backward kernels associated with $\mathbf{r}^c_j$, which are $\{ \kappa^r_{j,k}\}$. In each cluster of backward kernels, we determine a set of weights $w_{j,k}$ that leads to a point formed as the convex combination of $\{\hat{\mathbf{r}}_{j,k}\}$ \begin{displaymath} \tilde{\mathbf{r}}^c_j = \sum_{k} w_{j,k} \mathbf{r}^c_{j,k}. \end{displaymath} An optimal point $\tilde{\mathbf{r}}^c_j$ minimizes the deviation of back-projection with regard to the cluster of kernels $\{\kappa^r_{j,k}(\cdot)\}_k$ is defined as \begin{equation} \label{eqSubFunction} \begin{aligned} &\min_{w_{j,k}} \{ \| \kappa^r_{j,k} (\sum_{k} w_{j,k} \mathbf{r}^c_{j,k}) - \mathbf{h}^* \| \}_k, \\ s.t. \quad & \sum_{k=1}^M w_{j,k} = 1, ~~ w_{j,k} \geq 0. \end{aligned} \end{equation} The final projected point $\mathbf{r}^*$ is then defined as \begin{equation} \label{eqCoreFunction} \mathbf{r}^* = \sum_{k} w_{l,k} \mathbf{r}^c_{l,k} \end{equation} according to the cluster of $\mathcal{N}(\mathbf{r}^c_l)$ that gives the minimal back-projected deviation, which is a solution of \begin{equation}\begin{aligned}\label{eqCoreFunction2} & \min_j \left\{ \min_{w_{j,k}} \{ \| \kappa^r_{j,k} (\sum_{k} w_{j,k}\mathbf{r}^c_{j,k}) - \mathbf{h}^* \| \}_k \right\}, \\ s.t. \quad & \sum_{k=1}^M w_{j,k} = 1, ~~ w_{j,k} \geq 0. \end{aligned}\end{equation} The computation for solving above optimization problem can be slow in many cases. Therefore, we propose a sub-optimal objective function as a relaxation of Eq.(\ref{eqCoreFunction2}) to be used in real-time applications (e.g., the tele-operation shown in Fig.\ref{figTeleoperation}). The problem is relaxed to \begin{equation} \min_j \left\{ \min_{k} \{ \| \kappa^r_{j,k} (\mathbf{r}^c_{j}) - \mathbf{h}^* \| \}_k \right\}, \end{equation} the solution of which can be acquired very efficiently by checking each candidate $\mathbf{r}^c_j$ with regard to all its $M$ reference backward kernels. Figure \ref{figFramework} gives an illustration for the evaluation of back-projected deviation. \vspace{5pt} \noindent \textbf{Motion Smoothing:} A dynamic motion is processed as a sequence of continuous poses in our system, where the projected poses in the configuration space of humanoid are generated separately. To avoid the generation of jerky motion, we use a method modified from the double exponential smoothing~\cite{laviola2003double} to post-process the projected poses. Given a projected pose $\mathbf{r}_t$ at time frame $t$, the update rules of a smoothed pose $\mathbf{s}_t$ are defined as \begin{equation} \begin{aligned} & \mathbf{s}_t = \alpha y_t + (1-\alpha)(\mathbf{s}_{t-1} + \mathbf{b}_{t-1}), ~~ 0 \leq \alpha \leq 1 \\ & \mathbf{b}_t = \gamma (\mathbf{s}_t - \mathbf{s}_{t-1}) + (1 - \gamma) \mathbf{b}_{t-1}, ~~ 0 \leq \gamma \leq 1 \\ & \mathbf{s}_t = \mathbf{s}_{t-1}, ~\text{if} ~\|\mathbf{s}_t - \mathbf{s}_{t-1}\| < \eta \end{aligned} \end{equation} $\alpha$, $\gamma$ and $\eta$ are parameters to control the effectiveness of smoothing, where $\alpha=0.75$, $\gamma=0.3$ and $\eta=0.15$ are used to give satisfactory results in our practice. \vspace{5pt} \noindent \textbf{Remark:} It must be clarified the \textit{Identity} property introduced in Section \ref{subsecProblem} is relaxed to $\Omega(h_i) \approx r_i$ in practice due to the following reasons: \begin{itemize} \item Regularized ELM method is employed to construct the kernels, which changes the corresponding energy function where a regularization term is added to improve its numerical stability. \item Double exponential smoothing is applied for smoothing a motion, which introduces minor adjustments on the output values. \end{itemize} \begin{figure} \centering \includegraphics[width=0.9\linewidth]{Skeleton} \caption{Feature vectors of human and humanoid: (a) the human skeleton from a Kinect sensor, (b) the corresponding pose descriptor of a human body consists of $19$ unit vectors, and (c) the pose descriptor for a NAO humanoid formed by all DOFs on its joints (source: http//:www.ez-robot.com).} \label{figSkeleton} \end{figure} \section{Real-time Projection on NAO} \label{secReconstruction} Our framework is testified on real-time motion imitation of a NAO humanoid robot with a Kinect RGB-D camera as the device to capture the motion of human. \subsection{Human-to-humanoid Motion Imitation} The human skeleton provided by a Kinect sensor is a set of line segments based on predefined key joints as shown in Fig.\ref{figSkeleton}(a). We define an abstraction consisting of $19$ unit vectors for a pose as illustrated in Fig.\ref{figSkeleton}(b), which is independent different body dimensions. It should be pointed out that it is unnecessary to always use the full set of unit vectors unless full body motion must be sensed. The NAO humanoid robot has 26 degree-of-freedoms, including the roll, pitch, and yaw of all its joints (see Fig.\ref{figSkeleton}(c)). Posing a NAO humanoid can be executed by specifying the values of all its degree-of-freedoms. To collect the data-set of human's motion, a user is asked to do arbitrary motion in front of a Kinect camera. Meanwhile, we have implemented a straightforward \textit{inverse kinematics} (IK) based scheme for upper-body motion. The roll, pitch, and yaw of every joint can be computed directly by the unit vectors of a human's skeleton model. After using mean shift to extract the landmarks of motion from the raw set, their corresponding landmark poses in the $C$-space of humanoid can be generated by this IK. Besides, we also define \textit{eight} basic poses (see Fig.\ref{figBasicPoses}) which play a critical role when evaluating the similarity between the projected poses of humanoid and the poses of human. \begin{figure}[t]\centering \includegraphics[width=\linewidth]{BasicPoses} \caption{Basic poses serve as benchmarks for similarity evaluation.}\label{figBasicPoses} \end{figure} Using the landmark poses defined in this way, human-to-humanoid motion imitation has been implemented by a single-core C++ program. All the tests below are taken on a personal computer with Intel Core i7-3770 3.4 GHz and 8 GB RAM memory. \subsection{Experimental Results} We evaluate our method mainly from three perspectives, including the computational efficiency of projection, the quality of reconstructed motion, and the influence by the size of landmark set. \vspace{5pt}\noindent \textbf{Efficiency of Projection:} From Section \ref{subsecFramework}, we know that the complexity for computing projection depends on the size of neighbors (i.e., $L$ and $M$). The cost of computation increases with larger $L$ and $M$ as more candidates and more reference kernels will be involved. In all our experiments, we use $L = M = 10$ and the average time for making a configuration projection is $0.00273ms$. When increasing to $L = M = 50$, the average time cost is still only $0.0201ms$. In summary, the overhead of our method for motion imitation is very light -- i.e., it fits well for different real-time applications. \begin{figure*} \centering \includegraphics[width=\linewidth]{PoseReconstruct} \caption{Eight basic poses are reconstructed by our method (left of each pair) and compared with the ground truth (right of each pair). The similarity metrics, $M_{max}$ and $M_{avg}$, of each pair are also reported. The evaluation is taken on a projection defined by using $1,644$ landmark pairs.}\label{figPoseReconstruct} \end{figure*} \begin{figure*} \centering \includegraphics[width=\linewidth]{Statistics} \caption{Statistics in eight motions for the change of two metrics: $M_{max}$ (blue) and $M_{avg}$ (red). The evaluation is also taken on a projection with $1,644$ landmark pairs.} \label{figStatistics} \end{figure*} \vspace{5pt}\noindent \textbf{Quality of Reconstruction:} Two metrics are used in our experiments to estimate the quality of a projected configuration $\mathbf{r}^* \in \mathbb{R}^{n}$ referring to its corresponding ground truth value $\mathbf{r}_{gt}$ -- the maximum absolute deviation in degree as \begin{displaymath} M_{max} = \frac{180^{\circ}}{\pi} \|r^* - r_{gt}\|_{\infty}, \end{displaymath} and the average absolute deviation in degree as \begin{displaymath} M_{avg} = \frac{1}{n} \left( \frac{180^{\circ}}{\pi}\|r^* - r_{gt}\|_1 \right). \end{displaymath} The evaluation is taken with a set holding $1,644$ configuration pairs as landmarks. All those eight poses shown in Fig.\ref{figBasicPoses} are tested, and the results are shown in Fig.\ref{figPoseReconstruct}. The results of comparison (in terms of $M_{max}$ and $M_{avg}$) indicates that the poses generated by our method share good similarity with the ground truths. Besides of static poses, we also evaluate the quality of reconstructed motion in the $C$-space of humanoid as a sequence of poses. We define eight basic motion sequences, each of which starts from the rest pose and ends at one of the basic poses. The complete human motions are recorded for the reconstruction using our projection in the $C$-space of humanoid. The projected poses are compared with the poses generated by IK, serving as the ground truths. The values of $M_{max}$ and $M_{avg}$ in these eight motions are shown in Fig.\ref{figStatistics}. It is easy to find that the errors are bounded to less than $10^{\circ}$ in all motions. \begin{figure}[t] \centering \includegraphics[width=\linewidth]{Size} \caption{To reconstruct motion using landmark sets having different number of corresponding samples, statistics indicate that more landmark pairs lead to better results.}\label{figSize} \end{figure} \vspace{5pt}\noindent \textbf{Size of Landmarks:} As presented in Section \ref{subsecPreprocessing}, the correspondence samples used to formulate projection in our framework is extracted from the captured motions. In our implementation, it is generated by a user moving in front of a Kinect sensor for 5 minutes. Then, three sets with different number of landmarks ($1,644$, $961$, and $86$ respectively) are extracted. The corresponding pairs of poses are then constructed with the help of IK. The 8-th pose in Fig.\ref{figBasicPoses} -- POSE\_8 and the motion from the rest pose to POSE\_8 are constructed from the projections defined on the sets with different number of landmarks. From the statistics and comparisons shown in Fig.\ref{figSize}, it is easy to conclude that our projection based formulation converges when the number of landmarks increases. In other words, more landmarks result in a more accurate projection. However, it should also be noted that the projection from the smaller set may still be useful in some applications with low requirement on quality but having more restrictions on speed and memory usage. \subsection{Application of tele-operation} We have tested the motion imitation realized by our method in an application of tele-operation using a NAO humanoid. As illustrated in Fig.\ref{figTeleoperation} and the supplementary video of this paper, a user can remotely control the motion of a NAO robot to grasp an object and put it into a box. The scene that can be seen from the camera of NAO is displayed on a screen placed in front of the user as the visual feedback. The imitation realized by our system has good accuracy. As a result, the tele-operation can be performed very smoothly. \section{Conclusion \& Future Work} \label{secConclusion} In this paper, we have proposed a framework to realize motion imitation. Different from conventional methods, our method is based on a novel formulation of projection between two configuration spaces with different dimensions. Given a new input pose of human, its projection in the space of humanoid is defined as finding the optimal $C$-point that minimizes a back-projection deviation referring to the built kernels. We have validated our idea by reconstructing humanoid motion on a NAO robot. The experimental results are encouraging and motions of good quality can be reconstructed efficiently. There are several potential improvements can be made to our method. First, an intuitive improvement is to extend the current setup to full-body motion reconstruction by incorporating the constraint of whole-body balance. Second, the ELM based kernels currently used in our framework do not have a explicit bound for prediction with a new input. Finding kernel functions that can provide a bound on prediction could be another future work. Lastly, we are interested in exploring more applications beyond tele-operation. \bibliographystyle{IEEEtran}
{'timestamp': '2016-07-26T02:11:48', 'yymm': '1607', 'arxiv_id': '1607.04907', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04907'}
arxiv
\section{Introduction} Structure-from-Motion targets at recovering 3D structure and camera motion from monocular 2D feature tracks. Conventional SFM primarily concerns with the 3D reconstruction of a single rigidly moving object seen by a static camera, or a static and rigid scene observed by a moving camera --in both cases there are only one relative rigid motion involved. SFM has been extended to the areas of {\em multi-body} SFM, as well as {\em single body} {non-rigid SFM} (see Table.\ref{tab:summary} for a classification of different SFM problems). Since, NRSFM is central to many computer vision applications such as motion capture, activity recognition, human-computer interaction, and dynamic scene reconstruction, etc. Therefore, it has been extensively researched (e.g. in \cite{Bregler:CVPR-2000}\cite{Xiao-Chai-Kanade:ECCV-2004}\cite{Akhter-Sheikh-Khan-Kanade:Trajectory-Space-2010}\cite{Dai-Li-He:CVPR-2012}\cite{Dense-NRSFM:CVPR-2013}\cite{PND-Mixture-Model:IJCV-2016}) in the past. So far, all existing methods for NRSFM have implicitly assumed that there is only one deformable shape or object in the view. However, the real world scenarios can be much more complicated involving multiple, independently deforming objects in the scene. Multiple nonrigid objects are commonly encountered in our daily lives, for example, in motion capture, multiple persons perform different activities with possible interactions (see Fig.~\ref{fig:multiple_nonrigid} for an example); in human-computer interaction, different users may conduct different gesture commands; and in traffic scene, multiple vehicles and walking pedestrians create {\bf multi-body non-rigid deformations}. To handle such multiple non-rigid deformations in 3D reconstruction, a natural idea would be to simply treat the multiple non-rigid deformations as a single (though more complex) non-rigid deformation (with higher order or higher rank), and then apply any state-of-the-art non-rigid structure-from-motion methods such as \cite{Dai-Li-He:CVPR-2012}\cite{Procrustean-Normal-Distribution:CVPR-2013}. However, by this idea, the inherent structure in the problem has not been exploited, which may hinder the success of 3D reconstruction. Even if the method succeeds in obtaining 3D reconstruction, it cannot tell meaningful segmentation of the multiple non-rigid objects. Another choice would be conducting the tasks of non-rigid motion segmentation \cite{SSC:PAMI-2013} and non-rigid 3D reconstruction \cite{Dai-Li-He:CVPR-2012} successively. However, in this way, the solution of each sub-task does not benefit from the solution of the other sub-task. For example, non-rigid motion segmentation provides critical information to correct non-rigid 3D reconstruction while non-rigid 3D reconstruction constrains the corresponding multi-body motion segmentation. Therefore, we would like to emphasize that since non-rigid deformation originally occurs in 3D space, it's more intuitive to perform non-rigid motion segmentation and reconstruction simultaneously in 3D space rather than solving this problem using two step process. {\small \begin{table*}[h!] \caption{A classification of different SFM problems defined by the number of objects and the rigidity of each object. This paper aims to fill in the currently missing work of {\bf Multi-body Non-rigid SFM} shown in blue.\label{tab:summary}}\vspace{-0.15in} \center \resizebox{1.0\linewidth}{!} {\small \begin{tabular}{|l||c|c|} \hline & Single body & Multi-body\\\hline\hline Rigid & \begin{tabular}{@{}c@{}} Single-body Rigid SFM \cite{Tomasi:IJCV-1992} \\ $\m W_{2\m F\times \m P} = \m R_{2\m F\times 3} \m S_{3\times \m P}, \mbox{\rm rank}(\m S) = 3$ \end{tabular} & \begin{tabular}{@{}c@{}} Multi-body Rigid SFM \cite{Multi-body-Rigid:IJCV-1998}\cite{Yan-Pollefeys:PAMI-2008} \\ $\m W_{2\m F\times \m P} = \m R_{2\m F\times 3\m F} \m S_{3\m F\times \m P}, \mbox{\rm rank}(\m S) = 3\m K $ \end{tabular} \\ \hline Non-rigid & \begin{tabular}{@{}c@{}} Single-body Non-rigid SFM \cite{Bregler:CVPR-2000} \\ $\m W_{2\m F\times \m P} = \m R_{2\m F\times 3\m F} \m S_{3\m F\times \m P}, \mbox{\rm rank}(\m S) = 3\m K$ \end{tabular} & \begin{tabular}{@{}c@{}} \textcolor{blue}{Multi-body Non-Rigid SFM}\\ \textcolor{blue}{$\m W_{2\m F\times \m P} = \m R_{2\m F\times 3\m F} \m S_{3\m F\times \m P}, \m S = \m S \m C$. i.e, } \\ \textcolor{blue}{3D trajectory should lie in union of linear/affine subspace.} \end{tabular} \\ \hline \end{tabular} } \label{tab:multi-scal} \end{table*}} \begin{figure}[!htp] \begin{center} \subfigure[\label{fig:dance_yoga_2D_1}]{\includegraphics[width=0.24\linewidth]{Figures/Image1.png}} \subfigure[\label{fig:dance_yoga_2D_2}]{\includegraphics[width=0.24\linewidth]{Figures/Image2.png}} \subfigure[\label{fig:dance_yoga_3D_1}]{\includegraphics[width=0.24\linewidth]{Figures/3DImage1.png}} \subfigure[\label{fig:dance_yoga_3D_2}]{\includegraphics[width=0.24\linewidth]{Figures/3DImage2.png}} \end{center} \caption{\small Illustration of complex multi-body non-rigid 3D reconstruction, where two persons perform different activities (Dancing and Yoga \cite{Akhter-Sheikh-Khan-Kanade:Trajectory-Space-2010}). Given the multi-frame 2D feature tracks as input, our method simultaneously outputs the 3D non-rigid reconstruction and the segmentation of the track trajectory in 3D. (a) First frame of the 2D track; (b) Second frame of the 2D track; (c) 3D reconstruction and segmentation of (a) using our method, where different colors index shows the corresponding segmentation; (d) Similarly, 3D reconstruction and segmentation of (b). } \noindent\makebox[\linewidth]{\rule{0.83\paperwidth}{0.4pt}} \label{fig:multiple_nonrigid} \end{figure} \begin{figure} \centering \subfigure[\label{fig:multi_object3}] {\includegraphics[width=0.40\textwidth]{Figures/recons_seg_multi_class.png}} \subfigure[\label{fig:diag_multi3}] {\includegraphics[width=0.40\textwidth]{Figures/diagonal_multi_class.png}} \caption{(a) Three subjects are performing actions such as stretch(red), dance(cyan) and yoga(green). Our approach is able to reconstruct and segment each action faithfully with reconstruction error of 0.0413 and 0 segmentation error. Here, different color corresponds to segmentation with dark and light color circles for each subject shows ground-truth and reconstructed 3D coordinates respectively. (b) Obtained block diagonal matrix.} \noindent\makebox[\linewidth]{\rule{0.83\paperwidth}{0.4pt}} \label{fig:result_3object} \end{figure} To demonstrate the advantage of the concurrent procedure as shown in Fig. \ref{fig:flow_diagram} and Table \ref{tab:summary}, this paper introduces an approach to perform non-rigid 3D reconstruction and its motion segmentation simultaneously. Specifically, we represent the multiple non-rigid motion as union of 3D trajectory subspaces \footnote{Zhu \etal \cite{Union_Subspaces:CVPR-2014} used the union of subspaces representation (different non-rigid deformations lie in different subspaces), where the subspace is defined in shape space contrast to our trajectory space. As we will show later, this difference provides uniqueness of our formulation in dealing with multiple non-rigid deformation and in dealing with dense case.}. By using the self-expressiveness model in representing multiple linear/affine subspace, where each 3D trajectory can be expressed with other trajectories in the same subspace only, enables us in compact representation of trajectories. In this way, we are able to exploit the inherent grouping structure in \emph{3D trajectory space}. For dense non-rigid reconstruction, we could further enforce the spatial coherence constraint. By contrast to existing methods, this endows us the following benefits: \begin{enumerate}[(i)] \item A compact representation for component non-rigid deformation in 3D trajectory space; \item Joint multiple deformable objects motion segmentation and 3D non-rigid structure reconstruction; \item Improved spatial regularity in 3D non-rigid dense reconstruction (in contrast, a hard segmentation of the 2D tracks may result in discontinuity at the segmentation boundary). \end{enumerate} The readers are invited to have a preview of results obtained by our method, as shown in Fig.~\ref{fig:multiple_nonrigid}, where we show a daily life motion capture of two person performing dancing and yoga individually as in Fig.~\ref{fig:dance_yoga_2D_1} and Fig.~\ref{fig:dance_yoga_2D_2}. Similarly, in Fig.~\ref{fig:result_3object} three different person are performing stretch, dance and yoga. By applying our proposed method, we are able to achieve both non-rigid 3D reconstruction and non-rigid motion segmentation as shown in Fig.~\ref{fig:dance_yoga_3D_1}, Fig.~\ref{fig:dance_yoga_3D_2} and Fig.~\ref{fig:multi_object3}. \paragraph{Contributions:} (1) This paper is first to model multiple non-rigid deformations as points in the union of multiple affine 3D trajectory subspace. This enables us to jointly solve the non-rigid reconstruction and non-rigid motion segmentation problems in 3D trajectory space; (2) Our formulation can handle both sparse and dense multiple non-rigid reconstruction problems uniformly; (3) We propose an efficient optimization procedure based on ADMM. \section{Related Work} Ever since the seminal work by Bregler \etal \cite{Bregler:CVPR-2000} modeling a non-rigid shape as lying in a ``\emph{shape space}'' (a linear combination of basis shapes), considerable progress has been made in the area of non-rigid 3D reconstruction. In 2004, Xiao \etal \cite{Xiao-Chai-Kanade:ECCV-2004} showed the inherent ambiguity in modeling non-rigid shape and proposed a remedy of ``basis constraints'' to derive a closed-form solution. In 2008, Akhter \etal \cite{Akhter-Sheikh-Khan-Kanade:Trajectory-Space-2010} presented a dual approach by modeling 3D trajectories, \ie ``\emph{trajectory space}''. In 2009, Akhter \etal \cite{Defence-orthonormality:CVPR-2009} proved that even there is an ambiguity in shape bases or trajectory bases, non-rigid shapes can still be solved uniquely without any ambiguity. Based on this, in 2012, Dai \etal \cite{Dai-Li-He:CVPR-2012} proposed a ``prior-free'' method to recover camera motion and 3D non-rigid deformation by exploiting the low rank constraint only. Besides shape basis model and trajectory basis model, the shape-trajectory approach \cite{Complementary-rank-3:CVPR-2011} combines two models and formulates the problems as revealing trajectory of the shape basis coefficients. Besides linear combination model, Lee \etal \cite{Procrustean-Normal-Distribution:CVPR-2013} proposed a Procrustean Normal Distribution (PND) model, where 3D shapes are aligned and fit into a normal distribution. Simon \etal \cite{Spatiotemporal-Priors:ECCV-2014} proposed to exploit the Kronecker pattern in the shape-trajectory (spatial-temporal) priors. Zhu and Lucey \cite{Convolutional-Sparse-Coding-Trajectory:PAMI-2015} applied the convolutional sparse coding technique to NRSFM using point trajectories. However, the method requires to learn an over-complete basis of 3D trajectories, prior to performing 3D reconstruction. Despite of the above success, NRSFM is still far behind its rigid counterpart. This is mainly due to difficulty in modeling real world non-rigid deformation. Real world non-rigid reconstruction generally requires the ability to handle long-term, complex and dense non-rigid shape variations. Such complex and dense non-rigid motion not only increases the computational complexity but also adds difficulty in modeling various kinds of different motions. Zhu \etal \cite{Union_Subspaces:CVPR-2014} proposed to represent long-term complex non-rigid motion as lying in a union of shape sub-spaces rather than sum of sub-spaces. Cho \etal \cite{PND-Mixture-Model:IJCV-2016} represented complex shape variations probabilistically by a mixture of primitive shape variations. By contrast to the above methods dealing with sparse NRSFM, dense NRSFM methods such as \cite{Dense-NRSFM:3DIMPVT-2012}\cite{Dense-NRSFM:CVPR-2013}\cite{Video-Registration:IJCV-2013}\cite{Video-Pop-Up:ECCV-2014} aim at achieving 3D reconstruction for each pixel in a video sequence, where spatial constraint has been widely exploited to regularize the problem. Garg \etal \cite{Dense-NRSFM:CVPR-2013} presented a variational formulation to dense non-rigid reconstruction by exploiting the spatial smoothness in 3D shapes, which in principle deals with single non-rigid deformation in contrast to our multiple non-rigid deformations. Fragkiadaki \etal \cite{Grouping-Trajectory-Reconstuction:NIPS-2014} solved the problem in sequel, namely, video segmentation by multi-scale trajectory clustering, 2D trajectory completion, rotation estimation and 3D reconstruction. Recently, Yu \etal \cite{Direct-Dense-Deformable:ICCV-2015} bridges template based method and feature track based method by proposing a dense template based direct approach to deformable shape reconstruction from monocular sequences. Russell \etal \cite{Video-Pop-Up:ECCV-2014} proposed to simultaneously segment a complex dynamic scene containing mixture of multiple objects into constituent objects and reconstruct a 3D model of the scene by formulating the problem as hierarchical graph-cut based segmentation, where the entire scene is decomposed into background and foreground objects and the complex motion of non-rigid or articulated objects are modeled as a set of overlapping rigid parts. Our proposed method differs from this method in the following aspects: 1) We provide a compact representation to multiple non-rigid deformation problem; 2) We propose an efficient and elegant optimization based on ADMM; 3) Our method could deal with both sparse and dense scenarios elegantly. \section{Formulation} We seek to reconstruct the 3D trajectories such that they satisfy the union of affine subspace constraint (\ie the 3D trajectories lie in a union of affine subspaces) and non-rigid shape constraints (low rank and spatial coherent). Let us consider a monocular camera observing multiple non-rigid objects. In this paper, we use the $orthographic$ $camera$ model and eliminate the translation component in camera motion as suggested in \cite{Bregler:CVPR-2000}. The image measurement $\m w_{ij} = [u_{ij}, v_{ij}]^T$ and 3D point $\m S_{ij}$ on the non-rigid shape are related by the camera motion $\m R_i$ as: $\mathbf{w}_{ij} = \m R_i \m{S}_{ij}$, where $\m R_i \in \mathbb{R}^{2\times 3}$ denotes the first two rows of the $i$-th camera rotation. Under this representation, stacking all the $\m F$ frames of measurements and all the $\m P$ points in a matrix form will give us: \begin{equation} \label{eq:motion_shape} \m W = \m R \m S, \end{equation} where $\m R = \mathrm{blkdiag}(\m R_1,\cdots,\m R_F) \in \mathbb{R}^{2\m F\times 3\m F}$ denotes the camera motion matrix. NRSFM aims at recovering the \emph{camera motion} $\m R$ and 3D non-rigid reconstruction $\m S \in \mathbb{R}^{3\m F\times \m P}$ from the 2D \emph{measurement matrix} $\m W \in \mathbb{R}^{2\m F \times \m P}$ such that $\m W=\m R\m S$. \subsection{Representing multi-body non-rigid structure as a union of affine subspace} We propose that multiple non-rigid structures that corresponds to distinct motion lies in a union of affine subspace. Here, the underlying assumption is that the trajectories belong to different non-rigid objects spans a distinct affine subspace. Figure \ref{fig:A_algo} clearly validates such assumption as there are only connection within clusters and no connection between clusters or block diagonal structure. Now, consider each trajectory $\m S_i$ that corresponds to a $3 \m F$ dimensional vector formed by stacking the 3D feature tracks of point $i$ across all frames. \begin{equation} \m S_i = [\m S_{1i}^T, \m S_{2i}^T, ..., \m S_{\m Fi}^T]^T \in \mathbb{R}^{3\m F}, \end{equation} where $\m S_{fi}$ $\in $ $\mathbb{R}^3$. Under the orthographic camera model, feature trajectory associated with non-rigid motion lie in an affine subspace of dimension $\mathbb{R}^{3 \m F}$. After taking $\m P$ such $3\m F$ dimensional trajectory and stacking into the column of a matrix we form $\m S$ matrix $\in $ $\mathbb{R}^{3\m F \times \m P}$. Mathematically, it implies that $\m S$ is a real valued matrix whose columns are drawn from a union of $n$ subspace of $\mathbb{R}^{3\m F}$ of dimension less than min($3\m F$, $\m P$). Therefore, each trajectory in a union of affine subspace could be faithfully reconstructed by a combination of other trajectories in the same subspace. This leads to $self$-$expressiveness$ of 3D trajectories. Concretely, \begin{equation} \m S_i = \m S \m C_i, \m C_{ii} = 0. \end{equation} \begin{figure} \centering \includegraphics[width=0.6\textwidth] {Figures/Trajectory_Space_Intuition.pdf}~~~ \caption{Visual illustration of the affine subspace constraint $\m S_i$ = $\m S$ $\m C_i$ for multi-body NRSFM. Each column of $\m S$ is a trajectory of a 3D point(shown in green). This visualization tries to state that a trajectory $\m S_i$ can be reconstructed using affine combination of few other trajectories(sparse). $Note :$ This pictorial representation is provided for better understanding and is only for illustration purpose, signals shown here are not generated mathematically. } \label{fig:S_Sci} \end{figure} Here, $\m C_i$ is a $\m P \times 1$ coefficient vector and $\m C_{ii}$ = $0$ takes care of the trivial solution $\m S_i = \m S_i$. Stacking all such coefficient vectors, we form a matrix $\m C \in \mathbb{R}^{\m P \times \m P}$ that captures the similarity between different trajectories. Using the fact that any trajectory of $\m S$ in an affine subspace of dimension $3\m F$ can be written as affine combination of $3 \m F + 1$ other points from $\m S$ and to cluster trajectories that lies near to union of affine subspaces, we arrive at the following equation. \begin{equation} \label{eq:SSC_constraints} \m S = \m S \m C, \m 1^T \m C = 1^T, \mathrm{diag}(\m C) = 0. \end{equation} Figure \ref{fig:Union of Subspace representation} shows the affinity matrix $\m A = |\m C| + |\m C^T|$ obtained for two objects that undergo non-rigid deformation. The obtained sparse solution clearly shows that multi-body non-rigid structure can be represented as union of affine subspace. \begin{figure}[!htp] \begin{center} \subfigure[\label{fig:affine_s}]{\includegraphics[width=0.32\linewidth]{Figures/affine_subspace1.png}} \subfigure[\label{fig:A_algo}]{\includegraphics[width=0.32\linewidth]{Figures/CMatrix_Dance_Yoga1.png}} \subfigure[\label{fig:A_clean}]{\includegraphics[width=0.32\linewidth]{Figures/CMatrix_Dance_Yoga_Clean.png}} \end{center} \caption{\small (a) Two subjects performing different non-rigid motion that are dance and yoga. Red and green color shows the entire trajectory of each objects over $F$ frames. (b) Visualisation of the affinity matrix obtained using our formulation. (c) Clean affinity matrix obtained after incorporating spectral clustering \cite{Spectral-Clustering:NIPS-2001}. } \label{fig:Union of Subspace representation} \noindent\makebox[\linewidth]{\rule{0.83\paperwidth}{0.4pt}} \end{figure} \subsection{Representing multiple non-rigid deformations in case of sparse feature tracks} To solve the problem of multi-body NRSFM in case of sparse feature tracks, we propose the following optimization framework for simultaneous reconstruction and segmentation of objects that are undergoing non-rigid deformation, \begin{equation} \begin{aligned} & \displaystyle \underset{\m C, \m S, \m S^{\sharp}} {\text{minimize}} \frac{1}{2}\|\m W - \m R \m S \|_F^2 + \lambda_1\|\m C\|_1 + \lambda_2\|\m S^{\sharp}\|_{*} \\ & \text{{subject to: }} \\ & \displaystyle \m S^{\sharp} = g(\m S), \displaystyle \m S = \m S \m C, \displaystyle \m 1^{T} \m C = \m 1^{T}, \displaystyle \mathrm{diag}(\m C) = \m 0. \end{aligned} \label{eq:sparse_version} \end{equation} The first term in the above optimization is meant for penalizing reprojection error under $orthographic$ projection. Under single-body NRSFM configuration, 3D shape $\m S$ can be well characterized as lying in a single low dimensional linear subspace. However, when there are multiple non-rigid objects, each non-rigid object could be characterized as lying in an affine subspace. One can argue that affine subspace of dimension $n$ can be considered as a subset of $(n+1)$ dimension that includes origin. Nonetheless, such representation may result in ambiguous solution while clustering different subspace. The fact that the 3D trajectories lie in a union of affine subspaces as argued previously we put the Eq.~\ref{eq:SSC_constraints} as our optimization constraints. In addition to this, to reveal the intrinsic structure of multi-body non-rigid structure-from-motion (NRSFM), we seek for sparsest solution of $\m C$ (\cite{SSC:PAMI-2013}). So, the second term in {\bf{Eq.}} \eqref{eq:sparse_version} enforces $l_1$ norm minimization of $\m C$ matrix. Lastly, we enforce a global shape constraint for compact representation of multi-body non-rigid objects by penalizing the rank of entire non-rigid shape. Similar to \cite{Dai-Li-He:CVPR-2012} and \cite{Dense-NRSFM:CVPR-2013}, we penalize the nuclear norm of reshuffled shape matrix $\m S^{\sharp} \in \mathbb{R}^{\m F\times 3 \m P}$, this is because nuclear norm is known as convex envelope of the rank function. Here, $\m g(\m S)$ denotes mapping from $\m S$ $\in$ $\mathbb{R}^{3\m F\times \m P}$ to $\m S^\sharp$ $\in$ $\mathbb{R}^{\m F\times 3 \m P}$. \subsection{Representing multi-body non-rigid deformations in case of dense feature tracks} When per pixel feature tracks are available, we can enforce spatial regularization ($Markovian$ $assumption$) i.e there will be a high correlation between neighbouring features. To exploit this property, the spatial smoothness can be used as a regularization term to further constrain the non-rigid reconstruction. Garg \etal \cite{Dense-NRSFM:CVPR-2013} proposed to use the total variation of the 3D shape $\|\m S\|_{TV}$. By contrast, we propose to enforce the spatial smoothness constraint on the coefficient matrix $\m C$ directly by using the $l_1$ norm, \begin{equation} \label{eq:C_TV} \sum_{(i,j) \in \mathcal{N}} \|\m C_i - \m C_j\|_1, \end{equation} \ie, the total variation of $\m C$. This definition gives us the benefit in solving the problem as proved later. In essence, the total variations of $\m C$ and $\m S$ are correlated. However, it is desirable that $\m C$ matrix must cater the self-expressiveness of the non-rigid shape deformation as compact as possible. So, we incorporate spatial smoothness constraint on coefficient matrix than on shape matrix $\m S$. By introducing an appropriately defined matrix $\m D$ encoding the neighbouring relation, Eq.~\eqref{eq:C_TV} can be equivalently expressed as: \begin{equation} \|\m C \m D \|_1 = \sum_{(i,j) \in \mathcal{N}} \|\m C_i - \m C_j\|_1. \label{eq:C_D} \end{equation} In {{Fig.}} \ref{fig:DMatrix_exp}, we illustrate the process of how to obtain the matrix $\m D$. \begin{figure} \centering \includegraphics[width=0.6\textwidth] {Figures/Dmatrix_explanation.pdf}~~~ \caption{D matrix caters the neighboring trajectory relation. In the above illustration $\m P_2$, $\m P_4$, $\m P_6$, $\m P_8$, are the 4 immediate neighboring trajectories of $\m P_5$. Therefore, corresponding elements of $\m D$ matrix has $\m -1$ entries, $\m P_5$ has value $\m 1$ and the rest entries are $\m 0$. Therefore, the corresponding coefficient column of $\m C$ matrix now rely on relations defined in the $\m D$ matrix. Here, $\m C$ and $\m D$ are $\m P \times \m P$ and $\m P \times \m 4\m P$ matrix respectively. Where, $\m P$ is the number of total feature tracks. For handling the border pixels one can think of zero padding techniques in 2D image and add zero column vector to the corresponding pixel index in D matrix.} \label{fig:DMatrix_exp} \end{figure} Adding the spatial constraint to the optimization equation \eqref{eq:sparse_version}, that facilitates this neighboring constraint, we procure the following optimization for dense tracks \begin{equation} \begin{aligned} & \displaystyle \underset{\m C, \m S, \m S^{\sharp} }{\text{minimize}}~ \frac{1}{2}\|\m W - \m R \m S \|_F^2 + \lambda_1\|\m C\|_1 + \lambda_2 \| \m C\m D \|_1 + \lambda_3\|\m S^{\sharp}\|_{*} \\ & \text{{subject to:}} \\ & \displaystyle \m S^{\sharp} = g(\m S), \displaystyle \m S = \m S \m C, \displaystyle \m 1^{T} \m C = \m 1^{T}, \displaystyle \mathrm{diag}(\m C) = \m 0. \end{aligned} \label{eq:Optimization_function} \end{equation} \section{Solution} Due to the bilinear term $\m S = \m S \m C$, the overall optimization of Eq.-\eqref{eq:Optimization_function} is non-convex. We solve it via the ADMM, which has a proven effectiveness for many non-convex problems and is widely used in computer vision. The ADMM works by decomposing the original optimization problem into several sub-problems, where each sub-problem can be solved efficiently. To this end, we seek to decompose Eq.-\eqref{eq:Optimization_function} into several sub-problems. First note that the two $l_1$ terms $\|\m C\|_1$ and $\|\m C \m D\|_1$ can be put together as $\|\m C [\m I ~\m D]\|_1$. Without loss of generality, we still denote the new term as $\m C \m D$, the only difference is, the new dimension of $\m D$ will be $\m P \times 5\m P$, thus the cost function becomes: $\frac{1}{2} \|\m W - \m R \m S \|_F^2 + \lambda_1\|\m C \m D \|_1 + \lambda_2\|\m S^{\sharp}\|_{*} $. To further decouple the constraint, we introduce an auxiliary variable $\m E = \m C \m D$. With these operations, the optimization problem Eq.-\eqref{eq:Optimization_function} can be reformulated as: \begin{equation} \begin{aligned} & \displaystyle \underset{\m E, \m S, \m S^{\sharp}, \m C} {\text{minimize}} ~\frac{1}{2}\|\m W - \m R \m S \|_F^2 + \lambda_1\|\m E \|_1 + \lambda_2\|\m S^{\sharp}\|_{*} \\ & \text{{subject to:}} \\ & \displaystyle \m S^{\sharp} = g(\m S), \displaystyle \m S = \m S \m C, \displaystyle \m C \m D = \m E, \displaystyle \m 1^{T} \m C = \m 1^{T}, \displaystyle \mathrm{diag}(\m C) = \m 0. \end{aligned} \label{eq:main_optimization} \end{equation} The Augmented Lagrangian formulation for Eq.-\eqref{eq:main_optimization} is: \begin{eqnarray} \mathcal{L}(\m S, \m S^{\sharp}, \m C, \m E, \{\m Y_i\}_{i=1}^4) = & \frac{1}{2}\|\m W - \m R \m S \|_F^2 + \lambda_1\|\m E \|_1 + \lambda_2\|\m S^{\sharp}\|_{*} + <\m Y_1, \m S^{\sharp} - g(\m S)> \nonumber \\ & + \frac{\beta}{2}\|\m S^{\sharp} - g(\m S) \|_F^2 + <\m Y_2, \m S - \m S \m C> + \frac{\beta}{2}\|\m S - \m S \m C \|_F^2 \\ \nonumber & + <\m Y_3, \m C \m D - \m E> + \frac{\beta}{2}\|\m C \m D - \m E \|_F^2 \nonumber \\ \nonumber & + <\m Y_4, 1^T \m C - \m 1^T > + \frac{\beta}{2}\|\m 1^T \m C - \m 1^T \|_F^2. \label{eq:Lagrangian} \end{eqnarray} where $\{\m Y_i\}_{i=1}^4$ are the matrices of Lagrange multipliers corresponding to the four equality constraints, and $\beta$ is the penalty parameter. We do not need to introduce a Lagrange multiplier for the diagonal constraint of $\mathrm{diag}(\m C) = \m 0$ as we will enforce this constraint exactly in the solution of $\m C$. The ADMM iteratively updates the individual variable so as to minimize $\mathcal{L}$ while the other variables are fixed. In the following, we derive the update for each of the variables. \subsubsection{The solution of $\m S$:} \begin{equation} \begin{array}{l} \m {S} = \arg\min_{\m S} \frac{1}{2}\|\m W - \m R \m S \|_F^2 + <\m Y_1, \m S^{\sharp} - g(\m S)> + \frac{\beta}{2}\|\m S^{\sharp} - g(\m S) \|_F^2 \\ \qquad \qquad \qquad + <\m Y_2, \m S - \m S \m C> + \frac{\beta}{2}\|\m S - \m S \m C \|_F^2. \end{array} \end{equation} The sub-problem for $\m S$ reaches a least squares problem. The closed-form solution of $\m S$ can be derived as: \begin{equation} \label{eq:Update_S} \frac{1}{\beta}(\m R^T \m R + \beta \m I) \m S + \m S(\m I - \m C)(\m I - \m C^T) = \frac{1}{\beta}\m R^T \m W + (g^{-1}(\m S^{\sharp}) + \frac{g^{-1}(\m Y_1)}{\beta } - \frac{\m Y_2}{\beta}(\m I - \m C^T)), \end{equation} which is a Sylvester equation. \subsubsection{The solution of $\m S^{\sharp}$:} \begin{equation} \label{eq:update_S_Sharp} \m {S}^{\sharp} = \arg\min_{\m {S}^{\sharp}} ~ \lambda_2\|\m S^{\sharp}\|_{*} + <\m Y_1, \m S^{\sharp} - g(\m S)> + \frac{\beta}{2}\|\m S^{\sharp} - g(\m S) \|_F^2 \end{equation} A close-form solution exists for this sub-problem. Let's define the soft-thresholding operation as $\mathcal{S}_{\tau}[x] = \mathrm{sign}(x)\max(|x|-\tau, 0)$. The optimal solution to Eq.-\eqref{eq:update_S_Sharp} can be obtained as: \begin{equation} \label{eq:Update_S_Sharp} \m S^{\sharp} = \m U \mathcal{S}_{\lambda_2/\beta}(\Sigma) \m V, \end{equation} where $[\m U, \Sigma, \m V] = \mathrm{svd}(g(\m S) - \m Y_1/\beta)$. \subsubsection{The solution of $\m E$:} \begin{equation} \m E = \arg\min_{\m E} \lambda_1\|\m E \|_1 + <\m Y_3, \m C \m D -\m E> + \frac{\beta}{2}\| \m C \m D - \m E \|_F^2, \end{equation} A close-form solution exists for this sub-problem by using element-wise shrinkage. \begin{equation} \label{eq:Update_E} \m E = \mathcal{S}_{\lambda_1/\beta}(\m C \m D + \frac{\m Y_3}{\beta}). \end{equation} \subsubsection{The solution of $\m C$:} \begin{equation} \begin{array}{l} \m C = \arg\min_{\m C} ~ <\m Y_2, \m S - \m S \m C> + \frac{\beta}{2}\|\m S - \m S \m C\|_F^2 + <\m Y_3, \m C \m D - \m E> + \frac{\beta}{2}\|\m C \m D - \m E\|_F^2 + \\ \qquad \qquad \qquad <\m Y_4, \m 1^T \m C - \m 1^T> + \frac{\beta}{2}\|\m 1^T \m C - \m 1^T \|_F^2 \end{array} \end{equation} The closed-form solution of $\m C$ is derived as: \begin{equation}\label{eq:update_C} (\m S^T \m S + \m 1 \m 1^T)\m C + \m C(\m D \m D^T) = \m S^T \m S + \m S^T \frac{\m Y_2}{\beta} + \m E \m D^T - \m Y_3 \frac{\m D^T}{\beta} + \m 1 \m 1^T - \m 1\frac{\m Y_4}{\beta} \end{equation} \begin{equation} \label{eq:Update_C} \m C = \m C - \mathrm{diag}(\m C), \end{equation} Finally, the Lagrange multipliers $\{\m Y_i\}_{i=1}^4$ and $\beta$ are updated as: \begin{equation} \label{eq:update_Y1} \m Y_1 = \m Y_1 + \beta(\m S^{\sharp} - g(\m S)), \m Y_2 = \m Y_2 + \beta(\m S - \m S \m C), \end{equation} \begin{equation} \label{eq:update_Y3} \m Y_3 = \m Y_3 + \beta(\m C \m D - \m E), \m Y_4 = \m Y_4 + \beta(\m 1^T \m C - \m 1^T), \end{equation} \begin{equation} \label{eq:update_beta} \beta = \min(\beta_m, \rho\beta), \end{equation} \subsubsection{Initialization:} As our method tries to solve a non-convex optimization problem \eqref{eq:main_optimization}, a proper initialization is needed. In this paper, we initialize our implementation by using the single-body non-rigid structure-from-motion method \cite{Dai-Li-He:CVPR-2012}. Other methods can also be used. Note that these single-body non-rigid structure-from-motion was only used for a proper camera motion. In our current implementation, we have fixed the camera motion while updating the 3D non-rigid reconstruction and segmentation. In future, we will put the update of camera rotation in the loop. \subsubsection{Sparse feature tracks:} In the above section, we provide the derivation for solving the dense feature tracks case. Sparse feature tracks case could be viewed as a simplified form of the dense case by removing the spatial constraint term $\|\m C \m D \|$ directly. \begin{algorithm}[t!] \caption{Multi-body non-rigid structure-from-motion and segmentation via the ADMM} \label{Algorithm 1} \begin{algorithmic} \REQUIRE ~~\\ 2D feature track matrix $\m W$, camera motion $\m R$, $\lambda_1$, $\lambda_2$, $\rho>1$, $\beta_m$, $\epsilon$; \\ \vspace{0.2cm} \hspace{-0.3cm}{\bf Initialize:} ${\m S}^{(0)}$, ${\m S^{\sharp}}^{(0)}$, $\m C^{(0)}$, $\m E^{(0)}$, $\{{\bf Y}_i^{(0)}\}_{i=1}^4 = {\bf 0}$, $\beta^{(0)}$;\\ \vspace{0.2cm} \WHILE {not converged} \STATE 1. Update $(\m S, \m S^{\sharp}, \m E, \m C)$ by Eq.~\eqref{eq:Update_S}, Eq.~\eqref{eq:Update_S_Sharp}, Eq.~\eqref{eq:Update_E}, Eq.~\eqref{eq:update_C} and Eq.~\eqref{eq:Update_C};\\ \STATE 2. Update $\{{\bf Y}_i\}_{i=1}^4$ and $\beta$ by Eq.~\eqref{eq:update_Y1}-Eq.~\eqref{eq:update_beta};\\ \STATE 3. Check the convergence conditions $\| \m S^{\sharp} - g(\m S)\|_{\infty} \leq \epsilon$, $\| \m S - \m S\m C\|_{\infty} \leq \epsilon$, $\| \m 1^T \m C - \m 1^T \|_{\infty} \leq \epsilon$, and $\| \m C \m D - \m E \|_{\infty} \leq \epsilon$; \\ \ENDWHILE \vspace{0.2cm} \ENSURE ~${\m C}$, $\m S, \m S^{\sharp}$. \STATE Form an affinity matrix $\m A = |\m C| + |\m C^T|$, then apply spectral clustering \cite{Spectral-Clustering:NIPS-2001} to $\m A$. Note: Spectral clustering demands number of clusters as input. One way to obtain optimal number of cluster is to use eigen gap information of Laplacian matrix, but in our experiments, we assumed that number of deformable objects are known a priori. \end{algorithmic} \end{algorithm} \section{Experiments} To evaluate the effectiveness of our approach for multi-body non-rigid structure-from-motion, we conducted extensive experiments on both synthetic data and real images, under both sparse and dense scenarios. Our implementation is not trying to alternate between shape recovery and SSC \cite{SSC:PAMI-2013}, rather its a unified optimization framework. As our method jointly perform non-rigid 3D reconstruction and segmentation, we use the following criteria to measure the performances of the algorithm: \\ (i) Relative error in multi-body non-rigid 3D reconstruction \begin{equation} e_{3D} = \|\m S_f^{est} - \m S_f^{GT}\|_F/\| \m S_f^{GT} \|_F, \end{equation} (ii) Error in multi-body non-rigid motion segmentation, \begin{equation} e_{MS} = \frac{\mathrm{total ~number ~of ~incorrectly ~segmented ~trajectories}}{\mathrm{total ~number ~of trajectories}}. \end{equation} \subsection{Multi-body non-rigid data} To prove the correctness of our formulation, we first test our method on synthetic dataset. We synthesize two non-rigid objects by using the CMU Mocap dataset \cite{Akhter-Sheikh-Khan-Kanade:Trajectory-Space-2010}, for example one person performs Yoga while the other person is dancing. In Fig.~\ref{fig:synthetic_sequence}, we illustrate four sample multi-body non-rigid structure-from-motion sequences. \begin{figure} \centering \subfigure [\label{fig:1}] {\includegraphics[width=0.24\textwidth]{Figures/Face_Pickup_Affine_Subspace.png}} \subfigure [\label{fig:2}] {\includegraphics[width=0.24\textwidth]{Figures/Shark_Yoga_Affine_Subspace.png}} \subfigure [\label{fig:3}]{\includegraphics[width=0.24\textwidth]{Figures/Stretch_Yoga_Affine_Subspace.png}} \subfigure [\label{fig:4}]{\includegraphics[width=0.24\textwidth]{Figures/Walking_Yoga_Affine_Subspace.png}} \caption{3D reconstruction and segmentation of different multi-body non-rigid motion sequences a) Face-Pickup Sequence; b) Shark-Yoga Sequence; c) Stretch-Yoga Sequence; d) Walking-Yoga Sequence. The dark small circles in the respective segments shows the Ground-Truth 3D points.} \label{fig:synthetic_sequence} \noindent\makebox[\linewidth]{\rule{0.83\paperwidth}{0.4pt}} \end{figure} \subsection{Experiment 1: Convergence} Given noise free input, we want to check whether or not our proposed algorithm converge; and if it does converge, whether it converges to the correct solution. Note that we use the sparse sequences from the CMU MoCap dataset \cite{Akhter-Sheikh-Khan-Kanade:Trajectory-Space-2010} directly without any dimension reduction or projection. Typical convergence curves of the objective function and the primal residuals are illustrated in Fig.~\ref{fig:Convergence_Curve}. \begin{figure} \centering \includegraphics[width=1.0\textwidth,height=0.5\textwidth] {Figures/convergence_curve.png}~~~ \caption{Typical convergence curves of the objective function and the primal residuals $\|\m S^{\sharp} - g(\m S)\|_\infty, \| \m S - \m S \m C \|_\infty, \| \m C \m D - \m E\|_\infty$ and $\| \m 1^T \m C - \m 1^T\|_\infty$. The above plot shows the convergence statistics for Dance+Yoga Sequence. *ADMM Convergence Curve = maximum of ($\|\m S^{\sharp} - g(\m S)\|_\infty, \| \m S - \m S \m C \|_\infty, \| \m C \m D - \m E\|_\infty$ and $\| \m 1^T \m C - \m 1^T\|_\infty$). } \label{fig:Convergence_Curve} \end{figure} \subsection{Experiment 2: Performance on noisy feature tracks} We also conducted experiments to analyze the performance of our method under different level of noise on input track features. In the same manner as above, we generated multi-body non-rigid sequences (``Dance + Yoga'', ``Face + Pickup'', ``Face + Yoga'', ``Shark + Stretch'', ``Shark + Yoga'', ``Stretch + Yoga'' and ``Walking + Yoga''), then zero-mean Gaussian noise with standard deviation $\sigma$ were added to the feature tracks. For each noisy input, we ran our code for 5 times and recorded the mean 3D reconstruction error and non-rigid motion segmentation error. \begin{figure} \centering \includegraphics[width=0.47\textwidth,height=0.166\textheight] {Figures/recons_noise.png}~ \includegraphics[width=0.47\textwidth,height=0.166\textheight]{Figures/seg_noise.png} \caption{Left: 3D Reconstruction error VS noise levels; Right: non-rigid motion segmentation error VS noise levels. } \label{fig:noise_performance} \end{figure} Fig.~\ref{fig:noise_performance}, illustrate the statistical results of 3D non-rigid reconstruction and non-rigid motion segmentation. From the statistics as plotted in Fig.~\ref{fig:noise_performance}, we conclude that both the 3D reconstruction error and the motion segmentation error increases with the increase of noise level. Our 3D reconstruction based non-rigid motion segmentation achieves smaller motion segmentation error compared with 2D trajectory based motion segmentation methods such as sparse subspace clustering (SSC) \cite{SSC:PAMI-2013} and efficient dense subspace clustering (EDSC) \cite{EDSC:WACV-2014}. \subsection{Experiment 3: Performance Comparison on Sparse Dataset} In Table~\ref{tab:segmentation_comparison} we compared the segmentation results of our approach with SSC \cite{SSC:PAMI-2013} and EDSC \cite{EDSC:WACV-2014} on multi-body non-rigid sequences over 2D feature tracks. It clearly demonstrate that performing non-rigid motion segmentation in 3D space using our approach leads to remarkable results. Since, our method jointly solves 3D reconstruction and multi-body non-rigid motion segmentation, we compare our method with the two stage method, namely \begin{enumerate}[1)] \item Baseline method 1: Single body non-rigid structure-from-motion (State-of-the-art ``block-matrix method'' \cite{Dai-Li-He:CVPR-2012} was used) followed by subspace clustering of the 3D trajectories (SSC \cite{SSC:PAMI-2013} was used), denoted as ``BMM+SSC(3D)''; \item Baseline method 2: Subspace clustering of the 2D feature tracks (2D trajectories) followed by single body non-rigid structure-from-motion for each cluster of 2D feature tracks, denoted as ``SSC(2D)+BMM''. \end{enumerate} Table~\ref{tab:comparisons_baseline}, provides experimental comparisons between our method and two baseline methods in dealing with multi-body non-rigid structure-from-motion. In all the sequences, our method achieves zero multi-body non-rigid motion segmentation error and comparable 3D non-rigid reconstruction. Experiments clearly shows that our 3D reconstruction is very close to the accuracy of BMM \cite{Dai-Li-He:CVPR-2012} method in almost all dataset. However, the advantage with our framework we can have robust segmentation along with better reconstruction at the same time. Fig. \ref{fig:comparison_efficacy} shows the robustness of our approach. Our method faithfully reconstruct and segment two different complex non-rigid motion than the two baseline methods. Extensive experiments were performed on synthetic sparse data-sets with different combination of non-rigid motion Fig. \ref{fig:multi_nonrigid} shows some of the results on these different combinations of non-rigid motion on CMU Mocap dataset \cite{Akhter-Sheikh-Khan-Kanade:Trajectory-Space-2010}, where as Fig. \ref{fig:umpm_result} and Table \ref{tab:result_umpm} presents results obtained on UMPM dataset \cite{UMPM}. We also compared the affinity matrices of our method with SSC \cite{SSC:PAMI-2013}. It's visually apparent from Fig.~\ref{fig:affinity_matrix}, that our method outputs an affinity matrix with better structure, which results in better non-rigid motion segmentation performance. \begin{table} \begin{center} \caption{Motion segmentation performance comparison with SSC \cite{SSC:PAMI-2013} and EDSC \cite{EDSC:WACV-2014} over 2D feature tracks.} \label{tab:segmentation_comparison} \begin{tabular}{|c|c|c|c|} \hline Dataset & SSC ($e_{MS}$) & EDSC ($e_{MS}$) & Ours\\ \hline Dance+Yoga & 0.025 & 0.0345 & 0.0\\ \hline Drink+Walking & 0.0 & 0.01 & 0.0\\ \hline Shark+Stretch & 0.3939 & 0.0 & 0.0 \\ \hline Walking+Yoga & 0.0 & 0.0 & 0.0 \\ \hline Face+Pickup & 0.098 & 0.0 & 0.0\\ \hline Face+Yoga & 0.012 & 0.0 & 0.0\\ \hline Shark+Yoga & 0.41 & 0.0 & 0.0 \\ \hline Stretch+Yoga & 0.0 & 0.0 & 0.0\\ \hline \end{tabular} \end{center} \end{table} \begin{table}[!htp] \centering \caption{Performance comparison between our method and the baseline methods, where 3D reconstruction error ($e_{3D}$) and non-rigid motion segmentation error ($e_{MS}$) are used as error metrics.} \begin{tabular}{|c|c|c|c|c|c|c|} \hline \multirow{2}{*}{Dataset} & \multicolumn{2}{c|}{BMM + SSC (3D)} & \multicolumn{2}{c|}{SSC(2D) + BMM} & \multicolumn{2}{c|}{Our Method} \\ \cline{2-7} & $e_{3D}$ & $e_{MS}$ & $e_{3D}$ & $e_{MS}$ & $e_{3D}$ & $e_{MS}$ \\ \hline Dance + Yoga & 0.0456 & 0.0345 & 0.0588 & 0.0259 & 0.046 & {\bf{0.0}} \\ \hline Drink + Walking & 0.0745 & 0.0 & 0.0858 & 0.0 & {\bf{0.073}} & {\bf{0.0}} \\ \hline Shark + Stretch & 0.0246 & 0.4015 & 0.0979 & 0.3939 & 0.025 & {\bf{0.0}} \\ \hline Walking + Yoga & 0.0702 & 0.0 & 0.0900 & 0.0 & {0.0702} & {\bf{0.0}} \\ \hline Face + Pickup & 0.0324 & 0.0988 & 0.0239 & 0.0988 & 0.025 & {\bf{0.0}} \\ \hline Face + Yoga & 0.0172 & 0.012 & 0.0332 & 0.012 & 0.019 & {\bf{0.0}} \\ \hline Shark + Yoga & 0.0356 & 0.4167 & 0.1049 & 0.4091 & 0.0371 & {\bf{0.0}}\\ \hline Stretch + Yoga & 0.0392 & 0.0 & 0.0557 & 0.0 & 0.0393 & {\bf{0.0}} \\ \hline \end{tabular} \label{tab:comparisons_baseline} \end{table} \begin{figure}[!htp] \begin{center} \subfigure[\label{fig:NRSFM_3D}]{\includegraphics[width=0.32\linewidth]{Figures/NrSFM_SSC_3D.png}} \subfigure[\label{fig:SSC_NRSFM}]{\includegraphics[width=0.32\linewidth]{Figures/SSC_2D_NRSFM.png}} \subfigure[\label{fig:our_method}]{\includegraphics[width=0.32\linewidth]{Figures/Our_Method.png}} \end{center} \caption{\small Demonstrating the efficacy of our approach. The above plot shows the results on Dance + Yoga sequence. (a) Result obtained by applying BMM method \cite{Dai-Li-He:CVPR-2012} to get 3D points and then use SSC \cite{SSC:PAMI-2013} to segment 3D points. (b) Result obtained by applying SSC \cite{SSC:PAMI-2013} to 2D feature tracks and then use BMM \cite{Dai-Li-He:CVPR-2012} separately to each segment to get 3D reconstruction. (c) Result by applying simultaneous reconstruction and segmentation framework(Our approach). } \label{fig:comparison_efficacy} \noindent\makebox[\linewidth]{\rule{0.83\paperwidth}{0.4pt}} \end{figure} \begin{figure}[!htp] \begin{center} \subfigure[\label{fig:shark_yoga}]{\includegraphics[width=0.24\linewidth]{Figures/Shark_Yoga_Affine_Subspace.png}} \subfigure[\label{fig:stretch_yoga}]{\includegraphics[width=0.24\linewidth]{Figures/Dance_Yoga_Affine_Subspace.png}} \subfigure[\label{fig:face_yoga}]{\includegraphics[width=0.24\linewidth]{Figures/Face_Yoga_Affine_Subspace.png}} \subfigure[\label{fig:shark_stretch}]{\includegraphics[width=0.24\linewidth]{Figures/Shark_Stretch_Affine_Subspace.png}} \end{center} \caption{\small Illustration of multi-body non-rigid reconstruction with segmentation on different data-sets. (a) Shark + Yoga Sequence (b) Dance + Yoga Sequence (c) Face + Yoga Sequence (d) Shark + Stretch Sequence. The dark small circles in the respective segments shows the Ground-Truth 3D points.} \label{fig:multi_nonrigid} \noindent\makebox[\linewidth]{\rule{0.83\paperwidth}{0.4pt}} \end{figure} \begin{table} \centering \caption{Quantitative results on UMPM data-set \cite{UMPM}. The rotation were obtained using BMM method \cite{Dai-Li-He:CVPR-2012} (K = 11). Different K value may results in different reconstruction error ($e _{MS}$) value. Statistics clearly reveals that we can get high fidelity motion segmentation using our approach and reasonable 3D reconstruction simultaneously on very complex data-set as well.} \begin{tabular}{|c|c|c|c|c|c|c|} \hline \multirow{2}{*}{Dataset} & \multicolumn{2}{c|}{BMM + SSC (3D)} & \multicolumn{2}{c|}{SSC(2D) + BMM} & \multicolumn{2}{c|}{Our Method} \\ \cline{2-7} & $e_{3D}$ & $e_{MS}$ & $e_{3D}$ & $e_{MS}$ & $e_{3D}$ & $e_{MS}$ \\ \hline p2\_free\_2 & 0.1973 & 0.0 & 0.2177 & 0.0 & 0.1992 & {0.0} \\ \hline p3\_ball\_1 & 0.1356 & 0.0 & 0.1422 & 0.0 & 0.1348 & 0.0 \\ \hline p4\_grab\_2 & 0.2018 & 0.0 & 0.2182 & 0.0 & 0.2080 & 0.0 \\ \hline p4\_table\_12 & 0.2313 & 0.0 & 0.2418 & 0.0 & 0.2313 & 0.0 \\ \hline p4\_meet\_12 & 0.0800 & 0.0135 & 0.0941 & 0.0 & 0.0821 & 0.0135 \\ \hline \end{tabular} \label{tab:result_umpm} \end{table} \begin{figure} \centering \includegraphics[width=0.6\textwidth, height=0.15\textheight] {Figures/result_umpm.pdf}~~~ \caption{Reconstruction and segmentation result on (a) p3\_ball\_1. (b) p4\_meet\_12 data-set from UMPM database \cite{UMPM}. Light green and light red circles shows the 3D reconstruction, where as dark circles of the respective color shows their 3D ground-truth. Here, different color shows the corresponding segmentation.} \label{fig:umpm_result} \noindent\makebox[\linewidth]{\rule{0.83\paperwidth}{0.4pt}} \end{figure} \begin{figure} \centering \includegraphics[width=0.25\textwidth]{Figures/Affinity_Matrix_SSC.jpg}~~~ \includegraphics[width=0.25\textwidth]{Figures/Affinity_Matrix_Our_Method.jpg} \caption{Obtained Affinity Matrix $\m A = |\m C| + |\m C^T|$. a) Affinity matrix from SSC; b) Affinity matrix from our Method. Best Viewed on Screen.} \label{fig:affinity_matrix} \end{figure} \subsection{Experiment 4: Analysis on Dense Dataset} To expeditiously test the effectiveness of our implementation over available dense sequences, we tested our method on the uniformly sampled version of the original sequences. We performed experimentation on benchmark NRSFM synthetic and real data-set sequence \cite{Dense-NRSFM:CVPR-2013} introduced by Grag {\it{et al.}} Table \ref{tab:dense_3d_synthetic} lists the obtained 3D reconstruction error on these freely available standard synthetic data-sequence \cite{Dense-NRSFM:CVPR-2013}. Figure \ref{fig:Dense_result_synthetic} and \ref{fig:real_face_back_} provides visual insight of the procured 3D shapes over synthetic and real sequence respectively. To test the segmentation of different structure on real dataset, we performed experiments by combining two real dataset sequence. Figure \ref{fig:real_face_heart_} shows the segmentation of non-rigid feature tracks to their corresponding classes. \begin{table} \begin{center} \caption{Quantitative results on synthetic face sequence, without and with neighboring constraints.} \label{tab:dense_3d_synthetic} \begin{tabular}{|c|c|c|c|} \hline Dataset & No.of Feature points & e3d(C constraint) & e3d(CD constraint)\\ \hline Face Sequence 1 & 3275 & 0.0749 & 0.0745\\ \hline Face Sequence 2 & 3275 & 0.0506 & 0.050\\ \hline Face Sequence 3 & 3275 & 0.0384 & 0.0380\\ \hline Face Sequence 4 & 3275 & 0.0446 & 0.0443 \\ \hline \end{tabular} \end{center} \end{table} \begin{figure}[t!] \centering \includegraphics[width=0.8\textwidth, height=0.20\textheight] {Figures/Diagram_dense_recons.pdf}~~~ \caption{Reconstruction results on the synthetic Face Sequence benchmark data-set \cite{Dense-NRSFM:CVPR-2013}. The above shown results were obtained on uniformly sampled trajectories of Face Sequence. } \label{fig:Dense_result_synthetic} \end{figure} \begin{figure}[t!] \centering \includegraphics[width=0.8\textwidth, height=0.22\textheight] {Figures/real_sequence_face_back.pdf}~~~\\ \includegraphics[width=0.8\textwidth, height=0.22\textheight] {Figures/Diagram_real_sequence_heart.pdf} \caption{Reconstruction results on the real sequence data-sets: Face, Back and Heart Sequence \cite{Dense-NRSFM:CVPR-2013}. The above shown results were obtained on uniformly sampled trajectories.} \label{fig:real_face_back_} \end{figure} \begin{figure}[t!] \centering \includegraphics[width=0.8\textwidth, height=0.20\textheight] {Figures/Face+Heart.pdf}~~~ \caption{Segmentation result on the real sequence data-sets: (Face + Heart) Sequence \cite{Dense-NRSFM:CVPR-2013}. (a) Top-View, (b) \& (c) Side-View of the scene. Different color signature (Green for heart and Red for Face) symbolizes the corresponding class labels.} \label{fig:real_face_heart_} \end{figure} \section{Conclusions} This paper has filled in a missing gap in the Structure-from-Motion family by proposing a new framework for ``Multi-body Non-rigid-Structure-from-Motion''. It achieves a joint non-rigid reconstruction and non-rigid shape segmentation of multiple deformable structures observed in a single image sequence. Under our new multi-body NRSFM framework, the solutions for motion segmentation can better constrain the solutions for 3D reconstruction. This way, we achieved superior performance in both 3D non-rigid reconstruction and non-rigid motion segmentation, compared with the alternative, two stage method (first segment, then reconstruct). In future, we plan to investigate the scalability issue observed in our current implementation; we aim to apply the new method to denser feature tracks in longer video sequences. In addition to this, we plan to improve over state-of-the-art 3D reconstruction method \cite{Dai-Li-He:CVPR-2012} to get much robust reconstruction for the objects undergoing non-rigid deformation. \section*{Acknowledgments} Y. Dai is funded in part by ARC Grants (DE140100180, LP100100588) and National Natural Science Foundation of China (61420106007). H. Li's research is funded in part by ARC grants (DP120103896, LP100100588, CE140100016) and NICTA (Data61). \bibliographystyle{splncs}
{'timestamp': '2016-07-18T02:07:21', 'yymm': '1607', 'arxiv_id': '1607.04515', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04515'}
arxiv
\section{Proof-of-Concept Applications} This paper demonstrates backscatter communication on commodity devices, and in this section we evaluate prototypes of three novel applications enabled by these techniques. We evaluate only the communication aspect of our prototypes and consider fully exploring their security and usability issues outside the of scope of this work. \subsection{Smart Contact Lens} Smart contact lens systems~\cite{liao20123,yao2012contact} measure biomarkers like glucose, cholesterol and sodium in tears that can help with unobtrusive tracking for diabetic patients. The lens consists of a miniature glucose sensor IC, and an antenna. Although the power required for glucose sensing is minimal, real-time communication is power consuming and rules out conventional radios. Today these systems are limited to periodically sampling and storing the glucose data that is then transmitted sporadically using backscatter whenever the lens is next to a dedicated, powered, RFID-like reader. We leverage our design to show that a smart contact lens can communicate with commodity Wi-Fi and Bluetooth radios, without the need for dedicated reader hardware. We develop the form factor antenna prototype lens shown in Fig.~\ref{fig:rssi_contact_lens}. The prototype consists of a 1~cm diameter loop antenna similar to prior contact lens systems~\cite{liao20123, yao2012contact}. The antenna was built using 30~AWG wire and then encapsulated in a 200 $\mu$m thick layer of poly-dimethylsiloxane (PDMS) for biocompatibility and structural integrity. We then connect the antenna to our FPGA prototype. Unlike traditional antennas that have a 50 $\Omega$ impedance, small loop antennas have non-standard impedances and so we optimize the impedance of the backscatter switch network for the impedance of our loop antenna. We note that for ease of prototyping, we use FPGA hardware but an IC should conform to the contact lens size form factor, similar to prior backscattering lens designs~\cite{lens1}. To evaluate the system, we immerse our antenna prototype in contact lens solution. We configure the TI Bluetooth chip to transmit every 40~ms and place it 12 inches from the lens. We use the Intel Wi-Fi card as a receiver and vary its distances to the lens antenna. The RSSIs follow a similar trend when using a Samsung Galaxy S4 as the receiver. We configure our FPGA to detect the Bluetooth beacons and backscatter 2~Mbps Wi-Fi packets. Fig.~\ref{fig:rssi_contact_lens} plots the Wi-Fi RSSI for different Bluetooth transmit power values. The plot shows that we can achieve ranges of more than 24~inches, demonstrating the feasibility of a smart contact lens that communicate directly with commodity radios. We note that the range is smaller than prior plots because the antenna is much smaller and is immersed in liquid leading to high signal attenuation. The range however is similar to prior smart contact lens with a dedicated RFID-like reader~\cite{lens1}. \begin{figure}[!t] \subfigure { \includegraphics[width=.25\columnwidth]{./figures/contact_ant.eps} } \subfigure { \includegraphics[width=0.7\columnwidth]{./figures/contact_lens.eps} } \vskip -0.1in \caption{{\bf RSSI with smart contact lens antenna prototype.}} \vskip -0.15in \label{fig:rssi_contact_lens} \end{figure} \vfill \subsection{Implanted Neural Recording Devices} Implantable neural recording devices have recently demonstrated promising results towards use in brain-computer interfaces (BCIs)~\cite{leuthardt2004brain} that help paralyzed individuals operate motor prosthetic devices, command electronic devices, or even regain control of their limbs~\cite{hochberg2006neuronal}. These systems use either penetrating neural probes~\cite{bmi2} or a surface electrode grid~\cite{wyler1984subdural} that is implanted to collect local field potentials and electrocorticography (ECoG) signals~\cite{bmi2}. The recording sensors today consume around 2~$\mu$W/channel~\cite{wyler1984subdural}, with 8--64 parallel recording channels. \begin{figure}[!t] \subfigure { \includegraphics[width=.25\columnwidth]{./figures/bmi_ant.eps} } \subfigure { \includegraphics[width=0.7\columnwidth]{./figures/bmi.eps} } \vskip -0.1in \caption{{\bf RSSI with implantable neural recording antenna.}} \vskip -0.15in \label{fig:rssi_bmi} \end{figure} Instead of using a custom backscatter reader as prior prototypes~\cite{bmi1,bmi2,bmi3}, we leverage our design to transmit the data directly to commodity radios. To demonstrate this, we built a form factor antenna for the implantable neural recording device shown in Fig.~\ref{fig:rssi_bmi}. We construct a 4~cm diameter full wavelength loop antenna using 16 AWG magnet wire and encapsulate it in a 2~mm thick layer of PDMS to isolate it from biological tissue. These devices are typically implanted either on top of the dura beneath the skull or just under the skin inside the skull cavity. For our in-vitro evaluation, we choose muscle tissue whose electromagnetic properties are similar to grey matter at 2.4~GHz~\cite{gabriel1996dielectric}. We took a 0.75~inch thick pork chop and created a slit 0.0625~inch from the surface and inserted the antenna. We use the TI Bluetooth device as our RF source and place it at a distance of 3~inches from the meat surface. We use Intel Link 5300 Wi-Fi card on channel 11 as our Wi-Fi receiver; the RSSI results were similar with a Samsung S4. We set our FPGA prototype to synthesize 2~Mbps Wi-Fi packets. Fig.~\ref{fig:rssi_bmi} shows the RSSI for different Bluetooth powers. The plots show the feasibility of communicating with implanted devices, despite significant attenuation due to the muscle tissue. The range we achieve is better than the 1-2~cm target range for existing prototypes~\cite{bmi1, bmi2}. Finally, since Samsung Note 5 and iPhone 6 support 10~dBm Bluetooth transmissions, this demonstrates an implantable device that can communicate with commodity mobile devices. \subsection{Card to Card Communication} Finally, we can use the single-tone transmission from Bluetooth devices to enable communication between two passive cards similar to ambient backscatter~\cite{abc-sigcomm2013}, but without the need for strong TV transmissions. Since most users have Bluetooth-enabled devices (e.g., smartphone), this could be used for money transfer between credit cards, bus passes, splitting of checks, or transferring content to digital paper devices. We prototype proof-of-concept credit card form factor devices shown in Fig.~\ref{fig:card_2_card} that backscatter the single-tone from the Bluetooth device to communicate between each other. We replicate prior work on ambient backscatter~\cite{abc-sigcomm2013} and use its receiver architecture. We however, tune the hardware to operate at 2.4~GHz instead of the UHF TV band. The prototype also has an IGLOO Nano FPGA to implement digital baseband processing for \name\, an MSP430 micro-controller for running application software, LEDs for visual feedback, an accelerometer and capacitive touch sensors for user input. \begin{figure}[!t] \subfigur { \includegraphics[width=.25\columnwidth]{./figures/card_to_card.eps} } \subfigure { \includegraphics[width=0.7\columnwidth]{./figures/tag2tag.eps} } \vskip -0.15in \caption{{\bf BER for communication between two cards with integrated antennas.} Amazon card shown for comparison.} \vskip -0.15in \label{fig:card_2_card} \end{figure} We evaluate card to card communication by configuring one card to periodically transmit an 18 bit payload at 100~kbps to another, at time instances corresponding to the single-tone Bluetooth transmissions. The cards use their energy detectors to synchronize with the Bluetooth transmissions. We place the transmit card 3~inches from a 10~dBm TI Bluetooth device and vary the location of the receiver. Fig.~\ref{fig:card_2_card} shows the bit error rate achieved. The plot demonstrates that up to a distance of 30~inches, 10~dBm Bluetooth transmissions achievable on smartphones such as the Note 5 and iPhone 6, can enable card to card communication. \subsection{Bluetooth as an RF source} \label{sec:bluetooth} The high level idea is to transform a Bluetooth chip into a single tone transmitter, i.e., with constant amplitude and frequency. We leverage two insights about GFSK modulation used in Bluetooth. First, Bluetooth uses two frequencies to encode the zero and one data bits. Thus, if we could transmit a stream of constant ones or zeros, we create a single frequency tone. Second, passing a single tone through the Gaussian filter used by Bluetooth does not change its spectral properties since the filter only smooths out abrupt changes to the frequency. Thus, if we could get the Bluetooth chipsets to transmit a continuous stream of zeros or ones, then we effectively create a single tone. Achieving this in practice requires us to address two key challenges: data whitening and the BLE packet structure. \begin{figure}[!t] \includegraphics[width=0.9\columnwidth]{./figures/ble_scrambler.eps} \vskip -0.15in \caption{Shift registers used in Bluetooth to perform data whitening.} \vskip -0.1in \label{fig:ble_scrambler} \end{figure} \vskip 0.05in\noindent{\bf Data whitening.} While our goal is to create long sequences of either zeros or ones, Bluetooth uses data whitening to avoid such sequences so as to enable accurate timing recovery on a Bluetooth receiver. Specifically, Bluetooth uses the 7-bit linear feedback shift register circuit in Fig.~\ref{fig:ble_scrambler} with the polynomial $x^7 + x^4 +1$. Given an initial state, the circuit outputs a sequence of bits that are used to whiten the incoming data by XORing the data bits with the bits output by the circuit. We reverse this whitening process to create the desired sequence of ones or zeros. To do this, we observe that given an initial state for each of the registers, we can deterministically generate the whitening sequence. We also note from the Bluetooth specification that the shift registers are initialized using the Bluetooth channel number. In particular, Bluetooth initializes the zeroth register to a one and the rest of the six registers to the binary representation of the Bluetooth channel number. For instance, while transmitting on the Bluetooth advertising channel 37, the zeroth register in Fig.~\ref{fig:ble_scrambler} is set to 1 and the rest are set to the binary representation of 37. Thus, given an advertising channel, we can initialize the Bluetooth whitening algorithm and compute the whitening sequence. The data bits are then set to the same bits in the whitening sequence or their bit complement to generate long sequences of zeros or ones respectively. In~\xref{sec:blue-results}, we show this process works with unmodified Bluetooth chipsets. \vskip 0.05in\noindent{\bf Link-layer packet structure.} The above discussion assumes that we can control all the bits in a Bluetooth packet; however an advertising packet has fields including the preamble and access address, shown in Fig.~\ref{fig:ble_packet}, that cannot be arbitrarily modified. The preamble is fixed to an alternating sequence of zeros and ones, and the access address is set to {\it 0x8E89BED6} for advertising packets. This is followed by a length field and an advertiser address field. Finally, the packet has the data payload and a 3-byte CRC. Of the above fields, only the data payload can be set to arbitrary values.\footnote{The Android API only allows 24 of the 32 bytes in the payload to be arbitrarily set.} Therefore, our system takes the following steps: 1) we use the Bluetooth preamble, access address and the header (56~$\mu$s in total) to enable Bluetooth packet detection at the backscattering device using an ultra-low power envelope detection circuit, 2) we estimate the beginning of the payload and start backscattering using the techniques introduced in~\xref{sec:genwifi} to generate Wi-Fi packets, and 3) we complete the Wi-Fi transmission before the start of the Bluetooth CRC field. Since the Bluetooth Bluetooth CRC is being transmitted on a different channel than the generated Wi-Fi packet, it does not affect the Wi-Fi receiver. \begin{figure}[!t] \includegraphics[width=0.9\columnwidth]{./figures/ble_packet.eps} \vskip -0.05in \caption{Structure of a Bluetooth advertising packet.} \vskip -0.15in \label{fig:ble_packet} \end{figure} The above design requires estimating the beginning of the Bluetooth packet. Our receiver uses an envelope detector, similar to prior ultra-low power designs~\cite{allsee-nsdi14,abc-sigcomm2013}, for energy detectors. Our energy detection circuit can be customized to only trigger for Bluetooth transmitter up to 8--10 feet, to prevent false positives. Energy detection however does not allow us to accurately detect the beginning of the Bluetooth packet since we do not decode the Bluetooth preamble and hence cannot use typical synchronization techniques. This results in inaccurate estimates of the beginning of the payload. Our implementation uses a guard interval of 4~$\mu$s in our estimate of the start of the payload to address this. \section{Discussion and Conclusion} We introduce a novel approach that transforms wireless transmissions from one technology to the other, on the air. Specifically, we show for the first time that Bluetooth transmissions can be used to generate Wi-Fi and ZigBee-compatible signals using backscatter communication. Using this approach, we build proof-of-concepts for previously infeasible applications including the first contact lens form-factor antenna prototype and an implantable neural recording interface that communicate directly with commodity devices such as smartphones and watches, thus enabling the vision of Internet connected implanted devices. \textred{Finally we outline research directions for improving upon this work. First, interscatter enables high bit rates which allow data to be transmitted in shorter periods of time. This reduces the time for which transmissions occupy the channel and can reduce power consumption by duty cycling the device. Future work could improve overall throughput by using BLE data packets which can be transmitted at a faster rate than BLE advertisements. Additionally the latest Bluetooth standard increases the maximum length for these data packets which would further improve throughput. Lastly, while our current design focuses on generating 802.11b transmissions using backscatter, future work could explore OFDM based protocols such as 802.11g/n/ac to improve the bit rates we achieve by an additional order of magnitude.} \subsection{Communication to Backscatter Device} \label{sec:downlink} Achieving communication to the backscattering device is a challenge because it cannot decode Wi-Fi and Bluetooth transmissions: Bluetooth uses frequency modulation while 802.11b uses phase modulation with DBPSK/DQPSK; so both have relatively constant amplitudes. Traditional receivers for such phase/frequency modulated signals require synthesis of a high frequency carrier that is orders of magnitude more power consuming than backscatter transmitter. In fact, existing ultra-low power backscatter receiver designs~\cite{abc-sigcomm2013,allsee-nsdi14,nsdi16} use amplitude modulation (AM) which does not require phase and frequency selectivity; unfortunately, Wi-Fi and Bluetooth radios do not support AM. \begin{figure}[!t] \includegraphics[width=\columnwidth]{./figures/ofdm_zeros.eps} \vskip -0.15in \caption{{\bf Creating AM signals using OFDM.} We show four OFDM symbols (in black). Random OFDM symbols are constructed using IFFT over random modulated bits while constant OFDM symbols are constructed using the same modulated bits. The red line show the output of our peak detector receiver.} \label{fig:ofdm_timedomain} \vskip -0.15in \end{figure} \vskip 0.05in\noindent{\bf Our Approach.} We transform the payload of 802.11g packets into AM modulated signals. In 802.11g, each OFDM symbol is generated by taking an IFFT over QAM modulated bits to generate 64~time domain samples. Fig.~\ref{fig:ofdm_timedomain} shows a time-domain OFDM symbol created from random modulated bits, which we call {\it random OFDM}. We also show the symbol created when the IFFT is performed over constant modulated bits, which we call {\it constant OFDM}. The figure shows that while random OFDM symbols have the energy spread across the time samples, in constant OFDM the energy is in the first time sample and is zero elsewhere. This can be used to create an amplitude modulated signal. Constructing a constant OFDM symbol using Wi-Fi radios is however not straightforward due to scrambling, coding and interleaving. Next, we describe how to to achieve this goal. \vskip 0.05in\noindent{\it Scrambler.} 802.11g data scrambling is performed by XORing the incoming data bits with the output of a 7-bit linear feedback shift register using the same polynomial shown in Fig.~\ref{fig:ble_scrambler}. Given the scrambling seed, the output sequence of the circuit is deterministic. According to the Wi-Fi standard, the scrambling seed is set to a pseudorandom non-zero value. In principle, this information should be available on the Wi-Fi hardware. Our experiments in~\xref{sec:res_downlink} reveal that a number of commercial Wi-Fi chipsets use a predictable sequence of scrambling seeds. Further, certain Atheros chipsets also allow us to set the scrambling seed to a fixed value in the driver. Using this, we reverse the effect of the scrambler. \vskip 0.05in\noindent{\it Convolutional Encoder.} 802.11g uses convolutional encoding on the scrambled bits to be resilient to noise and interference. It uses a 1/2 rate convolutional encoder where two coded bits are output for each incoming scrambled bit. The higher 2/3 and 3/4 coding rates are obtained by dropping some of the 1/2 rate encoded bits. Specifically, given the scrambled bits, $b[k]$, the two encoded bits are, \begin{eqnarray*} C_1[k] = b[k] \oplus b[k-2] \oplus b[k-3] \oplus b[k-5] \oplus b[k-6]\\ C_2[k] = b[k] \oplus b[k-1] \oplus b[k-2] \oplus b[k-3] \oplus b[k-6] \end{eqnarray*} This is a 1-to-2 mapping which cannot generate every desired sequence of encoded bits. We observe however that if all the incoming scrambled bits are ones (zeros), then all the encoded bits are ones (zeros). Thus, we can generate a sequence of all zeros or all ones as encoded bits. \vskip 0.05in\noindent{\it Interleaver.} The encoded bits are interleaved across different OFDM frequency bins to make adjacent encoded bits more robust to frequency selective channel fading. We note however that when using a sequence of all ones or zeros as our encoded bits, interleaving again results in a sequence of all ones or zeros and does not require us to perform any special operation. \vskip 0.05in\noindent{\it Modulator.} The interleaved bits are modulated using BPSK, 4QAM, 16QAM or 64QAM. Since our interleaved bits are all ones or zeros within an OFDM symbol, the modulation operation results in using the same constellation point across all the OFDM bins, achieving our goal of creating an OFDM symbol constructed using a constant modulated symbol. We note that OFDM symbols have pilot bits inserted in specific frequency bins, which cannot be controlled. This however does not significantly change the desired constant OFDM pattern since the fraction of pilot to data symbols is low. Also, 802.11g convolutional encoders have a delay length of $7$, i.e., the last six data bits from the previous OFDM symbol impact the first few encoded bits in the current OFDM symbol. This could be a problem when the constant OFDM symbol follows a random OFDM symbol. We address this by setting the last six data bits in the random OFDM symbol to ones and use 16/64 QAM to ensure that the random OFDM symbol will still result in a high amplitude signal. \begin{figure}[!t] \includegraphics[width=\columnwidth]{./figures/ofdm_ones.eps} \vskip -0.15in \caption{{\bf Encoding bits with OFDM symbols.} The figure shows the encoding used to convey bits to the backscatter device.} \label{fig:ofdm_timedomain1} \vskip -0.15in \end{figure} \vskip 0.05in\noindent{\bf Encoding process.} Ideally, we can encode a 1 and 0 bit by random and constant OFDM symbols respectively. Fig.~\ref{fig:ofdm_timedomain} shows why this is a problem: constant OFDM symbols have a peak at the beginning of the time-domain symbol. This is a problem since we use a passive peak detection receiver that tracks the peaks in this signal (shown in red). This creates false peaks at the beginning of each constant OFDM symbol, which can confuse the receiver when there are consecutive constant OFDM symbols. To avoid this, we encode each bit with two OFDM symbols as shown in Fig.~\ref{fig:ofdm_timedomain1}. A one bit is represented by a random OFDM symbol followed by a constant OFDM symbol, while a zero bit is represented as two random OFDM symbols. Since each 802.11g OFDM symbol is 4~$\mu$s, this achieves a bit rate of $125$~kbps. Finally, OFDM symbols have a cyclic prefix where the last few time samples are repeated at the beginning. Since the cyclic prefix in the case of a constant OFDM symbol is all zero, this could create a glitch. To avoid this, we pick the preceding random OFDM symbol such that its last time sample has a high amplitude. This ensures that the peak detector circuit sees a high peak at the end of the first OFDM symbol and does not create a glitch during the cyclic prefix. \subsection{Putting it all together} We use a query-reply protocol. The Wi-Fi device queries the backscatter device using the reverse channel in~\xref{sec:downlink}. The backscatter device responds using the backscatter channel in~\xref{sec:genwifi}. This design works with multiple backscatter devices since the Wi-Fi device can query them one after the other. \subsection{Generating Wi-Fi using backscatter} \label{sec:genwifi} We describe how to generate 802.11b signals by backscatter the single-tone from the Bluetooth device. We first present our design that can create a frequency shift to the incoming single tone signal. We then show how to synthesize 802.11b signals from this shifted tone. \subsubsection{Single Sideband Backscatter Design} \label{sec:singleside} While existing sideband modulation techniques have been recently used to create frequency shifts~\cite{bluetoothbackscatter, nsdi16}, they also create a mirror copy. These works demonstrate that modulating the radar cross-section of an antenna effectively multiples a single tone signal by the modulating signal. Since, $2\sin(f_c t)\sin(\Delta ft) = \cos((f_c-\Delta f)t) - \cos((f_c+\Delta f)t)$, modulating the antenna at $\Delta f$ in the presence of the incoming single-tone carrier signal, $\sin(f_c t)$, creates the desired shift $\cos((f_c+\Delta f)t)$. However, it also creates the mirror copy $\cos((f_c-\Delta f)t)$. This is problematic when used with Bluetooth: both the advertising channels 37 and 39 are at either end of the ISM band, as shown in Fig.~\ref{fig:versus}. Thus, creating any frequency shifts to the corresponding Bluetooth signal will create a mirror copy outside the ISM band. The second advertising channel, 38, overlaps with Wi-Fi channel 6 and is close to Wi-Fi channel 1, and hence can create strong interference to the weak backscattered Wi-Fi signals. Further, generating packets on Wi-Fi channel 11 using advertising channel 39 shown in Fig.~\ref{fig:versus}, would again create a mirror copy that lies outside the ISM band. Thus, existing sideband modulation techniques cannot be used by \name\ on any of the BLE/Wi-Fi channels. \vskip 0.05in\noindent{\bf Our Solution.} We present the first single sideband backscatter architecture that produces a frequency shift on only one side of the single tone Bluetooth transmission. Our intuition is to emulate radios. Specifically, radios use 2.4~GHz oscillators to generate the orthogonal signals, $\cos(2\pi f_c t)$ and $\sin(2\pi f_c t)$. These are multiplied with digital in-phase, $I(t)$, and quadrature phase components, $Q(t)$, to create the signal: $$[I(t)+j Q(t)]\times[\cos(2\pi f_c t) + j\sin(2\pi f_c t)]$$ By setting $I(t)$ and $Q(t)$ to $\cos(2\pi \Delta ft)$ and $\sin(2\pi \Delta ft)$, radios can easily create the desired shifted signal, $e^{j2\pi (f_c +\Delta f)t}$, without any mirror copies. The challenge is that we cannot use oscillators running at 2.4~GHz since they consume significant amounts of power~\cite{razavi1998rf}. Our insight is that mathematically we can imitate the above operations using complex impedances on the backscatter device without 2.4~GHz oscillators. Say, we could create the complex signal $e^{j2\pi\Delta ft}$, then backscattering such a complex signal with the incoming single-tone Bluetooth transmission, $\cos(2\pi f_c t)$, results in: \begin{eqnarray*} e^{j2\pi\Delta ft} \cos(2\pi f_c t) = \frac{1}{2} (e^{j2\pi(f_c+\Delta f)t} + e^{j2\pi(-f_c+\Delta f)t}) \end{eqnarray*} The first term is the desired shifted signal while the second term has a negative frequency and does not occur in practice. Thus, the above operation creates the desired shift without a mirror copy. So if we can create the complex signal $e^{j2\pi\Delta ft}$ using backscatter, we can achieve single-sideband backscatter modulation. The desired signal can be written as, \begin{eqnarray} \label{eqn:1} e^{j2\pi\Delta ft} = \cos(2\pi\Delta ft) + j\sin(2\pi\Delta ft) \end{eqnarray} To create this on a backscatter device, we generate the sin/cos terms using square waves. We then use complex impedances at the switch to generate the desired complex values. \vskip 0.05in\noindent{\it Step 1.} We approximate the sin/cos terms in Eq.~\ref{eqn:1} using square waves alternating between +1 to -1,\footnote{ Since digital operations are on 0 and 1 bits, in practice we perform step 1 using a square wave between 1 and 0 instead of +1 and -1. This is however a straightforward mapping with a DC offset. For simplicity however, we explain our design using +1 and -1.} at a frequency of $\Delta f$. From Fourier analysis a square wave at $\Delta f$ can be written as $\frac{4}{\pi}\sum_{n=1,3,5,\cdots}\frac{1}{n} \sin(2\pi n\Delta ft)$. The first harmonic is the desired sine term while the third and fifth harmonic have a power of $\frac{1}{n^2}$ which are 9.5~dB and 14~dB lower than the first. Since all 802.11b bit rates can operate at SNRs lower than 14~dB, such an approximation is sufficient for our purposes. To generate the cosine term, we time shift this square wave by a quarter of the time period. This square wave can easily be generated by clocking the switch and the digital operations at multiples of the desired offset, $\Delta f$. \vskip 0.05in\noindent{\it Step 2.} Now that we have approximated the sin/cos terms to be either +1 or -1, Eq.~\ref{eqn:1} can take one of four values: {\it 1+j, 1-j, -1+j,} and {\it -1-j}. We create these complex values by changing the impedance of the backscatter hardware. RF signals are reflected when they cross two materials that have different impedances. Since the impedance of an antenna is different from the medium around it, a fraction of the incident RF signals get reflected off the antenna. Backscatter works by creating an additional impedance boundary between the antenna and the backscatter circuit. Specifically, given an incoming signal $S_{in}$, the reflected signal from the backscatter device is given by, \begin{equation*} S_{out} = \frac{Z_a - Z_c}{Z_a +Z_c} S_{in} \end{equation*} Here $Z_a$ and $Z_c$ are the impedance of the antenna and the backscatter circuit respectively. In traditional backscatter, the impedance of the backscatter circuit is set to either $Z_a$ or $0$ corresponding to no reflection or maximum reflection of the incoming signal. We note however that the impedance of the backscatter circuit can be set to complex values by changing the inductance of the circuit~\cite{fullduplex-mobicom2014,matt-qambacksactter}. Specifically, at the frequency $f$, the impedance of the backscatter circuit can be written as $j2\pi fL$ where the inductance is $L$. Thus, by changing this inductance, we can create complex values for the fraction, $\frac{Z_a-Z_c}{Z_a+Z_c}$. Specifically, to get the four desired complex values, {\it 1+j, 1-j, -1+j, -1-j}, we set the impedances of the backscatter circuit to $\frac{-j}{2+j}Z_a$, $\frac{j}{2-j}Z_a$, $\frac{2-j}{j}Z_a$ and $\frac{2+j}{-j}Z_a$ respectively. The antenna impedance, $Z_a$, is typically tuned to 50 ohms. By switching between these impedance states, we can generate the desired complex signal $e^{j2\pi \Delta ft}$ and hence achieve single-sideband backscatter modulation. \textred{Optimizing for these constraints, for our 2.4~GHz backscatter devices we used a 3~pF capacitor, open impedance, 1~pF and 2~nH to achieve the four complex values.} \subsubsection{Synthesizing 802.11b signals} \label{sec:ssb_iq} A Wi-Fi signal can be written as, $(I_{wifi}(t) + jQ_{wifi}(t))e^{j2\pi f_{c}t}$, where $I_{wifi}(t)$ and $Q_{wifi}(t)$ correspond to the in-phase and quadrature-phase components for the baseband Wi-Fi signal. This can be rewritten as, \begin{eqnarray*} (I_{wifi}(t) + jQ_{wifi}(t)) e^{j2\pi\Delta ft} e^{j2\pi f_{bluetooth}t} \end{eqnarray*} Thus, to generate Wi-Fi signals, we need to create $(I_{wifi}(t) + jQ_{wifi}(t))e^{j2\pi\Delta ft}$ using backscatter. We have already demonstrated earlier how to generate $e^{j2\pi\Delta ft}$, so we can multiply it with the in-phase and quadrature-phase components of 802.11b to generate Wi-Fi signals. As described in~\xref{sec:versus}, 802.11b signals use DSSS/CCK coding that creates coded bits that are then modulated using either DBPSK or DQPSK. Thus, if we can show that we can transmit DBPSK and DQOPK, we can create 802.11b signals. \vskip 0.05in\noindent{\bf DBPSK.} In this case, the one and zero bits are represented as +1 and -1, which translates to always setting $Q_{wifi}(t)$ to zero and $I_{wifi}(t)$ to either +1 or -1. Since $e^{j2\pi\Delta ft}$ takes the values in the set {\it \{1+j, 1-j, -1+j, -1-j\}}, multiplying it with +1 or -1 results in values within the same set, which we know how to generate using our impedance values. Thus, we can generate \label{eqn:2} DBPSK modulation and hence achieve 1 and 5.5~Mbps 802.11b transmissions. \vskip 0.05in\noindent{\bf DQPSK.} In this case, both $I_{wifi}(t)$ and $Q_{wifi}(t)$ are set to either +1 or -1. Thus, the baseband Wi-Fi signal can take one of the following values: {\it \{1+j, 1-j, -1+j, -1-j\}}. Multiplying this with $e^{j2\pi\Delta ft}$ which takes one of the following values {\it \{1+j, 1-j, -1+j, -1-j\}}, results in one of these four normalized values: {\it \{1,-1,j,-j\}}. We observe that {\it\{1,-1,j,-j\}} and {\it \{1+j, 1-j, -1+j, -1-j\}} (which are the four impedance values generated in our backscatter hardware) are constellation points that are shifted by $\pi/4$. Since 802.11b uses differential QPSK, we ignore this constant phase shift of $\pi/4$ and instead map them to the four complex impedance values generated by our hardware. Wi-Fi receivers ignore this constant phase shift since the bits are encoded using differential phase modulation. This allows us to generate DQPSK modulation and the corresponding 2 and 11~Mbps 802.11b transmissions. \begin{figure}[!t] \includegraphics[width=\columnwidth]{./figures/ssb_spectra.eps} \vskip -0.1in \caption{{ Comparing single sideband backscatter (red signal) to prior double sideband backscatter (blue signal).}} \vskip -0.1in \label{fig:ssb_spectra} \end{figure} Fig.~\ref{fig:ssb_spectra} shows the frequency spectrum for the backscatter generated WiFi signals at 2~Mbps using our single-sideband backscatter with an arbitrary frequency shift of 22~MHz. For comparison, we also plot the spectrum using prior sideband backscatter approaches~\cite{nsdi16}. The plots show that prior sideband backscatter designs create a strong mirror copy on the other side of the single tone. However, single-sideband backscatter, introduced in this paper, eliminates this mirror copy and hence improves spectral efficiency. \subsubsection{Practical Design Considerations} The Bluetooth advertising packet can have a payload up to 31 bytes or 248~$\mu$s. Since Wi-Fi packets at different bit rates occupy the channel for different times, this translates to different packet sizes. At 2, 5.5 and 11~Mbps the Wi-Fi payload can be 38, 104, and 209 bytes within a single Bluetooth advertising packet. Given its size, we however cannot fit a 1~Mbps Wi-Fi packet in a single Bluetooth advertising packets. \textred{We note that Bluetooth data transmissions, which are sent at faster rates and can last up to 2~$ms$, would enable 1~Mbps packets and greater overall throughput.} We focus on Bluetooth advertising packets in this paper since they are easier to control on commodity devices. \vskip 0.05in\noindent{\it Additional Optimizations.} Bluetooth does not perform carrier sense before transmitting. Further, the backscatter Wi-Fi packet is at a different frequency that could be occupied, resulting in a collision. Since Bluetooth advertisements are small and sent once every 20~ms, such collisions have a negligible impact on Wi-Fi which operates at a much finer time granularity. Collisions however are not desirable at the backscattering device; they would require the backscattering device to retransmit its data, consuming more energy. We describe three optimizations that can reduce these collisions. \vskip 0.05in\noindent 1) We could ensure that the Wi-Fi channel is unoccupied for the backscatter duration. Since most devices have both Wi-Fi and Bluetooth, they could coordinate and hence the Wi-Fi radio could schedule a $CTS\_to\_Self$ packet to be transmitted before the Bluetooth packet. $CTS\_to\_Self$ can reserve the channel for the duration of the Bluetooth packet, preventing other Wi-Fi devices from making concurrent transmissions. The ability to schedule $CTS\_to\_Self$ packets has been demonstrated in the past~\cite{tep,wifibackscatter-sigcomm2014} and requires driver and firmware access to the commodity device. \vskip 0.05in\noindent 2) We leverage that the advertisement packets are sent on all Bluetooth advertising channels one after the other, separated by a fixed duration $\Delta T$ (around 400~$\mu$s for TI Bluetooth chipsets). Using this we imitate an RTS-CTS exchange: when Bluetooth transmits on channel 37, we backscatter an RTS packet on the desired Wi-Fi channel. If the channel is free, the Wi-Fi device responds with a CTS packet, effectively reserving Wi-Fi channel 11 for the next $2\Delta T + T_{Bluetooth}$, where $T_{Bluetooth}$ is the duration of the Bluetooth packet. The backscattering device detects the presence of this CTS using our peak detection hardware. It then transmits data packets on the desired Wi-Fi channel using the remaining advertising packets sent on channel 38 and 39 over the next $2\Delta T + T_{Bluetooth}$ seconds. \vskip 0.05in\noindent 3) To reduce the energy overhead of transmitting the RTS packet, we could instead transmit a data packet. If the Wi-Fi receiver can decode this packet, we would have exchanged useful data to the receiver. The Wi-Fi device can then send a $CTS\_to\_Self$ packet reserving the channel for the next $2\Delta T + T_{Bluetooth}$, which can then be used to backscatter additional Wi-Fi packets using the two remaining advertising packets, without collisions. This eliminates the energy overhead of sending a data-free RTS packet. Evaluating the effectiveness of this is not in the scope of this paper. \vskip 0.05in\noindent\textred{Finally we note that having a large number of backscatter devices will not be affected by the RTS transmission since the multiple devices will be scheduled using the downlink transmissions before any of the backscatter devices even transmit.} \section{FPGA and IC Design} We began by developing the hardware on an FPGA platform to characterize the system and build proof of concept applications. We then translated the design into an IC and used it to quantify the power consumption. \noindent\textbf{FPGA design.} Our system has two components: the RF front end and the baseband digital circuit. The front end consists of a backscatter modulator and a passive receiver. We isolate the receiver from the antenna using a single pole double throw (SPDT) switch that switches between transmit and receive modes. The backscatter modulator switches between four impedance states and is implemented using a cascaded two-stage SPDT switch network. We use HMC190BMS8 SPDT switches both for isolating the transmitter and receiver and in the backscatter modulator. The front end is implemented on a low loss Rodgers 4350 substrate~\cite{hmc190bms8}. As explained in~\xref{sec:genwifi}, the impedances connected to the four terminals of the switch network are a 3~pF capacitor, open impedance, a 1~pF capacitor and a 2~nH inductor which achieve the four desired complex values. The receiver is an energy detector consisting of passive analog components and a comparator to distinguish between the presence and absence of energy. We replicate the receiver described in ~\cite{allsee-nsdi14, abc-sigcomm2013, nsdi16}. The 802.11b scrambling, DSSS/CCK encoding, CRC encoding, DQSPK encoding and single-side band backscatter were implemented in Verilog \textred{and translated onto the DE1 Cyclone II FPGA development board by Altera~\cite{altera_de1}}. We implement a 35.75~MHz shift which we found to be optimal for rejecting the interference from the Bluetooth RF source. The digital output of the FPGA was connected to the backscatter modulator and the energy detector was fed to its digital input. A 2~dBi antenna was used on the \name\ device. \begin{figure*}[!t] \subfigure[TI CC2650] { \includegraphics[width=.3\textwidth]{./figures/cc2650.eps} } \subfigure[Galaxy S5 Smartphone] { \includegraphics[width=.3\textwidth]{./figures/s5.eps} } \subfigure[Moto360 (2nd gen) Smartwatch] { \includegraphics[width=0.3\textwidth]{./figures/moto360.eps} } \vskip -0.1in \caption{{\bf Generating Bluetooth single tone.} The red lines show Bluetooth transmissions with random application data and the green lines show the single-tone transmission created by \name.} \label{fig:spectra} \vskip -0.15in \end{figure*} \noindent \textbf{IC design.} As CMOS technology has scaled, the power consumption of digital computation has decreased significantly~\cite{koomey}. Unfortunately, active radios require power hungry \textit{analog} components which operate at RF frequencies and do not scale in either power or area. Interscatter relies exclusively on baseband digital computation with no components operating at RF frequencies, so it can leverage CMOS scaling for ultra-low power operations. We implement \name\ on the TSMC 65~nm low power CMOS technology node. For context, Atheros AR6003~\cite{atheros_ar6003} chipsets released in 2009 used 65~nm CMOS and so, it is a fair comparison with industry standard. The \name\ IC implementation can be broken down into the following three main components described in detail below: the frequency synthesizer, baseband processor, and backscatter modulator. \noindent \textit{Frequency synthesizer.} This block takes a frequency reference as an input and generates the 802.11b baseband 11~MHz clock as well as the four phases of the 35.75~MHz frequency clock required for backscatter. \textred{We use an integer N charge pump and ring oscillator based PLL to generate a 143~MHz clock which is fed to a Johnson counter to generate the four clocks for the 35.75~MHz frequency shift each 90\degree~out of phase.} The same 143~MHz clock is divided by 13 to generate the 11~MHz baseband clock. Thus, 11~MHz and 35.75~MHz are phase synchronized and we avoid glitches. This block consumes 9.69 $\mu W$ of power. \noindent\textit{Baseband processor.} This block takes the payload as the input and generates the baseband 802.11b packet. We use the same Verilog code which was verified on the FPGA and synthesize the transistor level implementation using the Design Compiler tool by Synopsis~\cite{synopsis}. This block has a power consumption of 8.51 $\mu W$ for 2~Mbps Wi-Fi transmissions. \noindent\textit{Backscatter modulator.} We implement our single sideband backscatter in the digital domain by independently generating the in-phase and quadrature phase components. We take the two bit output of the baseband processor and feed it to two multiplexers that map the four phases of the 35.75~MHz carrier to corresponding in-phase and quadrature-phase components. Then, at each time instant, the in-phase and quadrature phase components are mapped to the four required impedance states in~\xref{sec:ssb_iq}. We use CMOS switches to choose between open, short, capacitive and inductive states. The single side band backscatter modulator consumes 9.79 $\mu W$. {\it In total, generating 2~Mbps 802.11b packets consumes 28 $\mu W$.} \section{Introduction} There has been recent interest in medical applications including smart contact lens platforms~\cite{lens1,lens2,lens3,lens4} that measure biomarkers like glucose, cholesterol and sodium for diabetes management, as well as implantable neural devices that help in the treatment of epilepsy, Parkinson's disease~\cite{ecog-parkinson}, reanimation of limbs~\cite{ecog-limb} and development of brain-computer interfaces~\cite{ecog-bmi}. As part of an ecosystem of connected devices, these implants have the potential to transform the management of chronic medical conditions and enable novel interaction capabilities. In this paper we ask the following question: can these implanted devices communicate directly with mobile devices such as smartphones, watches and tablets? The key challenge is that owing to their severe power constraints, these devices cannot use conventional radios to generate Wi-Fi, Bluetooth or ZigBee transmissions and hence cannot communicate directly with commodity devices. While recent work on passive Wi-Fi~\cite{nsdi16} significantly reduces the power consumption of Wi-Fi transmissions using backscatter communication, it requires infrastructure support in the form of specialized hardware that can generate the continuous wave RF signal needed for backscattering Wi-Fi signals. Thus, it cannot fully plug and play with existing mobile devices. \begin{figure}[!t] \includegraphics[width=\columnwidth]{./figures/watch_to_phone.eps} \caption{{\bf \Name\ Communication.} The backscatter device (e.g., contact lens) reflects transmissions from a Bluetooth device (e.g., smart watch) to generate standards-compatible Wi-Fi signals that are decodable on a Wi-Fi device (e.g., smartphone).} \label{fig:page1} \vskip -0.15in \end{figure} \begin{figure*}[!t] \centering \includegraphics[width=0.8\textwidth]{./figures/applications.eps} \vskip -0.1in \caption{{\bf Potential applications of \Name\ communication.} (a) Active contact lens systems can backscatter Bluetooth transmissions from a watch to generate Wi-Fi signals to a phone, (b) implantable brain interfaces can communicate by using Bluetooth headsets and smartphones, and (c) credit cards can communicate with each other by backscattering Bluetooth transmissions from a smartphone.} \label{fig:applications} \vskip -0.15in \end{figure*} We introduce {\it\name}\footnote{Short for inter-technology backscatter communication.}, a novel backscatter communication system that works using only commodity devices by transforming transmissions from one technology to the other, on the air. We observe that most mobile devices have a Bluetooth, Wi-Fi or ZigBee radio. Further, users increasingly carry smart watches, fitness trackers and Bluetooth headsets in addition to their smartphones. \Name\ reuses the radios on these devices as both RF sources for backscatter as well as receivers the backscattered signals. This allows us to benefit from the Wi-Fi, ZigBee and Bluetooth economies of scale (a few dollars per chip~\cite{ti_ble_chip_buy}) and eliminate the cost of a dedicated reader. Further, it significantly lowers the barrier to adoption, as the wireless hardware is widely available on commodity devices and does not require the user to carry a specialized backscatter reader. Our key idea is a novel approach to backscatter communication: create Wi-Fi signals by backscattering Bluetooth transmissions. To understand this, consider an \name\ device in the presence of a Bluetooth transmitter (e.g., smart watch) and a Wi-Fi receiver (e.g., smartphone), as shown in Fig.~\ref{fig:page1}. We backscatter advertising packets from the Bluetooth device to synthesize 802.11b signals at 2--11~Mbps. In the figure, the \name\ device backscatters Bluetooth packets on channel 38 to generate standards-compliant 802.11b packets on Wi-Fi channel 11. Realizing this idea is challenging for at least three reasons: \begin{Itemize} \item Wi-Fi and Bluetooth have different physical layer specifications --- Wi-Fi requires a 22~MHz bandwidth and uses spread spectrum coding. Bluetooth occupies a 1-2~MHz bandwidth and uses Gaussian Frequency Shift Keying (GFSK). \item Bluetooth operates at carrier frequencies that are different from Wi-Fi. While sideband-backscatter modulation~\cite{nsdi16,bluetoothbackscatter} could shift the carrier by tens of Megahertz, it also creates a redundant copy on the opposite side of the carrier.\footnote{Say an RF source transmits a signal $\sin(f_ct)$, sideband modulation backscatters at a frequency of $\Delta f$, resulting in $sin(\Delta f t)$, which would in turn create the multiplicative signal $2\sin(f_ct)\sin(\Delta ft) = \cos((f_c-\Delta f)t) - \cos((f_c+\Delta f)t)$. The two signals correspond to a signal with a positive frequency shift and its mirror copy with a negative shift.} This not only wastes bandwidth but the redundant copy would also lie outside the unlicensed ISM band (see~\xref{sec:singleside}). \item For bi-directional communication, we need a receiver at the \name\ device. Wi-Fi and Bluetooth receivers consume orders of magnitude higher power than backscatter and would offset its power saving. In fact, existing ultra-low power receiver designs rely on amplitude modulation (AM)~\cite{haykin2008communication}, which is not supported by Wi-Fi or Bluetooth. \end{Itemize} At a high level, we first transform a Bluetooth transmission into a single tone signal and use backscatter to create standards-compliant Wi-Fi packets on a single side of the resulting single tone Bluetooth signal. Specifically, we make three key technical contributions to achieve this design. \begin{Itemize} \item We show for the first time that {\it Bluetooth radios can be used to create single-tone transmissions}. We leverage that Bluetooth uses GFSK that encodes bits using two frequency tones. Thus, if we could transmit a stream of constant ones or zeros, we can create a single tone transmission. In~ \xref{sec:bluetooth}, we describe how to achieve this on commodity Bluetooth devices in the presence of the data whitening, CRC and headers. \item We present the {\it first single-sideband backscatter design} that creates frequency shifts on a single side of the carrier. This lets us create 2--11~Mbps Wi-Fi signals shifted by tens of Megahertz on only {\it one side} of our single tone Bluetooth transmissions. We achieve this using complex impedances at the backscatter switch, without the need for a power-consuming 2.4~GHz oscillators (see~\xref{sec:genwifi}). \item We {\it transform OFDM Wi-Fi devices into AM modulators}. At a high level, the Wi-Fi device in our design modulates the amplitude profile of OFDM symbols to create an AM signal. We show that this can be achieved by just setting the appropriate data bits in a Wi-Fi packet, without the need for any hardware power control.~\xref{sec:downlink} describes how we perform this in the presence of Wi-Fi scrambling, convolutional encoding and interleaving. \end{Itemize} We build prototype backscatter hardware on an FPGA platform and experiment with various Bluetooth and Wi-Fi devices. Our evaluation shows that we can generate 2--11~Mbps Wi-Fi signals from Bluetooth transmissions. To estimate the power consumption, we also design an integrated circuit using Cadence and Synopsis~\cite{cadence_RFspectre, synopsis}, which backscatters Bluetooth to create Wi-Fi signals. Our results show that backscattering 2~Mbps Wi-Fi signals using Bluetooth consumes only 28~$\mu$W. Finally, to demonstrate the generality of our approach, we also show the feasibility of generating ZigBee signals by backscattering Bluetooth transmissions. To show the potential of our design, we implement proof-of-concepts for the three applications shown in Fig.~\ref{fig:applications}. We build a contact lens form-factor antenna and evaluate it in-vitro to demonstrate that it can communicate with commodity devices. We also build an implantable neural recording interface antenna and evaluate it in-vitro using muscle tissue. \textred{Finally, to demonstrate the applicability of our techniques beyond medical implants, we create credit card form-factor devices that can communicate with each other using Bluetooth transmissions as the RF signal source for backscatter.} \section{System Design} We use backscatter to transform transmissions from Bluetooth devices into Wi-Fi signals. In this section, we first provide an overview of Bluetooth and Wi-Fi physical layers and then describe how to create single-tone transmissions using Bluetooth devices. We then show how to create an 802.11b signal from this single tone Bluetooth transmission. Finally, we outline our design for bi-directional communication using OFDM Wi-Fi as an AM modulator. \section{\@startsection {section}{1}{\z@}% {2ex \@plus 1ex \@minus .1ex}% {1ex \@plus.2ex}% {\normalfont\bfseries\scshape\fontsize{11}{13}\selectfont}} \global\def\subsection{\@startsection{subsection}{2}{\z@}% {2ex\@plus 1ex \@minus .1ex}% {1ex \@plus .2ex}% {\normalfont\bfseries\fontsize{10}{12}\selectfont}} \def\@maketitle{\newpage \null \setbox\@acmtitlebox\vbox{% \baselineskip 20pt \vskip 2em \begin{center} {\ttlfnt \@title\par} \vskip 0.25em {\subttlfnt \the\subtitletext\par}\vskip 1.25e {\baselineskip 16pt\aufnt \lineskip .5em \begin{tabular}[t]{c}\hspace{-.15cm}\@author \end{tabular}\par} \vskip 0.75em \end{center}} \dimen0=\ht\@acmtitlebox \advance\dimen0 by -10pc\relax \unvbox\@acmtitlebox \ifdim\dimen0<0.0pt\relax\vskip-\dimen0\fi} \fi \def\sharedaffiliation{% \end{tabular} \begin{tabular}{c}} \begin{document} \font\ttlfnt=phvb8t at 16pt \newcommand{\supsym}[1]{\raisebox{6pt}{{\footnotesize #1}}} \widowpenalty = 10000 \title{\textred{Inter-Technology Backscatter: Towards \\Internet Connectivity for Implanted Devices}} \numberofauthors{1} \author{% Vikram Iyer\supsym{$\dagger$}, Vamsi Talla\supsym{$\dagger$}, Bryce Kellogg\supsym{$\dagger$}, Shyamnath Gollakota and Joshua R. Smith\\ \affaddr{University of Washington}\\ \coprimary{\supsym{$\dagger$}Co-primary Student Authors}\\ \affaddr{\{vsiyer, vamsit, kellogg, gshyam, jrsjrs\}@uw.edu}\\ } \maketitle \begin{sloppypar} \input{abstract-9} \input{intro-8} \input{overview-2} \input{versus-4} \input{bluesource-3} \input{genwifi-2} \input{downlink-5} \input{imp-1} \input{results-1} \input{applications-2} \input{related-3} \input{conclusion-3} \bibliographystyle{abbrv} \section{Related Work} Interscatter is related to our prior work on ambient and Wi-Fi backscatter communication~\cite{abc-sigcomm2013,abc-sigcomm2014, wifibackscatter-sigcomm2014} where devices communicate by backscattering ambient signals such as TV and Wi-Fi transmissions. Specifically, Wi-Fi backscatter~\cite{wifibackscatter-sigcomm2014} conveys information by either reflecting or not reflecting existing Wi-Fi packets on the wireless channel. This creates CSI changes that encode information. Since the minimum resolution at which the bits are conveyed is greater than a Wi-Fi packet, this limits the bit rate to 100--1000~bps. \textred{Recent work on FS-Backscatter~\cite{fs-backscatter} combines this packet-level backscatter approach with double sideband subcarrier modulation~\cite{nsdi16,rfid-textbook1,fm-backscatter-paper}. Specifically, it uses a ring oscillator to shift each Wi-Fi packet to a different frequency and achieves higher reliability than Wi-Fi backscatter. Interscatter differs from these designs in two ways. First, interscatter achieves standards-compliant 2--11~Mbps Wi-Fi packets where the content is generated by the backscattering device. This allows devices to transmit data at the high bit rates supported by Wi-Fi. In contrast, Wi-Fi backscatter and FS backscatter (in the context of Wi-Fi), encode information by either reflecting or not reflecting multiple packets from a Wi-Fi transmitter. As a result, the backscattered bits are encoded at the granularity of the Wi-Fi transmitter's packets and the backscatter device cannot change the packet content. Thus, the achieved bit rates are significantly lower. Second, these approaches require a large number of packets to be flooded by the Wi-Fi transmitter to send a small number of backscatter bits. This is not an efficient use of wireless resources and is likely to be unacceptable in crowded Wi-Fi networks. Finally in large scale production open loop ring oscillators are known to have frequency variation between devices~\cite{ring-otis, process-otis} and high phase noise which limit data rates and range performance. Given these constraints as well as the significant attenuation and detuning of antennas in human tissue, it is unclear whether this approach would be feasible for medical implants. } \cite{nasa,wifibackscatter-sigcomm2015} use full-duplex radios to cancel the high-power Wi-Fi transmissions from the reader and decode weak backscattered signals to enable high data rates of 5--330 Mbps. These approaches require a custom full-duplex radio to be incorporated at the receiver and hence do not work with existing devices. Passive Wi-Fi~\cite{nsdi16} generates 802.11b transmissions using double sideband subcarrier modulation~\cite{rfid-textbook1, fm-backscatter-paper} from a continuous wave transmitter. Specifically, it shows that backscatter can be used to generate 802.11b transmissions when backscattering transmissions from a custom transmitter that sends out constant wave signals.~\cite{bluetoothbackscatter} generates FSK Bluetooth transmissions by backscattering a continuous wave transmitter. We build on this work, but differ in three critical ways. 1) Prior work requires custom specialized continuous wave transmitter hardware. Thus, they cannot plug and play with commodity devices. We introduce a novel approach to backscatter communication where we demonstrate for the first time that one can transform transmissions from a Bluetooth device into Wi-Fi signals, and achieve a system that can work using only commodity radios. 2) Prior work could not perform single-sideband backscatter and hence used 44~MHz of bandwidth to generate 22~MHz Wi-Fi transmissions. This is undesirable given that the 2.4~GHz ISM band is becoming increasingly crowded. In contrast, we introduce the first single-sideband backscatter design that generates Wi-Fi signals on only one side of the carrier and has double the spectral efficiency over prior designs. 3) Prior work uses custom plugged-in hardware to communicate to the backscattering device. In contrast, we reuse Wi-Fi transmitters to convey information to the backscattering devices. Specifically, we introduce a novel mechanism that encodes information in OFDM symbols of a Wi-Fi transmission. Finally, Anynfc~\cite{cheap_rfid_reader} sells RFID readers that connect to smartphones via the headphone jack for \$185. While promising, RFID readers do not have the same economy of scale as Wi-Fi or Bluetooth which cost a few dollars~\cite{ti_ble_chip_buy}. Further, existing devices already have Wi-Fi and Bluetooth radios. This takes us closer to the vision of backscatter as a general-purpose communication mechanism. \section{Evaluation} We first check if we can create single tone transmissions on various Bluetooth platforms. We then measure the communication range and packet loss rate for the Wi-Fi packets generated by backscattering Bluetooth. Next, we evaluate the efficacy of our single sideband backscatter architecture. We then evaluate the communication link from an 802.11g transmitter to our low-power receiver. Finally, we demonstrate the feasibility of generating ZigBee transmissions. \subsection{Generating Bluetooth single tone} \label{sec:blue-results} We run experiments with three different Bluetooth devices: the Texas Instruments CC2650, a Moto 360 2nd gen smart watch, and a Samsung Galaxy S5. We connected the exposed antenna connector on the TI chipsets to a spectrum analyzer and recorded data during the payload section of a Bluetooth packet. The Android platforms do not expose antenna connectors, so instead we performed the same experiment by recording the signal through a a 2~dBi monopole antenna connected to the spectral analyzer. We set the application layer data as described in~\xref{sec:bluetooth} to create a single tone. Fig.~\ref{fig:spectra} shows the spectrum of random Bluetooth transmissions in green. It also shows the same spectrum (in red) after performing the operations described in~\xref{sec:bluetooth} for comparison. The plots show that we can create single tone transmissions from commodity Bluetooth devices. \subsection{Measuring the Wi-Fi RSSI} We measure Wi-Fi RSSI for different distances between the backscatter device, Bluetooth transmitter and Wi-Fi receiver. We first fix the distance between the backscatter device and the Bluetooth transmitter. We then move the Wi-Fi receiver perpendicular from the mid-point of the line connecting the other two devices and measure the RSSI of the backscattered Wi-Fi packets reported by the Wi-Fi receiver. We set the backscatter device to generate 2~Mbps Wi-Fi packets on channel 11. The Bluetooth transmitter sends advertising packets with a 31 byte payload on BLE channel 38, once every 40~ms. We use a TI Bluetooth device and an Intel Link 5300 Wi-Fi card as our Bluetooth transmitter and Wi-Fi receiver respectively. We use four power values at the Bluetooth transmitter: 1) 0~dBm which is the typical configuration for Bluetooth devices, 2) 4~dBm, which is supported on Samsung S6~\cite{fcc-samsungs6} and One Plus 2 ~\cite{fcc-oneplus2}, 3) 10~dBm, which is supported by Samsung Note 5~\cite{fcc-samsungnote5} and iPhone 6~\cite{fcc-iphone6}, and 4) 20~dBm which is supported by class 1 Bluetooth devices. \begin{figure}[!t] \subfigure[1~feet between the backscatter device and Bluetooth transmitter] { \includegraphics[width=\columnwidth]{./figures/rssi_vs_dist_1ft.eps} } \subfigure[3 feet between the backscatter device and Bluetooth transmitter] { \includegraphics[width=\columnwidth]{./figures/rssi_vs_dist_3ft.eps} } \caption{{\bf Measuring the Wi-Fi RSSI.} RSSI versus distances between the backscattering device, Bluetooth transmitter and Wi-Fi receiver at different transmit power values.} \label{fig:rssi_dist} \vskip -0.15in \end{figure} Fig.~\ref{fig:rssi_dist} shows the results when the Bluetooth transmitter and the backscatter device are 1 and 3 feet apart. We pick these distances since we expect the user to use their mobile devices close to the backscatter device they intend to interrogate. The x-axis plots the distance between the Wi-Fi receiver and the backscatter device while the y-axis plots the reported Wi-Fi RSSI values. The figure shows that: \begin{Itemize} \item At higher transmit powers, the range at which Wi-Fi packets are reported is high --- with 20~dBm, we achieve a range of around 90~feet. This is because higher transmit powers translate to high-powered Bluetooth signals at the backscatter device. This in turns increases the RSSI of the backscatter generated Wi-Fi packets. \item For a similar reason, at larger distances between the Bluetooth transmitter and the backscatter device, the Wi-Fi RSSI and range are lower. We however note that the achieved ranges are more than sufficient for the target personal area networking applications shown in Fig.~\ref{fig:applications}. \item While the RSSI values are lower than typical 802.11n/g deployment, the reported RSSI values are mostly sufficient for decoding 2~Mbps 802.11b transmissions given that theoretically 2~Mbps Wi-Fi transmissions require an SNR of only 6~dB for reliable communication. \end{Itemize} Finally, we compute the packet error rate (PER) observed on the backscatter generated Wi-Fi packets across the whole spectrum of RSSI values observed in our experiments. To do this, we configure the backscatter device to consecutively transmit 200 unique sequence numbers in a loop that we use to compute the error rate the Wi-Fi receiver. We compute the packet error rate for both 2 and 11~Mbps Wi-Fi transmissions. For 2~Mbps and 11~Mbps, we generate packets with a payload of 31 and 77~bytes respectively so as to fit within a Bluetooth advertising packet. Fig.~\ref{fig:per} shows a CDF of the observed packet loss rate. The figure shows that, \begin{Itemize} \item Both 2~Mbps and 11~Mbps transmissions have similar packet loss rates. This is because the Wi-Fi packet payload sizes that can fit within a Bluetooth advertising packet are small. Further, both our 2~Mbps and 11~Mbps Wi-Fi packets use preamble and header encoded at the same bit rate. Thus, we see similar packet error rates between the two transmissions. This provides an interesting design choice in our system, where given the small packet sizes, if we were to optimize for the number of retransmissions, it is better to use the higher Wi-Fi bit rates and transmit more bits. Exploring this and how it interacts with power consumption would be an interesting future direction. \item The packet error rate was greater than 30\% for low RSSI values. In principle, we can leverage prior work in our community~\cite{marnello,mrd} that use diversity and coding to account for such packet losses in Wi-Fi networks. \end{Itemize} \begin{figure}[!t] \includegraphics[width=\columnwidth]{./figures/per.eps} \vskip -0.1in \caption{{\bf Wi-Fi packet error rate.} We measured packet error rate for backscatter-generated Wi-Fi packets at both 2 and 11 Mbps.} \vskip -0.1in \label{fig:per} \end{figure} \subsection{Efficacy of single sideband backscatter} We compare the single sideband backscatter design introduced in this paper with prior double sideband backscatter hardware designs~\cite{nsdi16}. We use a USRP to transmit a single tone carrier such that the unintended mirror copy generated by double sideband backscatter appears in Wi-Fi channel 6. We then configure a standard Wi-Fi transmitter-receiver pair on channel 6 and evaluate the effect of the backscatter interference by running iperf using TCP with the default Wi-Fi rate adaptation algorithm. We use a Linksys WRT54G Wi-Fi AP as the Wi-Fi transmitter and a Nexus 4 smartphone as the Wi-Fi receiver separated by 10~feet. We set the backscatter device to generate 2~Mbps Wi-Fi packets with 32 byte payloads, at a distance of 2~feet from the Wi-Fi receiver. Fig.~\ref{fig:interference} shows the iperf throughput in the presence of single and double-sideband backscatter hardware. The x-axis shows the rate at which Wi-Fi packets are generated using backscatter. For comparison, we show the baseline throughput in the absence of both backscatter devices. The plot shows that, \begin{Itemize} \item When the backscattering device generates a small number of packets (50 pkts/s), it has negligible impact on the concurrent iperf flow. This is true with both single-sideband and prior double sideband backscatter designs. This is expected because the backscattered packets are small and are transmitted at a very low rate that they do not affect the throughput of concurrent Wi-Fi connections. \item When we backscatter Wi-Fi packets at a higher rate, the iperf throughput is reduced with prior double sideband backscatter hardware. This is because it creates a mirror copy on Wi-Fi channel 6 that reduces the throughput of any other Wi-Fi connection. However, we see negligible impact on the iperf throughput with our single-sideband hardware. This demonstrates that our single-sideband backscatter design can double spectral efficiency. \end{Itemize} \begin{figure}[!t] \includegraphics[width=\columnwidth]{./figures/iperf_interfere.eps} \caption{{\bf Efficacy of single sideband backscatter.} We compare our design with double sideband backscatter designs on the throughput of an iperf flow on a concurrent Wi-Fi transmitter-receiver pair. Baseline is the throughput in the absence of any backscatter device.} \label{fig:interference} \end{figure} \subsection{Communication in reverse direction} \label{sec:res_downlink} \begin{figure}[!t] \includegraphics[width=\columnwidth]{./figures/downlink.eps} \vskip -0.1in \caption{BER from 802.11g device to our low-power receiver.} \vskip -0.15in \label{fig:downlink} \end{figure} As described in~\xref{sec:downlink}, we create an AM modulated signal using OFDM by setting the appropriate modulated bits on each OFDM symbol. This however requires us to know the scrambling seed that is used by the Wi-Fi transmitter. We run experiments to track how different chipsets change the scrambling seed between packets by transmitting 802.11g packets at a bit rate of 36~Mbps from each Wi-Fi device. Since existing Wi-Fi receivers do not expose the scrambling seed, we instead use the gr-ieee802-11 package~\cite{usrp-802.11g} for GNURadio which implements the complete 802.11g receive chain to view the scrambling seed for each packet. Our experiments reveal that the AR5001G, AR5007G and AR9580 Atheros chipsets simply increment the scrambling seed by one between frames which is consistent with other studies~\cite{scrambler-seed}. We were also able keep the seed value fixed on ath5k cards by setting the GEN\_SCRAMBLER field in the AR5K\_PHY\_CTL register of the driver. Next, we evaluate how our reverse link works with our low-power peak detector receiver. We transmit 36~Mbps 802.11g packets scrambled with a known seed. The Wi-Fi transmitter is configured to send a pre-defined repeating sequence of bits using the encoding in~\xref{sec:downlink}. We move our low-power receiver away from the Wi-Fi transmitter and compute the observed bit error rate at each location. Fig.~\ref{fig:downlink} shows the BER results as a function of the distance between the Wi-Fi transmitter and our peak detector receiver. The plot shows that despite the significant variability of OFDM, our peak detector achieves bit error rates less than 0.01 at distance of up to 18. Our current receiver uses off-the-shelf components and has a sensitivity of -32~dBm for 160~kbps. This however can be improved in a custom IC implementation that could give us higher ranges. \subsection{Generating ZigBee Using Backscatter} Finally, we show the feasibility of generating ZigBee signals by backscattering Bluetooth transmissions. ZigBee operates in the 2.4~GHz band over 16 channels where each channel is 5~MHz wide. At the physical layer, ZigBee achieves bit rates of 250~kbps using DSSS coding and offset-QPSK and has a better noise sensitivity than Wi-Fi. Since we have demonstrated that we can generate 802.11b that uses DSSS and QPSK, we adapt the techniques in~\xref{sec:genwifi} to also generate ZigBee-compliant packets. \begin{figure}[!t] \includegraphics[width=\columnwidth]{./figures/zigbee.eps} \vskip -0.1in \caption{{\bf CDF of ZigBee RSSI.} We measure the RSSI of backscatter-generated ZigBee packets at five different locations.} \vskip -0.15in \label{fig:zigbee} \end{figure} To evaluate this, we use the TI CC2650 Bluetooth device as our Bluetooth transmitter on advertising channel 38 and set our backscatter device to generate packets on channel 14, i.e., 2.420~GHz. We use the TI CC2531 as our commodity ZigBee receiver to receive the packets generated by the backscatter device. We place the backscattering device two feet away from the Bluetooth transmitter and the ZigBee receiver at five different locations up to 15~feet from the backscatter device. Fig.~\ref{fig:zigbee} shows the CDF of the ZigBee RSSI values for various distance locations, showing the feasibility of generating ZigBee packets with backscatter. We note that existing ZigBee transmitters consume tens of milliwatts of power when actively transmitting. In contrast, our backscatter based approach would consume tens of microwatts while transmitting a packet and could be beneficial for short range communication with nearby ZigBee devices. \subsection{Bluetooth Versus Wi-Fi} \label{sec:versus} \vskip 0.05in\noindent{\bf Bluetooth.} Bluetooth low energy (BLE) devices use the advertisement channels to broadcast information about their presence and to initiate connections. Once the connection is established with a nearby Bluetooth device, they communicate by hopping across the 36 data channels spread across the 2.4~GHz ISM band. The three advertisement channels labeled as channels 37, 38 and 39 are shown in Fig.~\ref{fig:versus}. Since transmissions on data channels require establishing a connection with another device, we focus on Bluetooth advertisement channels where we can broadcast packets. Bluetooth LE uses Gaussian Frequency Shift Keying (GFSK) modulation with a bandwidth of 2~MHz. Specifically, a `1' (`0') bit is represented by a positive (negative) frequency shift of approximately 250~kHz from the center frequency. The resulting FSK signal is then passed through a Gaussian filter to achieve the desired spectral shape. \vskip 0.05in\noindent{\bf Wi-Fi.} While Wi-Fi supports a suite of standards, we focus on 802.11b for the purpose of backscatter. Wi-Fi operates on three non-overlapping channels, each 22~MHz wide. To create 1 and 2~Mbps transmissions, 802.11b first XORs each data bit with a Barker sequence to create a sequence of eleven coded bits for each incoming data bit, which it then modulates using DBPSK and DQPSK. To create 5.5 and 11~Mbps transmissions, 802.11b uses CCK where each block of four incoming bits is mapped to 8-bit code words, which are then transmitted using DBPSK and DQPSK.
{'timestamp': '2016-07-19T02:00:40', 'yymm': '1607', 'arxiv_id': '1607.04663', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04663'}
arxiv
\section{Introduction} The rapid growth of mobile wireless applications and consumers continues to strain the limited cellular network capacity and has motivated the exploration of next generation 5G wireless networks. The mobile industry predicts a $1000$x data traffic growth by 2020. To meet this anticipated data growth demand, both industry and academia are exploring various advanced solutions to boosting network capacity while continually providing high-level user experience to wireless customers. One natural direction is developing new technologies to improve the efficiency of limited licensed spectrum. Such popular advances include small cell base station (SBS) coverage, massive multiple-input multiple-output links, and device-to-device communications. Despite these exciting solutions, one key obstacle to network capacity expansion still lies in the scarce licensed spectral resources. To overcome spectrum shortage, LTE in unlicensed spectrum (LTE-U) technology has been proposed and is currently under consideration by the 3GPP into its future standards. LTE-U technology allows users to access both licensed and unlicensed spectra under a unified LTE network infrastructure. It can provide better link performance, medium access control (MAC), mobility management, and larger coverage than simple Wi-Fi offloading \cite{traffic,offload}. Despite the many advantages of LTE-U, it still faces certain technical challenges. One primary issue is the coexistence with the incumbent Wi-Fi systems. On the one hand, LTE systems are specifically designed to operate in the licensed spectrum under the centralized control of network units based on non-contention MAC protocols to prevent packet collision among subscribers. On the other hand, Wi-Fi users rely on carrier sensing multiple access with collision avoidance (CSMA/CA) to reduce packet collision and use a contention based MAC protocol, namely distributed coordination function (DCF), to resolve package collision through a random backoff mechanism. Therefore, how to ensure a fair and harmonious coexistence environment for both networks becomes a major challenge for LTE-U. First, for the two conflicting MAC technologies to coexist in the same unlicensed band, their mutual impact and interference must be carefully controlled and managed. It is important that a) Wi-Fi transmissions will not frequently collide with LTE-U transmissions; b) LTE-U transmissions will not lead to a substantial drop of Wi-Fi throughput. Secondly, we should require a coexistence proposal of LTE-U and Wi-Fi so as not to demand fundamental changes to the existing protocols defined in LTE and Wi-Fi standards. This requirement is essential to avoid any impractical retrofitting of IEEE 802.11-compliant Wi-Fi radios, or the re-design of existing 3GPP standards. To overcome such challenges, we will first propose a new wireless access point (AP) architecture, namely hyper-AP (HAP), which is deployed by cellular operators and functions simultaneously as an LTE SBS and a Wi-Fi AP. By integrating both LTE and Wi-Fi functions within the same HAP node, it can then jointly coordinate the spectrum allocation and the interference management for Wi-Fi and LTE-U. Based on the use of HAP, we develop a novel LTE-U and Wi-Fi coexistence mechanism by embedding LTE-U signalling within the existing Wi-Fi protocol for seamless integration. Specifically, the HAP will provide LTE user access in the contention free period (CFP) under a centralized coordinator, whereas the HAP continues to provide normal Wi-Fi user access through its contention period (CP) using the traditional CSMA/CA mechanism. The main merit of the newly proposed HAP is that it can well support the standalone mode for LTE-U transmission, which is found to be a formidable hurdle in many other coexistence mechanisms. In what follows, we shall first provide an LTE-U technology overview, including operation modes, coexistence technologies for LTE and Wi-Fi, and current considerations of combining LTE-U technology within Wi-Fi MAC protocols. Next, we introduce the new wireless HAP that provides both LTE-U access and Wi-Fi access in shared unlicensed band. To improve the system performance, our key contribution is the novel LTE and Wi-Fi coexistence mechanism that embeds LTE-U channel access within a standardized Wi-Fi protocol. We shall also provide simulation results to illustrate the achievable network performance gain in terms of Wi-Fi per-user throughput and overall system throughput. Compared with networks under traditional coexistence technology without LTE-U deployments, the proposed network access demonstrates better performance for both LTE-U and Wi-Fi user groups. \section{Overview of LTE-U Technology} \subsection{LTE-U Operation Modes} Presently, there are mainly three operation modes proposed for LTE-U networking based on different control channel configurations and supplementary links: supplementary downlink (SDL), carrier aggregation (CA) time division LTE (TD-LTE), and standalone LTE-U \cite{coe1},\cite{coexistence}. In SDL mode, the licensed spectrum serves as the anchor carrier. When needed, the unlicensed spectrum is used for additional downlink data transmission since the downlink demand is often higher than uplink. Since the SDL mode merely utilizes the unlicensed spectrum as a downlink supplement, carrier aggregation technique can be applied with few changes on the existing LTE standards. In carrier aggregation TD-LTE mode, the unlicensed spectrum is used as an auxiliary TDD channel to carry both downlink and uplink traffic. Its control channels remain on the licensed spectrum. Once again, CA techniques can be adopted to execute the carrier aggregation TD-LTE mode. In standalone LTE-U mode, both data and control signals from LTE-U nodes are transmitted on unlicensed spectrum without relying on the additional licensed spectrum. This mode can be used in the areas without guaranteed coverage of licensed cellular infrastructure, and hence is a more flexible form of LTE-U. Moreover, this mode also lacks an intelligent and centralized control signalling on licensed spectrum to ensure reliable transmission, resource utilization, channel measurement, among others. \subsection{LTE and Wi-Fi Coexistence Technologies} \label{section_coexistence} Wi-Fi and LTE have substantially different PHY/MAC protocols, making their joint coordination exceptionally challenging. In a nutshell, the LTE system uses a centralized MAC protocol which allocates a non-overlapping set of physical resource blocks in time-frequency domain to mobile users within a cell. There is no contention among users within such centralized multiple access in both downlink and uplink. On the other hand, the Wi-Fi MAC protocol uses a decentralized, contention-based, random access mechanism based on CSMA/CA and DCF. If properly designed, LTE-U networks should be a good spectrum-sharing partner with the incumbent Wi-Fi networks within the unlicensed band \cite{neighbor}. Next, we will introduce several known LTE and Wi-Fi coexistence mechanisms, which are also summarized in Table \ref{tab_coe}. \subsubsection{Channel Splitting Coexistence} In some cases, the unlicensed spectrum is sufficiently wide. It becomes possible for the LTE-U SBS to choose the cleanest channel, i.e., the channel exhibiting the lowest sensed interference power level, based on power and activity measurements. In this case, the SBS is almost free of interference from its neighboring Wi-Fi devices if the Wi-Fi APs are given a ``channel-clearing'' request by the SBS. Qualcomm has developed a simple and efficient dynamic channel selection method \cite{neighbor}. Other works have also discussed ways to leverage existing underlay techniques in both LTE-U and Wi-Fi systems to ensure the least congested channel selection. We shall note that, although the unlicensed spectrum is not unlimited, there is still a chance that it has not been fully utilized by Wi-Fi users. There may exist little Wi-Fi activity in some locations such as certain outdoor environments. Therefore, dynamic channel selection may suffice to meet the coexistence requirement in various low or medium-density Wi-Fi deployment scenarios. \subsubsection{Channel Sharing Coexistence} When the Wi-Fi APs are densely deployed, it is very likely that the SBS has to share the unlicensed channel with Wi-Fi systems. According to the regional regulatory requirements, co-channel coexistence mechanisms can be separated into two kinds: listen-before-talk (LBT) and non-LBT markets. In LBT markets, such as Europe and Japan, the mechanism of CSMA/CA will be used. Before data transmission, the cognitive SBS will attempt to access the unlicensed spectrum to assess whether there exists sufficient access opportunities. When the unlicensed spectrum is deemed idle, the SBS will activate; otherwise, the SBS will back off one period. Given the simplicity of this CSMA/CA protocol, it is not effective in highly dense Wi-Fi networks that rarely have idle channels. In non-LBT markets, such as the United States, South Korea, China, and India, several mechanisms have also been proposed to facilitate the coexistence. Qualcomm has proposed a duty-cycle based carrier sensing adaptive transmission (CSAT) mechanism that measures channel utilization by neighboring nodes and adopts the on/off duty cycle of secondary cells in the unlicensed band \cite{neighbor}. The duty cycle period is determined by LTE MAC control elements, and is adaptively chosen based on the number of measured active Wi-Fi APs and their channel occupancy to allow a fair sharing between LTE-U and Wi-Fi. In \cite{coe6}, a similar duty cycle mechanism called LTE muting was proposed to silence some LTE-U subframes for Wi-Fi usage. The almost blank subframes mechanism in existing LTE standard can also be exploited to enable the duty cycle mechanism \cite{coe8}. Furthermore, the authors in \cite{bib_Yun} proposed to utilize multiple antenna configurations and to exploit different frame structures between the two systems for efficient coexistence. The cognitive radio schemes have also been taken into account for LTE and Wi-Fi coexistence in \cite{bib_Guan}. Generally, the proposed mechanisms in non-LBT markets are more compatible with the existing LTE standards and are simpler to implement than the LBT mechanism. Moreover, in the high density Wi-Fi environment, the LBT mechanism is likely to fail since open channel opportunities for LTE-U are slim. In such cases, non-LBT mechanisms can achieve a good performance by carefully selecting the duty cycle (or muting) period. \begin{table}[!hbp] \renewcommand{\multirowsetup}{\centering} \caption{LTE and Wi-Fi coexistence technologies} \label{tab_coe} \small \center \begin{tabular}{|c|c|c|c|} \hline \rowcolor{mygray} \bf{Types} & \bf{Features} & \bf{Ideas} & \bf{Examples} \\ \hline \tabincell{c}{Channel-\\ Splitting} & \tabincell{c}{Channel\\ selection} & \tabincell{l}{SBS selects the channel having the \\ lowest interference power to avoid \\interference with nearby nodes.} & \tabincell{c}{Dynamic frequency\\ selection \cite{neighbor}}\\ \hline \multirow{5}{2.2cm}{Channel-Sharing} & LBT & \tabincell{l}{\hspace{1em}SBS adopts the CSMA/CA with\\ \hspace{1em}collision avoidance mechanism\\ \hspace{1em}to access unlicensed spectrum.} & \tabincell{c}{Dynamic duty cycle\\ with LBT \cite{DLBT}} \\ \cline{2-4} & non-LBT & \tabincell{l}{SBS senses the channel\\ utilization then adopts\\ duty cycle of the unlicensed\\ spectrum.} & \tabincell{c}{Duty cycle based\\ CSAT \cite{neighbor}; \\ LTE muting \cite{coe6, coe8, bib_Yun, bib_Guan}} \\ \hline \end{tabular} \end{table} \subsection{Coexistence from Wi-Fi Perspective} \label{section_structure_A} Thus far, our discussions have centered on the necessary aspects of an LTE-U system to coexist with Wi-Fi networks in the unlicensed band. Here, we will briefly summarize how Wi-Fi MAC protocols may be affected by the presence of coexisting LTE-U and discuss their coexistence challenges. We start with the default and the most commonly utilized Wi-Fi channel access mechanism known as DCF. Under the DCF mechanism, pure Wi-Fi users will have less opportunities to access the channel if they sense that LTE users are continuously occupying certain channels. Even with LBT or non-LBT mechanisms at the LTE side, Wi-Fi transmissions could still be disrupted because of the well-known exposed-node problem, which occurs when a node is prevented from sending packets to other nodes owing to a neighboring transmitter. Conversely, LTE transmissions will also be interfered by the Wi-Fi systems under DCF for the same reason. Despite the popularity of the DCF mechanism, point coordination function (PCF) is a well-known optional protocol capability for Wi-Fi infrastructure mode. Under the PCF mechanism, there exists a CFP followed by a CP in each periodic access interval and Wi-Fi nodes can be centrally coordinated by an AP for controlled channel access with a point coordinator (PC) in the CFP. Although the PCF option has seldom been used until now, its centralized, contention-free nature provides a perfect mechanism for LTE-U channel sharing without interference from contention based Wi-Fi transmission. By activating PCF, the CFP can be used by LTE-U channel access whereas the CP can be continually occupied by Wi-Fi nodes in sharing the unlicensed band without mutual interference. We further note that, in addition to the classic DCF and PCF, a more versatile hybrid coordination function (HCF) is another option for infrastructure Wi-Fi access. Unlike in PCF, the CFP in the HCF includes several contention free intervals known as HCF Controlled Channel Access (HCCA) transmission opportunity (TXOP). Moreover, HCF based Wi-Fi nodes access the Wi-Fi channels by utilizing a QoS-aware hybrid coordinator (HC). To ensure QoS of LTE-U users, medium access proportion of each node may be allocated according to the priority of services. Because of the flexibility and the self-control ability of HCF, it is more suitable to LTE-U applications given only unlicensed band. \section{LTE-U Embedded in Wi-Fi Protocols} In this section, we first propose a novel HAP for LTE and Wi-Fi coexistence and then introduce an innovative LTE and Wi-Fi coexistence mechanism by embedding LTE-U within existing Wi-Fi protocol. \subsection{A New LTE-U Framework} One major obstacle to LTE-U is the lack of centralized coordinator in the unlicensed band, making it difficult to manage mutual interference between the two channel sharing networks. To tackle this problem, we propose a novel wireless AP, called HAP, which integrates both the Wi-Fi AP and SBS functionalities into a single networking unit. The Wi-Fi side of the HAP exclusively accesses the unlicensed spectrum, while the LTE side of the HAP can access both licensed and unlicensed bands. Because the HAP is deployed by the same network service provider, it can more efficiently mitigate the mutual interference between the two networks through careful management of both licensed and unlicensed bands. \begin{figure} \begin{centering} \includegraphics[width=0.7\textwidth]{unlicensed_model.eps} \par\end{centering} \caption{LTE-U embedded in Wi-Fi protocol.}\label{fig_unlicensd_model} \end{figure} We propose an approach different from the existing LTE-U mechanisms, which is depicted in Fig. \ref{fig_unlicensd_model}. In the CFP, a centralized coordinator controls the resource allocation scheme. When one LTE-U radio transmits during CFP, other LTE-U and Wi-Fi radios are muted. In this way, interference between different radios and from the Wi-Fi transmission can be avoided. On the other hand, since the transmission periods for both LTE and Wi-Fi users are completely separated, Wi-Fi users will no longer need to compete for unlicensed resources with LTE users. Hence, the performance of the Wi-Fi network can be separately controlled and managed. The proposed LTE and Wi-Fi coexistence technique functions as follows. When an HAP is on, it shall first scan the unlicensed band and select the channel with the least background interference power and the lowest user occupancy. Thereafter, each HAP determines its CFP and CP allocations for the chosen channel at a CFP repetition interval according to its traffic needs and other QoS considerations. Once the setup of channel-sharing between contention-free LTE-U and contention-based Wi-Fi completes, LTE-U and Wi-Fi users can access the unlicensed spectrum via the CFP and the CP, respectively. In the following, we will present two LTE-U embedding proposals: unlicensed carrier aggregation (UCA) TD-LTE and standalone LTE-U operation modes. We note that the SDL mode is a special case of the carrier aggregation TD-LTE without the uplink transmission in LTE-U. Therefore, we do not devote special attention to the SDL mode henceforth. We shall also note that, along with the other LTE-U networks, the following two modes are better suited to support delay-tolerant services due to the volatility of the Wi-Fi traffic and the uncertainty of background interference on the unlicensed spectrum. \subsection{Unlicensed Carrier Aggregation of TD-LTE} We now demonstrate how to implement the UCA TD-LTE mode in the proposed HAP. As shown in the carrier aggregation phase of Fig. \ref{fig_LTEU-CA}, the HAP will first read its Wi-Fi beacons, which are located at the start of each CFP. The beacons contain the information of the time stamp and the CFP length. The HAP then will decide whether and when to aggregate the unlicensed and licensed bands according to the beacon, i.e., based on the available transmission interval calculated by the time stamp and CFP length embedded in the beacon. The decision is then signalled to the LTE-U users in the licensed downlink control channel (DCCH). Since the unlicensed spectrum is only used for data payload transmission (i.e., to expand the downlink shared channel (DSCH) bandwidth), both PCF and HCF mechanisms can be adopted. The signalling exchange procedure of the proposed scheme is also shown in Fig. \ref{fig_LTEU-CA}. First, an association request will be sent by a user equipment (UE). After receiving the association request, the HAP will search for channels with the lowest interference power and the highest CFP vacancy, then decide whether and when to aggregate these unlicensed bands as LTE-U channels based on its time-stamp and CFP length, and later respond to the user with its control signals and an uplink (UL) grant. Thereafter, a signal carrying the user identity will be sent to the HAP, and the HAP will send Radio Resource Control (RRC) signal to decide the channel allocation given its licensed bands and the newly acquired carrier aggregation resources. \begin{figure} \begin{centering} \includegraphics[width=1\textwidth]{CA_TD-LTE.eps} \par\end{centering} \caption{Procedure for UCA TD-LTE mode.}\label{fig_LTEU-CA} \end{figure} \subsection{Standalone LTE-U} We now propose a standalone (SA) LTE-U mode in our HAP framework. In the SA LTE-U mode, both the control and data channels of the LTE-U system must reside in the unlicensed band without the help of an auxiliary licensed spectrum. In this mode, it is likely that the allowable duration of each TXOP is too short to accommodate a LTE frame (i.e., $10$ ms). Thus, to properly embed LTE-U into the Wi-Fi networks, the active length of each LTE frame should be adapted. In light of standardized LTE transmissions, we shall exploit the discontinuous reception (DRX) and discontinuous transmission (DTX) mechanisms in the LTE protocol for LTE-U embedding \cite{DX2}. According to the existing DTX and DRX standard formats, the LTE frame can be shortened through silencing to fit into a TXOP duration. By shortening an LTE frame to fit within a TXOP interval, we are able to embed SA LTE-U transmission into an existing Wi-Fi timing structure in the unlicensed band. In fact, the Wi-Fi only users can be fully oblivious to the presence of SA LTE-U without the need for any protocol or standard readjustment. Fig. \ref{fig_DTX_DRX_LTEU} shows an example of a shortened LTE frame with $6$ subframes that are embedded into the TXOP duration. Each LTE subframe begins with a control region that covers $1$ to $3$ OFDM symbols. The primary and secondary synchronization signals (PSS and SSS, respectively) of the SA LTE-U are transmitted in subframes $0$ and $5$ and the physical broadcast channel (PBCH) is transmitted in subframe $0$. Because subframes $0$ and $5$ carry crucial synchronization information, we shall define each TXOP duration for LTE-U to span at least $6$ subframes\footnote{According to the IEEE 802.11n standard, TXOP duration is in the range from $32~\mu s$ to $8160~\mu s$ in increments of $32~\mu s$.} or 6 ms. The beacons in Wi-Fi HCF carry the system information such as the time stamp, the length of CFP, and the starting time and the maximum length of each TXOP. Before each (shortened) SA LTE frame, there should also be a header to help with the frame synchronization. Moreover, an ACK signal will be sent at the end of each TXOP. In what follows, we will show the operation process for both uplink and downlink. \begin{figure} \begin{centering} \includegraphics[width=1\textwidth]{standalone_LTE.eps} \par\end{centering} \caption{Procedure for SA LTE-U mode.}\label{fig_DTX_DRX_LTEU} \end{figure} The part of DTX LTE-U mode in Fig. \ref{fig_DTX_DRX_LTEU} shows the process of uplink signal transmission with the DTX mechanism. In the discovery and association phase, a UE will first send an association request to the serving HAP once it has data to transmit. The serving HAP will respond to the UE with the beacon information and a UL grant. Thereafter, the UE will check the Wi-Fi Beacon and determine whether to work with that HAP. After the UE joins LTE-U, the signal transmission will go into the phase of normal data transfer, during which both the user identity and DTX length $n$ will be sent to the HAP. On the unlicensed band, HAP also uses SA LTE-U to exchange RRC information with the UE. Finally, the uplink and downlink transmissions will stay active for $n$ subframes. The UE will return to DTX mode in the ensuing $10-n$ subframes, and then wake up again to send more data. Similarly, the part of the DRX LTE-U mode in the Fig. \ref{fig_DTX_DRX_LTEU} shows the signalling exchange procedure of the downlink transmission with the DRX mechanism. A UE will wake up periodically to check PDCCH. If the UE cannot monitor the PDCCH, it would return to sleep again; otherwise, the UE would send the pending data transmission request to the serving HAP. Upon receiving the pending data transmission request, the serving HAP will allocate physical resources on the unlicensed spectrum to the UE. From the beacon information and the LTE-U broadcast channel, the UE can locate the LTE-U control channels. Information such as UE identity, buffer status, and the DRX length $n$ will be sent to the serving HAP. Accordingly, the HAP determines the resource allocation. Finally, the shortened $n$ subframes will carry downlink and uplink transmissions, and the UE will sleep for the next $10-n$ subframes in DRX before waking up for more downlink reception. \section{Performance Evaluation} \begin{table}[] \caption{System Parameters}\label{parameter} \centering{ \small \begin{tabular}{|c|c|c|c|} \hline Parameters & Settings & Parameters & Settings \tabularnewline \hline \hline Noise power & $-174$~dBm/Hz & PHY header & $192$ bits \tabularnewline \hline Path loss exp. & $5$ & MAC header & $224$ bits \tabularnewline \hline Transmit power & $30$~dBm & Propagation delay & $20$ $\mu s$ \tabularnewline \hline Payload length & $1500$ byte & SIFS & $16$ $\mu s$ \tabularnewline \hline Bandwidth & $20$ MHz & DIFS & $50$ $\mu s$ \tabularnewline \hline Min. backoff window & 16 & Slot time & $9$ $\mu s$ \tabularnewline \hline Max. backoff window & $1024$ & ACK & $112$ bits + PHY header \tabularnewline \hline Max. backoff stage & $6$ & RTS & $160$ bits + PHY header \tabularnewline \hline WiFi channel bit rate & $130$ Mbps & CTS & $112$ bits + PHY header \tabularnewline \hline \end{tabular} \end{table} In this section, we will consider a two-tier network in which HAPs operate under the coverage of a macrocell. We deploy $N$ Wi-Fi users and $M$ LTE-U users according to Poisson distribution within the coverage of an HAP. Each user will associate with the proper serving HAP according to standard LTE association strategies, and the licensed bands are orthogonally allocated to the macrocell as well as each HAP. We let the Wi-Fi be the most popular IEEE 802.11n protocol in the $5$ GHz unlicensed band with $20$ MHz bandwidth and certain useful parameters can be found in \cite{ave_LTE}. We let the HAP coverage have a radius of $100$ m. The length of the CFP repetitional interval is $100$ ms, which is the default value in the IEEE 802.11n. The channel fading between LTE-U users and the HAP follows standard 3GPP fading model \cite{fading}. The parameters are listed in Table \ref{parameter}. In our performance evaluation tests, we compare the HAP based network performance against two benchmark access schemes. Specifically, our proposed LTE-U network based on the HAP framework is compared against the pure Wi-Fi access without LTE-U deployment (labelled as ``original'' henceforth in all figures). The LTE-U access based on the LBT protocol is also included. For simplicity, we do not differentiate specific traffic types for each LTE user and let available channel resources be equally allocated among LTE-U and Wi-Fi users. In other words, we let the fractions of CFP and CP in the HAP network are $\frac{M}{M+N}$ and $\frac{N}{M+N}$, respectively. Note that this assignment is simple but not necessarily optimum. Fig. 4(a) presents the comparative results of average Wi-Fi per-user throughput under the three network service protocols. Recall that the ``original'' network denotes the pure Wi-Fi case without serving LTE-U users, which naturally delivers the highest Wi-Fi throughput among all three scenarios. Because of the channel contention, the per-user Wi-Fi throughput decreases as the number of Wi-Fi users grows under each of the three protocols. What is more interesting is that, for smaller number of LTE-U users ($M$ = 5), the proposed HAP can improve the per-user Wi-Fi throughput by 20\%- 30\% above that of the LBT protocol. For larger number of LTE-U users ($M = 10$), the improvement becomes more significant (30\% - 70\%). The reason is that LBT is still a contention-based protocol whose performance would deteriorate as the number of competing users grows. On the other hand, our newly proposed HAP-based access protocol divides the LTE-U spectrum access orthogonally from the Wi-Fi user access such that the cross-network interference between LTE-U and Wi-Fi is avoided. The results in Fig. 4(a) demonstrate that the proposed HAP coverage can better preserve Wi-Fi network throughput than the LBT scheme. \begin{figure} \center \subfigure[Per-user Wi-Fi throughput under different networks.]{ \begin{minipage}[b]{0.5\textwidth} \includegraphics[width=10cm]{wifi_throughput.eps} \end{minipage} } \subfigure[LTE-U, Wi-Fi, and total throughput comparison in unlicensed spectrum under different LTE-U modes.]{ \begin{minipage}[b]{0.5\textwidth} \includegraphics[width=10cm]{throughput2.eps} \end{minipage} } \caption{Simulation results.} \end{figure} In Fig. 4(b), we further compare the LTE-U throughput, the Wi-Fi throughput, and the overall system throughput under the three different network scenarios. We randomly place $30$ Wi-Fi users and $10$ LTE-U users within the HAP coverage area. In addition, the results in Fig. 4(b) illustrate that the proposed HAP architecture achieves higher LTE-U throughput, higher Wi-Fi throughput, and higher overall system throughput when compared with the LBT protocol. Under HAP, the overall system throughput can be $50\%$ plus with only a mild loss of Wi-Fi throughput when compared against the original pure Wi-Fi network. On the other hand, the LBT scheme not only exhibits a noticeable throughput loss in Wi-Fi, but also a significant drop in the overall throughput than the proposed HAP network. Clearly, our HAP serviced network can better utilize the unlicensed spectrum while better protecting the Wi-Fi user experience. Furthermore, the improvement of unlicensed LTE-U throughput is also significant compared with the standalone licensed LTE throughput. Suppose the licensed bandwidth in each HAP is the same as the unlicensed bandwidth, i.e., $20$ MHz. Then we assume that one LTE user's rate within a typical 4G-LTE connection is at $8$ Mbps, which is within the average per-user throughput in practical LTE systems from $3$ to $10$ Mbps. By allowing this user to be one of the $10$ users to access LTE-U, its throughput can be improved by as much as $71.6\%$ in the proposed HAP-based LTE-U network, rather than by $36.8\%$ in the LBT-based LTE-U network. We also test the case with $40$ Wi-Fi users, in which the proposed HAP-based LTE-U network still achieves as much as $57.3\%$ throughput gain, better than $27.8\%$ in the LBT-based LTE-U network. Overall, we demonstrate that the shared spectrum access by LTE-U and Wi-Fi is more efficient than the conventional LBT protocol because of the more efficient LTE-U channel access. Furthermore, our proposed LTE-U embedding protocols are easy to implement. They can be directly integrated into existing IEEE 802.11 networks without any Wi-Fi adjustment. In fact, non-LTE users can function in normal mode and appear fully oblivious to the presence of any LTE-U users. Our test results of the proposed LTE-U access protocol establish its network performance advantages in terms of sum throughput and per-user Wi-Fi throughput. \section{Further Works and Open Research Issues} Although the proposed HAP frameworks can substantially improve the spectrum efficiency and facilitate the deployment of LTE-U, there still exist several open issues worth investigating: \noindent \textbf{Interference management}: The first issue is the interference management in the unlicensed spectrum. Although we require HAPs to scan for clear unlicensed band for LTE-U embedding, the criteria for such decision deserve further detailed study, particularly for dense Wi-Fi deployment areas. Without a truly clean and open unlicensed channel, LTE-U has to reuse certain channels and manage interference even during CFP. In terms of interoperability, HAPs belonging to different operators may compete for the same unlicensed bands and, if unregulated, could lead to major failure of LTE-U. Therefore, problems involving channel selection and interoperability must be investigated. \noindent \textbf{CFP and CP Allocation}: Another question lies in the resource division between CFP and CP. For example, when many hybrid users are admitted into the LTE-U system from Wi-Fi, it is natural to allocate longer CFP. However, it may substantially degrade the performance of remaining Wi-Fi users relying on the shorter CP. Conversely, if insufficient CFP is allocated, per-user LTE-U throughput would suffer whereas precious resources on the Wi-Fi side may be under-utilized. It is therefore important to optimize the CFP and CP parameters (e.g. period, duration) according to the network environment. The optimization depends not only on the number of users but also on co-channel interference from adjacent cells or networks as well as the user traffic load. \noindent \textbf{Multiple HAP cooperation and clustering}: Multiple HAPs may be deployed within the coverage of a macro-cell. In this case, how to cluster and jointly control HAPs for better system performance and how to allocate wireless resources among different HAPs are important open problems. Distributed resource optimizations based on game theoretic models and machine learning approaches are expected to provide important insight. \section{Conclusion} This article aims to propose novel frameworks for the deployment of LTE-U in the unlicensed spectrum. We first reviewed various operation modes and coexistence techniques for LTE and Wi-Fi networks, and then presented a novel concept of HAP by combining SBS and Wi-Fi AP functionality to overcome many thorny issues in LTE-U and Wi-Fi coexistence. Our focus for embedding LTE-U fully within the present Wi-Fi protocol is motivated by the natural need to avoid retrofitting Wi-Fi networks to accommodate LTE-U channel sharing. We as well proposed two basic LTE-U embedding approaches within the existing Wi-Fi MAC protocol based on the novel HAP framework. Our simulation results demonstrated the substantial throughput advantage of the proposed LTE-U embedding mechanisms over existing methods. We further identified several open research issues for fine-tuning and optimizing our proposed LTE-U embedding mechanisms in practical implementation.
{'timestamp': '2016-07-19T02:03:41', 'yymm': '1607', 'arxiv_id': '1607.04729', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04729'}
arxiv
\section{Introduction} Unless stated otherwise, the graphs considered in this paper are simple, loopless and finite. A \emph{homomorphism} $h$ of a graph $G$ to a graph $H$ is a mapping $h:V(G)\to V(H)$ such that adjacency is preserved by $h$, that is, the images of two adjacent vertices of $G$ must be adjacent in $H$. If such a mapping exists, we note $G\to H$. For a fixed graph $H$, given an input graph $G$, the decision problem \PBCOL{$H$} (whose name is derived from the proximity of the problem to proper vertex-colouring) consists of determining whether $G\to H$ holds. Problems of the form \PBCOL{$H$} for some fixed graph $H$, are called \emph{homomorphism problems}. A classic theorem of Hell and Ne\v{s}et\v{r}il~\cite{HN90} states a \emph{dichotomy} for this problem: if $H$ is bipartite, \PBCOL{$H$} is polynomial-time solvable; otherwise, it is NP-complete. \medskip \noindent\textbf{Tropical graphs.} As an extension of graph homomorphisms, homomorphisms of edge-coloured graphs have been studied, see for example~\cite{AM98,Bthesis,B94,BFHN15,BH00}. In this paper, we consider the variant where the \emph{vertices} are coloured. We initiate the study of \emph{tropical graph homomorphism problems}, in which the vertex sets of the graphs are partitioned into colour classes. Formally, a \emph{tropical graph} $(G,c)$ is a graph $G$ together with a (not necessarily proper) vertex-colouring $c:V(G)\to C$ of $G$, where $C$ is a set of colours. If $|C|=k$, we say that $(G,c)$ is a \emph{$k$-tropical graph}. Given two tropical graphs $(G,c_1)$ and $(H,c_2)$ (where the colour set of $c_1$ is a subset of the colour set of $c_2$), a homomorphism $h$ of $(G,c_1)$ to $(H,c_2)$ is a homomorphism of $G$ to $H$ that also preserves the colours, that is, for each vertex $v$ of $G$, $c_1(v)=c_2(h(v))$. For a fixed tropical graph $(H,c)$, problem \PBCOL{$(H,c)$} asks whether, given an input tropical graph $(G,c_1)$, we have $(G,c_1)\to (H,c)$. \medskip \noindent\textbf{The homomorphism factoring problem.} Brewster and MacGillivray defined the following related problem in~\cite{BM97}. For two fixed graphs $H$ and $Y$ and a homomorphism $h$ of $H$ to $Y$, the \textsc{$(H,h,Y)$-Factoring} problem takes as an input, a graph $G$ together with a homomorphism $g$ of $G$ to $Y$, and asks for the existence of a homomorphism $f$ of $G$ to $H$ such that $f=h\circ g$. The \PBCOL{$(H,c)$} problem corresponds to \textsc{$(H,c,K_{|C|}^+)$-Factoring} where $K_{|C|}^+$ is the complete graph on $|C|$ vertices with all loops (and with $C$ the set of colours used by $c$). (Note that in~\cite{BM97}, loops were not considered.) \medskip \noindent\textbf{Constraint satisfaction problems (CSPs).} Graph homomorphism problems fall into a more general class of decision problems, the \emph{constraint satisfaction problems}, defined for \emph{relational structures}. A relational structure $S$ over a \emph{vocabulary} (a vocabulary is a set of pairs $(R_i,a_i)$ of relation names and arities) consists of a \emph{domain} $V(S)$ of vertices together with a set of relations corresponding to the vocabulary, that is, $R_i\subseteq V(S)^{a_i}$ for each relation $R_i$ of the vocabulary. Given two relational structures $S$ and $T$ over the same vocabulary, a homomorphism of $S$ to $T$ is a mapping $h:V(S)\to V(T)$ such that each relation $R_i$ is preserved, that is, for each subset of $V(S)^{a_i}$ of $R_i$ in $S$, its image set in $T$ also belongs to $R_i$. For a fixed relational structure $T$, \textsc{$T$-CSP} is the decision problem asking whether a given input relational structure has a homomorphism to $T$. Using this terminology, a graph $H$ is a relational structure over the vocabulary $\{(A,2)\}$ consisting of a single binary relation $A$ (adjacency). Hence, \PBCOL{$H$} is a CSP. Further, \PBCOL{$(H,c)$} is equivalent to the problem \textsc{$C(H,c)$-CSP}, where $C(H,c)$ is obtained from $H$ by adding a set of $k$ unary relations to $H$ (one for each colour class of the $k$-colouring $c$). \medskip \noindent\textbf{The Dichotomy Conjecture.} In their celebrated paper~\cite{FV98}, Feder and Vardi posed the following conjecture. \begin{conjecture}[Feder and Vardi~\cite{FV98}]\label{conj:CSP-dicho} For every fixed relational structure $T$, \textsc{$T$-CSP} is polynomial-time solvable or NP-complete. \end{conjecture} Conjecture~\ref{conj:CSP-dicho} became known as the \emph{Dichotomy Conjecture} and has given rise to extensive work in this area, see for example~\cite{B03,B02,FH98,FH98csp,FHH99,FHH02}. If the conjecture holds, it would imply a fundamental distinction between CSP and the whole class NP. Indeed, the latter is known (unless P$=$NP) to contain so-called \emph{NP-intermediate} problems that are neither NP-complete nor polynomial-time solvable~\cite{L75}. The Dichotomy Conjecture was motivated by several earlier dichotomy theorems for special cases, such as the one of Schaefer for binary structures~\cite{S78} or the one of Hell and Ne\v{s}et\v{r}il for undirected graphs, stated as follows. \begin{theorem}[Hell and Ne\v{s}et\v{r}il Dichotomy \cite{HN90}]\label{thm:HN} Let $H$ be an undirected graph. If $H$ is bipartite, then \PBCOL{$H$} is polynomial-time solvable. Otherwise, \PBCOL{$H$} is NP-complete. \end{theorem} \medskip \noindent\textbf{Digraph homomorphisms.} Digraph homomorphisms are also well-studied in the context of complexity dichotomies. We will relate them to tropical graph homomorphisms. For a digraph $D$, \PBCOL{$D$} asks whether an input digraph admits a homomorphism to $D$, that is, a homomorphism of the underlying undirected graphs that also preserves the orientation of the arcs. While in the case of undirected graphs, the \PBCOL{H} problem is only polynomial time for graphs whose core is either $K_1$ or $K_2$, in the case of digraphs the problem remains polynomial time for a large class of digraphs which are cores. The classification of such cores has been one of the difficulties of the conjecture. Such classifications are given for certain interesting subclasses, see for example~\cite{BH90,BHM88,BHM95,BKN09,F01}. A proof of a conjectured classification of the general case has been announced while this paper was under review (see~\cite{FKR17}). If valid, this would imply the truth of the Dichotomy Conjecture, as Feder and Vardi~\cite{FV98} showed the following (seemingly weaker) statement to be equivalent to it. \begin{conjecture}[Equivalent form of the Dichotomy Conjecture, Feder and Vardi~\cite{FV98}]\label{conj:digraph-dicho} For every bipartite digraph $D$, \PBCOL{$D$} is polynomial-time solvable or NP-complete. \end{conjecture} In Section~\ref{sec:dicho-CSP}, similarly to its above reformulation (Conjecture~\ref{conj:digraph-dicho}), we will show that the Dichotomy Conjecture has an equivalent formulation as a dichotomy for tropical homomorphisms problems. More precisely, we will show that the Dichotomy Conjecture is true if and only if its restriction to \PBCOL{$(H,c)$} problems, where $(H,c)$ is a $2$-tropical bipartite graph, also holds. In other words, one can say that the class of $2$-tropical bipartite graph homomorphisms is as rich as the whole class of CSPs. For many digraphs $D$ it is known such that \PBCOL{$D$} is NP-complete. Such a digraph of order~$4$ and size~$5$ is presented in the book by Hell and Ne\v{s}et\v{r}il~\cite[page 151]{HNbook}. Such oriented trees are also known, see~\cite{HNZ96} or~\cite[page 158]{HNbook}; the smallest such known tree has order~$45$. A full dichotomy is known for oriented cycles~\cite{F01}; the smallest such NP-complete oriented cycle has order between~$24$ and~$36$~\cite{D16,F01}. Using these results, one can easily exhibit some NP-complete \PBCOL{$(H,c)$} problems. To this end, given a digraph $D$, we construct the $3$-tropical graph $T(D)$ as follows. Start with the set of vertices $V(D)$ and colour its vertices Blue. For each arc $\overrightarrow{uv}$ in $D$, add a path $ux_ux_vv$ of length~$3$ from $u$ to $v$ in $T(D)$, where $x_u$ and $x_v$ are two new vertices coloured Red and Green, respectively. The following fact is not difficult to observe. \begin{proposition}\label{prop:digraph-reduc} For any two digraphs $D_1$ and $D_2$, we have $D_1\to D_2$ if and only if $T(D_1)\to T(D_2)$. \end{proposition} By the above results on NP-complete \PBCOL{$D$} problems and Proposition~\ref{prop:digraph-reduc}, we obtain a $3$-tropical graph of order~$14$, a $3$-tropical tree of order~$133$, and a $3$-tropical cycle of order between~$72$ and~$108$ whose associated homomorphism problems are NP-complete. Nevertheless, in this paper, we exhibit (by using other reduction techniques) much smaller tropical graphs, trees and cycles $(H,c)$ with \PBCOL{$(H,c)$} NP-complete. \medskip \noindent\textbf{List homomorphisms.} Dichotomy theorems have also been obtained for a list-based extension of the class of homomorphism problems, the \emph{list-homomorphism problems}. In this setting, introduced by Feder and Hell in~\cite{FH98}, the input consists of a pair $(G,L)$, where $G$ is a graph and $L:V(G)\to 2^{V(H)}$ is a list assignment representing a set of allowed images for each vertex of $G$. For a fixed graph $H$, the decision problem \PBlistCOL{$H$} asks whether there is a homomorphism $h$ of $G$ to $H$ such that for each vertex $v$ of $G$, $h(v)\in L(v)$. Problem \PBlistCOL{$H$} can be seen as a generalization of \PBCOL{$H$}. Indeed, restricting \PBlistCOL{$H$} to the class of inputs where for each vertex $v$ of $G$, $L(v)=V(H)$, corresponds precisely to \PBCOL{$H$}. Therefore, if \PBCOL{$H$} is NP-complete, so is \PBlistCOL{$H$}. For this set of problems, a full complexity dichotomy has been established in a series of three papers~\cite{FH98,FHH99,FHH02}. We state the dichotomy result for simple graphs from~\cite{FHH99}, that is related to our work. (A circular arc graphs is an intersection graph of arcs on a cycle.) \begin{theorem}[Feder, Hell and Huang~\cite{FHH99}]\label{thm:listhom-table} If $H$ is a bipartite graph such that its complement is a circular arc graph, then \PBlistCOL{$H$} is polynomial-time solvable. Otherwise, \PBlistCOL{$H$} is NP-complete. \end{theorem} Given a tropical graph $(H,c)$, the problem \PBCOL{$(H,c)$} is equivalent to the restriction of \PBlistCOL{$H$} to instances $(G,L)$ where each list is the set of vertices in one of the colour classes of $c$. Next, we introduce a less restricted variant of \PBlistCOL{$H$} that is also based on tropical graph homomorphisms. \medskip \noindent\textbf{The \PBtropCOL{\boldmath{$H$}} problem.} Given a fixed graph $H$, we introduce the decision problem \PBtropCOL{$H$}, whose instances consist of (1) a vertex-colouring $c$ of $H$ and (2) a tropical graph $(G,c_2)$. Then, \PBtropCOL{$H$} consists of deciding whether $(G,c_1)\to (H,c)$. Alternatively, \PBtropCOL{$H$} is an instance restriction of \PBlistCOL{$H$} to instances with \emph{laminar lists}, that is, lists such that for each pair of distinct vertices $v_1, v_2 \in V(G)$, $L(v_1) = L(v_2)$ or $L(v_1) \cap L(v_2) =\emptyset$. (We remark that \PBtropCOL{$H$}, as well as \PBlistCOL{$H$}, can also be formulated as a CSP, where certain unary relations encode the list constraints: so-called \emph{full CSPs}, see~\cite{FH98csp} for details.) Given the difficulty of studying \PBCOL{$(H,c)$} problems, as will be demonstrated in Section~\ref{sec:dicho-CSP}, the study of \PBtropCOL{$H$} problems will be the focus of the other parts of this paper. This study is directed by the following question. \begin{question}\label{mainquestion} For a given graph $H$, what is the complexity of \PBtropCOL{$H$}? \end{question} Clearly, \PBCOL{$(H,c)$} where each vertex receives the same colour, is computationally equivalent to \PBCOL{$H$}. Therefore, by the Hell-Ne\v{s}et\v{r}il dichotomy of Theorem~\ref{thm:HN}, if $H$ is non-bipartite, \PBtropCOL{$H$} is NP-complete. Furthermore, by the above formulation of \PBtropCOL{$H$} as an instance restriction of \PBlistCOL{$H$}, whenever \PBlistCOL{$H$} is polynomial-time solvable, so is \PBtropCOL{$H$}. Thus, according to Theorems~\ref{thm:HN} and~\ref{thm:listhom-table}, all problems \PBtropCOL{$H$} where $H$ is not bipartite are NP-complete, and all problems \PBtropCOL{$H$} where $H$ is bipartite and its complement is a circular-arc graph are polynomial-time solvable. Thus, it remains to study \PBtropCOL{$H$} when $H$ belongs to the class of bipartite graphs whose complement is not a circular-arc graph. This class of graphs has been well-studied, and characterized by forbidden induced subgraphs~\cite{TM76}. It is a rich class of graphs that includes all cycles of length at least~$6$, all trees with at least one vertex from which there are three branches of length at least~$3$, and an many other graphs~\cite{TM76}. Observe that for any induced subgraph $H'$ of a graph $H$, one can reduce \PBtropCOL{$H'$} to \PBtropCOL{$H$} by assigning, in the input colouring of $H$, a dummy colour to all the vertices of $H-H'$. Hence, if \PBtropCOL{$H$} is polynomial-time solvable, then \PBtropCOL{$H'$} is also polynomial-time solvable. Conversely, if \PBtropCOL{$H'$} is NP-complete, so is \PBtropCOL{$H$}. Therefore, to answer Question~\ref{mainquestion}, it is enough to consider minimal graphs $H$ such that \PBtropCOL{$H$} is NP-complete. A first question is to study the case of minimal graphs $H$ for which \PBlistCOL{$H$} is NP-complete; such a list is known and it follows from Theorem~\ref{thm:listhom-table}. In particular, it contains all even cycles of length at least~$6$. In Section~\ref{sec:list_hom}, we show that for every even cycle $C_{2k}$ of length at least~$48$, \PBtropCOL{$C_{2k}$} is NP-complete. On the other hand,for every even cycle $C_{2k}$ of length at most~$12$, \PBtropCOL{$C_{2k}$} is polynomial-time solvable. Unfortunately, for each graph $H$ in the above-mentioned list that is not a cycle, \PBtropCOL{$H$} is polynomial-time solvable, and thus larger graphs will be needed in the quest of a similar characterization of NP-complete \PBtropCOL{$H$} problems. In Section~\ref{sec:smallgraphs}, we show that for every bipartite graph $H$ of order at most~$8$, \PBtropCOL{$H$} is polynomial-time solvable, but there is a bipartite graph $H_9$ of order~$9$ such that \PBtropCOL{$H_9$} is NP-complete. Finally, in Section~\ref{sec:trees}, we study the case of trees. We prove that for every tree $T$ of order at most~$11$, \PBtropCOL{$T$} is polynomial-time solvable, but there is a tree $T_{23}$ of order~$23$ such that \PBtropCOL{$T_{23}$} is NP-complete. We remark that our NP-completeness results are finer than those that can be obtained from Proposition~\ref{prop:digraph-reduc}, in the sense that the orders of the obtained target graphs are much smaller. Similarly, we note that the results in~\cite{BM97} imply the existence of NP-complete \PBtropCOL{$H$} problems, and $H$ can be chosen to be a tree or a cycle. However, similarly as in Proposition~\ref{prop:digraph-reduc}, these results are also based on reductions from NP-complete \PBCOL{$D$} problems, where $H$ is obtained from the digraph $D$ by replacing each arc by a path (its length depends on $D$, but it is always at least~$3$). Thus, the NP-complete tropical targets obtained in~\cite{BM97} are trees of order at least~$133$ and cycles of order at least~$72$, which is much more than the ones exhibited in the present paper. \shortpaper{ \medskip To improve the presentation, some results in this paper are given without proof. The full paper, containing all proofs, is available online~\cite{fullversion}. } \section{Preliminaries and tools}\label{sec:prelim} In this section we gather some necessary preliminary definitions and results. \subsection{Isomorphisms, cores} For tropical graph homomorphisms, we have the same basic notions and properties as in the theory of graph homomorphisms. A homomorphism of tropical graph $(G,c_1)$ to $(H,c_2)$ is an \emph{isomorphism} if it is a bijection and it acts bijectively on the set of edges. \begin{definition} The \emph{core} of a tropical graph $(G,c)$ is the smallest (in terms of the order) induced tropical subgraph $(G',c_{|G'})$ admitting a homomorphism of $(G,c)$ to $(G',c_{|G'})$. \end{definition} In the same way as for simple graphs, it can be proved that the core of a tropical graph is unique. A tropical graph $(G,c)$ is called a \emph{core} if its core is isomorphic to $(G,c)$ itself. Moreover, we can restrict ourselves to studying only cores. Indeed it is not difficult to check that $(G,c_1)$ admits a homomorphism to $(H,c_2)$ if and only if the core of $(G,c_1)$ admits a homomorphism to the core of $(H,c_2)$. \subsection{Formal definitions of the used computational problems} We now formally define all the decision problems used in this paper. \problemdec{\PBCOL{$H$}}{A (di)graph $G$.}{Does there exist a homomorphism of $G$ to $H$?} \smallskip \problemdec{\PBlistCOL{$H$}}{A graph $G$ and a list function $L:V(G)\to 2^{V(H)}$.}{Is there a homomorphism $f$ of $G$ to $H$ such that for every vertex $x$ of $G$, $f(x)\in L(x)$?} \smallskip \problemdec{\PBCOL{$(H,c)$}}{A tropical graph $(G,c_1)$.}{Does $(G,c_1)$ admit a homomorphism to $(H,c)$?} \smallskip \problemdec{\PBtropCOL{$H$}}{A vertex-colouring $c$ of $H$, and a tropical graph $(G,c_1)$.}{Does $(G,c_1)$ admit a homomorphism to $(H,c)$?} \smallskip \problemdec{\textsc{$T$-CSP}}{A relational structure $S$ over the same vocabulary as $T$.}{Does $S$ admit a homomorphism to $T$?} \smallskip \problemdec{\textsc{$k$-SAT}}{A pair $(X,C)$ where $X$ is a set of Boolean variables and $C$ is a set of $k$-tuples of literals of $X$, that is, variables of $X$ or their negation.}{Is there a truth assignment $A:X\to\{0,1\}$ such that each clause of $C$ contains at least one true literal?} \smallskip \problemdec{\textsc{NAE $k$-SAT}}{A pair $(X,C)$ where $X$ is a set variables and $C$ is a set of $k$-tuples of variables of $X$.}{Is there a partition of $X$ into two classes such that each clause of $C$ contains at least one variable in each class?} It is a folklore result that \textsc{$2$-SAT} is polynomial-time solvable, a fact for example observed in~\cite{K67}. On the other hand, \textsc{$3$-SAT} is NP-complete~\cite{K72}, and \textsc{NAE $3$-SAT} is NP-complete as well~\cite{M98} (even if the input formula contains no negated variables). \subsection{Bipartite graphs} We now give several facts that are useful when working with homomorphisms of bipartite graphs. \begin{observation}\label{obs:bipartite-hom} Let $H$ be a bipartite graph with parts $A,B$. If $\phi:G\to H$ is a homomorphism of $G$ to $H$, then $G$ must be bipartite. Moreover, if $G$ and $H$ are connected, then $\phi^{-1}(A)$ and $\phi^{-1}(B)$ are the two parts of $G$. \end{observation} The next proposition shows that for bipartite target graphs, we may assume (at the cost of doubling the number of colours) that no two vertices from two different parts of the bipartition are coloured with the same colour. \begin{proposition}\label{prop:bipartite-hom} Let $(H,c)$ be a connected tropical bipartite graph with parts $A,B$, and assume that vertices in $A$ and $B$ are coloured by $c$ with colours in set $C_A$ and $C_B$, respectively. Let $c'$ be the colouring with colour set $(C_A\times 0)\cup (C_B\times 1)$ obtained from $c$ with $c'(x)=(c(x),0)$ if $x\in A$ and $c'(x)=(c(x),1)$ if $x\in B$. If \PBCOL{$(H,c')$} is polynomial-time solvable, then \PBCOL{$(H,c)$} is polynomial-time solvable. \end{proposition} \begin{proof} Let $(G,c_1)$ be a bipartite tropical graph. We may assume $G$ is connected since the complexity of \PBCOL{$(H,c)$} and \PBCOL{$(H,c')$} stays the same for connected inputs. Let $c_1'$ and $c_1''$ be the colourings obtained from $c_1$ by performing a similar modification as for $c'$: $c_1'(x)=(c_1(x),0)$ if $x\in A$ and $c_1'(x)=(c_1(x),1)$ if $x\in B$, and $c_1''(x)=(c_1(x),1)$ if $x\in A$ and $c_1''(x)=(c_1(x),0)$ if $x\in B$. Now it is clear, by Observation~\ref{obs:bipartite-hom}, that $(G,c_1)\to (H,c)$ if and only if either $(G,c_1')\to (H,c')$ or $(G,c_1'')\to (H,c')$. Since the latter condition can be checked in polynomial time, the proof is complete. \end{proof} \subsection{Generic lemmas for polynomiality} We now prove several generic lemmas that will be useful to prove that a specific \PBCOL{$(H,c)$} problem is polynomial-time solvable \begin{definition Let $(H,c)$ be a tropical graph. A vertex of $(H,c)$ is a \emph{forcing vertex} if all its neighbours are coloured with distinct colours. \end{definition} This is a useful concept since in any mapping of a tropical graph $(G,c')$ to a target containing a forcing vertex $x$, if a vertex of $G$ is mapped to $x$, then the mapping of all its neighbours is forced. We have the following immediate application: \begin{lemma}\label{lemm:all-forcing} Let $(H,c)$ be a tropical graph. If all vertices of $H$ are forcing vertices, then \PBCOL{$(H,c)$} is polynomial-time solvable. \end{lemma} \begin{proof} Choose any vertex $x$ of the instance $(G,c_1)$, and map it to any vertex of $(H,c)$ with the same colour. Once this choice is made, the mapping for the whole connected component of $x$ is forced. Hence, try all $O(|V(H)|)$ possibilities to map $x$, and repeat this for every connected component of $G$. The tropical graph $(G,c_1)$ is a YES-instance if and only if every connected component admits a mapping. \end{proof} \begin{lemma}[\textsc{$2$-SAT}]\label{lemm:2SAT} Let $(H,c)$ be a tropical graph and let $\{S_1,\ldots,S_k\}$ be a collection of independent sets of $H$, each of size at most~$2$. Assume that for every tropical graph $(G,c_1)$ admitting a homomorphism to $(H,c)$, there exists a partition $\mathcal P=P_1,\ldots,P_\ell$ of $V(G)$ into $\ell\leq k$ sets and a homomorphism $f:(G,c_1)\to (H,c)$ such that for every $i\in\{1,\ldots,\ell\}$, there is a $j=j(i)\in\{1,\ldots,k\}$ such that all vertices of $P_i$ map to vertices of $S_j$. Then \PBCOL{$(H,c)$} is polynomial-time solvable. \end{lemma} \begin{proof} We reduce \PBCOL{$(H,c)$} to \textsc{$2$-SAT}. For every set $S_i$, if $S_i$ contains only one vertex $s$, $s$ represents TRUE. If $S_i$ contains two vertices $s,s'$, one of them represents TRUE, the other FALSE (note that if some vertex belongs to two distinct sets $S_i$ and $S_j$, it is allowed to represent, say, FALSE with respect to $S_i$ and TRUE with respect to $S_j$). Now, given an instance $(G,c_1)$ of \PBCOL{$(H,c)$}, we build a \textsc{$2$-SAT} formula over variable set $V(G)$ that is satisfiable if and only if $(G,c_1)\to (H,c)$, as follows. For every edge $xy$ of $G$, assume that in $f$, $x$ is mapped to a vertex of $S_i$ and $y$ is mapped to a vertex of $S_j$ (necessarily if $(G,c_1)\to (H,c)$ we have $i\neq j$ since $S_i,S_j$ induce independent sets). Let $F_{xy}$ be a disjunction of conjunctive 2-clauses over variables $x,y$. For every edge $uv$ between a vertex $u$ in $S_i$ and a vertex $v$ in $S_j$, depending on the truth value assigned to $u$ and $v$, add to $F_{xy}$ the conjunctive clause that would be true if $x$ is assigned the truth value of $u$ and $y$ is assigned the truth value of $v$. For example: if $u=FALSE$ and $v=TRUE$ add the clause $(\overline{x}\wedge y)$. When $F_{xy}$ is constructed, transform it into an equivalent conjunction of disjunctive clauses and add it to the constructed \textsc{$2$-SAT} formula. Now, by the construction, if the formula is satisfiable we construct a homomorphism by mapping every vertex $x$ to the vertex of the corresponding set $S_i$ that has been assigned the same truth value as $x$ in the satisfying assignment. By construction it is clear that this is a valid mapping. On the other hand, if the formula is not satisfiable, there is no homomorphism of $(G,c_1)$ to $(H,c)$ satisfying the conditions, and hence there is no homomorphism at all. \end{proof} As a corollary of Lemma~\ref{lemm:2SAT} and Proposition~\ref{prop:bipartite-hom}, we obtain the following lemma: \begin{lemma}\label{lemm:2SAT-application} If $(H,c)$ is a bipartite tropical graph where each colour is used at most twice, then \PBCOL{$(H,c)$} is polynomial-time solvable. \end{lemma} Given a set $S$ of vertices, the \emph{boundary} $B(S)$ is the set of vertices in $S$ that have a neighbour out of $S$ \begin{lemma}\label{lemm:distinct-vertex-boundary} Let $(H,c)$ be a tropical graph containing a connected subgraph $S$ of forcing vertices such that:\\ (a) every vertex in $B(S)$ is coloured with a distinct colour (let $C(S)$ be the set of colours given to vertices in $B(S)$), and (b) no colour of $C(S)$ is present in $V(H)\setminus S$.\\ If \PBlistCOL{$(H-S)$} is polynomial-time solvable, then \PBCOL{$(H,c)$} is polynomial-time solvable. \end{lemma} \begin{proof} Let $\overline{S}=V(H)\setminus S$. Let $(G,c_1)$ be an instance of \PBCOL{$(H,c)$}. Consider an arbitrary vertex $v$ of $G$ with $c_1(v)=i$. Then, $v$ must be mapped to a vertex coloured~$i$. For every possible choice of mapping $v$, we will construct one instance of \PBlistCOL{$(H-S)$}. To construct an instance from such a choice, we first partition $V(G)$ into two sets: the set $V_S$ containing the vertices that must map to vertices in $S$ (and their images are determined), and the set $V_{\overline{S}}$ containing the vertices that must map to vertices of $\overline{S}$. We now distinguish two basic cases, that will be repeatedly applied during the construction. \noindent\textbf{Case~1: vertex \boldmath{$v$} is mapped to a vertex in \boldmath{$S$}.} If $v$ has been mapped to a vertex $x$ of $S$, since $x$ is a forcing vertex, the mapping of all neighbours of $v$ is determined (anytime there is a conflict we return NO for the specific instance under construction). We continue to propagate the forced mapping as much as possible (i.e. as long as the forced images belong to $S$) within a connected set of $G$ containing $v$. This yields a connected set $C_v$ of vertices of $G$ whose mapping is determined, and whose neighbourhood $N_v=N(C_v)\setminus C_v$ consists of vertices each of which must be mapped to a determined vertex of $\overline{S}$. We add $C_v$ to $V_S$. We now remove the set $C_v$ from $G$ and repeat the procedure for all vertices of $N_v$ using Case~2. \noindent\textbf{Case~2: vertex \boldmath{$v$} is mapped to a vertex in \boldmath{$\overline{S}$}.} We perform a BFS search on the remaining vertices in $G$, until we have computed a maximal connected set $C_v$ of vertices containing $v$ in which no vertex is coloured with a colour in $C(S)$. Then, for every vertex $x$ of $C_v$ with a neighbour $y$ that is coloured~$i$ ($i\in C(S)$), by Property~(a) we know that $y$ must be mapped to a vertex in $B(S)$, and moreover the image of $y$ is determined by colour~$i$. Hence the neighbourhood $N_v=N(C_v)\setminus C_v$ has only vertices whose mapping is determined. We add $C_v$ to set $V_{\overline{S}}$ and apply Case~1 to every vertex in $N_v$. \noindent\textbf{End of the procedure.} Once $V(G)$ has been partitioned into $V_S$ and $V_{\overline{S}}$ (where the mapping of all vertices in $V_S\cup N(V_S)$ is fixed), we can reduce this instance to a corresponding instance of \PBlistCOL{$(H-S)$}. In total, $(G,c_1)$ is a YES-instance if and only if at least one of the $O(|V(G)|)$ constructed instances of \PBlistCOL{$(H-S)$} is a YES-instance. \end{proof} The next lemma is similar to Lemma~\ref{lemm:distinct-vertex-boundary} but now the boundary is distinguished using edges. \begin{lemma}\label{lemm:distinct-edge-boundary} Let $(H,c)$ be a tropical graph containing a connected subgraph $S$ of forcing vertices with boundary $B=B(S)$ and $N=N(B)\setminus S$. Assume that the following properties hold:\\ (a) for every pairs $xy$, $x'y'$ of distinct edges of $B\times N$, we have $(c(x),c(y))\neq (c(x'),c(y'))$, and\\ (b) for every edge $xy$ of $B\times N$, there is no edge in $(H-S)\times (H-S)$ whose endpoints are coloured $c(x)$ and $c(y)$. If \PBlistCOL{$(H-S)$} is polynomial-time solvable, then \PBCOL{$(H,c)$} is polynomial-time solvable. \end{lemma} \begin{proof} The proof is almost the same as the one of Lemma~\ref{lemm:distinct-vertex-boundary}, except that now, while computing an instance of \PBlistCOL{$(H-S)$}, the distinction between $V_S$ and $V_{\overline{S}}$ is determined by the edges of $B\times N$. \end{proof} The next lemma identify some unique features of a tropical graph to simplify the problem into a list-homomorphism problem. \begin{definition A \emph{Unique Tropical Feature} in a tropical graph $(H,c)$ is a vertex or an edge of $H$ that satisfies one of the following conditions. \begin{itemize} \item[Type 1.] A vertex $u$ of $H$ whose colour class is $\{u\}$. \item[Type 2.] An edge $uv$ of $H$ such that there is no other edge in $H$ whose vertices are coloured $c(u)$ and $c(v)$, respectively. \item[Type 3.] A vertex $u$ of $H$ such that $N(u)$ is monochromatic in $(H,c)$ with colour $s$, and every vertex coloured $s$ that does not belong to $N(u)$ has no neighbour coloured with $c(u)$. \item[Type 4.] A forcing vertex $u$ of $H$ such that for each pair $v,w$ of distinct vertices in $N(u)$, there is no path $v'u'w'$ in $H-u$ with $c(v) = c(v')$, $c(u)=c(u')$ and $c(w)=c(w')$. \end{itemize} \end{definition} \begin{definition} Let $(H,c)$ be a tropical graph and $S$ a set of Unique Tropical Features of $(H,c)$. $S$ is partitioned into four sets as $S=S_1 \cup S_2 \cup S_3 \cup S_4$, where $S_i$ is the set of unique tropical features of type $i$ in $S$. We define $H(S)$ as follows : $V(H(S)) = (V(H)\cup \{u_v| u\in S_4, v\in N(u) \})\setminus (S_1 \cup S_3 \cup S_4)$ and $E(H(S)) = (E(H[V(H(S))])\setminus S_2)\cup \{u_vv| u\in S_4, v\in N(u)\}$. \end{definition} In other words, $H(S)$ is the graph obtained from $H$ by removing unique tropical features of type $1$, $2$, and $3$, and for each unique tropical feature $u$ of type $4$, replacing $N[u]$ by $d(u)$ pending edges. \begin{lemma}\label{lemm:unique-feature} Let $(H,c)$ be a tropical graph and $S$ a set of unique tropical features of $(H,c)$. If \PBlistCOL{$(H(S))$} is polynomial-time solvable, then \PBCOL{$(H,c)$} is polynomial-time solvable. \end{lemma} \begin{proof} Let $(G,c')$ be an instance of \PBCOL{$(H,c)$}. We are going to construct a graph $G'$ and associate to each vertex of $G'$ a list of vertices of $H(S)$ such that there is a list-homomorphism from $G'$ to $H(S)$ (with respect to these lists) if and only if there is a tropical homomorphism of $(G,c')$ to $(H,c)$. We proceed with sequential modifications, by considering the unique tropical features of $S$ one by one. First, we can see the instance $(G,c')$ of \PBCOL{$(H,c)$} as an instance of \PBlistCOL{$H$} by giving to each vertex $u$ in $G$ the list $L(u)$ of vertex in $H$ coloured $c'(u)$. If at any point in the following, we update the list of a vertex to be empty, we can conclude that there is no tropical homomorphism between $(G,c')$ and $(H,c)$. For each unique tropical feature $u$ of type $1$ in $S$, there is a colour $s$ such that only the vertex $u$ is coloured $s$ in $(H,c)$. Every vertex in $(G,c')$ coloured $s$ must be mapped to $u$ and has a list of size at most one. For each vertex $v$ in $(G,c')$ coloured $s$, we update the list of each of its neighbours $w$ such that $L(w)$ becomes $L(w)\cap N(u)$. We can then delete $v$ from $(G,c')$ and forget $L(v)$ without affecting the existence of a list-homomorphism. Indeed, if a homomorphism exists, then it must map each neighbour of $v$ to a neighbour of $u$. Moreover, there is no other vertex of $(G,c')$ that can be mapped to $u$. For each unique tropical feature $uv$ of type $2$ in $S$, there is no other edge than $uv$ in $H$ such that the colour of its vertices are $c(u)$ and $c(v)$. Every edge in $(G,c')$ whose vertices are coloured $c(u)$ and $c(v)$ must be mapped to $uv$. For each edge $xy$ in $(G,c')$ such that $c'(x)= c(u)$ and $c'(y)=c(v)$, we update the list of $x$ and $y$ such that $L(x)$ becomes $L(x)\cap \{u\}$ and $L(y)$ becomes $L(y)\cap \{v\}$. We can then delete the edge $uv$ from $(G,c')$ without changing the existence of a list-homomorphism. Indeed, if a homomorphism exists, it must map $x$ to $u$ and $y$ to $v$. Again, there is no other edge of $(G,c')$ that can be mapped to $uv$. For each unique tropical feature $u$ of type $3$ in $S$, $N(u)$ is monochromatic in $(H,c)$ of colour $s$ and any vertex coloured $s$ with a neighour coloured $c(u)$ must belong to $N(u)$. Let $v$ be a vertex of $G$ such that $c(v)=c(u)$ and $N(v)$ is monochromatic in $(G,c')$ of colour $s$. Then, we can assume that $v$ is mapped to $u$. Indeed, in every tropical homomorphism of $(G,c')$ to $(H,c)$, if $v$ is not mapped to $u$, it is mapped to a vertex at distance~$2$ from $u$, and one obtains another valid tropical homomorphism by only changing the mapping of $v$ to $u$. For each such vertex $v$, we update the list of its neighbours $w$ such that $L(w)$ becomes $L(w)\cap N(u)$. We can then delete $v$ from $(G,c')$ without affecting the existence of a list-homomorphism. Indeed, if a homomorphism exists, it maps every neighbour of $v$ to a neighbour of $u$. Moreover, there no other vertex of $(G,c')$ can be mapped to $u$. Finally, let $u$ be a vertex of type $4$ in $S$. Thus, by the definition of type $4$, for each $v, w \in N(u)$, there is no other path $v'u'w'$ in $H$ such that $c(v)=c(v')$, $c(u)=c(u')$ and $c(w)=c(w')$. Furthermore, since $u$ is a forcing vertex, we have $c(v)\neq c(w)$ for any two neighbours $v$ and $w$ of $u$. Let $x$ be a vertex of $G$ such that $c'(x)=c(u)$ and such that at least two neighbours of $x$ are of colours $c(v)$ or $c(w)$, one of each. Then, as $x$ is of type $4$, any homomorphism of $(G, c')$ to $(H,c)$ must map all such vertices $x$ to $u$. Remove all such vertices from $G$ and let $(G', c')$ be the remaining tropical graph. For any vertex $y$ of $G'$ if it is of colour $c(u)$, it may then either map to another vertex of this colour, or all its neighbours must map a same neighbour of $u$. Let $(H_1, c)$ be a tropical graph obtained from $(H, c)$ by removing the vertex $u$, and then adding one new vertex for each vertex in $N_H(u)$ and assigning the colour $c(u)$ to it. It follows that $(G',c')$ admits a homomorphism to $(H',c)$ if and only $(G,c')$ admits a homomorphism to $(H,c)$, proving our claim. In conclusion, we have built an instance $(G', L)$ of \PBlistCOL{$H(S)$} that maps to $H(S)$ if and only if $(G,c')$ maps to $(H,c)$, thus proving our claim. We remark, furthermore, that these changes used to introduced $(G', L)$ and $H(S)$ are compatible even between different types of vertices, thus we may allow $S$ to contain a combination of such vertices. However, in this work we will only consider sets $S$ whose elements are all of a same type. \end{proof} \section{\PBCOL{$(H,c)$} and the Dichotomy Conjecture}\label{sec:dicho-CSP} Since each \PBCOL{$(H,c)$} problem is a CSP, the Feder--Vardi Dichotomy Conjecture (Conjecture~\ref{conj:CSP-dicho}) would imply a complexity dichotomy for the class of \PBCOL{$(H,c)$} problems. As we mentioned before a proof of the conjecture has been recently announced, thus every \PBCOL{$(H,c)$} is either polynomial time solvable or it is an NP-complete problem. Here we point out that an independent proof even on a very restricted set of $(H,c)$ would also prove the original conjecture. Following the construction of Feder and Vardi (\cite[Theorem~10]{FV98}) and based on its exposition in the book by Hell and Ne\v{s}et\v{r}il~\cite[Theorem~5.14]{HNbook}, one can modify their gadgets to prove a similar statement for the class of $2$-tropical bipartite graph homomorphism problems. \shortpaper{The proof being very similar to the proofs in~\cite{BFHN15,FV98,HNbook}, we skip it here and refer to our manuscript~\cite{fullversion} instead. } \begin{theorem}\label{thm:CSP} For each CSP template $T$ there is a $2$-coloured graph $(H,c)$ such that \PBCOL{$(H,c)$} and \textsc{$T$-CSP} are polynomially equivalent. Moreover, $(H,c)$ can be chosen to be bipartite and homomorphic to a $2$-coloured forcing path. \end{theorem} \longpaper{ \begin{proof} We follow the proof of Theorem~5.14 in the book~\cite{HNbook} proving a similar statement for digraph homomorphism problems. The structure of the proof in~\cite{HNbook} is as follows. First, one shows that for each CSP template $T$, there is a bipartite graph $H$ such that the \textsc{$T$-CSP} problem and the \textsc{$H$-Retraction} problem are polynomially equivalent. Next, it is shown that for each bipartite graph $H$ there is a digraph $H'$ such that \textsc{$H$-Retraction} and \textsc{$H'$-Retraction} are polynomially equivalent. Finally it is observed that $H'$ is a core and thus \textsc{$H'$-Retraction} and \PBCOL{$(H',c)$} are polynomially equivalent. We adapt this proof to the case of $2$-tropical graph homomorphism problems. The construction of $H'$ from $H$ in~\cite{HNbook} is through the use of so-called zig-zag paths. In our case, we replace these zig-zag paths by specific $2$-coloured graphs that play the same role. This will allow us to construct a $2$-coloured graph $H'$ from a bipartite graph $H$ such that \textsc{$H$-Retraction} and \textsc{$H'$-Retraction} are polynomially equivalent. Our paths will have black vertices denoted by $B$ and white vertices denoted by $W$. Hence the path $WB^4W^4B$ consists of one white vertex, four black vertices, four white vertices and a black vertex. The maximal monochromatic subpaths are called \emph{runs}. Thus the above path is the concatenation of four runs: the first and last of length~$1$, the middle two of length~$4$. Given an odd integer $\ell$, we construct a path $P$ consisting of $\ell$ runs. The first and the last run each consist of a single white vertex. The interior runs are of length four. We denote that last (rightmost) vertex of $P$ by $0$. From $P$ we construct $\ell-2$ paths $P_1, \dots, P_{\ell-2}$. Path $P_i$ ($i=1, 2, \dots, \ell-2$) is obtained from $P$ by replacing the $i^{th}$ run of length four with a run of length~$2$. We denote the rightmost vertex of $P_i$ by $i$. Similarly, for an even integer $k$, we construct a second family of paths $Q$ and $Q_j$, ($j=1, 2, \dots, k-2$). The leftmost vertex of $Q$ is $1$ and the leftmost vertex of $Q_j$ is $j$. The paths are described below: $$ \begin{array}{rclcrcl} P & := & W\underbrace{B^4 W^4 \cdots W^4 B^4}_{\ell-2}W & \hspace{0.5cm} & Q & := & W\underbrace{B^4 W^4 \cdots B^4 W^4}_{k-2}B \\ P_i & := & W\underbrace{B^4 \cdots W^4}_{i-1}B^2\underbrace{W^4 \cdots B^4}_{\ell-i-2}W \hspace{1em}\mbox{($i$ odd)} & & Q_j & := & W\underbrace{B^4 \cdots W^4}_{j-1}B^2\underbrace{W^4 \cdots W^4}_{k-j-2}B \hspace{1em}\mbox{($j$ odd)} \\ P_i & := & W\underbrace{B^4 \cdots B^4}_{i-1}W^2\underbrace{B^4 \cdots B^4}_{\ell-i-2}W \hspace{1em}\mbox{($i$ even)} & & Q_j & := & W\underbrace{B^4 \cdots B^4}_{j-1}W^2\underbrace{B^4 \cdots W^4}_{k-j-2}B \hspace{1em}\mbox{($j$ even)} \\ \end{array} $$ We observe the following (c.f. page 156 of~\cite{HNbook}): \begin{enumerate} \item The paths $P$ and $P_i$ ($i=1,2,\dots \ell-2$) each admit a homomorphism \emph{onto} a \emph{$2$-colour forcing path} of length~$2\ell - 1$, (that is, a path consisting of one run of length~$1$, $\ell - 2$ runs each of length~$2$ and a final run of length~$1$: $WBBWWB\cdots W$). \item The paths $Q$ and $Q_j$ ($j=1,2,\dots k-2$) each admit a homomorphism onto a $2$-colour forcing path of length~$2k-1$. \item $P_i \to P_{i'}$ implies $i=i'$. \item $Q_j \to Q_{j'}$ implies $j=j'$. \item $P \to P_i$ for all $i$. \item $Q \to Q_j$ for all $j$. \item if $X$ is a $2$-tropical graph and $x$ is a vertex of $X$ such that $f: X \to P_i$ and $f': X \to P_{i'}$ for $i\neq i'$ with $f(x) = i$ and $f'(x) = i'$, then there is a homomorphism $F:X \to P$ with $F(x)=0$. \item if $Y$ is a $2$-tropical graph and $y$ is a vertex of $Y$ such that $f: Y \to Q_j$ and $f': Y \to Q_{j'}$ for $j \neq j'$ with $f(y) = j$ and $f'(y) = j'$, then there is a homomorphism $F:Y \to Q$ with $F(y)=1$. \end{enumerate} We note that $2$-colour forcing paths in $2$-tropical graphs can be used to define \emph{height} analogously to height in directed acyclic graphs. More precisely, suppose $G$ is a connected $2$-tropical graph that admits a homomorphism onto a $2$-colour forcing path, say $FP$, of even length. Let the vertices of $FP$ be $h_0, h_1, \dots, h_{2t}$. Observe that each vertex in the path has at most one white neighbour and at most one black neighbour. Thus once a single vertex $u$ in $G$ is mapped to $FP$, the image of each neighbour of $u$ is uniquely determined and by connectivity, the image of all vertices is uniquely determined. In particular, as $G$ maps \emph{onto} $FP$, there is exactly one homomorphism of $G$ to the path. (More precisely, if the path has length congruent to 0 modulo 4, there is an automorphism that reverses the path. In this case there are two homomorphisms that are equivalent up to the reversing.) We then observe that if $g:G \stackrel{onto}{\to} FP$, $h:H \to FP$, and $f: G \to H$, then for all vertices $u \in V(G)$, $g(u) = h(f(u))$. This allows us to define the height of $u \in V(G)$ to be $h_i$ when $g(u)=h_i$. Specifically, vertices at height $h_i$ in $G$ must map to vertices at height $h_i$ in $H$. For each problem $T$ in CSP there is a bipartite graph $H$ such that \textsc{$T$-CSP} and \textsc{$H$-Retraction} are equivalent~\cite{FV98,HNbook}. Let $H$ be a bipartite graph with parts $(A,B)$, with $A=\{a_1,\dots,a_{|A|}\}$ and $B=\{b_1,\dots,b_{|B|}\}$. Let $\ell$ (respectively $k$) be the smallest odd (respectively even) integer greater than or equal to $|A|$ (respectively $|B|$). To each vertex $a_i \in A$ attach a copy of $P_i$ identifying $i$ in $P_i$ with $a_i$ in $A$. Colour all original vertex of $H$ white. To each vertex $b_j \in B$ attach a copy of $Q_j$ identifying $j$ in $Q_j$ with $b_j$ in $B$. Call the resulting $2$-tropical graph $(H',c)$. See Figure~\ref{fig:rbtarget} for an illustration. Let $G$ be an instance of \textsc{$H$-Retraction}. In particular, we may assume without loss of generality that $H$ is a subgraph of $G$, $G$ is connected, and $G$ is bipartite. We colour the original vertices of $G$ white. Let $(A',B')$ be the partite classes of $G$ where $A \subseteq A'$ and $B \subseteq B'$. To each vertex $v$ of $A' \backslash A$, we attach a copy of $P$, identifying $v$ and $0$. To the vertices of $A \cup B$, we attach paths $P_i$ and $Q_j$ as described above to create a copy of $H'$. Call the resulting $2$-tropical graph $(G',c')$. In particular, note that $(G',c')$ and $(H',c')$ both map onto a $2$-colour forcing path of length $2\ell+2k-1$. The (original) vertices of $G$ and $H$ are at height $2\ell-1$ and $2\ell$ for colour classes $A$ and $B$ respectively. In particular, by the eight above properties, under any homomorphism $f:G' \to H'$ the restriction of $f$ to $G$ must map onto $H$ with vertices in $A'$ mapping to $A$ and vertices in $B'$ mapping to $B$. Using the eight properties of the paths above and following the proof of Theorem~5.14 in~\cite{HNbook}, we conclude that $G$ is a YES instance of \textsc{$H$-Retraction} if and only if $(G',c')$ is a YES instance of \textsc{$(H',c)$-Retraction}. On the other hand, let $(G',c')$ be an instance of \textsc{$(H',c)$-Retraction}. We sketch the proof from~\cite{HNbook}. We observe that $(G',c')$ must map to a $2$-colour forcing path of length $2\ell+2k-1$. The two levels of $G'$ corresponding to $H$ induce a bipartite graph (with white vertices) which we call $G$. The components of $G'-E(G)$ fall into two types: those which map to lower levels and those that map to higher levels than $G$. Let $C_t$ be a component that maps to a lower level. After required identifications we may assume $C_t$ contains only one vertex from $G$ (say $v$) and $C_t$ must map to some $P_i$. If $P_i$ is the unique $P_i$ path to which $C_t$ maps, then we modify $G'$ by identifying $v$ and $i$. Otherwise, $C_t$ maps to two paths and (by the properties~$5$--$8$) hence to all paths. The resulting graph $(G',c')$ retracts to $(H',c)$ if and only if $G$ retracts to $H$. \end{proof} \tikzset{ bigblue/.style={circle, draw=blue!80,fill=blue!40,thick, inner sep=1.5pt, minimum size=5mm}, bigred/.style={circle, draw=red!80,fill=red!40,thick, inner sep=1.5pt, minimum size=5mm}, bigblack/.style={circle, draw=black!100,fill=black!40,thick, inner sep=1.5pt, minimum size=5mm}, bluevertex/.style={circle, draw=blue!100,fill=blue!100,thick, inner sep=0pt, minimum size=2mm}, redvertex/.style={circle, draw=red!100,fill=red!100,thick, inner sep=0pt, minimum size=2mm}, blackvertex/.style={circle, draw=black!100,fill=black!100,thick, inner sep=0pt, minimum size=2mm}, whitevertex/.style={circle, draw=black!100,fill=white!100,thick, inner sep=0pt, minimum size=2mm}, smallblack/.style={circle, draw=black!100,fill=black!100,thick, inner sep=0pt, minimum size=1mm}, smallwhite/.style={circle, draw=black!100,fill=white!100,thick, inner sep=0pt, minimum size=1mm}, } \begin{figure}[ht!] \begin{center} \begin{tikzpicture} \node[smallwhite] (p1) at (0,4) {}; \node[smallblack] (p2) at (0.66,4) {}; \node[smallblack] (p3) at (1.32,4) {}; \node[smallblack] (p4) at (0.66,4.5) {}; \node[smallblack] (p5) at (1.32,4.5) {}; \draw[black] (p1)--(p2)--(p3)--(p4)--(p5)--(1.485,4.5); \node at (1.65,4.25) {$\cdots$}; \node[smallblack] (p6) at (1.98,4) {}; \node[smallblack] (p7) at (2.64,4) {}; \node[smallblack] (p8) at (1.98,4.5) {}; \node[smallblack] (p9) at (2.64,4.5) {}; \node[smallwhite] (p10) at (3.3,4.5) {}; \node[smallwhite] (p11) at (3.96,4.5) {}; \node[smallwhite] (p12) at (3.3,4) {}; \node[smallwhite] (p13) at (3.96,4) {}; \node[smallblack] (p14) at (4.62,4) {}; \node[smallblack] (p15) at (5.28,4) {}; \node[whitevertex] (pa1) at (6,4) {}; \draw[black] (1.815,4)--(p6)--(p7)--(p8)--(p9)--(p10)--(p11)--(p12)--(p13)--(p14)--(p15)--(pa1); \begin{scope}[yshift=-1.5cm] \node[smallwhite] (p1) at (0,4) {}; \node[smallblack] (p2) at (0.66,4) {}; \node[smallblack] (p3) at (1.32,4) {}; \node[smallblack] (p4) at (0.66,4.5) {}; \node[smallblack] (p5) at (1.32,4.5) {}; \draw[black] (p1)--(p2)--(p3)--(p4)--(p5)--(1.485,4.5); \node at (1.65,4.25) {$\cdots$}; \node[smallblack] (p6) at (1.98,4) {}; \node[smallblack] (p7) at (2.64,4) {}; \node[smallblack] (p8) at (1.98,4.5) {}; \node[smallblack] (p9) at (2.64,4.5) {}; \node[smallwhite] (p10) at (3.3,4.5) {}; \node[smallwhite] (p11) at (3.96,4.5) {}; \node[smallblack] (p12) at (4.62,4.5) {}; \node[smallblack] (p13) at (5.28,4.5) {}; \node[smallblack] (p14) at (4.62,4) {}; \node[smallblack] (p15) at (5.28,4) {}; \node[whitevertex] (pa2) at (6,4) {}; \draw[black] (1.815,4)--(p6)--(p7)--(p8)--(p9)--(p10)--(p11)--(p12)--(p13)--(p14)--(p15)--(pa2); \end{scope} \begin{scope}[yshift=-3cm] \node[smallwhite] (p1) at (0,4) {}; \node[smallblack] (p2) at (0.66,4) {}; \node[smallblack] (p3) at (1.32,4) {}; \node[smallblack] (p4) at (0.66,4.5) {}; \node[smallblack] (p5) at (1.32,4.5) {}; \draw[black] (p1)--(p2)--(p3)--(p4)--(p5)--(1.485,4.5); \node at (1.65,4.25) {$\cdots$}; \node[smallblack] (p6) at (1.98,4) {}; \node[smallblack] (p7) at (2.64,4) {}; \node[smallwhite] (p8) at (3.3,4) {}; \node[smallwhite] (p9) at (3.96,4) {}; \node[smallwhite] (p10) at (3.3,4.5) {}; \node[smallwhite] (p11) at (3.96,4.5) {}; \node[smallblack] (p12) at (4.62,4.5) {}; \node[smallblack] (p13) at (5.28,4.5) {}; \node[smallblack] (p14) at (4.62,4) {}; \node[smallblack] (p15) at (5.28,4) {}; \node[whitevertex] (pa3) at (6,4) {}; \draw[black] (1.815,4)--(p6)--(p7)--(p8)--(p9)--(p10)--(p11)--(p12)--(p13)--(p14)--(p15)--(pa3); \end{scope} \begin{scope}[yshift=-0.75cm] \node[whitevertex] (qb1) at (7,4) {}; \node[smallblack] (q11) at (7.66,4) {}; \node[smallblack] (q12) at (8.32,4) {}; \node[smallblack] (q13) at (7.66,4.5) {}; \node[smallblack] (q14) at (8.32,4.5) {}; \node[smallwhite] (q15) at (8.98,4.5) {}; \node[smallwhite] (q16) at (9.64,4.5) {}; \node[smallwhite] (q17) at (8.98,4) {}; \node[smallwhite] (q18) at (9.64,4) {}; \node[smallblack] (q19) at (10.3,4) {}; \node[smallblack] (q20) at (10.86,4) {}; \draw[black] (qb1)--(q11)--(q12)--(q13)--(q14)--(q15)--(q16)--(q17)--(q18)--(q19)--(q20)--(11.125,4); \node at (11.29,4.25) {$\cdots$}; \node[smallwhite] (q21) at (11.62,4) {}; \node[smallwhite] (q22) at (12.28,4) {}; \node[smallwhite] (q23) at (11.62,4.5) {}; \node[smallwhite] (q24) at (12.28,4.5) {}; \node[smallblack] (q25) at (12.94,4.5) {}; \draw[black] (11.455,4)--(q21)--(q22)--(q23)--(q24)--(q25); \end{scope} \begin{scope}[yshift=-2.25cm] \node[whitevertex] (qb2) at (7,4) {}; \node[smallblack] (q11) at (7.66,4) {}; \node[smallblack] (q12) at (8.32,4) {}; \node[smallblack] (q13) at (7.66,4.5) {}; \node[smallblack] (q14) at (8.32,4.5) {}; \node[smallwhite] (q15) at (8.98,4.5) {}; \node[smallwhite] (q16) at (9.64,4.5) {}; \node[smallblack] (q17) at (10.3,4.5) {}; \node[smallblack] (q18) at (10.86,4.5) {}; \node[smallblack] (q19) at (10.3,4) {}; \node[smallblack] (q20) at (10.86,4) {}; \draw[black] (qb2)--(q11)--(q12)--(q13)--(q14)--(q15)--(q16)--(q17)--(q18)--(q19)--(q20)--(11.125,4); \node at (11.29,4.25) {$\cdots$}; \node[smallwhite] (q21) at (11.62,4) {}; \node[smallwhite] (q22) at (12.28,4) {}; \node[smallwhite] (q23) at (11.62,4.5) {}; \node[smallwhite] (q24) at (12.28,4.5) {}; \node[smallblack] (q25) at (12.94,4.5) {}; \draw[black] (11.455,4)--(q21)--(q22)--(q23)--(q24)--(q25); \end{scope} \draw[black] (pa1)--(qb1)--(pa2)--(qb2)--(pa3) (pa3)--(qb1); \node at (6.5,4.5) {$H$}; \node at (6,3.25) {$\vdots$}; \node at (6,2) {$\vdots$}; \node at (7,2.5) {$\vdots$}; \end{tikzpicture} \end{center} \caption{Construction of a $2$-tropical target $H'$ from a \textsc{$H$-Retraction} problem.} \label{fig:rbtarget} \end{figure} \section{Minimal graphs $H$ for NP-complete \PBlistCOL{$H$}}\label{sec:list_hom} Recall the dichotomy theorem for list homomorphism problems of Feder, Hell and Huang (Theorem~\ref{thm:listhom-table}): \PBlistCOL{$H$} is polynomial-time solvable if $H$ is bipartite and its complement is a circular arc graph, otherwise NP-complete. Alternatively, the latter class of graphs was characterized by Trotter and Moore~\cite{TM76} in terms of seven families of forbidden induced subgraphs: six infinite ones and a finite one. \shortpaper{One of these families is the family of even cycles of length at least~$6$. The only tree in the list of forbidden graphs, which is called $G_1$ in~\cite{FHH99}, is a claw where each edge is subdivided twice.} \longpaper{See their descriptions in Table~\ref{table}, as reproduced from~\cite{FHH99}. To concisely describe these seven families, they employ the following notation: Let $\mathcal F = \{S_i : 1 \leq i \leq k\}$ be a family of subsets of $\{1,2,\ldots,\ell\}$. Define $H_F$ to be the bipartite graph $(X,Y)$ with $X = \{x_1,x_2,\ldots,x_\ell\}$ and $Y =\{y_1,y_2,\ldots,y_k\}$ such that $x_iy_j$ is an edge if and only if $i\in S_j$. The families $\mathcal C$, $\mathcal T$, $\mathcal W$, $\mathcal D$, $\mathcal M$, $\mathcal N$ and $\mathcal G$ in Table~\ref{table} are defined in this way. Note that the graph $C_i$ in $\mathcal C$ is the cycle of length~$i$. See Figure~\ref{fig:table} for an illustration of the other families from Table~\ref{table}. Also note that $G_1$, which is a claw where each edge is subdivided twice, is the only tree in the table. Given the above characterization, we can reformulate Theorem~\ref{thm:listhom-table} as follows. \begin{theorem}[Restatement of Theorem~\ref{thm:listhom-table}, Feder, Hell and Huang~\cite{FHH99} If $H$ contains one of the graphs defined in Table~\ref{table} as an induced subgraph, then \PBlistCOL{$H$} is NP-complete. Otherwise, \PBlistCOL{$H$} is polynomial-time solvable. \end{theorem} \begin{table}[ht!] \begin{tabular}{l} \hline $C_6 = \{\{1, 2\}, \{2, 3\}, \{3, 1\}\}$ \\ $C_8 = \{\{1, 2\}, \{2, 3\}, \{3, 4\}, \{4, 1\}\}$ \\ $C_{10} = \{\{1, 2\}, \{2, 3\}, \{3, 4\}, \{4, 5\}, \{5, 1\}\}$\\ \ldots\\ $T_1 = \{\{1, 2\}, \{2, 3\}, \{3, 4\}, \{2, 3, 5\}, \{5\}\}$\\ $T_2 = \{\{1, 2\}, \{2, 3\}, \{3, 4\}, \{4, 5\}, \{2, 3, 4, 6\}\{6\}\}$\\ $T_3 = \{\{1, 2\}, \{2, 3\}, \{3, 4\}, \{4, 5\}, \{5, 6\}, \{2, 3, 4, 5, 7\}, \{7\}\}$\\ \ldots\\ $W_1 = \{\{1, 2\}, \{2, 3\}, \{1, 2, 4\}, \{2, 3, 4\}, \{4\}\}$\\ $W_2 = \{\{1, 2\}, \{2, 3\}, \{3, 4\}, \{1, 2, 3, 5\}, \{2, 3, 4, 5\}, \{5\}\}$\\ $W_3 = \{\{1, 2\}, \{2, 3\}, \{3, 4\}, \{4, 5\}, \{1, 2, 3, 4, 6\}, \{2, 3, 4, 5, 6\}, \{6\}\}$\\ \ldots\\ $D_1 = \{\{1, 2, 5\}, \{2, 3, 5\}, \{3\}, \{4, 5\}, \{2, 3, 4, 5\}\}$\\ $D_2 = \{\{1, 2, 6\}, \{2, 3, 6\}, \{3, 4, 6\}, \{4\}, \{5, 6\}, \{2, 3, 4, 5, 6\}\}$\\ $D_3 = \{\{1, 2, 7\}, \{2, 3, 7\}, \{3, 4, 7\}, \{4, 5, 7\}, \{5\}, \{6, 7\}, \{2, 3, 4, 5, 6, 7\}\}$\\ \ldots\\ $M_1 = \{\{1, 2, 3, 4, 5\}, \{1, 2, 3\}, \{1\}, \{1, 2, 4, 6\}, \{2, 4\}, \{2, 5\}\}$\\ $M_2 = \{\{1, 2, 3, 4, 5, 6, 7\}, \{1, 2, 3, 4, 5\}, \{1, 2, 3\}, \{1\}, \{1, 2, 3, 4, 6, 8\}, \{1, 2, 4, 6\}, \{2, 4\}, \{2, 7\}\}$\\ $M_3 = \{\{1, 2, 3, 4, 5, 6, 7, 8, 9\}, \{1, 2, 3, 4, 5, 6, 7\}, \{1, 2, 3, 4, 5\}, \{1, 2, 3\}, \{1\}, \{1, 2, 3, 4, 5, 6, 8, 10\}, $\\ \hspace{240pt}$\{1, 2, 3, 4, 6, 8\}, \{1, 2, 4, 6\}, \{2, 4\}, \{2, 9\}\}$\\ \ldots\\ $N_1 = \{\{1, 2, 3\}, \{1\}, \{1, 2, 4, 6\}, \{2, 4\}, \{2, 5\}, \{6\}\}$\\ $N_2 = \{\{1, 2, 3, 4, 5\}, \{1, 2, 3\}, \{1\}, \{1, 2, 3, 4, 6, 8\}, \{1, 2, 4, 6\}, \{2, 4\}, \{2, 7\}, \{8\}\}$\\ $N_3 = \{\{1, 2, 3, 4, 5, 6, 7\}, \{1, 2, 3, 4, 5\}, \{1, 2, 3\}, \{1\}, \{1, 2, 3, 4, 5, 6, 8, 10\}, \{1, 2, 3, 4, 6, 8\},$\\ \hspace{250pt}$\{1, 2, 4, 6\}, \{2, 4\}, \{2, 9\}, \{10\}\}$\\ \ldots\\ $G_1 = \{\{1, 3, 5\}, \{1, 2\}, \{3, 4\}, \{5, 6\}\}$\\ $G_2 = \{\{1\}, \{1, 2, 3, 4\}, \{2, 4, 5\}, \{2, 3, 6\}\}$\\ $G_3 = \{\{1, 2\}, \{3, 4\}, \{5\}, \{1, 2, 3\}, \{1, 3, 5\}\}$\\ \hline \end{tabular} \caption{Six infinite families $\mathcal C$, $\mathcal T$, $\mathcal W$, $\mathcal D$, $\mathcal M$, $\mathcal N$ and family $\mathcal G$ of size~$3$ of forbidden induced subgraphs for polynomial-time \PBlistCOL{$H$} problems.} \label{table} \end{table} \begin{figure}[ht!] \centering \subfigure[$T_i$]{ \scalebox{0.85}{\begin{tikzpicture}[join=bevel,inner sep=0.5mm,scale=0.7] \node[draw,shape=circle,fill](x1) at (2.5,1.5) {}; \path (x1)+(0.5,0) node {$x_1$}; \node[draw,shape=circle,fill](y1) at (2.5,0) {}; \path (y1)+(0,-0.5) node {$y_1$}; \node[draw,shape=circle,fill](x2) at (4,0) {}; \path (x2)+(-0.25,-0.5) node {$x_2$}; \node[draw,shape=circle,fill](y2) at (4.75,-2) {}; \path (y2)+(0,-0.5) node {$y_2$}; \node[draw,shape=circle,fill](x3) at (5.5,0) {}; \path (x3)+(-0.5,0) node {$x_3$}; \node[draw,shape=circle,fill](xi+1) at (7.5,0) {}; \path (xi+1)+(0.7,0) node {$x_{i+1}$}; \node[draw,shape=circle,fill](yi+1) at (8.25,-2) {}; \path (yi+1)+(0,-0.5) node {$y_{i+1}$}; \node[draw,shape=circle,fill](xi+2) at (9,0) {}; \path (xi+2)+(0.5,-0.5) node {$x_{i+2}$}; \node[draw,shape=circle,fill](yi+2) at (10.5,0) {}; \path (yi+2)+(0.25,-0.5) node {$y_{i+2}$}; \node[draw,shape=circle,fill](xi+3) at (10.5,1.5) {}; \path (xi+3)+(-0.7,0) node {$x_{i+3}$}; \node[draw,shape=circle,fill](yi+3) at (6.5,3) {}; \path (yi+3)+(0.6,0.25) node {$y_{i+3}$}; \node[draw,shape=circle,fill](xi+4) at (6.5,4.5) {}; \path (xi+4)+(0.7,0) node {$x_{i+4}$}; \node[draw,shape=circle,fill](yi+4) at (5,4.5) {}; \path (yi+4)+(-0.7,0) node {$y_{i+4}$}; \node at (6.5,0) {$\cdots$}; \draw[line width=1pt] (x1)--(y1)--(x2)--(y2)--(x3)--(yi+3)--(xi+1)--(yi+1)--(xi+2)--(yi+2)--(xi+3) (x2)--(yi+3)--(xi+2) (yi+3)--(xi+4)--(yi+4) (x3) -- ++(0.3,-0.5) (xi+1) -- ++(-0.3,-0.5) (yi+3) -- ++(0.15,-1.2) (yi+3) -- ++(-0.15,-1.2); \end{tikzpicture}} }\qquad \subfigure[$W_i$]{ \scalebox{0.85}{\begin{tikzpicture}[join=bevel,inner sep=0.5mm,scale=0.7] \node[draw,shape=circle,fill](x1) at (0,0) {}; \path (x1)+(-0.5,0.25) node {$x_1$}; \node[draw,shape=circle,fill](x2) at (1.5,0) {}; \path (x2)+(-0.5,0.25) node {$x_2$}; \node[draw,shape=circle,fill](y1) at (0.75,-2) {}; \path (y1)+(0,-0.5) node {$y_1$}; \node[draw,shape=circle,fill](xi) at (3.5,0) {}; \path (xi)+(0.5,0.25) node {$x_i$}; \node[draw,shape=circle,fill](yi) at (4.25,-2) {}; \path (yi)+(0,-0.5) node {$y_i$}; \node[draw,shape=circle,fill](xi+1) at (5,0) {}; \path (xi+1)+(0.6,0.25) node {$x_{i+1}$}; \node[draw,shape=circle,fill](yi+1) at (1.5,2) {}; \path (yi+1)+(-0.5,0.25) node {$y_{i+1}$}; \node[draw,shape=circle,fill](yi+2) at (3.5,2) {}; \path (yi+2)+(0.5,0.25) node {$y_{i+2}$}; \node[draw,shape=circle,fill](xi+2) at (2.5,2.5) {}; \path (xi+2)+(0,-0.5) node {$x_{i+2}$}; \node[draw,shape=circle,fill](yi+3) at (2.5,3.5) {}; \path (yi+3)+(0,0.5) node {$y_{i+3}$}; \node at (2.5,0) {$\cdots$}; \draw[line width=1pt] (x1)--(y1)--(x2)--(yi+1)--(xi)--(yi)--(xi+1)--(yi+2)--(x2) (x1)--(yi+1)--(xi+2)--(yi+3) (xi+2)--(yi+2)--(xi) (x2) -- ++(0.3,-0.5) (xi) -- ++(-0.3,-0.5) (yi+1) -- ++(0.3,-1.2) (yi+1) -- ++(0.6,-1.2) (yi+2) -- ++(-0.3,-1.2) (yi+2) -- ++(-0.6,-1.2); \end{tikzpicture}} }\qquad \subfigure[$D_i$]{ \scalebox{0.85}{\begin{tikzpicture}[join=bevel,inner sep=0.5mm,scale=0.7] \node[draw,shape=circle,fill](x1) at (0,0) {}; \path (x1)+(0,0.4) node {$x_1$}; \node[draw,shape=circle,fill](x2) at (1.5,0) {}; \path (x2)+(-0.25,0.4) node {$x_2$}; \node[draw,shape=circle,fill](y1) at (0.75,-2) {}; \path (y1)+(-0.25,-0.3) node {$y_1$}; \node[draw,shape=circle,fill](y2) at (2.25,-2) {}; \path (y2)+(-0.25,-0.3) node {$y_2$}; \node[draw,shape=circle,fill](xi+1) at (3.5,0) {}; \path (xi+1)+(0.6,0.25) node {$x_{i+1}$}; \node[draw,shape=circle,fill](yi+1) at (4.25,-2) {}; \path (yi+1)+(0.7,0) node {$y_{i+1}$}; \node[draw,shape=circle,fill](xi+2) at (5,0) {}; \path (xi+2)+(0.5,0.35) node {$x_{i+2}$}; \node[draw,shape=circle,fill](yi+2) at (6.5,0) {}; \path (yi+2)+(-0.2,-0.5) node {$y_{i+2}$}; \node[draw,shape=circle,fill](xi+3) at (6.85,1) {}; \path (xi+3)+(0.5,0.3) node {$x_{i+3}$}; \node[draw,shape=circle,fill](yi+3) at (6.85,-1) {}; \path (yi+3)+(0.5,-0.4) node {$y_{i+3}$}; \node[draw,shape=circle,fill](xi+4) at (3.25,-4) {}; \path (xi+4)+(0,-0.5) node {$x_{i+4}$}; \node[draw,shape=circle,fill](yi+4) at (2.5,2) {}; \path (yi+4)+(0,0.5) node {$y_{i+4}$}; \node at (2.5,0) {$\cdots$}; \node at (3.25,-2) {$\cdots$}; \draw[line width=1pt] (x1)--(y1)--(xi+4)--(y2)--(x2)--(y1) (x2)--(yi+4)--(xi+1)--(yi+1) (xi+4)--(yi+1)--(xi+2)--(yi+2) (xi+2)--(yi+4) .. controls +(-4,0) and +(-5.5,0.5) .. (xi+4)--(yi+3)--(xi+3)--(yi+4) (y2) -- ++(0.25,0.5) (xi+1) -- ++(-0.25,-0.5) (yi+4) -- ++(0.25,-1.2) (yi+4) -- ++(-0.25,-1.2) (xi+4) -- ++(0.3,1.2) (xi+4) -- ++(-0.3,1.2); \end{tikzpicture}} }\qquad \subfigure[$M_i$]{ \scalebox{0.85}{\begin{tikzpicture}[join=bevel,inner sep=0.5mm,scale=0.7] \node[draw,shape=circle,fill](x1) at (0,0) {}; \path (x1)+(-0.35,0.3) node {$x_1$}; \node[draw,shape=circle,fill](x2) at (1.5,0) {}; \path (x2)+(-0.5,0) node {$x_2$}; \node[draw,shape=circle,fill](x3) at (3,0) {}; \path (x3)+(-0.5,-0.1) node {$x_3$}; \node[draw,shape=circle,fill](x4) at (4.5,0) {}; \path (x4)+(-0.5,-0.1) node {$x_4$}; \node[draw,shape=circle,fill](x2i) at (6.5,0) {}; \path (x2i)+(0.5,0.25) node {$x_{2i}$}; \node[draw,shape=circle,fill](x2i+1) at (8,0) {}; \path (x2i+1)+(0.7,0.5) node {$x_{2i+1}$}; \node[draw,shape=circle,fill](x2i+2) at (9.5,0) {}; \path (x2i+2)+(0.5,0.25) node {$x_{2i+2}$}; \node[draw,shape=circle,fill](x2i+3) at (11,0) {}; \path (x2i+3)+(0.5,0.35) node {$x_{2i+3}$}; \node[draw,shape=circle,fill](x2i+4) at (-1,2.5) {}; \path (x2i+4)+(0,0.5) node {$x_{2i+4}$}; \node[draw,shape=circle,fill](y1) at (7,-2.5) {}; \path (y1)+(0,-0.5) node {$y_1$}; \node[draw,shape=circle,fill](y2) at (5.5,-2.5) {}; \path (y2)+(0,-0.5) node {$y_2$}; \node[draw,shape=circle,fill](yi+1) at (2,-2.5) {}; \path (yi+1)+(0,-0.5) node {$y_{i+1}$}; \node[draw,shape=circle,fill](yi+2) at (-1,0) {}; \path (yi+2)+(0,-0.5) node {$y_{i+2}$}; \node[draw,shape=circle,fill](yi+3) at (0.5,2.5) {}; \path (yi+3)+(0,0.5) node {$y_{i+3}$}; \node[draw,shape=circle,fill](y2i+3) at (7.5,2.5) {}; \path (y2i+3)+(0,0.5) node {$y_{2i+3}$}; \node[draw,shape=circle,fill](y2i+4) at (9,2.5) {}; \path (y2i+4)+(0,0.5) node {$y_{2i+4}$}; \node at (5.5,0) {$\cdots$}; \node at (3.25,-2.5) {$\cdots$}; \node at (2.5,2.5) {$\cdots$}; \draw[line width=1pt] (yi+2)--(x1)--(yi+1)--(x2)--(y2)--(x1)--(y1)--(x3)--(yi+1) (x3)--(y2)--(x2i)--(yi+3)--(x2i+2)--(y1)--(x2i+1)--(y2) (y2)--(x4)--(y1)--(x2i+3)--(y2i+4)--(x2)--(yi+3)--(x1) (x2i+4)--(yi+3)--(x3) (x2)--(y1)--(x2i) (yi+3)--(x4)--(y2i+3)--(x2) (y1) -- ++(-0.5,1.5) (y1) -- ++(-0.8,1.5) (y2) -- ++(-0.2,1.5) (y2) -- ++(0.2,1.5) (yi+3) -- ++(2.3,-1.2) ; \end{tikzpicture}} }\qquad \subfigure[$N_i$]{ \scalebox{0.85}{\begin{tikzpicture}[join=bevel,inner sep=0.5mm,scale=0.7] \node[draw,shape=circle,fill](x1) at (0,0) {}; \path (x1)+(-0.35,0.3) node {$x_1$}; \node[draw,shape=circle,fill](x2) at (1.5,0) {}; \path (x2)+(-0.5,0) node {$x_2$}; \node[draw,shape=circle,fill](x3) at (3,0) {}; \path (x3)+(-0.5,-0.1) node {$x_3$}; \node[draw,shape=circle,fill](x4) at (4.5,0) {}; \path (x4)+(-0.5,-0.1) node {$x_4$}; \node[draw,shape=circle,fill](x2i) at (6.5,0) {}; \path (x2i)+(0.5,0.25) node {$x_{2i}$}; \node[draw,shape=circle,fill](x2i+1) at (8,0) {}; \path (x2i+1)+(0.7,0.5) node {$x_{2i+1}$}; \node[draw,shape=circle,fill](x2i+2) at (9.5,0) {}; \path (x2i+2)+(0.5,0.25) node {$x_{2i+2}$}; \node[draw,shape=circle,fill](x2i+3) at (11,0) {}; \path (x2i+3)+(0.5,0.35) node {$x_{2i+3}$}; \node[draw,shape=circle,fill](x2i+4) at (-1,2.5) {}; \path (x2i+4)+(0,0.5) node {$x_{2i+4}$}; \node[draw,shape=circle,fill](y1) at (5.5,-2.5) {}; \path (y1)+(0,-0.5) node {$y_1$}; \node[draw,shape=circle,fill](yi) at (2,-2.5) {}; \path (yi)+(0,-0.5) node {$y_{i}$}; \node[draw,shape=circle,fill](yi+1) at (-1,0) {}; \path (yi+1)+(0,-0.5) node {$y_{i+1}$}; \node[draw,shape=circle,fill](yi+2) at (0.5,2.5) {}; \path (yi+2)+(0,0.5) node {$y_{i+2}$}; \node[draw,shape=circle,fill](y2i+2) at (7.5,2.5) {}; \path (y2i+2)+(0,0.5) node {$y_{2i+2}$}; \node[draw,shape=circle,fill](y2i+3) at (9,2.5) {}; \path (y2i+3)+(0,0.5) node {$y_{2i+3}$}; \node[draw,shape=circle,fill](y2i+4) at (-1,1.5) {}; \path (y2i+4)+(0,-0.5) node {$y_{2i+4}$}; \node at (5.5,0) {$\cdots$}; \node at (3.25,-2.5) {$\cdots$}; \node at (2.5,2.5) {$\cdots$}; \draw[line width=1pt] (yi+1)--(x1)--(yi)--(x2)--(y1)--(x1) (x3)--(yi) (x3)--(y1)--(x2i)--(yi+2)--(x2i+2) (x2i+1)--(y1) (y1)--(x4) (x2i+3)--(y2i+3)--(x2)--(yi+2)--(x1) (y2i+4)--(x2i+4)--(yi+2)--(x3) (yi+2)--(x4)--(y2i+2)--(x2) (y1) -- ++(-0.2,1.5) (y1) -- ++(0.2,1.5) (yi+2) -- ++(2.3,-1.2); \end{tikzpicture}} }\\ \subfigure[$G_1$]{ \scalebox{0.85}{\begin{tikzpicture}[join=bevel,inner sep=0.5mm,scale=0.7] \node[draw,shape=circle,fill](x1) at (0.25,0) {}; \path (x1)+(-0.5,0) node {$x_1$}; \node[draw,shape=circle,fill](y2) at (0.25,1) {}; \path (y2)+(-0.5,0) node {$y_2$}; \node[draw,shape=circle,fill](x2) at (0.25,2) {}; \path (x2)+(-0.5,0) node {$x_2$}; \node[draw,shape=circle,fill](x3) at (1.75,0) {}; \path (x3)+(0.5,0) node {$x_3$}; \node[draw,shape=circle,fill](y3) at (1.75,1) {}; \path (y3)+(0.5,0) node {$y_3$}; \node[draw,shape=circle,fill](x4) at (1.75,2) {}; \path (x4)+(0.5,0) node {$x_4$}; \node[draw,shape=circle,fill](y1) at (1,0) {}; \path (y1)+(0,0.5) node {$y_1$}; \node[draw,shape=circle,fill](x5) at (1,-1) {}; \path (x5)+(0.5,0) node {$x_5$}; \node[draw,shape=circle,fill](y4) at (1,-2) {}; \path (y4)+(0.5,0) node {$y_4$}; \node[draw,shape=circle,fill](x6) at (1,-3) {}; \path (x6)+(0.5,0) node {$x_6$}; \draw[line width=1pt] (x2)--(y2)--(x1)--(y1)--(x5)--(y4)--(x6) (y1)--(x3)--(y3)--(x4); \end{tikzpicture}} }\qquad \subfigure[$G_2$]{ \scalebox{0.85}{\begin{tikzpicture}[join=bevel,inner sep=0.5mm,scale=0.7] \node[draw,shape=circle,fill](y4) at (0,0) {}; \path (y4)+(-0.5,0) node {$y_4$}; \node[draw,shape=circle,fill](x6) at (0,1) {}; \path (x6)+(-0.5,0) node {$x_6$}; \node[draw,shape=circle,fill](x3) at (0,-1) {}; \path (x3)+(-0.5,0) node {$x_3$}; \node[draw,shape=circle,fill](y3) at (2,0) {}; \path (y3)+(0.5,0) node {$y_3$}; \node[draw,shape=circle,fill](x5) at (2,1) {}; \path (x5)+(0.5,0) node {$x_5$}; \node[draw,shape=circle,fill](x4) at (2,-1) {}; \path (x4)+(0.5,0) node {$x_4$}; \node[draw,shape=circle,fill](x2) at (1,0) {}; \path (x2)+(0,0.5) node {$x_2$}; \node[draw,shape=circle,fill](y2) at (1,-1) {}; \path (y2)+(0.4,0.3) node {$y_2$}; \node[draw,shape=circle,fill](x1) at (1,-2) {}; \path (x1)+(0.5,0) node {$x_1$}; \node[draw,shape=circle,fill](y1) at (1,-3) {}; \path (y1)+(0.5,0) node {$y_1$}; \draw[line width=1pt] (x6)--(y4)--(x2)--(y3)--(x5) (y4)--(x3)--(y2)--(x4)--(y3) (x2)--(y2)--(x1)--(y1); \end{tikzpicture}} }\qquad \subfigure[$G_3$]{ \scalebox{0.85}{\begin{tikzpicture}[join=bevel,inner sep=0.5mm,scale=0.7] \node[draw,shape=circle,fill](x2) at (0,0) {}; \path (x2)+(-0.5,0) node {$x_2$}; \node[draw,shape=circle,fill](y4) at (0,1) {}; \path (y4)+(-0.5,0) node {$y_4$}; \node[draw,shape=circle,fill](x3) at (0,2) {}; \path (x3)+(-0.5,0) node {$x_3$}; \node[draw,shape=circle,fill](y2) at (0,3) {}; \path (y2)+(-0.5,0) node {$y_2$}; \node[draw,shape=circle,fill](x4) at (0,4) {}; \path (x4)+(-0.5,0) node {$x_4$}; \node[draw,shape=circle,fill](y1) at (1,0) {}; \path (y1)+(0.5,0) node {$y_1$}; \node[draw,shape=circle,fill](x1) at (1,1) {}; \path (x1)+(0.5,0) node {$x_1$}; \node[draw,shape=circle,fill](y5) at (1,2) {}; \path (y5)+(0.5,0) node {$y_5$}; \node[draw,shape=circle,fill](x5) at (1,3) {}; \path (x5)+(0.5,0) node {$x_5$}; \node[draw,shape=circle,fill](y3) at (1,4) {}; \path (y3)+(0.5,0) node {$y_3$}; \draw[line width=1pt] (x4)--(y2)--(x3)--(y5)--(x5)--(y3) (x3)--(y4)--(x1)--(y5) (y4)--(x2)--(y1)--(x1); \end{tikzpicture}} } \caption{Illustration of the families defined in Table~\ref{table} (except the cycles in $\mathcal C$).} \label{fig:table} \end{figure} \shortpaper{In fact, one can show the following result (see~\cite{fullversion} for a proof). \begin{theorem}\label{thm:table} Let $H$ be a graph in the characterization of forbidden induced subgraphs of~\cite{TM76} that is no an even cycle. Then, \PBtropCOL{$H$} is polynomial-time solvable. \end{theorem} } In this section, we first turn our attention to the family of even cycles of length at least~$6$. We show that \PBtropCOL{$C_{2k}$} is polynomial-time solvable for any $k\leq 6$. On the other hand, for any $k\geq 24$, \PBtropCOL{$C_{2k}$} is NP-complete. \longpaper{We then prove that for all other minimal graphs $H$ described in Table~\ref{table}, \PBtropCOL{$H$} is polynomial-time solvable.} \subsection{Polynomial-time cases for even cycles} We now prove that the tropical homomorphism problems for small even cycles are polynomial-time solvable. \begin{theorem} \label{thm: C12} For each integer $k$ with $2\leq k\leq 6$, \PBtropCOL{$C_{2k}$} is polynomial-time solvable. \end{theorem} \begin{proof} Since \PBlistCOL{$C_4$} is polynomial-time solvable, \PBtropCOL{$C_{4}$} is polynomial-time solvable. We will consider all cases $k\in\{3,4,5,6\}$ separately. But in each of those cases we note that if $(C_{2k}, c)$ is not a core, then the core is path, and since the \PBlistCOL{$P_k$} is polynomial-time solvable for any $k\geq 1$, \PBtropCOL{$C_{2k}$} would also be polynomial-time solvable. Hence in the rest of the proof we always assume $(C_{2k}, c)$ is a core. Furthermore, by Proposition~\ref{prop:bipartite-hom}, we can assume that the colour sets of $c$ in $X$ and $Y$ are disjoint. \medskip First, assume $k=3$. There are three vertices in each part of the bipartition of $C_6$. If one vertex is coloured with a colour not present anywhere else in the part, Lemma~\ref{lemm:unique-feature} implies again that \PBCOL{$(C_6,c)$} is polynomial-time solvable. Hence, we can assume that each part of the bipartition is monochromatic. But then $(C_6,c)$ is not a core, a contradiction with our assumption. \medskip Suppose $k=4$. There are four vertices in each part of the bipartition $(X,Y)$ of $C_8$. If there is a vertex that, in $c$, is the only one coloured with its colour, since \PBlistCOL{$P_k$} is polynomial-time solvable for any $k\geq 1$, by Lemma~\ref{lemm:unique-feature} \PBCOL{$(C_8,c)$} is polynomial-time solvable. Hence we may assume that each colour appears at least twice, in particular each part of the bipartition is coloured with either one or two colours. If some part, say $X$, is coloured with only one colour (say Blue) then $(C_8,c)$ is not a core which again contradicts our assumption. Hence, in each part, there are exactly two vertices of each colour. In this case we can use Lemma~\ref{lemm:2SAT} with $S_1$, $S_2$, $S_3$ and $S_4$ being the four sets of two vertices with the same colour. It follows that \PBCOL{$(C_8,c)$} is polynomial-time solvable. \medskip Assume that $k=5$, and let $c$ be a vertex-colouring of $C_{10}$. By similar arguments as in the proof of Theorems~\ref{thm:small_graph} and~\ref{thm:SmallTree}, using Lemma~\ref{lemm:unique-feature} and the fact that $(H,c)$ should not be homomorphic to a $P_2$- or $P_3$-subgraph, each part of the bipartition $(X,Y)$ contains exactly two vertices of one colour and three vertices of another colour, say $X$ has three vertices coloured~$1$ and two vertices coloured~$2$, and $Y$ has three vertices coloured~$a$ and two vertices coloured~$b$. The cyclic order of the colours of $X$ can be either $1-1-1-2-2$ or $1-1-2-1-2$ (up to permutation of colours and other symmetries). If this order is $1-1-1-2-2$, then the vertex of $Y$ adjacent to the two vertices coloured~$2$ satisfies the hypothesis of Lemma~\ref{lemm:unique-feature} and hence \PBCOL{$(C_{10},c)$} is polynomial-time solvable. The same argument can be applied to $Y$, hence the cyclic order of the colours of $Y$ is $a-a-b-a-b$. Hence, there is a unique vertex $y$ of $Y$ whose two neighbours are coloured~$1$. If $c(y)=b$, then the second vertex of $Y$ coloured~$b$ is in the centre of a $3$-vertex path coloured $1-b-2$ that satisfies the hypothesis of Lemma~\ref{lemm:unique-feature}, hence \PBCOL{$(C_{10},c)$} is polynomial-time solvable. Therefore, we have $c(y)=a$. By the same argument, the unique vertex of $X$ adjacent to two vertices of $Y$ coloured~$a$ must be coloured~$1$. Therefore, up to symmetries $c$ is one of the three colourings $1-a-1-a-2-b-1-a-2-b$, $1-a-1-b-2-a-1-a-2-b$ and $1-a-1-b-2-a-1-b-2-a$ (in the cyclic order). We are going to use the Lemma~\ref{lemm:2SAT} to conclude the case $k=5$. In a homomorphism to $(C_{10},c)$, a vertex coloured~$2$ or~$b$ can only be mapped to the two vertices in $(C_{10},c)$ of the corresponding colour. A vertex $v$ coloured~$1$ adjacent to at least one vertex coloured~$b$ or a vertex coloured~$a$ adjacent to at least one vertex coloured~$2$ also can only be mapped to two vertices of $(C_{10},c)$ (the ones having the same properties as $v$). However, a vertex coloured~$1$ all whose neighbours are coloured~$a$ can be mapped to three different vertices in $(C_{10},c)$ (say $x_1$, $x_2$, $x_3$, the vertices coloured~$1$, that all have a neighbour coloured~$a$). But at least one of $x_1$, $x_2$, $x_3$, say $x_1$, has a common neighbour coloured~$a$ with one of the two other vertices (say $x_2$). Therefore, if there is a homomorphism $h$ of some tropical graph $(G,c_1)$ to $(C_{10},c)$ mapping a vertex $v$ of $G$ coloured~$1$ all whose neighbours are coloured~$a$ to $x_1$, we can modify $h$ so that $v$ is mapped to $x_2$ instead. In other words, there is a homomorphism of $(G,c_1)$ to $(C_{10},c)$ where none of the vertices coloured~$1$ all whose neighbours are coloured~$a$ is mapped to $x_1$. Therefore such vertices have two possible targets: $x_2$ and $x_3$. The same is true for vertices coloured~$a$ all whose neighbours are coloured~$1$. Thus, $(C_{10},c)$ satisfies the hypothesis of Lemma~\ref{lemm:2SAT} and \PBCOL{$(C_{10},c)$} is polynomial-time solvable. \medskip Finally, assume now that $k=6$. Again, using Lemma~\ref{lemm:unique-feature}, we can assume than each part of the bipartition has at most three colours, and each colour appears at least twice. Furthermore, if there are exactly three colours in each part, each colour appears exactly twice and hence \PBCOL{$(C_{12},c)$} is polynomial-time solvable by Lemma~\ref{lemm:2SAT}. If one part of the bipartition has one colour and the other has at most two colours, then $(C_{12},c)$ would not be a core. Therefore, the numbers of colours of the parts in the bipartition are either one and three, two and three, or two and two. Assume that one part, say $X$, is monochromatic (say Red) and the other, $Y$, has three colours (thus two vertices of each colour). For the graph to be a core and not satisfy Lemma~\ref{lemm:unique-feature}, the three colours of $Y$ must form the cyclic pattern $x-y-z-x-y-z$. In this case, considering any vertex $v$ of colour Red in an input tropical graph $(G,c_1)$, in any homomorphism $(G,c_1)\to (C_{12},c)$, all the neighbours of $v$ with the same colour must be identified. Furthermore, no Red vertex in $(G,c_1)$ can have neighbours of three distinct colours. Therefore, the mapping of each connected component is forced after making a choice for one vertex. Since there are two choices per vertex, we have a polynomial-time algorithm for \PBCOL{$(C_{12},c)$}. Assume now that one part, say $X$, contains two colours ($a$ and $b$) and the other, $Y$, contains three colours ($x$, $y$ and $z$). Note that there are exactly two vertices of each colour in $Y$. We are going to use Lemma~\ref{lemm:2SAT} to conclude this case. A vertex of some input graph $(G,c_1)$ coloured $x$, $y$ or $z$ can only be mapped to two possible vertices in $(C_{12},c)$. A vertex of $(G,c_1)$ coloured $a$ or $b$ (say $a$) and having all its neighbours of the same colour, say $x$, might be mapped to more than two vertices of $(C_{12},c)$. However, once again, there are always two of these vertices that, together, are adjacent to all the vertices of colour~$x$ (indeed, there are only two vertices of colour~$x$). These two vertices are the designated targets for Lemma~\ref{lemm:2SAT}. A vertex coloured~$a$ (or~$b$) with two different colours in its neighbourhood can only be mapped to two possible vertices if there is no pattern $x-a-y-a-x-a-y$ in the graph (up to permutation of colours). Hence, if there is no such pattern in the graph (up to permutation of colours), $(C_{12},c)$ satisfies the hypothesis of Lemma~\ref{lemm:2SAT} and \PBCOL{$(C_{12},c)$} is polynomial-time solvable. On the other hand, if there is a pattern $x-a-y-a-x-a-y$ in the graph, then there is a unique path coloured $a-x-b$ or $a-y-b$ in the graph and, by Lemma~\ref{lemm:unique-feature}, \PBCOL{$(C_{12},c)$} is polynomial-time solvable as well. Therefore, we are left to consider the cases where there are exactly two colours in each part. We assume first that there are two vertices coloured~$a$ and four vertices coloured~$b$ in one part, say $X$. If the neighbours of vertices of colour~$a$ all have the same colour, say~$x$, then $(C_{12},c)$ is not a core because it can be mapped to its sub-path coloured $a-x-b-y$. We suppose without loss of generality that the coloured cycle contains a path coloured $y-a-x-b$. Then, if there is no other path coloured $y-a-x-b$, by Lemma~\ref{lemm:unique-feature} \PBCOL{$(C_{12},c)$} is polynomial-time solvable. Therefore, there is another such path in $(C_{12},c)$. If this other path is part of a path $x-a-y-a-x$, then the problem is polynomial-time solvable by applying Lemma~\ref{lemm:unique-feature} to the star $a-y-a$. Up to symmetry, we are left with two cases: $y-a-x-b-.-b-.-a-.-b-.-b$ or $y-a-x-b-.-b-.-b-.-a-.-b$ (where a dot could be colour $x$ or $y$). The first case must be $y-a-x-b-.-b-y-a-x-b-.-b$, because otherwise, $(C_{12},c)$ is not a core. Any placement of the remaining $x$'s and $y$'s yields a polynomial-time solvable case using Lemma~\ref{lemm:distinct-vertex-boundary}. Similarly, the second case must be $y-a-x-b-.-b-.-b-y-a-x-b$. Then, \PBCOL{$(C_{12},c)$} is polynomial-time solvable because of Lemma~\ref{lemm:distinct-edge-boundary}, with $a-x-b-y-a$ as forcing set and $x-b-.-b-.-b-y$, which contains no vertex coloured~$a$, as the other set. Finally, we can assume, without loss of generality, that there are exactly three vertices for each of the two colours in each part. There are three possible configurations in each part: $a-a-a-b-b-b$, $a-a-b-b-a-b$ or $a-b-a-b-a-b$, up to permutations of colours. If one part of the bipartition is in the first configuration, then, either we have the pattern $a-x-b$ or $a-y-b$ that satisfies the hypothesis of Lemma~\ref{lemm:unique-feature}, or we have two paths $a-x-b$, in which case, there is a unique path $a-y-a$ or $b-y-b$ which satisfies the hypothesis of Lemma~\ref{lemm:unique-feature}. Suppose some part of the bipartition is in the second case. Then, if we have the pattern $a-x-a-.-b-x-b-.-a-.-b-.$, there is a unique path $a-x-b$ satisfying the hypothesis of Lemma~\ref{lemm:unique-feature}. Otherwise, we have the pattern $a-x-a-.-b-y-b-.-a-.-b-.$, in which case we can apply Lemma~\ref{lemm:2SAT} in a similar way as for $C_{10}$. Therefore, both parts of the bipartition must be in the third configuration. But then every vertex is a forcing vertex and we can apply Lemma~\ref{lemm:all-forcing}. This completes the proof. \end{proof} \subsection{NP-completeness results for even cycles} We now show that \PBtropCOL{$C_{2k}$} is NP-complete whenever $k\geq 24$. We present a proof using a specific $4$-tropical $48$-cycle. The proof holds similarly for any larger even cycle. It also works similarly for some $3$-tropical cycles $C_{2k}$ for $k\geq 24$ and for $2$-tropical cycles $C_{2k}$ for $k\geq 27$. We use the colour set $\{G, B, R, Y\}$ (for Green, Blue, Red and Yellow). We define $P_{x,y}$ to be a tropical path of length~$8$, with vertices $x=x_0, x_1, \dots, x_7, x_8=y$ where $\{c(x),c(y)\}=\{G, B\}$, $c(x_5)=R$ and all others are coloured Yellow. Thus, $P_{x,y}$ represents one of the two non-isomorphic tropical graphs from Figure~\ref{fig:Pxy}. The distance of the only vertex of colour $R$ from the two ends defines an orientation from one end to another. Thus, in our figures, an arc between two vertices $u$ and $v$ is a $P_{uv}$ path. \begin{figure}[ht!] \centering \scalebox{1}{\begin{tikzpicture}[join=bevel,inner sep=0.5mm,scale=1] \begin{scope} \node[draw,shape=circle,color=black,fill](x0) at (0,0) {}; \path (x0)+(0,-0.3) node {$x$}; \path (x0)+(0,+0.3) node {$G$}; \node[draw,shape=star,color=black,fill](x1) at (1,0) {}; \path (x1)+(0,-0.3) node {$x_1$}; \path (x1)+(0,+0.3) node {$Y$}; \node[draw,shape=star,color=black,fill](x2) at (2,0) {}; \path (x2)+(0,-0.3) node {$x_2$}; \path (x2)+(0,+0.3) node {$Y$}; \node[draw,shape=star,color=black,fill](x3) at (3,0) {}; \path (x3)+(0,-0.3) node {$x_3$}; \path (x3)+(0,+0.3) node {$Y$}; \node[draw,shape=star,color=black,fill](x4) at (4,0) {}; \path (x4)+(0,-0.3) node {$x_4$}; \path (x4)+(0,+0.3) node {$Y$}; \node[draw,shape=rectangle,scale=1.4,color=black,fill](x5) at (5,0) {}; \path (x5)+(0,-0.3) node {$x_5$}; \path (x5)+(0,+0.3) node {$R$}; \node[draw,shape=star,color=black,fill](x6) at (6,0) {}; \path (x6)+(0,-0.3) node {$x_6$}; \path (x6)+(0,+0.3) node {$Y$}; \node[draw,shape=star,color=black,fill](x7) at (7,0) {}; \path (x7)+(0,-0.3) node {$x_7$}; \path (x7)+(0,+0.3) node {$Y$}; \node[draw,shape=diamond,color=black,fill](x8) at (8,0) {}; \path (x8)+(0,-0.3) node {$y$}; \path (x8)+(0,+0.3) node {$B$}; \draw[line width=1pt] (x0)--(x1)--(x2)--(x3)--(x4)--(x5)--(x6)--(x7)--(x8); \end{scope} \begin{scope}[yshift=-1.2cm] \node[draw,shape=diamond,color=black,fill](x0) at (0,0) {}; \path (x0)+(0,-0.3) node {$x$}; \path (x0)+(0,+0.3) node {$B$}; \node[draw,shape=star,color=black,fill](x1) at (1,0) {}; \path (x1)+(0,-0.3) node {$x_1$}; \path (x1)+(0,+0.3) node {$Y$}; \node[draw,shape=star,color=black,fill](x2) at (2,0) {}; \path (x2)+(0,-0.3) node {$x_2$}; \path (x2)+(0,+0.3) node {$Y$}; \node[draw,shape=star,color=black,fill](x3) at (3,0) {}; \path (x3)+(0,-0.3) node {$x_3$}; \path (x3)+(0,+0.3) node {$Y$}; \node[draw,shape=star,color=black,fill](x4) at (4,0) {}; \path (x4)+(0,-0.3) node {$x_4$}; \path (x4)+(0,+0.3) node {$Y$}; \node[draw,shape=rectangle,scale=1.4,color=black,fill](x5) at (5,0) {}; \path (x5)+(0,-0.3) node {$x_5$}; \path (x5)+(0,+0.3) node {$R$}; \node[draw,shape=star,color=black,fill](x6) at (6,0) {}; \path (x6)+(0,-0.3) node {$x_6$}; \path (x6)+(0,+0.3) node {$Y$}; \node[draw,shape=star,color=black,fill](x7) at (7,0) {}; \path (x7)+(0,-0.3) node {$x_7$}; \path (x7)+(0,+0.3) node {$Y$}; \node[draw,shape=circle,color=black,fill](x8) at (8,0) {}; \path (x8)+(0,-0.3) node {$y$}; \path (x8)+(0,+0.3) node {$G$}; \draw[line width=1pt] (x0)--(x1)--(x2)--(x3)--(x4)--(x5)--(x6)--(x7)--(x8); \end{scope} \end{tikzpicture}}\caption{The two non-isomorphic graphs of type $P_{xy}$.} \label{fig:Pxy} \end{figure} Similarly, $Q_{z,t}$ is defined to be a tropical path of length~$10$ with vertices $z=z_0, z_1, \dots, z_9, z_{10}=t$ where $\{c(z),c(t)\}=\{G, B\}$, $c(z_5)=R$ and all others are coloured Yellow. See Figure~\ref{fig:QZt} for an illustration. In this case, as the only vertex of colour $R$ is at the same distance from both ends, the two possible colourings of the end-vertices correspond to isomorphic graphs. Hence, in our figures, a dotted edge will be used to represent a $Q$-type path between two vertices. \begin{figure}[ht!] \centering \scalebox{1}{\begin{tikzpicture}[join=bevel,inner sep=0.5mm,scale=1] \begin{scope} \node[draw,shape=circle,color=black,fill](x0) at (0,0) {}; \path (x0)+(0,-0.3) node {$z$}; \path (x0)+(0,+0.3) node {$G$}; \node[draw,shape=star,color=black,fill](x1) at (1,0) {}; \path (x1)+(0,-0.3) node {$z_1$}; \path (x1)+(0,+0.3) node {$Y$}; \node[draw,shape=star,color=black,fill](x2) at (2,0) {}; \path (x2)+(0,-0.3) node {$z_2$}; \path (x2)+(0,+0.3) node {$Y$}; \node[draw,shape=star,color=black,fill](x3) at (3,0) {}; \path (x3)+(0,-0.3) node {$z_3$}; \path (x3)+(0,+0.3) node {$Y$}; \node[draw,shape=star,color=black,fill](x4) at (4,0) {}; \path (x4)+(0,-0.3) node {$z_4$}; \path (x4)+(0,+0.3) node {$Y$}; \node[draw,shape=rectangle,scale=1.4,color=black,fill](x5) at (5,0) {}; \path (x5)+(0,-0.3) node {$z_5$}; \path (x5)+(0,+0.3) node {$R$}; \node[draw,shape=star,color=black,fill](x6) at (6,0) {}; \path (x6)+(0,-0.3) node {$z_6$}; \path (x6)+(0,+0.3) node {$Y$}; \node[draw,shape=star,color=black,fill](x7) at (7,0) {}; \path (x7)+(0,-0.3) node {$z_7$}; \path (x7)+(0,+0.3) node {$Y$}; \node[draw,shape=star,color=black,fill](x8) at (8,0) {}; \path (x8)+(0,-0.3) node {$z_8$}; \path (x8)+(0,+0.3) node {$Y$}; \node[draw,shape=star,color=black,fill](x9) at (9,0) {}; \path (x9)+(0,-0.3) node {$z_9$}; \path (x9)+(0,+0.3) node {$Y$}; \node[draw,shape=diamond,color=black,fill](x10) at (10,0) {}; \path (x10)+(0,-0.3) node {$t$}; \path (x10)+(0,+0.3) node {$B$}; \draw[line width=1pt] (x0)--(x1)--(x2)--(x3)--(x4)--(x5)--(x6)--(x7)--(x8)--(x9)--(x10); \end{scope} \end{tikzpicture}} \caption{The $Q$-type path $Q_{z,t}$.} \label{fig:QZt} \end{figure} The following lemma is easy to observe. \begin{lemma} \label{lem:arc_and_dotted_line} The following is true. \begin{enumerate} \item $P_{x,y}$ admits a tropical homomorphism to $P_{u,v}$ if and only if $c(x)=c(u)$ and $c(y)=c(v)$. \item $Q_{z,t}$ admits a tropical homomorphism to $P_{u,v}$ both in the case where $c(z)=c(u)$ and $c(t)=c(v)$, and in the case where $c(z)=c(v)$ and $c(t)=c(u)$. \end{enumerate} \end{lemma} By Lemma~\ref{lem:arc_and_dotted_line}, in our abbreviated notation of arcs and dotted edges, a dotted edge can map to a dotted edge or to an arc as long as the colours of the end-vertices are preserved. However, to map an arc to another arc, not only the colours of the end-vertices must be preserved, but also the direction of the arc. With our notation, the tropical directed $6$-cycle of Figure~\ref{fig:C48} corresponds to a $4$-tropical $48$-cycle, $(C_{48},c)$. \begin{figure}[ht!] \centering \scalebox{1}{\begin{tikzpicture}[join=bevel,inner sep=0.5mm,scale=1] \begin{scope} \draw node[color=black,fill,circle,label=0*360/6-90:$g_0$,label=0*360/6+90:$G$](g0) at (0*360/6-90:1.3cm) {}; \draw node[color=black,fill,diamond,label=1*360/6-90:$b_0$,label=1*360/6+90:$B$](b0) at (1*360/6-90:1.3cm) {}; \draw node[color=black,fill,circle,label=2*360/6-90:$g_1$,label=2*360/6+90:$G$](g1) at (2*360/6-90:1.3cm) {}; \draw node[color=black,fill,diamond,label=3*360/6-90:$b_1$,label=3*360/6+90:$B$](b1) at (3*360/6-90:1.3cm) {}; \draw node[color=black,fill,circle,label=4*360/6-90:$g_2$,label=4*360/6+90:$G$](g2) at (4*360/6-90:1.3cm) {}; \draw node[color=black,fill,diamond,label=5*360/6-90:$b_2$,label=5*360/6+90:$B$](b2) at (5*360/6-90:1.3cm) {}; \draw[->, line width=1pt] (g0)--(b0); \draw[->, line width=1pt] (b0)--(g1); \draw[->, line width=1pt] (g1)--(b1); \draw[->, line width=1pt] (b1)--(g2); \draw[->, line width=1pt] (g2)--(b2); \draw[->, line width=1pt] (b2)--(g0); \end{scope} \end{tikzpicture}} \caption{A short representation of the $4$-tropical $48$-cycle $(C_{48},c)$.} \label{fig:C48} \end{figure} Our aim is to show that NAE $3$-SAT reduces (in polynomial time) to \PBCOL{$(C_{48},c)$}. \begin{theorem} \label{thm:C48} For any $k\geq 24$, \PBtropCOL{$C_{2k}$} is NP-complete. \end{theorem} \begin{proof} We prove the statement when $k=24$ and observe that the same reduction holds for any $k\geq 24$. Indeed, one can make $P_{x,y}$ and $Q_{z,t}$ longer while still satisfying Lemma \ref{lem:arc_and_dotted_line}. \PBCOL{$(C_{48},c)$} is clearly in NP. To show NP-hardness, we show that NAE $3$-SAT can be reduced in polynomial-time to \PBCOL{$(C_{48},c)$}. Let $(X,C)$ be an instance of NAE $3$-SAT. To partition $X$ into two parts, it is enough to decide, for each pair of elements of $X$, whether they are in a same part or not. Thus, we are expected to define a binary relation among variables which satisfies the following conditions. \begin{enumerate} \item $X_p\sim X_q \wedge X_q\sim X_r \Rightarrow X_q\sim X_r$ (Partition) \item $X_p\nsim X_q \wedge X_q\nsim X_r \Rightarrow X_p\sim X_r$ (Partition into two parts) \end{enumerate} To build our gadget, we start with a partial gadget associated to each pair of variables of $X$. To each pair $x_i, x_j\in X$, we associate the $4$-tropical $6$-cycle $(C_{x_ix_j},c)$ of Figure~\ref{fig:gadgetCx1x2}. Here, $U_G$ (coloured Green) is a common vertex of all such cycles, but all other vertices are distinct. \begin{figure}[ht!] \centering \scalebox{1}{\begin{tikzpicture}[join=bevel,inner sep=0.5mm,scale=1] \begin{scope} \draw node[color=black,fill,circle,label=0*360/6-90:$U_G$,label=0*360/6+90:$G$](g0) at (0*360/6-90:1.3cm) {}; \draw node[color=black,fill,diamond,label=1*360/6-90:$b^0_{x_ix_j}$,label=1*360/6+90:$B$](b0) at (1*360/6-90:1.3cm) {}; \draw node[color=black,fill,circle,label=2*360/6-90:$g^1_{x_ix_j}$,label=2*360/6+90:$G$](g1) at (2*360/6-90:1.3cm) {}; \draw node[color=black,fill,diamond,label=3*360/6-90:$b^1_{x_ix_j}$,label=3*360/6+90:$B$](b1) at (3*360/6-90:1.3cm) {}; \draw node[color=black,fill,circle,label=4*360/6-90:$g^2_{x_ix_j}$,label=4*360/6+90:$G$](g2) at (4*360/6-90:1.3cm) {}; \draw node[color=black,fill,diamond,label=5*360/6-90:$b^2_{x_ix_j}$,label=5*360/6+90:$B$](b2) at (5*360/6-90:1.3cm) {}; \draw[->, line width=1pt] (g0)--(b0); \draw[->, line width=1pt] (b0)--(g1); \draw[loosely dashed, line width=1pt] (g1)--(b1); \draw[->, line width=1pt] (b1)--(g2); \draw[loosely dashed, line width=1pt] (g2)--(b2); \draw[loosely dashed, line width=1pt] (b2)--(g0); \end{scope} \end{tikzpicture}} \caption{$(C_{x_ix_j},c)$} \label{fig:gadgetCx1x2} \end{figure} We are interested in possible mappings of this partial gadget into our tropical $48$-cycle, $(C_{48}, c)$ of Figure~\ref{fig:C48}. By the symmetries of $(C_{48},c)$, we assume, without loss of generality, that $U_G$ maps to $g_0$. Having this assumed, we observe the following crucial fact. \begin{claim}\label{claim:C48} There are exactly two possible homomorphisms of $(C_{x_ix_j},c)$ to $(C_{48},c)$. \begin{enumerate} \item A mapping $\sigma$ given by $\sigma(U_G)=g_0$, $\sigma(b^0_{x_ix_j})=b_0$, $\sigma(g^1_{x_ix_j})=g_1$, $\sigma(b^1_{x_ix_j})=b_1$, $\sigma(g^2_{x_ix_j})=g_2$ and $\sigma(b^2_{x_ix_j})=b_2$ \item A mapping $\rho$ give by $\rho(U_G)=g_0$, $\rho(b^0_{x_ix_j})=b_0$, $\rho(g^1_{x_ix_j})=g_1$, $\rho(b^1_{x_ix_j})=b_0$, $\rho(g^2_{x_ix_j})=g_1$ and $\rho(b^2_{x_ix_j})=b_0$ \end{enumerate} \end{claim} The main idea of our reduction lies in Claim~\ref{claim:C48}. After completing the description of our gadgets, we will have a $4$-tropical graph containing a copy of $C_{x_ix_j}$ for each pair $x_i,x_j$ of variables. If we find a homomorphism of this graph to $(C_{48},c)$, then its restriction to $C_{x_ix_j}$ is either a mapping of type $\sigma$, or of type $\rho$. A $\sigma$-mapping would correspond to assigning $x_i$ and $x_j$ to two different parts, and a $\rho$-mapping would correspond to assigning them to a same part of a partition of $X$. \begin{observation} It is never possible to map $b^2_{x_ix_j}$ to $b_1$ or to map $b^1_{x_ix_j}$ to $b_2$. \end{observation} To enforce the two conditions, partitioning $X$ into two parts by a binary relation, we add more structures. Consider the three partial gadgets $(C_{x_px_q},c)$, $(C_{x_qx_r},c)$ and $(C_{x_px_r},c)$. Considering $b^1_{x_px_q}$ of $(C_{x_px_q},c)$, we choose vertices $b^2_{x_px_r}$ and $b^2_{x_qx_r}$ from $(C_{x_px_r},c)$ and $(C_{x_qx_r},c)$ respectively, and connect them by a tree as in Figure~\ref{fig:treeCx1x2x3}. The internal vertices of these trees are all new and distinct. \begin{figure}[ht!] \centering \scalebox{0.75}{\begin{tikzpicture}[join=bevel,inner sep=0.5mm,scale=1] \begin{scope} \draw node[color=black,fill,diamond,label=0:$b^1_{x_px_q}$,label=180:$B$](b1x1x2) at (0,0) {}; \draw node[color=black,fill,diamond,label=-90:$b^2_{x_qx_r}$,label=90:$B$](b2x2x3) at (3,-1) {}; \draw node[color=black,fill,diamond,label=0:$b^2_{x_px_r}$,label=180:$B$](b2x1x3) at (0,-2) {}; \draw node[color=black,fill,circle,label=180:$G$](g0) at (0,-1) {}; \draw node[color=black,fill,circle,label=90:$G$](g1) at (2,-1) {}; \draw node[color=black,fill,diamond,label=90:$B$](b0) at (1,-1) {}; \draw[->, line width=1pt] (g1)--(b0); \draw[->, line width=1pt] (b0)--(g0); \draw[loosely dashed, line width=1pt] (b1x1x2)--(g0)--(b2x1x3); \draw[loosely dashed, line width=1pt] (g1)--(b2x2x3); \end{scope} \end{tikzpicture}} \caption{Tree connecting $b^1_{x_px_q}$, $b^2_{x_px_r}$ and $b^2_{x_qx_r}$} \label{fig:treeCx1x2x3} \end{figure} We build similar structures on $(b^1_{x_px_r},b^2_{x_qx_r},b^2_{x_px_q})$ and on $(b^1_{x_qx_r},b^2_{x_px_q},b^2_{x_px_r})$, where the order corresponds to the structure. Let $(C_{x_px_qx_r},c)$ be the resulting partial gadget (see Figure \ref{fig:Cx1x2x3}). \begin{figure}[ht!] \centering \scalebox{1}{\begin{tikzpicture}[join=bevel,inner sep=0.5mm,scale=1] \begin{scope} \node[draw,circle,fill,label=-90:$U_G$,color=black,label=30:$G$](ug) at (0,0) {}; \begin{scope}[yshift=4cm] \node[draw,color=black,fill,diamond,label=0*180/4+180:$B$](b0x12) at (0*180/4:1.5cm) {}; \node[draw,color=black,fill,circle,label=1*180/4+180:$G$](g1x12) at (1*180/4:1.5cm) {}; \node[draw,diamond,fill,label=2*180/4:$b^1_{x_px_q}$,color=black,label=2*180/4+180:$B$](b1x12) at (2*180/4:1.5cm) {}; \node[draw,color=black,fill,circle,label=3*180/4+180:$G$](g2x12) at (3*180/4:1.5cm) {}; \node[draw,diamond,fill,label=4*180/4:$b^2_{x_px_q}$,color=black,label=4*180/4+180:$B$](b2x12) at (4*180/4:1.5cm) {}; \draw[->, line width=1pt] (ug)--(b0x12); \draw[->, line width=1pt] (b0x12)--(g1x12); \draw[loosely dashed, line width=1pt] (g1x12)--(b1x12); \draw[->, line width=1pt] (b1x12)--(g2x12); \draw[loosely dashed, line width=1pt] (g2x12)--(b2x12); \draw[loosely dashed, line width=1pt] (b2x12)--(ug); \end{scope} \begin{scope}[rotate=-120, yshift=4cm] \node[draw,color=black,fill,diamond,label=0*180/4+60:$B$](b0x13) at (0*180/4:1.5cm) {}; \node[draw,color=black,fill,circle,label=1*180/4+60:$G$](g1x13) at (1*180/4:1.5cm) {}; \node[draw,diamond,fill,label=-120+2*180/4:$b^1_{x_px_r}$,color=black,label=2*180/4+60:$B$](b1x13) at (2*180/4:1.5cm) {}; \node[draw,color=black,fill,circle,label=3*180/4+60:$G$](g2x13) at (3*180/4:1.5cm) {}; \node[draw,diamond,fill,label=-120+4*180/4:$b^2_{x_px_r}$,color=black,label=4*180/4+60:$B$](b2x13) at (4*180/4:1.5cm) {}; \draw[->, line width=1pt] (ug)--(b0x13); \draw[->, line width=1pt] (b0x13)--(g1x13); \draw[loosely dashed, line width=1pt] (g1x13)--(b1x13); \draw[->, line width=1pt] (b1x13)--(g2x13); \draw[loosely dashed, line width=1pt] (g2x13)--(b2x13); \draw[loosely dashed, line width=1pt] (b2x13)--(ug); \end{scope} \begin{scope}[rotate=120, yshift=4cm] \node[draw,color=black,fill,diamond,label=0*180/4+300:$B$](b0x23) at (0*180/4:1.5cm) {}; \node[draw,color=black,fill,circle,label=1*180/4+300:$G$](g1x23) at (1*180/4:1.5cm) {}; \node[draw,diamond,fill,label=120+2*180/4:$b^1_{x_qx_r}$,color=black,label=2*180/4+300:$B$](b1x23) at (2*180/4:1.5cm) {}; \node[draw,color=black,fill,circle,label=3*180/4+300:$G$](g2x23) at (3*180/4:1.5cm) {}; \node[draw,diamond,fill,label=120+4*180/4:$b^2_{x_qx_r}$,color=black,label=4*180/4+300:$B$](b2x23) at (4*180/4:1.5cm) {}; \draw[->, line width=1pt] (ug)--(b0x23); \draw[->, line width=1pt] (b0x23)--(g1x23); \draw[loosely dashed, line width=1pt] (g1x23)--(b1x23); \draw[->, line width=1pt] (b1x23)--(g2x23); \draw[loosely dashed, line width=1pt] (g2x23)--(b2x23); \draw[loosely dashed, line width=1pt] (b2x23)--(ug); \end{scope} \draw[loosely dashed, line width=1pt] (b1x12)--(b2x13) node[midway,color=black,fill,circle,label=30:$G$](g0x1){}; \draw[loosely dashed, line width=1pt] (b1x13)--(b2x23) node[midway,color=black,fill,circle,label=-90:$G$](g0x3){}; \draw[loosely dashed, line width=1pt] (b1x23)--(b2x12) node[midway,color=black,fill,circle,label=150:$G$](g0x2){}; \node[draw,color=black,fill,diamond,label=0*60:$B$](b0x1) at (0*60:2cm) {}; \node[draw,color=black,fill,circle,label=1*60:$G$](g1x2) at (1*60:2cm) {}; \node[draw,color=black,fill,diamond,label=2*60:$B$](b0x2) at (2*60:2cm) {}; \node[draw,color=black,fill,circle,label=3*60:$G$](g1x3) at (3*60:2cm) {}; \node[draw,color=black,fill,diamond,label=4*60:$B$](b0x3) at (4*60:2cm) {}; \node[draw,color=black,fill,circle,label=5*60:$G$](g1x1) at (5*60:2cm) {}; \draw[->, line width=1pt] (b0x1)--(g0x1); \draw[->, line width=1pt] (g1x1)--(b0x1); \draw[loosely dashed, line width=1pt] (b2x23)--(g1x1); \draw[->, line width=1pt] (b0x2)--(g0x2); \draw[->, line width=1pt] (g1x2)--(b0x2); \draw[loosely dashed, line width=1pt] (b2x13)--(g1x2); \draw[->, line width=1pt] (b0x3)--(g0x3); \draw[->, line width=1pt] (g1x3)--(b0x3); \draw[loosely dashed, line width=1pt] (b2x12)--(g1x3); \end{scope} \end{tikzpicture}} \caption{$C_{x_px_qx_r}$} \label{fig:Cx1x2x3} \end{figure} \begin{claim} \label{claim:nice_representation_of_equivalence} In any mapping of $(C_{x_px_qx_r},c)$ to $(C_{48},c)$, an odd number of $(C_{x_ix_j},c)$ is mapped to $(C_{48},c)$ by a $\rho$-mapping. Furthermore, for any choice of an odd number of $(C_{x_ix_j},c)$ (that is either one or all three of them), there exists a mapping of $(C_{x_px_qx_r},c)$ to $(C_{48},c)$ which induces a $\rho$-mapping exactly on our choice. \end{claim} \emph{Proof of claim} Indeed, each $(C_{x_ix_j},c)$ can be mapped to $(C_{48},c)$ only by $\sigma$ or $\rho$, which implies that there are eight ways to map the union of $(C_{x_px_q},c)$, $(C_{x_px_r},c)$ and $(C_{x_qx_r},c)$ to $(C_{48},c)$. Of these eight ways, four map an odd number of $(C_{x_ix_j},c)$ to $(C_{48},c)$ by a $\rho$-mapping. The four remaining ways are to map all $(C_{x_ix_j},c)$ to $(C_{48},c)$ by a $\sigma$-mapping, or to choose one of them to map by a $\sigma$-mapping and to map the two others by a $\rho$-mapping. One can check easily that the union of $(C_{x_px_q},c)$, $(C_{x_px_r},c)$, $(C_{x_qx_r},c)$ and the tree of Figure~\ref{fig:treeCx1x2x3} has six ways to be mapped to $(C_{48},c)$. Indeed, it is no longer possible to map all $(C_{x_ix_j},c)$ by $\sigma$ nor to map $(C_{x_px_r},c)$ by $\sigma$ and $(C_{x_px_q},c)$ and $(C_{x_qx_r},c)$ by $\rho$. By symmetry, this implies Claim~\ref{claim:nice_representation_of_equivalence}.~{\tiny ($\Box$)} Finally, to complete the gadget, what remains is to forbid the possibility of a $\rho$-mapping for all three of $(C_{x_px_q},c)$, $(C_{x_px_r},c)$ and $(C_{x_qx_r},c)$ in the case where $(x_px_qx_r)$ is a clause in $C$. This is done by adding a $b^1_{x_px_q}b^2_{x_qx_r}$-path shown in Figure~\ref{fig:partialGadgetForClause}. \begin{figure}[ht!] \centering \scalebox{1}{\begin{tikzpicture}[join=bevel,inner sep=0.5mm,scale=1] \begin{scope} \draw node[color=black,fill,diamond,label=-90:$b^1_{x_px_q}$,label=90:$B$](b1x1x2) at (0,0) {}; \draw node[color=black,fill,diamond,label=-90:$b^2_{x_qx_r}$,label=90:$B$](b2x2x3) at (4,0) {}; \draw node[color=black,fill,circle,label=90:$G$](x1) at (1,0) {}; \draw node[color=black,fill,diamond,label=90:$B$](x2) at (2,0) {}; \draw node[color=black,fill,circle,label=90:$G$](x3) at (3,0) {}; \draw[->, line width=1pt] (b1x1x2)--(x1); \draw[->, line width=1pt] (x1)--(x2); \draw[->, line width=1pt] (x2)--(x3); \draw[loosely dashed, line width=1pt] (x3)--(b2x2x3); \end{scope} \end{tikzpicture}} \caption{Partial clause gadget.} \label{fig:partialGadgetForClause} \end{figure} Let $f(X,C)$ the final gadget we have just built. Assuming that there are $v$ variables and $c$ clauses, the $4$-tropical graph $f(X,C)$ has $1+53\times v^2+132\times v^3+33\times c$ vertices. To complete our proof we want to prove the following. $(X,C)$ is a YES instance of NAE $3$-SAT if and only if the $4$-tropical graph $f(X,C)$ admits a homomorphism to $(C_{48},c)$. It follows directly form our construction that if $f(X,C) \to (C_{48},c)$, then $(X,C)$ is a YES instance of \textsc{NAE $3$-SAT}. We need to show that if $(X,C)$ is a YES instance, then there exists a homomorphism of $f(X,C)$ to $(C_{48},c)$. Let $(X,C)$ be a YES instance of \textsc{NAE $3$-SAT}. There exists a partition $p: X \rightarrow \{A,B\}$ such that every clause in $C$ is not fully included in $A$ or $B$. We build a homomorphism of $f(X,C)$ to $(C_{48},c)$ in the following way. $U_G$ is mapped to $g_0$. For each pair of variables $x_i, x_j \in X$, we map $C_{x_ix_j}$ by a $\rho$-mapping if and only if $p(x_i)=p(x_j)$, and by a $\sigma$-mapping otherwise. For every triple of variable $x_p, x_q, x_r \in X$, there is an odd number of pairs $x_i,x_j$ of variables in $\{x_p, x_q, x_r\}$ such that $p(x_i)=p(x_j)$. It follows from Claim \ref{claim:nice_representation_of_equivalence} that one can extend the mapping to any $C_{x_px_qx_r}$. Moreover, as two such structures only intersect on $C_{x_ix_j}$, we can extend the mapping to every $C_{x_px_qx_r}$. It only remains to map the $b^1_{x_px_q}b^2_{x_qx_r}$-path added for the clause, shown in Figure~\ref{fig:partialGadgetForClause}. If $(x_p, x_q, x_r)$ is a clause in $C$, then $p(x_p) \neq p(x_q)$ or $p(x_q) \neq p(x_r)$. It follows that $C_{x_px_q}$ or $C_{x_qx_r}$ is mapped by a $\sigma$-mapping, in which case the $b^1_{x_px_q}b^2_{x_qx_r}$-path shown in Figure~\ref{fig:partialGadgetForClause} can also be mapped. We have shown that there is a homomorphism of $f(X,C)$ to $(C_{48},c)$. This concludes the proof. \end{proof} We observe that the proof could be slightly modified to obtain variations of Theorem~\ref{thm:C48}. \begin{remark}\label{rem:C48}\ \begin{enumerate} \item In the reduction from Theorem~\ref{thm:C48}, Red vertices are never in the same part of the bipartition as Blue and Green vertices. It follows that one could colour every Red vertex Blue, and Theorem \ref{thm:C48} would still hold, for $3$-tropical cycles. \item The idea of this proof can also be extended for a $2$-tropical $54$-cycle. To do this we first insert a Red vertex between $x_5$ and $x_6$ in $P_{xy}$ and a Red vertex between $z_5$ and $z_6$ in $Q_{zt}$. We observe that the proof follows similarly. However, in this case, all blue vertices are in one part and all green vertices are on the other part of the bipartition. Thus, as in the previous claim, we can remove two colours now and use the natural bipartition to distinguish two sets of colours for each colour class. \end{enumerate} \end{remark} \longpaper{ \subsection{Other families of minimal graphs} Next, we show that for each of the minimal graphs $H$ from Table~\ref{table} (other than even cycles) that make \PBlistCOL{$H$} NP-complete, \PBtropCOL{$H$} is polynomial-time solvable. \begin{theorem}\label{thm:table}f For every graph $H$ belonging to one of the six families $\mathcal T$, $\mathcal W$, $\mathcal D$, $\mathcal M$, $\mathcal N$ and $\mathcal G$ described in Table~\ref{table}, \PBtropCOL{$H$} is polynomial-time solvable. \end{theorem} \begin{proof} We assume for contradiction, that for some integer~$i$ and a family $\mathcal F$ among $\mathcal T$, $\mathcal W$, $\mathcal D$, $\mathcal M$, $\mathcal N$ and $\mathcal G$, there is a problem \PBCOL{$(F_i,c)$} that is not polynomial-time solvable. \medskip \noindent\textbf{Family \boldmath{$\mathcal{T}$}.} Suppose $x_{i+4}$ is coloured~$m$. Suppose $y_{i+3}$ is coloured~$a$, $a\neq m$ by Proposition~\ref{prop:bipartite-hom}. Then, $y_{i+4}$ cannot be coloured~$a$ (otherwise it can be folded onto $y_{i+3}$), so it is coloured~$b$. Because of Lemma~\ref{lemm:unique-feature}, there must be another $P_3$ coloured $amb$ on the graph, but for the graph to be a core, the vertex coloured $m$ of this $P_3$ must not be adjacent to $y_{i+3}$. However, note that $y_{i+3}$ is adjacent to every vertex of $X$ except for $x_1$ and $x_{i+3}$, both of which have degree~$1$ and cannot create a $3$-vertex path coloured $a$-$m$-$b$. \medskip \noindent\textbf{Family \boldmath{$\mathcal{W}$}.} Now, we consider $W_i$. We try to find a colouring $c$ of $W_i$ such that \PBCOL{$(W_i,c)$} is not polynomial-time solvable. Suppose $y_{i+2}$ is coloured with colour $a$. Suppose $x_{i+3}$ is coloured $m$. $y_{i+4}$ cannot be coloured~$a$, otherwise it can be folded onto $y_{i+2}$, so we may assume it is coloured~$b$. $y_{i+3}$ cannot be coloured~$b$, for otherwise $y_{i+4}$ can be folded onto it, so it is coloured~$a$ or~$d$. Suppose first that it is coloured~$d$. By Lemma~\ref{lemm:unique-feature}, there is another vertex coloured~$a$, and the only one which could not be folded onto $y_{i+2}$ is $y_{i+1}$, so it must be coloured~$a$. Similarly, $y_{1}$ is coloured~$d$. By Lemma~\ref{lemm:unique-feature}, there is another edge besides $x_{i+3},y_{i+4}$ with endpoints coloured~$m$ and~$b$, but for the graph to be a core, the edge $x_{i+3}y_{i+4}$ must not be able to fold onto it. However, it is easily verified that this is impossible. So, we must assume that $y_{i+3}$ is coloured~$a$. There is no other vertex in $Y$ coloured~$a$, otherwise it can be folded onto $y_{i+2}$ or $y_{i+3}$. We can assume, without loss of generality, that a connected subgraph of the source graph, coloured only with~$m$ and~$b$, and with only vertices of colour~$a$ at distance~$1$, will be sent to $x_{i+3}$ and $y_{i+4}$. Knowing this, we can contract each such subgraph to a single vertex, coloured with a new colour~$\omega$, and similarly replace $x_{i+3}$ and $y_{i+4}$ by a single vertex coloured~$\omega$, adjacent to $y_{i+2}$ and $y_{i+3}$. There will be a homomorphism between the source graph and $(W_i,c)$ if and only if there is one after such transformation. However, the graph obtained after such transformation will not contain any induced subgraph from the table above, which yields a contradiction. \medskip \noindent\textbf{Family \boldmath{$\mathcal{D}$}.} Now, consider $D_i$ and a colouring $c$ such that \PBCOL{$(D_i,c)$} is not polynomial-time solvable. Suppose $x_{i+4}$ is coloured~$m$ and $y_{i+4}$ is coloured~$a$. By Lemma~\ref{lemm:unique-feature}, there is another vertex coloured~$a$. We may assume that $y_1$ is such a vertex because it is the only one that cannot be folded on $y_{i+4}$. Then, $x_1$ cannot have colour~$m$, for otherwise it can be folded onto $x_{i+4}$, so it is coloured~$l$. By Lemma~\ref{lemm:unique-feature}, there is another vertex in $X$ coloured~$l$, say $v$. $y_1x_1$ can be folded onto $y_{i+4}v$, which yields a contradiction. \medskip \noindent\textbf{Family \boldmath{$\mathcal{M}$}.} Now, consider $M_i$ and a colouring $c$ such that \PBCOL{$(M_i,c)$} is not polynomial-time solvable. Suppose $x_2$ is coloured~$m$ and $y_{i+2}$ is coloured~$a$. By Lemma~\ref{lemm:unique-feature}, there is another vertex in $X$ coloured~$m$. The only vertex which can be coloured~$m$ without being able to be folded onto $x_2$ is $x_1$. This is because $y_{i+2}$ is adjacent only to $x_1$ and $x_2$ is adjacent to every vertex in $Y$ except for $y_{i+2}$. So we may assume $x_1$ is coloured~$m$. By Lemma~\ref{lemm:unique-feature}, there is another vertex in $Y$ coloured~$a$, say $v$. $x_1y_{i+2}$ can be folded onto $x_2v$ since $x_2$ is adjacent to every vertex in $Y$ except $y_{i+2}$, which yields a contradiction. \medskip \noindent\textbf{Family \boldmath{$\mathcal{N}$}.} Now, consider $N_i$ and a colouring $c$ such that \PBCOL{$(N_i,c)$} is not polynomial-time solvable. Suppose $x_2$ is coloured $m$. For $3\leq j\leq 2i+3$, $x_j$ cannot be coloured~$m$, for otherwise it can be folded onto $x_2$ since $N(x_j) \subset N(X_2)$. By Lemma~\ref{lemm:unique-feature}, $x_1$ or $x_{2i+4}$ must be coloured~$m$. Both $x_1$ and $x_{2i+4}$ have a neighbour of degree~$1$ (namely, $y_{i+1}$ and $y_{2i+4}$, respectively), which are the two only vertices in $Y$ not adjacent to $x_2$. By Lemma~\ref{lemm:unique-feature}, neither $x_1y_{i+1}$ nor $x_{2i+4}y_{2i+4}$ can be an edge of unique colour. Either exactly one of them is coloured~$ma$ and a neighbour $v$ of $x_2$ is coloured~$a$, in which case the graph is not a core because the edge can be folded on $x_2v$ (since $N(x_1) \setminus \{y_{i+1}\}$ and $N(x_{2i+4}) \setminus \{y_{2i+4}\}$ are both subsets of $N(x_2)$), or both $x_1y_{i+1}$ and $x_{2i+4}y_{2i+4}$ are coloured $ma$ and the graph is not a core because $x_{2i+4}y_{2i+4}$ can be folded on $x_1y_{i+1}$ since $N(x_{2i+4}) \setminus \{y_{2i+4} \} \subset N(x_1)$, yielding a contradiction. \medskip \noindent\textbf{Family \boldmath{$\mathcal{G}$}.} We try to find a colouring $c$ of $G_1$ such that \PBCOL{$(G_1,c)$} is not polynomial-time solvable. The colour of $y_1$ is, say, $a$. By Lemma~\ref{lemm:unique-feature}, colour~$a$ must be present somewhere else in $Y$. By symmetry, we can assume $y_2$ is coloured~$a$. The two neighbours of $y_2$ cannot be coloured with the same colour, for otherwise we can fold $x_2$ on $x_1$, implying that $(G_1,c)$ is not a core, a contradiction. Without loss of generality, $x_1$ and $x_2$ are coloured~$1$ and~$2$ respectively. By Lemma~\ref{lemm:unique-feature} applied to edge $y_2x_2$, there must be another edge coloured~$a2$. However, if a neighbour of $y_1$ is coloured~$2$, we can fold $y_2x_2$ onto $y_1$ and the graph is not a core, a contradiction. It follows that the other edge coloured~$a2$ is either $y_3x_4$ or $y_4x_6$. By symmetry, we can assume that $x_4$ is coloured~$2$ and $y_3$ is coloured~$a$. $x_3$ cannot be coloured~$1$ or~$2$, for otherwise $(G_1,c)$ is not a core. Therefore, $x_3$ is coloured with a third colour, say~$3$. At this point, $y_1x_1y_2x_2$ is coloured $a1a2$ and $y_1x_3y_3x_4$ is coloured $a3a2$. Consider the colour of $y_4$. It must be $a$ by Lemma~\ref{lemm:unique-feature}. There are only two uncoloured vertices, $x_5$ and $x_6$, which must be coloured~$1$ and~$3$ by Lemma~\ref{lemm:unique-feature}. The graph is not a core in both cases as we can either fold $x_6y_4$ onto $x_1y_1$ or the edge $x_6y_4$ onto $x_3y_1$, a contradiction. Now, let $c$ be a colouring of $G_2$ such that \PBCOL{$(G_2,c)$} is not polynomial-time solvable. Suppose the vertex $y_2$ is coloured with $a$. Then, $y_1$ cannot be coloured~$a$, for otherwise it can be folded onto $y_2$, which yields a contradiction. Therefore, $y_1$ is coloured~$b$. Because of Lemma~\ref{lemm:unique-feature}, $y_3$ and $y_4$ must be coloured~$a$ and~$b$. By symmetry, we may assume $y_3$ is coloured~$a$ and $y_4$ is coloured~$b$. Suppose $x_5$ is coloured~$m$. Then $x_1$, $x_2$, $x_3$ and $x_4$ cannot be coloured~$m$, for otherwise $y_3x_5$ can be folded on $y_2$. Thus, $y_3x_5$ is the only edge coloured~$am$. Lemma~\ref{lemm:unique-feature} yields a contradiction. Now, let $c$ be a colouring of $G_3$ such that \PBCOL{$(G_3,c)$} is not polynomial-time solvable. By Lemma~\ref{lemm:unique-feature}, there are at most two colours in each part of the bipartition. If $x_1$ and $x_2$ have the same colour, $x_2$ can be folded onto $x_1$, a contradiction. Similarly, if $y_1$ and $y_4$ have the same colour, $y_1$ can be folded onto $y_4$. Then $x_1$, $y_1$, $x_2$ and $y_4$ induce a complete bipartite graph with every colour of $c$, implying that $(G_3,c)$ is not a core, a contradiction. \end{proof} \section{Bipartite graphs of small order}\label{sec:smallgraphs} In this section, we show that for each graph $H$ of order at most~$8$, \PBtropCOL{$H$} is polynomial-time solvable. On the other hand, there is a graph $H_9$ of order~$9$ such that \PBtropCOL{$H_9$} is NP-complete. \begin{theorem} \label{thm:small_graph} For any bipartite graph $H$ of order at most~$8$, \PBtropCOL{$H$} is polynomial-time solvable. \end{theorem} \begin{proof} It suffices to prove that for each bipartite graph $H$ of order at most~$8$ and each colouring $c$ of $H$, \PBCOL{$(H,c)$} is polynomial-time solvable. In fact, by Proposition~\ref{prop:bipartite-hom} it suffices to show the statement for colourings of $H$ such that the colour sets in the two parts of the bipartition are disjoint. To prove that \PBCOL{$(H,c)$} is polynomial-time solvable it is enough to prove it for the core of $S(H,c)$, it is also enough to prove it for each connected component of $(H,c)$. Thus in the rest of the proof we always assume that $(H,c)$ is connected core. Let $(X,Y)$ be the bipartition of $H$. Since the only graphs of order at most~$8$ in the characterization of minimal NP-complete graphs $H$ with \PBlistCOL{$H$} NP-complete are the cycles $C_6$ and $C_8$~\cite{FHH99} \longpaper{(see Table~\ref{table})}, by Theorem~\ref{thm:listhom-table}, if $H$ does not contain an induced $6$-cycle or an induced $8$-cycle, then \PBlistCOL{$H$} is polynomial-time solvable and therefore \PBtropCOL{$H$} is polynomial-time solvable. Therefore $H$ contains an induced $6$-cycle or an induced $8$-cycle. If $H$ contains an induced copy of $C_8$, then $H$ is isomorphic to $C_8$ itself and hence we are done by Theorem~\ref{thm: C12}. Therefore, we can assume that $H$ contains an induced copy of $C_6$. Again by Theorem~\ref{thm: C12}, if $H$ is isomorphic to $C_6$, we are done. Now, assume that $H$ is a bipartite graph of order~$7$ or~$8$ with an induced copy of $C_6$. If one part, say $X$, is of order~$3$, then all its vertices belong to each $6$-cycle of $H$. Hence, for each $x\in X$, \PBlistCOL{($H-x$)} is polynomial-time solvable. Thus, if $X$ is not monochromatic, we can apply Lemma~\ref{lemm:unique-feature} and \PBCOL{$(H,c)$} is polynomial-time solvable. Therefore we may assume $X$ is monochromatic, say Blue. If $Y$ contains at most two colours, then $(H,c)$ contains as a subgraph the path on three vertices where the central vertex is Blue and the other vertices are coloured with the colours of $Y$.But then $(H,c)$ maps to this subgraph and, therefore, it is not a core, a contradiction. Hence, $Y$ contains at least three colours. If $|Y|=4$, then $Y$ contains two colours that are the unique ones coloured with their colour. Moreover, \PBlistCOL{$(H-\{x,y\})$} contains no $6$-cycle and, therefore, by Lemma~\ref{lemm:unique-feature} \PBCOL{$(H,c)$}, is polynomial-time solvable. Hence we can assume that $|Y|=5$. If $Y$ contains at least four colours, by the same argument we are done, therefore, we assume that $Y$ contains exactly three colours. If $(H,c)$ contains a star with a Blue centre and a three leaves of different colours, then $(H,c)$ is not a core. Therefore the neighbourhood of each vertex of $X$ contains at most two colours. Assume that the three vertices $y_1$, $y_2$, $y_3$ of $Y$ in the $6$-cycle have three different colours. Let $y_4$, another element of $Y$ be of the same colour as $y_i$. By the previous observation, $y_4$ can only be adjacent to neighbours of $y_i$. But then mapping $y_4$ to $y_1$ is a homomorphism which means $(H,c)$ is not a core. Therefore, we can assume that $c(y_1)=c(y_2)=1$ and $c(y_3)=2$. Then, the vertex coloured~$3$ has degree~$1$ and is adjacent to the common neighbour of $y_1$ and $y_2$. But then again, $(H,c)$ is not a core. Therefore, $H$ is a bipartite graph of order~$8$ and $|X|=|Y|=4$. If there are at least three colours in one part of the bipartition (say $X$), then two vertices $x_1$, $x_2$ in $X$ form two colour classes of size~$1$. Moreover, $H-\{x_1,x_2\}$ has no $6$-cycle and therefore, by Lemma~\ref{lemm:unique-feature}, \PBCOL{$(H,c)$} is polynomial-time solvable. We may then assume that each part of the bipartition contains at most two colours. If one part, say $X$, contains exactly one colour (say Blue), then $(H,c)$ contains a path on three vertices with every colour of $c$ (the central vertex is Blue) and is not a core, a contradiction. Therefore each part of the bipartition contains exactly two colours. If in each part, each colour has exactly two vertices, we can apply Lemma~\ref{lemm:2SAT} to show that \PBCOL{$(H,c)$} is polynomial-time solvable. Therefore, we can assume that there is a colour, say Blue, where exactly three vertices of one part, say $x_1$, $x_2$, $x_3$ from part $X$, coloured Blue ($x_4$ is coloured Green). If $H-x_4$ contains no induced $6$-cycle (it cannot contain an $8$-cycle since it has order~$7$), then \PBlistCOL{$(H-x_4)$} is polynomial-time solvable and we can use Lemma~\ref{lemm:unique-feature} and \PBCOL{$(H,c)$} is polynomial-time solvable. Hence we may assume $H-x_4$ contains an induced $6$-cycle $C$. Note that $C$ must contain three vertices of $X$ and therefore contains all three of $x_1$, $x_2$, $x_3$. If the three other vertices $y_1$, $y_2$ an $y_3$ of $C$ are coloured with the same colour, then $(H,c)$ is not a core, a contradiction. Therefore assume, without loss of generality, that $c(y_1)=c(y_2)=1$ and $c(y_3)=2$. Then, in order for $(H,c)$ to be a core, we cannot have both $x_1$ and $y_1$ (respectively, $y_2$ and $x_3$) of degree~$3$. More precisely, either $d(y_1)=d(x_3)=2$ and $d(x_1)=d(y_2)=3$, or $d(y_1)=d(x_3)=3$ and $d(x_1)=d(y_2)=2$. In both cases, we have $d(y_3)=2$, for otherwise $(H,c)$ contains a $4$-cycle with all four colours, and $(H,c)$ is not a core. If $c(y_4)=1$, then $(H,c)$ contains a path on four vertices coloured $2$-Blue-$1$-Green; moreover there is no edge in $(H,c)$ whose endpoints are coloured Green and $2$, therefore $(H,c)$ is homomorphic to the above path and is not a core. If $c(y_4)=2$, then $(H,c)$ contains a $4$-coloured $4$-cycle and again $(H,c)$ is not a core, a contradiction. As no such tropical graph exists, we have shown that for all possible cases the $(H,c)$-colouring problem is polynomial-time solvable. \end{proof} Denote by $H_9$ the graph obtained from a $6$-cycle by adding a pendant degree~$1$-vertex to three independent vertices (see Figure~\ref{fig:G9}). \begin{figure}[ht!] \centering \includegraphics[scale=0.7]{9graph.pdf} \caption{The $4$-tropical graph $H_9$.} \label{fig:G9} \end{figure} \begin{theorem}\label{thm:H_9} \PBtropCOL{$H_9$} is NP-complete. \end{theorem} \begin{proof} We show that \PBCOL{$(H_9,c)$} is NP-complete, where $c$ is the $4$-colouring of $H_9$ illustrated in Figure~\ref{fig:G9}. We describe a reduction from \PBlistCOL{$C_6$}, which is NP-complete~\cite{FHH99}. We label the vertices in $C_6$ from~$1$ to~$6$ sequentially. We also do that in the $C_6$ included in $H_9$. We assume without loss of generality that the vertex adjacent to the Red vertex is labelled~$1$, and the one adjacent to the Green one is labelled~$3$. It follows that the vertex adjacent to the Yellow vertex is labelled~$5$. Let $(G,L)$ be an instance of \PBlistCOL{$C_6$}, where $L$ is the list-assignment function. If $G$ is not bipartite, then $G$ has no homomorphism to $C_6$, so we can assume that $G$ is bipartite. Since $G$ and $C_6$ are bipartite, we may assume that $\forall u \in V(G)$, either $L(u)\subseteq\{1,3,5\}$, or $L(u)\subseteq\{2,4,6\}$. Thus $|L(u)|\leq 3$. From $(G,L)$, we build an instance $f(G,L)$ of \PBCOL{$(H_9,c)$} as follows. First, we consider a copy $G'$ of $G$, we let $G'\subset f(G,L)$ and colour every vertex of $G'$ Black. We call $u'$ the copy of vertex $u$ in $G'$. Then, for each vertex $u$ of $G$, we add a gadget $H_u$ to $f(G,L)$ that is attached to $u'$. The gadget is described below and depends only on $L(u)$. \begin{itemize} \item If $L(u)=\{1\}$ (respectively, $\{3\}$ or $\{5\}$), then $H_u$ is a single Red (respectively, Green or Yellow) vertex of degree~$1$ adjacent only to $u'$. \item If $L(u)=\{2\}$ (respectively, $\{4\}$ or $\{6\}$), then $H_u$ consists of two $2$-vertex path: a Red--Black path and a Green--Black path (respectively, a Green--Black path and a Yellow--Black path or a Yellow--Black path and a Red--Black path) whose Black vertex is of degree~$2$ and is adjacent to $u'$ (the other vertex is of degree~$1$). \item If $L(u)=\{2,4\}$ (respectively, $\{4,6\}$ or $\{2,6\}$), then $H_u$ is a $2$-vertex Green--Black (respectively, Yellow--Black or Red--Black) path whose Black vertex is of degree~$2$ and adjacent to $u'$ (the other vertex is of degree~$1$). \item If $L(u)=\{1,3\}$ (respectively, $\{3,5\}$ or $\{1,5\}$), then $H_u$ is a $5$-vertex Red--Black--Black--Black--Green path (respectively, Green--Black--Black--Black--Yellow or Yellow--Black--Black--Black--Red) whose middle Black vertex is of degree~$3$ and adjacent to $u'$ (the endpoints of the path are of degree~$1$ and the other two vertices have degree~$2$). \item If $L(u)=\{1,3,5\}$, then $H_u$ is a $3$-vertex Black--Black--Red path with the black leaf adjacent to $u'$. \item If $L(u)=\{2,4,6\}$, then $H_u$ is a $4$-vertex Black--Black--Black--Red path with the black leaf adjacent to $u'$. \end{itemize} Let us prove that $G$ has a homomorphism to $C_6$ that fulfils the constraints of list $L$, if and only if $f(G,L)\to (H_9,c)$. For the first direction, consider a list homomorphism $h$ of $G$ to $C_6$ with the list function $L$. We build a homomorphism $h'$ of $f(G,L)$ to $(H_9,c)$ as follows. First of all, each copy $v'$ of a vertex $v$ of $G$ with $h(v)=i$ is mapped to $i$ in $(H_9,c)$. It is clear that this defines a homomorphism of the subgraph $G'$ of $f(G,L)$ to the Black $6$-cycle in $(H_9,c)$. It is now easy to complete $h'$ into a homomorphism of $f(G,L)$ to $(H_9,c)$ by considering each gadget $H_u$ independently. For the converse, let $h_T$ be a homomorphism of $f(G,L)$ to $(H_9,c)$. Then, we claim that the restriction of $h_T$ to the vertices of the subgraph $G'$ of $f(G,L)$ is a list homomorphism of $G$ to $C_6$ with list function $L$. Indeed, let $u'$ be a vertex of $G'$. If $H_u$ has one vertex (say a Red vertex), then $L(u)=\{1\}$. Then necessarily $u'$ is sent to a neighbour of a vertex coloured Red in $(H_9,c)$. Since the only such neighbour is vertex~$1$, $u'\in h_T(u)$. All the other cases follow from similar considerations. \end{proof} \section{Trees}\label{sec:trees} We now consider the complexity of tropical homomorphism problems when the target tropical graph is a tropical tree It follows from the results in Section~\ref{sec:list_hom} that for every tree $T$ of order at most~$10$, \PBtropCOL{$T$} is polynomial-time solvable. Indeed, such a tree needs to contain a minimal tree $T$ of order at most~$10$ for which \PBlistCOL{$T$} is NP-complete, and the only such tree is $G_1$, which has order~$10$~\cite{FHH99}. \longpaper{(See Table~\ref{table}.)} We proved in Theorem~\ref{thm:table} that \PBtropCOL{$G_1$} is polynomial-time solvable. With some efforts, one can extend this to trees of order at most~$11$. \shortpaper{The proof is tedious and we omit it here, see~\cite{fullversion} for details.} \begin{theorem}\label{thm:SmallTree} For every tree $T$ of order at most~$11$, \PBtropCOL{$T$} is polynomial-time solvable. \end{theorem} \longpaper{ \begin{proof} Let $G_1$ be the smallest tree such that \PBlistCOL{$G_1$} is NP-hard, as defined in Table~\ref{table} of Section~\ref{sec:list_hom} ($G_1$ has order $10$ and is obtained from a claw by subdividing each edge twice). We let $V(G_1)=\{c,x_1,y_1,z_1,x_2,y_2,z_2,x_3,y_3,z_3\}$, with edges $cx_i$, $x_iy_i$, $y_iz_i$ for $i=1,2,3$ Assume for a contradiction that there is a tree $T_0$ of order~$11$ such that \PBtropCOL{$T$} is not polynomial-time solvable. Then, $T_0$ is a connected core. Once again, by Proposition~\ref{prop:bipartite-hom}, we may assume that the colour sets of the two parts in the bipartition of $T_0$ are disjoint. By Theorem~\ref{thm:listhom-table}, for any tree $T$ which does not contain $G_1$ as an induced subgraph, \PBlistCOL{$T$} is polynomial-time solvable, and therefore \PBtropCOL{$T$} is polynomial-time solvable. Hence $G_1$ is a subtree of $T_0$. There are four non-isomorphic trees of order~$11$ which contain $G_1$, depending on where we attach the additional vertex $a$. If in $T_0$, $a$ is adjacent to $c$, then the same arguments as in the proof of Theorem~\ref{thm:table} showing that \PBtropCOL{$G_1$} is polynomial-time solvable show that \PBtropCOL{$T_0$} is polynomial-time solvable, a contradiction. Let $(A,B)$ be the bipartition of $T_0$ with $\{c,y_1,y_2,y_3\}\subseteq A$ and $\{x_1,x_2,x_3,z_1,z_2,z_3\}\subseteq B$. For the remainder, we may assume that no vertex (except $a$) is the only one with its colour, for otherwise, by Lemma~\ref{lemm:unique-feature}, \PBtropCOL{$T_0$} would be polynomial-time solvable. In particular, $A-a$ is coloured with at most two colours and $B-a$ is coloured with at most three colours. Assume first that $a$ is adjacent to a vertex $x_i$ of $G_1$, say $x_1$. The colours of $x_1$ and $z_1$ must be distinct, otherwise $(T_0,c_0)$ is not a core. Without loss of generality, assume that $c_0(x_1)=1$ and $c_0(z_1)=2$. Without loss of generality the central vertex $c$ is Black. The supplementary vertex $a$ must be coloured with a different colour than $c$ and $y_1$ (say with colour Red), otherwise $(T_0,c_0)$ is not a core. Hence $y_1$ is not Red. Assume first that $y_1$ is Green. Then (without loss of generality), $y_2$ is Black and $y_3$ is Green, otherwise we could apply Lemma~\ref{lemm:unique-feature}. But by Lemma~\ref{lemm:unique-feature}, there must be two edges with endpoints $1$ and Green, and one with endpoints $2$ and Green. Hence $c_0(x_3)=1$ and $c_0(z_3)=2$ (if $c_0(x_3)=2$ and $c_0(z_3)=1$ then $(T_0,c_0)$ is not a core). But again by Lemma~\ref{lemm:unique-feature} we need another edge with endpoints Black and $1$, and one with endpoints Black and $2$. But in both cases $(T_0,c_0)$ is not a core, a contradiction. This shows that vertex $y_1$ must be Black. Then, since $(T_0,c_0)$ is a core, vertex $c$ has no neighbour coloured~$2$. But if there is no second edge with endpoints coloured $2$ and Black, then we could apply Lemma~\ref{lemm:unique-feature}. Hence one of $y_2$ and $y_3$, say $y_2$, must be Black, and $c_0(z_2)=2$. If $c_0(x_2)=1$, $(T_0,c_0)$ is not a core, therefore $c_0(x_2)=3$, and $c_0(x_3)\in\{1,3\}$. If $y_3$ is Black, then $(T_0,c_0)$ is not a core, hence $y_3$ is Red. But both neighbours of $y_3$ must have distinct colours, which means we can apply Lemma~\ref{lemm:unique-feature} to one of the edges incident with $y_3$, a contradiction. Assume now that $a$ is adjacent to a vertex $y_i$ of $G_1$, say $y_1$. Then, the colours of $a$, $x_1$ and $z_1$ must be distinct, say $c_0(x_1)=1$, $c_0(z_1)=2$, $c_0(a)=3$. Without loss of generality the central vertex $c$ is Black. By Lemma~\ref{lemm:unique-feature}, there is another vertex coloured Black. If $y_1$ is Black, then by Lemma~\ref{lemm:unique-feature} we have two further edges with endpoints Black-$2$ and Black-$3$. But these edges cannot be both incident with $c$ (otherwise $(T_0,c_0)$ is not a core), hence there is another Black vertex. Then in fact, Lemma~\ref{lemm:unique-feature} implies that both $y_2$ and $y_3$ are Black. But then, any way to complete $c_0$ implies that $(T_0,c_0)$ is not a core, a contradiction. Therefore, $y_1$ is not Black (say it is Red) and we can assume that $y_2$ is Black, and since we need a second Red vertex, $y_3$ is Red. But one of the type of edges among Red-$1$, Red-$2$ and Red-$3$ will appear only once, and we can apply Lemma~\ref{lemm:unique-feature}, a contradiction. We assume finally that $a$ is adjacent to a vertex $z_i$ of $G_1$, say $z_1$. Without loss of generality, vertex $a$ is Black, vertex $z_1$ is coloured~$1$, and vertex $y_1$ is Red (otherwise, $(T_0,c_0)$ is not a core). By Lemma~\ref{lemm:unique-feature}, there must be another $3$-vertex path coloured Black-$1$-Red. This path must be $cx_iy_i$ with $c$ Black, for otherwise $(T_0,c_0)$ is not a core. We can assume that $c_0(x_2)=1$ and $y_1$ is Red. Then $c_0(x_1)\neq 1$, assume $c_0(x_1)=2$. Then again by Lemma~\ref{lemm:unique-feature} there is another $3$-vertex path coloured Black-$2$-Red. The only possibility is that $c_0(x_3)=2$ and $y_3$ is Red. Then $c_0(z_3)\notin\{1,2\}$, otherwise $(T_0,c_0)$ is not a core. Hence we assume $c_0(z_3)=3$, which by Lemma~\ref{lemm:unique-feature} implies $c_0(z_2)=3$. But then there is a unique $3$-vertex path coloured $1$-Red-$3$, and by Lemma~\ref{lemm:unique-feature}, \PBCOL{$(T_0,c_0)$} is polynomial-time solvable, a contradiction. This completes the proof. \end{proof} Let $T_{23}$ be the tree of order~$23$ shown in Figure~\ref{target_23_tree}. \begin{figure}[ht!] \centering \includegraphics[scale=0.7]{23tree.pdf} \caption{The $7$-tropical tree $(T_{23},c)$} \label{target_23_tree} \end{figure} \begin{theorem}\label{thm:T23} \PBtropCOL{$T_{23}$} is NP-complete. \end{theorem} \begin{proof} We give a reduction from \textsc{$3$-SAT} to \PBCOL{$(T_{23},c)$}, where $c$ is the colouring of Figure~\ref{target_23_tree}. Given an instance $(X,C)$ of \textsc{$3$-SAT}, we construct an instance $f(X,C)=(G_{X,C},c_{X,C})$ of \PBCOL{$(T_{23},c)$} To construct the graph $G_{X,C}$, we first define the following building blocks. See Figure~\ref{building_block_tree} for illustrations. \begin{itemize} \item The block $S_{1,2}$ is a graph built from a $7$-vertex black-coloured path with vertex set $\{x_1,\ldots,x_7\}$ where a BlackCross leaf is attached to vertices $x_1$ and $x_7$, a RedDot leaf is attached to vertices $x_2$ and $x_6$, and a GreenDot leaf is attached to vertex $x_4$. \item The block $S_{1,T}$ is a graph built from a $7$-vertex black-coloured path with vertex set $\{x_1,\ldots,x_7\}$ where a BlackCross leaf is attached to vertices $x_1$ and $x_7$, a RedDot leaf is attached to vertices $x_2$ and $x_6$, and a RedCross leaf is attached to vertex $x_4$. \item The block $S_{1,T}$ is a graph built from a $7$-vertex black-coloured path with vertex set $\{x_1,\ldots,x_7\}$ where a BlackCross leaf is attached to vertices $x_1$ and $x_7$, a GreenDot leaf is attached to vertices $x_2$ and $x_6$, and a GreenCross leaf is attached to vertex $x_4$. \item The \emph{NOT-block} is depicted in Figure~\ref{fig:NOT-block}. \item The \emph{A-block} is depicted in Figure~\ref{fig:A-block}. \end{itemize} Illustrations of these blocks can be found in Figure~\ref{building_block_tree}. \begin{figure}[ht!] \centering \subfigure[The blocks $S_{1,2}$, $S_{1,T}$ and $S_{2,T}$.]{\label{fig:S-blocks}\includegraphics[scale=0.7]{Sblocks.pdf}}\qquad \subfigure[The variable gadget of $x$, essentially a NOT-block.]{\label{fig:NOT-block}\includegraphics[scale=0.7]{T23_variable.pdf}}\qquad \subfigure[The $A$-block and its representation as an arrow.]{\label{fig:A-block}\includegraphics[scale=0.7]{Ablock.pdf}} \caption{The building blocks of $G_{X,C}$.} \label{building_block_tree} \end{figure} We now define gadgets for each variable of $X$ and each clause of $C$. The graph $G_{X,C}$ is formed by the set of all variable and clause gadgets. \begin{itemize} \item For a variable $x\in X$, the \emph{variable gadget of $x$} consists of the four vertices $x^0$, $x^1$, $\bar{x}^0$ and $\bar{x}^1$, coloured respectively BlackDot, BlackCross, BlackDot and BlackCross, joined by a NOT-block as described in Figure \ref{fig:NOT-block}. The image of $x^0$ and $x^1$ in $(T_{23},c)$ correspond to the truth-value of the litteral $x$. Similarly, the image of $\bar{x}^0$ and $\bar{x}^1$ correspond to the truth-value of the litteral $\bar{x}$. For a litteral $l$, we use the notation $l^0$ (resp. $l^1$) to describe either $x^0$ (resp. $x^1)$ when $l=x$ with $x\in X$, or $\bar{x}^0$ (resp. $\bar{x}^1$) when $l=\bar{x}$ with $x\in X$. \item For each clause $c=(l_1,l_2,l_3)\in C$, there is a \emph{clause gadget of $c$} (as drawn in Figure~\ref{gadget_clause_tree}) connecting vertices $l_1^0$, $l_2^0$ and $l_3^0$. \end{itemize} \begin{figure}[ht!] \centering \includegraphics[scale=0.7]{GadgetClauseTree.pdf} \caption{Example of a clause gadget of clause $(l_1,l_2,l_3)$. The full details of the $A$-blocks and $S_{1,2}$-blocks are represented in Figure~\ref{building_block_tree}.} \label{gadget_clause_tree} \end{figure} We now show that $G_{X,C}\to (T_{23},c)$ if and only if $(X,C)$ is satisfiable. \medskip Assume first that there is a homomorphism $h$ of $G_{X,C}$ to $(T_{23},c)$. We first prove some properties of $h$. \begin{claim}\label{clm:T_{23}} The homomorphism $h$ satisfies the following properties. \begin{itemize} \item[(1)] For each literal $l$ of a variable of $X$, vertices $l^0$ and $l^1$ are mapped to the two vertices of one of the pairs $T$, $F_1$ or $F_2$. The same holds for the extremities of the blocks $S_{1,2}$, $S_{1,T}$, $S_{2,T}$ and $A$. \item[(2)] The two extremities of each block $S_{1,2}$ are both mapped either to the vertices of $T$, or to vertices of $F_1\cup F_2$. \item[(3)] The two extremities of each block $S_{1,T}$ are both mapped either to the vertices of $F_2$, or to vertices of $F_1\cup T$. \item[(4)] The two extremities of each block $S_{2,T}$ are both mapped either to the vertices of $F_1$, or to vertices of $F_2\cup T$. \item[(5)] For each variable $x$ of $X$, exactly one of $x^0$ and $\bar{x}^0$ is mapped to a vertex of $T$, and the other is mapped to a vertex of $F_1$ or $F_2$. \item[(6)] In any $A$-block, either some extremity is mapped to $T$ (then the other extremity can be mapped to any of $F_1$, $F_2$ or $T$), or the left extremity is mapped to $F_2$ and the right extremity, to $F_1$. \end{itemize} \end{claim} \noindent\emph{Proof of claim.} (1) This is immediate since the only pairs in $(T_{23},c)$ consisting of two adjacent BlackDot and BlackCross vertices are the ones of $T$, $F_1$ and $F_2$. \smallskip (2)--(4) We only prove~(2), since the three proofs are not difficult and similar. By~(1), the extremities of $S_{1,2}$ are mapped to vertices of $T\cup F_1\cup F_2$. If one extremity is mapped to $T$, the remainder of the mapping is forced and the claim follows. If one extremity is mapped to $F_1\cup F_2$, one can easily complete it to a mapping where the other extremity is mapped to either $F_1$ or $F_2$. \smallskip (5) By (1), $x^0$ and $\bar{x}^0$ must be mapped to a vertex of $T\cup F_1\cup F_2$. Without loss of generality, we can assume that $x^0$ corresponds to the left extremity of the NOT-block $N_x$ connecting $x^0$ and $\bar{x}^0$. First assume that $x^0$ and $\bar{x}^0$ are mapped to the vertex of $T$ coloured BlackDot. Then, considering the vertices of $N_x$ from left to right, the mapping is forced and the degree~$3$-vertex of $N_x$ at distance~$2$ both of a RedDot and a RedCross vertex must be mapped to the vertex $c$ of $T_{23}$. But then, continuing towards the right of $N_x$, $\bar{x}^0$ cannot be mapped to a vertex of $T$. Therefore, we may assume that both $x^0$ and $\bar{x}^0$ are mapped to the BlackCross vertices of $F_1\cup F_2$. If $x^0$ is mapped to the BlackCross vertex in $F_1$, then again going through $N_x$ from left to right the mapping is forced; the central vertex of $N_x$ must be mapped to a vertex of $F_2$, and $\bar{x}^0$ must be mapped to a vertex of $T$, a contradiction. The same applied when $x^0$ is mapped to the BlackCross vertex in $F_2$, completing the proof of~(5). \smallskip (6) An $A$-block is composed of two parts: the upper part and the lower part. Observe that if the left extremity of an $A$-block is mapped to $F_1$, then using~(2) and~(4), the mapping of the upper part of the $A$-block is forced and the right extremity has to be mapped to $T$. Similarly, if the left extremity is mapped to $F_2$, by~(2) and~(3) the right extremity cannot be mapped to $F_2$. On the other hand, for all other combinations of mapping the extremities to $T$, $F_1$ or $F_2$ the mapping can be extended.~{\tiny ($\Box$)} \medskip We are ready to show how to construct the truth assignment $A(h)$. If $h(l^0)\in T$ for some literal $l$, we let $l$ be True and if $h(l^0)\in F_1\cup F_2$, we let $l$ be False. By Claim~\ref{clm:T_{23}}(5), this is a consistent truth assignment for $X$. For any clause $c=(l_1,l_2,l_3)$, in the clause gadget of $c$, we have three $A$-blocks forming a directed triangle. Hence, by Claim~\ref{clm:T_{23}}(6), there must be one of the three extremities of this triangle mapped to a vertex of $T$. Therefore, by Claim~\ref{clm:T_{23}}(2), at least one of the vertices $l_1^0$, $l_2^0$ and $l_3^0$ is mapped to $T$. This shows that $A(h)$ satisfies the formula $(X,C)$. \medskip Reciprocally, if there is a solution for $(X,C)$, one can build a homomorphism of $G_{X,C}$ to $(T_{23},c)$ by mapping, for each literal $l$, the vertices $l_0$ and $l_1$ to one of the vertex pairs $F_1$, $F_2$ and $T$ of $(T_{23},c)$ corresponding to the truth value of $l$ (if $l$ is False, we may choose one of $F_1$ and $F_2$ arbitrarily). Then, using Claim~\ref{clm:T_{23}}, one can easily complete this to a valid mapping. \end{proof} \section{Conclusion} We have shown that the class of \PBCOL{$(H,c)$} problems has a very rich structure, since they fall into the classes of CSPs for which a dichotomy theorem would imply the truth of the Feder--Vardi Dichotomy Conjecture. Hence, we turned our attention to the class of \PBtropCOL{$H$} problems, for which a dichotomy theorem might exist. Despite some initial results in this direction, we have not been able to exhibit such a dichotomy, and leave this as the major open problem in this paper. Towards a solution to this problem, we propose a simpler question. All bipartite graphs $H$ that we know with problem \PBtropCOL{$H$} being NP-complete contain, as an induced subgraph, either an even cycle of length at least~$6$ (for example cycles themselves or $H_9$), or the graph $G_1$\longpaper{ from Table~\ref{table}}, that is, a claw with each edge subdivided twice (this is the case for $T_{23}$). Hence, we ask the following. (A bipartite graph is \emph{chordal} if it contains no induced cycle of length at least~$6$.) \begin{question} \label{conj:nocycle} Is it true that for any chordal bipartite graph $H$ with no induced copy of $G_1$, \PBtropCOL{$H$} is polynomial-time solvable? \end{question} Note that Question~\ref{conj:nocycle} is not an attempt at giving an exact classification, since \PBtropCOL{$G_1$} and \PBtropCOL{$C_{2k}$} for $k\leq 6$ are polynomial-time solvable. \smallskip Another interesting question would be to consider the restriction of \PBtropCOL{$H$} to $2$-tropical graphs. Recall that by Remark~\ref{rem:C48}(2), one can slightly modify the gadgets from Theorem~\ref{thm:C48} and the colouring of the cycle, to obtain a $2$-colouring $c$ of $C_{54}$ such that \PBCOL{$(C_{54},c)$} is NP-complete. \medskip Finally, we relate our work to the \textsc{$(H,h,Y)$-Factoring} problem studied in~\cite{BM97} and mentioned in the introduction. Recall that \PBCOL{$(H,c)$} corresponds to \textsc{$(H,c,K_{|C|}^+)$-Factoring} where $K_{|C|}^+$ is the complete graph on $|C|$ vertices with all loops, and with $C$ the set of colours used by $c$. In~\cite{BM97}, the authors studied \textsc{$(H,h,Y)$-Factoring} when $Y$ has no loops. Using reductions from NP-complete \PBCOL{$D$} problems where $D$ is an oriented even cycle or an oriented tree, they proved that for any fixed graph $Y$ which is not a path on at most four vertices, there is an even cycle $C$ and a tree $T$ such that \textsc{$(C,h_C,Y)$-Factoring} and \textsc{$(T,h_T,Y)$-Factoring} are NP-complete (for some suitable homomorphisms $h_C$ and $h_T$). Note that $C$ and $T$ here are fairly large. We can strengthen these results as follows. Consider our reduction of Theorem~\ref{thm:C48} showing in particular that \PBtropCOL{$C_{48}$} is NP-complete. As noted in Remark~\ref{rem:C48}(1), the given colouring $c$ of $C_{48}$ can easily be made a proper colouring by separating the red vertices into two classes, according to which part of the bipartition of $C_{48}$ they belong to. Then, one can observe that $c$ is in fact a homomorphism to a tree $T_1$ obtained from a claw where one edge is subdivided once (the three vertices of degree~$1$ are coloured Blue, Black and Green, and the two other vertices are the two kinds of Red). Thus, for any graph $Y$ containing this subdivided claw as a subgraph, we deduce that \textsc{$(C_{48},c_{1|T_1},Y)$-Factoring} is NP-complete. We can use a similar approach for our result of Theorem~\ref{thm:T23}, that \PBtropCOL{$T_{23}$} is NP-complete. Note that the colouring $c_2$ we give is in fact a homomorphism to a tree $T_2$ which is obtained from a star with five branches by subdividing one edge once. Thus, for any graph $Y$ containing $T_2$ as a subgraph, \textsc{$(T_{23},c_{2|T_2},Y)$-Factoring} is NP-complete. Of course we can apply this argument by replacing $T_1$ and $T_2$ by the underlying graph of any loop-free homomorphic image of $(C_{48},c_1)$ and $(T_{23},c_2)$, respectively. \vspace{0.5cm} \noindent\textbf{Acknowledgements.} We thank Petru Valicov for initial discussions on the topic of this paper.
{'timestamp': '2018-01-31T02:06:13', 'yymm': '1607', 'arxiv_id': '1607.04777', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04777'}
arxiv
\subsection{LSTM Equations} \input{lstm_equations} \subsection{Parameter reduction} \label{subsec:am_parameter_reduction} In order to reduce memory consumption and computation, we compress the previously described acoustic model using projection layers that sit between the outputs of an LSTM layer and both the recurrent and non-recurrent inputs to same and subsequent layers~\cite{SakSeniorBeaufays14}. In our system, we introduce projection matrices of rank 100 for the first four layers, and a projection matrix of rank 200 for the fifth hidden layer, as we have noticed the weight matrices' ranks increases with depth. Of crucial importance, however, is that when a significant rank reduction is applied, it is not sufficient to initialize the projection layer's weight matrix randomly for training with the CTC criterion. In section~\ref{sec:training} we explore a number of options for better, faster and more stable training convergence for our model. They range from adding a multiplicative factor that along with the global learning rate scales the gradient of the projection layers' weights during backpropagation, to exploying a clever initialization proposed in~\cite{prabhavalkar2016} that uses the larger `uncompressed' model without the projection layer and jointly factorize its recurrent and (non-recurrent) inter-layer weight matrices at each hidden layer using a form of singular value decomposition to determine a shared projection layer. \subsection{Quantization basics} Given floating point values, our goal is to represent them as 8-bit integers. Generally speaking we could use either a uniform or a non-uniform quantizer, or even an optimal quantizer for a given value distribution~\cite{bovik2005}. However, with simplicity and performance in mind, and validated by previous work in the area~\cite{vanhoucke2011}, we settled on a uniform linear quantizer that assumes a uniform distribution of the values within a given range. As a result we do not need a decompression step at inference time. \textbf{Quantizing.} Given a set of float values $\mathbf{V}=\{V_x\}$, and a desired scale $S$ (e.g. we use 255 for 8-bits), we compute a factor $Q$ that produces a scaled version of the original: $\mathbf{V}'=\{0 \le V_{x}' \le S\}$. To maximize the use of $S$ we determine the range of values $R = (V_\text{max} - V_\text{min})$ we want to quantize, i.e., squeeze into the new scale $S$. Thus, the quantization factor can be expressed as $Q = \frac{S}{R}$, and the quantized values as $V_{x}' = Q * (V_{x} - V_\text{min})$. \textbf{Recovery.} A quantized value $V_{x}'$ can be recovered (i.e. transformed back into its approximate high-precision value) by performing the inverse of the quantization operation, which implies computing a recovery factor $Q^{-1} = \frac{R}{S}$. The recovered value is then expressed as $V_{x} = V_{x}' * Q^{-1} + V_\text{min}$. \textbf{Quantization error and bias.} Quantization is a lossy process, with two sources of error. The first is the difference between the input value and its quantized-then-recovered value (precision loss). The second is the result of discrepancies in quantization-recovery operations that introduce a bias in the computed value (bias error)~\cite{Tan08}. Of the two sources of error, the precision loss is theoretically and practically unavoidable but, on average, has a smaller impact on what the original data represents (e.g. the difference in the variances of $\mathbf{V}$ and $\mathbf{V}'$ is very small~\cite{gersho1992}). The bias, however, is theoretically avoidable by paying close attention to how the quantized values are manipulated, thus avoiding the introduction of inconsistencies. The latter is very important since bias problems have a big impact on the quantization error. Consequently we pay particular attention in eliminating bias error in Section~\ref{subsec:quantized_inference}. \subsection{Quantized inference} \label{subsec:quantized_inference} The approach we follow during neural network inference is to treat each layer independently, receiving and producing floating point values: inputs get quantized on-the-fly, while network parameters offline. Internally, layers operate on 8-bit integers for the matrix multiplications (typically the most computationally intensive operations), and their product is recovered to floating point, as depicted in Figure \ref{fig:quantization_scheme_diagram}. This simplifies the implementation of complex activation functions, and allows mixing integer layers with float layers, if desired. \begin{figure} \centering \includegraphics[width=\columnwidth]{quantization_scheme} \footnotesize \caption{\footnotesize Execution of typical inference $y = W X + B$ : weights $\mathbf{W}$ are already quantized, and inputs $\mathbf{X}$ are quantized $Q(\cdot)$ on-the-fly before performing multiplication $Mult(\cdot)$; the product is then recovered $R(\cdot)$ to apply the biases $\mathbf{B}$ and the activation function $F(\cdot)$.} \label{fig:quantization_scheme_diagram} \end{figure} \textbf{Multiplication of quantized values.} In order to perform most of the multiplication, $V_\text{c} = V_\text{a} * V_\text{b}$, in the 8-bit domain (though using 32-bit accumulators), we must first apply the offset, $V_\text{min}$, such that $V_\text{x} = \frac{V_\text{x}''}{Q}$, where $V_\text{x}''=V_\text{x}' + Q V_\text{min}$. We then apply the recovery factor on the result, which for the multiplication of two independently quantized values $V_\text{a}'$ and $V_\text{b}'$, is the inverse product of their quantization factors $Q_\text{a}$ and $Q_\text{b}$ : \begin{equation} \label{eq:mult} \footnotesize V_\text{c} = \frac{V_\text{a}'' * V_\text{b}''}{Q_\text{a} * Q_\text{b}}\quad\quad\quad\quad\quad\text{(} Mult(\cdot) \text{ and } R(\cdot) \text{ in Figure 1)} \end{equation} \textbf{Integer multiplication: effects on quantization and recovery.} In eq.~\eqref{eq:mult}, each factor $V_\text{x}''$ is of integer type. This means in the $V_\text{x}''$ formulation: 1) $V_\text{x}'$ is already an integer; 2) $Q V_\text{min}$ is a float that will be rounded to an integer, and thus introduce an error: $E = \text{float}(Q V_\text{min}) - \text{integer}(Q V_\text{min})$. This requires that quantization be performed in a way that is consistent with this formulation in order to avoid introducing bias error. Thus we introduce a rounding operation $\text{round}(\cdot)$: \begin{equation} \label{eq:quant} \footnotesize V_\text{x}' = \text{round}(Q V_\text{x}) - \text{round}(Q V_\text{min})\quad\quad\text{(} Q(\cdot) \text{ in Figure 1)} \end{equation} Thus precision errors in the quantization and multiplication are consistent and cancel each other. This also means that recovery needs to be consistent with eq.~\eqref{eq:quant}: \begin{equation} \footnotesize V_\text{x} = \frac{V_\text{x}' + \text{round}(Q V_\text{min})}{Q}\quad\quad\quad\quad\quad\quad\text{(} R(\cdot) \text{ in Figure 1)} \end{equation} \textbf{Efficient implementation.} The proposed quantization scheme benefits from the reduced memory bandwidth of accessing 8-bit values, and enables squeezing more values into any fast cache available, thus reducing power consumption and access time. Furthermore, it allows better use of optimized SIMD instructions by fitting in more values per operation, which offers a performance advantage over their floating point counterparts. The overhead of the quantization and recovery operations is typically negligible, and also parallelizable via SIMD. We do not cover any specific implementation since whereas the previous benefits are generally applicable, the details hinge on the targeted hardware, and that is beyond the scope of this paper. However, in our previous work ~\cite{mcgraw16} we recorded a significant speed up over unquantized floating point inference. Logically, our scheme can be applied at a given level of granularity, subdividing groups of values into sub-groups for better precision. This means parameter matrices at different NN layers can be quantized independently, or even further broken down into individually quantized sub-matrices. We set the granularity at the level of the weight matrices (e.g. the parameters associated with individual gates in an LSTM). This results in a relatively small loss in final inference accuracy (see Table~\ref{tbl:results}). \subsection{Quantization aware training} \label{subsec:quantization-aware_training} \input{training} \begin{table*} \footnotesize \centering \begin{tabular}{|c|c|c|c|c||c|c|c|c|} \hline \textbf{System (Params.)} & \multicolumn{4}{|c||}{\textbf{WER (\%) on Clean Eval Set}} & \multicolumn{4}{|c|}{\textbf{WER (\%) on Noisy Eval Set}} \\ \hline & \textbf{match} & \textbf{mismatch} & \textbf{quant} & \textbf{quant-all} & \textbf{match} & \textbf{mismatch} & \textbf{quant} & \textbf{quant-all} \\ \hline \hline $4\times300$ ($\sim$2.9M) & 13.6 & 14.3 (5.1\%) & 13.5 (-0.7\%) & 13.6 (0.0\%) & 26.3 & 28.2 (7.2\%) & 26.5 (0.8\%) & 26.5 (0.8\%) \\ \hline $5\times300$ ($\sim$3.7M) & 12.5 & 13.1 (4.8\%) & 12.6 (0.8\%) & 12.7 (1.6\%) & 24.6 & 26.6 (8.1\%) & 24.8 (0.8\%) & 25.0 (1.6\%) \\ \hline $4\times400$ ($\sim$5.0M) & 12.1 & 12.5 (3.3\%)& 12.3 (1.7\%) & 12.3 (1.7\%) & 23.2 & 25.0 (7.8\%) & 23.7 (2.2\%) & 23.8 (2.6\%) \\ \hline $5\times400$ ($\sim$6.3M) & 11.4 & 11.7 (2.6\%) & 11.5 (0.9\%) & 11.7 (2.6\%) & 22.3 & 23.5 (5.4\%) & 22.6 (1.3\%) & 22.7 (1.8\%) \\ \hline $4\times500$ ($\sim$7.7M) & 11.7 & 12.0 (2.6\%) & 11.7 (0.0\%) & 11.7 (0.0\%) & 22.6 & 23.6 (4.4\%) & 22.6 (0.0\%)& 22.7 (0.4\%) \\ \hline $5\times500$ ($\sim$9.7M) & 10.9 & 11.1 (1.8\%) & 11.2 (2.8\%) & 11.1 (1.8\%) & 20.9 & 21.7 (3.8\%) & 21.4 (2.4\%) & 21.5 (2.9\%) \\ \hline \hline $P=100$ ($\sim$2.7M) & 11.6 & 12.1 (4.3\%) & 11.8 (1.7\%) & 11.9 (2.6\%) & 22.6 & 23.8 (5.3\%) & 23.1 (2.2\%) & 23.3 (3.1\%) \\ \hline $P=200$ ($\sim$4.8M) & 10.6 & 10.8 (1.9\%) & 10.6 (0.0\%) & 10.7 (0.9\%) & 20.5 & 21.4 (4.4\%) & 20.6 (0.5\%) & 20.7 (1.0\%) \\ \hline $P=300$ ($\sim$6.8M) & 10.3 & 10.5 (1.9\%) & 10.5 (1.9\%) & 10.6 (2.9\%) & 19.8 & 20.3 (2.5\%) & 20 (1.0\%) & 20.4 (3.0\%) \\ \hline $P=400$ ($\sim$8.9M) & 10.3 & 10.5 (1.9\%) & 10.3 (0.0\%) & 10.5 (1.9\%) & 19.6 & 20.2 (3.1\%) & 19.8 (1.0\%) & 19.9 (1.5\%) \\ \hline \hline Avg. Relative Loss & - & 3.0\% & 0.9\% & 1.6\% & - & 5.2\% & 1.2\% & 1.9\% \\ \hline \end{tabular} \caption{\footnotesize Word error rates on `clean' and `noisy' evaluation sets for various model architectures. Numbers in parentheses represent the loss relative to the \textbf{`matched'} condition where models are trained and evaluated using floating point arithmetic.} \label{tbl:results} \end{table*} \section{Introduction} \label{sec:intro} \input{intro} \section{Related work} \label{sec:related-work} \input{related-work} \section{Quantization Scheme} \label{sec:deepq} \input{deepq} \section{Experimental Setup} \label{sec:experiments-setup} \input{experiments} \section{Results} \label{sec:results} \input{results} \section{Conclusions} \label{sec:conclusions} \input{conclusions} \newpage \eightpt \bibliographystyle{IEEEtran} \subsection{Acoustic Model Architectures} We evaluate architectures which vary along two main dimensions: the total number of parameters in the model, and whether the architecture uses projection layers~\cite{SakSeniorBeaufays14} or not. We train RNN-based acoustic models with 4 or 5 layers of LSTM cells; the number of LSTM cells, $N$, is kept the same in all of the layers. We use $N=300, 400, 500$ in our experiments for a total of 6 configurations. In addition, we train models with 5 layers of 500 LSTM cells, but insert a projection layer of $P$ units after each of the 5 LSTM layers to reduce the rank of the recurrent and inter-layer weight matrices~\cite{SakSeniorBeaufays14}. In this work, unlike our previous work~\cite{prabhavalkar2016}, we keep the size of the projection layers the same across all layers. We consider $P=100, 200, 300, 400$, thus adding 4 more configurations. We utilize the same frontend as our previous work~\cite{prabhavalkar2016}: standard 40-dimensional log mel-filterbank energies over the 8kHz range, computed every 10ms on 25ms windows of input speech. Following~\cite{SakSeniorRaoEtAl15b}, we stack features together from 8 consecutive frames (7 frames of right context) and only present every third stacked frame as input to the network. In addition to stabilizing CTC training, this reduces computation since the network is only evaluated once every 30ms. In order to minimize the delay between the acoustics and the output labels produced by the network, we constrain the set of CTC alignments to be within 100ms of the locations determined by a forced-alignment~\cite{Senior15}. Our decoding setup is identical to that presented in our previous work~\cite{mcgraw16, prabhavalkar2016}. Following~\cite{lei2013}, we generate a much smaller first-pass language model (LM) (69.5K n-grams; mostly unigrams) which is composed with the lexicon transducer to generate the decoder graph; models are re-scored on-the-fly with a larger 5-gram LM. Our systems are trained on anonymized hand-transcribed utterances extracted from Google voice-search ($\sim$3M utterances) and dictation ($\sim$1M utterances) traffic. To improve robustness, we create `multi-style' training data by synthetically distorting the utterances, simulating the effect of background noise and reverberation. 20 distorted utterances are created for each input utterance; noise samples used in this process are extracted from environmental recordings of everyday events and Youtube videos. Results are reported on a set of 13.3K hand-transcribed anonymized utterances (135K words) extracted from Google traffic from an open-ended dictation domain. We also report results on a `noisy' version of the evaluation set, created synthetically using a noise distribution with similar characteristics as the one used to train the model. \section{Experiments} \label{sec:experiments} In pilot experiments, we found that quantization aware CTC training did not produce models with a better word error rate (WER) performance than `standard' float trained models. Therefore, in all of our experiments we use float CTC training, and then apply quantization aware sMBR training. \subsection{CTC Training of LSTM AMs with Projection Layers} \begin{figure} \centering \includegraphics[width=0.92\columnwidth]{ler_plot.pdf} \caption{\footnotesize Label error rates on held-out set as a function of training time during CTC training of model with 200 projection layer nodes $(P = 200)$ using different learning rate schedules.} \label{fig:proj_layer_ler} \end{figure} As reported in our previous work~\cite{prabhavalkar2016}, we find that training LSTMs to optimize the CTC criterion is somewhat unstable for models with projection layers. One solution to this problem, which we proposed in~\cite{prabhavalkar2016}, is to first train an `uncompressed' model without any projection layers. This model is used to initialize the projection layer matrices through a truncated singular value decomposition (SVD) of the recurrent weight matrices. While this stabilizes the training process, and has the benefit of providing a principled procedure for setting the number of nodes in each of the projection layers, it has the drawback that it requires a two-stage training process that increases overall training time. Therefore, in the present work, we propose an alternative strategy that stabilizes CTC training without requiring an expensive two-stage training process, yet results in better convergence. As a representative example, in Figure~\ref{fig:proj_layer_ler}, we plot CI-phoneme label error rates (LERs) for the model with 200 projection nodes in each layer $(P = 200)$, on a held-out development set. In all cases, we use an exponentially decaying global learning rate (LR): $\eta_g(t) = c_g 10^{- \frac{t}{T_g}}$, where $t$ is the total training time ($c_g = 1.5 \times 10^{-4}$ and $T_g = 20 \text{ days}$ in our experiments). The SVD-based initialization~\cite{prabhavalkar2016} appears as `SVD initialization' in the figure. The most straightforward technique to stabilize training is to set the initial global learning rate as high as possible while avoiding divergence ($c_g = 1.5 \times 10^{-7}$, in our experiments; `Low LR' in Figure~\ref{fig:proj_layer_ler}). Although this stabilizes training, this leads to extremely slow convergence since the learning rate is many orders of magnitude smaller, and significantly worse LER than the SVD-based initialization. As an alternative, we propose using a lower learning rate for parameters in the projection layer, by defining a separate projection learning rate multiplier $\eta_p(t)$ which multiplies the global learning rate (i.e., the effective learning rate for projection layer parameters is $\eta_g(t)\eta_p(t)$). We find that we can stabilize training by using a lower effective learning rate for the projection layer parameters relative to the rest of the system by using an exponentially increasing projection learning rate multiplier that gradually scales the effective learning rate multipler towards the global learning rate (`Scheduled Projection LR' in Figure~\ref{fig:proj_layer_ler}): $\eta_{p}(t) = c_{p}^{\left(1 - \min\left\{\frac{t}{T_{p}}, 1\right\}\right)}$ ($c_p = 10^{-3}$ and $T_p = 0.6 \text{ days}$ in our experiments). Note that, $\eta_p(t) \rightarrow 1 \text{ as } t \rightarrow T_p$, and thus the same effective learning rate is used for all parameters for $t > T_p$. As can be seen in Figure~\ref{fig:proj_layer_ler}, although the SVD-based initialization outperforms using a single low global learning rate, the scheduled projection learning rate schedule results in the fastest convergence, while avoiding the need for the two-stage training required by the SVD-based initialization. Therefore, we employ the projection learning rate schedule for CTC training of models with projection layers. \subsection{Quantization aware sMBR Training of AMs} \label{sec:am-smbr-qtrain} Once models have been trained under the CTC criterion, we sequence-train them to optimize the sMBR criterion. In order to mitigate the instability encountered during sMBR training of models with projection layers, we find that it is sufficient to use a constant learning rate multiplier for projection layer nodes: $\eta_p(t) = c^{\text{sMBR}}_{p}$ (we set, $c^{\text{sMBR}}_{p} = 0.5$ and the global LR parameter, $c_g = 1.5\times10^{-5}$, in our experiments).
{'timestamp': '2016-12-20T02:01:13', 'yymm': '1607', 'arxiv_id': '1607.04683', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04683'}
arxiv
\section{Introduction} \IEEEPARstart {T}{he} latest advantages in deep learning technologies has led to explosive growth in machine learning and computer vision for building systems that have shown significant improvements in a huge range of applications such as image classification \cite{krizhevsky2012imagenet}, \cite{vggnet} and object detection \cite{girshick2015fast}. The fully convolutional neural networks (FCN) \cite{long2015fully} permit end-to-end training and testing for image labeling; holistically-nested edge detector (HED) \cite{xie15hed} learns hierarchically embedded multi-scale edge fields to account for the low-, mid-, and high- level information for contours and object boundaries; Faster R-CNN \cite{ren2015faster} is a state-of-the-art object detection method depending on region proposal algorithms to predict object locations. FCN performs image-to-image training and testing, a factor that has become crucial in attaining a powerful modeling and computational capability of complex natural images and scenes. \begin{figure}[!t] \centering \includegraphics[width=3.4in]{fig1} \caption{Gland Haematoxylin and Eosin (H\&E) stained slides and ground truth labels. Images in the first row exemplify different glandular structures. Characteristics such as heterogeneousness and anisochromasia can be observed in the image. The second row shows the ground truth. To achieve better visual effects, each color represents an individual glandular structure.} \end{figure} The well-suited solution to image labeling/segmentation in which each pixel is assigned a label from a pre-specified set are FCN family models \cite{long2015fully,xie15hed}. However, when it concerns the problem where individual objects need to be identified, they fails to be directly applied to. This is a problem called instance segmentation. In image labeling, two different objects are assigned with the same label as long as they belong to the same class; while in instance segmentation, in addition to obtaining their class labels, it is also demanded that objects belonging to the same class are identified individually. Exited in most organ systems as important structures, glands fulfill the responsibility of secreting proteins and carbohydrates. However, adenocarcinomas, the most prevalent type of cancer, arises form glandular epithelium. The precise instance segmentation of glands in histopathological images is essential for morphology assessment, which has been proven to be not only a valuable tool for clinical diagnosis but also the prerequisite of cancer differentiation. Nonetheless, the task of segmenting gland instances is very challenging due to the striking dissimilarity of glandular morphology in different histologic grades. In computer vision, in spite of the promising results for instance segmentation that a recently developed progress \cite{dai2015instance} shows, it is suited for segmenting individual objects in natural scenes. With the proposal of fully convolutional network (FCN) \cite{long2015fully}, the "end-to-end" learning strategy has strongly simplified the training and testing process and achieved state-of-the-art results in solving the segmentation problem back at the time. Krahenbuh \emph{et al.} \cite{krahenbuhl2012efficient} and Zheng \emph{et al.} \cite{zheng2015conditional} integrate Conditional Random Fields (CRF) with FCN to achieve finer partitioning result of FCN. However, their inability of distinguishing different objects leads to the failure in instance segmentation problem. The attempt to partition the image into semantically meaningful parts while classifying each part into one of pre-determined classes is called semantic segmentation and has already been well studied in computer vision. One limitation of semantic segmentation is its inability of detecting and delineating different instances of the same class while segmentation at the instance level being an important task in medical image analysis. The quantitative morphology evaluation as well as cancer grading and staging requires the instance segmentation of the gland histopathological slide images \cite{kainz2015semantic}. Current semantic segmentation method cannot meet the demand of medical image analysis. The intrinsic properties of medical image pose plenty of challenges in instance segmentation \cite{dimopoulos2014accurate}. First of all, objects being in heterogeneous shapes make it difficult to use mathematical shape models to achieve the segmentation. As Fig.1 shows, the cytoplasm being filled with mucinogen granule causes the nucleus being extruded into a flat shape whereas the nucleus appears as a round or oval body after secreting. Second, variability of intra- and extra- cellular matrix is often the culprit leading to anisochromasia. Therefore, the background portion of medical images contains more noise like intensity gradients, compared to natural images. Several problems arose in our exploration of analyzing medical image: 1) some objects lay near the others thus one can only see the tiny gaps between them when zooming in the image on a particular area; or 2) one entity borders another letting their edges adhesive with each other. We call this an issue of \emph{'coalescence'}. If these issues are omitted during the training phase, even there is only one pixel coalescing with another then segmentation would be a total disaster. In this paper, we aim to developing a practical system for instance segmentation in gland histology images. We make use of multichannel learning, region, boundary and location cues using convolutional neural networks with deep supervision, and solve the instance segmentation issue in the gland histology image. Our algorithm is evaluated on the dataset provided by MICCAI 2015 Gland Segmentation Challenge Contest \cite{sirinukunwattana2016gland, sirinukunwattana2015stochastic} and achieves state-of-the-art performance among all participants and other popular methods of instance segmentation. We conduct a series of experiments in comparison with other algorithms and proves the superiority of the proposed framework. This paper is arranged as follows. In section \ref{related}, a review of previous work in relative area is presented. In section \ref{method}, the complete methodology of the proposed framework of gland instance segmentation is described. In section \ref{exp}, a detailed evaluation on this method is demonstrated. In section \ref{con}, we give our conclusion. \section{Related Work} \label{related} In this section, a retrospective introduction about instance segmentation will be delivered. Then, to present related work about our framework as clear as possible, information about channels will be delivered respectively, preceded by an overall review of multi-channel framework. \subsection{Instance segmentation} Instance segmentation, a task requires distinguishing contour, location, class and the number of objects in image, is attracting more and more attentions in image processing and computer vision. As a complex problem hardly be solved by traditional algorithms, more deep learning approaches are engaged to solve it. For example, SDS \cite{hariharan2014simultaneous} precedes with a proposal generator and then two parallel pathways for region foreground and bounding box are combined as outcome of instance segmentation. Hypercolumn \cite{hariharan2015hypercolumns}, complishes instance segmentation by utilizing hypercolumn features instead of traditional feature maps. MCNs \cite{dai2015instance} category predicted pixels via the result of object detection. In DeepMask \cite{pinheiro2015learning} and SharpMask \cite{pinheiro2016learning} two branches for segmentation and object score are engaged. Different form DeepMask, InstanceFCN \cite{dai2016instance} exploits local coherence rather than high-dimensional features to confirm instances. DCAN \cite{chen2016dcan}, the winner of 2015 MICCAI who shares the same dataset with us, combine contour and region for instance segmentation. To sum up, most of the models mentioned above make contributions to instance segmentation by integrating more than one CNN models to provide proposals and do segmentation. \subsection{Multichannel Model} Inspired by models mentioned above, since more than one model should engaged to solve instance segmentation problem, in another words, more than one kind of information is required, then building up a multichannel framework is also a plausible method. Multichannel model usually utilized to integrate features of various kinds to achieve more satisfying result. As far as we know, multichannel framework is rarely seen in instance segmentation of medical images. It can be seen in grouping features \cite{lee2014multi}, face recognizing \cite{chen2015learning} and image segmentation \cite{scharwachter2013efficient}, which leverage a bag-of-feature pipeline to improve the performance. In our multichannel framework, three channels aim at segmentation, object detection and edge detection are fused together. Related work about them are introduced respectively as follows. \subsubsection{Image Segmentation} Image segmentation aim at producing pixelwise labels to images. In neural network solution, the fully convolutional neural network \cite{long2015fully} takes the role of a watershed. Before that, patchwise training is common. Ciresan \emph{et al.} \cite{ciresan2012deep} utilize DNN to segment images of electron microscope. Farabet \emph{et al.} \cite{farabet2013learning} segment natural scene and label them. Liu \emph{et al.} \cite{liu2015crf} extract features of different patches from superpixel. Then CRF is trained to provide ultimate segmentation result. FCN \cite{long2015fully} puts forward a more efficient model to train end-to-end. After that, fully convolutional network attracts people’s attention. U-net \cite{ronneberger2015u} preserve more context information by maintaining more feature channels at up-sampling part compared to FCN. Dai \emph{et al.} \cite{dai2016instance} improve FCN model to solve instance segmentation problems. We leverage the FCN model to produce the information of probability masks, as the region channel in our framework. \subsubsection{Object Detection} Object detection problem requires a system locate objects of different classes within an image. A common deep convolutional neural network solution is usually running a classier on candidate proposals and many models have been arose and improved on the basis of it. R-CNN \cite{girshick2014rich} is a representative approach that proposals are generated by an unsupervised algorithm and classified by SVMs by features extracted by DNN. To accelerate R-CNN, fast R-CNN \cite{girshick2015fast} and faster R-CNN \cite{ren2015faster} are put forward one after another. Different from R-CNN, DeepMultiBox \cite{erhan2014scalable} generate proposals by using DNN. The network for proposal producing in OverFeat \cite{sermanet2013overfeat} share weights with network designed for classification tasks and reconcile results of classification and proposals as the ultimate result. YOLO \cite{redmon2015you} is an end-to-end model that predict proposals and class probabilities simultaneously by regard object detection problem as a single regression problem. \subsubsection{Edge detection} Approaches to computational edge detection play a fundamental role in the history of image processing. In recent years, solutions of neural network, at once flourishing and effective, bring about a new access towards solving complicated edge detection problems. HED \cite{xie15hed} earns hierarchically embedded multi-scale edge fields to account for the low-, mid-, and high- level information for contours and object boundaries. DeepEdge \cite{bertasius2015deepedge} also utilize multi-scale of image to solve this problem by using deep convolutional neural network. Ganin \emph{et al.} \cite{ganin2014n} propose an approach to solve edge detection problem by integrate the neural network with the nearest neighbor search. Shen \emph{et al.} \cite{shen2015deepcontour} propose a new loss function and improve the accuracy of counter detection via a neural network. \subsection{Previous work} Earlier conference version of our approach were presented in Xu \emph{et al.}\cite{xu2016gland}. Here we further illustrate that: (1) we add another channel - detection channel - in this paper, due to the reason that the region channel and the detection channel complement each other; (2) this framework achieves state-of-the-art results; (3) to address the problem of images with rotation invariance, we find a new data augmentation strategy that is proven to be effective. (4) ablation experiments are carried out to corroborate the effectiveness of the proposed framework. \section{Method} \label{method} In this section, we will introduce details about our framework (as shown in Fig.~\ref{model1}). By integrating the information generated from different channels, our multichannel framework is capable of instance segmentation. Aiming at solving this problem, we select three channels, foreground segmentation channel for image segmentation, object detection channel for gland detection and edge detection channel. The reason of choosing these three channels is based on the fact that information of region, contour and location contributes receptively and complimentarily to our ultimate purpose and the joint effort of them will perform much better than each of them alone. In our framework, effects of different channels are distinct. The foreground segmentation channel in our framework distinguishes the foreground and background of images. Targeted regions in pathological contains complex morphological features. It is common that glands grow close to one another. This, however, will bring about a negative effect for algorithm that the distance between two adjacent glands are too diminutive to distinguish by computer. Machines tend to conflate two glands as a whole even there do exist a gap between them. Therefore, the object detection channel is in demand of designating the bounding box of each gland to which foreground pixels in that box are belonged. In regard to the overlapping area of bounding boxes, glands boundaries are predicted by the edge detection channel. As for the area that glands are close, edge detection fails to precisely predict boundaries of glands and requires the assistance of object detection channel. Only under the joint effort of various kinds of information, can instance segmentation problem be properly solved. \begin{figure}[!t] \centering \includegraphics[width=3.4in]{model1} \caption{This illustrates a brief structure of the proposed framework. The foreground segmentation channel distinguishes glands from the background. The object detection channel detects glands and their region in the image. The edge detection channel outputs the result of boundary detection. A convolution neural network concatenates features generated by different channels and produces segmented instances.} \label{model1} \end{figure} \begin{figure*}[!t] \centering \includegraphics[width=7in]{model2} \caption{This illustrates the structure of this framework. We fuse outputs of three channels to achieve instance segmentation. For all the channels in this framework, FCN for region channel, Faster RCNN for object channel and HED for edge channel, are all based on VGG16 model, we present this classical five pooling structure in details by "Conv Net" at the top of the figure and show it briefly by a rectangular block named "Conv Net". Especially, in region and object channels, arrows pointing from "Conv Net" denotes the output of the "Conv Net", while in edge channel they represent output of deep supervisions. In the region channel, strides of the last two pooling layers of "Conv Net" are set as 1; atrous convolution being applied to convolution layers leads to the higher resolution of feature maps (as annotated in brackets). } \label{model2} \end{figure*} \subsection{Foreground Segmentation Channel} The foreground segmentation channel distinguishes glands from the background. With the arising of FCN, image segmentation become more effective thanks to the end-to-end training strategy and dense prediction on attribute-sized images. FCN replace the fully-connected layer with a convolutional layer and upsample the feature map to the same size as the original image through deconvolution thus an end-to-end training and prediction is guaranteed. Compared to the previous prevalent method sliding window in image segmentation, FCN is faster and simpler. FCN family models \cite{long2015fully,xie15hed} have achieved great accomplishment in labeling images. Usually, the FCN model can be regarded as the combination of a feature extractor and a pixel-wise predictor. Pixel-wise predictor predict probability mask of segmented images. The feature extractor is able to abstract high-level features by down-sampling and convolution. Though, useful high-level features are extracted, details of images sink in the process of max-pooling and stride convolution. Consequently, when objects are adjacent to each other, FCN may consider them as one. It is natural having FCN to solve image segmentation problems. However, instance segmentation is beyond the ability of FCN. It requires a system to differentiate instances of the same class even they are extremely close to each other. Even so, the probability mask produced by FCN still performs valuable support on solving instance segmentation problems. To compensate the resolution reduction of the feature map due to downsampling, FCN introduce the skip architecture to combine deep, semantic information and shallow, appearance information. Nevertheless, DeepLab \cite{chen2016deeplab} proposes the FCN with atrous convolution that empowers the network with the wider receptive field without downsampling. Less downsampling layer means less space-invariance brought by downsampling which is benefit to the enhancement of segmentation precision. Our foreground segmentation channel is a modified version of FCN-32s \cite{long2015fully} of which strides of pool4 and pool5 are 1 and subsequent convolution layers enlarge the receptive field by the atrous convolution. Given an input image $X$ and the parameter of FCN network is denoted as ${w}_{s}$, thus the output of FCN is \begin{equation} {P}_{s}\left(Y^{*}_{s}=k \mid X;w_{s}\right) = {\mu}_{k}\left(h_{s}\left(X,w_{s}\right)\right), \end{equation} where $\mu(\cdot)$ is the softmax function. $\mu_{k}(\cdot)$ is the output of the $k$th category and $h_{s}(\cdot)$ outputs the feature map of the hidden layer. \subsection{Object Detection Channel} The object detection channel detects glands and their locations in the image. The location of object is helpful on counting number and identifying the range of objects. According to some previous works on instance segmentation, such as MNC \cite{dai2016instance}, confirmation of the bounding-box is usually the first step towards instance segmentation. After that, segmentation and other options are carried out within bounding boxes. Though this method is highly approved, the loss of context information caused by limited receptive fields and bounding-box may exacerbate the segmentation result. Consequently, we integrate the information of location to the fusion network instead of segmenting instances within bounding boxes. To achieve the location information, Faster-RCNN, a state-of-the-art object detection model, is engaged to solve this problem. In this model, convolutional layers are proposed to extract feature maps from images. After that, Region Proposal Network (RPN) takes arbitrary-sized feature map as input and produces a set of bounding-boxes with probability of objects. Region proposals will be converted into regions of interest and classified to form the final object detection result. Filling is operated in consonance with other two channel and to annotate the overlapping area. Sizes of various channels should be the same before gathering into the fusion network. To guarantee the output size of object detection channel being in accordance with other channels, we reshape it and change the bounding box into another formation. The value of each pixel in region covered by the bounding box equals to the number of bounding boxes it belongs to. For example, if a pixel is in the public area of three bounding boxes, then the value of that pixel will be three. We denote $w_{d}$ as the parameter of Faster-RCNN and $\phi$ represents the filling operation of bounding box. The output of this channel is \begin{equation} P_{d}\left(X,w_{d}\right) = \phi\left(h_{d}\left(X,w_{d}\right)\right). \end{equation} $h_{d}\left(\cdot\right)$ is the predicted coordinate of the bounding box. \subsection{Edge Detection Channel} The edge detection channel detects boundaries between glands. The combination of merely the probability mask predicted by FCN and the location of glands tend to fuzzy boundaries of glands, especially between adjacent objects, consequently it is tough to distinguish different objects. To receive precise and clear boundaries, the information of edge is crucial which has also been proved by DCAN \cite{chen2016dcan}. The effectiveness of edge in our framework can be concluded into two aspects. Firstly, edge compensate the information loss caused by max-pooling and other operations in FCN. As a result, the contours become more precise and the morphology become more similar to the ground truth. Secondly, even if the location and the probability mask are confirmed, it is unavoidable that predicted pixel regions of adjacent objects are still connected. Edge, however, is able to differentiate them apart. As expected, the synergies among region, location and edge finally achieve the state-of-the art result. The edge channel in our model is based on Holistically-nested Edge Detector (HED) \cite{xie15hed}. It is a CNN-based solution towards edge detection. It learns hierarchically embedded multi-scale edge fields to account for the low-, mid-, and high- level information for contours and object boundaries. In edge detection task, pixels of labels are much less than pixels of back ground. The imbalance may decrease the convergence rate or even cause the non-convergence problem. To solve the problem, deep supervision \cite{lee2015deeply} and balancing of the loss between positive and negative classes are engaged. In total, there are five side supervisions which are established before each down-sampling layers. We denote $w_{e}$ as the parameter of HED, thus the $m$th prediction of deep supervision is \begin{equation} P^{(m)}_{e}(Y^{(m)*}_{e}=1 \mid X;w_{e})=\sigma(h^{(m)}_{e}(X,w_{e}). \end{equation} $\sigma(\cdot)$ denotes sigmoid function - the output layer of HED. $h^{(m)}_{e}$ represents the output of the hidden layer that relative to $m$th deep supervision. The weighted sum of M outputs of deep supervision is the final result of this channel and the weighted coefficient is $\alpha$. This process is delivered through the convolutional layer. The back propagation enables the network to learn relative importances of edge predictions under different scales. \begin{equation} P_{e}(Y^{*}_{e}=1 \mid X;w_{e},\alpha) = \sigma(\sum_{m=1}^{M}\alpha^{(m)}\cdot h^{(m)}_{e}(X,w_{e})). \end{equation} \subsection{Fusing Multichannel} Merely receiving the information of these three channels is not the ultimate purpose of our algorithm. Instance segmentation is. As a result, a fusion system is of great importance to maximize synergies of these three kinds of information above. It is hard for a non-learning algorithm to recognize the pattern of all these information. Naturally, a CNN based solution is the best choice. After obtaining outputs of these three channels, a shallow seven-layer convolutional neural network is used to combine the information and yield the final result. To reduce the information loss and ensure sufficiently large reception field, we once again replace downsampling with the atrous convolution. We denote $w_{f}$ as the parameter of this network and $h_{f}$ as the hidden layer. Thus the output of the network is \begin{equation} P_{f}\left(Y_{f}^{*}=k\mid P_{s},P_{d},P_{e};w_{f}\right)=\mu_{k}\left(h_{f}\left(P_{s},P_{d},P_{e},w_{f}\right)\right). \end{equation} \section{Experiment} \label{exp} \begin{figure*}[!t] \centering \includegraphics[width=7in]{result} \caption{From left to right: original image, ground truth, results of FCN, results of FCN with atrous convolution and results of the proposed framework. Compared to FCN, most of adjacent glandular structures are separated apart which indicates that our framework accomplishes the instance segmentation goal. However, few glands with small sizes or filled with red blood cells escape the detection of our model. The bad performance in the last row is due to the fact that in most samples, the white area is recognized as cytoplasm while in this sample, the white area is the background. } \label{result} \end{figure*} \begin{table*}[t] \centering \resizebox{\textwidth}{!}{ \begin{threeparttable}[b] \caption{Performance in Comparison to Other Methods} \begin{tabular}{c|c|c|c|c|c|c|c|c|c|c|c|c|c|c} \hline \multirow{3}{*}{Method}& \multicolumn{4}{c|}{F1 Score}& \multicolumn{4}{c|}{ObjectDice}& \multicolumn{4}{c|}{ObjectHausdorff}& \multirow{3}{*}{Rank Sum}& \multirow{3}{*}{Weighted Rank Sum}\\ \cline{2-13} &\multicolumn{2}{c|}{Part A}& \multicolumn{2}{c|}{Part B}& \multicolumn{2}{c|}{Part A}& \multicolumn{2}{c|}{Part B}& \multicolumn{2}{c|}{Part A}& \multicolumn{2}{c|}{Part B}& \\ \cline{2-13} & Score & Rank & Score & Rank & Score & Rank & Score & Rank & Score & Rank & Score & Rank & \\ \hline FCN & 0.788 & 11 & 0.764 & 4 & 0.813 & 11 & 0.796 & 4 & 95.054 & 11 & 146.2478 & 4 & 45 & 27.75 \\ \hline FCN with atrous convolution \cite{chen2016deeplab} & 0.854 & 9 & 0.798 & 2 & 0.879 & 6 & 0.825 & 2 & 62.216 & 9 & 118.734 & 2 & 30 & 19.5 \\ \hline\hline \textbf{\cellcolor[rgb]{.9,.9,.9}Ours} & \cellcolor[rgb]{.9,.9,.9}0.893 & \cellcolor[rgb]{.9,.9,.9}3 & \textbf{\cellcolor[rgb]{.9,.9,.9}0.843} & \textbf{\cellcolor[rgb]{.9,.9,.9}1} & \textbf{\cellcolor[rgb]{.9,.9,.9}0.908} & \textbf{\cellcolor[rgb]{.9,.9,.9}1} & \textbf{\cellcolor[rgb]{.9,.9,.9}0.833} & \textbf{\cellcolor[rgb]{.9,.9,.9}1} & \textbf{\cellcolor[rgb]{.9,.9,.9}44.129} & \textbf{\cellcolor[rgb]{.9,.9,.9}1} & \textbf{\cellcolor[rgb]{.9,.9,.9}116.821} & \textbf{\cellcolor[rgb]{.9,.9,.9}1} & \cellcolor[rgb]{.9,.9,.9}8 & \cellcolor[rgb]{.9,.9,.9}4.5\\ \hline CUMedVision2 \cite{chen2016dcan} & \textbf{0.912} & \textbf{1} & 0.716 & 6 & 0.897 & 2 & 0.781 & 8 & 45.418 & 2 & 160.347 & 9 & 28 & 9.5\\ \hline ExB3 & 0.896 & 2 & 0.719 & 5 & 0.886 & 3 & 0.765 & 9 & 57.350 & 6 & 159.873 & 8 & 33 & 13.75\\ \hline ExB2 & 0.892 & 4 & 0.686 & 9 & 0.884 & 4 & 0.754 & 10 & 54.785 & 3 & 187.442 & 11 & 41 & 15.75\\ \hline ExB1 & 0.891 & 5 & 0.703 & 7 & 0.882 & 5 & 0.786 & 5 & 57.413 & 7 & 145.575 & 3 & 32 & 16.5\\ \hline Frerburg2 \cite{ronneberger2015u} & 0.870 & 6 & 0.695 & 8 & 0.876 & 7 & 0.786 & 6 & 57.093 & 4 & 148.463 & 6 & 37 & 17.75\\ \hline Frerburg1 \cite{ronneberger2015u} & 0.834 & 10 & 0.605 & 11 & 0.875 & 8 & 0.783 & 7 & 57.194 & 5 & 146.607 & 5 & 46 & 23\\ \hline CUMedVision1 \cite{chen2016dcan} & 0.868 & 7 & 0.769 & 3 & 0.867 & 10 & 0.800 & 3 & 74.596 & 10 & 153.646 & 7 & 40 & 23.5\\ \hline CVIP Dundee & 0.863 & 8 & 0.633 & 10 & 0.870 & 9 & 0.715 & 11 & 58.339 & 8 & 209.048 & 13 & 59 & 27.25\\ \hline LIB & 0.777 & 12 & 0.306 & 14 & 0.781 & 12 & 0.617 & 13 & 112.706 & 13 & 190.447 & 12 & 76 & 37.5\\ \hline CVML & 0.652 & 13 & 0.541 & 12 & 0.644 & 14 & 0.654 & 12 & 155.433 & 14 & 176.244 & 10 & 75 & 39.25\\ \hline vision4GlaS & 0.635 & 14 & 0.527 & 13 & 0.737 & 13 & 0.610 & 14 & 107.491 & 12 & 210.105 & 14 & 80 & 39.5\\ \hline \end{tabular}\end{threeparttable}} \label{table} \end{table*} \subsection{Dataset} Our method is evaluated on the dataset provided by MICCAI 2015 Gland Segmentation Challenge Contest \cite{sirinukunwattana2016gland, sirinukunwattana2015stochastic}. The dataset consists of 165 labeled colorectal cancer histological images scanned by Zeiss MIRAX MIDI. The resolution of the image is approximately 0.62μm per pixel. 85 images belong to training set and 80 affiliate to test sets (test A contains 60 images and test B contains 20 images). There are 37 benign sections and 48 malignant ones in training set, 33 benign sections and 27 malignant ones in testing set A and 4 benign sections and 16 malignant ones in testing set B.\subsection{Data augmentation and Processing} We first preprocess data by performing per channel zero mean. The next step is to generate edge labels from region labels and perform dilation to edge labels afterward. Whether pixel is edge or not is decided by four nearest pixels (over, below, right and left) in region label. If all four pixels in region channel belongs to foreground or all of them belongs to background, then this pixel is regarded as edge. To enhance performance and combat overfitting, copious training data are needed. Given the circumstance of the absence of large dataset, data augmentation is essential before training. Two strategies of data augmentation has been carried out and the improvement of results is a strong evidence to prove the efficiency of data augmentation. In Strategy \uppercase\expandafter{\romannumeral1}, horizontal flipping and rotation operation ($0^\circ$, $90^\circ$, $180^\circ$, $270^\circ$) are used in the training images. Besides operations in Strategy \uppercase\expandafter{\romannumeral1}, Strategy \uppercase\expandafter{\romannumeral2} also includes sinusoidal transformation, pin cushion transformation and shear transformation. Deformation of original images is beneficial to the increasement of robustness and the promotion of final result. After data augmentation, a $400 \times 400$ region is cropped from the original image as input. \subsection{Evaluation} Evaluation method is the same as the competition goes. Three indicators are involved to evaluate performance on test A and test B. Indicators assess detection result respectively, segmentation performance and shape similarity. Final score is the summation of six rankings and the smaller the better. Since image amounts of test A and test B are of great difference, we not only calculate the rank sum as the host of MICCAI 2015 Gland Segmentation Challenge Contest demands, but we also list the weighted rank sum. The weighted rank sum is calculated as: \begin{equation} Weighted RS=\frac{3}{4}\sum test A Rank+\frac{1}{4}\sum test B Rank. \end{equation} The program for evaluation is given by MICCAI 2015 Gland Segmentation Challenge Contest \cite{sirinukunwattana2016gland, sirinukunwattana2015stochastic}. The first criterion for evaluation reflets the accuracy of gland detection which is called F1score. The segmented glandular object of True Positive (TP) is the object that shares more than 50\% areas with the ground truth. Otherwise, the segmented area will be determined as False Positive (FP). Objects of ground truth without corresponding prediction are considered as False Negative (FN). \begin{equation} F1score = \frac{2\cdot Precision\cdot Recall}{Precision + Recall} \end{equation} \begin{equation} Precision = \frac{TP}{TP+FP} \end{equation} \begin{equation} Recall=\frac{TP}{TP+FN} \end{equation} Dice is the second criterion for evaluating the performance of segmentation. Dice index of the whole image is \begin{equation} D(G,S)=\frac{2(\mid G\cap S\mid)}{\mid G\mid +\mid S\mid}, \end{equation} of which G represents the ground truth and S is the segmented result. However, it is not able to differentiate instances of same class. As a result, object-level dice score is employed to evaluate the segmentation result. The definition is as follows: \begin{equation} D_{object}(G,S)=\frac{1}{2}\left[\sum_{i=1}^{n_{S}}w_{i}D(G_{i},S_{i})+\sum_{j=1}^{n_{G}}\widetilde{w}_{j}D(\widetilde{G}_{i},\widetilde{S}_{i})\right], \end{equation} \begin{equation} w_{i}=\frac{\mid S_{i}\mid}{\sum_{j=1}^{n_{S}}\mid S_{j}\mid}, \end{equation} \begin{equation} \widetilde{w}_{i}=\frac{\mid \widetilde{G}_{i}\mid}{\sum_{j=1}^{n_{G}}\mid \widetilde{G}_{j} \mid}. \end{equation} $n_{S}$ and $n_{G}$ are the number of instances in the segmented result and ground truth. Shape similarity reflects the performance on morphology likelihood which plays a significant role in gland segmentation. Hausdorff distance is exploited to evaluate the shape similarity. To assess glands respectively, the index of Hausdorff distance deforms from the original formation: \begin{equation} H(G,S)=\mathrm{max}\left\{\underset{x\epsilon G}{sup} \underset{y\epsilon S}{inf}\left\|x-y\right\|,\underset{y\epsilon S}{sup} \underset{x\epsilon G}{inf}\left\|x-y\right\|\right\}, \end{equation} to the object-level formation: \begin{equation} H_{object}(S,G)=\frac{1}{2}\left[\sum_{i=1}^{n_{s}}w_{i}H(G_{i},S_{i})+\sum_{i=1}^{n_{G}}\widetilde{w}_{i}H(\widetilde{G}_{i},\widetilde{S}_{i})\right], \end{equation} where \begin{equation} w_{i}=\frac{|S_{i}|}{\sum_{j=1}^{n_{S}}|S_{j}|}, \end{equation} \begin{equation} \widetilde{w}_{i}=\frac{|\widetilde{G}_{i}|}{\sum_{j=1}^{n_{G}}|\widetilde{G}_{j}|}. \end{equation} Similar to object-level dice index $n_{S}$ and $n_{G}$ represents instances of segmented objects and ground truth. \subsection{Result and Discussion}Our framework performs well on datasets provided by MICCAI 2015 Gland Segmentation Challenge Contest and achieves the state-of-the-art result (as listed in Table \uppercase\expandafter{\romannumeral1}) among all participants \cite{sirinukunwattana2016gland}. We rearrange the scores and ranks in this table. Our method outranks FCN and other participants \cite{sirinukunwattana2016gland} based on both rank sum and weighted rank sum. Compared to FCN and FCN with atrous convolution, our framework obtains better score which is a convincing evidence that our work is more effective in solving instance segmentation problem in histological images. Though, FCN with atrous convolution performs better than FCN, for atrous convolution process less poolings and covers larger receptive fields, our framework combines information of region, location and edge to achieve higher score in the dataset. The reason why our framework rank higher, is because most of the adjacent glandular structures have been separated apart, so that more beneficial to meet the evaluation index of instance segmentation, while in FCN and FCN with atrous convolution they are not. Results of comparision are illustrated in Fig.~\ref{result}. \begin{table*}[t] \centering \caption{Comparison with instance segmentation methods} \begin{tabular}{c|c|c|c|c|c|c} \hline \multirow{2}{*}{Method} & \multicolumn{2}{c|}{F1 Score} & \multicolumn{2}{c|}{ObjectDice} & \multicolumn{2}{c}{ObjectHausdorff} \\ \cline{2-7} & Part A & Part B & Part A & Part B & Part A & Part B\\ \hline HyperColumn \cite{hariharan2015hypercolumns} & 0.852 & 0.691 & 0.742 & 0.653 & 119.441 & 190.384\\ \hline MNC \cite{dai2015instance} & 0.856 & 0.701 & 0.793 & 0.705 & 85.208 & 190.323\\ \hline SDS \cite{hariharan2014simultaneous} & 0.545 & 0.322 & 0.647 & 0.495 & 116.833 & 229.853\\ \hline BOX-$>$FCN with atrous convolution+EDGE3 & 0.807 & 0.700 & 0.790 & 0.696 & 114.230 & 197.360\\ \hline \cellcolor[rgb]{.9,.9,.9}OURS & \cellcolor[rgb]{.9,.9,.9}\textbf{0.893} & \cellcolor[rgb]{.9,.9,.9}\textbf{0.843} & \cellcolor[rgb]{.9,.9,.9}\textbf{0.908} & \cellcolor[rgb]{.9,.9,.9}\textbf{0.833} & \cellcolor[rgb]{.9,.9,.9}\textbf{44.129} & \cellcolor[rgb]{.9,.9,.9}\textbf{116.821}\\ \hline \end{tabular} \end{table*} \begin{table*} \centering \caption{Data Augmentation Strategy comparison} \begin{tabular}{c|c|c|c|c|c|c|c} \hline \multirow{2}{*}{Strategy} & \multirow{2}{*}{Method} & \multicolumn{2}{c|}{F1 Score} & \multicolumn{2}{c|}{ObjectDice} & \multicolumn{2}{c}{ObjectHausdorff} \\ \cline{3-8} & & Part A & Part B & Part A & Part B & Part A & Part B\\ \hline \multirow{2}{*}{Strategy \uppercase\expandafter{\romannumeral1}} & FCN & 0.709 & 0.708 & 0.748 & 0.779 & 129.941 & 159.639\\ \cline{2-8} & FCN with atrous convolution \cite{chen2016deeplab} & 0.820 & 0.749 & 0.843 & 0.811 & 79.768 & 131.639\\ \hline \multirow{2}{*}{Strategy \uppercase\expandafter{\romannumeral2}} & FCN & 0.788 & 0.764 & 0.813 & 0.796 & 95.054 & 146.248\\ \cline{2-8} & FCN with atrous convolution \cite{chen2016deeplab} & \textbf{0.854} & \textbf{0.798} & \textbf{0.879} & \textbf{0.825} & \textbf{62.216} & \textbf{118.734}\\ \hline \end{tabular} \end{table*} \begin{table*}[t] \centering \caption{Plausibility of Channels. We denote AMC as fusion network with atrous convolution and MC as fusion network without atrous convolution. EDGE1 represents that edge label are not dilated while EDGE3 signifies edge label dilated by a disk filter with radius 3. BOX detnotes the bounding box.} \begin{tabular}{c|c|c|c|c|c|c} \hline \multirow{2}{*}{Method} & \multicolumn{2}{c|}{F1 Score} & \multicolumn{2}{c|}{ObjectDice} & \multicolumn{2}{c}{ObjectHausdorff} \\ \cline{2-7} & Part A & Part B & Part A & Part B & Part A & Part B\\ \hline MC: FCN + EDGE1 + BOX & 0.863 & 0.784 & 0.884 & 0.833 & 57.519 & 108.825\\ \hline MC: FCN + EDGE3 + BOX & 0.886 & 0.795 & 0.901 & 0.840 & 49.578 & 100.681\\ \hline MC: FCN with atrous convolution + EDGE3 + BOX & 0.890 & 0.816 & \textbf{0.905} & 0.841 & 47.081 & 107.413\\ \hline \hline AMC: FCN + EDGE3 + BOX & \textbf{0.893} & 0.803 & 0.903 & \textbf{0.846} & 47.510 & \textbf{97.440}\\ \hline AMC: FCN with atrous convolution + EDGE3 + BOX & \textbf{0.893} & \textbf{0.843} & 0.908 & 0.833 & \textbf{44.129} & 116.821\\ \hline AMC: FCN with atrous convolution + EDGE1 + BOX & 0.876 & 0.824 & 0.894 & 0.826 & 50.028 & 123.881\\ \hline \hline AMC: FCN with atrous convolution + BOX & 0.876 & 0.815 & 0.893 & 0.808 & 50.823 & 132.816\\ \hline AMC: FCN with atrous convolution + EDGE3 & 0.874 & 0.816 & 0.904 & 0.832 & 46.307 & 109.174\\ \hline \end{tabular} \end{table*} Ranks of test A are higher than test B in general due to the inconsistency of data distribution. In test A, most images are the normal ones while test B contains a majority of cancerous images which are more complicated in shape and lager in size. Hence, a larger receptive field is required in order to detect cancerous glands. However, before we exploit the atrous convolution algorithm, the downsampling layer not only gives the network larger receptive field but also make the resolution of the feature map decreases thus the segmentation result becomes worse. The atrous convolution algorithm empower the convolutional neural network with larger receptive field with less downsampling layers. Our multichannel framework enhances the performance based on the FCN with atrous convolution by adding two channels - edge detection channel and object detection channel. Since the differences between background and foreground in histopathological image are small (3th row of Fig.~\ref{result}), FCN and FCN with atrous convolution sometimes predict the background pixel as gland thus raise the false positive rate. The multichannel framework abates the false positive by adding context of pixel while predicting object location. Compared to CUMedVision1 \cite{chen2016dcan}, CUMedVision2 \cite{chen2016dcan} add the edge information thus results of test A improve yet those of test B deteriorate. But our method improves both results of test A and test B after combine the context of edge and location. However, white regions in gland histopathological images are of two kinds: 1) cytoplasm; and 2) there is no cell or tissue (background). The difference between these two kinds is that cytoplasm usually appears surrounded by nuclei or other stained tissue. In the image of the last row in Fig.~\ref{result}, glands encircles white regions without cell or tissue causing that the machine mistakes them as cytoplasm. As for images of the 4th and 5th row in Fig.~\ref{result}, glands are split when cutting images, which is the reason that cytoplasm is mistaken as the background. \textbf{Comparison with instance segmentation methods} Currently, methods suitable for instance segmentation of images of natural scenes predict instances based on detection or proposal, such as SDS \cite{hariharan2014simultaneous}, Hypercolumn \cite{hariharan2015hypercolumns} and MNC \cite{dai2015instance}. One defect of this logic is its dependence on the precision of detection or proposal. If the object escapes the detection, it would evade the subsequent segmentation as well. Besides, the segmentation being restricted to a certain bounding box would have little access to context information hence impact the result. Under the condition of bounding boxes overlapping one another, which instance does the pixel in the overlapping region belongs to cannot be determined. The overlapping area falls into the category of the nearest gland in our experiment. To further demonstrate the defect of the cascade architecture, we designed a baseline experiment. We first perform gland detection then segment gland instances inside bounding boxes. There is a shallow network (same as the fusion network) combines the information of foreground segmentation and edge detection to generate the final result. Configurations of all experiments are set the same as our method. Results are showed in Table \uppercase\expandafter{\romannumeral2} and prove to be less effective than the proposed framework. \subsection{Ablation Experiment} \subsubsection{Data Augmentation Strategy} To enhance performance and combat overfitting, data augmentation is essential before training. We observe through experiments that adequate transformation of gland images is beneficial to training. This is because that glands are in various shape naturally and cancerous glands are more different in morphology. Here we evaluate the effect on results of foreground segmentation channel using Strategy \uppercase\expandafter{\romannumeral1} and Strategy \uppercase\expandafter{\romannumeral2}. We present the results in Table \uppercase\expandafter{\romannumeral3}. \subsubsection{Plausibility of Channels} In the convolutional neural network, the main purpose of downsampling is to enlarge the receptive field yet at a cost of decreased resolution and information loss of original data. Feature maps with low resolution would increase the difficulty of upsample layer training. The representational ability of feature maps is reduced after upsampling and further lead to inferior segmentation result. Another drawback of downsampling is the space invariance it introduced while segmentation is space sensitive. The inconsistence between downsampling and image segmentation is obvious. The atrous convolution algorithm empower the convolutional neural network with larger receptive field with less downsampling layers. The comparison between segmentation performances of FCN with and without the atrous convolution shows the effectiveness of it in enhancing the segmentation precision. The foreground segmentation channel with the FCN with atrous convolution improves the performance of the multichannel framework. So does the fusion stage with the atrous convolution. Pixels belonged to edge occupy a extremely small proportion of the whole image. The imbalance between edge and non-edge poses a severe threat to the network training that may lead to non convergence. Edge dilation can alleviate the imbalance in a certain way and improve the edge detection precision. To prove that these three channels truly improve the performance of instance segmentation, we conduct the following two baseline experiments: a) merely launch foreground segmentation channel and edge detection channel; b) merely launch foreground segmentation channel and object detection channel. The results is in favor of the three-channel framework with no surprise. Results of experiments mentioned above are presented in Table \uppercase\expandafter{\romannumeral4}. \section{Conclusion} \label{con} We propose a new framework called deep multichannel neural networks which achieves state-of-the-art results in MICCAI 2015 Gland Segmentation Challenge. The universal framework extracts features of edge, region and location then concatenate them together to generate the result of instance segmentation. In future work, this algorithm can be expanded in instance segmentation of medical images. \section*{Acknowledgment} This work is supported by Microsoft Research under the eHealth program, the Beijing National Science Foundation in China under Grant 4152033, the Technology and Innovation Commission of Shenzhen in China under Grant shenfagai2016-627, Beijing Young Talent Project in China, the Fundamental Research Funds for the Central Universities of China under Grant SKLSDE-2015ZX-27 from the State Key Laboratory of Software Development Environment in Beihang University in China. \ifCLASSOPTIONcaptionsoff \newpage \fi \bibliographystyle{IEEEtran}
{'timestamp': '2016-07-20T02:11:16', 'yymm': '1607', 'arxiv_id': '1607.04889', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04889'}
arxiv
\section{Conclusion} \label{sec:conclusion} We have described \sys, a system for proving equivalence of SQL rewrite rules. In support of \sys, we defined a formal language \sem, following closely SQL's syntax. Our semantics extends that of SQL from finite relations to infinite relations, and uses univalent types from Homotopy Type Theory to represent and prove equality of cardinal numbers (finite and infinite). We have demonstrated the power and flexibility of \sys by proving the correctness of several powerful optimization rules found in the database literature. \section{Denotation of \sem} \label{sec:denotation} In this section we define the denotational semantics of \sem. We first discuss the translation of \sem constructs into \outputLang. Then, in~\secref{more-sql}, we describe how advanced features of SQL (such as integrity constraints and indexes) can be expressed using \sem and subsequently translated. Figure~\ref{fig:denote-query} shows the translation of \sem to \outputLang. The translation rules make use of contexts. A {\em context schema} $\Gamma$ is a schema (see the definition of $\texttt{Schema}$ in Fig.~\ref{fig:data-model}); a {\em context} $g$ is a tuple of type $\texttt{Tuple}\; \Gamma$ associated to that schema. Intuitively, the context consists of the concatenation of all tuple variables occurring in a surrounding scope. For example, consider the \sem query with correlated subqueries in~\figref{contexts} where path expressions are used to refer to relations in predicates, as discussed in~\secref{data-model}. As in standard SQL, evaluation proceeds from the outermost to the innermost query, starting with query $q_1$. After the \texttt{FROM} clause in $q_1$ is processed, the context consists of $R_1$'s schema ($\sigma_{R_1}$), which is then passed to the query $q_2$. In turn, $q_2$ then processes its \texttt{FROM} clause, and appends the schema of $R_2$ to the context ($\node{\sigma_{R_1}}{\sigma_{R_2}}$), and this context is used to evaluate the path expression $q_2$'s predicate (\texttt{right.$k$ = left.$k$}, i.e., \texttt{$R_1$.k = $R_2$.k}), and similarly when $q_3$ evaluates its predicate. In our system, contexts are implemented as tuples. To make passing of contexts explicit, in the following, each \sem construct takes in a context tuple (represented by {\tt Tuple $\Gamma$}), and is translated to functions that take in both a tuple ($t$) and a context tuple ($g$). \begin{figure} \begin{small} \[ \begin{array}{ll} \texttt{SELECT $*$ FROM $R_1$ WHERE} & q_1 \\ \quad {\color{blue}\texttt {-- predicate in $q_2$: $R_2$.b = $R_1$.a }} & \\ \quad \texttt {EXISTS SELECT $*$ FROM $R_2$ WHERE right.$p_2$=left.$p_1$ AND} & q_2\\ \qquad {\color{blue}\texttt {-- predicate in $q_3$: $R_3$.c=$R_2$.b }} & \\ \qquad \texttt{EXISTS SELECT $*$ FROM $R_3$} & \\ \hspace{0.7in} \texttt{WHERE right.$p_3$=left.right.$p_2$} & q_3 \end{array} \] \end{small} \hrule \vspace{0.1in} \centering \begin{tabular}{|c|l|}\hline Query & Context schema \\ \hline init & \texttt{$\Gamma_0$=empty} \\ \hline $q_1$ & \texttt{$\Gamma_1$=node $\Gamma_0$ $\sigma_{R_1}$} \\ \hline $q_2$ & \texttt{$\Gamma_2$=node $\Gamma_1$ $\sigma_{R_2}$} \\ \hline $q_3$ & \texttt{$\Gamma_3$=node $\Gamma_2$ $\sigma_{R_3}$} \\ \hline \end{tabular} \figlabel{contexts} \caption{Using Contexts in Evaluating Correlated Subqueries} \end{figure} \subsection{Denoting Basic HoTTSQL Constructs} \begin{figure*}[t] \centering \[ \begin{array}{llll} \multicolumn{3}{l}{ \framebox[1.1\width]{ $\denoteQuery{\Gamma}{q}{\sigma} : \texttt{Tuple} \; \Gamma \rightarrow \texttt{Tuple} \; \sigma \rightarrow \mathcal{U} $} } & \texttt{(* $Query$ *)} \\ \\ \denoteQuery{\Gamma}{table}{\sigma} & \triangleq & \lambda \; \context \; \tuple. \; \denoteTable{table} \; t \\ \denoteQuery{\Gamma}{\SELECT{p}{q}}{\sigma} & \triangleq & \multicolumn{2}{l}{ \lambda \; \context \; \tuple. \; \sum_{t':\texttt{Tuple} \; \sigma'}{ (\denoteProj{p}{\node{\Gamma}{\sigma'}}{\sigma} \; \mkPair{g}{t'} = t) \times \denoteQuery{\Gamma}{q}{\sigma'}} \; g \; t'} \\ \denoteQuery{\Gamma}{\FROM{q_1, q_2}}{\node{\sigma_1}{\sigma_2}} & \triangleq & \lambda \; \context \; \tuple. \; \denoteQuery{\Gamma}{q_1}{\sigma_1} \; g \; \fst{t} \times \denoteQuery{\Gamma}{q_2}{\sigma_2} \; g \; \snd{t} \\ \denoteQuery{\Gamma}{\FROM{q}}{\sigma} & \triangleq & \lambda \; \context \; \tuple. \; \callQuery{\Gamma}{q}{\sigma} \\ \denoteQuery{\Gamma}{\WHERE{q}{b}}{\sigma} & \triangleq & \lambda \; \context \; \tuple. \; \callQuery{\Gamma}{q}{\sigma} \times \denotePred{\node{\Gamma}{\sigma}}{b} \; \mkPair{g}{t} \\ \denoteQuery{\Gamma}{\UNIONALL{q_1}{q_2}}{\sigma} & \triangleq & \lambda \; \context \; \tuple. \; \callQuery{\Gamma}{q_1}{\sigma} + \callQuery{\Gamma}{q_2}{\sigma} \\ \denoteQuery{\Gamma}{\EXCEPT{q_1}{q_2}}{\sigma} & \triangleq & \lambda \; \context \; \tuple. \; \callQuery{\Gamma}{q_1}{\sigma} \times (\negate{(\callQuery{\Gamma}{q_2}{\sigma})}) \\ \denoteQuery{\Gamma}{\DISTINCT{q}}{\sigma} & \triangleq & \lambda \; \context \; \tuple. \; \merely{\callQuery{\Gamma}{q}{\sigma}} \\ \\ \multicolumn{3}{l}{ \framebox[1.1\width]{$ \denotePred{\Gamma}{b} : \texttt{Tuple} \; \Gamma \rightarrow \mathcal{U} $ } } & \texttt{(* $Predicate$ *)}\\ \\ \denotePred{\Gamma}{e_1 = e_2} & \triangleq & \lambda \; \context. \;(\callExpr{\Gamma}{e_1}{\tau} = \callExpr{\Gamma}{e_2}{\tau}) \\ \denotePred{\Gamma}{\AND{b_1}{b_2}} & \triangleq & \lambda \; \context. \; \callPred{\Gamma}{b_1} \times \callPred{\Gamma}{b_2} \\ \denotePred{\Gamma}{\OR{b_1}{b_2}} & \triangleq & \lambda \; \context. \; \merely{\callPred{\Gamma}{b_1} + \callPred{\Gamma}{b_2}} \\ \denotePred{\Gamma}{\NOT{b}} & \triangleq & \lambda \; \context. \; \negate{(\callPred{\Gamma}{b})} \\ \denotePred{\Gamma}{\EXISTS{q}} & \triangleq & \lambda \; \context. \; \merely{\sum_{t:\texttt{Tuple} \; \sigma}{\callQuery{\Gamma}{q}{\sigma}}} \\ \denotePred{\Gamma}{\texttt{FALSE}} & \triangleq & \lambda \; \context. \; \textbf{0} \\ \denotePred{\Gamma}{\texttt{TRUE}} & \triangleq & \lambda \; \context. \; \textbf{1} \\ \denotePred{\Gamma}{\CastPred{p}{b}} & \triangleq & \lambda \; \context. \; \denotePred{\Gamma'}{b} \; (\denoteProj{p}{\Gamma}{\Gamma'} \; g) \\ \\ \multicolumn{3}{l}{ \framebox[1.1\width]{$ \denoteExpr{\Gamma}{e}{\tau} : \texttt{Tuple} \; \Gamma \rightarrow \denote{\tau} $} } & \texttt{(* $Expression$ *)} \\ \\ \denoteExpr{\Gamma}{\Var \; p}{\tau} & \triangleq & \lambda \; \context. \; \denoteProj{p}{\Gamma}{\leaf \; \tau} \; g \\ \denoteExpr{\Gamma}{f(e_1, \ldots)}{\tau} & \triangleq & \lambda \; \context. \; \denote{f}(\callExpr{\Gamma}{e_1}{\tau_1}, \ldots ) \\ \denoteExpr{\Gamma}{agg(q)}{\tau'} & \triangleq & \lambda \; \context. \; \denote{agg} \; ( \denoteQuery{\Gamma}{q}{\leaf \; \tau} \; g ) \\ \denoteExpr{\Gamma}{\CastExpr{p}{e}}{\tau} & \triangleq & \lambda \; \context. \; \denoteExpr{\Gamma'}{e}{\tau} \; (\denoteProj{c}{\Gamma}{\Gamma'} \; g) \\ \\ \multicolumn{3}{l}{ \framebox[1.1\width]{$ \denoteProj{p}{\Gamma}{\Gamma'} : \texttt{Tuple} \; \Gamma \rightarrow \texttt{Tuple} \; \Gamma'$ } } & \texttt{(* $Projection$ *)} \\ \\ \denoteProj{*}{\Gamma}{\Gamma} & \triangleq & \lambda \; \context. \; g \\ \denoteProj{\texttt{Left}}{\node{\Gamma_0}{\Gamma_1}}{\Gamma_0} & \triangleq & \lambda \; \context. \; \fst{g} \\ \denoteProj{\texttt{Right}}{\node{\Gamma_0}{\Gamma_1}}{\Gamma_1} & \triangleq & \lambda \; \context. \; \snd{g} \\ \denoteProj{\texttt{Empty}}{\Gamma}{\texttt{empty}} & \triangleq & \lambda \; \context. \; \texttt{unit} \\ \denoteProj{\Compose{p_1}{p_2}}{\Gamma}{\Gamma''} & \triangleq & \lambda \; \context. \; \denoteProj{p_2}{\Gamma'}{\Gamma''}\;(\denoteProj{p_1}{\Gamma}{\Gamma'} \; g) \\ \denoteProj{\Duplicate{p_1}{p_2}}{\Gamma}{\node{\Gamma_0}{\Gamma_1}} & \triangleq & \lambda \; \context. \; (\denoteProj{p_1}{\Gamma}{\Gamma_0} \; g, \; \denoteProj{p_2}{\Gamma}{\Gamma_1} \; g) \\ \denoteProj{\Evaluate{e}}{\Gamma}{\leaf \; \tau} & \triangleq & \lambda \; \context. \; \callExpr{\Gamma}{e}{\tau} \\ \end{array} \] \caption{Denotational Semantics of \inputLang} \label{fig:denote-query} \end{figure*} \paragraph{Queries} A query $q$ is denoted to a function from $q$'s context tuple (of type $\texttt{Tuple} \; \Gamma$) to a HoTT-Relation (of type \( \texttt{Tuple} \; \sigma \rightarrow \mathcal{U} \)): \[ \denoteQuery{\Gamma}{q}{\sigma}: Tuple \; \Gamma \rightarrow Tuple \; \sigma \rightarrow \mathcal{U} \] The \texttt{FROM} clause is recursively denoted to a series of cross products of HoTT-Relations. Each cross product is denoted using $\times$ as shown in Section~\ref{sec:target-lang}. For example: \[ \begin{array}{ll} \denoteQuery{\Gamma}{\FROM{q_1 , \; q_2}}{\sigma} & \triangleq \\ \lambda \; \context \; \tuple. \; (\denoteQuery{\Gamma}{q_1}{\sigma} \; g \; \fst{t}) \times (\denoteQuery{\Gamma}{q_2}{\sigma} \; g \; \snd{t}) \end{array} \] \noindent where $\fst{t}$ and $\snd{t}$ indexes into the context tuple $\Gamma$ to retrieve the schemas of $q_1$ and $q_2$ respectively. Note the manipulation of the context tuple in the denotation of \texttt{WHERE}: for each tuple $t$, we first evaluate $t$ against the query before \texttt{WHERE}, using the context tuple $g$. After that, we evaluate the predicate $b$ by first constructing a new context tuple as discussed (namely, by concatenating $\Gamma$ and $\sigma$, the schema of $q$), passing it the combined tuple $(g,t)$. The combination is needed as $t$ has schema $\sigma$ while the predicate $b$ is evaluated under the schema $\node{\Gamma}{\sigma}$, and the combination is easily accomplished as $g$, the context tuple, has schema $\Gamma$. \texttt{UNION ALL}, \texttt{EXCEPT}, and \texttt{DISTINCT} are denoted using +, negation ($\negate{n}$) and merely ($\merely{n}$) on univalent types as shown in Section~\ref{sec:target-lang}. \paragraph{Predicates} A predicate $b$ is denoted to a function from a tuple (of type $\texttt{Tuple} \; \Gamma$) to a univalent type (of type $\mathcal{U}$): \[ \denotePred{\Gamma}{b} : \texttt{Tuple} \; \Gamma \rightarrow \mathcal{U} \] \noindent More specifically, the return type $\mathcal{U}$ must be a \emph{squash type}~\cite[Ch. 3.3]{hottBook}. A squash type can only be a type of 1 element, namely \textbf{1}, and a type of 0 element, namely \textbf{0}. \inputLang program with the form \texttt{$q$ WHERE $b$} is denoted to the Cartesian product between a univalent type and a mere proposition. As an example, suppose a particular tuple $t$ has multiplicity 3 in query $q$, i.e., $q\; t = \denote{R}{t} = {\bf 3}$, where ${\bf 3}$ is a univalent type. Since predicates are denoted to propositions, applying the tuple to the predicate returns either ${\bf 1}$ or ${\bf 0}$, and the overall result of the query for tuple $t$ is then either ${\bf 3} \times {\bf 0} = {\bf 0}$, or ${\bf 3} \times {\bf 1} = {\bf 1}$, i.e., a squash type. \paragraph{Expressions and Projections} A value expression $e$ is denoted to a function from a tuple (of type $\texttt{Tuple} \; \Gamma$) to its data type, such as {\tt int} and {\tt bool} \ ($\denote{\tau}$): \[ \denoteExpr{\Gamma}{e}{\tau} : \texttt{Tuple} \; \Gamma \rightarrow \denote{\tau} \] \noindent A projection $p$ from $\Gamma$ to $\Gamma'$ is denoted to a function from a tuple of type $\texttt{Tuple} \; \Gamma$ to a tuple of type $\texttt{Tuple} \; \Gamma'$. \[\denoteProj{p}{\Gamma}{\Gamma'} : \texttt{Tuple} \; \Gamma \rightarrow \texttt{Tuple} \; \Gamma'\] Projections are recursively defined. A projection can be composed by two projections using ``{\tt .}''. The composition of two projection, ``$\Compose{p_1}{p_2}$'', where $p_1$ is a projection from $\Gamma$ to $\Gamma'$ and $p_2$ is a projection from $\Gamma'$ to $\Gamma''$, is denoted to a function from a tuple of type $\texttt{Tuple} \; \Gamma$ to a tuple of type $\texttt{Tuple} \; \Gamma''$ as follows: \[\lambda \; \context. \; \denoteProj{p_2}{\Gamma'}{\Gamma''}\;(\denoteProj{p_1}{\Gamma}{\Gamma'} \; g) \] We apply the denotation of $p_1$, which is a function of type $\texttt{Tuple}\;\Gamma \rightarrow \texttt{Tuple} \; \Gamma'$, to the argument of composed projection $g$, then apply the denotation of $p_2$ to the result of application. A projection can also be combined by two projections using ``{\tt ,}''. The combining of two projection, $\Duplicate{p_1}{p_2}$, is denoted to: \[ \lambda \; \context. \; (\denoteProj{p_1}{\Gamma}{\Gamma_0} \; g, \; \denoteProj{p_2}{\Gamma}{\Gamma_1} \; g) \] % where we apply the denotation of $p_1$ and the denotation of $p_2$ to the argument of combined projection ($g$) separately, and combine their results using the constructor of a pair. \subsection{Denoting Derived HoTTSQL Constructs} \label{sec:more-sql} \sem supports additional SQL features including group by, integrity constraints, and index. All such features are commonly utilized in query optimization. \paragraph{Grouping} Grouping is a widely-used relational operator that projects rows with a common value into separate groups, and applies an aggregation function (e.g., average) to each group. In SQL, this is supported via the \texttt{GROUP BY} operator that takes in the attribute names to form groups. \sem supports grouping by de-sugaring \texttt{GROUP BY} using correlated subqueries that returns a single attribute relation, and applying aggregation function to the resulting relation~\cite{BunemanLSTW94SIGMOD}. Below is an example of such rewrite expressed using SQL: \[ \begin{array}{ll} \texttt{SELECT $k$, SUM($g$) FROM $R$ GROUP BY $k$} \vspace{0.05in} \\ \vspace{0.05in}\hspace{0.8in} \text{rewrites to} \Downarrow \\ \texttt{SELECT DISTINCT $k$, SUM( SELECT $g$ FROM $R$} \\ \qquad \qquad \qquad \qquad \qquad \quad \;\; \texttt{ WHERE $R.k = R_1.k$)} \\ \texttt{FROM $R$ AS $R_1$} \end{array} \] \noindent We will illustrate using grouping in rewrite rules in~\secref{agg-rule}. \paragraph{Integrity Constraints} Integrity constraints are used in real-world database systems and facilitate various semantics-based query optimizations~\cite{DarFJST96}. \sem supports two important integrity constraints: keys and functional dependency, through syntactic rewrite. A {\em key constraint} requires an attribute to have unique values among all tuples in a relation. In \sem, a projection $k$ is a key to the relation $R$ if the following holds: \[ \begin{array}{l} \texttt{key ($k$) ($R$)} := \\ \qquad \denoteQuery{\texttt{empty}}{\texttt{SELECT * FROM $R$}}{\sigma} = \\ \qquad \llbracket \texttt{empty} \vdash \texttt{SELECT Left.* FROM $R$, $R$} \\ \qquad \texttt{ WHERE (\Var{Right.Left.$k$}) = (\Var{Right.Right.$k$)}}: \sigma \rrbracket \end{array} \] To see why this definition satisfies the key constraint, note that $k$ is a key in $R$ if and only if $R$ equals to its self-join on $k$ after converting the result into a set using \texttt{DISTINCT}. Intuitively, if $k$ is a key, then self-join of $R$ on $k$ will keep all the tuples of $R$ with each tuple's multiplicity unchanged. Conversely, if $R$ satisfies the self-join criteria, then attribute $k$ holds unique values in $R$ and is hence a key. \paragraph{Functional Dependencies} Keys are used in defining functional dependencies and indexes. A \emph{functional dependency} constraint from attribute $a$ to $b$ requires that for any two tuples $t_1$ and $t_2$ in $R$, $(t_1.a = t_2.a) \rightarrow (t_1.b = t_2.b)$ In \sem, two projections $a$ and $b$ forms a functional dependency in relation $R$ if the following holds: \[ \begin{array}{l} \texttt{fd ($a\; b$) ($R$)} := \\ \qquad \texttt{key Left.* } \llbracket \texttt{empty} \vdash \texttt{DISTINCT SELECT a, b} \\ \qquad \qquad \qquad \qquad \quad \texttt{FROM R}:\node{(\leaf{\tau_a})}{(\leaf{\tau_b})} \rrbracket \end{array} \] If $a$ and $b$ forms a functional dependency, then $a$ should be a key in the relation the results from projecting $a$ and $b$ from $R$ followed by de-duplication. The converse argument follows similarly. \paragraph{Index} An index on an attribute $a$ is a data structure that speeds up the retrieval of tuples with a given value of $a$~\cite[Ch. 8]{dbSysBook}. To reason about rewrite rules that use indexes, we follow the idea that index can be treated as a logical relation rather than physical data structure from Tsatalos et al~\cite{TsatalosSI94}. Since defining index as an relation requires a unique identifier of each tuple (analogous to a pointer to each tuple in the physical implementation of an index in database systems), we define index as a \sem query that projects on the a key of the relation and the index attribute. For example, if $k$ is a key of relation $R$, an index $I$ of $R$ on attribute $a$ can be defined as: \[ \texttt{index}(a, R) := \texttt{SELECT $k$, $a$ FROM $R$} \] \noindent In Section~\ref{sec:index-rule}, we show example rewrite rules that utilize indexes that are commonly used in query optimizers. \section{Discussion} \label{sec:discussion} {\bf Limitations} Our system does currently not support three SQL features: NULL's with their associated three-valued-logic, outer joins, and windows functions. However, all can be expressed in \sem, at the cost of some added complexity, as we explain now. When any argument to an expression is NULL, then the expression's output is NULL; this feature can easily be supported by modifying the external operators. When an argument of a comparison predicate is NULL, then the resulting predicate has value \texttt{unknown}, and SQL uses three valued logic to compute predicates: it defines $0 = \texttt{false}, 1/2 = \texttt{unknown}, 1=\texttt{true}$, and the logical operators $x \texttt{ and } y = \min(x,y)$, $x \texttt{ or } y = \max(x,y)$, $\texttt{not}(x) = 1-x$; a select-from-where query returns all tuples for which the where-predicate evaluates to \texttt{true} (i.e. not \texttt{false} or \texttt{unknown}). As a consequence, the law of excluded middle fails, for example the query: $$\SelectFromWhere{\texttt{*}}{R}{a=5 \texttt{ or } a \neq 5}$$ is not equivalent to $\SelectFrom{\texttt{*}}{R}$. This, too, could be currently expressed \sem\ by encoding the predicates as external functions that implement the 3-valued logic. However, by doing so one hides from the rewrite rules the equality predicate, which plays a key role in joins. In future versions, we plan to offer native support for NULL's, to simplify the task of proving rewrite rules over relations with NULLs. Both outer joins and windows functions are directly expressible in \sem. For example, a left outer join of two relations $R(a,b)$, $S(b,c)$ can be expressed by first joining $R$ and $S$ on $b$, and union-ing the result with \[ \begin{array}{ll} \SelectFrom{R.*,\texttt{NULL}}{S} \texttt{ EXCEPT } \\ \SelectFromWhere{R.*,\texttt{NULL}}{S}{R.b=S.b} \end{array} \] A direct implementation in \sem\ would basically have to follow the same definition of left outer joins. {\bf Finite v.s. Infinite Semantics} Recall that our semantics extends the standard bag semantics of SQL in two ways: we allow a relation to have infinitely many distinct elements, and we allow each element to have an infinite multiplicity. To the best of our knowledge, our system is the first that interprets SQL over infinite relations. This has two consequences. First, our system cannot check the equivalence of two SQL expressions that return the same results on all finite relations, but differ on some infinite relations. It is well-known that there exists First Order sentences, called {\em infinity axioms}, that do not admit any finite model, but admit infinite models. For example \cite[pp.307]{DBLP:books/sp/BorgerGG1997} the sentence $\varphi \equiv \forall x \exists y \forall z(\neg R(x,x) \wedge R(x,y) \wedge (R(y,z) \rightarrow R(x,z)))$ is an infinity axiom. It is possible to write a SQL query that checks $\varphi$, then returns the empty set if $\varphi$ is false, or returns a set consisting of a single value (say, 1) if $\varphi$ is true: call this query $Q_1$. Call $Q_2$ the query \SelectFromWhere{\texttt{DISTINCT} 1}{R}{2=3}. Then $Q_1=Q_2$ over all finite relations, but $Q_1 \neq Q_2$ not over infinite relations. Thus, one possible disadvantage of our semantics is that we cannot prove equivalence of queries that encode infinity axioms. However, none of the optimization rules that we found in the literature, and discussed in this paper, encode an infinity axiom. Hence we argue that, for practical purposes, extending the semantics to infinite relations is a small price to pay for the added simplicity of the equivalence proofs. Second, by generalizing SQL queries to both finite and infinite relations we make our system theoretically complete: if two queries are equivalent then, by G\"odel's completeness theorem, there exists a proof of their equivalence. Finding the proof is undecidable (it is recursively enumerable, r.e.): our system does not search for the proof, instead the user has to find it, and our system will verify it. Contrast this with a system whose semantics is based on finite relations: such a system cannot have a complete proof system for SQL query equivalence. Indeed, if such a complete proof system existed, then SQL query equivalence would be r.e. (since we can enumerate all proofs and search for a proof of $Q_1=Q_2$), and therefore equivalence would be decidable (since it is also co-r.e., because we can enumerate all finite relations, searching for an input s.t. $Q_1 \neq Q_2$). However, by Trakthenbrot's, query equivalence is undecidable. Recall that Trakthenbrot's theorem~\cite{Trakhtenbrot50DANUSSR,DBLP:books/sp/Libkin04} states that the problem {\em given an FO sentence $\varphi$, check if $\varphi$ has a finite model} is undecidable. We can reduce this problem to query equivalence by defining $Q_1$ to be a query that checks checks $\varphi$ and returns the empty set if $\varphi$ is false, or returns some non-empty set if $\varphi$ is true, and defining $Q_2$ to be the query that always returns the empty set (as above), then checking $Q_1 \equiv Q_2$). Thus, by extending our semantics to infinite relations we guarantee that, whenever two queries are equivalent, there exists a proof of their equivalence. \section{Introduction} \seclabel{intro} From purchasing plane tickets to browsing social networking websites, we interact with database systems on a daily basis. Every database system consists of a query optimizer that takes in an input query and determines the best program, also called a query plan, to execute in order to retrieve the desired data. Query optimizers typically consists of two components: a query plan enumerator that generates query plans that are semantically equivalent to the input query, and a plan selector that chooses the optimal plan from the enumerated ones to execute based on a cost model. The key idea behind plan enumeration is to apply {\em rewrite rules} that transform a given query plan into another one, hopefully one with a lower cost. While numerous plan rewrite rules have been proposed and implemented, unfortunately designing such rules remains a highly challenging task. For one, rewrite rules need to be {\em semantically preserving}, i.e., if a rule transforms query plan $Q$ into $Q'$, then the results (i.e., the relation) returned from executing $Q$ must be the same as those returned from $Q'$, and this has to hold for {\em all} possible input database schemas and instances. Obviously, establishing such proof for any non-trivial query rewrite rule is not an easy task. Coupled with that, the rich language constructs and subtle semantics of SQL, the de facto programming language used to interact with relational database systems, only makes the task even more difficult. As a result, while various rewrite rules have been proposed and studied extensively in the data management research community~\cite{MumickFPR90SIGMOD, Muralikrishna92VLDB, LevyMS94VLDB, SeshadriHPLRSSS96SIGMOD}, to the best of our knowledge only the trivial ones have been formally proven to be semantically preserving. This has unfortunately led to dire consequences as incorrect query results have been returned from widely-used database systems due to unsound rewrite rules, and such bugs can often go undetected for extended periods of time \cite{GanskiW87SIGMOD, MySQLBug, PostgresBug}. In this paper we describe a system to formally verify the equivalence of two SQL expressions. We demonstrate its utility by proving correct a large number of query rewrite rules that have been described in the literature and are currently used in popular database systems. We also show that, given counter examples, common mistakes made in query optimization fail to pass our formal verification, as they should. Our system shares similar high-level goals of building formally verified systems using theorem provers and proof assistants as recent work has demonstrated \cite{Leroy09JACM, SEL4, FSCQ}. The biggest challenge in designing a formal verification system for equivalence of SQL queries is choosing the right SQL semantics. Among the various features of SQL, the language uses both set and bag semantics and switches freely between them, making semantics definition of the language a difficult task. Although SQL is an ANSI standard~\cite{sql2011}, the ``formal'' semantics defined there is of little use for formal verification: it is loosely described in English and has resulted in conflicting interpretations \cite{Date89AW}. Researchers have defined two quite different rigorous semantics of SQL. The first comes from the formal methods community~\cite{MalechaMSW10POPL, VeanesGHT09ICFEM, VeanesTH10LAPR16}, where SQL relations are interpreted as lists, and SQL queries as functions over lists; two queries are equivalent if they return lists that are equal up to element permutation (under bag semantics) or up to element permutation and duplicate elimination (under set semantics). The problem with this semantics is that even the simplest equivalences require lengthy proofs in order to reason about order-independence or duplicate elimination, and these proofs become huge when applied to rewrites found in real-world optimizations. The second semantics comes from the database theory community and uses only set semantics \cite{TheAliceBook, BunemanLSTW94SIGMOD, NegriPS91TODS}. This line of work has led to theoretical results characterizing languages for which query equivalence is decidable (and often fully characterizing the complexity of the equivalence problem), and separating them from richer languages where equivalence is undecidable~\cite{ChandraM77STOC,SagivY80JACM,DBLP:conf/icdt/Ullman97,DBLP:conf/icdt/GeckKNS16}. For example, equivalence is decidable (and $\Pi^P_2$-complete for a fixed database schema~\cite{DBLP:conf/icdt/Ullman97}, and coNEXPTIME-complete in general~\cite{DBLP:conf/icdt/GeckKNS16}) for conjunctive queries with safe negation, but undecidable for conjunctive queries with unsafe negation. Unfortunately, this approach is of limited use in practice, because most query optimization rules use features that places them in the undecidable language fragments. This paper contributes a new semantics for SQL that is both simple and allows simple proofs of query equivalence. We then demonstrates its effectiveness by proving the correctness of various powerful query optimization rules described in the literature. Our semantics consists of two non-trivial generalizations of $K$-relations. $K$-relations were introduced by Green et al. in the database theory community~\cite{GreenKT07PODS}, and represent a relation as mathematical function that takes as input a tuple and returns its multiplicity in the relation, with 0 meaning that the tuple does not exist in the relation. A $K$-relation is required to have finite support, meaning that only a finite set of tuples have multiplicity $>0$. $K$-relations greatly simplify reasoning about SQL: under set semantics, a relation is simply a function that returns 0 or 1 (i.e., a Boolean value), while under bag semantics it returns a natural number (i.e., a tuple's multiplicity). Database operations such as join or union become arithmetic operations on the corresponding multiplicities: join becomes multiplication, union becomes addition. Determining the equivalence of a rewrite rule that transforms a query $Q$ into another query $Q'$ reduces to checking the equivalence of the functions they denote. For example, proving that the join operation is associative reduces to proving that multiplication is associative. As we will show, reasoning about functions over cardinals is much easier than writing inductive proofs on data structures such as lists. However, $K$-relations as defined by~\cite{GreenKT07PODS} are difficult to use in proof assistants, because one needs to prove for every SQL expression under consideration that the $K$-relation it returns has finite support: this is easy with pen-and-paper, but very hard to encode for a proof assistant. Without a guarantee of finite support, some operations are undefined, for example projection on an attribute requires infinite summation. Our first generalization of $K$-relations is to drop the finite support requirement, and meanwhile allow the multiplicity of a tuple to be any cardinal number as opposed to a (finite) natural number. Then the possibly infinite sum corresponding to a projection is well defined. With this change, SQL queries are interpreted over finite and infinite bags, where some tuples may have infinite multiplicities. To the best of our knowledge, ours is the first SQL semantics that interprets relations as both finite and infinite; we discuss some implications in Sec.~\ref{sec:discussion}. Our second generalization of $K$-relations is to replace cardinal numbers with univalent types. Homotopy Type Theory (HoTT)~\cite{hottBook} has been introduced recently as a generalization of classical type theory by adding membership and equality proofs. A {\em univalent type} is a cardinal number (finite of infinite) together with the ability to prove equality. To summarize, we define a SQL semantics where a relation is interpreted as a function mapping each tuple to a univalent type, whose cardinality represents the multiplicity of the tuple in the relation, and a SQL query is interpreted as a function from input relations to an output relation. We call the SQL language with this particular semantics \sem. Our language covers all major features of SQL. In addition, since univalent types have been integrated into the Coq proof assistant, we leverage that implementation to prove equivalences of SQL expressions. To demonstrate the effectiveness of \sem, we implemented a new system called \sys (Database OPtimizations CERTified) for proving equivalence of SQL rewrite rules. We have used \sys to prove many well-known and commonly-used rewrite rules from the data management research literature, many of which have never been formally proven correct before: aggregates~\cite{ChaudhuriD97SIGMOD,DBLP:conf/pods/KhamisNR16}, magic sets rewriting~\cite{BancilhonMSU86PODS}, query rewriting using indexes~\cite{TsatalosSI94}, and equivalence of conjunctive queries~\cite{TheAliceBook}. All our proofs require at most a few dozens lines of Coq code using \sys, as shown in Fig.~\ref{fig:rules}. All definitions and proofs presented in this paper are open-source and available online.\footnote{\url{http://dopcert.cs.washington.edu}} In summary, this paper makes the following contributions: \begin{itemize} \item We present \sem, a (large fragment) of SQL whose semantics generalizes $K$-relations to infinite relations and univalent types. The goal of this semantics is to enable easy proofs for the equivalence of query rewrite rules. (Sec.~\ref{sec:semantics}.) \item We prove a wide variety of well-known and widely-used SQL rewrite rules, where many of them have not be formally proven before; each proof require at most a few dozens lines of Coq code using \sys. (Sec.~\ref{sec:denotation}.) \item We implement \sys, a new system written in Coq for checking the equivalence of SQL rewrite rules. \sys comes with a number of heuristic tactics for deciding the equivalence of arbitrary rewrite rules, and a fully automated procedure for deciding rewrite rules involving conjunctive queries, where conjunctive queries represent a fragment of SQL where equivalence is decidable. (Sec.~\ref{sec:rules}.) \end{itemize} The rest of this paper is organized as follows. In~\secref{overview}, we given an overview and motivation for a new semantics for SQL. We then introduce \sem in~\secref{semantics}, its semantics in \secref{denotation}, and demonstrate our results in~\secref{rules}. Related work is presented in \secref{related}. We include some discussion in \secref{discussion} and conclude in \secref{conclusion}. \section{Overview} \label{sec:overview} \begin{figure} \begin{small} \textbf{Rewrite Rule}: \begin{flalign*} \quad\; & \SelectFromWhere{\texttt{*}}{(\UNIONALL{R}{S})}{b} \quad \equiv & \\ & \UNIONALL{(\SelectFromWhere{\texttt{*}}{R}{b})}{(\SelectFromWhere{\texttt{*}}{S}{b})} & \end{flalign*} \textbf{\sem Denotation}: \begin{flalign*} \Rightarrow & \lambdaFn{t}{(\denote{R} \; t + \denote{S} \; t) \times \denote{b} \; t} \equiv \lambdaFn{t}{\denote{R} \; t \times \denote{b} \; t + \denote{S} \; t \times \denote{b} \; t} & \end{flalign*} \textbf{\sem Proof}: Apply distributivity of $\times$ over $+$. \end{small} \caption{Proving a rewrite rule using \sem. Recall that \texttt{UNION ALL} means bag-union in SQL, which in \sem is translated to addition of tuple multiplicities in the two input relations. } \label{fig:union-slct} \end{figure} \paragraph{SQL} The basic datatype in SQL is a {\em relation}, which has a {\em schema} (a relation name $R$ plus attribute names $\sigma$), and an {\em instance} (a bag of tuples). A SQL query maps one or more input relations to a (nameless) output relation. For example, if a relation with schema $R(a,b)$ has instance $\set{(1,40),(2,40),(2,50)}$ then the SQL query \begin{flalign*} \texttt{Q1:} & \SelectFrom{a}{R} \end{flalign*} returns the bag $\set{1,2,2}$. SQL freely mixes set and bag semantics, where a set is simply a bag without duplicates and uses the \texttt{distinct} keyword to remove duplicates. For example, the query: \begin{flalign*} \texttt{Q2:} & \SelectFrom{\texttt{DISTINCT } a}{R} \end{flalign*} returns the set $\set{1,2}$. \paragraph{List Semantics} Previous approaches to mechanizing formal proofs of SQL query equivalences represent bags as list~\cite{MalechaMSW10POPL, VeanesGHT09ICFEM, VeanesTH10LAPR16}. Every SQL query admits a natural interpretation over lists, using a recursive definition~\cite{DBLP:journals/tcs/BunemanNTW95}. To prove that two queries are equivalent, one uses their inductive definition on lists, and proves that the two results are equal up to element reordering and duplicate elimination (for set semantics). The main challenges in this approach are coming up with the induction hypothesis, and dealing with list equivalence under permutation and duplicate elimination. Inductive proofs quickly grow in complexity, even for simple query equivalences. Consider the following query: \begin{flalign*} \texttt{Q3:} & \SelectFromWhere{\texttt{DISTINCT } x.a}{R \; \texttt{AS} \; x, R \; \texttt{AS} \; y}{x.a=y.a} \end{flalign*} \texttt{Q3} is equivalent to \texttt{Q2}, because it performs a redundant self-join: the inductive proof of their equivalence is quite complex, and has, to the best of our knowledge, not been done formally before. A much simpler rewrite rule, the commutativity of selection, requires 65 lines of Coq proof in prior work~\cite{MalechaMSW10POPL}, and only 10 lines of Coq proof in our semantics. Powerful database query optimizations, such as magic sets rewrites and conjunctive query equivalences, are based on generalizations of redundant self-joins elimination like $\texttt{Q2}\equiv\texttt{Q3}$, but significantly more complex (see Sec.~\ref{sec:rules}), and inductive proofs become impractical. This motivated us to consider a different semantics; we do not use list semantics in this paper. \paragraph{$K$-Relation SQL Semantics} An alternative approach introduced in~\cite{GreenKT07PODS} is to represent relations as functions that map every tuple to a value that indicates how many times it appears in the relation. If the relation is a bag, then the function returns a natural number, and if it is a set then it returns a value in $\set{0,1}$. More generally, a commutative semi-ring is a structure ${\bf K} = (K, +, \times, 0, 1)$ where both $(K,+,0)$ and $(K,\times,1)$ are commutative monoids, and $\times$ distributes over $+$. For a fixed set of attributes $\sigma$, denote $\texttt{Tuple}(\sigma)$ the type of tuples with attributes $\sigma$. A $K$-relation~\cite{GreenKT07PODS} is a function: \begin{align*} \denote{R}: & \texttt{Tuple} \; \sigma \rightarrow K \end{align*} with finite support, meaning that the set $\setof{t}{\denote{R}\; t \neq 0}$ is finite. A bag is an $\mathds{N}$-relation, and a set is a $\mathds{B}$-relation. All relational operators are expressed in terms of the semi-ring operations, for example: \begin{align*} & \denote{\UNIONALL{R}{S}} = \lambdaFn{t}{\denote{R} \; t+\denote{S} \; t} \\ & \denote{\SelectFrom{\texttt{*}}{R,S}} = \lambdaFn{(t_1,t_2)}{\denote{R} \; t_1 \times \denote{S} \; t_2} \\ & \denote{\SelectFromWhere{\texttt{*}}{R}{b}} = \lambdaFn{t}{\denote{R} \; t \times \denote{b} \; t}\\ & \denote{\SelectFrom{x.a}{R}} = \lambdaFn{t}{\sum_{t' \in \texttt{Tuple} \; \sigma}(t = \D{a} \; t') \times \denote{R} \; t'}\\ & \denote{\SelectFrom{\DISTINCT \texttt{*}}{R}} = \lambdaFn{t}{\merely{\denote{R} \; t}} \\ \end{align*} where, for any predicate $b$: $\denote{b} \; t = 1$ if the predicate holds on $t$, and $\denote{b} \; t = 0$ otherwise. The function $\merely{\ }$ is defined as $\merely{x}=0$ when $x=0$, and $\merely{x}= 1$ otherwise (see Subsec.~\ref{sec:target-lang}). The projection $\D{a} \; t'$ returns the attribute $a$ of the tuple $t'$, while equality $(x=y)$ is interpreted as 0 when $x\neq y$ and 1 otherwise. To prove that two SQL queries are equal one has to prove that two semi-ring expressions are equal. For example, Fig.~\ref{fig:union-slct} shows how we can prove that selections distribute over unions, by reducing it to the distributivity of $\times$ over $+$, while Fig.~\ref{fig:magic-distinct} shows the proof of the equivalence for $\texttt{Q2} \equiv \texttt{Q3}$. \begin{figure} \begin{small} \textbf{Rewrite Rule}: \begin{flalign*} \quad\; & \SelectFromWhere{\texttt{DISTINCT } x.a}{R \; \texttt{AS} \; x, R \; \texttt{AS} \; y}{x.a=y.a} \quad \equiv &\\ & \SelectFrom{\texttt{DISTINCT } a}{R}& \end{flalign*} \textbf{Equational \sem Proof}: \begin{flalign*} \Rightarrow & \lambdaFn{t}{\merely{\sum_{t_1, t_2} (t = \D{a}\; t_1) \times (\D{a} \; t_1= \D{a} \; t_2) \times \denote{R} \; t_1 \times \denote{R} \; t_2}} \equiv& \\ & \lambdaFn{t}{\merely{\sum_{t_1, t_2} (t = \D{a} \; t_1) \times (t = \D{a} \; t_2) \times \denote{R} \; t_1 \times \denote{R} \; t_2}} \equiv& \\ & \lambdaFn{t}{\merely{(\sum_{t_1} (t = \D{a} \; t_1) \times \denote{R} \; t_1) \times (\sum_{t_2} (t = \D{a} \; t_2) \times \denote{R} \; t_2)}} \equiv& \\ & \lambdaFn{t}{\merely{\sum_{t_1} (t = \D{a} \;t_1) \times \denote{R} \; t_1}}& \end{flalign*} We used the following semi-ring identities: \begin{flalign*} (a=b) \times (b=c) \equiv & (a=b) \times (a=c)\\ \sum_{t_1, t_2} E_1(t_1) \times E_2(t_2) \equiv & \sum_{t_1} E_1(t_1) \times \sum_{t_2} E_2(t_2)\\ \merely{n \times n} \equiv & \merely{n} \end{flalign*} \textbf{Deductive \sem Proof}: \begin{flalign*} \Rightarrow \forall \; t. & \exists_{t_0} (\denote{a} \; t_0 = t) \land \denote{R} \; t_0 \leftrightarrow & \\ & \exists_{t_1, t_2} (\denote{a} \; t_1 = t) \land \denote{R} \; t_1 \land \denote{R} \; t_2 \land (\denote{a} \; t_1 = \denote{a} \; t_2) & \end{flalign*} Then case split on $\leftrightarrow$. Case $\rightarrow$: instantiate both $t_1$ and $t_2$ with $t_0$, then apply hypotheses. Case $\leftarrow$: instantiate $t_0$ with $t_1$, then apply hypotheses. \end{small} \caption{The proof of equivalence $\texttt{Q2} \equiv \texttt{Q3}$.} \label{fig:magic-distinct} \end{figure} Notice that the definition of projection requires that the relation has finite support; otherwise, the summation is over an infinite set and is undefined in $\mathds{N}$. This creates a major problem for our equivalence proofs, since we need to prove, for each intermediate result of a SQL query, that it returns a relation with finite support. This adds significant complexity to the otherwise simple proofs of equivalence. \paragraph{\sem Semantics} To handle this challenge, our semantics generalizes $K$-Relation in two ways: we no longer require relations to have finite support, and we allow the multiplicity of a tuple to be an arbitrary cardinality (possibly infinite). More precisely, in our semantics a relation is interpreted as a function: \begin{align*} & \texttt{Tuple} \; \sigma \rightarrow \mathcal{U} \end{align*} where $\mathcal{U}$ is the class of homotopy types. We call such a relation a \emph{HoTT-relation}. A homotopy type $n \in \mathcal{U}$ is an ordinary type with the ability to prove membership and equality between types. Homotopy types form a commutative semi-ring and can well represent cardinals. Cardinal number 0 is the empty homotopy type \textbf{0}, 1 is the unit type \textbf{1}, multiplication is the product type $\times$, addition is the sum type $+$, infinite summation is the dependent product type $\Sigma$, and truncation is the squash type $\merely{.}$. Homotopy types generalize natural numbers and their semiring operations, and is now well integrated with automated proof assistants like Coq \footnote{After adding the Univalence Axiom to Coq's underlying type theory.}. As we show in the rest of this paper, the equivalence proofs retain the simplicity of $\mathds{N}$-relations and can be easily mechanized, but without the need to prove finite support. In addition, homotopy type theory unifies squash type and proposition. Using the fact that propositions as types in homotopy type theory \cite[Ch 1.11]{hottBook}, in order to prove the equivalence of two squash types, $\merely{p}$ and $\merely{q}$, it is sufficient to just prove the bi-implication ($p \leftrightarrow q$), which is arguably easier in Coq. For example, transforming the equivalence proof of Figure~\ref{fig:magic-distinct} to bi-implication would not require a series of equational rewriting using semi-ring identities any more, which is complicated because it is under the variable bindings of $\Sigma$. The bi-implication can be proved in Coq by deduction easily. The queries of the above rewrite rule fall in the well studied category of conjunctive queries, for which equality is decidable (equality between arbitrary SQL queries is undecidable). Using Coq's support for automating deductive reasoning (with \emph{Ltac}), we have implemented a decision procedure for the equality of conjunctive queries, the aforementioned rewrite rule can thus be proven in one line of Coq code. \section{Appendix Title} \bibliographystyle{abbrvnat} \section{Related Work} \label{sec:related} \subsection{Query Rewriting} Query rewriting based on equivalence rules is an essential part of modern query optimizers. Rewrite rules are either fired by a forward chaining rule engine in a Starburst optimizer framework \cite{HaasFLP89SIGMOD,PiraheshHH92SIGMOD}, or are used universally to represent the search space in Exodus \cite{GraefeD87SIGMOD} and its successors, including Volcano \cite{GraefeM93ICDE} and Cascades \cite{Graefe95aDEB}. Using \sys, we formally prove a series of rewrite rules from the database literature. Those rules include basic algebraic rewrites such as selection push down \cite{Ullman89}, rewrite rules using indexes \cite{dbSysBook}, and unnesting aggregates with joins \cite{Muralikrishna92VLDB}. We are able to prove one of the most complicated rewrite rules that is also widely used in practice: magic set rewrites \cite{MumickFPR90SIGMOD, BancilhonMSU86PODS, SeshadriHPLRSSS96SIGMOD}. Magic set rewrites involve many SQL features such as correlated subqueries, aggregation and group by. To our best knowledge, its correctness has not been formally proven before. \sys automates proving rewrite rules on decidable fragments of SQL. According to Codd's theorem \cite{Codd72}, relational algebra and relational calculus (formulas of first-order logic on database instances) are equivalent in expressive power. Thus, the equivalence between two SQL queries is in general undecidable \cite{Trakhtenbrot50DANUSSR}. Extensive research has been done to study the complexity of containment and equivalence of fragments of SQL queries under bag semantics and set semantics \cite{ChandraM77STOC, ChaudhuriV92PODS, IoannidisR95TODS, DBLP:conf/icdt/GeckKNS16, JayramKV06PODS, SagivY80JACM, Meyden92PODS}. We list the results in Figure~\ref{fig:complexity}. \subsection{SQL Semantics} SQL is the de-facto language for relational database systems. Although the SQL language is an ANSI/ISO standard \cite{sql2011}, it is loosely described in English and leads to conflicting interpretations \cite{Date89AW}. Previous related formalizations of various fragments of SQL include relational algebra \cite{TheAliceBook}, comprehension syntax \cite{BunemanLSTW94SIGMOD}, and recursive and non-recursive Datalog \cite{ChaudhuriV92PODS}. These formalisms are not suited for rigorous reasoning about the correctness of real world rewrite rules since they mostly focus exclusively on set semantics. In addition, in order to express rewrite rules in these formalism, non-trivial transformation from SQL are required. Previous SQL formalizations in proof systems include \cite{MalechaMSW10POPL, BenzakenCD14ESOP, VeanesGHT09ICFEM, VeanesTH10LAPR16}. In \cite{VeanesGHT09ICFEM, VeanesTH10LAPR16}, SQL semantics are encoded in the Z3 SMT solver for test generation. In \cite{MalechaMSW10POPL}, an end to end verified prototype database system is implemented in Coq. In \cite{BenzakenCD14ESOP}, a relational data model and relational algebra are implemented in Coq. Compared with \cite{MalechaMSW10POPL, BenzakenCD14ESOP}, \sem covers all important SQL feature such as bags, aggregation, group by, indexes, and correlated subqueries. As a result, we are able to express a wide range of rewrite rules. Unlike \cite{MalechaMSW10POPL}, we did not build an end to end formally verified database system. In \sem, SQL features like aggregation on group by and indexes are supported through syntactic rewrites. Rewriting aggregation on group by using aggregation on relations and correlated subqueries is based on \cite{BunemanLSTW94SIGMOD}. We use logical relation to represent indexes in \sem. This was firstly proposed by Tastalos et al \cite{TsatalosSI94}. \subsection{Related Formal Semantics in Proof Systems} In the past decades, a number of formal semantics in different application domains were developed using proof systems for software verification. The CompCert compiler \cite{Leroy09JACM} specifies the semantics of a subset of C in Coq and provides machine checkable proofs of the correctness of compilation. HALO denotes Haskell to first-order logic for static verification of contracts \cite{VytiniotisJCR13POPL}. Bagpipe \cite{WeitzWTEKT2016:TR} developed formal semantics for the Border Gateway Protocol (BGP) to check the correctness of BGP configurations. SEL4 \cite{SEL4} formally specifies the functional correctness of an OS kernel in Isabelle/HOL and developed a verified OS kernel. FSCQ \cite{FSCQ} builds a crash safe file system using an encoding of crash Hoare logic in Coq. With formal semantics in proof systems, there are more verified system developed such as Verdi \cite{WilcoxWPTWEA15PLDI}, Verve \cite{YangH10PLDI}, Bedrock \cite{Chlipala13} and Ironclad \cite{HawblitzelHLNPZZ14OSDI}. \section{\sys: A Verified System for Proving Rewrite Rules} \label{sec:rules} To demonstrate the effectiveness of \sem, we implement \sys, a system written in Coq for checking the equivalence of SQL rewrite rules. \sys consists of four parts, 1) the denotational semantics of \sem, 2) a library consisting of lemmas and tactics that can be used as building blocks for constructing proofs of arbitrary rewrite rules, 3) a fully automated decision procedure for the equivalence of rewrite rules consisting only of conjunctive queries, and 4) a number of proofs of existing rewrite rules from the database literature and real world systems. \sys relies on the Homotopy Type Theory Coq library~\cite{HoTTCoq}. Its trusted code base contains 296 lines of specification of \sem. Its verified part contains 405 lines of library code (including the decision procedure for conjunctive queries), and 1094 lines of code that prove well known SQL rewrite rules. In the following sections, we first show various rewrite rules and the lemmas they use from the \sys library, and then explain our automated decision procedure. \subsection{Proving Rewrite Rules in \sys by Examples} We proved 23 rewrite rules from both the database literature and real world optimizers using \sem. Figure~\ref{fig:rules} shows the number of rewrite rules that we proved in each category and the average lines of code (LOC) required per proof. \begin{figure} \centering \begin{tabular}{llll} Category & No. of rules & Avg. LOC (proof only) \\ \hline Basic & 8 & 11.1 \\ Aggregation & 1 & 50 \\ Subquery & 2 & 17 \\ Magic Set & 7 & 30.3 \\ Index & 3 & 64 \\ Conjunctive Query & 2 & 1 (automatic) \\ \textbf{Total} & 23 & 25.2 \\ \end{tabular} \caption{Rewrite rules proved} \label{fig:rules} \end{figure} The following sections show a sampling of interesting rewrite rules in these categories. Sec~\ref{sec:basic-rewrite} shows how two basic rewrite rules are proved. Sec~\ref{sec:agg-rule} shows how to prove a rewrite rule involving aggregation. Sec~\ref{sec:magic} shows how to prove the magic set rewrite rules. Sec~\ref{sec:index-rule} shows how to state a rewrite rule involving indexes. \subsubsection{Basic Rewrite Rules} \label{sec:basic-rewrite} Basic rewrites are simple rewrite rules that are fundamental building blocks of the rewriting system. These rewrites are also very effective in terms of reducing query execution time. We demonstrate how to prove the correctness of basic rewrite rules in \sys using two examples: selection push down and commutativity of joins. \paragraph{Selection Push Down} Selection push down moves a selection (filter) directly after the scan of the input table to dramatically reduce the amount of data in the execution pipeline as early as possible. It is known as one of most powerful rules in database optimizers~\cite{dbSysBook}. We formulate selection push down as the following rewrite rule in \inputLang: \begin{small} \[ \begin{array}{ll} \denoteQuery{\Gamma}{\texttt{SELECT * FROM $R$ WHERE $p_1$ AND $p_2$ }}{\sigma} & \equiv \\ \llbracket \Gamma \vdash \texttt{SELECT * FROM} & \\ \multicolumn{2}{l}{ \qquad \texttt{(SELECT * FROM $R$ WHERE $p_1$) WHERE $p_2$ : $\sigma$} \rrbracket} \\ \end{array} \] \end{small} This will be denoted to: \begin{small} \[ \begin{array}{ll} \lambda \; \context \; \tuple. \; \D{p_1} \mkPair{g}{t} \times \llbracket p_2 \rrbracket \; \mkPair{g}{t} \times \D{R} \; g \; t & \equiv \\ \lambda \; \context \; \tuple. \; \D{p_2} \; \mkPair{g}{t} \times ( \D{p_1} \; \mkPair{g}{t} \times \D{R} \; g \; t) \\ \end{array} \] \end{small} The proof proceeds by functional extensionality \footnote{Function extensionality is implied by the Univalence Axiom.} and the associativity and commutativity of $\times$. \paragraph{Commutativity of Joins} Commutativity of joins allows an optimizer to rearrange the order of joins in order to get the join order with best performance. This is one of the most fundamental rewrite rules that almost every optimizer uses. We formulate the commutativity of joins in \inputLang as follows: \begin{small} \[ \begin{array}{ll} \denoteQuery{\Gamma}{\texttt{SELECT * FROM $R$, $S$}}{\Pair{\sigma_R}{\sigma_S}} \quad \equiv \\ \denoteQuery{\Gamma}{\texttt{SELECT Right.Right.*, Right.Left.* FROM $S$, $R$}}{\Pair{\sigma_R}{\sigma_S}} \end{array} \] \end{small} Note that the select clause flips the tuples from $S$ and $R$, such that the order of the tuples matches the original query. This will be denoted to: \begin{small} \[ \begin{array}{ll} \lambda \; \context \; \tuple. \; \D{R} \; g \; \fst{t} \times \D{S} \; g \; \snd{t} \quad \equiv \\ \lambda \; \context \; \tuple. \; \sum_{t_1} \D{S} \; g \; \fst{t_1} \times \D{R} \; g \; \snd{t_1} \times ((\snd{t_1},\fst{t_1}) = t) \end{array} \] \end{small} The proof uses Lemma~\ref{lem:sum_pair} provided by the \sys library. \begin{lemma} \label{lem:sum_pair} Let $A$ inhabit $\mathcal{U}$, and have $P: A \rightarrow \mathcal{U}$ be a type family, then we have: \[ \sum_{x:A \times B} P \; x = \sum_{x: B \times A} P \; (\snd{x}, \fst{x}) \] \end{lemma} Together with the fact that $t_1 = (\fst{t_1}, \snd{t_1})$, the rewrite rule's right hand side becomes: \begin{small} \[ \lambda \; \context \; \tuple. \; \sum_{t'} \D{S} \; g \; \snd{t'} \times \D{R} \; g \; \fst{t'} \times (t' = t ) \] \end{small} The proof then uses Lemma~\ref{lem:pair_eq} provided by the \sys library. \begin{lemma} \label{lem:pair_eq} Let $A$ and $B$ inhabit $\mathcal{U}$, and have $P: A \times B \rightarrow \mathcal{U}$, then we have: \[ P\; x = \sum_{x'} P \; x' \times (x' = x) \] \end{lemma} After applying Lemma~\ref{lem:pair_eq}, the right hand side becomes the following, and we can finish the proof by applying commutativity of $\times$: \begin{small} \[ \lambda \; \context \; \tuple. \; \D{S} \; g \; \snd{t} \times \D{R} \; g \; \fst{t} \] \end{small} \subsubsection{Aggregation and Group By Rewrite Rules} \label{sec:agg-rule} Aggregation and Group By are widely used in analytic queries \cite{ChaudhuriD97SIGMOD}. The standard data analytic benchmark TPC-H \cite{tpch} has 16 queries with group by and 21 queries with aggregation out of a total of 22 queries. Following is an example rewrite rule for aggregate queries. The query on the left-hand side groups the relation $R$ by the column $k$, sums all values in the $b$ column for each resulting partition, and then removes all results except the partition whose column $k$ is equal to the constant $l$. This can be rewritten to the faster query that first removes all tuples from $R$ whose column $k \neq l$, and then computes the sum. \begin{small} \[ \begin{array}{ll} \llbracket \Gamma \vdash \texttt{SELECT * FROM (SELECT $k$, SUM($b$) FROM $R$ GROUP BY $k$)} & \\ \qquad \; \texttt{WHERE $(\Var{k}) = l$} : \sigma \rrbracket \quad \equiv \\ \denoteQuery{\Gamma}{\texttt{SELECT $k$, SUM($b$) FROM $R$ WHERE $(\Var{k})=l$ GROUP BY $k$ }}{\sigma} \end{array} \] \end{small} As shown in Sec.~\ref{sec:more-sql}, we use a correlated subquery and a unary aggregate function (which takes a \inputLang query as its input) to represent aggregation on group by SQL queries. After de-sugaring, the group by query becomes \texttt{SELECT DISTINCT $\ldots$}. The rule will thus be denoted to: \begin{small} \[ \begin{array}{ll} \lambda \; \context \; \tuple. \; (\fst{t} = \denote{l}) \times \| \sum_{t_1} \denote{R} \; t_1 \times (\fst{t} = \denote{k} \; t_1) \times \\ \qquad \quad (\snd{t} = \denote{\texttt{SUM}} \; (\lambda \; t'. \; \sum_{t_2} (\denote{k} \; t_1 = \denote{k} \; t_2) \times \\ \qquad \qquad \quad \denote{R} \; t_2 \times (\denote{b} \; t_1 = t')) \| \\ \quad \equiv \quad \\ \lambda \; \context \; \tuple. \; \| \sum_{t_1} (\denote{k} \; t_1 = \denote{l}) \times \denote{R} \; t_1 \times (\fst{t} = \denote{k} \; t_1) \times \\ \qquad \quad (\snd{t} = \denote{\texttt{SUM}} \; (\lambda \; t'. \; \sum_{t_2} (\denote{k} \; t_1 = \denote{k} \; t_2) \times (\denote{k} \; t_2 = \denote{l}) \times \\ \qquad \qquad \quad \denote{R} \; t_2 \times (\denote{b} \; t_1 = t')) \| \end{array} \] \end{small} The proof proceeds by functional extensionality, after which both sides become squash types. The proof then uses the fundamental lemma about squash types, where for all squash types $A$ and $B$, $(A \leftrightarrow B) \Rightarrow (A = B)$. It thus suffices to prove by cases the bi-implication ($\leftrightarrow$) of both sides. In both cases, instantiate $t_1$ with $t_1$ ($t_1$ is the witness of the $\Sigma$ hypothesis). It follows that $t.1 = \denote{l} = \denote{k} \; t_1$, and thus that $\denote{k} \; t_2 = \denote{l}$ inside $\texttt{SUM}$. \subsubsection{Magic Set Rewrite Rules} \label{sec:magic} Magic set rewrites are well known rewrite rules that were originally used in the recursive query processing in deductive databases \cite{BancilhonMSU86PODS, RohmerLK86NGC}. It was then used for rewriting complex decision support queries and has been implemented in commercial systems such as IBM's DB2 database \cite{SeshadriHPLRSSS96SIGMOD, MumickFPR90SIGMOD}. Below is an example of a complex magic set rewrite from \cite{SeshadriHPLRSSS96SIGMOD}. \noindent Original Query: \begin{small} \[ \begin{array}{ll} \texttt{CREATE VIEW $DepAvgSal$ AS} \\ \qquad \texttt{(SELECT $E.did$, AVG($E.sal$) AS $avgsal$ FROM $Emp$ $E$} \\ \qquad \texttt{GROUP BY $E.did$);} \\ \texttt{SELECT $E.eid$, $E.sal$ FROM $Emp$ $E$, $Dept$ $D$, $DepAvgSal$ $V$ } \\ \texttt{WHERE $E.did = D.did$ AND $E.did = V.did$ AND $E.age < 30$} \\ \qquad \texttt{AND $D.budget > 100000$ AND $E.sal > V.avgsal$}\\ \end{array} \] \end{small} \noindent Rewritten Query: \begin{small} \[ \begin{array}{ll} \texttt{CREATE VIEW $PartialResult$ AS} \\ \qquad \texttt{(SELECT $E.eid$, $E.sal$, $E.did$ FROM $Emp$ $E$, $Dept$ $D$}\\ \qquad \; \texttt{WHERE $E.did = D.did$ AND $E.age < 30$ AND} \\ \qquad \qquad \texttt{$D.budget > 100000$);}\\ \texttt{CREATE VIEW $Filter$ AS} \\ \qquad \texttt{(SELECT DISTINCT $P.did$ FROM $PartialResult$ $P$);}\\ \texttt{CREATE VIEW $LimitedDepAvgSal$ AS} \\ \qquad \texttt{(SELECT $F.did$, AVG($E.sal$) AS $avgsal$} \\ \qquad \; \texttt{FROM $Filter$ $F$, $Emp$ $E$} \\ \qquad \; \texttt{WHERE $E.did = F.did$} \\ \qquad \; \texttt{GROUP BY $F.did$);} \\ \texttt{SELECT $P.eid$, $P.sal$} \\ \texttt{FROM $PartialResult$ $P$, $LimitedDepAvgSal$ $V$} \\ \texttt{WHERE $P.did = V.did$ AND $P.sal > V.avgsal$}\\ \end{array} \] \end{small} This query aims to find each young employee in a big department ($D.budget > 100000$) whose salary is higher then the average salary in her department. Magic set rewrites use the fact that only the average salary of departments that are big and have young employees need to be computed. As described in \cite{SeshadriHPLRSSS96SIGMOD}, all magic set rewrites can be composed from just three basic rewrite rules on semijoins, namely introduction of $\theta$-semijoin, pushing $\theta$-semijoin through join, and pushing $\theta$-semijoin through aggregation. Following, we show how to state all three rewrite rules using \sys, and show how to prove two. We firstly define $\theta$-semijoin as a syntactic rewrite in \sem: \begin{small} \[ \begin{array}{ll} \texttt{$A$ SEMIJOIN $B$ ON $\theta$} \triangleq \\ \texttt{SELECT * FROM $A$ WHERE EXISTS (SELECT * FROM $B$ WHERE $\theta$)} \end{array} \] \end{small} \paragraph{Introduction of $\theta$-semijoin} This rules shows how to introduce semijoin from join and selection. Using semijoin algebra notation, this rewrite can be expressed as follows: \[ R_1 \bowtie_{\theta} R_2 \equiv R_1 \bowtie_{\theta} (R_2 \ltimes_{\theta} R_1) \] \noindent Using \inputLang, the rewrite can be expressed as follows: \begin{small} \[ \begin{array}{ll} \denoteQuery{\Gamma}{\texttt{SELECT * FROM $R_2$, $R_1$ WHERE $\theta$}}{\sigma} & \quad \equiv \quad \\ \multicolumn{2}{l}{\denoteQuery{\Gamma}{\texttt{SELECT * FROM ($R_2$ SEMIJOIN $R_1$ ON $\theta$), $R_1$ WHERE $\theta$ }}{\sigma}} \end{array} \] \end{small} \noindent which is denoted to: \begin{small} \[ \begin{array}{ll} \lambda \; \context \; \tuple. \; \denote{\theta} \; \mkPair{g}{t} \times \denote{R_2} \; g \; \fst{t} \times \denote{R_1} \; g \; \snd{t} & \quad \equiv \quad \\ \lambda \; \context \; \tuple. \; \denote{\theta} \; \mkPair{g}{t} \times \denote{R_2} \; g \; \fst{t} \times \denote{R_1} \; g \; \snd{t} \times{} \\ \qquad \quad \merely{\sum_{t_1}\denote{\theta} \; \mkPair{g}{\mkPair{\fst{t}}{t_1}} \times \denote{R_1} \; g \; t_1} \end{array} \] \end{small} \noindent The proof uses Lemma~\ref{lem:hprop_prod} provided by the \sys library. \begin{lemma} \label{lem:hprop_prod} $\forall P, T: \mathcal{U}$, where $P$ is either $\textbf{0}$ or $\textbf{1}$, we have: \[ (T \rightarrow P) \Rightarrow ((T \times P) = T) \] \end{lemma} \begin{proof} Intuitively, this can be proven by cases on $T$. If $T$ is inhabited, then $P$ holds by assumption, and $T \times \textbf{1} = T$. If $T = 0$, then $\textbf{0} \times P = \textbf{0}$. \end{proof} Using this lemma, it remains to be shown that $\denote{\theta} \; \mkPair{g}{t}$ and $\denote{R_2} \; g \; \fst{t}$ and $\denote{R_1} \; g \; \snd{t}$ imply $\merely{\sum_{t_1}\denote{\theta} \; \mkPair{g}{\mkPair{\fst{t}}{t_1}} \times \denote{R_1} \; g \; t_1}$. We show this by instantiating $t_1$ with $t.2$, and then by hypotheses. \paragraph{Pushing $\theta$-semijoin through join} The second rule in magic set rewrites is the rule for pushing $\theta$-semijoin through join, represented in semijoin algebra as: \[ (R_1 \bowtie_{\theta_1} R_2) \ltimes_{\theta_2} R_3 \equiv (R_1 \bowtie_{\theta_1}R_2') \ltimes_{\theta_2} R_3 \] \noindent where $R_2' = E_2 \ltimes_{\theta_1 \land \theta_2} (R_1 \bowtie R_3)$. This rule can be written in \inputLang as below: \begin{small} \[ \begin{array}{ll} \lambda \; \context \; \tuple. \; \llbracket \Gamma \vdash \texttt{(SELECT * FROM $R_1$, $R_2$ WHERE $\theta_1$)} \\ \qquad \qquad \quad \texttt{SEMIJOIN $R_3$ ON $\theta_2$}:\Pair{\sigma_1}{\sigma_2} \rrbracket \quad \equiv \quad \\ \lambda \; \context \; \tuple. \; \llbracket \Gamma \vdash \texttt{(SELECT *} \\ \qquad \qquad \quad \texttt{ FROM $R_1$, ($R_2$ SEMIJOIN (FROM $R_1$, $R_3$) ON $\theta_1$ AND $\theta_2$)} \\ \qquad \qquad \quad \texttt{ WHERE $\theta_1$) SEMIJOIN $R_3$ ON $\theta_2$} :\Pair{\sigma_1}{\sigma_2} \rrbracket \end{array} \] \end{small} \noindent The rule is denoted to: \begin{small} \[ \begin{array}{ll} \lambda \; \context \; \tuple. \; \merely{\sum_{t_1} \denote{\theta_2} \; \mkPair{g}{\mkPair{t}{t_1}} \times \denote{R_3} \; g \; t_1} \times \\ \qquad \quad \denote{\theta_1} \; \mkPair{g}{t} \times \denote{R_1} \; g \; \fst{t} \times \denote{R_2} \; g \; \snd{t} \qquad \equiv \\ \lambda \; \context \; \tuple. \; \merely{\sum_{t_1} \denote{\theta_2} \; \mkPair{g}{\mkPair{t}{t_1}} \times \denote{R_3} \; g \; t_1} \times \\ \qquad \quad \denote{\theta_1} \; \mkPair{g}{t} \times \denote{R_1} \; g \; \fst{t} \times \denote{R_2} \; g \; \snd{t} \times{} \\ \qquad \quad \| \sum_{t_1} \denote{\theta_1} \; \mkPair{g}{\mkPair{\fst{t_1}}{\snd{t}}} \times \denote{\theta_2} \; \mkPair{g}{\mkPair{\mkPair{\fst{t_1}}{\snd{t}}}{\snd{t_1}}} \\ \qquad \quad \times \denote{R_1} \; g \; \fst{t_1} \times \denote{R_3} \; g \; \snd{t_1} \| \end{array} \] \end{small} We can prove this rule by using a similar approach to the one used to prove introduction of $\theta$-semijoin: rewriting the right hand side using Lemma~\ref{lem:hprop_prod}. and then instantiating $t_1$ with $(t.1, t_1)$ ($t_1$ is the witness of the $\Sigma$ hypothesis). \paragraph{Pushing $\theta$-semijoin through aggregation} The final rule is pushing $\theta$-semijoin through aggregation: \newcommand{_{\bar{g}}\mathcal{F}_{\bar{f}}}{_{\bar{g}}\mathcal{F}_{\bar{f}}} \[ _{\bar{g}}\mathcal{F}_{\bar{f}}(R_1) \ltimes_{c_1 = c_2} R_2 \equiv _{\bar{g}}\mathcal{F}_{\bar{f}}(R_1 \ltimes_{c_1 = c_2} R_2) \] \noindent where $_{\bar{g}}\mathcal{F}_{\bar{f}}$ is a grouping/aggregation operator ($_{\bar{g}}\mathcal{F}_{\bar{f}}$ was firstly defined in \cite{SeshadriHPLRSSS96SIGMOD}), and $\bar{g}$ denotes the group by attributes and $\bar{f}$ denotes the aggregation function. In this rule, one extra condition is that $c_1$ is from the attributes in $\bar{g}$ and $c_2$ is from the attributes of $R_2$. This rule can be written in \inputLang as below: \begin{small} \[ \begin{array}{ll} \llbracket \Gamma \vdash \texttt{(SELECT $c_1$, COUNT($a$) FROM $R_1$ GROUP BY $c_1$)} \\ \qquad \quad \texttt{SEMIJOIN $R_2$ ON $c_1 = c_2$ } : \sigma \rrbracket \quad \equiv \\ \llbracket \Gamma \vdash \texttt{SELECT $c_1$, COUNT($a$)} \\ \qquad \quad \texttt{FROM ($R_1$ SEMIJOIN $R_2$ ON $c_1 = c_2$) GROUP BY $c_1$} : \sigma \rrbracket \end{array} \] \end{small} \noindent We omit the proof here for brevity. \subsubsection{Index Rewrite Rules} \label{sec:index-rule} As introduced in Section~\ref{sec:more-sql}, we define an index as a \sem query that projects on the indexed attribute and the primary key of a relation. Assuming $k$ is the primary key of relation $R$, and $I$ is an index on column $a$: \[ I := \texttt{SELECT $k$, $a$ FROM $R$} \] \noindent We prove the following common rewrite rule that converts a full table scan to a lookup on an index and a join: \begin{small} \[ \begin{array}{ll} \denoteQuery{\Gamma}{\texttt{SELECT * FROM $R$ WHERE $a = l$ }}{\sigma} \quad \equiv \\ \llbracket \Gamma \vdash \texttt{SELECT * FROM $I$, $R$} \\ \qquad \quad \texttt{WHERE $a = l$ AND Right.Left.$k$ = Right.Right.$k$ } : \sigma \rrbracket \end{array} \] \end{small} \noindent We omit the proof here for brevity. \subsection{Automated Decision Procedure for Conjunctive Queries} \label{sec:automation} \begin{figure*} \centering \begin{tabular}{|l|l|l|l|l|} \hline & Containment (Set) & Containment (Bag) & Equivalence (Set) & Equivalence (Bag) \\ \hline Conjunctive Queries & NP-Complete \cite{ChandraM77STOC} & Open & NP-Complete \cite{ChandraM77STOC} & Graph Isomorphism \cite{ChaudhuriV92PODS} \\ \hline Union of Conjunctive Queries & NP-Complete \cite{SagivY80JACM} & Undecidable \cite{IoannidisR95TODS} & NP-Complete \cite{SagivY80JACM} & Open \\ \hline Conjunctive Query with $\neq$, $\geq$, and $\leq$ & $\Pi_2^p$-Complete \cite{Meyden92PODS} & Undecidable \cite{JayramKV06PODS} & $\Pi_2^p$-Complete \cite{Meyden92PODS} & Undecidable \cite{JayramKV06PODS} \\ \hline First Order (SQL) Queries & Undecidable \cite{Trakhtenbrot50DANUSSR} & Undecidable & Undecidable & Undecidable \\ \hline \end{tabular} \caption{Complexities of Query Containment and Equivalence} \label{fig:complexity} \end{figure*} \begin{figure} \tikzset{ internode/.style = {shape=circle, draw, align=center} } \begin{tikzpicture} \begin{scope} \node [internode] (root) {} child {node (n1) {$\sigma_{R_1}$}} child {node (n2) {$\sigma_{R_2}$}}; \node [text width=6cm, anchor=east] at (6.5, 0) {Schema of $t_1$ (left)}; \end{scope} \begin{scope}[xshift=4cm] \node [internode] {} child {node [internode] {} child {node (n3) {$\sigma_{R_1}$}} child {node (n4) {$\sigma_{R_1}$}} } child {node (n5) {$\sigma_{R_2}$}}; \node [text width=6cm, anchor=east] at (6.5, 0) {Schema of $t_1$ (right)}; \end{scope} \draw[->, dashed, blue] (n3)--(n1); \draw[->, dashed, blue] (n4)--(n1); \draw[->, dashed, blue] (n5)--(n2); \end{tikzpicture} \begin{tikzpicture} \begin{scope} \node [internode] (root) {} child {node (n1) {$\sigma_{R_1}$}} child {node (n2) {$\sigma_{R_2}$}}; \node [text width=6cm, anchor=east] at (6.5, 0) {Schema of $t_1$ (left)}; \end{scope} \begin{scope}[xshift=4cm] \node [internode] {} child {node [internode] {} child {node (n3) {$\sigma_{R_1}$}} child {node (n4) {$\sigma_{R_1}$}} } child {node (n5) {$\sigma_{R_2}$}}; \node [text width=6cm, anchor=east] at (6.5, 0) {Schema of $t_1$ (right)}; \end{scope} \draw[->, dashed, red] (n1)--(n3); \draw[->, dashed, red] (n2)--(n5); \end{tikzpicture} \caption{The mappings found to prove the conjunctive query example, blue lines show the mapping found to prove left $\rightarrow$ right, red lines show the mapping found to prove right $\rightarrow$ left. } \label{fig:mappings} \end{figure} The equivalence of two SQL queries is in general undecidable. Figure~\ref{fig:complexity} shows the complexities of deciding containment and equivalence of subclasses of SQL. The most well-known subclass are conjunctive queries, which are of the form \texttt{DISTINCT SELECT $p$ FROM $q$ WHERE $b$}, where $p$ is a sequence of arbitrarily many attribute projections, $q$ is the cross product of arbitrarily many input relations, and $b$ is a conjunct consisting of arbitrarily many equality predicates between attribute projections. We implement a decision procedure to automatically prove the equivalence of conjunctive queries in \inputLang. After denoting the \inputLang query to \outputLang, the decision procedure automates steps similar to the proof in Section \ref{sec:agg-rule}. First, after applying functional extensionality, both sides become squash types due to the \texttt{DISTINCT} clause. The procedure then applies the fundamental lemma about squash types $\forall A B, (A \leftrightarrow B) \Rightarrow (A = B)$. In both cases of the resulting bi-implication, the procedure tries all possible instantiations of the $\Sigma$, which is due to the \texttt{SELECT} clause. This search for the correct instantiation is implemented using Ltac's built-in backtracking support. The procedure then rewrites all equalities and tries to discharge the proof by direct application of hypotheses. The following is an example of two equivalent conjunctive SQL queries that we can solve using our decision procedure: \begin{small} \[ \begin{array}{ll} \texttt{SELECT DISTINCT $x$.$c_1$ FROM $R_1$ AS $x$, $R_2$ AS $y$} \\ \texttt{WHERE $x$.$c_2$ = $y$.$c_3$} & \quad \equiv \\ \texttt{SELECT DISTINCT $x$.$c_1$ FROM $R_1$ AS $x$, $R_1$ AS $y$, $R_2$ AS $z$} \\ \texttt{WHERE $x$.$c_1$ = $y$.$c_1$ AND $x$.$c_2$ = $z$.$c_3$} \end{array} \] \end{small} The same queries can be expressed in \inputLang as follows, where the schema of $R_i$ is $\sigma_{R_i}$: \begin{small} \[ \begin{array}{ll} \llbracket \Gamma \vdash \texttt{DISTINCT SELECT Right.Left.$c_1$ FROM $R_1$, $R_2$} \\ \qquad \quad \texttt{WHERE Right.Left.$c_2$ = Right.Right.$c_3$} :\sigma \rrbracket \quad \equiv \\ \llbracket \Gamma \vdash \texttt{DISTINCT SELECT Right.Left.Left.$c_1$} \\ \qquad \quad \texttt{FROM (FROM $R_1$, $R_1$), $R_2$} \\ \qquad \quad \texttt{WHERE Right.Left.Left.$c_1$ = Right.Left.Right.$c_1$ AND } \\ \qquad \qquad \qquad \texttt{Right.Left.Left.$c_2$ = Right.Right.$c_3$} : \sigma \rrbracket \end{array} \] \end{small} \noindent which is denoted as: \begin{small} \[ \begin{array}{ll} \lambda \; \context \; \tuple. \; \| \sum_{t_1} \denote{R_1} \; g \fst{t_1} \times \denote{R_2} \; g \; \snd{t_1} \times{} \\ \qquad \quad (\denote{c_2} \; \fst{t_1} = \denote{c_3} \; \snd{t_1} ) \times {} \\ \qquad \quad (\denote{c_1} \; \fst{t_1} = t) \times \| \qquad \equiv \\ \lambda \; \context \; \tuple. \; \| \sum_{t_1} \denote{R_1} \; g \; \fst{\fst{t_1}} \times \denote{R_1} \; g \; \snd{\fst{t_1}} \times \denote{R_2} \; g \; \snd{t_1} \times{} \\ \qquad \quad (\denote{c_1} \; \fst{\fst{t_1}} = \denote{c_1} \; \snd{\fst{t_1}}) \times (\denote{c_2} \; \fst{\fst{t_1}} = \denote{c_3} \; \snd{t_1}) \times{} \\ \qquad \quad (\denote{c_1} \fst{\fst{t_1}} = t) \| \end{array} \] \end{small} The decision procedure turns this goal into a bi-implication, which it proves by cases. For the $\rightarrow$ case, the decision procedure destructs the available $\Sigma$ witness into tuple $t_x$ from $R_1$ and $t_y$ from $R_2$ and tries all instantiations of $t_1$ using these tuples. The instantiation $t_1 = ((t_x, t_x), t_y)$ allows the procedure to complete the proof after rewriting all equalities. For the $\leftarrow$ case, the available tuples are $t_x$ from $R_1$, $t_y$ from $R_1$, and $t_z$ from $R_2$. The instantiation $t_1 = (t_x, t_z)$ allows the procedure to complete the proof after rewriting all equalities. This assignment is visualized in Figure~\ref{fig:mappings}. \section{\sem and Its Semantics} \label{sec:semantics} In this section, we present \sem, a SQL-like language for expressing rewrite rules. To simplify discussion, we first describe how relational data structures are modeled in Section~\ref{sec:data-model}. We then describe \sem, a language built on top of our relational data structures that covers all major features of SQL, in Section~\ref{sec:input-lang}. Next, we define \outputLang, the formal expressions into which \sem is translated, in Section~\ref{sec:target-lang}. \subsection{Data Model} \label{sec:data-model} We first describe how schemas for relations and tuples are modeled in \sem. Both of these foundational concepts from relational theory~\cite{Codd70CACM} are what \sem uses to build upon. \begin{figure}[t] \[ \begin{array}{llll} \tau \in \texttt{Type} & ::= & \texttt{int} ~|~ \texttt{bool} ~|~ \texttt{string} ~|~ \; \ldots \\ \denote{\texttt{int}} & ::= & \mathds{Z} \\ \denote{\texttt{bool}} & ::= & \mathds{B} \\ \denote{\texttt{string}} & ::= & String \\ \ldots & & \\ \\ \sigma \in \texttt{Schema} & ::= & \texttt{empty} \\ & \; \mid & \leaf{\tau} \\ & \; \mid & \node{\sigma_1}{\sigma_2} \\ \\ \texttt{Tuple} \; \texttt{empty} & ::= & \texttt{Unit} \\ \texttt{Tuple} \; (\node{\sigma_1}{\sigma_2}) & ::= & \texttt{Tuple} \; \sigma_1 \times \texttt{Tuple} \; \sigma_2 \\ \texttt{Tuple} \; (\leaf{\tau}) & ::= & \denote{\tau} \\ \end{array} \] \caption{Data Model of \sem} \label{fig:data-model} \end{figure} \begin{figure}[t] \begin{minipage}{.4\columnwidth} \tikzset{ internode/.style = {shape=circle, draw, align=center} } \begin{tikzpicture} \begin{scope} \node [internode, anchor=north] (root) at (0, 0) {} child {node {\texttt{string}}} child {node [internode] {} child {node {\texttt{int}}} child {node {\texttt{bool}}} }; \end{scope} \end{tikzpicture} \end{minipage} \begin{minipage}{.6\columnwidth} \begin{small} \[ \begin{array}{lll} \sigma : \texttt{Schema} & = & \node{(\leaf{\texttt{int}})}{} \\ & & \quad (\node{(\leaf{\texttt{int}})}{} \\ & & \quad\quad (\leaf{\texttt{bool}})) \\ \texttt{Tuple} \; \sigma & = & String \times (\mathds{Z} \times \mathds{B}) \\ t : \texttt{Tuple} \; \sigma & = & \mkPair{``Bob''}{\mkPair{52}{\texttt{true}}} \end{array} \] \end{small} \end{minipage} \caption{An Example of \sem Schema and Tuple} \label{ex:data-model} \end{figure} \paragraph{Schema and Tuple} We briefly review the standard SQL definitions of a schema and a tuple. Conceptually, a database schema is an unordered bag of $(n, \tau)$ pairs, where $n$ is an attribute name, and $\tau$ is the type of the attribute. For example, the schema of a table containing personal information might be: \[ \{(\text{Name}, \texttt{string}), (\text{Age}, \texttt{int}), (\text{Married}, \texttt{bool})\} \] A database tuple is a collection of values that conform to a given schema. For example, the following is a tuple with the aforementioned schema: \[ \{\text{Name}:\text{``Bob''}; \; \text{Age}:52; \; \text{Married}: \texttt{true} \} \] Attributes from tuples are accessed using record syntax. For instance $t.\text{Name}$ returns ``Bob'' where $t$ refers to the tuple above. As shown in Figure~\ref{fig:data-model}, we assume there exists a set of SQL types \texttt{Type}, which can be denoted into types in Coq. In \sem, we define schemas and tuples as follows. A schema is modeled as a collection of types organized in a binary tree, with each type corresponding to an attribute. As shown in~\figref{data-model}, a schema can be constructed from the $\texttt{empty}$ schema, an individual type $\tau$, or recursively from two schema nodes $s_1$ and $s_2$, corresponding to the branches of the subtree. As we will see, this organization is beneficial in both writing \sem rewrite rules and also reasoning about the equivalence of schemas. The tuple type in \sem is defined as a dependent type on a schema. As shown in~\figref{data-model}, a tuple is an nested pair with the identical structure as its schema. Given a schema $s$, if $s$ is the empty schema, then the (only) instance of $\texttt{Tuple} \; \texttt{empty}$ is {\tt Unit} (i.e., empty) tuple. Otherwise, if $s$ is a leaf node in the schema tree with type $\tau$, then a tuple is simply a value of the type $\D{\tau}$. Finally, if $s$ is recursively defined using two schemas $s_1$ and $s_2$, then the resulting tuple is an instance of a product type $\texttt{Tuple}(s_1) \times \texttt{Tuple}(s_2)$. As an illustration, Figure~\ref{ex:data-model} shows a tuple $t$ and its schema $\sigma$, where $\sigma$ = \texttt{(node (leaf \textrm{Int}) (node (leaf \textrm{Int}) (leaf \textrm{Int})))} and $t$ has the nested pair type $(String \times (\mathds{Z} \times \mathds{B}))$. To access an element from a tuple, \sem uses path expressions with selectors $\texttt{Left}$ and $\texttt{Right}$. For instance, the path $\texttt{Left}.\texttt{Right}$ retrieves the value 52 from the tuple $t$ in \figref{data-model}. As will be shown in \secref{denotation}, path expressions will be denoted to standard pair operations, i.e., $\texttt{Left}$ will be denoted to ``$\fst{}$'', which returns the first element from a pair, and $\texttt{Left}$ will be denoted to ``$\snd{}$'', which returns the second. Such expressions can be composed to retrieve nested pair types. For instance, $\texttt{Left}.\texttt{Right}$ will be denoted to ``$\snd{\fst{}}$'', thus it retrieves 52 from $t$ in \figref{data-model}. \paragraph{Relation} In \sem a relation is modeled as a function from tuples to homotopy types called HoTT-relations, $\texttt{Tuple} \; \sigma \rightarrow \mathcal{U}$, as already discussed in~\secref{overview}; we define homotopy types shortly. \paragraph{Discussion} We briefly comment on our choice of data model. There are two approaches to defining tuples in database theory \cite{TheAliceBook}: the named approach and unnamed approach. We chose an unnamed approach, because it avoids name collisions, and because proof assistants like Coq can decide schema equivalence of unnamed schemas based on structural equality. Previous work~\cite{MalechaMSW10POPL} adopted an unnamed approach as well, for the same reason. Our choice for representing tuples as trees, rather than as ordered lists, is non-standard: we do this in order to allow our language to express generic rewrite rules, without specifying a particular schema for the input relations, see \secref{rewriteRules}. Finally, we note that, in our model, a tuple is a dependent type, which depends on its schema. We use dependent types to ensure that a tuple, which is a nested pair, must have the same structure as its schema, which is a binary tree, by construction. This allows us to denote a path expression (composed by $\texttt{Left}$, $\texttt{Right}$) to a series of corresponding pair operations (composed by ``$\fst{}$'', ``$\snd{}$'') easily. \subsection{\sem: A SQL-like Query Language} \label{sec:input-lang} We now describe \sem, our source language used to express rewrite rules. Figure~\ref{fig:sql-syntax} defines the syntax of \sem. We divide the language constructs of \sem into four categories: queries, predicates, expressions, and projections. \paragraph{Queries} A query takes in relation(s) and outputs another relation. The input to a query can be a base relation (called a $Table$ in~\figref{sql-syntax}) or other queries, including projections, cross product, selections, bag-wise operations (\texttt{UNION ALL} and \texttt{EXCEPT}), and finally conversion to sets (\texttt{DISTINCT}). \paragraph{Predicates} Predicates are used as part of selections (i.e., filtering of tuples) in queries. Given a tuple $t$, predicates return a Boolean value to indicate whether $t$ should be retained in the output relation. \paragraph{Expressions} Expressions are used both in predicates and projections, and they evaluate to values (e.g., of type $\mathds{Z}$, $\mathds{B}$, $String$, etc). Expression includes conversions from projection to expression ($\Var{p}$), uninterpreted functions on expressions, aggregators of a query, and casts of an expression ($\CastExpr{p}{e}$). $\Var{p}$ converts a projection $p$ into an expression. For example, $\Var{a} = \Var{b}$ is an equality predicate on attribute $a$ and attribute $b$, where $\Var{a}$ and $\Var{b}$ are the expressions representing attribute $a$ and $b$. As shown next, we use a projection to represent an attribute. Uninterpreted functions of expressions $f(e_1, \ldots, e_n)$ are used to represent arithmetic operations on expressions such as addition, multiplication, division, mode, and constants (which are nullary uninterpreted functions). $\texttt{CASTEXPR}$\; is a special construct that is used to represent castings of meta-variables to express generic query rewrite rules. A comprehensive discussion of meta-variables can be found in \secref{rewriteRules}. A normal (non-generic) query would not need $\texttt{CASTEXPR}$. \paragraph{Projections} When applied to a relation, projections denote a subset of attributes to be returned. A projection is defined to be a tuple to tuple function. It can be the identity function (\texttt{*}), or return the subtree denoted by any of the path expressions as discussed in~\secref{data-model}, such as returning the left (\texttt{Left}) or right (\texttt{Right}) subtree of the tuple. Any empty tuple can also be produced using \texttt{empty}. Multiple projections can be composed using ``{\tt .}''. Two projections $p_1$ and $p_2$ can be applied to the input tuple separately with the results combined together using ``{\tt ,}''. $\Evaluate{p}$ is used to convert a projection to an expression. Below are examples of \sem query using projections: \vspace{2mm} {\centering \begin{tabular}{lll} & SQL & \inputLang \\ \hline $q_1$ & \texttt{SELECT $R.*$ FROM $R, S$} & \texttt{SELECT Left.* FROM $R, S$} \\ $q_2$ & \texttt{SELECT $S.*$ FROM $R, S$} & \texttt{SELECT Right.* FROM $R, S$} \\ $q_3$ & \texttt{SELECT $S.p$ FROM $R, S$} & \texttt{SELECT Right.$p$ FROM $R, S$} \\ $q_4$ & \texttt{SELECT $R.p_1$, $S.p_2$} & \texttt{SELECT Left.$p_1$, Right.$p_2$} \\ &\texttt{FROM $R, S$} & \texttt{FROM $R, S$} \\ $q_5$ & \texttt{SELECT $p_1+p_2$ FROM $R$} & \texttt{SELECT $\Evaluate add(\Var{p_1},\Var{p_2})$} \\ & & \texttt{FROM $R$} \\ \end{tabular} } In $q_1$, we compose the path expressions \texttt{Left} and \texttt{*} to represent projecting all attributes of $R$ from a tuple that is in the result of $R \bowtie S$ \footnote{Technically $\bowtie$ denotes natural join in relational theory~\cite{Codd70CACM}. However, since \sem schemas are unnamed, there are no shared names between schemas, and thus natural joins are equivalent to cross products. Hence, we use $\bowtie$ for cross product of relations to distinguish it from Cartesian product of types ($\times$) to be discussed in~\secref{target-lang}.}. In $q_3$, we compose \texttt{Right} and $k$ to project to a single attribute from $S$. The variable $k$ is a projection to a singleton tuple, which is the way to represent attributes in our semantics. In $q_4$, we are projecting one attribute $p_1$ from $R$, and another attribute $p_2$ from $S$ using the projection combinator ``{\tt ,}''. In $q_5$, to represent $p_1+p_2$, we first convert attributes ($p_1$, $p_2$) to expressions ($\Var{p_1}$, $\Var{p_2}$), then use an uninterpreted function $\texttt{add}$ to represent addition, and cast that back to a projection using $\Evaluate$. \subsection{Expressing Rewrite Rules} \seclabel{rewriteRules} \sem is a language for expressing query rewrite rules, and each such rule needs to hold over all relations (i.e., both sides of each rule need to return the same relation for all schemas and instances, as discussed in~\secref{overview}), and likewise for predicates and expressions. To facilitate that, \sem allows users to declare meta-variables for queries, predicates, and expressions, and uses two functions $\CastPred{}{}$ and $\CastExpr{}{}$, as we illustrate next. First, consider meta-variables. Referring to~\figref{union-slct}, the base tables $R$ and $S$ are meta-variables that can be quantified over all possible relations, and $b$ is a meta-variable ranging over predicates. For another example, consider the rewrite rule in Fig.~\ref{fig:magic-distinct}: we want to say that the rule holds for any relation $R$ with a schema having an attribute $a$. We express this in \sem by using a meta-variable $p$ instead of the attribute $a$: \begin{flalign*} \quad\; & \texttt{DISTINCT} \; \SelectFrom{\texttt{Left}.p}{R, R} \\ & \texttt{WHERE \Var{\texttt{Left}.p} = \Var{\texttt{Right}.p}}\\ & \equiv \ \texttt{DISTINCT} \; \SelectFrom{p}{R} \end{flalign*} Since our data model is a tree, it is very convenient to use a meta-variable $p$ to navigate to any leaf (corresponding to an attribute), and it also easy to concatenate two schemas using the $\node{}{}$ constructor; in contrast, a data model based on ordered lists would make the combination of navigation and concatenation more difficult. Second, we explain the functions $\CastPred{}{}$ and $\CastExpr{}{}$ in \sem with another example. Consider the rewrite rule (to be presented in \secref{basic-rewrite}) for pushing down selection predicates, written informally as: \begin{small} \begin{flalign*} \quad\; & \SelectFrom{\texttt{*}}{R, \; (\SelectFromWhere{\texttt{*}}{S}{b})} \quad \equiv &\\ & \SelectFromWhere{\texttt{*}}{R, \; S}{b} & \end{flalign*} \end{small} In this rule, $b$ is a meta-variable that ranges over all possible Boolean predicates. In standard SQL, the two occurrences of $b$ are simply identical expressions, but in \sem the second occurrence is in a environment that consists of the schemas of both $R$ and $S$. In \sem, this is done rigorously using the $\CastPred{}$ construct: \begin{small} \begin{flalign*} \quad\; & \SelectFrom{\texttt{*}}{R, \; (\SelectFromWhere{\texttt{*}}{S}{b})} \quad \equiv &\\ & \SelectFromWhere{\texttt{*}}{R, \; S}{(\CastPred{\texttt{Right}}{b})} & \end{flalign*} \end{small} The expression $\CastPred{\texttt{Right}}{b}$ is function composition: it applies $\texttt{Right}$ first, to obtain the schema of $R$, then evaluates the predicate $b$ on the result. Requiring explicit casts is an important feature of \sem: doing so ensures that rewrite rules are only applicable in situations where they are valid. In the example above, the rule is only valid for all predicates $b$ where $b$ refers only to attributes in $S$, and the cast operation makes that explicit. The {\tt CASTEXPR} construct works similarly for expressions. \begin{figure}[t] \centering \[ \begin{array}{llll} q \in \texttt{Query} & ::= & \texttt{Table} \\ & \; \mid & \texttt{SELECT} \; p \; q \\ & \; \mid & \texttt{FROM} \; q_1, \ldots, q_n \\ & \; \mid & q \; \texttt{WHERE} \; p \\ & \; \mid & q_1 \; \texttt{UNION ALL} \; q_2 \\ & \; \mid & q_1 \; \texttt{EXCEPT} \; q_2 \\ & \; \mid & \texttt{DISTINCT} \; q \\ b \in \texttt{Predicate} & ::= & e_1 \; \texttt{=} \; e_2 \\ & \; \mid & \texttt{NOT} \; b \mid b_1 \; \texttt{AND} \; b_2 \mid b_1 \; \texttt{OR} \; b_2 \mid \texttt{true} \mid \texttt{false} \\ & \; \mid & \texttt{CASTPRED} \; p \; b \\ & \; \mid & \texttt{EXISTS} \; q \\ e \in \texttt{Expression} & ::= & \Var \; p \\ & \; \mid & f(e_1, \ldots, e_n) \mid agg(q) \\ & \; \mid & \texttt{CASTEXPR} \; p \; e \\ p \in \texttt{Projection} & ::= & \texttt{*} \mid \texttt{Left} \mid \texttt{Right} \mid \texttt{Empty} \\ & \; \mid & \Compose{p_1}{p_2} \\ & \; \mid & \Duplicate{p_1}{p_2} \\ & \; \mid & \Evaluate{e} \end{array} \] \caption{Syntax of \inputLang} \label{fig:sql-syntax} \end{figure} \subsection{UniNomials} \label{sec:target-lang} The interpretation of a \inputLang expression is a formal expression over \outputLang, which is an algebra of univalent types. \begin{definition} \outputLang, the algebra of Univalent Types, consists of $(\mathcal{U}, \textbf{0}, \textbf{1}, +, \times, \negate{\cdot}, \merely{\cdot}, \sum)$, where: \begin{itemize} \item $(\mathcal{U}, \textbf{0}, \textbf{1}, +, \times)$ forms a semi-ring, where $\mathcal{U}$ is the universe of univalent types, $\textbf{0}, \textbf{1}$ are the empty and singleton types, and $+, \times$ are binary operations $\mathcal{U} \times \mathcal{U} \rightarrow \mathcal{U}$: $n_1 + n_2$, is the direct sum, and $n_1 \times n_2$ is the Cartesian product. \item $\negate{\cdot}, \merely{\cdot}$ are derived unary operations $\mathcal{U} \rightarrow \mathcal{U}$, where $(\negate{\textbf{0}}) = \textbf{1}$ and $(\negate{n}) = \textbf{0}$ when $n\neq 0$, and $\merely{n}=\negate{(\negate{n})}$. \item $\sum : (A \rightarrow \mathcal{U}) \rightarrow \mathcal{U}$ is the infinitary operation: $\sum f$ is the direct sum of the set of types $\setof{f(a)}{a \in A}$. \end{itemize} \end{definition} Following standard notation~\cite{hottBook}, we say that the homotopy type $n$ inhabits some universe $\mathcal{U}$. The base cases of $n$ come from the denotation of HoTT-Relation and equality of two tuples (In HoTT, propositions are squash types, which are {\textbf{0}} or {\textbf{1}} \cite[Ch 1.11]{hottBook}). The denotation of \sem will be shown Section~\ref{sec:denotation}. There are 5 type-theoretic operations on $\mathcal{U}$: \paragraph{Cartesian product ($\times$)} Cartesian product of univalent types is analogously the same concept as the Cartesian product of two sets. For $A, B:\mathcal{U}$, the cardinality of $A \times B$ is the cardinality of $A$ multiplied by the cardinality of $B$. For example, we denote the cross product of two HoTT-Relations using the Cartesian product of univalent types: \[ \denote{R_1 \bowtie R_2} \triangleq \lambda \; \tuple. \; (\denote{R_1} \; \fst{t}) \times (\denote{R_2} \; \snd{t}) \] The result of $R_1 \bowtie R_2$ is a HoTT-Relation with type $\texttt{Tuple} \; \sigma_{R_1 \bowtie R_2}$ $\rightarrow \mathcal{U}$. For every tuple $t \in R_1 \bowtie R_2$, its cardinality equals to the cardinality of $t$'s left sub-tuple ($\fst{t}$) in $R_1$ ($\denote{R_1} \; \fst{t}$) multiplied by the cardinality of $t$'s right sub-tuple ($\snd{t}$) in $R_2$ ($\denote{R_2} \; \snd{t}$). \paragraph{Disjoint union ($+$)} Disjoint union on univalent types is analogously the same concept as union on two disjoint sets. For $A,B: \mathcal{U}$, the cardinality of $A + B$ is the cardinality of $A$ adding the cardinality of $B$. For example, \texttt{UNION ALL} denotes to $+$: \[ \denote{\UNIONALL{R_1}{R_2}} \triangleq \lambda \; \tuple. \; (\denote{R_1} \; t) + (\denote{R_2} \; t) \] In SQL, \texttt{UNION ALL} means bag semantic union of two relations. Thus a tuple $t \in \UNIONALL{R_1}{R_2}$ has a cardinality of its cardinality in $R_1$ ($\denote{R_1} \; t$) added by its cardinality in $R_2$ ($\denote{R_2} \; t$). We also denote logical \texttt{OR} of two predicates using $+$. $A+B$ is corresponded type-theoretic operation of logical OR if $A$ and $B$ are squash types (recall that squash types are {\textbf{0}} or \textbf{1} ~\cite[Ch 1.11]{hottBook}). \paragraph{Squash ($\merely{n}$)} Squash is a type-theoretic operation that truncates a univalent type to {\textbf{0}} or \textbf{1}. For $A:\mathcal{U}$, $\merely{A} = \textbf{0}$ if $A$'s cardinality is zero and $\merely{A} = \textbf{1}$ otherwise. An example of using squash types is in denoting \texttt{DISTINCT} (\texttt{DISTINCT} means removing duplicated tuples in SQL, i.e., converting a bag to a set): \[ \denote{\DISTINCT{R}} \triangleq \lambda \; \tuple. \; \merely{\denote{R} \; t} \] For a tuple $t \in \DISTINCT{R}$, its cardinality equals to $1$ if its cardinality in $R$ is non-zero and equals to $0$ otherwise. This is exactly $\merely{\denote{R}\; t}$. \paragraph{Negation ($\negate{n}$)} If $n$ is a squash type, $\negate{n}$ is the negation of $n$. We have $\negate{\textbf{0}} = \textbf{1}$ and $\negate{\textbf{1}} = \textbf{0}$. Negation is used to denote negating a predicate and to denote \texttt{EXCEPT} . For example, \texttt{EXCEPT} is used to denote negation: \[ \denote{R_1 \; \texttt{EXCEPT} \; R_2} \triangleq \lambda \; \tuple. \; (\denote{R_1} \; t) \times (\negate{\merely{\denote{R_2} \; t}}) \] A tuple $t \in R_1 \; \texttt{EXCEPT} \; R_2$ retains its multiplicity in $R_1$ if its multiplicity in $R_2$ is not 0 (since if $\denote{R_2} \; t \neq \textbf{0}$, then ${\merely{\denote{R_2} \; t} \rightarrow \textbf{0}} = \textbf{1} $). \paragraph{Summation ($\sum$)} Given $A:\mathcal{U}$ and $B:A \rightarrow \mathcal{U}$, \;$\sum_{x:A} B(x)$ is a dependent pair type $\sum$ is used to denote projection. For example: \[ \denote{\texttt{SELECT $k$ FROM $R$}} \triangleq \lambda \; \tuple. \; \sum_{t': \texttt{Tuple} \; \sigma_R} \merely{\denote{k} \; t' = t} \times \denote{R} \; t' \] For a tuple $t$ in the result of this projection query, its cardinality is the summation of the cardinalities of all tuples of schema $\sigma_A$ that also has the same value on column $k$ with $t$. Here $\merely{\denote{k} \; t' = t}$ equals to \textbf{1}~if $t$ and $t'$ have same value on $k$, otherwise it equals to \textbf{0}. Unlike $K$-Relations, using univalent types allow us to support summation over an infinite domain and evaluate expressions such as the projection described above. In general, proving rewrite rules in \outputLang enables us to use powerful automatic proving techniques such as associative-commutative term rewriting in semi-ring structures (recall that $\mathcal{U}$ is a semi-ring) similar to the \texttt{ring} tactic~\cite{ringtac} and Nelson-Oppen algorithm on congruence closure~\cite{NelsonO80JACM}. Both of which mitigate our proof burden.
{'timestamp': '2016-08-09T02:00:58', 'yymm': '1607', 'arxiv_id': '1607.04822', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04822'}
arxiv
\section{Introduction} \paragraph{\bf Hard lattice problems.} Lattices are discrete subgroups of $\mathbb{R}^d$. More concretely, given a basis $B = \{\vc{b}_1, \dots, \vc{b}_d\} \subset \mathbb{R}^d$, the lattice $\mathcal{L} = \mathcal{L}(B)$ generated by $B$ is defined as $\mathcal{L}(B) = \left\{\sum_{i=1}^d \lambda_i \vc{b}_i: \lambda_i \in \mathbb{Z}\right\}$. Given a basis of a lattice $\mathcal{L}$, the Shortest Vector Problem (SVP) asks to find a shortest non-zero vector in $\mathcal{L}$ under the Euclidean norm, i.e., a non-zero lattice vector $\vc{s}$ of norm $\|\vc{s}\| = \lambda_1(\mathcal{L}) := \min_{\vc{v} \in \mathcal{L} \setminus \{\vc{0}\}} \|\vc{v}\|$. Given a basis of a lattice and a target vector $\vc{t} \in \mathbb{R}^d$, the Closest Vector Problem (CVP) asks to find a vector $\vc{s} \in \mathcal{L}$ closest to $\vc{t}$ under the Euclidean distance, i.e.\ such that $\|\vc{s} - \vc{t}\| = \min_{\vc{v} \in \mathcal{L}} \|\vc{v} - \vc{t}\|$. These two hard problems are fundamental in the study of lattice-based cryptography, as the security of these schemes is directly related to the hardness of SVP and CVP in high dimensions. Various other hard lattice problems, such as Learning With Errors (LWE) and the Shortest Integer Solution (SIS) problem are closely related to SVP and CVP, and many reductions between these and other hard lattice problems are known; see e.g.\ \cite[Figure 3.1]{laarhoven12kolkata} or \cite{stephens16} for an overview. These reductions show that being able to solve CVP efficiently implies that almost all other lattice problems can also be solved efficiently in the same dimension, which makes the study of the hardness of CVP even more important for choosing parameters in lattice-based cryptography. \paragraph{\bf Algorithms for SVP and CVP.} Although SVP and CVP are both central in the study of lattice-based cryptography, algorithms for SVP have received somewhat more attention, including a benchmarking website to compare different algorithms~\cite{svp}. Various SVP methods have been studied which can solve CVP as well, such as enumeration (see e.g.\ \cite{kannan83, fincke85, gama10, micciancio15}), discrete Gaussian sampling~\cite{aggarwal15, aggarwal15b}, constructing the Voronoi cell of the lattice~\cite{agrell02, micciancio10}, and using a tower of sublattices~\cite{becker14}. On the other hand, for the asymptotically fastest method in high dimensions for SVP\footnote{To obtain provable guarantees, sieving algorithms are commonly modified to facilitate a somewhat artificial proof technique, which drastically increases the time complexity beyond e.g.\ the discrete Gaussian sampler and the Voronoi cell algorithm~\cite{ajtai01, nguyen08, pujol09, micciancio10b}. On the other hand, if some natural heuristic assumptions are made to enable analyzing the algorithm's behavior, then sieving clearly outperforms these methods. We focus on heuristic sieving in this paper.}, lattice sieving, it is not known how to solve CVP with similar costs as SVP. After a series of theoretical works on constructing efficient heuristic sieving algorithms~\cite{nguyen08, micciancio10b, wang11, zhang13, laarhoven15crypto, laarhoven15latincrypt, becker15nns, becker16cp, becker16lsf} as well as practical papers studying how to speed up these algorithms even further~\cite{milde11, schneider11, schneider13, bos14, fitzpatrick14, ishiguro14, mariano14, mariano14b, mariano15, mariano16pdp, mariano16}, the best time complexity for solving SVP currently stands at $2^{0.292d + o(d)}$~\cite{becker16lsf, mariano16}. Although for various other methods the complexities for solving SVP and CVP are similar~\cite{gama10, micciancio10, aggarwal15b}, one can only guess whether the same holds for lattice sieving methods. To date, the best heuristic time complexity for solving CVP in high dimensions stands at $2^{0.377d + o(d)}$, due to Becker--Gama--Joux~\cite{becker14}. \subsection{Contributions} In this paper we revisit heuristic lattice sieving algorithms, as well as the recent trend to speed up these algorithms using nearest neighbor searching, and we investigate how these algorithms can be modified to solve CVP and its generalizations. We present two different approaches for solving CVP with sieving, each of which we argue has its own merits. \paragraph{\bf Adaptive sieving.} In \textit{adaptive sieving}, we adapt the entire sieving algorithm to the problem instance, including the target vector. As the resulting algorithm is tailored specifically to the given CVP instance, this leads to the best asymptotic complexity for solving a single CVP instance out of our two proposed methods: $2^{0.292d + o(d)}$ time and space. This method is very similar to solving SVP with lattice sieving, and leads to equivalent asymptotics on the space and time complexities as for SVP. The corresponding space-time tradeoff is illustrated in Figure~\ref{fig:1}, and equals that of \cite{becker16lsf} for solving SVP. \paragraph{\bf Non-adaptive sieving.} Our main contribution, \textit{non-adaptive sieving}, takes a different approach, focusing on cases where several CVP instances are to be solved on the same lattice. The goal here is to minimize the costs of computations depending on the target vector, and spend more time on preprocessing the lattice, so that the amortized time complexity per instance is smaller when solving many CVP instances on the same lattice. This is very closely related to the Closest Vector Problem with Preprocessing (CVPP), where the difference is that we allow for exponential-size preprocessed space. Using nearest neighbor techniques with a balanced space-time tradeoff, we show how to solve CVPP with $2^{0.636d + o(d)}$ space and preprocessing, in $2^{0.136d + o(d)}$ time. A continuous tradeoff between the two complexities can be obtained, where in the limit we can solve CVPP with $(1/\varepsilon)^{O(d)}$ space and preprocessing, in $2^{\varepsilon d + o(d)}$ time. This tradeoff is depicted in Figure~\ref{fig:1}. A potential application of non-adaptive sieving is as a subroutine within enumeration methods. As described in e.g.\ \cite{gama10}, at any given level in the enumeration tree, one is attempting to solve a CVP instance in a lower-dimensional sublattice of $\mathcal{L}$, where the target vector is determined by the path chosen from the root to the current node in the tree. That means that if we can preprocess this sublattice such that the amortized time complexity of solving CVPP is small, then this could speed up processing the bottom part of the enumeration tree. This in turn might help speed up the lattice basis reduction algorithm BKZ~\cite{schnorr87, schnorr94, chen11}, which commonly uses enumeration as its SVP subroutine, and is key in assessing the security of lattice-based schemes. As the preprocessing needs to be performed once, CVPP algorithms with impractically large preprocessing costs may not be useful, but we show that with sieving the preprocessing costs can be quite small. \begin{figure}[!t] {\center \includegraphics{sievingcvp-figure1}} \caption{Heuristic complexities for solving the Closest Vector Problem (CVP), the Closest Vector Problem with Preprocessing (CVPP), Bounded Distance Decoding with Preprocessing ($\delta$-BDDP), and the Approximate Closest Vector Problem with Preprocessing ($\kappa$-CVPP). The red curve shows CVP complexities of Becker--Gama--Joux~\cite{becker14}. The left blue curve denotes CVP complexities of adaptive sieving. The right blue curve shows exact CVPP complexities using non-adaptive sieving. Purple curves denote relaxations of CVPP corresponding to different parameters $\delta$ (BDD radius) and $\kappa$ (approximation factor). Note that exact CVPP corresponds to $\delta$-BDDP with $\delta = 1$ and to $\kappa$-CVPP with $\kappa = 1$.\label{fig:1}} \end{figure} \paragraph{\bf Outline.} The remainder of the paper is organized as follows. In Section~\ref{sec:pre} we describe some preliminaries, such as sieving algorithms and a useful result on nearest neighbor searching. Section~\ref{sec:ad} describes adaptive sieving and its analysis for solving CVP without preprocessing. Section~\ref{sec:non} describes the preprocessing approach to solving CVP, with complexity analyses for exact CVP and some of its relaxations. \section{Preliminaries} \label{sec:pre} \subsection{Lattice sieving for solving SVP} Heuristic lattice sieving algorithms for solving the shortest vector problem all use the following basic property of lattices: if $\vc{v}, \vc{w} \in \mathcal{L}$, then their sum/difference $\vc{v} \pm \vc{w} \in \mathcal{L}$ is a lattice vector as well. Therefore, if we have a long list $L$ of lattice vectors stored in memory, we can consider combinations of these vectors to obtain new, shorter lattice vectors. To make sure the algorithm makes progress in finding shorter lattice vectors, $L$ needs to contain a lot of lattice vectors; for vectors $\vc{v}, \vc{w} \in \mathcal{L}$ of similar norm, the vector $\vc{v} - \vc{w}$ is shorter than $\vc{v}, \vc{w}$ iff the angle between $\vc{v}, \vc{w}$ is smaller than $\pi/3$, which for random vectors $\vc{v}, \vc{w}$ occurs with probability $(3/4)^{d/2 + o(d)}$. The expected space complexity of heuristic sieving algorithms follows directly from this observation: if we draw $(4/3)^{d/2 + o(d)}$ random vectors from the unit sphere, we expect a large number of pairs of vectors to have angle less than $\pi/3$, leading to many short difference vectors. This is exactly the heuristic assumption used in analyzing these sieving algorithms: when normalized, vectors in $L$ follow the same distribution as vectors sampled uniformly at random from the unit sphere. \begin{heuristic} \label{heur:1} When normalized, the list vectors $\vc{w} \in L$ behave as i.i.d.\ uniformly distributed random vectors from the unit sphere $\mathcal{S}^{d-1} := \{\vc{x} \in \mathbb{R}^d: \|\vc{x}\| = 1\}$. \end{heuristic} Therefore, if we start by sampling a list $L$ of $(4/3)^{d/2 + o(d)}$ long lattice vectors, and iteratively consider combinations of vectors in $L$ to find shorter vectors, we expect to keep making progress. Note that naively, combining pairs of vectors in a list of size $(4/3)^{d/2 + o(d)} \approx 2^{0.208d + o(d)}$ takes time $(4/3)^{d + o(d)} \approx 2^{0.415d + o(d)}$. \paragraph{\bf The Nguyen-Vidick sieve.} The heuristic sieve algorithm of Nguyen and Vidick~\cite{nguyen08} starts by sampling a list $L$ of $(4/3)^{d/2 + o(d)}$ long lattice vectors, and uses a \textit{sieve} to map $L$, with maximum norm $R := \max_{\vc{v} \in L} \|\vc{v}\|$, to a new list $L'$, with maximum norm at most $\gamma R$ for $\gamma < 1$ close to $1$. By repeatedly applying this sieve, after $\operatorname{poly}(d)$ iterations we expect to find a long list of lattice vectors of norm at most $\gamma^{\operatorname{poly}(d)} R = O(\lambda_1(\mathcal{L}))$. The final list is then expected to contain a shortest vector of the lattice. Algorithm~\ref{alg:nv} in Appendix~\ref{app:alg} describes a sieve equivalent to Nguyen-Vidick's original sieve, to map $L$ to $L'$ in $|L|^2$ time. \paragraph{\bf Micciancio and Voulgaris' GaussSieve.} Micciancio and Voulgaris used a slightly different approach in the GaussSieve~\cite{micciancio10b}. This algorithm reduces the memory usage by immediately \textit{reducing} all pairs of lattice vectors that are sampled. The algorithm uses a single list $L$, which is always kept in a state where for all $\vc{w}_1, \vc{w}_2 \in L$, $\|\vc{w}_1 \pm \vc{w}_2\| \geq \|\vc{w}_1\|, \|\vc{w}_2\|$, and each time a new vector $\vc{v} \in \mathcal{L}$ is sampled, its norm is reduced with vectors in $L$. After the norm can no longer be reduced, the vectors in $L$ are reduced with $\vc{v}$. Modified list vectors are added to a stack to be processed later (to maintain the pairwise reduction-property of $L$), and new vectors which are pairwise reduced with $L$ are added to $L$. Immediately reducing all pairs of vectors means that the algorithm uses less time and memory in practice, but at the same time Nguyen and Vidick's heuristic proof technique does not apply here. However, it is commonly believed that the same bounds $(4/3)^{d/2 + o(d)}$ and $(4/3)^{d + o(d)}$ on the space and time complexities hold for the GaussSieve. Pseudocode of the GaussSieve is given in Algorithm~\ref{alg:gauss} in Appendix~\ref{app:alg}. \subsection{Nearest neighbor searching} Given a data set $L \subset \mathbb{R}^d$, the nearest neighbor problem asks to preprocess $L$ such that, when given a query $\vc{t} \in \mathbb{R}^d$, one can quickly return a nearest neighbor $\vc{s} \in L$ with distance $\|\vc{s} - \vc{t}\| = \min_{\vc{w} \in L} \|\vc{w} - \vc{t}\|$. This problem is essentially identical to CVP, except that $L$ is a finite set of unstructured points, rather than the infinite set of all points in a lattice $\mathcal{L}$. \paragraph{\bf Locality-Sensitive Hashing/Filtering (LSH/LSF).} A celebrated technique for finding nearest neighbors in high dimensions is Locality-Sensitive Hashing (LSH)~\cite{indyk98, wang14}, where the idea is to construct many random partitions of the space, and store the list $L$ in hash tables with buckets corresponding to regions. Preprocessing then consists of constructing these hash tables, while a query $\vc{t}$ is answered by doing a lookup in each of the hash tables, and searching for a nearest neighbor in these buckets. More details on LSH in combination with sieving can be found in e.g.\ \cite{laarhoven15crypto, laarhoven15latincrypt, becker15nns, becker16cp}. Similar to LSH, Locality-Sensitive Filtering (LSF)~\cite{becker16lsf, laarhoven15nns} divides the space into regions, with the added relaxation that these regions do not have to form a partition; regions may overlap, and part of the space may not be covered by any region. This leads to improved results compared to LSH when $L$ has size exponential in $d$~\cite{becker16lsf, laarhoven15nns}. Below we restate one of the main results of~\cite{laarhoven15nns} for our applications. The specific problem considered here is: given a data set $L \subset \mathcal{S}^{d-1}$ sampled uniformly at random, and a random query $\vc{t} \in \mathcal{S}^{d-1}$, return a vector $\vc{w} \in L$ such that the angle between $\vc{w}$ and $\vc{t}$ is at most $\theta$. The following result further assumes that the list $L$ contains $n = (1 / \sin \theta)^{d + o(d)}$ vectors. \begin{lemma} \label{lem:nns} \cite[Corollary 1]{laarhoven15nns} Let $\theta \in (0, \frac{1}{2} \pi)$, and let $u \in [\cos \theta, 1/\cos \theta]$. Let $L \subset \mathcal{S}^{d-1}$ be a list of $n = (1 / \sin \theta)^{d + o(d)}$ vectors sampled uniformly at random from $\mathcal{S}^{d-1}$. Then, using spherical LSF with parameters $\alpha_{\mathrm{q}} = u \cos \theta$ and $\alpha_{\mathrm{u}} = \cos \theta$, one can preprocess $L$ in time $n^{1 + \rho_{\mathrm{u}} + o(1)}$, using $n^{1 + \rho_{\mathrm{u}} + o(1)}$ space, and with high probability answer a random query $\vc{t} \in \mathcal{S}^{d-1}$ correctly in time $n^{\rho_{\mathrm{q}} + o(1)}$, where: \begin{align} n^{\rho_{\mathrm{q}}} &= \left(\frac{\sin^2 \theta \, (u \cos \theta + 1)}{u \cos \theta - \cos 2 \theta}\right)^{d/2}, \quad n^{\rho_{\mathrm{u}}} = \left(\frac{\sin^2 \theta}{1 - \cot^2 \theta\left(u^2 - 2 u \cos \theta + 1\right)}\right)^{d/2}. \label{eq:main3} \end{align} \end{lemma} Applying this result to sieving for solving SVP, where $n = \sin(\frac{\pi}{3})^{-d + o(d)}$ and we are looking for pairs of vectors at angle at most $\frac{\pi}{3}$ to perform reductions, this leads to a space and preprocessing complexity of $n^{0.292d + o(d)}$, and a query complexity of $2^{0.084d + o(d)}$. As the preprocessing in sieving is only performed once, and queries are performed $n \approx 2^{0.208d + o(d)}$ times, this leads to a reduction of the complexities of sieving (for SVP) from $2^{0.208d + o(d)}$ space and $2^{0.415d + o(d)}$ time, to $2^{0.292d + o(d)}$ space and time~\cite{becker16lsf}. \section{Adaptive sieving for CVP} \label{sec:ad} We present two methods for solving CVP using sieving, the first of which we call \textit{adaptive sieving} -- we adapt the entire sieving algorithm to the particular CVP instance, to obtain the best overall time complexity for solving one instance. When solving several CVP instances, the costs roughly scale linearly with the number of instances. \subsubsection{Using one list.} The main idea behind this method is to translate the SVP algorithm by the target vector $\vc{t}$; instead of generating a long list of lattice vectors reasonably close to $\vc{0}$, we generate a list of lattice vectors close to $\vc{t}$, and combine lattice vectors to find lattice vectors even closer vectors to $\vc{t}$. The final list then hopefully contains a closest vector to $\vc{t}$. One quickly sees that this does not work, as the fundamental property of lattices does not hold for the lattice coset $\vc{t} + \mathcal{L}$: if $\vc{w}_1, \vc{w}_2 \in \vc{t} + \mathcal{L}$, then $\vc{w}_1 \pm \vc{w}_2 \notin \vc{t} + \mathcal{L}$. In other words, two lattice vectors close to $\vc{t}$ can only be combined to form lattice vectors close to $\vc{0}$ or $2 \vc{t}$. So if we start with a list of vectors close to $\vc{t}$, and combine vectors in this list as in the Nguyen-Vidick sieve, then after one iteration we will end up with a list $L'$ of lattice vectors close to $\vc{0}$. \subsubsection{Using two lists.} To make the idea of translating the whole problem by $\vc{t}$ work for the Nguyen-Vidick sieve, we make the following modification: we keep track of two lists $L = L_{\vc{0}}$ and $L_{\vc{t}}$ of lattice vectors close to $\vc{0}$ and $\vc{t}$, and construct a sieve which maps two input lists $L_{\vc{0}}, L_{\vc{t}}$ to two output lists $L_{\vc{0}}', L_{\vc{t}}'$ of lattice vectors slightly closer to $\vc{0}$ and $\vc{t}$. Similar to the original Nguyen-Vidick sieve, we then apply this sieve several times to two initial lists $(L_{\vc{0}}, L_{\vc{t}})$ with a large radius $R$, to end up with two lists $L_{\vc{0}}$ and $L_{\vc{t}}$ of lattice vectors at distance at most approximately $\sqrt{4/3} \cdot \lambda_1(\mathcal{L})$ from $\vc{0}$ and $\vc{t}$\footnote{Observe that by the Gaussian heuristic, there are $(4/3)^{d/2 + o(d)}$ vectors in $\mathcal{L}$ within any ball of radius $\sqrt{4/3} \cdot \lambda_1(\mathcal{L})$. So the list size of the NV-sieve will surely decrease below $(4/3)^{d/2}$ when $R < \sqrt{4/3} \cdot \lambda_1(\mathcal{L})$.}. The argumentation that this algorithm works is almost identical to that for solving SVP, where we now make the following slightly different heuristic assumption. \begin{heuristic} \label{heur:2} When normalized, the list vectors $L_{\vc{0}}$ and $L_{\vc{t}}$ in the modified Nguyen-Vidick sieve both behave as i.i.d.\ uniformly distributed random vectors from the unit sphere. \end{heuristic} The resulting algorithm, based on the Nguyen-Vidick sieve, is presented in Algorithm~\ref{alg:nv-adaptive}. \begin{algorithm}[!t] \caption{The adaptive Nguyen-Vidick sieve for finding closest vectors} \label{alg:nv-adaptive} \begin{algorithmic}[1] \Require Lists $L_{\vc{0}}, L_{\vc{t}} \subset \mathcal{L}$ containing $(4/3)^{d/2 + o(d)}$ vectors at distance $\leq R$ from $\vc{0}, \vc{t}$ \Ensure Lists $L_{\vc{0}}', L_{\vc{t}}' \subset \mathcal{L}$ contain $(4/3)^{d/2 + o(d)}$ vectors at distance $\leq \gamma R$ from $\vc{0}, \vc{t}$ \State Initialize empty lists $L_{\vc{0}}', L_{\vc{t}}'$ \For{\textbf{each} $(\vc{w}_1, \vc{w}_2) \in L_{\vc{0}} \times L_{\vc{0}}$} \If{$\|\vc{w}_1 - \vc{w}_2\| \leq \gamma R$} \State Add $\vc{w}_1 - \vc{w}_2$ to the list $L_{\vc{0}}'$ \EndIf \EndFor \For{\textbf{each} $(\vc{w}_1, \vc{w}_2) \in L_{\vc{t}} \times L_{\vc{0}}$} \If{$\|(\vc{w}_1 - \vc{w}_2) - \vc{t}\| \leq \gamma R$} \State Add $\vc{w}_1 - \vc{w}_2$ to the list $L_{\vc{t}}'$ \EndIf \EndFor \State \Return $(L_{\vc{0}}', L_{\vc{t}}')$ \end{algorithmic} \end{algorithm} \subsubsection{Main result.} As the (heuristic) correctness of this algorithm follows directly from the correctness of the original NV-sieve, and nearest neighbor techniques can be applied to this algorithm in similar fashion as well, we immediately obtain the following result. Note that space-time tradeoffs for SVP, such as the one illustrated in \cite[Figure 1]{becker16lsf}, similarly carry over to solving CVP, and the best tradeoff for SVP (and therefore CVP) is depicted in Figure~\ref{fig:1}. \begin{theorem} Assuming Heuristic~\ref{heur:2} holds, the adaptive Nguyen-Vidick sieve with spherical LSF solves CVP in time $\mathrm{T}$ and space $\mathrm{S}$, with \begin{align} \mathrm{S} = (4/3)^{d/2 + o(d)} \approx 2^{0.208 d + o(d)}, \quad \mathrm{T} = (3/2)^{d/2 + o(d)} \approx 2^{0.292 d + o(d)}. \end{align} \end{theorem} An important open question is whether these techniques can also be applied to the faster GaussSieve algorithm to solve CVP. The GaussSieve seems to make even more use of the property that the sum/difference of two lattice vectors is also in the lattice, and operations in the GaussSieve in $\mathcal{L}$ cannot as easily be \textit{mimicked} for the coset $\vc{t} + \mathcal{L}$. Solving CVP with the GaussSieve with similar complexities is left as an open problem. \section{Non-adaptive sieving for CVPP} \label{sec:non} Our second method for finding closest vectors with heuristic lattice sieving follows a slightly different approach. Instead of focusing only on the total time complexity for one problem instance, we split the algorithm into two phases: \begin{itemize} \item Phase 1: Preprocess the lattice $\mathcal{L}$, without knowledge of the target $\vc{t}$; \item Phase 2: Process the query $\vc{t}$ and output a closest lattice vector $\vc{s} \in \mathcal{L}$ to $\vc{t}$. \end{itemize} Intuitively it may be more important to keep the costs of Phase 2 small, as the preprocessed data can potentially be reused later for other instances on the same lattice. This approach is essentially equivalent to the Closest Vector Problem with Preprocessing (CVPP): preprocess $\mathcal{L}$ such that when given a target vector $\vc{t}$ later, one can quickly return a closest vector $\vc{s} \in \mathcal{L}$ to $\vc{t}$. For CVPP however the preprocessed space is usually restricted to be of polynomial size, and the time used for preprocessing the lattice is often not taken into account. Here we will keep track of the preprocessing costs as well, and we do not restrict the output from the preprocessing phase to be of size $\operatorname{poly}(d)$. \subsubsection{Algorithm description.} To minimize the costs of answering a query, and to do the preprocessing independently of the target vector, we first run a standard SVP sieve, resulting in a large list $L$ of almost all short lattice vectors. Then, after we are given the target vector $\vc{t}$, we use $L$ to reduce the target. Finally, once the resulting vector $\vc{t}' \in \vc{t} + \mathcal{L}$ can no longer be reduced with our list, we hope that this reduced vector $\vc{t}'$ is the shortest vector in the coset $\vc{t} + \mathcal{L}$, so that $\vc{0}$ is the closest lattice vector to $\vc{t}'$ and $\vc{s} = \vc{t} - \vc{t}'$ is the closest lattice vector to $\vc{t}$. The first phase of this algorithm consists in running a sieve and storing the resulting list in memory (potentially in a nearest neighbor data structure for faster lookups). For this phase either the Nguyen-Vidick sieve or the GaussSieve can be used. The second phase is the same for either method, and is described in Algorithm~\ref{alg:nonadaptive} for the general case of an input list essentially consisting of the $\alpha^{d + o(d)}$ shortest vectors in the lattice. Note that a standard SVP sieve would produce a list of size $(4/3)^{d/2 + o(d)}$ corresponding to $\alpha = \sqrt{4/3}$. \begin{algorithm}[!t] \caption{Non-adaptive sieving (Phase 2) for finding closest vectors} \label{alg:nonadaptive} \begin{algorithmic}[1] \Require A list $L \subset \mathcal{L}$ of $\alpha^{d/2 + o(d)}$ vectors of norm at most $\alpha \cdot \lambda_1(\mathcal{L})$, and $\vc{t} \in \mathbb{R}^d$ \Ensure The output vector $\vc{s}$ is the closest lattice vector to $\vc{t}$ (w.h.p.) \State Initialize $\vc{t}' \leftarrow \vc{t}$ \For{\textbf{each} $\vc{w} \in L$} \If{$\|\vc{t}' - \vc{w}\| \leq \|\vc{t}'\|$} \State Replace $\vc{t}' \leftarrow \vc{t}' - \vc{w}$ and restart the \textbf{for}-loop \EndIf \EndFor \State \Return $\vc{s} = \vc{t} - \vc{t}'$ \end{algorithmic} \end{algorithm} \subsubsection{List size.} We first study how large $L$ must be to guarantee that the algorithm succeeds. One might wonder why we do not fix $\alpha = \sqrt{4/3}$ immediately in Algorithm~\ref{alg:nonadaptive}. To see why this choice of $\alpha$ does not suffice, suppose we have a vector $\vc{t}' \in \vc{t} + \mathcal{L}$ which is no longer reducible with $L$. This implies that $\vc{t}'$ has norm approximately $\sqrt{4/3} \cdot \lambda_1(\mathcal{L})$, similar to what happens in the GaussSieve. Now, unfortunately the fact that $\vc{t}'$ cannot be reduced with $L$ anymore, does \textit{not} imply that the closest lattice point to $\vc{t}'$ is $\vc{0}$. In fact, it is more likely that there exists an $\vc{s} \in \vc{t} + \mathcal{L}$ of norm slightly more than $\sqrt{4/3} \cdot \lambda_1(\mathcal{L})$ which is closer to $\vc{t}'$, but which is not used for reductions. By the Gaussian heuristic, we expect the distance from $\vc{t}$ and $\vc{t}'$ to the lattice to be $\lambda_1(\mathcal{L})$. So to guarantee that $\vc{0}$ is the closest lattice vector to the reduced vector $\vc{t}'$, we need $\vc{t}'$ to have norm at most $\lambda_1(\mathcal{L})$. To analyze and prove correctness of this algorithm, we will therefore prove that, under the assumption that the input is a list of the $\alpha^{d + o(d)}$ shortest lattice vectors of norm at most $\alpha \cdot \lambda_1(\mathcal{L})$ for a particular choice of $\alpha$, w.h.p.\ the algorithm reduces $\vc{t}$ to a vector $\vc{t}' \in \vc{t} + \mathcal{L}$ of norm at most $\lambda_1(\mathcal{L})$. To study how to set $\alpha$, we start with the following elementary lemma regarding the probability of reduction between two uniformly random vectors with given norms. \begin{lemma} \label{lem:1} Let $v, w > 0$ and let $\vc{v} = v \cdot \vc{e}_v$ and $\vc{w} = w \cdot \vc{e}_w$. Then: \begin{align} \mathbb{P}_{\vc{e}_v, \vc{e}_w \sim \mathcal{S}^{d-1}}\Big(\|\vc{v} - \vc{w}\|^2 < \|\vc{v}\|^2\Big) \sim \left[1 - \left(\tfrac{w}{2v}\right)^2\right]^{d/2 + o(d)}. \end{align} \end{lemma} \begin{proof} Expanding $\|\vc{v} - \vc{w}\|^2 = v^2 + w^2 - 2 v w \ip{\vc{e}_v}{\vc{e}_w}$ and $\|\vc{v}\|^2 = v^2$, the condition $\|\vc{v} - \vc{w}\|^2 < \|\vc{v}\|^2$ equals $\frac{w}{2v} < \ip{\vc{e}_v}{\vc{e}_w}$. The result follows from \cite[Lemma 2.1]{becker16lsf}. \end{proof} Under Heuristic~\ref{heur:1}, we then obtain a relation between the choice of $\alpha$ for the input list and the expected norm of the reduced vector $\vc{t}'$ as follows. \begin{lemma} \label{lem:2} Let $L \subset \alpha \cdot \mathcal{S}^{d-1}$ be a list of $\alpha^{d + o(d)}$ uniformly random vectors of norm $\alpha > 1$, and let $\vc{v} \in \beta \cdot \mathcal{S}^{d-1}$ be sampled uniformly at random. Then, for high dimensions $d$, there exists a $\vc{w} \in L$ such that $\|\vc{v} - \vc{w}\| < \|\vc{v}\|$ if and only if \begin{align} \alpha^4 - 4 \beta^2 \alpha^2 + 4\beta^2 < 0. \label{eq:a} \end{align} \end{lemma} \begin{proof} By Lemma~\ref{lem:1} we can reduce $\vc{v}$ with $\vc{w} \in L$ with probability similar to $p = [1 - \frac{\alpha^2}{4\beta^2}]^{d/2 + o(d)}$. Since we have $n = \alpha^{d + o(d)}$ such vectors $\vc{w}$, the probability that none of them can reduce $\vc{v}$ is $(1 - p)^n$, which is $o(1)$ if $n \gg 1/p$ and $1 - o(1)$ if $n \ll 1/p$. Expanding $n \cdot p$, we obtain the given equation~\eqref{eq:a}, where $\alpha^4 - 4 \beta^2 \alpha^2 + 4 \beta^2 < 0$ implies $n \gg 1/p$. \end{proof} Note that in our applications, we do not just have a list of $\alpha^{d + o(d)}$ lattice vectors of norm $\alpha \cdot \lambda_1(\mathcal{L})$; for any $\alpha_0 \in [1, \alpha]$ we expect $L$ to contain $\alpha_0^{d + o(d)}$ lattice vectors of norm at most $\alpha_0 \cdot \lambda_1(\mathcal{L})$. To obtain a reduced vector $\vc{t}'$ of norm $\beta \cdot \lambda_1(\mathcal{L})$, we therefore obtain the condition that for \textit{some} value $\alpha_0 \in [1, \alpha]$, it must hold that $\alpha_0^4 - 4 \beta^2 \alpha_0^2 + 4\beta_0^2 < 0$. From~\eqref{eq:a} it follows that $p(\alpha^2) = \alpha^4 - 4 \beta^2 \alpha^2 + 4\beta^2$ has two roots $r_1 < 2 < r_2$ for $\alpha^2$, which lie close to $2$ for $\beta \approx 1$. The condition that $p(\alpha_0^2) < 0$ for some $\alpha_0 \leq \alpha$ is equivalent to $\alpha > r_1$, which for $\beta = 1 + o(1)$ implies that $\alpha^2 \geq 2 + o(1)$. This means that asymptotically we must set $\alpha = \sqrt{2}$, and use $n = 2^{d/2 + o(d)}$ input vectors, to guarantee that w.h.p.\ the algorithm succeeds. A sketch of the situation is also given in Figure~\ref{fig:2a}. \begin{figure}[!t] \subfloat[For solving \textbf{exact CVP}, we must reduce the vector $\vc{t}$ to a vector $\vc{t}' \in \vc{t} + \mathcal{L}$ of norm at most $\lambda_1(\mathcal{L})$. The nearest lattice point to $\vc{t}'$ lies in a ball of radius approximately $\lambda_1(\mathcal{L})$ around $\vc{t}'$ (blue), and almost all the mass of this ball is contained in the (black) ball around $\vc{0}$ of radius $\sqrt{2} \cdot \lambda_1(\mathcal{L})$. So if $\vc{s} \in \mathcal{L} \setminus \{\vc{0}\}$ had lain closer to $\vc{t}'$ than $\vc{0}$, we would have reduced $\vc{t}'$ with $\vc{s}$, since $\vc{s} \in L$.\label{fig:2a}]{% \includegraphics{sievingcvp-figure2a}}% \hfill \subfloat[For \textbf{variants of CVP}, a choice $\alpha$ for the list size implies a norm $\beta \cdot \lambda_1(\mathcal{L})$ of $\vc{t}'$. The nearest lattice vector $\vc{s}$ to $\vc{t}'$ lies within $\delta \cdot \lambda_1(\mathcal{L})$ of $\vc{t}'$ ($\delta = 1$ for approx-CVP), so with high probability $\vc{s}$ has norm approximately $(\sqrt{\beta^2 + \delta^2}) \cdot \lambda_1(\mathcal{L})$. For $\delta$-BDD, if $\sqrt{\beta^2 + \delta^2} \leq \alpha$ then we expect the nearest point $\vc{s}$ to be in the list $L$. For $\kappa$-CVP, if $\beta \leq \kappa$, then the lattice vector $\vc{t} - \vc{t}'$ has norm at most $\kappa \cdot \lambda_1(\mathcal{L})$.\label{fig:2b}]{ \includegraphics{sievingcvp-figure2b}}% \caption{Comparison of the list size complexity analysis for CVP (left) and BDD/approximate CVP (right). The point $\vc{t}$ represents the target vector, and after a series of reductions with Algorithm~\ref{alg:nonadaptive}, we obtain $\vc{t}' \in \vc{t} + \mathcal{L}$. Blue balls around $\vc{t}'$ depict regions in which we expect the closest lattice point to $\vc{t}'$ to lie, where the blue shaded area indicates a negligible fraction of this ball~\cite[Lemma 2]{becker16lsf}.\label{fig:2}} \end{figure} \subsubsection{Modifying the first phase.} As we will need a larger list of size $2^{d/2 + o(d)}$ to make sure we can solve CVP exactly, we need to adjust Phase 1 of the algorithm as well. Recall that with standard sieving, we reduce vectors iff their angle is at most $\theta = \frac{\pi}{3}$, resulting in a list of size $(\sin \theta)^{-d + o(d)}$. As we now need the output list of the first phase to consist of $2^{d/2 + o(d)} = (\sin \theta')^{-d + o(d)}$ vectors for $\theta' = \frac{\pi}{4}$, we make the following adjustment: only reduce $\vc{v}$ and $\vc{w}$ if their common angle is less than $\frac{\pi}{4}$. For unit length vectors, this condition is equivalent to reducing $\vc{v}$ with $\vc{w}$ iff $\|\vc{v} - \vc{w}\|^2 \leq (2 - \sqrt{2}) \cdot \|\vc{v}\|^2$. This further accelerates nearest neighbor techniques due to the smaller angle $\theta$. Pseudocode for the modified first phase is given in Appendix~\ref{app:alg2} \subsubsection{Main result.} With the algorithm in place, let us now analyze its complexity for solving CVP. The first phase of the algorithm generates a list of size $2^{d/2 + o(d)}$ by combining pairs of vectors, and naively this can be done in time $\mathrm{T}_1 = 2^{d + o(d)}$ and space $\mathrm{S} = 2^{d/2 + o(d)}$, with query complexity $\mathrm{T}_2 = 2^{d/2 + o(d)}$. Using nearest neighbor searching (Lemma~\ref{lem:nns}), the query and preprocessing complexities can be further reduced, leading to the following result. \begin{theorem} \label{thm:2} Let $u \in (\frac{1}{2} \sqrt{2}, \sqrt{2})$. Using non-adaptive sieving, we can solve CVP with preprocessing time $\mathrm{T}_1$, space complexity $\mathrm{S}$, and query time complexity $\mathrm{T}_2$ as follows: \begin{align} \mathrm{S} = \mathrm{T}_1 &= \left(\frac{1}{u (\sqrt{2} - u)}\right)^{d/2 + o(d)}, \qquad \mathrm{T}_2 = \left(\frac{\sqrt{2} + u}{2 u}\right)^{d/2 + o(d)}. \end{align} \end{theorem} \begin{proof} These complexities follow from Lemma~\ref{lem:nns} with $\theta = \frac{\pi}{4}$, noting that the first phase can be performed in time and space $\mathrm{T}_1 = \mathrm{S} = n^{1 + \rho_{\mathrm{u}}}$, and the second phase in time $\mathrm{T}_2 = n^{\rho_{\mathrm{q}}}$. \end{proof} To illustrate the time and space complexities of Theorem~\ref{thm:2}, we highlight three special cases $u$ as follows. The full tradeoff curve for $u \in (\frac{1}{2} \sqrt{2}, \sqrt{2})$ is depicted in Figure~\ref{fig:1}. \begin{itemize} \item Setting $u = \frac{1}{2} \sqrt{2}$, we obtain $\mathrm{S} = \mathrm{T}_1 = 2^{d/2 + o(d)}$ and $\mathrm{T}_2 \approx 2^{0.2925d + o(d)}$. \item Setting $u = 1$, we obtain $\mathrm{S} = \mathrm{T}_1 \approx 2^{0.6358 d + o(d)}$ and $\mathrm{T}_2 \approx 2^{0.1358 d + o(d)}$. \item Setting $u = \frac{1}{2}(\sqrt{2} + 1)$, we get $\mathrm{S} = \mathrm{T}_1 = 2^{d + o(d)}$ and $\mathrm{T}_2 \approx 2^{0.0594 d + o(d)}$. \end{itemize} The first result shows that the query complexity of non-adaptive sieving is never worse than for adaptive sieving; only the space and preprocessing complexities are worse. The second and third results show that CVP can be solved in significantly less time, even with preprocessing and space complexities bounded by $2^{d + o(d)}$. \paragraph{\bf Minimizing the query complexity.} As $u \to \sqrt{2}$, the query complexity keeps decreasing while the memory and preprocessing costs increase. For arbitrary $\varepsilon > 0$, we can set $u = u_\varepsilon \approx \sqrt{2}$ as a function of $\varepsilon$, resulting in asymptotic complexities $\mathrm{S} = \mathrm{T}_1 = (1/\varepsilon)^{O(d)}$ and $\mathrm{T}_2 = 2^{\varepsilon d + o(d)}$. This shows that it is possible to obtain a slightly subexponential query complexity, at the cost of superexponential space, by taking $\varepsilon = o(1)$ as a function of $d$. \begin{corollary} \label{thm:3} For arbitrary $\varepsilon > 0$, using non-adaptive sieving we can solve CVPP with preprocessing time and space complexities $(1/\varepsilon)^{O(d)}$, in time $2^{\varepsilon d + o(d)}$. In particular, we can solve CVPP in $2^{o(d)}$ time, using $2^{\omega(d)}$ space and preprocessing. \end{corollary} Being able to solve CVPP in subexponential time with superexponential preprocessing and memory is neither trivial nor quite surprising. A naive approach to the problem, with this much memory, could for instance be to index the entire fundamental domain of $\mathcal{L}$ in a hash table. One could partition this domain into small regions, solve CVP for the centers of each of these regions, and store all the solutions in memory. Then, given a query, one looks up which region $\vc{t}$ is in, and returns the answer corresponding to that vector. With a sufficiently fine-grained partitioning of the fundamental domain, the answers given by the look-ups are accurate, and this algorithm probably also runs in subexponential time. Although it may not be surprising that it is possible to solve CVPP in subexponential time with (super)exponential space, it is not clear what the complexities of other methods would be. Our method presents a clear tradeoff between the complexities, where the constants in the preprocessing exponent are quite small; for instance, we can solve CVPP in time $2^{0.06d + o(d)}$ with less than $2^{d + o(d)}$ memory, which is the same amount of memory/preprocessing of the best provable SVP and CVP algorithms~\cite{aggarwal15, aggarwal15b}. Indexing the fundamental domain may well require much more memory than this. \subsection{Bounded Distance Decoding with Preprocessing} We finally take a look at specific instances of CVP which are easier than the general problem, such as when the target $\vc{t}$ lies unusually close to the lattice. This problem naturally appears in practice, when a private key consists of a \textit{good basis} of a lattice with short basis vectors, and the public key is a \textit{bad basis} of the same lattice. An encryption of a message could then consist of the message being mapped to a lattice point $\vc{v} \in \mathcal{L}$, and a small error vector $\vc{e}$ being added to $\vc{v}$ ($\vc{t} = \vc{v} + \vc{e}$) to hide $\vc{v}$. If the noise $\vc{e}$ is small enough, then with a good basis one can decode $\vc{t}$ to the closest lattice vector $\vc{v}$, while someone with the bad basis cannot decode correctly. As decoding for arbitrary $\vc{t}$ (solving CVP) is known to be hard even with knowledge of a good basis~\cite{micciancio01e, feige02, regev04d, alekhnovich05}, $\vc{e}$ needs to be very short, and $\vc{t}$ must lie unusually close to the lattice. So instead of assuming target vectors $\vc{t} \in \mathbb{R}^d$ are sampled at random, suppose that $\vc{t}$ lies at distance at most $\delta \cdot \lambda_1(\mathcal{L})$ from $\mathcal{L}$, for $\delta \in (0,1)$. For adaptive sieving, recall that the list size $(4/3)^{d/2 + o(d)}$ is the minimum initial list size one can hope to use to obtain a list of short lattice vectors; with fewer vectors, one would not be able to solve SVP.\footnote{The recent paper \cite{bai16} discusses how to use less memory in sieving, by using triple- or tuple-wise reductions, instead of the standard pairwise reductions. These techniques may also be applied to adaptive sieving to solve CVP with less memory, at the cost of an increase in the time complexity.} For non-adaptive sieving however, it may be possible to reduce the list size below $2^{d/2 + o(d)}$. \subsubsection{List size.} Let us again assume that the preprocessed list $L$ contains almost all $\alpha^{d + o(d)}$ lattice vectors of norm at most $\alpha \cdot \lambda_1(\mathcal{L})$. The choice of $\alpha$ implies a maximum norm $\beta_{\alpha} \cdot \lambda_1(\mathcal{L})$ of the reduced vector $\vc{t}'$, as described in Lemma~\ref{lem:2}. The nearest lattice vector $\vc{s} \in \mathcal{L}$ to $\vc{t}'$ lies within radius $\delta \cdot \lambda_1(\mathcal{L})$ of $\vc{t}'$, and w.h.p.\ $\vc{s} - \vc{t}'$ is approximately orthogonal to $\vc{t}'$; see Figure~\ref{fig:2b}, where the shaded area is asymptotically negligible. Therefore w.h.p.\ $\vc{s}$ has norm at most $(\sqrt{\beta_{\alpha}^2 + \delta^2}) \cdot \lambda_1(\mathcal{L})$. Now if $\sqrt{\beta_{\alpha}^2 + \delta^2} \leq \alpha$, then we expect the nearest vector to be contained in $L$, so that ultimately $\vc{0}$ is nearest to $\vc{t}'$. Substituting $\alpha^4 - 4 \beta^2 \alpha^2 + 4 \beta^2 = 0$ and $\beta^2 + \delta^2 \leq \alpha^2$, and solving for $\alpha$, this leads to the following condition on $\alpha$. \begin{align} \alpha^2 \geq \tfrac{2}{3} (1 + \delta^2) + \tfrac{2}{3} \sqrt{(1 + \delta^2)^2 - 3 \delta^2} \, . \label{eq:a2} \end{align} Taking $\delta = 1$, corresponding to exact CVP, leads to the condition $\alpha \geq \sqrt{2}$ as expected, while in the limiting case of $\delta \to 0$ we obtain the condition $\alpha \geq \sqrt{4/3}$. This matches experimental observations using the GaussSieve, where after finding the shortest vector, newly sampled vectors often cause \textit{collisions} (i.e.\ being reduced to the $\vc{0}$-vector). In other words, Algorithm~\ref{alg:nonadaptive} often reduces target vectors $\vc{t}$ which essentially lie \textit{on} the lattice ($\delta \to 0$) to the $\vc{0}$-vector when the list has size $(4/3)^{d/2 + o(d)}$. This explains why collisions in the GaussSieve are common when the list size grows to size $(4/3)^{d/2 + o(d)}$. \subsubsection{Main result.} To solve BDD with a target $\vc{t}$ at distance $\delta \cdot \lambda_1(\mathcal{L})$ from the lattice, we need the preprocessing to produce a list of almost all $\alpha^{d + o(d)}$ vectors of norm at most $\alpha \cdot \lambda_1(\mathcal{L})$, with $\alpha$ satisfying~\eqref{eq:a2}. Similar to the analysis for CVP, we can produce such a list by only doing reductions between two vectors if their angle is less than $\theta$, where now $\theta = \arcsin(1 / \alpha)$. Combining this with Lemma~\ref{lem:1}, we obtain the following result. \begin{theorem} \label{thm:BDD} Let $\alpha$ satisfy \eqref{eq:a2} and let $u \in (\sqrt{\frac{\alpha^2 - 1}{\alpha^2}}, \sqrt{\frac{\alpha^2}{\alpha^2 - 1}})$. Using non-adaptive sieving, we can heuristically solve BDD for targets $\vc{t}$ at distance $\delta \cdot \lambda_1(\mathcal{L})$ from the lattice, with preprocessing time $\mathrm{T}_1$, space complexity $\mathrm{S}$, and query time complexity $\mathrm{T}_2$ as follows: \begin{align} & \qquad \mathrm{S} = \left(\frac{1}{1 - (\alpha^2 - 1) (u^2 - \frac{2 u}{\alpha} \sqrt{\alpha^2 - 1} + 1)}\right)^{d/2 + o(d)}, \\ \mathrm{T}_1 &= \max\left\{\mathrm{S}, \ (3/2)^{d/2 + o(d)}\right\}, \qquad \mathrm{T}_2 = \left(\frac{\alpha + u \sqrt{\alpha^2 - 1}}{2 \alpha - \alpha^3 + \alpha^2 u \sqrt{\alpha^2 - 1}}\right)^{d/2 + o(d)}. \end{align} \end{theorem} \begin{proof} These complexities directly follow from applying Lemma~\ref{lem:nns} with $\theta = \arcsin(1/\alpha)$, and again observing that Phase 1 can be performed in time $\mathrm{T}_1 = n^{1 + \rho_{\mathrm{u}}}$ and space $\mathrm{S} = n^{1 + \rho_{\mathrm{u}}}$, while Phase 2 takes time $\mathrm{T}_2 = n^{\rho_{\mathrm{q}}}$. Note that we cannot combine vectors whose angles are larger than $\frac{\pi}{3}$ in Phase 1, which leads to a lower bound on the preprocessing time complexity $\mathrm{T}_1$ based on the costs of solving SVP. \end{proof} Theorem~\ref{thm:BDD} is a generalization of Theorem~\ref{thm:2}, as the latter can be derived from the former by substituting $\delta = 1$ above. To illustrate the results, Figure~\ref{fig:1} considers two special cases: \begin{itemize} \item For $\delta = \frac{1}{2}$, we find $\alpha \approx 1.1976$, leading to $\mathrm{S} \approx 2^{0.2602d + o(d)}$ and $\mathrm{T}_2 = 2^{0.1908d + o(d)}$ when minimizing the space complexity. \item For $\delta \to 0$, we have $\alpha \to \sqrt{4/3} \approx 1.1547$. The minimum space complexity is therefore $\mathrm{S} = (4/3)^{d/2 + o(d)}$, with query complexity $\mathrm{T}_2 = 2^{0.1610d + o(d)}$. \end{itemize} In the limit of $u \to \sqrt{\frac{\alpha^2}{\alpha^2 - 1}}$ we need superexponential space/preprocessing $\mathrm{S}, \mathrm{T}_1 \to 2^{\omega(d)}$ and a subexponential query time $\mathrm{T}_2 \to 2^{o(d)}$ for all $\delta > 0$. \subsection{Approximate Closest Vector Problem with Preprocessing} Given a lattice $\mathcal{L}$ and a target vector $\vc{t} \in \mathbb{R}^d$, approximate CVP with approximation factor $\kappa$ asks to find a vector $\vc{s} \in \mathcal{L}$ such that $\|\vc{s} - \vc{t}\|$ is at most a factor $\kappa$ larger than the real distance from $\vc{t}$ to $\mathcal{L}$. For random instances $\vc{t}$, by the Gaussian heuristic this means that a lattice vector counts as a solution iff it lies at distance at most $\kappa \cdot \lambda_1(\mathcal{L})$ from $\vc{t}$. \subsubsection{List size.} Instead of reducing $\vc{t}$ to a vector $\vc{t}'$ of norm at most $\lambda_1(\mathcal{L})$ as is needed for solving exact CVP, we now want to make sure that the reduced vector $\vc{t}'$ has norm at most $\kappa \cdot \lambda_1(\mathcal{L})$. If this is the case, then the vector $\vc{t} - \vc{t}'$ is a lattice vector lying at distance at most $\kappa \cdot \lambda_1(\mathcal{L})$, which w.h.p.\ qualifies as a solution. This means that instead of substituting $\beta = 1$ in Lemma~\ref{lem:2}, we now substitute $\beta = \kappa$. This leads to the condition that $\alpha_0^4 - 4\kappa^2 \alpha_0^2 + 4 \beta^2 < 0$ for some $\alpha_0 \leq \alpha$. By a similar analysis $\alpha^2$ must therefore be larger than the smallest root $r_1 = 2\kappa (\kappa - \sqrt{\kappa^2 - 1})$ of this quadratic polynomial in $\alpha^2$. This immediately leads to the following condition on $\alpha$: \begin{align} \alpha^2 \geq 2 \kappa \left(\kappa - \sqrt{\kappa^2 - 1}\right). \label{eq:a3} \end{align} A sanity check shows that $\kappa = 1$, corresponding to exact CVP, indeed results in $\alpha \geq \sqrt{2}$, while in the limit of $\kappa \to \infty$ a value $\alpha \approx 1$ suffices to obtain a vector $\vc{t}'$ of norm at most $\kappa \cdot \lambda_1(\mathcal{L})$. In other words, to solve approximate CVP with very large (constant) approximation factors, a preprocessed list of size $(1 + \varepsilon)^{d + o(d)}$ suffices. \subsubsection{Main result.} Similar to the analysis of CVPP, we now take $\theta = \arcsin(1/\alpha)$ as the angle with which to reduce vectors in Phase 1, so that the output of Phase 1 is a list of almost all $\alpha^{d + o(d)}$ shortest lattice vectors of norm at most $\alpha \cdot \lambda_1(\mathcal{L})$. Using a smaller angle $\theta$ for reductions again means that nearest neighbor searching can speed up the reductions in both Phase 1 and Phase 2 even further. The exact complexities follow from Lemma~\ref{lem:nns}. \begin{theorem} \label{thm:aCVP} Using non-adaptive sieving with spherical LSF, we can heuristically solve $\kappa$-CVP with similar complexities as in Theorem~\ref{thm:BDD}, where now $\alpha$ must satisfy \eqref{eq:a3}. \end{theorem} Note that only the dependence of $\alpha$ on $\kappa$ is different, compared to the dependence of $\alpha$ on $\delta$ for bounded distance decoding. The complexities for $\kappa$-CVP arguably decrease \textit{faster} than for $\delta$-BDD: for instance, for $\kappa \approx 1.0882$ we obtain the same complexities as for BDD with $\delta = \frac{1}{2}$, while $\kappa = \sqrt{4/3} \approx 1.1547$ leads to the same complexities as for BDD with $\delta \to 0$. Two further examples are illustrated in Figure~\ref{fig:1}: \begin{itemize} \item For $\kappa = 2$, we have $\alpha \approx 1.1976$, which for $u \approx 0.5503$ leads to $\mathrm{S} = \mathrm{T}_1 = 2^{0.2602 d + o(d)}$ and $\mathrm{T}_2 = 2^{0.1908 d + o(d)}$, and for $u = 1$ leads to $\mathrm{S} = \mathrm{T}_1 = 2^{0.3573 d + o(d)}$ and $\mathrm{T}_2 = 2^{0.0971 d + o(d)}$. \item For $\kappa \to \infty$, we have $\alpha \to 1$, i.e.\ the required preprocessed list size approaches $2^{o(d)}$ as $\kappa$ grows. For sufficiently large $\kappa$, we can solve $\kappa$-CVP with a preprocessed list of size $2^{\varepsilon d + o(d)}$ in at most $2^{\varepsilon d + o(d)}$ time. The preprocessing time is given by $2^{0.2925 d + o(d)}$. \end{itemize} The latter result shows that for any superconstant approximation factor $\kappa = \omega(1)$, we can solve the corresponding approximate closest vector problem with preprocessing in subexponential time, with an exponential preprocessing time complexity $2^{0.292d + o(d)}$ for solving SVP and generating a list of short lattice vectors, and a subexponential space complexity required for Phase 2. In other words, even without superexponential preprocessing/memory we can solve CVPP with large approximation factors in subexponential time. To compare this result with previous work, note that the lower bound on $\alpha$ from \eqref{eq:a3} tends to $1 + 1/(8 \kappa^2) + O(\kappa^{-4})$ as $\kappa$ grows. The query space and time complexities are further both proportional to $\alpha^{\Theta(d)}$. To obtain a polynomial query complexity and polynomial storage after the preprocessing phase, we can solve for $\kappa$, leading to the following result. \begin{corollary} \label{cor:acvpp-poly} With non-adaptive sieving we can heuristically solve approximate CVPP with approximation factor $\kappa$ in polynomial time with polynomial-sized advice iff $\kappa = \Omega(\sqrt{d / \log d})$. \end{corollary} \begin{proof} The query time and space complexities are given by $\alpha^{\Theta(d)}$, where $\alpha = 1 + \Theta(1 / \kappa^2)$. To obtain polynomial complexities in $d$, we must have $\alpha^{\Theta(d)} = d^{O(1)}$, or equivalently: \begin{align} 1 + \Theta\left(\frac{1}{\kappa^2}\right) = \alpha = d^{O(1/d)} = \exp \, O\left(\frac{\log d}{d}\right) = 1 + O\left(\frac{\log d}{d}\right). \end{align} Solving for $\kappa$ leads to the given relation between $\kappa$ and $d$. \end{proof} Apart from the heuristic assumptions, this approximation factor is equivalent to Aharonov and Regev~\cite{aharonov04}, who showed that the decision version of CVPP with approximation factor $\kappa = \Omega(\sqrt{d / \log d})$ can provably be solved in polynomial time. This further (heuristically) improves upon results of~\cite{lagarias90b, dadush14}, who are able to solve search-CVPP with polynomial time and space complexities for $\kappa = O(d^{3/2})$ and $\kappa = \Omega(d / \sqrt{\log d})$ respectively. Assuming the heuristic assumptions are valid, Corollary~\ref{cor:acvpp-poly} closes the gap between these previous results for decision-CVPP and search-CVPP with a rather simple algorithm: (1) preprocess the lattice by storing all $d^{O(1)}$ shortest vectors of the lattice in a list; and (2) apply Algorithm~\ref{alg:nonadaptive} to this list and the target vector to find an approximate closest vector. Note that nearest neighbor techniques only affect leading constants; even without nearest neighbor searching this would heuristically result in a polynomial time and space algorithm for $\kappa$-CVPP with $\kappa = \Omega(\sqrt{d / \log d})$. An interesting open problem would be to see if this result can be made provable for arbitrary lattices, without any heuristic assumptions. \section*{Acknowledgments} The author is indebted to L\'{e}o Ducas, whose initial ideas and suggestions on this topic motivated work on this paper. The author further thanks Vadim Lyubashevsky and Oded Regev for their comments on the relevance of a subexponential time CVPP algorithm requiring (super)exponential space. The author is supported by the SNSF ERC Transfer Grant CRETP2-166734 FELICITY. \bibliographystyle{alpha}
{'timestamp': '2016-07-19T02:05:21', 'yymm': '1607', 'arxiv_id': '1607.04789', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04789'}
arxiv
\section{Introduction} Nowadays, millions of videos are being uploaded to the Internet every day. These videos capture all aspects of multimedia content about their uploader's daily life. These explosively growing user generated content videos online are becoming an crucial source of video data. Automatically categorizing videos into concepts, such as people actions, objects, etc., has become an important research topic. Recently many work have been proposed to tackle with building concept detectors both in image domain and video domain \cite{deng2009imagenet,liang2015towards,tang2012shifting,karpathy2014large,jiang2015exploiting}. However, the need for manual labels by human annotators has become one of the major important limitations for large-scale concept learning. It is even more so in video domain, since training concept detectors on videos is more challenging than on still images. Many image datasets such as ImageNet~\cite{deng2009imagenet}, CIFAR~\cite{krizhevsky2009learning}, PASCAL VOC\cite{everingham2010pascal}, MS COCO~\cite{lin2014microsoft} and Caltech~\cite{fei2006one} have been collected and manually labeled. In video domain, some largest datasets such as UCF-101\cite{soomro2012ucf101}, MCG-WEBV~\cite{cao2009mcg}, TRECVID MED~\cite{over2014trecvid} and FCVID~\cite{jiang2015exploiting} are popular benchmark datasets for video classification. Collecting such datasets requires a large amount of human effort that can take thousands of man hours. In addition, manually labeling video requires playing back the video, which is more time consuming and expensive than labeling still images. As a result, the largest labeled video collection, FCVID~\cite{jiang2015exploiting}, only contains about 0.09 million labels with 239 concept classes, much less than the 14 million labels with over 20,000 classes in the image collection ImageNet~\cite{deng2009imagenet}. Many state-of-the-art models in visual classification are based on the neural networks~\cite{jiang2015exploiting,karpathy2014large,varadarajan2015efficient}. As the architecture gets deeper, the neural network would need more data to train in order to get better performance. However, more data needs more human supervision which are more expensive to acquire in the video domain. Videos are available on the web and contain rich contextual information with a weak annotation about their content, such as their titles, descriptions and surrounding text. These webly-labeled data are orders of magnitude larger than that of any manually-labeled collections. Moreover, automatically extracted features from multiple modalities such as existing still image classification models, automatic speech recognition and optical character recognition tools can be useful additional information for the content of the video. Figure \ref{cur-example} shows an example of webly-labeled video for walking with a dog. As we see, the textual metadata we get from the web videos contain useful but very noisy information. The multi-modal prior information we get is correlated across modalities, as the image classification results and speech transcript show high probability of dog appearance, while the textual metadata indicates the same content. Some of the videos (about 20\% in the FCVID dataset) have very little textual metadata and we can only obtain web labels via other modalities. To address the problem of learning detectors from the big web data, in this paper, we utilize multi-modal information to harness prior knowledge from the web video without any manual efforts. Existing methods on learning from noisy webly-labeled data has mainly focused on the image domain \cite{fergus2005learning,li2010optimol,bergamo2010exploiting,chen2015webly}. Existing studies demonstrated promising results in this direction. However, these methods are primarily based on some heuristic methods. It is not clear what objective is being optimized and where or even whether the learning process will converge. Moreover, these methods only utilize a single text modality in the image domain. It is unclear how to exploit the multi-modal prior knowledge for concept learning from the rich context of Internet video. To utilize the large amount of webly-labeled video data for concept learning, we propose a learning framework called \textbf{WEbly-Labeled Learning (WELL)}. It is established on the theories called \textit{curriculum learning}~\cite{bengio2009curriculum} and \textit{self-paced learning}~\cite{kumar2010self}. The learning framework is motivated by human learning, where people generally start learning easier aspects of a concept, and then gradually take more complex examples into the learning process\cite{bengio2009curriculum,kumar2010self,jiang2015self}. Following this idea, WELL learns a concept detector iteratively from first using a few samples with more confident labels (more related to the concept), then gradually incorporate more video samples with noisier labels. The algorithm combines the prior knowledge, called learning curriculum, extracted from the webly-labeled data with the dynamic information learned from the statistical model (self-paced) to determine which video samples to learn in the next iteration. This idea of easy-to-hard learning paradigm has been adopted for learning in noisy web data~\cite{jiang2014easy,chen2015webly,kumar2010self} and has been proved to be efficient to deal with noise and outliers. Our proposed method generalizes such learning paradigm using a clear objective function. It is proved to be convex and is a also general framework that can incorporate state-of-the-art deep learning methods to learn robust detectors from noisy data. Our framework fundamentally changes self-paced learning and allows learning for video concept detectors at unlimited scale. Figure~\ref{well-cnn} shows the architecture of the proposed method. We extract keyframe-level convolutional neural network features and feed them into WELL layer with average pooling and iterative learning process. We have also tried using other video features such as motion features and audio MFCC features. Our contributions are threefold. First, we address the problem of learning robust video concept detectors from noisy web data through a general framework with solid theoretical justifications. We show that WELL not only outperforms state-of-the-art learning methods on noisy labels, but also, notably, achieves comparable results with state-of-the-art models trained using manual annotation on one of the largest video dataset. Second, we provide detailed comparison of different approaches to exploit multi-modal curriculum from noisy labels and verify that our method is robust against certain level of noisiness in the video data. Finally, the efficacy and the scalability have been empirically demonstrated on two public benchmarks, including by far the largest manually-labeled video set called FCVID~\cite{jiang2015exploiting} and the largest multimedia dataset called YFCC100M~\cite{thomee2015yfcc100m}. The promising results suggest that detectors trained on sufficient webly-labeled videos may outperform detectors trained on any existing manually-labeled datasets. \begin{figure*} \centering \includegraphics[width=0.9\textwidth,height=1.5in]{well-cnn} \vspace{-6mm} \caption{\textbf{Learning architecture of WEbly-Labeled Learning (WELL)}} \label{well-cnn} \end{figure*} \section{Related Work} \textbf{Curriculum and Self-paced Learning}: Recently a learning paradigm called~\textit{curriculum learning} (CL) was proposed by Bengio et al., in which a model is learned by gradually incorporating from easy to complex samples in training so as to increase the entropy of training samples~\cite{bengio2009curriculum}. A curriculum determines a sequence of training samples and is often derived by predetermined heuristics in particular problems. For example, Chen et al. designed a curriculum where images with clean backgrounds are learned before the images with noisy backgrounds~\cite{chen2015webly} , i.e. their method first builds a feature representation by a Convolutional Neural Network (CNN) on images with clean background and then they fine tune the models on images with noisy background. In~\cite{spitkovsky2009baby}, the authors approached grammar induction, where the curriculum is derived in terms of the length of a sentence. Because the number of possible solutions grows exponentially with the length of the sentence, and short sentences are easier and thus should be learn earlier. The heuristic knowledge in a problem often proves to be useful. However, the curriculum design may lead to inconsistency between the fixed curriculum and the dynamically learned models. That is, the curriculum is predetermined a prior and cannot be adjusted accordingly, taking into account the feedback about the learner. To alleviate the issue of CL, Kumar et al. designed a learning paradigm, called \emph{self-paced learning} (SPL)~\cite{kumar2010self}. SPL embeds curriculum design as a regularizer into the learning objective. Compared with CL, SPL exhibits two advantages: first, it jointly optimizes the learning objective with the curriculum, and thus the curriculum and the learned model are consistent under the same optimization problem; second, the learning is controlled by a regularizer which is independent of the loss function in specific problems. This theory has been successfully applied to various applications, such as matrix factorization~\cite{zhao2015self}, action/event detection~\cite{jiang2014self}, domain adaption~\cite{tang2012shifting}, tracking~\cite{supancic2013self} and segmentation~\cite{kumar2011learning}, reranking~\cite{jiang2014easy}, etc. \textbf{Learning Detectors in Web Data}: Many recent studies have been proposed to utilize the large amount of noisy data from the Internet. For example, \cite{mitchell2015never} proposed a Never-Ending Language Learning (NELL) paradigm and built adaptive learners that makes use of the web data by learning different types of knowledge and beliefs continuously. Such learning process is mostly self-supervised, and previously learned knowledge enables learning further types of knowledge. In the image domain, existing methods try to tackle the problem of constructing qualified training sets based on the search results of text or image search engines~\cite{fergus2005learning,li2007optimol,chen2013neil,li2014exploiting,divvala2014learning,liang2015towards}. For example, \cite{fergus2005learning} extended the probabilistic Latent Semantic Analysis in visual domain and learned object categories using results from image search engines. \cite{li2007optimol} proposed an incremental learning paradigm that initialized from a few seed images and repeatedly trained models to refine the collected image dataset from the Internet. NEIL~\cite{chen2013neil} followed the idea of NELL and learned from web images to form a large collection of concept detectors iteratively via a semi-supervised fashion. By combining the classifiers and the inter-concept relationships it learned, NEIL can be used for scene classification and object detection task. \cite{li2014exploiting} tried to learn robust classifiers by considering the noisy textual information accompanied with web images. However, the down side is that the portion of the true positive samples has to be determined via prior knowledge, where in fact it is not accurate to assume the same number of true positive samples for any targeted concept. \cite{divvala2014learning} introduced a webly-supervised visual concept learning method that automatically learns large amount of models for a wide range of variations within visual concepts. They discovered concept variances through vocabulary of online books, and then downloaded images based on text-search from the web to train object detection and localization models. \cite{liang2015towards} presented a weakly-supervised method called Baby Learning for object detection from a few training images and videos. They first embed the prior knowledge into a pre-trained CNN. When given very few samples for a new concept, a simple detector is constructed to discover much more training instances from the online weakly labeled videos. As more training samples are selected, the concept detector keeps refining until a mature detector is formed. Another recent work in image domain \cite{chen2015webly} proposed a webly supervised learning of Convolutional Neural Network. They utilized easy images from search engine like Google to bootstrap a first-stage network and then used noisier images from photo-sharing websites like Flickr to train an enhanced model. In video domain, only few studies \cite{duan2012visual,han2015fast,varadarajan2015efficient} have been proposed for noisy data learning since training robust video concept detectors is more challenging than the problem in the image domain. \cite{duan2012visual} tackled visual event detection problem by using SVM based domain adaptation method in web video data. \cite{han2015fast} described a fast automatic video retrieval method using web images. Given a targeted concept, compact representations of web images obtained from search engines like Google, Flickr are calculated and matched to compact features of videos. Such method can be utilized without any pre-defined concepts. \cite{varadarajan2015efficient} discussed a method that exploits the YouTube API to train large scale video concept detectors on YouTube. The method utilized a calibration process and hard negative mining to train a second order mixture of experts model in order to discover correlations within the labels. Most of the existing methods are heuristic approaches as it is unclear what objective is being optimizing on the noisy data. Moreover, results obtained from the web search results is just one approach to acquire prior knowledge or curriculum. To the best of our knowledge, there have been no systematical studies on exploiting the multi-modal prior knowledge in video concept learning on noisy data. Since search engine algorithm is changing rapidly, it is unclear that how noisy the web labels are and how the level of noisiness in the data will affect performance. In this paper, we proposed a theoretically justified method with clear framework for curriculum constructing and model learning. We also empirically demonstrate its superior performance over representative existing methods and systemically verify that WELL is robust against the level of noisiness of the video data. \vspace{-1mm} \section{WEbly-Labeled Learning (WELL)} \subsection{Problem Description} In this paper, following~\cite{varadarajan2015efficient}, we consider a concept detector as a classifier and our goal is to train concept detectors from webly-labeled video data without any manual labeling effort. Given a noisy web video training set and a target concept set, we do not assume any distribution of the noise. Formally, we represent the training set as $\mathcal{D} = \{(\mathbf{x}_i,\mathbf{z}_i,\mathbf{\tilde{y}}_i)\}_{i=1}^n$ where $\mathbf{x}_i \in \mathbb{R}^m$ denotes the feature for the $i^{th}$ observed sample, and $\mathbf{z}_i$ represents its noisy web label, which generally means the prior knowledge we can get from the web without additional human effort that not only includes textual information provided by the uploaders in the video metadata but also includes prior knowledge from other modalities using existing tools like pre-trained Convolutional Neural Network image detector \cite{chatfield2014return}, Automatic Speech Recognition \cite{povey2011kaldi} and Optical character recognition \cite{smith2007overview}. The $\mathbf{\tilde{y}}_i \subset \mathcal{Y}$ is the inferred concept label set for the $i^{th}$ observed sample based on its noisy web label, and $\mathcal{Y}$ denotes the full set of target concepts. In our experiment, to simplify the problem, we apply our method on binary classification and infer binary labels $\tilde{y}_i$ from the noisy web labels. The noisy web labels can be used to automatically infer concept labels by matching the concept name to the video textual metadata. For example, a video may be inferred to the concept label ``cat'' as its textual title contains cat. \cite{varadarajan2015efficient} utilizes the YouTube topic API, which is derived from the textual metadata, to automatically get concept labels for videos. The web labels are quite noisy as the webly-labeled concepts may not present in the video content whereas the concepts not in the web label may well appear. \subsection{Model and Algorithm} \subsubsection{Objective Function} To leverage the noisy web labels in a principled way, we propose WEbly-Labeled Learning (WELL). Formally, given a training set $\mathcal{D}$ as described before, Let $L(\tilde{y}_i,g(\mathbf{x}_i,\mathbf{w}))$, or $\ell_i$ for short, denote the loss function which calculates the cost between the inferred label $\tilde{y}_i$ and the estimated label $g(\mathbf{x}_i,\mathbf{w})$. Here $\mathbf{w}$ represents the model parameter inside the decision function $g$. For example, in our paper, $\mathbf{w}$ represents the weight parameters in the Convolutional Neural Network (CNN) and the Support Vector Machine (SVM). Our objective function is to jointly learn the model parameter $\mathbf{w}$ and the latent weight variable $\mathbf{v}= [v_1,\cdots,v_n]^T$ by: \vspace{-2mm} \begin{equation} \label{eq:spcl_obj} \begin{split} \!\min_{\mathbf{w},\mathbf{v}\in \lbrack 0,\!1]^{n}}\!\!\mathbb{E}(\mathbf{w},\!\mathbf{v}\!;\lambda,\!\Psi\!) \!=\! \sum_{i=1}^n v_i L(\tilde{y}_i,\!g(\mathbf{x}_i,\!\mathbf{w})) \!+\! f(\mathbf{v};\! \lambda), \\ \text{ subject to } \mathbf{v} \in \Psi \end{split} \end{equation} where $\mathbf{v=[}v_{1},v_{2},\cdots ,v_{n}\mathbf{]}^{T}$ denote the latent weight variables reflecting the inferred labels' confidence. The weights determine a learning sequence of samples, where samples with greater weights tend to be learned earlier. Our goal is to assign greater weights to the samples with more confident labels whereas smaller or zero weights to the samples with noisy labels. To this end, we employ the self-paced regularizer $f$, which controls the learning process of the model. We consider the linear regularizer Eq.~\eqref{eq:linear_scheme} proposed in~\cite{jiang2015self}: \begin{equation} \label{eq:linear_scheme} f(\mathbf{v};\lambda) = \frac{1}{2} \lambda \sum_{i=1}^n ( v_i^2 - 2v_i ). \vspace{-1mm} \end{equation} Generally, a self-paced regularizer determines the scheme for penalizing the latent weight variables. Physically it resembles the learning schemes human used in understanding new concepts. The linear scheme corresponds to a prudent strategy, which linearly penalizes the samples that are different to what the model has already learned (see Eq.~\eqref{eq:linear_closedform}). The hyper-parameter $\lambda$ $(\lambda > 0)$ is called ``model age'', which controls the pace at which the model learns new samples. When $\lambda$ is small only samples of with small loss will be considered. As $\lambda$ grows, more samples with larger loss will be gradually appended to train a ``mature'' mode. $\Psi$ in Eq.~\eqref{eq:spcl_obj} is a curriculum region derived from noisy web labels $\mathbf{z}$ that incorporates the prior knowledge extracted from the webly-labeled data as a convex feasible region for the weight variables. The shape of the region weakly implies a prior learning sequence of samples, where the expected values for favored samples are larger. The curriculum region can be derived in a variety of ways that make use of different modalities. We will discuss this topic in details in following section. A straightforward approach is by counting the term frequency in the video's textual metadata. That is, for example, the chance of a video containing the concept ``cat'' become higher when it has more word ``cat'' in its title, description or tags. Eq.~\eqref{eq:spcl_obj} represents a concise and general optimization model ~\cite{jiang2015self}. It combines the prior knowledge extracted from the noisy webly-labeled data (as the curriculum region) and the information dynamically learned during the training (via the self-paced regularizer). Intuitively, the prior knowledge serves as an instructor providing a guidance on learning the latent weights, but it leaves certain freedom for the model (the student) to adjust the actual weights according to its learning pace. Experimental results in Section~\ref{sec:experiments} demonstrate the learning paradigm can better overcome the noisy labels than heuristic approaches. Figure \ref{well-cnn} shows the learning process of our method. Following~\cite{kumar2010self,jiang2015self}, we employ the alternative convex search algorithm to solve Eq.~\eqref{eq:spcl_obj}. Algorithm~\ref{alg:overall} takes the input of a curriculum region, an instantiated self-paced regularizer and a step size parameter; it outputs an optimal model parameter $\mathbf{w}$. First of all, it initializes the latent weight variables in the feasible region. Then it alternates between two steps until it finally converges: Step 3 learns the optimal model parameter with the fixed and most recent $\mathbf{v}^*$; Step 5 learns the optimal weight variables with the fixed $\mathbf{w}^*$. In the beginning, the model ``age'' is gradually increased so that more noisy samples will be gradually incorporated in the training. Step 3 can be conveniently implemented by existing off-the-shelf supervised learning methods such as the back propagation. Gradient-based methods can be used to solve the convex optimization problem in Step 4. According to~\cite{gorski2007biconvex}, the alternative search in Algorithm~\ref{alg:overall} converges as the objective function is monotonically decreasing and is bounded from below. \setlength{\textfloatsep}{1pt} \vspace{-3mm} \IncMargin{1em} \begin{algorithm} \SetKwData{Left}{left}\SetKwData{This}{this}\SetKwData{Up}{up} \SetKwInOut{Input}{input}\SetKwInOut{Output}{output} \LinesNumbered \Input{Input dataset $\mathcal{D}$, curriculum region $\Psi$, self-paced function $f$ and a step size $\mu$} \Output{Model parameter $\mathbf{w}$} \BlankLine Initialize $\mathbf{v}^*$, $\lambda$ in the curriculum region\; \While{not converged} { Update $\mathbf{w}^* = \arg\min_{\mathbf{w}} \mathbb{E}(\mathbf{w},\mathbf{v}^*;\lambda, \Psi)$\; Update $\mathbf{v}^* = \arg\min_{\mathbf{v}} \mathbb{E}(\mathbf{w}^*,\mathbf{v}; \lambda, \Psi)$\; \lIf{$\lambda$ is small}{increase $\lambda$ by the step size $\mu$} } \Return $\mathbf{w}^*$ \caption{\label{alg:overall} WEbly-Labeled Learning (WELL).} \end{algorithm} \DecMargin{1em} \vspace{-3mm} At an early age when $\lambda$ is small, Step 4 in Algorithm~\ref{alg:overall} has an evident suppressing effect over noisy samples that have greater loss to the already learned model. For example, with a fixed $\mathbf{w}$, the unconstrained close-formed solution for the regularizer in Eq.~\eqref{eq:linear_scheme} equals \begin{equation} \label{eq:linear_closedform} v_i^* =\begin{cases} -\frac{1}{\lambda} \ell_i +1 & \ell_{i} < \lambda\\ 0 & \ell_{i} \ge \lambda \end{cases}, \end{equation} where $v_i$ represents the $i$th element in the optimal solution $\mathbf{v}^* = [v_1^*, \cdots, v_n^*]^T$. Eq.~\eqref{eq:linear_closedform} called linear regularizer indicates the latent weight is proportional to the negative sample loss, and the sample whose loss is greater or equals to $\lambda$ will have zero weights and thus will not affect the training of the next model. As the model age grows, the hyper-parameter $\lambda$ increases, and more noisy samples will be used into training. The prior knowledge embedded in the curriculum region $\Psi$ is useful as it suggests a learning sequence of samples for the ``immature'' model. \cite{meng2015objective} theoretically proves that the iterative learning process is identical to optimizing a robust loss function on the noisy data. If we keep increasing $\lambda$, the model will ultimately use every sample in the noisy data, which is undesirable as the labels of some noisy samples are bound to be incorrect. To this end, we stop increasing the age $\lambda$ after about a certain number of iterations (early stopping). The exact stopping iteration for each detector is automatically tuned in terms of its performance on a small validation set. \begin{figure*} \centering \includegraphics[width=0.8\textwidth,height=0.3\textheight]{curriculum_example} \caption{Curriculum Extraction Example. We automatically extract information using meaningful prior knowledge from several modalities and fuse them to get curriculum for WELL. Our method makes use of text, speech, visual cues while common methods like search engine only extract from textual information.} \label{curriculum_example} \end{figure*} \subsubsection{Model Details}\label{sec:partial_curriculum} In this section we discuss further details of the curriculum region $\Psi$ and the self-paced regularizer $f(\mathbf{v};\lambda)$. $\Psi$ is a feasible region that embeds the prior knowledge extracted from the webly-labeled data. It physically corresponds to a convex search region for the latent weight variable. Given a set of training samples $\mathbf{X}=\{\mathbf{x}_{i}\}_{i=1}^{n}$, we utilize the partial-order curriculum which generalizes the total-order curriculum by incorporating the incomplete prior over groups of samples. Samples in the confident groups should be learned earlier than samples in the less confident groups. It imposes no prior over the samples within the same group nor the samples not in any group. Formally, we define a partial order relation $\preceq$ such that $x_i \preceq x_j$ indicates that the sample $x_i$ should be learned no later than $x_j$ ($i,j \in [1,n]$). Similarly given two sample subsets $\mathbf{X}_{a} \preceq \mathbf{X}_{b}$ denotes the samples in $\mathbf{X}_{a}$ should be learned no later than the samples in $\mathbf{X}_{b}$. In our problem, we extract the partial-order curriculum in the webly-labeled data in the following ways: we only distinguish the training order for groups of samples. Information from different modalities of the web labels can be used for curriculum design. A straightforward way is to directly utilize the textual descriptions of the videos generated by the uploaders. We compare common ways to extract curriculum from web data for concept learning to the proposed novel method that utilize state-of-the-art topic modeling techniques in natural language processing. In the following methods (Exact \& Stem Matching, Word Embedding and Latent Topic with Word Embedding), we first extract bag-of-words features from different modalities and then match them using specific matching methods to the concept words. Each video will then come with a matching score to each concept. In our experiment, we divide the data into two partial-order curriculum groups, where the videos with matching scores larger than zero will be in one group while others will be in the other group. \textbf{Exact \& Stem Matching} We build curriculum directly using exact word matching or stemmed word matching between the textual metadata of the noisy videos to the targeted concept names. \textbf{YouTubeTopicAPI} We directly utilize the YouTube topic API to search for videos that are related to the concept words. The topic API utilizes textual information of the uploaded videos to obtain related topics of the videos from Freebase. \textbf{SearchEngine} We build curriculum using the search result from a text-based search engine. It is similar to related web-search based methods. \textbf{Word Embedding} We use word embedding \cite{mikolov2013distributed} to match words in metadata to targeted concept words in order to deal with synonyms and related concepts. The word embedding is trained using Google News data. \textbf{Latent Topic} We build curriculum based on the latent topic we learned from the noisy label. We incorporate Latent Dirichlet Allocation (LDA)~\cite{blei2003latent} to determine how each noisy labeled video is related to each target concept. The basic idea is that each web video consists of mixtures of topics (concepts), and each topic is characterized by a distribution of words. Formally, given all the noisy information extracted from a web video and collected them as a document $\mathbf{d_i}$, which combines into a corpus $\mathbf{d}$, we have a target set of $\mathbf{k}$ topics, then the key inferential problem that we are going to solve is that of computing the posterior distribution of the latent topics given a corpus (how likely the videos are related to each target concept given the noisy information): \begin{equation} \label{eq:lda} p(\theta,\mathbf{t}|\mathbf{d},\alpha,\beta) = \frac{p(\theta,\mathbf{t},\mathbf{d}|\alpha,\beta)}{p(\mathbf{d}|\alpha,\beta)} \end{equation} where $\theta$ is the topic distribution variable for the corpus, $\theta$ $\sim$ Dir($\alpha$), in which Dir($\alpha$) represents a uniform Dirichlet distribution with scaling parameter $\alpha$. The $\mathbf{t}$ is the topic assignment variable that indicates which topic each word belong to in the document. $\beta$ is the Dirichlet prior on the per-topic word distribution, in which we impose asymmetric priors over the word distribution so that each learned topic will be seeded with particular words in our target concept. For example, a topic will be seeded with words "walk, dog" for the target concept "WalkingWithDog". The parameter estimation in Eq~\eqref{eq:lda} can be done via Bayes methods. However, Eq.~\eqref{eq:lda} is intractable to compute since $p(\mathbf{d}|\alpha,\beta)$ is intractable due to the coupling between $\theta$ and $\beta$ \cite{blei2003latent}. To solve this problem, approximate inference algorithms are introduced and we use the online variational inference algorithm from \cite{hoffman2010online}. The true posterior is approximated by a simpler distribution: \begin{equation} \label{eq:lda-vi} q(\theta,\mathbf{t}|\gamma,\phi) = q(\theta|\gamma)\prod_{i=1}^{N}{q(t_i|\phi_i)} \end{equation} where the Dirichlet parameter $\gamma$ and the multinomial parameters ($\phi_1,...,\phi_N$) are the free variational parameters. Thus the maximization problem is equivalent to minimizing the Kullback-Leibler(KL) divergence between $q(\theta,\mathbf{t}|\gamma,\phi)$ and the posterior $p(\theta,\mathbf{t}|\mathbf{d},\alpha,\beta)$ \cite{blei2003latent}. The optimization problem can then be solve using Expectation-Maximization algorithm \cite{hoffman2010online}. The estimated parameters $\theta,t$ in Eq.~\eqref{eq:lda} is then used for constructing curriculum region in Eq.~\eqref{eq:spcl_obj}. \textbf{Latent Topic with Word Embedding (LT+WE)} We first learn latent topics using LDA to replace the concept words with a topic word distribution and then match the latent topic words to the web label's bag-of-words features by using the word embeddings. We compare this method to the others using only textual information from the web videos. We also use this method to get curriculum from other modalities such as Automatic Speech Recognition (ASR) \cite{povey2011kaldi}, Optical Character Recognition (OCR) \cite{smith2007overview} and basic image detector pre-trained on still images~\cite{ILSVRC15} (in this paper we use VGG net~\cite{simonyan2014very}, extract keyframe-level image classification results and average them to get video-level results.). We extract bag-of-word features from them and combine them with linear weights. Detailed fusion experiments can be found in Section \ref{sec:experiments}. We empirically set OCR's weight to be small as the results are much noisier than other features. Figure~\ref{curriculum_example} shows an example of the noisy web video data and how the curriculum is extracted with different methods. Our method can utilize information from different modalities while common methods like search engine only consider textual information. We compare the performance of different ways of curriculum design by training detectors directly in Section 4. The labels in webly-labeled data are much noisier than manually-labeled data, and as a result, we found that the learning is prone to overfitting the noisy labels. To address this issue, inspired by the dropout technique in deep learning~\cite{srivastava2014dropout}, we use a dropout strategy for webly-labeled learning~\cite{liang2016learning}. It is implemented in the self-paced regularizer discussed in Section 3. With the dropout, the regularizers become: \begin{equation} \label{eq:dropout} \vspace{-2mm} \begin{split} r_i(p) \sim \text{Bernoulli}(p) + \epsilon, (0 < \epsilon \ll 1)\\ f(\mathbf{v};\lambda, p) = \frac{1}{2} \lambda \sum_{i=1}^n (\frac{1}{r_i} v_i^2 - 2v_i), \end{split} \vspace{-2mm} \end{equation} where $\mathbf{r}$ is a column vector of independent Bernoulli random variables with the probability $p$ of being 1. Each of the element equals the addition of $r_i$ and a small positive constant $\epsilon$. Denote $\mathbb{E}_{\mathbf{w}} = \sum_{i=1}^n v_i \ell_i + f(\mathbf{v};\lambda)$ as the objective with the fixed model parameters $\mathbf{w}$ without any constraint, and the optimal solution $\mathbf{v}^* = [v_1^*, \cdots, v_n^*]^T= \argmin_{\mathbf{v}\in[0,1]^n} \mathbb{E}_{\mathbf{w}}$. We have: \begin{equation} \vspace{-2mm} \label{eq:linear_dropout} \begin{split} \mathbb{E}_{\mathbf{w}} = \sum_{i=1}^n \ell_i v_i + \lambda ( \frac{1}{2r_i} v_i^2 - v_i );\\ \frac{\partial \mathbb{E}_{\mathbf{w}}}{\partial v_i} = \ell + \lambda v_i/r_i -\lambda = 0;\\ \Rightarrow v_i^* =\begin{cases} r_i(-\frac{1}{\lambda} \ell_i +1) & \ell_{i} < \lambda\\ 0 & \ell_{i} \ge \lambda \end{cases}. \end{split} \vspace{-2mm} \end{equation} The dropout effect can be demonstrated in the closed-form solutions in Eq.~\eqref{eq:linear_dropout}: with the probability $1-p$, $v_i^*$ in both the equations approaches 0; with the probability $p$, $v_i^*$ approaches the solution of the plain regularizer discussed in Eq.~\eqref{eq:linear_scheme}. Recall the self-paced regularizer defines a scheme for learning samples. Eq.~\eqref{eq:linear_dropout} represent the new dropout learning scheme. When the base learner is neural networks, the proposed dropout can be used combined with the classical dropout in~\cite{srivastava2014dropout}. The term dropout in this paper refers to dropping out samples in the iterative learning. By dropping out a sample, we drop out its update to the model parameter, which resembles the classical dropout used in neural networks. It operates on a more coarse-level which is useful for noisy data. When samples with incorrect noisy labels update a model, it will encourage the model to select more noisy labels. The dropout strategy prevents overfitting to noisy labels. It provides a way of combining many different sample subsets in different iterations in order to help avoid bad local minima. Experimental results substantiate this argument. In practice, we recommend setting two Bernoulli parameters for positive and negative samples on imbalanced data. \section{Experiments}\label{sec:experiments} In this section, we evaluate our method WELL for learning video detectors on noisy labeled data. The experiments are conducted on two major public benchmarks: FCVID and YFCC100M, where FCVID is by far one of the biggest manually annotated video dataset \cite{jiang2015exploiting}, and the YFCC100M dataset is the largest multimedia benchmark \cite{thomee2015yfcc100m}. \subsection{Experimental Setup} \textbf{Datasets, Features and Evaluation Metrics} Fudan-columbia Video Dataset (FCVID) contains 91,223 YouTube videos (4,232 hours) from 239 categories. It covers a wide range of concepts like activities, objects, scenes, sports, DIY, etc. Detailed descriptions of the benchmark can be found in~\cite{jiang2015exploiting}. Each video is manually labeled to one or more categories. In our experiments, we do not use the manual labels in training, but instead we automatically generate the web labels according to the concept name appearance in the video metadata. The manual labels are used only in testing to evaluate our and the baseline methods. Following~\cite{jiang2015exploiting}, the standard train/test split is used. The second set is YFCC100M \cite{thomee2015yfcc100m} which contains about 800,000 videos on Yahoo! Flickr with metadata such as the title, tags, the uploader, etc. There are no manual labels on this set and we automatically generate the curriculum from the metadata in a similar way. Since there are no annotations, we train the concept detectors on the most 101 frequent latent topics found in the metadata. There are totally 47,397 webly labeled videos on the 101 concepts for training. On FCVID, as the manual labels are available, the performance is evaluated in terms of the precision of the top 5 and 10 ranked videos (P@5 and P@10) and mean Average Precision (mAP) of 239 concepts. On YFCC100M, since there are no manual labels, for evaluation, we apply the detectors to a third public video collection called TRECVID MED which includes 32,000 Internet videos~\cite{over2014trecvid}. We apply the detectors trained on YFCC100M to the TRECVID videos and manually annotate the top 10 detected videos returned by each method for 101 concepts. \textbf{Implementation Details} We build our method on top of a pre-trained convolutional neural network as the low-level features (VGG network \cite{simonyan2014very}). We extract the key-frame level features and create a video feature by the average pooling. The same features are used across different methods on each dataset. The concept detectors are trained based on a hinge loss cost function. Algorithm~\ref{alg:overall} is used to train the concept models iteratively and the $\lambda$ stops increasing after 100 iterations. We automatically generate curriculum labels based on the video metadata, ASR, OCR and VGG net 1,000 classification results using latent topic modeling with word embedding matching as shown in Section 3, and derive a partial-order curriculum using the method discussed in Section 3.2.2. \textbf{Baselines} The proposed method is compared against the following five baseline methods which cover both the classical and the recent representative learning algorithms on webly-labeled data. \textit{BatchTrain} trains a single SVM model using all samples in the multi-modal curriculum built as described in section 3.2.2 LT+WE. \textit{Self-Paced Learning (SPL)} is a classical method where the curriculum is generated by the learner itself~\cite{kumar2010self}. \textit{BabyLearning} is a recent method that simulates baby learning by starting with few training samples and fine-tuning using more weakly labeled videos crawled from the search engine \cite{liang2015towards}. \textit{GoogleHNM} is a hard negative mining method proposed by Google \cite{varadarajan2015efficient}. It utilizes hard negative mining to train a second order mixture of experts model according to the video's YouTube topics. \textit{FastImage} \cite{han2015fast} is a video retrieval method that utilizes web images from search engine to match to the video with re-ranking. \textit{WELL} is the proposed method. The hyper-parameters of all methods including the baseline methods are tuned on the same validation set. On FCVID, the set is a standard development set with manual labels randomly selected from 10\% of the training set (No training was done using ground truth labels) whereas on YFCC100M it is also a 10\% proportion of noisy training set. \subsection{Experiments on FCVID} \textbf{Curriculum Comparison} As disscussed in Section 3.2.2, we compare different ways to build curriculum for noisy label learning. Here we also compare their effectiveness by training concept detectors directly using the curriculum labels. The batch train model is used for all generated cirriculumn labels. In Table \ref{exp-cur} we show the batch trained models' precision at 5, 10 and mean average precision on the test set of FCVID. For LT+WE (Multi-modal), we extract curriculum from different modalities as shown in Section 3.2.2, and combine them using linear weights. The weights are hyper-parameters that are tuned on the validation set, and the optimal weights for textual metadata, ASR, image classification and OCR results are 1.0, 0.5, 0.5 and 0.05, respectively. Results show that the curriculum generated by combining latent topic modeling and word embedding using multi-modal prior knowledge is the most accurate, which indicates our claim of exploiting multi-modal information is beneficial, and we use this method in WELL for the rest of the experiments. \begin{table}[] \centering \caption{Curriculum BatchTrain Comparison} \label{exp-cur} \begin{tabular}{|l||c|c|c|} \hline Method & P@5 & P@10 & mAP \\ \hline \hline ExactMatching & 0.730 & 0.713 & 0.419 \\ StemMatching & 0.782 & 0.763 & 0.469 \\ YouTubeTopicAPI & 0.587 & 0.563 & 0.315 \\ SearchEngine & 0.723 & 0.713 & 0.413 \\ WordEmbedding & 0.790 & 0.774 & 0.462 \\ LatentTopic & 0.731 & 0.716 & 0.409 \\ LT+WE & 0.804 & 0.795 & 0.473 \\ \textbf{LT+WE(Multi-modal)} & \textbf{0.838 } & \textbf{ 0.820 } & \textbf{ 0.486 } \\ \hline \end{tabular} \end{table} \textbf{Baseline Comparison} Table~\ref{exps-basline} compares the precision and mAP of different methods where the best results are highlighted. As we see, the proposed WELL significantly outperforms all baseline methods, with statistically significant difference at $p$-level of 0.05. Comparing WELL with SPL, the effect of curriculum learning and dropout makes a significant difference in terms of performance, which suggests the importance of prior knowledge and preventing over-fitting in webly learning. The promising experimental results substantiate the efficacy of the proposed method. \begin{table}[ht] \centering \footnotesize \caption{Baseline comparison on FCVID} \label{exps-basline} \begin{tabular}{|l||c|c|c|c|c|c|} \hline Method & P@5 & P@10 & mAP \\ \hline \hline BatchTrain & 0.838 & 0.820 & 0.486 \\ FastImage~\cite{han2015fast} &- &- & 0.284\\ SPL~\cite{kumar2011learning} & 0.793 & 0.754 & 0.414 \\ GoogleHNM~\cite{varadarajan2015efficient} & 0.781 & 0.757 & 0.472 \\ BabyLearning~\cite{liang2015towards} & 0.834 & 0.817 & 0.496 \\ \textbf{WELL} &\textbf{0.918}&\textbf{0.906} & \textbf{0.615} \\ \hline \end{tabular} \end{table} \textbf{Robustness to Noise Comparison} In this comparison we manually control the noisiness of the curriculum in order to systematically verify how our methods would perform with respect to the noisiness within the web data. The experimental results indicate the robustness of our method towards noisy labels. To this end, we randomly select video samples with ground truth labels for each concept, so that the precision of the curriculum labels are set at 20\%, 40\%, 60\%, 80\% and we fix the recall of all the labels. We then train WELL using such curriculum and test them on the FCVID testing set. We also compare WELL to three other methods with the same curriculum, among them \textit{GoogleHNM} is a recent method to train video concept detector with large-scale data. We exclude \textit{BabyLearning}, which relies on the returned results by the search engine, since in this experiment the curriculum is fixed . As shown in Table \ref{exp-noise}, as the noisiness of the curriculum grows (the precision drops), WELL maintains its performance while other methods drop significantly. Specifically, when the precision of the curriculum drops from 40\% to 20\%, other methods' mAP averagely drops 46.5\% while WELL's mAP only drops 19.1\% relatively. It shows that WELL is robust against different level of noise, which shows great potential in larger scale webly-labeled learning as the dataset gets bigger, the noisier it may become. \begin{figure}[!ht] \centering \includegraphics[width=1.0\linewidth,height=55mm]{well-noise} \caption{WELL performance with curriculum of different level of noisiness. p=k\% means the curriculum precision. The higher is k, the less noise is in the curriculum labels.} \label{well-noise} \end{figure} \begin{table}[ht] \centering \footnotesize \caption{WELL performance with curriculum of different level of noisiness. $p$ represents the precision of the curriculum. } \vspace{1mm} \label{exp-noise} \begin{tabular}{|l||c|c|c|c|} \hline & p=20\% & p=40\% & p=60\% & p=80\% \\ \hline \hline BatchTrain & 0.232 & 0.463 & 0.538 & 0.592 \\ SPL & 0.184 & 0.396 & 0.515 & 0.586 \\ GoogleHNM & 0.304 & 0.477 & 0.552 & 0.602 \\ \textbf{WELL} & \textbf{0.496} & \textbf{0.613} & \textbf{0.646} & \textbf{0.673} \\ \hline \end{tabular} \end{table} \begin{table}[ht] \centering \footnotesize \caption{WELL performance with curriculum of different level of noisiness. $p$ represents the precision of the curriculum. } \vspace{1mm} \label{exp-noise} \begin{tabular}{|l||c|c|c|c|} \hline & p=80\% & p=60\% & p=40\% & p=20\% \\ \hline \hline BatchTrain & 0.592& 0.538& 0.463& 0.232 \\ SPL & 0.586& 0.515& 0.396& 0.184 \\ GoogleHNM & 0.602& 0.552& 0.477& 0.304 \\ \textbf{WELL} & \textbf{0.673}& \textbf{0.646}& \textbf{0.613}& \textbf{0.496} \\ \hline \end{tabular} \end{table} \textbf{Ground-truth Training Comparison} In this part, we also compare our method with the state-of-the-art method trained using ground truth labels on FCVID (rDNN)~\cite{jiang2015exploiting}. We compare WELL trained using the static CNN features, the standard features provided by the authors~\cite{jiang2015exploiting}, and we also compare WELL using the late (average) fusion with CNN, motion and audio MFCC features (WELL-MM) to the method that achieves the best result on FCVID trained using the same multi-modal features. WELL-MM uses CNN, Motion and MFCC features, which is the same set of features as rDNN-F~\cite{jiang2015exploiting}. Noted that the state-of-the-art method uses the ground truth labels to train models, which includes 42,223 videos with manual labels, while our proposed method uses none of the human annotation into training but still be able to outperform one of the state-of-the-art results. \begin{table}[ht] \centering \footnotesize \caption{Ground-truth Training Comparison on FCVID. The methods with * are trained using human annotated labels. WELL-MM uses CNN, Motion and MFCC features, which is the same set of features as rDNN-F.} \vspace{1mm} \label{exps-sa} \begin{tabular}{|l||c|c|c|c|c|c|} \hline Method & P@5 & P@10 & mAP \\ \hline \hline WELL &\textbf{0.918}&\textbf{0.906} & \textbf{0.615} \\ Static CNN\cite{jiang2015exploiting}* &-&- & 0.638 \\ WELL-MM &\textbf{0.930}&\textbf{0.918} & \textbf{0.697} \\ rDNN-F\cite{jiang2015exploiting}* &-&- & 0.754 \\ \hline \end{tabular} \end{table} \textbf{Noisy Dataset Size Comparison} To investigate the potential of concept learning on webly-labeled video data, we apply the methods on different sizes of subsets of the data. Specifically, we randomly split the FCVID training set into several subsets of 200, 500, 1,000, and 2,000 hours of videos, and train the models on each subset without using manual annotations. The models are then tested on the same test set. Table~\ref{exps-small} lists the average results of each type of subsets. As we see, the accuracy of WELL on webly-labeled data increases along with the growth of the size of noisy data while other webly learning methods' performance tend to be saturated. Comparing to the methods trained using ground truth, In Table~\ref{exps-small}, WELL-MM trained using the whole dataset (2000h) outperforms rDNN-F(trained using manual labels) trained using around 1200h of data. And since the incremental performance increase of WELL-MM is close to linear, we conclude that with sufficient webly-labeled videos WELL-MM will be able to outperform the rDNN-F trained using 2000h of data, which is currently the largest manual labeled dataset. \vspace{-3mm} \begin{figure}[!ht] \centering \includegraphics[width=1.05\linewidth,height=70mm]{well-dataset} \vspace{-7mm} \caption{MAP comparison of models trained using web labels and ground-truth labels on different subsets of FCVID. The methods with * are trained using human annotated labels.} \label{well-dataset} \end{figure} \begin{table}[ht] \centering \footnotesize \caption{MAP comparison of models trained using web labels and ground-truth labels on different subsets of FCVID. The methods with * are trained using human annotated labels. Noted some of the numbers from \cite{jiang2015exploiting} are approximated from graphs.} \vspace{1mm} \label{exps-small} \setlength{\tabcolsep}{4pt} \renewcommand{\arraystretch}{1.1} \begin{tabular}{|l||c|c|c|c|} \hline Dataset Size & 200h & 500h & 1000h & 2000h \\ \hline BatchTrain & 0.364 & 0.422 & 0.452 & 0.486 \\ SPL~\cite{kumar2011learning} & 0.327 &0.379 &0.403 &0.414 \\ GoogleHNM~\cite{varadarajan2015efficient} & 0.361 & 0.421 &0.451 &0.472 \\ BabyLearning~\cite{liang2015towards} &0.390 & 0.447 & 0.481 & 0.496 \\ \textbf{WELL-MM} & \textbf{0.541} & \textbf{0.616} & \textbf{0.632} & \textbf{0.697} \\ \hline Static CNN\cite{jiang2015exploiting}* & 0.485 & 0.561 & 0.604 & 0.638 \\ rDNN-F\cite{jiang2015exploiting}* & 0.550 & 0.620 & 0.650 & 0.754\\ \hline \end{tabular} \end{table} \vspace{-3mm} \subsection{Experiments on YFCC100M} In the experiments on YFCC100M, we train 101 concept detectors on YFCC100M and test them on the TRECVID MED dataset which includes 32,000 Internet videos. Since there are no manual labels, to evaluate the performance, we manually annotate the top 10 videos in the test set and report their precisions in Table~\ref{exps-yfcc}. The MED evaluation is done by four annotators and the final results are averaged from all annotations. The Fleiss' Kappa value for these four annotators is 0.64. A similar pattern can be observed where the comparisons substantiate the rationality of the proposed webly learning framework. Besides, the promising results on the largest multimedia set YFCC100M verify the scalability of the proposed method. \vspace{-3mm} \begin{table}[ht] \centering \footnotesize \caption{Baseline comparison on YFCC100M} \label{exps-yfcc} \begin{tabular}{|l||c|c|c|c|c|c|} \hline Method & P@3 & P@5 & P@10\\ \hline \hline BatchTrain & 0.535 & 0.513 & 0.487 \\ SPL~\cite{kumar2011learning} &0.485 & 0.463 & 0.454\\ GoogleHNM~\cite{varadarajan2015efficient} &0.541 & 0.525 & 0.500 \\ BabyLearning~\cite{liang2015towards} &0.548 & 0.519 & 0.466 \\ \textbf{WELL} &\textbf{0.667} & \textbf{0.663} & \textbf{0.649}\\ \hline \end{tabular} \end{table} \begin{figure*} \centering \includegraphics[width=1.0\textwidth]{pick-all} \vspace{-7mm} \caption{WELL's example picks for different iterations} \vspace{-5mm} \label{well-pick-all} \end{figure*} \vspace{-4mm} \subsection{Time Complexity Comparison} The computation complexity of WELL is comparable to existing methods. For a single class, the complexity for our model and baseline models is $O(r \times n \times m)$, where $r$ is the number of iterations to converge, $n$ is the number of training samples and $m$ is the feature dimension. Theoretically, the complexity is comparable to the baseline models that have different $r$. In practice, on a 40 core-CPU machine, WELL and SPL takes 7 hours to converge (100 iterations) on FCVID with 239 concepts, whereas GoogleHNM and BabyLearning take around 5 hours. In Table \ref{time}, we show the theoretical and actual run time for all methods. \begin{table}[ht] \centering \caption{Runtime comparison across different methods. We report the time complexity on different method as well as their actual run time on FCVID (in hours).} \label{time} \begin{tabular}{|l||c|c|c|} \hline Method & Complexity & FCVID(h) \\ \hline \hline BatchTrain & $O(n \times m)$ & 2.0 \\ SPL & $O(r \times n \times m)$ & 7.0 \\ GoogleHNM & $O(r \times n \times m)$ & 5.0 \\ BabyLearning & $O(r \times n \times m)$ & 5.0 \\ WELL & $O(r \times n \times m)$ & 7.0\\ \hline \end{tabular} \end{table} \vspace{-3mm} \subsection{Qualitative Analysis} In this section we show training examples of WELL. In Figure~\ref{well-pick-all}, we demonstrate the positive samples that WELL select at different stage of training the concept "baseball", "forest", "birthday" and "cow". For the concept "baseball", at early stage (1/93, 25/93), WELL selects easier and clearer samples such as those camera directly pointing at the playground, while at later stage (75/93, 93/93) WELL starts to train with harder samples with different lighting conditions and untypical samples for the concept. For the concept "birthday", as we see, at later stage of the training, complex samples for birthday event like a video with two girl singing birthday song (75/84) and a video of celebrating birthday during hiking (84/84) are included in the training. For the concept "forest", at the final iteration (95/95), a video of a man playing nunchaku is included, as the video title contains "Air Forester Nunchaku Freestyle" and it is included in the curriculum, which is reasonable as the curriculum is noisy and may contain false positive. Since WELL is able to leave outliers in later stage of the training, the affection of the false positives in the curriculum can be alleviated by early stopping. In our experiments, we stop increasing $\lambda$ after 100 iterations so in the final model, only a subset of samples are used. \vspace{-2mm} \section{Conclusions} In this paper, we proposed a novel method called WELL for webly labeled video data learning. WELL extracts multi-modal informative knowledge from noisy weakly labeled video data from the web through a general framework with solid theoretical justifications. WELL achieves the best performance only using webly-labeled data on two major video datasets. The comprehensive experimental results demonstrate that WELL outperforms state-of-the-art studies by a statically significant margin on learning concepts from noisy web video data. In addition, the results also verify that WELL is robust to the level of noisiness in the video data. The result suggests that with more webly-labeled data, which is not hard to obtain, WELL can potentially outperform models trained on any existing manually-labeled data. \vspace{-3mm} \bibliographystyle{abbrv} \linespread{0.9} \scriptsize \section{Introduction} Nowadays, millions of videos are being uploaded to the Internet every day. These videos capture all aspects of multimedia content about their uploader's daily life. These explosively growing user generated content videos online are becoming an crucial source of video data. Automatically categorizing videos into concepts, such as people actions, objects, etc., has become an important research topic. Recently many work have been proposed to tackle with building concept detectors both in image domain and video domain \cite{deng2009imagenet,liang2015towards,tang2012shifting,karpathy2014large,jiang2015exploiting}. However, the need for manual labels by human annotators has become one of the major important limitations for large-scale concept learning. It is even more so in video domain, since training concept detectors on videos is more challenging than on still images. Many image datasets such as ImageNet~\cite{deng2009imagenet}, CIFAR~\cite{krizhevsky2009learning}, PASCAL VOC\cite{everingham2010pascal}, MS COCO~\cite{lin2014microsoft} and Caltech~\cite{fei2006one} have been collected and manually labeled. In video domain, some largest datasets such as UCF-101\cite{soomro2012ucf101}, MCG-WEBV~\cite{cao2009mcg}, TRECVID MED~\cite{over2014trecvid} and FCVID~\cite{jiang2015exploiting} are popular benchmark datasets for video classification. Collecting such datasets requires a large amount of human effort that can take thousands of man hours. In addition, manually labeling video requires playing back the video, which is more time consuming and expensive than labeling still images. As a result, the largest labeled video collection, FCVID~\cite{jiang2015exploiting}, only contains about 0.09 million labels with 239 concept classes, much less than the 14 million labels with over 20,000 classes in the image collection ImageNet~\cite{deng2009imagenet}. Many state-of-the-art models in visual classification are based on the neural networks~\cite{jiang2015exploiting,karpathy2014large,varadarajan2015efficient}. As the architecture gets deeper, the neural network would need more data to train in order to get better performance. However, more data needs more human supervision which are more expensive to acquire in the video domain. Videos are available on the web and contain rich contextual information with a weak annotation about their content, such as their titles, descriptions and surrounding text. These webly-labeled data are orders of magnitude larger than that of any manually-labeled collections. Moreover, automatically extracted features from multiple modalities such as existing still image classification models, automatic speech recognition and optical character recognition tools can be useful additional information for the content of the video. Figure \ref{cur-example} shows an example of webly-labeled video for walking with a dog. As we see, the textual metadata we get from the web videos contain useful but very noisy information. The multi-modal prior information we get is correlated across modalities, as the image classification results and speech transcript show high probability of dog appearance, while the textual metadata indicates the same content. Some of the videos (about 20\% in the FCVID dataset) have very little textual metadata and we can only obtain web labels via other modalities. To address the problem of learning detectors from the big web data, in this paper, we utilize multi-modal information to harness prior knowledge from the web video without any manual efforts. Existing methods on learning from noisy webly-labeled data has mainly focused on the image domain \cite{fergus2005learning,li2010optimol,bergamo2010exploiting,chen2015webly}. Existing studies demonstrated promising results in this direction. However, these methods are primarily based on some heuristic methods. It is not clear what objective is being optimized and where or even whether the learning process will converge. Moreover, these methods only utilize a single text modality in the image domain. It is unclear how to exploit the multi-modal prior knowledge for concept learning from the rich context of Internet video. To utilize the large amount of webly-labeled video data for concept learning, we propose a learning framework called \textbf{WEbly-Labeled Learning (WELL)}. It is established on the theories called \textit{curriculum learning}~\cite{bengio2009curriculum} and \textit{self-paced learning}~\cite{kumar2010self}. The learning framework is motivated by human learning, where people generally start learning easier aspects of a concept, and then gradually take more complex examples into the learning process\cite{bengio2009curriculum,kumar2010self,jiang2015self}. Following this idea, WELL learns a concept detector iteratively from first using a few samples with more confident labels (more related to the concept), then gradually incorporate more video samples with noisier labels. The algorithm combines the prior knowledge, called learning curriculum, extracted from the webly-labeled data with the dynamic information learned from the statistical model (self-paced) to determine which video samples to learn in the next iteration. This idea of easy-to-hard learning paradigm has been adopted for learning in noisy web data~\cite{jiang2014easy,chen2015webly,kumar2010self} and has been proved to be efficient to deal with noise and outliers. Our proposed method generalizes such learning paradigm using a clear objective function. It is proved to be convex and is a also general framework that can incorporate state-of-the-art deep learning methods to learn robust detectors from noisy data. Our framework fundamentally changes self-paced learning and allows learning for video concept detectors at unlimited scale. Figure~\ref{well-cnn} shows the architecture of the proposed method. We extract keyframe-level convolutional neural network features and feed them into WELL layer with average pooling and iterative learning process. We have also tried using other video features such as motion features and audio MFCC features. Our contributions are threefold. First, we address the problem of learning robust video concept detectors from noisy web data through a general framework with solid theoretical justifications. We show that WELL not only outperforms state-of-the-art learning methods on noisy labels, but also, notably, achieves comparable results with state-of-the-art models trained using manual annotation on one of the largest video dataset. Second, we provide detailed comparison of different approaches to exploit multi-modal curriculum from noisy labels and verify that our method is robust against certain level of noisiness in the video data. Finally, the efficacy and the scalability have been empirically demonstrated on two public benchmarks, including by far the largest manually-labeled video set called FCVID~\cite{jiang2015exploiting} and the largest multimedia dataset called YFCC100M~\cite{thomee2015yfcc100m}. The promising results suggest that detectors trained on sufficient webly-labeled videos may outperform detectors trained on any existing manually-labeled datasets. \begin{figure*} \centering \includegraphics[width=0.9\textwidth,height=1.5in]{well-cnn} \vspace{-6mm} \caption{\textbf{Learning architecture of WEbly-Labeled Learning (WELL)}} \label{well-cnn} \end{figure*} \section{Related Work} \textbf{Curriculum and Self-paced Learning}: Recently a learning paradigm called~\textit{curriculum learning} (CL) was proposed by Bengio et al., in which a model is learned by gradually incorporating from easy to complex samples in training so as to increase the entropy of training samples~\cite{bengio2009curriculum}. A curriculum determines a sequence of training samples and is often derived by predetermined heuristics in particular problems. For example, Chen et al. designed a curriculum where images with clean backgrounds are learned before the images with noisy backgrounds~\cite{chen2015webly} , i.e. their method first builds a feature representation by a Convolutional Neural Network (CNN) on images with clean background and then they fine tune the models on images with noisy background. In~\cite{spitkovsky2009baby}, the authors approached grammar induction, where the curriculum is derived in terms of the length of a sentence. Because the number of possible solutions grows exponentially with the length of the sentence, and short sentences are easier and thus should be learn earlier. The heuristic knowledge in a problem often proves to be useful. However, the curriculum design may lead to inconsistency between the fixed curriculum and the dynamically learned models. That is, the curriculum is predetermined a prior and cannot be adjusted accordingly, taking into account the feedback about the learner. To alleviate the issue of CL, Kumar et al. designed a learning paradigm, called \emph{self-paced learning} (SPL)~\cite{kumar2010self}. SPL embeds curriculum design as a regularizer into the learning objective. Compared with CL, SPL exhibits two advantages: first, it jointly optimizes the learning objective with the curriculum, and thus the curriculum and the learned model are consistent under the same optimization problem; second, the learning is controlled by a regularizer which is independent of the loss function in specific problems. This theory has been successfully applied to various applications, such as matrix factorization~\cite{zhao2015self}, action/event detection~\cite{jiang2014self}, domain adaption~\cite{tang2012shifting}, tracking~\cite{supancic2013self} and segmentation~\cite{kumar2011learning}, reranking~\cite{jiang2014easy}, etc. \textbf{Learning Detectors in Web Data}: Many recent studies have been proposed to utilize the large amount of noisy data from the Internet. For example, \cite{mitchell2015never} proposed a Never-Ending Language Learning (NELL) paradigm and built adaptive learners that makes use of the web data by learning different types of knowledge and beliefs continuously. Such learning process is mostly self-supervised, and previously learned knowledge enables learning further types of knowledge. In the image domain, existing methods try to tackle the problem of constructing qualified training sets based on the search results of text or image search engines~\cite{fergus2005learning,li2007optimol,chen2013neil,li2014exploiting,divvala2014learning,liang2015towards}. For example, \cite{fergus2005learning} extended the probabilistic Latent Semantic Analysis in visual domain and learned object categories using results from image search engines. \cite{li2007optimol} proposed an incremental learning paradigm that initialized from a few seed images and repeatedly trained models to refine the collected image dataset from the Internet. NEIL~\cite{chen2013neil} followed the idea of NELL and learned from web images to form a large collection of concept detectors iteratively via a semi-supervised fashion. By combining the classifiers and the inter-concept relationships it learned, NEIL can be used for scene classification and object detection task. \cite{li2014exploiting} tried to learn robust classifiers by considering the noisy textual information accompanied with web images. However, the down side is that the portion of the true positive samples has to be determined via prior knowledge, where in fact it is not accurate to assume the same number of true positive samples for any targeted concept. \cite{divvala2014learning} introduced a webly-supervised visual concept learning method that automatically learns large amount of models for a wide range of variations within visual concepts. They discovered concept variances through vocabulary of online books, and then downloaded images based on text-search from the web to train object detection and localization models. \cite{liang2015towards} presented a weakly-supervised method called Baby Learning for object detection from a few training images and videos. They first embed the prior knowledge into a pre-trained CNN. When given very few samples for a new concept, a simple detector is constructed to discover much more training instances from the online weakly labeled videos. As more training samples are selected, the concept detector keeps refining until a mature detector is formed. Another recent work in image domain \cite{chen2015webly} proposed a webly supervised learning of Convolutional Neural Network. They utilized easy images from search engine like Google to bootstrap a first-stage network and then used noisier images from photo-sharing websites like Flickr to train an enhanced model. In video domain, only few studies \cite{duan2012visual,han2015fast,varadarajan2015efficient} have been proposed for noisy data learning since training robust video concept detectors is more challenging than the problem in the image domain. \cite{duan2012visual} tackled visual event detection problem by using SVM based domain adaptation method in web video data. \cite{han2015fast} described a fast automatic video retrieval method using web images. Given a targeted concept, compact representations of web images obtained from search engines like Google, Flickr are calculated and matched to compact features of videos. Such method can be utilized without any pre-defined concepts. \cite{varadarajan2015efficient} discussed a method that exploits the YouTube API to train large scale video concept detectors on YouTube. The method utilized a calibration process and hard negative mining to train a second order mixture of experts model in order to discover correlations within the labels. Most of the existing methods are heuristic approaches as it is unclear what objective is being optimizing on the noisy data. Moreover, results obtained from the web search results is just one approach to acquire prior knowledge or curriculum. To the best of our knowledge, there have been no systematical studies on exploiting the multi-modal prior knowledge in video concept learning on noisy data. Since search engine algorithm is changing rapidly, it is unclear that how noisy the web labels are and how the level of noisiness in the data will affect performance. In this paper, we proposed a theoretically justified method with clear framework for curriculum constructing and model learning. We also empirically demonstrate its superior performance over representative existing methods and systemically verify that WELL is robust against the level of noisiness of the video data. \vspace{-1mm} \section{WEbly-Labeled Learning (WELL)} \subsection{Problem Description} In this paper, following~\cite{varadarajan2015efficient}, we consider a concept detector as a classifier and our goal is to train concept detectors from webly-labeled video data without any manual labeling effort. Given a noisy web video training set and a target concept set, we do not assume any distribution of the noise. Formally, we represent the training set as $\mathcal{D} = \{(\mathbf{x}_i,\mathbf{z}_i,\mathbf{\tilde{y}}_i)\}_{i=1}^n$ where $\mathbf{x}_i \in \mathbb{R}^m$ denotes the feature for the $i^{th}$ observed sample, and $\mathbf{z}_i$ represents its noisy web label, which generally means the prior knowledge we can get from the web without additional human effort that not only includes textual information provided by the uploaders in the video metadata but also includes prior knowledge from other modalities using existing tools like pre-trained Convolutional Neural Network image detector \cite{chatfield2014return}, Automatic Speech Recognition \cite{povey2011kaldi} and Optical character recognition \cite{smith2007overview}. The $\mathbf{\tilde{y}}_i \subset \mathcal{Y}$ is the inferred concept label set for the $i^{th}$ observed sample based on its noisy web label, and $\mathcal{Y}$ denotes the full set of target concepts. In our experiment, to simplify the problem, we apply our method on binary classification and infer binary labels $\tilde{y}_i$ from the noisy web labels. The noisy web labels can be used to automatically infer concept labels by matching the concept name to the video textual metadata. For example, a video may be inferred to the concept label ``cat'' as its textual title contains cat. \cite{varadarajan2015efficient} utilizes the YouTube topic API, which is derived from the textual metadata, to automatically get concept labels for videos. The web labels are quite noisy as the webly-labeled concepts may not present in the video content whereas the concepts not in the web label may well appear. \subsection{Model and Algorithm} \subsubsection{Objective Function} To leverage the noisy web labels in a principled way, we propose WEbly-Labeled Learning (WELL). Formally, given a training set $\mathcal{D}$ as described before, Let $L(\tilde{y}_i,g(\mathbf{x}_i,\mathbf{w}))$, or $\ell_i$ for short, denote the loss function which calculates the cost between the inferred label $\tilde{y}_i$ and the estimated label $g(\mathbf{x}_i,\mathbf{w})$. Here $\mathbf{w}$ represents the model parameter inside the decision function $g$. For example, in our paper, $\mathbf{w}$ represents the weight parameters in the Convolutional Neural Network (CNN) and the Support Vector Machine (SVM). Our objective function is to jointly learn the model parameter $\mathbf{w}$ and the latent weight variable $\mathbf{v}= [v_1,\cdots,v_n]^T$ by: \vspace{-2mm} \begin{equation} \label{eq:spcl_obj} \begin{split} \!\min_{\mathbf{w},\mathbf{v}\in \lbrack 0,\!1]^{n}}\!\!\mathbb{E}(\mathbf{w},\!\mathbf{v}\!;\lambda,\!\Psi\!) \!=\! \sum_{i=1}^n v_i L(\tilde{y}_i,\!g(\mathbf{x}_i,\!\mathbf{w})) \!+\! f(\mathbf{v};\! \lambda), \\ \text{ subject to } \mathbf{v} \in \Psi \end{split} \end{equation} where $\mathbf{v=[}v_{1},v_{2},\cdots ,v_{n}\mathbf{]}^{T}$ denote the latent weight variables reflecting the inferred labels' confidence. The weights determine a learning sequence of samples, where samples with greater weights tend to be learned earlier. Our goal is to assign greater weights to the samples with more confident labels whereas smaller or zero weights to the samples with noisy labels. To this end, we employ the self-paced regularizer $f$, which controls the learning process of the model. We consider the linear regularizer Eq.~\eqref{eq:linear_scheme} proposed in~\cite{jiang2015self}: \begin{equation} \label{eq:linear_scheme} f(\mathbf{v};\lambda) = \frac{1}{2} \lambda \sum_{i=1}^n ( v_i^2 - 2v_i ). \vspace{-1mm} \end{equation} Generally, a self-paced regularizer determines the scheme for penalizing the latent weight variables. Physically it resembles the learning schemes human used in understanding new concepts. The linear scheme corresponds to a prudent strategy, which linearly penalizes the samples that are different to what the model has already learned (see Eq.~\eqref{eq:linear_closedform}). The hyper-parameter $\lambda$ $(\lambda > 0)$ is called ``model age'', which controls the pace at which the model learns new samples. When $\lambda$ is small only samples of with small loss will be considered. As $\lambda$ grows, more samples with larger loss will be gradually appended to train a ``mature'' mode. $\Psi$ in Eq.~\eqref{eq:spcl_obj} is a curriculum region derived from noisy web labels $\mathbf{z}$ that incorporates the prior knowledge extracted from the webly-labeled data as a convex feasible region for the weight variables. The shape of the region weakly implies a prior learning sequence of samples, where the expected values for favored samples are larger. The curriculum region can be derived in a variety of ways that make use of different modalities. We will discuss this topic in details in following section. A straightforward approach is by counting the term frequency in the video's textual metadata. That is, for example, the chance of a video containing the concept ``cat'' become higher when it has more word ``cat'' in its title, description or tags. Eq.~\eqref{eq:spcl_obj} represents a concise and general optimization model ~\cite{jiang2015self}. It combines the prior knowledge extracted from the noisy webly-labeled data (as the curriculum region) and the information dynamically learned during the training (via the self-paced regularizer). Intuitively, the prior knowledge serves as an instructor providing a guidance on learning the latent weights, but it leaves certain freedom for the model (the student) to adjust the actual weights according to its learning pace. Experimental results in Section~\ref{sec:experiments} demonstrate the learning paradigm can better overcome the noisy labels than heuristic approaches. Figure \ref{well-cnn} shows the learning process of our method. Following~\cite{kumar2010self,jiang2015self}, we employ the alternative convex search algorithm to solve Eq.~\eqref{eq:spcl_obj}. Algorithm~\ref{alg:overall} takes the input of a curriculum region, an instantiated self-paced regularizer and a step size parameter; it outputs an optimal model parameter $\mathbf{w}$. First of all, it initializes the latent weight variables in the feasible region. Then it alternates between two steps until it finally converges: Step 3 learns the optimal model parameter with the fixed and most recent $\mathbf{v}^*$; Step 5 learns the optimal weight variables with the fixed $\mathbf{w}^*$. In the beginning, the model ``age'' is gradually increased so that more noisy samples will be gradually incorporated in the training. Step 3 can be conveniently implemented by existing off-the-shelf supervised learning methods such as the back propagation. Gradient-based methods can be used to solve the convex optimization problem in Step 4. According to~\cite{gorski2007biconvex}, the alternative search in Algorithm~\ref{alg:overall} converges as the objective function is monotonically decreasing and is bounded from below. \setlength{\textfloatsep}{1pt} \vspace{-3mm} \IncMargin{1em} \begin{algorithm} \SetKwData{Left}{left}\SetKwData{This}{this}\SetKwData{Up}{up} \SetKwInOut{Input}{input}\SetKwInOut{Output}{output} \LinesNumbered \Input{Input dataset $\mathcal{D}$, curriculum region $\Psi$, self-paced function $f$ and a step size $\mu$} \Output{Model parameter $\mathbf{w}$} \BlankLine Initialize $\mathbf{v}^*$, $\lambda$ in the curriculum region\; \While{not converged} { Update $\mathbf{w}^* = \arg\min_{\mathbf{w}} \mathbb{E}(\mathbf{w},\mathbf{v}^*;\lambda, \Psi)$\; Update $\mathbf{v}^* = \arg\min_{\mathbf{v}} \mathbb{E}(\mathbf{w}^*,\mathbf{v}; \lambda, \Psi)$\; \lIf{$\lambda$ is small}{increase $\lambda$ by the step size $\mu$} } \Return $\mathbf{w}^*$ \caption{\label{alg:overall} WEbly-Labeled Learning (WELL).} \end{algorithm} \DecMargin{1em} \vspace{-3mm} At an early age when $\lambda$ is small, Step 4 in Algorithm~\ref{alg:overall} has an evident suppressing effect over noisy samples that have greater loss to the already learned model. For example, with a fixed $\mathbf{w}$, the unconstrained close-formed solution for the regularizer in Eq.~\eqref{eq:linear_scheme} equals \begin{equation} \label{eq:linear_closedform} v_i^* =\begin{cases} -\frac{1}{\lambda} \ell_i +1 & \ell_{i} < \lambda\\ 0 & \ell_{i} \ge \lambda \end{cases}, \end{equation} where $v_i$ represents the $i$th element in the optimal solution $\mathbf{v}^* = [v_1^*, \cdots, v_n^*]^T$. Eq.~\eqref{eq:linear_closedform} called linear regularizer indicates the latent weight is proportional to the negative sample loss, and the sample whose loss is greater or equals to $\lambda$ will have zero weights and thus will not affect the training of the next model. As the model age grows, the hyper-parameter $\lambda$ increases, and more noisy samples will be used into training. The prior knowledge embedded in the curriculum region $\Psi$ is useful as it suggests a learning sequence of samples for the ``immature'' model. \cite{meng2015objective} theoretically proves that the iterative learning process is identical to optimizing a robust loss function on the noisy data. If we keep increasing $\lambda$, the model will ultimately use every sample in the noisy data, which is undesirable as the labels of some noisy samples are bound to be incorrect. To this end, we stop increasing the age $\lambda$ after about a certain number of iterations (early stopping). The exact stopping iteration for each detector is automatically tuned in terms of its performance on a small validation set. \begin{figure*} \centering \includegraphics[width=0.8\textwidth,height=0.3\textheight]{curriculum_example} \caption{Curriculum Extraction Example. We automatically extract information using meaningful prior knowledge from several modalities and fuse them to get curriculum for WELL. Our method makes use of text, speech, visual cues while common methods like search engine only extract from textual information.} \label{curriculum_example} \end{figure*} \subsubsection{Model Details}\label{sec:partial_curriculum} In this section we discuss further details of the curriculum region $\Psi$ and the self-paced regularizer $f(\mathbf{v};\lambda)$. $\Psi$ is a feasible region that embeds the prior knowledge extracted from the webly-labeled data. It physically corresponds to a convex search region for the latent weight variable. Given a set of training samples $\mathbf{X}=\{\mathbf{x}_{i}\}_{i=1}^{n}$, we utilize the partial-order curriculum which generalizes the total-order curriculum by incorporating the incomplete prior over groups of samples. Samples in the confident groups should be learned earlier than samples in the less confident groups. It imposes no prior over the samples within the same group nor the samples not in any group. Formally, we define a partial order relation $\preceq$ such that $x_i \preceq x_j$ indicates that the sample $x_i$ should be learned no later than $x_j$ ($i,j \in [1,n]$). Similarly given two sample subsets $\mathbf{X}_{a} \preceq \mathbf{X}_{b}$ denotes the samples in $\mathbf{X}_{a}$ should be learned no later than the samples in $\mathbf{X}_{b}$. In our problem, we extract the partial-order curriculum in the webly-labeled data in the following ways: we only distinguish the training order for groups of samples. Information from different modalities of the web labels can be used for curriculum design. A straightforward way is to directly utilize the textual descriptions of the videos generated by the uploaders. We compare common ways to extract curriculum from web data for concept learning to the proposed novel method that utilize state-of-the-art topic modeling techniques in natural language processing. In the following methods (Exact \& Stem Matching, Word Embedding and Latent Topic with Word Embedding), we first extract bag-of-words features from different modalities and then match them using specific matching methods to the concept words. Each video will then come with a matching score to each concept. In our experiment, we divide the data into two partial-order curriculum groups, where the videos with matching scores larger than zero will be in one group while others will be in the other group. \textbf{Exact \& Stem Matching} We build curriculum directly using exact word matching or stemmed word matching between the textual metadata of the noisy videos to the targeted concept names. \textbf{YouTubeTopicAPI} We directly utilize the YouTube topic API to search for videos that are related to the concept words. The topic API utilizes textual information of the uploaded videos to obtain related topics of the videos from Freebase. \textbf{SearchEngine} We build curriculum using the search result from a text-based search engine. It is similar to related web-search based methods. \textbf{Word Embedding} We use word embedding \cite{mikolov2013distributed} to match words in metadata to targeted concept words in order to deal with synonyms and related concepts. The word embedding is trained using Google News data. \textbf{Latent Topic} We build curriculum based on the latent topic we learned from the noisy label. We incorporate Latent Dirichlet Allocation (LDA)~\cite{blei2003latent} to determine how each noisy labeled video is related to each target concept. The basic idea is that each web video consists of mixtures of topics (concepts), and each topic is characterized by a distribution of words. Formally, given all the noisy information extracted from a web video and collected them as a document $\mathbf{d_i}$, which combines into a corpus $\mathbf{d}$, we have a target set of $\mathbf{k}$ topics, then the key inferential problem that we are going to solve is that of computing the posterior distribution of the latent topics given a corpus (how likely the videos are related to each target concept given the noisy information): \begin{equation} \label{eq:lda} p(\theta,\mathbf{t}|\mathbf{d},\alpha,\beta) = \frac{p(\theta,\mathbf{t},\mathbf{d}|\alpha,\beta)}{p(\mathbf{d}|\alpha,\beta)} \end{equation} where $\theta$ is the topic distribution variable for the corpus, $\theta$ $\sim$ Dir($\alpha$), in which Dir($\alpha$) represents a uniform Dirichlet distribution with scaling parameter $\alpha$. The $\mathbf{t}$ is the topic assignment variable that indicates which topic each word belong to in the document. $\beta$ is the Dirichlet prior on the per-topic word distribution, in which we impose asymmetric priors over the word distribution so that each learned topic will be seeded with particular words in our target concept. For example, a topic will be seeded with words "walk, dog" for the target concept "WalkingWithDog". The parameter estimation in Eq~\eqref{eq:lda} can be done via Bayes methods. However, Eq.~\eqref{eq:lda} is intractable to compute since $p(\mathbf{d}|\alpha,\beta)$ is intractable due to the coupling between $\theta$ and $\beta$ \cite{blei2003latent}. To solve this problem, approximate inference algorithms are introduced and we use the online variational inference algorithm from \cite{hoffman2010online}. The true posterior is approximated by a simpler distribution: \begin{equation} \label{eq:lda-vi} q(\theta,\mathbf{t}|\gamma,\phi) = q(\theta|\gamma)\prod_{i=1}^{N}{q(t_i|\phi_i)} \end{equation} where the Dirichlet parameter $\gamma$ and the multinomial parameters ($\phi_1,...,\phi_N$) are the free variational parameters. Thus the maximization problem is equivalent to minimizing the Kullback-Leibler(KL) divergence between $q(\theta,\mathbf{t}|\gamma,\phi)$ and the posterior $p(\theta,\mathbf{t}|\mathbf{d},\alpha,\beta)$ \cite{blei2003latent}. The optimization problem can then be solve using Expectation-Maximization algorithm \cite{hoffman2010online}. The estimated parameters $\theta,t$ in Eq.~\eqref{eq:lda} is then used for constructing curriculum region in Eq.~\eqref{eq:spcl_obj}. \textbf{Latent Topic with Word Embedding (LT+WE)} We first learn latent topics using LDA to replace the concept words with a topic word distribution and then match the latent topic words to the web label's bag-of-words features by using the word embeddings. We compare this method to the others using only textual information from the web videos. We also use this method to get curriculum from other modalities such as Automatic Speech Recognition (ASR) \cite{povey2011kaldi}, Optical Character Recognition (OCR) \cite{smith2007overview} and basic image detector pre-trained on still images~\cite{ILSVRC15} (in this paper we use VGG net~\cite{simonyan2014very}, extract keyframe-level image classification results and average them to get video-level results.). We extract bag-of-word features from them and combine them with linear weights. Detailed fusion experiments can be found in Section \ref{sec:experiments}. We empirically set OCR's weight to be small as the results are much noisier than other features. Figure~\ref{curriculum_example} shows an example of the noisy web video data and how the curriculum is extracted with different methods. Our method can utilize information from different modalities while common methods like search engine only consider textual information. We compare the performance of different ways of curriculum design by training detectors directly in Section 4. The labels in webly-labeled data are much noisier than manually-labeled data, and as a result, we found that the learning is prone to overfitting the noisy labels. To address this issue, inspired by the dropout technique in deep learning~\cite{srivastava2014dropout}, we use a dropout strategy for webly-labeled learning~\cite{liang2016learning}. It is implemented in the self-paced regularizer discussed in Section 3. With the dropout, the regularizers become: \begin{equation} \label{eq:dropout} \vspace{-2mm} \begin{split} r_i(p) \sim \text{Bernoulli}(p) + \epsilon, (0 < \epsilon \ll 1)\\ f(\mathbf{v};\lambda, p) = \frac{1}{2} \lambda \sum_{i=1}^n (\frac{1}{r_i} v_i^2 - 2v_i), \end{split} \vspace{-2mm} \end{equation} where $\mathbf{r}$ is a column vector of independent Bernoulli random variables with the probability $p$ of being 1. Each of the element equals the addition of $r_i$ and a small positive constant $\epsilon$. Denote $\mathbb{E}_{\mathbf{w}} = \sum_{i=1}^n v_i \ell_i + f(\mathbf{v};\lambda)$ as the objective with the fixed model parameters $\mathbf{w}$ without any constraint, and the optimal solution $\mathbf{v}^* = [v_1^*, \cdots, v_n^*]^T= \argmin_{\mathbf{v}\in[0,1]^n} \mathbb{E}_{\mathbf{w}}$. We have: \begin{equation} \vspace{-2mm} \label{eq:linear_dropout} \begin{split} \mathbb{E}_{\mathbf{w}} = \sum_{i=1}^n \ell_i v_i + \lambda ( \frac{1}{2r_i} v_i^2 - v_i );\\ \frac{\partial \mathbb{E}_{\mathbf{w}}}{\partial v_i} = \ell + \lambda v_i/r_i -\lambda = 0;\\ \Rightarrow v_i^* =\begin{cases} r_i(-\frac{1}{\lambda} \ell_i +1) & \ell_{i} < \lambda\\ 0 & \ell_{i} \ge \lambda \end{cases}. \end{split} \vspace{-2mm} \end{equation} The dropout effect can be demonstrated in the closed-form solutions in Eq.~\eqref{eq:linear_dropout}: with the probability $1-p$, $v_i^*$ in both the equations approaches 0; with the probability $p$, $v_i^*$ approaches the solution of the plain regularizer discussed in Eq.~\eqref{eq:linear_scheme}. Recall the self-paced regularizer defines a scheme for learning samples. Eq.~\eqref{eq:linear_dropout} represent the new dropout learning scheme. When the base learner is neural networks, the proposed dropout can be used combined with the classical dropout in~\cite{srivastava2014dropout}. The term dropout in this paper refers to dropping out samples in the iterative learning. By dropping out a sample, we drop out its update to the model parameter, which resembles the classical dropout used in neural networks. It operates on a more coarse-level which is useful for noisy data. When samples with incorrect noisy labels update a model, it will encourage the model to select more noisy labels. The dropout strategy prevents overfitting to noisy labels. It provides a way of combining many different sample subsets in different iterations in order to help avoid bad local minima. Experimental results substantiate this argument. In practice, we recommend setting two Bernoulli parameters for positive and negative samples on imbalanced data. \section{Experiments}\label{sec:experiments} In this section, we evaluate our method WELL for learning video detectors on noisy labeled data. The experiments are conducted on two major public benchmarks: FCVID and YFCC100M, where FCVID is by far one of the biggest manually annotated video dataset \cite{jiang2015exploiting}, and the YFCC100M dataset is the largest multimedia benchmark \cite{thomee2015yfcc100m}. \subsection{Experimental Setup} \textbf{Datasets, Features and Evaluation Metrics} Fudan-columbia Video Dataset (FCVID) contains 91,223 YouTube videos (4,232 hours) from 239 categories. It covers a wide range of concepts like activities, objects, scenes, sports, DIY, etc. Detailed descriptions of the benchmark can be found in~\cite{jiang2015exploiting}. Each video is manually labeled to one or more categories. In our experiments, we do not use the manual labels in training, but instead we automatically generate the web labels according to the concept name appearance in the video metadata. The manual labels are used only in testing to evaluate our and the baseline methods. Following~\cite{jiang2015exploiting}, the standard train/test split is used. The second set is YFCC100M \cite{thomee2015yfcc100m} which contains about 800,000 videos on Yahoo! Flickr with metadata such as the title, tags, the uploader, etc. There are no manual labels on this set and we automatically generate the curriculum from the metadata in a similar way. Since there are no annotations, we train the concept detectors on the most 101 frequent latent topics found in the metadata. There are totally 47,397 webly labeled videos on the 101 concepts for training. On FCVID, as the manual labels are available, the performance is evaluated in terms of the precision of the top 5 and 10 ranked videos (P@5 and P@10) and mean Average Precision (mAP) of 239 concepts. On YFCC100M, since there are no manual labels, for evaluation, we apply the detectors to a third public video collection called TRECVID MED which includes 32,000 Internet videos~\cite{over2014trecvid}. We apply the detectors trained on YFCC100M to the TRECVID videos and manually annotate the top 10 detected videos returned by each method for 101 concepts. \textbf{Implementation Details} We build our method on top of a pre-trained convolutional neural network as the low-level features (VGG network \cite{simonyan2014very}). We extract the key-frame level features and create a video feature by the average pooling. The same features are used across different methods on each dataset. The concept detectors are trained based on a hinge loss cost function. Algorithm~\ref{alg:overall} is used to train the concept models iteratively and the $\lambda$ stops increasing after 100 iterations. We automatically generate curriculum labels based on the video metadata, ASR, OCR and VGG net 1,000 classification results using latent topic modeling with word embedding matching as shown in Section 3, and derive a partial-order curriculum using the method discussed in Section 3.2.2. \textbf{Baselines} The proposed method is compared against the following five baseline methods which cover both the classical and the recent representative learning algorithms on webly-labeled data. \textit{BatchTrain} trains a single SVM model using all samples in the multi-modal curriculum built as described in section 3.2.2 LT+WE. \textit{Self-Paced Learning (SPL)} is a classical method where the curriculum is generated by the learner itself~\cite{kumar2010self}. \textit{BabyLearning} is a recent method that simulates baby learning by starting with few training samples and fine-tuning using more weakly labeled videos crawled from the search engine \cite{liang2015towards}. \textit{GoogleHNM} is a hard negative mining method proposed by Google \cite{varadarajan2015efficient}. It utilizes hard negative mining to train a second order mixture of experts model according to the video's YouTube topics. \textit{FastImage} \cite{han2015fast} is a video retrieval method that utilizes web images from search engine to match to the video with re-ranking. \textit{WELL} is the proposed method. The hyper-parameters of all methods including the baseline methods are tuned on the same validation set. On FCVID, the set is a standard development set with manual labels randomly selected from 10\% of the training set (No training was done using ground truth labels) whereas on YFCC100M it is also a 10\% proportion of noisy training set. \subsection{Experiments on FCVID} \textbf{Curriculum Comparison} As disscussed in Section 3.2.2, we compare different ways to build curriculum for noisy label learning. Here we also compare their effectiveness by training concept detectors directly using the curriculum labels. The batch train model is used for all generated cirriculumn labels. In Table \ref{exp-cur} we show the batch trained models' precision at 5, 10 and mean average precision on the test set of FCVID. For LT+WE (Multi-modal), we extract curriculum from different modalities as shown in Section 3.2.2, and combine them using linear weights. The weights are hyper-parameters that are tuned on the validation set, and the optimal weights for textual metadata, ASR, image classification and OCR results are 1.0, 0.5, 0.5 and 0.05, respectively. Results show that the curriculum generated by combining latent topic modeling and word embedding using multi-modal prior knowledge is the most accurate, which indicates our claim of exploiting multi-modal information is beneficial, and we use this method in WELL for the rest of the experiments. \begin{table}[] \centering \caption{Curriculum BatchTrain Comparison} \label{exp-cur} \begin{tabular}{|l||c|c|c|} \hline Method & P@5 & P@10 & mAP \\ \hline \hline ExactMatching & 0.730 & 0.713 & 0.419 \\ StemMatching & 0.782 & 0.763 & 0.469 \\ YouTubeTopicAPI & 0.587 & 0.563 & 0.315 \\ SearchEngine & 0.723 & 0.713 & 0.413 \\ WordEmbedding & 0.790 & 0.774 & 0.462 \\ LatentTopic & 0.731 & 0.716 & 0.409 \\ LT+WE & 0.804 & 0.795 & 0.473 \\ \textbf{LT+WE(Multi-modal)} & \textbf{0.838 } & \textbf{ 0.820 } & \textbf{ 0.486 } \\ \hline \end{tabular} \end{table} \textbf{Baseline Comparison} Table~\ref{exps-basline} compares the precision and mAP of different methods where the best results are highlighted. As we see, the proposed WELL significantly outperforms all baseline methods, with statistically significant difference at $p$-level of 0.05. Comparing WELL with SPL, the effect of curriculum learning and dropout makes a significant difference in terms of performance, which suggests the importance of prior knowledge and preventing over-fitting in webly learning. The promising experimental results substantiate the efficacy of the proposed method. \begin{table}[ht] \centering \footnotesize \caption{Baseline comparison on FCVID} \label{exps-basline} \begin{tabular}{|l||c|c|c|c|c|c|} \hline Method & P@5 & P@10 & mAP \\ \hline \hline BatchTrain & 0.838 & 0.820 & 0.486 \\ FastImage~\cite{han2015fast} &- &- & 0.284\\ SPL~\cite{kumar2011learning} & 0.793 & 0.754 & 0.414 \\ GoogleHNM~\cite{varadarajan2015efficient} & 0.781 & 0.757 & 0.472 \\ BabyLearning~\cite{liang2015towards} & 0.834 & 0.817 & 0.496 \\ \textbf{WELL} &\textbf{0.918}&\textbf{0.906} & \textbf{0.615} \\ \hline \end{tabular} \end{table} \textbf{Robustness to Noise Comparison} In this comparison we manually control the noisiness of the curriculum in order to systematically verify how our methods would perform with respect to the noisiness within the web data. The experimental results indicate the robustness of our method towards noisy labels. To this end, we randomly select video samples with ground truth labels for each concept, so that the precision of the curriculum labels are set at 20\%, 40\%, 60\%, 80\% and we fix the recall of all the labels. We then train WELL using such curriculum and test them on the FCVID testing set. We also compare WELL to three other methods with the same curriculum, among them \textit{GoogleHNM} is a recent method to train video concept detector with large-scale data. We exclude \textit{BabyLearning}, which relies on the returned results by the search engine, since in this experiment the curriculum is fixed . As shown in Table \ref{exp-noise}, as the noisiness of the curriculum grows (the precision drops), WELL maintains its performance while other methods drop significantly. Specifically, when the precision of the curriculum drops from 40\% to 20\%, other methods' mAP averagely drops 46.5\% while WELL's mAP only drops 19.1\% relatively. It shows that WELL is robust against different level of noise, which shows great potential in larger scale webly-labeled learning as the dataset gets bigger, the noisier it may become. \begin{figure}[!ht] \centering \includegraphics[width=1.0\linewidth,height=55mm]{well-noise} \caption{WELL performance with curriculum of different level of noisiness. p=k\% means the curriculum precision. The higher is k, the less noise is in the curriculum labels.} \label{well-noise} \end{figure} \begin{table}[ht] \centering \footnotesize \caption{WELL performance with curriculum of different level of noisiness. $p$ represents the precision of the curriculum. } \vspace{1mm} \label{exp-noise} \begin{tabular}{|l||c|c|c|c|} \hline & p=20\% & p=40\% & p=60\% & p=80\% \\ \hline \hline BatchTrain & 0.232 & 0.463 & 0.538 & 0.592 \\ SPL & 0.184 & 0.396 & 0.515 & 0.586 \\ GoogleHNM & 0.304 & 0.477 & 0.552 & 0.602 \\ \textbf{WELL} & \textbf{0.496} & \textbf{0.613} & \textbf{0.646} & \textbf{0.673} \\ \hline \end{tabular} \end{table} \begin{table}[ht] \centering \footnotesize \caption{WELL performance with curriculum of different level of noisiness. $p$ represents the precision of the curriculum. } \vspace{1mm} \label{exp-noise} \begin{tabular}{|l||c|c|c|c|} \hline & p=80\% & p=60\% & p=40\% & p=20\% \\ \hline \hline BatchTrain & 0.592& 0.538& 0.463& 0.232 \\ SPL & 0.586& 0.515& 0.396& 0.184 \\ GoogleHNM & 0.602& 0.552& 0.477& 0.304 \\ \textbf{WELL} & \textbf{0.673}& \textbf{0.646}& \textbf{0.613}& \textbf{0.496} \\ \hline \end{tabular} \end{table} \textbf{Ground-truth Training Comparison} In this part, we also compare our method with the state-of-the-art method trained using ground truth labels on FCVID (rDNN)~\cite{jiang2015exploiting}. We compare WELL trained using the static CNN features, the standard features provided by the authors~\cite{jiang2015exploiting}, and we also compare WELL using the late (average) fusion with CNN, motion and audio MFCC features (WELL-MM) to the method that achieves the best result on FCVID trained using the same multi-modal features. WELL-MM uses CNN, Motion and MFCC features, which is the same set of features as rDNN-F~\cite{jiang2015exploiting}. Noted that the state-of-the-art method uses the ground truth labels to train models, which includes 42,223 videos with manual labels, while our proposed method uses none of the human annotation into training but still be able to outperform one of the state-of-the-art results. \begin{table}[ht] \centering \footnotesize \caption{Ground-truth Training Comparison on FCVID. The methods with * are trained using human annotated labels. WELL-MM uses CNN, Motion and MFCC features, which is the same set of features as rDNN-F.} \vspace{1mm} \label{exps-sa} \begin{tabular}{|l||c|c|c|c|c|c|} \hline Method & P@5 & P@10 & mAP \\ \hline \hline WELL &\textbf{0.918}&\textbf{0.906} & \textbf{0.615} \\ Static CNN\cite{jiang2015exploiting}* &-&- & 0.638 \\ WELL-MM &\textbf{0.930}&\textbf{0.918} & \textbf{0.697} \\ rDNN-F\cite{jiang2015exploiting}* &-&- & 0.754 \\ \hline \end{tabular} \end{table} \textbf{Noisy Dataset Size Comparison} To investigate the potential of concept learning on webly-labeled video data, we apply the methods on different sizes of subsets of the data. Specifically, we randomly split the FCVID training set into several subsets of 200, 500, 1,000, and 2,000 hours of videos, and train the models on each subset without using manual annotations. The models are then tested on the same test set. Table~\ref{exps-small} lists the average results of each type of subsets. As we see, the accuracy of WELL on webly-labeled data increases along with the growth of the size of noisy data while other webly learning methods' performance tend to be saturated. Comparing to the methods trained using ground truth, In Table~\ref{exps-small}, WELL-MM trained using the whole dataset (2000h) outperforms rDNN-F(trained using manual labels) trained using around 1200h of data. And since the incremental performance increase of WELL-MM is close to linear, we conclude that with sufficient webly-labeled videos WELL-MM will be able to outperform the rDNN-F trained using 2000h of data, which is currently the largest manual labeled dataset. \vspace{-3mm} \begin{figure}[!ht] \centering \includegraphics[width=1.05\linewidth,height=70mm]{well-dataset} \vspace{-7mm} \caption{MAP comparison of models trained using web labels and ground-truth labels on different subsets of FCVID. The methods with * are trained using human annotated labels.} \label{well-dataset} \end{figure} \begin{table}[ht] \centering \footnotesize \caption{MAP comparison of models trained using web labels and ground-truth labels on different subsets of FCVID. The methods with * are trained using human annotated labels. Noted some of the numbers from \cite{jiang2015exploiting} are approximated from graphs.} \vspace{1mm} \label{exps-small} \setlength{\tabcolsep}{4pt} \renewcommand{\arraystretch}{1.1} \begin{tabular}{|l||c|c|c|c|} \hline Dataset Size & 200h & 500h & 1000h & 2000h \\ \hline BatchTrain & 0.364 & 0.422 & 0.452 & 0.486 \\ SPL~\cite{kumar2011learning} & 0.327 &0.379 &0.403 &0.414 \\ GoogleHNM~\cite{varadarajan2015efficient} & 0.361 & 0.421 &0.451 &0.472 \\ BabyLearning~\cite{liang2015towards} &0.390 & 0.447 & 0.481 & 0.496 \\ \textbf{WELL-MM} & \textbf{0.541} & \textbf{0.616} & \textbf{0.632} & \textbf{0.697} \\ \hline Static CNN\cite{jiang2015exploiting}* & 0.485 & 0.561 & 0.604 & 0.638 \\ rDNN-F\cite{jiang2015exploiting}* & 0.550 & 0.620 & 0.650 & 0.754\\ \hline \end{tabular} \end{table} \vspace{-3mm} \subsection{Experiments on YFCC100M} In the experiments on YFCC100M, we train 101 concept detectors on YFCC100M and test them on the TRECVID MED dataset which includes 32,000 Internet videos. Since there are no manual labels, to evaluate the performance, we manually annotate the top 10 videos in the test set and report their precisions in Table~\ref{exps-yfcc}. The MED evaluation is done by four annotators and the final results are averaged from all annotations. The Fleiss' Kappa value for these four annotators is 0.64. A similar pattern can be observed where the comparisons substantiate the rationality of the proposed webly learning framework. Besides, the promising results on the largest multimedia set YFCC100M verify the scalability of the proposed method. \vspace{-3mm} \begin{table}[ht] \centering \footnotesize \caption{Baseline comparison on YFCC100M} \label{exps-yfcc} \begin{tabular}{|l||c|c|c|c|c|c|} \hline Method & P@3 & P@5 & P@10\\ \hline \hline BatchTrain & 0.535 & 0.513 & 0.487 \\ SPL~\cite{kumar2011learning} &0.485 & 0.463 & 0.454\\ GoogleHNM~\cite{varadarajan2015efficient} &0.541 & 0.525 & 0.500 \\ BabyLearning~\cite{liang2015towards} &0.548 & 0.519 & 0.466 \\ \textbf{WELL} &\textbf{0.667} & \textbf{0.663} & \textbf{0.649}\\ \hline \end{tabular} \end{table} \begin{figure*} \centering \includegraphics[width=1.0\textwidth]{pick-all} \vspace{-7mm} \caption{WELL's example picks for different iterations} \vspace{-5mm} \label{well-pick-all} \end{figure*} \vspace{-4mm} \subsection{Time Complexity Comparison} The computation complexity of WELL is comparable to existing methods. For a single class, the complexity for our model and baseline models is $O(r \times n \times m)$, where $r$ is the number of iterations to converge, $n$ is the number of training samples and $m$ is the feature dimension. Theoretically, the complexity is comparable to the baseline models that have different $r$. In practice, on a 40 core-CPU machine, WELL and SPL takes 7 hours to converge (100 iterations) on FCVID with 239 concepts, whereas GoogleHNM and BabyLearning take around 5 hours. In Table \ref{time}, we show the theoretical and actual run time for all methods. \begin{table}[ht] \centering \caption{Runtime comparison across different methods. We report the time complexity on different method as well as their actual run time on FCVID (in hours).} \label{time} \begin{tabular}{|l||c|c|c|} \hline Method & Complexity & FCVID(h) \\ \hline \hline BatchTrain & $O(n \times m)$ & 2.0 \\ SPL & $O(r \times n \times m)$ & 7.0 \\ GoogleHNM & $O(r \times n \times m)$ & 5.0 \\ BabyLearning & $O(r \times n \times m)$ & 5.0 \\ WELL & $O(r \times n \times m)$ & 7.0\\ \hline \end{tabular} \end{table} \vspace{-3mm} \subsection{Qualitative Analysis} In this section we show training examples of WELL. In Figure~\ref{well-pick-all}, we demonstrate the positive samples that WELL select at different stage of training the concept "baseball", "forest", "birthday" and "cow". For the concept "baseball", at early stage (1/93, 25/93), WELL selects easier and clearer samples such as those camera directly pointing at the playground, while at later stage (75/93, 93/93) WELL starts to train with harder samples with different lighting conditions and untypical samples for the concept. For the concept "birthday", as we see, at later stage of the training, complex samples for birthday event like a video with two girl singing birthday song (75/84) and a video of celebrating birthday during hiking (84/84) are included in the training. For the concept "forest", at the final iteration (95/95), a video of a man playing nunchaku is included, as the video title contains "Air Forester Nunchaku Freestyle" and it is included in the curriculum, which is reasonable as the curriculum is noisy and may contain false positive. Since WELL is able to leave outliers in later stage of the training, the affection of the false positives in the curriculum can be alleviated by early stopping. In our experiments, we stop increasing $\lambda$ after 100 iterations so in the final model, only a subset of samples are used. \vspace{-2mm} \section{Conclusions} In this paper, we proposed a novel method called WELL for webly labeled video data learning. WELL extracts multi-modal informative knowledge from noisy weakly labeled video data from the web through a general framework with solid theoretical justifications. WELL achieves the best performance only using webly-labeled data on two major video datasets. The comprehensive experimental results demonstrate that WELL outperforms state-of-the-art studies by a statically significant margin on learning concepts from noisy web video data. In addition, the results also verify that WELL is robust to the level of noisiness in the video data. The result suggests that with more webly-labeled data, which is not hard to obtain, WELL can potentially outperform models trained on any existing manually-labeled data. \vspace{-3mm} \bibliographystyle{abbrv} \linespread{0.9} \scriptsize
{'timestamp': '2016-07-19T02:05:10', 'yymm': '1607', 'arxiv_id': '1607.04780', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04780'}
arxiv
\section{Introduction} \label{sec-intro} In this paper we study sublanguages of Plotkin's functional programming language ${\mathrm{PCF}}$, which we here take to be the simply typed $\lambda$-calculus over a single base type $\nat$, with constants \[ \begin{array}{rlcrl} \num{n} & : \nat \mbox{~~for each $n \in \mathbb{N}$} \;, & & {\mathit{suc}},{\mathit{pre}} & : \nat\rightarrow\nat \;, \\ {\mathit{ifzero}} & : \nat\rightarrow\nat\rightarrow\nat\rightarrow\nat \;, & & Y_\sigma & : (\sigma\rightarrow\sigma)\rightarrow\sigma \mbox{~~for each type $\sigma$} \;. \end{array} \] As usual, we will consider this language to be endowed with a certain (call-by-name) operational semantics, which in turn gives rise to a notion of \emph{observational equivalence} for ${\mathrm{PCF}}$ programs. We define the \emph{level} ${\mathrm{lv}}(\sigma)$ of a type $\sigma$ inductively by \[ {\mathrm{lv}}(\nat) ~=~ 0 \;, ~~~~~~ {\mathrm{lv}}(\sigma\rightarrow\tau) ~=~ \max\,({\mathrm{lv}}(\sigma)+1,{\mathrm{lv}}(\tau)) \;, \] and define the \emph{pure type} $\pure{k}$ of level $k \in \mathbb{N}$ by \[ \pure{0} ~=~ \nat \;, ~~~~~~ \pure{k+1} ~=~ \pure{k} \rightarrow \nat \;. \] Modifying the definition of ${\mathrm{PCF}}$ so that the constants $Y_\sigma$ are admitted only for types $\sigma$ of level $\leq k$, we obtain a sublanguage ${\mathrm{PCF}}_k$ for any $k \in \mathbb{N}$. Our main result will be that for each $k$, the expressive power of ${\mathrm{PCF}}_{k+1}$ strictly exceeds that of ${\mathrm{PCF}}_k$: in particular, there is no closed term of ${\mathrm{PCF}}_k$ that is observationally equivalent to $Y_{\pure{k+1}}$. (Fortunately, `observational equivalence' has the same meaning for all the languages in question here, as will be explained in Section~\ref{sec-background}.) This answers a question posed explicitly by Berger in \cite{Berger-min-recursion}, but present in the folklore at least since the early 1990s. It is worth remarking that the situation is quite different for various extensions of ${\mathrm{PCF}}$ considered in the literature, in which one may restrict to recursions at level~1 types without loss of expressivity (see Subsection~\ref{subsec-embed}). We can phrase our result more denotationally in terms of the type structure ${\mathsf{SF}}$ of \emph{(PCF-)sequential functionals} or its effective substructure ${\mathsf{SF}}^{\mbox{\scriptsize \rm eff}}$. As will be reviewed in Section~\ref{sec-background}, the latter may be conveniently characterized up to isomorphism as the closed term model for ${\mathrm{PCF}}$ modulo observational equivalence. Our result can therefore be understood as saying that more elements of ${\mathsf{SF}}^{\mbox{\scriptsize \rm eff}}$ (and hence of ${\mathsf{SF}}$) are denotable in ${\mathrm{PCF}}_{k+1}$ than in ${\mathrm{PCF}}_k$. From this we may easily infer that there is no finite `basis' $B \subseteq {\mathsf{SF}}^{\mbox{\scriptsize \rm eff}}$ relative to which all elements of ${\mathsf{SF}}^{\mbox{\scriptsize \rm eff}}$ are $\lambda$-definable (see Corollary~\ref{no-finite-basis-cor} below). The models ${\mathsf{SF}}$ and ${\mathsf{SF}}^{\mbox{\scriptsize \rm eff}}$ are \emph{extensional}: elements of type $\sigma \rightarrow \tau$ can be considered as mathematical functions mapping elements of type $\sigma$ to elements of type $\tau$. Whilst our theorem is naturally stated in terms of these extensional models, its proof will make deep use of a more intensional model which yields ${\mathsf{SF}}$ as its extensional quotient. This intensional model of PCF has been considered many times before in the literature, for instance as the \emph{${\mathrm{PCF}}$ B\"ohm tree} model of Amadio and Curien \cite{Amadio-Curien}, and it is known to be isomorphic to the game models of PCF given by Abramsky, Jagadeesan and Malacaria \cite{AJM} and by Hyland and Ong \cite{Hyland-Ong}. In this paper, we choose to work with the \emph{nested sequential procedure} (NSP) presentation of this model, as studied in detail in the recent book of Longley and Normann \cite{Longley-Normann}. (We will touch briefly on the possible use of other presentations for this purpose in Section~\ref{sec-further-work}.) We shall denote the NSP model by ${\mathsf{SP}}^0$; its construction will be reviewed in Section~\ref{sec-background}, but in the meantime, let us offer a high-level overview of our proof method without assuming detailed knowledge of this model. As a motivating example, fix $k \in \mathbb{N}$, and consider the ${\mathrm{PCF}}$ term \[ \Phi_{k+1} ~:~ (\nat \rightarrow \pure{k+1} \rightarrow \pure{k+1}) \rightarrow \nat \rightarrow \pure{k+1} \] given informally by \[ \Phi_{k+1}\;g\;n ~=~ g\;n\;(\Phi_{k+1}\;g\;(n+1)) ~=~ g\;n\;(g\;(n+1)\;(g\;(n+2)\;(g\;\cdots))) \;, \] or more formally by \[ \Phi_{k+1} ~=~ \lambda g n.\; Y_{\nat \rightarrow \pure{k+1}} \, (\lambda f m.\,g\,m\,(f(m+1)))\,n \;, \] where $f$ has type $\nat \rightarrow \pure{k+1}$. Clearly, $\Phi_{k+1}$ is a term of ${\mathrm{PCF}}_{k+1}$; however, we will be able to show that the element of ${\mathsf{SF}}$ that $\Phi_{k+1}$ defines is not denotable in ${\mathrm{PCF}}_k$. What is the essential feature of this function that puts it beyond the reach of ${\mathrm{PCF}}_k$? To get a hint of this, we may observe from the informal definition above that $\Phi_{k+1}$ seems implicitly to involve an infinite nested sequence of calls to its argument $g$, and indeed the NSP model makes this idea precise. Furthermore, each call to $g$ involves an argument of type level $k+1$ resulting from another such call. Broadly speaking, we shall refer to such a sequence of nested calls (subject to certain other conditions) as a \emph{$k\!+\!1$-spine} in the NSP associated with $\Phi_{k+1}$. As a second example, we can see from the natural recursive definition of $Y_{\pure{k+1}}$ itself that this too involves a spine of this kind: \[ Y_{\pure{k+1}} \; h ~=~ h(Y_{\pure{k+1}}\;h) ~=~ h(h(h(\cdots))) \;. \] where $h$ has type $\pure{k+1} \rightarrow \pure{k+1}$. In fact, we may view $Y_{\pure{k+1}}$ as a `special case' of $\Phi_{k+1}$, since $Y_{\pure{k+1}} \,h$ is observationally equivalent to $\Phi_{k+1} \,(\lambda n.h) \,\num{0}$. A suitable general definition of $k\!+\!1$-spine turns out to be quite delicate to formulate; but having done this, it will be possible to prove that no ${\mathrm{PCF}}_k$-denotable NSP contains a $k\!+\!1$-spine (Theorem~\ref{no-gremlin-thm}). This will be proved by induction on the generation of such NSPs: in essence, we have to show that none of the generating operations for the interpretations of ${\mathrm{PCF}}_k$ terms are capable of manufacturing spinal NSPs out of non-spinal ones. This already suffices to show that within the intensional model ${\mathsf{SP}}^0$, the evident procedure for $Y_{\pure{k+1}}$ is denotable in ${\mathrm{PCF}}_{k+1}$ but not in ${\mathrm{PCF}}_k$. However, this does not yet establish our main theorem, which concerns not ${\mathsf{SP}}^0$ but its extensional quotient ${\mathsf{SF}}$. For this purpose, we undertake a closer analysis of the function $\Phi_{k+1}$ defined above: we show that not only the NSP arising from the above definition, but any \emph{extensionally equivalent} NSP, must necessarily involve a $k\!+\!1$-spine. This shows that, within ${\mathsf{SF}}$ (or ${\mathsf{SF}}^{\mbox{\scriptsize \rm eff}}$), the functional given by $\Phi_{k+1}$ is not denotable in ${\mathrm{PCF}}_k$. This establishes Berger's conjecture that the languages ${\mathrm{PCF}}_k$ form a strict hierarchy. Since $\Phi_{k+1}$ is definable from $Y_{\nat \rightarrow \pure{k+1}}$, the above shows that the element $Y_{\nat \rightarrow \pure{k+1}} \in {\mathsf{SF}}$ is not ${\mathrm{PCF}}_k$-denotable. To complete the picture, however, we would also like to know that the simpler element $Y_{\pure{k+1}} \in {\mathsf{SF}}$ is not ${\mathrm{PCF}}_k$-denotable. We show this via a more refined version of the above analysis which is of some interest in its own right. Just as ${\mathrm{PCF}}$ is `stratified' into sublanguages ${\mathrm{PCF}}_k$, we show that each ${\mathrm{PCF}}_k$ may be further stratified into sublanguages ${\mathrm{PCF}}_{k,1}, {\mathrm{PCF}}_{k,2}, \ldots$ on the basis of the `width' of the types $\sigma$ for which $Y_\sigma$ is permitted (see Definition~\ref{width-def}). An easy adaptation of our earlier proofs then shows that, for any $l$, there are operators $Y_\sigma$ in ${\mathrm{PCF}}_{k,l+2}$ that are not denotable in ${\mathrm{PCF}}_{k,l}$ (the appearance of $l+2$ is admittedly a curiosity here). Since all these $Y_\sigma$ are themselves readily definable from $Y_{\pure{k+1}}$, it follows that $Y_{\pure{k+1}} \in {\mathsf{SF}}$ itself is not denotable in ${\mathrm{PCF}}_{k,l}$ for any $l$, and hence not in ${\mathrm{PCF}}_k$. This finer analysis illustrates the remarkable richness of structure that ${\mathsf{SF}}$ has to offer. The paper is organized as follows. In Section~\ref{sec-background} we recall the necessary technical background on ${\mathrm{PCF}}$ and on the models ${\mathsf{SP}}^0$ and ${\mathsf{SF}}$, fleshing out many of the ideas outlined above. In Section~\ref{sec-denotations} we obtain a convenient inductive characterization of the class of procedures denotable in (the `oracle' version of) ${\mathrm{PCF}}_k$, framed in terms of constructions on the procedures themselves. In Section~\ref{sec-Y-k+1} we introduce the central concept of a $k\!+\!1$-spinal procedure, and show using our inductive characterization that no ${\mathrm{PCF}}_k$-denotable procedure can be $k\!+\!1$-spinal (this is the most demanding part of the proof). As noted above, this already shows that ${\mathrm{PCF}}_{k+1}$ denotes more elements of ${\mathsf{SP}}^0$ than ${\mathrm{PCF}}_k$ does. In Section~\ref{sec-extensional} we obtain the corresponding result for ${\mathsf{SF}}$, showing that the element $\Phi_{k+1} \in {\mathsf{SF}}$, and hence $Y_{\nat \rightarrow \pure{k+1}} \in {\mathsf{SF}}$, is not ${\mathrm{PCF}}_k$-denotable. In Section~\ref{sec-pure-type} we adapt our methods to the more fine-grained hierarchy of languages ${\mathrm{PCF}}_{k,l}$ that takes account of the widths of types; this enables us to show also that $Y_{\pure{k+1}} \in {\mathsf{SF}}$ is not ${\mathrm{PCF}}_k$-denotable. We conclude in Section~\ref{sec-further-work} with a discussion of related and future work. The present paper is a revised, corrected and expanded version of a University of Edinburgh technical report from July 2015, the most significant changes being the addition of the material on the pure type $\pure{k+1}$ in Section~\ref{sec-pure-type}, and a simplified approach to characterizing a suitable substructure of ${\mathsf{SP}}^0$ in Section~\ref{sec-denotations}. I am grateful to Ulrich Berger, Mart\'{i}n Escard\'{o}, Dag Normann and Alex Simpson for valuable discussions and correspondence, and to Luke Ong and Colin Stirling for helping me to navigate the existing literature on $\lambda Y$ and recursion schemes (as discussed in Section~\ref{sec-further-work}). Many of the participants in the Domains XII workshop in Cork and the Galop XI workshop in Eindhoven also offered valuable comments; thanks in particular to Neil Jones for drawing his work to my attention. Finally, I thank the anonymous referees for their careful work on the paper and their valuable suggestions; these have resulted in significant improvements in both the overall architecture and the formal details. \section{Background} \label{sec-background} We here summarize the necessary definitions and technical background from \cite{Longley-Normann}, especially from Chapters~6 and 7. \subsection{The language ${\mathrm{PCF}}$} \label{subsec-PCF} In \cite{Scott-TCS}, Scott introduced the language LCF for computable functionals of simple type. This language is traditionally called ${\mathrm{PCF}}$ when equipped with a standalone operational semantics as in Plotkin \cite{LCF-considered}. We will work here with the same version of ${\mathrm{PCF}}$ as in \cite{Longley-Normann}, with the natural numbers as the only base type. Our types $\sigma$ are thus generated by \[ \sigma ~::=~ \nat ~\mid~ \sigma \rightarrow \sigma \;, \] and our terms will be those of the simply typed $\lambda$-calculus constructed from the constants \[ \begin{array}{rcll} \num{n} & : & \nat & \mbox{for each $n \in \mathbb{N}$} \;, \\ \mathit{suc},\;\mathit{pre} & : & \nat\rightarrow\nat \;, \\ \mathit{ifzero} & : & \nat\rightarrow\nat\rightarrow\nat\rightarrow\nat \;, \\ Y_\sigma & : & (\sigma\rightarrow\sigma) \rightarrow \sigma & \mbox{for each type $\sigma$} \;. \end{array} \] We often abbreviate the type $\sigma_0 \rightarrow\cdots\rightarrow \sigma_{r-1} \rightarrow \nat$ to $\sigma_0,\ldots,\sigma_{r-1} \rightarrow \mathbb{N}$ or just $\vec{\sigma} \rightarrow \nat$. As usual, we write $\Gamma \vdash M:\sigma$ to mean that $M$ is a well-typed term in the environment $\Gamma$ (where $\Gamma$ is a finite list of typed variables). Throughout the paper, we shall regard the type of a variable $x$ as intrinsic to $x$, and will often write $x^\sigma$ to indicate that $x$ carries the type $\sigma$. For each $k \in \mathbb{N}$, the sublanguage ${\mathrm{PCF}}_k$ is obtained by admitting the constants $Y_\sigma$ only for types $\sigma$ of level $\leq k$. We endow the class of closed ${\mathrm{PCF}}$ terms with the following small-step reduction rules: \[ \begin{array}{rclcrcl} (\lambda x.M)N & \rightsquigarrow & M[x \mapsto N] \;, & & \mathit{ifzero}\;\num{0} & \rightsquigarrow & \lambda xy.x \;, \\ \mathit{suc}\;\num{n} & \rightsquigarrow & \num{n+1} \;, & & \mathit{ifzero}\;\num{n+1} & \rightsquigarrow & \lambda xy.y \;, \\ \mathit{pre}\;\num{n+1} & \rightsquigarrow & \num{n} \;, & & Y_\sigma M & \rightsquigarrow & M(Y_\sigma M) \;. \\ \mathit{pre}\;\num{0} & \rightsquigarrow & \num{0} \;, \end{array} \] We furthermore allow these reductions to be applied in certain term contexts. Specifically, the relation $\rightsquigarrow$ is inductively generated by the rules above along with the clause: if $M \rightsquigarrow M'$ then $E[M] \rightsquigarrow E[M']$, where $E[-]$ is one of the contexts \[ [-]N \;, ~~~~~~~~ {\mathit{suc}}\,[-] \;, ~~~~~~~~ {\mathit{pre}}\,[-] \;, ~~~~~~~~ {\mathit{ifzero}}\,[-] \;. \] We write $\rightsquigarrow^*$ for the reflexive-transitive closure of $\rightsquigarrow$. If $Q$ is any closed ${\mathrm{PCF}}$ term of type $\nat$, it is easy to check that either $Q \rightsquigarrow^* \num{n}$ for some $n \in \mathbb{N}$ or the (unique) reduction path starting from $Q$ is infinite. This completes the definition of the languages ${\mathrm{PCF}}$ and ${\mathrm{PCF}}_k$. Whilst the language ${\mathrm{PCF}}_0$ is too weak for programming purposes (it cannot even define addition), it is not hard to show that even ${\mathrm{PCF}}_1$ is Turing-complete: that is, any partial computable function $\mathbb{N} \rightharpoonup \mathbb{N}$ is representable by a closed ${\mathrm{PCF}}_1$ term of type $\nat \rightarrow \nat$. We will also refer to the non-effective language ${\mathrm{PCF}}^\Omega$ (or \emph{oracle ${\mathrm{PCF}}$}) obtained by extending the definition of ${\mathrm{PCF}}$ with a constant $C_f: \nat\rightarrow\nat$ for every set-theoretic partial function $f : \mathbb{N} \rightharpoonup \mathbb{N}$, along with a reduction rule $C_f \num{n} \rightsquigarrow \num{m}$ for every $n,m$ such that $f(n)=m$. (In ${\mathrm{PCF}}^\Omega$, the evaluation of a closed term $Q:\nat$ may fail to reach a value $\num{n}$ either because it generates an infinite computation, or because it encounters a subterm $C_f(n)$ where $f(n)$ is undefined.) The languages ${\mathrm{PCF}}^\Omega_k$ are defined analogously. If $M,M'$ are closed ${\mathrm{PCF}}^\Omega$ terms of the same type $\sigma$, and ${\mathcal{L}}$ is one of our languages ${\mathrm{PCF}}_k$, ${\mathrm{PCF}}_k^\Omega$, ${\mathrm{PCF}}$, ${\mathrm{PCF}}^\Omega$, we say that $M,M'$ are \emph{observationally equivalent in ${\mathcal{L}}$}, and write $M \simeq_{\mathcal{L}} M'$, if for all closed program contexts $C[-^\sigma] : \nat$ of ${\mathcal{L}}$ and all $n \in \mathbb{N}$, we have \[ C[M] \rightsquigarrow^* \num{n} \mbox{~~iff~~} C[M'] \rightsquigarrow^* \num{n} \;. \] (It makes no difference to the relation $\simeq_{\mathcal{L}}$ whether we take $C[-]$ to range over single-hole or multi-hole contexts.) Fortunately, it is easy to show that all of the above languages give rise to exactly the same relation $\simeq_{\mathcal{L}}$. Indeed, it is immediate from the definition that if ${\mathcal{L}},{\mathcal{L}}'$ are two of our languages and ${\mathcal{L}} \supseteq {\mathcal{L}}'$, then $\simeq_{{\mathcal{L}}} \,\subseteq\, \simeq_{{\mathcal{L}}'}$; it therefore only remains to verify that $M \simeq_{{\mathrm{PCF}}_0} M'$ implies $M \simeq_{{\mathrm{PCF}}^\Omega} M'$. We may show this by a `syntactic continuity' argument, exploiting the idea that any of the constants $Y_\sigma$ or $C_f$ in ${\mathrm{PCF}}^\Omega$ can be `approximated' as closely as necessary by terms of ${\mathrm{PCF}}_0$. Specifically, let us write $\bot$ for the non-terminating program $Y_0(\lambda x^0.x) : \nat$ (a term of ${\mathrm{PCF}}_0$), and for any type $\sigma$ write $\bot_\sigma$ for the term of type $\sigma$ of the form $\lambda \vec{x}.\bot$. For any $j \in \mathbb{N}$, we may then define ${\mathrm{PCF}}_0$ terms \begin{eqnarray*} Y_\sigma^{(j)} & = & \lambda f^{\sigma\rightarrow\sigma}.\,f^j(\bot_\sigma) \;, \\ C_f^{(j)} & = & \lambda n.\,\mathit{case}~n~\mathit{of}~ (0 \Rightarrow \num{f(0)} \mid \cdots \mid j-1 \Rightarrow \num{f(j-1)}) \;, \end{eqnarray*} where we use some evident syntactic sugar in the definition of $C_f^{(j)}$. For any ${\mathrm{PCF}}^\Omega$ term $M$, let $M^{(j)}$ denote the `approximation' obtained from $M$ by replacing all occurrences of constants $Y_\sigma, C_f$ by $Y_\sigma^{(j)}, C_f^{(j)}$ respectively. It is then not hard to show that for closed $Q:\nat$, we have \[ Q \rightsquigarrow^* \num{n} \mbox{~~~iff~~~} \exists j.\; Q^{(j)} \rightsquigarrow^* \num{n} \;. \] From this it follows easily that if $C[-]$ is an observing context of ${\mathrm{PCF}}^\Omega$ that distinguishes $M,M'$, then some approximation $C^{(j)}[-]$ (a context of ${\mathrm{PCF}}_0$) also suffices to distinguish them. This establishes that $\simeq_{{\mathrm{PCF}}_0} \,\subseteq\; \simeq_{{\mathrm{PCF}}^\Omega}$. We may therefore write $\simeq$ for observational equivalence without ambiguity. In fact, an even more restricted class of observing contexts suffices for ascertaining observational equivalence of ${\mathrm{PCF}}^\Omega$ terms. The well-known \emph{(equational) context lemma}, due to Milner \cite{Milner-PCF}, states that $M \simeq M' : \sigma_0,\ldots,\sigma_{r-1} \rightarrow \nat$ iff $M,M'$ have the same behaviour in all \emph{applicative contexts} of ${\mathrm{PCF}}$---% that is, if for all closed ${\mathrm{PCF}}$ terms $N_0:\sigma_0,\ldots,N_{r-1}:\sigma_{r-1}$, we have \[ M N_0 \ldots N_{r-1} \rightsquigarrow^* n \mbox{~~iff~~} M' N_0 \ldots N_{r-1} \rightsquigarrow^* n \;. \] Furthermore, using the above idea of approximation, it is easy to see that we obtain exactly the same equivalence relation if we allow the $N_i$ here to range only over closed ${\mathrm{PCF}}_0$ terms---this gives us the notion of \emph{${\mathrm{PCF}}_0$ applicative equivalence}, which we shall denote by $\sim_{0}$. We have concentrated so far on giving a purely operational description of ${\mathrm{PCF}}$. We are now able to express the operational content of our main theorems as follows. As in Section~\ref{sec-intro}, we define the type $\pure{k}$ by $\pure{0} = \nat$, $\pure{k+1} = \pure{k} \rightarrow \nat$; we shall write $\pure{k}$ simply as $k$ where there is no risk of confusion. \begin{theorem} \label{operational-main-thm} For any $k \geq 1$, there are functionals definable in ${\mathrm{PCF}}_{k+1}$ but not in ${\mathrm{PCF}}^\Omega_k$. More specifically: (i) There is no closed term $M$ of ${\mathrm{PCF}}^\Omega_k$ such that $M \simeq Y_{\nat \rightarrow (k+1)}$ (or equivalently $M \sim_{0} Y_{\nat \rightarrow (k+1)}$). (ii) There is even no closed $M$ of ${\mathrm{PCF}}^\Omega_k$ such that $M \simeq Y_{k+1}$. \end{theorem} We shall obtain part~(i) of this theorem at the end of Section~\ref{sec-extensional}, then in Section~\ref{sec-pure-type} resort to a more indirect method to obtain the stronger statement (ii). The theorem also holds when $k=0$, but this rather uninteresting case does not require the methods of this paper; it will be dealt with in Subsection~\ref{subsec-power-pcf1}. Theorem~\ref{operational-main-thm} can be construed as saying that in a suitably pure fragment of a functional language such as Haskell, the computational strength of recursive function definitions increases strictly as the admissible type level for such recursions is increased. The point of the formulation in terms of $\sim_{0}$ is to present our result in as manifestly strong a form as possible: there is no $M \in {\mathrm{PCF}}_k$ that induces the same partial function as $Y_{k+1}$ even on closed ${\mathrm{PCF}}_0$ terms. A more denotational formulation of our theorem can be given in terms of the model ${\mathsf{SF}}$ of \emph{sequential functionals}, which we here define as the type structure of closed ${\mathrm{PCF}}^\Omega$ terms modulo observational equivalence. Specifically, for each type $\sigma$, let ${\mathsf{SF}}(\sigma)$ denote the set of closed ${\mathrm{PCF}}^\Omega$ terms $M:\sigma$ modulo $\simeq$. It is easy to check that application of ${\mathrm{PCF}}^\Omega$ terms induces a well-defined function $\cdot : {\mathsf{SF}}(\sigma\rightarrow\tau) \times {\mathsf{SF}}(\sigma) \rightarrow {\mathsf{SF}}(\tau)$ for any $\sigma,\tau$; the structure ${\mathsf{SF}}$ then consists of the sets ${\mathsf{SF}}(\sigma)$ along with these application operations. Using the context lemma, it is easy to see that ${\mathsf{SF}}(\nat) \cong \mathbb{N}_\bot = \mathbb{N} \sqcup \{ \bot \}$, and also that ${\mathsf{SF}}$ is \emph{extensional}: if $f,f' \in {\mathsf{SF}}(\sigma\rightarrow\tau)$ satisfy $f \cdot x = f' \cdot x$ for all $x \in {\mathsf{SF}}(\sigma)$, then $f = f'$. Thus, up to isomorphism, each ${\mathsf{SF}}(\sigma\rightarrow\tau)$ may be considered simply as a certain set of functions from ${\mathsf{SF}}(\sigma)$ to ${\mathsf{SF}}(\tau)$. Any closed ${\mathrm{PCF}}^\Omega$ term $M:\sigma$ naturally has a denotation $\sem{M}^{\mathsf{SF}}$ in ${\mathsf{SF}}(\sigma)$, namely its own equivalence class. We may therefore restate Theorem~\ref{operational-main-thm} as: \begin{theorem} \label{SF-main-thm} Suppose $k \geq 1$. (i) The element $\sem{Y_{\nat\rightarrow(k+1)}}^{\mathsf{SF}}$ is not denotable in ${\mathrm{PCF}}^\Omega_k$. (ii) Even $\sem{Y_{k+1}}^{\mathsf{SF}}$ is not ${\mathrm{PCF}}^\Omega_k$-denotable. \end{theorem} It follows immediately that in any other adequate, compositional model of ${\mathrm{PCF}}^\Omega$ (such as Scott's continuous model or Berry's stable model), the element $\sem{Y_{k+1}}$ is not ${\mathrm{PCF}}^\Omega_k$-denotable, since the equivalence relation on ${\mathrm{PCF}}^\Omega$ terms induced by such a model must be contained within $\simeq$. By taking closed terms of ${\mathrm{PCF}}$ rather than ${\mathrm{PCF}}^\Omega$ modulo observational equivalence, we obtain the type structure ${\mathsf{SF}}^{\mbox{\scriptsize \rm eff}}$ of \emph{effective sequential functionals}, which can clearly be seen as a substructure of ${\mathsf{SF}}$. Although the above constructions of ${\mathsf{SF}}$ and ${\mathsf{SF}}^{\mbox{\scriptsize \rm eff}}$ are syntactic, there are other more mathematical constructions (for instance, involving game models \cite{AJM,Hyland-Ong}) that also give rise to these structures, and experience suggests that these are mathematically natural classes of higher-order functionals. We now see that Theorem~\ref{SF-main-thm}(i) implies an interesting absolute property of ${\mathsf{SF}}^{\mbox{\scriptsize \rm eff}}$, not dependent on any choice of presentation for this structure or any selection of language primitives: \begin{corollary}[No finite basis] \label{no-finite-basis-cor} There is no finite set $B$ of elements of ${\mathsf{SF}}^{\mbox{\scriptsize \rm eff}}$ such that all elements of ${\mathsf{SF}}^{\mbox{\scriptsize \rm eff}}$ are $\lambda$-definable relative to $B$. In other words, the cartesian category of ${\mathrm{PCF}}$-computable functionals is not finitely generated. \end{corollary} \begin{proof} Suppose $B = \{ b_0, \ldots, b_{n-1} \}$ were such a set. For each $i$, take a closed ${\mathrm{PCF}}$ term $M_i$ denoting $b_i$. Then the terms $M_0,\ldots,M_{n-1}$ between them contain only finitely many occurrences of constants $Y_\sigma$, so these constants are all present in ${\mathrm{PCF}}_k$ for large enough $k$. But this means that $b_0,\ldots,b_{n-1}$, and hence all elements of ${\mathsf{SF}}^{\mbox{\scriptsize \rm eff}}$, are ${\mathrm{PCF}}_k$-denotable, contradicting Theorem~\ref{SF-main-thm}(i). $\Box$ \end{proof} \subsection{The model ${\mathsf{SP}}^0$} \label{sec-SP0} We turn next to an overview of the \emph{nested sequential procedure} (or NSP) model, denoted by ${\mathsf{SP}}^0$. Further details and motivating examples are given in \cite{Longley-Normann}. In some respects, however, our presentation here will be more formal than that of \cite{Longley-Normann}: in particular, our discussion of bound variables and $\alpha$-conversion issues will be somewhat more detailed, in order to provide a solid foundation for the delicate syntactic arguments that follow. The ideas behind this model have a complex history. The general idea of sequential computation via nested oracle calls was the driving force behind Kleene's later papers (e.g.\ \cite{Kleene-revisited-IV}), although the concept did not receive a particularly transparent or definitive formulation there. Many of the essential ideas of NSPs can be found in early work of Sazonov \cite{Sazonov-early}, in which a notion of \emph{Turing machine with oracles} was used to characterize the `sequentially computable' elements of the Scott model. NSPs as we study them here were first explicitly introduced in work on game semantics for ${\mathrm{PCF}}$-- both by Abramsky, Jagadeesan and Malacaria \cite{AJM} (under the name of \emph{evaluation trees}) and by Hyland and Ong \cite{Hyland-Ong} (under the name of \emph{canonical forms}). In these papers, NSPs played only an ancillary role; however, it was shown by Amadio and Curien \cite{Amadio-Curien} how (under the name of \emph{${\mathrm{PCF}}$ B\"ohm trees}) they could be made into a model of ${\mathrm{PCF}}$ in their own right. Similar ideas were employed again by Sazonov \cite{Sazonov-PCF} to give a standalone characterization of the class of sequentially computable functionals. More recently, Normann and Sazonov \cite{Normann-Sazonov} gave an explicit construction of the NSP model in a somewhat more semantic spirit than \cite{Amadio-Curien}, using the name \emph{sequential procedures}. As in \cite{Longley-Normann}, we here add the epithet `nested' to emphasize the contrast with other flavours of sequential computation.% \footnote{A major theme of \cite{Longley-Normann} is that NSPs serve equally well to capture the essence of PCF computation and that of Kleene's S1--S9 computability; this is one reason for preferring a name that is not biased towards PCF.} As in \cite{Longley-Normann}, our NSPs are generated by means of the following infinitary grammar, interpreted coinductively. Here $\bot$ is a special atomic symbol and $n$ ranges over natural numbers. \begin{eqnarray*} \mbox{\it Procedures:}~~~~ p,q & ::= & \lambda x_0 \cdots x_{r-1}.\,e \\ \mbox{\it Expressions:}~~~~ d,e & ::= & \bot ~\mid~ n ~\mid~ {\mathtt{case}}~a~\,{\mathtt{of}}~ (i \Rightarrow e_i \mid i \in \mathbb{N}) \\ \mbox{\it Applications:}~~~~~~~ a & ::= & x\, q_0 \cdots q_{r-1} \end{eqnarray*} Here we write $(i \Rightarrow e_i \mid i \in \mathbb{N})$ to indicate an infinite sequence of `branches': $(0 \Rightarrow e_0 \mid 1 \Rightarrow e_1 \mid 2 \Rightarrow e_2 \mid \cdots)$. We will use vector notation to denote finite (possibly empty) lists of variables or procedures: $\vec{x}$, $\vec{q}$. Our convention will be that a list $\vec{x}$ must be non-repetitive, though a list $\vec{q}$ need not be. We may use $t$ to range over \emph{NSP terms} of any of the above three kinds; note that a `term' is formally a (possibly infinite) syntax tree as generated by the above grammar. A procedure $\lambda \vec{x}.\bot$ will often be abbreviated to $\bot$. For the most part, we will be working with terms modulo (infinitary) $\alpha$-equivalence, and most of the concepts we introduce will be stable under renamings of bound variables. Thus, a statement $t=t'$, appearing without qualification, will mean that $t,t'$ are $\alpha$-equivalent (although we will sometimes write $=$ as $=_\alpha$ if we wish to emphasize this). When we wish to work with terms on the nose rather than up to $=_\alpha$, we shall refer to them as \emph{concrete terms}. If each variable is assigned a simple type over $\nat$, then we may restrict our attention to \emph{well-typed}\index{well-typed} terms. Informally, a term will be well-typed unless a typing violation occurs at some particular point within its syntax tree. Specifically, within any term $t$, occurrences of procedures $\lambda \vec{x}.e$ (of any type), applications $x \vec{q}$ (of the ground type $\nat$) and expressions $e$ (of ground type) have types that are related to the types of their constituents and of variables as usual in type $\lambda$-calculus extended by ${\mathtt{case}}$ expressions of type $\nat$. We omit the formal definition here since everything works in the expected way; for a more precise formulation see \cite[Section~6.1.1]{Longley-Normann}. If $\Gamma$ is any environment (i.e.\ a finite non-repetitive list of variables), we write $\Gamma \vdash e$ and $\Gamma \vdash a$ to mean that $e,a$ respectively are well-typed with free variables in $\Gamma$. We also write $\Gamma \vdash p:\tau$ when $p$ is well-typed in $\Gamma$ and of type $\tau$. We shall often refer to variable environments that arise from combining several lists of variables, which may be represented by different notations, e.g.\ $\Gamma,V,\vec{x}$. Since such environments are required to be non-repetitive, we take it to be part of the content of a typing judgement such as $\Gamma,V,\vec{x} \vdash t \,(:\tau)$ that the entire list $\Gamma,V,\vec{x}$ is non-repetitive. However, the \emph{order} of variables within an environment will typically be of much less concern to us (clearly our typing judgements $\Gamma \vdash T \,(:\tau)$ are robust under permutations of $\Gamma$), and we will sometimes abuse notation by identifying a finite \emph{set} $Z$ of variables with the list obtained from some arbitrary ordering of it. It will also be convenient to place another condition on concrete well-typed terms (not imposed in \cite{Longley-Normann}) in order to exclude \emph{variable hiding}. Specifically, we shall insist that if $\Gamma \vdash t \,(:\tau)$ then no variable of $\Gamma$ appears as a bound variable within $t$, nor are there any \emph{nested} bindings within $t$ of the same variable $x$. (Clearly any concrete term not satisfying this restriction is $\alpha$-equivalent to one that does.) This will help to avoid confusion in the course of some delicate arguments in which questions of the identity of variables are crucial. With these ideas in place, we may take ${\mathsf{SP}}(\sigma)$ to be the set of well-typed procedures of type $\sigma$ modulo $=_\alpha$, and ${\mathsf{SP}}^0(\sigma) \subseteq {\mathsf{SP}}(\sigma)$ the subset constituted by the \emph{closed} procedures (i.e.\ those that are well-typed in the empty environment). By inspection of the grammar for procedures, it is easy to see that ${\mathsf{SP}}^0(\nat) \cong \mathbb{N}_\bot$. As in \cite{Longley-Normann}, we shall need to work not only with NSPs themselves, but with a more general calculus of NSP \emph{meta-terms} designed to accommodate the intermediate forms that arise in the course of computations: \begin{eqnarray*} \mbox{\it Meta-procedures:} ~~~~ P,Q & ::= & \lambda \vec{x}.\,E \\ \mbox{\it Meta-expressions:} ~~~~ D,E & ::= & \bot ~\mid~ n ~\mid~ \caseof{G}{i \Rightarrow E_i \mid i \in \mathbb{N}} \\ \mbox{\it Ground meta-terms:} ~~~~~~~~ G & ::= & E ~\mid~ x\, \vec{Q} ~\mid~ P \vec{Q} \end{eqnarray*} Here again, $\vec{x}$ and $\vec{Q}$ denote finite lists. We shall use $T$ to range over meta-terms of any of the above three kinds; once again, a meta-term is formally a syntax tree as generated by the above grammar. (Unless otherwise stated, we use uppercase letters for general meta-terms and lowercase ones for terms.) Once again, we will normally work with meta-terms up to (infinitary) $\alpha$-equivalence, but may also work with concrete meta-terms when required. The reader is warned of an ambiguity arising from the above grammar: a surface form $\lambda.E$ may be parsed either as a meta-procedure $\lambda \vec{x}.E$ with $\vec{x}$ empty, or as a ground meta-term $(\lambda \vec{x}.E)\vec{Q}$ with both $\vec{x},\vec{Q}$ empty. Formally these are two quite distinct meta-terms, bearing in mind that meta-terms are officially syntax trees. To remedy this ambiguity, we shall therefore in practice write `$()$' to indicate the presence of an empty argument list $\vec{Q}$ to a meta-procedure $P$, so that the ground meta-term above will be written as $(\lambda.E)()$. In the absence of `$()$', a surface form $\lambda.E$ should always be interpreted as a meta-procedure. Meta-terms are subject to the expected typing discipline, leading to typing judgements $\Gamma \vdash P:\sigma$, $\Gamma \vdash E$, $\Gamma \vdash G$ for meta-procedures, meta-expressions and ground meta-terms respectively. Again we omit the details: see \cite[Section~6.1.1]{Longley-Normann}. We shall furthermore require that well-typed concrete meta-terms are subject to the no-variable-hiding condition. We will sometimes write e.g.\ $\Gamma \vdash P$ to mean that $P$ is a well-typed meta-procedure in environment $\Gamma$, if the type itself is of no particular concern to us. There is an evident notion of simultaneous capture-avoiding \emph{substitution} $T[\vec{x}\mapsto\vec{Q}]$ for well-typed concrete terms. Specifically, given $\Gamma,\vec{x} \vdash T \,(:\tau)$ and $\Gamma,\vec{y} \vdash Q_i : \sigma_i$ for each $i<r$, where $\vec{x} = x_0^{\sigma_0},\ldots,x_{r-1}^{\sigma_{r-1}}$, we will have $\Gamma,\vec{y} \vdash T[\vec{x}\mapsto\vec{Q}] \,(:\tau)$. Note that this may entail renaming of bound variables both within $T$ (in order to avoid capture of variables in $\vec{y}$) and in the $Q_i$ (in order to maintain the no-hiding condition for variables bound within $T$). The details of how this renaming is performed will not matter, provided that for each $T,\vec{x},\vec{Q}$ as above we have a determinate choice of a suitable concrete term $T[\vec{x}\mapsto\vec{Q}]$, so that multiple appearances of the same substitution will always yield the same result. We also note that substitution is clearly well-defined on $\alpha$-equivalence classes. Finally, we will say a substitution $[\vec{x}\mapsto\vec{Q}]$ \emph{covers} a set $V$ of variables if $V$ consists of precisely the variables $\vec{x}$. As a mild extension of the concept of meta-term, we have an evident notion of a \emph{meta-term context} $C[-]$: essentially a meta-term containing a `hole' $-$, which may be of meta-procedure, meta-expression or ground meta-term type (and in the case of meta-procedures, will carry some type $\sigma$). Our convention here is that a meta-term context $C[-]$ is permitted to contain only a single occurrence of the hole $-$. Multi-hole contexts $C[-_0,-_1,\ldots]$ will occasionally be used, but again, each hole $-_i$ may appear only once. By the \emph{local variable environment} associated with a concrete meta-term context $\Gamma \vdash C[-]$, we shall mean the set $X$ of variables $x$ bound within $C[-]$ whose scope includes the hole, so that the environment in force at the hole is $\Gamma,X$. (The no-variable-hiding convention ensures that $X$ and indeed $\Gamma,X$ is non-repetitive.) Although in principle local variable environments pertain to particular choices of concrete contexts, most of the concepts that we define using such environments will be easily seen to be invariant under renamings of bound variables. Next, there is a concept of \emph{evaluation} whereby any concrete meta-term $\Gamma \vdash T\, (:\sigma)$ evaluates to an ordinary concrete term $\Gamma \vdash\, \dang{\!T\!} (:\sigma)$. To define this, the first step is to introduce a \emph{basic reduction}\index{basic reduction} relation $\rightsquigarrow_b$ for concrete ground meta-terms, which we do by the following rules: \begin{description} \item[(b1)] \( (\lambda \vec{x}.E) \vec{Q} \rightsquigarrow_b E [\myvec{x} \mapsto \myvec{Q}] ~~~\) (\emph{$\beta$-rule}). \item[(b2)] \( \caseof{\bot}{i \Rightarrow E_i} \rightsquigarrow_b \bot \). \item[(b3)] \( \caseof{n}{i \Rightarrow E_i} \rightsquigarrow_b E_n \). \item[(b4)] \( \caseof{(\caseof{G}{i \Rightarrow E_i})}{j \Rightarrow F_j} \rightsquigarrow_b \) \\ \( \mbox{~~~~~~~~~} \caseof{G}{i \Rightarrow \caseof{E_i}{j \Rightarrow \!F_j}} \). \end{description} Note that the $\beta$-rule applies even when $\vec{x}$ is empty: thus, $(\lambda.2)() \rightsquigarrow_b 2$. From this, a \emph{head reduction} relation $\rightsquigarrow_h$ on concrete meta-terms is defined inductively: \begin{description} \item[(h1)] If $G \rightsquigarrow_b G'$ then $G \rightsquigarrow_h G'$. \item[(h2)] If $G \rightsquigarrow_h G'$ and $G$ is not a ${\mathtt{case}}$ meta-term, then \[ \caseof{G}{i \Rightarrow E_i} ~\rightsquigarrow_h~ \caseof{G'}{i \Rightarrow E_i} \;. \] \item[(h3)] If $E \rightsquigarrow_h E'$ then $\lambda \myvec{x}.E ~\rightsquigarrow_h~ \lambda \myvec{x}.E'$. \end{description} Clearly, for any meta-term $T$, there is at most one $T'$ with $T \rightsquigarrow_h T'$. We call a meta-term a \emph{head normal form} if it cannot be further reduced using $\rightsquigarrow_h$. The possible shapes of head normal forms are $\bot$, $n$, $\caseof{y \vec{Q}}{i \Rightarrow E_i}$ and $y \vec{Q}$, the first three optionally prefixed by $\lambda \myvec{x}$ (where $\vec{x}$ may contain $y$). We now define the \emph{general reduction} relation $\rightsquigarrow$ inductively as follows: \begin{description} \item[(g1)] If $T \rightsquigarrow_h T'$ then $T \rightsquigarrow T'$. \item[(g2)] If $E \rightsquigarrow E'$ then $\lambda \myvec{x}.E ~\rightsquigarrow~ \lambda \myvec{x}.E'$. \item[(g3)] If $Q_j = Q'_j$ except at $j=k$ where $Q_k \rightsquigarrow Q'_k$, then \begin{eqnarray*} x \vec{Q} & \rightsquigarrow & x \vec{Q}\,' \;, \\ \caseof{x\, \vec{Q}}{i \Rightarrow E_i} & \rightsquigarrow & \caseof{x\, \vec{Q}\,'}{i \Rightarrow E_i} \;. \end{eqnarray*} \item[(g4)] If $E_i = E'_i$ except at $i=k$ where $E_k \rightsquigarrow E'_k$, then \[ \caseof{x\, \vec{Q}}{i \Rightarrow E_i} ~\rightsquigarrow~ \caseof{x\, \vec{Q}}{i \Rightarrow E'_i} \;. \] \end{description} It is easy to check that this reduction system is sound with respect to the typing rules. We emphasize that the relation $\rightsquigarrow$ is defined on concrete meta-terms, although it is clear that it also gives rise to a well-defined reduction relation on their $\alpha$-classes. An important point to note is that modulo the obvious inclusion of terms into meta-terms, terms are precisely meta-terms in \emph{normal form}, i.e.\ those that cannot be reduced using $\rightsquigarrow$. (For example, the meta-procedure $\lambda.2$ is in normal form, though the ground meta-term $(\lambda.2)()$ is not.) We write $\rightsquigarrow^*$ for the reflexive-transitive closure of $\rightsquigarrow$. The above reduction system captures the finitary aspects of evaluation. In general, however, since terms and meta-terms may be infinitely deep, evaluation must be seen as an infinite process. To account for this infinitary aspect, we use some familiar domain-theoretic ideas. We write $\sqsubseteq$ for the evident syntactic orderings on concrete meta-procedures and on ground meta-terms: thus, $T \sqsubseteq U$ iff $T$ may be obtained from $U$ by replacing zero or more ground subterms (perhaps infinitely many) by $\bot$. It is easy to see that for each $\sigma$, the set of all concrete procedure terms of type $\sigma$ forms a directed-complete partial order under $\sqsubseteq$. By a \emph{finite} (concrete) term $t$, we shall mean one generated by the following grammar, this time construed inductively: \begin{eqnarray*} \mbox{\it Procedures:}~~~~ p,q & ::= & \lambda x_0 \ldots x_{r-1}.\,e \\ \mbox{\it Expressions:}~~~~ d,e & ::= & \bot ~\mid~ n ~\mid~ {\mathtt{case}}~a~\,{\mathtt{of}}~ (0 \Rightarrow e_0 \mid \cdots \mid r-1 \Rightarrow e_{r-1}) \\ \mbox{\it Applications:}~~~~~~~ a & ::= & x\, q_0 \ldots q_{r-1} \end{eqnarray*} We regard finite terms as ordinary NSP terms by identifying the conditional branching $(0 \Rightarrow e_0 \mid \cdots \mid r-1 \Rightarrow e_{r-1})$ with \[ (0 \Rightarrow e_0 \mid \cdots \mid r-1 \Rightarrow e_{r-1} \mid r \Rightarrow \bot \mid r+1 \Rightarrow \bot \mid \cdots) \;. \] We may now explain how a general meta-term $T$ \emph{evaluates} to a term $\dang{\!T\!}$. This will in general be an infinite process, but we can capture the value of $T$ as the limit of the finite portions that become visible at finite stages in the reduction. To this end, for any concrete meta-term $T$ we define \[ \Downarrow_{\mbox{\scriptsize \rm fin}} T ~=~ \{ t \mbox{~finite~} \mid \exists T'.\; T \rightsquigarrow^* T' ~\wedge~ t \sqsubseteq T' \} \;. \] It is not hard to check that for any meta-term $T$, the set $\Downarrow_{\mbox{\scriptsize \rm fin}} T$ is directed with respect to $\sqsubseteq$ (see \cite[Proposition~6.1.2]{Longley-Normann}). We may therefore define $\dang{\!T\!}$, the \emph{value} of $T$, to be the ordinary concrete term \[ \dang{\!T\!} ~=~ \bigsqcup \,(\Downarrow_{\mbox{\scriptsize \rm fin}} T) \;. \] Note in passing that the value $\dang{\!G\!}$ of a ground meta-term $G$ may be either an expression or an application. In either case, it is certainly a ground meta-term. It is also easy to see that $\dang{\lambda \myvec{x}.E} \,=\, \lambda \myvec{x}.\dang{\!E\!}$, and that if $T \rightsquigarrow^* T'$ then $\dang{\!T\!} \,=\, \dang{\!T'\!}$. Whilst we have defined our evaluation operation $\dang{\!-\!}$ for concrete meta-terms, it is clear that this induces a well-defined evaluation operation on their $\alpha$-classes, and for the most part this is all that we shall need. We also note that the syntactic ordering $\sqsubseteq$ on concrete terms induces a partial order $\sqsubseteq$ on their $\alpha$-classes, and that each ${\mathsf{SP}}(\sigma)$ and ${\mathsf{SP}}^0(\sigma)$ is directed-complete with respect to this ordering. In the present paper, an important role will be played by the tracking of variable occurrences (and sometimes other subterms) through the course of evaluation. By inspection of the above rules for $\rightsquigarrow$, it is easy to see that if $T \rightsquigarrow T'$, then for any occurrence of a (free or bound) variable $x$ within $T'$, we can identify a unique occurrence of $x$ within $T$ from which it originates (we suppress the formal definition). The same therefore applies whenever $T \rightsquigarrow^* T'$. In this situation, we may say that the occurrence of $x$ within $T'$ is a \emph{residual} of the one within $T$, or that the latter is the \emph{origin} of the former. Note, however, that these relations are relative to a particular reduction path $T \rightsquigarrow^* T'$: there may be other paths from $T$ to $T'$ for which the origin-residual relation is different. Likewise, for any occurrence of $x$ within $\dang{\!T\!}$, we may pick some finite $t \sqsubseteq \dang{\!T\!}$ containing this occurrence, and some $T' \sqsupseteq t$ with $T \rightsquigarrow^* T'$; this allows us to identify a unique occurrence of $x$ within $T$ that originates the given occurrence in $\dang{\!T\!}$. It is routine to check that this occurrence in $T$ will be independent of the choice of $t$ and $T'$ and of the chosen reduction path $T \rightsquigarrow^* T'$; we therefore have a robust origin-residual relationship between variable occurrences in $T$ and those in $\dang{\!T\!}$. A fundamental result for NSPs is the \emph{evaluation theorem}, which says that the result of evaluating a meta-term is unaffected if we choose to evaluate certain subterms `in advance': \begin{theorem}[Evaluation theorem] \label{eval-thm} If $C[-_0,-_1,\ldots]$ is any meta-term context with countably many holes and $C[T_0,T_1,\ldots]$ is well-formed, then \[ \dang{C[T_0,T_1,\ldots]} ~=~ \dang{C[\dang{\!T_0\!},\dang{\!T_1\!},\ldots]}. \] \end{theorem} The proof of this is logically elementary but administratively complex: see \cite[Section~6.1.2]{Longley-Normann}. One further piece of machinery will be useful: the notion of \emph{hereditary $\eta$-expansion}, which enables us to convert a variable $x$ into a procedure term (written $x^\eta$). Using this, the restriction that variables may appear only at the head of applications can be seen to be inessential: e.g.\ the `illegal term' $f x$ may be replaced by the legal term $f x^\eta$. The definition of $x^\eta$ is by recursion on the type of $x$: if $x:\sigma_0,\ldots,\sigma_{r-1} \rightarrow \nat$, then \[ x^\eta ~=~ \lambda z_0^{\sigma_0} \ldots z_{r-1}^{\sigma_{r-1}} . \; \caseof{x z_0^\eta \ldots z_{r-1}^\eta}{i \Rightarrow i} \;. \] In particular, if $x:\nat$ then $x^\eta = \lambda.\,\caseof{x}{i \Rightarrow i}$. The following useful properties of $\eta$-expansion are proved in \cite[Lemma~6.1.14]{Longley-Normann}: \begin{lemma} \label{eta-properties} $\dang{x^\eta \vec{q}} \;=\, \caseof{x \vec{q}}{i \Rightarrow i}$, and $\dang{\lambda \vec{y}.\,p \vec{y}\,^\eta} \;=\, p$. \end{lemma} The sets ${\mathsf{SP}}(\sigma)$ may now be made into a total applicative structure ${\mathsf{SP}}$ by defining \[ (\lambda x_0 \cdots x_r.e) \cdot q ~=~ \lambda x_1 \cdots x_r.\dang{e[x_0 \mapsto q]} \;. \] Clearly the sets ${\mathsf{SP}}^0(\sigma)$ are closed under this application operation, so we also obtain an applicative substructure ${\mathsf{SP}}^0$ of ${\mathsf{SP}}$. It is easy to check that application in ${\mathsf{SP}}$ is monotone and continuous with respect to $\sqsubseteq$. It is also shown in \cite[Section~6.1.3]{Longley-Normann} that both ${\mathsf{SP}}$ and ${\mathsf{SP}}^0$ are typed \emph{$\lambda$-algebras}: that is, they admit a compositional interpretation of typed $\lambda$-terms that validates $\beta$-equality. (The relevant interpretation of pure $\lambda$-terms is in fact given by three of the clauses from the interpretation of ${\mathrm{PCF}}^\Omega$ as defined in Subsection~\ref{subsec-interp} below.) \subsection{Interpretation of ${\mathrm{PCF}}$ in ${\mathsf{SP}}^0$} \label{subsec-interp} A central role will be played by certain procedures $Y_\sigma \in {\mathsf{SP}}^0((\sigma\rightarrow\sigma)\rightarrow\sigma)$ which we use to interpret the ${\mathrm{PCF}}$ constants $Y_\sigma$ (the overloading of notation will do no harm in practice). If $\sigma = \sigma_0,\ldots,\sigma_{r-1} \rightarrow \nat$, we define $Y_\sigma = \lambda g^{\sigma\rightarrow\sigma}. F_\sigma[g]$, where $F_\sigma[g]$ is specified corecursively up to $\alpha$-equivalence by: \[ F_\sigma[g] ~=_\alpha~ \lambda x_0^{\sigma_0} \ldots x_{r-1}^{\sigma_{r-1}}.\; \caseof{g\;(F_\sigma[g])\; x_0^\eta \cdots x_{r-1}^\eta}{i \Rightarrow i} \;. \] (A concrete representative of $F_\sigma[g]$ satisfying the no-hiding condition will of course feature a different choice of bound variables $x_0,\ldots,x_{r-1}$ at each level.) We may now give the standard interpretation of ${\mathrm{PCF}}^\Omega$ in ${\mathsf{SP}}$. To each ${\mathrm{PCF}}^\Omega$ term $\Gamma \vdash M:\sigma$ we associate a procedure-in-environment $\Gamma \vdash \sem{M}^{{\mathsf{SP}}}_\Gamma : \sigma$ (denoted henceforth by $\sem{M}_\Gamma$) inductively as follows: \begin{eqnarray*} \sem{x^\sigma}_\Gamma & = & x^{\eta} \\ \sem{\num{n}}_\Gamma & = & \lambda.n \\ \sem{{\mathit{suc}}}_\Gamma & = & \lambda x.\,\caseof{x}{i \Rightarrow i+1} \\ \sem{{\mathit{pre}}}_\Gamma & = & \lambda x.\,\caseof{x}{0 \Rightarrow 0 \mid i+1 \Rightarrow i} \\ \sem{{\mathit{ifzero}}}_\Gamma & = & \lambda xyz.\,{\mathtt{case}}~{x}~{\mathtt{of}}~(0 \Rightarrow \caseof{y}{j \Rightarrow j} \\ & & ~~~~~~~~~~~~~~~\mid~i+1 \Rightarrow \caseof{z}{j \Rightarrow j}) \\ \sem{Y_\sigma}_\Gamma & = & Y_\sigma \\ \sem{C_f}_\Gamma & = & \lambda x.\,\caseof{x}{i \Rightarrow f(i)} \\ \sem{\lambda x^\sigma.M}_\Gamma & = & \lambda x.\sem{M}_{\Gamma,x} \\ \sem{MN}_\Gamma & = & \sem{M}_\Gamma \cdot \sem{N}_\Gamma \end{eqnarray*} (In the clause for $C_f$, we interpret $f(i)$ as $\bot$ whenever $f(i)$ is undefined.) The following key property of $\sem{-}^{\mathsf{SP}}$ is shown as Theorem~7.1.16 in \cite{Longley-Normann}: \begin{theorem}[Adequacy] \label{SP0-adequacy} For any closed ${\mathrm{PCF}}^\Omega$ term $M:\nat$, we have $M \rightsquigarrow^* \num{n}$ iff $\sem{M} = \lambda.n$. \end{theorem} We may now clarify the relationship between ${\mathsf{SP}}^0$ and ${\mathsf{SF}}$. First, there is a natural `observational equivalence' relation $\approx$ on each ${\mathsf{SP}}^0(\sigma)$, defined by \[ q \approx q' \mbox{~~~iff~~~} \forall r \in {\mathsf{SP}}^0(\sigma\rightarrow\nat).~~ r \cdot q ~=~ r \cdot q' \;. \] It is not hard to see that if $p \approx p' \in {\mathsf{SP}}^0(\sigma\rightarrow\tau)$ and $q \approx q' \in {\mathsf{SP}}^0(\sigma)$ then $p \cdot q \approx p' \cdot q \approx p' \cdot q' \in {\mathsf{SP}}^0(\tau)$. Explicitly, the first of these equivalences holds because for any $r \in {\mathsf{SP}}^0(\tau\rightarrow\nat)$ we have (using Lemma~\ref{eta-properties}) that \[ r \cdot (p \cdot q) ~=~ (\lambda x.r(\lambda \vec{z}.xq\vec{z}^{\,\eta})) \cdot p ~=~ (\lambda x.r(\lambda \vec{z}.xq\vec{z}^{\,\eta})) \cdot p' ~=~ r \cdot (p' \cdot q) \;, \] while the second equivalence holds because for any $r \in {\mathsf{SP}}^0(\tau\rightarrow\nat)$ we have \[ r \cdot (p' \cdot q) ~=~ (\lambda y.r(\lambda \vec{z}.p'y^\eta \vec{z}^{\,\eta})) \cdot q ~=~ (\lambda y.r(\lambda \vec{z}.p'y^\eta \vec{z}^{\,\eta})) \cdot q' ~=~ r \cdot (p' \cdot q') \;. \] We thus obtain a well-defined applicative structure ${\mathsf{SP}}^0 /\!\approx$ as a quotient of ${\mathsf{SP}}^0$; we write $\theta : {\mathsf{SP}}^0 \rightarrow {\mathsf{SP}}^0 /\!\approx$ for the quotient map. It turns out that up to isomorphism, this structure ${\mathsf{SP}}^0 /\!\approx$ is none other than ${\mathsf{SF}}$. Indeed, in \cite{Longley-Normann} this was taken as the definition of ${\mathsf{SF}}$, and the characterization as the closed term model of ${\mathrm{PCF}}^\Omega$ modulo observational equivalence proved as a consequence. In order to fill out the picture a little more, we will here exhibit the equivalence of these two definitions as a consequence of the following non-trivial fact, given as Corollary~7.1.34 in \cite{Longley-Normann}:% \footnote{What is actually shown in \cite{Longley-Normann} is that every element of ${\mathsf{SP}}^0$ is denotable on the nose in a language ${\mathrm{PCF}} + \mathit{byval}$, with a certain choice of denotation for the constant $\mathit{byval}$. Since the latter satisfies $\sem{\mathit{byval}} \approx \sem{\lambda f^{\nat\rightarrow\nat}x^\nat.\,{\mathit{ifzero}}\;x\,(fx)(fx)}$, the present Theorem~\ref{SP0-completeness-thm} follows easily.} \begin{theorem} \label{SP0-completeness-thm} For every $p \in {\mathsf{SP}}^0(\sigma)$, there is a closed ${\mathrm{PCF}}^\Omega$ term $M: \sigma$ such that $\sem{M} \approx p$. \end{theorem} \begin{proposition} \label{SF-char} $({\mathsf{SP}}^0/\!\approx) \cong{\mathsf{SF}}$, via an isomorphism that identifies $\theta(\sem{M}^{\mathsf{SP}})$ with $\sem{M}^{\mathsf{SF}}$ for any closed ${\mathrm{PCF}}^\Omega$ term $M$. \end{proposition} \begin{proof} For any element $x \in {\mathsf{SP}}^0/\!\approx$, we may take $p \in {\mathsf{SP}}^0$ with $\theta(p)=x$, then by Theorem~\ref{SP0-completeness-thm} take $M$ closed with $\sem{M} \approx p$; we then have that $\theta(\sem{M}) = x$. In this way, each ${\mathsf{SP}}^0(\sigma)/\!\approx$ corresponds bijectively to the set of closed ${\mathrm{PCF}}^\Omega$ terms $M:\sigma$ modulo some equivalence relation $\sim$. Recall now that $\simeq$ denotes observational equivalence in ${\mathrm{PCF}}^\Omega$. To see that $\sim \,\subseteq\, \simeq$, suppose $M \sim M'$, and let $C[-]$ be any suitable observing context of ${\mathrm{PCF}}^\Omega$. By the compositionality of $\sem{-}^{\mathsf{SP}}$, we obtain some $\sem{C} \in {\mathsf{SP}}^0$ such that $\sem{C[M]} = \sem{C} \cdot \sem{M}$ and similarly for $M'$. But $M \sim M'$ means that $\sem{M} \approx \sem{M'}$, whence by the definition of $\approx$ we conclude that $\sem{C[M]} = \sem{C[M']}$ at type $\nat$. So by Theorem~\ref{SP0-adequacy} we have $C[M] \rightsquigarrow^* \num{n}$ iff $C[M'] \rightsquigarrow^* \num{n}$. Since $C[-]$ was arbitrary, we have shown that $M \simeq M'$. To see that $\simeq \,\subseteq\, \sim$, suppose $M \simeq M' : \sigma$. It will suffice to show that $\sem{M} \approx \sem{M'}$. So suppose $r \in {\mathsf{SP}}^0(\sigma\rightarrow\nat)$, and using Theorem~\ref{SP0-completeness-thm}, take a ${\mathrm{PCF}}^\Omega$ term $R$ such that $\sem{R} \approx r$. Then $r \cdot \sem{M} = \sem{R} \cdot {M} = \sem{RM}$ at type $\nat$, and similarly for $M'$. But since $M \simeq M'$, we have $RM \rightsquigarrow^* n$ iff $RM' \rightsquigarrow^* n$, whence $\sem{RM} = \sem{RM'}$ by Theorem~\ref{SP0-adequacy}. Thus $r \cdot \sem{M} = r \cdot \sem{M'}$, and we have shown $\sem{M} \approx \sem{M'}$. Since each ${\mathsf{SF}}(\sigma)$ consists of closed ${\mathrm{PCF}}^\Omega$ terms $M:\sigma$ modulo $\simeq$, we have established a bijection $({\mathsf{SP}}^0(\sigma) /\!\approx) \cong {\mathsf{SF}}(\sigma)$ for each $\sigma$. Moreover, both $\sem{-}^{\mathsf{SP}}$ and $\theta$ respect application, so it follows that $({\mathsf{SP}}^0 /\!\approx) \cong {\mathsf{SF}}$, and it is immediate by construction that $\theta(\sem{M}^{\mathsf{SP}})$ is identified with $\sem{M}^{\mathsf{SF}}$. $\Box$ \end{proof} \vspace*{1.0ex} As we have already seen in Subsection~\ref{subsec-PCF}, Milner's context lemma for ${\mathrm{PCF}}^\Omega$ implies that ${\mathsf{SF}}$ is extensional. From this and Proposition~\ref{SF-char}, we may now read off the following useful characterization of the equivalence $\approx$: \begin{lemma}[NSP context lemma] \label{nsp-eq-context-lemma} Suppose $p,p' \in {\mathsf{SP}}^0(\sigma_0,\ldots,\sigma_{r-1} \rightarrow \nat)$. Then $p \approx p'$ iff \[ \forall q_0 \in {\mathsf{SP}}^0(\sigma_0), \ldots, q_{r-1} \in {\mathsf{SP}}^0(\sigma_{r-1}). ~~ p \cdot q_0 \cdot \ldots \cdot q_{r-1} ~=~ p' \cdot q_0 \cdot \ldots \cdot q_{r-1} \;. \] \end{lemma} We shall also make use of the \emph{observational ordering} on ${\mathsf{SF}}$ and the associated preorder on ${\mathsf{SP}}$. Let $\sqsubseteq$ be the usual information ordering on ${\mathsf{SF}}(\nat) \cong \mathbb{N}_\bot$, and let us endow each ${\mathsf{SF}}(\sigma)$ with the partial order $\preceq$ defined by \[ x \preceq x' \mbox{~~~iff~~~} \forall h \in {\mathsf{SF}}(\sigma\rightarrow\nat),\, n \in \mathbb{N}.~~ h \cdot x ~\sqsubseteq~ h \cdot x' \;. \] It is easy to see that the application operations $\cdot$ are monotone with respect to $\preceq$. Moreover, Milner's context lemma also exists in an \emph{inequational} form which says, in effect, that if $f,f' \in {\mathsf{SF}}(\sigma_0,\ldots,\sigma_{r-1}\rightarrow\nat)$ then \[ f \preceq f' \mbox{~~~iff~~~} \forall y_0 \in {\mathsf{SF}}(\sigma_0),\ldots,y_{r-1} \in {\mathsf{SF}}(\sigma_{r-1}).~~ f \cdot y_0 \cdot \ldots \cdot y_{r-1} ~\sqsubseteq f' \cdot y_0 \cdot \ldots \cdot y_{r-1} \;. \] Thus, if elements of ${\mathsf{SF}}(\sigma\rightarrow\tau)$ are considered as functions ${\mathsf{SF}}(\sigma) \rightarrow {\mathsf{SF}}(\tau)$, the partial order $\preceq$ coincides with the pointwise partial order on functions. We write $\preceq$ also for the preorder on each ${\mathsf{SP}}^0(\sigma)$ induced by $\preceq$ on ${\mathsf{SF}}$: that is, $p \preceq p'$ iff $\theta(p) \preceq \theta(p')$. Furthermore, we extend the use of the notations $\approx,\,\preceq$ in a natural way to open terms (in the same environment), and indeed to meta-terms: e.g.\ we may write $\vec{x} \vdash P \preceq P'$ to mean $\dang{\lambda \vec{x}.P} \;\preceq\; \dang{\lambda \vec{x}.P'}$. Clearly $p \approx p'$ iff $p \preceq p' \preceq p$. The following is also now immediate: \begin{lemma} \label{nsp-ineq-context-lemma} Suppose $p,p' \in {\mathsf{SP}}^0(\sigma)$ where $\sigma = \sigma_0,\ldots,\sigma_{r-1} \rightarrow \nat$. Then the following are equivalent: (i) $p \preceq p'$. (ii) \( \forall r \in {\mathsf{SP}}^0(\sigma\rightarrow\nat).~ r \cdot p \sqsubseteq r \cdot p' \). (iii) \( \forall q_0 \in {\mathsf{SP}}^0(\sigma_0), \ldots, q_{r-1} \in {\mathsf{SP}}^0(\sigma_{r-1}). ~~ p \cdot q_0 \cdot \ldots \cdot q_{r-1} \,\sqsubseteq\, p' \cdot q_0 \cdot \ldots \cdot q_{r-1} \). \end{lemma} We conclude this subsection by reformulating some of the major milestones in our proof using the notation now available. Specifically, in Sections~\ref{sec-denotations} and \ref{sec-Y-k+1} we will show the following: \begin{theorem} \label{SP0-main-thm} For any $k \geq 1$, the element $\sem{Y_{k+1}} \in {\mathsf{SP}}^0$ is not ${\mathrm{PCF}}^\Omega_k$-denotable (whence neither is $\sem{Y_{0 \rightarrow (k+1)}}$). \end{theorem} In Section~\ref{sec-extensional} we will go on to show that no $Z \approx \sem{Y_{0 \rightarrow (k+1)}}$ can be ${\mathrm{PCF}}^\Omega_k$-denotable, establishing Theorem~\ref{SF-main-thm}(i). In Section~\ref{sec-pure-type} we will resort to a more refined version of our methods to show the same for $Y_{k+1}$; this will establish Theorem~\ref{SF-main-thm}(ii). \subsection{The embeddability hierarchy} \label{subsec-embed} The following result will play a crucial role in this paper: \begin{theorem}[Strictness of embeddability hierarchy] \label{no-retraction-thm} In ${\mathsf{SF}}$, no type $\pure{k+1}$ can be a \emph{pseudo-retract} of any finite product $\Pi_i \sigma_i$ where each $\sigma_i$ is of level $\leq k$. More formally, if $z$ is a variable of type $\pure{k+1}$ and each $x_i$ a variable of type $\sigma_i$, there cannot exist procedures \[ z \vdash t_i : \sigma_i \;, ~~~~~~ \vec{x} \vdash r : \pure{k+1} \] such that $z \vdash {r[\vec{x} \mapsto \vec{t}\,]} \,\succeq z^\eta$. \end{theorem} If in the above setting we had $z \vdash {r[\vec{x} \mapsto \vec{t}\,]} \,\approx z^\eta$, we would call $\pure{k+1}$ a \emph{retract} of $\Pi_i \sigma_i$. In Appendix A we will show that the notions of retract and pseudo-retract actually coincide, since $z \vdash p \succeq z^\eta$ implies $z \vdash p \approx z^\eta$. However, this fact will not be needed for the main results of this paper. In our statement of Theorem~\ref{no-retraction-thm}, we have referred informally to a product $\Pi_i \sigma_i$ which we have not precisely defined (although the formal statement of the theorem gives everything that is officially necessary). One may readily make precise sense of this product notation within the \emph{Karoubi envelope} ${\mathbf{K}}({\mathsf{SF}})$ as studied in \cite[Chapter~4]{Longley-Normann}: for instance, it is not hard to show that any finite product of level $\leq k$ types can be constructed as a retract of the pure type $\pure{k+1}$. In the present paper, however, references to product types may be taken to be purely informal and motivational. The proof of Theorem~\ref{no-retraction-thm} appears in \cite[Section~7.7]{Longley-Normann}, but because of its crucial role in the paper we reprise it here with some minor stylistic improvements. \vspace*{1.0ex} \begin{proof} By induction on $k$. For the case $k=0$, we note that $\nat\rightarrow\nat$ cannot be a pseudo-retract of any $\nat^r$, since (for example) the set of maximal elements in ${\mathsf{SF}}(\nat\rightarrow\nat)$ is of larger cardinality than the set of all elements of ${\mathsf{SF}}(\nat)^r$. (Alternatively, one may note that $\nat\rightarrow\nat$ is not a \emph{retract} of $\nat^r$, since the former contains strictly ascending chains of length $r+2$ while the latter does not; then use the method of Appendix~A in the easy case $k=1$ to show that any pseudo-retraction of the relevant type would be a retraction.) Now assume the result for $k-1$, and suppose for contradiction that $z \vdash t_i$ and $\vec{x} \vdash r$ exhibit $\pure{k+1}$ as a pseudo-retract of $\Pi_i \sigma_i$ where each $\sigma_i$ is of level $\leq k$. Let $v =\, \dang{r[\vec{x} \mapsto \vec{t}\,]}$, so that $z \vdash v \succeq z^\eta$, whence $\dang{v[z \mapsto u]}\, \succeq u$ for any $u \in {\mathsf{SP}}^0(k+1)$. We first check that any $v$ with this latter property must have the syntactic form $\lambda f^k.\,\caseof{zp}{\cdots}$ for some $p$ of type $\pure{k}$. Indeed, it is clear that $v$ does not have the form $\lambda f.n$ or $\lambda f.\bot$, and the only other alternative form is $\lambda f.\,\caseof{fp'}{\cdots}$. In that case, however, we would have \[ \dang{v[z \mapsto \lambda w^k.0]} \cdot\; (\lambda y^{k-1}.\bot) ~=~ \bot \;, \] contradicting $\dang{v[z \mapsto \lambda w^k.0]} \cdot\; (\lambda y^{k-1}.\bot) \,\succeq\, (\lambda w.0)(\lambda y.\bot) = 0$. We now focus on the subterm $p$ in $v = \lambda f^k.\,\caseof{zp}{\cdots}$. The general direction of our argument will be to show that $\lambda f^k.p$ represents a function of type $\pure{k} \rightarrow \pure{k}$ that dominates the identity, and that moreover our construction of $v$ as $\dang{r[\vec{x} \mapsto \vec{t}\,]}$ can be used to split this into functions $\pure{k} \rightarrow \Pi_j \rho_j$ and $\Pi_j \rho_j \rightarrow \pure{k}$ where the $\rho_j$ are of level $\leq k-1$, contradicting the induction hypothesis. An apparent obstacle to this plan is that $z$ as well as $f$ may appear free in $p$; however, it turns out that we still obtain all the properties we need if we specialize $z$ here (somewhat arbitrarily) to $\lambda w.0$. Specifically, we claim that $\lambda f.\!\dang{p[z \mapsto \lambda w.0]} \,\succeq {\mathit{id}}_k$. By Lemma~\ref{nsp-ineq-context-lemma}, it will suffice to show that $\dang{p[f \mapsto q, z \mapsto \lambda w.0]} \,\succeq q$ for any $q \in {\mathsf{SP}}^0(k)$. The idea is that if it is not, then (ignoring the presence of $z$ in $p$ for now) we may specialize $z$ to some $u$ that will detect the difference between $p[f \mapsto q]$ and $q$, so that the subterm `$zp$' within $v$ will yield $\bot$, contradicting that $z \vdash v \succeq z^\eta$. We can even allow for the presence of $z$ in $p$ by a suitably careful choice of $u$. Again by Lemma~\ref{nsp-ineq-context-lemma}, it suffices to show that $\dang{p[f \mapsto q, z \mapsto \lambda w.0]} \cdot\; s \succeq q \cdot s$ for any $s$. So suppose $q \cdot s = \lambda.n$ whereas $\dang{p[f \mapsto q, z \mapsto \lambda w.0]} \cdot\; s \neq \lambda.n$ for some $s \in {\mathsf{SP}}^0(k-1)$ and $n \in \mathbb{N}$. Take $u = \lambda g.\,\caseof{gs}{n \Rightarrow 0}$, so that $u \cdot q' = \bot$ whenever $q' \cdot s \neq \lambda.n$. Then $u \preceq \lambda w.0$ by Lemma~\ref{nsp-ineq-context-lemma}, so we have $\dang{p[f \mapsto q, z \mapsto u]} \cdot\; s \neq \lambda.n$ since $\lambda.n$ is maximal in ${\mathsf{SP}}^0(\nat)$. By the definition of $u$, it follows that $\dang{(zp)[f \mapsto q, z \mapsto u]}\, = \bot$, whence $\dang{v[z \mapsto u]} \cdot\, q = \bot$, whereas $u \cdot q=0$, contradicting $\dang{v[z \mapsto u]}\, \succeq u$. This completes the proof that $\lambda f.\!\dang{p[z \mapsto \lambda w.0]} \; \succeq {\mathit{id}}_{k}$. Next, we show how to split the function represented by this procedure so as to go through some $\Pi_j \rho_j$ as above. Since $\dang{r[\vec{x} \mapsto \vec{t}\,]} \,= \lambda f.\,\caseof{zp}{\cdots}$, we have that $r[\vec{x}\mapsto\vec{t}\,]$ reduces in finitely many steps to a head normal form $\lambda f.\,\caseof{zP}{\cdots}$ where $\dang{\!P\!}\,=p$. By working backward through this reduction sequence, we may locate the ancestor within $r[\vec{x}\mapsto\vec{t}\,]$ of this head occurrence of $z$. Since $z$ does not appear free in $r$, this occurs within some $t_i$, and clearly it must appear as the head of some subterm $\caseof{zp'}{\cdots}$. Now since $t_i$ has type $\sigma_i$ of level $\leq k$, and $z:\pure{k+1}$ is its only free variable, it is easy to see that all \emph{bound} variables within $t_i$ have pure types of level $<k$. Let $x'_0,x'_1,\ldots$ denote the finitely many bound variables that are in scope at the relevant occurrence of $zp'$, and suppose each $x'_j$ has type $\rho_j$ of level $<k$. By considering the form of the head reduction sequence $r[\vec{x}\mapsto\vec{t}\,] \rightsquigarrow^*_h \lambda f.\,\caseof{zP}{\cdots}$, we now see that $P$ has the form $p'[\vec{x}\,' \mapsto \vec{T}]$ where each $T_j: \rho_j$ contains at most $f$ and $z$ free.% \footnote{The reader wishing to see a more formal justification for this step may consult the proof of Lemma~\ref{g-lemma-1}(i) below.} Writing $^*$ for the substitution $[z \mapsto \lambda w.0]$, define procedures \[ f^k \vdash t'_j =\, \dang{T_j^*} \,: \rho_j \;, ~~~~~~ \vec{x}\,' \vdash r' =\, \dang{p'^*} \,: \pure{k} \;. \] Then $\dang{r'[\vec{x}\,' \mapsto \vec{t}\,'\,]}$ coincides with the term $\dang{\lambda f.\,P^*} \,= \lambda f.\!\dang{\!p^*\!}$, which dominates the identity as shown above. Thus $\pure{k}$ is a pseudo-retract of $\Pi_j \rho_j$, which contradicts the induction hypothesis. So $\pure{k+1}$ is not a pseudo-retract of $\Pi_i \sigma_i$ after all, and the proof is complete. $\Box$ \end{proof} \vspace*{1.0ex} As an aside, we remark that for several extensions of ${\mathrm{PCF}}$ studied in the literature, the situation is completely different, in that the corresponding fully abstract and universal models possess a \emph{universal} simple type $\upsilon$ of which all simple types are retracts. It follows easily in these cases that one can indeed bound the type levels of recursion operators without loss of expressivity. For example: \begin{itemize} \item In the language ${\mathrm{PCF}}+{\mathit{por}}+{\mathit{exists}}$ considered by Plotkin \cite{LCF-considered}, the type $\nat\rightarrow\nat$ is universal, and the proof of this shows that every program in this language is observationally equivalent to one in ${\mathrm{PCF}}_1 + {\mathit{por}}+{\mathit{exists}}$. (This latter fact was already noted in \cite{LCF-considered}.) \item In ${\mathrm{PCF}}+{\mathit{catch}}$ (a slight strengthening of Cartwright and Felleisen's language SPCF \cite{Cartwright-Felleisen}), the type $\nat\rightarrow\nat$ is again universal, and again the sublanguage ${\mathrm{PCF}}_1 + {\mathit{catch}}$ has the same expressive power. \item In the language ${\mathrm{PCF}}+H$ of Longley \cite{SRF}, the type $(\nat\rightarrow\nat)\rightarrow\nat$ is universal, but even here, all constants $Y_\sigma$ with ${\mathrm{lv}}(\sigma)>1$ are dispensable. \end{itemize} Further details of each the above scenarios may be found in \cite{Longley-Normann}. These facts may offer some indication of why a `cheap' proof of our present results in the setting of pure ${\mathrm{PCF}}$ is not to be expected.% \footnote{That PCF manifests greater structural complexity than many stronger languages is also a moral of Loader's undecidability theorem for finitary PCF \cite{Loader-PCF}. However, the complexity we explore here seems quite orthogonal to that exhibited by Loader: we are concerned purely with `infinitary' aspects of definability, the entire finitary structure being already represented by our ${\mathrm{PCF}}_0$.} \subsection{Other sublanguages of ${\mathrm{PCF}}$} \label{subsec-power-pcf1} Our main theorems establish a hierarchy of languages ${\mathrm{PCF}}_1 < {\mathrm{PCF}}_2 < \cdots\,$. Before proceeding further, however, we pause to clarify the relationship between ${\mathrm{PCF}}_0$ and ${\mathrm{PCF}}_1$, and also to survey some of the interesting territory that lies between them, in order to situate our theorems within a wider picture. On the one hand, ${\mathrm{PCF}}_0$ is a rather uninteresting language. As regards the elements of ${\mathsf{SF}}$ that it denotes, it is equivalent in expressivity to ${\mathrm{PCF}}_\bot$, a variant of ${\mathrm{PCF}}_0$ in which we replace $Y_0$ by a constant $\bot$ (denoting $\bot \in {\mathsf{SF}}(\nat)$). This is clear since $Y_0$ and $\bot$ are interdefinable: we have $\bot = Y_0(\lambda x.x)$, and it is easy to see that $Y_0 = \lambda f. f\bot$ (in ${\mathsf{SF}}$). By a syntactic analysis of the possible normal forms of type $\pure{1}$ in ${\mathrm{PCF}}_\bot$, one can show that these are very weak languages that do not even define addition. However, such an analysis is unnecessary for our purposes, since there are more interesting languages that clearly subsume ${\mathrm{PCF}}_0$ but are known to be weaker than ${\mathrm{PCF}}_1$. For instance, Berger \cite{Berger-min-recursion} considered the language ${\mathrm{T}}_0 +{\mathit{min}}$, where ${\mathrm{T}}_0$ (a fragment of G\"odel's System~T) is the $\lambda$-calculus with first-order primitive recursion over the natural numbers: \[ \num{0} ~: \nat \;, ~~~~~~ {\mathit{suc}} ~: \mathbb{N} \rightarrow \mathbb{N} \;, ~~~~~~ {\mathit{rec}}_0 ~: \nat \rightarrow (\nat \rightarrow \nat \rightarrow \nat) \rightarrow (\nat \rightarrow \nat) \;, \] and ${\mathit{min}}$ is the classical \emph{minimization} (i.e.\ unbounded search) operator of type $(\nat\rightarrow\nat)\rightarrow\nat$. On the one hand, it is an easy exercise to define $\bot$ in ${\mathrm{T}}_0 + {\mathit{min}}$, and to define both ${\mathit{rec}}_0$ and ${\mathit{min}}$ in ${\mathrm{PCF}}_1$. On the other hand, Berger showed that the ${\mathrm{PCF}}_1$-definable functional $\Phi_0: (\nat\rightarrow\nat\rightarrow\nat) \rightarrow (\nat \rightarrow \nat)$ given by \[ \Phi_0\;g\;n ~=~ g\;n\;(\Phi_0\;g\;(n+1)) \;, \] is not expressible in ${\mathrm{T}}_0 + {\mathit{min}}$.% \footnote{Berger actually considered denotability in the Scott model, but his argument applies equally to ${\mathsf{SF}}$.} As already indicated in Section~\ref{sec-intro}, this functional and its higher-type analogues will play a crucial role in the present paper. This situation is revisited in \cite[Section~6.3]{Longley-Normann} from the perspective of substructures of ${\mathsf{SP}}^0$. It is shown that ${\mathrm{T}}_0 + {\mathit{min}}$, and indeed the whole of ${\mathrm{T}} + {\mathit{min}}$, can be modelled within the substructure ${\mathsf{SP}}^{0,{\mbox{\scriptsize \rm lwf}}}$ of \emph{left-well-founded} procedures, whereas the above functional $\Phi_0$ is not representable by any such procedure; thus $\Phi_0$ is not expressible in ${\mathrm{T}} + {\mathit{min}}$. (The reader may wish to study these results and proofs before proceeding further, since they provide simpler instances of the basic method that we will use in this paper.) At third order, there are even `hereditarily total' functionals definable in ${\mathrm{PCF}}_1$ but not by higher-type iterators, one example being the well-known \emph{bar recursion} operator (see \cite{Longley-bar-recursion}). Even weaker than ${\mathrm{T}}_0 + {\mathit{min}}$ is the language of \emph{(strict) Kleene primitive recursion plus minimization}, denoted by ${\mathsf{Klex}}^{\mbox{\scriptsize \rm min}}$ in \cite{Longley-Normann}; this again subsumes ${\mathrm{PCF}}_0$. It is shown in \cite{Longley-Normann} that the computational power of ${\mathsf{Klex}}^{\mbox{\scriptsize \rm min}}$ coincides with that of computable \emph{left-bounded} procedures; this is used to show, for example, that even ${\mathit{rec}}_0$ is not computable in ${\mathsf{Klex}}^{\mbox{\scriptsize \rm min}}$. We find it reasonable to regard left-bounded procedures as embodying the weakest higher-order computability notion of natural interest that is still Turing complete. \section{Sequential procedures for ${\mathrm{PCF}}_k$ terms} \label{sec-denotations} For the remainder of the paper, we take $k$ to be some fixed natural number greater than $0$. In this section we give a direct inductive characterization of the ${\mathrm{PCF}}^\Omega_k$-denotable elements of ${\mathsf{SP}}$ by making explicit how our interpretation works for terms of ${\mathrm{PCF}}^\Omega_k$. The first point to observe is that we may restrict attention to ${\mathrm{PCF}}^\Omega_k$ terms in \emph{long $\beta\eta$-normal form}: that is, terms in $\beta$-normal form in which every variable or constant $z$ of type $\sigma_0,\ldots,\sigma_{r-1} \rightarrow \nat$ is fully applied (i.e.\ appears at the head of a subterm $z N_0 \ldots N_{r-1}$ of type $\nat$). Moreover, an inductive characterization of the class of such terms is easily given. \begin{proposition} \label{long-beta-eta-prop} (i) A procedure $\Gamma \vdash p : \sigma$ is denotable by a ${\mathrm{PCF}}^\Omega_k$ term $\Gamma \vdash M: \sigma$ iff it is denotable by one in long $\beta\eta$-normal form. (ii) The class of long $\beta\eta$-normal forms of ${\mathrm{PCF}}^\Omega_k$ is inductively generated by the following clauses: \begin{enumerate} \item If $\Gamma \vdash N_i : \sigma_i$ is a normal form for each $i<r$ and $x^{\sigma_0,\ldots,\sigma_{r-1} \rightarrow \nat} \in \Gamma$, then $\Gamma \vdash x N_0 \ldots N_{r-1} : \nat$ is a normal form (note that $r$ may be $0$ here). \item If $\Gamma, x^\sigma \vdash M : \tau$ is a normal form then so is $\Gamma \vdash \lambda x.M : \sigma \rightarrow \tau$. \item The numeric literals $\Gamma \vdash \num{n} : \nat$ are normal forms. \item If $\Gamma \vdash M : \nat$ is a normal form then so are $\Gamma \vdash {\mathit{suc}}\;M : \nat$, $\Gamma \vdash {\mathit{pre}}\;M : \nat$ and $\Gamma \vdash C_f\,M : \nat$ for any $f: \mathbb{N} \rightharpoonup \mathbb{N}$. \item If $\Gamma \vdash M : \nat$, $\Gamma \vdash N : \nat$ and $\Gamma \vdash P : \nat$ are normal forms, then so is $\Gamma \vdash {\mathit{ifzero}}\;M\;N\;P : \nat$. \item If $\sigma = \sigma_0,\ldots,\sigma_{r-1} \rightarrow \nat$ is of level $\leq k$ and $\Gamma \vdash M : \sigma\rightarrow\sigma$ and $\Gamma \vdash N_i : \sigma_i$ are normal forms, then $\Gamma \vdash Y_\sigma M N_0 \ldots N_{r-1} : \nat$ is a normal form. \end{enumerate} \end{proposition} \begin{proof} (i) It is a well-known property of simply typed $\lambda$-calculi that every term $M$ is $\beta\eta$-equivalent to one in long $\beta\eta$-normal form: indeed, we may first compute the $\beta$-normal form of $M$ and then repeatedly apply the $\eta$-rule to expand any subterms that are not already fully applied. Moreover, it is shown in \cite[Theorem~6.1.18]{Longley-Normann} that ${\mathsf{SP}}$ is a $\lambda\eta$-algebra, so that if $\Gamma \vdash M =_{\beta\eta} M'$ then $\sem{M}_\Gamma = \sem{M'}_\Gamma$ in ${\mathsf{SP}}$. This establishes the claim. (ii) This is clear from the fact that no application may be headed by a $\lambda$-abstraction and that all occurrences of variables and constants must be fully applied. $\Box$ \end{proof} \vspace*{1.0ex} It follows that the class of ${\mathrm{PCF}}^\Omega_k$-denotable procedures may be generated inductively by a set of clauses that mirror the above formation rules for long $\beta\eta$-normal ${\mathrm{PCF}}^\Omega_k$ terms. We now consider each of these formation rules in turn in order to spell out the corresponding operation at the level of NSPs. In Section~\ref{sec-Y-k+1} we will show that these operations cannot give rise to \emph{$k\!+\!1$-spinal} procedures, from which it will follow that no ${\mathrm{PCF}}^\Omega_k$-denotable procedure can be $k\!+\!1$-spinal. For the first three formation rules, the effect on NSPs is easily described: \begin{proposition} \label{NSP-nf-prop} (i) If $\Gamma \vdash x N_0 \ldots N_{r-1} : \nat$ in ${\mathrm{PCF}}^\Omega$, then $\sem{x N_0 \ldots N_{r-1}}_\Gamma = \caseof{x \sem{N_0}_\Gamma \cdots \sem{N_{r-1}}_\Gamma}{j \Rightarrow j}$. (ii) If $\Gamma \vdash \lambda x.M : \sigma \rightarrow \tau$ in ${\mathrm{PCF}}^\Omega$, then $\sem{\lambda x.M}_\Gamma = \lambda x.\,\sem{M}_{\Gamma,x}$. (iii) $\sem{\num{n}}_\Gamma = \lambda.n$. \end{proposition} \begin{proof} (i) Easy using the definition of $\sem{-}$ and Lemma~\ref{eta-properties}. (ii), (iii) are part of the definition of $\sem{-}$. $\Box$ \end{proof} \vspace*{1.0ex} As regards the formation rules for ${\mathit{suc}}$, ${\mathit{pre}}$, $C_f$ and ${\mathit{ifzero}}$, the situation is again fairly straightforward, although a little more machinery is needed: \begin{definition} \label{rightward-leaf-def} (i) The set of \emph{rightward} (occurrences of) \emph{numeral leaves} within a term $t$ is defined inductively by means of the following clauses: \begin{enumerate} \item A term $n$ is a rightward numeral leaf within itself. \item Every rightward numeral leaf within $e$ is also one within $\lambda \vec{x}.e$. \item Every rightward numeral leaf in each $e_i$ is also one in $\caseof{a}{i \Rightarrow e_i}$. \end{enumerate} (ii) If $t$ is a term and $e_i$ an expression for each $i$, let $t[i \mapsto e_i]$ denote the result of replacing each rightward leaf occurrence $i$ in $t$ by the corresponding $e_i$. \end{definition} \begin{lemma} \label{rightward-leaf-prop} $\dang{\caseof{d}{i \Rightarrow e_i}} \;= d[i \mapsto e_i]$ for any expressions $d,e_i$. \end{lemma} \begin{proof} For each $c \in \mathbb{N}$, define a `truncation' operation $-^{(c)}$ on expressions as follows: \begin{eqnarray*} n^{(c)} ~=~ n \;, ~~~~ \bot^{(c)} & = & \bot \;, \\ \caseof{a}{i \Rightarrow e_i}^{(0)} & = & \bot \;, \\ \caseof{a}{i \Rightarrow e_i}^{(c+1)} & = & \caseof{a}{i \Rightarrow e_i^{(c)}} \;. \end{eqnarray*} Then clearly $d = \bigsqcup_c d^{(c)}$ and $d[i \mapsto e_i] = \bigsqcup_c d^{(c)}[i \mapsto e_i]$. Moreover, we may show by induction on $c$ that \[ \dang{\caseof{d^{(c)}}{i \Rightarrow e_i}} ~=~ d^{(c)}[i \mapsto e_i] \;. \] The case $c=0$ is trivial since $d^{(0)}$ can only have the form $n$ or $\bot$. For the induction step, the situation for $d=n,\bot$ is trivial, so let us suppose $d = \caseof{a}{j \Rightarrow f_j}$. Then \begin{eqnarray*} & & \dang{\caseof{d^{(c+1)}}{i \Rightarrow e_i}} \\ &=& \dang{\caseof{(\caseof{a}{j \Rightarrow f_j^{(c)}})}{i \Rightarrow e_i}} \\ &=& \caseof{a}{j \Rightarrow\, \dang{\caseof{f_j^{(c)}}{i \Rightarrow e_i}}} \\ &=& \caseof{a}{j \Rightarrow (f_j^{(c)}[i \mapsto e_i])} \mbox{~~by the induction hypothesis} \\ &=& (\caseof{a}{j \Rightarrow f_j^{(c)}})[i \mapsto e_i] \\ &=& d^{(c+1)}[i \mapsto e_i] \;. \end{eqnarray*} Since $\dang{\!-\!}$ is continuous, the proposition follows by taking the supremum over $c$. $\Box$ \end{proof} \vspace*{1.0ex} From this lemma we may now read off the operations on NSPs that correspond to clauses~4 and 5 of Proposition~\ref{long-beta-eta-prop}(ii): \begin{proposition} \label{NSP-arith-prop} (i) If $\Gamma \vdash M : \nat$ in ${\mathrm{PCF}}^\Omega$, then $\sem{C_f\,M}_\Gamma = \sem{M}_\Gamma [i \mapsto f(i)]$ (understanding $f(i)$ to be $\bot$ when $i \not\in {\mathrm{dom}}\;f$); similarly for ${\mathit{suc}}$ and ${\mathit{pre}}$. (ii) If $\Gamma \vdash M : \nat$, $\Gamma \vdash N : \nat$ and $\Gamma \vdash P : \nat$, then $\sem{{\mathit{ifzero}}\;M\;N\;P}_\Gamma = \sem{M}_\Gamma [0 \mapsto d,\, i+1 \mapsto e]$ where $\sem{N}_\Gamma = \lambda.d$ and $\sem{P}_\Gamma = \lambda.e$. \end{proposition} \begin{proof} (i) The definition of $\sem{-}$ yields \[ \sem{C_f\,M}_\Gamma ~= \dang{\lambda.\,\caseof{\sem{M}_\Gamma}{i \Rightarrow f(i)}} \, , \] and by Lemma~\ref{rightward-leaf-prop} this evaluates to $\sem{M}_\Gamma [i \mapsto f(i)]$. Likewise for ${\mathit{suc}}$ and ${\mathit{pre}}$. (ii) The definition of $\sem{-}$ yields \[ \sem{{\mathit{ifzero}}\;M\;N\;P}_\Gamma ~=~ \dang{\lambda.\,\caseof{\sem{M}_\Gamma}{0 \Rightarrow d \mid i+1 \Rightarrow e}} \, , \] and by Lemma~\ref{rightward-leaf-prop} this evaluates to $\sem{M}_\Gamma [0 \mapsto d,\, i+1 \mapsto e]$. $\Box$ \end{proof} \vspace*{1.0ex} It remains to consider the formation rule involving $Y_\sigma$. It will be convenient to regard the NSP for $Y M N_0 \ldots N_{r-1}$ as a result of plugging some simpler NSPs together, in the sense indicated by the following definition. Here and later, we shall follow the convention that Greek capitals $\Gamma,\Delta$ denote arbitrary environments, while Roman capitals $Z,X,V$ denote lists of variables of type level $\leq k$. (Of course, the idea of plugging can be formulated without any restrictions on types, but we wish to emphasize at the outset that only pluggings at level $\leq k$ will feature in our proof.) \begin{definition}[Plugging] \label{plugging-def} Suppose given the following data: \begin{itemize} \item a variable environment $\Gamma$, \item a finite list $Z$ of `plugging variables' $z$ of level $\leq k$, disjoint from $\Gamma$,% \item a \emph{root expression} $\Gamma,Z \vdash e$, \item a substitution $\xi$ assigning to each $z^\sigma \in Z$ a procedure $\Gamma,Z \vdash \xi(z) : \sigma$. \end{itemize} In this situation, we define the \emph{($k$-)plugging} $\Pi_{\Gamma,Z}(e,\xi)$ (often abbreviated to $\Pi(e,\xi)$) to be the meta-term obtained from $e$ by repeatedly expanding variables $z \in Z$ to $\xi(z)$. To formalize this, let $T^\circ$ denote the meta-term obtained from $T$ by replacing each ground type subterm $z \vec{Q}$ (where $z \in Z$) by $\bot$. We may now define, up to $\alpha$-equivalence, \begin{eqnarray*} \Pi^0(e,\xi) & = & e \;, \\ \Pi^{m+1}(e,\xi) & = & \Pi^m(e,\xi)[z \mapsto \xi(z) \mbox{~for all $z \in Z$}] \;, \\ \Pi(e,\xi) & = & \bigsqcup_m \Pi^m(e,\xi)^\circ \;, \end{eqnarray*} where $\bigsqcup$ denotes supremum with respect to the syntactic order on meta-terms. \end{definition} It is easy to see that $\Pi_{\Gamma,Z}(e,\xi)$ is well-typed in environment $\Gamma$. Note that some renaming of bound variables will typically be necessary in order to realize $\Pi_{\Gamma,Z}(e,\xi)$ as a concrete term conforming to the no-variable-hiding condition; we will not need to fix on any one particular way of doing this. The operation on NSPs corresponding to clause~6 of Proposition~\ref{long-beta-eta-prop}(ii) may now be described as follows: \begin{proposition} \label{NSP-Y-prop} Suppose that $\sigma = \sigma_0,\ldots,\sigma_{r-1} \rightarrow \nat$ is of level $\leq k$ and that $\Gamma \vdash Y_\sigma M N_0 \ldots N_{r-1}$ in ${\mathrm{PCF}}^\Omega_k$, where $\sem{M}_\Gamma = \lambda z^\sigma.p = \lambda z^{\sigma} x_0^{\sigma_0} \cdots x_{r-1}^{\sigma_{r-1}}.\,e$ and $\sem{N_i}_\Gamma = q_i$ for each $i$. Then \[ \sem{Y_\sigma M N_0 \ldots N_{r-1}}_\Gamma ~=~ \lambda. \dang{\Pi_{\Gamma,Z}(e,\xi)} \] where $Z = z,x_0,\ldots,x_{r-1}$, $\xi(z) = p$, and $\xi(x_i) = q_i$ for each $i$. \end{proposition} \vspace*{1.0ex} \begin{proof} Note that in this instance of plugging, the repeated substitutions are needed only for the sake of the term $\xi(z)$ which may contain $z$ free---only a single substitution step is needed for the plugging variables $x_i$, since the $q_i$ contain no free variables from $Z$. We may thus rewrite $\Pi_{\Gamma,Z}(e,\xi)$ as \[ \Pi_{\Gamma,\vec{x},Z'}(e,\xi')\;[\vec{x}\mapsto{q}] \,, \] where $Z'=\{z\}$ and $\xi'(z)=p$. The proposition will therefore follow easily (with the help of Theorem~\ref{eval-thm}) once we know that \[ \sem{Y_\sigma M}_\Gamma ~=~ \lambda \vec{x}.\, \dang{\Pi_{\Gamma,\vec{x},Z'}(e,\xi')} \;. \] To see this, write $Y_\sigma = \lambda g.F_\sigma[g]$ where $F_\sigma[g] = \lambda \vec{x}.\,\caseof{g\,(F_\sigma[g])\,\vec{x}^{\,\eta}}{i \Rightarrow i}$ as at the start of Section~\ref{subsec-interp}. Then clearly \[ \sem{Y_\sigma M}_\Gamma ~=~ (\lambda g. F_\sigma[g]) \cdot (\lambda z.p) ~=~ \dang{F_\sigma[\lambda z.p]} \;. \] Here the meta-term $F_\sigma[\lambda z.p]$ is specified corecursively (up to $\alpha$-equivalence) by \[ F_\sigma[\lambda z.p] ~=~ \lambda \vec{x}.\,\caseof{(\lambda z. p)\,(F_\sigma[\lambda z.p])\,\vec{x}^{\,\eta}}{i \Rightarrow i} \] That is, $F_\sigma[\lambda z.p]$ coincides with the meta-term $G = \bigsqcup_m G^m$, where \[ G^0 ~=~ \bot_\sigma \;, ~~~~~~ G^{m+1} ~=~ \lambda \vec{x}.\,\caseof{(\lambda z.p)\,G^m\,\vec{x}^{\,\eta}}{i \Rightarrow i} \;. \] We may now compare this with the meta-term $H = \bigsqcup_m H^m$, where \[ H^0 ~=~ \bot_\sigma \;, ~~~~~~ H^{m+1} ~=~ \lambda \vec{x}.\, e [z \mapsto H^m] \;. \] Noting that $(\lambda z.p)\,G^m\,\vec{x}^{\,\eta} \rightsquigarrow e[z \mapsto G^m,\,\vec{x} \mapsto \vec{x}^{\,\eta}]$, we have by Lemmas~\ref{eta-properties} and \ref{rightward-leaf-prop} that \[ \dang{G^{m+1}} ~=~ \dang{\lambda \vec{x}.\, e[z \mapsto G^m]} \] whence by Theorem~\ref{eval-thm} and an easy induction we have $\dang{G^m} \,=\, \dang{H^m}$ for all $m$. Hence $\dang{\!G\!} \,=\, \dang{\!H\!}$. Moreover, it is immediate from the definition that $H$ coincides with the meta-term $\lambda \vec{x}.\, \Pi_{\Gamma,\vec{x},Z'}(e,\xi')$ mentioned earlier. We thus have \[ \sem{Y_\sigma M}_\Gamma ~=~ \dang{F_\sigma[\lambda z.p]} ~=~ \dang{\!G\!} ~=~ \dang{\!H\!} ~=~ \lambda \vec{x}.\, \dang{\Pi_{\Gamma,\vec{x},Z'}(e,\xi')} \] and the proof is complete. (We have glossed over some fine details of variable renaming here, but these are easily attended to.) $\Box$ \end{proof} \vspace*{1.0ex} Combining Propositions~\ref{NSP-nf-prop}, \ref{NSP-arith-prop} and \ref{NSP-Y-prop} with Proposition~\ref{long-beta-eta-prop}, the results of this section may be summarized as follows. \begin{theorem} \label{denotable-inductive-thm} The class of ${\mathrm{PCF}}^\Omega_k$-denotable procedures-in-environment $\Gamma \vdash p$ is the class generated inductively by the following rules: \begin{enumerate} \item If $\Gamma \vdash q_i$ is denotable for each $i<r$ and $x \in \Gamma$, then \[ \Gamma \vdash \lambda.\,\caseof{x q_0 \ldots q_{r-1}}{j \Rightarrow j} \] is denotable. \item If $\Gamma,x \vdash p$ is denotable, then $\Gamma \vdash \lambda x.p$ is denotable. \item Each $\Gamma \vdash \lambda.n$ is denotable. \item If $\Gamma \vdash p$ is denotable and $f : \mathbb{N} \rightharpoonup \mathbb{N}$, then $\Gamma \vdash p[i \mapsto f(i)]$ is denotable. (The constructions for ${\mathit{suc}}$ and ${\mathit{pre}}$ are special cases of this). \item If $\Gamma \vdash p$, $\Gamma \vdash \lambda.d$ and $\Gamma \vdash \lambda.e$ are denotable, then $\Gamma \vdash p[0 \mapsto d, i+1 \mapsto e]$ is denotable. \item If $\Gamma \vdash \lambda z^\sigma x_0^{\sigma_0} \cdots x_{r-1}^{\sigma_{r-1}}.e$ is denotable where $\sigma = \sigma_0,\ldots,\sigma_{r-1}\rightarrow\nat$ is of level $\leq k$, and $\Gamma \vdash q_i:\sigma_i$ is denotable for each $i<r$, then \[ \Gamma \vdash \lambda. \dang{\Pi_{\Gamma,Z}(e,\xi)} \] is denotable, where $Z = z,\vec{x}$ is disjoint from $\Gamma$, $\xi(z) = \lambda \vec{x}.e$, and $\xi(x_i)=q_i$ for each $i$. \end{enumerate} \end{theorem} To conclude this section, we introduce a useful constraint on NSPs which, although not satisfied by all ${\mathrm{PCF}}^\Omega_k$-denotable procedures, will hold for all those that we will need to consider in the course of our main proofs. As we shall see, this constraint will interact well with the inductive rules just presented. Referring back to the examples in Section~\ref{sec-intro}, we see that the recursive definitions of both $Y_{k+1}$ and $\Phi_{k+1}$ involved a variable $g$ of type level $k+2$. It is therefore natural that our analysis will involve the consideration of terms in which such a variable $g$ appears free. However, it will turn out that apart from this one designated variable, our terms need never involve any other variables of level $>k$, and this has a pleasant simplifying effect on our arguments. This motivates the following definition: \begin{definition} \label{regular-def} Suppose $g$ is a variable of type level $k+2$. (i) An environment $\Gamma$ is \emph{($g$-)regular} if $\Gamma$ contains $g$ but all other variables in $\Gamma$ are of type level $\leq k$. (ii) A meta-term $T$ is regular if all free and bound variables within $T$ are of level $\leq k$, except possibly for free occurrences of $g$. (iii) A meta-term-in-environment $\Gamma \vdash T$ is regular if both $\Gamma, T$ are regular. \end{definition} There is a useful alternative characterization of regularity in the case of normal forms: \begin{proposition} \label{regular-term-prop} A term-in-environment $\Gamma \vdash t$ is regular iff $\Gamma$ is regular and $t$ is not a procedure of type level $\geq k+2$. \end{proposition} \begin{proof} The left-to-right implication is trivial, since a procedure of level $\geq k+2$ would have the form $\lambda \vec{x}.\cdots$ where at least one of the $x_i$ was of level $\geq k+1$. For the converse, suppose $\Gamma$ is regular and $t$ is not a procedure of level $\geq k+2$. Then $t$ contains no free variables of level $\geq k$ other than $g$, so we just need to show that all variables bound by a $\lambda$-abstraction within $t$ are of level $\leq k$. Suppose not, and suppose that $\lambda \vec{x}.e$ is some outermost subterm of $t$ with ${\mathrm{lv}}(\vec{x}) > k$. Then $\lambda \vec{x}.e$ cannot be the whole of $t$, since $t$ would then be a procedure of level $>k+1$. Since $t$ is a normal form, the subterm $\lambda \vec{x}.e$ (of level $>k+1$) must therefore occur as an argument to some variable $w$ of level $> k+2$. But this is impossible, since $\Gamma$ contains no such variables, nor can such a $w$ be bound within $t$, since the relevant subterm $\lambda \vec{w}.d$ would then properly contain $\lambda \vec{x}.e$, contradicting the choice of the latter. $\Box$ \end{proof} \vspace*{1.0ex} Let us now consider how the inductive clauses of Theorem~\ref{denotable-inductive-thm} may be used to generate \emph{regular} procedures-in-environment $\Gamma \vdash t$. The following gives a useful property of derivations involving these clauses: \begin{proposition} \label{regular-generation-prop} If $\Gamma \vdash t$ is regular and ${\mathrm{PCF}}^\Omega_k$-denotable, then any inductive generation of the denotability of $\Gamma \vdash t$ via the clauses of Theorem~\ref{denotable-inductive-thm} will consist entirely of regular procedures-in-environment. \end{proposition} \begin{proof} It suffices to observe that for each of the six inductive clauses (regarded as rules), if the conclusion is a regular procedure-in-environment then so are each of the premises. For clause 1, this is clearly the case because the $q_i$ are subterms of the procedure in the conclusion. For clause 2, we note that if $\lambda x.p$ is regular then so is $p$, and moreover $x$ has level $\leq k$ so that $\Gamma,x$ is regular. Clauses 3 and 4 are trivially handled. For clause 5, we not that if $\Gamma \vdash p[0 \vdash d, i+1 \mapsto e]$ is regular then $\Gamma \vdash p$, $\Gamma \vdash \lambda.d$ and $\Gamma \vdash \lambda.e$ are immediately regular by Proposition~\ref{regular-term-prop} (regardless of whether any leaves $0$ or $i+1$ appear in $p$). Likewise, for clause 6, we note that under the given hypotheses, both $\lambda z \vec{x}.e$ and each $q_i$ are of level $\leq k+1$; hence if $\Gamma$ is regular then immediately $\Gamma \vdash \lambda z \vec{x}.e$ and $\Gamma \vdash q_i$ are regular by Proposition~\ref{regular-term-prop}. $\Box$ \end{proof} \vspace*{1.0ex} In particular, let us consider again the construction of the procedure $Y_{k+1}$ as $\lambda g.F_{k+1}[g]$, where \[ F_{k+1}[g] ~=~ \lambda x^k.\;\caseof{g\,(F_{k+1}[g])\,x^\eta}{i \Rightarrow i} \;. \] It is clear by inspection that $g \vdash F_{k+1}[g]$ is regular; hence, if it were ${\mathrm{PCF}}^\Omega_k$-denotable, then Proposition~\ref{regular-generation-prop} would apply. We shall show, however, that a purely regular derivation via the clauses of Theorem~\ref{denotable-inductive-thm} cannot generate `spinal' terms such as $F_{k+1}[g]$; hence $g \vdash F_{k+1}[g]$ is not ${\mathrm{PCF}}^\Omega_k$-denotable. This will immediately imply that $Y_{k+1}$ itself is not ${\mathrm{PCF}}^\Omega_k$-denotable (Theorem~\ref{SP0-main-thm}), since the only means of generating non-nullary $\lambda$-abstractions is via clause 2 of Theorem~\ref{denotable-inductive-thm}. \section{${\mathrm{PCF}}^\Omega_k$-denotable procedures are non-spinal} \label{sec-Y-k+1} In this section, we will introduce the crucial notion of a \emph{($k\!+\!1$-)spinal term}, and will show that the clauses of Theorem~\ref{denotable-inductive-thm} (in the regular case) are unable to generate spinal terms from non-spinal ones. Since the procedure $F_{k+1}[g]$ will be easily seen to be spinal, this will establish Theorem~\ref{SP0-main-thm}. More specifically, we will actually introduce the notion of a \emph{$g$-spinal term}, where $g$ is a free variable which we treat as fixed throughout our discussion. We shall do this first for the case \[ g ~:~ (k+1) \rightarrow (k+1) \] as appropriate for the analysis of $F_{k+1}[g]$ and hence of $Y_{k+1}$. Later we will also consider a minor variation for $g$ of type $\nat \rightarrow (k+1) \rightarrow (k+1)$, as appropriate to the definition of $\Phi_{k+1}$ given in Section~\ref{sec-intro}. In both cases, we shall be able to dispense with the term `$k\!+\!1$-spinal', since the type level $k+1$ may be read off from the type of $g$. Some initial intuition for the concept of spinality was given in Section~\ref{sec-intro}. We now attempt to provide some further motivation by examining a little more closely the crucial difference between $Y_{k+1}$ and $Y_k$ (say) that we are trying to capture. The most obvious difference between these procedures is that $Y_{k+1}$ involves an infinite sequence of nested calls to a variable $g: (k+1) \rightarrow (k+1)$, whereas $Y_k$ does not. One's first thought might therefore be to try and show that no procedure involving an infinite nesting of this kind can be constructed using the means at our disposal corresponding to ${\mathrm{PCF}}^\Omega_k$ terms. As it stands, however, this is not the case. Suppose, for example, that ${\mathit{up}}_k: {k} \rightarrow {k+1}$ and ${\mathit{down}}_k: {k+1} \rightarrow {k}$ are ${\mathrm{PCF}}_0$ terms defining a standard retraction ${k} \lhd {k+1}$. More specifically, let us inductively define \[ \begin{array}{rclrcl} {\mathit{up}}_0 & = & \lambda x^0.\lambda z^0.x \;, & {\mathit{down}}_0 & = & \lambda y^1.\,y\,\num{0} \;, \\ {\mathit{up}}_{k+1} & = & \lambda x^{k+1}.\lambda z^{k+1}.\,x({\mathit{down}}_k\;z) \;, & {\mathit{down}}_{k+1} & = & \lambda y^{k+2}.\lambda w^{k}.\,y({\mathit{up}}_k\;w) \;. \end{array} \] Now consider the ${\mathrm{PCF}}_k$ program \[ Z_{k+1} ~=~ \lambda g: (k+1) \rightarrow (k+1).\; {\mathit{up}}_k\,(Y_k\,({\mathit{down}}_k \circ g \circ {\mathit{up}}_k)) \;. \] This is essentially just a representation of $Y_k$ modulo our encoding of type $k$ in type $k+1$. A simple calculation shows that the NSPs for $Y_{k+1}$ and $Z_{k+1}$ are superficially very similar in form, both involving an infinite sequence of nested calls to $g: (k+1) \rightarrow (k+1)$. (These NSPs are shown schematically in Figure~1 for the case $k=2$.) We will therefore need to identify some more subtle property of NSPs that differentiates between $Y_{k+1}$ and $Z_{k+1}$. \begin{figure} \label{Y_Z_NSPs} \begin{center} \includegraphics[scale=.60]{Y_Z_NSPs.pdf} \end{center} \caption{The NSPs for $Y_3$ and $Z_3$. Here $\lambda.z$ abbreviates $\lambda.\,\caseof{z}{i \Rightarrow i}$.} \vspace*{1.0ex} \end{figure} The intuitive idea will be that in the NSP for $Z_{k+1}$, the full potency of $g$ as a variable of type ${k+1} \rightarrow {k+1}$ is not exploited, since both the input and output of $g$ are `funnelled' through the simpler type ${k}$. Such funnelling will inevitably entail some loss of information, as Theorem~\ref{no-retraction-thm} tells us that the type ${k}$ cannot fully represent the structure of the type ${k+1}$. A useful mental picture here is that of a $(k+1)$-dimensional space being `flattened' down to a $k$-dimensional one. Broadly speaking, then, we shall want to define a $g$-spinal term to be one containing an infinite sequence of nested calls to $g$ but with no essential `flattening' of the arguments. It will then be the case that $Y_{k+1}$ is $g$-spinal, but $Z_{k+1}$ is not. We now approach the formal definition of a $g$-spinal term, generalizing the structure exhibited by the terms $F_{k+1}[g]$. To get our bearings, let us examine the form of these terms one more time. Note that $F_{k+1}[g]$ has the form $\lambda x^k. H[g,x]$, where \[ H[g,x] ~=~ \caseof{g(\lambda x'.H[g,x']) x^\eta}{\cdots} \;. \] Spinal expressions of this kind, in which the topmost $g$ of the spine appears at the very head of the expression, will be referred to as \emph{head-spinal}. In fact, we shall say that $H[g,x]$ is head-spinal with respect to the variable $x$, since as noted above, it is significant here that $x$ is passed to $g$ with no `flattening' (in the form of the procedure $x^\eta$). As a first attempt, then, one might hazard that we should define a concept of head-spinality relative to a type $k$ variable coinductively as follows: an expression $e$ is $g$-head-spinal w.r.t.\ $x$ if it is of the form \[ \caseof{g(\lambda x'.e')x^\eta}{\cdots} \] where $e'$ is itself $g$-head-spinal w.r.t.\ $x$. In fact, in order for the set of non-spinal terms to have appropriate closure properties, we shall need to relax this definition in two ways. Firstly, we allow $\lambda x'.e'$ to be replaced by $\lambda x'.E[e']$ where $E[-]$ is any expression context: that is, we allow the head-spinal subterm $e'$ to appear at positions other than the head of this procedure. Secondly, we allow $x^\eta$ to be replaced by a procedure term $o$ that can be \emph{specialized} to (something close to) $x^\eta$: the intuition is that any such $o$ will embody the whole content of $x$ with no flattening. This leads us, at last, to the following definition. Note that this makes reference to the technical notion of an \emph{$x,V$-closed substitution}, the explanation of which we shall defer to Definition~\ref{xV-closed-def} below. This entails that the notion of head-spinality needs to be defined relative to a certain set $V$ of variables as well as a type $k$ variable $x$. We shall adopt the convention that any environment denoted by $\Gamma$ will be $g$-regular (and hence will contain $g$); recall that Roman letters such as $V,X,Z$ always denote lists of variables of level $\leq k$ (which may also contribute to the environments we consider). \begin{definition}[Spinal terms] \label{spinal-def} Suppose $g$ has type $(k+1) \rightarrow (k+1)$. Suppose $\Gamma \vdash e$ is $g$-regular, and that $x^k \in \Gamma$ and $V \subseteq \Gamma$. (i) In this situation, we coinductively declare $e$ to be \emph{$g$-head-spinal with respect to $x,V$} iff $e$ has the form \[ \caseof{g(\lambda {x'}. E[e']) o}{\cdots} \] where $E[-]$ is an expression context, and \begin{enumerate} \item for some $x,\!V$-closed substitution $^\circ$ covering the free variables of $o$ other than $x$, we have $o^\circ \succeq x^\eta$, \item $e'$ is $g$-head-spinal with respect to $x',V'$, where $V'$ is the local variable environment for $E[-]$. (Clearly $e'$ will automatically be $g$-regular in some $\Gamma'$ that contains both $x'$ and $V'$.) \end{enumerate} In other words, we take `$e$ is $g$-head-spinal w.r.t.\ $x,V$' to be the largest relation that satisfies the above statement. (ii) In the above setting, we may also refer to the application $g(\lambda {x'}. E[e']) o$ itself as $g$-head-spinal w.r.t.\ $x,V$. (iii) We say a term $t$ is \emph{$g$-spinal} if it contains a subexpression that is $g$-head-spinal w.r.t.\ some $x,V$. \end{definition} Whilst this definition makes use of local variable environments which in principle pertain to concrete terms, it is easily seen that the notion of $g$-spinal term is $\alpha$-invariant. Since we are taking $g$ to be fixed throughout the discussion, we will usually omit mention of it and speak simply of spinal and head-spinal terms, and of regular (meta-)terms and environments. In condition~1, one might have expected to see $o^\circ \approx x^\eta$, but it turns that the argument goes through most smoothly with $\succeq$ in place of $\approx$. In Appendix~A we will see that $o^\circ \succeq x^\eta$ is actually equivalent to $o^\circ \approx x^\eta$, although this is somewhat non-trivial to show and is not needed for our main proof. It remains to define the notion of an $x,V$-closed substitution. Suppose that $^\circ = [\vec{w} \mapsto \vec{r}\,]$ is some substitution proposed for use in condition 1 of Definition~\ref{spinal-def}(i). Since we are wishing to compare $o^\circ$ with $x^\eta$, it is natural to require that the $\vec{r}$ contain no free variables other than $x$. However, what we want to ensure here is intuitively that the whole unflattened content of $x$ is present in $o$ itself rather than simply being introduced by the substitution. This can be ensured if we allow $x$ as a free variable only in procedures $r_i$ of type level $<k$: such procedures can only introduce `flattened' images of $x$, since the $x$ is here being funnelled through a type of level $\leq k-1$. For technical reasons, we furthermore need to restrict such occurrences of $x$ to those $r_i$ substituted for variables $w_i$ in a certain set $V$, which in practice will consist of variables bound between one spinal occurrence of $g$ and the next (as can be seen from the specification of $V'$ above). The necessity for the set $V$ is admittedly difficult to motivate at this point: it is simply what the details of the proof seem to demand (see the last page of the proof of Lemma~\ref{g-lemma-2}). \begin{definition} \label{xV-closed-def} If $x$ is a variable of type $k$ and $V$ a set of variables, a substitution $^\circ = [\vec{w} \mapsto \vec{r}\,]$ is called \emph{$x,\!V$-closed} if the $r_i$ contain no free variables, except that if $w_i \in V$ and ${\mathrm{lv}}(w_i)<k$ then $r_i$ may contain $x$ free. \end{definition} It is worth remarking that if we were only interested in showing the non-definability of $Y_{k+1}$ as an element of ${\mathsf{SP}}^0$, one could do without the notion of $x,\!V$-closedness altogether, and more simply require in Definition~\ref{spinal-def} that $^\circ$ is closed (and moreover that $\dang{\!o^\circ\!}\, = x^\eta$ on the nose). The weaker definition we have given is designed with the proof of non-definability in ${\mathsf{SF}}$ in mind: we will be able to show in Section~\ref{sec-extensional} that every (simple) procedure representing the functional $\Phi_{k+1} \in {\mathsf{SF}}$ is spinal in this weaker sense.% \footnote{It can be shown using Theorem~\ref{no-retraction-thm} that if $o^\circ \succeq x^\eta$ where $^\circ$ is $x,\!V$-closed, then at least one $x$ in $\dang{\!o^\circ\!}$ must originate from $o$ rather than from $^\circ$. We have not actually settled the question of whether there are procedures $o$ such that $o^\circ \succeq x^\eta$ for some $x,\!V$-closed $^\circ$ but not for any closed $^\circ$; fortunately this is not necessary for the purpose of our proof.} We now digress briefly to explain the small modification of this machinery that we will need in Section~\ref{sec-extensional}. Since our purpose there will be to analyse the functional $\Phi_{k+1}$ which we defined in Section~\ref{sec-intro}, we shall be working in a setup in which the global variable $g$ has the slightly different type ${0}\rightarrow(k+1)\rightarrow(k+1)$. In this setting, we may vary the above definition by coinductively declaring $e$ to be $g$-head-spinal w.r.t.\ $x,V$ iff $e$ has the form \[ \caseof{gb(\lambda x'. E[e']) o}{\cdots} \] where $b$ is a procedure term of type ${0}$ and conditions~1 and 2 above are also satisfied. Subject to this adjustment, all the results and proofs of the present section go through in this modified setting, with the extra argument $b$ playing no active role. For the remainder of this section, we shall work with a global variable $g$ of the simpler type $(k+1) \rightarrow (k+1)$, on the understanding that the extra arguments $b$ can be inserted where needed to make formal sense of the material in the modified setting. We do not expect that any confusion will arise from this. Clearly $g \vdash F_{k+1}[g]$ is spinal. The main result of this section will be that every ${\mathrm{PCF}}^\Omega_k$-denotable procedure $\Gamma \vdash p$ is non-spinal (Theorem~\ref{no-gremlin-thm}). We shall establish this by induction on the generation of denotable terms as in Theorem~\ref{denotable-inductive-thm}, the only challenging case being the one for rule~6, which involves plugging. Here we require some technical machinery whose purpose is to show that if the result of a plugging operation is spinal, then a spinal structure must already have been present in one of the components of the plugging: there is no way to `assemble' a spinal structure from material in non-spinal fragments. The core of the proof will consist of some lemmas developing the machinery necessary for tackling rule 6. We start with some technical but essentially straightforward facts concerning evaluation and the tracking of subterms and variable substitutions. \begin{lemma} \label{g-lemma-1} Suppose that \[ \Gamma \;\vdash\; \dang{K[d]} \;=_\alpha\; K'[c] \] where $K[-],K'[-]$ are concrete meta-term contexts with local environments $\vec{v},\vec{v}\,'$ respectively, and $\Gamma,\vec{v} \vdash d = \caseof{gpq}{\cdots}$, $\Gamma,\vec{v}\,' \vdash c = \caseof{gp'q'}{\cdots}$ are concrete expressions. Suppose also that: \begin{enumerate} \item $\Gamma \vdash K[d]$ is regular; \item in the evaluation above, the head $g$ of $c$ originates from that of $d$. \end{enumerate} Then: (i) There is a substitution $^\dag = [\vec{v}\mapsto\vec{s}\,]$ of level $\leq k$ arising from the $\beta$-reductions in the above evaluation, with $\Gamma,\vec{v}\,' \vdash \vec{s}$ regular, such that $\Gamma,\vec{v}\,' \vdash gp'q' =_\alpha \,\dang{\!(gpq)^\dag\!}$, whence $\dang{\!d^\dag\!}$ is of form $\caseof{gp'q'}{\cdots}$ up to $=_\alpha$.% \footnote{Note that although both $\dang{\!d^\dag\!}$ and $c$ have the form $\caseof{gp'q'}{\cdots}$, they will in general have different case-branches, for instance when $K[-]$ is of the form $\caseof{-}{\cdots}$.} (ii) If furthermore $c$ is head-spinal w.r.t.\ some $x,V$, then also $\dang{d^\dag}$ is head-spinal w.r.t.\ $x,V$. (iii) If $K[-]$ contains no $\beta$-redexes $P \vec{Q}$ with $P$ of type level $k+1$, then $^\dag$ is \emph{trivial for level $k$ variables}: that is, there is an injection $\iota$ mapping each level $k$ variable $v_i \in \vec{v}$ to a variable $\iota(v_i) \in \vec{v}\,'$ such that $s_i = \iota(v_i)^\eta$. \end{lemma} In reference to part~(iii), recall that substitutions $v \mapsto v^\eta$ have no effect on the meaning of a term, as established by Lemma~\ref{eta-properties}. Note that the environments $\vec{v},\vec{v}\,'$, and hence the injection $\iota$, will in general depend on the concrete choice of $K[d]$ and $K'[c]$. However, for the purpose of proving the theorem, it is clearly harmless to assume that $K'[c]$ is, on the nose, the concrete term obtained by evaluating $K[d]$. In this case, we will see from the proof below that each $\iota(v_i)$ will be either $v_i$ itself or a renaming of $v_i$ arising from the evaluation. \vspace*{1.0ex} \begin{proof} (i) We first formulate a suitable property of terms that is preserved under all individual reduction steps. Let $K[-],d,p,q$ and $\vec{v}$ be fixed as above, and suppose that \[ K^0[\caseof{gP^0Q^0}{\cdots}] ~\rightsquigarrow~ K^1[\caseof{gP^1Q^1}{\cdots}] \] via a single reduction step, where the $g$ on the right originates from the one on the left, and moreover $K^0,P^0,Q^0$ enjoy the following properties (we write $\vec{v}\,^0$ for the local environment for $K^0[-]$): \begin{enumerate} \item $\Gamma \vdash K^0[\caseof{gP^0Q^0}{\cdots}]$ is regular. \item There exists a substitution $^{\dag0} = [\vec{v}\mapsto\vec{s}\,^0]$ (with $\Gamma,\vec{v}\,^0 \vdash \vec{s}\,^0$ regular) such that $\dang{gP^0Q^0} \,=_\alpha\, \dang{(gpq)^{\dag 0}}$. \end{enumerate} We claim that $K^1,P^1,Q^1$ enjoy these same properties w.r.t.\ the local environment $\vec{v}\,^1$ for $K^1[-]$. For property~1, clearly $K^1[\caseof{gP^1Q^1}{\cdots}]$ cannot contain variables of level $>k$ other than $g$, because $K^0[\caseof{gP^0Q^0}{\cdots}]$ does not. For property~2, we define the required substitution $^{\dag1} = [\vec{v}\mapsto\vec{s}\,^1]$ by cases according to the nature of the reduction step: \begin{itemize} \item If the subexpression $\caseof{gP^0Q^0}{\cdots}$ is unaffected by the reduction (so that $P^0=P^1$ and $Q^0=Q^1$), or if the reduction is internal to $P^0,Q^0$ or to the rightward portion $(\cdots)$, or if the reduction has the form \begin{eqnarray*} \caseof{(\caseof{gP^0Q^0}{i \Rightarrow E^0_i})}{j \Rightarrow F_j} & \rightsquigarrow & \\ \caseof{gP^0Q^0}{i \Rightarrow \caseof{E^0_i}{j \Rightarrow F_j}} \end{eqnarray*} then the conclusion is immediate, noting that $\vec{v}\,^1 = \vec{v}\,^0$ and taking $^{\dag 1}=\,^{\dag 0}$. \item If the reduction is for a $\beta$-redex $(\lambda \vec{x}.E)\vec{R}$ where the indicated subexpression $\caseof{gP^0Q^0}{\cdots}$ lies within some $R_i$, we may again take $^{\dag 1}$ to be $^{\dag 0}$, with obvious adjustments to compensate for any renaming of bound variables within $R_i$ or $\vec{s}\,^0$. In this case $\vec{v}\,^1$ may contain more variables than $\vec{v}\,^0$, but we will still have that $\Gamma,\vec{v}\,^1 \vdash \vec{s}\,^1$ once these renamings have been effected. \item If the reduction is for a $\beta$-redex $(\lambda \vec{x}.E)\vec{R}$ where $\caseof{gP^0Q^0}{\cdots}$ lies within $E$, then $P^1 = P^0[\vec{x} \mapsto \vec{R}\,']$ and $Q^1 = Q^0[\vec{x} \mapsto \vec{R}\,']$ for some $\vec{R}\,' =_\alpha \vec{R}$. In this case, the local environment $\vec{v}\,^1$ for $K^1[-]$ will be $\vec{v}\,^0 - \vec{x}$ (perhaps modulo renamings of the $v^0_i$), so that the conclusion follows if we take $^{\dag 1} = [\vec{v}\mapsto\vec{s}\,^1]$ where $s_i^1 = \dang{s_i^0 [\vec{x}\mapsto\vec{R}\,']}$ for each $i$ (modulo the same renamings). Note here that $\Gamma,\vec{v}\,^1 \vdash \vec{s}\,^1$ is regular since $\vec{R}$ is regular by condition~1 of the hypothesis. \end{itemize} Now in the situation of the lemma we will have some finite reduction sequence \[ K[\caseof{gpq}{\cdots}] ~\rightsquigarrow^*~ K''[\caseof{gP'Q'}{\cdots}] \;, \] where, intuitively, $K''[-]$ is fully evaluated down as far as the hole. More formally, there is a finite normal-form context $t[-] \sqsubseteq K''[-]$ containing the hole in $K''[-]$ such that $t[-] \sqsubseteq K'[-]$; from this we may also see that $\dang{\!P'\!}\,=p'$, $\dang{\!Q'\!}\,=q'$ and $\dang{\!K''[-]\!}\,=K'[-]$. Moreover, we now see that $K,p,q$ themselves trivially satisfy the above invariants if we take $^\dag = [\vec{v} \mapsto \vec{v}\,^\eta]$ (Lemma~\ref{eta-properties} is used here). We therefore infer by iterating the argument above that $K'',P',Q'$ also satisfy these invariants with respect to some $^\dag = [\vec{v} \mapsto \vec{s}\,]$ with $\Gamma,\vec{v}\,' \vdash \vec{s}$ regular. (The environment $\Gamma,\vec{v}\,'$ is correct here, as $K'[-],K''[-]$ have the same local environment.) We now have $gp'q' =\, \dang{gP'Q'} \,=_\alpha\, \dang{(gpq)^\dag}$. That the $\vec{v}$ are of level $\leq k$ is automatic, because $K[d]$ is regular. It also follows immediately that $\dang{\!d^\dag\!}$ has the stated form. (ii) If $c$ is head-spinal w.r.t.\ $x,V$, then we see from Definition~\ref{spinal-def} that $gp'q'$ and hence $\dang{d^\dag} \,= \caseof{gp'q'}{\cdots}$ are head-spinal w.r.t.\ $x,V$. (iii) From the proof of (i), we see that in the reduction of $K[\caseof{gpq}{\cdots}]$ to $K''[\caseof{gP'Q'}{\cdots}]$, any $v_i \in \vec{v}$ can be tracked through the local environments for the intermediate contexts $K^0[-],K^1[-],\ldots$ until (if ever) it is a substitution variable for a $\beta$-reduction. For those $v_i$ that never serve as such a variable, it is clear from the construction that $v_i$ gives rise to some variable $\iota(v_i) \in \vec{v}\,'$ (either $v_i$ itself or a renaming thereof), and that $s_i = v_i^\dag = \iota(v_i)^\eta$. We wish to show that all $v_i \in \vec{v}$ of level $k$ are in this category. Recalling that $\vec{v}$ is the local environment for $K[-]$, any $v_i \in \vec{v}$ of level $k$ is bound by the leading $\lambda$ of some meta-procedure $P$ within $K[-]$ of level $k+1$. By hypothesis, this $P$ does not occur in operator position; nor can it occur as an argument to another $\lambda$-abstraction within $K[-]$, since this would require a bound variable of level $\geq k+1$. It must therefore occur as a level $k+1$ argument to $g$, so that we have a subterm $g(\lambda v_i.E[-])\cdots$. But this form of subterms is stable under reductions, since $g$ is a global variable; it follows easily that this subterm has a residual $g(\lambda v_i'.E'[-])\cdots$ in each of the intermediate reducts (where $v_i'$ is either $v_i$ or a renaming thereof), and thus that $v_i$ and renamings thereof never serve as substitution variables for $\beta$-reductions. $\Box$ \end{proof} \vspace*{1.0ex} Thus, in the setting of the above lemma, if $c$ is head-spinal then $d$ can be specialized and evaluated to yield a head-spinal term via the substitution $[\vec{v} \mapsto \vec{s}\,]$. However, we wish to show more, namely that in this setting, $d$ itself is already a spinal term, so that the $\vec{s}$ make no essential contribution to the spinal structure. (This will give what we need in order to show that $k$-pluggings cannot manufacture spinal terms out of non-spinal ones.) This is shown by the next lemma, whose proof forms the most complex and demanding part of the entire argument. The main challenge will be to show that all the head-spinal occurrences of $g$ in $\dang{d[\vec{v} \mapsto \vec{s}\,]}$ originate from $d$ rather than from $\vec{s}$. The reader is advised that great care is needed as regards which variables can appear free where, and for this reason we shall make a habit of explicitly recording the variable environment for practically every term or meta-term that we mention. \begin{lemma} \label{g-lemma-2} Suppose we have regular terms \[ \Gamma,\vec{v} \;\vdash~ d ~=~ \caseof{gpq}{\cdots} \;, ~~~~~~ \Gamma,\vec{v}\,' \vdash \vec{s} \;, ~~~~~~ {\mathrm{lv}}(\vec{v}), {\mathrm{lv}}(\vec{v}\,') \leq k \;, \] where $\Gamma,\vec{v}\,' \vdash\, \dang{d[\vec{v}\mapsto\vec{s}\,]}$ is head-spinal with respect to some $x,V$. Then $d$ itself is spinal. \end{lemma} \begin{proof} We begin with some informal intuition. The term $\dang{d[\vec{v}\mapsto\vec{s}\,]}$, being head-spinal, will be of the form \[ \Gamma,\vec{v}\,' \;\vdash~ t ~=~ \caseof{g\,(\lambda x'.\,E[\caseof{gF'o'}{\cdots}])\,o}{\cdots} \;, \] where ${o'}^\circ \succeq {x'}^\eta$ for some $^\circ$ (and likewise for $o$ and $x$). Here the head $g$ of $t$ clearly originates from that of $d$; likewise, the $\lambda x'$ originates from the leading $\lambda$ of $p$ within $d$, rather than from $\vec{s}$. Suppose, however, that the second displayed spinal occurrence of $g$ in $t$ originated from some $s_i$ rather than from $d$. In order to form the application of this $g$ to $o'$, the whole content of ${x'}^\eta$ would in effect need to be passed in to $s_i$ when $d$ and $\vec{s}$ are combined. But this is impossible, since the arguments to $s_i$ are of level $<k$, so by Theorem~\ref{no-retraction-thm} we cannot funnel the whole of ${x'}^\eta$ through them: that is, the interface between $d$ and $\vec{s}$ is too narrow for the necessary interaction to occur. (The situation is made slightly more complex by the fact that some components of $^\circ$ might also involve $x'$, but the same idea applies.) It follows that the second spinal $g$ in $t$ originates from $d$ after all. By iterating this argument, we can deduce that all the spinal occurrences of $g$, and indeed the entire spinal structure, comes from $d$. We now proceed to the formal proof. By renaming variables if necessary, we may assume for clarity that the same variable is never bound in two places within the entire list of terms $d,\vec{s}$, and that all bound variables within $d,\vec{s}$ are distinct from those of $\vec{v}$ and $\vec{v}\,'$. Let $^\dag = [\vec{v}\mapsto\vec{s}\,]$, and let us write the subterm $p$ appearing within $d$ as $\Gamma,\vec{v} \vdash \lambda {x'}^k.e$, where $\Gamma,\vec{v},x' \vdash e$ is regular. Then \[ \dang{d^\dag} ~=~ \caseof{g\,(\lambda x'.\!\dang{e^\dag})\dang{q^\dag}}{\cdots} \;, \] and since $\dang{\!d^\dag\!}$ is head-spinal by hypothesis, $\dang{\!{e}^\dag\!}$ will be some term $\Gamma,x',\vec{v}\,' \vdash E[c]$, where $\Gamma,x',\vec{v}\,',\vec{y}\,' \vdash c~=~ \caseof{gF'o'}{\cdots}$ is itself head-spinal with respect to $x'$ and $\vec{y}\,'$. (Here $\vec{y}\,'$ denotes the local environment for $E[-]$, so that $\Gamma,x',\vec{v}\,',\vec{y}\,'$ contains no repetitions.) We will first show that the head $g$ of $c$ comes from $e$ rather than from $^\dag$; we will later show that the same argument can be repeated for lower spinal occurrences of $g$. \vspace*{1.0ex} \emph{Claim 1: In the evaluation $\dang{\!e^\dag\!} \,= E[c]$, the head $g$ of $c$ originates from $e$.} \vspace*{1.0ex} \emph{Proof of Claim 1:} Suppose for contradiction that the head $g$ of $c$ originates from some substituted occurrence of an $s_i$ within ${e}^\dag$, say as indicated by ${e}^\dag = D[s_i]$ and $s_i = L[d']$, where $\Gamma,x',\vec{v}\,' \vdash D[-]$, $\Gamma,\vec{v}\,' \vdash s_i$, and $\Gamma,\vec{v}\,',\vec{z} \vdash d' = \caseof{gp'q'}{\cdots}$. (Here $\vec{z}$ is the local variable environment for $L[-]$; note that $\vec{z}$ is disjoint from $\Gamma,x',\vec{v}\,'$, but may well overlap with $\vec{y}\,'$.) Then \[ \Gamma,x',\vec{v}\,' \;\vdash~ \dang{\!e^\dag\!} ~=~ \dang{D[L[d']]} ~=~ E[c] \;, \] where the head $g$ in $d'$ is the origin of the head $g$ in $c$. We will use this to show that a head-spinal term may be obtained from $d'$ via a substitution of level $< k$; this will provide the bottleneck through which ${x'}^\eta$ is unable to pass. We first note that the above situation satisfies the conditions of Lemma~\ref{g-lemma-1}, where we take the $\Gamma,K,d,K',c$ of the lemma to be respectively $(\Gamma,x',\vec{v}\,'),$ $D[L[-]],d',E,c$. Condition~1 of the lemma holds because $\Gamma,\vec{v},x' \vdash e$ and $\Gamma,\vec{v}\,' \vdash \vec{s}$ are clearly regular, whence so is $\Gamma,x',\vec{v} \vdash e^\dag = D[L[d']]$; condition~2 is immediate in the present setup. We conclude that there is a substitution $[\vec{y}\mapsto\vec{t}\,]$ (called $[\vec{v}\mapsto\vec{s}\,]$ in the statement of Lemma~\ref{g-lemma-1}) with $\vec{y}$ the local environment for $D[L[-]]$ and $\Gamma,x',\vec{v}\,',\vec{y}\,' \vdash \vec{t}$ (recalling that $\vec{y}\,'$ are the local variables for $E[-]$), such that $\dang{d'[\vec{y}\mapsto\vec{t}\,]}$ is head-spinal and indeed of the form $\caseof{gF'o'}{\cdots}$ with $F',o'$ as above. Furthermore, the only $\beta$-redexes in $e^\dag$ are those arising from the substitution $^\dag$, with some $s_j$ of level $k$ as operator. There are therefore no $\beta$-redexes in $e^\dag$ with a substitution variable of level $k$, so by Lemma~\ref{g-lemma-1}(iii), the substitution $[\vec{y} \mapsto \vec{t}\,]$ is trivial for variables of level $k$. Note also that $\vec{y}$ (the environment for $D[L[-]]$) subsumes $\vec{z}$ (the environment for $L[-]$); it is disjoint from $\Gamma,x,\vec{v}\,'$ but may well overlap with $\vec{y}\,'$. Let us now split the substitution $[\vec{y} \mapsto \vec{t}\,]$ as $[\vec{y}\,^+ \mapsto \vec{t}\,^+, \, \vec{y}\,^- \mapsto \vec{t}\,^-]$, where $\vec{y}\,^+$ consists of the variables in $\vec{y}$ of level $k$, and $\vec{y}\,^-$ consists of those of level $<k$. As we have noted, the substitution for $\vec{y}\,^+$ is trivial: that is, there is a mapping associating with each $y_j \in \vec{y}\,^+$ a variable $\iota(y_j) \in \vec{y}\,'$ such that $t_j = \iota(y_j)^\eta$. Taking stock, we have that \begin{eqnarray*} \Gamma,x',\vec{v}\,',\vec{y}\,' & \vdash & \dang{d'[\vec{y} \mapsto \vec{t}\,]} ~=~ \caseof{gF'o'}{\cdots} \;, \\ \Gamma,\vec{v}\,',\vec{z} & \vdash & d' = \caseof{gp'q'}{\cdots} \;, \\ \Gamma,x',\vec{v}\,',\vec{y}\,' & \vdash & \vec{t} \;, \end{eqnarray*} where $[\vec{y}\mapsto\vec{t}\,]$ is trivial for level $k$ variables, and $gF'o'$ is head-spinal w.r.t.\ $x,\vec{y}\,'$. From this we may read off that \[ \Gamma,x',\vec{v}\,',\vec{y}\,' \;\vdash\; \dang{q'[\vec{y} \mapsto \vec{t}\,]} ~=~ o' \;. \] Since $\vec{y}$ subsumes $\vec{z}$, we may henceforth regard $q'$ as a term in environment $\Gamma,\vec{v}\,',\vec{y}$. (This is compatible with the no-variable-hiding condition: our conventions ensure that the variables of $\vec{y}-\vec{z}$ come from $d$ rather than $s_i$ and so do not appear bound in $q'$.) We may harmlessly write $q'[\vec{y} \mapsto \vec{t}\,]$ as above, even though there are variables of $\vec{y}$ that cannot appear in $q'$. Since $x'$ does not occur free in $q'$, each free occurrence of $x'$ in $o'$ above must originate from some $t_j \in \vec{t}$, which must furthermore have some type $\rho_j$ of level $<k$, since if $t_j$ had level $k$ then we would have $t_j = \iota(y_j)^\eta$ which does not contain $x'$ free. In fact, we may decompose the substitution $[\vec{y} \mapsto \vec{t}\,]$ as $[\vec{y}\,^+ \mapsto \iota(\vec{y}\,^+)^\eta]$ followed by $[\vec{y}\,^- \mapsto \vec{t}\,^-]$, since none of variables of $\vec{y}\,^-$ appear free in the $\iota(y_j)^\eta$ for $y_j \in \vec{y}\,^+$. Setting $q'^* =\, \dang{q[\vec{y}\,^+ \mapsto \iota(\vec{y}\,^+)^\eta]}$ (so that $q'^*$ is just $q'$ with the variables in $\vec{y}\,^+$ rewritten via $\iota$), we therefore have $\dang{q'^*[\vec{y}\,^- \mapsto \vec{t}\,^-]}\, = o'$. Thus: \begin{eqnarray*} \Gamma,\vec{v}\,',\iota(\vec{y}\,^+),\vec{y}\,^- & \vdash & q'^* : \pure{k} \;, \\ \Gamma,x,\vec{v}\,',\vec{y}\,' & \vdash & t_j : \rho_j \mbox{~~~for $t_j \in \vec{t}\,^-$} \;, \\ \Gamma,x,\vec{v}\,',\vec{y}\,' & \vdash & \dang{q'^* [\vec{y}\,^- \mapsto \vec{t}\,^-]} ~=~ o' \;. \end{eqnarray*} Since $o'^\circ \succeq {x'}^\eta$ for a suitable $x',\vec{y}\,'$-closed substitution $^\circ$ (as part of the fact that $\dang{\!d^\dag\!}$ is head-spinal), the above already comes close to exhibiting $\pure{k}$ as a pseudo-retract of a level $<k$ product type, contradicting Theorem~\ref{no-retraction-thm}. To complete the argument, we must take account of the effect of $^\circ$, which we here write as $[\vec{w}\mapsto\vec{r}\,]$ (we may assume that $\vec{w}$ is exactly $\Gamma,\vec{v}\,',\vec{y}\,'$). Reordering our variables, we may now write $x,\vec{w} \vdash \vec{t}\,^-$. Next, let us split $^\circ$ into two independent parts: a substitution $[\vec{w}\,^+\mapsto\vec{r}\,^+]$ covering the variables in $\Gamma,\vec{v}\,',\vec{y}\,'$ of level $\geq k$, and $[\vec{w}\,^-\mapsto\vec{r}\,^-]$ covering those of level $<k$. Since $^\circ$ is $x',\vec{y}\,'$-closed, we have $\vdash \vec{r}\,^+$ and $x' \vdash \vec{r}\,^-$. Now set ${q'}^\wr =\, \dang{{q'^*}[\vec{w}\,^+\mapsto\vec{r}\,^+]}$, so that $\vec{u}\,^- \vdash {q'}^\wr$ where $\vec{u}\,^-$ consists of the variables of $\Gamma,\vec{v}\,',\vec{y}$ of level $<k$. The idea is that $\vec{u}\,^- \vdash {q'}^\wr$ may now serve as one half of a suitable pseudo-retraction. For the other half, let $[\vec{u}\,^- \mapsto \vec{a}\,^-]$ denote the effect of the substitution $[\vec{y}\,^- \mapsto \vec{t}\,^-]$ followed by $^\circ =[\vec{w} \ \mapsto \vec{r}\,]$ (the order is important here as $\vec{y}\,^-$ and $\vec{w}$ may overlap). Since $\vec{u}\,^- \subseteq \vec{y} \cup \vec{w}$ and $x,\vec{w} \vdash \vec{t}\,^-$ and $x \vdash \vec{r}$, this substitution does indeed cover at least the variables of $\vec{u}\,^-$ and we have $x \vdash \vec{a}\,^-$. We may now verify that $\vec{u}\,^- \vdash {q'}^\wr$ and $x \vdash \vec{a}\,^-$ constitute a pseudo-retraction as follows: \begin{eqnarray*} x' & \vdash & \dang{{q'}^\wr [\vec{u}\,^- \mapsto \vec{a}\,^-]} \\ & = & \dang{q'^* [\vec{w}\,^+ \mapsto \vec{r}\,^+] [\vec{y}\,^- \mapsto \vec{t}\,^-] [\vec{w} \ \mapsto \vec{r}\,]} \\ & = & \dang{(q'^* [\vec{y}\,^- \mapsto \vec{t}\,^-]) [\vec{w} \ \mapsto \vec{r}\,] } \\ & = & \dang{{o'}^\circ} ~\succeq~ {x'}^\eta \;. \end{eqnarray*} As regards the second equation here, the first substitution $[\vec{w}\,^+ \mapsto \vec{r}\,^+]$ may be safely omitted as $\vec{w}\,^+$ and $\vec{y}\,^-$ are disjoint and the terms $\vec{r}\,^+$ do not contain any of the $\vec{w}\,^+$ or $\vec{y}\,^-$ free. We therefore have $\pure{k}$ as a pseudo-retract of a product of level $<k$ types. This contradicts Theorem~\ref{no-retraction-thm}, so the proof of Claim 1 is complete. \vspace*{1.0ex} We may therefore suppose that in the evaluation $\dang{\!e^\dag\!} = E[c]$, the originating occurrence of the head $g$ in $c$ is as indicated by $\Gamma,x',\vec{v} \vdash e = C[d']$, where $\Gamma,x',\vec{v},\vec{v}\,'' \vdash d' =\caseof{gp'q'}{\cdots}$. (Here $\vec{v}\,''$ is the local environment for $C[-]$. The symbols $d',p',q'$ are available for recycling now that the proof of Claim~1 is complete.) In order to continue our analysis to greater depth, note that we may write \[ \Gamma,x',\vec{v}\,' \vdash~ \dang{\!e^\dag\!} ~=~ \dang{(\lambda \vec{v}.\,C[d'])\vec{s}} ~=~ E[c] \;, \] where $c$ is head-spinal w.r.t.\ $x',\vec{y}\,'$, and the head $g$ of $d'$ is the origin of the head $g$ of $c$. (Recall that $\vec{y}\,'$ is the local environment for $E[-]$ and that $\Gamma,x',\vec{v} \vdash e = C[d']$ is regular, whence ${\mathrm{lv}}(\vec{v}\,'') \leq k$.) We claim that once again we are in the situation of Lemma~\ref{g-lemma-1}, taking $\Gamma,K,d,K',c$ of the lemma to be respectively $(\Gamma,x',\vec{v}\,')$, $(\lambda \vec{v}.\,C[-])\vec{s}$, $d', E, c$. Condition~2 of the lemma is immediate in the present setup; for condition~1, we again note that $\Gamma,x',\vec{v}\,' \vdash C[d'] = e$ and $\Gamma,\vec{v}\,' \vdash \vec{s}$ are regular, so by Proposition~\ref{regular-term-prop} contain no bound variables of level $>k$; hence the same is true for $(\lambda \vec{v}.\,C[d'])\vec{s}$. Applying Lemma~\ref{g-lemma-1}, we obtain a substitution $^{\dag'} = [\vec{v}\,^+ \mapsto \vec{s}\,^+]$ of level $\leq k$ (with $\vec{v}\,^+ = \vec{v},\vec{v}\,''$), where $\Gamma,x',\vec{v}\,',\vec{v}\,^+ \vdash d'$ and $\Gamma,x',\vec{v}\,',\vec{y}\,' \vdash \vec{s}\,^+$ are regular, such that \[ \Gamma,x',\vec{v}\,',\vec{y}\,' \;\vdash\; \dang{d'[\vec{v}\,^+\!\mapsto\!\vec{s}\,^+]} \] is head-spinal w.r.t.\ $x',\vec{y}\,'$, and indeed of the form $\caseof{gF'o'}{\cdots}$ with $F',o'$ as above. (We may in fact write just $\Gamma,x',\vec{v}\,^+ \vdash d'$ since, by assumption, the variables of $\vec{v}\,'$ do not overlap with the free or bound variables of $d$ so do not appear in $d$.) We may also read off that $\dang{(p')^{\dag'}} \,= F'$ and $\dang{(q')^{\dag'}} \,= o'$. As regards the substitution $^{\dag'} = [\vec{v}\,^+ \mapsto \vec{s}\,^+]$, it is clear that this extends $ [\vec{v} \mapsto \vec{s}\,]$ since the evaluation of $(\lambda \vec{v}.\,C[d'])\vec{s}$ starts by $\beta$-reducing this term. Moreover, the argument of Lemma~\ref{g-lemma-1}(iii) shows that $^{\dag'}$ is trivial for any level $k$ variables in $\vec{v}\,''$, as $C[-]$ is in normal form. We are now back precisely where we started, in the sense that $d',\vec{v}\,^+,\vec{s}\,^+$ themselves satisfy the hypotheses of Lemma~\ref{g-lemma-2}, with $(\Gamma,x')$ now playing the role of $\Gamma$ and $(\vec{v}\,',\vec{y}\,')$ that of $\vec{v}\,'$. Explicitly, we have regular terms \[ \Gamma,x,\vec{v}\,^+ \vdash d' = \caseof{gp'q'}{\cdots} \;, ~~~~~~~~ \Gamma,x,\vec{v}\,',\vec{y}\,' \vdash \vec{s}\,^+ \] (so that ${\mathrm{lv}}(\vec{v}\,^+), {\mathrm{lv}}(\vec{v}\,',\vec{y}\,') \leq k$) where $\Gamma,x,\vec{v}\,',\vec{y}\,' \vdash \dang{d' [\vec{v}\,^+ \mapsto \vec{s}\,^+]}$ is head-spinal w.r.t.\ $x',\vec{y}\,'$. We can therefore iterate the whole of the above argument to obtain an infinite descending chain of subterms \[ \begin{array}{rrlrl} \Gamma,\vec{v} \vdash & d = & \caseof{gpq}{\cdots} \;, & p = & \lambda x'.\,C[d'] \;, \\ \Gamma,\vec{v},x',\vec{v}\,'' \vdash & d' = & \caseof{gp'q'}{\cdots} \;, & p' = & \lambda x''.\,C'[d''] \;, \\ \Gamma,\vec{v},x',\vec{v}\,'',x'',\vec{v}\,'''' \vdash & d'' = & \caseof{gp''q''}{\cdots} \;, & p'' = & \lambda x'''.\,C''[d'''] \;, \\ & \cdots & & \cdots & \end{array} \] along with associated substitutions $^\dag$, $^{\dag'}$, $^{\dag''}, \ldots$ applicable to $d,d',d'',\ldots$ respectively, such that $\dang{\!p^\dag\!}$, $\dang{(p')^{\dag'}\!}$, $\dang{(p'')^{\dag''}\!}, \ldots$ coincide with the successive procedure subterms $F,F',F'',\ldots$ from the spine of the original term $\dang{\!d^\dag\!}$, and likewise $\dang{\!q^\dag\!}$, $\dang{(q')^{\dag'}\!}$, $\dang{(q'')^{\dag''}\!}, \ldots$ coincide with $o,o',o''\ldots$. We cannot quite conclude that $d$ is head-spinal, because the critical $x$ in $q^\dag$ might originate not from $q$ but from a level $k$ term in $\vec{s}$ (for example). However, we can show that this problem does not arise for $q',q'',\ldots$, essentially because $x',x'',\ldots$ are bound locally within $p$. We will in fact show that $d'$ is head-spinal w.r.t.\ $x',\vec{v}\,''$, where $\vec{v}\,''$ is the local environment for $C[-]$; this will imply that $d$ is spinal. In the light of Definition~\ref{spinal-def}, it will be sufficient to show that $(q')^{\circ'} \succeq {x'}^\eta$ for some $x',\vec{v}\,''$-closed specialization $^{\circ'}$ covering the free variables of $q'$ except $x'$ (namely those of $\Gamma,\vec{v},\vec{v}\,''$); the same argument will then obviously apply also to $q'',q''',\ldots$. Recall that $\Gamma,\vec{v},\vec{v}\,'',x' \vdash q'$ and $\Gamma,\vec{v}\,',\vec{y}\,',x' \vdash o'$. Since $gF'o'$ is head-spinal w.r.t.\ $x,\vec{y}\,'$, we may as before take $^\circ = [\vec{w}\mapsto\vec{r}\,]$ $x',\vec{y}\,'$-closed such that ${o'}^\circ \succeq {x'}^\eta$, where $\vec{w} = \Gamma,\vec{v}\,',\vec{y}\,'$ and $x' \vdash \vec{r}$. Now define \[ ^{\circ'} ~=~ [\vec{v} \mapsto \vec{s}\,^\circ, \; \vec{v}\,'' \mapsto (\vec{s}\,'')^\circ, \; \vec{w}\,^\Gamma\mapsto\vec{r}\,^\Gamma] \] (where we write $\vec{s}\,^+$ as $\vec{s},\vec{s}\,''$, and $\vec{w}\,^\Gamma \mapsto \vec{r}\,^\Gamma$ denotes the restriction of $^\circ$ to $\Gamma$). This covers the free variables of $q'$ except $x'$, and we have $x' \vdash \vec{s}\,^\circ, (\vec{s}\,'')^\circ, \vec{r}\,^\Gamma$ because $\vec{w} \vdash \vec{s}, \vec{s}\,''$ and $x \vdash \vec{r}$. Moreover, we have \[ q'^{\circ'} ~=~ (q' [\vec{v}\,^+ \mapsto (\vec{s}\,^+)^\circ])[\vec{w}\,^\Gamma \mapsto \vec{r}\,^\Gamma] ~=~ (q'^{\dag'})^\circ ~\approx~ o^\circ ~\succeq~ x'^\eta \] since $(\vec{s}\,^+)^\circ$ contains no free variables except $x$. To check that $^{\circ'}$ is $x',\vec{v}\,''$-closed, it remains to show that that $u^{\circ'}$ may contain $x'$ free only when $u \in \vec{v},''$ and $u$ is of level $<k$. (Indeed, it is because of the possibility of $x'$ occurring free in these terms that the machinery of $x,V$-closed substitutions is necessary at all.) The remaining cases are handled as follows: \begin{itemize} \item The terms $\vec{s}$ exist in environment $\Gamma,\vec{v}\,'$, so do not involve $x'$ or any of the variables of $\vec{y}\,'$. Since $^\circ$ is $x',\vec{y}\,'$-closed, it follows that the terms $\vec{s}\,^\circ$ do not involve $x'$. \item For any variables $v \in \vec{v}\,''$ of level $k$, we have $v^{\dag'} = v^\eta$ which contains no free variables of level $<k$, so that $(v^{\dag'})^\circ$ cannot involve $x'$. \item The $\vec{r}\,^\Gamma$ cannot involve $x'$, since $^\circ$ is $x',\vec{y}\,'$-closed and $\Gamma$ is disjoint from $\vec{y}\,'$. \end{itemize} This completes the verification that $d$ is spinal. $\Box$ \end{proof} \vspace*{1.0ex} From the above lemma we may immediately conclude, for example, that in the setting of Lemma~\ref{g-lemma-1}(ii) the term $d$ is spinal. We are now ready for the main result of this section: \begin{theorem} \label{no-gremlin-thm} Every ${\mathrm{PCF}}^\Omega_k$-denotable procedure $\Gamma \vdash p$ is non-$g$-spinal where $g: (k+1) \rightarrow (k+1)$. \end{theorem} \begin{proof} In the light of Section~\ref{sec-denotations}, it will suffice to show that the clauses of Theorem~\ref{denotable-inductive-thm} cannot generate spinal terms from non-spinal ones. For clauses 1--5 this is very easily seen. For clause 6, it will be sufficient to show that non-spinal terms are closed under $k$-plugging, and it is here that the machinery of Lemmas~\ref{g-lemma-1} and \ref{g-lemma-2} comes into play. Suppose that $t =\, \dang{\Pi_{\Gamma,Z}(e,\xi)}$ where $\Gamma,Z \vdash e$ and $\Gamma,Z \vdash \xi(z)$ for each $z \in Z$. For later convenience, to each $z_i \in Z$ let us associate the procedure $\Gamma \vdash r_i =\, \dang{\Pi_{\Gamma,Z}(\xi(z_i),\xi)}$; it is then clear from the definition of plugging and the evaluation theorem that $t =\, \dang{e[\vec{z}\mapsto\vec{r}\,]}$ and that $r_i =\, \dang{\xi(z_i)[\vec{z}\mapsto\vec{r}\,]}$ for each $i$. It will be natural to frame the argument contrapositively. Suppose that $t$ is spinal, i.e.\ $t$ contains some head-spinal expression $c$ at position $K[-]$. We shall focus on the head occurrence of $g$ in $c$. Clearly this occurrence must originate from one of the ingredients $\Gamma,Z \vdash e$ or $\Gamma,Z \vdash \xi(z)$ of the plugging $\Pi_{\Gamma,Z}(e,\xi)$; let us denote this ingredient by $\Gamma,Z \vdash t_0$. We will show that $t_0$ itself is spinal. Suppose that the relevant occurrence of $g$ in $t_0$ is as indicated by \[ \Gamma,Z \;\vdash\; t_0 ~=~ L[d] \;, ~~~~~~ \Gamma,Z,\vec{v} \;\vdash\; d ~=~ \caseof{g p q}{\cdots} \;, \] where $\vec{v}$ is the local environment for $L[-]$. Writing $^\star$ for $[\vec{z}\mapsto\vec{r}\,]$, we have $\dang{\Pi(t_0,\xi)} \,=\, \dang{t_0^\star}$; and if $C[-]$ is the context encapsulating the remainder of the plugging $\Pi(e,\xi)$, then we may write \[ \Gamma \vdash~ K[c] ~=~ t ~=~ \dang{C[\Pi(t_0,\xi)]} ~=~ \dang{C[t_0^\star]} ~=~ \dang{C[L^\star[\dang{\!d^\star\!}]]} \;, \] where \[ \dang{\!d^\star\!} ~=~ \caseof{g \dang{\!p^\star\!} \dang{\!q^\star\!}\!}{\cdots} \;. \] We claim that we are in the situation of Lemma~\ref{g-lemma-1}, taking $\Gamma,K,d,K',c$ of the lemma to be respectively $\Gamma,C[L^\star[-]],\dang{\!\!d^\star\!\!},K,c$. Condition~1 of the lemma holds because $C[t_0^\star]$ is constructed by substitution from normal-form terms of level $\leq k$, and condition~2 is immediate in the present setup. By Lemma~\ref{g-lemma-1}, we may therefore conclude that for a suitable substitution $[\vec{v} \mapsto \vec{s}\,]$ with $\Gamma, \vec{v}\,' \vdash \vec{s}$ regular, $\Gamma \vdash\, \dang{\dang{\!d^\star\!}[\vec{v}\mapsto\vec{s}\,]}$ is head-spinal. (Note that the local variables of $C[-]$ do not appear in $d^\star$, because $\Gamma,Z \vdash t_0$ and $\Gamma \vdash \vec{r}$.) Equivalently, we may say that $\dang{d[\vec{v}\,^+\!\mapsto\vec{s}\,^+]}$ is head-spinal, where \[ [\vec{v}\,^+\mapsto\vec{s}\,^+] ~=~ [\vec{z}\mapsto\vec{r}, ~\vec{v}\mapsto\vec{s}\,] \;, \] so that $\Gamma, \vec{v}\,' \vdash \vec{s}\,^+$ and ${\mathrm{lv}}(\vec{v}\,^+),{\mathrm{lv}}(\vec{v}\,') \leq k$. (Note that the $\vec{z}$ do not appear free in $\vec{s}$, nor the $\vec{v}$ in $\vec{r}$.) Since $\Gamma,Z,V \vdash d$ and $\Gamma,\vec{v}\,' \vdash \vec{s}\,^+$ are regular, we are in the situation of Lemma~\ref{g-lemma-2}, so may conclude that $d$ itself is spinal, and hence that $t_0$ is spinal. We have thus shown that $k$-plugging cannot assemble spinal terms from non-spinal ones, and this completes the proof. $\Box$ \end{proof} \vspace*{1.0ex} In particular, since the procedure $g \vdash F_{k+1}[g]$ mentioned at the start of the section is spinal, we may conclude that this procedure is not ${\mathrm{PCF}}^\Omega_k$-denotable, and hence neither is the procedure $Y_{k+1}$. This establishes Theorem~\ref{SP0-main-thm}. We conclude the section by mentioning some minor variations on Theorem~\ref{no-gremlin-thm} that we will require below. First, as already indicated, the whole of the above proof goes through for the modified notion of spinal term appropriate to a variable $g: 0 \rightarrow (k+1) \rightarrow (k+1)$. Secondly, the theorem also holds for an innocuous extension of ${\mathrm{PCF}}^\Omega_k$ with a constant ${\mathit{byval}} : (\nat\rightarrow\nat) \rightarrow \nat \rightarrow \nat$, whose denotation in ${\mathsf{SP}}^0$ we take to be \[ \lambda fx.\;\caseof{x}{i \Rightarrow \caseof{fi}{j \Rightarrow j}} \;. \] To see that the proof of Theorem~\ref{no-gremlin-thm} goes through in the presence of ${\mathit{byval}}$, it suffices simply to add an extra clause to the inductive proof noting that the procedure for ${\mathit{byval}}$ is non-spinal. This mild extension will allow a significant simplification of the forms of procedures that we need to consider in Section~\ref{sec-extensional}.% \footnote{The operator ${\mathit{byval}}$ plays a major role in \cite[Section~7.1]{Longley-Normann}, where it is shown that every element of ${\mathsf{SP}}^0$ is denotable in ${\mathrm{PCF}}^\Omega + {\mathit{byval}}$. The sense in which it is innocuous is that its denotation in ${\mathsf{SF}}$ coincides with that of $\lambda fx.\,{\mathit{ifzero}}\,x\,(fx)(fx)$; thus ${\mathit{byval}}$ adds nothing to the expressivity of ${\mathrm{PCF}}^\Omega_k$ as regards ${\mathsf{SF}}$.} \section{Non-definability in the extensional model} \label{sec-extensional} To obtain corresponding non-definability results for ${\mathsf{SF}}$ rather than ${\mathsf{SP}}^0$, one must show not only that the canonical procedures $Y_\tau$ considered above are not ${\mathrm{PCF}}^\Omega_k$-denotable, but also that no extensionally equivalent procedures are. It is easy to see that there are indeed many other procedures $Z$ with the same extension as $Y_\tau$. To give a trivial example, we may present the canonical procedure $Y_{k+1}$ as $\lambda gx.C[g,x]$, where \[ C[g,x] ~=~ \caseof{A[g,x]}{i \Rightarrow i} \;, ~~~~~~~~ A[g,x] ~=~ g(\lambda x'.C[g,x'])x^\eta \;. \] However, another candidate for the fixed point operator is \[ Z_0 ~=~ \lambda gx.\,\caseof{A[g,x]}{i \Rightarrow {C[g,x]}} \;. \] Intuitively, this computes the desired value twice, discarding the first result. As a slightly more subtle example, consider the procedure \[ Z_1 ~=~ \lambda gx.\,\caseof{g(\lambda x'.\caseof{A[g,x]}{i \Rightarrow {C[g,x']}}) x^\eta}{k \Rightarrow k} \;. \] Here, within the $\lambda x'$ subterm, we have smuggled in a repetition of the top-level computation $A[g,x]$ before proceeding to evaluate what is really required. The effect is that $\lambda x'.\caseof{A[g,x]}{i \Rightarrow C[g,x']}$ may be extensionally below $\lambda x'.C[g,x']$, and this may indeed affect the result when $g$ is applied. However, this can only happen when $Y_{k+1}gx$ is undefined anyway, so it is easy to see that $Z_1$ as a whole will have the same extension as $Y_{k+1}$. Yet another way to construct procedures extensionally equivalent to $Y_{k+1}$ is to vary the subterms of the form $x^\eta$ (where $x$ has type $k$). For instance, in the case $k=1$, we could replace $x^\eta$ by an extensionally equivalent term such as \[ X_0 ~=~ \lambda y^0.\, x(\lambda.\,\caseof{y}{0 \Rightarrow \caseof{x(\lambda.0)}{j \Rightarrow 0} \mid i+1 \Rightarrow i+1}) \;. \] This is different in character from the previous examples: rather than simply repeating the computation of $xy^\eta$, we are performing the specific computation $x(\lambda.0)$ which we can see to be harmless given that this point in the tree has been reached. Clearly, such `time-wasting' tricks as the above may be combined and elaborated to yield more complex examples of procedures equivalent to $Y$. However, all of the above are rather innocuous variations and do not really yield a fundamentally different method of computing fixed points. For example, the bodies of both $Z_0,Z_1$ are still head-spinal terms, and it is essentially the spines that are really computing the desired fixed point by the canonical method. This suggests that we should try to show that every procedure extensionally equivalent to $Y_{k+1}$ is spinal; from this it would follow easily by Theorem~\ref{no-gremlin-thm} that the fixed point functional $Y_{k+1}$ in ${\mathsf{SF}}$ is not denotable in ${\mathrm{PCF}}^\Omega_k$. Unfortunately, we are currently unable to show this in the case of $Y_{k+1}$: indeed, the syntactic analysis of procedures $Z \approx Y_{k+1}$ appears to present considerable technical difficulties. We shall establish the result for $Y_{0 \rightarrow (k+1)}$, although even here, it is simplest to concentrate not on $Y_{0 \rightarrow (k+1)}$ itself, but on a certain functional that is readily definable from it, namely the functional $\Phi_{k+1}$ introduced in Section~\ref{sec-intro}. Nonetheless, the above examples of `time-wasting' procedures illustrate some of the situations that our proof will need to deal with, and they may help to motivate some of the technical machinery that follows. Specifically, within ${\mathrm{PCF}}_{k+1}$, let us define \begin{eqnarray*} \Phi_{k+1} & : & ({0} \rightarrow (k+1) \rightarrow (k+1)) \rightarrow ({0} \rightarrow (k+1)) \\ \Phi_{k+1}\,g^{0\rightarrow(k+1)\rightarrow(k+1)} & = & Y_{{0}\rightarrow(k+1)}\, (\lambda f^{0\rightarrow(k+1)}.\lambda n.\,g\,n\,(f({\mathit{suc}}\;n))) \;, \end{eqnarray*} so that informally \[ \Phi_{k+1}\,g\,n ~=~ g\,n\,(g\,(n+1)\,(g\,(n+2)\, (\cdots))) \;. \] For the rest of this section we will write $\Phi_{k+1}$ simply as $\Phi$. For each $n \in \mathbb{N}$, let $g \vdash \Phi^n[g] = \Phi\,g\,\num{n} : {k+1}$, and let $p_n \in {\mathsf{SP}}(k+1)$ be the canonical NSP for $\Phi^n[g]$ (that is, the one arising from the above ${\mathrm{PCF}}$ definition via the standard interpretation in ${\mathsf{SP}}^0$). These procedures may be defined simultaneously by: \[ g~ \vdash~ p_n ~=~ \lambda x^k.\,\caseof{g\,(\lambda.n)\,p_{n+1}\,x^\eta}{i \Rightarrow i} ~:~ k+1 \;. \] By a syntactic analysis of the possible forms of (simple) procedures $g \vdash q \approx p_n$, we will show that any such $q$ is necessarily spinal. Here we have in mind the modified notion of spinal term that is applicable to terms involving a global variable $g : \rho$, where $\rho = {0} \rightarrow (k+1) \rightarrow (k+1)$ (see the explanation following Definition~\ref{spinal-def}). Using Theorem~\ref{no-gremlin-thm} (adapted to this modified setting), it will then be easy to conclude that within ${\mathsf{SF}}$, the element $\sem{\lambda g.\,\Phi^0[g]}$, and hence $Y_{{0}\rightarrow(k+1)}$ itself, is not ${\mathrm{PCF}}^\Omega_k$-denotable in ${\mathsf{SF}}$. To show that any $q \approx p_n$ is head-spinal, our approach will be as follows. First, we show that any such $q$ must broadly resemble $p_n$ in at least its top-level structure, in that $q$ must have the form $\lambda x.\,\caseof{garo}{\cdots}$, where the arguments $a,r,o$ are closely related to the corresponding arguments $(\lambda.n), p_{n+1}, x^\eta$ occurring within $p_n$. We do this by showing that if $q$ were to deviate in any way from this prescribed form, we would be able to cook up procedures $G \in {\mathsf{SP}}^0(\rho)$ and $X \in {\mathsf{SP}}^0(k)$ manifesting an extensional difference between $q$ and $p_n$, i.e.\ such that $q[g \mapsto G]X \not\approx p_n[g \mapsto G]X$. (Contrary to our usual convention, we will here use the uppercase letters $G,X$ to range over normal-form closed procedures that may be substituted for $g,x$ respectively.) In particular, we shall establish a sufficiently close relationship between $r$ and $p_{n+1}$ that the same analysis can then be iterated to arbitrary depth, showing that $q$ has a spinal structure as required. The main complication is that $r$ need not superficially resemble $p_{n+1}$, since within $r$, the crucial application of $g$ that effectively computes the value of $p_{n+1}$ may be preceded by other `time-wasting' applications of $g$ (the idea is illustrated by the example $Z_1$ above). However, it turns out that such time-wasting subterms $g a^1 r^1 o^1$ must be of a certain kind if the extensional behaviour $q \approx p_n$ is not to be jeopardized: in particular, the first argument $a^1$ must evaluate to some $i < n$. (As in the example of $Z_1$, the idea is that if the subterm $g a^1 r^1 o^1$ merely repeats some `outer' evaluation, it will make no overall difference to the extension if the evaluation of this subterm does not terminate.) In order to formulate the relationship between $r$ and $p_{n+1}$, we therefore need a means of skipping past such time-wasting applications in order to reach the application of $g$ that does the real work. We achieve this with the help of a \emph{masking} operator $\mu_{n,n'}$, which (for any $n \leq n'$) overrides the behaviour of $g$ on numerical arguments $n \leq i < n'$ with a trivial behaviour returning the dummy value $0$. We now proceed to our formal development. As a brief comment on notation, we recall from Section~\ref{sec-background} that the relations $\approx$ and $\preceq$ of observational equivalence and inequality make sense not just for elements of ${\mathsf{SP}}^0$ but for arbitrary meta-terms (including applications), closed or otherwise. Throughout this section, for typographical convenience, we will tend to express the required relationships mostly at the level of meta-terms, writing for instance $pq \approx \lambda.n$ rather than the equivalent $\dang{pq}\,=\lambda.n$ or $p \cdot q = \lambda.n$. We shall also perpetrate other mild abuses of notation, such as writing a procedure $\lambda.n$ simply as $n$ (except for special emphasis), $\lambda \vec{x}.\bot$ as $\bot$, $x^\eta$ as $x$, a meta-expression $\caseof{A}{i \Rightarrow i}$ just as $A$, and abbreviating a substitution $[g \mapsto G,\, x \mapsto X]$ to $[G,X]$. We shall say that $G \in {\mathsf{SP}}^0(0\rightarrow(k+1)\rightarrow(k+1))$ is \emph{strict} if $G\bot ro \approx \bot$ for any $r,o$. Clearly, $G$ is strict iff $G \approx \lambda izx.\,\caseof{i}{j \Rightarrow G (\lambda.j) z^\eta x^\eta}$. In connection with meta-terms with free variable $g$, we shall write $T \approx^\prime T'$ to mean that $T[g \mapsto G] \approx T'[g \mapsto G]$ for all \emph{strict} $G$; the notation $\preceq^\prime$ is used similarly. We shall actually analyse the syntactic forms of procedures $g \vdash q$ based on the assumption that $q \succeq^\prime p_n$, where $p_n$ is the canonical procedure for $\Phi^n[g]$ as above. We shall say a procedure $g \vdash q$ is \emph{simple} if for every application $garo$ appearing within $q$, the first argument $a$ is just a numeral $\lambda.n$. The following observation simplifies our analysis of terms considerably; it uses the operator ${\mathit{byval}}$ and its NSP interpretation, as introduced at the end of Section~\ref{sec-Y-k+1}. \begin{proposition} \label{simple-prop} If there is a procedure $g \vdash q \succeq^\prime p_n$-denotable in ${\mathrm{PCF}}^\Omega_k$, then there is a simple procedure $g \vdash q' \succeq^\prime p_n$ denotable in ${\mathrm{PCF}}^\Omega_k + {\mathit{byval}}$. \end{proposition} \begin{proof} Suppose $g \vdash q$ is ${\mathrm{PCF}}^\Omega_k$-denotable where $q \succeq^\prime p_n$, and write \[ S[g] ~=~ \lambda izx.\,\caseof{i}{j \Rightarrow g(\lambda.j)z^\eta x^\eta} \;. \] It is easy to see that \[ S[g] ~=~ \sem{\lambda izx.\,{\mathit{byval}}\,(\lambda j. gjzx)\,i\,}_g \;. \] Take $g \vdash q' =\, \dang{q[g \mapsto S[g]]}$, so that $q'$ is denotable in ${\mathrm{PCF}}^\Omega_k + {\mathit{byval}}$. Then $q \approx^\prime q'$ since $S[G] \approx G$ for all strict $G$, so $q' \succeq^\prime p_n$. Finally, $q'$ is clearly simple: every occurrence of $g$ within $q[g \mapsto S[g]]$ has a numeral as its first argument, so the same will be true of $\dang{q[g \mapsto S[g]]}$. $\Box$ \end{proof} \vspace*{1.0ex} For any $n \leq n'$, let us define the \emph{masking} $\mu_{n,n'}(g)$ of $g$ to be the following procedure term (here $\rho = 0 \rightarrow (k+1) \rightarrow (k+1)$): \[ g^\rho ~\vdash~ \mu_{n,n'}(g) ~=~ \lambda izx.\, \caseof{i}{n \Rightarrow 0 \mid \cdots \mid n'-1 \Rightarrow 0 \mid - \Rightarrow gizx} ~:~ \rho \;. \] (The wildcard symbol `$-$' covers all branch indices not covered by the preceding clauses.) We may also write $\mu_{n,n'}(P)$ for $\mu_{n,n'}(g)[g \mapsto P]$ if $P$ is any meta-procedure of type $\rho$. We write $\mu_{n,n+1}$ simply as $\mu_n$; note also that $\mu_{n,n}(g) \approx^\prime g$. Clearly $\mu_n(\mu_{n+1}(\cdots(\mu_{n'-1} (g)) \cdots)) \approx \mu_{n,n'}(g)$. We shall say that a closed meta-term $\vdash P : \rho$ is \emph{trivial at $n$} if $P(\lambda.n)\bot\bot \approx 0$. Note that $\mu_{n,n'}(G)$ is trivial at each of $n,\ldots,n'-1$ for any closed $G$; indeed, $G$ is trivial at $n,\ldots,n'-1$ iff $G \succeq^\prime \mu_{n,n'}(G)$. The following lemma now implements our syntactic analysis of the top-level structure of simple procedures $q \succeq^\prime p_n$. \begin{lemma} \label{Qn-lemma} Suppose $g \vdash q$ is simple and $q \succeq^\prime p_n$. Then $q$ has the form $\lambda x^k.\,\caseof{g a r o}{\cdots}$, where: \begin{enumerate} \item $a = \lambda.n$, \item $o[g \mapsto G] \succeq x^\eta$ whenever $\vdash G$ is trivial at $n$, \item $r[g \mapsto \mu_n(g),\, x \mapsto X] \succeq^\prime p_{n+1}$ for any $X$. \end{enumerate} \end{lemma} \begin{proof} Suppose $q = \lambda x^k.e$. Clearly $e$ is not constant since $q \succeq p_n$; and if $e$ had head variable $x$, we would have $q[g \mapsto \lambda izx.\,\caseof{i}{- \Rightarrow 0}](\lambda w.\bot) = \bot$, whereas $p_n[g \mapsto \lambda izx.\,\caseof{i}{- \Rightarrow 0}](\lambda w.\bot) = 0$, contradicting $q \succeq^\prime p_n$. So $e$ has the form $\caseof{g a r o}{\cdots}$. For claim~1, we have $a = \lambda.m$ for some $m \in \mathbb{N}$ because $q$ is simple. Suppose that $m \neq n$, and consider \[ G' ~=~ \lambda izx.\,\caseof{i}{n \Rightarrow 0 \mid - \Rightarrow \bot} \;. \] Then for any $X$, clearly $q[G']X \approx \bot$, whereas $p_n[G']X \approx G'(\lambda.n)(\cdots)X \approx 0$, contradicting $q \succeq^\prime p_n$. Thus $a = \lambda.n$. For claim~2, suppose that $G (\lambda.n) \bot \bot \approx 0$ but not $o[G] \succeq x^\eta$; then we may take $X \in {\mathsf{SP}}^0({k})$ and $u \in {\mathsf{SP}}^0({k-1})$ such that $Xu \approx l \in \mathbb{N}$ but $o[G,X]u \not\approx l$. Now define \[ G' ~=~ \lambda izx.\,\caseof{i}{j \Rightarrow \caseof{xu}{l \Rightarrow Gjzx \mid - \Rightarrow \bot}} \;. \] Then $G' \preceq G$, so $o^* u \not\approx l$ where $^* = [G',X]$; hence $G' a^* r^* o^* \approx \bot$ and so $q[G']X \approx \bot$. On the other hand, we have \begin{eqnarray*} p_n[G']X & \approx & \caseof{G'(\lambda.n)p_{n+1}^*X}{i \Rightarrow i} \\ & \approx & \caseof{Xu}{l \Rightarrow G(\lambda.n)p_{n+1}^*X} ~\approx~ 0 \;, \end{eqnarray*} contradicting $q \succeq^\prime p_n$ (note that $G'$ is strict). Thus $o[G] \succeq x^\eta$. For claim~3, suppose that $p_{n+1}[G]X' \approx l$ for some strict $G \in {\mathsf{SP}}^0(\rho)$ and $X' \in {\mathsf{SP}}^0(k)$. We wish to show that $r[\mu_n(G), X]X' \approx l$ for any $X$. Suppose not, and consider \[ G' ~=~ \lambda izx.\,\caseof{i}{n \Rightarrow \caseof{zX'}{l \Rightarrow 0 \mid - \Rightarrow \bot} \mid - \Rightarrow Gizx} \;. \] Then $G' \preceq \mu_n(G)$, so $r[G',X]X' \not\approx l$. Moreover, since $a=\lambda.n$ by claim~1, we see that $G' a^* r^* o^* \approx \bot$, where $^* = [G',X]$, so that $q[G']X \approx \bot$. On the other hand, we have \begin{eqnarray*} p_n[G']X & \approx & \caseof{G'(\lambda.n)p_{n+1}^*X}{i \Rightarrow i} \\ & \approx & \caseof{p_{n+1}^*X'}{l \Rightarrow 0} \;. \end{eqnarray*} Here, since $p_{n+1}$ does not contain $x$ free, we have $p_{n+1}^* = p_{n+1}[G']$. But it is easy to see that $p_{n+1}[G'] \approx p_{n+1}[G]$, since every occurrence of $g$ within $p_{n+1}$ is applied to $\lambda.n'$ for some $n'>n$, and for all such $n'$ we have $G'(\lambda.n') \approx G(\lambda.n')$. (Since $p_{n+1}$ contains infinitely many applications of $g$, an appeal to continuity is formally required here.) But $p_{n+1}[G]X' \approx l$ by assumption; thus $p_{n+1}^*X' \approx l$, allowing us to complete the proof that $p_n[G']X \approx 0$. Once again, this contradicts $q \succeq^\prime p_n$, so claim~3 is established. $\Box$ \end{proof} \vspace*{1.0ex} In the light of Appendix~A, one may strengthen claim~2 of the above lemma by writing $o[g \mapsto G] \approx x^\eta$. This gives a fuller picture of the possible forms of terms $q \approx p_n$, but is not needed for showing that such $q$ are spinal. We have now almost completed a circle, in the sense that claim~3 tells us that $\dang{r[g \mapsto \mu_n(g), x \mapsto X]}$ itself satisfies the hypothesis for $q$ (with $n+1$ in place of $n$). However, there still remains a small mismatch between the hypothesis and the conclusion, in that claim~3 concerns not $r$ itself but rather $\dang{r[g \mapsto \mu_n(g)]}$. (In the light of claim~3, the variable $x$ may be safely ignored here.) This mismatch is repaired by the following lemma, which lends itself to iteration to any depth. Note the entry of a term context $E[-]$ here. \begin{lemma} \label{q-structure-lemma} Suppose $g \vdash q$ is simple and $q[g \mapsto \mu_{n,n'}(g)] \succeq^\prime p_{n'}$. Then $q$ has the form $\lambda x^k.\,E[\caseof{garo}{\cdots}]$, where: \begin{enumerate} \item $E[-]$ has empty local variable environment, \item $a = \lambda.n'$, \item $o[g \mapsto G] \succeq x^\eta$ whenever $\vdash G$ is trivial at $n,\cdots,n'$, \item $r[g \mapsto \mu_{n,n'+1}(g),\,x \mapsto X] \succeq^\prime p_{n'+1}$ for any $X$. \end{enumerate} \end{lemma} \begin{proof} Let $q' =\, \dang{q[g \mapsto \mu_{n,n'}(g)]}$. Under the above hypotheses, we have by Lemma~\ref{Qn-lemma} that $q'$ is of the form $\lambda x.\,\caseof{ga'r'o'}{\cdots}$, where $a'=\lambda.n'$, $o'[g \mapsto G] \succeq x^\eta$ whenever $G$ is trivial at $n'$, and $r'[g \mapsto \mu_{n'}(g)] \succeq^\prime p_{n'+1}$. Write $q$ as $\lambda x.\,E[\caseof{garo}{\cdots}]$ where the displayed occurrence of $g$ originates the head $g$ of $q'$ via the substitution $^\dag = [g \mapsto \mu_{n,n'}(g)]$. Suppose that the hole in $E[-]$ appeared within an abstraction $\lambda y.-$; then the hole in $E[g \mapsto \mu_{n,n'}(g)][-]$ would likewise appear within such an abstraction. Moreover, the evaluation of $q[g \mapsto \mu_{n,n'}(g)]$ consists simply of the contraction of certain expressions $\mu_{n,n'}(g)(\lambda.m)r''o''$ to either $0$ or $g(\lambda.m)r''o''$, followed by some reductions $\caseof{0}{i \Rightarrow e_i} \rightsquigarrow e_0$; thus, any residue in $q'$ of the critical $g$ identified above will likewise appear underneath $\lambda y$. But this is impossible, because the head $g$ of $q'$ is a residue of this $g$ by assumption. This establishes condition~1. In the light of this, by Lemma~\ref{g-lemma-1}(i) we have $a' \approx a^\dag$, $o' \approx o^\dag$ and $r' \approx r^\dag$. But since $q$ is simple, $a$ is a numeral, so $a=\lambda.n'$, giving condition~2. For condition~3, suppose $G$ is trivial at $n,\ldots,n'$. Then $G \succeq \mu_{n,n'+1}(G)$, so that \[ o[g \mapsto G] ~\succeq~ o[g \mapsto \mu_{n,n'}(\mu_{n'}(G))] ~\approx~ o^\dag[g \mapsto \mu_{n'}(G)] ~\approx~ o'[g \mapsto \mu_{n'}(G)] ~\succeq~ x^\eta \;, \] since $\mu_{n'}(G)$ is trivial at $n'$. Condition~4 also holds since $r'[g \mapsto \mu_{n'}(g)] \approx r^\dag[g \mapsto \mu_{n'}(g)] \approx r[g \mapsto \mu_{n,n'+1}(g)]$, where $r'[g \mapsto \mu_{n'}(g)] \succeq^\prime p_{n'+1}$. $\Box$ \end{proof} \begin{corollary} \label{spinal-cor} If $g \vdash q$ is simple and $q \succeq^\prime p_n$, then $q$ is spinal (in the modified sense). \end{corollary} \begin{proof} Since condition~3 of the above lemma matches its hypotheses, starting from the assumption that $q \approx^\prime q[g \mapsto \mu_{n,n}(g)] \succeq^\prime p_n$, we may apply the lemma iteratively to obtain a spinal structure as prescribed by Definition~\ref{spinal-def} (subject to the relevant adjustments for $g : 0 \rightarrow (k+1) \rightarrow (k+1)$). Note that at each level, a suitable substitution $^\circ$ will be the closed one that specializes $g$ to $\lambda izx.0$ (which is trivial at all $n$), and all variables $x^k$ other than the innermost-bound one to $\bot$. $\Box$ \end{proof} \vspace*{1.0ex} Thus, if there exists a ${\mathrm{PCF}}^\Omega_k$-denotable procedure $t \approx \lambda g.p_0$, for instance, then by Proposition~\ref{simple-prop} there is also a simple such procedure $t'$ denotable in ${\mathrm{PCF}}^\Omega_k + {\mathit{byval}}$, and by Corollary~\ref{spinal-cor}, this $t'$ will be spinal in the modified sense. But this contradicts Theorem~\ref{no-gremlin-thm} (understood relative to the modified setting, and applied to ${\mathrm{PCF}}^\Omega_k + {\mathit{byval}}$ as indicated at the end of Section~\ref{sec-Y-k+1}). We conclude that no $t \approx \lambda g.p_0$ can be ${\mathrm{PCF}}^\Omega_k$-denotable. Since the interpretation of ${\mathrm{PCF}}^\Omega_k$ in ${\mathsf{SF}}$ factors through ${\mathsf{SP}}^0$, this in turn means that within the model ${\mathsf{SF}}$, the element $\sem{\lambda g.\,\Phi^0[g]}$ is not denotable in ${\mathrm{PCF}}^\Omega_k$. On the other hand, this element is obviously denotable relative to $Y_{{0}\rightarrow (k+1)} \in {\mathsf{SF}}$ even in ${\mathrm{PCF}}_1$, so the proof of Theorems~\ref{operational-main-thm}(i) and \ref{SF-main-thm}(i) is complete. This establishes Berger's conjecture, and also suffices for the proof of Corollary~\ref{no-finite-basis-cor}. \section{Extensional non-definability of $Y_{k+1}$} \label{sec-pure-type} We have so far shown that the element $Y_{0 \rightarrow (k+1)} \in {\mathsf{SF}}$ is not ${\mathrm{PCF}}^\Omega_k$-denotable. We shall now refine our methods slightly to show that even $Y_{k+1} \in {\mathsf{SF}}$ is not ${\mathrm{PCF}}^\Omega_k$-denotable. Since $\pure{k+1}$ is clearly a ${\mathrm{PCF}}_0$-definable retract of every level $k+1$ type, this will establish that no $Y_\sigma \in {\mathsf{SF}}$ where ${\mathrm{lv}}(\sigma)=k+1$ is denotable in ${\mathrm{PCF}}^\Omega_k$. The idea is as follows. Within each type level $k \geq 1$, we can stratify the types into \emph{sublevels} $(k,l)$ where $l = 1,2,\ldots$, essentially by taking account of the `width' of the type as well as its depth. We thus obtain a sublanguage ${\mathrm{PCF}}^\Omega_{k,l}$ of ${\mathrm{PCF}}^\Omega_k$ by admitting $Y_\sigma$ only for types $\sigma$ of sublevel $(k,l)$ or lower. We show that, roughly speaking, all our previous methods can be adapted to show that for a given $k$, the languages ${\mathrm{PCF}}^\Omega_{k,l}$ for $l = 1,2,\ldots$ form a strict hierarchy. (This is true as regards definability in ${\mathsf{SP}}^0$; for ${\mathsf{SF}}$, we will actually show only that ${\mathrm{PCF}}^\Omega_{k,l}$ is strictly weaker than ${\mathrm{PCF}}^\Omega_{k,l+2}$.) This more refined hierarchy is of some interest in its own right, and illustrates that the structure of ${\mathsf{SF}}$ is much richer than that manifested by the pure types.% \footnote{This contrasts with the situation for extensional \emph{total} type structures over $\mathbb{N}$, for example. There, under mild conditions, every simple type is isomorphic to a pure type: see Theorem~4.2.9 of \cite{Longley-Normann}.} Any term of ${\mathrm{PCF}}^\Omega_k$ will be a term of some ${\mathrm{PCF}}^\Omega_{k,l}$. Previously we showed only that no such term could define $Y_{0 \rightarrow (k+1)} \in {\mathsf{SF}}$; however, we now see that there is actually plenty of spare headroom between ${\mathrm{PCF}}^\Omega_{k,l}$ and the pure type $k+1$. Specifically, there are operators $Y_\sigma$ in ${\mathrm{PCF}}^\Omega_{k,l+2}$ that are not ${\mathrm{PCF}}^\Omega_{k,l}$-denotable; and since all such $\sigma$ are of level $\leq k$ and are thus easily seen to be retracts of $\pure{k+1}$, we may conclude that $Y_{k+1} \in {\mathsf{SF}}$ is not ${\mathrm{PCF}}^\Omega_k$-denotable. The following definition sets out the more fine-grained stratification of types that we shall use. \begin{definition} \label{width-def} (i) The \emph{width} $w(\sigma)$ of a type $\sigma$ is defined inductively as follows: \[ w(\nat) ~=~ 0 \;, ~~~~~~~~ w(\sigma_0,\ldots,\sigma_{r-1} \rightarrow \nat) ~=~ \max(r,w(\sigma_0),\ldots,w(\sigma_{r-1})) \;. \] For $k,l \geq 1$, we say $\sigma$ has \emph{sublevel} $(k,l)$ if ${\mathrm{lv}}(\sigma)=k$ and $w(\sigma)=l$. If $\sigma=\nat$, we simply say that $\sigma$ has \emph{sublevel} $0$. We order sublevels in the obvious way: $0$ is the lowest sublevel, and $(k,l) < (k',l')$ if either $k<k'$ or $k=k'$ and $l<l'$. (ii) For each $k,l$ we define a type $\rho_{k,l}$ by: \[ \rho_{0,l} ~=~ \nat \;, ~~~~~~~~ \rho_{k+1,l} ~=~ \rho_{k,l},\ldots,\rho_{k,l} \rightarrow \nat \mbox{~~($l$ arguments)} \;. \] When $k,l \geq 1$, we may call $\rho_{k,l}$ the \emph{homogeneous} type of sublevel $(k,l)$. \end{definition} The following facts are easily established. Here we shall say that $\sigma$ is a \emph{simple retract} of $\tau$ if there is a ${\mathrm{PCF}}_0$-definable retraction $\sigma \lhd \tau$ within ${\mathsf{SP}}^0$. \begin{proposition} \label{sublevel-facts} (i) For $k \geq 1$, every type of sublevel $(k,l)$ or lower is a simple retract of $\rho_{k,l}$. Hence, for all $k \geq 0$, for every finite list of types $\sigma_i$ of level $\leq k$, there is some $l$ such that each $\sigma_i$ is a simple retract of $\rho_{k,l}$. (ii) Every finite product of level $\leq k$ types is a simple retract of $\pure{k+1}$. (iii) If $\sigma$ is a simple retract of $\tau$, then $Y_\sigma$ is ${\mathrm{PCF}}_0$-definable from $Y_\tau$ in ${\mathsf{SP}}_0$. \end{proposition} \begin{proof} (i) The first claim (for $k \geq 1$) is easy by induction on $k$, and the second claim (which is trivial when $k=0$) follows easily. (ii) By induction on $k$. The case $k=0$ is easy. For $k \geq 1$, suppose $\sigma_0,\ldots,\sigma_{m-1}$ are level $\leq k$ types, where $\sigma_i = \tau_{i0},\ldots,\tau_{i(n_i-1)} \rightarrow \nat$ for each $i$. Here the $\tau_{ij}$ are of level at most $k-1$, so by (i), we may choose $l$ such that each $\tau_{ij}$ is a simple retract of $\rho_{k-1,l}$. Taking $n = \max_i n_i$, we then have that each $\sigma_i$ is a simple retract of $\rho_{k-1,l},\ldots,\rho_{k-1,l} \rightarrow \nat$ (with $n$ arguments). The product $\Pi_i \sigma_i$ is therefore a simple retract of the type $\sigma = \nat,\rho_{k-1,l},\ldots,\rho_{k-1,l} \rightarrow \nat$. But by the induction hypothesis, the product of $\nat,\rho_{k-1,l},\ldots,\rho_{k-1,l}$ is a simple retract of $\pure{k}$ whence $\sigma$ itself is a simple retract of $\pure{k+1}$. We leave (iii) as an exercise. $\Box$ \end{proof} \vspace*{1.0ex} Next, we adapt the proof of Theorem~\ref{no-retraction-thm} to establish the crucial gap between $\rho_{k,l}$ and $\rho_{k,l+1}$. This gives an indication of how our methods may be used to map out the embeddability relation between types in finer detail, although we leave an exhaustive investigation of this to future work. \begin{theorem} \label{kl-no-retraction-thm} Suppose $k \geq 1$. Within ${\mathsf{SF}}$, the type $\rho_{k,l+1}$ is not a pseudo-retract of any finite product of types of sublevel $\leq (k,l)$ or lower. \end{theorem} \begin{proof} In view of Proposition~\ref{sublevel-facts}(i), it will suffice to show that $\rho_{k,l+1}$ is not a pseudo-retract of a finite power of $\rho_{k,l}$. We argue by induction on $k$. The arguments for both the base case $k=1$ and the step case $k>1$ closely parallel the argument for the step case in Theorem~\ref{no-retraction-thm}, so we treat these two cases together as far as possible, omitting details that are easy adaptations of those in the earlier proof. Suppose for contradiction that there were procedures \[ z^\rho \vdash t_i : \sigma ~~(i<m) \;, ~~~~~~~~ x_0^{\sigma},\ldots,x_{m-1}^{\sigma} \vdash r : \rho \;, \] where $\rho = \rho_{k,l+1}$, $\sigma = \rho_{k,l}$, such that $z \vdash r[\vec{x} \mapsto \vec{t}\,] \succeq z^\eta$. Let $v =\, \dang{r[\vec{x} \mapsto \vec{t}\,]}$, so that $z \vdash v \succeq z^\eta$. As in the proof of Theorem~\ref{no-retraction-thm}, one may show that $v$ has the form $\lambda f_0 \ldots f_l.\,\caseof{zp_0 \ldots p_l}{\cdots}$ where $p_i[z \mapsto \lambda \vec{w}.0] \succeq f_i$ for each $i$. Next, we note that $r[\vec{x} \mapsto \vec{t}\,]$ reduces in finitely many steps to a head normal form $\lambda f_0 \ldots f_l.\, \caseof{zP_0\ldots P_l}{\cdots}$ where $\dang{P_i} \,= p_i$ for each $i$; moreover, the ancestor of the leading $z$ here must lie within some $t_i$, say at the head of some subterm $z\vec{P}\,'$, where $\vec{P}$ is an instance of $\vec{P}\,'$ via some substitution $^\dag$. At this point, the arguments for the base case and step case part company. In the base case $k=1$, we have that $z^\rho \vdash t_i : \sigma$ where $\rho = \nat^{l+1} \rightarrow \nat$ and $\sigma = \nat^l \rightarrow \nat$; thus there are no bound variables within $t_i$ except the top-level ones---say $w_0,\ldots,w_{l-1}$, all of type $\nat$. So in fact $^\dag$ has the form $[\vec{w} \mapsto \vec{W}]$ for certain meta-terms $f_0^\nat,\ldots,f_l^\nat,z \vdash W_j : \nat$. Now consider the terms $f_0,\ldots,f_l \vdash \vec{W}^*$ and $\vec{w} \vdash \vec{P}\,' {}^*$, writing $^*$ for the substitution $[z \mapsto \lambda w.0]$. These compose to yield $\vec{f} \, \vdash \, \dang{\vec{P}\,^*} \,=\, \dang{\vec{p}\,^*} \,\succeq f$, so we have expressed $\nat^{l+1}$ as a pseudo-retract of $\nat^l$ within ${\mathsf{SF}}$. As already noted in the course of the proof of Theorem~\ref{no-retraction-thm}, this is impossible. For the step case $k>1$, we proceed much as in the proof of Theorem~\ref{no-retraction-thm}, using the substitution $^\dag$ to express $\rho_{k-1,l+1}$ as a retract of a finite product of types of sublevel $(k-1,l)$ or lower, contrary to the induction hypothesis. We leave the remaining details as an exercise. $\Box$ \end{proof} \vspace*{1.0ex} We now outline how the ideas of Sections~\ref{sec-denotations}, \ref{sec-Y-k+1} and \ref{sec-extensional} may be adapted to show that $Y_{\rho_{k,l+1}} \in {\mathsf{SP}}^0$ is not ${\mathrm{PCF}}^\Omega_{k,l}$-denotable. We assume that $k \geq 2$ for the time being (the case $k=1$ will require special treatment). The adaptations are mostly quite systematic: the type $\rho_{k,l+1}$ now plays the role of $\pure{k+1}$; types of sublevel $\leq (k,l)$ play the role of types of level $\leq k$; $\rho_{k-1,l+1}$ plays the role of $\pure{k}$; and types of sublevel $\leq (k-1,l)$ play the role of types of level $<k$. Since the proof we are adapting is quite lengthy, we leave many routine details to be checked by the reader. First, the evident adaptation of Definition~\ref{plugging-def} yields a notion of \emph{$k,l$-plugging} where the plugging variables are required to be of sublevel $\leq (k,l)$, and we thus obtain an inductive characterization of the ${\mathrm{PCF}}^\Omega_{k,l}$-denotable procedures analogous to Theorem~\ref{denotable-inductive-thm}. We also adapt the notion of \emph{regular} meta-term as follows: \begin{definition} Suppose $g : \rho_{k,l+1} \rightarrow \rho_{k,l+1}$ for $k,l \geq 1$. An environment $\Gamma$ is \emph{$g$-($k,l$-)regular} if $\Gamma$ contains $g$ but no other variables of sublevel $> (k,l)$. A meta-term $T$ is $g$-regular if it contains no variables of sublevel $> (k,l)$ except possibly for free occurrences of $g$. We say $\Gamma \vdash T$ is $g$-regular if both $\Gamma$ and $T$ are $g$-regular. \end{definition} Next, we proceed to the ideas of Section~\ref{sec-Y-k+1}. Our convention here will be that $\Gamma$ ranges over regular environments, and Roman capitals $V,Z$ range over sets of variables of sublevel $\leq (k,l)$. The notions of $x,V$-closed substitution and spinal term carry over as follows: \begin{definition} \label{kl-spinal-def} Suppose $g : \rho_{k,l+1} \rightarrow \rho_{k,l+1}$ where $k \geq 2$ and $l \geq 1$. (i) If $\vec{x}$ is a list of variables of type $\rho_{k-1,l+1}$ and $V$ a set of variables of sublevel $\leq (k,l)$, a substitution $^\circ = [\vec{w} \mapsto \vec{r}\,]$ is called \emph{$\vec{x},V$-closed} if the $r_i$ contain no free variables, except that if $w_i \in V$ and $w_i$ is of sublevel $\leq (k-1,l)$ then $r_i$ may contain the $\vec{x}$ free. (ii) Suppose $\Gamma \vdash e$ is $g$-$k,l$-regular and $\vec{x},V \subseteq \Gamma$. We coinductively declare $e$ to be \emph{$g$-head-spinal} w.r.t.\ $\vec{x},V$ iff $e$ has the form $\caseof{g(\lambda \vec{x}\,'.E[e'])\vec{o}}{\cdots}$, where $E[-]$ is an expression context, and \begin{itemize} \item for some $\vec{x},V$-closed specialization $^\circ$ covering the free variables of $\vec{o}$ other than those of $\vec{x}$, we have $\vec{o}\,^\circ \succeq \vec{x}^{\,\eta}$, \item $e'$ is $g$-head-spinal w.r.t.\ $\vec{x}\,',V'$, where $V'$ is the local variable environment for $E[-]$. \end{itemize} (iii) We say a regular term $\Gamma \vdash t$ is \emph{$g$-spinal} if it contains a $g$-head-spinal subexpression w.r.t.\ some $\vec{x},V$. \end{definition} Lemma~\ref{g-lemma-1} and its proof go through with the above adaptations; here the local environments $\vec{v}, \vec{v}\,'$ are now of sublevel $\leq (k,l)$, and part~(iii) of the lemma now states that if $K[-]$ contains no redexes with operator of sublevel $> (k,l)$, then the substitution $^\dag$ is trivial for variables of sublevel $\geq (k-1,l+1)$. The crucial Lemma~\ref{g-lemma-2}, which forms the heart of our proof, now translates as follows: \begin{lemma} \label{kl-lemma-2} Suppose $g: \rho_{k,l+1} \rightarrow \rho_{k,l+1}$ and we have $g$-regular terms \[ \Gamma,\vec{v} \;\vdash~ d ~=~ \caseof{gpq}{\cdots} \;, ~~~~~~ \Gamma,\vec{v}\,' \vdash \vec{s} \,, \] where $\vec{v},\vec{v}\,'$ are of sublevel $\leq (k,l)$, and $\Gamma,\vec{v}\,' \vdash\, \dang{d[\vec{v}\mapsto\vec{s}\,]}$ is $g$-head-spinal with respect to some $\vec{x},V$. Then $d$ itself is $g$-spinal. \end{lemma} The entire proof of this lemma translates systematically according to the correspondences we have indicated, invoking Theorem~\ref{kl-no-retraction-thm} for the fact that $\rho_{k-1,l+1}$ is not a pseudo-retract of a product of sublevel $\leq (k-1,l)$ types. The analogue of Theorem~\ref{no-gremlin-thm} now goes through readily, so we obtain: \begin{theorem} If $k \geq 2$ and $l \geq 1$, every ${\mathrm{PCF}}^\Omega_{k,l}$-denotable procedure is non-$g$-spinal where $g: \rho_{k,l+1} \rightarrow \rho_{k,l+1}$. $\Box$ \end{theorem} As in our original proof, we will actually use a version of this theorem for the modified notion of spinal term that incorporates the extra argument $b$, and for the extension of ${\mathrm{PCF}}^\Omega_{k,l}$ with the operator ${\mathit{byval}}$. To adapt the material of Section~\ref{sec-extensional}, we now take $g$ to be a variable of type $0 \rightarrow \rho_{k,l+1} \rightarrow \rho_{k,l+1}$, and argue that the ${\mathrm{PCF}}_{k,l+2}$-denotable element $\Phi = \lambda g.\, Y_{0 \rightarrow \rho_{k,l+1}} (\lambda fn.\,g\,n\,(f({\mathit{suc}}\,n)))$ within ${\mathsf{SF}}$ is not ${\mathrm{PCF}}^\Omega_{k,l}$-denotable. The proof is a completely routine adaptation of that in Section~\ref{sec-extensional}. Since $Y_{0 \rightarrow \rho_{k,l+1}}$ is readily definable from $Y_{k+1}$ by Proposition~\ref{sublevel-facts}, this implies that $Y_{k+1} \in {\mathsf{SF}}$ is not ${\mathrm{PCF}}^\Omega_{k,l}$-denotable. We have thus shown: \begin{theorem} (i) For $k \geq 2$ and $l \geq 1$, the element $Y_{0 \rightarrow \rho_{k,l+1}} \in {\mathsf{SF}}$ is denotable in ${\mathrm{PCF}}_{k,l+2}$ but not in ${\mathrm{PCF}}^\Omega_{k,l}$. (ii) For $k \geq 2$, the element $Y_{k+1} \in {\mathsf{SF}}$ is not denotable in ${\mathrm{PCF}}^\Omega_k$. \end{theorem} A slightly different approach is needed for the case $k=1$. This is because at level $0$ our only type is $\nat$, so we are unable to make a distinction between sublevels $l$ and $l+1$. To establish Lemma~\ref{kl-lemma-2} in this case, we again wish to show that we cannot pass in the content of the relevant $\vec{x}\,'$ to the relevant $s_i$, but now the idea is to appeal to the fact that $\vec{x}\,'$ consists of $l+1$ variables of type $\nat$, whereas $s_i$ accepts at most $l$ arguments of type $\nat$. (We have already seen that $\nat^{l+1}$ cannot be a retract of $\nat^l$.) However, we also need to exclude the possibility that the substitution $^\circ$ is being used to import some components of $\vec{x}\,'$. We can achieve this if we require $^\circ$ to be actually closed rather than just $\vec{x}\,',V'$-closed, and it turns out that this is permissible if we also tighten our notion of spinal term slightly, essentially to ensure that no intermediate applications of $g$ appear in between those declared to constitute the spine of the term: \begin{definition} \label{strongly-spinal-def} Suppose $g : \rho_{1,l+1} \rightarrow \rho_{1,l+1}$ where $l \geq 1$. Suppose $\Gamma \vdash e$ is $g$-$1,l$-regular and $\vec{x} \subseteq \Gamma$. We coinductively declare $e$ to be \emph{strongly $g$-head-spinal} w.r.t.\ $\vec{x}$ iff $e$ has the form $\caseof{g(\lambda \vec{x}\,'.E[e'])\vec{o}}{\cdots}$, where $E[-]$ is an expression context, and \begin{itemize} \item the hole within $E[-]$ does not itself occur within an application $gpq$, \item for some closed substitution $^\circ$ covering the free variables of $\vec{o}$ other than those of $\vec{x}$, we have $\vec{o}\,^\circ \succeq \vec{x}^{\,\eta}$, \item $e'$ is strongly $g$-head-spinal w.r.t.\ $\vec{x}\,'$. \end{itemize} The notion of strongly $g$-spinal term follows suit. \end{definition} The counterpart of Lemma~\ref{g-lemma-1} goes through as expected, although without part~(iii): the relevant sublevel distinction does not exist at type level $0$, and we cannot conclude that the substitution in question is trivial for all variables of type $\nat$. We may now indicate the required changes to Lemma~\ref{kl-lemma-2} and its proof: \begin{lemma} Suppose $g: \rho_{1,l+1} \rightarrow \rho_{1,l+1}$ and we have $1,l$-regular terms \[ \Gamma,\vec{v} \;\vdash~ d ~=~ \caseof{gpq}{\cdots} \;, ~~~~~~ \Gamma,\vec{v}\,' \vdash \vec{s} \,, \] where $\vec{v},\vec{v}\,'$ are of sublevel $\leq (1,l)$, and $\Gamma,\vec{v}\,' \vdash\, \dang{d[\vec{v}\mapsto\vec{s}\,]}$ is strongly $g$-head-spinal with respect to some $\vec{x}$. Then $d$ itself is strongly $g$-spinal. \end{lemma} \begin{proof} The proof of Lemma~\ref{g-lemma-2} up to the end of the proof of Claim~1 adapts straightforwardly, and is somewhat simplified by the fact that the substitution $^\circ$ is closed. As sketched above, the crucial contradiction is provided by the fact that $\nat^{l+1}$ is not a pseudo-retract of $\nat^l$ in ${\mathsf{SF}}$. For the remainder of the proof, the key point to note is that $\vec{v}\,''$ (the local environment for $C[-]$) is actually empty in this case. This is because $C[-]$ is in normal form and contains no free variables of level $\geq 2$ except $g$, so any $\lambda$-term containing the hole would need to appear as an argument to $g$. It would then follow that the hole within $E[-]$ lay within an argument to some occurrence of $g$, as precluded by the definition of strongly spinal term. It follows trivially that the $\vec{x}\,',\vec{v}\,''$-closed substitution $^{\circ'}$ constructed at the very end of the proof is actually closed. Moreover, the spinal structure of $d'$ identified by the proof cannot contain any intermediate applications of $g$, since these would give rise under evaluation to intermediate applications of $g$ in the spine of $\dang{d[\vec{v}\mapsto\vec{s}\,]}$ as precluded by Definition~\ref{strongly-spinal-def}. Thus, the identified spinal structure in $d'$ is actually a strongly spinal structure, and the argument is complete. $\Box$ \end{proof} \vspace*{1.0ex} A trivial adaptation of the proof of Theorem~\ref{no-gremlin-thm} now yields: \begin{theorem} No ${\mathrm{PCF}}^\Omega_{1,l}$-denotable procedure can be strongly $g$-spinal where $g: \rho_{1,l+1} \rightarrow \rho_{1,l+1}$. $\Box$ \end{theorem} As before, this adapts easily to a variable $g$ of type $0 \rightarrow \rho_{1,l+1} \rightarrow \rho_{1,l+1}$. From here on, we again follow the original proof closely. The only additional point to note is that in place of Corollary~\ref{spinal-cor} we now require that any simple $g \vdash q$ with $q \succeq' p_n$ must be \emph{strongly} spinal, but this is already clear from the proof of Lemma~\ref{q-structure-lemma}. We therefore have everything we need for: \begin{theorem} (i) For any $l \geq 1$, $Y_{\nat^{l+2} \rightarrow \nat} \in {\mathsf{SF}}$ is not denotable in ${\mathrm{PCF}}^\Omega_{1,l}$. (ii) $Y_2 \in {\mathsf{SF}}$ is not denotable in ${\mathrm{PCF}}^\Omega_1$. $\Box$ \end{theorem} The proof of Theorems~\ref{operational-main-thm} and \ref{SF-main-thm} is now complete. \section{Related and future work} \label{sec-further-work} \subsection{Other hierarchies of Y-combinators} There have been a number of previous results from various research traditions showing that in some sense the power of level $k$ recursions increases strictly with $k$. Whilst many of these results look tantalizingly similar to ours, it turns out on inspection that their mathematical substance is quite different, and we do not expect any substantial technical connections with our own work to be forthcoming. Nonetheless, it is interesting to see how strikingly different ideas and methods arising in other contexts can lead to superficially similar results. Previous results to the effect that $Y$-combinators for level $k+1$ are not definable from those for level $k$ have been obtained by Damm \cite{Damm-IO} and Statman \cite{Statman-lambda-Y}. It is convenient to discuss the latter of these first. Statman works in the setting of the simply typed \emph{$\lambda Y$-calculus}, essentially the pure $\lambda$-calculus extended with constants $Y_\sigma : (\sigma\rightarrow\sigma)\rightarrow\sigma$ and reduction rules $Y_\sigma M \rightsquigarrow M(Y_\sigma M)$. He gives a succinct proof that $Y_{k+1}$ is not definable from $Y_k$ up to computational equality, based on the following idea. If $Y_{k+1}$ were definable from $Y_k$, it would follow that the recursion equation $Y_{k+1} g = g(Y_{k+1} g)$ could be derived with only finitely many uses of the equation $Y_k M = M(Y_k M)$ (say $m$ of them). It would then follow, roughly speaking, that $mn$ recursion unfoldings for $Y_k$ would suffice to fuel $n$ recursion unfoldings for $Y_{k+1}$. On the other hand, it can be shown that the size of normal-form terms definable using $n$ unfoldings of $Y_{k+1}$ (as a function of the size of the starting term) grows faster than can be accounted for with $mn$ unfoldings of $Y_k$. The language $\lambda Y$ is seemingly less powerful than ${\mathrm{PCF}}$,% \footnote{One might consider translating ${\mathrm{PCF}}$ into $\lambda Y$ by representing natural numbers as Church numerals; however, it appears that predecessor is not $\lambda Y$-definable for this representation.} although this is perhaps not the most essential difference between Statman's work and ours. More fundamentally, Statman's method establishes the non-definability only up to computational equality (that is, the equivalence relation generated by the reduction rules), whereas we have been concerned with non-definability modulo observational (or extensional) equivalence. Even for non-denotability in ${\mathsf{SP}}^0$, an approach along Statman's lines would be unlikely to yield much information, since there is no reason why the number of unfoldings of $Y_k$ required to generate the NSP for $Y_{k+1}$ to depth $n$ should not grow dramatically as a function of $n$. A result very similar to Statman's was obtained earlier in Damm \cite{Damm-IO}, but by a much more indirect route as part of a far-reaching investigation of the theory of tree languages. In Damm's setting, programs are \emph{recursion schemes}---% essentially, families of simultaneous (and possibly mutually recursive) defining equations in typed $\lambda$-calculus---but in essence these can be considered as terms of $\lambda Y$ relative to some signature consisting of typed constants. (Actually, Damm's $\lambda$-terms involve a restriction to \emph{derived types}, which has the effect of limiting attention to what are elsewhere called \emph{safe} recursion schemes.) Any such program can be expanded to an infinite tree (essentially a kind of B\"ohm tree), and Damm's result (Theorem~9.8 of \cite{Damm-IO}) is that if programs are considered up to \emph{tree equality}, then safe level $k+1$ recursions give more expressive power than safe level $k$ ones. Damm's result is thus distinguished from Statman's in two ways: by the restriction to safe recursion schemes, and by the use of tree equality in place of the stricter computational equality. This latter point brings Damm's work somewhat closer in spirit to our work: indeed, in the case of pure $\lambda Y$, tree equality agrees with equality of innocent strategies if the base type is interpreted as a certain trivial game---or equivalently with equality in a variant of our ${\mathsf{SP}}^0$ with no ground type values. However, in the case of a signature for ${\mathrm{PCF}}$, tree equality will still be considerably more fine-grained than equality in ${\mathsf{SP}}^0$, let alone in ${\mathsf{SF}}$, since in effect the ${\mathrm{PCF}}$ constants are left uninterpreted. It therefore seems unlikely that an approach to our theorems via Damm's methods is viable. The strictness of the recursion scheme hierarchy was further investigated by Ong \cite{Ong-model-checking}, who used innocent game semantics to show that the complexity of certain model checking problems for trees generated by level $k$ recursions increases strictly with $k$. It was also shown by Hague, Murawski, Ong and Serre \cite{Collapsible-PDA} that the trees generated by level $k$ recursion schemes (with no safety restriction) were precisely those that could be generated by \emph{collapsible pushdown automata} of order $k$. Later, Kartzow and Parys \cite{Kartzow-Parys} used pumping lemma techniques to show that the collapsible pushdown hierarchy was strict, hence so was the recursion scheme hierarchy with no safety restriction. Again, despite the intriguing parallels to our work, these results appear to be manifesting something quite different: in our setting, the power of level $k$ recursion has nothing to do with the `difficulty of computing' the relevant NSPs in the sense of automata theory, since the full power of Turing machines is required even at level~1. Also of interest is the work of Jones \cite{Jones-cons-free} from the functional programming community. Jones's motivation is close to ours in that he seeks to give mathematical substance to the programming intuition that some (combinations of) language features yield `more expressive power' than others. As Jones notes, an obvious obstacle to obtaining such results is that all programming languages of practical interest are Turing complete, so that no such expressivity distinctions are visible at the level of the (first-order) computable functions. Whereas we have responded to this by considering the situation at higher types, where genuine expressivity differences do manifest themselves, Jones investigates the power of (for example) recursion at different type levels in the context of a restricted language of `read-only' or `cons-free' programs. Amongst other results, he shows that in such a language, if data values and general recursion of type level $k \geq 1$ are admitted, then the computable functions from lists of booleans to booleans are exactly the {\sc{exp}$^k$\sc{time}} computable ones. These results inhabit a mathematical territory very different from ours, although yet again, the basic moral that the power of recursion increases strictly with its type level shines through. \subsection{Relationship to game semantics} Next, we comment briefly how our work relates to the known \emph{game models} of PCF \cite{AJM,Hyland-Ong}. It is known that these models are in fact isomorphic to our ${\mathsf{SP}}^0$, although the equivalence between the game-theoretic definition of application and our own is mathematically non-trivial (see \cite[Section~7.4]{Longley-Normann}). This raises the obvious question of whether our proofs could be conducted equally well, or better, in a game-semantical setting. Whilst a direct translation is presumably possible, our present impression is that the sequential procedure presentation, and our calculus of meta-terms in particular, allows one to see the wood for the trees more clearly, and also to draw more easily on familiar intuitions from $\lambda$-calculus. However, a closer look at game-semantical approaches would be needed in order to judge whether either approach really offers some genuine mathematical or conceptual advantage over the other. \subsection{Sublanguages of ${\mathrm{PCF}}$: further questions} \label{sublang-questions} We now turn our attention to some potential extensions and generalizations of our work. So far, we have worked mainly with a coarse stratification of types in terms of their levels, although we have illustrated in Section~\ref{sec-pure-type} how finer stratifications are also possible. Naturally, there is scope for a still more fine-grained analysis of types and the relative strength of their $Y$-combinators; this is of course closely related to the task of mapping out the embeddability relation between types (as in Subsection~\ref{subsec-embed}) in finer detail. Even at level~1, there is some interest here. Our analysis in Section~\ref{sec-pure-type} has shown that, for $l \geq 1$, \begin{itemize} \item the element $Y_{\nat^{l+1} \rightarrow \nat} \in {\mathsf{SP}}^0$ is not ${\mathrm{PCF}}^\Omega_0$-definable from $Y_{\nat^l \rightarrow \nat}$, \item the element $Y_{\nat^{l+2} \rightarrow \nat} \in {\mathsf{SF}}$ is not ${\mathrm{PCF}}^\Omega_0$-definable from $Y_{\nat^l \rightarrow \nat}$. \end{itemize} However, this leaves us with a small gap for ${\mathsf{SF}}$: e.g.\ we have not shown either that $Y_{\nat\rightarrow\nat}$ is strictly weaker than $Y_{\nat^2\rightarrow\nat}$ or that $Y_{\nat^2\rightarrow\nat}$ is strictly weaker than $Y_{\nat^3\rightarrow\nat}$, although according to classical logic, at least one of these must be the case. (This is reminiscent of some well-known situations from complexity theory.) We expect that a more delicate analysis will allow us to fill this gap. One can also envisage an even more fine-grained hierarchy obtained by admitting other base types such as the booleans or unit type. A closely related task is to obtain analogous results for the \emph{call-by-value} interpretation of the simple types (as embodied in Standard~ML, for example). As is shown in \cite[Section~4.3]{Longley-Normann}, a call-by-value (partial) type structure ${\mathsf{SF}}_v$ can be constructed by fairly general means from ${\mathsf{SF}}$: here, for example, ${\mathsf{SF}}_v(\pure{1})$ consists of all partial functions $\mathbb{N} \rightharpoonup \mathbb{N}$ rather than (monotone) total functions $\mathbb{N}_\bot \rightarrow \mathbb{N}_\bot$, and ${\mathsf{SF}}_v(\pure{2})$ consists of partial functions $\mathbb{N}_\bot^\mathbb{N} \rightharpoonup \mathbb{N}$. From known results on the interencodability of call-by-name and call-by-value models (see \cite[Section~7.2]{Longley-Normann}), it is easy to read off the analogue of Corollary~\ref{no-finite-basis-cor} for ${\mathsf{SF}}_v^{\mbox{\scriptsize \rm eff}}$; however, more specific results on the relative strengths of various $Y$-combinators within ${\mathsf{SF}}_v$ would require some further reworking of our arguments.% Of course, one can also pose relative definability questions for other elements besides $Y$-combinators. For instance, it is natural to consider the \emph{higher-order primitive recursors} ${\mathit{rec}}_\sigma$ of System~T, as well as the closely related \emph{iterators} ${\mathit{iter}}_{\sigma\tau}$: \begin{eqnarray*} {\mathit{rec}}_\sigma & : & \sigma \rightarrow (\sigma \rightarrow \nat \rightarrow \sigma) \rightarrow \nat \rightarrow \sigma \;, \\ {\mathit{iter}}_{\sigma\tau} & : & (\sigma\rightarrow (\sigma + \tau)) \rightarrow \sigma \rightarrow \tau \;. \end{eqnarray*} The idea behind the latter is to embody the behaviour of a \emph{while} construct for imperative-style loops with state $\sigma$ and exit type $\tau$.% \footnote{The sum type $\sigma + \tau$ is not officially part of our system, but can (for any given $\sigma,\tau$) be represented as a retract of some existing simple type.} It is shown in \cite[Section~6.3]{Longley-Normann} that each ${\mathit{rec}}_\sigma$ may be interpreted by a \emph{left-well-founded} procedure (cf.\ Subsection~\ref{subsec-power-pcf1}), and it is not hard to check that the same is true for each ${\mathit{iter}}_{\sigma\tau}$. Furthermore, it is clear that all left-well-founded procedures are non-spinal, so it requires only the addition of an easy base case in the proof of Theorem~\ref{no-gremlin-thm} to show that $Y_{k+1}$ cannot be defined even in ${\mathrm{PCF}}_k^\Omega$ extended with all primitive recursors and iterators. (Actually, we can dispense with the primitive recursors here, as it is straightforward to define them from suitable iterators.) The dual question, roughly speaking, is whether any or all of the recursors ${\mathit{rec}}_\sigma$ or iterators ${\mathit{iter}}_{\sigma\nat}$ for types $\sigma$ of level $k+1$ are definable in ${\mathrm{PCF}}_k$. We conjecture that they are not, and that this could be shown by suitably choosing a substructure of ${\mathsf{SP}}^0$ so as to exclude such ${\mathit{iter}}_{\sigma\nat}$. (This would incidentally answer Question~2 of \cite[Section~5]{Berger-min-recursion}.) One could also look for substructures that more precisely determine the strength of various \emph{bar recursion} operators or the \emph{fan functional}. All in all, our experience leads us to expect that many further substructures of ${\mathsf{SP}}^0$ should be forthcoming, leading to a harvest of non-definability results exhibiting a rich `degree structure' among ${\mathrm{PCF}}$-computable functionals. Another very natural kind of question is the following: given a particular sublanguage ${\mathcal{L}}$ of ${\mathrm{PCF}}$, what is the \emph{simplest} possible type for an element of ${\mathsf{SF}}^{\mbox{\scriptsize \rm eff}}$ that is not denotable in ${\mathcal{L}}$? Or to look at it another way: given a type $\sigma$, what is the smallest natural sublanguage of ${\mathrm{PCF}}$ that suffices for defining all elements of ${\mathsf{SF}}^{\mbox{\scriptsize \rm eff}}(\sigma)$? Here the analysis of \cite[Section~7.1]{Longley-Normann} yields several positive definability results, whilst the analysis of the present paper provides ammunition on the negative side. The current state of our knowledge is broadly as follows. As in \cite{Longley-Normann}, we write ${\Klex^\smallmin}$ of the language of \emph{Kleene $\mu$-recursion}: this is equivalent (in its power to denote elements of ${\mathsf{SF}}$) to ${\mathrm{PCF}}_0$ extended with a strict primitive recursor for ground type and a strict iterator for ground type, but with no form of general recursion. \begin{itemize} \item For first-order types $\sigma$, even ${\Klex^\smallmin}$ suffices for defining all elements of ${\mathsf{SF}}^{\mbox{\scriptsize \rm eff}}(\sigma)$; likewise, the oracle version ${\Klex^\smallmin}^\Omega$ suffices for ${\mathsf{SF}}(\sigma)$. \item For second-order types $\sigma$ of the special form $(\nat\rightarrow\nat)^r \rightarrow \nat$, ${\Klex^\smallmin}^\Omega$ still suffices for ${\mathsf{SF}}(\sigma)$; however, this result is non-constructive, and ${\Klex^\smallmin}$ does not suffice for ${\mathsf{SF}}^{\mbox{\scriptsize \rm eff}}(\sigma)$. (We draw here on some recent work of Dag Normann \cite{Normann-sequential-dcpo}.) \item For general second-order types, ${\Klex^\smallmin}^\Omega$ no longer suffices, but the languages ${\mathrm{PCF}}_1$, ${\mathrm{PCF}}_1^\Omega$ suffice for ${\mathsf{SF}}^{\mbox{\scriptsize \rm eff}}$, ${\mathsf{SF}}$ respectively---% indeed, even the single recursion operator $Y_{\nat\rightarrow\nat}$ is enough here. \item For third-order types, we do not know whether ${\mathrm{PCF}}_1$ suffices (for ${\mathsf{SF}}^{\mbox{\scriptsize \rm eff}}$). We do know that ${\mathrm{PCF}}_2$ suffices, and that $Y_{\nat\rightarrow\nat}$ alone is not enough. \item For types of level $k \geq 4$, ${\mathrm{PCF}}_{k-3}$ does not suffice, but ${\mathrm{PCF}}_{k-2}$ does. \end{itemize} Again, there is scope for a more fine-grained view of the hierarchy of types. \subsection{Other languages and models} We have so far concentrated almost entirely on ${\mathrm{PCF}}$-style sequential computation. To conclude, we briefly consider which other notions of higher-order computation are likely to present us with an analogous situation. As already noted at the end of Subsection~\ref{subsec-embed}, several extensions of ${\mathrm{PCF}}$ studied in the literature present a strikingly different picture: in these settings, universal types exist quite low down, and as a consequence, only $Y$-combinators of low type (along with the other constants of the language) are required for full definability. There is, however, one important language which appears to be more analogous to pure ${\mathrm{PCF}}$ in these respects, namely an extension with \emph{local state} (essentially Reynolds's \emph{Idealized Algol}). This language was studied in \cite{Game-semantics}, where a fully abstract game model was provided (consisting of well-bracketed but possibly non-innocent strategies). Unpublished work by Jim Laird has shown that there is no universal type in this setting. We would conjecture also that the recursion hierarchy for this language is strict, where we consider expressibility modulo observational equivalence in Idealized Algol. This would constitute an interesting variation on our present results. Related questions also arise in connection with \emph{total} functionals. Consider, for example, the type structure ${\mathsf{Ct}}$ of total continuous functionals, standardly constructed as the extensional collapse (relative to $\mathbb{N}$) of the Scott model ${\mathsf{PC}}$ of partial continuous functionals. It is shown by Normann \cite{Normann2000} that every effective element of ${\mathsf{Ct}}$ is represented by a \emph{${\mathrm{PCF}}$-denotable} element of ${\mathsf{PC}}$, and the proof actually shows that ${\mathrm{PCF}}_1$ suffices here. (The further generalization of these ideas by Longley \cite{Ubiquity} makes some use of second-order recursions as in ${\mathrm{PCF}}_2$; we do not know whether these can be eliminated.) Thus, in this setting, only recursions of low type are needed to obtain all computable functionals. Similar remarks apply to the total type structure ${\mathsf{HEO}}$, obtained as the extensional collapse of ${\mathsf{PC}}^{\mbox{\scriptsize \rm eff}}$. On the other hand, one may consider the \emph{Kleene computable} functionals over ${\mathsf{Ct}}$, or over the full set-theoretic type structure ${\mathsf{S}}$, as defined by the schemes S1--S9. As explained in \cite[Chapter~6]{Longley-Normann}, sequential procedures can be seen as abstracting out the algorithmic content common to both ${\mathrm{PCF}}$-style and Kleene-style computation (note that Kleene's S9 in some sense does duty for the $Y$-combinators of ${\mathrm{PCF}}$). This naturally suggests that our strict hierarchy for ${\mathrm{PCF}}$ may have an analogue for the Kleene computable functionals (say over ${\mathsf{S}}$ or ${\mathsf{Ct}}$), where at level $k$ we consider the evident restriction of S9 to types of level $\leq k$. We conjecture that this is indeed the case, although the required counterexamples may be more difficult to find given that we are limited to working with total functionals. \section*{Appendix A: Super-identity procedures} In the course of our proof, we have frequently encountered assertions of the form $p \succeq x^\eta$ for various procedures $x^k \vdash p$. Although not necessary for our main argument, it is natural to ask whether there are any such procedures other than those for which $p \approx x^\eta$. The following theorem shows that the answer is no: in other words, no procedure $\lambda x.p : \pure{k} \rightarrow \pure{k}$ can extensionally `improve on' the identity function. We present this as a result of some interest in its own right, whose proof is perhaps less trivial than one might expect. Recall that $\preceq$ denotes the extensional order on ${\mathsf{SF}}$, as well as the associated preorder on ${\mathsf{SP}}^0$. Within ${\mathsf{SF}}$, we will write $f \prec f'$ to mean $f \preceq f'$ but $f \neq f'$; we also write $f \sharp f'$ to mean that $f,f'$ have no upper bound with respect to $\preceq$. We call an element of ${\mathsf{SP}}^0$ \emph{finite} if it is a finite tree once branches of the form $i \Rightarrow \bot$ have been deleted. We say an element of ${\mathsf{SF}}$ is \emph{finite} if it is represented by some finite element of ${\mathsf{SP}}^0$. We write ${\mathsf{SP}}^{0,{\mbox{\scriptsize \rm fin}}}(\sigma), {\mathsf{SF}}^{\mbox{\scriptsize \rm fin}}(\sigma)$ for the set of finite elements in ${\mathsf{SP}}^0(\sigma), {\mathsf{SF}}(\sigma)$ respectively. \begin{theorem} \label{super-identity-thm} (i) If $f \in {\mathsf{SF}}^{\mbox{\scriptsize \rm fin}}(k)$ and $f \prec f'$, then there exists $f'' \sharp f'$ with $f \prec f''$. (ii) If $\Phi \in {\mathsf{SF}}(k \rightarrow k)$ and $\Phi \succeq {\mathit{id}}$, there can be no $f \in {\mathsf{SF}}(k)$ with $\Phi(f) \succ f$; hence $\Phi = {\mathit{id}}$. \end{theorem} \begin{proof} (i) The cases $k=0,1$ are easy, so let us assume $k \geq 2$. Suppose $f \prec f'$ where $f$ is finite. Then for some $g \in {\mathsf{SF}}(k-1)$ we have $f(g)=\bot$ but $f'(g)=n \in \mathbb{N}$, say, and by continuity in ${\mathsf{SP}}^0$ we may take $g$ here to be finite. Take $p,q \in {\mathsf{SP}}^{0,{\mbox{\scriptsize \rm fin}}}$ representing $f,g$ respectively; we may assume that $p,q$ are `pruned' so that every subtree containing no leaves $m \in \mathbb{N}$ must itself be $\bot$. \textit{Case 1:} $g(\bot^{k-2}) = a \in \mathbb{N}$. In this case, we may suppose that $q = \lambda x.a$. Consider the computation of $p \cdot q$. Since all calls to $q$ trivially evaluate to $a$, this computation follows the rightward path through $p$ consisting of branches $a \Rightarrow \cdots$. But since $p$ is finite and $p \cdot q = \bot$ (because $f(g)=\bot$), this path must end in a leaf occurrence of $\bot$ within $p$. Now extend $p$ to a procedure $p'$ by replacing this leaf occurrence by some $n' \neq n$; then clearly $p' \cdot q = n'$. Taking $f''$ to be the function represented by $p'$, we then have $f \preceq f''$ and $f''(g) = n' \,\sharp\, n = f'(g)$, so $f'' \sharp f'$ (whence also $f'' \neq f$ so $f \prec f''$). \textit{Case 2:} $g(\bot^{k-2}) = \bot$. Take $N$ larger than $n$ and all numbers appearing in $p,q$. Define $p' \sqsupseteq p$ as follows: if $p = \lambda x.\bot$, take $p' = \lambda x.N$, otherwise obtain $p'$ from $p$ by replacing each case branch $j \Rightarrow \bot$ anywhere within $p$ by $j \Rightarrow N$ whenever $j \leq N$. Extend $q$ to $q'$ in the same way. Note in particular that every ${\mathtt{case}}$ subterm within $p',q'$ will now be equipped with a branch $N \Rightarrow N$. Now consider the computation of $p \cdot q$. Since $p,q$ are finite and $f(g)=\bot$, this evaluates to an occurrence of $\bot$ which originates from $p$ or $q$. Since no numbers $>N$ ever arise in the computation, this occurrence of $\bot$ cannot be part of a branch $j \Rightarrow \bot$ for $j>N$, so will have been replaced by $N$ in $p'$ or $q'$. Now suppose that we head-reduce $pq$ until $\bot$ first appears in head position, and let $U$ be the resulting meta-term. Then it is easy to see that $p'q'$ correspondingly reduces to a meta-term $U'$ with $N$ in head position. (Formally, we reason here by induction on the length of head-reduction sequences not involving the rule for $\caseof{\bot}{\cdots}$.) We now claim that $p' \cdot q' = N$. Informally, this is because the head occurrence of $N$ in $U'$ will be propagated to the top level by the case branches $N \Rightarrow N$ within both $p'$ and $q'$. More formally, let us define the set of meta-expressions \emph{led by $N$} inductively as follows: \begin{itemize} \item $N$ is led by $N$. \item If $E$ is led by $N$, then so is $\caseof{E}{i \Rightarrow D_i}$. \end{itemize} We say that an NSP meta-term $T$ is \emph{saturated at $N$} if every ${\mathtt{case}}$ subterm within $T$ has a branch $N \Rightarrow E$ where $E$ is led by $N$. Clearly $p'q'$ is saturated at $N$, and it is easy to check that the terms saturated at $N$ are closed under head reductions; thus $U'$ is saturated at $N$. But we have also seen that $U'$ has $N$ in head position, so is led by $N$. Finally, an easy induction on term size shows that every finite meta-term that is led by $N$ and saturated at $N$ evaluates to $N$ itself. This shows that $p' \cdot q' = N$. To conclude, let $f'',g'$ be the functions represented by $p',q'$ respectively, so that $f \preceq f''$ and $g \preceq g'$. Then $f'(g')=n$, but $p'' \cdot q = N$ so $f''(g')=N \neq n$, whence $f'' \sharp f'$ (and also $f'' \neq f$ so $f \prec f''$). (ii) Suppose $\Phi \succeq {\mathit{id}}$ and $\Phi(f) \succ f$ for some $f$. Again by continuity, we may take $f$ to be finite. Then by (i), we may take $f'' \succ f$ such that $f'' \,\sharp\, \Phi(f)$. But this is impossible because $\Phi(f'') \succeq f''$ and $\Phi(f'') \succeq \Phi(f)$. Thus $\Phi={\mathit{id}}$. $\Box$ \end{proof} \vspace*{1.0ex} It is easy to see that the above theorem holds with any finite type over $\nat$ in place of $\pure{k}$. However, it will trivially fail if the unit type $\unit$ is admitted as an additional base type: e.g.\ the function $(\lambda x.\top) \in {\mathsf{SF}}(\unit\rightarrow\unit)$ strictly dominates the identity. An interesting question is whether the theorem holds for all finite types over the type $\bool$ of booleans: note that the above proof fails here since it requires the base type to be infinite. For comparison, we mention that in other models of computation, improvements on the identity are sometimes possible for such types. For example, if $\sigma=\bool\rightarrow\bool$, then a functional of type $\sigma\rightarrow\sigma$ strictly dominating the identity exists in the Scott model. Indeed, such a function $J$ can be defined in ${\mathrm{PCF}}$ augmented with the parallel conditional ${\mathit{pif}}$, e.g.\ as \[ J ~=~ \lambda f^\sigma.\lambda x^\bool.\,\mathit{vote}(f(x),f({\mathit{tt}}),f({\mathit{ff}})) \;. \] Here $\mathit{vote}$ is Sazonov's voting function, definable by \[ \mathit{vote}(x,y,z) ~=~ {\mathit{pif}}(x,{\mathit{pif}}(y,{\mathit{tt}},z),{\mathit{pif}}(y,z,{\mathit{ff}})) \;. \] The point is that $J$ will `improve' the function $\lambda x.\,{\mathit{if}}(x,{\mathit{tt}},{\mathit{tt}})$ to $\lambda x.{\mathit{tt}}$. We do not know whether phenomena of this kind can arise within the model ${\mathsf{SF}}$.
{'timestamp': '2018-06-20T02:09:57', 'yymm': '1607', 'arxiv_id': '1607.04611', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04611'}
arxiv
\section{Introduction} \label{sec:intro} As a key part of the human visual system, visual attention mechanisms filter irrelevant visual stimuli in order to focus more on the important parts. Computational models of attention try to mimic this process through the use of machines and algorithms. These models have gained increasing attention lately. The reason behind this growing interest lies in their use in different computer vision and multimedia problems including but not limited to image retrieval~\cite{5730497}, visual quality assessment~\cite{7303954,7444164} video resizing/summarization~\cite{6529173,6527322}, action recognition~\cite{Wang2017}, event detection~\cite{Gan2015} either as a tool for visual feature extraction or as a mechanism for selecting features. These models are also important for generic applications such as advertisement and web design~\cite{7294708} as attention plays a key role in both user interfaces and human-machine interaction. In the literature, the computational attention models developed so far generally aim to predict where humans fixate their eyes in images~\cite{borji2013state}. Specifically, they produce the so-called saliency maps from the visual data where a high saliency score at an image location indicates that the point is more likely to be fixated. These models are largely inspired by the hierarchical processing of human visual system~\cite{Hubel1962} and the theoretical studies like Feature Integration Theory~\cite{Treisman:CogPsych1980} or Guided Search Model~\cite{Wolfe:PsychBul1994}. They consider low-level image features (color, orientation, contrast, motion, etc.) and/or high-level features (pedestrians, faces, text) while predicting saliency maps. In this process, while low-level features are employed to examine how different an image point from its surroundings, high-level features are employed as it is experimentally shown that humans have a tendency to fixate on certain object classes more than others. Another current trend in the existing literature is to detect salient objects~\cite{6331539,borji2015salient,7347445,7514760} from the images. These models specifically aim at identifying the most prominent objects in an image that attract attention under free-viewing conditions and then segmenting them out from the background. These computational models for visual attention can be further grouped into two according to their inputs as static and dynamic saliency models. While static models work on images, dynamic models take video sequences as input. Saliency prediction from videos leads to great challenges when it is compared to carrying out the same task in still images. The reason is that the dynamic saliency frameworks require taking into account both spatial and temporal characteristics of the video sequences. Static saliency models use features like color, intensity and orientation, however dynamic models need to focus more on the moving objects or image parts as it is shown that humans there is a tendency for humans to look at them while viewing. Hence, the preliminary models proposed for dynamic saliency prediction extend the existing saliency models suggested for still images so that they consider extra motion features~\cite{harel2006graph,guo2008spatio,cui2009temporal,seo2009static}. However, more recent works approach the same task from a different point of view and propose novel solutions~\cite{hou2007saliency,mathe2012dynamic,rudoy2013learning}. \subsection{Overview of our approach} Deep learning has been successfully applied to saliency prediction in still images in the last few years, providing state-of-the-art results~\cite{Kümmerer2014b,pan2016shallow,kruthiventi2015deepfix,vig2014large,zhao2015saliency,Bruce_2016_CVPR,Jetley_2016_CVPR}. The early models utilize pre-trained deep convolutional neural networks (CNNs) proposed to classify images as generic feature extractors and build classifiers on top of those features to classify fixated image regions~\cite{vig2014large,Kümmerer2014b}. Later models, however, approach the problem from an end-to-end perspective and either train networks from scratch or most of the time fine-tune the weights of a pre-trained model~\cite{Kruthiventi_2016_CVPR, Jetley_2016_CVPR,pan2016shallow}. The modifications in the network architectures are usually about integrating multi-scale processing or using different loss functions~\cite{HuangSALICON2015,Jetley_2016_CVPR}. It has been investigated that the power of these deep models mainly comes from the property that the features learned by these networks are semantically very rich~\cite{Bruce_2016_CVPR}, capturing high-level factors important for saliency detection. Motivated by the success of these works, in this study, we explore the use of two-stream CNNs for saliency prediction from videos. To the best of our knowledge, our work is the first deep model for dynamic saliency, which is trained in an end-to-end manner, that learns to combine spatial and temporal information in an optimal manner within a two-stream network architecture. \subsection{Our contributions} The contributions of our work can be summarized as follows: \begin{enumerate} \item We study two-stream convolutional neural networks which mimic the visual pathways in the brain and combine networks trained on temporal and spatial information to predict saliency map of a given video frame. Although these network architectures have been previously investigated for some computer vision problems such as video classification~\cite{karpathy2014large} and action recognition~\cite{simonyan14b}, to our knowledge, we are the first to apply two-stream deep models for saliency prediction from videos in the literature. In particular, in our study, we investigate two different fusion strategies, namely element-wise and convolutional fusion strategies, to integrate spatial and temporal streams. \item We carry out extensive experiments on DIEM ~\cite{mital2011clustering} and UCF-Sports~\cite{MatheSminchisescuPAMI2015} datasets and compare our deep spatio-temporal saliency networks against several state-of-the-art dynamic saliency models. Our evaluation demonstrates that the proposed STSConvNet model outperforms these models in nearly all of the evaluation metrics on these datasets. \item On a number of challenging still images, we also show that our spatio-temporal saliency network can predict the human fixations better than the state-of-the-art deep static saliency models. The key idea that we follow is to extract optical flow from these static images by using a recently proposed method~\cite{walker2015dense} and feed them to our network along with the appearance image. \end{enumerate} \section{Related Work} In this study, we focus on bottom-up modeling of dynamic saliency. Below, we first summarize the existing dynamic saliency models from the literature and then provide a brief overview of the proposed deep-learning based static saliency models which are related to ours. \subsection{Dynamic Saliency} Early examples of saliency models for dynamic scenes extend the previously proposed static saliency models which process images in a hierarchical manner by additionally considering features related to motion such as optical flow. For instance, in~\cite{harel2006graph}, Harel \emph{et al.} propose a graph-theoretic solution to dynamic saliency by representing the extracted feature maps in terms of fully connected graphs and by predicting the final saliency map. In~\cite{cui2009temporal}, Cui \emph{et al.} extract salient parts of video frames by performing spectral residual analysis on the Fourier spectrum of these frames over the spatial and the temporal domains. In~\cite{guo2008spatio}, Guo \emph{et al.} propose a similar spectral analysis based formulation. In~\cite{sultani2014human}, Sultani and Saleemi extend Harel \emph{et al.}~\cite{harel2006graph}'s model by using additional features such as color and motion gradients and by post-processing the predicted maps via a graphical model based on Markov Random Fields. In~\cite{seo2009static}, Seo and Milanfar employ self similarities of spatio-temporal volumes to predict saliency. ~\cite{mauthner2015encoding}, Mauthner \emph{et al.} also present a video saliency detection method for using as a prior information for activity recognition algorithms. Instead of using a data driven approach they propose an unsupervised algorithm for estimating salient regions of video sequences. Following these early works, other researchers rather take different perspectives and devise novel solutions for dynamic saliency. For example, in~\cite{hou2007saliency}, Hou and Zhang consider rarity of visual features while extracting saliency maps from videos and propose an entropy maximization-based model. In~\cite{rahtu2010segmenting}, Rahtu \emph{et al.} extract saliency by estimating local contrast between feature distributions. In~\cite{Ren2012}, Ren \emph{et al.} propose a unified model with the temporal saliency being estimated by sparse and low-rank decomposition and the spatial saliency map being extracted by considering local-global contrast information. In~\cite{mathe2012dynamic}, Mathe \emph{et al.} devise saliency prediction from videos as a classification task where they integrate several visual cues through learning-based fusion strategies. In another study, Rudoy \emph{et al.}~\cite{rudoy2013learning} propose another learning based model for dynamic saliency. It differs from Mathe \emph{et al.}'s model~\cite{mathe2012dynamic} in that they take into account a sparse set of gaze locations thorough which they predict conditional gaze transitions over subsequent video frames. Zhou \emph{et al.}~\cite{zhou2014learning} oversegment video frames and use low-level features from the extracted regions to estimate regional contrast values. Zhao \emph{et al.}~\cite{zhao2015fixation} learn a bank of filters for fixations and use it to model saliency in a location-dependent manner. Khatoonabadi \emph{et al.}~\cite{hossein2015many} propose a saliency model that depends on compressibility principle. In a very recent study, Leboran \emph{et al.}~\cite{awsd}, propose another dynamic saliency model by using the idea that perceptual relevant information is carried by high-order statistical structures. \subsection{Deep Static Saliency} In recent years, deep neural networks based models provide state-of-the-art results in many computer vision problems such as image classification~\cite{he2015deep}, object detection~\cite{girshick2015fast}, activity recognition~\cite{zhou2014learning}, semantic segmentation~\cite{long2015fully} and video classification~\cite{karpathy2014large}. These approaches perform hierarchical feature learning specific to a task, and thus gives results better than the engineered features. Motivated by the success of these models, a number of researchers have recently proposed deep learning based models for saliency prediction from images~\cite{Kümmerer2014b,pan2016shallow,kruthiventi2015deepfix,vig2014large,Bruce_2016_CVPR,Jetley_2016_CVPR,Li2016}. Vig \emph{et al.}~\cite{vig2014large} use an ensemble of CNNs which learns biologically inspired hierarchical features for saliency prediction. K\"{u}mmerer \emph{et al.}~\cite{Kümmerer2014b} employ deep features learned through different layers of the AlexNet~\cite{krizhevsky2012imagenet} and learn how to integrate them for predicting saliency maps. Kruthiventi et al.~\cite{kruthiventi2015deepfix} adopt VGGNet~\cite{simonyan15b} for saliency estimation where they introduce a location-biased convolutional layer to model the center-bias, and train the model on SALICON dataset using Euclidean loss. Jetley \emph{et al.}~\cite{Jetley_2016_CVPR} also use the VGGNet architecture but they especially concentrate on investigating different kinds of probability distance measures to define the loss function. Pan \emph{et al.}~\cite{pan2016shallow} very recently propose two CNN models having different layer sizes by approaching saliency prediction as a regression task. Li \emph{et al.}~\cite{Li2016} employ a fully convolutional neural network within a multi-task learning framework to jointly detect saliency and perform object class segmentation. It is important to note that all these models are proposed for predicting saliency in still images not videos. Bruce \emph{et al.}~\cite{Bruce_2016_CVPR} propose yet another fully convolutional network to predict saliency and they try to understand factors and learned representations when training these type of networks for saliency estimation. Motivated by the deep static saliency models, in our paper we investigate the use of two-stream CNNs for saliency prediction from videos. In fact, investigating layered formulations is not new for saliency prediction. As discussed earlier, most of the traditional dynamic saliency models are inspired from the hierarchical processing in the low-level human vision~\cite{Hubel1962}. These models, however, employ hand-crafted features to encode appearance and motion contrast to predict where humans look at in dynamic scenes. Since they depend on low-level cues, they often fail to capture semantics of scenes at its full extent, which is evidently important for gaze prediction. More recent models, on the other hand, employ learning-based formulations to integrate these low-level features with the detection maps for faces, persons, and other objects. This additional supervision boosts the prediction accuracies, however, the performance is limited by the discrimination capability of the considered features and the robustness of the employed detectors. As compared to the previous dynamic saliency models, our deep spatio-temporal saliency networks are trained to predict saliency in an end-to-end manner. This allows us to learn hierarchical features, both low-, mid- and high-level,~\cite{Cichy2016,bylinskii2016should} that are specialized for the gaze prediction task. For instance, while the early layers learn filters that are sensitive to edges or feature contrasts, the filters in the top layers are responsible from capturing more complex, semantic patterns that are important for the task. In our case, our deep two-stream saliency networks learn multiple layers of spatial and temporal representations and ways to combine them to predict saliency. In particular, in our study we extract temporal information via optical flow between consecutive video frames and investigate different ways to use this additional information in saliency prediction within a deep two-stream spatio-temporal network architecture~\cite{simonyan14b}. These two-stream networks are simple to implement and train, and to our interest, are in line with the hierarchical organization of the human visual system. Specifically, the biological motivation behind these architectures is the so-called two-streams hypothesis~\cite{two-stream-hypothesis} which speculate that human visual cortex is comprised of two distinct streams, namely ventral and the dorsal streams, which are respectively specialized to process appearance and motion information. Here, an alternative deep architecture could be to stack two or more frames together and feeding this input to a deep single-stream CNN, which was investigated in several action recognition networks~\cite{7410867,6165309,Taylor2010,7410879}. In this work, we do not pursue this direction because of two reasons. Firstly, this approach requires learning 3D convolutional filters~\cite{7410867,6165309,Taylor2010} in order to capture spatio-temporal regularities among input video frames but using 3D filters highly increases the complexity of the models and these 3D convolutional networks are harder to train with limited training data~\cite{7410879} (which is the case for the existing dynamic saliency datasets). Secondly, 3D convolutional filters are mainly used for expressing long-range motion patterns which could be important for recognizing an action since they cannot easily be captured by optical-flow based two-stream models. For dynamic saliency prediction though, we believe that such long-range dependencies are minimally important as human attention shifts continuously, and optical flow information is sufficient to establish the link between motion and saliency. \begin{figure*}[!t] \centering \includegraphics[width=\textwidth]{sources/saliency-networks.jpg} \\ \begin{tabular}{cp{1cm}p{1cm}c} \small{(a) Single stream saliency networks} & & & \small{(b) Two-stream saliency networks}\\ \end{tabular} \caption{(a) The baseline single stream saliency networks. While SSNet utilizes only spatial (appearance) information and accepts still video frames, TSNet exploits only temporal information whose input is given in the form of optical flow images. (b) The proposed two-stream spatio-temporal saliency networks. STSMaxNet performs fusion by using element-wise max fusion, whereas STSConvNet employs convolutional fusion after the fifth convolution layers.} \label{fig:saliency-networks} \end{figure*} \section{Our Models} The aim of our study is to investigate the use of deep architectures for predicting saliency from dynamic scenes. Recently, CNNs provided drastically superior performance in many classification and regression tasks in computer vision. While the lower layers of these networks respond to primitive image features such as edges, corners and shared common patterns, the higher layers extract semantic information like object parts, faces or text~\cite{Bruce_2016_CVPR,bylinskii2016should}. As mentioned before, such low and high-level features are shown to be both important and complementary in estimating visual saliency. Towards this end, we examine two baseline single stream networks (spatial and temporal) given in Figure~\ref{fig:saliency-networks}(a) and two two-stream networks~\cite{simonyan14b} shown in Figure~\ref{fig:saliency-networks}(b), which combine spatial and temporal cues via two different integration mechanisms: element-wise max fusion and convolutional fusion, respectively. We describe these models in detail below. \subsection{Spatial Saliency Network} For the basic single stream baseline model, we retrain the recently proposed static saliency model in~\cite{pan2016shallow} for dynamic saliency prediction by simply ignoring temporal information and using the input video frame alone. Hence, this model does not consider the inter-frame relationships while predicting saliency for a given video. As shown in the top row of Figure~\ref{fig:saliency-networks}(a), this CNN resembles the VGG-M model~\cite{simonyan15b} -- the main difference being that the final layer is a deconvolution (fractionally strided convolution) layer to up sample to the original image size. Note that it does not use any temporal information and exploits only appearance information to predict saliency in still video frames. We refer to this network architecture as SSNet. \subsection{Temporal Saliency Network} Saliency prediction from videos is inherently different than estimating saliency from still images in that our attention is highly affected by the local motion contrast of the foreground objects. To understand the contribution of temporal information to the saliency prediction, we develop a second single stream baseline. As given in the bottom row of Figure~\ref{fig:saliency-networks}(a), this model is just a replica of the spatial stream net but the input is provided in the form of optical flow images, as in~\cite{simonyan14b}, computed from two subsequent frames. We refer to this single stream network architecture as TSNet. \subsection{Spatio-Temporal Saliency Network with Direct Averaging} As a baseline model, we define a network model which integrates the responses of the final layers of the spatial and the temporal saliency networks by using direct averaging. Note that this model does not consider a learning strategy on how to combine these two-stream network and consider each one of the single-stream networks equally reliable. We refer to this two-stream network architecture as STSAvgNet. \subsection{Spatio-Temporal Saliency Network with Max Fusion} This network model accepts both a video frame and the corresponding optical flow image as inputs and merges together the spatial and temporal single stream networks via element-wise max fusion. That is, given two feature maps $\mathbf{x}^{s},\mathbf{x}^{t}\in \mathbb{R}^{H\times W \times D}$ from the spatial and temporal streams, with $W,H,D$ denoting the width, height and the number of channels (filters), max fusion takes the maximum of these two feature maps at every spatial location $i$ and $j$, and channel $d$, as: \begin{equation} y^{max}_{i,j,d} = \max\left(x^{s}_{i,j,d} , x^{t}_{i,j,d}\right)\;. \end{equation} The use of the $\max$ operation makes the ordering of the channels in a convolutional layer arbitrary. Hence, this fusion strategy assumes arbitrary correspondences between the spatial and temporal streams. That said, this spatio-temporal model seeks filters so that these arbitrary correspondences between feature maps become as meaningful as possible according to the joint loss. After this fusion step, it also uses a deconvolution layer to produce an up-sampled saliency map as the final result as illustrated in the top row of Figure~\ref{fig:saliency-networks}(b). We refer to this two-stream network architecture as STSMaxNet. \subsection{Spatio-Temporal Saliency with Convolutional Fusion} This network model integrates spatial and temporal streams by applying convolutional fusion. That is, the corresponding feature maps $\mathbf{x}^{s}$ and $\mathbf{x}^{t}$ respectively from the spatial and temporal streams are stacked together and then combined as follows: \begin{equation} \mathbf{y}^{conv} = \left[ \mathbf{x}^{s} \quad\mathbf{x}^{t}\right]*\mathbf{f}+\mathbf{b}\;, \end{equation} where $\mathbf{f}\in\mathbb{R}^{1\times 1 \times 2D \times D}$ denotes a bank of $1\times 1$ filters, and $\mathbf{b}\in \mathbb{R}^D$ represents the bias term. The main advantage of the convolutional fusion over the element-wise max fusion is that the filterbank $\mathbf{f}$ learns the optimal correspondences between the spatial and temporal streams based on the loss function, and reduces the number of channels by a factor of two through the weighted combinations of $\mathbf{x}^{s}$ and $\mathbf{x}^{t}$ with weights given by $\mathbf{f}$ at each spatial location. As demonstrated in the bottom row of Figure~\ref{fig:saliency-networks}(b), this is followed by a number of convolutions and a final deconvolution layer to produce the saliency map. We refer to this network architecture as STSConvNet. \subsection{Spatio-Temporal Saliency Network with Direct Fusion} Finally, as another baseline model, we design a single stream network in which the appearance and optical flow images are stacked together and fed to the network as input. This model implements an early fusion strategy at the very beginning of the network architecture and can be seen as a special case of STSConvNet. Here, each layer of the network learns a set of filters that directly acts on the given appearance and motion frames. We refer to this model as STSDirectNet. \section{Implementation Details} \label{ssec:implementation_details} \subsection{Network Architectures} The architecture of our single stream models is the same with that of the deep convolution network proposed in~\cite{pan2016shallow}. They take $320\times 240\times 3$ pixels images and processes them by the following operations: $C(96,7,3)$ $\rightarrow$ $LRN$ $\rightarrow$ $P$ $\rightarrow$ $C(256,5,2)$ $\rightarrow$ $P$ $\rightarrow$ $C(512,3,1)$ $\rightarrow$ $C(512,5,2)$ $\rightarrow$ $C(512,5,2)$ $\rightarrow$ $C(256,7,3)$ $\rightarrow$ $C(128,11,5)$ $\rightarrow$ $C(32,11,5)$ $\rightarrow$ $C(1,13,6)$ $\rightarrow$ $D$. Here, $C(d,f,p)$ represents a convolutional layer with $d$ filters of size $f\times f$ applied to the input with padding $p$ and stride 1. $LRN$ denotes a local response normalization layer that carries out a kind of lateral inhibition, and $P$ indicates a max pooling layer over $3\times 3$ regions with stride 2. Finally, $D$ is a deconvolution layer with filters of size $8\times 8\times 1$ with stride 4 and padding 2 which upscales the final convolution results to the original size. All convolutional layers except the last one are followed by a ReLU layer. Our spatial and temporal stream models in particular differ from each other in their inputs. While the first one processes still images, the next one accepts optical flow images as input. For the proposed spatio-temporal saliency networks shown in Figure~\ref{fig:saliency-networks}(b), we employ element-wise max and convolutional fusion strategies to integrate the spatial and temporal streams. Performing fusion after the fifth convolutional layer gives the best results for both of these fusion strategies. In STSMaxNet, the single stream networks are combined by applying element-wise max operation, which is followed by the same deconvolution layer in the single stream models. On the other hand, STSConvNet performs fusion by stacking the feature maps together and integrating them by a convolution layer $C(512,1,0)$ whose weights are initialized with identity matrices. The remaining layers are the same with those of the single stream models. \subsection{Data Preprocessing} We employ three publicly available datasets, 1.DIEM (Dynamic Images and Eye Movements)~\cite{mital2011clustering}, 2. UCF-Sports~\cite{MatheSminchisescuPAMI2015} datasets and 3. MIT 300 dataset~\cite{mit-saliency-benchmark}, which are described in detail in Section~\ref{sec:experiments}, in our experiments. Since our networks accept inputs of size $320\times 240\times 3$ pixels and outputs saliency maps of the same size, all videos and ground truth fixation density maps are rescaled to this size prior to training. We use the publicly available implementation of DeepFlow~\cite{weinzaepfel2013deepflow} and we additionally extract optical flow information from the rescaled versions of subsequent video frames. Optical flow images are then generated by stacking horizontal and vertical flow components and the magnitude of the flow together. Some example optical flow images are shown in Figure~\ref{fig:opticalflow}. \begin{figure}[!t] \centering \begin{tabular}{c@{\;}c@{\;}c} \includegraphics[width=0.15\textwidth,height=1.8cm]{sources/ucfd1.jpg} & \includegraphics[width=0.15\textwidth,height=1.8cm]{sources/ucfg1.jpg} & \includegraphics[width=0.15\textwidth,height=1.8cm]{sources/ucfc1.jpg}\\ \includegraphics[width=0.15\textwidth,height=1.8cm]{sources/ucfd_flow.jpg} & \includegraphics[width=0.15\textwidth,height=1.8cm]{sources/ucfg_flow.jpg} & \includegraphics[width=0.15\textwidth,height=1.8cm]{sources/ucfc_flow.jpg} \end{tabular} \caption{Sample optical flow images generated for some frames of a video sequence from UCF-Sports dataset.\vspace{-6pt}} \label{fig:opticalflow} \end{figure} \subsection{Data Augmentation} Data augmentation is a widely used approach to reduce the effect of over-fitting and improve generalization of neural networks. For saliency prediction, however, classical techniques such as cropping, horizontal flipping, or RGB jittering are not very suitable since they alter the visual stimuli used in the eye tracking experiments in collecting the fixation data. Having said that, horizontal flipping is used in~\cite{pan2016shallow} as a data augmentation strategy although there is no theoretical basis for why this helps to obtain better performance. In our study, we propose to employ a new and empirically grounded data augmentation strategy for specifically training saliency networks. In~\cite{judd2011fixations}, the authors performed a thorough analysis on how image resolution affects the exploratory behavior of humans through an eye-tracking experiment. Their experiments revealed that humans are quite consistent about where they look on high and low-resolution versions of the same images. Motivated with this observation, we process all video sequences and produce their low-resolution versions by down-sampling them by a factor of 2 and 4, and use these additional images with the fixations obtained from original high-resolution images in training. We note that in reducing the resolution of optical flow images the magnitude should also be rescaled to match with the down-sampling rate. It is worth-mentioning that this new data augmentation strategy can also be used for boosting performances of deep models for static saliency estimation. \subsection{Training} We employ the weights of the pretrained CNN model in~\cite{pan2016shallow} to set the initial weights of our spatial and temporal stream networks. In training the models, we use Caffe framework~\cite{jia14} and employed Stochastic Gradient Descent with Euclidean distance between the predicted saliency map and the ground truth. The networks were trained over 200K iterations where we used a batch size of 2 images, momentum of 0.9 and weight decay of 0.0005, which is reduced by a factor of 0.1 at every 10K iterations. Depending on the network architectures, it takes between 1 day to 3 days to train our models on the DIEM dataset by using a single 2GB GDDR5 NVIDIA GeForce GTX 775M GPU on a desktop PC equipped with 4-core Intel i5 (3.4 GHz) Processor and 16 GB memory. At test time, it takes approximately 2 secs to extract the saliency map of a single video frame. \section{Experimental Results} \label{sec:experiments} In the following, we first review the datasets on which we perform our experiments and provide the list of state-of-the-art computational saliency models that we compared against our spatio-temporal saliency networks. We then provide the details of the quantitative evaluation metrics that are used to assess the model performances. Next, we discuss our experimental results. \subsection{Datasets} To validate the effectiveness of the proposed deep dynamic saliency networks, our first set of experiments is carried out on the DIEM dataset~\cite{mital2011clustering}. This dataset is collected for the purpose of investigating where people look at dynamic scenes. It includes 84 high-definition natural videos including movie trailers, advertisements, etc. Each video sequence has eye fixation data collected from approximately 50 different human subjects. In our experiments, we only used the right-eye positions of the human subjects as done in~\cite{borji2013quantitative}. We perform our second set of experiments on the UCF-Sports ~\cite{MatheSminchisescuPAMI2015}. This dataset is collected from broadcast television channels such as the BBC and ESPN which consists of a set of sport actions~\cite{MatheSminchisescuPAMI2015}. The video sequences are collected from wide range of websites. This dataset contains 150 video sequences with $720\times 480$ resolution and cover a range of scene and viewpoints. The dataset includes several actions such as diving, golf swing, kicking and lifting, and is used for action recognition. However, recently, additional human gaze annotations were collected in~\cite{MatheSminchisescuPAMI2015}. These fixations are collected over 16 human subjects under task specific and task-independent free viewing conditions. Lastly, for the experiments on predicting eye fixations on still images, we choose a number of images from the MIT 300 dataset~\cite{mit-saliency-benchmark}. Selected images are the ones especially depicting an action and including objects that are interpreted as in motion. This dataset has eye fixation data collected from 39 subjects under free-viewing conditions for 3 secs for a total of 300 natural images with longest dimension 1024 pixels and the other dimension varied from 457 to 1024 pixels. \subsection{The compared computational saliency models} Through our experiments on DIEM and UCF-Sports datasets, we compare our deep network models with eight state-of-the-art dynamic saliency models: GVBS~\cite{harel2006graph}, PQFT~\cite{guo2008spatio}, SR~\cite{hou2007saliency}, Seo and Milanfar~\cite{seo2009static}, Rudoy \emph{et al.}~\cite{rudoy2013learning}, Fang \emph{et al.}~\cite{fang2014}, Zhou \emph{et al.}~\cite{zhou2014learning}, and DWS~\cite{awsd} models. Moreover, we compare our two-stream deep models STSMaxNet and STSConvNet to a certain extent with deep static saliency model DeepSal~\cite{pan2016shallow} as the architectures of our TSNet and SSNet models are adapted from this model. \subsection{Evaluation Measures} We employ Area Under Curve (AUC), shuffled AUC (sAUC)~\cite{zhang2008sAUC}, Pearson's Correlation Coefficient (CC), Normalized Scanpath Saliency (NSS)~\cite{nss}, Normalized Cross Correlation (NCC) and ${\chi}^2$ distance throughout our experiments for performance evaluation. We note that NCC and ${\chi}^2$ distance are not widely-used measures but we report them as some recent studies~\cite{rudoy2013learning,zhao2015fixation,mauthner2015encoding} employ them in their analysis. AUC measure considers the saliency maps as a classification map and uses the receiver operator characteristics curve to estimate the effectiveness of the predicted saliency maps in capturing the ground truth eye fixations. An AUC value of~1 indicates a perfect match with the ground truth while the performance of chance is indicated by a value close to 0.5. The AUC measure cannot account for the tendency of human subjects to look at the image center of the screen, i.e. the so-called center bias. Hence, we also report the results of the shuffled version of AUC (sAUC) where the center bias is compensated by selecting the set of fixations used as the false positives from another randomly selected video frame from the dataset instead of the processed frame. CC treats the predicted saliency and the ground truth human fixation density maps as random variables and measures the strength of a linear relationship between two using a Gaussian kernel density estimator. While a value close to 0 indicates no correlation, a CC value close to +1/-1 demonstrates a good linear relationship. NSS estimates the average normalized saliency score value by examining the responses at the human fixated locations on the predicted saliency map which has been normalized to have zero mean and unit standard deviation. While a NSS value of 0 indicates chance in predicting eye fixtions, a non-negative NSS value, especially that of greater than 1, denotes correspondence between maps above chance. NCC is a general measure used for assessing image similarity. It treats the ground truth fixation map and the predicted saliency map as images and estimates a score with values close to 1 implying high similarity and negative values indicating low similarity. ${\chi}^2$ distance considers the saliency maps as a probability distribution map and compares the predicted map with the ground truth human fixation map accordingly. A perfect prediction model needs to provide a distance close to~0 for the ${\chi}^2$ distance. \begin{figure*}[!t] \centering \begin{tabular}{c@{\;}c@{\;}c@{\;}c@{\;}c@{\;}c@{\;}c} \includegraphics[width=0.135\textwidth]{sources/159_motion.jpg} & \includegraphics[width=0.135\textwidth]{sources/159_gt.jpg} & \includegraphics[width=0.135\textwidth]{sources/159_ssnet.jpg} & \includegraphics[width=0.135\textwidth]{sources/159_tsnet.jpg} & \includegraphics[width=0.135\textwidth]{sources/159_avgnet2.jpg} & \includegraphics[width=0.135\textwidth]{sources/159_stsmaxnet.jpg} & \includegraphics[width=0.135\textwidth]{sources/159_stsconvnet.jpg} \\ \includegraphics[width=0.135\textwidth]{sources/321_motion.jpg} & \includegraphics[width=0.135\textwidth]{sources/321_gt.jpg} & \includegraphics[width=0.135\textwidth]{sources/321_ssnet.jpg} & \includegraphics[width=0.135\textwidth]{sources/321_tsnet.jpg} & \includegraphics[width=0.135\textwidth]{sources/321_avgnet2.jpg} & \includegraphics[width=0.135\textwidth]{sources/321_stsmaxnet.jpg} & \includegraphics[width=0.135\textwidth]{sources/321_stsconvnet.jpg} \\ \includegraphics[width=0.135\textwidth]{sources/191_motion.jpg} & \includegraphics[width=0.135\textwidth]{sources/191_gt.jpg} & \includegraphics[width=0.135\textwidth]{sources/191_ssnet.jpg} & \includegraphics[width=0.135\textwidth]{sources/191_tsnet.jpg} & \includegraphics[width=0.135\textwidth]{sources/191_avgnet2.jpg} & \includegraphics[width=0.135\textwidth]{sources/191_stsmaxnet.jpg} & \includegraphics[width=0.135\textwidth]{sources/191_stsconvnet.jpg} \\ \includegraphics[width=0.135\textwidth]{sources/240_motion.jpg} & \includegraphics[width=0.135\textwidth]{sources/240_gt.jpg} & \includegraphics[width=0.135\textwidth]{sources/240_ssnet.jpg} & \includegraphics[width=0.135\textwidth]{sources/240_tsnet.jpg} & \includegraphics[width=0.135\textwidth]{sources/240_avgnet2.jpg} & \includegraphics[width=0.135\textwidth]{sources/240_stsmaxnet.jpg} & \includegraphics[width=0.135\textwidth]{sources/240_stsconvnet.jpg} \\ \small{Overlayed images} & \small{Ground Truth} & \small SSNet & \small TSNet & \small STSAvgNet & \small STSMaxNet & \small STSConvNet \end{tabular} \caption{Qualitative evaluation of the proposed saliency network architectures. For these sample frames from the DIEM dataset, our STSConvNet provides the most accurate prediction as compared to the other network models.} \label{fig:network-comparisons} \end{figure*} \subsection{Experiments on DIEM} In our analysis, we first both qualitatively and quantitatively compare our proposed deep dynamic saliency networks, SSNet, TSNet, STSDirectNet, STSAvgNet, STSMaxNet and STSConvNet, with each other. Following the experimental setup of~\cite{borji2013quantitative}, we split the dataset into a training set containing 64 video sequences and a testing set including the remaining 20 representative videos covering different concepts. Specifically, we use the same set of splits used in~\cite{rudoy2013learning}. As our STSMaxNet and STSConvNet models integrate spatial and temporal streams by respectively using element-wise and convolutional fusion strategies, we perform an extensive set of initial experiments to determine the optimum layers for the fusion process to take place in these two-stream networks. In particular, we train STSMaxNet and STSConvNet models by considering different fusion layers, and test each one of them on the test set by considering sAUC measure. In Table~\ref{tab:invest}, we provide these performance comparisons at different fusion layers. Interestingly, as can be seen from the table, fusing the spatial and temporal streams after the fifth convolution layer achieves the best results for both spatio-temporal networks. In the remainder, we use these settings for our STSMaxNet and STSConvNet models. In Figure~\ref{fig:network-comparisons}, for some sample video frames we provide the outputs of the proposed networks along with the corresponding human fixation density maps (the ground truth). The input frames are given as overlayed images by compositing them with their consecutive frames to show the motion in the scenes. Saliency maps are shown as heatmaps superimposed over the original image for visualization purposes. As can be seen from these results, SSNet, which does employ appearance but not motion information, in general provides less accurate saliency maps and misses the foreground objects or their parts that are in motion. TSNet gives relatively better results, but as shown in the second and the third row, it does not identify all of the salient regions as it focuses more on the moving parts of the images. Directly averaging the saliency maps of these two single stream models, referred to as STSAvgNet, does not produce very satisfactory results either. As expected, STSMaxNet is slightly better since max fusion enforces to learn more effective filters in order to combine the spatial and temporal streams. Overall, STSConvNet is the best performing model. This can be rooted in the application of $1 \times 1$ convolutional filters that learn the optimal weights to combine appearance and motion feature maps. \begingroup \begin{table}[!t] \centering \caption{Performance comparison of our spatio-temporal saliency networks at different fusion layers on the DIEM dataset. The reported values are sAUC scores. Best performance is achieved after the fifth convolution layer.} \begin{tabular}{|ccc|} \hline Fusion Layers & STSMaxNet & STSConvNet\\ \hline \hline Conv2 & 0.52 & 0.71\\ Conv3 & 0.67 & 0.70\\ Conv4 & 0.76 & 0.83\\ Conv5 & 0.81 & 0.84\\ Conv6 & 0.80 & 0.79\\ Conv7 & 0.81 & 0.79\\ \hline \end{tabular} \label{tab:invest} \end{table} \endgroup \renewcommand*{\arraystretch}{1.2} \begin{table}[!t] \centering \caption{Performance comparisons on the DIEM dataset.} \begin{tabular}{|p{2.25cm}cccccc|} \hline & AUC & sAUC & CC & NSS & ${\chi}^2$ & NCC\\ \hline \hline SSNet & 0.72 & 0.69 & 0.35 & 1.85 & 0.48 & 0.41\\ TSNet & 0.79 & 0.77 & 0.41 & 1.98 & 0.40 & 0.43\\ \hline STSDirectNet & 0.71 & 0.60 & 0.37 & 1.53 & 0.49 & 0.28\\ STSAvgNet & 0.68 & 0.62 & 0.37 & 1.67 & 0.49 & 0.37\\ STSMaxNet & 0.83 & 0.81 & 0.46 & 2.01 & 0.31 & 0.45\\ STSConvNet & 0.87 & 0.84 & 0.47 & 2.15 & 0.29 & 0.46\\ STSConvNet* & \textbf{0.88} & \textbf{0.86} & \textbf{0.48} & 2.18 & \textbf{0.28} & \textbf{0.47}\\ \hline GBVS~\cite{harel2006graph} & 0.74 & 0.70 & 0.47 & 2.04 & 0.47 & 0.38\\ SR~\cite{hou2007saliency} & 0.69 & 0.64 & 0.30 & 2.22 & 0.57 & 0.40\\ PQFT~\cite{guo2008spatio} & 0.71 & 0.67 & 0.33 & 1.77 & 0.52 & 0.33\\ Seo-Milanfar~\cite{seo2009static} & 0.59 & 0.51 & 0.10 & 0.12 & 0.75 & 0.28\\ Rudoy \emph{et al.}~\cite{rudoy2013learning} & -- & 0.74 & -- & -- & 0.31 & --\\ Fang \emph{et al.}~\cite{fang2014} & 0.71 & 0.48 & 0.21 & 0.55 & 0.87 & 0.40\\ Zhou \emph{et al.}~\cite{zhou2014learning} & 0.60 & 0.52 & 0.13 & 0.24 & 0.71 & 0.22\\ DWS~\cite{awsd} & 0.81 & 0.79 & 0.32 & \textbf{2.97} & 0.40 & 0.39\\ \hline \end{tabular} \label{tab:DIEMresults} \end{table} \begin{figure*}[!t] \centering \begin{tabular}{c@{\;}c@{\;}c@{\;}c@{\;}c@{\;}c@{\;}c} \includegraphics[width=0.135\textwidth]{sources/279_280.jpg} & \includegraphics[width=0.135\textwidth]{sources/2295_qt.jpg} & \includegraphics[width=0.135\textwidth]{sources/2295_our.jpg} & \includegraphics[width=0.135\textwidth]{sources/2295_gvbs.jpg} & \includegraphics[width=0.135\textwidth]{sources/2295_quaf.jpg} & \includegraphics[width=0.135\textwidth]{sources/d2.jpg} & \includegraphics[width=0.135\textwidth]{sources/2295_nips.jpg} \\ \includegraphics[width=0.135\textwidth]{sources/111_112.jpg} & \includegraphics[width=0.135\textwidth]{sources/dsogt_1.jpg} & \includegraphics[width=0.135\textwidth]{sources/deor_1.jpg} & \includegraphics[width=0.135\textwidth]{sources/ro1.jpg} & \includegraphics[width=0.135\textwidth]{sources/roo1.jpg} & \includegraphics[width=0.135\textwidth]{sources/d5.jpg} & \includegraphics[width=0.135\textwidth]{sources/rooo1.jpg} \\ \includegraphics[width=0.135\textwidth]{sources/20_21.jpg} & \includegraphics[width=0.135\textwidth]{sources/dsogt_3.jpg} & \includegraphics[width=0.135\textwidth]{sources/deor_3.jpg} & \includegraphics[width=0.135\textwidth]{sources/ro3.jpg} & \includegraphics[width=0.135\textwidth]{sources/roo3.jpg} & \includegraphics[width=0.135\textwidth]{sources/d6.jpg}& \includegraphics[width=0.135\textwidth]{sources/rooo3.jpg} \\ \includegraphics[width=0.135\textwidth]{sources/14_15.jpg} & \includegraphics[width=0.135\textwidth]{sources/dsogt_5.jpg} & \includegraphics[width=0.135\textwidth]{sources/deor_5.jpg} & \includegraphics[width=0.135\textwidth]{sources/ro5.jpg} & \includegraphics[width=0.135\textwidth]{sources/roo5.jpg} & \includegraphics[width=0.135\textwidth]{sources/d7.jpg} & \includegraphics[width=0.135\textwidth]{sources/rooo5.jpg} \\ \includegraphics[width=0.135\textwidth]{sources/224_225.jpg} & \includegraphics[width=0.135\textwidth]{sources/dsogt_13.jpg} & \includegraphics[width=0.135\textwidth]{sources/deor_13.jpg} & \includegraphics[width=0.135\textwidth]{sources/ro13.jpg} & \includegraphics[width=0.135\textwidth]{sources/roo13.jpg} & \includegraphics[width=0.135\textwidth]{sources/d8.jpg} & \includegraphics[width=0.135\textwidth]{sources/rooo13.jpg} \\ \includegraphics[width=0.135\textwidth]{sources/171_172.jpg} & \includegraphics[width=0.135\textwidth]{sources/2772_qt.jpg} & \includegraphics[width=0.135\textwidth]{sources/2772_our.jpg} & \includegraphics[width=0.135\textwidth]{sources/2772_gvbs.jpg} & \includegraphics[width=0.135\textwidth]{sources/2772_quaf.jpg} & \includegraphics[width=0.135\textwidth]{sources/d3.jpg} & \includegraphics[width=0.135\textwidth]{sources/2772_nips.jpg} \\ \small Overlayed frames & \small Ground Truth & \small STSConvNet* & \small GBVS~\cite{harel2006graph} & \small PQFT~\cite{guo2008spatio} & \small SR~\cite{hou2007saliency} & \small DWS~\cite{awsd} \end{tabular} \caption{Qualitative comparison of our STSConvNet* model against some dynamic saliency models on DIEM dataset. Our model clearly produces better results.} \label{fig:tab:model-comparisons} \end{figure*} In Table~\ref{tab:DIEMresults}, we present the quantitative results averaged over all video sequences and frames on the test split of the DIEM dataset. Here, we compare and contrast our single- and two-stream saliency networks with eight existing dynamic saliency methods, namely GVBS~\cite{harel2006graph}, SR~\cite{hou2007saliency}, PQFT~\cite{guo2008spatio}, Seo and Milanfar~\cite{seo2009static}, Rudoy \emph{et al.}~\cite{rudoy2013learning}\footnote{Since the code provided by the authors is not working correctly, sAUC and $\chi^2$ scores are directly taken from~\cite{rudoy2013learning}.}, Fang \emph{et al.}~\cite{fang2014}, Zhou \emph{et al.}~\cite{zhou2014learning} and DWS~\cite{awsd} models. Among our deep saliency networks, we empirically find that STSDirectNet provides the worst quantitative results. This is in line with our observation in Table~\ref{tab:invest} that delaying the integration of appearance and motion streams to a certain extent leads to more effective learning of mid and low level features. Secondly, we see that SSNet performs considerably lower than Temporal stream network, which demonstrates that motion is more vital for dynamic saliency. STSMaxNet gives results better than those of the single stream models but our STSConvNet model performs even better. It can be argued that STSConvNet learns more effective filters that combine spatial and temporal streams in an optimal manner. In addition, when we employ the data augmentation strategy proposed in the previous section, it further improves the overall performance of STSConvNet. In the remainder, we refer to this model with data augmentation as STSConvNet*. When we compare our proposed STSMaxNet, STSConvNet, and STSConvNet* models to the previous dynamic saliency methods, our results demonstrate the advantages of two-stream deep CNNs that they consistently outperform all those approaches, including the very recently proposed DWS model, according to five out of six evaluation measures. We present some qualitative results in Figure~\ref{fig:tab:model-comparisons} where we again provide the input frames as transparent overlayed images showing the inherent motion. We observe that the proposed STSConvNet* model localizes the salient regions more accurately than the existing models. For example, for the frame given in the first row, none of the compared models correctly capture the fixations over the painting brush. Similarly, for the second and the third frames, only our spatio-temporal saliency network fixates to the text and the cellular phone in the frames, respectively. \subsection{Experiments on UCF-Sports} Learning-based models might sometimes fail to provide satisfactory results for a test sample due to a shift from the training data domain. To validate generalization ability of our best-performing STSConvNet* model, we perform additional experiments on UCF-Sports dataset. In particular, we do not carry out any training for our model from scratch or fine-tune it on UCF-Sports but rather use the predictions of the model trained only on DIEM dataset. \begingroup \renewcommand*{\arraystretch}{1.2} \begin{table}[!t] \centering \caption{Performance comparisons on the UCF-SPORTS dataset.} \begin{tabular}{|p{2.25cm}cccccc|} \hline & AUC & sAUC & CC & NSS & ${\chi}^2$ & NCC\\ \hline \hline GBVS~\cite{harel2006graph} & 0.83 & 0.52 & 0.46 & 1.82 & 0.54 & \textbf{0.59}\\ SR~\cite{hou2007saliency} & 0.78 & 0.69 & 0.26 & 1.20 & 0.42 & 0.52\\ PQFT~\cite{guo2008spatio} & 0.69 & 0.51 & 0.29 & 1.15 & 0.64 & 0.48\\ Seo-Milanfar~\cite{seo2009static} & 0.80 & 0.72 & 0.31 & 1.37 & 0.56 & 0.36\\ Fang \emph{et al.}~\cite{fang2014} & \textbf{0.85} & 0.70 & 0.44 & 1.95 & 0.52 & 0.33\\ Zhou \emph{et al.}~\cite{zhou2014learning} & 0.81 & 0.72 & 0.36 & 1.71 & 0.56 & 0.37\\ DWS~\cite{awsd} & 0.76 & 0.70 & 0.28 & 2.01 & 0.40 & 0.49\\ STSConvNet* & 0.82 & \textbf{0.75} & \textbf{0.48} & \textbf{2.13} & \textbf{0.39} & 0.54\\ \hline \end{tabular} \label{tab:ucf-results} \end{table} \endgroup \begin{figure*}[!t] \centering \resizebox{\textwidth}{!} { \begin{tabular}{c@{\;}c@{\;}c@{\;}c@{\;}c@{\;}c} \includegraphics[width=0.18\textwidth]{sources/306_307.jpg} & \includegraphics[width=0.18\textwidth]{sources/usir_3.jpg} & \includegraphics[width=0.18\textwidth]{sources/ueor_3.jpg} & \includegraphics[width=0.18\textwidth]{sources/usirr_3.jpg} & \includegraphics[width=0.18\textwidth]{sources/usirrr_3.jpg} \\ \includegraphics[width=0.18\textwidth]{sources/269_270.jpg} & \includegraphics[width=0.18\textwidth]{sources/usir_2.jpg} & \includegraphics[width=0.18\textwidth]{sources/ueor_2.jpg} & \includegraphics[width=0.18\textwidth]{sources/usirr_2.jpg} & \includegraphics[width=0.18\textwidth]{sources/usirrr_2.jpg} \\ \includegraphics[width=0.18\textwidth]{sources/288_289.jpg} & \includegraphics[width=0.18\textwidth]{sources/usir_6.jpg} & \includegraphics[width=0.18\textwidth]{sources/ueor_6.jpg} & \includegraphics[width=0.18\textwidth]{sources/usirr_6.jpg} & \includegraphics[width=0.18\textwidth]{sources/usirrr_6.jpg} \\ \includegraphics[width=0.18\textwidth]{sources/78_79.jpg} & \includegraphics[width=0.18\textwidth]{sources/usir_8.jpg} & \includegraphics[width=0.18\textwidth]{sources/ueor_8.jpg} & \includegraphics[width=0.18\textwidth]{sources/usirr_8.jpg} & \includegraphics[width=0.18\textwidth]{sources/usirrr_8.jpg} \\ \includegraphics[width=0.18\textwidth]{sources/58_59.jpg} & \includegraphics[width=0.18\textwidth]{sources/usir_1.jpg} & \includegraphics[width=0.18\textwidth]{sources/ueor_1.jpg} & \includegraphics[width=0.18\textwidth]{sources/usirr_1.jpg} & \includegraphics[width=0.18\textwidth]{sources/usirrr_1.jpg} \\ \footnotesize Overlayed input frames & \footnotesize Ground Truth & \footnotesize STSConvNet* & \footnotesize Fang \emph{et al.}~\cite{fang2014} & \footnotesize DWS~\cite{awsd} \end{tabular}} \caption{Qualitative comparison of our STSConvNet* model against some previous dynamic saliency models on UCF-Sports dataset. Our spatio-temporal saliency network outperforms the others.} \label{fig:tab:early-ucf} \end{figure*} \begin{figure}[!t] \centering \resizebox{\linewidth}{!} { \begin{tabular}{c@{\;}c@{\;}c@{\;}c@{\;}c} \includegraphics[width=2.4cm,height=1.8cm]{sources/m1.jpg} & \includegraphics[width=2.4cm,height=1.8cm]{sources/mg1.jpg} & \includegraphics[width=2.4cm,height=1.8cm]{sources/mf1.jpg} & \includegraphics[width=2.4cm,height=1.8cm]{sources/ms1.jpg} & \includegraphics[width=2.4cm,height=1.8cm]{sources/mr1.jpg} \\ \includegraphics[width=2.4cm,height=3.4cm]{sources/m2.jpg} & \includegraphics[width=2.4cm,height=3.4cm]{sources/mg2.jpg} & \includegraphics[width=2.4cm,height=3.4cm]{sources/mf2.jpg} & \includegraphics[width=2.4cm,height=3.4cm]{sources/ms2.jpg} & \includegraphics[width=2.4cm,height=3.4cm]{sources/mr2.jpg} \\ \includegraphics[width=2.4cm,height=2cm]{sources/m6.jpg} & \includegraphics[width=2.4cm,height=2cm]{sources/mg6.jpg} & \includegraphics[width=2.4cm,height=2cm]{sources/mf6.jpg} & \includegraphics[width=2.4cm,height=2cm]{sources/ms6.jpg} & \includegraphics[width=2.4cm,height=2cm]{sources/mr6.jpg} \\ \includegraphics[width=2.4cm,height=3.5cm]{sources/m5.jpg} & \includegraphics[width=2.4cm,height=3.5cm]{sources/mg5.jpg} & \includegraphics[width=2.4cm,height=3.5cm]{sources/mf5.jpg} & \includegraphics[width=2.4cm,height=3.5cm]{sources/ms5.jpg} & \includegraphics[width=2.4cm,height=3.5cm]{sources/mr5.jpg} \\ \includegraphics[width=2.4cm,height=3.2cm]{sources/m4.jpg} & \includegraphics[width=2.4cm,height=3.2cm]{sources/mg4.jpg} & \includegraphics[width=2.4cm,height=3.2cm]{sources/mf4.jpg} & \includegraphics[width=2.4cm,height=3.2cm]{sources/ms4.jpg} & \includegraphics[width=2.4cm,height=3.2cm]{sources/mr4.jpg} \\ \normalsize Input Image &\normalsize Ground Truth & \normalsize DeepFix~\cite{kruthiventi2015deepfix} & \normalsize SALICON~\cite{jiang2015salicon} & \normalsize STSConvNet \end{tabular}} \caption{Some experiments on still images. While the top performing deep static saliency models fail to compute satisfactory results in these images (results taken from~\cite{bylinskii2016should}), our spatio-temporal saliency network (STSConvNet) can produce better saliency maps using predicted optical flow maps.} \label{fig:motioneffect} \end{figure} In Table~\ref{tab:ucf-results}, we provide the performance of our model compared to the previous dynamic saliency models which are publicly available on the web. As can be seen, our STSConvNet* model performs better than the state-of-the-art models according to majority of the evaluation measures. It especially outperforms the recently proposed DWS model in terms of all measures. These results suggest that our two-stream network generalizes well beyond the DIEM dataset. In Figure~\ref{fig:tab:early-ucf}, we present sample qualitative results of Fang \emph{et al.}~\cite{fang2014} and DWS model~\cite{awsd} (two recently proposed models) and our STSConvNet model on some video frames. For instance, we observe that for the sample frame given in the first row, our model fixates to both the runner and the crowd. For the second and the third sample frames, the compared models do not accurately localize the weight lifter and the cowboys as salient, respectively. Similarly, the proposed STSConvNet* model predicts the eye fixations better than the competing models for the fourth image containing a guardian walking in a corridor. For the last diving image, STSConvNet* and Fang~\emph{et~al.} give results fairly close to the ground truth, while DWS output some spurious regions as salient. \subsection{Experiments on Still Images from MIT300} Deep static saliency networks achieve excellent performances on existing benchmark datasets for static saliency estimation. These models, however, only exploit spatial information captured in still images, but sometimes an image, despite being taken in an instant, might carry plenty of information regarding the inherent motion exist in it. In a recent study by Bylinski~\emph{et~al.}~\cite{bylinskii2016should}, the authors demonstrate that the areas showing these kind of activities are indeed evidently important for saliency prediction since humans have tendency to look at the objects that they think in motion or that are in interaction with humans or some other objects. Motivated by these observations, in this section, we present the failures or the shortcomings of the current deep static saliency models through some examples, and show how motion information exist in still images can be utilized to fill in the semantic gap exist in the current static saliency models. Figure~\ref{fig:motioneffect} presents sample images taken from~\cite{bylinskii2016should} and which are from the MIT 300 dataset~\cite{mit-saliency-benchmark} where highly fixated regions (which cover the 95th percentile of the human fixation maps) are highlighted with yellow curves. As can be clearly seen from these examples, the state-of-the-art deep static models generally fail to give high saliency values to regions where an action occurs or which contains objects that are interpreted as in motion. To capture those regions, we employ the deep optical flow prediction model~\cite{walker2015dense} which extracts optical flow from static images. Once we estimate the motion map of a still image, we can exploit this information together with the RGB image as inputs to our spatio-temporal saliency network (STSConvNet) to extract a saliency map. We observe that using these (possibly noisy) motion maps within our framework provides more accurate predictions than the existing deep static saliency models, and even captures the objects of gaze as illustrated in the first two sample images. These experiments reveal that the performances of static saliency networks can be improved by additionally considering motion information inherent in still images. \section{Conclusion} In this work, we have investigated several deep architectures for predicting saliency from dynamic scenes. Two of these deep models are single-stream convolutional networks respectively trained for processing spatial and temporal information. Our proposed spatio-temporal saliency networks, on the other hand, are built based on two-stream architecture and employ different fusion strategies, namely direct averaging, max fusion and convolutional fusion, to integrate appearance and motion features, and they are all trainable in an end-to-end manner. While training these saliency networks, we additionally employ an effective and well-founded data augmentation method that utilizes low-resolution versions of the video frames and the ground truth saliency maps, giving a significant boost in performance. Our experimental results demonstrate that the proposed STSConvNet model achieves superior performance over the state-of-the-art methods on DIEM and UCF-Sports datasets. Lastly, we provide some illustrative example results on a number of challenging still images, which show that static saliency estimation can also benefit from motion information. This is left as an interesting topic for future research. \section*{Acknowledgment} This research was supported in part by TUBITAK Career Development Award 113E497 and Hacettepe BAP FDS-2016-10202. \ifCLASSOPTIONcaptionsoff \newpage \fi \bibliographystyle{IEEEtran}
{'timestamp': '2017-11-16T02:04:49', 'yymm': '1607', 'arxiv_id': '1607.04730', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04730'}
arxiv
\section{INTRODUCTION} In recent years deep learning methods have demonstrated significant improvements in various tasks. These methods outperform human-level object detection in some tasks \cite{resnet}, and achieve state-of-the-art results in machine translation \cite{nmt} and speech processing \cite{graves2013speech}. Additionally, deep learning combined with reinforcement learning techniques was able to beat human champions in challenging games such as Go \cite{d_silver}. There are three different reasons for the outstanding results of Deep Learning models: \begin{enumerate} \item Powerful computing resources such as fast GPUs. \item Utilizing efficiently large collections of datasets, e.g. ImageNet \cite{imagenet} for image processing. \item Advanced academic research on training methods and network architectures \cite{batch_norm}, \cite{alexnet}, \cite{adadelta}, \cite{dropout}. \end{enumerate} Error correcting codes for channel coding are used in order to enable reliable communications at rates close to the Shannon capacity. A well-known family of linear error correcting codes are the low-density parity-check (LDPC) codes \cite{galmono}. LDPC codes achieve near Shannon channel capacity with the belief propagation (BP) decoding algorithm, but can typically do so for relatively large block lengths. For high density parity check (HDPC) codes \cite{jiang2006iterative}, \cite{dimnik2009improved}, \cite{yufit2011efficient}, \cite{zhang2012adaptive}, such as common powerful algebraic codes, the BP algorithm obtains poor results compared to the maximum likelihood decoder \cite{helmling2014efficient}. In this work we focus on HDPC codes and demonstrate how the BP algorithm can be improved. The naive approach to the problem is to assume a neural network type decoder without restrictions, and train its weights using a dataset that contains a large amount of codewords. The training goal is to reconstruct the transmitted codeword from a noisy version after transmitting over the communication channel. Unfortunately, when using this approach our decoder is not given any side information regarding the structure of the code. In fact it is even not aware of the fact that the code is linear. Hence we are required to train the decoder using a huge collection of codewords from the code, and due to the exponential nature of the problem, this is infeasible, e.g., for a BCH(63,45) code we need a dataset of $2^{45}$ codewords. On top of that, the database needs to reflect the variability due to the noisy channel. In order to overcome this issue, our proposed approach is to assign weights to the edges of the Tanner graph that represent the given linear code, thus yielding a ``soft'' Tanner graph. These edges are trained using deep learning techniques. A well-known property of the BP algorithm is the independence of the performance on the transmitted codeword. A major ingredient in our new method is that this property is preserved by our decoder. Thus it is sufficient to use a single codeword for training the parameters of our decoder. We demonstrate improvements over BP for various high density parity check codes, including BCH(63,36), BCH(63,45), and BCH(127,106) . \section{THE BELIEF PROPAGATION ALGORITHM} The renowned BP decoder \cite{galmono}, \cite{ru_book} can be constructed from the Tanner graph, which is a graphical representation of some parity check matrix that describes the code. In this algorithm, messages are transmitted over edges. Each edge calculates its outgoing message based on all incoming messages it receives over all its edges, except for the message received on the transmitting edge. We start by providing an alternative graphical representation to the BP algorithm with $L$ full iterations when using parallel (flooding) scheduling. Our alternative representation is a trellis in which the nodes in the hidden layers correspond to edges in the Tanner graph. Denote by $N$, the code block length (i.e., the number of variable nodes in the Tanner graph), and by $E$, the number of edges in the Tanner graph. Then the input layer of our trellis representation of the BP decoder is a vector of size $N$, that consists of the log-likelihood ratios (LLRs) of the channel outputs. The LLR value of variable node $v$, $v=1,2,\ldots,N$, is given by $$ l_v = \log\frac{\Pr\left(C_v=1 | y_v\right)}{\Pr\left(C_v=0 | y_v\right)} $$ where $y_v$ is the channel output corresponding to the $v$th codebit, $C_v$. All the following layers in the trellis, except for the last one (i.e., all the hidden layers), have size $E$. For each hidden layer, each processing element in that layer is associated with the message transmitted over some edge in the Tanner graph. The last (output) layer of the trellis consists of $N$ processing elements that output the final decoded codeword. Consider the $i$th hidden layer, $i=1,2,\ldots,2L$. For odd (even, respectively) values of $i$, each processing element in this layer outputs the message transmitted by the BP decoder over the corresponding edge in the graph, from the associated variable (check) node to the associated check (variable) node. A processing element in the first hidden layer ($i=1$), corresponding to the edge $e=(v,c)$, is connected to a single input node in the input layer: It is the variable node, $v$, associated with that edge. Now consider the $i$th ($i>1$) hidden layer. For odd (even, respectively) values of $i$, the processing node corresponding to the edge $e=(v,c)$ is connected to all processing elements in layer $i-1$ associated with the edges $e'=(v,c')$ for $c'\ne c$ ($e'=(v',c)$ for $v'\ne v$, respectively). For odd $i$, a processing node in layer $i$, corresponding to the edge $e=(v,c)$, is also connected to the $v$th input node. The BP messages transmitted over the trellis graph are the following. Consider hidden layer $i$, $i=1,2,\ldots,2L$, and let $e=(v,c)$ be the index of some processing element in that layer. We denote by $x_{i,e}$, the output message of this processing element. For odd (even, respectively), $i$, this is the message produced by the BP algorithm after $\lfloor (i-1)/2 \rfloor$ iterations, from variable to check (check to variable) node. For odd $i$ and $e=(v,c)$ we have (recall that the self LLR message of $v$ is $l_v$), \begin{equation} x_{i,e=(v,c)} = l_v + \sum_{e'=(v,c'),\: c'\ne c} x_{i-1,e'} \label{eq:x_ie_RB} \end{equation} under the initialization, $x_{0,e'}=0$ for all edges $e'$ (in the beginning there is no information at the parity check nodes). The summation in~\eqref{eq:x_ie_RB} is over all edges $e'=(v,c')$ with variable node $v$ except for the target edge $e=(v,c)$. Recall that this is a fundamental property of message passing algorithms~\cite{ru_book}. Similarly, for even $i$ and $e=(v,c)$ we have, \begin{equation} x_{i,e=(v,c)} = 2\tanh^{-1} \left( \prod_{e'=(v',c),\: v'\ne v} \tanh \left( \frac{x_{i-1,e'}}{2} \right) \right) \label{eq:x_ie_LB} \end{equation} The final $v$th output of the network is given by \begin{equation} o_v = l_v + \sum_{e'=(v,c')} x_{2L,e'} \label{eq:ov} \end{equation} which is the final marginalization of the BP algorithm. \section{THE PROPOSED DEEP NEURAL NETWORK DECODER} We suggest the following parameterized deep neural network decoder that generalizes the BP decoder of the previous section. We use the same trellis representation for the decoder as in the previous section. The difference is that now we assign weights to the edges in the Tanner graph. These weights will be trained using stochastic gradient descent which is the standard method for training neural networks. More precisely, our decoder has the same trellis architecture as the one defined in the previous section. However, Equations~\eqref{eq:x_ie_RB}, \eqref{eq:x_ie_LB} and \eqref{eq:ov} are replaced by \begin{equation} x_{i,e=(v,c)} = \tanh \left(\frac{1}{2}\left(w_{i,v} l_v + \sum_{e'=(v,c'),\: c'\ne c} w_{i,e,e'} x_{i-1,e'}\right)\right) \label{eq:x_ie_RB_NN} \end{equation} for odd $i$, \begin{equation} x_{i,e=(v,c)} = 2\tanh^{-1} \left( \prod_{e'=(v',c),\: v'\ne v}{x_{i-1,e'}}\right) \label{eq:x_ie_LB_NN} \end{equation} for even $i$, and \begin{equation} o_v = \sigma \left( w_{2L+1,v} l_v + \sum_{e'=(v,c')} w_{2L+1,v,e'} x_{2L,e'} \right) \label{eq:ov_NN} \end{equation} where $\sigma(x) \equiv \left( 1+e^{-x} \right)^{-1}$ is a sigmoid function. The sigmoid is added so that the final network output is in the range $[0,1]$. This makes it possible to train the network using a cross entropy loss function, as described in the next section. Apart of the addition of the sigmoid function at the outputs of the network, one can see that by setting all weights to one, Equations \eqref{eq:x_ie_RB_NN}-\eqref{eq:ov_NN} degenerate to \eqref{eq:x_ie_RB}-\eqref{eq:ov}. Hence by optimal setting (training) of the parameters of the neural network, its performance can not be inferior to plain BP. It is easy to verify that the proposed message passing decoding algorithm \eqref{eq:x_ie_RB_NN}-\eqref{eq:ov_NN} satisfies the message passing symmetry conditions \cite[Definition 4.81]{ru_book}. Hence, by \cite[Lemma 4.90]{ru_book}, when transmitting over a binary memoryless symmetric (BMS) channel, the error rate is independent of the transmitted codeword. Therefore, to train the network, it is sufficient to use a database which is constructed by using noisy versions of a single codeword. For convenience we use the zero codeword, which must belong to any linear code. The database reflects various channel output realizations when the zero codeword has been transmitted. The goal is to train the parameters $\left \{ w_{i,v},w_{i,e,e'},w_{i,v,e'} \right \}$ to achieve an $N$ dimensional output word which is as close as possible to the zero codeword. The network architecture is a non-fully connected neural network. We use stochastic gradient descent to train the parameters. The motivation behind the new proposed parameterized decoder is that by setting the weights properly, one can compensate for small cycles in the Tanner graph that represents the code. That is, messages sent by parity check nodes to variable nodes can be weighted, such that if a message is less reliable since it is produced by a parity check node with a large number of small cycles in its local neighborhood, then this message will be attenuated properly. The time complexity of the deep neural network is similar to plain BP algorithm. Both have the same number of layers and the same number of non-zero weights in the Tanner graph. The deep neural network architecture is illustrated in Figure~\ref{fig:BCH_15_11_arch} for a BCH(15,11) code. \begin{figure}[thpb] \centering \includegraphics[width=0.983101925\linewidth]{nn_15_11_highres.pdf} \caption{Deep Neural Network Architecture For BCH(15,11) with 5 hidden layers which correspond to 3 full BP iterations. Note that the self LLR messages $l_v$ are plotted as small bold lines. The first hidden layer and the second hidden layer that were described above are merged together. Also note that this figure shows 3 full iterations and the final marginalization.} \label{fig:BCH_15_11_arch} \end{figure} \section{EXPERIMENTS} \subsection{Neural Network Training} We built our neural network on top of the TensorFlow framework~\cite{abadi2015tensorflow} and used an NVIDIA Tesla K40c GPU for accelerated training. We applied cross entropy as our loss function, \begin{equation} L{(o,y)}=-\frac{1}{N}\sum_{v=1}^{N}y_{v}\log(o_{v})+(1-y_{v})\log(1-o_{v}) \label{eq:cross_entropy} \end{equation} where $o_{v}$, $y_{v}$ are the deep neural network output and the actual $v$th component of the transmitted codeword (if the all-zero codeword is transmitted then $y_{v}=0$ for all $v$). Training was conducted using stochastic gradient descent with mini-batches. The mini-batch size was $120$ examples. We applied the RMSPROP~\cite{rmsprop} rule with a learning rate equal to $0.001$. The neural network has $10$ hidden layers, which correspond to $5$ full iterations of the BP algorithm. Each processing element in an odd (even, respectively) indexed hidden layer is described by Equation~\eqref{eq:x_ie_RB_NN} (Equation~\eqref{eq:x_ie_LB_NN}, respectively). At test time, we inject noisy codewords after transmitting through an AWGN channel and measure the bit error rate (BER) in the decoded codeword at the network output. When computing~\eqref{eq:x_ie_RB_NN}, we also clip the input to the tanh function such that the absolute value of the input is always smaller than some positive constant $A < 10$. This is also required for practical (finite block length) implementations of the BP algorithm, in order to stabilize the operation of the decoder. We trained our decoding network on few different linear codes, including BCH(15,11), BCH(63,36), BCH(63,45) and BCH(127,106). \subsection{Neural Network Training With Multiloss} The proposed neural network architecture has the property that after every odd $i$ layer we can add final marginalization. We can use that property to add additional terms in the loss. The additional terms can increase the gradient update at the backpropagation algorithm and allow learning the lower layers. At each odd $i$ layer we add the final marginalization to loss: \begin{equation} L{(o,y)}=-\frac{1}{N}\sum_{i=1,3}^{2L-1}\sum_{v=1}^{N}y_{v}\log(o_{v,i})+(1-y_{v})\log(1-o_{v,i}) \label{eq:multiloss_cross_entropy} \end{equation} where $o_{v,i}$, $y_{v}$ are the deep neural network output at the odd $i$ layer and the actual $v$th component of the transmitted codeword. This network architecture is illustrated in Figure 2. \begin{figure}[thpb] \centering \hspace*{-3.5cm}\includegraphics[width=1.4\linewidth, left]{nn_15_11_multiloss_highres.pdf} \caption{Deep Neural Network Architecture For BCH(15,11) with training multiloss. Note that the self LLR messages $l_v$ are plotted as small bold lines.} \label{fig:BCH_15_11_arch_multiloss} \end{figure} \subsection{Dataset} The training data is created by transmitting the zero codeword through an AWGN channel with varying SNRs ranging from $1{\rm dB}$ to $6{\rm dB}$. Each mini batch has $20$ codewords for each SNR (a total of $120$ examples in the mini batch). For the test data we use codewords with the same SNR range as in the training dataset. Parity check matrices were taken from \cite{ParityCheckMatrix}. \subsection{Results} In this section we present the results of the deep neural decoding networks for various BCH block codes. In each code we observed an improvement compared to the BP algorithm. Note that when we applied our algorithm to the BCH(15,11) code, we obtained close to maximum likelihood results with the deep neural network. For larger BCH codes, the BP algorithm and the deep neural network still have a significant gap from maximum likelihood. The BER figures~\ref{fig:BCH_63_36_ber}, \ref{fig:BCH_63_45_ber} and \ref{fig:BCH_127_106_ber} show an improvement of up to $0.75{\rm dB}$ in the high SNR region. Furthermore, the deep neural network BER is consistently smaller or equal to the BER of the BP algorithm. This result is in agreement with the observation that our network cannot perform worse than the BP algorithm. Figure \ref{fig:BCH_63_45_multiloss_ber} shows the results of training the deep neural network with multiloss. It shows an improvement of up to $0.9{\rm dB}$ compared to the plain BP algorithm. Moreover, we can observe that we can achieve the same BER performance of 50 iteration BP with 5 iteration of the deep neural decoder, This is equal to complexity reduction of factor 10. We compared the weights of the BP algorithm and the weights of the trained deep neural network for a BCH(63,45) code. We observed that the deep neural network produces weights in the range from $-0.8$ to $2.2$, in contrast to the BP algorithm which has binary $“1”$ or $“0”$ weights. Figure~\ref{fig:weight_hist} shows the weights histogram for the last layer. Interestingly, the distribution of the weights is close to a normal distribution. In a similar way, every hidden layer in the trained deep neural network has a close to normal distribution. Note that Hinton \cite{hinton2010practical} recommends to initialize the weights with normal distribution. In Figures~\ref{fig:layer4_bp} and~\ref{fig:layer4_dl} we plot the weights of the last hidden layer. Each column in the figure corresponds to a neuron described by Equation ~\eqref{eq:x_ie_RB_NN}. It can be observed that most of the weights are zeros except the Tanner graph weights which have value of 1 in Figure~\ref{fig:layer4_bp} (BP algorithm) and some real number in Figure~\ref{fig:layer4_dl} for the neural network. In Figure~\ref{fig:layer4_bp} and ~\ref{fig:layer4_dl} we plot a quarter of the weights matrix for better illustration. \begin{figure}[thpb] \centering \includegraphics[width=0.983101925\linewidth]{bch_63_36_ber.png} \caption{BER results for BCH(63,36) code.} \label{fig:BCH_63_36_ber} \end{figure} \begin{figure}[thpb] \centering \includegraphics[width=0.983101925\linewidth]{bch_63_45_ber.png} \caption{BER results for BCH(63,45) code.} \label{fig:BCH_63_45_ber} \end{figure} \begin{figure}[thpb] \centering \includegraphics[width=0.983101925\linewidth]{bch_127_106_ber.png} \caption{BER results for BCH(127,106) code.} \label{fig:BCH_127_106_ber} \end{figure} \begin{figure}[thpb] \centering \includegraphics[width=0.983101925\linewidth]{bch_63_45_ber_multiloss.png} \caption{BER results for BCH(63,45) code trained with multiloss.} \label{fig:BCH_63_45_multiloss_ber} \end{figure} \begin{figure}[thpb] \centering \includegraphics[width=0.983101925\linewidth]{weight_hist.png} \caption{Weights histogram of last hidden layer of the deep neural network for BCH(63,45) code.} \label{fig:weight_hist} \end{figure} \begin{figure}[thpb] \centering \includegraphics[width=0.983101925\linewidth]{weight_mat_0_2D.png} \caption{Weights of the last hidden layer in the BP algorithm for BCH(63,45) code.} \label{fig:layer4_bp} \end{figure} \begin{figure}[thpb] \centering \includegraphics[width=0.983101925\linewidth]{weight_mat_3_2D.png} \caption{Weights of the last hidden layer in deep neural network for BCH(63,45) code.} \label{fig:layer4_dl} \end{figure} \section{CONCLUSIONS} In this work we applied deep learning techniques to improve the performance of the BP algorithm. We showed that a ``soft'' Tanner graph can produce improvements when used in the BP algorithm instead of the standard Tanner graph. We believe that the BER improvement was achieved by properly weighting the messages, such that the effect of small cycles in the Tanner graph was partially compensated. It should be emphasized that the parity check matrices that we worked with were obtained from \cite{ParityCheckMatrix}. We have not evaluated our method on parity check matrices for which an attempt was made to reduce the number of small cycles. A notable property of our neural network decoder is that once we have trained its parameters, we can improve performance compared to plain BP without increasing the required computational complexity. Another notable property of the neural network decoder is that we learn the channel and the linear code simultaneously. We regard this work as a first step in the implementation of deep learning techniques for the design of improved decoders. Our future work include possible improvements in the error rate results by exploring new neural network architectures and combining other decoding methods. Furthermore, we plan to investigate the connection between the parity check matrix and the deep neural network decoding capabilities. \addtolength{\textheight}{-12cm} \section*{ACKNOWLEDGMENT} This research was supported by the Israel Science Foundation, grant no. 1082/13. The Tesla K40c used for this research was donated by the NVIDIA Corporation. \bibliographystyle{IEEEtran}
{'timestamp': '2016-10-03T02:05:04', 'yymm': '1607', 'arxiv_id': '1607.04793', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04793'}
arxiv
\section{Introduction} Human Activity Recognition (HAR) is the understanding of human behaviour from data captured by pervasive sensors, such as cameras or wearable devices. It is a powerful tool in medical application areas, where consistent and continuous patient monitoring can be insightful. Wearable devices provide an unobtrusive platform for such monitoring, and due to their increasing market penetration, feel intrinsic to the user. This daily integration into a user's life is crucial for increasing the understanding of overall human health and wellbeing. This is referred to as the ``quantified self" movement. Wearables, such as actigraph accelerometers, generate a continuous time series of a person's daily physical exertion and rest. This ubiquitous monitoring presents substantial amounts of data, which can ({\em i})~ provide new insights by enriching the feature set in health studies, and ({\em ii})~ enhance the personalisation and effectiveness of health, wellness, and fitness applications. By decomposing an accelerometer's time series into distinctive activity modes or actions, a comprehensive understanding of an individual's daily physical activity can be inferred. The advantages of longitudinal data are however complemented by the potential of noise in data collection from an uncontrolled environment. Therefore, the data sensitivity calls for robust automated evaluation procedures. In this paper, we present a robust automated human activity recognition (RAHAR) algorithm. We test our algorithm in the application area of sleep science by providing a novel framework for evaluating sleep quality and examining the correlation between the aforementioned and an individual's physical activity. Even though we evaluate the performance of the proposed HAR algorithm on sleep analysis, RAHAR can be employed in other research areas such as obesity, diabetes, and cardiac diseases. \section{Related Work} Human activity recognition (HAR) has been an active research area in computer vision and machine learning for many years. A variety of approaches have been investigated to accomplish HAR ranging from analysis of still images and videos to motion capture and inertial sensor data. Video has been the most widely studied data source in HAR literature. Hence, there exists a wealth of papers in this particular domain. The most recent literature on HAR from videos include trajectory-based descriptors~\cite{ HWang:IJCV15, BFernando:TPAMI16, IAtmosukarto:WACV15}, spatio-temporal feature representations~\cite{ SMa:CVPR15, ZZhou:TMM15, DTran:ICCV15}, feature encoding~\cite{ VKantorov:CVPR14, XPeng:ECCV14, HKuehne:WACV16}, and deep learning~\cite{ JDonahue:CVPR15, LWang:CVPR15, LSun:ICCV15}. Reviewing the extensive list of video-based HAR studies, however, goes beyond the scope of this study and we refer the reader to~\cite{ SKe:Computers13, PBorges:TCSVT13} for a collection of more comprehensive surveys on the topic. Unlike HAR from video, existing approaches for HAR from still images are somewhat limited, and range from histogram-based representations~\cite{NIkizler:ICPR08, CThurau:CVPR08} and color descriptors~\cite{FKhan:IJCV13} to pose-, appearance- and parts-based representations~\cite{WYang:CVPR10, SMaji:CVPR11, BYao:ICCV11, GSharma:TPAMI16}. Guo and Lai recently provided a comprehensive survey of the studies on still image-based HAR in~\cite{GGuo:PatRec14}. Several techniques have been proposed, on the other hand, for HAR from 3D data, encompassing representations based on bag-of-words~\cite{ WLi:CVPRW10, LXia:CVPRW12}, eigen-joints~\cite{ XYang:CVPRW12}, sequence of most informative joints~\cite{ FOfli:JVCI14}, linear dynamical systems~\cite{ RChaudhry:CVPRW13}, actionlets~\cite{ JWang:CVPR12}, Lie algebra embedding~\cite{ RVemulapalli:CVPR14}, covariance descriptors~\cite{ MHussein:IJCAI13}, hidden Markov models~\cite{ FLv:ECCV06}, subspace view-invariant metrics~\cite{ YSheikh:ICCV05} and occupancy patterns~\cite{ JWang:ECCV12, AVieira:CIARP12}. Aggarwal and Xia presented a recent survey summarizing state-of-the-art techniques in HAR from 3D data~\cite{JAggarwal:PatRec14}. Unlike vision-based HAR systems, sensor-based HAR technologies commonly deal with time series of state changes and/or various parameter values collected from a wide range of sensors such as contact sensors, accelerometers, audio and motion detectors, etc. Chen et al.~\cite{LChen:TCMCC12} and Bulling et al.~\cite{ABulling:CSUR14} present comprehensive reviews of sensor-based activity recognition literature. The most recent work in this domain includes knowledge-based inference~\cite{ACalzada:EMBC14, DBiswas:HUMOV15}, ensemble methods~\cite{ATripathi:EAIS15, CCatal:ASOC15}, data-driven approaches~\cite{RAkhavian:WSC15, LLiu:KNOSYS15}, and ontology-based techniques~\cite{GOkeyo:PMCJ14}. All of the aforementioned studies investigate recognition/classification of fully observed action or activity, e.g., jumping, walking, running, drinking, etc. (i.e., activities of daily living), using well-curated datasets. However, thanks to the ``quantified self" movement, myriad of consumer-grade wearable devices have become available for individuals who have started monitoring their physical activity on a continuous basis, generating tremendous amount of data. Therefore, there is an urgent need for automatic analysis of data coming from fitness trackers to assess the physical activity levels and patterns of individuals for the ultimate goal of quantifying their overall wellbeing. This task requires understanding of longitudinal, noisy physical activity data at a rather higher (coarser) level than specific action/activity recognition level. Main challenges as well as opportunities of HAR from personalized data and lifelogs have been discussed in several dimensions in~\cite{BDobkin:CurrOpinNeurol13, OLara:SURV13, JBort-Roig:Sports14, MRehman:Sensors15, SMukhopadhyay:JSEN15}. There has been a number of initiatives to overcome the challenge of collecting annotated personalized data to further research on HAR from continuous measurement of real-world physical activities~\cite{MZhou:ICMR13, CMeurisch:UbiComp15}. Even though such systems exhibit a crucial attempt in furthering research in mining personalized data, they have limited practical importance as they rely on manual annotation of the acquired data. There has also been recent attempts to automatically recognize human activities from continuous personalized data~\cite{JHamm:MobiCASE13, CDobbins:CIT15, MUddin:WearSys15, OBanos:EMBC15}. However, most of these studies are designed to recognize only a predefined set of activities, and hence, not comprehensive and robust enough to quantify the physical activity levels for the overall assessment of individuals' wellbeing. \section{Background} Sleep pattern evaluation is a paragon of cumbersome testing and requires extensive manual evaluation and interpretation by clinical experts. Unhealthy sleep habits can impede physical, mental and emotional wellbeing, and lead to exacerbated health consequences~\cite{strine2005associations}. Since patient referral to sleep specialists is often based on self-reported abnormalities, exacerbation often precedes diagnosis. Clinical diagnosis of complex sleep disorders involves a variety of tests, including an overnight lab stay with oxygen and brain wave monitoring (polysomnography and electroencephalogram, respectively), and a daily sleep history log with a subjective questionnaire. The daily sleep logs and questionnaires are often found to be unreliable and inconsistent with actual observed activity. This is especially true in adolescents~\cite{arora2013investigation}. The overnight stay allows specialists to manually monitor the patient's sleep period. This requires the active involvement of a clinical sleep specialist. Furthermore, the monitoring is only for one night and in a clinical setting, rather than the patient's own home. Using wearable devices provides both a context-aware and longitudinal monitoring. The inconvenience and inaccuracy of daily logs, coupled with the invasiveness of an overnight lab stay, substantiate the need and adoption of wearable devices for first pass diagnostic screening. More generally, using our HAR approach with a wearable device empowers users to self-monitor their sleep patterns, and reform their activity habits for optimised sleep and an improved quality of life. \section{Preliminaries} In this section we present a description of the dataset and the context-aware definitions used for our application area. \subsection{Data} Data was collected as part of a research study to examine the impact of sleep on health and performance in adolescents by Weil COrnell Medical COllege - Qatar. Two international high schools were selected for cohort development. Student volunteers were provided with an actigraph accelerometer, ActiGraph GT3X+\footnote{http://actigraphcorp.com/support/activity-monitors/gt3xplus/}, to wear on their non-dominant wrist, continuously throughout the study (i.e. even when sleeping). Deidentified data collected in the study were used in the current analysis. The ActiGraph GT3X+ is a clinical-grade wearable device that has been previously validated against clinical polysomnography~\cite{PFreedson:MedSciSports98}. The device samples the user's sleep-wake activity at 30-100 Hertz. Currently sleep experts use this device in conjunction with the accompanying software, ActiLife\footnote{http://actigraphcorp.com/products-showcase/software/actilife/}, to evaluate an individual's sleep period. We evaluate our results side-by-side with ActiLife's results. \subsection{Definitions} \begin{figure*} \caption{Sleep science definitions on an example accelerometer data extract} \centering \includegraphics[scale=0.25]{ActivityExample.jpg} \label{fig:sleep_example} \end{figure*} \begin{table*} \centering \caption{Relevant sleep science equations~\cite{CIber:AASM07}} \centering \begin{tabular}{c|c} \hline Sleep Period & $ \big[ \text{Sleep Onset Time}, \text{Sleep Awakening Time} \big] $ \T\B \\ \hline Sleep Period Duration & $ \left \| \text{Sleep Awakening Time} - \text{Sleep Onset Time} \right \| $ \T\B \\ \hline Wake After Sleep Onset (WASO) & $ \sum_{\text{n}=\text{onset}}^{\text{awake}} \left \| \text{Wakefulness} \right \| $ \T\B \\ \hline Latency & $ \big[ \text{Preceding Sedentary Time}, \text{Sleep Onset Time} \big] $ \T\B \\ \hline Total Minutes in Bed & $ \left \| \text{Sleep Awakening Time} - \text{Preceding Sedentary Time} \right \| $ \T\B \\ \hline Total Sleep Time & $ \left \| \text{Sleep Period Duration} - \text{WASO} - \text{Latency} \right \| $ \T\B \\ \hline Sleep Efficiency & $ \text{Total Sleep Time} / \text{Total Minutes in Bed} $ \T\B \\ \hline \end{tabular} \label{tab:sleep_eqs} \end{table*} To apply our methodology to the area of sleep science, it is important to note the definitions mentioned in this section. In traditional sleep study literature, a sleep period is bounded between the sleep-onset-time and sleep-awakening-time~\cite{CIber:AASM07}. Experts characterise the sleep-onset-time as the first minute after a self-reported bedtime, that is followed by 15 minutes of continuous sleep~\cite{sadeh2000sleep}. We propose a modified definition, that allows for automatic evaluation and deems sleep diaries unnecessary. As a result, we can infer the ``bedtime" of an individual in reverse, based on their sedentary activity before the onset of sleep. Epoch records that contain no triaxial movement, 0 steps taken, and an inclinometer output of not lying down, are candidate sleep records, and are further tested for whether they are a component of the sleep period. We define sleep-onset-time as the first candidate epoch record in a series of 15 continuous candidate sleep minutes. Likewise, the sleep-awakening-time is defined as the last epoch record in a series of 15 continuous candidate sleep minutes, that is followed by 30 continuous non-candidate sleep minutes, (i.e. 30 minutes of active awake time). The sleep period duration can be computed as the time passed between sleep onset and sleep awakening. Within the sleep period, there are periods of unrest or wakefulness. For example, when a user re-adjusts positions, or uses the bathroom. If the duration of movement exceeds 5 consecutive minutes of activity, it is marked as a time of ``wakefulness." The total sum of all moments of wakefulness is referred to as wake-after-sleep-onset, also known as WASO. Immediately preceding the start of the sleep onset, is the time-in-bed, which quantifies the sedentary time an individual spends before they have fallen asleep. This sedentary time can be observed in the actigraph accelerometer data. The time that the preceding sedentary activity begins until the time of the sleep onset is called the sleep latency. From the aforementioned values, total sleep time and an overall sleep efficiency score can be deduced. Total sleep time covers the defined sleep period, less the wake after sleep onset time and less the latency. Lastly, sleep efficiency is the ratio of total sleep time to total minutes in bed. All of the above definitions are summarised in Table~\ref{tab:sleep_eqs}, and visualised in Fig.~\ref{fig:sleep_example}. In this study, we use sleep efficiency as the metric to measure sleep quality~\cite{JCacioppo:PsycSci02} among other metrics such as latency, wake after sleep onset, awakening index, total sleep time, etc.~\cite{SScholle:SleepMedicine11}. \section{Methodology} Our methodology for RAHAR is shown algorithmically in Fig.~\ref{algo:rahar}. We elaborate on the details of our algorithm in the sequel. \begin{figure} \begin{algorithmic}[1] \STATE{\textbf{input:} Raw accelerometer data} \STATE{\textbf{output:} Time-series segments with activity intensity level annotations} \FORALL{segment (daily or otherwise)} \FORALL{epoch (minutes, hour, etc.)} \STATE{implement activity cut points} \ENDFOR \STATE{change points $\gets$ implement hierarchical divisive estimation} \STATE{change point intervals $\gets$ divide time series by change points} \ENDFOR \FORALL{change point interval} \STATE{activity mode $\gets$ statistical mode of cut points} \ENDFOR \end{algorithmic} \caption{Algorithm for Robust Automated Human Activity Recognition (RAHAR).} \label{algo:rahar} \end{figure} \begin{figure*} \centering \caption{Classification labelling of each change point interval during an example awake time} \includegraphics[width=1.0\linewidth]{RAHAR.png} \label{fig:change_point_labeling} \end{figure*} \subsection{Pre-Processing} The accelerometer of choice, Actigraph GT3X+, sampled each person's activity at 30-100 Hertz. The stored data included the triaxial accelerometer coordinates as well as a computed epoch step count based on the vertical axis, and post-processed inclinometer orientation. This raw data was downloaded and aggregated to a minute-by-minute granularity. An epoch of one minute was selected in order to optimise the interpretability of the physical activity~\cite{KGabriel:IJBNPA10}, as well as for implementing the state-of-the-art cut point methodology~\cite{troiano2008physical}. In other contexts, a different granularity may be sufficient. \subsection{Automated Annotation and Segmentation} Due to the context of sleep disorders, sleep periods needed to be annotated within the raw ActiGraph output. Candidate sleep records, epochs with no triaxial movement, 0 steps taken, and an inclinometer output of not lying down, were identified in the time series and tested to find the sleep onset time, and sleep awakening time. The details of this terminology is elaborated in the preliminaries section. All test instances that fell within these two boundary times, were annotated as ``Sleep," and constituted the sleep period. Whilst analysing the data, we found that several participants had multiple sleep periods in a day, implying that they took daily naps or followed a polyphasic, or biphasic, sleep pattern. Upon closer analysis of the length and time of the sleep period, no discernible patterns were visible. Thus we opted to segment the time series by the end of a sleep period rather than the traditional approach of segmenting by day. Each sleep period was linked to its preceding activity, extending until the previous sleep period. We refer to these segments as sleep-wake segments. The result of this decision is that the activity immediately before each sleep period is used for the correlation analysis for its subsequent sleep period, rather than the total for that day. \begin{figure*} \centering \caption{ROC curves for sleep efficiency} \begin{subfigure}[b]{0.49\linewidth} \centering \caption{RAHAR} \includegraphics[width=\linewidth]{Ours_ROC.png} \label{fig:roc_RAHAR} \end{subfigure} \begin{subfigure}[b]{0.49\linewidth} \centering \caption{Sleep Expert + ActiLife} \includegraphics[width=\linewidth]{SleepExpert_ROC.png} \label{fig:roc_SEAL} \end{subfigure} \label{fig:roc_curve} \end{figure*} \begin{table*} \centering \caption{Sleep efficiency results} \begin{tabular}{c|cc|cc|cc|cc|cc} \hline &\multicolumn{2}{c}{AU-ROC} & \multicolumn{2}{c}{F1 Score}& \multicolumn{2}{c}{Recall}& \multicolumn{2}{c}{Precision}& \multicolumn{2}{c}{Accuracy} \\ \hline & SE+AL & RAHAR & SE+AL & RAHAR & SE+AL & RAHAR & SE+AL & RAHAR & SE+AL & RAHAR \\ \hline \hline Ada & 0.7489 & 0.8132 & 0.5574 & 0.6885 & 0.5484 & 0.5526 & 0.5667 & 0.9130 & 0.6966 & 0.7206\\ RF & 0.8115 & 0.8746 & 0.6885 & 0.7500 & 0.6774 & 0.6316 & 0.7000 & 0.9231 & 0.7865 & 0.7647\\ SVM & 0.7497 & 0.7895 & 0.3721 & 0.7077 & 0.2581 & 0.6053 & 0.6667 & 0.8519 & 0.6966 & 0.7206\\ LogR & 0.5884 & 0.8649 & - & 0.6875 & - & 0.5789 & - & 0.8462 & - & 0.7059\\ \hline Average & 0.7246 & 0.8355 & 0.5393* & 0.7154* & 0.4946* & 0.5965* & 0.6445* & 0.8960* & 0.7266* & 0.7353*\\ \hline \multicolumn{11}{@{}l}{{\scriptsize * logistic regression (LogR) score is not included in averaging.}} \\ \end{tabular} \label{tab:slp_eff_res} \end{table*} \subsection{Activity Mode Detection} The actigraph accelerometer data contains post-filtered ``counts" for each of the axes. These counts quantify the frequency and intensity of the user's activity\footnote{http://actigraphcorp.com/wp-content/uploads/2015/06/ActiGraph-White-Paper\_What-is-a-Count\_.pdf}. Using Troiano's cut point scale~\cite{troiano2008physical}, the age of a user, and their accelerometer triaxial count, each epoch is labeled with an intensity level: Sedentary, Light, Moderate, or Vigorous. Since each epoch is 1 minute in length, this provides an unnecessary granularity to an individual's activity levels and is highly subject to noise. We ``smooth" the activity intensity levels over activity modes using change point detection. Once the time series is segmented into sleep-wake segments, we identify the distinctive activity modes using the multiple change point detection algorithm, hierarchical divisive estimation~\cite{NJames:JSS15}. We tested the change points to a statistical significance level of 0.01 and used a maximum number of random permutations of 99. Each change point result is treated as the interval boundaries for distinctive activity modes. Each sleep-wake segment now consists of a series of change point intervals. The activity intensity classification label for each change point interval is computed by taking the statistical mode of the minute-by-minute labels over every epoch existing within the interval. Fig.~\ref{fig:change_point_labeling} illustrates the classification labelling of an individual's awake time. \subsection{Modeling} In sleep science, sleep quality is defined by a number of metrics, including total sleep time, wake after sleep onset, awakening index, and sleep efficiency~\cite{SScholle:SleepMedicine11}. In our analysis, we focus on sleep efficiency metric for our experiments~\cite{JCacioppo:PsycSci02}. Sleep efficiency is computed as a numerical value ranging from 0 to 1. According to specialists, a sleep efficiency below 0.85 (i.e., 85\%) indicates poor sleep quality. Thus, each sleep period can be classified as having ``good sleep efficiency" or ``poor sleep efficiency"~\cite{williams1974electroencephalography}. To model the effect of daily physical activity on sleep, the duration of each intensity level of activity was aggregated over the sleep-wake segment. The percentage of awake time in each mode was used as the model input. \section{Experiments and Results} \begin{figure*} \centering \caption{Comparison of the performance of random forest model for each approach} \begin{subfigure}[b]{0.49\linewidth} \centering \caption{ROC} \includegraphics[width=\linewidth]{RandomForest_comp.png} \label{fig:rf_roc_comp} \end{subfigure} \begin{subfigure}[b]{0.49\linewidth} \centering \caption{Sensitivity-Specificity} \includegraphics[width=\linewidth]{SensSpec_comp.png} \label{fig:rf_ss_comp} \end{subfigure} \label{fig:rf_comp} \end{figure*} \begin{table*} \centering \caption{Sleep efficiency -- sensitivity and specificity} \begin{tabular}{c|cc|cc|cc|cc} \hline &\multicolumn{2}{c}{AU-ROC} & \multicolumn{2}{c}{F1 Score}& \multicolumn{2}{c}{Sensitivity}& \multicolumn{2}{c}{Specificity} \\ \hline & SE+AL & RAHAR & SE+AL & RAHAR & SE+AL & RAHAR & SE+AL & RAHAR \\ \hline \hline Ada & 0.7489 & 0.8132 & 0.5574 & 0.6885 & 0.5484 & 0.5526 & 0.7759 & 0.9333\\ RF & 0.8115 & 0.8746 & 0.6885 & 0.7500 & 0.6774 & 0.6316 & 0.8448 & 0.9333\\ SVM & 0.7497 & 0.7895 & 0.3721 & 0.7077 & 0.2581 & 0.6053 & 0.9310 & 0.8667\\ LogR & 0.5884 & 0.8649 & - & 0.6875 & - & 0.5789 & - & 0.8667\\ \hline Average & 0.7246 & 0.8355 & 0.5393* & 0.7154* & 0.4946* & 0.5965* & 0.8505* & 0.9111*\\ \hline \multicolumn{9}{@{}l}{{\scriptsize * logistic regression (LogR) score is not included in averaging.}} \\ \end{tabular} \label{tab:sens_spec} \end{table*} RAHAR is fundamentally a feature extraction algorithm for HAR in the context of quantifying daily physical activity levels of individuals. We therefore test the quality of activity recognition by RAHAR as compared to an expert-based HAR using a tool on continuous physical activity data from a wearable sensor. Since there is \textit{no} ground truth on human activity in this context, our objective is to evaluate which HAR approach leads to better quality models for sleep research, i.e., models for predicting sleep quality, specifically, sleep efficiency. We selected four models for evaluating the performance of RAHAR against the performance of an expert-based HAR using a tool on the described actigraphy dataset: logistic regression, support vector machines with radial basis function kernel, random forest, and adaboost. \begin{itemize} \item Logistic Regression (LogR): We chose this model because it is an easily interpretable binary classifier. It is also relatively robust to noise, which as explained earlier is a complication on data collected in an uncontrolled environment.\footnote{Even though we included logistic regression (LogR) in our experiments, it is important to note that LogR model failed to stratify the dataset successfully for the state-of-the-art baseline approach, and predicted all cases to be in a single class. Therefore, we excluded LogR score of RAHAR from analysis whenever corresponding LogR score of the state-of-the-art baseline approach was not available.} \item Support Vector Machine (SVM): This model was selected because it, also, is a binary classifier. We chose a radial basis function kernel, and so it differs from logistic regression in that it does not linearly divide the data. \item Random Forest (RF): This model was tested as an alternative because of its easy straightforward interpretation, which is particularly relevant in the healthcare or consumer domains. It also is not restricted to linearly dividing the data. \item Adaboost (Ada): Lastly, Adaboost was tested because it is less prone to overfitting than random forest. \end{itemize} For comparison purposes, we use the results from a sleep specialist using Actigraph's ActiLife software as a baseline. The sleep specialist segmentation of the ActiLife results uses the preceding day's activity for each sleep period, and aggregates the activity to an epoch of an hour. ActiLife requires the sleep specialist to manually adjust the sleep period boundaries, and then automatically computes the efficiency and other sleep metrics. Figs.~\ref{fig:roc_RAHAR} and~\ref{fig:roc_SEAL} show the ROC curves for RAHAR and the sleep expert using ActiLife software (denoted as ``SE+AL"), respectively, while Table~\ref{tab:slp_eff_res} summarises the results for both RAHAR and SE+AL. One of the most important performance measures for HAR is the area under ROC (AU-ROC). Based on AU-ROC scores, both RAHAR and SE+AL performed best with random forest model. Furthermore, SE+AL achieved an average AU-ROC of 0.7246 whereas RAHAR achieved 0.8355, a 15\% improvement of AU-ROC score on average by our algorithm as opposed to the sleep expert using ActiLife. With an AU-ROC score of 0.5884 for SE+AL approach, the logistic regression model was, however, unable to stratify the dataset, and so predicted all cases to be in a single class. We considered this to be a failure of the logistic regression model for this problem, and thus, did not include its results in our discussion whenever it was appropriate to do so. For this reason, the misleading results have also been removed from Table~\ref{tab:slp_eff_res}. Another important performance measure for HAR is the F1 score, which is computed as the harmonic mean of precision and recall. According to Table~\ref{tab:slp_eff_res}, RAHAR performed better than SE+AL in terms of precision and recall for all models, and hence, yielded significantly higher F1 scores. Specifically, F1 score for RAHAR, on average, was 0.7154 whereas it was 0.5393 for SE+AL (excluding logistic regression in both cases), yielding a solid margin of about 0.18 points (i.e., more than 30\% improvement). On the other hand, the accuracy scores, on average, were 0.7353 for RAHAR and 0.7266 for SE+AL (again excluding logistic regression), and exhibited a relatively less significant difference still in favor of RAHAR. \section{Discussion of Results in Medical Context} In this section we discuss the results of the best performing model and its broader impact to the area of sleep science. As seen in Fig.~\ref{fig:roc_curve} random forest and logistic regression were the two best performing models with the RAHAR algorithm. Based on the desired threshold value of true positive rate, TPR, (i.e., sensitivity), either model could be preferred to minimize false positive rate, FPR, (i.e., 1-specificity), which is equivalent to maximizing specificity. Random forest was also the best performing model for the SE+AL approach as mentioned earlier. If we compare the ROC as well as the sensitivity-specificity plots of the best model of each approach (i.e., random forest), we see that RAHAR outperforms SE+AL almost always as illustrated in Fig.~\ref{fig:rf_comp}. Table~\ref{tab:sens_spec}, on the other hand, summarises sensitivity and specificity scores for RAHAR and SE+AL. Average sensitivity score for SE+AL and RAHAR across all models except logistic regression were 0.4946 and 0.5965, respectively. In other words, average sensitivity score for RAHAR is 20\% higher than that of SE+AL. As for specificity, RAHAR with an average score of 0.9111 outperforms SE+AL with an average score of 0.8505, which corresponds to a 7\% improvement. As we seek to determine in our study whether a person had a ``good quality sleep" based on his physical activity levels during awake period prior to sleep, a false positive occurs when the model predicts ``good quality sleep" when the person actually had a ``poor quality sleep." Therefore, the number of false positives needs to be kept at a minimum for a desired number of true positives. In other words, a high specificity score is sought after while keeping the sensitivity score at the desired level. As can be seen from Fig.~\ref{fig:rf_ss_comp} with this perspective in mind, for a large range of sensitivity scores, RAHAR achieved higher specificity scores almost all the time than SE+AL did. For example, RAHAR achieved a sensitivity score of 0.9 with a specificity score of 0.8 whereas SE+AL remained at a specificity score of 0.6 for the same sensitivity threshold. In summary, RAHAR outperforms state-of-the-art procedure in sleep research in many aspects. However, its application is not limited to sleep and it can be used for understanding and treatment of other health issues such as obesity, diabetes, or cardiac diseases. Moreover, RAHAR allows for fully automated interpretation without the necessity of manual input or subjective self-reporting. Given the current interest in deep learning, a natural question that may arise is why an approach based on feature extraction and model building has been used instead of using deep learning models directly on the raw sensor data for HAR. In medical community, the explainability of a model is of utmost important as the medical professionals are interested in learning cause-and-effect relationships and using this knowledge to support their decision making processes. In this particular case, for example, sleep experts are interested in understanding how and when certain physical activity levels effect sleep in order to make decisions to improve sleep quality of individuals accordingly. However, it is an interesting idea to explore deep learning to see what is the best model from a model accuracy perspective to understand the limits of the value of continuous monitoring of individuals' physical activity, not only from a medical perspective in particular but also from a ``quantified self" perspective in general. \section{Conclusion} In this paper, we presented a robust automated human activity recognition (RAHAR) algorithm for multi-modal phenomena, and evaluated its performance in the application area of sleep science. We tested the results of RAHAR against the results of a sleep expert using ActiLife for predicting sleep quality, specifically, sleep efficiency. Our model a) automated the activity recognition, and b) improved the current state-of-the-art results, on average, by ~15\% in terms of AU-ROC and ~30\% in terms of F1 scores across different models. Automating the human activity recognition puts sleep science evaluation in the hands of wearable device users. This empowers users to self-monitor their sleep-wake habits, and take action to improve the quality of their life. The improved results demonstrate the robustness of RAHAR as well as the capabilities of implementing the algorithm within clinical software such as ActiLife. The application of RAHAR is, however, not limited to sleep science. It can be used to monitor physical activity levels and patterns of individuals with other health issues such as obesity, diabetes, and cardiac diseases. Besides, RAHAR can also be used in the general context of the ``quantified self" movement, and provide individuals actionable information about their overall fitness levels. \bibliographystyle{IEEEtran}
{'timestamp': '2016-07-20T02:06:21', 'yymm': '1607', 'arxiv_id': '1607.04867', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04867'}
arxiv
\section{Background} \label{background} \subsection{Notation} Let $ I_t : \mathbb R^2\mapsto \mathbb R $ refer to an image captured at time $t$ treated as a function of real values using sub pixel interpolation \cite{Dame10_mi_thesis} for non integral locations. The patch corresponding to the tracked object's location in $ I_t $ is denoted by $\mathbf{I_t}(\mathbf{x_t}) \in \mathbb R^N $ where $\mathbf{x_t}=[\mathbf{x_{1t}},..., \mathbf{x_{Nt}}]$ with $\mathbf{x_{kt}}=[x_{kt}, y_{kt}]^T \in \mathbb R^2$ being the Cartesian coordinates of pixel $ k $. Further, $\mathbf{w}(\mathbf{x}, \mathbf{p_s}) : \mathbb{R}^2 \times \mathbb{R}^S\mapsto \mathbb{R}^2$ denotes a warping function of $ S $ parameters that represents the set of allowable image motions of the tracked object by specifying the deformations that can be applied to $\mathbf{x_0}$ to align $\mathbf{I_t}(\mathbf{w}(\mathbf{x_0},\mathbf{p_{st}}))$ with $ \mathbf{I_0}(\mathbf{x_0}) $. Finally $f(\mathbf{I^*}, \mathbf{I^c},\mathbf{p_a} ) : \mathbb{R}^N \times \mathbb{R}^N \times \mathbb{R}^A\mapsto \mathbb{R}$ is a function of $A$ parameters that measures the similarity between two patches - the reference or template patch $\mathbf{I^*}$ and a candidate patch $ \mathbf{I^c} $. For brevity, $ \mathbf{I_t}(\mathbf{w}(\mathbf{x_0}, \mathbf{p_{st}}))$ and $\mathbf{I_0}(\mathbf{x_0})$ will also be denoted as $ \mathbf{I_t} $ and $ \mathbf{I_0} $ respectively. \subsection{Decomposing registration based tracking} \label{decompose_registration_tracking} Using this notation, RBT can be formulated as a search problem whose aim is to find the optimal parameters $\mathbf{p_t}=[\mathbf{p_{st}}, \mathbf{p_{at}}]\in\mathbb{R}^{S+A}$ that maximize the similarity, given by $f$, between $\mathbf{I^*} = \mathbf{I_0}$ and $\mathbf{I^c}=\mathbf{I_t}$, that is, \begin{equation} \begin{aligned} \label{reg_tracking} \mathbf{p_t} = \underset{\mathbf{p_s},\mathbf{p_a} } {\mathrm{argmax}} ~f(\mathbf{I_0}(\mathbf{x_0}),\mathbf{I_t}(\mathbf{w}(\mathbf{x_0},\mathbf{p_s})), \mathbf{p_a}) \end{aligned} \end{equation} This formulation gives rise to an intuitive way to decompose the tracking task into three sub modules - the similarity metric $ f $, the warping function $ \mathbf{w} $ and the optimization approach. These can be designed to be semi independent in the sense that any given optimizer can be applied unchanged to several combinations of methods for the other two modules which in turn interact only through a well defined and consistent interface. In this work, these sub modules are respectively referred to as AM, SSM and SM. A more detailed description with examples follows. \subsubsection{Appearance Model} \label{appearanceModel} This is the image similarity metric defined by $f$ in Eq. \ref{reg_tracking} that the SM uses to compare different warped patches from $ I_t $ to find the closest match with $\mathbf{I^*}$. It may be noted that $\mathbf{I^*}$ is not constrained to be fixed but may be updated during tracking as in \cite{Ross08ivt}. Examples of $f$ with $A=0$ include sum of squared differences (\textbf{SSD}) \cite{Lucas81lucasKanade,Baker04lucasKanade_paper,Benhimane07_esm_journal}, sum of conditional variance (\textbf{SCV}) \cite{Richa11_scv_original}, reversed SCV (\textbf{RSCV}) \cite{Dick13nn}, normalized cross correlation (\textbf{NCC}) \cite{Scandaroli2012_ncc_tracking}, mutual information (\textbf{MI}) \cite{Dowson08_mi_ict,Dame10_mi_ict} and cross cumulative residual entropy (\textbf{CCRE}) \cite{Wang2007_ccre_registration,Richa12_robust_similarity_measures}. There has also been a recent extension to SCV called \textbf{LSCV} \cite{Richa14_scv_constraints} that claims to handle localized intensity changes better. Finally, it has been shown \cite{Ruthotto2010_thes_ncc_equivalence} that SSD performs better when applied to z-score \cite{Jain2005_ncc_z_score} normalized images which makes it equivalent to NCC. The resultant formulation is considered here as a distinct AM called Zero Mean NCC (\textbf{ZNCC}). These AMs can be divided into 2 categories - those that use some form of the L2 norm as $ f $ - SSD, SCV, RSCV, LSCV and ZNCC - and those that do not - MI, CCRE and NCC. The latter are henceforth called robust AMs after \cite{Richa12_robust_similarity_measures}. The two AMs introduced here - SSIM and SPSS - too fall into this category. To the best of our knowledge, the only AMs with $A\neq 0$ introduced thus far in literature are those with an illumination model (\textbf{ILM}), where $f$ is expressed as $f(\mathbf{I^*}, g(\mathbf{I^c},\mathbf{p_a}))$ with $g : \mathbb{R}^N \times \mathbb{R}^A \mapsto \mathbb{R}^N$ accounting for differences in lighting conditions under which $I_0$ and $I_t$ were captured. These include gain \& bias (\textbf{GB}) \cite{Bartoli2006,Bartoli2008} and piecewise gain \& bias (\textbf{PGB}) \cite{Silveira2007_esm_lighting,Silveira2009_ilm_rgb_vs,Silveira2010_esm_ilm_rgb,Silveira14_esm_ilm_omni} with the latter comprising surface modeling with radial basis function (\textbf{RBF}) too. Though there have also been AMs that incorporate online learning \cite{Jepson2003_online_am,Ross08ivt,Firouzi2014227_online_am}, they are not compatible with all SMs used here and so have not been tested. \subsubsection{State Space Model} \label{stateSpace} This is the warping function $ \mathbf{w} $ that represents the deformations that the tracked patch can undergo. It therefore defines the set of allowable image motions of the corresponding object and can be used to place constraints on the search space of $ \mathbf{p_s} $ to make the optimization more robust or efficient. Besides the DOF of allowed motion, SSM also includes the actual parameterization of $ \mathbf{w} $. For instance, even though both represent 8 DOF motion, $\mathbb{SL}(3)$ \cite{Benhimane07_esm_journal, Kwon2014_sl3_aff_pf} is considered as a different SSM than standard homography \cite{Lucas81lucasKanade,Baker04lucasKanade_paper} that uses actual entries of the corresponding matrix. This work uses 7 SSMs including 5 from the standard hierarchy of geometrical transformations \cite{Hartley04MVGCV,Szeliski2006_fclk_extended} - translation, isometry, similitude, affine and homography - along with two alternative parameterizations of homography - $\mathbb{SL}(3)$ and corner based (i.e. using x,y coordinates of the bounding box corners). More complex SSMs to handle non rigid objects have also been proposed in literature like thin plate splines \cite{Bookstein1989_tps}, basis splines \cite{Szeliski1997_spline} and quadric surfaces \cite{Shashua2001_q_warp}. However, these are not tested here as the datasets used only feature rigid objects so these cannot be fairly evaluated. Extensions like incorporation of 3D pose \cite{Cobzas2009_ic_3d_tracking} and camera parameters \cite{Trummer2008_gklt} to $ \mathbf{w} $ are also excluded. \subsubsection{Search Method} \label{searchMethod} This is the optimization procedure that searches for the warped patch in $ I_t $ that best matches $\mathbf{I^*}$. There have been two main categories of SMs in literature - gradient descent (GD) and stochastic search. The former category includes the four variants of the classic Lucas Kanade (LK) tracker \cite{Lucas81lucasKanade} - forward additive (\textbf{FALK}) \cite{Lucas81lucasKanade}, inverse additive (\textbf{IALK}) \cite{Hager98parametricModels}, forward compositional (\textbf{FCLK}) \cite{Szeliski2006_fclk_extended} and inverse compositional (\textbf{ICLK}) \cite{Baker01ict} - that have been shown \cite{Baker01ict,Baker04lucasKanade_paper} to be equivalent to first order terms. Here, however, we show experimental results (Sec. \ref{res_sm}) proving that they perform differently in practice. A more recent approach of this type is the Efficient Second order Minimization (\textbf{ESM}) \cite{Benhimane07_esm_journal} technique that uses gradients from both $ I_0 $ and $ I_t $ to make the best of ICLK and FCLK. Several extensions have also been proposed to these SMs to handle specific challenges like motion blur \cite{Park2009_esm_blur}, resolution degradation \cite{Ito2011_res_degrade}, better Taylor series approximation \cite{Keller2008} and optimal subset selection \cite{Benhimane2007}. Though these can be fit within our framework, either as distinct SMs or as variants thereof, they are not considered here for lack of space. There are three main stochastic SMs in literature - approximate nearest neighbor (\textbf{NN}) \cite{Gu2010_ann_classifier_tracker,Dick13nn}, particle filters (\textbf{PF}) \cite{Isard98condensation,Kwon2009_affine_ois,Li2012_pf_affine_self_tuning_journal,Firouzi2014227_online_am,Kwon2014_sl3_aff_pf} and random sample consensus (\textbf{RANSAC}) \cite{Brown2007_ransac_stitching,Zhang2015_rklt}. Though less prone to getting stuck in local maxima than GD, their performance depends largely on the number and quality of random samples used and tends to be rather jittery and unstable due to the limited coverage of the search space. One approach to obtain better precision is to combine them with GD methods \cite{Dick13nn,Zhang2015_rklt} where results from the former are used as starting points for the latter. Three such combinations have been tested here as examples of hybrid or composite SMs - NN+ICLK (\textbf{NNIC}), PF+FCLK (\textbf{PFFC}) and RANSAC+FCLK (\textbf{RKLT}). \section{Conclusions} \label{conclusions} We presented two new similarity measures for registration based tracking and also formulated a novel way to decompose trackers in this domain into three sub modules. We tested many different combinations of methods for each sub module to gain interesting insights into their strengths and weaknesses. Several surprising results were obtained that proved previously published theoretical analysis to be somewhat inaccurate in practice, thus demonstrating the usefulness of this approach. Finally, the open source tracking framework used for generating these results was made publicly available so these can be easily reproduced. \section{Introduction} \label{introduction} Visual tracking is an important field in computer vision with diverse application domains including robotics, surveillance, targeting systems, autonomous navigation and augmented reality. Registration based tracking (\textbf{RBT}), also known in literature as direct visual tracking \cite{Silveira10_esm_ext2, Scandaroli2012_ncc_tracking, Richa12_robust_similarity_measures, Richa14_scv_constraints}, is a sub field thereof where the object is tracked by warping each image in a sequence to align the object patch with the template. Trackers of this type are especially popular in robotics and augmented reality applications both because they estimate the object pose with greater precision and are significantly faster than online learning and detection based trackers (\textbf{OLT}s) \cite{singh16_modular_results}. However, OLTs are better suited to general purpose tracking as RBTs are prone to failure when the object undergoes significant appearance changes due to factors like occlusions and lighting variations or when completely novel views of the object are presented by deformations or large pose changes. As a result, OLTs are more popular in literature and have been the subject of several recent studies \cite{Liu14_olt_survey, Smeulders2014_tracking_survey, Kristan2016_vot16}. The scope of such studies is usually limited to finding the trackers that work best under challenging conditions by testing them on representative sequences with little to no analysis provided regarding \textit{why} specific trackers work better than others for given challenges. This is understandable since such trackers differ widely in design and have little in common that may be used to relate them to each other and perform comparative analysis from a design perspective. As we show in this work, however, RBTs do not have this drawback and can be decomposed into three sub modules - appearance model (\textbf{AM}), state space model (\textbf{SSM}) and search method (\textbf{SM}) (Sec. \ref{decompose_registration_tracking}) - that makes their systematic analysis feasible. Though this decomposition is somewhat obvious and indeed has been observed before \cite{Szeliski2006_fclk_extended, Richa12_robust_similarity_measures}, it has never been explored systematically or used to improve the study of this paradigm of tracking. It is the intent of this work to fill this gap by unifying the myriad of contributions made in this domain since the original Lucas Kanade (LK) tracker was introduced \cite{Lucas81lucasKanade}. Most of these works have presented novel ideas for only one of these submodules while using existing methods, often selected arbitrarily, for the rest. For instance, Hager \& Belheumer \cite{Hager98parametricModels}, Shum \& Szeliski\cite{Shum00_fc}, Baker \& Matthews\cite{Baker01ict} and Benhimane \& Malis\cite{Benhimane04esmTracking} all introduced new variants of the Newton type SM used in \cite{Lucas81lucasKanade} but only tested these with SSD\footnote{refer Sec. \ref{decompose_registration_tracking} for acronyms} AM. Similarly, Dick et. al \cite{Dick13nn} and Zhang et. al \cite{Zhang2015_rklt} only combined their stochastic SMs with RSCV and SSD respectively. Conversely, Richa et. al \cite{Richa11_scv_original}, Scandaroli et. al \cite{Scandaroli2012_ncc_tracking} and Dame et. al \cite{Dame10_mi_ict} introduced SCV, MI and NCC as AMs but combined these only with a single SM - ESM in the former and ICLK in the other two. Even more recent works that use illumination models (\textbf{ILM}) (Sec. \ref{appearanceModel}), including Bartoli \cite{Bartoli2006,Bartoli2008}, Silvera \& Malis \cite{Silveira2007_esm_lighting,Silveira2009_ilm_rgb_vs,Silveira2010_esm_ilm_rgb} and Silvera \cite{Silveira14_esm_ilm_omni}, have combined their respective ILMs with only a single SM in each case. Finally, most SMs and AMs have been tested with only one SSM - either homography \cite{Benhimane04esmTracking,Benhimane07_esm_journal,Dame10_mi_ict} or affine \cite{Baker01ict,Ross08ivt}. In fact, Benhimane \& Malis \cite{Benhimane04esmTracking} mentioned that their SM only works with $\mathbb{SL}(3)$ SSM though experiments (Sec. \ref{results}) showed that it works equally well with others. Such limited testing might not only give false indications about a method's capability but might also prevent it from achieving its full potential. For instance, an AM that outperforms others with a given SM might not do so with other SMs and an SM may perform better with an AM other than the one it is tested with. In such cases, our decomposition can be used to experimentally find the optimal combination of methods for any contribution while also providing novel insights about its workings. We demonstrate its practical applicability by comparing several existing methods for these sub modules not only with each other but also with two new AMs based on structural similarity (\textbf{SSIM}) \cite{Wang04_ssim_original} that we introduce here and fit within this framework. SSIM is a popular measure for evaluating the quality of image compression algorithms by comparing the compressed image with the original one. Since it measures the information loss in the former - essentially a slightly distorted or damaged version of the latter - it makes a suitable metric for comparing candidate warped patches with the template to find the one with the minimum loss and thus most likely to represent the same object. Further, it has been designed to capture the perceptual similarity of images and is known to be robust to illumination and contrast changes \cite{Wang04_ssim_original}. It is reasonable, therefore, to expect it to perform well for tracking under challenging conditions too. As such, it has indeed been used for tracking before with particle filters \cite{Loza2009_ssim_pf,Wang2013_ssim_bc}, gradient ascent \cite{Loza11_ssim_lk_tracking} and hybrid \cite{Loza2009a_ssim_hybrid} SMs. All of these trackers, however, used imprecise SSMs with low degrees of freedom (DOF) - estimating only translation and scaling of the target patch. To the best of our knowledge, no attempt has been made to use SSIM for high DOF RBT within the LK framework \cite{Lucas81lucasKanade}. This work aims to fill this gap too. To summarize, following are the main contributions of this work: \begin{itemize} \item Adapt a popular image quality measure - SSIM - for high precision RBT and introduce a simpler but faster version called SPSS (Sec. \ref{sec_ssim}). \item Evaluate these models comprehensively by comparing against 8 existing AMs using 11 SMs and 7 SSMs. Experiments are done using 4 large datasets with over 100,000 frames in all to ensure their statistical significance. \item Compare low DOF RBTs against state of the art OLTs to validate the suitability of the former for fast and high precision tracking applications. \item Provide an open source tracking framework\footnote{available at \url{http://webdocs.cs.ualberta.ca/~vis/mtf/}} called MTF \cite{singh16_mtf} using which all results can be reproduced and which, owing to its efficient C++ implementation, can also serve as a practical tracking solution. \end{itemize} Rest of this paper is organized as follows - section \ref{background} describes the decomposition, section \ref{sec_ssim} presents details about SSIM and section \ref{experiments} provides results and analysis. \section{Results and Analysis} \label{experiments} \subsection{Datasets} Following four publicly available datasets have been used to analyze the trackers: \begin{enumerate} \item Tracking for Manipulation Tasks (\textbf{TMT}) dataset \cite{Roy2015_tmt} that contains videos of some common tasks performed at several speeds and under varying lighting conditions. It has 109 sequences with 70592 frames. \item Visual Tracking Dataset provided by \textbf{UCSB} \cite{Gauglitz2011_ucsb} that has 96 short sequences with a total of 6889 frames. These are more challenging than TMT but also somewhat artificial as they were created to represent specific challenges rather than realistic tasks. \item \textbf{LinTrack} dataset \cite{Zimmermann2009_lintrack} that has 3 long sequences with a total of 12477 frames. These are more realistic than those in UCSB but also more difficult to track. \item A collection of 28 challenging planar tracking sequences from several significant works in literature \cite{Kwon2014_sl3_aff_pf,Silveira2007_esm_lighting,Silveira2009_ilm_rgb_vs,Silveira2010_esm_ilm_rgb,Silveira14_esm_ilm_omni,Crivellaro2014_dft,Nebehay2015_cmt}. We call this the \textbf{PAMI} dataset after \cite{Kwon2014_sl3_aff_pf} from where several of the sequences originate. There are 16511 frames in all. \end{enumerate} All of these datasets except PAMI have full pose (8 DOF) ground truth data which makes them suitable for evaluating high precision trackers that are the subject of this study. For PAMI, this data was generated using a combination of very high precision tracking and manual refinement \cite{Roy2015_tmt}. \subsection{Evaluation Measures} \textbf{Alignment Error} ($E_{AL}$) \cite{Dick13nn} has been used as the metric to compare tracking result with the ground truth since it accounts for fine misalignments of pose better than other measures like center location error and Jaccard index. A tracker's overall accuracy is measured through its \textbf{success rate} (SR) which is defined as the fraction of total frames where $E_{AL}$ is less than a threshold of $t_p$ pixels. Formally, $ SR = |S|/|F| $ where $ S = \{f^{i} \in F : E_{AL}^{i} < t_p \}$, $F$ is the set of all frames and $E_{AL}^{i}$ is the error in the $i^{th}$ frame $f^{i}$. Since there are far too many sequences to present results for each, an overall summary of performance is reported instead by averaging the SR over all sequences in the four datasets. In addition, to better utilize frames that follow a tracker's first failure in any sequence, we initialize trackers at $ 10 $ different evenly spaced frames in each sequence. Therefore the SR plots represent accumulated tracking performance over a total of $ |F| = 589380 $ frames, out of which $ 106469 $ are unique. Finally, the SR is evaluated for several values of $ t_p $ ranging from 0 to 20 and the resulting SR vs. $ t_p $ plot is studied to get an overall idea of how precise and robust a tracker is. As an alternative measure for robustness, reinitialization tests \cite{Kristan2016_vot16} were also conducted where a tracker is reinitialized after skipping 5 frames every time its $ E_{AL} $ exceeds 20 and the number of such reinitialization is counted. Due to space constraints, these results are presented in the supplementary (available on MTF website). \subsection{Parameters Used} All results were generated using a fixed sampling resolution of $ 50{\times}50 $ irrespective the tracked object's size. Input images were smoothed using a Gaussian filter with a $ 5{\times}5 $ kernel before being fed to the trackers. Iterative SMs were allowed to perform a maximum of $ 30 $ iterations per frame but only as long as the L2 norm of the change in bounding box corners in each iteration exceeded $ 0.0001 $. Implementation details of NN, PF and RANSAC were taken from \cite{Dick13nn}, \cite{Kwon2014_sl3_aff_pf} and \cite{Zhang2015_rklt} respectively. NN was run with 1000 samples and PF with 500 particles. For RANSAC and RKLT, a $ 10{\times} 10 $ grid of sub patches was used and each sub patch was tracked by a 2 DOF FCLK tracker with a sampling resolution of $ 25{\times} 25 $. As in \cite{Wang04_ssim_original}, SSIM parameters are computed as $ C_1=(K_1L)^2 $ and $ C_2=(K_2L)^2 $ with $ K_1 =0.01$, $ K_2 =0.03$ and $ L=255$. Learning based trackers (Sec. \ref{res_ssm}) were run using default settings provided by their respective authors. Speed tests were performed on a 4 GHz Intel Core i7-4790K machine with 16 GB of RAM. \begin{figure*}[!htbp] \begin{subfigure}{\textwidth} \centering \includegraphics[width=\textwidth]{fc_ic_esm.eps} \end{subfigure} \begin{subfigure}{\textwidth} \centering \includegraphics[width=\textwidth]{fa_ia_pf.eps} \end{subfigure} \begin{subfigure}{\textwidth} \centering \includegraphics[width=\textwidth]{pffc_nn_nnic.eps} \end{subfigure} \begin{subfigure}{\textwidth} \centering \includegraphics[width=\textwidth]{ransac_rklt_ssm.eps} \end{subfigure} \caption{Success rates for AMs using different SMs with Homography as well as for different SSMs using SSIM with ESM (bottom right). Plot legends indicate areas under the respective curves. Best viewed on a high resolution screen.} \label{fig_am} \end{figure*} \begin{figure}[t] \includegraphics[width=0.5\textwidth]{speed_esm_pf.eps} \caption{Speeds of ESM and PF with homography. Solid and dotted lines show the means and standard deviations respectively.} \label{fig_speed_esm_pf} \end{figure} \subsection{Results} \label{results} The results presented in this section are organized into three sections corresponding to the three sub modules. In each, we present and analyze results comparing different methods for the respective sub module. \subsubsection{Appearance Models} \label{res_am} Fig. \ref{fig_am} shows the SR curves for all AMs using different SMs and homography SSM with plot legends also indicating the areas under the respective curves which are equivalent \cite{vCehovin2014_eval} to the average SR over this range of $ t_p $. Fig. \ref{fig_speed_esm_pf} shows the speeds of these AMs with ESM and PF as representatives of GD and stochastic SMs respectively. LSCV is excluded to reduce clutter as it was found to perform very similarly to SCV. Its results are in the supplementary instead along with those for the ILMs. Further, RANSAC and RKLT do not include CCRE and MI results since both are far too slow for 100 of them to be run simultaneously in real time. Also, both perform \textit{very} poorly with these SMs, probably because the small sub patches used there \cite{Zhang2015_rklt} do not have sufficient information to be represented well by the joint histograms employed by these AMs. Several observations can be made here. Firstly, NCC is the best performer with all SMs except IALK and NN - IALK performs poorly with all robust AMs (Sec. \ref{res_sm}) while NN performs best with MI. Nevertheless, SSIM is usually equivalent to NCC or a close second showing that the latter is among the best AMs known. Also, as expected, SSIM is much better than SPSS with all SMs, with the latter only managing to match the performance of SSD on average. Further, though ZNCC is claimed to be equivalent to NCC \cite{Ruthotto2010_thes_ncc_equivalence} and also has a wider basin of convergence due to its SSD like formulation, it usually does \textit{not} perform as well as NCC. Secondly, in spite of being the most sophisticated and computationally expensive AM, CCRE is the worst performer with GD SMs and even MI is only slightly better than SSD on average. However, MI and CCRE are actually the best performing AMs with NN and MI is so with NNIC too. This shows that their poor performance with GD SMs is likely to be due to their narrower basin of convergence rather than an inherent weakness in the AMs themselves. This also explains MI's significant lead over CCRE with these SMs though the two differ only in the latter using a cumulative joint histogram. It seems likely that the additional complexity of CCRE along with the resultant invariance to appearance changes further \textit{reduces} its basin of convergence \cite{Dame10_mi_ict}. This discrepancy in performance between GD and stochastic SMs demonstrates the inadequacy of evaluating an AM with only one SM. Thirdly, SCV outperforms RSCV with both inverse GD SMs - ICLK and IALK - though the reverse is true with both the forward ones - FCLK and FALK. This pattern also holds for stochastic and composite SMs - SCV is better with NN/NNIC where samples are generated from $ I_0 $ but worse with PF/PFFC where these come from $ I_t $. Also, their performance is very similar with ESM where information from both $ I_0 $ and $ I_t $ is used. This is probably because SCV performs likelihood substitution with $ \mathbf{I_0} $ \cite{Richa11_scv_original} while RSCV does so with $ \mathbf{I_t} $ \cite{Dick13nn}. Fourthly, the separation between AMs is narrower with RANSAC than other SMs as this SM depends more on the \textit{number} of sub patches used than on the tracker used for each. Conversely, PF shows maximum variation between AMs, thus indicating its strong reliance on $ f $. Finally, SPSS is not much faster than SSIM with either SM though it has lower computational complexity. This is partly due to SSIM finding convergence in fewer iterations with GD SMs and partly due to the way Eigen \cite{eigenweb} optimizes matrix multiplications, many of which are used for computing $ f_{ssim} $ and its derivatives while those of $ f_{spss} $ have to be computed pixel by pixel. The same holds for SSD too. \subsubsection{State Space Models} \label{res_ssm} \begin{figure*}[!htbp] \begin{center} \includegraphics[width=\textwidth]{lt_with_ssim_2r.eps} \caption{Success Rates for SSIM using translation as well as for 8 OLTs. The former are shown with \textbf{solid} lines and the latter in \textbf{dashed} lines. The speed plot on the right has \textbf{logarithmic scaling} on the x axis for clarity though actual figures are also shown.} \label{fig_lt_with_ssim_2r} \end{center} \end{figure*} Results in this section follow a slightly different format from the other two due to the difference in the motivations for using low DOF SSMs - they are more robust due to reduced search space and faster due to the gradients of $ \mathbf{w} $ being less expensive to compute. Limiting the DOF also makes them directly comparable to OLTs which too have low DOF. As a result, 2 DOF RBTs were also tested with 8 state of the art OLTs \cite{Kristan2016_vot16} - DSST \cite{Danelljan2014_dsst}, KCF \cite{henriques2015high_kcf}, CMT \cite{Nebehay2015_cmt}, RCT \cite{Zhang2012_rct}, TLD \cite{Kalal12tld}, Struck \cite{hare2011struck}, FRG \cite{Adam2006_fragtrack} and GOTURN \cite{Held2016_goturn}. Lastly, in order to make the evaluations fair, \textit{lower DOF ground truth} has been used for all accuracy results in this section. This was generated for each SSM using least squares optimization to find the warp parameters that, when applied to the initial bounding box, will produces a warped box whose $E_{AL}$ with respect to the 8 DOF ground truth is as small as it is possible to achieve given the constraints of that SSM. Fig. \ref{fig_lt_with_ssim_2r} shows the results of these tests in terms of both accuracy and speed. As expected, all the OLTs have low SR for smaller $ t_p $ since they are less precise in general \cite{Kristan2016_vot16}. What is more interesting, however, is that none of them, with the exception of DSST and perhaps Struck, managed to surpass the best RBTs even for larger $ t_p $. The superiority of DSST and Struck over other OLTs is consistent with results on VOT dataset \cite{Kristan2016_vot16}. However, the very poor performance of GOTURN \cite{Held2016_goturn}, which is one of the best trackers on that dataset, indicates a fundamental difference in the challenges involved in the two paradigms of tracking. The speed plot shows another reason why OLTs are not suitable for high speed tracking applications - they are $ 10 $ to $ 30 $ times slower than RBTs except PF and RANSAC that are not implemented efficiently yet. It is not surprising that tracking based SLAM systems like SVO \cite{Forster2014_svo} use registration based trackers as they need to track hundreds of patches per frame. To conclude the analysis in this section, we tested the performance of different SSMs against each other and the results are reported in the bottom right subplot of Fig. \ref{fig_am} using ESM with SSIM. Contrary to expectations, lower DOF SSMs are not better except perhaps affine and similitude that have slightly higher SR than homography for larger $ t_p $. In fact, the SR curves of all low DOF SSMs approach those of homography as $ t_p $ increases which does indicate their higher robustness - though not as precise as homography, they tend to be more resistant to complete failure. Also, all three parameterizations of homography have almost identical performance, with their plots showing near perfect overlap. This suggests that the theoretical justification \cite{Benhimane07_esm_journal} for using ESM only with $\mathbb{SL}(3)$ has little practical significance. \subsubsection{Search Methods} \label{res_sm} SR plots comparing different SMs for each AM are presented in the supplementary to save space as they contain the same data as Fig. \ref{fig_am}. First fact to observe is that the four variants of LK do not perform identically. Though FCLK and FALK are indeed evenly matched, both ICLK and IALK are significantly worse, with ICLK being notably better than IALK. This is especially true for CCRE where it outperforms both additive SMs. This contradicts the equivalence between these variants that was reported in \cite{Baker04lucasKanade_paper} and justified there using both theoretical analysis and experimental results. The latter, however, were only performed on synthetic images and even the former used several approximations. Therefore, it is perhaps not surprising that this equivalence does not hold under real world conditions. Secondly, ESM fails to outperform FCLK for any AM except SCV and ZNCC and even there it does not lead by much. This fact too emerges in contradiction to the theoretical analysis in \cite{Benhimane07_esm_journal} where ESM was shown to have second order convergence and so should be better than first order methods like FCLK. Thirdly, both additive LK variants, and especially IALK, fare worse against compositional ones when using robust AMs compared to SSD-like AMs. This is probably because the Hessian after convergence approach used for extending Newton's method to these AMs does not make as much sense for additive formulations \cite{Dame10_mi_thesis}. Lastly, PFFC is the best performing SM followed by NNIC and RKLT which proves the efficacy of composite SMs. \section{Structural Similarity} \parskip 0pt \label{sec_ssim} SSIM was originally introduced \cite{Wang04_ssim_original} to assess the loss in image quality incurred by compression methods like JPEG. It has been very popular in this domain since it closely mirrors the approach adopted by the human visual system to subjectively evaluate the quality of an image. SSIM between $ \mathbf{I_0} $ and $\mathbf{I_t}$ is defined as a product of 3 components: {\footnotesize \begin{align} \label{eq_ssim_complete} f_{ssim} = \left( \dfrac{2\mu_t\mu_0+C_1}{\mu_t ^2+\mu_0^2+C_1}\right)^\alpha \left(\dfrac{2\sigma_{t}\sigma_{0}+C_2}{\sigma_t ^2 + \sigma_0^2 + C_2}\right)^\beta \left(\dfrac{\sigma_{t0}+C_3}{\sigma_{t}\sigma_{0}+C_3}\right)^\gamma \end{align} } where $\mu_t$ is the mean and $ \sigma_{t}$ is the sample standard deviation of $ \mathbf{I_t} $ while $ \sigma_{t0} $ is the sample \textit{covariance} between $ \mathbf{I_t} $ and $ \mathbf{I_0} $. The three components of $ f_{ssim} $ from left to right are respectively used for luminance, contrast and structure comparison between the two patches. The positive constants $ \alpha,\beta,\gamma$ are used to assign relative weights to these components while $ C_1 $, $ C_2 $, $ C_3 $ are added to ensure their numerical stability with small denominators. Here, as in most practical implementations \cite{Wang04_ssim_original,Loza2009_ssim_pf,Loza2009a_ssim_hybrid,Loza11_ssim_lk_tracking,Wang2013_ssim_bc}, it is assumed that $ \alpha = \beta = \gamma = 1 $ and $ C_3 = \dfrac{C_2}{2} $ so that Eq. \ref{eq_ssim_complete} simplifies to: \begin{align} \label{eq_ssim} f_{ssim} = \dfrac{ \left(2\mu_t\mu_0+C_1\right) \left(2\sigma_{t0}+C_2\right) } { \left(\mu_t ^2+\mu_0^2+C_1\right) \left(\sigma_t ^2 + \sigma_0^2 + C_2\right) } \end{align} \subsection{Newton's Method with SSIM} \parskip 0pt \label{newton_ssim} Using SSIM with NN and PF is straightforward since these only need $ f_{ssim} $ to be computed between candidate patches. However, GD SMs also require its derivatives as they solve Eq \ref{reg_tracking} by estimating an incremental update $ \Delta\mathbf{p_t} $ to $ \mathbf{p_{t-1}} $ using some variant of Newton's method as: \begin{align} \label{eq_nwt_method} \Delta\mathbf{p}_t=-\hat{\mathbf{H}}^{-1}\hat{\mathbf{J}}^T \end{align} where $ \hat{\mathbf{J}} $ and $ \hat{\mathbf{H}} $ respectively are estimates for Jacobian $ \mathbf{J} = \partial f/\partial \mathbf{p}$ and Hessian $ \mathbf{H} = \partial^2 f/\partial \mathbf{p}^2$ of $ f $ w.r.t. $ \mathbf{p} $. These can be further decomposed using chain rule as: \begin{gather} \label{eq_jac_basic} \mathbf{J} = \dfrac{\partial f}{\partial \mathbf{I}} \dfrac{\partial I}{\partial \mathbf{p}} = \dfrac{\partial f}{\partial \mathbf{I}} \nabla \mathbf{I} \dfrac{\partial \mathbf{w}}{\partial \mathbf{p}}\\ \label{eq_hess_basic} \mathbf{H} = \dfrac{\partial \mathbf{I}}{\partial \mathbf{p}}^T \dfrac{\partial^2 f}{\partial \mathbf{I}^2} \dfrac{\partial \mathbf{I}}{\partial \mathbf{p}} + \dfrac{\partial f}{\partial \mathbf{I}} \dfrac{\partial^2 \mathbf{I}}{\partial \mathbf{p}^2} \end{gather} Of the right hand side terms in Eqs. \ref{eq_jac_basic} and \ref{eq_hess_basic}, only $\partial f/\partial \mathbf{I} $ and $\partial^2 f/\partial \mathbf{I}^2 $ depend on $ f $ so the relevant expressions for $ f_{ssim} $ are presented below - general formulations corresponding to $ \mathbf{J} $ and $ \mathbf{H} $ in Eqs. \ref{eq_ssim_grad_final} and \ref{eq_ssim_hess_final} respectively, followed by specializations for $ \hat{\mathbf{J}} $ and $ \hat{\mathbf{H}} $ used by specific SMs. Detailed derivations are presented in the supplementary. {\footnotesize \begin{align} \label{eq_ssim_grad_final} \dfrac{\partial f_{ssim}}{\partial \mathbf{I_t}} = \mathbf{f'} = \dfrac{2}{cd} \left[ \left(\dfrac{a\mathbf{\bar{I}_0}-cf\mathbf{\bar{I}_t}}{N-1} + \dfrac{\mu_0b - \mu_tfd}{N} \right) \right] \end{align} \begin{align} \label{eq_ssim_hess_final} \dfrac{\partial^2 f_{ssim}}{\partial \mathbf{I_t}^2} &= \dfrac{2}{cd} \bigg[ \dfrac{1}{N} S_N \left( \dfrac{4}{N-1} \left( \mu_0\mathbf{\bar{I}_0}- \mu_tf\mathbf{\bar{I}_t} \right) - \dfrac{3\mu_td}{2}\mathbf{f'} - \dfrac{fd}{N} \right)\notag\\ &- \dfrac{c}{N-1} \left( \dfrac{3}{2}\mathbf{f'}^T\mathbf{\bar{I}_t} + f\mathbb{I} \right) \bigg] \end{align} } with $ \mathbf{\bar{I}_t} = \mathbf{I_t}-\mu_t, a=2\mu_t\mu_0+C_1 $, $ b=2\sigma_{t0}+C_2 $, $ c=\mu_t ^2+\mu_0^2+C_1, d=\sigma_t ^2 + \sigma_0^2 + C_2, f=f_{ssim} $ and $ S_n\left(\mathbf{K}\right) $ denoting an $ n{\times} k $ matrix formed by stacking the $ 1\times k $ vector $ \mathbf{K} $ into rows. The form of $\partial f/\partial \mathbf{I}$ used by the four variants of LK is identical except that ICLK requires the differentiation to be done w.r.t. $ \mathbf{I_0} $ instead of $ \mathbf{I_t} $ - the expressions for this are trivial to derive since SSIM is symmetrical. ESM was originally \cite{Benhimane07_esm_journal} formulated as using the mean of $\nabla \mathbf{I_0}$ and $\nabla \mathbf{I_t}$ to compute $ \mathbf{J} $ but, as this formulation is only applicable to SSD, a generalized version \cite{Brooks10_esm_ic,Scandaroli2012_ncc_tracking} is considered here that uses the \textit{difference} between FCLK and ICLK Jacobians. It is generally assumed \cite{Baker04lucasKanade_paper,Benhimane07_esm_journal} that the second term of Eq. \ref{eq_hess_basic} is too costly to compute and too small near convergence to matter and so is omitted to give the Gauss Newton Hessian: \begin{align} \label{eq_hess_basic_gn} \mathbf{H}_{gn} = \dfrac{\partial \mathbf{I}}{\partial \mathbf{p}}^T \dfrac{\partial^2 f}{\partial \mathbf{I}^2} \dfrac{\partial \mathbf{I}}{\partial \mathbf{p}} \end{align} Though $ \mathbf{H}_{gn} $ works very well for SSD (and in fact even better than $ \mathbf{H}$ \cite{Baker04lucasKanade_paper,Dame10_mi_thesis}), it is well known \cite{Dame10_mi_thesis,Scandaroli2012_ncc_tracking} to \textit{not} perform well with other AMs like MI, CCRE and NCC and we can confirm that the latter is true for SSIM and SPSS too. For these AMs, an approximation to $ \mathbf{H} $ \textit{after convergence} has to be used instead by assuming perfect alignment between the patches or $\mathbf{I^c}=\mathbf{I^*} $ . This approximation is here referred to as the \textbf{Self Hessian} and, as this substitution can be made by setting either $ \mathbf{I^c} = \mathbf{I_0}$ or $ \mathbf{I^*} = \mathbf{I_t} $, we get two forms which are respectively deemed to be ICLK and FCLK Hessians: {\footnotesize \begin{gather} \label{eq_hess_iclk} \hat{\mathbf{H}}_{ic} = \mathbf{H}_{self}^\mathbf{*} = \dfrac{\partial \mathbf{\mathbf{I_0}}}{\partial \mathbf{p}}^T \dfrac{\partial^2 f(\mathbf{I_0}, \mathbf{I_0})}{\partial \mathbf{I}^2} \dfrac{\partial \mathbf{\mathbf{I_0}}}{\partial \mathbf{p}} + \dfrac{\partial f(\mathbf{I_0}, \mathbf{I_0})}{\partial \mathbf{I}} \dfrac{\partial^2 \mathbf{\mathbf{I_0}}}{\partial \mathbf{p}^2}\\ \label{eq_hess_fclk} \hat{\mathbf{H}}_{fc} = \mathbf{H}_{self}^\mathbf{c} = \dfrac{\partial \mathbf{\mathbf{I_t}}}{\partial \mathbf{p}}^T \dfrac{\partial^2 f(\mathbf{I_t}, \mathbf{I_t})}{\partial \mathbf{I}^2} \dfrac{\partial \mathbf{\mathbf{I_t}}}{\partial \mathbf{p}} + \dfrac{\partial f(\mathbf{I_t}, \mathbf{I_t})}{\partial \mathbf{I}} \dfrac{\partial^2 \mathbf{\mathbf{I_t}}}{\partial \mathbf{p}^2} \end{gather} } It is interesting to note that $ \mathbf{H}_{gn} $ has the exact same form as $ \mathbf{H}_{self} $ for SSD (since $ \partial f_{ssd}(\mathbf{I_0}, \mathbf{I_0})/\partial \mathbf{I} = \partial f_{ssd}(\mathbf{I_t}, \mathbf{I_t})/\partial \mathbf{I} = \mathbf{0}$) so it seems that interpreting Eq. \ref{eq_hess_basic_gn} as the first order approximation of Eq. \ref{eq_hess_basic} for SSD as in \cite{Baker04lucasKanade_paper,Dowson08_mi_ict,Dame10_mi_thesis} is incorrect and it should instead be seen as a special case of $ \mathbf{H}_{self} $. Setting $ \mathbf{I_0} = \mathbf{I_t} $ simplifies Eq. \ref{eq_ssim_hess_final} to: \begin{align} \dfrac{\partial^2 f_{ssim}(\mathbf{I_t}, \mathbf{I_t})}{\partial \mathbf{I_t}^2} = \dfrac{-2}{\bar{c}\bar{d}} \left[ \dfrac{\bar{d}}{N^2} + \dfrac{\bar{c}}{N-1}\mathbb{I} \right] \end{align} with $ \bar{c}=2\mu_t^2 + C_1 $ and $ \bar{d}=2\sigma_t^2 + C_2 $. Finally, FALK and IALK use the same form of $ \partial^2 f/\partial \mathbf{I}^2 $ as FCLK while ESM uses the \textit{sum} of $ \hat{\mathbf{H}}_{fc} $ and $\hat{\mathbf{H}}_{ic}$. \subsection{Simplifying SSIM with pixelwise operations} \parskip 0pt In the formulation described so far, SSIM has been computed over the \textit{entire} patch - i.e. $ \mu_t $, $ \sigma_t $ and $ \sigma_{t0} $ have been computed over all $ N $ pixels in $ \mathbf{I_t} $ and $ \mathbf{I_0} $. In its original form \cite{Wang04_ssim_original}, however, the expression in Eq. \ref{eq_ssim} was applied to several corresponding \textit{sub windows} within the two patches - for instance $ 8\times 8 $ sub windows that are moved pixel-by-pixel over the entire patch - and the \textit{mean} of all resultant scores taken as the overall similarity score. For tracking applications, such an approach is not only impracticable from speed perspective, it presents another issue for GD SMs - presence of insufficient texture in these small sub windows may cause Eq. \ref{eq_nwt_method} to become ill posed if $ \mathbf{J} $ and $ \mathbf{H} $ are computed for each sub window and then averaged. As a result, the formulation used here considers only one end of the spectrum of variation of size and number of sub windows - a single sub window of the same size as the patch. Now, if the \textit{other} end of the spectrum is considered - $ N $ sub windows of size $ 1\times 1 $ each - then a different AM is obtained that may provide some idea about the effect of window wise operations while also being much simpler and faster. The resultant model is termed as \textbf{Sum of Pixelwise Structural Similarity} or \textbf{SPSS}. When considered pixel wise, $ \sigma_t $ and $ \sigma_{t0} $ become null while $ \mu_t$ becomes equal to the pixel value itself so that Eq. \ref{eq_ssim} simplifies to: \begin{align} \label{eq_spss} f_{spss} = \sum\limits_{i=1}^{N} \dfrac{ 2\mathbf{I_t}(\mathbf{x}_\mathbf{it}) \mathbf{I_0}(\mathbf{x}_\mathbf{i0}) + C_1 } { \mathbf{I_t}(\mathbf{x}_\mathbf{it})^2 + \mathbf{I_0}(\mathbf{x}_\mathbf{i0})^2 + C_1 } \end{align} Similar to SSD, contributions from different pixels to $ f_{spss} $ are independent of each other so that each entry of $ \partial f_{spss}/\partial \mathbf{I_t}$ has contribution only from the corresponding pixel. This also holds true for each entry of the principal diagonal of $\partial^2 f_{spss}/\partial \mathbf{I_t}^2 $ (which is a diagonal matrix). Denoting the contributions of the $ i^{th} $ pixel to $ f_{spss} $, $ \partial f_{spss}/\partial \mathbf{I_t}$ and $\partial^2 f_{spss}/\partial \mathbf{I_t}^2 $ respectively as $ f_i $, $ f'_i $ and $ f''_i $, we get: \begin{align} \label{eq_spss_grad} f'_i &= \dfrac{ 2 (\mathbf{I_0}(\mathbf{x}_\mathbf{i0}) - \mathbf{I_t}(\mathbf{x}_\mathbf{it}) f_{i} ) } { \mathbf{I_t}(\mathbf{x}_\mathbf{it})^2 + \mathbf{I_0}(\mathbf{x}_\mathbf{i0})^2 + C_1 }\\ \label{eq_spss_hess} f''_i &= \dfrac{ -2( f_{i} + 3\mathbf{I_t}(\mathbf{x}_\mathbf{it})f'_{i} ) } { \mathbf{I_t}(\mathbf{x}_\mathbf{it})^2 + \mathbf{I_0}(\mathbf{x}_\mathbf{i0})^2 + C_1 }\\ \label{eq_spss_self_hess} f''_i(\mathbf{I_t}, \mathbf{I_t}) &= \dfrac{-2} { 2\mathbf{I_t}(\mathbf{x}_\mathbf{it})^2 + C_1 } \end{align}
{'timestamp': '2017-01-31T02:09:50', 'yymm': '1607', 'arxiv_id': '1607.04673', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04673'}
arxiv
\section{introduction} Communication for omniscience (CO) is a problem proposed in \cite{Csiszar2004}. It is assumed that there is a group of users in the system and each of them observes a component of a discrete memoryless multiple source in private. The users can exchange their information over lossless broadcast channels so as to attain \textit{omniscience}, the state that each user obtains the total information in the entire multiple source in the system. The CO problem in \cite{Csiszar2004} is based on an asymptotic source model, where the communication rates could be real or fractional. Meanwhile, coded cooperative data exchange (CCDE) problem proposed in \cite{Roua2010} can be considered a non-asymptotic CO problem where the communication rates are required to be integral. By incorporating the idea of packet-splitting, the CCDE problem can be easily extended to an asymptotic setting. Determining a rate vector that achieves omniscience with the minimum sum-rate is a fundamental problem in CO. Although the non-asymptotic CO problem has been frequently studied in the literature, there still does not exist an efficient algorithm for the asymptotic setting. The reasons are explained as follows. The submodularity of the CO problem has been shown in \cite{ChanMMI,ChanSuccessive,ChanSuccessiveIT,MiloIT2015,CourtIT2014,Ding2015ICT,Ding2015ISIT}. By designating a sum-rate, a submodular function minimization (SFM) algorithm can check whether the sum-rate is achievable for CO and/or return an achievable rate vector with the given sum-rate. Since the SFM algorithm completes in strongly polynomial time, the remaining problem is how to adapt the sum-rate to the minimum. This problem is not difficult for non-asymptotic setting since every adaptation should be integral. For example, the authors in \cite{MiloIT2015,CourtIT2014} proposed efficient adaptation algorithms for non-asymptotic CO problem, the complexity of which only grows logarithmically in the total amount of information in the system. However, when considering the asymptotic setting, it is not clear how to choose the step size in each adaptation (Improper step sizes may result in an infinite loop). More specifically, even if we know that a sum-rate is over/below the optimum, it is not sure how much we should decrease/increase from the current estimation. On the other hand, the authors in \cite{MiloDivConq2011} proposed a divide-and-conquer (DV) algorithm for the asymptotic setting by repetitively running a decomposition algorithm (DA) in \cite{MinAveCost}. The idea is to first find the fundamental partition \cite{ChanMMI}, the one corresponds to the minimum sum-rate, and then iteratively break each non-singleton element into singletons so that each tuple in the optimal rate vector is determined. However, the DA algorithm is able to not only determine the fundamental partition but also return an optimal rate vector, which we will explain in this paper. Therefore, those further divisions of the fundamental partition in the DV algorithm are not necessary. In this paper, we propose a modified decomposition algorithm (MDA) for solving the asymptotic CO problem based on the DA algorithm in \cite{MinAveCost}. The MDA algorithm starts with a lower estimation of the minimum sum-rate. In each iteration, the step size is determined based on the finest/minimum partition of a Dilworth truncation problem. We prove the optimality of the output rate vector and show that the estimation sequence converges monotonically upward to the minimum sum-rate. In addition, we propose a fusion method implementation of the coordinate-wise saturation capacity algorithm (CoordSatCapFus) for solving the Dilworth truncation problem. In the CoordSatCapFus algorithm, the SFM in each iteration is done over a fused user set with a cardinality smaller than the original one. We show that the MDA algorithm can reduce the cubic calls of SFM (in the DV algorithm) to quadratic calls of SFM. We do an experiment to show that the fusion method in the CoordSatCapFus algorithm contributes to a considerable reduction in computation complexity when the number of users grows. We also discuss how to solve the non-asymptotic CO problem by one more run of the CoordSatCapFus algorithm. Finally, we show how to choose a proper linear ordering to solve the minimum weighted sum-rate problem. \section{System Model} \label{sec:system} Let $V$ with $\Card{V}>1$ be the finite set that contains the indices of all users in the system. We call $V$ the \textit{ground set}. Let $\RZ{V}=(\RZ{i}:i\in V)$ be a vector of discrete random variables indexed by $V$. For each $i\in V$, user $i$ can privately observe an $n$-sequence $\RZ{i}^n$ of the random source $\RZ{i}$ that is i.i.d.\ generated according to the joint distribution $P_{\RZ{V}}$. We allow users exchange their sources directly so as to let all users $i\in V$ recover the source sequence $\RZ{V}^n$. We consider both asymptotic and non-asymptotic models. In the asymptotic model, we will characterize the asymptotic behavior as the \emph{block length} $n$ goes to infinity. In non-asymptotic model, the communication rates are required to be integer-valued. Let $\rv_V=(r_i:i\in V)$ be a rate (vector). We call $\rv_V$ an achievable rate if omniscience is possible by letting users communicate with the rates designated by $\rv_V$. Let $r$ be the function associated with $\rv_V$ such that $r(X)=\sum_{i\in X} r_i,\forall X \subseteq V$ with the convention $r(\emptyset)=0$. For $X,Y \subseteq V$, let $H(\RZ{X})$ be the amount of randomness in $\RZ{X}$ measured by Shannon entropy \cite{YeungITBook} and $H(\RZ{X}|\RZ{Y})=H(\RZ{X \cup Y})-H(\RZ{Y})$ be the conditional entropy of $\RZ{X}$ given $\RZ{Y}$. In the rest of this paper, we simplify the notation $\RZ{X}$ to $X$. It is shown in \cite{Csiszar2004} that an achievable rate must satisfy the Slepian-Wolf constraints: \begin{equation} \label{eq:SWConstrs} r(X) \geq H(X|V\setminus X), \quad \forall X \subset V. \end{equation} The interpretation of the Slepian-Wolf constraint on $X$ is: To achieve CO, the total amount of information sent from user set $X$ should be at least complementary to total amount of information that is missing in user set $V \setminus X$. The set of all achievable rate vectors is $$ \RRCO(V)=\Set{ \rv_V\in\Real^{|V|} \colon r(X) \geq H(X|V\setminus X),\forall X \subset V }. $$ \subsection{Asymptotic and No-asymptotic Models} In an asymptotic CO model, the minimum sum-rate can be determined by the following linear programming (LP) \begin{equation} \label{eq:MinSumRate} \RACO(V)=\min\Set{r(V) \colon \rv_V\in \RRCO(V)} \end{equation} and the set of all optimal rates is $$ \RRACO^*(V)=\Set{\rv_V\in \RRACO(V) \colon r(V)=\RACO(V)}. $$ In a non-asymptotic CO model, $H(X) \in \Z_+$ for all $X \subseteq V$ and the minimum sum-rate can be determined by the integer linear programming (ILP) $\RNCO(V)=\min\Set{r(V) \colon \rv_V\in \RRCO(V) \cap \Z^{|V|} }$. The optimal rate set is $ \RRNCO^*(V)=\Set{\rv_V \in \RRCO(V) \cap \Z^{|V|} \colon r(V)=\RNCO(V)}$. \subsection{Corresponding CCDE Systems} CCDE is an example of CO, where the asymptotic model corresponds to the CCDE system that allows packet-splitting, while the non-asymptotic model corresponds to the CCDE system that does not allow packet-splitting. In CCDE, $\RZ{i}$ is the packet set that is obtained by user $i$, where each packet $\Has{j}$ belongs to a field $\F_q$. The users are geographically close to each other so that they can transmit linear combinations of their packet set via lossless wireless channels to help the others recover all packets in $\RZ{V}=\cup_{i\in V} \RZ{i}$. In this problem, the value of $H(X)$ can be obtained by counting the number of packets in $\RZ{X}$, i.e., $H(X)=|\RZ{X}|$ and $H(X|Y)=|\RZ{X \cup Y}|-|\RZ{Y}|$. \begin{example} \label{ex:main} Let $V=\{1,\dotsc,5\}$. Each user observes respectively \begin{equation} \begin{aligned} \RZ{1} & = (\RW{a},\RW{c},\RW{e},\RW{f}), \\ \RZ{2} & = (\RW{a},\RW{d},\RW{h}), \\ \RZ{3} & = (\RW{b},\RW{c},\RW{e},\RW{f},\RW{g},\RW{h}), \\ \RZ{4} & = (\RW{a},\RW{c},\RW{f},\RW{g},\RW{h}), \\ \RZ{5} & = (\RW{b},\RW{d},\RW{f}), \end{aligned} \nonumber \end{equation} where $\RW{j}$ is an independent uniformly distributed random bit. The users exchange their private observations to achieve the omniscience of $\RZ{V}=(\RW{a},\dotsc,\RW{h})$. In this system, $\RACO(V)= \frac{11}{2}$ and $\RNCO(V) = 6$. $\rv_V = (0,\frac{1}{2},2,\frac{5}{2},\frac{1}{2})$ is an optimal rate in $\RRACO^*(V)$ for asymptotic model, while $\rv_V=(0,1,2,3,0)$ is the optimal rate in $\RRNCO^*(V)$ for non-asymptotic model. The method to implement rate $\rv_V = (0,\frac{1}{2},2,\frac{5}{2},\frac{1}{2})$ is to let users divide each packets into two chunks of equal length and transmit according to rate $(0,1,4,5,1)$ with each tuple denotes the number of packet chunks. $(0,\frac{1}{2},2,\frac{5}{2},\frac{1}{2})$ and $\frac{11}{2}$ are the normalized rate and sum-rate, respectively. \end{example} \section{Preliminaries} In this section, we list some existing results derived previously in \cite{ChanMMI,ChanSuccessive,ChanSuccessiveIT,CourtIT2014,MiloIT2015,Ding2015ICT,Ding2015Game,Ding2015ISIT,Ding2015NetCod,FujishigePolyEntropy,Fujishige2005} for CO. \subsection{Submodularity and Nonemptiness of Base Polyhedron} It is shown in \cite{FujishigePolyEntropy,Fujishige2005} that the entropy function $H$ is the rank function of a polymatroid, i.e., it is (a) normalized: $H(\emptyset) = 0 $; (b) monotonic: $H(X) \geq H(Y)$ for all $X,Y \subseteq V$ such that $Y \subseteq X$; (c) submodular: \begin{equation} \label{eq:SubMIneq} H(X) + H(Y) \geq H(X \cap Y) + H(X \cup Y) \end{equation} for all $X,Y \subseteq V$. For $\alpha\in\RealP$, define the set function $\Fu{\alpha}$ as $$ \Fu{\alpha}(X)=\begin{cases} H(X|V\setminus X) & X \subset V \\ \alpha & X=V \end{cases}. $$ Let $ \FuHash{\alpha}(X)=\Fu{\alpha}(V)-\Fu{\alpha}(V \setminus X)=\alpha-\Fu{\alpha}(V \setminus X), \forall X \subseteq V$ be the \textit{dual set function} of $\Fu{\alpha}$. It is shown in \cite{ChanMMI,Ding2015ISIT,Ding2015NetCod} that $\FuHash{\alpha}$ is intersecting submodular, i.e., $\FuHash{\alpha}(X) + \FuHash{\alpha}(Y) \geq \FuHash{\alpha}(X \cap Y) + \FuHash{\alpha}(X \cup Y)$ for all $X,Y \subseteq V$ such that $X \cap Y \neq \emptyset$. The polyhedron and base polyhedron of $\FuHash{\alpha}$ are respectively \begin{equation} \begin{aligned} & P(\FuHash{\alpha},\leq) = \Set{\rv_V\in\Real^{|V|} \colon r(X) \leq \FuHash{\alpha}(X),\forall X \subseteq V}, \\ & B(\FuHash{\alpha},\leq) = \Set{\rv_V \in P(\FuHash{\alpha},\leq) \colon r(V) = \FuHash{\alpha}(V)}. \\ \end{aligned} \nonumber \end{equation} It is shown in \cite{Ding2015ICT,Ding2015ISIT,Ding2015Game} that $B(\FuHash{\alpha},\leq) = \Set{ \rv_V \in \RRCO(V) \colon r(V) = \alpha}$, i.e., $B(\FuHash{\alpha},\leq)$ denotes the set of all achievable rates with sum-rate equal to $\alpha$, and $B(\FuHash{\alpha},\leq) \neq \emptyset$ if and only if $\alpha \geq \RACO(V)$. In addition, $B(\FuHash{\RACO(V)},\leq) = \RRACO^*(V)$ and $B(\FuHash{\RNCO(V)},\leq) \cap \Z^{|V|} = \RRNCO^*(V)$. Denote $\Pi(V)$ the set that contains all possible partitions of $V$ and $\Pi'(V)=\Pi(V)\setminus\{V\}$. For $\Pat \in \Pi(V)$, let $\FuHash{\alpha}[\Pat] = \sum_{X \in \Pat} \FuHash{\alpha}(X)$. The Dilworth truncation of $\FuHash{\alpha}$ is \cite{Dilworth1944} \begin{equation} \label{eq:Dilworth} \FuHashHat{\alpha}(X) = \min_{\Pat\in \Pi(X)} \FuHash{\alpha}[\Pat] , \quad \forall X \subseteq V. \end{equation} If $\alpha \geq \RACO(V)$, $\FuHashHat{\alpha}$ is submodular with $\FuHashHat{\alpha}(V)=\alpha$ and $B(\FuHashHat{\alpha},\leq)=B(\FuHash{\alpha},\leq)$ \cite[Lemma IV.7]{Ding2015Game}. \subsection{Minimum Sum-rate and Fundamental Partition} The authors in \cite{Ding2015ISIT,Ding2015Game} show that \begin{equation} \label{eq:RACO} \RACO(V) = \max_{\Pat \in \Pi'(V)} \sum_{X \in \Pat} \frac{ H(V) - H(X) }{|\Pat|-1} \end{equation} and $\RNCO(V) = \lceil \RACO(V) \rceil$. Meanwhile, in the studies on secrecy capacity in \cite{ChanMMI,ChanSuccessive,ChanSuccessiveIT}, it is shown that maximum secrecy capacity in $V$ equals to the multivariate mutual information (MMI) $I(V)$, which has a dual relationship with $\RACO(V)$: $\RACO(V)=H(V)-I(V)$, and the finest/minimal maximizer of \eqref{eq:RACO} is called the \textit{fundamental partition} and denoted by $\Pat^*$. \begin{algorithm} [t] \label{algo:MDA} \small \SetAlgoLined \SetKwInOut{Input}{input}\SetKwInOut{Output}{output} \SetKwFor{For}{for}{do}{endfor} \SetKwRepeat{Repeat}{repeat}{until} \SetKwIF{If}{ElseIf}{Else}{if}{then}{else if}{else}{endif} \BlankLine \Input{the ground set $V$, an oracle that returns the value of $H(X)$ for a given $X \subseteq V$ and a linear ordering $\Phi = (\phi_1,\dotsc,\phi_{|V|})$} \Output{$\rv_V$ which is a rate vector in the base polyhedron $B(\FuHashHat{\RACO(V)},\leq)$, $\Pat^*$ which is the fundamental partition and $\alpha$ which equals to $\RACO(V)$ } \BlankLine initiate $\Pat \leftarrow \{\Set{i} \colon i\in V\}$ and $\alpha \leftarrow \sum_{X \in \Pat}\frac{ H(V) - H(X) }{ |\Pat| - 1 } $ \; $(\rv_V,\Pat^*) \leftarrow \text{CoordSatCapFus}(V,H,\alpha,\Phi)$ \; \While{$\Pat^* \neq \Pat$}{ update $\Pat \leftarrow \Pat^*$ and $\alpha \leftarrow \sum_{X \in \Pat^*}\frac{ H(V) - H(X) }{ |\Pat^*| - 1 } $\; $(\rv_V,\Pat^*) \leftarrow \text{CoordSatCapFus}(V,H,\alpha,\Phi)$ \; } return $\rv_V$, $\Pat^*$ and $\alpha$\; \caption{Modified Decomposition Algorithm (MDA) } \end{algorithm} \section{Algorithm} \label{sec:algo} In this section, we propose a MDA algorithm, the modified version of the DA algorithm in \cite{MinAveCost}, in Algorithm 1 for solving the asymptotic CO problem and show how to extend it to solve the non-asymptotic one. The MDA algorithm starts with $\alpha$, a lower estimation of $\RACO(V)$, and iteratively updates it by the minimal/finest minimizer of the Dilworth truncation problem $\FuHashHat{\alpha} = \min_{\Pat\in \Pi(V)} \FuHash{\alpha}[\Pat]$ until it reaches the optimal one. The finest minimizer of the Dilworth truncation problem and a rate vector in the base polyhedron $B(\FuHashHat{\alpha},\leq)$ are determined by the CoordSatCapFus algorithm in Algorithm 2. The CoordSatCapFus algorithm is a fusion method to implement the coordinate-wise saturation capacity (CoordSatCap) algorithm that is proposed in \cite{Fujishige2005} and adopted in \cite{MinAveCost} for the Dilworth truncation problem. We list the notations in Algorithms 1 and 2 below. Let $\chi_X$ be the characteristic vector of the subset $X \subseteq V$. We shorten the notation $\chi_{\Set{i}}$ to $\chi_i$ for a singleton subset of $V$. Let $ \Phi = (\phi_1,\dotsc,\phi_{|V|})$ be a linear ordering of $V$. For example, $\Phi = (2,3,1,4)$ is a linear ordering of $V = \Set{1,\dotsc,4}$. In Section~\ref{sec:MinWeightSumRate}, we will show that by choosing a proper linear ordering of $V$ the output rate $\rv_V$ of Algorithm 1 also minimizes a weighted sum-rate objective function. For $U \subseteq \Pat$ where $\Pat$ is some partition in $\Pi(V)$, denote $\tilde{U}=\cup_{X \in U} X$, i.e., $U$ is a fusion of all the subsets in $U$ into one subset of $V$. For example, for $U = \Set{\Set{1,3},\Set{2,4},\Set{5},\Set{6}} \subset \Set{\Set{1,3},\Set{2,4},\Set{5},\Set{6},\Set{7}} \in \Pi({\Set{1,\dotsc,7}})$, we have $\tilde{U} = \Set{1,\dotsc,6}$. By using these notations, we propose the MDA algorithm for the asymptotic CO problem and show that they can be easily extended to solve the non-asymptotic CO problem as follows. \begin{algorithm} [t] \label{algo:PolyRank} \small \SetAlgoLined \SetKwInOut{Input}{input}\SetKwInOut{Output}{output} \SetKwFor{For}{for}{do}{endfor} \SetKwRepeat{Repeat}{repeat}{until} \SetKwIF{If}{ElseIf}{Else}{if}{then}{else if}{else}{endif} \BlankLine \Input{the ground set $V$, an oracle that returns the value of $H(X)$ for a given $X \subseteq V$, $\alpha$ which is an estimation of $\RACO(V)$ and a linear ordering $\Phi = ( \phi_1,\dotsc,\phi_{|V|})$} \Output{$\rv_V$ which is a rate vector in $B(\FuHashHat{\alpha},\leq)$ and $\Pat^*$ which is the minimal/finest minimizer of $\min_{\Pat\in \Pi(V)} \FuHash{\alpha}[\Pat]$ } \BlankLine $\rv_V \leftarrow (\alpha - H(V)) \chi_V$ \tcp*{$\rv \in P(\FuHash{\alpha},\leq)$ by doing so.} initiate $ r_{\phi_1} \leftarrow \FuHash{\alpha}(\Set{\phi_1})$ and $\Pat^* \leftarrow \Set{\Set{\phi_1}}$\; \For{$i=2$ \emph{\KwTo} $|V|$}{ determine the saturation capacity $$ \hat{\xi} \leftarrow \min\Set{ \FuHash{\alpha}(\Set{\phi_i} \cup \tilde{U}) - r(\Set{\phi_i} \cup \tilde{U}) \colon U \subseteq \Pat^*} $$ and the minimal/smallest minimizer $U^*$\; $U_{\phi_i}^* \leftarrow U^* \cup \Set{\phi_i}$\; $ \rv_V \leftarrow \rv_V + \hat{\xi} \chi_{\phi_i}$\; \tcc{ merge/fuse all subsets in $\Pat^*$ that intersect with $\tilde{U}_{\phi_i}^*$ into one subset $\tilde{U}_{\phi_i}^* \cup \tilde{\X}$} $\X \leftarrow \Set{X \in \Pat^* \colon X \cap \tilde{U}_{\phi_i}^* \neq \emptyset}$\; $\Pat^* \leftarrow (\Pat^* \setminus \X) \cup \Set{ \tilde{U}_{\phi_i}^* \cup \tilde{\X} }$\; } return $\rv_V$ and $\Pat^*$\; \caption{Coordinate-wise Saturation Capacity Algorithm by Fusion Method (CoordSatCapFus)} \end{algorithm} \subsection{Asymptotic Model} The optimality of the MDA algorithm for the asymptotic setting is summarized in the following theorem with the proof in Appendix~\ref{app:theo:main}, where every step in the CoordSatCapFus algorithm is explained. \begin{theorem} \label{theo:main} The MDA algorithm outputs the minimum sum-rate $\RACO(V)$, the fundamental partition $\Pat^*$ and an optimal rate $\rv_V \in \RRACO(V)$. The estimation of $\RACO(V)$, $\alpha$, converges monotonically upward to $\RACO(V)$. \end{theorem} \begin{example} \label{ex:AlgorithmACO} For the system in Example~\ref{ex:main}, we start the MDA algorithm with singleton partition $\Pat=\Set{\Set{1},\dotsc,\Set{5}}$ and $\alpha = \sum_{i \in V}\frac{ H(V) - H(\Set{i}) }{ |V| - 1 } = \frac{19}{4}$. Let the linear ordering be $\Phi = (4,3,2,5,1)$. By calling the CoordSatCapFus algorithm, we have the following results. We initiate $\rv_V = (\alpha - H(V)) \chi_V = (-\frac{13}{4},\dotsc,-\frac{13}{4})$ and set $\Pat^*=\Set{\Set{4}}$ and $r_4 = \FuHash{19/4}(\Set{4}) = \frac{7}{4}$ so that $\rv_V = (-\frac{13}{4},-\frac{13}{4},-\frac{13}{4},\frac{7}{4},-\frac{13}{4})$. \begin{itemize} \item For $\phi_2=3$, the values of $\FuHash{\alpha}(\Set{\phi_2} \cup \tilde{U}) - r(\Set{\phi_2} \cup \tilde{U})$ for all $U \subseteq \Pat^* = \Set{\Set{4}}$ are $$ \FuHash{19/4}(\Set{3}) - r(\Set{3}) = 6 , \FuHash{19/4}(\Set{3,4}) - r(\Set{3,4}) = 21/4.$$ So, the saturation capacity $\hat{\xi} = 21/4$, the minimal minimizer $U^* = \Set{\Set{4}}$ and $U_4^* = \Set{\Set{3},\Set{4}}$. We update to $r_3 = -\frac{13}{4} + \frac{21}{4} = 2$ so that $\rv_V = (-\frac{13}{4},-\frac{13}{4},2,\frac{7}{4},-\frac{13}{4})$. We have only one element $\Set{4} \in \Pat^*$ such that $\tilde{U}_{4}^* \cap \Set{4} \neq \emptyset$. So, $\X = \Set{\Set{4}}$ and $\tilde{U}_{\phi_i}^* \cup \tilde{\X} = \Set{3,4}$. We update to $\Pat^* = \Set{\Set{3,4}}$. \item For $\phi_3=2$, the values of $\FuHash{\alpha}(\Set{\phi_3} \cup \tilde{U}) - r(\Set{\phi_3} \cup \tilde{U})$ for all $U \subseteq \Pat^* = \Set{\Set{3,4}}$ are \begin{equation} \begin{aligned} &\FuHash{19/4}(\Set{2}) - r(\Set{2}) = 3 , \\ &\FuHash{19/4}(\Set{2,3,4}) - r(\Set{2,3,4}) = 17/4. \end{aligned} \nonumber \end{equation} We have $\hat{\xi} = 3$ and $U_{2}^* = \Set{\Set{2}}$. We update to $\rv_V = (-\frac{13}{4},-\frac{1}{4},2,\frac{7}{4},-\frac{13}{4})$. Since $\tilde{U}_{2}^* \cap X = \emptyset, \forall X \in \Pat$, we have $\X = \emptyset$ and $\Pat^* = \Set{\Set{3,4},\Set{2}}$. \item For $\phi_4 = 5$, we have $\hat{\xi}=3$, $U_{5}^*=\Set{\Set{5}}$ and $\X=\emptyset$. We update to $\rv_V = (-\frac{13}{4},-\frac{1}{4},2,\frac{7}{4},-\frac{1}{4})$ and $\Pat^* = \Set{\Set{3,4},\Set{2},\Set{5}}$. \item For $\phi_5=1$, we have $\hat{\xi} = \frac{13}{4}$, $U_1^* = \Set{\Set{3,4},\Set{1}}$ and $\X = \Set{\Set{3,4}}$. Therefore, the CoordSatCapFus algorithm terminates with $\rv_V = (0,-\frac{1}{4},2,\frac{7}{4},-\frac{1}{4})$ and $\Pat^*=\Set{\Set{1,3,4},\Set{2},\Set{5}}$. \end{itemize} Since $\Pat \neq \Pat^*$, we continue the iteration in the MDA algorithm. In the second iteration, we have $\Pat=\Set{\Set{1,3,4},\Set{2},\Set{5}}$ and $\alpha = \frac{11}{2}$. The CoordSatCapFus algorithm returns $\rv_V = (0,\frac{1}{2},2,\frac{5}{2},\frac{1}{2})$ and $\Pat^* = \Set{\Set{1,3,4},\Set{5},\Set{2}}$. The MDA algorithm terminates since $\Pat = \Pat^*$. One can show that the outputs $\rv_V$, $\Pat^*$ and $\alpha$ are respectively an optimal rate in $\RRACO^*(V)$, the fundamental partition and the minimum sum-rate $\RACO(V)$ for asymptotic model. We plot the value of $\alpha$ in each iteration, or the estimation sequence of $\RACO(V)$, in Fig.~\ref{fig:Converge}. It can be shown that $\alpha$ converges monotonically upward to $\RACO(V)$. \end{example} \begin{figure}[tbp] \centering \scalebox{0.7}{\input{figures/Converge.tex}} \caption{The estimation sequence of $\RACO(V)$, i.e., the value of $\alpha$ in each iteration, when the MDA algorithm is applied to the system in Example~\ref{ex:AlgorithmACO}.} \label{fig:Converge} \end{figure} The CoordSatCap algorithm is one of the standard tools for solving the Dilworth truncation problem in the literature, e.g., \cite{MinAveCost}. It is also used in \cite{MiloIT2015,CourtIT2014} to determine an optimal rate vector in $\RRNCO^*(V)$ and/or checking whether a sum-rate $\alpha$ is achievable for non-asymptotic setting.\footnote{If the sum-rate $\alpha$ is not achievable, the rate $\rv_V \in B(\FuHashHat{\alpha},\leq)$ returned by the CoordSatCap algorithm has $r(V)$ strictly less than $\alpha$.} But, in these works, the CoordSatCap algorithm is implemented on the original user set instead of a fused one. For example, in \cite{MiloIT2015,CourtIT2014}, the the saturation capacity $\hat{\xi}$ is determined by the SFM problem \begin{equation} \label{eq:SatCapOld} \min\Set{ \FuHash{\alpha}(X) - r(X) \mid \phi_i \in X \subseteq V_i}, \end{equation} where $V_{i} = \Set{\phi_1,\dotsc,\phi_i}$. Problem \eqref{eq:SatCapOld} can be solved in $O(\SFM(|V_{i-1}|))$ time, where $\SFM(|V|)$ denotes the complexity of an SFM algorithm for a set function defined on $2^{V}$. On the contrary, the corresponding SFM problem \begin{equation} \label{eq:SatCapFus} \min\Set{ \FuHash{\alpha}(\Set{\phi_i} \cup \tilde{U}) - r(\Set{\phi_i} \cup \tilde{U}) \colon U \subseteq \Pat^*} \end{equation} in step 4 in the CoordSatCapFus algorithm is done over $\Pat^*$, a fused/merged user sets of $V_{i-1}$ that is obtained by steps 8 and 9 in the previous iterations. Here, the objective function in \eqref{eq:SatCapFus} is submodular on $2^{\Pat^*}$. Problem \eqref{eq:SatCapFus} can be solved in $\SFM(|\Pat^*|)$ time. Since $|\Pat^*| \leq |V_2|$, \eqref{eq:SatCapFus} is less complex than \eqref{eq:SatCapOld}. For example, in the first iteration of the MDA algorithm when $\phi_3 = 2$ in Example~\ref{ex:AlgorithmACO}, We have $\Pat^*=\Set{\Set{3,4}}$ and $V_2 = \Set{3,4}$ such that $|\Pat^*|<|V_2|$. Problem~\eqref{eq:SatCapFus} completes in $O(\SFM(1))$ time, while problem \eqref{eq:SatCapOld} completes in $O(\SFM(2))$ time.\footnote{In the case when $|V|=1$, SFM reduces to comparison between two possible sets, empty and ground sets, i.e., it is not necessary to call the SFM algorithm. This example just shows the difference in complexity. } See the experimental results in Section~\ref{sec:Complexity}. \subsection{Non-asymptotic Model} \label{sec:NCO} The algorithms in \cite{MiloIT2015,CourtIT2014} for non-asymptotic CO model can adjust $\alpha$ on the nonnegative integer grid until it finally reaches $\RNCO(V)$, where the CoordSatCap can be replaced by the CoordSatCapFus algorithm which is less complex. See experimental results in Section~\ref{sec:Complexity}. In fact, the value of $\RNCO(V)$ and an optimal rate in $\RRNCO^*(V)$ can be determined by one more call of the CoordSatCapFus algorithm after solving the asymptotic CO problem. Let $\RACO(V)$ be the asymptotic minimum sum-rate determined by the MDA algorithm. We know automatically $\RNCO(V) = \lceil \RACO(V) \rceil$. By calling the CoordSatCapFus algorithm with input $\alpha = \RNCO(V)$, we can determine the value of an optimal rate in $B(\FuHashHat{\RNCO(V)},\leq) \cap \Z^{|V|} = \RRNCO^*(V)$. The integrality of this optimal vector is shown in Section~\ref{sec:MinWeightSumRate}. \begin{example} \label{ex:AlgorithmNCO} Assume that we get $\RACO(V) = \frac{11}{2}$ in Example~\ref{ex:AlgorithmACO}. Then, $\RNCO(V) = \lceil \RACO(V) \rceil = 6$. By calling $$ (\rv_V,\Pat^*) \leftarrow \text{CoordSatCapFus}(V,H,\RNCO(V),\Phi),$$ we have $\rv_V=(0,1,2,3,0)$ for linear ordering $\Phi = (4,3,2,5,1)$ and $\Pat^* = \Set{\Set{1,2,3,4,5}}$,\footnote{For $\RNCO(V) > \RACO(V) $, the minimizer of $\min_{\Pat\in \Pi(V)} \FuHash{\RNCO(V)}[\Pat]$ is uniquely $\Set{V}$ \cite{Narayanan1991PLP}.} where $\rv_V$ is an optimal rate in $\RRNCO^*(V)$ for non-asymptotic model. \end{example} \section{Minimum Weighted Sum-rate Problem} \label{sec:MinWeightSumRate} Let $\wv_V = (w_i \colon i \in V) \in \RealP^{|V|}$ and $\wv_V^{\intercal} \rv_V = \sum_{i \in V} w_i r_i$. We say that $\Phi = (\phi_1,\dotsc,\phi_{|V|})$ is a linear ordering that is consistent with $\wv_V$ if $w_{\phi_1} \leq w_{\phi_2} \leq \dotsc \leq w_{\phi_{|V|}}$. \begin{theorem} Let $\Phi$ be the linear ordering consistent with $\wv_V$. The optimal rate $\rv_V$ returned by the MDA algorithm for asymptotic model is the minimizer of $\min \Set{ \wv_V^{\intercal} \rv_V \colon \rv_V \in \RRACO^*(V) }$; The optimal rate $\rv_V$ returned by $\text{CoordSatCapFus}(V,H,\lceil \RACO(V) \rceil,\Phi)$ for asymptotic model is the minimizer of $ \min \Set{ \wv_V^{\intercal} \rv_V \colon \rv_V \in \RRNCO^*(V) } $. \end{theorem} \begin{IEEEproof} In the last iteration of the MDA algorithm, we call the CoordSatCapFus algorithm by inputting $\alpha=\RACO(V)$. The Dilworth truncation $\FuHashHat{\RACO(V)}$ is a polymatroid rank function \cite{ChanMMI}. Let $\text{EX}(\FuHashHat{\RACO(V)})$ be the set that contains all extreme points, or vertices, of the base polyhedron $B(\FuHashHat{\RACO(V)},\leq)$. We have the initial point $\rv_V = (\alpha - H(V)) \chi_V \leq \rv_V^\prime, \forall \rv_V^\prime \in \text{EX}(\FuHashHat{\RACO(V)})$.\footnote{$\rv_V \leq \rv_V^\prime, \forall \rv_V^\prime \in \text{EX}(f)$ is a tighter condition than $\rv_V \in P(f,\leq)$.} So, the CoordSatCapFus algorithm necessarily returns an extreme point in $B(\FuHashHat{\RACO(V)},\leq)$ which minimizes $\min \Set{ \wv_V^{\intercal} \rv_V \colon \rv_V \in \RRACO^*(V) }$\cite{Fujishige2005}. In the same way, we can prove the claim for the non-asymptotic model. In addition, $\FuHash{\RNCO(V)}$ is integer-valued. So is $\FuHashHat{\RNCO(V)}$. Therefore, all extreme points in $B(\FuHashHat{\RNCO(V)},\leq)$ are integral. \end{IEEEproof} For example, one can show that $\rv_V = (0,\frac{1}{2},2,\frac{5}{2},\frac{1}{2})$ in Example~\ref{ex:AlgorithmACO} and $\rv_V=(0,1,2,3,0)$ in Example~\ref{ex:AlgorithmNCO} are the minimum weighted sum-rate vector in $\RRACO^*(V)$ and $\RRNCO^*(V)$, respectively, where the weight $\wv_V$ is the one that linear ordering $\Phi = (4,3,2,5,1)$ is consistent with, e.g., $\wv_V = (4,0.5,0.5,0.3,3.3)$. Note, any linear ordering is consistent with $\wv_V=(1,\dotsc,1)$, i.e., if the problem is just to determine the minimum sum-rate and an optimal rate vector, the linear ordering can be arbitrarily chosen. \section{Complexity} \label{sec:Complexity} The authors in \cite{MiloDivConq2011} proposed a divide-and-conquer (DV) algorithm for the asymptotic CO problem. The idea is to directly apply the DA algorithm in \cite{MinAveCost} to determine the fundamental partition and iteratively break each non-singleton subsets in it into singletons to determine each tuple in the optimal rate. Since the DA algorithm completes in $O(|V|^2\cdot\SFM(|V|))$ time, the complexity of the DV algorithm is upper bounded by $O(|V|^3\cdot\SFM(|V|))$. The complexity of the MDA algorithm is upper bounded by $O(|V|^2\cdot\SFM(|V|))$,\footnote{The complexity of the CoordSatCapFus algorithm based on~\eqref{eq:SatCapFus} in the worst case is the same as the CoordSatCap algorithm based on~\eqref{eq:SatCapOld}. The worst case is when $\Pat^*=\Set{\Set{\phi_1},\dotsc,\Set{\phi_i}}$ for all $i$ in the CoordSatCapFus algorithm. In the DA algorithm in \cite{MinAveCost}, the CoorSatCap algorithm is implemented for solving the Dilworth truncation problem. Therefore the complexity of MDA algorithm is upper bounded by $O(|V|^2\cdot\SFM(|V|))$. } which is lower than the DV algorithm. Let $|V|$ be the size of the SFM problem with complexity $\SFM(|V|)$. As aforementioned, although the numbers of calls of SFM algorithm are the same, the size of each SFM problem in the CoordSatCapFus algorithm based on \eqref{eq:SatCapFus} is less than that in the CoordSatCap algorithm based on \eqref{eq:SatCapOld} in general. We do an experiment to compare the complexity of these two algorithms. Let $H(V)$ be fixed to $50$ and $|V|$ vary from $5$ to $30$. For each value of $|V|$, we repeat the procedure for 20 times: (a) randomly generate a CO system; (b) apply the MDA algorithm twice, one calls the CoordSatCapFus algorithm and the other calls the CoordSatCap algorithm. We record overall/summed size of the SFM algorithm in each run of the MDA algorithm and average over the repetitions. The results are shown in Fig.~\ref{fig:Complexity}. It can be seen that by implementing the CoordSatCapFus algorithm, there is a considerable reduction in complexity when the size of user set $|V|$ grows. \begin{figure}[tbp] \centering \scalebox{0.7}{\input{figures/Complexity.tex}} \caption{The size of SFM problem over repetitions in the experiment in Section~\ref{sec:Complexity}, where $H(V)$ is fixed to $50$ and $|V|$ varies from $5$ to $50$.} \label{fig:Complexity} \end{figure} \section{Conclusion} We proposed an MDA algorithm for determining the minimum sum-rate and a corresponding optimal rate for the asymptotic CO problem. The MDA algorithm mainly proposed an idea on how to update the minimum sum-rate estimation: A closer estimation to the optimum could be obtained by the minimal/finest minimizer of a Dilworth truncation problem based on the current estimation. We also proposed a CoordSatCapFus algorithm to solve the Dilworth truncation problem which was less complex than the original CoordSatCap algorithm. We discussed how to extend the MDA algorithm to solve the non-asymptotic problem and how to choose a proper linear ordering of the user set to solve a minimum weighted sum-rate problem. \appendices \section{Proof of Theorem~\ref{theo:main}} \label{app:theo:main} In \cite{Narayanan1991PLP,MinAveCost}, the authors proposed a DA for determining the principal partition sequence (PSP) for a clustering problem. Since the fundamental partition is one of the partitions in PSP \cite{ChanMMI,ChanInfoCluster}, we adapt DA to MDA to just determine the fundamental partition. A similar approach can be found in \cite{ChanInfoCluster}. Based on the studies in \cite{Narayanan1991PLP,ChanInfoCluster}, if the CoordSatCapFus algorithm is able to determine the minimum and the minimal/finest minimizer of the Dilworth truncation problem $\min_{\Pat\in \Pi(V)} \FuHash{\alpha}[\Pat]$ for a given value of $\alpha$, the MDA algorithm outputs $\RACO(V)$, the fundamental partition and an optimal rate $\rv_V \in \RRACO^*(V) = B(\FuHashHat{\RACO(V)},\leq)$. In addition, the value of $\alpha$ of the MDA algorithm converges monotonically upward to $\RACO(V)$. Now, we show that CoordSatCapFus algorithm determines the finest minimizer of $\min_{\Pat\in \Pi(V)} \FuHash{\alpha}[\Pat]$. For $\FuHash{\alpha}$, Consider the (original/general) CoordSatCap algorithm \cite{Fujishige2005}: \begin{enumerate}[step 1:] \item Initiate $\rv_V$ such that $\rv_V \in P(\FuHash{\alpha},\leq)$; \item For each dimension $i \in \Set{1,\dotsc,|V|}$, do $ \rv \leftarrow \rv + \hat{\xi} \chi_{\phi_i}$, where $\hat{\xi}$ is the \text{saturation capacity} \begin{equation} \label{eq:SatCap} \hat{\xi} = \min\Set{\FuHash{\alpha}(X) - r(X) \colon \phi_i \in X \subseteq V}. \end{equation} \end{enumerate} $\hat{\xi}$ in \eqref{eq:SatCap} is the maximum increment in $r_{\phi_i}$ such that the resulting $\rv_V$ is still in $P(\FuHash{\alpha},\leq)$, hence the name saturation capacity. Due to the intersecting submodularity of $\FuHash{\alpha}$, \eqref{eq:SatCap} is an SFM problem and the CoordSatCap algorithm finally updates $\rv_V$ to a vector/rate in $B(\FuHashHat{\alpha},\leq)$ with $r(V) = \FuHashHat{\alpha}(V)$. The minimal minimizer of $\min_{\Pat\in \Pi(V)} \FuHash{\alpha}[\Pat]$ is determined as follows. Let $\hat{X}_{\phi_i}$ be the minimal minimizer of \eqref{eq:SatCap} for dimension $\phi_i$. By iteratively merging dimensions $\phi_i,\phi_j \in V$ such that $\phi_i \in \hat{X}_{\phi_j}$ until there is no such pair left, we can determine the finest partition in $\Pi(V)$ that minimizes $\FuHash{\alpha}[\Pat]$ \cite{Bilxby1985,Fujishige2005,MinAveCost}.\footnote{The minimal minimizer of $\min_{\Pat\in \Pi(V)} \FuHash{\alpha}[\Pat]$ corresponds to the minimal separators of a submodular system with the rank function being $\FuHashHat{\alpha}$. Define the partial order $\preceq$ as $\phi_i \preceq \phi_j$ if $\phi_i \in \hat{X}_{\phi_j}$. Let $G(V,E)$ be the digraph with the edge set constituted by edges $e_{\phi_i,\phi_j} \in E$ if $\phi_i \preceq \phi_j$. The minimal separators are the strongly connected components of the underlying undirected graph of $G(V,E)$. The procedure that updates $\Pat^*$ in Appendix~\ref{app:theo:main} is exactly the one that determines these minimal separators. For more details, we refer the reader to \cite{Bilxby1985,Fujishige2005}.} The implementation is as follows. Initiate $\Pat^*=\Set{\Set{\phi_i} \colon i \in V}$ at the beginning of the CoordSatCap algorithm. After obtaining each $\hat{X}_{\phi_i}$ for $i$ in step 2, do the followings: \begin{itemize} \item find all elements in $\Pat^*$ that intersect with $\hat{X}_{\phi_i}$, i.e., determine $\X = \Set{X \in \Pat^* \colon X \cap \hat{X}_{\phi_i} \neq \emptyset}$; \item merge all the elements in $\X$ to form a single element in $\Pat^*$ by $\Pat^* = (\Pat^* \setminus \X) \cup \tilde{\X}$. \end{itemize} $\Pat^*$ is the minimal minimizer of $\min_{\Pat\in \Pi(V)} \FuHash{\alpha}[\Pat]$ at the end of the CoordSatCap algorithm. It is easy to see that by letting $\rv_V = (\alpha-H(V))\chi_V$ we have $\rv_V \in P(\FuHash{\alpha},\leq)$ initially. Let $\Phi$ be any linear ordering of $V$. We have \begin{multline} \label{eq:PolyRank1} \min\Set{ \FuHash{\alpha}(X) - r(X) \colon \phi_i \in X \subseteq V} \\ = \min\Set{ \FuHash{\alpha}(X) - r(X) \colon \phi_i \in X \subseteq V_i} \end{multline} where $V_{i} = \Set{\phi_1,\dotsc,\phi_{i}}$ due to the monotonicity of the entropy function $H$ \cite{Fujishige2005}.\footnote{This property has also been used in \cite{MiloIT2015,CourtIT2014} for solving the non-asymptotic CO problem.} \begin{lemma} \label{lemma:PolyRank2} Let $\Pat^*$ be the partition that is updated in each iteration of the CoordSatCap algorithm as described above, \begin{multline} \min\Set{\FuHash{\alpha}(X) - r(X) \colon \phi_i \in X \subseteq V} \\ = \min\Set{\FuHash{\alpha}(\tilde{U}) - r(\tilde{U}) \colon \Set{\phi_i} \in U \subseteq \Pat^*}. \nonumber \end{multline} Let $\hat{X}_{\phi_i}$ and $U_{\phi_i}^*$ be the minimal minimizer of the LHS and RHS, respectively, of the equation above. Then, $\hat{X}_i=\tilde{U}_i^*$. \end{lemma} \begin{IEEEproof} For any $X \subseteq V$, let $\Y=\Set{Y \in \Pat \colon Y \cap X \neq \emptyset}$. We have \begin{equation} \begin{aligned} & \quad \FuHash{\alpha}(X) - r(X) - \FuHash{\alpha}(\tilde{\Y}) + r(\tilde{\Y}) \\ & = \FuHash{\alpha}(X) - \FuHash{\alpha}(\tilde{\Y}) + r( \tilde{\Y} \setminus X ) \\ & = \FuHash{\alpha}(X) - \FuHash{\alpha}(\tilde{\Y}) + \sum_{Y \in \Y} \big( \FuHash{\alpha}(Y) - \FuHash{\alpha}(Y \cap X) \big) \geq 0, \end{aligned} \nonumber \end{equation} where the last inequality is obtained by applying submodular inequality \eqref{eq:SubMIneq} inductively over intersecting subsets. The minimality of $\tilde{U}_i^*$ over all $X \subseteq V$ such that $\phi_i \in X$ can also be seen by induction. So, $\hat{X}_i=\tilde{U}_i^*$. \end{IEEEproof} Based on \eqref{eq:PolyRank1} and Lemma~\ref{lemma:PolyRank2}, we can implement the CoordSatCap algorithm by a fusion method as in the CoordSatCapFus algorithm, where steps 8 and 9 are equivalent to the procedure that updates $\Pat^*$ as described above. \bibliographystyle{ieeetr}
{'timestamp': '2016-07-19T02:06:04', 'yymm': '1607', 'arxiv_id': '1607.04819', 'language': 'en', 'url': 'https://arxiv.org/abs/1607.04819'}
arxiv
\section{Related work} \noindent \textbf{Dense prediction problem} We focus on three dense prediction subtasks: such as monocular depth estimation, semantic segmentation and image super-resolution. Learning-based monocular depth estimation was first introduced by Saxena et al.~\cite{saxena2006learning}. Later studies improved accuracy by using large network architectures~\cite{chen2019structure,eigen2015predicting,eigen2014depth,Hu2018RevisitingSI,laina2016deeper} or integrating semantic information~\cite{jiao2018look} and surface normals~\cite{qi2018geonet}. Fu et al.~\cite{fu2018deep} formulated depth estimation as an ordinal regression problem, while~\cite{chen2016single,lee2019monocular} estimated relative instead of metric depth. Facil et al.~\cite{facil2019cam} proposed to learn camera calibration from the images for depth estimation. Recent approaches further improve the performance by exploiting monocular priors such as planarity constraints~\cite{liu2019planercnn,liu2018planenet,Yin2019enforcing,huynh2020guiding,lee2019big} or occlusion~\cite{ramamonjisoa2019sharpnet}. Gonzalez and Kim~\cite{gonzalezbello2020forget} estimated depth by synthesizing stereo pairs from a single image, while~\cite{yang2021transformers} and~\cite{Ranftl2021} applied vision-transformer for depth prediction. For resource-limited hardware, it is more desirable to not only have a fast but also accurate model. A simple alternative is employing lightweight architectures such as MobileNet~\cite{howard2019searching,howard2017mobilenets,sandler2018mobilenetv2,wofk2019fastdepth}, GhostNet~\cite{han2020ghostnet}, and FBNet~\cite{tu2020efficient}. A popular approach is utilizing network compression techniques, including quantization~\cite{han2015deep}, network pruning~\cite{yang2018netadapt}, knowledge distillation~\cite{yucel2021real}. Another approach employs well-known pyramid networks or dynamic optimization schemes~\cite{aleotti2021real}. Deep neural networks have thrived on semantic segmentation, with early works~\cite{girshick2014rich,hariharan2014simultaneous} proposed to classify region proposals to perform this task. Later on, fully convolutional neural network methods~\cite{long2015fully,dai2015boxsup} are widely adopted to process arbitrary-sized input images and train the network end-to-end. Atrous convolution-based approach~\cite{liang2015semantic} generated the middle-score map that was later refined using the dense conditional random field (CRF)~\cite{krahenbuhl2011efficient} to mitigate the low-resolution prediction problem. Chen et al.~\cite{chen2017deeplab} then implemented atrous spatial pyramid pooling for segmenting objects at different scales, while~\cite{chen2017rethinking} and~\cite{chen2018encoder} employed atrous separable convolution and an efficient decoder module to capture sharp object boundaries. Zheng et al.~\cite{zheng2015conditional} enabled end-to-end training of dense CRF by implementing recurrent layers. Other approaches~\cite{badrinarayanan2017segnet,noh2015learning} utilized transposed convolution to generate the high-resolution prediction. Long et al.~\cite{long2015fully} produced multi-resolution prediction scores and took the average to generate the final output. Hariharan et al.~\cite{hariharan2015hypercolumns} fused mid-level features and trained dense classification layers at multiple stages. Badrinarayanan et al.~\cite{badrinarayanan2017segnet} and Ronneberger et al.~\cite{ronneberger2015u} implemented transposed convolution with skip-connections to exploit mid-level features. Wang et al.~\cite{wang2020deep} utilized multi-scale parallel inter-connected layers to further exploit learned features from pre-trained ImageNet models. Lightweight approaches~\cite{orsic2019defense,li2019dfanet,yu2018bisenet} employed pre-trained backbones as a decoder and a simple decoder to perform fast segmentation. Zhao et al.~\cite{zhao2018icnet} modified the cascade architecture of~\cite{zhao2017pyramid} to shrink the model size and speed-up inference. Image super-resolution task has also been immensely improved using deep neural networks. Dong et al.~\cite{dong2015image} first proposed a shallow but bulky network that~\cite{dong2016accelerating} later shrunk down utilizing transposed convolution. Kim et al.~\cite{kim2016accurate} implemented a deeper architecture with skip connection while Zhang et al.~\cite{zhang2018image} proposed channel attention to improve the performance. Kim et al.~\cite{kim2016deeply} introduced recursive layers that Tai et al.~\cite{tai2017image} later extended by adding the local residual connection. Likewise, many studies attempted to enhance model efficiency. Ahn et al.~\cite{ahn2018fast} suggested using cascade architecture and group convolution to reduce the number of parameters. Hui et al.~\cite{hui2018fast,hui2019lightweight} proposed the information distillation module for creating an efficient model. Lai et al.~\cite{lai2017deep} applied the Laplacian pyramid network to gradually increase the spatial resolution while downsizing the model. However, state-of-the-art methods mainly focus on increasing accuracy at the cost of model complexity that is infeasible in resource-limited settings, while manually designed lightweight architecture is a tedious task, requires much trial-and-error, and usually leads to architectures with low accuracy. \noindent \textbf{Neural Architecture Search} There has been increasing interest in automating network design using neural architecture search. Most of these methods focus on searching high-performance architecture using reinforcement learning~\cite{baker2016designing,liu2018progressive,pham2018efficient,zoph2016neural,zoph2018learning}, evolutionary search~\cite{real2019regularized}, differentiable search~\cite{liu2018darts}, or other learning algorithms~\cite{luo2018neural}. However, these methods are usually very slow and require huge resources for training. Other studies~\cite{dong2018dpp,elsken2018multi,hsu2018monas} also attempt to optimize multiple objectives like model size and accuracy. Nevertheless, their search process optimizes only on small tasks like CIFAR. In contrast, our proposed method targets real-world data such as NYU, KITTI, and Cityscapes on multiple dense prediction tasks. \section{Lightweight Dense Precition (LDP)} \noindent We propose the LDP framework to search for accurate and lightweight monocular depth estimation architectures utilizing a pre-defined backbone that has been successful for dense prediction in the past. The proposed framework takes in a dataset as input to search for the best possible model. This model can be deployed for depth estimation on hardware-limited devices. The first subsection defines the search space while the remaining two describe our multi-objective exploration and search algorithm. \subsection{Search Space} \noindent Previous neural architecture search (NAS) studies demonstrated the significance of designing a well-defined search space. A common choice of NAS is searching for a small set of complicated cells from a smaller dataset~\cite{zoph2018learning,liu2018progressive,real2019regularized}. These cells are later replicated to construct the entire architecture that hindered layer diversity and suffered from domain differences~\cite{tan2019mnasnet}. On the other hand, unlike classification tasks, dense prediction problems involve mapping a feature representation in the encoder to predictions at larger spatial resolution in the decoder. To this end, we build our search space upon a pre-defined backbone that is shown as the set of green blocks in Figure~\ref{fig:search_space_ver2}. The backbone is divided into multi-scale pyramid networks operating at different spatial resolutions. Each network scale consists of two encoder blocks, two decoder blocks, a refinement block, a downsampling and upsampling block (except for scale 1). Each block is constructed from a set of identical layers (marked as orange in Figure~\ref{fig:search_space_ver2}). Inspired by~\cite{tan2019mnasnet}, we search for the layer from a pool of operations and connections, including: \begin{figure*}[!t] \begin{center} \includegraphics[width=0.99\linewidth]{figures/search_algorithm.pdf} \end{center} \vspace{-0.35cm} \caption{The flowchart of our architecture search that utilizes the Assisted Tabu Search (ATS) with mutation to search for accurate and lightweight monocular depth estimation networks.} \vspace{-0.55cm} \label{fig:search_algorithm} \end{figure*} \begin{itemize}[noitemsep,topsep=0pt,parsep=1pt,partopsep=1pt] \item The number of resolution scales $S$. \item The number of layers for each block $N_{i,j}$. \item Convolutional operations (ConvOps): vanilla 2D convolution, depthwise convolution, inverted bottleneck convolution and micro-blocks~\cite{li2021micronet}. \item Convolutional kernel size (KSize): $3 \times 3$, $5 \times 5$. \item Squeeze and excitation ratio (SER): $0$, $0.25$. \item Skip connections (SOps): residual or no connection. \item The number of output channels: $F_{i,j}$. \end{itemize} \noindent Here $i$ indicates the resolution scale and $j$ is the block index at the same resolution. Internal operations such as ConvOps, KSize, SER, SOps, $F_{i,j}$ are utilized to construct the layer while $N_{i,j}$ determines the number of layers that will be replicated for block$_{i,j}$. In other words, as shown in Figure~\ref{fig:search_space_ver2}, layers within a block (e.g. layers 1 to N$_{1,2}$ of Encoder Block 1,2 are the same) are similar while layers of different blocks (e.g. Layer 1 in Refine Block 1,5 versus Layer 1 in Upsample Block S,7) can be different. We also perform layer mutation to further diversifying the network structure during the architecture search process. The mutation operations include: \begin{itemize}[noitemsep,topsep=0pt,parsep=1pt,partopsep=1pt] \item Swapping operations of two random layers with compatibility check. \item Modifying a layer with a new valid layer from the predefined operations. \end{itemize} Moreover, we also set computational constraints to balance the kernel size with the number of output channels. Therefore, increasing the kernel size of one layer usually results in decreasing output channels of another layer. Assuming we have a network of $S$ scales, and each block has a sub-search space of size $M$ then our total search space will be $M^{5 + [(S - 1) * 7]}$. Supposedly, a standard case with $M=192$, $S=5$ will result in a search space of size $\sim 2 \times 10^{75}$. \subsection{Multi-Objective Exploration} \noindent We introduce a multi-objective search paradigm seeking for both accurate and compact architectures. For this purpose, we monitor the \textit{validation grade} $\mathcal{G}$ that formulates both accuracy and the number of parameter of the trained model. It is defined by \begin{equation} \label{eq:validation_grade} \mathcal{G}(m) = \alpha \times A(m) + (1 - \alpha) \times \bigg[\frac{P}{P(m)}\bigg]^{r} \end{equation} \noindent where $A(m)$ and $P(m)$ are validation accuracy and the number of parameters of model $m$. $P$ is the target compactness, $\alpha$ is the balance coefficient, and $r$ is an exponent with $r=0$ when $P(m) \leq P$ and otherwise $r=1$. The goal is to search for an architecture $m^{*}$ where $G(m^{*})$ is maximum. However, computing $G$ requires training for every architecture candidate, resulting in considerable search time. To mitigate this problem, Mellor et al.~\cite{mellor2021neural} suggested to score an architecture at initialisation to predict its performance before training. For a network $f$, the \textit{score(f)} is defined as: \begin{equation} \label{eq:jacob_cov_score} score(f) = log|K_{H}| \end{equation} \noindent where $K_{H}$ is the kernel matrix. Let us assume that the mapping of model $f$ from a batch of data $X = \{x_i\}^{N}_{i=1}$ is $f(x_i)$. By assigning binary indicators to every activation units in $f$, a linear region $x_i$ of data point $i$ is represented by the binary code $c_i$. The kernel matrix $K_{H}$ is defined as: \begin{equation} \label{eq:kernel_matrix} K_{H} = \begin{pmatrix} N_{A} - d_{H}(c_1, c_1) & \dots & N_{A} - d_{H}(c_1, c_N) \\ \vdots & \ddots & \vdots \\ N_{A} - d_{H}(c_N, c_1) & \dots & N_{A} - d_{H}(c_N, c_N) \end{pmatrix} \end{equation} \noindent where $N_A$ is the number of activation units, and $d_{H}(c_i, c_j)$ is the Hamming distance between two binary codes. Inspired by this principle, we generate and train a set of different architectures for various dense prediction tasks. We evaluate the performance of these models and visualize the results against the \textit{score} that in our case is the mapping of depth values within image batches. Leveraging this observation, we 1) utilize the \textit{score} in our initial network ranking, and 2) define the mutation exploration reward $\mathcal{R}$ as: \begin{equation} \label{eq:mutation_exploration_reward} \mathcal{R}(m_i,m_j) = \alpha \times \frac{score(m_j)}{score(m_i)} + (1 - \alpha) \times \bigg[\frac{P}{P(m_j)}\bigg]^{r} \end{equation} \noindent where $m_j$ is a child network that is mutated from $m_i$ architecture. \subsection{Search Algorithm} \noindent The flowchart of our architecture search is presented in Figure~\ref{fig:search_algorithm}. We first randomly generate $60K$ unique parent models and create the initial network ranking based on the \textit{score} in Eq.~\ref{eq:jacob_cov_score}. We then select \textit{six} architectures in which \textit{three} are the highest-ranked while the other \textit{three} have the highest score of the networks with the size closest to the target compactness. \begin{table*}[t!] \caption{\label{tab:eval_nyuv2}Evaluation on the NYU-Depth-v2 dataset. Metrics with $\downarrow$ mean lower is better and $\uparrow$ mean higher is better. Type column shows the exploration method used to obtain the model. RL, ATS, and manual, refer to reinforcement learning, assisted tabu search, and manual design, respectively.} \centering \small \begin{tabular}{@{}llrcccccccc@{}} \hline \multicolumn{2}{c}{\textbf{Architecture}} & \textbf{\#params} & \textbf{Type} & \textbf{Search Time} & \textbf{REL$\downarrow$} & \textbf{RMSE$\downarrow$} & \(\boldsymbol{\delta_{1}}\)$\uparrow$ & \(\boldsymbol{\delta_{2}}\)$\uparrow$ & \(\boldsymbol{\delta_{3}}\)$\uparrow$ \\ \hline AutoDepth-BOHB-S & Saikia et al.'19~\cite{saikia2019autodispnet} & 63.0M & RL & 42 GPU days & 0.170 & 0.599 & - & - & - \\ \hline EDA & Tu et al.'21~\cite{tu2020efficient} & 5.0M & Manual & - & 0.161 & 0.557 & 0.782 & 0.945 & 0.984 \\ \hline Ef+FBNet & Tu \& Wu et al.~\cite{tu2020efficient,wu2019fbnet} & 4.7M & Manual & - & 0.149 & 0.531 & 0.803 & 0.952 & 0.987 \\ \hline FastDepth & Wofk et al.'19~\cite{wofk2019fastdepth} & 3.9M & Manual & - & 0.155 & 0.599 & 0.778 & 0.944 & 0.981 \\ \hline SparseSupNet & Yucel et al.'21~\cite{yucel2021real} & 2.6M & Manual & - & 0.153 & 0.561 & 0.792 & 0.949 & 0.985 \\ \hline LiDNAS-N & Huynh et al.'21~\cite{huynh2021lightweight} & 2.1M & ATS & 4.3 GPU days & \textbf{0.132} & 0.487 & 0.845 & 0.965 & \textbf{0.993} \\ \hline LDP-Depth-N & Ours & \textbf{2.0M} & ATS & 4.3 GPU days & \textbf{0.132} & \textbf{0.483} & \textbf{0.848} & \textbf{0.967} & \textbf{0.993} \\ \hline \end{tabular} \vspace{-0.45cm} \end{table*} Starting from these initial networks, we strive for the best possible model utilizing Assisted Tabu Search (ATS), inspired by Tabu search (TS)~\cite{glover1986future} that is a high level procedure for solving multicriteria optimization problems. It is an iterative algorithm that starts from some initial feasible solutions and aims to determine better solutions while being designed to avoid traps at local minima. We propose ATS by applying Eq.~\ref{eq:validation_grade} and~\ref{eq:mutation_exploration_reward} to TS to speed up the searching process. Specifically, we mutate numerous children models ($m_1$, $m_2$, .., $m_n$) from the current architecture ($m_c$). The mutation exploration reward $\mathcal{R}(m_c, m_i)$ is calculated using Eq.~\ref{eq:mutation_exploration_reward}. ATS then chooses to train the mutation with the highest rewards (e.g. architecture $m_i$ as demonstrated in Figure~\ref{fig:search_algorithm}). The validation grade of this model $\mathcal{G}(m_i)$ is calculated after the training. The performance of the chosen model is assessed by comparing $\mathcal{G}(m_i)$ with $\mathcal{G}(m_c)$. If $\mathcal{G}(m_i)$ is larger than $\mathcal{G}(m_c)$, then $m_i$ is a good mutation, and we opt to build the next generation upon its structure. Otherwise, we swap to use the best option in the tabu list for the next mutation. The process stops when reaching a maximum number of iterations or achieving a terminal condition. The network ranking will be updated, and the search will continue for the remaining parent architectures. \subsection{Implementation Details} \label{implementation_detail} \noindent For searching, we directly perform our architecture exploration on the training samples of the target dataset. We set the target compactness parameter $P$ using the previously published compact models as a guideline. We set the maximum number of exploration iterations to 100 and stop the exploration procedure if a better solution cannot be found after 10 iterations. The total search time required to find optimal architecture is $\sim 4.3$ GPU days. \begin{table}[b!] \caption{\label{tab:eval_kitti}Evaluation on the KITTI dataset. Metrics with $\downarrow$ mean lower is better and $\uparrow$ mean higher is better.} \centering \small \adjustbox{width=\columnwidth}{\begin{tabular}{@{}lrccccc@{}} \hline \textbf{Method} &\textbf{\#params} & \textbf{REL$\downarrow$} & \textbf{RMSE$\downarrow$} & \(\boldsymbol{\delta_{1}}\)$\uparrow$ & \(\boldsymbol{\delta_{2}}\)$\uparrow$ & \(\boldsymbol{\delta_{3}}\)$\uparrow$ \\ \hline FastDepth~\cite{wofk2019fastdepth} & 3.93M & 0.156 & 5.628 & 0.801 & 0.930 & 0.971 \\ \hline PyD-Net~\cite{poggi2018towards} & 1.97M & 0.154 & 5.556 & 0.812 & 0.932 & 0.970 \\ \hline EQPyD-Net~\cite{cipolletta2021energy} & 1.97M & 0.135 & 5.505 & 0.821 & 0.933 & 0.970 \\ \hline DSNet~\cite{aleotti2021real} & 1.91M & 0.159 & 5.593 & 0.800 & 0.932 & 0.971 \\ \hline LiDNAS-K & 1.78M & \textbf{0.133} & 5.157 & 0.842 & \textbf{0.948} & 0.980 \\ \hline LDP-Depth-K & \textbf{1.74M} & \textbf{0.133} & \textbf{5.155} & \textbf{0.844} & \textbf{0.948} & \textbf{0.981} \\ \hline \end{tabular}} \vspace{-0.25cm} \end{table} \begin{table}[b!] \vspace{-0.15cm} \caption{\label{tab:eval_cityscapes}Segmentation results on Cityscapes dataset. (MIoU)} \centering \small \begin{tabular}{@{}lrccc@{}} \hline {\textbf{Model}} & \textbf{\#params} & \textbf{resolution} & \textbf{val}$\uparrow$ & \textbf{test}$\uparrow$ \\ \hline BiSeNetV1 B~\cite{yu2018bisenet} & 49.0M & $768 \times 1536$ & 74.8 & 74.7 \\ \hline SwiftNet\cite{orsic2019defense} & 11.8M & $512 \times 1024$ & 70.2 & - \\ \hline DFANet~\cite{li2019dfanet} & 7.8M & $512 \times 1024$ & 70.8 & 70.3 \\ \hline BiSeNetV1 A~\cite{yu2018bisenet} & 5.8M & $768 \times 1536$ & 69.0 & 68.4 \\ \hline MobileNeXt~\cite{zhou2020rethinking} & 4.5M & $1024 \times 2048$ & 75.5 & 75.2 \\ \hline BiSeNetV2~\cite{yu2021bisenet} & 4.3M & $1024 \times 2048$ & 75.8 & 75.3 \\ \hline HRNet-W16~\cite{wang2020deep} & 2.0M & $512 \times 1024$ & 68.6 & 68.1 \\ \hline Lite-HRNet~\cite{yu2021lite} & 1.8M & $512 \times 1024$ & \textbf{76.0} & 75.3 \\ \hline \hline FasterSeg~\cite{chen2019fasterseg} & 4.4M & $1024 \times 2048$ & 73.1 & 71.5 \\ \hline MobileNetV3~\cite{howard2019searching} & \textbf{1.5M} & $1024 \times 2048$ & 72.4 & 72.6 \\ \hline LDP-Seg-Ci & 1.7M & $512 \times 1024$ & 75.8 & \textbf{75.5} \\ \hline \hline \end{tabular} \vspace{-0.25cm} \end{table} \begin{table}[b!] \caption{\label{tab:eval_coco}Segmentation results on COCO-Stuff dataset.} \centering \small \begin{tabular}{@{}lrccc@{}} \hline {\textbf{Model}} & \textbf{\#params} & \textbf{PixAcc}(\%)$\uparrow$ & \textbf{MIoU}(\%)$\uparrow$ \\ \hline BiSeNetV1 B~\cite{yu2018bisenet} & 49.0M & 63.2 & 28.1 \\ \hline ICNet~\cite{zhao2018icnet} & 12.7M & - & 29.1 \\ \hline BiSeNetV1 A~\cite{yu2018bisenet} & 5.8M & 59.0 & 22.8 \\ \hline BiSeNetV2~\cite{yu2021bisenet} & \textbf{4.3M} & 63.5 & 28.7 \\ \hline LDP-Seg-CO & \textbf{4.3M} & \textbf{64.2} & \textbf{29.3} \\ \hline \hline \end{tabular} \end{table} For training, we use the Adam optimizer~\cite{kingma2014adam} with $(\beta_1, \beta_2, \epsilon) = (0.9, 0.999, 10^{-8})$. The initial learning rate is $7*10^{-4}$, but from epoch 10 the learning is reduced by $5\%$ per $5$ epochs. We use a batch size of 256 and augment the input RGB and ground truth depth images using random rotations ([-5.0, +5.0] degrees), horizontal flips, rectangular window droppings, and colorization (RGB only). \section{Experiments} We deploy the LDP framework on dense prediction tasks: monocular depth estimation, semantic segmentation, and image super-resolution. Experiments show that LDP improved performance while using only a fraction of the number of parameters needed by the competing approaches. \subsection{Monocular Depth Estimation} We first demonstrate our method for monocular depth estimation that can be formulated as a dense regression problem. The main goal is to infer continuous pixel-wise depth values from a single input image. For this task, we apply LDP on the NYU-Depth-v2 \cite{silberman2012indoor} and KITTI~\cite{geiger2013vision} datasets. NYU-Depth-v2 contains $\sim120K$ RGB-D images obtained from 464 indoor scenes. From the entire dataset, we use 50K images for training and the official test set of 654 images for evaluation. KITTI is an outdoor driving dataset, where we use the standard Eigen split~\cite{eigen2015predicting,eigen2014depth} for training (39K images) and testing (697 images). We report the mean absolute relative error (REL), root mean square error (RMSE), and thresholded accuracy ($\delta_i$) as our performance metrics. \begin{table*}[t!] \caption{\label{tab:sup_res_x2}Image Super-Resolution with scaling factor $\times 2$.} \centering \begin{tabular}{@{}lccccccccc@{}} \hline \multicolumn{1}{c}{\multirow{2}{*}{ \textbf{Method} }} & \multicolumn{1}{c}{\multirow{2}{*}{ \textbf{\#params} }} & \multicolumn{2}{c}{ \textbf{Set5} } & \multicolumn{2}{c}{ \textbf{Set14} } & \multicolumn{2}{c}{ \textbf{BSD100} } & \multicolumn{2}{c}{ \textbf{Urban100} } \\ \cmidrule(l){3-10} \multicolumn{2}{c}{} & PSNR$\uparrow$ & SSIM$\uparrow$ & PSNR$\uparrow$ & SSIM$\uparrow$ & PSNR$\uparrow$ & SSIM$\uparrow$ & PSNR$\uparrow$ & SSIM$\uparrow$ \\ \midrule Bicubic & - & 33.66 & 0.9299 & 30.24 & 0.8688 & 29.56 & 0.8431 & 26.91 & 0.8425 \\ CARN~\cite{ahn2018fast} & 1.59M & 37.76 & 0.9590 & 33.52 & 0.9166 & 32.09 & 0.8978 & 31.92 & 0.9256 \\ LFFN~\cite{yang2019lightweight} & 1.52M & 37.95 & 0.9597 & 32.45 & 0.9142 & 32.20 & 0.8994 & 32.39 & 0.9299 \\ OISR-LF-s~\cite{he2019ode} & 1.37M & 38.02 & 0.9605 & 33.62 & 0.9178 & 32.20 & 0.9000 & 32.21 & 0.9290 \\ CBPN~\cite{zhu2019efficient} & 1.04M & 37.90 & 0.9590 & 33.60 & 0.9171 & 32.17 & 0.8989 & 32.14 & 0.9279 \\ OverNet~\cite{behjati2021overnet} & 0.90M & 38.11 & 0.9610 & 33.71 & 0.9179 & 32.24 & 0.9007 & 32.44 & 0.9311 \\ LapSRN~\cite{lai2017deep} & 0.81M & 37.52 & 0.9590 & 33.08 & 0.9130 & 31.80 & 0.8950 & 30.41 & 0.9100 \\ IMDN~\cite{hui2019lightweight} & 0.69M & 38.00 & 0.9605 & 33.63 & 0.9177 & 32.19 & 0.8996 & 32.17 & 0.9283 \\ MemNet~\cite{tai2017memnet} & 0.67M & 37.78 & 0.9597 & 33.28 & 0.9142 & 32.08 & 0.8978 & 31.31 & 0.9195 \\ VDSR~\cite{kim2016accurate} & 0.66M & 37.53 & 0.9587 & 33.05 & 0.9127 & 31.90 & 0.8960 & 30.77 & 0.9141 \\ IDN~\cite{hui2018fast} & 0.57M & 37.85 & 0.9598 & 33.58 & 0.9178 & 32.11 & 0.8989 & 31.95 & 0.9266 \\ CARN-M~\cite{ahn2018fast} & 0.41M & 37.53 & 0.9583 & 33.26 & 0.9141 & 31.92 & 0.8960 & 31.23 & 0.9194 \\ DRRN~\cite{tai2017image} & 0.29M & 37.74 & 0.9591 & 33.23 & 0.9136 & 32.05 & 0.8973 & 31.23 & 0.9188 \\ SRFBN~\cite{li2019feedback} & 0.28M & 37.78 & 0.9597 & 33.35 & 0.9156 & 32.00 & 0.8970 & 31.41 & 0.9207 \\ FSRCNN~\cite{dong2016accelerating} & \textbf{0.12M} & 37.00 & 0.9558 & 32.63 & 0.9088 & 31.53 & 0.8920 & 29.88 & 0.9020 \\ \hline DeCoNASNet~\cite{ahn2021neural} & 1.71M & 37.96 & 0.9594 & 33.63 & 0.9175 & 32.15 & 0.8986 & 32.03 & 0.9265 \\ FPNet~\cite{esmaeilzehi2021fpnet} & 1.61M & \textbf{38.13} & \textbf{0.9616} & \textbf{33.83} & \textbf{0.9198} & \textbf{32.29} & 0.9018 & 32.04 & 0.9278 \\ FALSR-A~\cite{chu2021fast} & 1.03M & 37.82 & 0.9595 & 33.55 & 0.9168 & 32.12 & 0.8987 & 31.93 & 0.9256 \\ LDP-Sup-x2 & 1.02M & 38.11 & 0.9612 & \textbf{33.83} & 0.9196 & \textbf{32.29} & \textbf{0.9019} & \textbf{32.49} & \textbf{0.9314} \\ \hline \hline \end{tabular} \end{table*} \begin{figure*}[ht] \begin{center} \includegraphics[width=0.99\linewidth]{figures/qualitative_cityscapes_v1.pdf} \end{center} \vspace{-0.35cm} \caption{Comparison on the Cityscapes validation set. (a) input image, (b) ground truth, (c) LDP-Seg-Ci, (d) Lite-HRNet~\cite{yu2021lite}, and (e) MobileNetV3~\cite{howard2019searching}.} \label{fig:qualitative_cityscapes} \vspace{-0.35cm} \end{figure*} In the case of NYU-Depth-v2, we set the target compactness $P=1.8M$ with the balance coefficient $\alpha=0.6$ to search for the optimized model on NYU-Depth-v2. We then select the best performance model (LDP-Depth-N) and compare its results with lightweight state-of-the-art methods~\cite{tu2020efficient,wofk2019fastdepth,wu2019fbnet,yucel2021real} along with their numbers of parameters. As shown in Table~\ref{tab:eval_nyuv2}, LDP-Depth-N outperforms the baseline while containing the least amount of parameters. Comparing with the best-performing approach, the proposed model improves the REL, RMSE, and $\theta_{1}$ by $11.4\%$, $8.2\%$, and $6.8\%$ while compressing the model size by $55\%$. Our method produces high-quality depth maps with sharper details as presented in Figure~\ref{fig:qualitative_nyu}. However, we observe that all methods still struggle in challenging cases, such as the scene containing Lambertian surfaces as illustrated by the example in the third column of Figure~\ref{fig:qualitative_nyu}. Moreover, the proposed method improves REL and RMSE by $22.3\%$ and $18.7\%$ while using only $3\%$ of the model parameters comparing to the state-of-the-art NAS-based disparity and depth estimation approaches~\cite{saikia2019autodispnet}. In addition, our method requires $90\%$ less search time than~\cite{saikia2019autodispnet} and outperforms~\cite{huynh2021lightweight} in almost all metrics. \begin{table*}[t!] \caption{\label{tab:sup_res_x4}Image Super-Resolution with scaling factor $\times 4$.} \centering \begin{tabular}{@{}lccccccccc@{}} \hline \multicolumn{1}{c}{\multirow{2}{*}{ \textbf{Method} }} & \multicolumn{1}{c}{\multirow{2}{*}{ \textbf{\#params} }} & \multicolumn{2}{c}{ \textbf{Set5} } & \multicolumn{2}{c}{ \textbf{Set14} } & \multicolumn{2}{c}{ \textbf{BSD100} } & \multicolumn{2}{c}{ \textbf{Urban100} } \\ \cmidrule(l){3-10} \multicolumn{2}{c}{} & PSNR$\uparrow$ & SSIM$\uparrow$ & PSNR$\uparrow$ & SSIM$\uparrow$ & PSNR$\uparrow$ & SSIM$\uparrow$ & PSNR$\uparrow$ & SSIM$\uparrow$ \\ \midrule Bicubic & - & 28.42 & 0.8104 & 26.01 & 0.7027 & 25.96 & 0.6675 & 23.17 & 0.6585 \\ s-LWSR64~\cite{li2020s} & 2.27M & 32.28 & 0.8960 & 28.34 & 0.7800 & 27.61 & 0.7380 & 26.19 & 0.7910 \\ CARN~\cite{ahn2018fast} & 1.59M & 32.13 & 0.8937 & 28.60 & 0.7806 & 27.58 & 0.7349 & 26.07 & 0.7837 \\ LFFN~\cite{yang2019lightweight} & 1.53M & 32.15 & 0.8945 & 28.32 & 0.7810 & 27.52 & 0.7377 & 26.24 & 0.7902 \\ OISR-LF-s~\cite{he2019ode} & 1.52M & 32.14 & 0.8947 & 28.63 & 0.7819 & 27.60 & 0.7369 & 26.17 & 0.7888 \\ CBPN~\cite{zhu2019efficient} & 1.19M & 32.21 & 0.8944 & 28.63 & 0.7813 & 27.58 & 0.7356 & 26.14 & 0.7869 \\ LapSRN~\cite{lai2017deep} & 0.81M & 31.54 & 0.8850 & 28.19 & 0.7720 & 27.32 & 0.7280 & 25.21 & 0.7560 \\ IMDN~\cite{hui2019lightweight} & 0.72M & 32.21 & 0.8948 & 28.58 & 0.7811 & 27.56 & 0.7353 & 26.04 & 0.7838 \\ MemNet~\cite{tai2017memnet} & 0.67M & 31.74 & 0.8893 & 28.26 & 0.7723 & 27.40 & 0.7281 & 25.50 & 0.7630 \\ VDSR~\cite{kim2016accurate} & 0.66M & 31.33 & 0.8838 & 28.02 & 0.7678 & 27.29 & 0.7252 & 25.18 & 0.7525 \\ IDN~\cite{hui2018fast} & 0.60M & 31.99 & 0.8928 & 28.52 & 0.7794 & 27.52 & 0.7339 & 25.92 & 0.7801 \\ s-LWSR32~\cite{li2020s} & 0.57M & 32.04 & 0.8930 & 28.15 & 0.7760 & 27.52 & 0.7340 & 25.87 & 0.7790 \\ SRFBN~\cite{li2019feedback} & 0.48M & 31.98 & 0.8923 & 28.45 & 0.7779 & 27.44 & 0.7313 & 25.71 & 0.7719 \\ CARN-M~\cite{ahn2018fast} & 0.41M & 31.92 & 0.8903 & 28.42 & 0.7762 & 27.44 & 0.7304 & 25.62 & 0.7694 \\ DRRN~\cite{tai2017image} & 0.29M & 31.68 & 0.8888 & 28.21 & 0.7720 & 27.38 & 0.7284 & 25.44 & 0.7638 \\ FSRCNN~\cite{dong2016accelerating} & \textbf{0.12M} & 30.71 & 0.8657 & 27.59 & 0.7535 & 26.98 & 0.7150 & 24.62 & 0.7280 \\ \hline FPNet~\cite{esmaeilzehi2021fpnet} & 1.61M & \textbf{32.32} & 0.8962 & \textbf{28.78} & \textbf{0.7856} & 27.66 & \textbf{0.7394} & 26.09 & 0.7850 \\ LDP-Sup-x4 & 1.09M & 32.30 & \textbf{0.8963} & 28.54 & 0.7836 & \textbf{27.67} & \textbf{0.7394} & \textbf{26.25} & \textbf{0.7927} \\ \hline \hline \end{tabular} \end{table*} \vspace{-0.15cm} \begin{figure*}[ht] \begin{center} \includegraphics[width=0.99\linewidth]{figures/qualitative_super_v1.pdf} \end{center} \label{fig:qualitative_super} \vspace{-0.35cm} \caption{Comparison on the Urban100 and BSD100 dataset.} \vspace{-0.35cm} \end{figure*} For KITTI, we aim at the target compactness of $P=1.45M$ with $\alpha=0.55$. We train our candidate architectures with the same self-supervised procedure proposed by~\cite{godard2019digging} and adopted by the state-of-the-art approaches~\cite{aleotti2021real,cipolletta2021energy,poggi2018towards,wofk2019fastdepth}. After the search, we pick the best architecture (LDP-Depth-K) to compare with the baselines and report the performance figures in Table~\ref{tab:eval_kitti}. The LDP-Depth-K model yields competitive results with the baselines while also being the smallest model. We observe that our proposed method provides noticeable improvement from PyD-Net and EQPyD-Net. Examples from Figure~\ref{fig:qualitative_kitti} show that the predicted depth maps from LDP-Depth-K are more accurate and contain fewer artifacts. \subsection{Semantic Segmentation} We then deploy LDP for dense classification tasks such as semantic segmentation that aims to predict discrete labels of image pixels. We employ the same backbone structure as in monocular depth estimation experiments and utilize the cross-entropy loss. For this problem, we evaluate our method on the Cityscapes~\cite{cordts2016cityscapes} and COCO-stuff~\cite{caesar2018coco} datasets. Cityscapes is an outdoor dataset containing images of various urban scenarios. The dataset consists of 5K high-quality annotated frames that 19 classes are used for semantic segmentation. Following the standard procedure, we used 2975, 500, and 1525 images for training, validation, and testing, respectively. COCO-stuff was created by annotating dense stuffs (e.g., sky, ground, walls) from the COCO dataset. This dataset can be utilized for image understanding as it contains 91 more stuffs classes compared to the original dataset. For fair comparison, we also use the COCO-Stuff-10K with 9K and 1K for training and testing purposes. We utilize both the mean Intersection-over-Union (MIoU) as well as the pixel accuracy (pixAcc) to assess the performance of our models. To perform searching on Cityscapes dataset, we set the target compactness $P=1.25M$ with the balance coefficient $\alpha=0.6$ using input image resolution of $512 \times 1024$ for all experiments. We then compare the best-performing model (LDP-Seg-Ci) with recent approaches~\cite{yu2018bisenet,li2019dfanet,orsic2019defense,yu2021lite,chen2019fasterseg,howard2019searching}. Results in Table~\ref{tab:eval_cityscapes} suggest that LDP-Seg-Ci performs on par with state-of-the-art while using fewer parameters than most methods. Although operating at a lower resolution, our generated model outperforms FasterSeg~\cite{chen2019fasterseg} while being $61\%$ more compact in terms of the number of parameters. Moreover, LDP-Seg-Ci also shows clear improvements compared to the MobileNetV3~\cite{howard2019searching} model. Qualitative results in Figure~\ref{fig:qualitative_cityscapes} also show that our model tends to produce more clean with sharper object boundaries and less cluttering than state-of-the-art approaches. In the case of the COCO-stuff, we aim at the target compactness of $P=4.0M$ with the balance coefficient $\alpha$ set to $0.6$. During searching and testing, we crop the input into $640 \times 640$ resolution. We evaluate the performance of our best architecture (LDP-Seg-CO) with current state-of-the-art methods~\cite{yu2018bisenet,zhao2018icnet,yu2021bisenet} and report the results in Table~\ref{tab:eval_coco}. Our method also achieves good performance for semantic segmentation on the COCO-stuff dataset while using much fewer parameters than competing approaches. \subsection{Image Super-resolution} To further assess the applicability of our proposed framework for dense prediction problems, we apply LDP framework for the image super-resolution task. We also employ a similar scheme as in previous experiments with added upsample blocks between decoder and refinement blocks to increase spatial dimension within the network scale. We then perform architecture search and training on the DIV2K~\cite{agustsson2017ntire} dataset. DIV2K is a high-quality image super-resolution dataset consisting of 800 samples for training, 100 for validation, and 100 for testing purposes. After that, we test our generated models on standard benchmarks such as Set5~\cite{bevilacqua2012low}, Set14~\cite{zeyde2010single}, B100~\cite{arbelaez2010contour}, and Urban100~\cite{huang2015single}. The results of our method are evaluated using the peak signal-to-noise ratio (PSNR) and structural similarity index (SSIM) metrics on the Y channel of the YCbCr color space. \begin{table}[!b] \vspace{-0.45cm} \caption{\label{tab:runtime_comparison}Average runtime comparison of the proposed method and other lightweight models. Runtime values are measured using a Pixel 3a phone with input image resolution ($640 \times 480$).} \centering \small \begin{tabular}{lc} \hline \textbf{Architecture} & \textbf{CPU(ms)} \\ \hline Ef+FBNet~\cite{tu2020efficient,wu2019fbnet} & 852 \\ \hline FSRCNN~\cite{dong2016accelerating} & 789 \\ \hline FastDepth~\cite{wofk2019fastdepth} & 458 \\ \hline VDSR~\cite{kim2016accurate} & 425 \\ \hline PyD-Net~\cite{poggi2018towards} & 226 \\ \hline Lite-HRNet~\cite{yu2021lite} & 217 \\ \hline LiDNAS-K~\cite{huynh2021lightweight} & 205 \\ \hline LDP-Seg-Ci & 207 \\ \hline LDP-Depth-K & 204 \\ \hline LDP-Sup-x2 & \textbf{203} \\ \hline \end{tabular} \end{table} \begin{figure*}[!t] \begin{center} \includegraphics[width=0.9\linewidth]{figures/searching_scenarios.pdf} \end{center} \vspace{-0.35cm} \caption{Trade-off between accuracy vs. the number of parameters of best models trained with different searching scenarios on NYU-Depth-v2, Cityscapes and testing on Urban100 dataset.} \vspace{-0.45cm} \label{fig:searching_scenarios} % \end{figure*} We search for optimized models at super-resolution scales $\times 2$ and $\times 4$ on the DIV2K dataset. In both cases, we determine the target compactness of $P=0.8$ with the balance coefficient $\alpha = 0.55$. We then compare the best-performing architectures (LDP-Sup-x2 and LDP-Sup-x4) with recent methods~\cite{esmaeilzehi2021fpnet,ahn2021neural,ahn2018fast,hui2019lightweight,chu2021fast,lai2017deep} on various testing benchmarks. Tables 10 and 11 show that our models produce more competitive results than several state-of-the-art image super-resolution methods while being relatively compact. Our models perform on par with FPNet while being at least $32\%$ smaller in terms of network size. Figure 10 provides visual comparisons on BSD100 and Urban100 benchmarks. The proposed method yields more accurate results than VDSR~\cite{kim2016accurate}, DRRN~\cite{tai2017image}, FSCRNN~\cite{dong2016accelerating} and more precise details than SRCNN~\cite{dong2014learning}, IMDN~\cite{hui2019lightweight}, FPNet~\cite{esmaeilzehi2021fpnet} methods. \begin{figure}[!b] \begin{center} \includegraphics[width=0.72\linewidth]{figures/qualitative_kitti_v2.pdf} \end{center} \vspace{-0.35cm} \caption{Comparison on the Eigen split of KITTI. (a) input image, (b) LDP-Depth-K, (c) LiDNAS-K~\cite{huynh2021lightweight}, (d) DSNet~\cite{aleotti2021real}, (e) PyD-Net~\cite{poggi2018towards}, and (f) FastDepth~\cite{wofk2019fastdepth}. Images in the right column presented zoom-in view for better visualization.} \label{fig:qualitative_kitti} \vspace{-0.35cm} \end{figure} \begin{figure*}[!t] \begin{center} \includegraphics[width=0.84\linewidth]{figures/convergence_v2.pdf} \end{center} \vspace{-0.35cm} \caption{The progress of different searching scenarios on the NYU-Depth-v2, Cityscapes and testing on Urban100 dataset. Charts show the metrics including thresholded accuracy, Mean IoU, peak-signal-to-noise-ratio (PSNR) and the number of parameters vs. the number of searching iterations.} \vspace{-0.25cm} \label{fig:convergence_v2} \end{figure*} \begin{figure}[!b] \begin{center} \includegraphics[width=0.99\linewidth]{figures/grid_search.pdf} \end{center} \vspace{-0.25cm} \caption{Grid search using randomly subsampled sets from the training data to look for good balance coefficient values on NYU-Depth-v2 (left) and KITTI (right).} \label{fig:grid_search} \vspace{-0.25cm} \end{figure} \subsection{Runtime Measurement} We also compare the runtime of our models with state-of-the-art lightweight methods on an Android device using the app from the Mobile AI benchmark developed by Ignatov et al.~\cite{ignatov2021fast}. To this end, we utilize the pre-trained models provided by the authors (Tensorflow~\cite{poggi2018towards}, PyTorch~\cite{wofk2019fastdepth}), convert them to \textit{tflite} and measure their runtime on mobile CPUs. The results in Table~\ref{tab:runtime_comparison} suggest that the proposed approaches produce competing performance, with the potential of running real-time on mobile devices with further optimization. \subsection{Exploration Convergence} We experiment with various settings for the multi-objective balance coefficient ($\alpha$) to assess its effect on the performance. For this purpose, we perform the architecture search with $\alpha$ set to $0.0$, $0.4$, $0.5$, $0.6$, and $1.0$ while the target compactness $P=2.0M$. Figure~\ref{fig:convergence_v2} presents the searching progress for accuracy (left), the number of parameters (center), and validation grade (right) from one parent architecture on NYU-Depth-v2. We observe that, scenario with $\alpha=0.0$ quickly becomes saturated as it only gives reward to the smallest model. Searching with $\alpha=0.4$ favors models with compact size but also with limited accuracy. The case with $\alpha=0.5$ provides a more balanced option, but accuracy is hindered due to fluctuation during searching. The exploration with $\alpha=1.0$ seeks for the network with the best accuracy yet producing significantly larger architecture while the case where $\alpha=0.6$ achieves promising accuracy although with slightly bigger model than the target compactness. \begin{figure*}[ht] \begin{center} \includegraphics[width=0.935\linewidth]{figures/qualitative_nyu_v1.pdf} \end{center} \vspace{-0.5cm} \caption{Comparison on the NYU test set. (a) input image, (b) ground truth, (c) LDP-Depth-N, (d) LiDNAS-N~\cite{huynh2021lightweight}, (e) Ef+FBNet~\cite{tu2020efficient,wu2019fbnet}, and (f) FastDepth~\cite{wofk2019fastdepth}.} \label{fig:qualitative_nyu} \vspace{-0.5cm} \end{figure*} \subsection{Searching Scenarios} To further analyze the outcome of different searching scenarios, we perform architecture searches for \textit{six} parent networks in five settings with $\alpha=0.0, 0.4, 0.5, 0.6, 1.0$ and $P=2.0M$ on NYU-Depth-v2. Results in Figure~\ref{fig:searching_scenarios} show that the best performance models in the case of $\alpha=0.5$ are more spread out, while training instances with $\alpha=0.6$ tend to produce both accurate and lightweight architectures. This, in turn, emphasizes the trade-off between validation accuracy and the network size. \subsection{Balance Coefficient Search} Determining a good balance coefficient value $(\alpha)$ for Eq.~\ref{eq:validation_grade} and~\ref{eq:mutation_exploration_reward} is crucial as it greatly affects the search performance. To this end, we perform grid search on randomly subsampled sets from the training data seeking for the optimized $\alpha$ value. The pattern in Figure~\ref{fig:grid_search} shows that, for NYU-Depth-v2 [4] and KITTI [2], approximately good $\alpha$ values range from $0.5$ to $0.6$. Additionally, the grid search is much faster (only requires $\sim 15$ hours on one dataset), enabling finding good $\alpha$ values when deploying to different datasets. \section{Conclusion} \noindent This paper proposed a novel NAS framework to construct lightweight dense prediction architectures using Assisted Tabu Search and employing a well-defined search space for balancing layer diversity and search volume. The proposed method achieves competitive accuracy on diverse datasets while running faster on mobile devices and being more compact than state-of-the-art handcrafted and automatically generated models. Our work provides a potential approach towards optimizing the accuracy and the network size for dense prediction without the need for manual tweaking of deep neural architectures. {\small \bibliographystyle{ieee_fullname}
{'timestamp': '2022-03-10T02:29:10', 'yymm': '2203', 'arxiv_id': '2203.01994', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.01994'}
arxiv
\section{Conclusion} This paper presents a data collection system that is portable and enables large-scale data collection. Our systems offers better utility for pedestrian behavior research because our systems consists of human verified labels grounded in the metric space, a combination of both top-down views and perspective views, and a human-pushed cart that approximates naturalistic human motion with a socially-aware ``robot". We further couple the system setup with a semi-autonomous labeling process that easily produces human verified labels in order to meet the demands of the large-scale data collected by our hardware. Lastly, we present the TBD pedestrian dataset we have collected using our system, which not only surpasses the quantity of similar datasets, but also offers unique pedestrian interaction behavior that adds to the qualitative diversity of pedestrian interaction data. A key concern about our current data collection setup is that our sensors consist purely of cameras. For better labeling accuracy, we are exploring whether adding a LiDAR will aid the autonomous tracking of pedestrians and produce more accurate labels. We also plan to continue making improvements to our software system and underlying methods. Although the semi-autonomous labeling process speeds up the labeling of pedestrians significantly, the bottleneck to produce huge quantities of data still lies in correcting the few erroneous tracking outcomes of the automatic tracking procedures. A centralized user interface is under development to better document these tracking errors and to provide intuitive tools to fix them. As mentioned earlier, our approach enables additional data collection in a wide range of locations and constraints. Additional data collection and public updates to this initial dataset are planned. In particular, we would like to collect additional data from the same atrium to increase the current sample size and possibly see more variability in behavior due to population shifts (university populations are constantly changing). Our goal is to increase usability by others and inspire more datasets to be generated using our approach. Interested parties should note that local ethics regulations may require care and limits on what can be released. Our dataset was collected under Institutional Review Board (IRB) oversight, including aspects related to public data sharing. For example, we posted signs at all entry points indicating recording was in progress and suggested alternate routes for those who did not wish to be filmed. This may be less necessary in locations where there is less expectation of privacy (e.g., extensive security cameras, locations with high frequency of social media recording, very public settings, etc). In closing, this paper documents a new method for collecting naturalistic pedestrian behavior. A novel dataset is also provided to illustrate how this technique provides value over existing datasets and so that other groups can advance their own research. We hope this effort enables many new discoveries. \section{Evaluation} \label{sec:evaluation} \subsection{Comparison with Existing Datasets} \label{sec:eval-compare} Compared to existing datasets collected in pedestrian natural environments, our TBD pedestrian dataset contains three components that greatly enhances the dataset's utility. These components are: \begin{enumerate} \item \textbf{Human verified labels grounded in metric space.} As mentioned in section \ref{sec:related-dsetuse}, ETH \cite{ETH} and UCY \cite{UCY} datasets are very popular and are the only datasets to be included during the evaluation of various research models in many papers. This is largely because the trajectory labels in these datasets are human verified, unlike \cite{edinburgh}, \cite{cff}, \cite{grandcentral}, and \cite{atc} that solely rely on automatic tracking to produce labels. These trajectory labels are also grounded in metric space rather than image space (e.g. \cite{stanforddrone} and \cite{towncentre} only contain labels in bounding boxes). Having labels grounded in metric space eliminates the possibility that camera poses might have an effect on the scale of the labels. It also makes the dataset useful for robot navigation related research because robots plan in the metric space rather than image space. \item \textbf{Combination of top-down views and perspective views.} Similar to datasets with top-down views, we use top-down views to obtain ground truth trajectory labels for every pedestrian present in the scene. Similar to datasets with perspective views, we gather perspective views from a ``robot" to imitate robot perception of human crowds. A dataset that contains both top-down views and perspective views will be useful for research projects that rely on perspective views. This allows perspective inputs to their models, while still having access to ground truth knowledge of the entire scene. Examples include pedestrian motion prediction given partial observation of the scene and robot navigation research projects that only have onboard sensors as inputs to navigation models. \item \textbf{Naturalistic human behavior with the presence of a ``robot".} Unlike datasets such as \cite{lcas} or \cite{jrdb}, the ``robot" that provides perspective view data collection is a cart being pushed by human. As mentioned in section \ref{sec:hardware}, doing so reduces the novelty effects from the surrounding pedestrians. Having the ``robot" being pushed by humans also ensures safety for the pedestrians and its own motion has more natural human behavior. As such, the pedestrians also react naturally around the robot by treating it as another human agent. \end{enumerate} \begin{table}[ht] \caption{A survey of existing pedestrian datasets on how they incorporate the three components in section \ref{sec:eval-compare}. For component 1, a ``No" means either not human verified or not grounded in metric space. For component 2, TD stands for ``top-down view" and ``P" stands for ``perspective view".} \label{tab:survey} \begin{center} \begin{tabular}{c||ccc} \toprule Datasets & Comp. 1 & Comp. 2 & Comp. 3\\ & (metric labels) & (views) & (``robot") \\ \hline TBD (Ours) & Yes & TD + P & Human + Cart \\ ETH \cite{ETH} & Yes & TD & N/A \\ UCY \cite{UCY} & Yes & TD & N/A \\ Edinburgh Forum \cite{edinburgh} & No & TD & N/A \\ VIRAT \cite{virat} & No & TD & N/A \\ Town Centre \cite{towncentre} & No & TD & N/A \\ Grand Central \cite{grandcentral} & No & TD & N/A \\ CFF \cite{cff} & No & TD & N/A \\ Stanford Drone \cite{stanforddrone} & No & TD & N/A \\ L-CAS \cite{lcas} & No* & P & Robot\\ WildTrack \cite{wildtrack} & Yes & TD & N/A\\ JackRabbot \cite{jrdb} & Yes & P & Robot\\ ATC \cite{atc} & No & TD & N/A\\ TH\"OR \cite{thor} & Yes & TD + P & Robot\\ \bottomrule \end{tabular} \end{center} \end{table} As shown in Table \ref{tab:survey}, current datasets only contain at most two of the three components\footnote{*L-CAS dataset does provide human verified labels grounded in the metric space. However, its pedestrian labels do not contain trajectory data, which means this dataset has limited usage in pedestrian behavior research, so we put ``No" here.}. A close comparison is the TH\"OR dataset \cite{thor}, but its perspective view data are collected by a robot. Additionally, unlike all other datasets in Table \ref{tab:survey}, the TH\"OR dataset is collected in a controlled lab setting rather than in the wild. This injects artificial factors into human behavior, making them unnatural. \subsection{Dataset Statistics} \label{sec:eval-stats} \begin{table}[ht] \caption{Comparison of statistics between our dataset and other datasets that provide human verified labels grounded in the metric space. For total time length, 51 minutes of our dataset includes the perspective view data.} \label{tab:stats} \begin{center} \begin{tabular}{c||ccc} \toprule Datasets & Time length & \# of pedestrians & Label freq (Hz)\\ \hline \multirow{2}{*}{TBD (Ours)} & 133 mins & \multirow{2}{*}{1416} & \multirow{2}{*}{60} \\ & (51 mins) & & \\ ETH \cite{ETH} & 25 mins & 650 & 15 \\ UCY \cite{UCY} & 16.5 mins & 786 & 2.5 \\ WildTrack \cite{wildtrack} & 200 sec & 313 & 2\\ JackRabbot \cite{jrdb} & 62 mins & 260 & 7.5\\ TH\"OR \cite{thor} & 60+ mins & 600+ & 100\\ \bottomrule \end{tabular} \end{center} \end{table} Table \ref{tab:stats} demonstrates the benefit of a semi-automatic labeling pipeline. With the aid of an autonomous tracker, humans only need to verify and make occasional corrections the tracking outcomes instead of locating the pedestrians on every single frame. The data we have collected so far already surpassed all other datasets that provide human verified labels in the metric space in terms of total time, number of pedestrians and labeling frequency. We will continue this effort and collect more data for future works. It is worth noting that the effect of noise becomes larger with higher labeling frequency. We provide high frequency labeling so that more information and details can be available on the trajectories. When using our data, we recommend downsampling so that noise will have a lesser effect on pedestrian behavior modeling. \subsection{Qualitative Pedestrian Behavior} \begin{figure}[thpb] \centering \includegraphics[scale=0.68]{imgs/qual.jpg} \caption{Example scenes from the TBD pedestrian dataset. a) a dynamic group. b) a static conversational group. c) a large tour group with 14 pedestrians. d) a pedestrian affecting other pedestrians' navigation plans by asking them to come to the table. e) pedestrians stop and look at their phones. f) two pedestrians change their navigation goals and turn towards the table. g) a group of pedestrians change their navigation goals multiple times. h) a crowded scene where pedestrians are heading towards different directions.} \label{fig:qual} \end{figure} Due to the nature of the environment where we collected the data as described in Section \ref{sec:hardware}, we observe a mixture of corridor and open space pedestrian behavior, many of which are rarely seen in other datasets. As shown in Figure \ref{fig:qual}, we observe both static conversation groups and dynamic walking groups. In one instance, a tour group of 10+ pedestrians entered our scene. We also observe that some pedestrians naturally change goals mid-navigation, which results in turning behavior. Due to the timing of our data collection, we also observe ongoing activities where several students set up tables and engage people passing by. This activity produces additional interesting pedestrian interaction analogous to sellers touting and buyers browsing. \section{Introduction} Pedestrian datasets are essential tools for designing socially appropriate robot behaviors, recognizing and predicting human actions, and studying pedestrian behavior. A generally accepted assumption for these datasets is that real-world pedestrians are experts in analyzing and navigating human crowds because they are proficient at behaving in accordance to social interaction norms. Behavioral or practical research related to pedestrian motion likely involves constructing a model that captures these social interactions and movements. In general, existing datasets have been collected in support specific research questions, leading to inadvertent limitations on utility towards certain research questions. This paper describes our efforts to collect and create a dataset that supports a larger array of research questions. \begin{figure}[h] \centering \includegraphics[scale=0.31]{imgs/combo.jpg} \caption{Our dataset consists of human verified labeling in metric space, a combination of top-down views and perspective views, and a cart to imitate socially appropriate robot behavior. This set of images represent the same moment recorded from multiple sensors: a) Top-down view image taken by a static camera with ground truth pedestrian trajectory labels shown. b) Perspective-view image from a 360 camera that captures high definition videos of nearby pedestrians. c) Perspective-view RBG and depth images from a stereo camera mounted on a cart that is used to imitate onboard robot sensors.} \label{fig:intro} \end{figure} For example, researchers may use these data to predict future pedestrian motions, including forecasting their trajectories \cite{Alahi1, Gupta1, Sophie, Social-STGCNN, ivanovic-trajectron}, and/or navigation goals \cite{kitani-2012, liang2020garden}. In social navigation, datasets can also be used to model interactions. For example, a key problem researchers have tried to address is the \textit{freezing robot problem} \cite{Trautman1}, in which the robot becomes stuck in dense, crowded situations while trying to be deferential to human movements for safety or end user acceptance reasons. Researchers have attributed this problem to robot's inability to model interactions \cite{sun2021move}. In other words, most current navigation algorithms do not consider pedestrian reactions and assume a non-cooperative environment. Some works \cite{nishimura2020risk} have used datasets to show that modeling the anticipation of human reactions to the robot's actions enables the robot to deliver a better performance. However, interactions are diverse and can be rare occurrences in human crowds. Although robotic systems typically have access to each pedestrian's basic properties (e.g., position and velocity), inter-pedestrian interactions are less frequent because interactions require the presence of two or more pedestrians that usually need to be in close proximity of each other. While data documenting interactions is more limited, some work has made progress on this front. For example, Sch\"oller et al. \cite{constant-velocity-model} has shown that a linear acceleration based method can perform comparably with deep learning based models in pedestrian trajectory prediction settings. This implies that pedestrians mostly walk in linear fashion, a default behavior when not interacting with other pedestrians. Additionally, pedestrian interactions can be very diverse, especially in certain contexts. Some categories of interactions that researchers have devised include collision avoidance, grouping \cite{wang-split-merge}, and leader-follower \cite{kothari2021human}. The details of these types of interactions can further be diversified by the environment (e.g. an open plaza or a narrow corridor). Mavrogiannis et al. \cite{mavrogiannis_etal2021-core-challenges} provides more details on interaction types. In order to better capture and model interactions to improve the performance of various pedestrian-related algorithms, considerably more data is needed across a variety of environments. To this end, we have constructed a data collection system that can achieve these two requirements: large quantity and environment diversity. First, we ensure that our equipment is completely portable and easy to set up. This allows collecting data in a variety of locations with limited lead time. Second, we address the challenge of labeling large quantities of data using a semi-autonomous labelling pipeline. We employ a state-of-the-art deep learning based \cite{zhang2021bytetrack} tracking module combined with various post-processing procedures to automatically produce high quality ground truth pedestrian trajectories in metric space. As mentioned earlier, current datasets tend to be focused on specific pedestrian research questions. In contrast, our dataset approach offers various improvements and aims to accommodate a wide variety of pedestrian behavior research. Specifically, we include three important characteristics: (1) ground truth labeling in metric space, (2) perspective views from a moving agent, and (3) natural human motion. To the best of our knowledge, publicly available datasets only have two of these characteristics, but not all three. To achieve this, we use multiple static cameras to ensure greater labelling accuracy. We offer both top-down and perspective views with the perspective-views supplied by cameras mounted on a cart. We use a cart pushed by one of our researchers to imitate a robot navigating through the crowd. Using a cart instead of a robot reduces the novelty effect from pedestrians \cite{brvsvcic2015escaping}, thereby capturing more natural pedestrian reactions, and increases the naturalness of the perspective-view ego motion. In this paper we also demonstrate our system through a dataset collected in a large indoor space: the TBD pedestrian dataset\footnote{\href{https://tbd.ri.cmu.edu/tbd-social-navigation-datasets}{https://tbd.ri.cmu.edu/tbd-social-navigation-datasets}}. Our dataset contains scenes that with a variety of crowd densities and pedestrian interactions that are unseen in other datasets. This dataset can be used to complement existing datasets by injecting a new data environment and more pedestrian behavior distribution into existing dataset mixtures, such as \cite{kothari2021human}. In summary, our contribution are as follows: \begin{itemize} \item We implement a novel data collection system that is portable and allows large-scale data collection. Our system also contains a pushed cart with mounted cameras to simulate robot navigation. This allows naturalistic data to be collected from a perspective view on a dynamic agent, thereby enabling model performance validation for robots lacking overhead views from infrastructure. \item We devise a semi-autonomous labeling pipeline that enables convenient grounding of pedestrians. This pipeline consists of a deep learning-based pipeline to track pedestrians and downstream procedures to generate pedestrian trajectories in the metric space. \item We provide a high quality large-scale pedestrian dataset. The data are collected both from overhead and perspective views and are labelled in both pixel space and the metric space for more practical use (e.g., in a social navigation setting). \end{itemize} \section{Related Work} \subsection{Pedestrian Data in Research} \label{sec:related-dsetuse} As is expected from the explosion of data-hungry machine learning methods in robotics, demand for pedestrian datasets has been on the rise in recent years. One popular category of research in this domain is human trajectory prediction (e.g., \cite{Alahi1, Gupta1, Sophie, Social-STGCNN, ivanovic-trajectron, kitani-2012, liang2020garden, wang-split-merge}). Much of this research utilizes selected mechanisms to model pedestrian interactions in hopes for better prediction performance (e.g., pooling layers in the deep learning frameworks \cite{Alahi1, Gupta1} or graph-based representations \cite{Social-STGCNN}). Rudenko et al. \cite{rudenko2019-predSurvey} provides a good summary into this topic. While the state-of-the art performance keeps improving with the constant appearance of newer models, it is often unclear how well these models can generalize in diverse environments. As shown in \cite{rudenko2019-predSurvey}, many of these models only conduct their evaluation on the relatively small-scale ETH \cite{ETH} and UCY \cite{UCY} datasets. Another popular demand for pedestrian datasets comes from social navigation research. Compared to human motion prediction research, social navigation research focuses more on planning. For example, social navigation research uses learning-based methods to identify socially appropriate motion for better robot behavior, such as deep reinforcement learning \cite{Everett18_IROS, chen2019crowd, Chen-gaze-learn} or inverse reinforcement learning \cite{okal-IRL, Tai-IRL}. Due to the lack of sufficiently large datasets, these models often train in simulators that lack realistic pedestrian behavior. Apart from training, datasets are also increasing in popularity in social navigation evaluation due to their realistic pedestrian behavior \cite{gao2021evaluation}. Social navigation methods are often evaluated in environments using pedestrian data trajectory playback (e.g., \cite{trautmanijrr, cao2019dynamic, sun2021move, wang2022group}). However, similar to human motion prediction research, these evaluations are typically only conducted on the ETH \cite{ETH} and UCY \cite{UCY} datasets as shown by \cite{gao2021evaluation}. These two datasets only use overhead views, and therefore lack the perspective view used by most robots. Comparisons between an intial dataset from our data collection system and existing datasets can be found in section \ref{sec:eval-compare}. \subsection{Simulators and Pedestrian Datasets} \label{sec:related-sim-dset} Simulators can fill in the role of datasets for both training and evaluation. Simulators such as PedSIM \cite{gloor2016pedsim}, CrowdNav \cite{chen2019crowd}, SocNavBench \cite{biswas2021socnavbench} and SEAN \cite{tsoi2020sean} are in use by the research community. However, sim-to-real transfer is an unsolved problem in robotics. Apart from lack of fidelity in visuals and physics, pedestrian simulators in particular entail the additional paradox of pedestrian behavior realism \cite{mavrogiannis2021core}: If pedestrian models are realistic enough for use in simulators, why don't we apply the same model to social navigation? In contrast, naturalistic datasets provide realistic pedestrian behavior. Unfortunately, datasets are limited in quantity, unlike simulators that can generate infinite pedestrian scenes. As mentioned in section \ref{sec:related-dsetuse}, most research is still limited to only the ETH and UCY datasets, which are small in scale and lack perspective views. Therefore, such datasets have an additional downside in that pedestrians do not react to the robot. While perspective views can be simulated using inferred laser scans from point perspectives (e.g., \cite{wang-split-merge}), this does not fill the need for camera data from perspective views. Also note that tying the simulated laser scanner location to a moving pedestrian in the data set will likely have unwanted noise in the human tracking. \section{System Description}\label{sec:system} In this work, we introduce a data collection system that is portable and easy to setup that will allow easy collection of large quantities of data. The data collection setup also contains a cart that provides data on naturalistic pedestrian reactions to the robot from a typical perspective view. \subsection{Hardware Setup}\label{sec:hardware} \begin{figure}[tbhp] \centering \includegraphics[scale=0.35]{imgs/cameras.jpg} \caption{Sensor setup used to collect the TBD pedestrian dataset. (left) one of three nodes used to used to capture top-down RGB views. Each node is self contained with an external battery and communicates wirelessly with other nodes. (right) cart used to capture sensor views from the mobile robot perspective during data collection. The cart is powered by an onboard power bank and laptop for time synchronization} \label{fig:camera} \end{figure} As shown in Figure~\ref{fig:hdc_setup}, we positioned three FLIR Blackfly RGB cameras (Figure~\ref{fig:camera}) surrounding the scene on the upper floors overlooking the ground level at roughly 90 degrees apart from each other. Compared to a single overhead camera, multiple cameras ensure better pedestrian labeling accuracy. This is achieved by labeling the pedestrians from cameras that have the highest image resolution of the pedestrians (i.e., closest to pedestrians). The RGB cameras are connected to portable computers powered by lead-acid batteries. We also positioned three more units on the ground floor, but did not use them for pedestrian labeling. In addition to the RGB cameras, we pushed a cart through the scene (Figure~\ref{fig:camera}), which was equipped with a ZED stereo camera to collect both perspective RGB views and depth information of the scene. A GoPro Fusion 360 camera for capturing high definition 360 videos of nearby pedestrians was mounted above the ZED. Data from the on-board cameras are useful in capturing pedestrian pose data and facial expressions. The ZED camera was powered by a laptop with a power bank. Our entire data collection hardware system is portable and does not require power outlets, thereby allowing data collection outdoors or in areas where wall power is not convenient. Cart data was collected multiple times during each data collection session. We pushed the cart from one end of the scene to another end, while avoiding pedestrians and obstacles along the way in a natural motion similar to a human pushing a delivery cart. The purpose of this cart was to represent a mobile robot traversing through the human environment. However, unlike other datasets such as \cite{lcas} or \cite{jrdb} that use a Wizard-of-Oz controlled robot, we used a manually pushed cart. This provided better trajectory control, increased safety, and reduced the novelty effect from pedestrians, as curious pedestrians may intentionally block robots or display other unnatural movements \cite{brvsvcic2015escaping}. The first batch of our data collection occurred on the ground level in a large indoor atrium area (Figure~\ref{fig:hdc_setup}). Half of the atrium area had fixed entry/exit points that led to corridors, elevators, stairs, and doors to the outside. The other half of the atrium was adjacent to another large open area and was unstructured with no fixed entry/exit points. We collected data around lunch and dinner times to ensure higher crowd densities (there was a food court in the neighboring open area). More data will be collected in the future in locations such as transit stations. \subsection{Post-processing and Labeling} A summary of our post processing pipeline is summarized in Figure \ref{fig:system-flowchart}. \label{sec:postprocessing} \begin{figure}[thpb] \centering \includegraphics[scale=0.27]{imgs/flowchart.jpg} \caption{Flowchart for our post-processing pipeline. Blue blocks are preparation procedures and orange blocks are labeling procedures. The green block transforms all trajectory labels onto the ground plane $z=0$.} \label{fig:system-flowchart} \end{figure} \subsubsection{Time synchronization and Calibration}\label{sec:calibration} To ensure time synchronization across the captured videos, we employed Precision Time Protocol over a wireless network to synchronize each of the clocks of the computers powering the cameras, which allows for sub-microsecond synchronization. For redundancy, we held an LED light at a location inside the field of view of all the cameras and switched it on and off at the beginning of each recording session. We then checked for the LED light signal during the post-processing stage to synchronize the starting frame of all the captured videos for each recording session. We observed very little time drift in the individual recording computer clocks throughout the duration of each recording session, meaning that one synchronization point at the beginning of the recording sufficed. Due to the portable nature of our system and the long distances between the cameras and the scene, we used scene reconstruction techniques to retrieve the intrinsics and poses of the cameras. We used Colmap \cite{schonberger2018robust} to perform a 3D reconstruction of the scene and estimated the static camera poses and intrinsics by additionally supplying it with dozens of static pictures of the atrium taken from a smartphone. The effectiveness of obtaining the camera parameters this way may also be applied to future work. For example, it may be possible to use crowdsourced approaches to collect such data when trying to repeat our effort with other camera deployments (e.g., a building atrium with multiple security cameras) since hundreds of images and videos may be available in populous areas. \subsubsection{Ground plane identification}\label{sec:ground} After the 3D reconstruction, the ground plane was not always $z=0$, but $z=0$ usually is the assumption for pedestrian datasets. We first defined an area on the ground plane and selected all the points inside the area $\mathcal{P}$. We then used RANSAC \cite{RANSAC} for maximum accuracy to identify a 2D surface $G$ within $\mathcal{P}$. \begin{equation} G = \text{RANSAC}(\mathcal{P}) \end{equation} Where $G$ is expressed as $g_ax + g_by + g_cz + g_d = 0$. Once the ground plane was identified, it was then trivial to apply simple geometry to identify the homography matrix that transforms the coordinates on $G$ to $G': z=0$. \subsubsection{Cart localization}\label{sec:cart_loc} After the cameras were synchronized and calibrated, the next step was to localize the cart in the scene. This was achieved by first identifying the cart on the static camera videos and then applying the camera matrices to obtain the metric coordinates. We attempted multiple tracking models such as a deep learning based tracking model \cite{chen2019siammaske} on the static camera videos, but the tracking outcomes were unsatisfactory. We later attached a poster-sized AprilTag \cite{olson2011apriltag} on top of the cart for automatic pose estimation of the cart. We also explored other localization methods (e.g., wireless triangulation) and will continue to track progress on large-space localization. For the first batch of data included in our dataset, we manually labeled the locations of the cart. \subsubsection{Pedestrian tracking and labeling}\label{sec:ped} Similar to cart localization, we first tracked the pedestrians on the static camera videos and then identified their coordinates on the ground plane $G$. We found ByteTrack \cite{zhang2021bytetrack} to be very successful in tracking pedestrians in the image space. Upon human verification over our entire first batch of data, ByteTrack successfully aided the trajectory labeling of $91.8\%$ of the pedestrians automatically. \begin{figure}[thpb] \centering \includegraphics[scale=0.215]{imgs/noise.jpg} \caption{Smoothing of noise in auto-generated pedestrian trajectories by applying 3D correction. (left)Left: Raw tracking results from ByteTrack \cite{zhang2021bytetrack} (pixel space). Some noise is present due to human body motion. (right) Accounting for noise in 3D results in more accurate labeling.} \label{fig:noise} \end{figure} Once we obtained the automatically tracked labels in pixel space, we needed to convert them into metric space. However, the process to do so was different from cart localization in section \ref{sec:cart_loc}, where the cart is either manually or automatically tracked (attached AprilTag). For the automatic tracking of pedestrians, the pedestrian's body motions while walking created significant noise, as shown in Figure \ref{fig:noise}. Therefore, the tracking noise was in 3D and assumptions that the noise solely exists on $G$ may result in large labeling inaccuracies. We addressed this issue by estimating 3D metric coordinates from two cameras instead of assuming the metric coordinates to be on the 2D plane $G$ and obtaining these coordinates from a single camera. For each camera, we had a $3\times4$ camera matrix $P$. \begin{equation} P=\begin{bmatrix} \mbox{---}\boldsymbol{p}_1\mbox{---} \\ \mbox{---}\boldsymbol{p}_2\mbox{---} \\ \mbox{---}\boldsymbol{p}_3\mbox{---} \end{bmatrix} \end{equation} Where we had $P_1, P_2, P_3$ for the three cameras respectively. For a given 2D point coordinate $\boldsymbol{x}$ we wanted to estimate its corresponding 3D coordinate $\boldsymbol{X}$, so we had $\boldsymbol{x} = \alpha P\boldsymbol{X}$. We could then apply the cross product technique to eliminate the scalar $\alpha$. This gave us $\boldsymbol{x} \times P\boldsymbol{X} = \boldsymbol{0}$, or more precisely \begin{equation} \begin{bmatrix} y\boldsymbol{p}_3^\top - \boldsymbol{p}_2^\top \\ \boldsymbol{p}_1^\top - x\boldsymbol{p}_3^\top \end{bmatrix}\boldsymbol{X}=\boldsymbol{0} \end{equation} With two cameras $P_i, P_j| i\neq j, \; (i, j) \in \{1, 2, 3\}$, their corresponding 2D image points $(x_i, y_i), (x_j, y_j)$, and the constraint that the 3D coordinates should be on the ground plane $G$, we could construct the following system of equations to estimate the 3D coordinates. \begin{equation} A\boldsymbol{X}=\begin{bmatrix} y_i\boldsymbol{p}_{i,3}^\top - \boldsymbol{p}_{i,2}^\top \\ \boldsymbol{p}_{i,1}^\top - x_i\boldsymbol{p}_{i,3}^\top \\ y_j\boldsymbol{p}_{j,3}^\top - \boldsymbol{p}_{j,2}^\top \\ \boldsymbol{p}_{j,1}^\top - x_j\boldsymbol{p}_{j,3}^\top \\ g_a, g_b, g_c, g_d \end{bmatrix}\boldsymbol{X}=\boldsymbol{0} \end{equation} We could then perform singular value decomposition (SVD) on $A$ to obtain the solution. With ByteTrack, each camera video contained a set of tracked trajectories in the image space $T_i=\{t_1,...,t_n\}, i\in\{1,2,3\}$. We estimated the 3D trajectory coordinates for each pair of 2D trajectories $(t_i, t_j)| t_i\in T_i, t_j\in T_j, i\neq j$ and the set of estimated coordinates that resulted in the lowest reprojection error were selected to be the final trajectory coordinates in the metric space. We then projected these 3D coordinates onto the ground plane $G$ and transformed them to $G'$ to obtain the final metric coordinates. Finally, we performed human verification over the entire tracking output, fixing any errors observed during the process. We also manually identified pedestrians that were outside our target tracking zone but had interactions with the pedestrians inside the tracking zone and included them as part of our dataset. \section{INTRODUCTION} This template provides authors with most of the formatting specifications needed for preparing electronic versions of their papers. All standard paper components have been specified for three reasons: (1) ease of use when formatting individual papers, (2) automatic compliance to electronic requirements that facilitate the concurrent or later production of electronic products, and (3) conformity of style throughout a conference proceedings. Margins, column widths, line spacing, and type styles are built-in; examples of the type styles are provided throughout this document and are identified in italic type, within parentheses, following the example. Some components, such as multi-leveled equations, graphics, and tables are not prescribed, although the various table text styles are provided. The formatter will need to create these components, incorporating the applicable criteria that follow. \section{PROCEDURE FOR PAPER SUBMISSION} \subsection{Selecting a Template (Heading 2)} First, confirm that you have the correct template for your paper size. This template has been tailored for output on the US-letter paper size. It may be used for A4 paper size if the paper size setting is suitably modified. \subsection{Maintaining the Integrity of the Specifications} The template is used to format your paper and style the text. All margins, column widths, line spaces, and text fonts are prescribed; please do not alter them. You may note peculiarities. For example, the head margin in this template measures proportionately more than is customary. This measurement and others are deliberate, using specifications that anticipate your paper as one part of the entire proceedings, and not as an independent document. Please do not revise any of the current designations \section{MATH} Before you begin to format your paper, first write and save the content as a separate text file. Keep your text and graphic files separate until after the text has been formatted and styled. Do not use hard tabs, and limit use of hard returns to only one return at the end of a paragraph. Do not add any kind of pagination anywhere in the paper. Do not number text heads-the template will do that for you. Finally, complete content and organizational editing before formatting. Please take note of the following items when proofreading spelling and grammar: \subsection{Abbreviations and Acronyms} Define abbreviations and acronyms the first time they are used in the text, even after they have been defined in the abstract. Abbreviations such as IEEE, SI, MKS, CGS, sc, dc, and rms do not have to be defined. Do not use abbreviations in the title or heads unless they are unavoidable. \subsection{Units} \begin{itemize} \item Use either SI (MKS) or CGS as primary units. (SI units are encouraged.) English units may be used as secondary units (in parentheses). An exception would be the use of English units as identifiers in trade, such as Ò3.5-inch disk driveÓ. \item Avoid combining SI and CGS units, such as current in amperes and magnetic field in oersteds. This often leads to confusion because equations do not balance dimensionally. If you must use mixed units, clearly state the units for each quantity that you use in an equation. \item Do not mix complete spellings and abbreviations of units: ÒWb/m2Ó or Òwebers per square meterÓ, not Òwebers/m2Ó. Spell out units when they appear in text: Ò. . . a few henriesÓ, not Ò. . . a few HÓ. \item Use a zero before decimal points: Ò0.25Ó, not Ò.25Ó. Use Òcm3Ó, not ÒccÓ. (bullet list) \end{itemize} \subsection{Equations} The equations are an exception to the prescribed specifications of this template. You will need to determine whether or not your equation should be typed using either the Times New Roman or the Symbol font (please no other font). To create multileveled equations, it may be necessary to treat the equation as a graphic and insert it into the text after your paper is styled. Number equations consecutively. Equation numbers, within parentheses, are to position flush right, as in (1), using a right tab stop. To make your equations more compact, you may use the solidus ( / ), the exp function, or appropriate exponents. Italicize Roman symbols for quantities and variables, but not Greek symbols. Use a long dash rather than a hyphen for a minus sign. Punctuate equations with commas or periods when they are part of a sentence, as in $$ \alpha + \beta = \chi \eqno{(1)} $$ Note that the equation is centered using a center tab stop. Be sure that the symbols in your equation have been defined before or immediately following the equation. Use Ò(1)Ó, not ÒEq. (1)Ó or Òequation (1)Ó, except at the beginning of a sentence: ÒEquation (1) is . . .Ó \subsection{Some Common Mistakes} \begin{itemize} \item The word ÒdataÓ is plural, not singular. \item The subscript for the permeability of vacuum ?0, and other common scientific constants, is zero with subscript formatting, not a lowercase letter ÒoÓ. \item In American English, commas, semi-/colons, periods, question and exclamation marks are located within quotation marks only when a complete thought or name is cited, such as a title or full quotation. When quotation marks are used, instead of a bold or italic typeface, to highlight a word or phrase, punctuation should appear outside of the quotation marks. A parenthetical phrase or statement at the end of a sentence is punctuated outside of the closing parenthesis (like this). (A parenthetical sentence is punctuated within the parentheses.) \item A graph within a graph is an ÒinsetÓ, not an ÒinsertÓ. The word alternatively is preferred to the word ÒalternatelyÓ (unless you really mean something that alternates). \item Do not use the word ÒessentiallyÓ to mean ÒapproximatelyÓ or ÒeffectivelyÓ. \item In your paper title, if the words Òthat usesÓ can accurately replace the word ÒusingÓ, capitalize the ÒuÓ; if not, keep using lower-cased. \item Be aware of the different meanings of the homophones ÒaffectÓ and ÒeffectÓ, ÒcomplementÓ and ÒcomplimentÓ, ÒdiscreetÓ and ÒdiscreteÓ, ÒprincipalÓ and ÒprincipleÓ. \item Do not confuse ÒimplyÓ and ÒinferÓ. \item The prefix ÒnonÓ is not a word; it should be joined to the word it modifies, usually without a hyphen. \item There is no period after the ÒetÓ in the Latin abbreviation Òet al.Ó. \item The abbreviation Òi.e.Ó means Òthat isÓ, and the abbreviation Òe.g.Ó means Òfor exampleÓ. \end{itemize} \section{USING THE TEMPLATE} Use this sample document as your LaTeX source file to create your document. Save this file as {\bf root.tex}. You have to make sure to use the cls file that came with this distribution. If you use a different style file, you cannot expect to get required margins. Note also that when you are creating your out PDF file, the source file is only part of the equation. {\it Your \TeX\ $\rightarrow$ PDF filter determines the output file size. Even if you make all the specifications to output a letter file in the source - if your filter is set to produce A4, you will only get A4 output. } It is impossible to account for all possible situation, one would encounter using \TeX. If you are using multiple \TeX\ files you must make sure that the ``MAIN`` source file is called root.tex - this is particularly important if your conference is using PaperPlaza's built in \TeX\ to PDF conversion tool. \subsection{Headings, etc} Text heads organize the topics on a relational, hierarchical basis. For example, the paper title is the primary text head because all subsequent material relates and elaborates on this one topic. If there are two or more sub-topics, the next level head (uppercase Roman numerals) should be used and, conversely, if there are not at least two sub-topics, then no subheads should be introduced. Styles named ÒHeading 1Ó, ÒHeading 2Ó, ÒHeading 3Ó, and ÒHeading 4Ó are prescribed. \subsection{Figures and Tables} Positioning Figures and Tables: Place figures and tables at the top and bottom of columns. Avoid placing them in the middle of columns. Large figures and tables may span across both columns. Figure captions should be below the figures; table heads should appear above the tables. Insert figures and tables after they are cited in the text. Use the abbreviation ÒFig. 1Ó, even at the beginning of a sentence. \begin{table}[h] \caption{An Example of a Table} \label{table_example} \begin{center} \begin{tabular}{|c||c|} \hline One & Two\\ \hline Three & Four\\ \hline \end{tabular} \end{center} \end{table} \begin{figure}[thpb] \centering \framebox{\parbox{3in}{We suggest that you use a text box to insert a graphic (which is ideally a 300 dpi TIFF or EPS file, with all fonts embedded) because, in an document, this method is somewhat more stable than directly inserting a picture. }} \caption{Inductance of oscillation winding on amorphous magnetic core versus DC bias magnetic field} \label{figurelabel} \end{figure} Figure Labels: Use 8 point Times New Roman for Figure labels. Use words rather than symbols or abbreviations when writing Figure axis labels to avoid confusing the reader. As an example, write the quantity ÒMagnetizationÓ, or ÒMagnetization, MÓ, not just ÒMÓ. If including units in the label, present them within parentheses. Do not label axes only with units. In the example, write ÒMagnetization (A/m)Ó or ÒMagnetization {A[m(1)]}Ó, not just ÒA/mÓ. Do not label axes with a ratio of quantities and units. For example, write ÒTemperature (K)Ó, not ÒTemperature/K.Ó \section{CONCLUSIONS} A conclusion section is not required. Although a conclusion may review the main points of the paper, do not replicate the abstract as the conclusion. A conclusion might elaborate on the importance of the work or suggest applications and extensions. \addtolength{\textheight}{-12cm} \section*{APPENDIX} Appendixes should appear before the acknowledgment. \section*{ACKNOWLEDGMENT} The preferred spelling of the word ÒacknowledgmentÓ in America is without an ÒeÓ after the ÒgÓ. Avoid the stilted expression, ÒOne of us (R. B. G.) thanks . . .Ó Instead, try ÒR. B. G. thanksÓ. Put sponsor acknowledgments in the unnumbered footnote on the first page. References are important to the reader; therefore, each citation must be complete and correct. If at all possible, references should be commonly available publications. \section*{ACKNOWLEDGMENT} This work was supported by grants (IIS-1734361 and IIS-1900821) from the National Science Foundation. { \bibliographystyle{IEEEtranS}
{'timestamp': '2022-03-07T02:01:26', 'yymm': '2203', 'arxiv_id': '2203.01974', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.01974'}
arxiv
\section{Introduction} Experimental biologists and clinicians seek a deeper understanding of biological processes and their link with disease phenotypes by characterizing cell behavior. Gene expression offers a fruitful avenue for insights into cellular traits and changes in cellular state. Advances in technology that enable the measurement of RNA levels for individual cells via Single-cell RNA sequencing (scRNA-seq) significantly increase the potential to advance our understanding of the biology of disease by capturing the heterogeneity of expression at the cellular level \citep{Haque:2017}. Gene differential expression analysis, which contrasts the marginal expression levels of genes between groups of cells, is the most commonly used mode of analysis to interrogate cellular heterogeneity. By contrast, the relational patterns of gene expression have received far less attention. The most intuitive relational effect is gene co-expression, a synchronization between gene expressions, which can vary dramatically among cells. Converging evidence has revealed the importance of co-expression among genes. When looking at a collection of highly heterogeneous cells, such as cells from multiple cell types, significant gene co-expression may indicate rich cell-level structure. Alternatively, when looking at a batch of highly homogeneous cells, gene co-expression could imply gene cooperation through gene co-regulation \citep{raj2006stochastic,Emmert-Streib:2014}. Biochemistry offers a complementary motivation for the advantages of studying co-expression in addition to marginal expression levels of genes. The biological system of a cell is generally described by a non-linear dynamical system in which gene expression is variable \citep{raj2006stochastic}. Therefore, the observed gene expression level varies by time and condition, even within the same cell, while the cooperation between genes is more stable over time and condition. For this reason, it can be argued that co-expression may more reliably characterize the biological system or state of the cell \citep{dai2019cell}. scRNA-seq, allows us to investigate gene co-expression at different resolutions, to understand not only how genes interact with each other within different cells, but also how the interactions relate to cell heterogeneity. The recent work by \cite{dai2019cell} attempts an ambitious task: characterizing the gene co-expression at a single cell level (termed ``cell-specific network'' CSN). Specifically, for a pair of genes and a target cell, \citet{dai2019cell} construct a 2-way $2\times2$ contingency table test by binning all the cells based on whether they are in the marginal neighborhoods of the target cell and assigning the test results as a binary indicator of gene association in the target cell. Viewed over all gene pairs, the result is a cell-specific gene network. Forgoing interpretation of the detected associations, they utilize the CSN to obtain a data transformation. Specifically, they replace the transcript counts in the gene-by-cell matrix with the degree sequence of each cell-specific network. Although this data transformation shows encouraging success in various downstream tasks, such as cell clustering, it remains unclear what the detected ``cell-specific'' gene association network really represents. The implementation details and interpretation of the results are presented at a heuristic level, making it difficult for others to appreciate and generalize this line of work. In a follow-up paper, \cite{wang2021constructing} take the first steps to capitalize on the CSN approach by redirecting the concept to obtain an estimator of co-expression. Specifically, they propose averaging the ``cell specific" gene association indicators over cells in a class to recover a global measure of gene association (avgCSN). The resulting measure performs remarkably well in certain simulations and detailed empirical investigations of brain cell data. Compared to Pearson's correlation, the avgCSN gene co-expression appears less noisy and provides more accurate edge estimation in simulations. It is also more powerful in a test to uncover differential gene networks between diseased and control brain cells. Finally, it provides biologically meaningful gene networks in developing cells. The empirical success of avgCSN likely lies in the nature of gene expression data: often noisy, sparse and heterogeneous, meaning not all cells exhibit co-expression at all times due to cellular state and conditions. For this reason, a successful method must be robust and sensitive to local patterns of dependencies. {\color{black} Being an average of a series of binary local contingency table tests, the error in each entry of avgCSN is limited, meanwhile the non-negative summands ensure that local patterns are not cancelled out. By contrast, measures like Pearson's correlation can have both negative and positive summands, and therefore the final value can be small even if the dependence structure is clear for a subset of the cells.} To make the method more stable, \cite{wang2021constructing} proposed some heuristic and practical techniques to compute avgCSN, for which we would like to have more principled insights. Examples are the choice of window size in defining neighborhoods in the local contingency table test, the choice of thresholding in constructing an edge, and the range of cells to aggregate over. Many natural questions emerge: how does avgCSN relate to other gene co-expression measures and the full range of general univariate dependence measures, and why does it perform well in practice? Through theoretical analysis and extensive experimental evaluations, we address these questions, revealing that avgCSN is an empirical estimator of a new dependency measure, which enjoys various advantages over the existing measures. For comparison, we briefly review the related work in gene co-expression measures and general univariate dependence. Since the work by \citet{eisen1998cluster}, Pearson's correlation has been the most popular gene co-expression measure for its simple interpretation and fast computation. However, Pearson's correlation fails to detect non-linear relationships and is sensitive to outliers. Another class of co-expression methods is based on mutual information (MI) \citep{bell1962mutual,steuer2002mutual,daub2004estimating}. The computation of MI involves discretizing the data and tuning parameters, and the dependence measure does not have an interpretable scale. \citet{reshef2011detecting} proposed the maximal information coefficient (MIC) as an extension of MI, but MIC was shown to be over-sensitive in practice. More comparisons of different co-expression measures and the constructed co-expression networks can be found in \cite{song2012comparison,allen2012comparing}. In the broader statistical literature, the problem of finding gene co-expression is closely related to that of detecting univariate dependence between two random variables. Specifically, for a pair of univariate random variables $X, Y$, how to measure the dependence between them has been a long-standing problem. The problem is often described as finding a function $\delta(X,Y)$, which measures the discrepancy between the joint distribution $F_{XY}$ and product of marginal distribution $F_{X}F_{Y}$. Numerous solutions to this problem have been provided: include the Renyi correlation \citep{renyi1959measures} measuring the correlation between two variables after suitable transformations; various regression-based techniques; Hoeffding’s D \citep{hoeffding1948non}, distance correlation (dCor) \citep{szekely2007measuring}, kernel-based measure like HSIC \citep{gretton2005measuring} and rank based measure like Kendall's $\tau$ and the refinement later, $\tau^\star$ \citep{bergsma2014consistent}. Most of these methods have not yet been widely adopted in genetics applications. Aside from avgCSN, the methods mentioned so far do not specifically target dependence relationships that are local and often assume the data are random samples from a common distribution (in contrast with a mixture distribution) in the theoretical analysis. However, real gene interactions may change as the intrinsic cellular state varies and may only exist under specific cellular conditions. Furthermore, with data integration now being a routine approach to combat the curse of dimensionality, samples from different experimental conditions or tissue types are likely to possess different gene relationships and thus create more complex situations for detecting gene interactions. In this setting, much like avgCSN, an ideal measure accumulates subtle local dependencies, possibly only observed in a subset of the cells. A co-expression measure that aims to detect local patterns, developed by \cite{wang2014gene}, counts the proportion of matching patterns of local expression ranks as the measure of gene co-expression. Specifically, they aggregate the gene interactions across all subsamples of size $k$. However, despite its promising motivation, it has low power to detect non-monotone relationships. MIC \citep{reshef2011detecting} and HHG \citet{heller2013consistent} are also measures that attempt to account for local patterns of dependencies. In this paper, we first give a detailed review of the related methods in \secref{aLDGintr}. Then in \secref{pop}, we show that avgCSN is indeed an empirical estimate of a valid dependence measure, which we define as averaged Local Density Gap (aLDG). In \secref{robpop} and \secref{emp}, we formally establish its statistical properties, including estimation consistency and robustness. We also investigate data-adaptive hyperparameter selection to justify and refine the heuristic choices in application in \secref{chooset}. Finally, we provide a systematic comparison of aLDG and its competitors via both simulation and real data examples in \secref{aLDGcompare}. \section{A brief review of dependence and association measures}\label{sec:aLDGintr} Before starting on the description of the various dependence measures, let us remark that \citet{renyi1959measures} proposed that a measure of dependence between two stochastic variables $X$ and $Y$, $\delta(X,Y)$, should ideally have the following properties: \begin{enumerate} \item[(i)] $\delta(X,Y)$ is defined for any $X,Y$ neither of which is constant with probability $1$. \item[(ii)] $\delta(X,Y)$=$\delta(Y,X)$. \item[(iii)] $0\leq \delta(X,Y) \leq 1$. \item[(iv)] $\delta(X,Y)=0$ if and only if $X$ and $Y$ are independent. \item[(v)] $\delta(X,Y)=1$ if either $X=g(Y)$ or $Y=f(X)$, where $f$ anf $g$ are measurable functions. \item[(vi)] If the Borel-measurable functions $f$ and $g$ map the real axis in a one-to-one way to itself, then $\delta(f(X),g(Y))=\delta(X,Y)$. \end{enumerate} Particularly, a measure satisfying (iv) is called a strong dependence measure. Apart from the above properties, there are two more properties that are particularly useful in single-cell data analysis. Single-cell data often contain a significant amount of noise, among which outliers account for a non-negligible fraction. Therefore \emph{robustness} is a desirable property in a dependence measure. Specifically, keeping with previous literature \citep{dhar2016study}, by robustness we mean that the value of the measure does not change much when a small contamination point mass, far away from the main population, is added. A formal description and corresponding evaluation metric will be described later. Another often overlooked property is \emph{locality}, which is a relatively novel concept and has not been properly defined to the best of our knowledge. Nevertheless, this concept has been catching attention over the recent decade \citep{reshef2011detecting,heller2013consistent,heller2016consistent,wang2014gene}, especially in work motivated by genetic data analysis. \emph{Locality} targets a special kind of dependence relationship that is generally restricted to a particular neighborhood in the sample space. A natural example is dependence that occurs in some, but not necessarily all of the components in a finite mixture. Another is dependence within a moving time window in a time series. Generally speaking, the interactions change as the hidden condition varies, or only exist under a specific hidden condition. A dependence measure that is \emph{local} should be able to accumulate dependence in the local regions. No measure has all of the properties mentioned above, as far as we know. Our new measure possesses all but properties (v) and (vi). In the following, we review a selected list of univariate dependence measures in more details. \subsection{Moment based measures} The first class of methods is based on various moment calculations. The main advantage is fast computation and minimum tuning, while the main drawback is non-robustness to outliers from their moment-based nature. \paragraph*{Pearson's correlation} The simplest measure is the classical Pearson’s correlation: \begin{equation} \text{Pearson's}\ \rho(X,Y):= \frac{\text{Cov}(X,Y)}{\sqrt{\text{Var}(X)\text{Var}(Y)}}. \end{equation} Plugin the sample estimation of covariance and variance, consistency and asymptotic normality can be proven using law of large numbers and the central limit theorem, respectively. Pearson's $\rho$ has been, and probably still is, the most extensively employed measure in statistics, machine learning, and real-world applications, due to its simplicity. However, it is known to detect only linear relationships. Also, as is the case for regression, it is well known that the product-moment estimator is sensitive to outliers: even just a single outlier may have substantial impact on the measure. \paragraph*{Maximal correlation} The maximal correlation (MC) is based on Pearson's $\rho$. It is constructed to avoid the problem that Pearson's $\rho$ can easily be zero even if there is strong dependence. \citet{gebelein1941statistische} first propose MC as \begin{equation} \text{MC}(X,Y) := \sup_{f,g} \rho(f(X),g(X)). \end{equation} Here the supremum is taken over all Borel-measurable functions $f,g$ with finite and positive variance for $f(X)$ and $g(Y)$. The measure MC can detect non-linear relationships, and in fact, it is a strong dependence measure. However, often MC cannot be evaluated explicitly except in special cases, because there does not always exist functions $f_0$ and $g_0$ such that $\text{MC} = \rho(f_0(X), g_0(Y))$. Also, it has been found to be overly ``sensitive'', i.e. it gives high value for distributions arbitrarily ``close'' to independence in practice. \paragraph*{Distance correlation} A recent surge of interests has been placed on using distance metrics to achieve consistent independence testing against all dependencies. A notable example is the distance correlation (dCor) proposed by \citet{szekely2007measuring}: \begin{align} \text{dCor} (X,Y)& := \frac{V(X,Y)}{\sqrt{V(X,X)V(Y,Y)}}, \\ & \quad \text{where } V(X,Y)=\mathbb{E}{|X-X'||Y -Y'|} + \mathbb{E}{|X - X'|}\mathbb{E}{|Y - Y'|}\\ & \quad \quad \quad \quad \quad \quad \quad \quad \quad - 2\mathbb{E}_{X,Y}\Big[{\mathbb{E}_{X'}|X-X'| \mathbb{E}_{Y'}|Y - Y'|}\Big], \nonumber \end{align} with $(X',Y')$ an i.i.d copy of $(X,Y)$. The distance correlation enjoys universal consistency against any joint distribution of finite second moments; however, in practice, it does not work well for non-monotone relationship \citep{shen2020distance}. Also, it is not robust from its moment based nature, as proven by \citet{dhar2016study}. \paragraph*{HSIC} Recall the definition and formula for the maximal correlation, about which we mentioned it is difficult to compute since it requires the supremum of the correlation $\rho(f(X),g(Y))$ taken over Borel-measurable $f$ and $g$. In the framework of reproducing kernel Hilbert spaces (RKHS), it is possible to pose this problem and compute an analogue of MC quite easily. A state-of-the-art method in this direction is the so-called Hilbert-Schmidt Independence Criterion (HSIC) \citep{gretton2005measuring}. Denote the support of $X$ and $Y$ as $\mathcal{X}$ and $\mathcal{Y}$ respectively, HSIC considers $f,g$ to be in RKHS $\mathcal{F}$ and $\mathcal{G}$ of functionals on sets $\mathcal{X}$ and $\mathcal{Y}$ respectively. Then HSIC is defined to be the Hilbert-Schmidt (HS) norm of a Hilbert-Schmidt operator. We refer the reader to \cite{gretton2005measuring} for detailed description. What might be of interest is that, in many cases, HSIC is equivalent to dCor. \subsection{Rank based measure} Another line of work based on ordinal statistics is developed in parallel to the moment-based methods. A random variable $X$ is called ordinal if its possible values have an ordering, but no distance is assigned to pairs of outcomes. Ordinal data methods are often applied to data in order to achieve robustness. \paragraph*{Spearman's $\rho_S$, Kendall's $\tau$ and $\tau^\star$} The two most popular measures of dependence for ordinal random variables $X$ and $Y$ are Kendall’s $\tau$ and Spearman’s $\rho_S$. Both Kendall's $\tau$ and Spearman's $\rho_S$ are proportional to sign versions of the ordinary covariance, which can be seen from the following expressions for the covariance: \begin{align*} \text{Cov}(X,Y) &= \frac12\EE{(X - X')(Y - Y')} \propto \text{Kendall} \\ & =\EE{(X' -X'')(Y' -Y''')} \propto \text{Spearman}, \end{align*} where $(X',Y'), (X'',Y''), (X''', Y''')$ are i.i.d replications of $(X,Y)$. Note that Kendall's $\tau$ is simpler than Spearman's $\rho_S$ in the sense that it can be defined using only two rather than three independent replications of $(X, Y)$, so often Kendall's $\tau$ is preferred. A concern from certain applications is that Kendall's $\tau$ and Spearman's $\rho_S$ are not \emph{strong} dependence measures, so tests based on them are inconsistent for the alternative of a general dependence. In fact, it is often observed that they have difficulty detecting nonmonotone relationship. Later, an extension $\tau^\star$ \citep{bergsma2014consistent} mitigates such deficiency by modifying Kendall's $\tau$ to a strong measure. \paragraph*{Hoeffding's D and BKR} Related to the ordinal statistics-based methods, another class of methods start from the cumulative distribution function (CDF), some of which are equivalent to ordinal forms due to the relationship between CDF and ranks. The oldest example is the Hoeffing's D proposed by \citet{hoeffding1948non}: \[ \text{Hoeffing's D} := \mathbb{E}_{X,Y} \Big[(F_{X,Y} - F_{X}F_{Y})^2\Big], \] where $F_X$, $F_Y$, $F_{X,Y}$ are the CDF of $X$, $Y$, $(X,Y)$ respectively. Still, Hoeffing's D is not a strong measure, while its modified version BKR \citep{blum1961distribution}: \[ \text{BKR} := \mathbb{E}_{X}\mathbb{E}_{Y} \Big[(F_{X,Y} - F_{X}F_{Y})^2\Big] \] is. It turns out Hoeffding's D belongs to a more general family of coefficients, which can be formulated as \[ \text{C}_{gh} := \int g(F_{X,Y} - F_{X}F_{Y}) d h(F_{XY}) \] for some $g$ and $h$. We will abbreviate Hoeffding's D as HoeffD in the figures in the remainder of paper. \subsection{Dependence measures aware of local patterns} Most of the methods mentioned so far do not specifically target dependence relationships that can be local in nature. In the following, we describe a few measures that were designed to capture complex relationships, whether local or not. \paragraph*{Maximal Information Coefficient} The idea behind the Maximal Information Coefficient (MIC,\cite{reshef2011detecting} statistic consists in computing the mutual information locally over a grid in the data set and then take as statistic the maximum value of these local information measures over a suitable choice of grid. However, several examples were given in \citet{simon2014comment} and \citet{gorfine2012comment} where MIC is clearly inferior to dCor. \paragraph*{HHG} \citet{heller2013consistent} pointed out another way to account for local patterns: that is, looking at dependence locally and then aggregating the dependence over the local regions. The local regions is simply defined as bins via partitioning the sample space. Additionally, HHG takes a multi-scale approach: multiple sample space partitions are conducted, and results are aggregated over all of them. This results in a provably consistent permutation test. However, the cost of implementation is significantly longer computation time than its competitors: it takes $O(n^3)$ computation time while its competitors normally take at most $O(n^2)$. \paragraph*{Matching ranks} Another method that developed specifically for accounting local pattern is proposed by \citep{wang2014gene}. Given $n$ pair of observations of $(X,Y)$, $\{(x_i,y_i)\}_{i=1}^n$, they propose to count the number of size $k$ subsequences $(x_{i_1}, x_{i_2}, \dots x_{i_k})$ and $(y_{i_1}, y_{i_2}, \dots y_{i_k})$ such that their rank is matched. We refer to this measure as MR (Matching Ranks). Specifically, we write the scaled version of MR such that it is in range [0,1]: \begin{align*} \text{MR} := \frac{1}{2{n\choose k}}\sum_{1\leq i_1<i_2\dots<i_k \leq n} & \Big(\mathbf{1}\{ rank(x_{i_1}, x_{i_2}, \dots x_{i_k}) = rank(y_{i_1}, y_{i_2}, \dots y_{i_k})\} \\ & + \mathbf{1}\{ rank(x_{i_1}, x_{i_2}, \dots x_{i_k}) = rank(-y_{i_1}, -y_{i_2}, \dots -y_{i_k})\}\Big), \end{align*} where $rank(a_1,\dots,a_k) = (r(a_1),\dots,r(a_k))$ where $r(a_i)$ is the rank of element $a_i$ within the sequences $(a_1,\dots,a_k)$, and the equality inside the indicator function applies element-wisely. Though claimed to be able to detect complex relationship, this measure is inferior to others in some non-monotone dependence case like quadratic relationship. \section{Our method: averaged Local Density Gap}\label{sec:aLDGdef} First, we elaborate on the origin of our work, which was inspired by gene co-expression analysis using single-cell data. In the context of gene co-expression analysis, the pair of random variables $X,Y$ represents the expression level of a pair of genes, and the goal is to find the relationship between them. Pearson's correlation is one commonly used metric for this task. In light of the many shortcomings of this global measure of dependence, \citet{dai2019cell} proposed to characterize the gene relationships for every cell. Their method takes the following approach: for the gene pair $(X,Y)$, and a target cell $j$, partition the $n$ samples based on whether $|X_{\cdot} - X_j| < h_x$ and $|Y_{\cdot} - Y_j| < h_y$, where $h_x$ and $h_y$ are predefined window sizes. This partition can be summarized as a $2 \times 2$ contingency table (\tabref{contingency}). Then evidence against independence in this $2\times 2$ table can be quantified by a general contingency table test statistic. \citet{dai2019cell} uses \begin{equation} S_{X,Y}^{(j)} := \frac{ \sqrt{n} \left(n_{x,y}^{(j)}n - n_{x,\cdot}^{(j)} n_{\cdot,y}^{(j)}\right)}{\sqrt{n_{x,\cdot}^{(j)} n_{y}^{(j)} (n-n_{x,\cdot}^{(j)}) (n-n_{\cdot,y}^{(j)})}}, \end{equation} and conducts a one-sided $\alpha$ level test based on its asymptotic normality, that is \begin{equation}\label{contingency_test} I_{XY}^{(j)}:= \mathbb{I}\{S_{X,Y}^{(j)} > \Phi^{-1} (1-\alpha)\}. \end{equation} \begin{table}[H] \centering \begin{tabular}{c|c|c|c} & $|Y_{\cdot} - Y_j| \leq h_y$ & $|Y_{\cdot} - Y_j| > h_y$ & \\ \hline $|X_{\cdot} - X_j| \leq h_x$ & $n_{x,y}^{(j)} $ & & $n_{x,\cdot}^{(j)}$ \\ \hline $|X_{\cdot} - X_j| > h_x$ & & & \\ \hline & $n_{\cdot,y}^{(j)}$ & & $n$ \end{tabular} \caption{The $2\times 2$ contingency table based on distance from $j$-th sample.} \label{tab:contingency} \end{table} {\color{black} \citet{dai2019cell} claim that $I_{XY}{(j)}$ indicates whether or not gene pairs $X$ and $Y$ are dependent in cell $j$, and refer to the detected dependence as \emph{local dependence}. Though interesting as a novel concept, it lacks rigor and interpretability. Alternatively we propose to define $X$ and $Y$ as being \emph{locally independent} at position $(x,y)$ as \begin{equation} f_{XY}(x,y) = f_{X}(x)f_{Y}(y), \end{equation} then $I_{XY}$ provides a way of assessing \emph{local independence}. Specifically, as a one-sided test, $I_{XY}(j)$ assesses whether or not $f_{XY}(x,y) > f_{X}(x)f_{Y}(y)$, at position $(x,y)$ marked by cell $j$. To assess global independence, aggregation, as proposed by \citet{wang2021constructing}, is needed. Their empirical measure can be formally written as: \begin{equation}\label{avgcsn} \text{avgCSN} := \frac{1}{n} \sum_{i=1}^n I_{XY} ^{(j)}. \end{equation} } {\color{black}Some simple approximations gives us a population correspondence of avgCSN.} Assume the variables $X,Y$ have joint density $f_{XY}$, and marginal densities, $f_{X}$ and $f_{Y}$, that have common support. Let $\widehat{f}_{XY}, \widehat{f}_{X}, \widehat{f}_{Y}$ be the estimated densities given observations of $(X,Y)$. Under the assumption that the bandwidth $h_x, h_y\to 0$ and $ \sqrt{h_x h_y n}\to\infty$, with some simple algebra (see \appref{derive} for detailed derivation), we see that \begin{align}\label{deriveavgcsn} \text{avgCSN} &\approx \frac{1}{n} \sum_{i=1}^n \mathbf{1}\left\{ \frac{\widehat{f}_{X,Y}(x_{i}, y_{i}) - \widehat{f}_{X}(x_{i}) \widehat{f}_{Y}(y_{i}) }{\sqrt{ \widehat{f}_{X}(x_{i})\widehat{f}_{Y}(y_{i})}} \geq t_n \right\},\quad \text{where } t_n = \frac{\Phi^{-1}(1-\alpha)}{\sqrt{n h_x h_y}}, \end{align} and $\alpha\in[0,1]$ is some hyperparameter related to the test level of the local contingency test (usually $\alpha$ is set to 0.05 or 0.01). Because $t_n \downarrow 0$ as $n$ goes to infinity, we naturally think of the following population dependence measure: \begin{equation*} \text{Pr}_{X,Y}\left\{ \frac{f_{X,Y}(X,Y) - f_X(X) f_{Y}(Y)}{\sqrt{f_{X}(X)f_{Y}(Y)}} > 0\right\}. \end{equation*} In the remainder of this section, we formally define a generalized version of this measure in \secref{pop}, along with its properties on the population level. Then we discuss consistent and robust estimation in \secref{emp} and provide guidance on hyper-parameter selection in \secref{chooset}. Finally, we comment on the relationship between our measure and some of the previous work in \secref{relation}. \subsection{Definition and basic properties}\label{sec:pop} \begin{definition}(averaged Local Density Gap) Consider a pair of random variables $X,Y$ whose joint and marginal densities both exist, and denote $f_{XY}, f_{X}, f_{Y}$ as their joint and marginal densities. The averaged Local Density Gap (aLDG) measure is then defined as \begin{equation} \text{aLDG}_t := \text{Pr}_{X,Y}\left\{ T(X,Y) > t\right\}, \quad \text{where } T(X,Y):= \frac{f_{X,Y}(X,Y) - f_X(X) f_{Y}(Y)}{\sqrt{f_{X}(X)f_{Y}(Y)}} \end{equation} and $t\geq 0$ is a tunable hyper-parameter. \end{definition} \noindent From the definition, one can immediately realize the following lemma. \begin{lemma}\label{lem:simpleprop} For a pair of random variables $X,Y$ whose joint and marginal densities both exist, we have \begin{enumerate} \item $X \perp Y \Longleftrightarrow \text{aLDG}_0 =0 $; \item if $t>0$, then $X \perp Y \Longrightarrow \text{aLDG}_t =0$; \item $\text{aLDG}_t \text{ is non-increasing with regard } t$ for all $t \geq 0$; \item $\text{aLDG}_t \in [0,1]$; \item $\text{aLDG}_t(X,Y) = \text{aLDG}_t(Y,X)$; \end{enumerate} \end{lemma} As a concrete example of the $\text{aLDG}$ measure, the left plot of \figref{aLDGpop} displays $\text{aLDG}$, given different $t$ for a bivariate Gaussian with different choices of correlation. We can see that (1) $\text{aLDG}_t$ is non-increasing with regard $t$ as our \lemref{simpleprop} suggests; (2) $\text{aLDG}_t$ equals zero at independence for all $t\geq 0$, while $\text{aLDG}_0$ equals zero if and only if there is no dependence, as our \lemref{simpleprop} suggests; (3) $\text{aLDG}_t$ increases with the dependency level, indicating that it is a sensible dependence measure. Note that, from \lemref{simpleprop}, $\text{aLDG}_0$ is a \emph{strong}\footnote{Recall that a measure of dependence between a pair of random variable $X,Y$ is \emph{strong} if it equals zero if and only if $X$ and $Y$ are independent.} measure of dependence. While being strong is a desirable feature of a dependence measure, for $\text{aLDG}$ type of measure, we find that it comes with the sacrifice of robustness under independence (\propref{indeprob}). On the other hand, setting $t>0$ could result in insensitivity under weak dependence, but with a provable guarantee of robustness (\thmref{aLDGrobpop}). In summary, the hyper-parameter $t$ serves as a trade-off between robustness and sensitivity. In \secref{chooset} we will discuss the practical choice of $t$ in more detail. For now, we treat it as a predefined non-negative constant. \subsection{Robustness analysis}\label{sec:robpop} In the following, we present a formal robustness analysis. An important tool to measure the robustness of a statistical measure is the influence function (IF). It measures the influence of an infinitesimal amount of contamination at a given value on the statistical measure. The Gross Error Sensitivity (GES) summarizes IF in a single index by measuring the maximal influence an observation could have. \begin{definition}[Influence function (IF) and Gross Error Sensitivity (GES)] Assume that the bivariate random variable $(X,Y)$ follows a distribution $F$, the influence function of a statistical functional $R$ at $F$ is defined as \begin{align}\label{if} \text{IF}\big((x,y), R, F\big) := \lim_{\epsilon \to 0} \frac{R\big((1-\epsilon) F + \epsilon \delta_{(x,y)}\big) - R(F)}{\epsilon} \end{align} where $\delta_{(x,y)}$ is a Dirac measure putting all its mass at $(x,y)$. The Gross Error Sensitivity (GES) summarizes IF in a single index by measuring the maximal influence over all possible contamination locations, which is defined as \begin{equation} \text{GES}(R, F) := \sup_{(x,y)} \mid \text{IF}\big((x,y), R, F\big)\mid. \end{equation} An estimator is called $B$-robust if its GES is bounded. \end{definition} Among the related work we have mentioned, only the robustness of $\tau$, $\tau^\star$, and $\text{dCor}$ have been theoretically investigated to the best of our knowledge. \citet{dhar2016study} proved that $\text{dCor}$ is not robust while $\tau$ and $\tau^\star$ are. Their evaluation criteria is a bit different from ours. We investigate the limit of the ratio when the contamination mass goes to zero. They investigate the ratio limit when the contamination position goes far away, given fixed contamination mass. We argue that our analysis aligns better with the main statistical literature. In the following, we show that $\text{aLDG}_t$ with $t>0$ is $B$-robust, under some reasonable regularity conditions. \begin{theorem}\label{thm:aLDGrobpop} Consider $t>0$, and a bivariate distribution $F$ of variable $(X,Y)$ whose joint and marginal densities exist as $f_{XY}$, $f_{X}$, $f_{Y}$, and satisfy \begin{equation} f_{\text{max}}:=||\sqrt{f_{X}f_{Y}}||_{\infty} <\infty; \quad \quad |\text{aLDG}_{t - \epsilon} - \text{aLDG}_{t}| \leq L\epsilon,\ \forall \ \epsilon >0; \end{equation} then we have \begin{equation} \text{GES}(\text{aLDG}_t, F) \leq L f_{\text{max}} +1 < \infty. \end{equation} \end{theorem} The proof of \thmref{aLDGrobpop} is in \appref{aLDGrobpop}. The first assumption about the boundness of density is common in density based statistical analysis. The second assumption about the $\text{aLDG}_{t}$ smoothness may look less familiar, however after a transformation, it is no more than a CDF-smoothness assumption: recall that $T(X,Y) := \frac{f_{XY}(X)-f_{X}(X)f_{Y}(Y)}{\sqrt{f_{X}(X)f_{Y}(Y)}}$, then \begin{align} |\text{aLDG}_{t-\epsilon} - \text{aLDG}_{t}|< L\epsilon \Longleftrightarrow \mathbb{P}\{|T(X,Y)-t|\leq \epsilon\} \leq L\epsilon, \end{align} that is, the CDF of random variable $T(X,Y)$ is L-lipschitz around $t$ for $t>0$. In \figref{smooth} we show the empirical density of $T(X,Y)$ for bivariate Gaussian of different correlation, which is generally bounded by some constant $L$ at positive values. \begin{figure}[H] \centering \includegraphics[width=1\linewidth]{plots/densityT.pdf} \caption{The empirical density of statistics $T$. The underlying bivariate distribution is Gaussian, and the value of $T$ is calculated using the true Gaussian density. We can see that, as the correlation increases, the density of $T$ near zero (annotated by the red dashed line) is smaller.} \label{fig:smooth} \end{figure} In the following, we show that $\text{aLDG}_0$ is not robust under independence. \begin{proposition}\label{prop:indeprob} For any distribution $F$ over a pair of independent random variables $(X,Y)$ whose joint and marginal density exists and are smooth almost everywhere, we have \begin{equation} \text{GES}(\text{aLDG}_0, F) = \infty \end{equation} if and only if X is independent of Y. \end{proposition} The proof of \propref{indeprob} is in \appref{indeprob}. The right plot in \figref{aLDGpop} provides some empirical evidence of the non-robustness of $\textnormal{aLDG}_0$ under independence. Specifically, we plot the population value of the ratio inside limitation \eqref{if}, under bivariate Gaussian with small enough contamination proportion $\epsilon$, to approximately show that the IF value of $\textnormal{aLDG}_t$ at independence indeed goes to infinity as $t$ goes to zero. \begin{figure}[H] \centering \includegraphics[width=\linewidth]{plots/popvalue.pdf} \caption{\textbf{(Left)} The true $\textnormal{aLDG}_t$ value for bivariate Gaussian with different levels of correlation under different choices of $t$. \textbf{(Right)} The influence function value approximated by setting the contamination proportion very small ($\epsilon = 10^{-6}$).} \label{fig:aLDGpop} \end{figure} \subsection{Consistent and robust estimation}\label{sec:emp} In this section we investigate estimation of $\text{aLDG}_t$ given finite samples. One natural way to estimate $\text{aLDG}_t$ is using the following plug-in estimator: recall that $\widehat{f}_{XY}, \widehat{f}_{X}, \widehat{f}_{Y}$ are the estimated joint and marginal densities, then given $n$ observations $\{(x_1,y_1),\dots,(x_n,y_n)\}$ of $(X,Y)$, $\text{aLDG}_t$ can be estimated by \begin{align} \label{eq:aLDGemp} \widehat{\text{aLDG}}_t & := \frac{1}{n}\sum_{i=1}^n \mathbf{1}\left\{ \widehat{T}(x_i,y_i) \geq t \right\},\quad \text{where } \widehat{T}(x_i,y_i):=\frac{\widehat{f}_{X,Y}(x_{i}, y_{i}) - \widehat{f}_{X}(x_{i}) \widehat{f}_{Y}(y_{i}) }{\sqrt{ \widehat{f}_{X}(x_{i})\widehat{f}_{Y}(y_{i})}} \end{align} In the following, we establish the non-asymptotic high probability bound of the estimation error using the above simple plug-in estimator $\widehat{\text{aLDG}}_t$. The error rate is determined by the density estimation error for variable $X, Y$, as well as the probability estimation error for $T(X,Y)$. \begin{theorem}\label{thm:aLDGconsist} Consider $t>0$, and a bivariate distribution $F$ of variable $(X,Y)$ whose joint and marginal densities exist as $f_{XY}$, $f_{X}$, $f_{Y}$, and satisfy \begin{align*} &\inf_{x,y}f_{XY}(x,y),\ \inf_{x}f_X(x) \inf_{y}f_Y(y) \geq c_{\min},\\ & \sup_{x,y}f_{XY}(x,y),\ \sup_{x}f_X(x) \sup_{y}f_Y(y) \leq c_{\max}, \end{align*} and for some $\eta_n$ with $\lim_{n\to\infty}\eta_n \to 0$, with probability at least $1-\frac{1}{n}$ \begin{equation} ||\widehat{f}_{XY}-f_{XY}||_{\infty}, ||\widehat{f}_{X}-f_{X}||_{\infty}, ||\widehat{f}_{Y}-f_{Y}||_{\infty} \leq \eta_n; \end{equation} and for some constant $0<L<\infty$, \begin{equation} |\text{aLDG}_{t-\epsilon}-\text{aLDG}_t| \leq L\epsilon\quad \text{for all} \ \epsilon>0. \end{equation} Then we have, with probability at least $1-\frac{2}{n}$, we have \begin{equation} \left|\widehat{\text{aLDG}}_t - \text{aLDG}_t\right| \leq LC\eta_n + \sqrt{\frac{2\log{n}}{n}}, \end{equation} where $C$ depends only on $c_{\min}, c_{\max}$. \end{theorem} \thmref{aLDGconsist} is flexible in the sense that one can plug-in any kind of density estimator and its error rate to obtain the error rate of the corresponding $\widehat{\text{aLDG}}$ estimator. The proof of \thmref{aLDGconsist} is in \appref{pfconsist}. Though \thmref{aLDGconsist} was for fixed $t$, we also provide similar result that holds true uniformly over all possible $t$ in \appref{uniform}. As for a concrete example, we provide explicit results for a special class of bivariate density and a simple density estimator. Specifically, we consider the true marginal density $f_X$, $f_Y$ that are L-Lipschitz, and the joint density $f_{XY}$ that are simply the product of $f_X$, $f_Y$; we also consider the following density estimator\footnote{The density estimator used here is not chosen to be minimax optimal. We instead design it to align the best with the practical methods \citet{dai2019cell} and \citet{wang2021constructing}, such that we can better justify and refine their heuristic choices of hyperparameter by theory.}: \begin{align}\label{densest} &\widehat{f}_{X}(\cdot) = \frac{1}{n} \sum_{j=1}^n K_{h_n}(\cdot, x_j) , \quad \widehat{f}_{Y}(\cdot) = \frac{1}{n} \sum_{j=1}^n K_{h_n}(\cdot, y_j), \nonumber\\ & \quad \widehat{f}_{XY}(\cdot, \cdot) = \frac{1}{n} \sum_{j=1}^n K_{h_n}(\cdot, x_j)K_{h_n}(\cdot, y_j), \end{align} where $K_{h_n}(\cdot,u):=\mathbf{1}\{|\cdot-u|\leq h_n\}/(2 h_n)$ is one-dimensional boxcar kernel smoothing function with bandwidth $h_n$. From \propref{densest} in \appref{densest}, the uniform estimation error rate $\eta_n$ in this setting is $O(n^{-1/6}\sqrt{\log{n}})$, given the asymptotic near-optimal bandwidth $h = O(n^{-1/6})$. Therefore, applying \thmref{aLDGconsist} gives us estimation error rate of $O(n^{-1/6}\sqrt{\log{n}})$ for $\textnormal{aLDG}_t$. We also include robustness analysis of $\widehat{\text{aLDG}}_t$ in \appref{emprob}. Specifically, we consider an empirical contamination model that is commonly encountered in single-cell data analysis: a small proportion of the sample points are replaced by ``outliers'' far away from the rest samples. We show that $\widehat{\text{aLDG}}_t$ with and without outliers are close as long as the outlier proportion is small. This suggests that the estimator of $\text{aLDG}_t$ preserves its robust nature. \subsection{Selection of hyper-parameter $t$}\label{sec:chooset} In this section, we propose two methods for selecting $t$, each of which has merit. We also provide guidance on which one is preferable in different practice settings. \paragraph*{Uniform error method} From the results in the previous section, we learn that $\text{aLDG}_0$ is not robust under independence. To prevent $\widehat{\text{aLDG}}_t$ from approaching $\text{aLDG}_0$ under independence, it is sufficient to make sure that the estimation error of $T$ under independence is uniformly dominated by $t$ with high-probability. To compute the uniform estimation error of $T$ under independence, we first manually construct the independence case via random shuffle. Given $n$ samples $\{(x_i,y_i)\}_{i=1}^n$ of $(X,Y)$, denote the corresponding empirical joint distribution as $\widehat{F}_{XY}$, and marginal joint distribution as $\widehat{F}_{X}$ and $\widehat{F}_{Y}$. Applying the random shuffle function $\pi$ on indices of one dimension (i.e. $Y$), we have \begin{equation} \{(x_i,y_{\pi(i)})\}_{i=1}^n \sim \widehat{F}_{X}\widehat{F}_{Y}, \end{equation} that is the shuffled samples $\{(x_i,y_{\pi(i)})\}$ now come from a different joint distribution where $(X,Y)$ are independent. We can then use the shuffled samples to compute the uniform estimation error of $T$ under independence. Note that $T$ under independence is exactly zero, therefore its uniform estimation error is just the uniform upper bound of its estimation. To stabilize the estimation of such upper bound, we use the median of estimated upper bound from $\max\{\lfloor 1000/n \rfloor, 5\}$ different random shuffles as the final estimation. We call this $t$ selection method the \emph{uniform error} method. \paragraph*{Asymptotic norm method} When using $\textnormal{aLDG}_t$ in large-scale data analysis, choosing $t$ using the above data-dependent choice may be undesirable because it requires additional computations. In extensive simulations we observe that a simple alternative also performs fine in terms of maintaining consistency, power and robustness: \begin{equation}\label{choosetnorm} t = \Phi^{-1}\left(1-\frac{1}{n}\right)\Big/\left(\sqrt{\sigma_{X}\sigma_Y} n^{1/3}\right). \end{equation} This choice is motivated by the following heuristic. Recall our derivation of aLDG statistics from avgCSN around \eqref{deriveavgcsn}: as the sample size $n$ goes to infinity, and $h_x, h_y \to 0$, $h_xh_yn\to\infty$, the empirical estimation of $\text{aLDG}_t$ using the boxcar kernel cioncide with avgCSN. Therefore, $t_n$ in \eqref{deriveavgcsn} could serve as a natural choice for $t$, but one need to be extra careful about $\alpha$, which is the test level of local contingency test \eqref{contingency_test} in definition towards avgCSN. We specically modify $\alpha$ to decrease with $n$ instead of a fixed value like $0.05$ since we desire consistency: i.e. $\text{aLDG}_t$ under independence should goes to zero as $n$ goes to infinity. Finally, plugging in our choice of bandwidth $h_x = \sigma_X n^{-1/6}$, $h_y = \sigma_Y n^{-1/6}$ together with the new $\alpha_n$ in place of $\alpha$ into $t_n$ \eqref{deriveavgcsn}, we get \eqref{choosetnorm}. We call this $t$ selection method the \emph{asymptotic norm} method. Empirically we find that the \emph{asymptotic norm} method is often too conservative given the small sample size (which is expected since it is based on the asymptotic normality of a contingency table test statistic). In practice, we recommend people use \emph{uniform error} over \emph{asymptotic norm} when the sample size is not too big (e.g., no bigger than 200). When the sample size is big enough (e.g., bigger than 200), and the computation budget is limited, we recommend the \emph{asymptotic norm} method. In the rest of the paper, we use the \emph{uniform error} method when the sample size is no bigger than 200 and the \emph{asymptotic norm} method when the sample size is bigger than 200. We admit that there could be other promising ways of selecting $t$, for example, a geometry way we provided in \appref{chooset}. Here we only present the methods that we found working the best after a careful evaluation (see \appref{chooset}). \subsection{Relationships to HHG}\label{sec:relation} The method that is most similar to aLDG is HHG (\cite{heller2013consistent}). Like aLDG, HHG \citep{heller2013consistent} is based on aggregation of multiple contrasts between the local joint and marginal distributions \begin{align*} HHG := \sum_{i\neq j} M(i,j),\quad M(i,j) := (n-2) \frac{\Big(p_{XY}(B_{XY}^{i,j})-p_{X}(B_{X}^{i,j})p_{Y}(B_Y^{ij})\Big)^2}{p_{X}(B_{X}^{i,j})\Big(1-p_{X}(B_{X}^{i,j})\Big)p_{Y}(B_Y^{ij})\Big(1-p_{Y}(B_Y^{ij})\Big)}, \end{align*} with $B_{X}^{i,j} = \{x: |x-x_i|\leq |x_i - x_j|\}$, $B_{Y}^{i,j} = \{y: |y-y_i|\leq |y_i - y_j|\}$ and $B_{XY}^{i,j} = B_{X}^{i,j} \otimes B_{Y}^{i,j} $, $p_{XY}, p_X, p_Y$ are joint probability function for $(X,Y)$ and marginal probability function for $X$ and $Y$ respectively. While the two measures appear quite similar, they differ in two critical aspects. \paragraph*{The efficiency of single scale bandwidth} One notable difference between HHG and aLDG is that the former relies on a multi-scale choice of bandwidth for each sample point. Specifically, it utilizes multiple ($O(n)$) bandwidths for each data point. This results in a provably consistent permutation test; however, the cost of implementation is significantly longer computation time than its competitors. aLDG takes a single-scale approach, which considerably improves the computation efficiency. Moreover, the aLDG formulation provides a direct analogy to a density functional, which allows us to exploit existing work in density estimation to determine an appropriate bandwidth. This single-scale approach, though may not optimal, achieves comparable power to HHG, as shown in the upcoming simulation studies. \paragraph*{The merit of thresholding} Another difference is that empirically aLDG aggregates over thresholded summands, see \eqref{eq:aLDGemp}. It turns out thresholding brings implicit robustness to noise. By contrast, consider the non-thresholded version of aLDG: \begin{equation} \text{aLDG}_{non}:= \EE{T(X,Y)}. \end{equation} Even with slight departures from independence, $\text{aLDG}_{non}$ can go to infinity. For example, consider the following joint and marginal distribution that admits a kernel product density mixture: \begin{align*} & f_{XY}(x,y) = \alpha k_{0,r}(x)k_{0,r}(y) + (1-\alpha)k_{0,1}(x)k_{0,1}(y),\\ & f_{X}(x) = \alpha k_{0,r}(x) + (1-\alpha)k_{0,1}(x), \quad f_{Y}(y) = \alpha k_{0,r}(y) + (1-\alpha)k_{0,1}(y) \end{align*} where $\alpha \in (0,1)$, $0<r\ll1$ and $k_{\mu,r}(\cdot):=\frac{1}{r}k(\frac{\cdot-\mu}{r})$, with $k$ as the density of 1-dim uniform distribution supported on $[-1,1]$. Note that as $\alpha\to0$ and $r\to 0$, the model is essentially an independence case contaminated with a small point mass. Additionally with $\alpha/r \to \infty$, we can show that (see \appref{thred} for details) \begin{equation}\label{nonthred} \EE{T(X,Y)} \approx \frac{\alpha}{r} \to \infty, \end{equation} that is the non-thresholded version of $\text{aLDG}$ is very large under such simple case of small departure from independence, therefore is problematic. With thresholding, however, $\text{aLDG}$ is guaranteed to be approximately $\alpha$, which goes to zero for small perturbations, as one would desire. \section{Empirical evaluation}\label{sec:aLDGcompare} \subsection{Single-cell data application}\label{sec:real} In this section, we evaluate aLDG among the other measures using scRNA-seq data from two studies. \paragraph*{Chu dataset} This dataset \citep{chu2016single} contains 1018 cells of human embryonic stem cell-derived lineage-specific progenitors. The seven cell types, including H1 embryonic stem cells (H1), H9 embryonic stem cells (H9), human foreskin fibroblasts (HFF), neuronal progenitor cells (NPC), definitive endoderm cells (DEC), endothelial cells (EC), and trophoblast-like cells (TB), were identified by fluorescence-activated cell sorting (FACS) with their respective markers. On average, 9600 genes are measured per cell. In the following, we show some special gene pairs that exhibit strong, weak, or no relational patterns and the corresponding dependence values produced by different measures. We find that only aLDG gives a high value for strong relational patterns no matter how complex the pattern composition is; maintains near-zero values for known independent cases; and avoids a spurious relationship skewed by technical noise and sparsity (Figure \ref{fig:realbi}). \begin{figure}[H] \centering \includegraphics[width=0.8 \linewidth]{plots/newrealpair.pdf} \caption{Example of gene pair scatter plots from the Chu dataset, which has 1018 cells from 7 cell types. Gene expression is recorded as counts per million (CPM) and $\log_2$ transformed. In each plot, we show the scatter plot of $\log_2(\text{CPM}+1)$ for a pair of genes and provide the corresponding estimated dependence values using different methods to the right of the plots. \textbf{(a)} aLDG gives a much higher value than the others in these scenarios which appear to illustrate a strong mixture dependence pattern, even when the signal is predominantly in one cell type. \textbf{(b)} aLDG produces a high value for the obvious three mixture relationship in the first subplot. By contrast, in the second subplot, the cell identity are randomly shuffled for each gene pair, resulting in a constructed case of independence. Most measures, including aLDG, give near-zero values in this setting. The exception is MIC, which gives a misleadingly high value. \textbf{(c)} This example illustrate performance when there is a high level of sparsity: MIC and the moment-based methods like Pearson, dCor, and HSIC provide estimates that are greatly overestimated, while aLDG, TauStar, and Hoeffding's D are not influenced by this phenomenon. \textbf{(d)} This gene pair combines the challenge of sparsity with considerable noise: aLDG is still able to capture the less noisy, local cluster pattern in the upper left corner. } \label{fig:realbi} \end{figure} \paragraph*{Autism Spectrum Disorder (ASD) Brain dataset} \citet{velmeshev2019single} includes scRNA-seq data from an ASD study that collected 105 thousand nuclei from cortical samples taken from 22 ASD and 19 control samples. Samples were matched for age, sex, RNA integrity number, and postmortem interval. In the following, we compare control and ASD groups by testing for differences in their gene co-expression matrices using the sparse-Leading-Eigenvalue-Driven (sLED) test \citep{zhu2017testing}. sLED takes the gene co-expression matrices for both control and ASD groups as input, and outputs a $p$-value indicating the significance of their difference. This method is particularly designed to detect differential signals attributable to a small fraction of the genes. To emphasize the contrast with differentially expressed genes, \cite{wang2021constructing} call these differential network genes. Here we compare the power of the test for various co-expression measures. We use cells classified as L2/3 excitatory neurons (414 cells from ASD samples and 358 from control samples) and a set of 50 genes chosen randomly among the top 500 genes deferentially expressed between ASD and control samples. In addition, we manually add noise by randomly swapping 10\% of the control and ASD labels in the original data to see which measures detect the signal in the presence of greater noise. We omit HHG for this task as it requires too much computation time. Boxplots of $p$-values from sLED test across 10 independent trials (different random swapping each trial) are shown for all the remaining measures (\figref{vel23power}). Among the remaining measures, we find that HSIC, $\tau^\star$, Hoeffding's D, MIC, and aLDG perform well compared to Pearson, Spearman, Kendall, MRank and dCor. A visualization of the corresponding control versus ASD co-expression differences is displayed in \figref{vel23}, showing that the winners produce difference matrices with a few dominating entries, which is favored by the sLED test, while the others produce relatively flat and noisy patterns. \begin{figure}[H] \centering \includegraphics[width=0.6\linewidth]{plots/newpval.pdf} \caption{The estimated $p$-values obtained using sLED permutation tests for different dependency measures. We manually added noise by randomly swapping 10\% of the control and ASD labels in the original data to see which measures detect the signal in the presence of greater noise. Boxplots show the results from 10 independent repetitions. } \label{fig:vel23power} \end{figure} \begin{figure}[H] \centering \includegraphics[width=\linewidth]{plots/newrealcormat.png} \caption{Estimated co-expression differences matrices (i.e. the absolute differences of the dependency matrices for control samples and ASD samples) obtained for different dependency measures.} \label{fig:vel23} \end{figure} \subsection{Simulation results}\label{sec:simu} In this section, we consider simulations that resembling single-cell data to gain insights underlying the behavior of aLDG relative to the other methods. Specifically, we investigate scenarios where the bivariate relationship is (1) finite mixture; (2) linear or nonlinear; (3) monotone or non-monotone. See \figref{data} for all the synthetic data distributions we considered. We evaluate each dependence measure from the following perspective: (1) ability to capture complex relationship; (2) ability to accumulate subtle local dependence; (3) interpretation of strength of dependence in common sense; (4) power as an independence test; and (5) computation time. In the following, we focus on one perspective in each subsection, showing selective examples that inform our conclusions, relegating other examples to supplementary materials. \paragraph {Detecting nonlinear, non-monotone relationships} By construction, aLDG is expected to detect any non-negligible deviation from independence. Though many existing measures, such as HSIC, Hoeffding's D, dCor, $\tau^\star$, claim to be sensitive to nonlinear, non-monotone relationships, some approaches are known to perform poorly under certain circumstances. By contrast, aLDG outperforms most of its competitors in the following standard evaluation experiment. \figref{nonlinear} illustrates three points: (1) at independence, except for dCor, HHG, and MIC, most measures produce negligible values, as desired; (2) for linear and monotone relationship, all measures produce high values as expected; and (3) for nonlinear non-monotone relationships only aLDG, dCor, HHG and MIC produce high values consistently. In conclusion, only aLDG can effectively detect various types of dependency relationships while maintaining near-zero value at independence. dCor, HHG, and MIC are known to be sensitive to small, artificial deviations from independence, and these simulations reveal that they are indeed too sensitive as they often produce high values at independence. A big portion of scRNA-seq data are collected over time; therefore, nonlinear, non-monotone and specifically oscillatory relationships are expected to happen. Therefore it is desirable to have a measure that is sensitive to dependence while remaining near zero of true independence, even under small perturbations. \begin{figure}[H] \centering \includegraphics[width=\linewidth]{plots/value.pdf} \caption{Empirical dependency estimates obtained for different data distributions for a variety of relationships between a pair of variables. For the visualization of different data distributions, see \figref{data}. Here we show the corresponding dependence level given by different measures using 200 samples (averaged over 50 trials).} \label{fig:nonlinear} \end{figure} \paragraph {Accumulating subtle local dependencies} aLDG detects the subset of the sample space that shows a pattern of dependence. In \figref{mix}, we simulated data as a bivariate Gaussian mixture consisting of three components with a varying proportion of highly dependent components and estimated the corresponding dependence level. We find that aLDG, together with other dependence measures designed to capture local dependence (HHG and MIC) increase with the proportion of highly correlated components, indicates that these global dependence measures can also detect subtle local dependence structure. Similar results are obtained for Negative Binomial mixtures \figref{nbmix}. As the finite mixture relationship is a common choice of model for scRNA-seq data, this suggests that measures able to accumulate dependencies across individual components could considerably benefit scRNA-seq data analysis. \begin{figure}[H] \centering \includegraphics[width=\linewidth]{plots/valuemix_gauss.pdf} \caption{Empirical aLDG value for Gaussian mixtures. In each plot we show the dependence level given by different measures for 200 samples (averaged over 50 trials). The data are generated as a three-component Gaussian mixture. From left to right, there are 0, 1, 2 and 3 out of 3 components with correlation of 0.8, while the remaining components have correlation 0, i.e., the dependence level increases from left to right. For the visualization of these different data distributions, see \figref{data}. } \label{fig:mix} \end{figure} \paragraph {Degree of dependencies} While it is hard to define the relative dependence level in general, we argue that when one random variable is a function of the other, $Y=h(X)$, then the pair should be regarded as having the perfect dependence (and be assigned of dependence level $1$). Moreover, the dependence level should decrease as independent noise is added. That is, for $Y_\epsilon = h(X) + \epsilon$, where $\epsilon \perp X$, one should expect the dependence measure $\delta$ to satisfy $\delta(Y_{\epsilon},X) < \delta(Y,X)$. We checked this monotonicity property by simulating data with several bivariate relationships and varying levels of noise (\figref{mono}). Specifically, we simulate the noise $\epsilon$ to be standard normal, and $Y = h(X) + c\epsilon$ where $c\in[0,1]$ indicates the noise level. We find that aLDG, HSIC, MIC, dCor, and HHG all show a clear decreasing pattern as the noise level increases; however, aLDG shows the most consistent monotonic drop from perfect dependence as the noise level increased. \begin{figure}[H] \includegraphics[width=1\linewidth]{plots/mono.pdf} \caption{Empirical dependence measure versus noise levels for different bivariate relationships. For the visualization of different data distributions, see \figref{data}. The results are shown for 100 samples (averaged over 50 trials). We claim that the higher the noise level is, the lower the estimated degree of dependence should be. Compared with other measures, aLDG decreases significantly as the noise level increases, and hence correctly infers the relative degree of dependence. } \label{fig:mono} \end{figure} \paragraph {Power as an independence test} Dependence measures are natural candidates for tests of independence. In this context, most existing dependence measures rely on bootstrapping or permutation to determine significance; hence we adopt this practice for all the dependence measures under comparison. \figref{non-linearpower} shows the empirical power under test level 0.05 for various types of data distribution and sample size, where we do 200 repetitions of permutations to estimate the null distribution. We observe the following outcomes: (1) almost all tests have controlled type-I error under independence; (2) Pearson's $\rho$, Spearman's $\rho_S$ and Kendall's $\tau$ are powerless for testing nonlinear and non-monotone relationships; (3) aLDG, HHG, and HSIC are consistently among the top three most powerful approaches for testing both linear and nonlinear, monotone and non-monotone relationships. Similar observations can be made for tests based on Gaussian mixtures \figref{gaussmixpower} and Negative Binomial mixtures \figref{nbmixpower}. \begin{figure}[H] \centering \includegraphics[width=\linewidth]{plots/power.pdf} \caption{The empirical power of permutation test at level 0.05, based on different dependency measures under different data distributions and sample sizes. For the visualization of different data distributions, see \figref{data}. The power is estimated using 50 independent trials.} \label{fig:non-linearpower} \end{figure} \paragraph {Computational comparisons} Theoretically speaking, aLDG requires $O(n^2)$ in time of computation (where $n$ is the number of samples), which is comparable to reported requirements for most dependence measures that can detect complex relationships. This empirically confirmed in a comparison of the computation time of aLDG with all its competitors. In \figref{time} we plot the time of computation versus sample size $n$ for different dependence measures\footnote{The time include some constant wrapper function loading time, therefore, might be longer than a direct function call; however, the relative scale is still correct.}. In previous evaluations, we saw that HHG as a method motivated from capturing local dependence structure, was indeed a strong competitor to aLDG: it has high power as an independence test across almost all the data distribution we considered; however, it requires $O(n^3)$ time of computation, and \figref{time} shows this large discrepancy from all the other methods, which normally takes $O(n^2)$ time. \section{Conclusion and Discussion} In this paper, we formalize the idea of averaging the \emph{cell-specific gene association} \citep{dai2019cell,wang2021constructing} under a general statistical framework. We show that this approach produces a novel univariate dependence measure, called aLDG, that can detect nonlinear, non-monotone relationships between a pair of variables. We then develop the corresponding theoretical properties of this estimator, including robustness and consistency. We also provide several hyper-parameter choices that are more justifiable and effective. Extensive simulations, motivated by expected scRNA-seq gene co-expression relationships and real data applications, show that this measure outperforms existing independence measures in various aspects: (1) it accumulates subtle local dependence over sub-populations; (2) it successfully interprets the relative strength of a monotonic function of dependence in the presence of noise better than many other measures that arose from independence test; (3) it is sensitive to complex relationships while robustly maintaining near-zero value at true independence, while several other measures are often overly sensitive to slight perturbations from independence and noise; (4) it computes comparatively rapidly compared to other dependence measures designed to capture complex relationships. Other measures perform well in some settings but fail in others that are highly relevant to the single-cell setting. For instance, MIC performed well as part of the sLED test for differences in co-expression matrices, but this measure tends to produce a high estimate of dependence even when the variables are independent, or nearly so (Figure \ref{fig:nonlinear} and Figure \ref{fig:mono}). The moment-based methods like Pearson, dCor, and HSIC perform poorly when the expression values are sparse, producing false indications of correlation (Figure \ref{fig:realbi}), and yet sparsity is the norm in most single cell data. Our method is implemented in the R package aLDG\footnote{\url{https://github.com/JINJINT/aLDG}}, where we also include all the other methods that we have compared with. The aLDG method does have some practical challenges: as a measure based on density estimation, the hyperparameter choices such as bandwidth can affect the performance of the measure. Though we provide some asymptotically optimal choices of those hyperparameters, in practice, they can fail due to the small sample size. For any given setting, the hyperparameters can be adjusted based on realistic simulations of the actual data and a solid understanding of the scRNA-seq data distribution. Similarly, due to the reliance on density estimation, it is hard to extend this measure to a multivariate setting. The sample size required for accurate estimation grows exponentially with the dimension. In practice, this limitation has little practical importance because gene co-expression studies focus on bivariate relationships. \paragraph{Acknowledgments} The authors would like to thank Xuran Wang for helpful comments. \paragraph{Funding} This project is funded by National Institute of Mental Health (NIMH) grant R01MH123184 and NSF DMS-2015492. \bibliographystyle{unsrtnat}
{'timestamp': '2022-03-07T02:02:24', 'yymm': '2203', 'arxiv_id': '2203.01990', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.01990'}
arxiv
\section{Introduction} Deep visuomotor policies that map from pixels to actions end-to-end can represent complex manipulation skills \cite{levine_finn_2016}, but have shown to be sensitive to the choice of action space \cite{martin2019iros} -- e.g., Cartesian end effector actions (i.e. task space \cite{berenson2011task}) perform favorably when learning policies for tabletop manipulation, while joint actions have shown to fare better for whole-body motion control \cite{peng2017learning, Tan-RSS-18}. In particular, policies modeled by deep networks are subject to spectral biases \cite{ronen2019convergence,battaglia2018relational, bietti2019inductive} that make them more likely to learn and generalize the low-frequency patterns that exist in the control trajectories. Hence, choosing the right action space in which to define these trajectories remains a widely recognized problem in both reinforcement learning \cite{peng2017learning} as well as imitation learning, where demonstrations can be provided in a wide range of formats -- e.g., continuous teleoperation in Cartesian or joint space, kinesthetic teaching, etc. -- each changing the underlying characteristics of the training data. \begin{figure}[t!] \centering \vspace{0.5em} \noindent\includegraphics[width=1.0\linewidth]{images/splash-v4.png} \caption{Enabled by an implicit policy formulation, Implicit Kinematic Policies (IKP) provide both Joint and Cartesian action representations (linked via forward kinematics) to a model that can pick up on inductive patterns in both spaces. Subsequently, this allows our end-to-end policies to extract the best action space for a wide variety of manipulation tasks ranging from tabletop block sorting to whole-arm sweeping.} \label{fig:teaser} \vspace{-1.5em} \end{figure} Although considerable research has been devoted to finding the right action space for a given application \cite{peng2017learning}, much less attention has been paid to figuring out how our models could instead discover for themselves which optimal combination of action spaces to use. This goal remains particularly unclear for most \textit{explicit} policies $f_\theta(\textbf{o})=\hat{\textbf{a}}$ with feed-forward models that take as input observations $\textbf{o}$ and output actions $\textbf{a}\in\mathcal{A}$. Explicit formulations must either specify a single action space to output from the model and potentially convert predictions into another desired space (e.g. with inverse kinematics), or use multiple action spaces with multiple outputs and losses which can be subject to conflicting gradients \cite{yu2020gradient} from inconsistent predictions \cite{martin2019iros}. In this work, we demonstrate that we can train deep policies to learn which action space to use for imitation, made possible by implicit behavior cloning (BC) \cite{florence2021implicit}. In contrast to its explicit counterpart, \textit{implicit} BC formulates imitation as the minimization of an energy-based model (EBM) $\hat{\textbf{a}}=\arg\min_{\textbf{a} \in \mathcal{A}} E_{\theta}(\textbf{o},\textbf{a})$ \cite{lecun2006tutorial}, which regresses the optimal action via sampling or gradient descent \cite{welling2011bayesian, du2019implicit}. Since actions are now inputs to the model, we propose presenting the model with the same action represented in multiple spaces while remaining consistent between each other, allowing the model to pick up on inductive patterns \cite{battaglia2018relational, bietti2019inductive} from all action representations. We study the benefits of this multi-action-space formulation with Cartesian task and joint action spaces in the context of learning manipulation skills. Since both spaces are linked by the kinematic chain, we can integrate a differentiable kinematic module within the deep network -- a formulation which we refer to as Implicit Kinematic Policies (IKP). IKP can be weaved into an implicit autoregressive control strategy introduced in \cite{florence2021implicit}, where each action dimension is successively and uniformly sampled at a time and passed as input to the model. This exposes the model to not only the joint configuration and end-effector pose, but also the Cartesian action representations of {\em{every rigid body link}} of the arm as input. This can provide downstream benefits when learning whole-body manipulation tasks that may have emergent patterns in the trajectory of any given link of the robot. Furthermore, a key aspect of Implicit Kinematic Policies is that in addition to exposing the implicit policy to both Cartesian and joint action spaces, it also enables incorporating learnable layers throughout the kinematic chain, which can be used to optimize for residuals in either space Our main contribution is Implicit Kinematic Policies, a new formulation that integrates forward kinematics as a differentiable module within the deep network of an autoregressive implicit policy, exposing both joint and Cartesian action spaces in a kinematically consistent manner. Behavior cloning experiments across several complex vision-based manipulation tasks suggest that IKP, without any modifications, is broadly capable of efficiently learning both prehensile and non-prehensile manipulation tasks, even in the presence of miscalibrated joint encoders -- results that may pave the way for more data efficient learning on low-cost or cable-driven robots, where low-level joint encoder errors (due to drift, miscalibration, or gear backlash) can propagate to large non-linear artifacts in the Cartesian end effector trajectories. IKP achieves 85.9\%, 97.5\% and 92.4\% on a sweeping, non-prehensile box lifting and precise insertion task respectively -- performance that is on par with or exceeds that of standard implicit or explicit baselines (using the best empirically chosen action space per individual task). We also provide qualitative experiments on a real UR5e robot suggesting IKP's ability to learn from noisy human demonstrations in a data-efficient manner. Our experiments provide an initial case study towards more general action-space-agnostic architectures for end-to-end robot learning. \section{Related Work} \subsection{Learning Task-Specific Action Representations} While much of the early work in end-to-end robot learning has focused on learning explicit policies that map pixels to low-level joint torques \cite{ddpg2016, levine_finn_2016}, more recent work has found that the choice of action space can have a significant impact on downstream performance for a wide range of robotic tasks ranging from manipulation to locomotion \cite{martin2019variable, duan2021learning, peng2017learning, Viereck_2018, varin2019comparison}. In the context of deep reinforcement learning for locomotion, \cite{peng2017learning} find that using PD joint controllers achieves higher sample efficiency and reward compared to torque controllers on bipedal and quadrupedal walking tasks in simulation, whereas \cite{Viereck_2018} interestingly find that torque controllers outperform PD joint controllers for a real robot hopping task. In contrast, \cite{duan2021learning} shows that using task space actions are more effective for learning higher level goals of legged locomotion compared to joint space controllers and demonstrate results on a real bipedal robot. Careful design of the action space is equally important when learning manipulation skills with high DoF robots \cite{martin2019variable, varin2019comparison}. Prior approaches successfully use direct torque control or PD control with joint targets to learn a variety of tasks such as pick-and-place, hammering, door opening \cite{rajeswaran2018learning} and stacking \cite{popov2017dataefficient}, but these methods often require lots of data and interaction with the environment to generalize well and are also sensitive to feedback gains in the case of PD control. Other works default to low-level residual cartesian PD controllers in order to learn prehensile tasks such as block stacking \cite{johannink2018residual} and insertion \cite{silver2019residual}, but \cite{martin2019variable, varin2019comparison} instead vouch for a task-space impedance controller to support more compliant robot control. However, this approach is agnostic to the full joint configuration of the robot and focuses on tabletop manipulation which is generally better defined in task space. Fundamentally, these works share the common theme of choosing the single best action space for a particular task. In this work, we are more concerned with the problem of extracting the best combination of action spaces. \subsection{Difficulties in Learning High-Frequency Functions} The proposed benefits of implicit kinematic policies rely on the hypothesis that simpler patterns are easier for deep networks to learn. Although theoretical analyses of two-layer networks and empirical studies of random training labels have shown that deep networks are prone to memorization \cite{Zhang2017UnderstandingDL}, further studies on network convergence behavior and realistic dataset noise have found that this result does not necessarily explain performance in practice. Instead, deep networks first learn patterns across samples before memorizing data points \cite{Arpit2017ACL}. \cite{Rahaman2019Spectral} formalize this finding and show that deep networks have a learning bias towards low-frequency functions by using tools from Fourier analysis and \cite{Basri2019TheCR} extend this result by showing that networks fit increasingly higher frequency functions over the course of training. Within learning-based robotics, multiple works have found the related result that higher-level action spaces lead to improved learnability. Specifically, the frequency of the action space can have an outsized effect on the robustness and quality of learned policies \cite{peng2017learning}. This could explain why learned, latent actions improve performance and generalizability for policies trained either with reinforcement learning \cite{Haarnoja2018LatentSP,Hausman2018LearningAE,Nair2020HierarchicalFS,Pflueger2020PlanSpaceSE} or imitation learning \cite{fox2017multi}. \begin{figure}[t] \centering \noindent\includegraphics[width=\linewidth]{images/implicit_vs_explicit.png} \caption{Integrating forward kinematics (FK), in particular, synergizes with implicit policies (a, b), where actions $\textbf{a}$ are sampled in joint space, and both joints and corresponding Cartesian actions along with observations $\textbf{o}$ can be fed as inputs to the EBM $f_\theta$. For explicit policies (c), it becomes less clear how to expose both action spaces in a kinematically consistent way to the deep network, except via predicting joints from observations, then using forward kinematics to backpropagate gradients from losses imposed on the final output Cartesian actions (in red). In this work, we investigate both formulations and find that implicit (b) yields better performance. } \label{fig:key-idea} \vspace{-2em} \end{figure} \section{Background} \subsection{Problem Formulation} We consider the imitation learning setting with access to a fixed dataset of observation-action pairs. We frame this problem as supervised learning of a policy $\pi: \mathcal{O} \rightarrow \mathcal{A}$ where $\mathbf{o} \in \mathcal{O} = \mathbb{R}^m$ represents an observational input to the policy and $\mathbf{a} \in \mathcal{A} = \mathbb{R}^d$ represents the action output. The policy $\pi$, with parameters $\theta$, can either be formulated as an {\em{explicit}} function $f_{\theta}(\mathbf{o}) \rightarrow \hat{\mathbf{a}}$ or as an {\em{implicit}} function $\arg\min_{\mathbf{a}\in\mathcal{A}} E(\mathbf{o}, \mathbf{a}) \rightarrow \hat{\mathbf{a}}$. In this work, we adopt the implicit formulation and build upon recent work which we describe in more detail in Section \ref{implicitbcsec}. We operate in the continuous control setting, where our policy infers a desired target configuration at 10 Hz, and a low-level controller asynchronously reaches desired configurations with a joint-level PD controller. Our $\mathcal{O}$ contains both image observations and proprioceptive robot state (i.e. from joint encoders). \subsection{Implicit BC} \label{implicitbcsec} We use an energy-based, contrastive loss to train our implicit policy, modeled with the same late-fusion deep network architecture as in \cite{florence2021implicit} with 26 convolutional ResNet layers \cite{resnets_2016} for the image encoder and 20 dense ResNet layers for the EBM. Specifically, to optimize $E_{\theta}(\cdot)$, we train an InfoNCE style loss \cite{Oord2018RepresentationLW} on observation-action samples \cite{florence2021implicit}. Our dataset consists of $\{\mathbf{o}_i, \mathbf{a}^*_i\}$ for $\mathbf{o}_i \in \mathbb{R}^m$ and $\mathbf{a}_i \in \mathbb{R}^d$ and from regression bounds $\mathbf{a}_{\min} , \mathbf{a}_{\max} \in \mathbb{R}^d$ we generate negative samples $\{\tilde{\mathbf{a}}_i^j\}_{j=1}^{N_{\text{neg.}}}$. The loss equates to the negative log likelihood of $p(\mathbf{a}|\mathbf{o})$ where we use negative samples to approximate the normalizing constant: \begin{align*} \mathcal{L}_{\text{InfoNCE}} &= \sum_{i=1}^N -\log(\tilde{p}_\theta(\mathbf{a}^*_i|\mathbf{o}_i,\{\tilde{\mathbf{a}}_i^j\}_{j=1}^{N_{\text{neg.}}})) \\ \tilde{p}_\theta(\mathbf{a}^*_i|\mathbf{o}_i,\{\tilde{\mathbf{a}}_i^j\}_{j=1}^{N_{\text{neg.}}}) &= \frac{e^{-E_\theta(\mathbf{o}_i, \mathbf{a}^*_i)}}{e^{-E_\theta(\mathbf{o}_i, \mathbf{a}^*_i)} + \sum_{j=1}^{N_{\text{neg.}}}e^{-E_\theta(\mathbf{o}_i, \tilde{\mathbf{a}}_i^j)}} \end{align*} To perform inference, given some observation $\mathbf{o}$, we minimize our learned energy function, $E_{\theta}(\mathbf{o}, \mathbf{a})$, over actions in $\mathcal{A}$ using a sampling-based optimization procedure. \label{implicitbc} \label{background} \section{Method} Here we present the details of our proposed Implicit Kinematic Policies (IKP) method. First, we will present our extension to the implicit policy formulation which provides multiple action space representations as input. (Sec.~\ref{subsec:multi-action-space}). Sec.~\ref{subsec:multi-action-space-explicit} also compares the implicit multi-action-space formulation to its explicit counterpart and discusses the relevant tradeoffs. We then describe how to perform autoregressive training and inference with implicit policies in a way that exposes the action trajectories of every joint and link in the robot to the model (Sec.~\ref{subsec:autoregressive-formulation}). Finally, we discuss a motivating application of controlling miscalibrated robots for precise tasks, and how IKP is uniquely suited to automatically compensate for this noise through the use of strategically placed residual blocks in the model (Sec.~\ref{subsec:residual-formulation}). \subsection{Multi-Action-Spaces With Implicit Policies}\label{subsec:multi-action-space} Our formulation enables the implicit policy $\hat{\mathbf{a}} = \arg\min_{\mathbf{a}} E_{\theta}(\mathbf{o}, \mathbf{a})$ to have access to multiple action spaces, which are constrained to be consistent. Specifically, our implicit multi-action-space formulation is of the form: \vspace{-.85em} \begin{equation} \begin{aligned} \underset{\mathbf{a}, \mathbf{a}', ...}{\arg\min} \quad & E_{\theta}(\mathbf{o}, \mathbf{a}, \mathbf{a}', ...)\\ \textrm{s.t.} \quad & \mathbf{a} = \mathcal{T}(\mathbf{a}'), ... \end{aligned} \label{eq:general-multi-action-space} \end{equation} where $\mathbf{a} \in \mathcal{A}$ is one parameterization of the action space, $\mathbf{a}' \in \mathcal{A}'$ is a different parameterization of the action space, and $\mathcal{T}(\cdot): \mathcal{A}' \rightarrow \mathcal{A}$ is a transformation between the two action spaces. Of course, $N$ different consistent parameterizations of the action space could be represented, which is depicted in Eq.~\ref{eq:general-multi-action-space} by the ellipses (...). In particular for robots, we are interested in representing both {\em{joint-space}} and {\em{cartesian-space}} actions, which is a case of Eq.~\ref{eq:general-multi-action-space} in which the transformation between the two action spaces is forward kinematics (FK): \vspace{-0.75em} \begin{equation} \begin{aligned} \underset{\mathbf{a}_{\text{joints}}, \ \mathbf{a}_{\text{cartesian}}}{\arg\min} \quad & E_{\theta}(\mathbf{o}, \mathbf{a}_{\text{joints}}, \mathbf{a}_{\text{cartesian}})\\ \textrm{s.t.} \quad & \mathbf{a}_{\text{cartesian}} = FK(\mathbf{a}_{\text{joints}}) \end{aligned} \label{eq:joints-cartesian-implicit} \end{equation} Specifically, we accomplish this by first sampling input actions in joint space $\mathbf{a}_{\text{joints}} \in \mathcal{A}_{\text{joints}}$, then computing the corresponding Cartesian (task) space actions via forward kinematics ($FK$), $\mathbf{a}_{\text{cartesian}} = FK(\mathbf{a}_{\text{joints}})$, and finally concatenating and passing the combined representation into the model $E_{\theta}(\mathbf{o}, \mathbf{a}_{\text{joints}}, \mathbf{a}_{\text{cartesian}})$. A visualization of this model is shown in the middle portion of Fig.~\ref{fig:key-idea}. Our hypothesis is that the model can use this redundant action representation to exploit patterns in both spaces, akin to {\em{automatically}} discovering the best combination of action spaces -- this hypothesis will be tested in our Experiments section. As we will show in Sec.~\ref{subsec:autoregressive-formulation}, we can perform training and inference for $E_{\theta}$ through using autoregressive derivative-free optimization. \begin{figure*}[t!] \label{fkdiagram} \centering \noindent\includegraphics[width=\textwidth]{images/overview.png} \caption{ \textbf{Method overview.} Given an image captured from an RGB camera overlooking the robot workspace (a), we feed it as input to a deep convolutional network (b) to get a latent state representation. We then predict desired robot joint actions by leveraging implicit autoregression \cite{florence2021implicit, nash2019autoregressive} (c) with state-conditioned EBMs to progressively sample each action dimension (joint angle) at a time: i.e., we uniform sample $\text{j}_n$, feed it to $\text{FK}_n$ (forward kinematics to link $n$, prepended with deep layers) to get the Cartesian pose $\text{C}_{n}$, which is then concatenated with the latent state and all previously sampled argmin joint dimensions $[\text{j}_n, \text{j}_{n-1}, ..., \text{j}_0]$ and Cartesian representations $[\text{C}_{n-1}, ..., \text{C}_0]$ and fed to an 8-layer EBM $\text{E}_{n}$ to compute the argmin over $\text{j}_n$. } \label{fig:method-overview} \vspace{-1.5em} \end{figure*} \subsubsection{Multi-Action-Spaces With Explicit Policies} \label{subsec:multi-action-space-explicit} Consider the above formulation in contrast to an explicit policy, $\hat{\mathbf{a}}=f_{\theta}(\mathbf{o})$, where the mapping $f_{\theta}(\cdot)$ maps to one specific action space. It is possible to provide different losses on different transformations of the explicit policy's action space, for example $\mathcal{L}_{\text{joints}}(\hat{\mathbf{a}}, \mathbf{a}^*)$ and $\mathcal{L}_{\text{cartesian}}(FK(\hat{\mathbf{a}}), FK(\mathbf{a}^*))$, where $FK$ represents differentiable forward kinematics. However, this can lead to conflicting gradients and requires choosing relative weightings, $\lambda$, between these losses: $\mathcal{L}_{\text{total}} = \mathcal{L}_{\text{joints}} + \lambda \mathcal{L}_{\text{cartesian}}$. This issue of loss balancing is exacerbated if the explicit policy were to regress the Cartesian representation of every link in the robot in addition to the joint configuration and end-effector pose. Additionally, the explicit policy predicts a single joint configuration even though there may be multiple correct configurations when using kinematically redundant robots. It is possible to first regress Cartesian actions and subsequently recover the corresponding joint configuration via inverse kinematics, however, IK solvers are only approximately differentiable which poses challenges for end-to-end training. A visualization of this explicit policy is shown in the rightmost column of Fig.~\ref{fig:key-idea}. \subsection{Autoregressive Implicit Training and Inference} \label{subsec:autoregressive-formulation} As in \cite{florence2021implicit}, we employ an autoregressive derivative-free optimization method for both training and inference. Sampling-based, derivative-free optimization synergizes with the multi-action-space constrained energy model (Eq.~\ref{eq:general-multi-action-space}), since gradient-based optimization (i.e. through Langevin dynamics \cite{florence2021implicit}), while possible, would require a solution to synchronize between the different action spaces.\footnote{Specifically, when using the implicit model gradients, with learning rate $\lambda$, the actions are updated as $\mathbf{a}_{\text{joints}}^{k+1} = \mathbf{a}_{\text{joints}}^{k} - \lambda \nabla_{\mathbf{a}_{\text{joints}}} E_{\theta}(\cdot)$ and $\mathbf{a}_{\text{cartesian}}^{k+1} = \mathbf{a}_{\text{cartesian}}^{k} - \lambda \nabla_{\mathbf{a}_{\text{cartesian}}} E_{\theta}(\cdot)$. The updated actions actions may not be consistent with each other -- even for an analytical model, there will be differences in the first-order derivatives of the different spaces.} The autoregressive procedure uses $m$ models, one model $E_{\theta}^{j}(\mathbf{o}, \mathbf{a}^{0:j})$ for each dimension $j = 1, 2, ...,m$. In contrast with prior work \cite{florence2021implicit}, instead of $\mathbf{a}$ only representing a single action space, our proposed method represents, for each $j$th model, both the 6DoF Cartesian pose of the $j$th link {\em{and}} the joint of that link into $\mathbf{a}$. Similarly in $\mathbf{o}$ we also represent the dual Cartesian-and-joint state of each link. Since our method strictly samples actions in joint space and the state is represented by the joint configuration, the Cartesian representations for both the state $\mathbf{o}$ and actions $\mathbf{a}$ are acquired through $FK(\mathbf{o})$ and $FK(\mathbf{a})$ for every dimension $j = 1, 2, ...,m$. We visualize this procedure in Fig. \ref{fig:method-overview} \subsection{Residual Forward Kinematics} \label{subsec:residual-formulation} In robotics, we often assume access to accurate kinematic descriptions and joint encoders, but this assumption can be a significant source of error in the context of low-cost or cable-driven robots. In these settings, the errors often take the form of fixed, unknown linear offsets in each joint motor encoder or link representation. If calibration isn't performed, both cases can cause heavy non-linear offsets in end-effector space which can drastically affect the performance on high-precision tasks. By adding dense residual blocks both before and after joint actions are sampled in the autoregressive procedure, we can encourage our model to learn these linear offsets at each joint and link rather than solving the more difficult problem of learning a highly non-linear offset in task space. This extension is only possible due to the full differentiability of the forward kinematics layer, which allows gradients to flow through the residual blocks. Concretely, we redefine our multi-action-space formulation with residuals as follows: \vspace{-1.5em} \begin{equation} \begin{aligned} \underset{\mathbf{a}_{\text{joints}}, \ \mathbf{a}_{\text{cartesian}}}{\arg\min} \quad & E_{\theta}(\mathbf{o}, \mathbf{a}_{\text{joints}}, \mathbf{a}_{\text{cartesian}})\\ \textrm{s.t.} \quad & \mathbf{a}_{\text{cartesian}} = FK\big(\mathbf{a}_{\text{joints}} + \Delta_{\theta}(\mathbf{a}_{\text{joints}})\big) \end{aligned} \label{eq:joints-cartesian-residuals-implicit} \end{equation} where $\Delta_{\theta}(\mathbf{a}_{\text{joints}}) \in \mathcal{A}_{\text{joints}}$ is a new learnable module in the implicit model which gives the model the inductive bias that there may be imperfect calibration of the joint measurements (i.e., biased joint encoder measurements). The module $\Delta_{\theta}(\cdot)$ can be learned during training and we hypothesize that the EBM may be able to automatically learn the $\Delta_{\theta}(\cdot)$ which provides the lowest-energy fit of the data. This can be interpreted as automatically calibrating the biased joint encoders. Experiments testing this hypothesis are in Section~\ref{subsec:residual-experiments}. \begin{figure}[t] \centering \noindent\includegraphics[width=\linewidth]{images/Sweeping+Flipping.png} \caption{Expert trajectories for bimanual sweeping are characterized by distinct patterns in Cartesian space (b), e.g., y-values experience a mode-change in the latter half of the episode when the policy switches bowls in which to drop particles. Such patterns are less salient in joint space (a). The opposite is true for bimanual flipping, where linear patterns emerge in joint space (c), whereas they are less salient in Cartesian space (d) especially with randomized end effector poses (semi-transparent plots).} \label{fig:tasks} \vspace{-1.5em} \end{figure} \section{Experiments} We evaluate IKP across several vision-based continuous control manipulation tasks with quantitative experiments in simulation, as well as qualitative results on a real robot. All tasks require generalization to unseen object configurations at test time. The goals of our experiments are two-fold: (i) across tasks where one action space substantially outperforms the other, we investigate whether IKP can achieve the best of both and perform consistently well across all tasks, and (ii) given a miscalibrated robot with unknown offsets in the joint encoders (representing miscalibration or low-cost encoders), we study whether IKP can autonomously learn to compensate for these offsets while still succeeding at the task. Across all experiments, a dataset of expert demonstrations is provided by a scripted oracle policy (in simulation), or by human teleoperation (in real). \subsection{\textbf{Simulated Bimanual Sweeping and Flipping}} In a simulated environment, we evaluate on two bimanual tasks -- sweeping and flipping -- both of which involve two 7DoF KUKA IIWA robot arms equipped with spatula-like end-effectors positioned over a $0.4m^2$ workspace. The setup for sweeping is identical to that presented in Florence et al. \cite{florence2021implicit}, where given a pile of 50-60 particles on the workspace, the task is to scoop and evenly distribute all particles into two bowls located next to the workspace. For flipping, given a bowl of 20-30 particles attached to the top of a $0.2m^3$ box, the task is to flip the box to pour the particles into a larger bowl positioned near the base of the arms. Both tasks are designed to involve significant coordination between the two arms. During sweeping, for example, scooping up particles and transporting them to the bowls requires carefully maintaining alignment between the tips of the spatulas to avoid dropping particles. Flipping, on the other hand, requires aligning the elbow surfaces against the sides of the box, and using friction to carry the box as it pours the particles into the bowl -- any subtle misalignment of the elbow against the sides can lead to the box slipping away or tipping over. For both tasks, we generate fixed datasets of 1,000 demonstration episodes using a scripted oracle with access to privileged state information, including object poses and contact points, which are not accessible to policies. We train two Implicit BC \cite{florence2021implicit} baselines \textit{without} Residual Kinematics: one using a 12DoF Cartesian action space (6DoF end-effector pose for each arm), and another using a 14DoF joint action space (7DoF for each arm). From the quantitative results presented in Tab. \ref{table:bimanual-experiments}, we observe that the performance of Implicit BC on bimanual sweeping degrades substantially when using a joint action space. This is likely that learning the task (\i.e. distribution of oracle demonstrations) involves recognizing a number of Cartesian space constraints that are less salient in joint space: e.g., keeping the Cartesian poses of the spatulas aligned with each other while scooping and transporting particles, and maintaining z-height with the tabletop. For bimanual flipping, on the other hand, we observe the opposite: where the performance of Implicit BC performs well with joint actions, but poorly with Cartesian actions. We conjecture that the task involves more whole-body manipulation, where fitting policies in joint space are more likely to result in motion trajectories that accurately conform to the desired elbow contact with the box. \vspace{-.7em} \begin{table}[h] \centering \caption{\scriptsize Performance Measured in Task Success (Avg $\pm$ Std \% Over 3 Seeds)} \begin{tabular}[b]{@{}lcccccccc@{}} \toprule Task & Sweeping & Flipping \\ {\em{Oracle's action space}} & \em{cartesian} & \em{joints} \\ Policy Action Space & & \\ \midrule Cartesian & 79.4 $\pm$ 2.1 & 38.6 $\pm$ 5.2\\ Joints & 44.3 $\pm$ 3.2 & \textbf{98.4 $\pm$ 1.4} \\ Joints + Cartesian (Ours) & \textbf{85.9 $\pm$ 1.5} & \textbf{97.5 $\pm$ 1.2} \\ \bottomrule \end{tabular} \vspace{-1.0em} \label{table:bimanual-experiments} \end{table} Our proposed method, Implicit Kinematic Policies (labeled as Joints + Cartesian in Tab. \ref{table:bimanual-experiments}) leverages both action spaces. Results suggest its performance is not only on par with the best bespoke action space for the task, but also surprisingly exceeds the performance of Cartesian actions for bimanual sweeping. Upon further inspection of the action trajectories for bimanual sweeping, it is evident that the Cartesian space action trajectories (Fig. \ref{fig:tasks}b) are lower frequency and contain more piecewise linear structure in comparison to the joint space action trajectories (Fig.~\ref{fig:tasks}a). Implicit policies have shown to thrive in conditions where this structure is present \cite{florence2021implicit}. In contrast, for bimanual flipping, the joint space action trajectories (Fig.~\ref{fig:tasks}c) appear much more linear and low frequency than the corresponding arc-like Cartesian trajectories (Fig.~\ref{fig:tasks}d). We also add small perturbations to the end-effector pose highlighted by the semi-transparent lines in plot (d) of Fig.~\ref{fig:tasks}. Note that the Implicit (Cartesian) policy uses a generic IK solver which can return multiple distinct joint target commands, causing less stable trajectories overall. \begin{figure}[t] \centering \noindent\includegraphics[scale=0.2]{images/Insertion+Sweeping.png} \vspace{-0.5em} \caption{Simple constant joint encoder errors (which may appear from drift in low-cost or cable-driven robots) can propagate to non-linear offsets in Cartesian space. By learning joint space residuals to compensate for these offsets, IKP is better equipped to generalize over such errors than standard end-to-end policies trained in Cartesian space for tabletop manipulation.} \label{fig:residual-deltas} \vspace{-1.5em} \end{figure} \subsection{\textbf{Simulated Miscalibrated Sweeping and Insertion}} \label{subsec:residual-experiments} We design two additional tasks to evaluate IKP's ability to learn high precision tasks in the presence of inaccurate joint encoders, described in Sec.~\ref{subsec:residual-formulation}. To replicate such a scenario, we simulate these errors by adding constant $<$ 2 degree offsets to each of the six revolute joints on a UR5e robot. These offsets are visualized and described in more detail in Fig.~\ref{fig:residual-deltas}. We test the effect of these offsets on the bimanual sweeping task and a new insertion task where the goal is to insert an L-shaped block into a tight fixture. Demonstrations for both tasks are provided in the form of a Cartesian scripted oracle with privileged access to the underlying joint offsets and can compensate for them. This is akin to a human using visual servoing to compensate for inaccurate encoders when teleoperating a real robot to collect expert demonstrations. Although both tasks are generally well-defined in Cartesian space as a series of linear step functions, the joint offsets induce high-frequency non-linear artifacts in the end-effector trajectory (Fig.~\ref{fig:residual-deltas}b and \ref{fig:residual-deltas}d) causing poor performance with the Implicit (Cartesian) policy (results in Tab.~\ref{table:noisy-experiments}). Poor performance persists for miscalibrated insertion despite using 10x the data. Alternatively, even though the encoder offsets only cause linear shifts in the joint trajectories (Fig.~\ref{fig:residual-deltas}a and \ref{fig:residual-deltas}c), both tasks are less structured in joint space and as a result Implicit (Joints) performs significantly worse on miscalibrated bimanual sweeping and comparatively worse on miscalibrated insertion. Implicit (Joints) performs relatively well on the miscalibrated insertion task due to the simplicity of the pick and place motion, but struggles to generalize when the block nears the edge of workspace as the joint trajectories become increasingly non-linear in those regions. The performance only slightly improves when using 1000 demonstrations. IKP provides a best-of-all-worlds solution by learning the linear offsets in joint space through the residual blocks while simultaneously exploiting the unperturbed Cartesian trajectories through forward kinematics on the shifted joint actions to generalize. IKP achieves the highest performance on miscalibrated insertion with both 100 and 1000 demonstrations, and significantly higher performance on miscalibrated bimanual sweeping. Interestingly, not only do Explicit and ExplicitFK perform significantly worse than both Implicit (Joints) and IKP for both tasks, but ExplicitFK also provides little to no additional benefit over Explicit, even in the presence of more data. \begin{table}[h] \centering \caption{\scriptsize Miscalibrated Joint Encoder Experiments, Performance Measured in Task Success (Avg $\pm$ Std. \% Over 3 Seeds). (``J+C'') is short for Joints+Cartesian.} \begin{tabular}[b]{@{}lcccccccc@{}} \toprule Task & Sweeping & \multicolumn{2}{c}{Block Insertion}\\ {\em{Oracle's action space}} & \em{cartesian} & \multicolumn{2}{c}{\em{cartesian}}\\ Method (Action Space) & 1000 & 100 & 1000\\ \midrule Explicit (Joints) & 38.2 $\pm$ 3.4 & 73.8 $\pm$ 4.3 & 74.2 $\pm$ 2.5\\ ExplicitFK (J + C) (Ours) & 40.3 $\pm$ 4.6 & 72.4 $\pm$ 3.8 & 75.4 $\pm$ 2.8\\ Implicit (Cartesian) & 3.1 $\pm$ 2.2 & 0.0 $\pm$ 0.0 & 0.0 $\pm$ 0.0\\ Implicit (Joints) & 46.3 $\pm$ 1.8 & 82.3 $\pm$ 2.9 & 85.2 $\pm$ 3.1 \\ IKP (J + C) (Ours) & \textbf{84.5 $\pm$ 1.2} & \textbf{88.8 $\pm$ 3.4} & \textbf{92.4 $\pm$ 2.6}\\ \bottomrule \end{tabular} \vspace{-1.0em} \label{table:noisy-experiments} \end{table} \subsection{\textbf{Real Robot Sorting, Sweeping, and Alignment}} We conduct qualitative experiments with a real UR5e robot on two tasks: 1) sorting two blocks into bowls and subsequently sweeping the bowls, and 2) aligning a red block with a blue block, where both tasks have initial locations randomized). Our goal with these experiments is two-fold: i) to demonstrate that IKP can run on real robots with noisy human continuous teleop demonstrations with as few as 100 demonstrations, and ii) to show that Implicit Kinematic Policies can perform both whole-body and prehensile tasks. Demonstrations for the block sorting portion of the first task are provided using continuous Cartesian position control based teleoperation at 100 Hz with a 3D mouse. Once the blocks are sorted, the teleoperator switches to a joint space PD controller with the same 3D mouse to guide the arm into an extended pose in order to sweep the bowls. For the alignment task, demonstrations are also provided using x, y and z Cartesian PD control at 100 Hz. Both tasks take 480${\times}$640 RGB images (downsampled to 96${\times}$96) from an Intel RealSense D435 camera at a semi-overhead view as input to the policy, and no extrinsic camera calibration is used. We show successful rollouts for both tasks in Fig.~\ref{fig:real-tasks}. \begin{figure}[t] \centering \noindent\includegraphics[scale=0.23]{images/Real_Robot_Figure.png} \caption{Real robot IKP rollouts on a sweeping and sorting task (top two rows) and a block alignment task (bottom row).} \label{fig:real-tasks} \vspace{-2em} \end{figure} \section{Discussion} In future work, we will investigate using the multi-action-space formulation to extend beyond joint and cartesian PD control by incorporating the forward and/or inverse robot dynamics into the network which will allow us to expose joint torques and velocities to our model in a fully differentiable way. We hypothesize that this additional information will be particularly helpful in dynamic manipulation tasks and visual locomotion where torque and velocity action trajectories may appear more structured. We would also like to further test our residual framework within IKP on robots that have non-linear drift in joint space which may represent a larger set of low-cost robots. Finally, we would like to utilize our fully differentiable residual forward kinematics module to learn the link parameters themselves, which can be a promising direction for controlling soft and/or continuum robots. \section*{Acknowledgments} \small The authors would like to thank Vincent Vanhoucke, Vikas Sindhwani, Johnny Lee, Adrian Wong, Daniel Seita and Ryan Hoque for helpful discussions and valuable feedback on the manuscript. \bibliographystyle{IEEEtranS}
{'timestamp': '2022-03-07T02:02:04', 'yymm': '2203', 'arxiv_id': '2203.01983', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.01983'}
arxiv
\section{Introduction} Anomaly detection (AD) has numerous real-world applications, especially for tabular data, including detection of fraudulent transactions, intrusions for cybersecurity, and adverse outcomes in healthcare. We propose a novel method that targets the following challenges in tabular AD: \begin{itemize}[noitemsep,nolistsep,leftmargin=*] \item \textbf{Noisy and irrelevant features}: Tabular data (such as Electronic Health Records) often contain noisy or irrelevant features caused by measurement noise, outliers and inconsistent units. Yet, even a change in a small subset of features may be considered anomalous. \item \textbf{Heterogeneous features}: Unlike image or text data, tabular data features can have values with significantly different types (numerical, boolean, categorical, and ordinal), ranges and distributions. \item \textbf{Some labeled data}: In many applications, often a small set of labeled data is available. AD accuracy can be substantially boosted by using labeled information to identify some representative anomalies and ignore irrelevant ones. \item \textbf{Interpretability}: Without interpretable outputs, humans cannot understand the rationale behind anomalies, take actions to improve the AD model performance and build trust. Verification of model accuracy is particularly challenging for tabular data as they are not easy to visualize for humans. An interpretable AD model should identify important features used to classify anomalies to enable verification and build trust. \end{itemize} Most AD methods for tabular data fail to address the above challenges -- their performance often deteriorates with noisy features (see Sec.~\ref{sec:experiments}), they cannot incorporate labeled data, and they cannot provide interpretability (see Sec.~\ref{sec:related_work}). In this paper, we aim to address these challenges by proposing a \textbf{D}ata-efficient \textbf{I}nterpretable \textbf{AD} approach, which we call \textbf{DIAD}. Our model architecture is inspired by Generalized Additive Models (GAMs) that have been shown to obtain high accuracy and interpretability for tabular data~\citep{caruana2015intelligible,chang2021interpretable,liu2021controlburn} and are widely used in many applications such as finding outlier patterns and auditing fairness~\citep{tan2018distill}. We propose to employ intuitive notions of Partial Identification (PID) as AD objective and propose to learn them with differentiable GAMs. PID scales to high-dimensional features and handles heterogeneous features, while the differentiable GAM architecture allows fine-tuning with labeled data and retain interpretability. Furthermore, by fine-tuning using a differentiable AUC loss with a small amount of labeled samples, DIAD outperforms other semi-supervised learning AD methods. For example, DIAD improves from 86.2\% to 89.4\% AUC with 5 labeled anomalies by unsupervised AD. DIAD provides rationale on why an example is classified as anomalous using the GAM graphs and also gives insights on the impact of labeled data on decision boundary, which can be used to build global understanding about the task and to help improve the AD performance. \section{Related Work} \label{sec:related_work} AD methods only with normal data are widely studied~\citep{kddtutorial}. The methods closest to the proposed are the tree-based AD. Isolation Forest (IF)~\citep{liu2008isolation} grows decision trees randomly and the shallower the tree depth for the data is, the more anomalous the data is. However, this approach shows performance degradation when feature dimensionality increases. Robust Random Cut Forest (RRCF, \citet{guha2016robust}) further improves IF by choosing features to split based on the size of its range, but it is more sensitive to scale. PIDForest~\citep{gopalan2019pidforest} zooms on the features which have large variances which makes it robust to noisy or irrelevant features. Another family of AD methods are based on generative approaches that learn to reconstruct input features, and use the error of reconstructions or density to identify anomalies. \citet{bergmann2018improving} employs auto-encoders for image data. DAGMM~\citep{zong2018deep} first learns an auto-encoder and uses a Gaussian Mixture Model to estimate density in the low-dimensional latent space. Since these generative approaches are based on reconstructing input features, they may not easily fit in high-dimensional tabular data with noisy and heterogeneous features and small amount of labeled examples. \setlength\tabcolsep{1.5pt} \begin{table}[tbp] \centering \caption{Comparison of related works.} \label{table:related_work} \resizebox{\columnwidth}{!}{ \begin{tabular}{c|ccccc} \toprule & \small{\textbf{\makecell{Utilizing\\unlabeled\\data}}} & \small{\textbf{\makecell{Handling\\noisy\\features}}} & \small{\textbf{\makecell{Handling\\heterogen-\\ous features}}} & \small{\textbf{\makecell{Utilizing\\labeled\\data}}} & \small{\textbf{\makecell{Interpret-\\ability}}} \\ \midrule PIDForest & \checkmark & \checkmark & \checkmark & \ding{55} & \ding{55} \\ DAGMM & \checkmark & \ding{55} & \ding{55} & \ding{55} & \checkmark \\ GOAD & \checkmark & \checkmark & \checkmark & \ding{55} & \ding{55} \\ Deep SAD & \checkmark & \checkmark & \checkmark & \checkmark & \ding{55} \\ ICL & \checkmark & \ding{55} & \checkmark & \ding{55} & \checkmark \\ DevNet & \ding{55} & \checkmark & \checkmark & \checkmark & \ding{55} \\ \midrule \makecell{DIAD\\(Ours)} & \checkmark & \checkmark & \checkmark & \checkmark & \checkmark \\ \bottomrule \end{tabular} } \end{table} Recently, methods with pseudo-tasks have been proposed for AD. One major line of work is to predict geometric transformations~\citep{golan2018deep, bergman2020classification}, such as rotation or random transformations, and use the prediction errors to detect anomalies. \citet{qiu2021neural} instead learns a set of diverse transformations and show improvements for tabular and text data. CutPaste~\citep{li2021cutpaste} learns to classify the images with patches replaced by another image, combined with density estimation in the latent space for image data. Several recent works focus on contrastive learning. \citet{tack2020csi} learns to distinguish synthetic samples from the original distribution and achieves success on image data. \citet{sohn2021learning} first learns a distribution-augmented contrastive representation and then uses a one-class classifier to identify anomalies. Internal Contrastive Learning (ICL, \citet{shenkar2022anomaly}) tries to distinguish between in-window and out-of-window features by a sliding window over features and utilizes the error to identify anomalies, achieving state-of-the-art performance for tabular data. A few AD works focus on explainability. \citet{vinh2016discovering,liu2020lp} explain anomalies from other off-the-shelf detectors; thus, their explanations may not reflect the rationales of the detectors. \citet{liznerski2021explainable} proposes to identify anomalies with a one-class classifier; it uses a CNN without fully connected layers so each output unit corresponds to a receptive field in the input image. This allows visualizations of which part of the input images leads to high error in the output with accurate localization; however, this approach is limited to image data. Several works have been proposed for semi-supervised AD. Deep SAD~\citep{ruff2019deep} extends the deep one-class classification method DSVDD~\citep{ruff2018deep} into the semi-supervised setting. However, their approach is non-interpretable and performs even worse than the unsupervised One-Class SVM for tabular data, while the DIAD outperforms it. DevNet~\citep{pang2019deep} formulates the AD problem into a regression problem and achieves better sample complexity under limited labeled data. \citet{yoon2020vime} trains an embedding similar to BERT~\citep{devlin2018bert} combined with consistency loss~\citep{sohn2020fixmatch} and achieves the state-of-the-art semi-supervised performance in tabular data. See Table~\ref{table:related_work} for a comparison. \section{Methods} \paragraph{Model Architecture} To render AD interpretable and allow back-propagation to learn from labeled data, our work is inspired from the NodeGAM~\citep{chang2021node}, an interpretable and differentiable tree-based GAM model. \paragraph{What are GAM and GA$^2$M?} GAMs and GA$^2$Ms are considered as white-box models since they allow humans to visualize their functional forms in 1-D or 2-D plots by not allowing any 3-way or more feature interactions. Specifically, given an input $x\in\mathbb{R}^{D}$, a label $y$, a link function $g$ (e.g. $g$ is $\log ({p}/{1 - p})$ in binary classification), main effects $f_j$ for each feature $j$, and 2-way feature interactions $f_{jj'}$, GAM and GA$^2$M are expressed as: \begin{align*} &\text{\textbf{GAM}:\ \ \ \ } g(y) = f_0 + \sum_{j=1}^D f_j(x_j), \ \ \ \\ &\text{\textbf{GA$^2$M}:\ \ \ \ } g(y) = f_0 + \sum_{j=1}^D f_j(x_j) + \sum_{j=1}^D\sum_{j' > j} f_{jj'}(x_j, x_{j'}). \end{align*} Unlike commonly-used deep learning architectures that use all the feature interactions, GAMs and GA$^2$M are restricted to lower-order interaction (1 or 2-way), so the impact of each $f_j$ or interaction $f_{jj'}(x_j, x_{j'})$ can be visualized independently as a graph. That means, for $f_j$, we may plot $x_j$ on the x-axis and $f_j(x_j)$ on the y-axis. To plot $f_{jj'}$, we show a scatter plot with $x_j$ on the x-axis and $x_j'$ on the y-axis, where color indicates the value $f_{jj'}$. Note that a linear model is a special case of GAM. Humans can easily simulate the decision making of a GAM by reading $f_j$ and $f_{jj'}$ from the graph for each feature $j$ and $j'$ and taking the sum. Here we review NodeGA$^2$M relevant to our changes. NodeGA$^2$M is based on GA$^2$M but uses the neural trees to learn feature functions $f_j$ and $f_{jj'}$. Specifically, NodeGA$^2$M consists of $L$ layers where each layer has $m$ differentiable soft oblivious decision trees (ODT) of equal depth $C$ where each tree only interacts with at most 2 features. Next, we describe ODTs. \begin{algorithm}[tb] \caption{A soft decision tree} \label{alg:pid_tree} \begin{algorithmic} \STATE {\bfseries Input:} Mini-batch $\bm{X} \in \mathbb{R}^{B \times D}$, Temperature $T$ ($T$ $\xrightarrow{}$ 0) \STATE {\bfseries Symbols:} Tree Depth $C$, Entmoid $\sigma$ \STATE {\bfseries Trainable Parameters}: Feature selection logits $\bm{F}^1, \bm{F}^2 \in \mathbb{R}^{D}$, split Thresholds $\bm{b} \in \mathbb{R}^{C}$, split slope $\bm{S} \in \mathbb{R}^{C}$, \vspace{-5pt} \\\hrulefill \STATE $\bm{F} = [\bm{F}^1, \bm{F}^2, \bm{F}^1,...]^T \in \mathbb{R}^{D \times C}$ \COMMENT{Alternating $\bm{F}^1$, $\bm{F}^2$} \STATE $G = \bm{X} \cdot \text{EntMax}(\bm{F} / T, \text{dim=0}) \in \mathbb{R}^{B \times C}$ \FOR{$c=1$ {\bfseries to} $C$} \STATE $H^c = \sigma(\frac{(\bm{G^c} - b^c)}{S^c \cdot T})$ \COMMENT{Soft binary split} \ENDFOR \STATE $ \bm{e} = \left( {\begin{bmatrix} H^1 \\ (1 - H^1) \end{bmatrix} } \otimes \dots \otimes {\begin{bmatrix} (H^C) \\ (1 - H^C) \end{bmatrix} } \right) \in \mathbb{R}^{B \times 2^C} $ \STATE $E = \text{sum}(\bm{e}, \text{dim=0}) \in \mathbb{R}^{2^C}$ \COMMENT{Sum across batch} \STATE {\bfseries Return:} $E$ count \end{algorithmic} \end{algorithm} \begin{algorithm}[tbp] \caption{DIAD Update} \label{alg:pid_update} \begin{algorithmic} \STATE {\bfseries Input:} Mini-batch $\bm{X}$, Tree model $\mathcal{M}$, Smoothing $\delta$, Leaf weights $w_{tl}$ for each tree $t$ and leaf $l$ in $\mathcal{M}$ \vspace{-5pt} \\\hrulefill \STATE $\bm{X}$ = MinMaxTransform($X$, min=$-1$, max=$1$) \STATE $\bm{X_U} \sim U[-1, 1]$ \COMMENT{Data uniformly drawn from [-1, 1]} \STATE $E^{tl} = \mathcal{M}(X)$ \COMMENT{counts -- See Alg.~\ref{alg:pid_tree}} \STATE $E_U^{tl} = \mathcal{M}(X_U)$ \STATE $E^{tl} = E^{tl} + \delta$, $E_U^{tl} = E_U^{tl} + \delta$ \COMMENT{Smooth the counts} \STATE $V_{tl} = \frac{E^{tl}}{\sum_{n'} E^{tl'}}$ \COMMENT{Volume ratio} \STATE $D_{tl} = \frac{E_U^{tl}}{\sum_{n'} E_U^{tl'}}$ \COMMENT{Data ratio} \STATE $M_{tl} = \frac{V_{tl}^2}{P_{tl}}$ \COMMENT{Second moments} \STATE $m_t \sim \text{Bernoulli}(p)$ \COMMENT{Sample masks per tree $t$} \STATE $M_{tl} = \frac{m_t}{p} * M_{tl} + (1 - m_t) * M_{tl}$ \COMMENT{Per-tree dropout} \STATE $L_M = -\sum_{t,l} M_{tl}$ \COMMENT{Maximize the second moments} \STATE $\hat{s}_{tl} = {V_{tl}} / {P_{tl}}$ \COMMENT{Sparsity} \STATE $s_{tl} = (\frac{2\hat{s}_{tl}}{(\max \hat{s}_{tl} - \min \hat{s}_{tl})} - 1)$ \COMMENT{Normalize to [-1, 1] -- Eq.~\ref{eq:norm_sp}} \STATE $w_{tl} = (1 - \gamma)w_{tl} + \gamma s_{tl}$ \COMMENT{Update weights -- Eq.~\ref{eq:sp_update}} \STATE Optimize $L_M$ by Adam optimizer \end{algorithmic} \end{algorithm} \paragraph{Differentiable ODTs:} An ODT works like a traditional decision tree except for all nodes in the same depth share the same input features and thresholds, which allows parallel computation and makes it suitable for deep learning. Specifically, an ODT of depth $C$ compares chosen $C$ input features to $C$ thresholds, and returns one of the $2^C$ possible options. Mathematically, for feature functions $F^c$ which choose what features to split, splitting thresholds $b^c$, and a response vector $\bm{R} \in \mathbb{R}^{2^C}$, the tree output $h(\bm{x})$ is given as: \begin{equation} h(\bm{x}) = \bm{R} \cdot \left( {\begin{bmatrix} \mathbb{I}(F^1(\bm{x}) - b^1) \\ \mathbb{I}(b^1 - F^1(\bm{x})) \end{bmatrix} } {\otimes} \dots {\otimes} {\begin{bmatrix} \mathbb{I}(F^C(\bm{x}) - b^C) \\ \mathbb{I}(b^C - F^C(\bm{x})) \end{bmatrix} }, \right). \end{equation} where $\mathbb{I}$ is the step function, $\otimes$ is the outer product and $\cdot$ is the inner product. Both feature functions $F^c$ and $\mathbb{I}$ would prevent differentiability. To address this, $F^c(\bm{x})$ is replaced with a weighted sum of features with a temperature annealing that makes it gradually one-hot: \begin{equation} \label{eq:split} F^c(\bm{x}) = \sum_{j=1}^D x_j \text{entmax}_{\alpha}(F^c / T)_{j}, \ \ \ \ T \rightarrow 0. \end{equation} where $\bm{F}^c \in \mathbb{R}^{D}$ are the logits for which features to choose, and entmax$_{\alpha}$~\citep{entmax} is the entmax normalization function as the sparse version of softmax such that the sum equals to $1$. As $T \rightarrow 0$, the output of entmax will gradually become one-hot. Also, we replace $\mathbb{I}$ with entmoid which works like a sparse sigmoid that has output values between $0$ and $1$. Unlike NodeGAM, we also introduce a temperature annealing in the entmoid to make it closer to $\mathbb{I}$ since it performs better under our AD objective. That is: \begin{equation} \text{entmoid}(\frac{\bm{x}}{T}) \rightarrow \mathbb{I}, \ \ \ \ \text{as\ \ } T \rightarrow 0. \end{equation} Differentiability of all operations (entmax, entmoid, outer and inner products), render ODT differentiable. \paragraph{Stacking trees into deep layers:} Similar to residual connections, all tree outputs $\bm{h}(\bm{x})$ from previous layers become the inputs to the next layer. For input features $\bm{x}$, the inputs $\bm{x}^l$ to each layer $l$ become: \begin{equation} \bm{x}^1 = \bm{x}, \ \ \ \bm{x}^l = [\bm{x}, \bm{h}^{1}(\bm{x}^1), ... , \bm{h}^{(l-1)}(\bm{x}^{(l-1)})] \text{\ \ for\ \ } l > 1. \end{equation} The final output of the model $\hat{y}(\bm{x})$ is the average of all the tree outputs ${\bm{h}_1,...,\bm{h}_L}$ of all $L$ layers: \begin{equation} \label{eq:final_output} \hat{y}(x) = \sum\nolimits_{l=1}^L \sum\nolimits_{i=1}^{m} h_{li}(\bm{x^l}) / ({L \cdot m}). \end{equation} \setlength\tabcolsep{2pt} \paragraph{GA$^2$M design} To allow only maximum two-way interactions, for each tree, at most two logits $\bm{F}^1$ and $\bm{F}^2$ are allowed, and let the rest of the depth the same as either $\bm{F}^1$ or $\bm{F}^2$: $\bm{F}^c = \bm{F}^{\left \lfloor{c / 2}\right \rfloor}$ for $c > 2$ -- this allows at most $2$ features to interact within each tree. Also, we avoid the connection between two trees that focus on different feature combinations, since it may create higher feature interactions. See Alg.~\ref{alg:pid_tree} for pseudo code. \begin{table*}[tbp] \centering \caption{Unsupervised AD performance (\% of AUC) on 18 tabular datasets for DIAD and 9 baselines. Metrics with standard error overlapped with the best number are bolded. Methods not involving randomness do not have standard error. We show the number of samples (N) and the number of features (P). Datasets are ordered by N.} \label{table:unsup_perf} \begin{tabular}{c|cccccccccc|cc} \toprule & \textbf{DIAD} & \textbf{PIDForest} & \textbf{IF} & \textbf{COPOD} & \textbf{PCA} & \textbf{ICL} & \textbf{kNN} & \textbf{RRCF} & \textbf{LOF} & \textbf{OC-SVM} & N & P \\ \midrule Vowels & 78.3\tiny{ $\pm$ 0.9 } & 74.0\tiny{ $\pm$ 1.0 } & 74.9\tiny{ $\pm$ 2.5 } & 49.6 & 60.6 & 90.8\tiny{ $\pm$ 2.1 } & \textbf{97.5} & 80.8\tiny{ $\pm$ 0.3 } & 5.7 & 77.8 & 1K & 12 \\ Siesmic & 72.2\tiny{ $\pm$ 0.4 } & 73.0\tiny{ $\pm$ 0.3 } & 70.7\tiny{ $\pm$ 0.2 } & 72.7 & 68.2 & 65.3\tiny{ $\pm$ 1.6 } & \textbf{74.0} & 69.7\tiny{ $\pm$ 1.0 } & 44.7 & 60.1 & 3K & 15 \\ Musk & 90.8\tiny{ $\pm$ 0.9 } & \textbf{100.0}\tiny{ $\pm$ 0.0 } & \textbf{100.0}\tiny{ $\pm$ 0.0 } & 94.6 & \textbf{100.0} & 93.3\tiny{ $\pm$ 0.7 } & 37.3 & 99.8\tiny{ $\pm$ 0.1 } & 58.4 & 57.3 & 3K & 166 \\ Satimage & \textbf{99.7}\tiny{ $\pm$ 0.0 } & 98.2\tiny{ $\pm$ 0.3 } & 99.3\tiny{ $\pm$ 0.1 } & 97.4 & 97.7 & 98.0\tiny{ $\pm$ 1.3 } & 93.6 & 99.2\tiny{ $\pm$ 0.2 } & 46.0 & 42.1 & 6K & 36 \\ Thyroid & 76.1\tiny{ $\pm$ 2.5 } & \textbf{88.2}\tiny{ $\pm$ 0.8 } & 81.4\tiny{ $\pm$ 0.9 } & 77.6 & 67.3 & 75.9\tiny{ $\pm$ 2.2 } & 75.1 & 74.0\tiny{ $\pm$ 0.5 } & 26.3 & 54.7 & 7K & 6 \\ A. T. & 78.3\tiny{ $\pm$ 0.6 } & \textbf{81.4}\tiny{ $\pm$ 0.6 } & 78.6\tiny{ $\pm$ 0.6 } & 78.0 & 79.2 & 79.3\tiny{ $\pm$ 0.7 } & 63.4 & 69.9\tiny{ $\pm$ 0.4 } & 43.7 & 67.0 & 7K & 10 \\ NYC & 57.3\tiny{ $\pm$ 0.9 } & 57.2\tiny{ $\pm$ 0.6 } & 55.3\tiny{ $\pm$ 1.0 } & 56.4 & 51.1 & 64.5\tiny{ $\pm$ 0.9 } & \textbf{69.7} & 54.4\tiny{ $\pm$ 0.5 } & 32.9 & 50.0 & 10K & 10 \\ Mammography & 85.0\tiny{ $\pm$ 0.3 } & 84.8\tiny{ $\pm$ 0.4 } & 85.7\tiny{ $\pm$ 0.5 } & \textbf{90.5} & 88.6 & 69.8\tiny{ $\pm$ 2.7 } & 83.9 & 83.2\tiny{ $\pm$ 0.2 } & 28.0 & 87.2 & 11K & 6 \\ CPU & 91.9\tiny{ $\pm$ 0.2 } & 93.2\tiny{ $\pm$ 0.1 } & 91.6\tiny{ $\pm$ 0.2 } & \textbf{93.9} & 85.8 & 87.5\tiny{ $\pm$ 0.3 } & 72.4 & 78.6\tiny{ $\pm$ 0.3 } & 44.0 & 79.4 & 18K & 10 \\ M. T. & 81.2\tiny{ $\pm$ 0.2 } & 81.6\tiny{ $\pm$ 0.3 } & 82.7\tiny{ $\pm$ 0.5 } & 80.9 & \textbf{83.4} & 81.8\tiny{ $\pm$ 0.4 } & 75.9 & 74.7\tiny{ $\pm$ 0.4 } & 49.9 & 79.6 & 23K & 10 \\ Campaign & 71.0\tiny{ $\pm$ 0.8 } & \textbf{78.6}\tiny{ $\pm$ 0.8 } & 70.4\tiny{ $\pm$ 1.9 } & \textbf{78.3} & 73.4 & 72.0\tiny{ $\pm$ 0.5 } & 72.0 & 65.5\tiny{ $\pm$ 0.3 } & 46.3 & 66.7 & 41K & 62 \\ smtp & 86.8\tiny{ $\pm$ 0.5 } & \textbf{91.9}\tiny{ $\pm$ 0.2 } & 90.5\tiny{ $\pm$ 0.7 } & 91.2 & 82.3 & 82.2\tiny{ $\pm$ 2.0 } & 89.5 & 88.9\tiny{ $\pm$ 2.3 } & 9.5 & 84.1 & 95K & 3 \\ Backdoor & \textbf{91.1}\tiny{ $\pm$ 2.5 } & 74.2\tiny{ $\pm$ 2.6 } & 74.8\tiny{ $\pm$ 4.1 } & 78.9 & 88.7 & \textbf{91.8}\tiny{ $\pm$ 0.6 } & 66.8 & 75.4\tiny{ $\pm$ 0.7 } & 28.6 & 86.1 & 95K & 196 \\ Celeba & \textbf{77.2}\tiny{ $\pm$ 1.9 } & 67.1\tiny{ $\pm$ 4.8 } & 70.3\tiny{ $\pm$ 0.8 } & 75.1 & \textbf{78.6} & 75.4\tiny{ $\pm$ 2.6 } & 56.7 & 61.7\tiny{ $\pm$ 0.3 } & 56.3 & 68.5 & 203K & 39 \\ Fraud & \textbf{95.7}\tiny{ $\pm$ 0.2 } & 94.7\tiny{ $\pm$ 0.3 } & 94.8\tiny{ $\pm$ 0.1 } & 94.7 & 95.2 & \textbf{95.5}\tiny{ $\pm$ 0.2 } & 93.4 & 87.5\tiny{ $\pm$ 0.4 } & 52.5 & 94.8 & 285K & 29 \\ Census & \textbf{65.6}\tiny{ $\pm$ 2.1 } & 53.4\tiny{ $\pm$ 8.1 } & 61.9\tiny{ $\pm$ 1.9 } & \textbf{67.4} & 66.1 & 58.4\tiny{ $\pm$ 0.9 } & 64.6 & 55.7\tiny{ $\pm$ 0.1 } & 45.0 & 53.4 & 299K & 500 \\ http & 99.3\tiny{ $\pm$ 0.1 } & 99.2\tiny{ $\pm$ 0.2 } & \textbf{100.0}\tiny{ $\pm$ 0.0 } & 99.2 & 99.6 & 99.3\tiny{ $\pm$ 0.1 } & 23.1 & 98.4\tiny{ $\pm$ 0.2 } & 64.7 & 99.4 & 567K & 3 \\ Donors & \textbf{87.7}\tiny{ $\pm$ 6.2 } & 61.1\tiny{ $\pm$ 1.3 } & 78.3\tiny{ $\pm$ 0.7 } & 81.5 & 82.9 & 65.5\tiny{ $\pm$ 11.8 } & 61.2 & 64.1\tiny{ $\pm$ 0.0 } & 40.2 & 70.2 & 619K & 10 \\ \midrule Average & \textbf{82.5} & 80.7 & 81.2 & 81.0 & 80.5 & 80.3 & 70.6 & 76.8 & 40.2 & 71.0 & - & - \\ Rank & \textbf{3.6} & 4.4 & 4.0 & 4.2 & 4.2 & 4.7 & 6.6 & 6.7 & 9.8 & 6.8 & - & - \\ \bottomrule \end{tabular} \vspace{-5pt} \end{table*} \paragraph{AD Objectives} Here we introduce the AD objective for our tree-based model: Partial Identification (PID)~\citep{gopalan2019pidforest}. Consider all patients admitted into an ICU. We might consider patients with blood pressure (BP) as 300 as anomalous, since it deviates from most others. In this example, BP of 300 is in a "sparse" feature space since very few people are more than 300. To formalize this intuition, we need to introduce the concept of volume. We first define the max and min value of each feature value. Then, we define the volume of a tree leaf as the product of the proportion of the splits within the min and max value. For example, assuming the max value of BP is 400 and min value is 0, the tree split of "BP $\ge$ 300" has a volume $0.25$. We define the sparsity $s_l$ of a tree leaf $l$ as the ratio between the volume of the leaf $V_l$ and the \% of data in the leaf $D_l$: $$ s_l = {V_l} / {D_l}, $$ and we treat the higher sparsity as more anomalous. Let's assume only less than 0.1\% have values more than 300 and the volume of "BP $\ge$ 300" is 0.25, this patient is quite anomalous in the data by having a large sparsity $\frac{0.25}{0.1\%}$. To learn the effective splitting of regions with high vs. low sparsity, we optimize the tree structures to maximize the variance of sparsity across leafs, as it splits the space into a high (anomalous) and a low (normal) sparsity region. Note that the expected sparsity weighted by the number of data in each leaf is a constant $1$. Given each tree leaf $l$, the \% of data in the leaf is $D_l$, sparsity $s_l$: \begin{equation} \mathbb{E}[s] = \sum_l [D_l s_l] = \sum_l [D_l \frac{V_l}{D_l}] = \sum_l [V_l] = 1. \end{equation} Therefore, maximizing variance equals to maximizing the second moment of sparsity since the first moment is $1$: \begin{equation} \max \text{Var}[s] = \max \sum\nolimits_l D_l s_l^2 = \max \sum\nolimits_l {V_l^2}/{D_l}. \end{equation} \paragraph{Estimating volume and the data ratio} The above objectives require estimating \% of volume $V_l$ and \% of data $D_l$ for each leaf $l$. However, calculating volume exactly is not trivial in an oblivious decision tree since it involves complicated rules extractions. Instead, we sample random points uniformly in the input space, and count the number of the random points that end up in each tree leaf. And more points in a leaf indicate higher volume. To avoid the zero count in the denominator, we use Laplacian smoothing, which adds a constant $\delta$ to each count. We find it's crucial to set a large $\delta$, around 50-100, to encourage models to ignore the tree leaves with fewer counts. Similarly, we estimate $D_l$ by counting the data ratio in each mini-batch. We add $\delta$ for both $V_l$ and $D_l$. \paragraph{Regularization} To encourage diverse trees, we introduce a per-tree dropout noise on the estimated momentum to make each tree operate on a different subset of samples in a mini-batch. We also restrict each tree to only split on $\rho\%$ of features randomly to promote diverse trees (Supp.~\ref{appx:hparams}). \paragraph{Updating leafs' weight} We set the leafs' response as the sparsity to reflect the degree of the anomaly. However, since sparsity estimation involves randomness, we set the response as the damped value of sparsity to stabilize the performance. Specifically, given the training step $i$, sparsity $s_l^i$ for each leaf $l$, and the update rate $\gamma$: \begin{equation} w_l^i = (1 - \gamma)w_l^{(i-1)} + \gamma s_l^i. \label{eq:sp_update} \end{equation} \paragraph{Normalizing sparsity} Because of the residual connections, the output of each tree adds with the input features and the summation becomes the input to the next tree. But this creates a very large magnitude difference -- as the output of trees could have sparsity values up to $10^4$ but the input feature is normalized to -1 and 1, naive optimization tends to ignore the input features. Also, the large outputs of trees make fine-tuning hard and lead to inferior performance in the semi-supervised setting (Sec.~\ref{sec:ablation}). To circumvent this magnitude difference, we linearly scale the min and max value of the estimated sparsity to -1 and 1: \begin{equation} \hat{s}_l = {V_l} / {D_l},\ \ \ \ \ s_l = {2\hat{s}_l} / {(\max_l \hat{s}_l - \min_l \hat{s}_l)} - 1. \label{eq:norm_sp} \end{equation} Algorithm ~\ref{alg:pid_update} overviews all training update steps. \paragraph{Incorporating labeled data} To optimize the labeled data in the imbalanced setting, we optimize the differentiable AUC loss~\citep{yan2003optimizing} which has been shown effective in the imbalanced setting. Specifically, given a mini-batch of labeled positive data $X_P$ and labeled negative data $X_N$, model $\mathcal{M}$, it minimizes \begin{equation} L_{PN} = \frac{1}{|X_P| |X_N|} \sum_{x_p \in X_P, x_n \in X_N} \max(\mathcal{M}(x_n) - \mathcal{M}(x_p), 0). \end{equation} We compare this AUC loss to commonly-used Binary Cross Entropy (BCE) loss (Sec.~\ref{sec:ablation}). \paragraph{Data Loader} Similar to Devnet~\citep{devnet}, we upsample the positive samples to make each mini-batch have the same number of positive and negative samples. We find it improves over uniform sampling (Sec.~\ref{sec:ablation}). \setlength\tabcolsep{2pt} \begin{figure*}[tbp] \begin{center} \begin{tabular}{ccccc} & (a) Vowels & (b) Satimage & (c) Thyroid & (d) NYC \\ \raisebox{4\normalbaselineskip}[0pt][0pt]{\rotatebox[origin=c]{90}{\small AUC}} & \includegraphics[width=0.24\linewidth]{figures/ss_summary2/vowels.pdf} & \includegraphics[width=0.24\linewidth]{figures/ss_summary2/satimage-2_nolegend.pdf} & \includegraphics[width=0.24\linewidth]{figures/ss_summary2/thyroid_nolegend.pdf} & \includegraphics[width=0.24\linewidth]{figures/ss_summary2/nyc_taxi_nolegend.pdf} \vspace{-5pt} \\ & \ \ \ \ \ No. Anomalies & \ \ \ \ \ No. Anomalies & \ \ \ \ \ No. Anomalies & \ \ \ \ \ No. Anomalies \vspace{5pt} \\ & (e) CPU & (f) Campaign & (g) Backdoor & (h) Donors \\ \raisebox{4\normalbaselineskip}[0pt][0pt]{\rotatebox[origin=c]{90}{\small AUC}} & \includegraphics[width=0.24\linewidth]{figures/ss_summary2/cpu_utilization_asg_misconfiguration.pdf} & \includegraphics[width=0.24\linewidth]{figures/ss_summary2/campaign_nolegend.pdf} & \includegraphics[width=0.24\linewidth]{figures/ss_summary2/backdoor_nolegend.pdf} & \includegraphics[width=0.24\linewidth]{figures/ss_summary2/donors_nolegend.pdf} \vspace{-5pt} \\ & \ \ \ \ \ No. Anomalies & \ \ \ \ \ No. Anomalies & \ \ \ \ \ No. Anomalies & \ \ \ \ \ No. Anomalies \vspace{5pt} \\ \end{tabular} \end{center} \caption{ Semi-supervised AD performance on 8 tabular datasets (out of 15) with varying number of anomalies. Our method `DIAD' (blue) outperforms other semi-supervised baselines. Summarized results can be found in Table.~\ref{table:ss_summary}. See the remaining plots with 7 tabular datasets in Supp.~\ref{appx:ss_figures_appx}. } \label{fig:ss} \end{figure*} \section{Experiments} \label{sec:experiments} We evaluate DIAD on various tabular datasets, in both unsupervised and semi-supervised settings. Detailed experimental settings and additional results are in Supplementary. \subsection{Unsupervised Anomaly Detection} We compare methods on $20$ tabular datasets, including $14$ datasets used in \citet{gopalan2019pidforest} and $6$ larger datasets from \citet{devnet}. Since it's hard to tune hyperparameters in the unsupervised setting, for fair comparisons we compare all baselines using default hyperparameters. We run experiments 8 times with different random seeds and take average if methods involve randomness. \begin{table*}[t] \caption{Unsupervised AD performance (\% of AUC) with additional 50 noisy features for DIAD and 9 baselines. We find both DIAD and OC-SVM deteriorate around 2-3\% while other methods deteriorate 7-17\% on average.} \label{table:unsup_noisy_perf} \centering \begin{tabular}{c|cccccccccc} \toprule & \textbf{DIAD} & \textbf{PIDForest} & \textbf{IF} & \textbf{COPOD} & \textbf{PCA} & \textbf{ICL} & \textbf{kNN} & \textbf{RRCF} & \textbf{LOF} & \textbf{OC-SVM} \\ \midrule Thyroid & 76.1\tiny{ $\pm$ 2.5 } & 88.2\tiny{ $\pm$ 0.8 } & 81.4\tiny{ $\pm$ 0.9 } & 77.6 & 67.3 & 75.9\tiny{ $\pm$ 2.2 } & 75.1 & 74.0\tiny{ $\pm$ 0.5 } & 26.3 & 54.7 \\ Thyroid (noise) & 71.1\tiny{ $\pm$ 1.2 } & 76.0\tiny{ $\pm$ 2.9 } & 64.4\tiny{ $\pm$ 1.6 } & 60.5 & 61.4 & 49.5\tiny{ $\pm$ 1.6 } & 49.5 & 53.6\tiny{ $\pm$ 1.1 } & 50.8 & 49.4 \\ Mammography & 85.0\tiny{ $\pm$ 0.3 } & 84.8\tiny{ $\pm$ 0.4 } & 85.7\tiny{ $\pm$ 0.5 } & 90.5 & 88.6 & 69.8\tiny{ $\pm$ 2.7 } & 83.9 & 83.2\tiny{ $\pm$ 0.2 } & 28.0 & 87.2 \\ Mammography (noise) & 83.1\tiny{ $\pm$ 0.4 } & 82.0\tiny{ $\pm$ 2.2 } & 71.4\tiny{ $\pm$ 2.0 } & 72.4 & 76.8 & 69.4\tiny{ $\pm$ 2.4 } & 81.7 & 79.1\tiny{ $\pm$ 0.7 } & 37.2 & 87.2 \\ \midrule Average $\downarrow$ & $\bm{3.5}$ & 7.5 & 15.6 & 17.6 & 8.9 & 13.4 & 13.9 & 12.2 & -16.8 & $\bm{2.7}$ \\ \bottomrule \end{tabular} \end{table*} \paragraph{Baselines} We compare with ICL~\citep{shenkar2022anomaly}, a recent deep-learning AD method, and non-deep learning methods including PIDForest~\citep{gopalan2019pidforest}, COPOD~\citep{copod}, PCA, k-nearest neighbors (kNN), RRCF~\citep{guha2016robust}, LOF~\citep{breunig2000lof} and OC-SVM~\citep{scholkopf2001estimating}. We use 2 aggregate metrics to summarize the performances across datasets: (1) \textbf{Average}: we take the average of AUC across datasets, (2) \textbf{Rank}: to avoid dominant impact of a few datasets, we calculate the rank of each method in each dataset and average across datasets (lower rank is better). We demonstrate overall AUC performances in Table~\ref{table:unsup_perf}. On average, our method performs the best in both Average and Rank. DIAD, using up to 2nd order interactions, performs better or on par with other models for most datasets. Compared to PIDForest, DIAD often underperforms on smaller datasets such as Musk and Thyroid, but outperforms on larger datasets like Backdoor, Celeba, Census and Donors. In Table.~\ref{table:unsup_noisy_perf}, we evaluate the robustness of AD methods with the additional noisy features. More specifically, we follow the experiment settings in \citet{gopalan2019pidforest} to include 50 additional noisy features which are randomly sampled from $[-1, 1]$ to Thyroid and Mammography datasets, and create Thyroid (noise) and Mammography (noise) respectively. In Table.~\ref{table:unsup_noisy_perf}, we show that the performance of DIAD is robust with additional noisy features (76.1$\rightarrow$71.1, 85.0$\rightarrow$83.1), while others show significant performance degradation. For example, on Thyroid (noise), ICL decreases from 75.9$\rightarrow$49.5, KNN from 75.1$\rightarrow$49.5, and COPOD from 77.6$\rightarrow$60.5. \setlength\tabcolsep{2pt} \begin{figure*}[tbp] \centering \begin{tabular}{cccccccc} & (a) Contrast (Sp=$0.38$) & & (b) Noise (Sp=$0.21$) & & (c) Area (Sp=$0.18$) & & \makecell{(d) Area x Gray Level\\(Sp=$0.05$)} \\ \raisebox{4\normalbaselineskip}[0pt][0pt]{\rotatebox[origin=c]{90}{\small Sparsity}}\hspace{-5pt} & \includegraphics[width=0.23\linewidth]{figures/mammography/0_imp0.382_contrast.pdf} & \raisebox{4\normalbaselineskip}[0pt][0pt]{\rotatebox[origin=c]{90}{\small Sparsity}}\hspace{-5pt} & \includegraphics[width=0.23\linewidth]{figures/mammography/1_imp0.206_rms_noise_flucutation.pdf} & \raisebox{4\normalbaselineskip}[0pt][0pt]{\rotatebox[origin=c]{90}{\small Sparsity}}\hspace{-5pt} & \includegraphics[width=0.23\linewidth]{figures/mammography/2_imp0.181_area.pdf} & \raisebox{4\normalbaselineskip}[0pt][0pt]{\rotatebox[origin=c]{90}{\small Gray Level}}\hspace{-5pt} & \includegraphics[width=0.23\linewidth]{figures/mammography/3_imp0.053_area_gray_level.pdf}\vspace{-5pt} \\ & \ \ \ \ \ Contrast & & \ \ \ \ \ Noise & & \ \ \ \ \ Area & & Area \vspace{5pt} \\ \end{tabular} \caption{ Explanations of the most anomalous sample in the Mammography dataset. We show the top 4 contributing GAM plots with 3 features (a-c) and 1 two-way interaction (d). (a-c) x-axis is the feature value, and y-axis is the model's predicted sparsity (higher sparsity represents more anomalous). Model's predicted sparsity is shown in the blue line. The red backgrounds indicate data density and the green line indicates the value of the most anomalous sample with Sp as its sparsity. The model finds it anomalous because it has high Contrast, Noise and Area differing from values where majority of other samples have. (d) x-axis is the Area and y-axis is the Gray Level with color indicating the sparsity (blue/red indicates anomalous/normal). The green dot is the value of the data that has 0.05 sparsity. } \label{fig:mammography_gam_plots} \end{figure*} \subsection{Semi-supervised Anomaly Detection} \label{sec:ss_result} Next, we focus on the semi-supervised setting. We show how much DIAD can improve the performance with small labeled data in comparison to alternatives. We first divide the data into 64\%-16\%-20\% train-val-test splits, and within the training set only a small part of data is labeled. Specifically, we assume the existence of labels for a small subset of the training set (5, 15, 30, 60 or 120 positives and the corresponding negatives to have the same anomaly ratio). The validation set is used for model selection and we report the average performances evaluated on the disjoint 10 data splits. We compare with 3 baselines: (1) \textbf{DIAD w/o PT}: we directly optimize our model under the small labeled data without the first AD pre-training stage. (2) \textbf{CST}: we compare with the Consistency Loss proposed in~\citet{vime} which regularizes the model to make similar predictions between unlabeled data under dropout noise injection. (3) \textbf{DevNet}~\citep{devnet}: the state-of-the-art semi-supervised AD methods. Hyperparameters are in Supp.~\ref{appx:ss_hparams}. \setlength\tabcolsep{4pt} \begin{table}[tbp] \centering \caption{Summary of semi-supervised AD performances. We show the average \% of AUC across 15 datasets with varying number of anomalies.} \label{table:ss_summary} \begin{tabular}{c|cccccc} \toprule \textbf{No. Anomalies} & \textbf{0} & \textbf{5} & \textbf{15} & \textbf{30} & \textbf{60} & \textbf{120} \\ \midrule DIAD & \textbf{87.1} & \textbf{89.4} & \textbf{90.0} & \textbf{90.4} & \textbf{89.4} & \textbf{91.0} \\ DIAD w/o PT & - & 86.2 & 87.6 & 88.3 & 87.2 & 88.8 \\ CST & - & 85.3 & 86.5 & 87.1 & 86.6 & 88.8 \\ DevNet & - & 83.0 & 84.8 & 85.4 & 83.9 & 85.4 \\ \bottomrule \end{tabular} \end{table} Fig.~\ref{fig:ss} shows the AUC across 8 of 15 datasets (the rest can be found in Supp.~\ref{appx:ss_figures_appx}). The proposed version of DIAD (blue) outperforms DIAD without pre-training (orange) consistently in 14 of 15 datasets (except Census dataset), which demonstrates that learning the PID objectives from unlabeled data help improve the performance. Second, both the consistency loss (green) and DevNet (red) do not always improve the performance in comparison to the supervised setting. To conclude, DIAD outperforms all baselines and improve from the unlabeled setting. \setlength\tabcolsep{2pt} \begin{figure*}[tbp] \begin{center} \begin{tabular}{cccccccc} & (a) Great Chat & & \makecell{(b) Great Messages\\Proportion} & & (c) Fully Funded & & (d) \makecell{Referred Count} \\ \raisebox{4\normalbaselineskip}[0pt][0pt]{\rotatebox[origin=c]{90}{\small Output}}\hspace{-5pt} & \includegraphics[width=0.23\linewidth]{figures/ft_donors/great_chat=t.pdf} & \raisebox{4\normalbaselineskip}[0pt][0pt]{\rotatebox[origin=c]{90}{\small Output}}\hspace{-5pt} & \includegraphics[width=0.23\linewidth]{figures/ft_donors/great_messages_proportion.pdf} & \raisebox{4\normalbaselineskip}[0pt][0pt]{\rotatebox[origin=c]{90}{\small Output}}\hspace{-5pt} & \includegraphics[width=0.23\linewidth]{figures/ft_donors/fully_funded=t.pdf} & \raisebox{4\normalbaselineskip}[0pt][0pt]{\rotatebox[origin=c]{90}{\small Output}}\hspace{-5pt} & \includegraphics[width=0.23\linewidth]{figures/ft_donors/teacher_referred_count.pdf}\vspace{-5pt} \\ \end{tabular} \end{center} \caption{ 4 GAM plots on the Donors dataset before (orange) and after (blue) fine-tuning on the labeled samples. In (a, b) we show two features that the labeled information agrees with the notion of sparsity; thus, after fine-tuning the magnitude increases. In (c, d) the label information disagrees with the notion of sparsity; thus, the magnitude changes or decreases after the fine-tuning. } \label{fig:donors_ft} \end{figure*} \subsection{Qualitative analyses on GAM explanations} \paragraph{Explaining anomalous data} To let domain experts understand and debug why a sample is considered anomalous, we demonstrate explaining the most anomalous sample considered by DIAD on Mammography dataset. The task is to detect breast cancer from radiological scans, specifically the presence of clusters of microcalcifications that appear bright on a mammogram. The 11k images are segmented and preprocessed by vision pipelines and extracted 6 image-related features including the area of the cell, constrast, and noise etc. In Fig.~\ref{fig:mammography_gam_plots}, we show the most anomalous data and see which feature contributes the most for sparsity (i.e. anomalous). We illustrate why the model predicts this sample as anomalous; the unusually-high `Contrast' (Fig.~\ref{fig:mammography_gam_plots}(a)) of the image differs from other samples. Also, the unusually high noise (Fig.~\ref{fig:mammography_gam_plots}(b)) and `Large area' (Fig.~\ref{fig:mammography_gam_plots}(c)) also makes it anomalous. Finally, it is also considered quite anomalous in a 2-way interaction (Fig.~\ref{fig:mammography_gam_plots}(d)). Since the sample has `middle area' and `middle gray level' which constitute a rare combination for the dataset. \paragraph{Qualitative analyses on the impact of fine-tuning with labeled data} In Fig.~\ref{fig:donors_ft}, we visualize how predictions change before and after fine-tuning with labeled samples on Donors dataset. Donors dataset consists of 620k educational proposals for K12 level with 10 features, and the anomalies are defined as the top 5\% ranked proposals as outstanding. Here, we show 4 GAM plots before and after fine-tuning. Figs.~\ref{fig:donors_ft} a \& b show that both `Great Chat' and `Great Messages Proportion' increase its magnitude after fine-tuning, showing that the sparsity of these two features is consistent with the labels. On the other hand, Figs.~\ref{fig:donors_ft} c \& d show that after fine-tuning, the model learns the opposite trend. The sparsity definition treats values with less density as more anomalous -- in this case \textit{`Fully Funded'=0} is treated as more anomalous. But in fact `Fully Funded' is a good indicator of outstanding proposals, so after fine-tuning model learns that \textit{`Fully Funded'=1} is in fact more anomalous. This shows the importance of incorporating labeled data into the model to let the model correct its anomaly objective and learn what the intended anomalies are. \section{Ablation and sensitivity analysis} \label{sec:ablation} To analyze the source of gains, we perform ablation studies with some variants of DIAD. The results are presented in Table~\ref{table:ablation}. First, we find fine-tuning with AUC is better than BCE. Sparsity normalization plays an important role in fine-tuning, since sparsity could have values up to $10^4$ which negatively affect fine-tuning. Upsampling the positive samples also contributes to performance improvements. \setlength\tabcolsep{6pt} \begin{table}[h!] \centering \vspace{-10pt} \caption{Ablation study for semi-supervised AD. We test our method with fine-tuning only AUC vs. BCE loss. The performance benefits from more labels. Removing sparsity normalization substantially decreases the performance.} \label{table:ablation} \begin{tabular}{c|ccccc} \toprule \textbf{No. Anomalies} & \textbf{5} & \textbf{15} & \textbf{30} & \textbf{60} & \textbf{120} \\ \midrule DIAD & \textbf{89.4} & \textbf{90.0} & \textbf{90.4} & \textbf{89.4} & \textbf{91.0} \\ Only AUC & 88.9 & 89.4 & 90.0 & 89.1 & 90.7 \\ Only BCE & 88.8 & 89.3 & 89.4 & 88.3 & 89.2 \\ \makecell{Unnormalized\\sparsity} & 84.1 & 85.6 & 85.7 & 84.2 & 85.6 \\ No upsampling & 88.6 & 89.1 & 89.4 & 88.5 & 90.1 \\ \bottomrule \end{tabular} \end{table} \setlength\tabcolsep{5pt} \begin{table}[h!] \centering \caption{Semi-supervised AD performance with 25\% of the original validation data (4\% of total data). } \label{table:ss_val_ratio_main} \begin{tabular}{c|ccccc} \toprule & \multicolumn{5}{c}{25\% val data (4\% of total data)} \\ \midrule \textbf{No. Anomalies} & \textbf{5} & \textbf{15} & \textbf{30} & \textbf{60} & \textbf{120} \\ \midrule DIAD & \textbf{89.0} & \textbf{89.3} & \textbf{89.7} & \textbf{89.1} & \textbf{90.4} \\ \makecell{DIAD w/o PT}& 85.4 & 87.1 & 86.9 & 86.4 & 87.9 \\ CST & 83.9 & 84.9 & 85.7 & 85.6 & 88.2 \\ DevNet & 82.0 & 83.4 & 84.4 & 82.0 & 84.6 \\ \bottomrule \end{tabular} \end{table} In practice we might not have a large (e.g. 16\% of the labeled dat) validation dataset, as in Sec.~\ref{sec:ss_result}, thus, it would be valuable to evaluate the performances of DIAD with a smaller validation dataset. In Table~\ref{table:ss_val_ratio_main}, we reduce the validation dataset size to only 4\% of the labeled data and find DIAD still consistently outperforms others. Additional results can be found in Supp.~\ref{appx:ss_less_val}. We also perform a sensitivity analysis in Supp.~\ref{appx:sensitivity} that varies hyperparameters in the unsupervised AD benchmarks. Our method performs quite stable in less than $2\%$ differences across a variety of hyperparameters. \section{Discussions and Conclusions} As all unsupervised AD methods rely on approximate objectives to discover anomalies such as reconstruction loss, predicting geometric transformations, or contrastive learning. The objectives inevitably would not align with labels on some datasets, as inferred from the performance ranking fluctuations across datasets. This motivates for abilities to incorporate labeled data to boost performances and incorporate interpretability to find out whether the model could be trusted and whether the approximate objective aligns with the human-defined anomalies. Beyond the inspirations from NodeGAM for the model architecture and PID loss for the objective, we introduce novel contributions that are key for highly accurate and interpretable AD: we modify the architecture by temperature annealing, introduce a novel way to estimate and normalize sparsity, propose a novel regularization for improved generalization, and introduce semi-supervised AD via supervised fine-tuning of the unsupervised learnt representations. Our contributions play a crucial role to push both unsupervised and semi-supervised AD benchmarks. Furthermore, our method provides interpretability which is crucial in high-stakes applications with needs of explanations such as finance or healthcare.
{'timestamp': '2022-03-07T02:05:03', 'yymm': '2203', 'arxiv_id': '2203.02034', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.02034'}
arxiv
\section{Introduction} Level design is a core feature of what defines a video game. When constructed correctly, it is a main determinant of player experience. From the designer's perspective, level design can be either a tedious, but necessary step in the game's development or a creatively freeing process - sometimes it is both. Most levels are designed with the intent to teach the game's interactable space - the mechanics - to the player in a way that is (ideally) engaging, fun, visually pleasing, intuitive, and informative \cite{rogers2014level,koster2013theory,green2017press}. Levels designed for tutorial sections of the game create simplistic and low-risk environments. These levels are direct, and sometimes oblique in their intention so the player can grasp the core mechanics of the game as quickly as possible. As the player becomes more familiar with the mechanics and how they work together in the game's system, the levels should also increase in complexity and challenge. The general design of these levels in turn needs to be as complex and engaging both visually and functionally~\cite{khalifa2019intentional,anthropy2014game}. Most games demonstrate each mechanic at least once throughout the entire level space; combining and ordering them in a way that builds itself based on the player's current skill as they get more familiar with the game \cite{totten_2016,anthropy2014game}. However, designing levels to explore multiple combinations of mechanics is an arduous task to undertake for a level designer. While it is unlikely that a player would play all of these levels, creating this possibility space of levels would allow the level designer to hand-pick and order them in a way that the mechanics feel coherent. Furthermore, an adaptive game with a diverse set of levels would allow the player to explore different combinations of mechanics according to their own pace and preference. For example, if a player is having difficulties with a certain necessary mechanic, such as long jumps in most Super Mario games or the spin attack in most Legend of Zelda games, having a specific subset of levels with a focus on these more challenging mechanics would allow the player to develop their skill with the mechanic better than a single tutorial level~\cite{anthropy2014game}. In contrast, if a player has fully mastered a mechanic, the game could select a level that uses the mechanic in a more challenging situation or a level with an entirely different mechanic space for them to master next. Levels could be selected automatically from the generated level space and dynamically ordered in a way that adapts to the player's current skill level as opposed to a hard-coded level ordering~\cite{yannakakis2011experience}. Generating a diversity of levels that explore multiple mechanic combinations would save time in the design process and allow for more creative flexibility in a way that manually designed levels could not provide. This paper presents a system that seeks to combine human design and AI-driven design to enable mixed-initiative collaborative game level creation. Users can choose to start from a blank slate with their work while adding their own edits then have an AI back-end evolve their work towards a pre-defined objective. This objective function can be defined by minimalism in design, maximization of game mechanic coverage, overall quality, or any other feature that could contribute to the quality of the level. Alternatively, users may select from a variety of AI suggestions and pre-generated samples to begin their work and then make changes as necessary. This design process is not limited to the initializing step of the level; the user and AI system can switch their roles as designers at any point in the creation process. Concurrently, the AI system will look at what its previous users have created and submitted, and ask new users to design levels that complement what's already there. With this design process, the mechanic space of a game can be fully explored and every combination of mechanics can be represented by a level. With a human-based rating system, the automated system can learn to design levels with better quality and the human users can design levels that are missing from this mechanic combination space. This project demonstrates the mixed-initiative collaborative process through level design for the independent, Sokoban-like game `Baba is You' - a game whose mechanics are defined and modified by the level design itself and the player's interaction with it. Levels can be made either by users, AI, or a mixed combination of both and uploaded to the level database to be used for future creations and to improve the quality of the AI's objective function. \subsection{Baba is Y'all v1 (prototype)} \begin{figure}[ht] \centering \includegraphics[width=0.8\linewidth]{imgs/level_matrix.png} \caption{Baba is Y'all Version 1 Main Screen (from April 2020)} \label{fig:levelMat1} \end{figure} The first version of Baba is Y'all (BiY v1) was released officially in March 29th, 2020, and promoted chiefly on Twitter. This version served as a prototype and proof-of-concept system for mixed-initiative AI-assisted game content collaboration specifically for designing levels in the game `Baba is You' (Arvi 'Hempuli' Teikari, 2017). This system was built on concepts from three different areas of content creation: \begin{itemize} \item \textbf{Crowdsourcing:} a model used by different systems that allows a large set of users to contribute toward a common goal provided by the system~\cite{brabham2013crowdsourcing}. For example, Wikipedia users participate to fill in missing information for particular content. \item \textbf{User content creation:} allows players to create levels for a game/system and upload them online to the level database for other players to play and enjoy - i.e. Super Mario Maker (Nintendo, 2015), Line Rider (inXile Entertainment, 2006), and LittleBigPlanet (Media Molecule, 2008). \item \textbf{Quality diversity:} the underlying technique behind our system. It ensures that the levels made from combining the first 2 concepts are of both good quality and diverse in terms of the feature space they are established in~\cite{pugh2016quality}. For this system, the feature space is defined as the potential game mechanics implemented in each level. \end{itemize} The Baba is Y'all website (as shown in figure~\ref{fig:levelMat1}) was a prototype example of a mixed-initiative collaborative level designing system. However, the site was limited by the steep learning curve required to interact with the system~\cite{charity2020baba}. Features of the site were overwhelming to use and lack cohesion in navigating the site. \subsection{Baba is Y'all v2 (updated release)} \begin{figure}[ht] \centering \includegraphics[width=0.8\linewidth]{imgs/dark_main.png} \caption{Baba is Y'all Version 2 Main Screen (as of September 2021)} \label{fig:levelMat2} \end{figure} The second version of Baba is Y'all\footnote{http://equius.gil.engineering.nyu.edu/} (BiY v2) was released on May 27th, 2021 and designed to have a more user-friendly setup. It was similarly promoted via Twitter and on mailing lists. This version includes a cleaner, more compact, and more fluid user interface for the entire website and consolidated many of the separate features from the BiY v1 site onto fewer pages for easier access. Three main webpages were created for this updated system. Unlike the previous version, which showed all of the mechanic combination levels (both from the database and unmade) in random order, the updated level selection page adds level tabs that separates levels by recently added (New), highest rated (Top), and levels with rules that had not been made yet (Unmade.) A carousel scrolling feature shows 9 levels at a time to not overwhelm the player with choices (as shown in figure~\ref{fig:levelMat2}). The level rating system is also included on the main page as a tab, as well as the search feature. The personal level selection tab allows users to see their previously submitted levels and login to their account to submit levels with their username as the author or co-author. The updated level editing page consolidates both the user editing with the PCG level evolution onto one page. Users can easily switch between manually editing the level themselves and allowing the PCG back-end system to edit the level while pausing in between. Users can also select rule objectives for the system to evolve towards implementing. To fight the problem of blank canvas paralysis, users can start from a set of different types of levels (both PCG and user-made)~\cite{krall2012artist}. Once a level is successfully solved, users may name the level upon submission - further personalizing the levels and assigning authorship. A slideshow tutorial is provided for the users and describes every feature and function of the site instead of the walkthrough video that was featured on BiY v1. Users can also play a demo version of the `Baba is You' (Arvi 'Hempuli' Teikari, 2017) game to familiarize themselves with the game mechanics/rule space and how they interact with each other (game dynamics). For quick assistance, a helper tool is provided on the level editing page as a refresher on how to use the editing tool. In addition to updating the features and collecting more data about the levels created, we conducted a formal user study with 76 participants to gather information about which features they chose to use for their level creation process and their subjective opinion on using the site overall. This user study, as well as the general level statistics collected from the site's database, showed that our new interface better facilitated the user-AI collaborative experience to create more diverse levels. \section{Background and Related Work} The Baba is Y'all system uses the following methods in the collaborative level design process: procedural content generation to create new levels from the AI backend, quality diversity to maintain the different kinds of levels produced from the system and show the coverage of game mechanics across each level, crowdsourcing so the AI may learn to create new levels from previously submitted "valid" levels - either those made exclusively by users, the system itself, or a combination of both, and finally mixed-initiative AI so that the user and evolutionary algorithm can develop the level together. Each method is described as the following: \subsection{Procedural Content Generation} Procedural content generation (PCG) is defined as the process of using a computer program to create content that with limited or indirect user input \cite{shaker2016procedural}. Such methods can make an automated, quicker, and more efficient content creation process, and also enable aesthetics based on generation. PCG has been used in games from the 1980's Rogue to its descendent genre of the Rogue-likes used in games such as Spelunky (Mossmouth, LLC, 2008) and Hades (Supergiant Games, 2020), as well as games that revolve around level and world generation such as Minecraft (Mojang, 2011) and No Man's Sky (Hello Games, 2016). PCG can be used to build levels such as The Binding of Isaac (Edmund McMillen, 2011), enemy encounters such as Phoenix HD (Firi Games, 2011), or item or weapon generation such as Borderlands (Gearbox Software, 2009). In academia, PCG has been explored in many different game facets for generating assets \cite{ruela2017procedural, gonzalez2020generating}, mechanics \cite{khalifa2019general, togelius2008experiment,browne2010evolutionary}, levels \cite{snodgrass2016learning,charity2020mech}, boss fights~\cite{siu2016programming}, tutorials~\cite{khalifa2019intentional,green2018atdelfi}, or even other generators \cite{kerssemakers2012procedural,earle2021learning,earle2021illuminating,khalifa2020multi}. A plethora of AI methods underpin successful PCG approaches, including evolutionary search \cite{togelius2010search}, supervised and unsupervised learning \cite{summerville2018procedural,liu2021deep}, and reinforcement learning \cite{khalifa2020pcgrl}. The results of these implementations have led to PCG processes being able to generate higher quality, more generalizable, and more diverse content. PCG is used in the Baba is Y'all system to allow the mutator module to create new `Baba is You' levels. \subsection{Quality Diversity} Quality-diversity (QD) search based methods are increasing in usage for both game researchers and AI researchers \cite{pugh2016quality,gravina2019procedural}. Quality-diversity techniques are search based techniques that try to generate a set of diverse solutions while maintaining high level of quality for each solution. A well-known and popular example is MAP-Elites, an evolutionary algorithm that uses a multi-dimensional map instead of a population to store its solutions~\cite{mouret2015illuminating}. This map is constructed by dividing the solution space into a group of cells based on a pre-defined behavior characteristics. Any new solution found will not only be evaluated for fitness but also for its defined characteristics then placed in the correct cell in the MAP-Elites map. If the cell is not empty, both solutions compete and only the fitter solution survives. Because of the map maintenance and the cell competition, MAP-Elites can guarantee a map of diverse and high quality solutions, after a finite number of iterations through the generated population. The MAP-Elites algorithm has also been extended into Constrained MAP-Elites \cite{khalifa2018talakat, khalifa2019intentional, alvarez2019empowering}, Covariance Matrix Adaptation using MAP-Elites (CMA-ME) \cite{fontaine2020covariance}, Monte Carlo Elites~\cite{sfikas2021monte}, MAP-Elites via Gradient Arborescence~\cite{fontaine2021differentiable}, and etc. For this project, we use the Constrained MAP-Elites algorithm to maintain a diverse population of `Baba is You' levels where the behavior characteristic space of the matrix is defined by the starting and ending rules of a level when it is submitted. \subsection{Crowdsourcing data and content} Some, but relatively few, games allow users to submit their own custom creations using the game's engine as most games do not have their source code available or even partially accessible for modifications to add more content in the context of the game. Whether through a built-in level editing system seen in games like Super Mario Maker (Nintendo, 2015), LittleBigPlanet (MediaMolecule, 2008), or LineRider (inXile Entertainment, 2006) or through a modding community that alter the source code for notable games such as Skyrim (Bethesda, 2011) Minecraft (Mojang, 2011,) or Friday Night Funkin' (Ninjamuffin99, 2020), players can create their own content to enhance their experience and/or share with others. In crowdsourcing, many users contribute data that can be used for a common goal. Some systems like Wikipedia rely entirely on content submitted by their user base in order to provide information to others on a given subject. Other systems like Amazon's MechanicalTurk crowdsource data collection, such as research experiments \cite{buhrmester2016amazon}, by outsourcing small tasks to multiple users for a small wage. An example of a game generator based on crowdsourced data is Barros et al.’s DATA Agent \cite{barros2018killed,green2018data}, which uses crowd-sourced data such as Wikipedia to create a point-click adventure game sourced from a large corpus of open data to generate interesting adventure games. What differentiates the Baba is Y'all system from other level editing systems or interactive PCG systems is that the Baba is Y'all site has a central goal: populate the MAP-Elites matrix with levels that cover all possible rule combinations. With this system, users may freely create the levels they want, but they may also work towards completing the global goal of making levels with a behavior characteristic that has not been made before. Participation in this task is encouraged by the AI back-end system that keeps track of missing cells in the MAP-Elites matrix. \subsection{Mixed-Initiative AI} Mixed-initiative AI systems involve a co-creation of content between a human user and an artificially intelligent system~\cite{yannakakis2014mixed}. Previous mixed-initiative systems include selecting from and evolving a population of generated images \cite{secretan2008picbreeder,bontrager2018deep}, composing music \cite{mann2016ai,tokui2000music}, and creating game levels through suggestive feedback \cite{machado2019pitako}. Mixed-initiative and collaborative AI level editors for game systems have thoroughly been explored in the field as well through direct and indirect interaction with the AI backend system \cite{shaker2013ropossum,liapis2013sentient,butler2013mixed,guzdial2018co,zhou2021toward,bhaumik2021lode,alvarez2019empowering,smith2010tanagra,delarosa2021mixed}. Since the release of the first Baba is Y'all prototype and paper~\cite{charity2020baba}, the implementation of mixed-initiative systems have grown in the game and AI research field. Bhaumik implemented an AI constrained system with their Lode Encoder level editing tool that only allowed users to edit a level from a set of levels generated by a variational autoencoder - forcing users to only edit from a palette provided by the AI back-end tool~\cite{bhaumik2021lode}. Delarosa used a reinforcement learning agent in a mixed-initiative web app to collaboratively suggest edits to Sokoban levels \cite{delarosa2021mixed}. Zhou used levels generated with the AI-assisted level editor Morai Maker (a Super Mario level editor) to apply transfer learning for level editing to Zelda \cite{zhou2021toward}. These recent developments look more into how the human users are affected through their relationship with collaborating with these AI systems and how it can be improved through examining the dimensionality of the QD algorithm, the evolutionary process, or the human-system interaction itself \cite{alvarez2020exploring}. We look to incorporate these new perspectives into this updated iteration of Baba is Y'all and evaluate the effects through a user study. \section{System Description} The updated Baba is Y'all site's features were condensed into 2 main pages to make navigation and level editing much easier and intuitive: \begin{itemize} \item \textbf{The Home Screen:} contains the level matrix \textit{Map Module}, the search page, the \textit{Rating Module} page, and the \textit{User Profile} page. From here, users can also change the visuals of the site from light to dark mode, view the tutorial section or the site stats page by clicking on the Baba and Keke sprites respectively at the top of the page, and create a new level from scratch by clicking on various 'Create New Level' buttons placed on various subpages. Figure~\ref{fig:levelMat2} shows the starting page of the home screen. \item \textbf{The Level Editor Screen:} contains both the \textit{Editor Module} and the \textit{Mutator Module}. Users can also test their levels with themselves or with the Keke solver by clicking on the Baba and Keke icons at the bottom of the canvas. Figure~\ref{fig:editor_screen} shows the starting page of the level editor screen. \end{itemize} In the following subsections, we are going to explain the different modules that constitutes these two main screens. Each of the following modules are either being used in the home screen, the level editor screen, or both. \subsection{Baba is You} `Baba is You' (Arvi ``Hempuli'' Teikari, 2019) is a puzzle game where players can manipulate the rules of a level and properties of the game objects through Sokoban-like movements of pushing word blocks found on the map. These dynamically changing rules create interesting exploration spaces for both procedurally generating the levels and solving them. The different combinations of rules can also lead to a large diversity of level types that can be made in this space. The general rules for the `Baba is You' game can be referred to from our previous paper~\cite{charity2020baba}. To reiterate, there are three types of rule formats in the game: \begin{itemize} \item \textbf{X-IS-(KEYWORD)} a property rule stating that the game object class `X' has a certain property such as `WIN', `YOU', `MOVE', etc. \item \textbf{X-IS-X} a reflexive rule stating that the game object class `X' cannot be changed to another game object class. \item \textbf{X-IS-Y} a transformative rule changing all game objects of class `X' into game objects of class `Y'. \end{itemize} \begin{figure} \centering \includegraphics[width=0.4\linewidth]{imgs/simple_level.png} \caption{An example of a simple `Baba is You' level.} \label{fig:simple_map} \end{figure} The game sprites are divided into two main different classes: the object class and the keyword class. Sprites in the object class represent the interactable objects in the map as well as the literal word representation for the object. Sprites in the keyword class represent the rules of the level that manipulate the properties of the objects. For example, figure~\ref{fig:simple_map} shows four different object class sprites [BABA (object and corresponding word) and FLAG (object and corresponding word)] and three different keyword class sprites [IS (x2), YOU, and WIN]. The keyword class sprites are arranged in two rules: `BABA-IS-YOU' allowing the player to control all the Baba objects and `FLAG-IS-WIN' indicating that reaching any flag object will make the player win the level. The system has a total of 32 different sprites: 11 object class sprites and 21 keyword class sprites. Because the game allows rule manipulation, object classes are arbitrary in the game as they serve only to provide a variety of objects for rules to affect and for aesthetic pleasure. \subsection{Game Module} The game module is responsible for simulating a `Baba is You' level. It also allows users to test the playability of levels either by directly playing through the level themselves or by allowing a solver agent to attempt to solve it. This component is used on the home screen when a user selects a level to play and the editor screen for a user to test their created level. Because the game rules are dynamic and can be altered by the player at any stage in the solution, the system keeps track of all the active rules at every state. Once the win condition has been met, the game module records the current solution, the active rules at the start of the level, and the active rules when the solution has been reached. These properties are saved to be used and interpreted by the Map module (section~\ref{sec:map_module}). The activated rules are used as the level's characteristic feature representation and saved as a chromosome to the MAP-Elites matrix. The game module provides an AI solver called 'KEKE' (based on one of the characters traditionally used as an autonomous 'NPC' in the game). KEKE uses a greedy best-first tree search algorithm that tries to solve the input level. The branching space is based on the five possible inputs a player can do within the game: move left, move right, move up, move down, and do nothing. The algorithm uses a heuristic function based on a weighted average of the Manhattan distance to the centroid distance for 3 different groups: keyword objects, objects associated with the `WIN' rule, and objects associated with the `PUSH' rule. These were chosen based on their critical importance for the user solving the level - as winning objects are required to complete the level, keyword objects allow for manipulation of active rules, and pushable objects can directly and indirectly affect the layout of a level map and therefore the accessibility of player objects to reach winning objects. The heuristic function is represented by the following equation: \begin{equation} h = (n + w + p) / 3 \end{equation} where $h$ is the final heuristic value for placement in the priority queue, $n$ is the minimum Manhatttan distance from any player object to the nearest winnable object, $w$ is the minimum Manhatttan distance from any player object to the nearest word sprite, and $p$ is the minimum Manhatttan distance from any player object to the nearest pushable object. As an update for this version of the system, the agent can run for a maximum of 10000 iterations and can be stopped at any time. A user may also attempt to solve part of the level themselves and the KEKE solver can pick up where the user left off to attempt to solve the remainder of the level. This creates a mixed-initiative approach to solving the levels in addition to editing the levels. However, even with this collaborative approach, the system still has limitations and difficulty solving levels with complex solutions - specifically solutions that require back-tracking across the level after a rule has been changed. The solver runs on the client side of the site and is limited by the capacity of the user's computational resources. Future work will look into improving the solver system to reduce computational resource. We will also look for better solving algorithms to improve the utility of the solver such as Monte Carlo Tree Search (MCTS) with reversibility compression~\cite{cook2021monte}. \subsection{Editor Module} \begin{figure}[ht] \centering \includegraphics[width=0.9\linewidth]{imgs/editor_screen.png} \caption{A screenshot of the level editor screen} \label{fig:editor_screen} \end{figure} The editor module of the system allows human users to create their own `Baba is You' levels in the same vain of Super Mario Maker (Nintendo, 2015). Figure~\ref{fig:editor_screen} shows the editor window that is available for the user. The user can place and erase any game sprite or keyword at any location on the map using the provided tools. As a basis, the user can start modifying either a blank map, a basic map (a map with X-IS-YOU and Y-IS-WIN rules already placed with X and Y objects), a randomly generated map, or an elite level provided by the Map Module. Similar to Super Mario Maker (Nintendo, 2015), the created levels can only be submitted after they are tested by the human player or the AI agent to check for solvability. For testing the level, the editor module sends the level information to the game module to allow the user to test it. This updated version of the site also includes an undo and redo feature so that users may erase any changes they make. A selection and lasso feature is also available so users can select specific areas of the level and move them to another location. Unlike the previous version, all tiles are available to the user on the same screen and the user may seamlessly transition from the editor module to the mutator module and vice versa for ease of access and better interactivity and collaboration between the AI system and the user. \subsection{Mutator Module}\label{sec:mutator_module} \begin{figure}[ht] \centering \includegraphics[width=0.8\linewidth]{imgs/evolver_screen.png} \caption{A screenshot of the level evolver page} \label{fig:evolver_screen} \end{figure} The Mutator module is a procedural content level generator. More specifically, the Baba is Y'all system uses an evolutionary level generator that defines a fitness function based on a version of tile-pattern Kullback-Liebler Divergence (ETPKLDiv\footnote{https://github.com/amidos2006/ETPKLDiv}) algorithm~\cite{lucas2019tile}. Figure~\ref{fig:evolver_screen} shows the updated interface used by the evolver. As mentioned before in the previous subsection, this version of the mutator module can interface seamlessly with the other modules to allow the user more ease of access between manual editing and evolutionary editing. The user can easily transfer the level from the editor module to the mutator module and vice versa. When switching between the editor module and the mutator module, the level loses its pure procedurally generated or pure human-designed quality and becomes a hybrid of the two - thus mixed-initiative interaction between the algorithm and the user. The evolver interface provides the user with multiple customizations such as the initialization method, stopping criteria, evolution pausing, and an application of a mutation function allowing manual user control. With these features, the user is not directly changing the evolution process itself, but instead guiding and limiting the algorithm towards generating the level they want. The ETPKLDiv algorithm uses a 1+1 evolution strategy, also known as a hillclimber, to improve the similarity between the current evolved levels and a reference level. The algorithm uses a sliding window of a fixed size to calculate the probability of each tile configuration (called tile patterns) in both the reference level and the evolved level and tries to minimize the Kullback-Liebler Divergence between both probability distributions. Like Lucas and Volz, we use a window size of 3x3 for the tile selection. This was to maximize the probability of generating initial rules for a level, since rules in `Baba is You' are made up of 3 tiles. However, in our project, we used 2+2 evolution strategy instead of 1+1 used to allow slightly more diversity in the population~\cite{lucas2019tile}. We also modified the fitness function to allow it to compare with more than one level. The fitness value also includes the potential solvability of the level ($p$), the ratio of empty tiles ($s$), and the ratio of useless sprites ($u$). The final fitness equation for a level is as follows: \begin{equation}\label{eq:fitness} fitness_{new} = min(fitness_{old}) + u + p + 0.1 \cdot s \end{equation} where $fitness_{old}$ is the Kullback-Lievler Divergence fitness function from the Lucas and Volz work~\cite{lucas2019tile} compared to a reference level. The minimum operator is added as we are using multiple reference levels instead of one and we want to pick the fitness of the most similar reference level. In the updated version of Baba is Y'all, we recalculate the ratio of useless objects ($u$) used in the original version's equation. The value $u$ is defined as the combined percentage of unnecessary object and word sprites in the level. This is broken up into 2 variables $o$ and $w$ for the objects and words respectively. The $o$ value corresponds to the objects that are not required or predicted to act as a constraint or solution for the level. The value for $o$ can be calculated as follows: \begin{equation} o = \frac{i}{j} \end{equation} where $i$ is the number of objects sprites initialized in the level without a related object-word sprite and $j$ is the total number of object sprites initialized in the level. While the $w$ value corresponds to the words that have no associated object in the map (this does not apply to keyword class words such as ``KILL'' or ``MOVE''). The value for $w$ can be calculated as follows: \begin{equation} w = \frac{k}{l} \end{equation} where $k$ is the number of word sprites initialized in the level without a related object-word sprite and $l$ is the total number of word sprites initialized in the level. To combine both variables $o$ and $w$ into the one variable $u$ a constant ratio is applied. In the system, 0.85 is applied to the $o$ variable and 0.15 to $w$. This is to more weight on reducing the number of useless object sprites as opposed to useless word sprites, as word sprites can be used to modify the properties of objects or transform other object sprites. The $u$ value is implemented in order to prevent noise within the level due to having object tiles that cannot be manipulated in any way or have relevancy to the level. A human-made level may include these ``useless'' tiles for aesthetic purposes or to give the level a theme - similar to the original `Baba is You' levels. However, the PCG algorithm optimizes towards efficiency and minimalist levels, therefore ignoring the subjective aspect of a level's quality (which can be added later by the user). The playability of the level ($p$) is a binary constraint value that determines whether a level is potentially winnable or not. The value can be calculated as follows: \begin{equation} p = \begin{cases} 1, & \text{has [`X-IS-YOU' rule, `WIN' keyword]} \\ 0, & otherwise \end{cases} \end{equation} This is to ensure any levels that are absolutely impossible to play or win are penalized in the population and less likely to be mutated and evolved from in future generations. We used a simple playability constraint check instead of checking for playability using the solver because the solver take time to check for playability. Also, all playable levels by the solver usually end up being easy levels due to the limited search space we are given for the best first algorithm. The ratio of empty tiles ($s$) is the ratio of empty space tiles to all of the tiles in the level. The equation can be calculated as follows: \begin{equation} s = \frac{e}{t} \end{equation} where $e$ is the number of empty spaces in the level and $t$ is the total number of tiles found in the level. The value $s$ is multiplied with a value of $0.1$ in equation~\ref{eq:fitness} to avoid heavy penalization for having any empty spaces in a level and to prevent encouragement for levels to mutate towards populating the level with an overabundance of similar tiles in order to eliminate any empty space. The Mutator module is not run as a back-end process to find more levels, instead it has to be done manually by the user. This is done due to the fact that some generated levels cannot be solved without human input. One might wonder why not generate a huge corpus of levels and ask the users later to test them for the system. This could result in the system generating a multitude of levels that are either impossible to solve or are solvable but not subjectively ``good'' levels - levels the user would not find pleasing or enjoyable. This overabundance of ``garbage'' levels could lead to a waste of memory and a waste human resources. By allowing the user direct control over which levels are submitted from the generation algorithm, it still guarantees that the levels are solvable and with sufficient quality and promote using the tool in a mixed-initiative approach. Future work will explore implementing a fully autonomous generator and associated solver to expand the archive of levels without human input. \subsection{Objective Module}\label{sec:objective_module} \begin{figure}[ht] \centering \includegraphics[width=0.9\linewidth]{imgs/obj_screen.png} \caption{A screenshot of the rule objective screen} \label{fig:objective_screen} \end{figure} In conjunction with the Mutator module (section~\ref{sec:mutator_module}), an Objective Module has been implemented to help guide the evolver towards generating levels that match selected objectives - or rules - set by either the Map Module or the user. Like before this will nudge both the user and the evolver back-end towards creating levels with mechanic combinations that have not been made in the site database. Users can select from the table of mechanics which sets of rules to include in the level - whether initially at the start of the level, at the solution, or either. Initial rules can be found automatically when the user or evolver edits the level, final rules can only be determined at the end of the level - when the solution has been found. Active rules are highlighted with a green backlight in the table and change accordingly when a rule is created or removed. The evolver also prioritizes levels that match as many of the selected rules as possible. A cascading function is used to rank the generated levels from the chromosome population. The evolver first evaluates how well a generated level corresponds to the selected objectives then looks at the fitness function. With this, the evolver becomes more involved with expanding the level database for the site and actively tries to help the user fill these missing levels. \subsection{Rating Module}\label{sec:rating_module} \begin{figure}[ht] \centering \includegraphics[width=0.9\linewidth]{imgs/rating_screen.png} \caption{A screenshot of the rating screen with 2 levels shown} \label{fig:rating_screen} \end{figure} Like the original system, a rating for a single level is determined by comparison to another level within the site database. The user must determine the better level based on two qualities: level of challenge and quality of aesthetic design. A level that is considered `more challenging' could indicate that the solution search space for the level takes longer to arrive at or is not as intuitive or straightforward. A level that is considered to have `better design' represents that the level is more visually pleasing and elegant with its map representation - a quality that is hard to generate automatically with AI. Users can select between the two levels for each feature by shifting a slider towards one level or the other. \subsection{Map Module}\label{sec:map_module} \begin{figure}[ht] \centering \includegraphics[width=0.9\linewidth]{imgs/map_screen.png} \caption{A screenshot of the map selection screen} \label{fig:select_screen} \end{figure} The Map module functions as both storing all of the levels in the site database as well as recommending specific levels to the user to use for their own level creation process. The Map module is the core module of the system. To maintain distinguish-ability between quality and diverse levels, we implemented the MAP-Elites algorithm for this module. \begin{table}[t] \caption{Chromosome Rule Representation} \centering \begin{tabular}{|p{0.2\linewidth}|p{0.7\linewidth}|} \hline Rule Type & Definition \\ \hline \hline X-IS-X & objects of class X cannot be changed to another class \\ X-IS-Y & objects of class X will transform to class Y \\ X-IS-PUSH & X can be pushed \\ X-IS-MOVE & X will autonomously move \\ X-IS-STOP & X will prevent the player from passing through it\\ X-IS-KILL & X will kill the player on contact\\ X-IS-SINK & X will destroy any object on contact\\ X-IS-[PAIR] & both rules 'X-IS-HOT' and 'X-IS-MELT' are present \\ X,Y-IS-YOU & two distinct objects classes are controlled by the player \\ \hline \end{tabular} \label{tab:rrp} \end{table} When a level is submitted to be archived, the system uses the list of active rules at the start and the end of the level as behavior characteristic for the input level to determine its location in the map. There are 9 different rules checked for in each level - based on the possible rule mechanics that can be made in the Game module system. Table \ref{tab:rrp} shows the full list of possible rules. Since these rules can be active at the beginning or at the end, it makes the number of behavior characteristics equal to 18 instead of 9 which provide us with a map of $2^{18}$ cells. The Map Module can recommend levels to start from when designing a new level. Like the Mutator Module (section~\ref{sec:mutator_module}), it also takes the Objective Module (section~\ref{sec:objective_module}) into consideration when selecting its recommendations. The Map Module can provide levels that most similarly match the objectives chosen and provide either other levels the user has previously made or high rated (and intuitively high quality) ``elite'' levels. In this project we are using a multi population per each cell of the Map-Elites similar to the constrained Map-Elites~\cite{khalifa2018talakat}. The quality of the level is determined by user ratings - performed by the Rating Module. \subsection{User Profiles} \begin{figure}[ht] \centering \includegraphics[width=0.9\linewidth]{imgs/user_screen.png} \caption{A screenshot of the user profile screen for the user 'Milk'} \label{fig:profile_screen} \end{figure} The user profiles feature is the newest addition to the Baba is Y'all site. Like the original system, if a user creates a profile through the site's login system and submits a level, they get authorship attributed to the submitted level. Users can also find their previously made levels on the profile page - called ``My Levels'' - and replay them, edit them, or view the level's mechanic combination. A user's personal stats for their level submissions can also be viewed on the page including the number of levels submitted, number of rule combinations contributed, and their top rated level. This feature was implemented to provide more user agency and personalization on the site and give users better access to their own submitted levels. Through the search page, players can search for specific levels by username or by level name. This creates a sense of authorship over each of the levels, even if the level wasn't designed with any human input (i.e. a level with PCG.js as the author) and encourages the collaborative nature of the site between AI and human. Users may also share links to site levels via the game page. \section{Results} The following results were extracted from the entire Baba is Y'all v2 site and includes data from levels made from participants not involved with the study. \subsection{User and Author-based Data} All users on the Baba is Y'all site had the option of registering for a new account to easily find their saved work as well as attribute personal authorship to any levels they submitted. Those who participated in the user study were given pre-made usernames in order to verify the levels they submitted from their responses and to protect their identities. These users only had to provide an email address to register for both the site and the survey. The site had a total of 727 unique users registered - only 78 (10\%) came from outside of the user study while the rest of the users participated in the survey. \begin{figure}[ht] \centering \includegraphics[width=0.95\linewidth]{imgs/Level-types.png} \caption{Sample levels generated for the system. The left column is user generated levels, the middle column is evolver module levels, and the right column is mixed-initiative user and evolver levels} \label{fig:level_types} \end{figure} We looked into all the levels created by the users and we divided them based on how the mixed-initiative tool was used to create them. We divided them into three main categories (as shown in figure~\ref{fig:level_types}): \begin{itemize} \item \textbf{User-Only levels:} were created from a blank map exclusively by the human user without any AI assistance. \item \textbf{PCG-only levels:} were created solely by the AI tool without any human input aside from choosing which tool to use and when. \item \textbf{Mixed-author levels:} involved both the human user as well as the AI tool in the creation process of the level. \end{itemize} \begin{table}[ht] \begin{center} \begin{tabular}{|c c c|} \hline Author Type & Number & \%\\ \hline\hline User-only & 103 & 66.45 \\ \hline PCG-only & 16 & 10.32\\ \hline Mixed-author & 36 & 23.23\\ \hline \hline Total & 155 & 100\\ \hline \end{tabular} \end{center} \caption{Authorship for levels submitted} \label{tab:level_author} \end{table} The majority of the levels submitted were user only (66.45\%), however almost a quarter (23.23\%) of the levels submitted had mixed-authorship. Table \ref{tab:level_author} shows the full data for this area. Looking at this table, we notice that the amount of submitted levels are a lot less than total number of users ($155$ levels and $727$ users). This big difference in the numbers is due to releasing the system online with no security measures. This attracted a lot of bots that created multiple accounts so they could fill out the user survey via the link provided, but did not submit any levels. \subsection{Level-based Data} \begin{figure}[ht] \centering \includegraphics[width=0.8\linewidth]{site_graphs/rule_perc.png} \caption{Site results for the rule distribution across levels submitted} \label{fig:level_rule_dist} \end{figure} Looking into all the $155$ submitted levels, we found only $74$ different cells in the MAP-Elites matrix were covered. This is less than 1\% of the whole number of possible rule combinations ($2^{18}$ possible combinations). Figure~\ref{fig:level_rule_dist} shows the rule distributions over all of the levels submitted. The X-is-KILL rule was used the most in over half of the levels submitted and the X-is-STOP rule was used the second-most at 44.52\%. This may be because these rules create hazards for the player and add more depth to the level and solution. Meanwhile, the X-is-[PAIR] rule was used the least in only 12.9\% of the levels submitted. This is likely due to the lock-and-key nature of the rule combinations that require more intentionally placed word blocks that can also be accomplished with the X-is-SINK or X-is-KILL rule. \begin{table}[ht] \begin{center} \begin{tabular}{|c c c c|} \hline User Type & \# Rules & Sol. Length & Map Size (\# tiles) \\ \hline\hline User-only & 2.563 $\pm$ 2.19 & 25.834 $\pm$ 26.11 & 117.883 $\pm$ 50.84\\ \hline PCG-only & 1.00 $\pm$ 1.17 & 19.062 $\pm$ 14.68 & 95.437 $\pm$ 25.60\\ \hline Mixed-author & \textbf{2.833 $\pm$ 2.56} & \textbf{26.027 $\pm$ 20.36} & \textbf{127.722 $\pm$ 49.91}\\ \hline \end{tabular} \end{center} \caption{Averaged attributes for different types of created levels} \label{tab:avg_author} \end{table} \begin{figure}[ht] \centering \includegraphics[width=1.0\linewidth]{site_graphs/rule_dist.png} \caption{Rule distributions across the different authored levels} \label{fig:rule_dist} \end{figure} The relation between rules and the different type of authors can be shown in table~\ref{tab:avg_author}. Some levels may use no rules at all (only containing the required X-is-YOU and X-is-WIN rules.) The mixed-author levels has the highest number of average rules per level ($2.833$), while PCG-only levels have the lowest average ($1$). The rule distributions for each author type are shown in Figure \ref{fig:rule_dist}. The PCG-authored levels had the least variability between rules while the Mixed-authored levels had the most variability. Mixed-author levels also had the highest average solution length and highest average level size, with PCG levels having the lowest for both attributes. \section{User Study} The following results were extracted from a Google Form survey given to the experiment participants. Users were instructed to play a level already made on the site, create a new level using the level editor, test it, and finally submit it to the site. They were also given the option to go through the tutorial of the site if they were unfamiliar with the `Baba is You' game or needed assistance with interacting with the level editor tool. Of the $727$ users registered on the site, only a total of $170$ responses were received, however, only $76$ of these responses were valid. These responses were evaluated based on cross-validation and verification between the saved level on the website and the level ID they submitted via the survey that they claimed they authored. Many of these invalid responses contained levels that either did not exist in the database or were claimed to be authored by another user already. The following results are taken from the self-reported subjective survey given to the valid $76$ users. \subsection{Demographic Data}\label{sec:demographics} \begin{figure}[ht] \centering \includegraphics[width=1.0\linewidth]{hor_survey_graphs/freq_v2.png} \caption{A. Frequency for playing games; B. Frequency for designing levels for games} \label{fig:freq_des_play} \end{figure} \begin{figure}[ht] \centering \includegraphics[width=1.0\linewidth]{hor_survey_graphs/pref_v2.png} \caption{Preference for solving or making puzzles} \label{fig:design_pref} \end{figure} Half of the users who completed the survey answered that they frequently played video games (more than 10 hours a week) with around 80\% of the users stating they play for at least 2 hours a week (figure~\ref{fig:freq_des_play}). Conversely, only 28.9\% of users responded that they spend 2 or more hours a week designing levels for games with 40.8\% of users stating they never design levels at all (figure~\ref{fig:design_pref}). When asked if they prefer to solve or make puzzles, 50\% of participants responded that they prefer to solve puzzles, while only 6.6\% preferred the latter. 40.8\% of users were split on the preference for designing and solving puzzles. \begin{figure}[ht] \centering \includegraphics[width=1.0\linewidth]{hor_survey_graphs/experience_v2.png} \caption{A. Experience playing Sokoban; B. Experience with 'Baba is You'; C. Experience with AI-assisted level editing tools} \label{fig:exp_graph} \end{figure} We asked participants if they had ever played the original game `Baba is You' by Hempuli (either the jam version or the Steam release as both contain the rules used in the Baba is Y'all site), played a Sokoban-like game (puzzle games with pushing block mechanics), and have experience with AI-assisted level editing tools. Figure~\ref{fig:exp_graph} shows the distribution of the users' answers for these questions. Only 30\% of participants had played the game before, meanwhile 22\% had heard of it but had never played it. For the rest, this study would be their first experience with the game. Interestingly enough, 96\% of the participants stated they had played a Sokoban-like game so we can infer that the learning curve would not be too harsh for the new players. Concerning AI-Assisted level editing tools, 75\% of users had never used them before, with 5.3\% stating they were unsure if they had ever used one - thus the learning curve for AI-collaboration would be much higher and new to participants. \subsection{Self-Reported Site Interactions} \begin{figure}[ht] \centering \includegraphics[width=1.0\linewidth]{survey_graphs/feat.png} \caption{Survey results for users' reports on the features they used} \label{fig:feat_report} \end{figure} Figure \ref{fig:feat_report} shows the full list of features that participants interacted with on the site. Users were given the optional task to go through the tutorial section of the Baba is Y'all site to familiarize themselves with both the mechanics of the original `Baba is You' game, the AI assisted tools available to them through the level editor, and the site layout and navigation itself. 81.6\% of users went through this tutorial (whether fully or partially was not recorded.) The second task for users was to play a level that was previously submitted to the website database. 100\% of users were able to solve a level by themselves, however 72.4\% of users reported choosing to watch the Keke AI solver complete the submitted level as well. The third and final task for the participants was to submit their own `Baba is You' level using the level editor. Here, users were asked the most about their involvement with the AI system. Some users chose to create more than one level, so they may have multiple experiences and their design choices may not be mutually exclusive (i.e. using a blank level and also using an AI-suggested level.) For the initial creation of the level, 88.2\% of users chose to start with a blank map. 9.2\% of users started with a level that had already been submitted to the level database - either a level that had been ranked as an elite level or a level created by the user themselves (in the case that they submitted more than one level during this study.) 6.6\% of users started with a level that was suggested from the 'Unmade' page - ideally with the intent to make a level with a rule combination that had not been made yet - thus expanding the MAP-Elites rule combination matrix in the database. Unfortunately, we forgot to ask users in the survey if they started with the random level option that was also provided by the AI assistance tool - so we lack data to report on this statistic. For editing the level, 81.6\% of users reported editing a level completely by hand without any AI assistance. 27.6\% of users edited the level with help from either the evolver algorithm or the mutator functions provided by the AI assistance back-end. 19.7\% of users reported using the objective table to aid the evolver tool in creating the level. We think this low percentage is attributed the fact that a large population of users were unfamiliar with the system or `Baba is You' game overall. This - as well as the lack of selection for level comparison from the previously submitted levels in the database - made using the evolver tool towards certain goals too steep of a task to accomplish and learn. Finally, when testing the level, 59.2\% of users reported using the Keke solver AI when testing their levels and 72.4\% of users named their levels. While not required in the tasks given, we also asked participants about any extra site features they chose to explore. 23.7\% of users reported submitting a level rating from the 'Rate' page. 51.3\% of users reported using the 'Search' tool to search for specific levels (what their search criteria was we did not ask.) Finally, 19.7\% of users reported using the 'Share Level' to share a submitted level link with others online. The least used interactions - 'Started with a database-saved map in the level editor', 'Started with a level suggestion from the Unmade page', and 'Used the objectives table to evolve levels' - were also all related to the AI mixed-initiation of the system. The first could be attributed to a lack of overall levels in the database (at the start of the experiment there were only around 40 available levels) therefore leading to a lack of viable options for the user to choose from. However, the lack of usage for the other two features could be attributed to the opposite problem of having too many options to choose from - again due to lack of levels available to choose from in the database. Trying to make a level with constrained parameters may have also been too steep of a task to accomplish for someone who was totally unfamiliar with the system or even the `Baba is You' game overall. There was also no incentive for a player to create a level suggested by the system as opposed to making a level from scratch. We also didn't explicitly instruct users to make a level from the suggested set, and instead allowed them to make whatever level they wanted with the editor - whether with the prompted ruleset or from their own ideas. \section{Discussion} \subsection{Data Analysis} It is clear from both the submitted level statistics of the site and the self-reported user survey that mixed-authorship is not the preference for users when designing levels. Many users would still prefer to have total control over their level design process from start to finish. For future work, we can look to limit user control and encourage more AI-assistance with the design process similar to the work done by Bhaumik et al.~\cite{bhaumik2021lode}. The limitations of the AI back-end (both the evolver and solver) may be at fault for the lack of AI interaction. The mutator and evolver system are dependent on previously submitted levels and level ratings in order to ``learn'' how to effectively evolve levels towards high quality design. As a result, the assistant tool is always learning what makes a ``good'' level from human input. If there is a lack of available data for the tool to learn from, the AI will be unable to create quality levels - causing the user to less likely submit mixed-initiative co-created levels, and causing a negative feedback loop. The fitness function defined for the evolver and mutator tool may be inadequate for level designing. It could produce a level that is deemed ``optimal'' in quality by its internal definition, but may actually be sub-par in quality for a human user. Another flaw in the AI-collaboration system, could be that the users lacked direct control on the evolver and mutator and attempting to use them in middle of creation might have been more problematic as it could destroy some of the level structures that the users were working on. Future work could remedy this problem by giving users various mutation "options" similar to the AI selections in RLBrush \cite{delarosa2021mixed} and Pitako. \cite{machado2019pitako} Finally, the `Keke' AI solver was also lacking in performance as a few participants mentioned that the solver was unable to solve their prototype levels that they themselves could end up solving in just a couple of moves. An improved AI solver would help with the level creation efficiency. \subsection{User Comments and Feedback} We gave the participants opportunities to provide open feedback about their experience using the site in order to gather more subjective data about their experience as well as collect suggestions for potential new features. Almost no users experienced any technical difficulties or bugs that prevented them from using the site. The few that did mentioned formatting issues with site caused by their browser (i.e. icons too close together, loading the helper gifs, font colors.) However, one user mentioned that this issue may have been because they were using the site from their phone (we unfortunately did not provide users with instructions to complete the study on a desktop or laptop.) In the future, we will be sure to exhaustively test the site on as many browsers as possible - both desktop-based and mobile - to be more accessible. Some users were confused by the tutorial and the amount of information it conveyed for the entire site citing it as ``intimidating'', ``overwhelming'', and ``a bit complex''. However, other users reported the lack of information saying it was ``not detailed'', or had ``sufficient information [...] but could have been delivered in a more comprehensible way.'' To make the game more accessible, we will most likely try to make the tutorial section less intimidating to new users by limiting the amount of information shown (possibly through a ``table of contents'' as suggested by one participant) while still being comprehensible enough to understand the level editor and tools. For feature suggestions, many users wished for larger maps and vocabulary - like those found in the Steam-release `Baba is You' game. Users also wished for a save feature that would allow them to make ``drafts'' of their level to come back later to edit. Many users also suggested a co-operative multiplayer feature for level editing and level solving - we can assume with another human and not an AI agent. \begin{figure}[ht] \centering \includegraphics[width=1.0\linewidth]{hor_survey_graphs/browser_v2.png} \caption{User feedback for likelihood to return using the site after the experiment} \label{fig:reuse_likelihood} \end{figure} While the results of the statistics on the levels submitted were disappointing for involvement of the AI assisting tool, we also asked users how likely they would continue using the site after the experiment. 38.2\% of users said they would continue to use the site, while 55.3\% said they would maybe use the site (figure~\ref{fig:reuse_likelihood}). Many users were optimistic and encouraging with the concept of incorporating AI and PCG technologies with level design - citing the project as a ``cool project'', ``a very unique experience'', a ``lovely game and experiment'', and ``very fun.'' At the time of writing, a few users did return, as their 'Keke' assigned usernames were shown as authors on the New page, long after the study was completed. Most notably, the Keke subject user Keke978 who took up the username 'Jme7' and contributed 28 more levels to the site after the study was concluded and currently holds the title for most levels submitted and most rule combinations on the site. Many users also provided us with constructive feedback for feature implementation, site usability, and suggestions for improvement with how to further incorporate the AI back-end interactivity. As shown in figure~\ref{fig:exp_graph}, 70\% of users who played with the system had never played the game `Baba is You' and 75\% of people had never used an AI-assisted level editor tool before this experiment. Based on this information and retainability of users to complete the survey and provide the constructive feedback, we can extrapolate 2 conclusions: 1. the game stands alone, independent of `Baba is You', as an entertainment system; and 2. for people with even limited AI-gaming experience, as long as they are not completely foreign to gaming, this project has the ability to grasp their attention long enough to understand it, tinker around, and then give constructive feedback. \section{Conclusion and Future Work} The results from the user study have demonstrated both the benefits and limitations of a crowd-sourced mixed-initiative collaborative AI system. Currently, users still prefer to edit most of the content themselves, with minimal AI input - due to the lack of submitted content and ratings for the AI to learn from. Pretraining the AI system before incorporating it into the full system would be recommended to create more intelligent systems that can effectively collaborate with their human partners for designing and editing content. This would lead to more helpful suggestions on the evolver's end as well as better designed levels overall. This project is the start of a much longer and bigger investigation into the concept of crowd-sourced mixed initiative systems that can use quality diversity methods to produce content and we have many more ideas to improve upon the Baba is Y’all system. As suggested by many participants in the user study, we would like to incorporate level design collaborations between multiple users and multiple types of evolutionary algorithms all at once to create levels. Our system would take inspiration from collaboration tools such as LodeEncoder \cite{bhaumik2021lode}, RLBrush \cite{delarosa2021mixed}, and Roblox (Roblox Corporation, 2006). This would broaden the scope and possibilities of level design and development even further to allow more creativity and evolutionary progress within the system. This collaboration setting will open multitude of interesting problems to investigate such as authorship. Outside of the `Baba is You' game, we would like to propose the development of an open-source framework to allow mixed-initiative crowd-sourcing level design for any game or game clone. Such games could include Zelda, Pacman, Final Fantasy, Kirby, or any other game as long as we have a way to differentiate between levels mechanically and we can measure minimum viable quality of levels. Adding more games to the mixed-initiative framework would allow an easier barrier of entry to players who may have been unfamiliar with the independent game `Baba is You' but is very familiar with triple-A games produced by companies such as Nintendo. We would like to also propose a competition for the online `Keke' solver algorithm for the challenging levels. In this competition, users would submit their own agent that can solve the user-made and artificially created `Baba is You' levels. Ideally, this improve the solver of the `Baba is Y'all' system but also introduce a novel agent capable of solving levels with dynamically changing content and rules - an area that has not been previously explored in the field. Development for this framework for this competition has already begun at the time of writing this paper. Finally, we would like to propose the creation of a fully autonomous level generator and solver that can act as a user to our system. This generator-solver pair would work parallel to the current system's mixed-initiative approach, but with a focus on coverage to exhaustively find and create levels for every combination of mechanics. With a redefined fitness function and updated solver (possibly from the Keke Solver Competition,) this could be more efficient than having users manually submit the levels, while still using content created by human users to maintain the mixed-initiative approach. There are many new directions we can take the Baba is Y'all system and the concept of crowd-sourced collaborative mixed-initiative level design as a whole and this project will hopefully serve as a stepping stone into the area and provide insight on how AI and users can work together in a crowd-sourced website to generate new and creative content. \section*{Acknowledgment} The authors would like to thank the Game Innovation Lab, Rodrigo Canaan, Mike Cook, and Jack Buckley for their feedback on the site in its beta version as well as the numerous users who participated in the study and left feedback. \ifCLASSOPTIONcaptionsoff \newpage \fi \bibliographystyle{IEEEtran}
{'timestamp': '2022-03-07T02:05:04', 'yymm': '2203', 'arxiv_id': '2203.02035', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.02035'}
arxiv
\section{Introduction} \label{sec:intro} Brazil reported COVID-19 first official case on February 25, 2020\cite{AgenciaBrasil2020_1}, in the city of São Paulo, which is the largest municipality in the country. Similar notifications in other Brazilian cities quickly followed, being accompanied by a devastating scenario of contagion and death \cite{Lovisolo2020,OF-COVID19-Relatorio30}, as shown in Fig.~\ref{fig:fig1}, which presents the prevalence of cases and deaths in the country until October 2021. The first official notification in Rio de Janeiro, the second largest and most visited city by tourists, occurred on March 6, 2020\cite{Cavalcante2020}, with the epidemiological situation quickly evolving to one of the worst scenarios at the national level, among the highest number of confirmed cases and deaths by COVID-19, as can be seen in the prevalence maps of Fig.~\ref{fig:fig2}. \begin{figure} \centering \includegraphics[scale=0.2]{fig1_a.jpeg} \vspace{2mm} \includegraphics[scale=0.2]{fig1_b.jpeg} \caption{Prevalence of COVID-19 cases and deaths confirmed in Brazil between March 2020 and October 2021 \cite{OF-COVID19-Relatorio30}.} \label{fig:fig1} \end{figure} \begin{figure} \centering \includegraphics[scale=0.2]{fig2_a.jpeg} \vspace{2mm} \includegraphics[scale=0.2]{fig2_b.jpeg} \caption{Prevalence of COVID-19 cases and deaths confirmed in Rio de Janeiro city between March 2020 and October 2021 \cite{OF-COVID19-Relatorio30}.} \label{fig:fig2} \end{figure} Furthermore, Fig.~\ref{fig:fig3} shows the incidence of confirmed cases (top left) and deaths (top right) in Rio de Janeiro from January 2020 to December 2021, organized by first symptoms date and event date, respectively. It also shows a comparison between new notifications per week and total notifications for cases (bottom left) and deaths (bottom right), where periods of incidence proportional to prevalence (exponential growth) are noticed. In this figure, the raw data are represented in magenta dots and the 7 days moving average by the green curve. Multiple waves of contagion/deaths can be seen, the four most pronounced in April 2020, December 2020, April 2021, and August 2021, respectively. Small oscillations over time, which resembles an endemic period, can also be seen. In addition, the surveillance data for new confirmed cases (top left of Fig.~\ref{fig:fig3}) also highlights the existence of case notifications in January and February 2020, well before March 1st, the current date where it is already confirmed (through surveillance data) that community transmission had started. These cases, registered by the date reported for the first symptoms, were not counted at the beginning of March 2020 because their registration in the system only occurred a posteriori. For this reason, March 6th was announced that time as the day of the first confirmed case. Although these early records may be due to errors in the registration, due to the provision of false or misleading information by patients, the fact that they are not isolated notifications may suggest that community transmission of SARS-CoV-2 in Rio de Janeiro city may have started well before the period close to March 1st, where community transmission is known to have already occurred. \begin{figure*} \centering \includegraphics[scale=0.45]{fig3_a.pdf} \includegraphics[scale=0.45]{fig3_b.pdf}\\ \vspace{5mm} \includegraphics[scale=0.45]{fig3_c.pdf}~~~~~~~~~ \includegraphics[scale=0.45]{fig3_d.pdf}~~~~~ \caption{Evolution of the incidence of confirmed cases (top left) and deaths (top right) of COVID-19 in Rio de Janeiro, from January 2020 to December 2021, organized by first symptoms date and event date, respectively. Also available is the comparison between new notifications per day and total notifications for cases (bottom left) and deaths (bottom right). The raw data are represented in magenta dots, and the 7 days moving average by the green curve. It can be noted the presence of multiple waves of contagion and deaths, where the four most pronounced peaks were in April 2020, December 2020, April 2021, and August 2021, respectively.} \label{fig:fig3} \end{figure*} As at the beginning of the pandemic the Brazilian epidemiological surveillance system was not prepared to massively register COVID-19 cases, it is not only possible but probable that the introduction of the virus in the community took place in a period earlier than of the current estimates for the starting date of community transmission (March 1st). The early cases mentioned above provide direct, albeit weak (due to possible recording errors or biases), evidence in this sense. The SARS-CoV-2 fluctuation in Rio de Janeiro, as well as the significant number of notifications before the first official confirmation, are peculiar epidemiological phenomena, which differ from the typical situation observed in the majority of Brazilian cities. Thus, this situation deserves to be further investigated, since understanding this multiple wave behavior can provide insights into different stages of the epidemic spread, information that can be useful to guide decision-makers in future outbreaks. In this context, one piece of information that is particularly interesting is the likely start date of each community outbreak, i.e., when the transmission inside a community is due to the locals. These dates are important because they can indicate key events, such as the introduction period of a new viral strain in the population\cite{Voloch2021, resendeetal}, or a drastic change in social behavior that is capable of inciting a new phase of epidemic expansion in a given population. Several mathematical approaches can be used to access the dynamics of an epidemic wave, including the estimation of their initial date. Compartmental models\cite{Brauer2008,Brauer2017,Martcheva2015} based on differential equations are very natural for this purpose, with the underling parametrization obtained with aid of data-assimilation techniques, such as Kalman filter\cite{Rajnesh2021p1}, nonlinear regression\cite{Kucharski2020,Magal2020p3040,Subhas2020p071101,Lobato2021nody}, Bayesian statistics\cite{Cotta2020p220,Lyra2020}, neural networks and other machine learning tools\cite{Magri2020,He2020,ALBANI2021p6088,Kuhl2021}, etc. Such compartmental models are also fundamental in approaches that employ the concept of complex networks to describe the epidemic dynamics in a large population with heterogeneous spatial distribution\cite{Chen2020,Costa2020p043306,Aleta2020p964,Aleta2020p157,Ventura2021}. It is also quite common to describe the evolution of epidemic waves with aid of purely phenomenological models, supported by frequentist\cite{Liu2020p1527,Vasconcelos2020,Pelinovsky2020p110241,Vasconcelos2021,Vasconcelos2021SR,Chol-jun2022,Pelinovsky2022p111699,Contoyiannis2022p043109,Contoyiannis2022p011103} or Bayesian\cite{Romadhon2021,Calatayud2022} statistical approaches. There are already some works in the open literature concerned with estimating the start date of a local epidemic outbreak of COVID-19, such as Delatorre et al.\cite{DELATORRE}, which tries to infer the starting date of the SARS-CoV-2 spread in Western Europe and the Americas; Batista and Cunha~Jr\cite{Fernando_Batista}, that did the same exercise for the early stages of COVID-19 in Portugal; and Zhai et al.\cite{Zhai2021p013155}, which investigated the initial COVID-19 dynamics of 10 states in the U.S.A., New York City, United Kingdom, Italy, and Spain. Despite the consistency of the results presented by the first two studies, by comparison with evidence (other epidemic observations) that support the estimated dates, they are more focused on reporting dates, having relatively few details about the underlying mathematical methodologies. The third one, on the other side, is rich in methodological detail, presenting a mechanistic framework based on a non-Markovian delayed compartmental model, which provides a relatively general tool for inferring the start date of an outbreak. However, in terms of validating the results, the authors' arguments implicitly rely heavily on the assumptions that the available data are sufficiently accurate and informative to calibrate the dynamic model, and that the latter provides a sufficiently realistic representation of the epidemic outbreak of interest. The scenario where at least one of these assumptions is not valid is not rare, so there is space in the literature for contributions that attack the same problem on other fronts. Seeking to contribute to expanding the arsenal to estimate the initial date of an epidemic community outbreak, this paper discusses a generic parametric statistical approach for estimating the start date of an epidemic outbreak based on epidemiological surveillance data. The fundamental idea is to present a procedure that incorporates elements of generality, to be applied in typical epidemic outbreaks, but that is simple enough to be used by researchers who do not have strong training in epidemiology or more advanced statistical methods (e.g. Bayesian inference). In this way, we combine the surveillance data with algebraic multiple waves models, nonlinear regression, and information criteria to obtain a simple but representative mathematical model of the underlying outbreak, which provides an interval estimate for the start date of the referred contagion wave. The proposed methodology is illustrated with aid of COVID-19 data from Rio de Janeiro city, which has complex dynamics, with multiple contagion waves and (the typical) very irregular data. The paper is organized as follows. Section~\ref{sec:methodology} describes the statistical framework. Section~\ref{sec:Results and discussion} presents the results of a case study in Rio de Janeiro. Finally, conclusions are shown in Section~\ref{sec:Conclusions}. \section{Method} \label{sec:methodology} The methodology employed here combines epidemiological surveillance data, algebraic statistical models, nonlinear regression, and a model selection procedure to infer the systematic behavior of COVID-19 outbreaks, focusing on estimating a possible start date for each contagion wave. A schematic version of this framework can be seen in Fig.~\ref{fig:fig4}, and each of its steps is described below. \begin{figure*} \centering \includegraphics[scale = 0.33]{fig4.pdf} \caption{Statistical framework adopted to describe the COVID-19 outbreaks and infer the start period of each contagion wave. From epidemiological data, several statistical models are built with the aid of a linear regression process via Monte Carlo simulation. Information criteria are used to choose the most representative model(s), which is (are) used to provide an interval estimate for the start date of the COVID-19 contagion wave.} \label{fig:fig4} \end{figure*} \subsection{Surveillance data} To monitor the evolution of COVID-19 spread, time series that quantify the new reported cases and deaths may be used. Very often such time series are obtained by a process of selection and agglutination of raw data from a large spreadsheet, where each line corresponds to a patient (duly anonymized), containing many dozens of information, such as zip code, date of first symptoms, and date of outcome (recovery or death), etc. These data are registered by the municipality health authorities. In the case of Rio de Janeiro city, they come from two databases: (i) e-SUS VE; and (ii) SIVEP-Gripe. The first records the flu syndrome in ordinary cases, while the second is responsible for the severe acute respiratory syndromes records. Both are compiled (without duplication) by the Municipal Health Department, which makes them available on a website\cite{PainelRioCovid} widely accessible to the general public. Data for new cases are organized by the date of first symptoms, while new deaths are recorded by the date of the event. Other locations have their registration systems, but the vast majority of them have most of the features in common with the database described above. Epidemiological data are notoriously problematic for statistical analysis purposes, as delay and underreporting effects are unavoidable, due to the physical impossibility of knowing all the cases that occur, neither in real-time nor with a few days delay\cite{Gamerman2022}. In practice, as the city of Rio de Janeiro has not adopted a massive random testing policy, only part of the cases of infection by COVID-19 were confirmed with the laboratory tests, essentially those that seek medical attention. Thus, the available data for cases evolution provide a distorted (biased) picture of the epidemiological reality, with far fewer cases reported than the actual number of infected, and with an estimated date for infection beginning shifted in time from the true onset, since the infection onset is estimated by the date of first symptoms (which occurs on average 5 days after the infection event). Death records also suffer from underreporting, but on a much smaller scale, as in this case registration is compulsory. Typically, deaths from COVID-19 that are not counted are those with no formal diagnosis of the disease by a laboratory test. In this setting, the time series for the number of new deaths per day can be considered a proxy to assess the evolution of contagion by the disease, since there is a clear correlation between it and the temporal evolution of the total number of cases (part of the cases evolves to death, more cases occurring, the expectation is more deaths, fewer cases, fewer deaths)\cite{Gamerman2022}. In the analysis reported in this paper, only death data are considered. Since these data are recorded by the actual date of the event (in this case, the death), no delay is inserted into data, except that one related to the insertion of data into the system, which can take up to 30 days, but which only compromises the accuracy of the end of the time series, and can be corrected with the use of nowcasting techniques\cite{Gamerman2022}. As the time series of cases and deaths are subject to much fluctuation, due to the natural variability of the disease, but also due to imperfections in the surveillance system, treating the data in advance is necessary to make them suitable for visual analysis, since extracting patterns from raw data is quite difficult. In this sense, these data are smoothed with the aid of 7 days moving average filter, to reduce excess fluctuation. As can be seen in Fig.~\ref{fig:fig3}, this treatment helps to display the data evolution pattern. But it should be mentioned that due to the use of only past data in the smoothing (for reasons of causality), the moving average inserts a delay of a few days in the data series. To avoid introducing this bias into statistical estimates, only raw data are considered in the statistical estimation processes presented below. Moving averages are used in this paper only to visually illustrate the trend of raw data. \subsection{Ensemble of statistical models} The three typical phases of an epidemic outbreak (expansion, transition, and exhaustion)\cite{brauer2001,Murray2002,Kuhl2021} usually are well described by logistic curves when the underlying population is relatively homogeneous, so that contamination comes out of a close interaction between two people. This scenario is assumed as a working hypothesis in this paper, in a way that several statistical models, based on the algebraic solution of a logistic differential equation, are used here to represent the multiple outbreaks of COVID-19 that are characterized by a dataset that collects deaths records for a certain locality into a time series. This is inspired by the approach adopted by Batista and Cunha~Jr\cite{Fernando_Batista} to study the early stages of COVID-19 in Portugal. It means the we have the statistical \subsubsection*{Single wave model} When just a single wave of contagion is of interest, the Verhulst logistic model \cite{Martcheva2015,Brauer2008,Murray2002,brauer2001} is employed. This model assumes a growth rate proportional to the disease prevalence in the population at time $t$, denoted by $C(t)$, but with a constant of proportionality that changes in time, so that it reduces when $C(t)$ grows, until reaching a maximum sustainable population in the limit when $t \to \infty$. This logistic model is defined by the differential equation \begin{equation}\label{log02} \dfrac{dC}{dt} = r \, C \, \left(1 - \dfrac{C}{K}\right) \, , \end{equation} which has as solution the classical logistic curve \begin{equation}\label{Ct} C(t) = \displaystyle \frac{K}{1+e^{\displaystyle -r \, (t-\tau)}} \, , \end{equation} where $r$ represents the infection growth rate, $K$ is the final number of notifications at the end of the outbreak, and $\tau$ describes the (initial condition dependent) instant of inflection associated to this curve, when the exponential growth ends, and a sudden deceleration begins. The derivative of $C(t)$, dubbed the incidence curve $I(t)$, represents the number of new death notifications per day, and is given by \begin{equation} I(t) = \dfrac{dC}{dt} = \frac{r \, K \, e^{\displaystyle -r\, (t-\tau)}}{\left(1 + e^{\displaystyle -r\,(t-\tau)} \right)^2} \, . \label{It} \end{equation} Other authors use generalized logistic curves to deal with this kind of epidemic data \cite{Vasconcelos2020,Fernando_Batista,Zou2020p1}. Despite this being a possibility, the present work opted for the classic logistic curve for the sake of parsimony, as it is capable of providing a reasonable representation of Rio de Janeiro outbreaks. \subsubsection*{Multiple waves model} When more than one wave of contagion matters, a multimodal epidemic curve with $N$ peaks is considered, which demands the estimation of $3N$ parameters \begin{equation} \theta = (K_1,\, r_1,\, \tau_1,\, \cdots , \, K_N,\, r_N,\, \tau_N) \, , \label{theta_eq} \end{equation} resulting in a global prevalence curve \begin{equation} C(t) = \displaystyle\sum_{i=1}^{N} \frac{K_i}{1+e^{\displaystyle -r_i \, (t-\tau_i)}} \, , \label{sumCN} \end{equation} which results, by differentiation, in the global incidence curve \begin{equation} I(t) = \displaystyle\sum_{i=1}^{N} \displaystyle \frac{r_i \, K_i \, e^{\displaystyle -r_i \, (t-\tau_i)}}{ \left(\displaystyle 1+e^{\displaystyle -r_i \, (t-\tau_i)} \right)^2} \, . \label{INt} \end{equation} \subsubsection*{Calibration procedure} The calibration process of each statistical model consists of identifying the underlying parameters with the aid of new deaths per day time series $(I_1, \cdots, I_n)$, that correspond to the discrete-time instants $(t_1, \cdots, t_n)$. This task requires the minimization of the \textit{Roots Mean Squared Error} (RMSE) \begin{equation} RMSE = \sqrt{\dfrac{1}{n}\sum_{j = 1}^{n} \left(I_{j} - I(t_{j} \,) \right)^2} \,, \label{eq:RMSE} \end{equation} that measures the ``discrepancy'' between data values and the corresponding predictions given by the model that calculates the incidence $I(t)$. In practice, RMSE represents the weighted average of the square of the residuals generated by the calibrated model\cite{Wasserman2004,Hastie2009}. The RMSE numerical minimization procedure employs a Trust Region algorithm\cite{Nocedal2006,Bonnans2009}, where bounds for the parameter value, as well as an initial guess, are specified. Such bounds are determined based on numerical experimentation followed by visual inspection of the fitted curves. To minimize the dependence of the fitted curve with the prescribed value for the initial guess, Monte Carlo simulation\cite{kroese2011,cunhajr2014p1355} is used, where random values for the initial guess (within the admissible region) are drawn and used to generate a fitting curve. Among all the obtained fittings, the one with the smallest RMSE is chosen. To assess the quality of the statistical fit, this work also considers the coefficient of determination \begin{equation} R^2 = 1 - \dfrac{\sum_{j = 1}^{n}\left( I_{j} - I(t_{j}) \,\right )^2 }{\sum_{j = 1}^{n} \left( I_{j} - \bar{I} \, \right)^2} \,, \label{Rsq} \end{equation} where the time series $(I_1, \cdots, I_n)$ average is given by \begin{equation*} \bar{I} = \dfrac{1}{n}\sum_{j = 1}^{n} I_{j} \, . \end{equation*} The last metric describes how much of the total variance generated by the observed data is explained by the calibrated model. The value of $R^2$ varies between 0 and 1, so that the closer to 1 the more significant the model is, as the value of $R^2$ is the proportion of the original variability of the data that is explained\cite{Bishop2006,Hastie2009}. \subsection{Model selection} Different models can be fitted to the same dataset, choosing which is the most suitable requires the use of rational criteria to avoid potential bias. Thus, two information criteria are used here to choose the most suitable model following a rational criterion, which seeks to balance simplicity and predictability between the models. They are: (i) Akaike information criterion (AIC); (ii) Bayesian information criterion (BIC)\cite{Bishop2006,Hastie2009,Brunton2019}. The AIC metric is given by \begin{equation} AIC = -2 \, \log{ L(\hat{\theta})} + 2 \, p \,, \label{AIC} \end{equation} where $p$ is the number of model parameters, $\hat{\theta}$ the estimated parameters vector which maximizes the likelihood function $L(\theta)$. On the other hand, the BIC metric is defined as \begin{equation} BIC = - 2 \ \log{ L(\hat{\theta})} + p \, \log{n} \,, \label{BIC} \end{equation} where $n$ is the number of observations. The model with the lowest AIC and BIC values is considered the best fitting model. Eventually these metrics can be combined with facts (documented in data) to assist in choosing the model. \subsection{Outbreak start dates} The estimate of the epidemic outbreak start date is not done in a punctual way, because an exact date in a context full of uncertainties such as an epidemic outbreak is a fragile estimate, and meaningless from any modeling point of view that makes sense. Thus, an interval estimate is considered in this work, where the upper limit of an admissible interval for the beginning of the outbreak is estimated with the help of the confidence band that encompasses the uncertainty of the statistical model. In this way, after the construction of a statistical model that fits the data, a 95\% confidence interval is obtained around the model's response curve. Such a prediction interval\cite{Wasserman2004}, with $(1-\alpha) \times 100\%$ confidence, is defined by \begin{equation} I(t) \pm z_{\alpha/2} \, \xi_{n} \,, \label{ICzj2} \end{equation} where $z_{\alpha/2}$ is the quantile of the Student-$\text{t}$ distribution with $n$ degrees of freedom and statistical significance $\alpha = 0.05$, while \begin{equation} \xi_{n} = S \, \sqrt{1 + \frac{1}{n} \, \frac{\sum_{j = 1}^{n}(I_{j} - I(t)\,)^2}{\sum_{j = 1}^{n}(I_{j} - \bar{I} \,)^2}} \,, \label{ICzj2} \end{equation} with \begin{equation} S = \frac{\sum_{j=1}^n (I(t_j)-I_j)^2}{n-2} \, . \end{equation} The intersection between the boundaries of this envelope and the time axis provides a range of possible dates for the start of the outbreak under investigation so that the rightmost point of this intersection is assumed to be an upper bound for the outbreak start date. \section{Results and discussion} \label{sec:Results and discussion} In this section, our objective is to obtain an interval estimation for the starting dates of each COVID-19 outbreak in Rio de Janeiro city. The start date in this context is understood to be the day on which a certain level of prevalence is achieved so that new infection events occur every day from that point forward. This starting date may be related to the introduction of a novel viral strain in the community or to a key event that initiated a new chain of contagion. \subsection*{The starting of SARS-CoV-2 community transmission} The data shown in Fig.~\ref{fig:fig3} allows us to observe the existence of several waves of contagion in Rio de Janeiro city, which resulted in 6 waves of deaths, four big explosions, and two small boosts. In this first analysis, only the first of these waves is considered. Once the exact date where one wave ends and another begins is extremely uncertain, makes more sense to speak about this event in an interval sense, a plausible period where that date is contained. In this way, by visual inspection of Fig.~\ref{fig:fig3}, it is verified that the first wave of deaths starts between the middle of March and the beginning of April, and ends by the end of June or the beginning of July 2020. Between March and April 2020, the epidemic surveillance system in Rio de Janeiro was still adapting to the pandemic, testing to determine if death from respiratory disease was due to COVID-19 was not yet mandatory, so that underreporting in this period (certainly above average) can bias the estimate of the outbreak start date. In May 2020, on the other side, the COVID-19 death tracking system was better developed, so the first wave phase records should not be so biased. Thus, for the sake of minimizing bias during statistical model calibration, the training data considered here uses the time series of new deaths per day between May 1st and July 1st. Table~\ref{tab1} shows the values of the parameters found in the calibration process for a single wave model, the estimated date for the epidemic outbreak start, as well as the quality metrics of the fitting and information criteria, for several scenarios of the parameter $\tau$, which represents the instant of inflection of the logistic model (the peak of the incidence curve). These multiple scenarios are considered because the evolution of a patient who dies, between the time of infection and death, has a variable duration. Therefore, considering a range of possible dates around the peak of the data (April 28, day 127 of the time series) is a strategy to reduce the influence of this uncertainty on the inference process. By generating a family of possible curves (ensemble of models), the adopted information criteria (AIC and BIC) and the known facts about the outbreak will indicate which of those curves are a plausible representation for the wave of deaths. \begin{table*} \centering \caption{{\bf Estimated parameters, the respective confidence intervals, fitting metrics, and information criteria measures for the statistical models used to represent the first wave of deaths by COVID-19 in Rio de Janeiro (for several scenarios of peak day). }} \label{tab1} \vspace{2mm} \begin{tabular}{c|c|c|c|c|cc|cc} \toprule $\tau$ & $K \times 10^3$ & $r \times 10^{-3} $ & deaths start date & cases start date & RMSE & R$^2$ & AIC & BIC\\ (day) & (people) & (day$^{-1}$) & upper bound & upper bound & & & & \\ \midrule 119 & 9.70 (9.14, 10.26) & 53 (49, 57) & Mar 13, 2020 & Mar 02, 2020 & 13.8 & 0.86 & 3.99 & 8.24\\ 120 & 9.70 (9.18, 10.21) & 53 (49, 57) & Mar 12, 2020 & Mar 01, 2020 & 12.7 & 0.89 & 3.99 & 8.24\\ 121 & 9.70 (9.21, 10.18) & 53 (49, 56) & Mar 11, 2020 & Feb 29, 2020 & 11.8 & 0.90 & 3.99 & 8.24\\ 122 & 9.70 (9.23, 10.16) & 53 (50, 56) & Mar 11, 2020 & Feb 29, 2020 & 11.1 & 0.91 & 4.19 & 8.44\\ 123 & 9.70 (9.25, 10.15) & 52 (49, 55) & Mar 11, 2020 & Feb 29, 2020 & 10.7 & 0.92 & 4.04 & 8.30\\ 125 & 9.28 (8.84, ~9.73) & 55 (51, 57) & Mar 15, 2020 & Mar 04, 2020 & 10.8 & 0.92 & 3.98 & 8.24\\ 127 & 8.72 (8.28, ~9.15) & 57 (53, 60) & Mar 20, 2020 & Mar 09, 2020 & 11.0 & 0.91 & 4.01 & 8.27\\ 129 & 8.18 (7.74, ~8.62) & 60 (56, 64) & Mar 26, 2020 & Mar 15, 2020 & 11.4 & 0.91 & 4.00 & 8.25\\ 131 & 7.68 (7.22, ~8.13) & 63 (59, 68) & Mar 31, 2020 & Mar 20, 2020 & 12.2 & 0.89 & 4.00 & 8.26\\ \bottomrule \end{tabular} \end{table*} Note that for each model corresponds to a date, which is the estimate of the upper limit for the beginning of the wave of deaths. Due to the correlation between cases and deaths, there is a temporal shift (with a certain probability distribution) between this limit date on the curve of deaths and its counterpart on the curve of cases. Hawryluk et al.\cite{Hawryluk2020} points out that the COVID-19 average time from symptom onset to death in Brazil, during the first wave, was around 15.2 (11.2, 17.8) days, so that a conservative estimate for the upper bound for the date of onset of cases (fifth column of Table~\ref{tab1}) can be obtained by subtracting 11 days from the date estimated by the curve of deaths (fourth column of Table~\ref{tab1}). \begin{figure*}[ht!] \centering \includegraphics[scale = 0.3]{fig5_a.pdf} \includegraphics[scale = 0.3]{fig5_b.pdf} \includegraphics[scale = 0.3]{fig5_c.pdf}\\ \vspace{5mm} \includegraphics[scale = 0.3]{fig5_d.pdf} \includegraphics[scale = 0.3]{fig5_e.pdf} \includegraphics[scale = 0.3]{fig5_f.pdf}\\ \vspace{5mm} \includegraphics[scale = 0.3]{fig5_g.pdf} \includegraphics[scale = 0.3]{fig5_h.pdf} \includegraphics[scale = 0.3]{fig5_i.pdf} \caption{Logistic curves fitted to the time series associated with the incidence of deaths during the first wave of COVID-19 in Rio de Janeiro city, and the corresponding prediction band, for several scenarios of peak day: 119 (top left), 120 (top center), 121 (top right), 122 (middle left), 123 (middle center), 125 (middle right), 127 (bottom left), 129 (bottom center), 131 (bottom right). The dashed vertical lines indicate the upper bound estimation for the starting date of the first epidemic wave. Data used in the model calibration: May 1st to July 1st, 2020.} \label{fig:fig5} \end{figure*} \begin{figure*}[ht!] \centering \includegraphics[scale = 0.3]{fig6_a.pdf} \includegraphics[scale = 0.3]{fig6_b.pdf} \includegraphics[scale = 0.3]{fig6_c.pdf}\\ \vspace{5mm} \includegraphics[scale = 0.3]{fig6_d.pdf} \includegraphics[scale = 0.3]{fig6_e.pdf} \includegraphics[scale = 0.3]{fig6_f.pdf}\\ \vspace{5mm} \includegraphics[scale = 0.3]{fig6_g.pdf} \includegraphics[scale = 0.3]{fig6_h.pdf} \includegraphics[scale = 0.3]{fig6_i.pdf}\\ \caption{Logistic curves fitted to the time series associated with the prevalence of deaths during the first wave of COVID-19 in Rio de Janeiro city, and the corresponding prediction band, for several scenarios of peak day: 119 (top left), 120 (top center), 121 (top right), 122 (middle left), 123 (middle center), 125 (middle right), 127 (bottom left), 129 (bottom center), 131 (bottom right). Data used in the model calibration: May 1st to July 1st, 2020.} \label{fig:fig6} \end{figure*} Furthermore, the fitting metrics of Table~\ref{tab1} suggest that all the calibrated statistical models have good adherence to the data, which can be visually confirmed in Fig.~\ref{fig:fig5}, which shows 9 candidate models for the single wave incidence curve, each one corresponding to a different value for $\tau$. The corresponding prevalence curves can be seen in the sequence, in Fig.~\ref{fig:fig6}. In these figures, the raw epidemic data is represented by magenta dots, the 7 days moving average by a thin green line, the fitted epidemic curve is given by a thick blue line, and the 95\% confidence band is shown in gray. In qualitative terms, all the candidate models provide a good description of the descending part of the wave, and they all more or less agree on the inference of the "hidden part" of the wave, i.e., that part of the outbreak which was not captured by the epidemic surveillance system on the early stages of the epidemic process. It is also noted that models with a lower value of $\tau$ (inflection point furthest from the peak of data) tend to estimate underreporting in death records more conservatively, as their prevalence curves are more detached from the observations (known to be underreported). However, despite the qualitative similarity between all candidate models, from a quantitative point of view, differences exist and materialize themselves in the estimation of the upper bound for the starting dates. These quantitative differences in date predictions are compared with known information about the onset of community transmission, to eliminate models that provide predictions inconsistent with observations. This can be seen as a complementary step in the model selection procedure, to delineate the most plausible model(s) for the available data. The surveillance data used to construct the Fig.~\ref{fig:fig3} presents sparse notifications for cases in January and February, and no null records from March 1st. This is a direct indication that at the beginning of March there was already community transmission. Thus, by inconsistency with direct evidence, we will eliminate all models that point to a date greater than March 1st as the upper bound for the wave of cases start date, which leaves us with four candidate models, corresponding to $\tau \in \{120, 121, 122, 123 \}$. Among these four models, $\tau = 120$ and $121$ have the lowest values for AIC and BIC, being in principle the natural choices for the most representative model. And between these two candidate models, $\tau =121$ has the lowest RMSE and highest $R^2$, so it is the optimal choice in light of fitting metrics and model selection criteria. This model indicates \underline{\emph{February 29, 2020}} as an upper bound for the first wave of cases starting date. \subsection*{Consistency on the inference of first wave starting date} It is very clear that the comparison with the evidence of the beginning of community transmission provides a good filter to discard models that overestimate the desired date, but does not provide information about the other models. This role is in charge of the model selection criteria, which show a marginally small difference in their numerical values for all the remnants candidate models, which may indicate that all the models under evaluation are more or less equally capable of describing the first epidemic wave. The fitting metrics RMSE and $R^2$ can be used as a supplement, in this case, the drawback is that, in the case of overfitting, they may provide very poor indicators of the model quality. Thus, in a scenario of metrics, as indicated in Table~\ref{tab1}, additional considerations to indicate the consistency of the statistical fit are desirable. Following this idea, a combination (arithmetic mean) of the forecast obtained by the four candidate models is used as an estimator for the starting date of cases, providing again \underline{\emph{February 29, 2020}} as a possible upper limit for the beginning of community transmission of COVID-19 in the city of Rio de Janeiro. Once this is an interval estimate, it is possible (and probable) that the threshold of dozens of cases in the prevalence of the disease has occurred sometime in February, instead of March as current data suggest. To strengthen this conclusion we use a hypothesis test, where the null and alternative hypotheses adopted are $$H_0: \mbox{cases start date} \geq \mbox{March 1, 2020} \, ,$$ and $$H_1: \mbox{cases start date} < \mbox{March 1, 2020} \, ,$$ respectively. Only the estimated upper bound dates that were not discarded in the comparison with the community transmission data are considered in the test, providing a piece of strong evidence against the null hypothesis, with a p-value 0.0288. This result is indirect evidence, coming from a prediction with a mathematical model, in favor of the thesis that the virus was already circulating in the city before March 2020, which adds to the direct (but weak) evidence that appears in the record of cases by first symptoms. \subsection*{The appearance of other waves of contagion} The exact periods when the other waves of contagion begin are so uncertain as that one of the first wave. Thus, periods that contain the other waves are determined by visual inspection as follows: Jun-Nov 2020 (second wave); Nov 2020-Mar 2021 (third wave); Mar-May 2021 (fourth wave); May-Jul 2021 (fifth wave); Jul-Dec 2021 (sixth wave). Logistic curves that fit training data, determined within each of these time windows, are fitted following a procedure similar to that adopted in the analysis of the first wave. The results of these model calibrations can be seen in Table~\ref{tab2}, which shows for the 2nd to the 6th epidemic waves, and several peak date scenarios, information related to identified parameters, wave starting dates, fitting metric, and model selection criteria. Selecting the models as described in the first wave, we obtain the following models as the most representative: $\tau = 268$ (second wave); $\tau = 355$ (third wave); $\tau = 465$ (fourth wave); $\tau = 505$ (fifth wave); $\tau = 608$ (sixth wave). The incidence curves that correspond to the best models of each wave can be seen in Fig.~\ref{fig:fig7}. In all these cases, the incidence curves show good adherence to the data, so that the respective models provide a reasonable description of the epidemic behavior underlying each analyzed period. Using these models (in the same way as was done in the first wave), we have as upper bounds for the start dates of the other epidemic waves: July 17, 2020 (second wave); November 6, 2020 (third wave); March 2, 2021 (fourth wave); March 16, 2021 (fifth wave); July 9, 2021 (sixth wave). Using the parameters identified in each of the six waves above as the initial guess of a regression process that seeks to calibrate a model with 6 waves, Eq.(\ref{INt}), we obtain the incidence curve and prediction band that are shown in Fig.~\ref{fig:fig8}, which also shows the start dates that were estimated above. This figure clarifies a point that may have left doubts in the reader, about the temporal proximity between the fourth and fifth waves. The sum of the two can explain the asymmetry observed in the fall of the fourth wave, which is interpreted in the light of this model as being the superposition of two contagion waves that emerged temporally close. This is a plausible scenario, for example, if there are two key events in the city that are triggers for scaling up contagion events. Or if two regions of the city, geographically not close, experience an increase in contagion almost simultaneously. \begin{table*} \centering \caption{{\bf Estimated parameters, the respective confidence intervals, fitting metrics, and information criteria measures for the statistical models used to represent the 2nd to 6th waves of deaths by COVID-19 in Rio de Janeiro (for several scenarios of peak day). }} \label{tab2} \vspace{2mm} \begin{tabular}{c|c|c|c|c|c|cc|cc} \toprule & $\tau$ & $K \times 10^3$ & $r \times 10^{-3} $ & deaths start date & cases start date & RMSE & R$^2$ & AIC & BIC\\ & (day) & (people) & (day$^{-1}$) & upper bound & upper bound & & & & \\ \midrule \multirow{4}{*}{2nd wave} & 264 & 4.30 (3.63, 4.70) & 28 (23, 34) & Jul 16, 2020 & Jul 05, 2020 & 5.37 & 0.27 & 124.7 & 129.73\\ & 266 & 4.36 (3.69, 5.03) & 28 (23, 33) & Jul 17, 2020 & Jul 06, 2020 & 5.34 & 0.27 & 88.2 & 93.30\\ & 268 & 4.48 (3.78, 5.18) & 27 (22, 32) & Jul 17, 2020 & Jul 06, 2020 & 5.35 & 0.27 & 4.3 & 9.36\\ & 270 & 4.67 (3.90, 5.43) & 26 (21, 31) & Jul 16, 2020 & Jul 05, 2020 & 5.40 & 0.26 & 22.8 & 27.84\\ \midrule \multirow{4}{*}{3rd wave} & 349 & 6.85 (6.22, 7.48) & 47 (41, 53) & Nov 06, 2020 & Oct 26, 2020 & 15.5 & 0.52 & 4.02 & 9.09\\ & 351 & 6.66 (6.15, 7.17) & 50 (45, 55) & Nov 06, 2020 & Oct 26, 2020 & 13.7 & 0.62 & 4.00 & 9.07\\ & 353 & 6.57 (6.14, 7.00) & 47 (47, 56) & Nov 06, 2020 & Oct 26, 2020 & 12.2 & 0.70 & 4.00 & 9.07\\ & 355 & 6.54 (6.16, 6.92) & 48 (48, 56) & Nov 06, 2020 & Oct 26, 2020 & 11.0 & 0.76 & 4.02 & 9.11\\ \midrule \multirow{4}{*}{4th wave} & 461 & 6.01 (5.56, 6.47) & 70 (63, 77) & Mar 03, 2021 & Feb 20, 2021 & 13.2 & 0.75 & 4.00 & 8.25\\ & 463 & 6.12 (5.73, 6.52) & 69 (63, 74) & Mar 02, 2021 & Feb 19, 2021 & 11.3 & 0.82 & 4.00 & 8.25\\ & 465 & 6.36 (5.95, 6.77) & 65 (60, 71) & Mar 02, 2021 & Feb 19, 2021 & 10.9 & 0.83 & 4.00 & 8.25\\ & 467 & 6.73 (5.25, 7.21) & 61 (55, 66) & Mar 02, 2021 & Feb 19, 2021 & 11.6 & 0.81 & 4.00 & 8.26\\ \midrule \multirow{4}{*}{5th wave} & 504 & 8.11 (6.78, 9.44) & 32 (26, 39) & Mar 14, 2021 & Mar 03, 2021 & 09.4 & 0.55 & 68.88 & 73.13\\ & 505 & 8.11 (6.65, 9.57) & 32 (25, 38) & Mar 16, 2021 & Mar 05, 2021 & 09.7 & 0.52 & 11.52 & 15.78\\ & 506 & 8.11 (6.51, 9.72) & 31 (24, 39) & Mar 19, 2021 & Mar 08, 2021 & 10.0 & 0.48 & 16.91 & 21.16\\ & 507 & 8.11 (6.35, 8.87) & 31 (23, 39) & Mar 21, 2021 & Mar 10, 2021 & 10.3 & 0.45 & 37.77 & 42.02\\ \midrule \multirow{4}{*}{6th wave} & 600 & 4.86 (4.62, 5.10) & 49 (46, 52) & Jul 05, 2021 & Jun 24, 2021 & 6.3 & 0.92 & 4.27 & 9.89\\ & 602 & 5.06 (4.81, 5.31) & 47 (44, 50) & Jul 02, 2021 & Jun 21, 2021 & 6.5 & 0.91 & 4.33 & 9.95\\ & 604 & 4.86 (4.63, 5.10) & 49 (46, 52) & Jul 05, 2021 & Jun 24, 2021 & 6.3 & 0.92 & 4.27 & 9.89\\ & 608 & 4.70 (4.48, 4.92) & 51 (48, 54) & Jul 09, 2021 & Jun 28, 2021 & 6.3 & 0.92 & 4.07 & 9.69\\ \bottomrule \end{tabular} \end{table*} \begin{figure*} \centering \includegraphics[scale = 0.3]{fig7_a.pdf} \includegraphics[scale = 0.3]{fig7_b.pdf} \vspace{5mm} \includegraphics[scale = 0.3]{fig7_c.pdf} \includegraphics[scale = 0.3]{fig7_d.pdf} \includegraphics[scale = 0.3]{fig7_e.pdf} \caption{Logistic curves fitted to the time series associated with COVID-19 incidence of deaths in Rio de Janeiro city, and the corresponding prediction bands, for several contagion waves. The dashed vertical lines indicate the upper bound estimation for the starting dates of the epidemic waves. Second wave (top) data: August 1st to November 1st, 2020; Third wave (middle top) data: November 1st, 2020 to February 1st, 2021; Fourth wave (middle middle) data: March 1st to May 1st, 2021; Fifth wave (middle bottom) data: May 1st to July 1st, 2021; and Sixth wave (bottom) data: August 1st to December 1st, 2021.} \label{fig:fig7} \end{figure*} \begin{figure*} \centering \includegraphics[scale = 0.5]{fig8.pdf} \caption{Logistic curve with 6-waves fitted to the time series associated with COVID-19 incidence of deaths in Rio de Janeiro city, and the corresponding prediction band. The dashed vertical lines indicate the upper bound estimations for the starting dates of the epidemic waves. Training data: April 1st, 2020 to December 31st, 2022.} \label{fig:fig8} \end{figure*} \subsection*{Correlation between starting dates and key events} It is worth remembering at this point that the Carnival festivities of that year took place between the 21st and 26th of February (Friday to Wednesday) 2020. This temporal proximity between the plausible period for the beginning of community transmission (February 29 or before) and the Carnival is a shred of evidence in favor of the hypothesis widely circulated among epidemiologists\cite{Ashktorab2021} that the Carnival celebrations in the streets were a critical event for the spread of COVID-19 in Rio de Janeiro. Correlations with other key events, such as business reopenings, extended holidays, festive dates, etc., can be similarly investigated. Due to space limitations, we do not present other investigations of this type in this paper. \section{Conclusions} \label{sec:Conclusions} The dynamics of COVID-19 may have multiple waves of contagion in the same geographic location as a side effect. Due to the complex and not fully understood nature of the disease transmission process, specifying the exact moment of emergence of new community contagion outbreaks is a hard task. This work presented a statistical approach capable of describing the multiple waves of contagion observed, as well as providing an interval estimation of the possible start date for each outbreak. This methodology was illustrated with the COVID-19 data of Rio de Janeiro city and determined possible starting dates for the multiple outbreaks during the years 2020 and 2021. The results obtained show that logistic models with one or more waves can be used to provide mathematical descriptions, with good adherence to the data, in epidemiological scenarios with complex transmission dynamics. In addition, they support that SARS-CoV-2 probably started to be disseminated locally in Rio de Janeiro as early as February 2020. \section*{Supplementary Material} The supplementary material is composed of the data and codes used to calibrate the statistical models, which are also are available in the repository \url{https://github.com/americocunhajr/COVID19Waves} \begin{acknowledgments} The authors thank Mrs. Gabrielle Pereira and \emph{\mbox{COVID-19:} Observatório Fluminense} initiative for preparing Figures~\ref{fig:fig1} and \ref{fig:fig2}. This work was supported by Funda\c c\~ao de Amparo \`a Pesquisa do Estado de S\~ao Paulo, FAPESP (process: 2015/50122-0); Funda\c c\~ao Carlos Chagas Fillho de Amparo \`a Pesquisa do Estado do Rio de Janeiro, FAPERJ (processes: 211.037/2019 and 201.294/2021); Coordenação de Aperfei\c coamento de Pessoal de N\'ivel Superior, CAPES (process: 88887.506931/2020-00), and Conselho Nacional de Desenvolvimento Cient\'ifico e Tecnol\'ogico , CNPq (process: 441016/2020-0). \end{acknowledgments} \section*{Data Availability Statement} \label{sec:DataStatement} The data that support the findings of this study are available within the article and its supplementary material. \section*{References}
{'timestamp': '2022-03-07T02:03:13', 'yymm': '2203', 'arxiv_id': '2203.02011', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.02011'}
arxiv
\section{Introduction} \label{section:introduction} Theoretical performance guarantees and adaptability to real-world constraints determine the deployability, and hence the practical utility, of statistical methods and machine learning algorithms. For example, spectral clustering \citep{NgEtAl:2001:OnSpectralClustering,Luxburg:2007:ATutorialOnSpectralClustering}, one of the most sought after algorithms for clustering and community detection, has been studied under various constraints such as \textit{must-link} and \textit{cannot-link} constraints \citep{KamvarEtAl:2003:SpectralLearning, WangDavidson:2010:FlexibleConstrainedSpectralClustering}, size-balanced clusters \citep{BanerjeeGhosh:2006:ScalableClusteringAlgorithmsWithBalancingConstraints}, and statistical fairness \citep{KleindessnerEtAl:2019:GuaranteesForSpectralClusteringWithFairnessConstraints}. Commonly used constraints in practice can be categorized as \textit{population-level} (also known as statistical-level) or \textit{individual-level} constraints. However, the only known consistency guarantees for constrained spectral clustering were established in \citet{KleindessnerEtAl:2019:GuaranteesForSpectralClusteringWithFairnessConstraints} for the first case, where the goal is to find balanced clusters with respect to an auxiliary categorical attribute. In this paper, we study a problem setting where the auxiliary information is encoded in a graph $\mathcal{R}$, which we refer to as a \textit{representation graph}. We study spectral clustering in a given \textit{similarity graph} $\mathcal{G}$ under an individual-level balancing constraint that is specified using the representation graph $\mathcal{R}$. There are two-fold advantages of this setting: \textbf{(i)} our constraint selects clusters that are balanced from each individual's perspective, and \textbf{(ii)} it enables us to define a new variant of the stochastic block model (SBM) \citep{HollandEtAl:1983:StochasticBlockmodelsFirstSteps} that plants the properties of $\mathcal{R}$ into the sampled graphs, making this variant of SBM \textit{representation-aware} (aware of the representation graph $\mathcal{R}$). \subsection{Problem setting and applications} \label{section:problem_setting_and_applications} Let $\mathcal{G}$ denote a similarity graph based on which clusters have to be discovered. We consider a setting where each node in $\mathcal{G}$ specifies a list of its representatives (other nodes in $\mathcal{G}$) using an auxiliary representation graph $\mathcal{R}$. The graph $\mathcal{R}$ is defined on the same set of nodes as $\mathcal{G}$ and its edges specify the ``is representative of'' relationship. For example, $\mathcal{R}$ may be a result of the interactions between individuals that result from values of certain latent node attributes like age and gender. This motivates a \textit{representation constraint} that requires the clusters in $\mathcal{G}$ to be such that each node has a sufficient number of representatives (as per $\mathcal{R}$) in all the clusters. Our goal is to develop and analyze variants of the spectral clustering algorithm with respect to this constraint. We begin by briefly describing two applications that motivate the above discussed problem. The first application is concerned with the ``fairness'' of clusters. Informally, a node or individual finds the clusters fair if it has a sufficient representation in all the clusters. The work of \citet{ChierichettiEtAl:2017:FairClusteringThroughFairlets} requires the clusters to be balanced with respect to various \textit{protected groups} (like gender or race). For example, if $50\%$ of the population is female then the same proportion should be respected in all clusters. This idea of proportional representation has been extended in various forms \citep{RosnerSchmidt:2018:PrivacyPreservingClusteringWithConstraints,BerceaEtAl:2019:OnTheCostOfEssentiallyFairClusterings,BeraEtAl:2019:FairAlgorithmsForClustering} and several efficient algorithms for discovering fair clusters under this notion have been proposed \citep{SchmidtEtAl:2018:FairCoresetsAndStreamingAlgorithmsForFairKMeansClustering,AhmadianEtAl:2019:ClusteringWithoutOverRepresentation,KleindessnerEtAl:2019:GuaranteesForSpectralClusteringWithFairnessConstraints}. While the fairness notion mentioned above is a \textit{statistical} fairness notion (i.e., constraints are applied on protected groups as a whole), \citet{ChenEtAl:2019:ProportionallyFairClustering} and \citet{MahabadiEtAl:2020:IndividualFairnessForKClustering} develop \textit{individual} fairness notions that require examples to be “sufficiently close" to their cluster centroids. \citet{AndersonEtAl:2020:DistributionalIndividualFairnessInClustering} pursue a different direction and adapt the fairness notion proposed by \citet{DworkEtAl:2012:FairnessThroughAwareness} to the problem of clustering. Only \citet{KleindessnerEtAl:2019:GuaranteesForSpectralClusteringWithFairnessConstraints} study spectral clustering in the context of (statistical) fairness. In contrast, we show in Section \ref{section:constraint} that our proposed constraint interpolates between statistical and individual fairness based on the structure of $\mathcal{R}$. \begin{figure}[t] \centering \subfloat[][Protected groups]{\includegraphics[width=0.3\textwidth]{Images/toy_example_protected}\label{fig:toy_example:protected_groups}}% \hspace{5mm}\subfloat[][Statistically fair clusters]{\includegraphics[width=0.3\textwidth]{Images/toy_example_fairsc}\label{fig:toy_example:fairsc}}% \hspace{5mm}\subfloat[][Individually fair clusters]{\includegraphics[width=0.3\textwidth]{Images/toy_example_repfairsc}\label{fig:toy_example:repfairsc}} \caption{An example representation graph $\mathcal{R}$. Panel (a) shows the protected groups recovered from $\mathcal{R}$. Panel (b) shows the clusters recovered by a statistically fair clustering algorithm. Panel (c) shows the ideal individually fair clusters. (Best viewed in color)} \label{fig:fairness:toy_example} \end{figure} \begin{example} \label{example:statistical_vs_individual_fairness} To understand the need for individual fairness notions, consider the representation graph $\mathcal{R}$ specified in Figure \ref{fig:toy_example:protected_groups}. All the nodes have a self-loop associated with them that has not been shown for clarity. In this example, $N = 24$, $K = 2$, and every node is connected to $d=6$ nodes (including the self-loop). To use a statistical fairness notion \citep{ChierichettiEtAl:2017:FairClusteringThroughFairlets}, one would begin by clustering the nodes in $\mathcal{R}$ to approximate the protected groups, as the members of these protected groups will be each other's representatives to the first order of approximation. A natural choice is to have two protected groups, as shown in Figure~\ref{fig:toy_example:protected_groups} using different colors. However, clustering nodes based on these protected groups can produce the green and yellow clusters shown in Figure~\ref{fig:toy_example:fairsc}. It is easy to verify that these clusters satisfy the statistical fairness criterion as they have an equal number of members from both protected groups. However, these clusters are very "unfair" from the perspective of each individual. For example, node $v_1$ does not have enough representation in the yellow cluster as only one of its six representatives are in this cluster, despite the equal size of both the clusters. A similar argument can be made for every other node in this graph. This example highlights an extreme case where a statistically fair clustering is highly unfair from the perspective of each individual. Figure~\ref{fig:toy_example:repfairsc} shows another clustering assignment, and it is easy to verify that each node in this assignment has the same representation in both red and blue clusters, making it individually fair with respect to $\mathcal{R}$. Our goal is to develop algorithms that prefer the clusters in Figure~\ref{fig:toy_example:repfairsc} over the clusters in Figure~\ref{fig:toy_example:fairsc}. \end{example} Another possible application could be in balancing the load on computing resources in a cloud platform. Here, nodes in $\mathcal{G}$ correspond to processes and edges encode similarity among these processes in terms of shareable resources such as a read-only file. The edges in $\mathcal{R}$ on the other hand connect processes that share resources that can only be accessed by one process at a time (say a network channel). The goal is to cluster similar processes in $\mathcal{G}$ while ensuring that neighbors in $\mathcal{R}$ are spread out across clusters to avoid a collision. \subsection{Contributions and results} \label{section:contributions_and_results} Our primary goal is to establish the statistical consistency of constrained spectral clustering, where the constraints are specified from the perspective of each individual node in the graph. Towards this end, we make four contributions. First, in Section \ref{section:constraint}, we introduce the notion of balance from the perspective of each individual node in the graph and formally specify our representation constraint as a simple linear expression. While we focus on spectral clustering in this paper, the proposed constraint may be of independent interest for other clustering techniques as well. Second, in Sections~\ref{section:unnormalized_repsc} and \ref{section:normalized_repsc}, we develop \textit{representation-aware} variants of the unnormalized and normalized spectral clustering. The proposed algorithms incorporate our representation constraint as a linear constraint in spectral clustering's optimization objective. The resulting problem can be easily solved using eigen-decomposition and the returned clusters approximately satisfy the constraint. Third, in Section~\ref{section:rsbm}, we propose a variant of SBM called \textit{representation-aware} stochastic block model ($\mathcal{R}$-SBM). $\mathcal{R}$-SBM encodes a probability distribution over similarity graphs $\mathcal{G}$ conditioned on a given representation graph $\mathcal{R}$. It can be viewed as a model that plants the properties of $\mathcal{R}$ into $\mathcal{G}$. We show that $\mathcal{R}$-SBM generates similarity graphs that present a ``hard'' problem instance to the spectral algorithms in a constrained setting. In Section~\ref{section:consistency_results}, we consider the class of $d$-regular representation graphs and establish the weak-consistency of our algorithms (Theorems \ref{theorem:consistency_result_unnormalized} and \ref{theorem:consistency_result_normalized}) for graphs sampled from $\mathcal{R}$-SBM. To the best of our knowledge, these are the first consistency results for constrained spectral clustering under individual-level constraints. Fourth, in Section~\ref{section:numerical_results}, we present empirical studies on both simulated and real-world data to verify our theoretical guarantees. A comparison between the performance of the proposed algorithms and their closest counterparts in the literature demonstrates their practical utility. In particular, our experiments show that the $d$-regularity assumption on the representation graph is not necessary in practice. We conclude the paper in Section \ref{section:conclusion} with a few remarks on promising directions for future work. The proofs of all technical lemmas are presented in the supplementary material \citep{ThisPaperSupp}. \subsection{Related results} \label{section:related_results} Several algorithms for unconstrained clustering such as $k$-means \citep{HofmannBuhmann:1997:PairwiseDataClusteringByDeterministicAnnealing, WagstaffEtAl:2001:ConstrainedKMeansClusteringWithBackgroundKnowledge}, expectation-maximization based clustering \citep{ShentalEtAl:2003:ComputingGaussianMixtureModelsWithEMUsingEquivalenceConstraints}, and spectral clustering \citep{KamvarEtAl:2003:SpectralLearning} have been modified to satisfy the given \textit{must-link} (ML) and \textit{cannot-link} (CL) constraints \citep{BasuEtAl:2008:ConstrainedClustering} that specify pairs of nodes that should or should not belong to the same cluster. In this paper, we restrict our focus to spectral clustering as it provides a deterministic solution to the clustering problem in polynomial time and can detect arbitrarily shaped clusters \citep{Luxburg:2007:ATutorialOnSpectralClustering}. Existing approaches modify spectral clustering by preprocessing the input similarity graph \citep{KamvarEtAl:2003:SpectralLearning, LuCarreiraPerpinan:2008:ConstrainedSpectralClusteringThroughAffinityPropagation}, post-processing the eigenvectors of the Laplacian matrix \citep{LiEtAl:2009:ConstrainedClusteringViaSpectralRegularization}, or modifying the optimization problem solved by spectral clustering \citep{YuShi:2001:GroupingWithBias,YuShi:2004:SegmentationGivenPartialGroupingConstraints, BieEtAl:2004:LearningFromGeneralLabelConstraints, WangDavidson:2010:FlexibleConstrainedSpectralClustering,ErikssonEtAl:2011:NormalizedCutsRevisited, KawaleBoley:2013:ConstrainedSpectralClusteringUsingL1Regularization, WangEtAl:2014:OnConstrainedSpectralClusteringAndItsApplications}. Researchers have also studied spectral approaches that, for example, handle inconsistent \citep{ColemanEtAl:2008:SpectralClusteringWithInconsistentAdvice} or sparse \citep{ZhuEtAl:2013:ConstrainedClustering} constraints, actively solicit constraints \citep{WangDavidson:2010:ActiveSpectralClustering}, or modify variants of spectral clustering \citep{RangapuramHein:2012:Constrained1SpectralClustering, WangEtAl:2009:IntegratedKLClustering}, to name but a few. Other types of constraints such as those on cluster sizes \citep{BanerjeeGhosh:2006:ScalableClusteringAlgorithmsWithBalancingConstraints, DemirizEtAl:2008:UsingAssignmentConstraintsToAvoidEmptyClustersInKMeansClustering} and those that can be expressed as linear expressions \citep{XuEtAl:2009:FastNormalizedCutWithLinearConstraints} have also been explored. While this has been an active area of research, theoretical consistency guarantees on the performance of these constrained spectral clustering algorithms are largely missing from the literature. (Unconstrained) spectral clustering is backed by strong statistical guarantees that usually take the form ``the algorithm makes $o(N)$ mistakes with probability $1 - o(1)$.'' Here, $N$ is the number of nodes in the similarity graph. These results consider a random model that generates problem instances for the algorithm (similarity graph in this case) with known ground-truth clusters. The high probability bound is with respect to this random model and the mistakes are computed against the ground-truth clusters. An algorithm that satisfies the condition above is called \textit{weakly consistent} \citep{Abbe:2018:CommunityDetectionAndStochasticBlockModels}. A common choice for the random model is the Stochastic Block Model (SBM) \citep{HollandEtAl:1983:StochasticBlockmodelsFirstSteps}. In this model, nodes have predefined community memberships that are used to sample edges with different probabilities. \citet{RoheEtAl:2011:SpectralClusteringAndTheHighDimensionalSBM} established the weak consistency of spectral clustering under the SBM. \citet{LeiEtAl:2015:ConsistencyOfSpectralClusteringInSBM} instead used a variant of SBM to sample networks with a more realistic degree distribution \citep{KarrerNewman:2011:StochasticBlockmodelsAndCommunityStructureInNetworks}. Several other variants of SBM have also been used to provide appropriate problem instances such as graphs with overlapping clusters \citep{ZhangEtAl:2014:DetectingOverlappingCommunitiesInNetworksUsingSpectralMethods}, observable node covariates \citep{BinkiewiczEtAl:2017:CovariateAssistedSpectralClustering}, or two alternative set of clusters, one \textit{unfair} and one \textit{fair} \citep{KleindessnerEtAl:2019:GuaranteesForSpectralClusteringWithFairnessConstraints}. \citet{LuxburgEtAl:2008:ConsistencyOfSpectralClustering} use a different random model where the similarity graph encodes pairwise cosine similarity between input feature vectors that follow a particular probability distribution. \citet{TremblayEtAl:2016:CompressiveSpectralClustering} study a variant of spectral clustering that is faster than the traditional algorithm. \textit{Strong consistency} results are also known in some cases \citep{GaoEtAl:2017:AchievingOptimalMisclassificationProportionInStochasticBlockModels,LeiZhu:2017:AGenericSampleSplittingApproachForRefinedCommunityRecoveryInSBMs, VuEtAl:2018:ASimpleSVDAlgorithmForFindingHiddenPartitions}. Finally, \citet{GhoshdastidarDukkipati:2017:UniformHypergraphPartitioning, GhoshdastidarDukkipati:2017:ConsistencyOfSpectralHypergraphPartitioningUnderPlantedPartitionModel} propose a variant of SBM for hypergraphs and establish the weak consistency of spectral algorithms in this setting. Theoretical results for constrained clustering are primarily concerned with the computational complexity of the problem. It is known that the problem is NP-hard if one hopes for an exact solution that satisfies all the CL constraints \citep{DavidsonRavi:2005:ClusteringWithConstraints} or the statistical fairness constraint \citep{ChierichettiEtAl:2017:FairClusteringThroughFairlets}. Hence, most existing methods only satisfy the constraints approximately \citep{CucuringuEtAl:2016:SimpleAndScalableConstrainedClustering}. Results related to the cluster quality in the constrained setting only consider the algorithm's convergence to the global optima of a relaxed optimization problem \citep{XuEtAl:2009:FastNormalizedCutWithLinearConstraints}. \citet{KleindessnerEtAl:2019:GuaranteesForSpectralClusteringWithFairnessConstraints} is a notable exception, however, even they consider constraints that apply at the level of protected groups as explained above, and not at the level of individuals. They follow a similar strategy as ours and modify spectral clustering to add a statistical fairness constraint. In Section~\ref{section:constraint}, we argue that a particular configuration of the representation graph $\mathcal{R}$ reduces our constraint to the statistical fairness criterion. Thus, the algorithms proposed in \citet{KleindessnerEtAl:2019:GuaranteesForSpectralClusteringWithFairnessConstraints} are strictly special cases of the algorithms presented in this paper. To the best of our knowledge, we are the first to establish statistical consistency results for constrained spectral clustering for individual-level constraints. A subset of results presented in this paper are available online as a preliminary draft \citep{ThisPaperArXiv}. \section{Notation and preliminaries} \label{section:notation_and_preliminaries} Let $\mathcal{G} = (\mathcal{V}, \mathcal{E})$ denote a similarity graph, where $\mathcal{V} = \{v_1, v_2, \dots, v_N\}$ is the set of $N$ nodes, and $\mathcal{E} \subseteq \mathcal{V} \times \mathcal{V}$ is the set of edges. The aim of clustering is to partition the nodes into $K \geq 2$ clusters $\mathcal{C}_1, \dots, \mathcal{C}_K \subseteq \mathcal{V}$ such that each node in $\mathcal{V}$ belongs to exactly one cluster, i.e., $\mathcal{C}_i \cap \mathcal{C}_j = \phi$ if $i \neq j$ and $\cup_{k=1}^K \mathcal{C}_k = \mathcal{V}$. We further assume the availability of a \textit{representation graph}, denoted by $\mathcal{R} = (\mathcal{V}, \hat{\mathcal{E}})$, that encodes auxiliary information. Notice that $\mathcal{R}$ is defined on the same set of vertices as the similarity graph $\mathcal{G}$, but has a different set of edges $\hat{\mathcal{E}} \subseteq \mathcal{V} \times \mathcal{V}$. The discovered clusters $\mathcal{C}_1, \dots, \mathcal{C}_K$ are required to satisfy the constraint encoded by $\mathcal{R}$, as described in Section \ref{section:constraint}. $\mathbf{A} \in \{0, 1\}^{N \times N}$ and $\mathbf{R} \in \{0, 1\}^{N \times N}$ denote the adjacency matrices of graphs $\mathcal{G}$ and $\mathcal{R}$, respectively. We assume that $\mathcal{G}$ and $\mathcal{R}$ are undirected. Further, $\mathcal{G}$ has no self-loops. Thus, $\mathbf{A}$ and $\mathbf{R}$ are symmetric and $A_{ii} = 0$ for all $i \in [N]$, where $[n] \coloneqq \{1, 2, \dots, n\}$ for any integer $n$. We propose modified variants of spectral clustering in Section \ref{section:algorithms}. Before describing the proposed algorithms, we begin with a brief review of the standard spectral clustering algorithm. \subsection{Unnormalized spectral clustering} \label{section:unnormalized_spectral_clustering} Given a similarity graph $\mathcal{G}$, unnormalized spectral clustering finds clusters by approximately optimizing a quality metric known as the ratio-cut defined as \citep{Luxburg:2007:ATutorialOnSpectralClustering} \begin{equation*} \mathrm{RCut}(\mathcal{C}_1, \dots, \mathcal{C}_K) = \sum_{i = 1}^K \frac{\mathrm{Cut}(\mathcal{C}_i, \mathcal{V} \backslash \mathcal{C}_i)}{\abs{\mathcal{C}_i}}. \end{equation*} Here, $\mathcal{V} \backslash \mathcal{C}_i$ denotes the set difference between sets $\mathcal{V}$ and $\mathcal{C}_i$. For any two subsets $\mathcal{X}, \mathcal{Y} \subseteq \mathcal{V}$, $\mathrm{Cut}(\mathcal{X}, \mathcal{Y})$ is defined as $\mathrm{Cut}(\mathcal{X}, \mathcal{Y}) = \frac{1}{2} \sum_{v_i \in \mathcal{X}, v_j \in \mathcal{Y}} A_{ij}$. That is, $\mathrm{Cut}(\mathcal{X}, \mathcal{Y})$ counts the number of edges that have one endpoint in $\mathcal{X}$ and another endpoint in $\mathcal{Y}$. The Laplacian matrix $\mathbf{L}$ of the similarity graph $\mathcal{G}$ is defined as \begin{equation} \label{eq:L_def} \mathbf{L} = \mathbf{D} - \mathbf{A}. \end{equation} Here, $\mathbf{D} \in \mathbb{R}^{N \times N}$ is the degree matrix, which is a diagonal matrix such that $D_{ii} = \sum_{j = 1}^N A_{ij}$, for all $i \in [N]$. Further, define $\mathbf{H} \in \mathbb{R}^{N \times K}$ as \begin{equation} \label{eq:H_def} H_{ij} = \begin{cases} \frac{1}{\sqrt{\abs{\mathcal{C}_j}}} & \text{ if }v_i \in \mathcal{C}_j \\ 0 & \text{ otherwise.} \end{cases} \end{equation} One can easily verify that $\mathrm{RCut}(\mathcal{C}_1, \dots, \mathcal{C}_K) = \trace{\mathbf{H}^\intercal \mathbf{L} \mathbf{H}}$, where $\mathbf{H}$ corresponds to clusters $\mathcal{C}_1, \dots, \mathcal{C}_K$. Thus, to find good clusters, one can solve: \begin{equation*} \min_{\mathbf{H} \in \mathbb{R}^{N \times K}} \,\,\,\, \trace{\mathbf{H}^\intercal \mathbf{L} \mathbf{H}} \,\,\,\, \text{s.t.} \,\,\,\, \mathbf{H} \text{ is of the form \eqref{eq:H_def}.} \end{equation*} It is computationally hard to solve this optimization problem due to the combinatorial nature of the constraint \citep{WagnerWagner:1993:BetweenMinCutAndGraphBisection}. Unnormalized spectral clustering instead solves the following relaxed optimization problem: \begin{equation} \label{eq:opt_problem_normal} \min_{\mathbf{H} \in \mathbb{R}^{N \times K}} \,\,\,\, \trace{\mathbf{H}^\intercal \mathbf{L} \mathbf{H}} \,\,\,\, \text{s.t.} \,\,\,\, \mathbf{H}^\intercal \mathbf{H} = \mathbf{I}. \end{equation} The above relaxation is often referred to as the spectral relaxation. By Rayleigh-Ritz theorem \citep[Section 5.2.2]{Lutkepohl:1996:HandbookOfMatrices}, the optimal matrix $\mathbf{H}^*$ is such that it has $\mathbf{u}_1, \mathbf{u}_2, \dots, \mathbf{u}_K \in \mathbb{R}^N$ as its columns, where $\mathbf{u}_i$ is the eigenvector corresponding to the $i^{th}$ smallest eigenvalue of $\mathbf{L}$ for all $i \in [K]$. The algorithm clusters the rows of $\mathbf{H}^*$ into $K$ clusters using $k$-means clustering \citep{Lloyd:1982:LeastSquaresQuantisationInPCM} to return $\hat{\mathcal{C}}_1, \dots, \hat{\mathcal{C}}_K$. Algorithm \ref{alg:unnormalized_spectral_clustering} summarizes this procedure. The Laplacian given in \eqref{eq:L_def} is more specifically known as unnormalized Laplacian. The next subsection describes a variant of spectral clustering, known as normalized spectral clustering \citep{ShiMalik:2000:NormalizedCutsAndImageSegmentation, NgEtAl:2001:OnSpectralClustering}, that uses the normalized Laplacian. Unless stated otherwise, we will use spectral clustering (without any qualification) to refer to unnormalized spectral clustering. \begin{algorithm}[t] \begin{algorithmic}[1] \State \textbf{Input:} Adjacency matrix $\mathbf{A}$, number of clusters $K \geq 2$ \State Compute the Laplacian matrix $\mathbf{L} = \mathbf{D} - \mathbf{A}$. \State Compute the first $K$ eigenvectors $\mathbf{u}_1, \dots, \mathbf{u}_K$ of $\mathbf{L}$. Let $\mathbf{H}^* \in \mathbb{R}^{N \times K}$ be a matrix that has $\mathbf{u}_1, \dots, \mathbf{u}_K$ as its columns. \State Let $\mathbf{h}^*_i$ denote the $i^{th}$ row of $\mathbf{H}^*$. Cluster $\mathbf{h}^*_1, \dots, \mathbf{h}^*_N$ into $K$ clusters using $k$-means clustering. \State \textbf{Output:} Clusters $\hat{\mathcal{C}}_1, \dots, \hat{\mathcal{C}}_K$, \textrm{s.t.} $\hat{\mathcal{C}}_i = \{v_j \in \mathcal{V} : \mathbf{h}^*_j \text{ was assigned to the }i^{th} \text{ cluster}\}$. \end{algorithmic} \caption{Unnormalized spectral clustering} \label{alg:unnormalized_spectral_clustering} \end{algorithm} \subsection{Normalized spectral clustering} \label{section:normalized_spectral_clustering} The ratio-cut objective divides $\mathrm{Cut}(\mathcal{C}_i, \mathcal{V} \backslash \mathcal{C}_i)$ by the number of nodes in $\mathcal{C}_i$ to balance the size of the clusters. The volume of a cluster $\mathcal{C} \subseteq \mathcal{V}$, defined as $\mathrm{Vol}(\mathcal{C}) = \sum_{v_i \in \mathcal{C}} D_{ii}$, is another popular notion of its size. The normalized cut or $\mathrm{NCut}$ objective divides $\mathrm{Cut}(\mathcal{C}_i, \mathcal{V} \backslash \mathcal{C}_i)$ by $\mathrm{Vol}(\mathcal{C}_i)$, and is defined as, \begin{equation*} \mathrm{NCut}(\mathcal{C}_1, \dots, \mathcal{C}_K) = \sum_{i = 1}^K \frac{\mathrm{Cut}(\mathcal{C}_i, \mathcal{V} \backslash \mathcal{C}_i)}{\mathrm{Vol}(\mathcal{C}_i)}. \end{equation*} As before, one can show that $\mathrm{NCut}(\mathcal{C}_1, \dots, \mathcal{C}_K) = \trace{\mathbf{T}^\intercal \mathbf{L} \mathbf{T}}$ \citep{Luxburg:2007:ATutorialOnSpectralClustering}, where $\mathbf{T} \in \mathbb{R}^{N \times K}$ is specified below. \begin{equation} \label{eq:T_def} T_{ij} = \begin{cases} \frac{1}{\sqrt{\mathrm{Vol}(\mathcal{C}_j)}} & \text{ if }v_i \in \mathcal{C}_j \\ 0 & \text{ otherwise.} \end{cases} \end{equation} Note that $\mathbf{T}^\intercal \mathbf{D} \mathbf{T} = \mathbf{I}$. Thus, the optimization problem for minimizing the NCut objective is \begin{equation} \label{eq:normalized_ideal_opt_problem} \min_{\mathbf{T} \in \mathbb{R}^{N \times K}} \,\,\,\, \trace{\mathbf{T}^\intercal \mathbf{L} \mathbf{T}} \,\,\,\, \text{s.t.} \,\,\,\, \mathbf{T}^\intercal \mathbf{D} \mathbf{T} = \mathbf{I} \text{ and } \mathbf{T} \text{ is of the form \eqref{eq:T_def}.} \end{equation} As before, this optimization problem is hard to solve, and normalized spectral clustering solves a relaxed variant of this problem. Let $\mathbf{H} = \mathbf{D}^{1/2} \mathbf{T}$ and define the normalized graph Laplacian as $\mathbf{L}_{\mathrm{norm}} = \mathbf{I} - \mathbf{D}^{-1/2} \mathbf{A} \mathbf{D}^{-1/2}$. Normalized spectral clustering solves the following relaxed problem: \begin{equation} \label{eq:opt_problem_normal_normalized} \min_{\mathbf{H} \in \mathbb{R}^{N \times K}} \,\,\,\, \trace{\mathbf{H}^\intercal \mathbf{L}_{\mathrm{norm}} \mathbf{H}} \,\,\,\, \text{s.t.} \,\,\,\, \mathbf{H}^\intercal \mathbf{H} = \mathbf{I}. \end{equation} Note that $\mathbf{H}^\intercal \mathbf{H} = \mathbf{I} \Leftrightarrow \mathbf{T}^\intercal \mathbf{D} \mathbf{T} = \mathbf{I}$. This is again the standard form of the trace minimization problem that can be solved using the Rayleigh-Ritz theorem. Algorithm \ref{alg:normalized_spectral_clustering} summarizes the normalized spectral clustering algorithm. \begin{algorithm}[t] \begin{algorithmic}[1] \State \textbf{Input:} Adjacency matrix $\mathbf{A}$, number of clusters $K \geq 2$ \State Compute the normalized Laplacian matrix $\mathbf{L}_{\mathrm{norm}} = \mathbf{I} - \mathbf{D}^{-1/2}\mathbf{A} \mathbf{D}^{-1/2}$. \State Compute the first $K$ eigenvectors $\mathbf{u}_1, \dots, \mathbf{u}_K$ of $\mathbf{L}_{\mathrm{norm}}$. Let $\mathbf{H}^* \in \mathbb{R}^{N \times K}$ be a matrix that has $\mathbf{u}_1, \dots, \mathbf{u}_K$ as its columns. \State Let $\mathbf{h}^*_i$ denote the $i^{th}$ row of $\mathbf{H}^*$. Compute $\tilde{\mathbf{h}}^*_i = \frac{\mathbf{h}^*_i}{\norm{\mathbf{h}^*_i}[2]}$ for all $i = 1, 2, \dots, N$. \State Cluster $\tilde{\mathbf{h}}^*_1, \dots, \tilde{\mathbf{h}}^*_N$ into $K$ clusters using $k$-means clustering. \State \textbf{Output:} Clusters $\hat{\mathcal{C}}_1, \dots, \hat{\mathcal{C}}_K$, \textrm{s.t.} $\hat{\mathcal{C}}_i = \{v_j \in \mathcal{V} : \tilde{\mathbf{h}}^*_j \text{ was assigned to the }i^{th} \text{ cluster}\}$. \end{algorithmic} \caption{Normalized spectral clustering} \label{alg:normalized_spectral_clustering} \end{algorithm} \section{Representation constraint and representation-aware spectral clustering} \label{section:algorithms} \subsection{Representation constraint} \label{section:constraint} Here, an individual-level constraint for clustering the graph $\mathcal{G} = (\mathcal{V}, \mathcal{E})$ is specified using a representation graph $\mathcal{R} = (\mathcal{V}, \hat{\mathcal{E}})$. One intuitive explanation for $\mathcal{R}$ is that nodes connected in this graph represent each other in some form (say based on opinions if nodes correspond to people). Let $\mathcal{N}_{\mathcal{R}}(i) = \{v_j \; : \; R_{ij} = 1\}$ denote the set of neighbors of node $v_i$ in $\mathcal{R}$. The size of $\mathcal{N}_{\mathcal{R}}(i) \cap \mathcal{C}_k$ denotes node $v_i$'s representation in cluster $\mathcal{C}_k$. The goal of this constraint is to ensure that each node has an adequate amount of representation in all clusters. \begin{definition} \label{def:balance} The balance of given clusters $\mathcal{C}_1, \dots, \mathcal{C}_K$ with respect to a node $v_i \in \mathcal{V}$ is defined as \begin{equation} \label{eq:balance} \rho_i = \min_{k, \ell \in [K]} \;\; \frac{\abs{\mathcal{C}_k \cap \mathcal{N}_{\mathcal{R}}(i)}}{\abs{\mathcal{C}_\ell \cap \mathcal{N}_{\mathcal{R}}(i)}}. \end{equation} \end{definition} It is easy to see that $0 \leq \rho_i \leq 1$ and higher values of $\rho_i$ indicate that node $v_i$ has an adequate representation in all clusters. Thus, one objective could be to find clusters $\mathcal{C}_1, \dots, \mathcal{C}_K$ that solve the following constrained optimization problem. \begin{equation} \label{eq:general_optimization_problem} \min_{\mathcal{C}_1, \dots, \mathcal{C}_K} \;\; f(\mathcal{C}_1, \dots, \mathcal{C}_K) \;\;\;\; \text{s.t.} \;\;\;\; \rho_i \geq \alpha, \; \forall \; i \in [N]. \end{equation} Here, $f(\cdot)$ is a function that is inversely proportional to the quality of clusters (such as $\mathrm{RCut}$ or $\mathrm{NCut}$), and $\alpha \in [0, 1]$ is a user specified threshold. However, it not clear as to how this approach can be combined with spectral clustering to develop a consistent algorithm. Therefore, we take a slightly different approach, as described below. First, note that $\rho_i \leq \min_{k, \ell \in [K]} \; \frac{\abs{\mathcal{C}_k}}{\abs{\mathcal{C}_\ell}}$ for all $i \in [N]$. Therefore, the balance $\rho_i$ is maximized when the representatives $\mathcal{N}_{\mathcal{R}}(i)$ of node $v_i$ are split across clusters $\mathcal{C}_1, \dots, \mathcal{C}_K$ in proportion of the sizes of these clusters. Our constraint, formally defined below, requires this proportionality condition to be satisfied for each node $v_i \in \mathcal{V}$. \begin{definition}[Representation constraint] \label{def:representation_constraint} Given a representation graph $\mathcal{R}$, clusters $\mathcal{C}_1, \dots, \mathcal{C}_K$ in $\mathcal{G}$ satisfy the representation constraint if $\abs{\mathcal{C}_k \cap \mathcal{N}_{\mathcal{R}}(i)} \propto \abs{\mathcal{C}_k}$, for all $i \in [N]$ and $k \in [K]$, or equivalently, \begin{equation} \label{eq:representation_constraint} \frac{\abs{\mathcal{C}_k \cap \mathcal{N}_{\mathcal{R}}(i)}}{\abs{\mathcal{C}_k}} = \frac{\abs{\mathcal{N}_{\mathcal{R}}(i)}}{N}, \;\; \forall k \in [K], \; \forall i \in [N]. \end{equation} \end{definition} In other words, the representation constraint requires the representatives of any given node $v_i$ to have a proportional membership in all clusters. For example, if a node $v_i$ is connected to $30\%$ of all the nodes in $\mathcal{R}$, then the clusters discovered in $\mathcal{G}$ must be such that this node has $30\%$ representation in all clusters. We wish to re-emphasize that the representation constraint applies at the level of individual nodes unlike the constraint in \citep{ChierichettiEtAl:2017:FairClusteringThroughFairlets} that applies at the level of protected groups. In Sections \ref{section:unnormalized_repsc} and \ref{section:normalized_repsc}, we show that \eqref{eq:representation_constraint} can be integrated with the optimization problem solved by spectral clustering. Appendix \ref{appendix:constraint} presents additional remarks about the properties of this constraint, in particular, its relation to the statistical-level constraint for categorical attributes \citep{ChierichettiEtAl:2017:FairClusteringThroughFairlets, KleindessnerEtAl:2019:GuaranteesForSpectralClusteringWithFairnessConstraints}. It shows that \eqref{eq:representation_constraint} recovers the statistical-level constraint for a particular configuration of the representation graph, and generalizes it to individual-level constraint for other configurations. Next, we turn to the feasibility of the constraint. \paragraph*{Feasibility} The optimization problem in \eqref{eq:general_optimization_problem} can always be solved for a small enough value of $\alpha$ (with the convention that $0/0 = 1$). On the other hand, the constraint in Definition \ref{def:representation_constraint} may not always be feasible. For example, if a node has only two representatives, i.e., $\abs{\mathcal{N}_{\mathcal{R}}(i)} = 2$, and there are $K > 2$ clusters, then \ref{eq:representation_constraint} can never be satisfied as there will always be at least one cluster $\mathcal{C}_k$ for which $\abs{\mathcal{C}_k \cap \mathcal{N}_{\mathcal{R}}(i)} = 0$. We argue in the subsequent subsections that spectral relaxation ensures the approximate satisfiability of the constraint when it is added to spectral clustering's optimization problem. We also describe a necessary assumption that is needed to ensure feasibility in practice and two additional assumptions that are required for our theoretical analysis. Thus, the way we use the proposed constraint makes it widely applicable, even though it is very strong. The general form of the constraint in \eqref{eq:general_optimization_problem} may be of independent interest in the context of other clustering algorithms, but we do not pursue this direction here. \subsection{Unnormalized representation-aware spectral clustering (\textsc{URepSC})} \label{section:unnormalized_repsc} Recall from Section \ref{section:unnormalized_spectral_clustering} that unnormalized spectral clustering approximately minimizes the ratio-cut objective by relaxing an NP-hard optimization problem to solve \eqref{eq:opt_problem_normal}. The lemma below specifies a sufficient condition that implies the constraint in \eqref{eq:representation_constraint}. \begin{lemma} \label{lemma:constraint_matrix_unnorm} Let $\mathbf{H} \in \mathbb{R}^{N \times K}$ have the form specified in \eqref{eq:H_def}. The condition \begin{equation} \label{eq:matrix_fairness_criteria} \mathbf{R} \left( \mathbf{I} - \frac{1}{N}\bm{1}\bmone^\intercal \right) \mathbf{H} = \mathbf{0} \end{equation} implies that the corresponding clusters $\mathcal{C}_1, \dots, \mathcal{C}_K$ satisfy the constraint in \eqref{eq:representation_constraint}. Here, $\mathbf{I}$ is the $N \times N$ identity matrix and $\bm{1}$ is a $N$-dimensional all-ones vector. \end{lemma} Ideally, we would like to solve the following optimization problem to get the clusters that satisfy the representation constraint, \begin{equation} \label{eq:optimization_problem_ideal} \min_{\mathbf{H}} \;\;\;\; \trace{\mathbf{H}^\intercal \mathbf{L} \mathbf{H}} \;\;\;\; \text{s.t.} \;\;\;\;\mathbf{H} \text{ is of the form \eqref{eq:H_def}} ; \;\;\;\; \mathbf{R} \left( \mathbf{I} - \frac{1}{N}\bm{1}\bmone^\intercal \right) \mathbf{H} = \mathbf{0}, \end{equation} where $\mathbf{L}$ is the unnormalized graph Laplacian defined in \eqref{eq:L_def}. However, as noted in Section \ref{section:unnormalized_spectral_clustering}, the first constraint on $\mathbf{H}$ makes this problem NP-hard. Thus, we solve the following relaxed problem, \begin{equation} \label{eq:opt_problem_with_eq_constraint} \min_{\mathbf{H}} \;\;\;\; \trace{\mathbf{H}^\intercal \mathbf{L} \mathbf{H}} \;\;\;\; \text{s.t.} \;\;\;\; \mathbf{H}^\intercal \mathbf{H} = \mathbf{I}; \;\;\;\; \mathbf{R} \left( \mathbf{I} - \frac{1}{N}\bm{1}\bmone^\intercal \right)\mathbf{H} = \mathbf{0}. \end{equation} Clearly, the columns of any feasible $\mathbf{H}$ must belong to the null space of $\mathbf{R}(\mathbf{I} - \bm{1}\bmone^\intercal / N)$. Thus, any feasible $\mathbf{H}$ can be expressed as $\mathbf{H} = \mathbf{Y} \mathbf{Z}$ for some matrix $\mathbf{Z} \in \mathbb{R}^{N - r \times K}$, where $\mathbf{Y} \in \mathbb{R}^{N \times N - r}$ is an orthonormal matrix containing the basis vectors of the null space of $\mathbf{R}(\mathbf{I} - \bm{1}\bmone^\intercal / N)$ as its columns. Here, $r$ is the rank of $\mathbf{R}(\mathbf{I} - \bm{1}\bmone^\intercal / N)$. Because $\mathbf{Y}^\intercal \mathbf{Y} = \mathbf{I}$, $\mathbf{H}^\intercal \mathbf{H} = \mathbf{Z}^\intercal \mathbf{Y}^\intercal \mathbf{Y} \mathbf{Z} = \mathbf{Z}^\intercal \mathbf{Z}$. Thus, $\mathbf{H}^\intercal \mathbf{H} = \mathbf{I} \Leftrightarrow \mathbf{Z}^\intercal \mathbf{Z} = \mathbf{I}$. The following optimization problem is equivalent to \eqref{eq:opt_problem_with_eq_constraint} by setting $\mathbf{H} = \mathbf{Y} \mathbf{Z}$. \begin{equation} \label{eq:optimization_problem} \min_{\mathbf{Z}} \;\;\;\; \trace{\mathbf{Z}^\intercal \mathbf{Y}^\intercal \mathbf{L} \mathbf{Y} \mathbf{Z}} \;\;\;\; \text{s.t.} \;\;\;\; \mathbf{Z}^\intercal \mathbf{Z} = \mathbf{I}. \end{equation} As in standard spectral clustering, the solution to \eqref{eq:optimization_problem} is given by the $K$ leading eigenvectors of $\mathbf{Y}^\intercal \mathbf{L} \mathbf{Y}$. Of course, for $K$ eigenvectors to exist, $N - r$ must be at least $K$, as $\mathbf{Y}^\intercal \mathbf{L} \mathbf{Y}$ has dimensions $N - r \times N - r$. The clusters can then be recovered by using $k$-means clustering to cluster the rows of $\mathbf{H} = \mathbf{Y} \mathbf{Z}$, as in Algorithm \ref{alg:unnormalized_spectral_clustering}. Algorithm \ref{alg:urepsc} summarizes this procedure. We refer to this algorithm as unnormalized representation-aware spectral clustering (\textsc{URepSC}). \begin{algorithm}[t] \begin{algorithmic}[1] \State \textbf{Input: }Adjacency matrix $\mathbf{A}$, representation graph $\mathbf{R}$, number of clusters $K \geq 2$ \State Compute $\mathbf{Y}$ containing orthonormal basis vectors of $\nullspace{\mathbf{R}(\mathbf{I} - \frac{1}{N}\bm{1}\bmone^\intercal)}$ \State Compute Laplacian $\mathbf{L} = \mathbf{D} - \mathbf{A}$ \State Compute leading $K$ eigenvectors of $\mathbf{Y}^\intercal \mathbf{L} \mathbf{Y}$. Let $\mathbf{Z}$ contain these vectors as its columns. \State Apply $k$-means clustering to rows of $\mathbf{H} = \mathbf{Y} \mathbf{Z}$ to get clusters $\hat{\mathcal{C}}_1, \hat{\mathcal{C}}_2, \dots, \hat{\mathcal{C}}_K$ \State \textbf{Return:} Clusters $\hat{\mathcal{C}}_1, \hat{\mathcal{C}}_2, \dots, \hat{\mathcal{C}}_K$ \end{algorithmic} \caption{\textsc{URepSC}} \label{alg:urepsc} \end{algorithm} \subsection{Normalized representation-aware spectral clustering (\textsc{NRepSC})} \label{section:normalized_repsc} We use a similar strategy as the previous section to develop the normalized variant of \textsc{RepSC}. Recall from Section \ref{section:normalized_spectral_clustering} that normalized spectral clustering approximately minimizes the $\mathrm{NCut}$ objective. The lemma below is a counterpart of Lemma \ref{lemma:constraint_matrix_unnorm}. It formulates a sufficient condition that implies our constraint in \eqref{eq:representation_constraint}, but this time in terms of the matrix $\mathbf{T}$ defined in \eqref{eq:T_def}. \begin{lemma} \label{lemma:constraint_matrix_norm} Let $\mathbf{T} \in \mathbb{R}^{N \times K}$ have the form specified in \eqref{eq:T_def}. The condition \begin{equation} \label{eq:normalized_matrix_fairness_criteria} \mathbf{R} \left( \mathbf{I} - \frac{1}{N}\bm{1}\bmone^\intercal \right) \mathbf{T} = \mathbf{0} \end{equation} implies that the corresponding clusters $\mathcal{C}_1, \dots, \mathcal{C}_K$ satisfy \eqref{eq:representation_constraint}. Here, $\mathbf{I}$ is the $N \times N$ identity matrix and $\bm{1}$ is a $N$ dimensional all-ones vector. \end{lemma} For \textsc{NRepSC}, we assume that the similarity graph $\mathcal{G}$ is connected so that the diagonal entries of $\mathbf{D}$ are strictly positive. We proceed as before to incorporate constraint \eqref{eq:normalized_matrix_fairness_criteria} in optimization problem \eqref{eq:normalized_ideal_opt_problem}. After applying the spectral relaxation, we get \begin{equation} \label{eq:optimization_problem_normalized} \min_{\mathbf{T}} \;\;\;\; \trace{\mathbf{T}^\intercal \mathbf{L} \mathbf{T}} \;\;\;\; \text{s.t.} \;\;\;\; \mathbf{T}^\intercal \mathbf{D} \mathbf{T} = \mathbf{I}; \;\;\;\; \mathbf{R}(\mathbf{I} - \bm{1} \bm{1}^\intercal / N) \mathbf{T} = \mathbf{0}. \end{equation} As before, $\mathbf{T} = \mathbf{Y} \mathbf{Z}$ for some $\mathbf{Z} \in \mathbb{R}^{N - r \times K}$, where recall that columns of $\mathbf{Y}$ contain orthonormal basis for $\nullspace{\mathbf{R}(\mathbf{I} - \bm{1} \bm{1}^\intercal / N)}$. This reparameterization yields \begin{equation*} \min_{\mathbf{Z}} \;\;\;\; \trace{\mathbf{Z}^\intercal \mathbf{Y}^\intercal \mathbf{L} \mathbf{Y} \mathbf{Z}} \;\;\;\; \text{s.t.} \;\;\;\; \mathbf{Z}^\intercal \mathbf{Y}^\intercal \mathbf{D} \mathbf{Y} \mathbf{Z} = \mathbf{I}. \end{equation*} Define $\mathbf{Q} \in \mathbb{R}^{N - r \times N - r}$ such that $\mathbf{Q}^2 = \mathbf{Y}^\intercal \mathbf{D} \mathbf{Y}$. Note that $\mathbf{Q}$ exists as the entries of $\mathbf{D}$ are non-negative Let $\mathbf{V} = \mathbf{Q} \mathbf{Z}$. Then, $\mathbf{Z} = \mathbf{Q}^{-1} \mathbf{V}$ and $\mathbf{Z}^\intercal \mathbf{Q}^2 \mathbf{Z} = \mathbf{V}^\intercal \mathbf{V}$ as $\mathbf{Q}$ is symmetric. Reparameterizing again, we get: \begin{equation*} \min_{\mathbf{V}} \;\;\;\; \trace{\mathbf{V}^\intercal \mathbf{Q}^{-1} \mathbf{Y}^\intercal \mathbf{L} \mathbf{Y} \mathbf{Q}^{-1} \mathbf{V}} \;\;\;\; \text{s.t.} \;\;\;\; \mathbf{V}^\intercal \mathbf{V} = \mathbf{I}. \end{equation*} This again is the standard form of the trace minimization problem and the optimal solution is given by the leading $K$ eigenvectors of $\mathbf{Q}^{-1} \mathbf{Y}^\intercal \mathbf{L} \mathbf{Y} \mathbf{Q}^{-1}$. Algorithm \ref{alg:nrepsc} summarizes the normalized representation-aware spectral clustering algorithm, which we denote by \textsc{NRepSC}. Note that the algorithm assumes that $\mathbf{Q}$ is invertible, which requires the absence of isolated nodes in the similarity graph $\mathcal{G}$. \begin{algorithm}[t] \begin{algorithmic}[1] \State \textbf{Input: }Adjacency matrix $\mathbf{A}$, representation graph $\mathbf{R}$, number of clusters $K \geq 2$ \State Compute $\mathbf{Y}$ containing orthonormal basis vectors of $\nullspace{\mathbf{R}(\mathbf{I} - \frac{1}{N}\bm{1}\bmone^\intercal)}$ \State Compute Laplacian $\mathbf{L} = \mathbf{D} - \mathbf{A}$ \State Compute $\mathbf{Q} = \sqrt{\mathbf{Y}^\intercal \mathbf{D} \mathbf{Y}}$ using the matrix square root \State Compute leading $K$ eigenvectors of $\mathbf{Q}^{-1} \mathbf{Y}^\intercal \mathbf{L} \mathbf{Y} \mathbf{Q}^{-1}$. Set them as columns of $\mathbf{V} \in \mathbb{R}^{N-r \times K}$ \State Apply $k$-means clustering to the rows of $\mathbf{T} = \mathbf{Y} \mathbf{Q}^{-1} \mathbf{V}$ to get clusters $\hat{\mathcal{C}}_1, \hat{\mathcal{C}}_2, \dots, \hat{\mathcal{C}}_K$ \State \textbf{Return:} Clusters $\hat{\mathcal{C}}_1, \hat{\mathcal{C}}_2, \dots, \hat{\mathcal{C}}_K$ \end{algorithmic} \caption{\textsc{NRepSC}} \label{alg:nrepsc} \end{algorithm} \subsection{Comments on the proposed algorithms} \label{section:comments_on_the_proposed_algorithms} Before proceeding with the theoretical analysis in Section \ref{section:analysis}, we first make two remarks about the proposed algorithms. \paragraph*{Spectral relaxation} Note that the constraints $\mathbf{R}(\mathbf{I} - \bm{1}\bmone^\intercal / N) \mathbf{H} = \mathbf{0}$ and $\mathbf{R}(\mathbf{I} - \bm{1}\bmone^\intercal / N) \mathbf{T} = \mathbf{0}$ imply the satisfaction of our representation constraint only when $\mathbf{H}$ and $\mathbf{T}$ have the form given in \eqref{eq:H_def} and \eqref{eq:T_def}, respectively. Thus, a feasible solution to the relaxed optimization problem in~\eqref{eq:opt_problem_with_eq_constraint} or \eqref{eq:optimization_problem_normalized} may not necessarily result in \textit{representation-aware} clusters. In fact, even in the unconstrained case, there are no general guarantees that bound the difference between the optimal solution of~\eqref{eq:opt_problem_normal} or \eqref{eq:opt_problem_normal_normalized} and the respective optimal solutions of the original NP-hard ratio-cut/normalized-cut problems \citep{KleindessnerEtAl:2019:GuaranteesForSpectralClusteringWithFairnessConstraints}. Thus, the representation-aware nature of the clusters discovered by solving \eqref{eq:optimization_problem} or \eqref{eq:optimization_problem_normalized} cannot be guaranteed in the general case. Nonetheless, we show in Section~\ref{section:analysis} that the discovered clusters indeed satisfy the representation constraint under certain additional assumptions. \paragraph*{Computational complexity} Algorithms \ref{alg:urepsc} and \ref{alg:nrepsc} have a time complexity of $O(N^3)$ and space complexity of $O(N^2)$. Finding the null space of $\mathbf{R}(\mathbf{I} - \bm{1} \bm{1}^\intercal / N)$ to calculate $\mathbf{Y}$ and computing the eigenvectors of appropriate matrices are the computationally dominant steps in both cases. This matches the worst-case complexity of the standard spectral clustering algorithm. For small $K$, several approximations can reduce this complexity, but most such techniques require $K = 2$ \citep{YuShi:2004:SegmentationGivenPartialGroupingConstraints,XuEtAl:2009:FastNormalizedCutWithLinearConstraints}. \section{Analysis} \label{section:analysis} In this section, we show that Algorithms~\ref{alg:urepsc} and \ref{alg:nrepsc} recover the ground truth clusters with a high probability under certain assumptions on the representation graph. As we will see in Section \ref{section:consistency_results}, the ground truth clusters satisfy \eqref{eq:representation_constraint} by construction for similarity graphs $\mathcal{G}$ sampled from a modified variant of the Stochastic Block Model (SBM) \citep{HollandEtAl:1983:StochasticBlockmodelsFirstSteps}, described in Section \ref{section:rsbm}. Section \ref{section:consistency_results} presents our main results that establish a high probability upper bound on the number of mistakes made by the proposed algorithms. Corollaries \ref{corollary:weak_consistency_urepsc} and \ref{corollary:weak_consistency_nrepsc} then establish their weak-consistency. \subsection{$\mathcal{R}$-SBM} \label{section:rsbm} The well known Stochastic Block Model (SBM) \citep{HollandEtAl:1983:StochasticBlockmodelsFirstSteps} allows one to sample random graphs with known clusters. It takes a function $\pi: \mathcal{V} \rightarrow [K]$ as input. This function assigns each node $v_i \in \mathcal{V}$ to one of the $K$ clusters. Then, independently for all node pairs $(v_i, v_j)$ such that $i > j$, $\mathrm{P}(A_{ij} = 1) = B_{\pi(v_i) \pi(v_j)},$ where $\mathbf{B} \in [0, 1]^{K \times K}$ is a symmetric matrix. The $(k, \ell)^{th}$ entry of $\mathbf{B}$ specifies the probability of a connection between two nodes that belong to clusters $\mathcal{C}_k$ and $\mathcal{C}_\ell$, respectively. A commonly used variant of SBM assumes $B_{kk} = \alpha$ and $B_{k\ell} = \beta$ for all $k, \ell \in [K]$ such that $k \neq \ell$. We define a variant of SBM with respect to a representation graph $\mathcal{R}$ below and refer to it as Representation-Aware SBM or $\mathcal{R}$-SBM. \begin{definition}[$\mathcal{R}$-SBM] \label{def:conditioned_sbm} A $\mathcal{R}$-SBM is defined by the tuple $(\pi, \mathcal{R}, p, q, r, s)$, where $\pi: \mathcal{V} \rightarrow [K]$ maps nodes in $\mathcal{V}$ to clusters, $\mathcal{R}$ is a representation graph, and $1 \geq p \geq q \geq r \geq s \geq 0$ are probabilities used for sampling edges. Under this model, for all $i > j$, \begin{equation} \label{eq:sbm_specification} \mathrm{P}(A_{ij} = 1) = \begin{cases} p & \text{if } \pi(v_i) = \pi(v_j) \text{ and } R_{ij} = 1, \\ q & \text{if } \pi(v_i) \neq \pi(v_j) \text{ and } R_{ij} = 1, \\ r & \text{if } \pi(v_i) = \pi(v_j) \text{ and } R_{ij} = 0, \\ s & \text{if } \pi(v_i) \neq \pi(v_j) \text{ and } R_{ij} = 0. \end{cases} \end{equation} \end{definition} The similarity graphs sampled from a $\mathcal{R}$-SBM have two interesting properties. First, everything else being equal, nodes have a higher tendency to connect with other nodes in the same cluster as $p \geq q$ and $r \geq s$. Thus, $\mathcal{R}$-SBM plants the clusters specified by $\pi$ in the sampled graph $\mathcal{G}$. Second, and more importantly, $\mathcal{R}$-SBM also plants the properties of the given representation graph $\mathcal{R}$ in the sampled graphs $\mathcal{G}$. To see this, note that nodes that are connected in $\mathcal{R}$ have a higher probability of being connected in $\mathcal{G}$ as well ($p \geq r$ and $q \geq s$). Recall that our algorithms must discover clusters in $\mathcal{G}$ in which the connected nodes in $\mathcal{R}$ are proportionally distributed. However, $\mathcal{R}$-SBM makes two nodes connected in $\mathcal{R}$ more likely to connect in $\mathcal{G}$, even if they do not belong to the same cluster ($q \geq r$). In this sense, graphs sampled from $\mathcal{R}$-SBM are ``hard'' instances from the perspective of our algorithms. When $\mathcal{R}$ itself has a community structure, there are two natural ways to cluster the nodes: \textbf{(i)} based on the ground-truth clusters $\mathcal{C}_1$, $\mathcal{C}_2$, \dots, $\mathcal{C}_K$ specified by $\pi$; and \textbf{(ii)} based on the communities in $\mathcal{R}$. The clusters based on communities in $\mathcal{R}$ are likely to not satisfy the representation constraint in Definition \ref{def:representation_constraint} as tightly connected nodes in $\mathcal{R}$ will be assigned to the same cluster in this case rather than being distributed across clusters. We show in Section \ref{section:consistency_results} that, under certain assumptions on $\mathcal{R}$, the ground-truth clusters can be constructed so that they satisfy the representation constraint \eqref{eq:representation_constraint}. Assuming that the ground-truth clusters indeed satisfy \eqref{eq:representation_constraint}, the goal is to show that Algorithms \ref{alg:urepsc} and \ref{alg:nrepsc} recover the ground-truth clusters with high probability rather than returning any other natural but ``representation-unaware'' clusters. \subsection{Consistency results} \label{section:consistency_results} As noted in Section \ref{section:constraint}, some representation graphs lead to constraints that cannot be satisfied. For our theoretical analysis, we restrict our focus to cases where the constraint in \eqref{eq:representation_constraint} is feasible. Towards this end, an additional assumption on $\mathcal{R}$ is required. \begin{assumption} \label{assumption:R_is_d_regular} $\mathcal{R}$ is a $d$-regular graph for some $K \leq d \leq N$. Moreover, $R_{ii} = 1$ for all $i \in [N]$, and each node in $\mathcal{R}$ is connected to $d / K$ nodes from cluster $\mathcal{C}_i$, for all $i \in [K]$ (including the self-loop). \end{assumption} Assumption~\ref{assumption:R_is_d_regular} ensures the existence of a $\pi$ for which the corresponding ground-truth clusters satisfy the representation constraint in \eqref{eq:representation_constraint}. Namely, assuming equal-sized clusters, let $\pi(v_i) = k$, if $(k - 1) \frac{N}{K} \leq i \leq k \frac{N}{K}$ for all $i \in [N]$, and $k \in [K]$. It can be easily verified that the resulting clusters $\mathcal{C}_k = \{v_i : \pi(v_i) = k \}$, $k \in [K]$ satisfy \eqref{eq:representation_constraint}. Before presenting our main results, we need to set up additional notation. Let $\bm{\Theta} \in \{0, 1\}^{N \times K}$ indicate the ground-truth cluster memberships, i.e., $\Theta_{ij} = 1 \Leftrightarrow v_i \in \mathcal{C}_j$. Similarly, $\hat{\bm{\Theta}} \in \{0, 1\}^{N \times K}$ indicates the clusters returned by the algorithm, i.e., $\hat{\Theta}_{ij} = 1 \Leftrightarrow v_i \in \hat{\mathcal{C}}_j$. Further, let $\mathcal{J}$ be the set of all $K \times K$ permutation matrices. The fraction of misclustered nodes \citep{LeiEtAl:2015:ConsistencyOfSpectralClusteringInSBM} is defined as \begin{equation*} M(\bm{\Theta}, \hat{\bm{\Theta}}) = \min_{\mathbf{J} \in \mathcal{J}} \frac{1}{N} \norm{\bm{\Theta} - \hat{\bm{\Theta}} \mathbf{J}}[0]. \end{equation*} As the ground truth clusters $\mathcal{C}_1, \dots, \mathcal{C}_K$ satisfy \eqref{eq:representation_constraint} by construction, a low $M(\bm{\Theta}, \hat{\bm{\Theta}})$ indicates that the clusters returned by the algorithm approximately satisfy \eqref{eq:representation_constraint}. Theorems \ref{theorem:consistency_result_unnormalized} and \ref{theorem:consistency_result_normalized} also use the eigenvalues of the Laplacian matrix in the expected case. We use $\mathcal{L}$ to denote this matrix, and define it as $\mathcal{L} = \mathcal{D} - \mathcal{A}$, where $\mathcal{A} = \mathrm{E}[\mathbf{A}]$ is the expected adjacency matrix of a graph sampled from $\mathcal{R}$-SBM and $\mathcal{D} \in \mathbb{R}^{N \times N}$ is a diagonal matrix such that $\mathcal{D}_{ii} = \sum_{j = 1}^N \mathcal{A}_{ij}$, for all $i \in [N]$. The next two results establish high-probability upper bounds on the fraction of misclustered nodes for \textsc{URepSC} and \textsc{NRepSC} for similarity graphs $\mathcal{G}$ sampled from $\mathcal{R}$-SBM. \begin{theorem}[Error bound for \textsc{URepSC}] \label{theorem:consistency_result_unnormalized} Let $\rank{\mathbf{R}} \leq N - K$ and assume that all clusters have equal sizes. Let $\mu_1 \leq \mu_2 \leq \dots \leq \mu_{N - r}$ denote the eigenvalues of $\mathbf{Y}^\intercal \mathcal{L} \mathbf{Y}$, where $\mathbf{Y}$ was defined in Section \ref{section:unnormalized_repsc}. Define $\gamma = \mu_{K + 1} - \mu_{K}$. Under Assumption \ref{assumption:R_is_d_regular}, there exists a universal constant $\mathrm{const}(C, \alpha)$, such that if $\gamma$ satisfies $$\gamma^2 \geq \mathrm{const}(C, \alpha) (2 + \epsilon) p N K \ln N,$$ and $p \geq C \ln N / N$ for some $C > 0$, then, $$M(\bm{\Theta}, \hat{\bm{\Theta}}) \leq \mathrm{const}(C, \alpha) \frac{(2 + \epsilon)}{\gamma^2} p N \ln N,$$ for every $\epsilon > 0$ with probability at least $1 - 2 N^{-\alpha}$ when a $(1 + \epsilon)$-approximate algorithm for $k$-means clustering is used in Step 5 of Algorithm \ref{alg:urepsc}. \end{theorem} \begin{theorem}[Error bound for \textsc{NRepSC}] \label{theorem:consistency_result_normalized} Let $\rank{\mathbf{R}} \leq N - K$ and assume that all clusters have equal sizes. Let $\mu_1 \leq \mu_2 \leq \dots \leq \mu_{N - r}$ denote the eigenvalues of $\mathcal{Q}^{-1} \mathbf{Y}^\intercal \mathcal{L} \mathbf{Y} \mathcal{Q}^{-1}$, where $\mathcal{Q} = \sqrt{\mathbf{Y}^\intercal \mathcal{D} \mathbf{Y}}$ and $\mathbf{Y}$ was defined in Section \ref{section:unnormalized_repsc}. Define $\gamma = \mu_{K + 1} - \mu_{K}$ and $\lambda_1 = qd + s(N - d) + (p - q) \frac{d}{K} + (r - s) \frac{N - d}{K}$. Under Assumption \ref{assumption:R_is_d_regular}, there are universal constants $\mathrm{const}_1(C, \alpha)$, $\mathrm{const}_4(C, \alpha)$, and $\mathrm{const}_5(C, \alpha)$ such that if: \begin{enumerate} \item $\left(\frac{\sqrt{p N \ln N}}{\lambda_1 - p}\right) \left(\frac{\sqrt{p N \ln N}}{\lambda_1 - p} + \frac{1}{6\sqrt{C}}\right) \leq \frac{1}{16(\alpha + 1)}$, \item $\frac{\sqrt{p N \ln N}}{\lambda_1 - p} \leq \mathrm{const}_4(C, \alpha)$, and \item $16(2 + \epsilon)\left[ \frac{8 \mathrm{const}_5(C, \alpha) \sqrt{K}}{\gamma} + \mathrm{const}_1(C, \alpha)\right]^2 \frac{p N^2 \ln N}{(\lambda_1 - p)^2} < \frac{N}{K}$, \end{enumerate} and $p \geq C \ln N / N$ for some $C > 0$, then, $$M(\bm{\Theta}, \hat{\bm{\Theta}}) \leq 32(2 + \epsilon)\left[ \frac{8 \mathrm{const}_5(C, \alpha) \sqrt{K}}{\gamma} + \mathrm{const}_1(C, \alpha)\right]^2 \frac{p N \ln N}{(\lambda_1 - p)^2},$$ for every $\epsilon > 0$ with probability at least $1 - 2 N^{-\alpha}$ when a $(1 + \epsilon)$-approximate algorithm for $k$-means clustering is used in Step 6 of Algorithm \ref{alg:nrepsc}. \end{theorem} Next, we discuss our assumptions and use the error bounds above to establish the weak consistency of our algorithms. \subsection{Discussion} \label{section:discussion} Note that $\mathbf{I} - \bm{1} \bm{1}^\intercal / N$ is a projection matrix and $\bm{1}$ is its eigenvector with eigenvalue $0$. Any vector orthogonal to $\bm{1}$ is also an eigenvector with eigenvalue $1$. Thus, $\rank{\mathbf{I} - \bm{1} \bm{1}^\intercal / N} = N - 1$. Because $\rank{\mathbf{R} (\mathbf{I} - \bm{1} \bm{1}^\intercal / N)} \leq \min(\rank{\mathbf{R}}, \rank{\mathbf{I} - \bm{1} \bm{1}^\intercal / N})$, requiring $\rank{\mathbf{R}} \leq N - K$ ensures that $\rank{\mathbf{R}(\mathbf{I} - \bm{1} \bm{1}^\intercal / N)} \leq N - K$, which is necessary for \eqref{eq:optimization_problem} and \eqref{eq:optimization_problem_normalized} to have a solution. The assumption on the size of the clusters, together with the $d$-regularity assumption on $\mathcal{R}$, allows us to compute the smallest $K$ eigenvalues of the Laplacian matrix in the expected case. This is a crucial step in the proof of our main consistency results. The additional assumptions in Theorem \ref{theorem:consistency_result_normalized} are easy to satisfy as $\lambda_1$ scales linearly with $N$ for appropriate values of $p, q, r,$ and $s$. Similar assumptions were also used in \citet{KleindessnerEtAl:2019:GuaranteesForSpectralClusteringWithFairnessConstraints}. \begin{remark} In practice, Algorithms \ref{alg:urepsc} and \ref{alg:nrepsc} only require the rank assumption on $\mathbf{R}$ to ensure the existence of solutions to the corresponding optimization problems. The assumptions on the size of clusters and $d$-regularity of $\mathcal{R}$ are only needed for our theoretical analysis. \end{remark} The next two corollaries are direct consequences of Theorems \ref{theorem:consistency_result_unnormalized} and \ref{theorem:consistency_result_normalized}, respectively. \begin{corollary}[Weak consistency of \textsc{URepSC}] \label{corollary:weak_consistency_urepsc} Under the same setup as Theorem \ref{theorem:consistency_result_unnormalized}, for \textsc{URepSC}, $M(\bm{\Theta}, \hat{\bm{\Theta}}) = o(1)$ with probability $1 - o(1)$ if $\gamma = \omega(\sqrt{pN K \ln N})$. \end{corollary} \begin{corollary}[Weak consistency of \textsc{NRepSC}] \label{corollary:weak_consistency_nrepsc} Under the same setup as Theorem \ref{theorem:consistency_result_normalized}, for \textsc{NRepSC}, $M(\bm{\Theta}, \hat{\bm{\Theta}}) = o(1)$ with probability $1 - o(1)$ if $\gamma = \omega(\sqrt{pN K \ln N} / (\lambda_1 - p))$. \end{corollary} Thus, under the assumptions in the corollaries above, Algorithms \ref{alg:urepsc} and \ref{alg:nrepsc} are weakly consistent \citep{Abbe:2018:CommunityDetectionAndStochasticBlockModels}. The conditions on $\gamma$ are satisfied in many interesting cases. For example, when there are $P$ protected groups, as is the case for statistical-level constraints, the equivalent representation graph has $P$ cliques that are not connected to each other (see Appendix \ref{appendix:constraint}). \citet{KleindessnerEtAl:2019:GuaranteesForSpectralClusteringWithFairnessConstraints} show that $\gamma = \theta(N/K)$ in this case (for the unnormalized variant), which satisfies the criterion given above if $K$ is not too large. Finally, Theorems \ref{theorem:consistency_result_unnormalized} and \ref{theorem:consistency_result_normalized} require a $(1 + \epsilon)$-approximate solution to $k$-means clustering. Several efficient algorithms have been proposed in the literature for this task \citep{KumarEtAl:2004:ASimpleLinearTimeApproximateAlgorithmForKMeansClusteringInAnyDimension,ArthurVassilvitskii:2007:KMeansTheAdvantagesOfCarefulSeeding,AhmadianEtAl:2017:BetterGuaranteesForKMeansAndEuclideanKMedianByPrimalDualAlgorithms}. Such algorithms are also available in commonly used software packages like MATLAB and scikit-learn. The assumption that $p \geq C \ln N / N$ controls the sparsity of the graph, and is required in the the consistency proofs for standard spectral clustering as well \citep{LeiEtAl:2015:ConsistencyOfSpectralClusteringInSBM}. \subsection{Proof of Theorems \ref{theorem:consistency_result_unnormalized} and \ref{theorem:consistency_result_normalized}} \label{section:proof_of_theorems} The proof of Theorems \ref{theorem:consistency_result_unnormalized} and \ref{theorem:consistency_result_normalized} follow the commonly used template for such results \citep{RoheEtAl:2011:SpectralClusteringAndTheHighDimensionalSBM, LeiEtAl:2015:ConsistencyOfSpectralClusteringInSBM}. In the context of \textsc{URepSC} (similar arguments work for \textsc{NRepSC} as well), we \begin{enumerate} \item Compute the expected Laplacian matrix $\mathcal{L}$ under $\mathcal{R}$-SBM and show that its top $K$ eigenvectors can be used to recover the ground-truth clusters (Lemmas \ref{lemma:introducing_uks}--\ref{lemma:orthonormal_eigenvectors_y2_yK}). \item Show that these top $K$ eigenvectors lie in the null space of $\mathbf{R}(\mathbf{I} - \bm{1} \bm{1}^\intercal / N)$, and hence are also the top $K$ eigenvectors of $\mathbf{Y}^\intercal \mathcal{L} \mathbf{Y}$ (Lemma \ref{lemma:first_K_eigenvectors_of_L}). This implies that Algorithm \ref{alg:urepsc} returns the ground truth clusters in the expected case. \item Use matrix perturbation arguments to establish a high probability mistake bound in the general case when the graph $\mathcal{G}$ is sampled from a $\mathcal{R}$-SBM (Lemmas \ref{lemma:bound_on_D-calD}--\ref{lemma:k_means_error}). \end{enumerate} We begin with a series of lemmas that highlight certain useful properties of eigenvalues and eigenvectors of the expected Laplacian $\mathcal{L}$. These lemmas will be used in Sections \ref{section:proof_consistency_unnormalized} and \ref{section:proof_consistency_normalized} to prove Theorem \ref{theorem:consistency_result_unnormalized} and \ref{theorem:consistency_result_normalized}, respectively. See the supplementary material \citep{ThisPaperSupp} for the proofs of all technical lemmas. For the remainder of this section, we assume that all appropriate assumptions made in Theorems \ref{theorem:consistency_result_unnormalized} and \ref{theorem:consistency_result_normalized} are satisfied. The first lemma shows that certain vectors that can be used to recover the ground-truth clusters indeed satisfy the representation constraint in \eqref{eq:matrix_fairness_criteria} and \eqref{eq:normalized_matrix_fairness_criteria}. \begin{lemma} \label{lemma:introducing_uks} The $N$-dimensional vector of all ones, denoted by $\bm{1}$, is an eigenvector of $\mathbf{R}$ with eigenvalue $d$. Define $\mathbf{u}_k \in \mathbb{R}^N$ for $k \in [K - 1]$ as, \begin{equation*} u_{ki} = \begin{cases} 1 & \text{ if }v_i \in \mathcal{C}_k \\ -\frac{1}{K - 1} & \text{ otherwise,} \end{cases} \end{equation*} where $u_{ki}$ is the $i^{th}$ element of $\mathbf{u}_k$. Then, $\bm{1}, \mathbf{u}_1, \dots, \mathbf{u}_{K - 1} \in \nullspace{\mathbf{R}(\mathbf{I} - \frac{1}{N}\bm{1}\bmone^\intercal)}$. Moreover, $\bm{1}, \mathbf{u}_1, \dots, \mathbf{u}_{K - 1}$ are linearly independent. \end{lemma} Recall that we use $\mathcal{A} \in \mathbb{R}^{N \times N}$ to denote the expected adjacency matrix of the similarity graph $\mathcal{G}$. Clearly, $\mathcal{A} = \tilde{\mathcal{A}} - p \mathbf{I}$, where $\tilde{\mathcal{A}}$ is such that $\tilde{\mathcal{A}}_{ij} = P(A_{ij} = 1)$ if $i \neq j$ (see \eqref{eq:sbm_specification}) and $\tilde{\mathcal{A}}_{ii} = p$ otherwise. Note that \begin{equation} \label{eq:eigenvector_A_tildeA} \tilde{\mathcal{A}} \mathbf{x} = \lambda \mathbf{x} \,\,\,\, \Leftrightarrow \,\,\,\, \mathcal{A} \mathbf{x} = (\lambda - p) \mathbf{x}. \end{equation} Simple algebra shows that $\tilde{\mathcal{A}}$ can be written as \begin{equation} \label{eq:tilde_cal_A_def} \tilde{\mathcal{A}} = q \mathbf{R} + s (\bm{1} \bm{1}^\intercal - \mathbf{R}) + (p - q)\sum_{k = 1}^K \mathbf{G}_k \mathbf{R} \mathbf{G}_k + (r - s) \sum_{k = 1}^K \mathbf{G}_k (\bm{1} \bm{1}^\intercal - \mathbf{R}) \mathbf{G}_k, \end{equation} where, for all $k \in [K]$, $\mathbf{G}_k \in \mathbb{R}^{N \times N}$ is a diagonal matrix such that $(\mathbf{G}_k)_{ii} = 1$ if $v_i \in \mathcal{C}_k$ and $0$ otherwise. The next lemma shows that $\bm{1}, \mathbf{u}_1, \dots, \mathbf{u}_{K - 1}$ defined in Lemma \ref{lemma:introducing_uks} are eigenvectors of $\tilde{\mathcal{A}}$. \begin{lemma} \label{lemma:uk_eigenvector_of_tildeA} Let $\bm{1}, \mathbf{u}_1, \dots, \mathbf{u}_{K - 1}$ be as defined in Lemma \ref{lemma:introducing_uks}. Then, \begin{eqnarray*} \tilde{\mathcal{A}} \bm{1} &=& \lambda_1 \bm{1} \text{ where } \lambda_1 = qd + s(N - d) + (p - q) \frac{d}{K} + (r - s) \frac{N - d}{K}, \text{ and } \\ \tilde{\mathcal{A}} \mathbf{u}_k &=& \lambda_{1 + k} \mathbf{u}_k \text{ where } \lambda_{1 + k} = (p - q) \frac{d}{K} + (r - s) \frac{N - d}{K}. \end{eqnarray*} \end{lemma} Let $\mathcal{L} = \mathcal{D} - \mathcal{A}$ be the expected Laplacian matrix, where $\mathcal{D}$ is a diagonal matrix with $\mathcal{D}_{ii} = \sum_{j=1}^N \mathcal{A}_{ij}$ for all $i \in [N]$. It is easy to see that $\mathcal{D}_{ii} = \lambda_1 - p$ for all $i \in [N]$ as $\mathcal{A} \bm{1} = (\lambda_1 - p) \bm{1}$ by \eqref{eq:eigenvector_A_tildeA} and Lemma \ref{lemma:uk_eigenvector_of_tildeA}. Thus, $\mathcal{D} = (\lambda_1 - p) \mathbf{I}$ and hence any eigenvector of $\tilde{\mathcal{A}}$ with eigenvalue $\lambda$ is also an eigenvector of $\mathcal{L}$ with eigenvalue $\lambda_1 - \lambda$. That is, if $\tilde{\mathcal{A}} \mathbf{x} = \lambda \mathbf{x}$, \begin{equation} \label{eq:eigenvectors_of_L} \mathcal{L} \mathbf{x} = (\mathcal{D} - \mathcal{A})\mathbf{x} = ((\lambda_1 - p) \mathbf{I} - (\tilde{\mathcal{A}} - p \mathbf{I})) \mathbf{x} = (\lambda_1 - \lambda) \mathbf{x}. \end{equation} Hence, the eigenvectors of $\mathcal{L}$ corresponding to the $K$ smallest eigenvalues are the same as the eigenvectors of $\tilde{\mathcal{A}}$ corresponding to the $K$ largest eigenvalues. Recall that the columns of the matrix $\mathbf{Y}$ used in Algorithms \ref{alg:urepsc} and \ref{alg:nrepsc} contain the orthonormal basis for the null space of $\mathbf{R}(\mathbf{I} - \bm{1} \bm{1}^\intercal/N)$. To solve \eqref{eq:optimization_problem} and \eqref{eq:optimization_problem_normalized}, we only need to optimize over vectors that belong to this null space. By Lemma \ref{lemma:introducing_uks}, $\bm{1}, \mathbf{u}_1, \dots, \mathbf{u}_{K - 1} \in \nullspace{\mathbf{R}(\mathbf{I} - \bm{1} \bm{1}^\intercal/N)}$ and these vectors are linearly independent. However, we need an orthonormal basis to compute $\mathbf{Y}$. Let $\mathbf{y}_1 = \bm{1} / \sqrt{N}$ and $\mathbf{y}_2, \dots, \mathbf{y}_K$ be orthonormal vectors that span the same space as $\mathbf{u}_1, \dots, \mathbf{u}_{K - 1}$. The next lemma computes such $\mathbf{y}_2, \dots, \mathbf{y}_K$. The matrix $\mathbf{Y} \in \mathbb{R}^{N \times N - r}$ contains these vectors $\mathbf{y}_1, \dots, \mathbf{y}_K$ as its first $K$ columns. \begin{lemma} \label{lemma:orthonormal_eigenvectors_y2_yK} Define $\mathbf{y}_{1 + k} \in \mathbb{R}^N$ for $k \in [K - 1]$ as \begin{equation*} y_{1 + k, i} = \begin{cases} 0 & \text{ if } v_i \in \mathcal{C}_{k{'}} \text{ s.t. } k{'} < k \\ \frac{K - k}{\sqrt{\frac{N}{K}(K - k)(K - k + 1)}} & \text{ if } v_i \in \mathcal{C}_k \\ -\frac{1}{\sqrt{\frac{N}{K}(K - k)(K - k + 1)}} & \text{ otherwise.} \end{cases} \end{equation*} Then, for all $k \in [K - 1]$, $\mathbf{y}_{1 + k}$ are orthonormal vectors that span the same space as $\mathbf{u}_1, \mathbf{u}_2, \dots, \mathbf{u}_{K - 1}$ and $\mathbf{y}_1^\intercal \mathbf{y}_{1 + k} = 0$. As before, $y_{1 + k, i}$ refers to the $i^{th}$ element of $\mathbf{y}_{1 + k}$. \end{lemma} Let $\mathbf{X} \in \mathbb{R}^{N \times K}$ be such that it has $\mathbf{y}_1, \dots, \mathbf{y}_{K}$ as its columns. If two nodes belong to the same cluster, the rows corresponding to these nodes in $\mathbf{X} \mathbf{U}$ will be identical for any $\mathbf{U} \in \mathbb{R}^{K \times K}$ such that $\mathbf{U}^\intercal \mathbf{U} = \mathbf{U} \mathbf{U}^\intercal = \mathbf{I}$. Thus, any $K$ orthonormal vectors belonging to the span of $\mathbf{y}_1, \dots, \mathbf{y}_K$ can be used to recover the ground truth clusters. With the general properties of the eigenvectors and eigenvalues established in the lemmas above, we next move on to the proof of Theorem \ref{theorem:consistency_result_unnormalized} in the next section and Theorem \ref{theorem:consistency_result_normalized} in Section \ref{section:proof_consistency_normalized}. \subsubsection{Proof of Theorem \ref{theorem:consistency_result_unnormalized}} \label{section:proof_consistency_unnormalized} Let $\mathcal{Z} \in \mathbb{R}^{N - r \times K}$ be a solution to the optimization problem \eqref{eq:optimization_problem} in the expected case with $\mathcal{A}$ as input. The next lemma shows that columns of $\mathbf{Y} \mathcal{Z}$ indeed lie in the span of $\mathbf{y}_1, \dots, \mathbf{y}_K$. Thus, the $k$-means clustering step in Algorithm \ref{alg:urepsc} will return the correct ground truth clusters when $\mathcal{A}$ is passed as input. \begin{lemma} \label{lemma:first_K_eigenvectors_of_L} Let $\mathbf{y}_1 = \bm{1} / \sqrt{N}$ and $\mathbf{y}_{1 + k}$ be as defined in Lemma \ref{lemma:orthonormal_eigenvectors_y2_yK} for all $k \in [K - 1]$. Further, let $\mathcal{Z}$ be the optimal solution of the optimization problem in \eqref{eq:optimization_problem} with $\mathbf{L}$ set to $\mathcal{L}$. Then, the columns of $\mathbf{Y} \mathcal{Z}$ lie in the span of $\mathbf{y}_1, \mathbf{y}_2, \dots, \mathbf{y}_K$. \end{lemma} Next, we use arguments from matrix perturbation theory to show a high-probability bound on the number of mistakes made by the algorithm. In particular, we need an upper bound on $\norm{\mathbf{Y}^\intercal \mathbf{L} \mathbf{Y} - \mathbf{Y}^\intercal \mathcal{L} \mathbf{Y}}$, where $\mathbf{L}$ is the Laplacian matrix for a graph randomly sampled from $\mathcal{R}$-SBM and $\norm{\mathbf{P}} = \sqrt{\lambdamax{\mathbf{P}^\intercal \mathbf{P}}}$ for any matrix $\mathbf{P}$. Note that $\norm{\mathbf{Y}} = \norm{\mathbf{Y}^\intercal} = 1$ as $\mathbf{Y}^\intercal \mathbf{Y} = \mathbf{I}$. Thus, \begin{equation} \label{eq:reducing_YLY_to_L} \norm{\mathbf{Y}^\intercal \mathbf{L} \mathbf{Y} - \mathbf{Y}^\intercal \mathcal{L} \mathbf{Y}} \leq \norm{\mathbf{Y}^\intercal} \,\, \norm{\mathbf{L} - \mathcal{L}} \,\, \norm{\mathbf{Y}} = \norm{\mathbf{L} - \mathcal{L}}. \end{equation} Moreover, $$\norm{\mathbf{L} - \mathcal{L}} = \norm{\mathbf{D} - \mathbf{A} - (\mathcal{D} - \mathcal{A})} \leq \norm{\mathbf{D} - \mathcal{D}} + \norm{\mathbf{A} - \mathcal{A}}.$$ The next two lemmas bound the two terms on the right hand side of the inequality above, thus providing an upper bound on $\norm{\mathbf{L} - \mathcal{L}}$, and hence on $\norm{\mathbf{Y}^\intercal \mathbf{L} \mathbf{Y} - \mathbf{Y}^\intercal \mathcal{L} \mathbf{Y}}$ by \eqref{eq:reducing_YLY_to_L}. \begin{lemma} \label{lemma:bound_on_D-calD} Assume that $p \geq C \frac{\ln N}{N}$ for some constant $C > 0$. Then, for every $\alpha > 0$, there exists a constant $\mathrm{const}_1(C, \alpha)$ that only depends on $C$ and $\alpha$ such that $$\norm{\mathbf{D} - \mathcal{D}} \leq \mathrm{const}_1(C, \alpha) \sqrt{p N \ln N}$$ with probability at-least $1 - N^{-\alpha}$. \end{lemma} \begin{lemma} \label{lemma:bound_on_A-calA} Assume that $p \geq C \frac{\ln N}{N}$ for some constant $C > 0$. Then, for every $\alpha > 0$, there exists a constant $\mathrm{const}_2(C, \alpha)$ that only depends on $C$ and $\alpha$ such that $$\norm{\mathbf{A} - \mathcal{A}} \leq \mathrm{const}_2(C, \alpha) \sqrt{p N}$$ with probability at-least $1 - N^{-\alpha}$. \end{lemma} From Lemmas \ref{lemma:bound_on_D-calD} and \ref{lemma:bound_on_A-calA}, we conclude that there is always a constant $\mathrm{const}_3(C, \alpha) = \max\{\mathrm{const}_1(C, \alpha), \mathrm{const}_2(C, \alpha)\}$ such that, for any $\alpha > 0$, with probability at least $1 - 2N^{-\alpha}$, \begin{equation} \label{eq:L-calL_bound} \norm{\mathbf{Y}^\intercal \mathbf{L} \mathbf{Y} - \mathbf{Y}^\intercal \mathcal{L} \mathbf{Y}} \leq \norm{\mathbf{L} - \mathcal{L}} \leq \mathrm{const}_3(C, \alpha) \sqrt{p N \ln N}. \end{equation} Let $\mathcal{Z}$ and $\mathbf{Z}$ denote the optimal solution of \eqref{eq:optimization_problem} in the expected ($\mathbf{L}$ replaced with $\mathcal{L}$) and observed case. We use \eqref{eq:L-calL_bound} to show a bound on $\norm{\mathbf{Y} \mathcal{Z} - \mathbf{Y} Z}[F]$ in Lemma \ref{lemma:bound_on_eigenvector_diff} and then use this bound to argue that Algorithm \ref{alg:urepsc} makes a small number of mistakes when the graph is sampled from $\mathcal{R}$-SBM. \begin{lemma} \label{lemma:bound_on_eigenvector_diff} Let $\mu_1 \leq \mu_2 \leq \dots \leq \mu_{N - r}$ be eigenvalues of $\mathbf{Y}^\intercal \mathcal{L} \mathbf{Y}$. Further, let the columns of $\mathcal{Z} \in \mathbb{R}^{N - r \times K}$ and $\mathbf{Z} \in \mathbb{R}^{N - r \times K}$ correspond to the leading $K$ eigenvectors of $\mathbf{Y}^\intercal \mathcal{L} \mathbf{Y}$ and $\mathbf{Y}^\intercal \mathbf{L} \mathbf{Y}$, respectively. Define $\gamma = \mu_{K + 1} - \mu_{K}$. Then, with probability at least $1 - 2N^{-\alpha}$, $$\inf_{\mathbf{U} \in \mathbb{R}^{K \times K} : \mathbf{U}\bfU^\intercal = \mathbf{U}^\intercal \mathbf{U} = \mathbf{I}} \norm{\mathbf{Y} \mathcal{Z} - \mathbf{Y} \mathbf{Z} \mathbf{U}}[F] \leq \mathrm{const}_3(C, \alpha) \frac{4\sqrt{2K}}{\gamma} \sqrt{p N \ln N},$$ where $\mathrm{const}_3(C, \alpha)$ is from \eqref{eq:L-calL_bound}. \end{lemma} Recall that $\mathbf{X} \in \mathbb{R}^{N \times K}$ is a matrix that contains $\mathbf{y}_1, \dots, \mathbf{y}_K$ as its columns. Let $\mathbf{x}_i$ denote the $i^{th}$ row of $\mathbf{X}$. Simple calculation using Lemma \ref{lemma:orthonormal_eigenvectors_y2_yK} shows that, \begin{equation*} \norm{\mathbf{x}_i - \mathbf{x}_j}[2] = \begin{cases} 0 & \text{ if }v_i \text{ and }v_j \text{ belong to the same cluster} \\ \sqrt{\frac{2K}{N}} & \text{ otherwise.} \end{cases} \end{equation*} By Lemma \ref{lemma:first_K_eigenvectors_of_L}, $\mathcal{Z}$ can be chosen such that $\mathbf{Y} \mathcal{Z} = \mathbf{X}$. Let $\mathbf{U}$ be the matrix that solves $\inf_{\mathbf{U} \in \mathbb{R}^{K \times K} : \mathbf{U}\bfU^\intercal = \mathbf{U}^\intercal \mathbf{U} = \mathbf{I}} \norm{\mathbf{Y} \mathcal{Z} - \mathbf{Y} \mathbf{Z} \mathbf{U}}[F]$. As $\mathbf{U}$ is orthogonal, $\norm{\mathbf{x}_i^\intercal \mathbf{U} - \mathbf{x}_j^\intercal \mathbf{U}}[2] = \norm{\mathbf{x}_i - \mathbf{x}_j}[2]$. The following lemma is a direct consequence of Lemma 5.3 in \citep{LeiEtAl:2015:ConsistencyOfSpectralClusteringInSBM}. \begin{lemma} \label{lemma:k_means_error} Let $\mathbf{X}$ and $\mathbf{U}$ be as defined above. For any $\epsilon > 0$, let $\hat{\bm{\Theta}} \in \mathbb{R}^{N \times K}$ be the assignment matrix returned by a $(1 + \epsilon)$-approximate solution to the $k$-means clustering problem when rows of $\mathbf{Y} \mathbf{Z}$ are provided as input features. Further, let $\hat{\bm{\mu}}_1$, $\hat{\bm{\mu}}_2$, \dots, $\hat{\bm{\mu}}_K \in \mathbb{R}^{K}$ be the estimated cluster centroids. Define $\hat{\mathbf{X}} = \hat{\bm{\Theta}} \hat{\bm{\mu}}$ where $\hat{\bm{\mu}} \in \mathbb{R}^{K \times K}$ contains $\hat{\bm{\mu}}_1, \dots, \hat{\bm{\mu}}_K$ as its rows. Further, define $\delta = \sqrt{\frac{2K}{N}}$, and $S_k = \{v_i \in \mathcal{C}_k : \norm{\hat{\mathbf{x}}_i - \mathbf{x}_i} \geq \delta/2\}$. Then, \begin{equation} \label{eq:num_mistakes_bound} \delta^2 \sum_{k = 1}^K \abs{S_k} \leq 8(2 + \epsilon) \norm{\mathbf{X} \mathbf{U}^\intercal - \mathbf{Y} \mathbf{Z}}[F][2]. \end{equation} Moreover, if $\gamma$ from Lemma \ref{lemma:bound_on_eigenvector_diff} satisfies $\gamma^2 > \mathrm{const}(C, \alpha) (2 + \epsilon) p NK \ln N$ for a universal constant $\mathrm{const}(C, \alpha)$, there exists a permutation matrix $\mathbf{J} \in \mathbb{R}^{K \times K}$ such that \begin{equation} \label{eq:correct_solution_on_non-mistakes} \hat{\bm{\theta}}_i^\intercal \mathbf{J} = \bm{\theta}_i^\intercal, \,\,\,\, \forall \,\, i \in [N] \backslash (\cup_{k=1}^K S_k). \end{equation} Here, $\hat{\bm{\theta}}_i \mathbf{J}$ and $\bm{\theta}_i$ represent the $i^{th}$ row of matrix $\hat{\bm{\Theta}}\mathbf{J}$ and $\bm{\Theta}$ respectively. \end{lemma} By the definition of $M(\bm{\Theta}, \hat{\bm{\Theta}})$, for the matrix $\mathbf{J}$ used in Lemma \ref{lemma:k_means_error}, $M(\bm{\Theta}, \hat{\bm{\Theta}}) \leq \frac{1}{N} \norm{\bm{\Theta} - \hat{\bm{\Theta}} \mathbf{J}}[0]$. But, according to Lemma \ref{lemma:k_means_error}, $\norm{\bm{\Theta} - \hat{\bm{\Theta}} \mathbf{J}}[0] \leq 2 \sum_{k = 1}^K \abs{S_k}$. Using Lemma \ref{lemma:bound_on_eigenvector_diff} and \ref{lemma:k_means_error}, we get: \begin{eqnarray*} M(\bm{\Theta}, \hat{\bm{\Theta}}) \leq \frac{1}{N} \norm{\bm{\Theta} - \hat{\bm{\Theta}} \mathbf{J}}[0] \leq \frac{2}{N} \sum_{k = 1}^K \abs{S_k} &\leq& \frac{16(2 + \epsilon)}{N \delta^2} \norm{\mathbf{X} \mathbf{U}^\intercal - \mathbf{Y} \mathbf{Z}}[F][2] \\ &\leq& \mathrm{const}_3(C, \alpha)^2 \frac{512(2 + \epsilon)}{N \delta^2 \gamma^2} p N K \ln N. \end{eqnarray*} Noting that $\delta = \sqrt{\frac{2K}{N}}$ and setting $\mathrm{const}(C, \alpha) = 256 \times \mathrm{const}_3(C, \alpha)^2$ finishes the proof. \subsubsection{Proof of Theorem \ref{theorem:consistency_result_normalized}} \label{section:proof_consistency_normalized} Recall that $\mathbf{Q} = \sqrt{\mathbf{Y}^\intercal \mathbf{D} \mathbf{Y}}$ and analogously define $\mathcal{Q} = \sqrt{\mathbf{Y}^\intercal \mathcal{D} \mathbf{Y}}$, where $\mathcal{D}$ is the expected degree matrix. It was shown after Lemma \ref{lemma:uk_eigenvector_of_tildeA} that $\mathcal{D} = (\lambda_1 - p) \mathbf{I}$. Thus, $\mathcal{Q} = \sqrt{\lambda_1 - p} \;\mathbf{I}$ as $\mathbf{Y}^\intercal \mathbf{Y} = \mathbf{I}$. Hence $\mathcal{Q}^{-1} \mathbf{Y}^\intercal \mathcal{L} \mathbf{Y} \mathcal{Q}^{-1} = \frac{1}{\lambda_1 - p} \mathbf{Y}^\intercal \mathcal{L} \mathbf{Y}$. Therefore, $\mathcal{Q}^{-1} \mathbf{Y}^\intercal \mathcal{L} \mathbf{Y} \mathcal{Q}^{-1} \mathbf{x} = \frac{\lambda}{\lambda_1 - p} \mathbf{x} \; \Longleftrightarrow \; \mathbf{Y}^\intercal \mathcal{L} \mathbf{Y} \mathbf{x} = \lambda \mathbf{x}$. Let $\mathcal{Z} \in \mathbb{R}^{N - r \times K}$ contain the leading $K$ eigenvectors of $\mathcal{Q}^{-1} \mathbf{Y}^\intercal \mathcal{L} \mathbf{Y} \mathcal{Q}^{-1}$ as its columns. Algorithm \ref{alg:nrepsc} will cluster the rows of $\mathbf{Y} \mathcal{Q}^{-1} \mathcal{Z}$ to recover the clusters in the expected case. As $\mathcal{Q}^{-1} =\frac{1}{\sqrt{\lambda_1 - p}} \mathbf{I}$, we have $\mathbf{Y} \mathcal{Q}^{-1} \mathcal{Z} = \frac{1}{\sqrt{\lambda_1 - p}} \mathbf{Y} \mathcal{Z}$. By Lemma \ref{lemma:first_K_eigenvectors_of_L}, $\mathcal{Z}$ can always be chosen such that $\mathbf{Y} \mathcal{Z} = \mathbf{X}$, where recall that $\mathbf{X} \in \mathbb{R}^{N \times K}$ has $\mathbf{y}_1, \dots, \mathbf{y}_K$ as its columns. Because the rows of $\mathbf{X}$ are identical for nodes that belong to the same cluster, Algorithm \ref{alg:nrepsc} returns the correct ground truth clusters in the expected case. To bound the number of mistakes made by Algorithm \ref{alg:nrepsc}, we show that $\mathbf{Y} \mathbf{Q}^{-1} \mathbf{Z}$ is close to $\mathbf{Y} \mathcal{Q}^{-1} \mathcal{Z}$. Here, $\mathbf{Z} \in \mathbb{R}^{N - r \times K}$ contains the top $K$ eigenvectors of $\mathbf{Q}^{-1} \mathbf{Y}^\intercal \mathbf{L} \mathbf{Y} \mathbf{Q}^{-1}$. As in the proof of Lemma \ref{lemma:bound_on_eigenvector_diff}, we use Davis-Kahan theorem to bound this difference. This requires us to compute $\norm{\mathcal{Q}^{-1} \mathbf{Y}^\intercal \mathcal{L} \mathbf{Y} \mathcal{Q}^{-1} - \mathbf{Q}^{-1} \mathbf{Y}^\intercal \mathbf{L} \mathbf{Y} \mathbf{Q}^{-1}}$. Note that: \begin{align*} \norm{\mathcal{Q}^{-1} \mathbf{Y}^\intercal \mathcal{L} \mathbf{Y} \mathcal{Q}^{-1} - \mathbf{Q}^{-1} \mathbf{Y}^\intercal \mathbf{L} \mathbf{Y} \mathbf{Q}^{-1}} = &\norm{\mathcal{Q}^{-1} - \mathbf{Q}^{-1}} \cdot \norm{\mathbf{Y}^\intercal \mathcal{L} \mathbf{Y}} \cdot \norm{\mathcal{Q}^{-1}} + \\ &\norm{\mathbf{Q}^{-1}} \cdot \norm{\mathbf{Y}^\intercal \mathcal{L} \mathbf{Y} - \mathbf{Y}^\intercal \mathbf{L} \mathbf{Y}} \cdot \norm{\mathcal{Q}^{-1}} + \\ &\norm{\mathbf{Q}^{-1}} \cdot \norm{\mathbf{Y}^\intercal \mathbf{L} \mathbf{Y}} \cdot \norm{\mathcal{Q}^{-1} - \mathbf{Q}^{-1}}. \end{align*} We already have a bound on $\norm{\mathbf{Y}^\intercal \mathcal{L} \mathbf{Y} - \mathbf{Y}^\intercal \mathbf{L} \mathbf{Y}}$ in \eqref{eq:L-calL_bound}. Also, note that $\norm{\mathcal{Q}^{-1}} = \frac{1}{\sqrt{\lambda_1 - p}}$ as $\mathcal{Q}^{-1} = \frac{1}{\sqrt{\lambda_1 - p}} \mathbf{I}$. Similarly, as $\mathbf{Y}^\intercal \mathbf{Y} = \mathbf{I}$, $\norm{\mathbf{Y}^\intercal \mathcal{L} \mathbf{Y}} \leq \norm{\mathcal{L}} = \lambda_1 - \bar{\lambda}$, where $\bar{\lambda} = \lambdamin{\tilde{\mathcal{A}}}$. Finally, \begin{align*} \norm{\mathbf{Q}^{-1}} &\leq \norm{\mathcal{Q}^{-1} - \mathbf{Q}^{-1}} + \norm{\mathcal{Q}^{-1}} = \norm{\mathcal{Q}^{-1} - \mathbf{Q}^{-1}} + \frac{1}{\sqrt{\lambda_1 - p}} \text{, and} \\ \norm{\mathbf{Y}^\intercal \mathbf{L} \mathbf{Y}} &\leq \norm{\mathbf{Y}^\intercal \mathcal{L} \mathbf{Y} - \mathbf{Y}^\intercal \mathbf{L} \mathbf{Y}} + \norm{\mathbf{Y}^\intercal \mathcal{L} \mathbf{Y}} = \norm{\mathbf{Y}^\intercal \mathcal{L} \mathbf{Y} - \mathbf{Y}^\intercal \mathbf{L} \mathbf{Y}} + \lambda_1 - \bar{\lambda}. \end{align*} Thus, to compute a bound on $\norm{\mathcal{Q}^{-1} \mathbf{Y}^\intercal \mathcal{L} \mathbf{Y} \mathcal{Q}^{-1} - \mathbf{Q}^{-1} \mathbf{Y}^\intercal \mathbf{L} \mathbf{Y} \mathbf{Q}^{-1}}$, we only need a bound on $\norm{\mathcal{Q}^{-1} - \mathbf{Q}^{-1}}$. The next lemma provides this bound. \begin{lemma} \label{lemma:calQ-Q_bound} Let $\mathcal{Q} = \sqrt{\mathbf{Y}^\intercal \mathcal{D} \mathbf{Y}}$, $\mathbf{Q} = \sqrt{\mathbf{Y}^\intercal \mathbf{D} \mathbf{Y}}$, and assume that $$\left(\frac{\sqrt{pN \ln N}}{\lambda_1 - p}\right)\left(\frac{\sqrt{pN \ln N}}{\lambda_1 - p} + \frac{1}{6\sqrt{C}} \right) \leq \frac{1}{16(\alpha + 1)},$$ where $C$ and $\alpha$ are used in $\mathrm{const}_1(C, \alpha)$ defined in Lemma \ref{lemma:bound_on_D-calD}. Then, $$\norm{\mathcal{Q}^{-1} - \mathbf{Q}^{-1}} \leq \sqrt{\frac{2}{(\lambda_1 - p)^3}} \norm{\mathbf{D} - \mathcal{D}}.$$ \end{lemma} \noindent Using the lemma above with \eqref{eq:L-calL_bound}, we get { \small \begin{align} \label{eq:calQYcalLYcalQ-QYLYQ_bound} \begin{aligned} \norm{\mathcal{Q}^{-1} \mathbf{Y}^\intercal \mathcal{L} \mathbf{Y} \mathcal{Q}^{-1} - \mathbf{Q}^{-1} \mathbf{Y}^\intercal \mathbf{L} &\mathbf{Y} \mathbf{Q}^{-1}} \leq \frac{2(\lambda_1 - \bar{\lambda})}{(\lambda_1 - p)^2} \left[ \sqrt{2} + \frac{\norm{\mathbf{D} - \mathcal{D}}}{\lambda_1 - p}\right] \norm{\mathbf{D} - \mathcal{D}} + \\ & \frac{\mathrm{const}_3(C, \alpha)}{\lambda_1 - p} \left[\frac{2\sqrt{2} \norm{\mathbf{D} - \mathcal{D}}}{\lambda_1 - p} + \frac{2 \norm{\mathbf{D} - \mathcal{D}}[][2]}{(\lambda_1 - p)^2} + 1 \right] \sqrt{p N \ln N}. \end{aligned} \end{align} } \noindent The next lemma uses the bound above to show that $\mathbf{Y} \mathbf{Q}^{-1} \mathbf{Z}$ is close to $\mathbf{Y} \mathcal{Q}^{-1} \mathcal{Z}$. \begin{lemma} \label{lemma:eigenvector_diff_bound_normalized} Let $\mu_1 \leq \mu_2 \leq \dots \leq \mu_{N - r}$ be eigenvalues of $\mathcal{Q}^{-1} \mathbf{Y}^\intercal \mathcal{L} \mathbf{Y} \mathcal{Q}^{-1}$. Further, let the columns of $\mathcal{Z} \in \mathbb{R}^{N - r \times K}$ and $\mathbf{Z} \in \mathbb{R}^{N - r \times K}$ correspond to the leading $K$ eigenvectors of $\mathcal{Q}^{-1} \mathbf{Y}^\intercal \mathcal{L} \mathbf{Y} \mathcal{Q}^{-1}$ and $\mathbf{Q}^{-1} \mathbf{Y}^\intercal \mathbf{L} \mathbf{Y} \mathbf{Q}^{-1}$, respectively. Define $\gamma = \mu_{K + 1} - \mu_{K}$ and let there be a constant $\mathrm{const}_4(C, \alpha)$ such that $\frac{\sqrt{p N \ln N}}{\lambda_1 - p} \leq \mathrm{const}_4(C, \alpha)$. Then, with probability at least $1 - 2N^{-\alpha}$, there exists a constant $\mathrm{const}_5(C, \alpha)$ such that \begin{align*} \inf_{\mathbf{U} : \mathbf{U}^\intercal \mathbf{U} = \mathbf{U}\bfU^\intercal = \mathbf{I}} \norm{\mathbf{Y} \mathcal{Q}^{-1} \mathcal{Z} - &\mathbf{Y} \mathbf{Q}^{-1} \mathbf{Z} \mathbf{U}}[F] \leq \\ &\left[\frac{16 K \mathrm{const}_5(C, \alpha)}{\gamma (\lambda_1 - p)^{3/2}} + \frac{2 \mathrm{const}_1(C, \alpha) \sqrt{K}}{(\lambda_1 - p)^{3/2}} \right] \sqrt{p N \ln N}, \end{align*} where $\mathrm{const}_1(C, \alpha)$ is defined in Lemma \ref{lemma:bound_on_D-calD}. \end{lemma} Recall that, by Lemma \ref{lemma:first_K_eigenvectors_of_L}, $\mathcal{Z}$ can always be chosen such that $\mathbf{Y} \mathcal{Z} = \mathbf{X}$, where $\mathbf{X}$ contains $\mathbf{y}_1, \dots, \mathbf{y}_K$ as its columns. As $\mathcal{Q}^{-1} = \frac{1}{\sqrt{\lambda_1 - p}} \mathbf{I}$, one can show that: \begin{equation*} \norm{(\mathcal{Q}^{-1} \mathbf{X})_i - (\mathcal{Q}^{-1} \mathbf{X})_j}[2] = \begin{cases} 0 & \text{ if } v_i \text{ and } v_j \text{ belong to the same cluster} \\ \sqrt{\frac{2K}{N(\lambda_1 - p)}} & \text{ otherwise.} \end{cases} \end{equation*} Here, $(\mathcal{Q}^{-1} \mathbf{X})_i$ denotes the $i^{th}$ row of the matrix $\mathbf{Y} \mathcal{Q}^{-1} \mathcal{Z}$. Let $\mathbf{U}$ be the matrix that solves $\inf_{\mathbf{U} \in \mathbb{R}^{K \times K} : \mathbf{U}\bfU^\intercal = \mathbf{U}^\intercal \mathbf{U} = \mathbf{I}} \norm{\mathbf{Y} \mathcal{Q}^{-1} \mathcal{Z} - \mathbf{Y} \mathbf{Q}^{-1} \mathbf{Z} \mathbf{U}}[F]$. As $\mathbf{U}$ is orthogonal, $\norm{(\mathcal{Q}^{-1} \mathbf{X})_i^\intercal \mathbf{U} - (\mathcal{Q}^{-1} \mathbf{X})_j^\intercal \mathbf{U}}[2] = \norm{(\mathcal{Q}^{-1} \mathbf{X})_i - (\mathcal{Q}^{-1} \mathbf{X})_j}[2]$. As in the previous case, the following lemma is a direct consequence of Lemma 5.3 in \citep{LeiEtAl:2015:ConsistencyOfSpectralClusteringInSBM}. \begin{lemma} \label{lemma:k_means_error_normalized} Let $\mathbf{X}$ and $\mathbf{U}$ be as defined above. For any $\epsilon > 0$, let $\hat{\bm{\Theta}} \in \mathbb{R}^{N \times K}$ be the assignment matrix returned by a $(1 + \epsilon)$-approximate solution to the $k$-means clustering problem when rows of $\mathbf{Y} \mathbf{Q}^{-1} \mathbf{Z}$ are provided as input features. Further, let $\hat{\bm{\mu}}_1$, $\hat{\bm{\mu}}_2$, \dots, $\hat{\bm{\mu}}_K \in \mathbb{R}^{K}$ be the estimated cluster centroids. Define $\hat{\mathbf{X}} = \hat{\bm{\Theta}} \hat{\bm{\mu}}$ where $\hat{\bm{\mu}} \in \mathbb{R}^{K \times K}$ contains $\hat{\bm{\mu}}_1, \dots, \hat{\bm{\mu}}_K$ as its rows. Further, define $\delta = \sqrt{\frac{2K}{N(\lambda_1 - p)}}$, and $S_k = \{v_i \in \mathcal{C}_k : \norm{\hat{\mathbf{x}}_i - \mathbf{x}_i} \geq \delta/2\}$. Then, \begin{equation*} \delta^2 \sum_{k = 1}^K \abs{S_k} \leq 8(2 + \epsilon) \norm{\mathbf{X} \mathbf{U}^\intercal - \mathbf{Y} \mathbf{Q}^{-1} \mathbf{Z}}[F][2]. \end{equation*} Moreover, if $\gamma$ from Lemma \ref{lemma:eigenvector_diff_bound_normalized} satisfies $$16(2 + \epsilon)\left[ \frac{8 \mathrm{const}_5(C, \alpha) \sqrt{K}}{\gamma} + \mathrm{const}_1(C, \alpha)\right]^2 \frac{p N^2 \ln N}{(\lambda_1 - p)^2} < \frac{N}{K},$$ then, there exists a permutation matrix $\mathbf{J} \in \mathbb{R}^{K \times K}$ such that \begin{equation*} \hat{\bm{\theta}}_i^\intercal \mathbf{J} = \bm{\theta}_i^\intercal, \,\,\,\, \forall \,\, i \in [N] \backslash (\cup_{k=1}^K S_k). \end{equation*} Here, $\hat{\bm{\theta}}_i \mathbf{J}$ and $\bm{\theta}_i$ represent the $i^{th}$ row of matrix $\hat{\bm{\Theta}}\mathbf{J}$ and $\bm{\Theta}$ respectively. \end{lemma} The proof of Lemma \ref{lemma:k_means_error_normalized} is similar to that of Lemma \ref{lemma:k_means_error}, and has been omitted. The result follows by using a similar calculation as was done after Lemma \ref{lemma:k_means_error} in Section \ref{section:proof_consistency_unnormalized}. \section{Numerical Results} \label{section:numerical_results} We perform three types of experiments. In the first two cases, we use synthetically generated data to validate our theoretical results using $d$-regular representation graphs (Section \ref{chapter:fairness:section:d_reg_experiments}) and non-$d$-regular representation graphs (Section \ref{chapter:fairness:section:sbm_experiments}). In the third case, we demonstrate the effectiveness of the proposed algorithms on a real-world dataset (Section~\ref{chapter:fairness:section:trade_experiments}). Notably, our experiments in Sections \ref{chapter:fairness:section:sbm_experiments} and \ref{chapter:fairness:section:trade_experiments} demonstrate that the $d$-regularity assumption on $\mathcal{R}$ is not needed in practice. Before proceeding further, we mention two important details below: \textbf{(i)} How do we compare with the algorithms presented in \cite{KleindessnerEtAl:2019:GuaranteesForSpectralClusteringWithFairnessConstraints}? and \textbf{(ii)} What do we do when the rank assumption on $\mathcal{R}$ is not satisfied? \begin{figure}[t] \centering \subfloat[][Accuracy vs no. of nodes]{\includegraphics[width=0.33\textwidth]{Images/U_d_reg_vs_N.pdf}\label{fig:d_reg_unnorm:vs_N}}% \subfloat[][Accuracy vs no. of clusters]{\includegraphics[width=0.33\textwidth]{Images/U_d_reg_vs_K.pdf}\label{fig:d_reg_unnorm:vs_K}}% \subfloat[][Accuracy vs degree of $\mathcal{R}$]{\includegraphics[width=0.33\textwidth]{Images/U_d_reg_vs_d.pdf}\label{fig:d_reg_unnorm:vs_d}} \caption{Comparing \textsc{URepSC} with other ``unnormalized'' algorithms using synthetically generated $d$-regular representation graphs.} \label{fig:d_reg_unnorm} \end{figure} \begin{figure}[t] \centering \subfloat[][Accuracy vs no. of nodes]{\includegraphics[width=0.33\textwidth]{Images/N_d_reg_vs_N.pdf}\label{fig:d_reg_norm:vs_N}}% \subfloat[][Accuracy vs no. of clusters]{\includegraphics[width=0.33\textwidth]{Images/N_d_reg_vs_K.pdf}\label{fig:d_reg_norm:vs_K}}% \subfloat[][Accuracy vs degree of $\mathcal{R}$]{\includegraphics[width=0.33\textwidth]{Images/N_d_reg_vs_d.pdf}\label{fig:d_reg_norm:vs_d}} \caption{Comparing \textsc{NRepSC} with other ``normalized'' algorithms using synthetically generated $d$-regular representation graphs.} \label{fig:d_reg_norm} \end{figure} \paragraph*{Comparison with \citet{KleindessnerEtAl:2019:GuaranteesForSpectralClusteringWithFairnessConstraints}} We refer to the algorithms proposed in \citet{KleindessnerEtAl:2019:GuaranteesForSpectralClusteringWithFairnessConstraints} as \textsc{UFairSC} and \textsc{NFairSC}, corresponding to the unnormalized and normalized fair spectral clustering, respectively. These algorithms assume that each node belongs to one of the $P$ protected groups $\mathcal{P}_1, \dots, \mathcal{P}_P \subseteq \mathcal{V}$ that are observed by the learner. Recall that these algorithms are special cases of our algorithms when $\mathcal{R}$ is block diagonal (Section \ref{section:constraint}). To demonstrate the generality of our algorithms, we only experiment with representation graphs that are not of the form specified above. Naturally, \textsc{UFairSC} and \textsc{NFairSC} are not directly applicable in this setting. Nonetheless, to compare with these algorithms, we approximate the protected groups by clustering the nodes in $\mathcal{R}$ using standard spectral clustering. Each discovered cluster is then treated as a protected group. \paragraph*{Approximate \textsc{URepSC} and \textsc{NRepSC}} Recall that the rank assumption on $\mathcal{R}$ requires $\rank{\mathbf{R}} \leq N - K$. It is not possible to find $K$ orthonormal eigenvectors in Algorithms \ref{alg:urepsc} and \ref{alg:nrepsc} if $\mathbf{R}$ violates this assumption. Unlike other assumptions in our theoretical analysis, this assumption is necessary in practice. If a graph $\mathcal{R}$ violates the rank assumption, we instead use the best rank $R$ approximation of its adjacency matrix $\mathbf{R}$ ($R \leq N - K$). This approximation does not have binary elements, but it works well in practice. Whenever this approximation is used, we refer to \textsc{URepSC} and \textsc{NRepSC} as \textsc{URepSC (approx.)} and \textsc{NRepSC (approx.)}, respectively. \begin{figure}[t] \centering \subfloat[][Unnormalized case]{\includegraphics[width=0.4\textwidth]{Images/U_d_reg_vs_rank_groups.pdf}\label{fig:d_reg_unnorm:rank_groups}}% \hspace{1cm}\subfloat[][Normalized case]{\includegraphics[width=0.4\textwidth]{Images/N_d_reg_vs_rank_groups.pdf}\label{fig:d_reg_norm:rank_groups}}% \caption{Accuracy vs the values of $P$ and $R$ used by \textsc{U/NFairSC} and \textsc{U/NRepSC}, respectively, for $d$-regular representation graphs.} \end{figure} \subsection{Experiments with $d$-regular representation graphs} \label{chapter:fairness:section:d_reg_experiments} For these experiments, we sampled $d$-regular representation graphs using $p=0.4$, $q=0.3$, $r=0.2$, and $s=0.1$, for various values of $d$, $N$, and $K$. We ensured that the sampled $\mathcal{R}$ satisfies Assumption \ref{assumption:R_is_d_regular} and $\rank{\mathbf{R}} \leq N - k$. Further, the ground-truth clusters have equal size and are representation-aware by construction as described in Section \ref{section:consistency_results}. Figure \ref{fig:d_reg_unnorm} compares the performance of \textsc{URepSC} with unnormalized spectral clustering (\textsc{USC}) (Algorithm \ref{alg:unnormalized_spectral_clustering}) and \textsc{UFairSC}. Figure \ref{fig:d_reg_unnorm:vs_N} shows the effect of varying $N$ for a fixed $d = 40$ and $K=5$. Figure \ref{fig:d_reg_unnorm:vs_K} varies $K$ and keeps $N = 1200$ and $d = 40$ fixed. Similarly, Figure \ref{fig:d_reg_unnorm:vs_d} keeps $N = 1200$ and $K = 5$ fixed and varies $d$. In all cases, we use $R = P = N/10$, where recall that $R$ is the rank used for approximation in \textsc{URepSC (approx.)} and $P$ is the number of protected groups discovered in $\mathcal{R}$ for running \textsc{UFairSC}. The figures plot the accuracy on $y$-axis and report the mean and standard deviation across $10$ independent executions of the algorithms in each case. As the ground truth clusters satisfy Definition \ref{def:representation_constraint} by construction, a high accuracy of cluster recovery implies that the algorithm returns representation-aware clusters. Figure \ref{fig:d_reg_norm} shows the corresponding results for \textsc{NRepSC}, where we compare it with the normalized variants of other algorithms. In Figures \ref{fig:d_reg_unnorm:vs_N} and \ref{fig:d_reg_norm:vs_N}, it appears that even the standard spectral clustering algorithm will return representation-aware clusters for a large enough graph. However, Figures \ref{fig:d_reg_unnorm:vs_K} and \ref{fig:d_reg_norm:vs_K} show that this is not true if the number of clusters also increases with $N$, as is more common in practice. It may also be tempting to think that \textsc{UFairSC} and \textsc{NFairSC} may perform well with a more carefully chosen value of $P$, the number of protected groups. However, Figures \ref{fig:d_reg_unnorm:rank_groups} and \ref{fig:d_reg_norm:rank_groups} show that this is not true. These figures plot the performance of \textsc{UFairSC} and \textsc{NFairSC} as a function of the number of protected groups $P$. Also shown in these plots is the performance of the approximate variants of our algorithms for various values of rank $R$. As expected, the accuracy increases with $R$ as the approximation of $\mathbf{R}$ becomes better. \begin{figure}[t] \centering \subfloat[][$N = 1000$, $K = 4$]{\includegraphics[width=0.48\textwidth]{Images/U_AccVsGroupRankSBM_1000_4.pdf}}% \hspace{0.5cm}\subfloat[][$N = 3000$, $K = 4$]{\includegraphics[width=0.48\textwidth]{Images/U_AccVsGroupRankSBM_3000_4}} \subfloat[][$N = 1000$, $K = 8$]{\includegraphics[width=0.48\textwidth]{Images/U_AccVsGroupRankSBM_1000_8}}% \hspace{0.5cm}\subfloat[][$N = 3000$, $K = 8$]{\includegraphics[width=0.48\textwidth]{Images/U_AccVsGroupRankSBM_3000_8}} \caption{Comparing \textsc{URepSC (approx.)} with \textsc{UFairSC} using synthetically generated representation graphs sampled from an SBM.} \label{fig:sbm_comparison_unnorm} \end{figure} \begin{figure}[t] \centering \subfloat[][$N = 1000$, $K = 4$]{\includegraphics[width=0.48\textwidth]{Images/N_AccVsGroupRankSBM_1000_4.pdf}}% \hspace{0.5cm}\subfloat[][$N = 3000$, $K = 4$]{\includegraphics[width=0.48\textwidth]{Images/N_AccVsGroupRankSBM_3000_4}} \subfloat[][$N = 1000$, $K = 8$]{\includegraphics[width=0.48\textwidth]{Images/N_AccVsGroupRankSBM_1000_8}}% \hspace{0.5cm}\subfloat[][$N = 3000$, $K = 8$]{\includegraphics[width=0.48\textwidth]{Images/N_AccVsGroupRankSBM_3000_8}} \caption{Comparing \textsc{NRepSC (approx.)} with \textsc{NFairSC} using synthetically generated representation graphs sampled from an SBM.} \label{fig:sbm_comparison_norm} \end{figure} \subsection{Experiments with representation graphs sampled from SBM} \label{chapter:fairness:section:sbm_experiments} In this case, we divide the nodes into $P = 5$ protected groups and sample a representation graph $\mathcal{R}$ using a Stochastic Block Model. Nodes in $\mathcal{R}$ are connected with probability $p_{\mathrm{in}} = 0.8$ (resp. $p_{\mathrm{out}} = 0.2$) if they belong to the same (resp. different) protected group(s). Conditioned on $\mathcal{R}$, we then sample an adjacency matrix from $\mathcal{R}$-SBM as before. As an $\mathcal{R}$ generated this way may violate the rank assumption, we only experiment with the approximate variants of \textsc{URepSC} and \textsc{NRepSC} in this case. Moreover, as such an $\mathcal{R}$ may not be $d$-regular, the notion of accuracy no longer conveys information about the representation awareness of an algorithm. Thus, we instead compute the individual balance $\rho_i$ with respect to each node, as defined in \eqref{eq:balance}. Recall that $0 \leq \rho_i \leq 1$ and higher values indicate that the representatives of node $v_i$ are well spread out across clusters $\hat{\mathcal{C}}_1$, \dots, $\hat{\mathcal{C}}_K$. We use average balance $\bar{\rho} = \frac{1}{N} \sum_{i = 1}^N \rho_i$ to measure the representation-awareness of the clusters. While average balance measures the representation awareness of the clusters, we also need to ensure that they have a high quality. Thus, we compute the ratio of the average balance to the ratio-cut objective. A high value indicates balanced clusters with a high quality (low ratio-cut score). Figure \ref{fig:sbm_comparison_unnorm} fixes the value of $P = 5$ and shows the variation of the metric described above on $y$-axis as a function of the number of protected groups used by \textsc{UFairSC} and rank $R$ used by \textsc{URepSC (approx.)}, for various values of $N$ and $K$. We used the same values of parameters $p$, $q$, $r$, and $s$, as in Section \ref{chapter:fairness:section:d_reg_experiments}. The plots in Figure \ref{fig:sbm_comparison_unnorm} show a trade-off between clustering accuracy and representation awareness. One can choose an appropriate value of $R$ and use \textsc{URepSC (approx.)} to get good quality clusters with a high balance. Figure \ref{fig:sbm_comparison_norm} presents analogous results for \textsc{NRepSC (approx.)}. \begin{figure}[t] \centering \subfloat[][$K = 2$]{\includegraphics[width=0.48\textwidth]{Images/U_Trade_2}}% \hspace{0.5cm}\subfloat[][$K = 4$]{\includegraphics[width=0.48\textwidth]{Images/U_Trade_4}} \subfloat[][$K = 6$]{\includegraphics[width=0.48\textwidth]{Images/U_Trade_6}}% \hspace{0.5cm}\subfloat[][$K = 8$]{\includegraphics[width=0.48\textwidth]{Images/U_Trade_8}} \caption{Comparing \textsc{URepSC (approx.)} with \textsc{UFairSC} on FAO trade network.} \label{fig:real_data_comparison_unnorm} \end{figure} \begin{figure}[t] \centering \subfloat[][$K = 2$]{\includegraphics[width=0.48\textwidth]{Images/N_Trade_2}}% \hspace{0.5cm}\subfloat[][$K = 4$]{\includegraphics[width=0.48\textwidth]{Images/N_Trade_4}} \subfloat[][$K = 6$]{\includegraphics[width=0.48\textwidth]{Images/N_Trade_6}}% \hspace{0.5cm}\subfloat[][$K = 8$]{\includegraphics[width=0.48\textwidth]{Images/N_Trade_8}} \caption{Comparing \textsc{NRepSC (approx.)} with \textsc{NFairSC} on FAO trade network.} \label{fig:real_data_comparison_norm} \end{figure} \subsection{Experiments with a real-world network} \label{chapter:fairness:section:trade_experiments} For the final set of experiments, we use the FAO trade network \citep{DomenicoEtAl:2015:StructuralReducibilityOfMultilayerNetworks}, which is a multiplex network based on the data made available by the Food and Agriculture Organization (FAO) of the United Nations. It has $214$ nodes representing countries and $364$ layers corresponding to commodities like coffee, banana, barley, etc. An edge between two countries in a layer indicates the volume of the corresponding commodity traded between these countries. We convert the weighted graph in each layer to an unweighted graph by connecting every node with its five nearest neighbors. We then make all the edges undirected and use the first $182$ layers to construct the representation graph $\mathcal{R}$. Nodes in $\mathcal{R}$ are connected if they are linked in either of these layers. Similarly, the next $182$ layers are used to construct the similarity graph $\mathcal{G}$. Note that $\mathcal{R}$ constructed this way is not $d$-regular. The goal is to find clusters in $\mathcal{G}$ that satisfy Definition \ref{def:representation_constraint} with respect to $\mathcal{R}$. To motivate this further, note that clusters based only on $\mathcal{G}$ only consider the trade of commodities $183$--$364$. However, countries also have other trade relations in $\mathcal{R}$, leading to shared economic interests. Assume that the members of each cluster would jointly formulate the economic policies for that cluster. However, the policies made in one cluster affect everyone, even if they are not part of the cluster, as they all share a global market. This incentivizes the countries to influence the economic policies of all the clusters. Being representation aware with respect to $\mathcal{R}$ entails that each country has members in other clusters with shared interests. This enables a country to indirectly shape the policies of other clusters. As before, we use the low-rank approximation for the representation graph in \textsc{URepSC (approx.)} and \textsc{NRepSC (approx.)}. Figure \ref{fig:real_data_comparison_unnorm} compares \textsc{URepSC (approx.)} with \textsc{UFairSC}, and has the same semantics as Figure \ref{fig:sbm_comparison_unnorm}. Different plots in Figure \ref{fig:real_data_comparison_unnorm} correspond to different choices of $K$. \textsc{URepSC (approx.)} achieves a higher ratio of average balance to ratio-cut. In practice, a user would choose $R$ by assessing the relative importance of a quality metric like ratio-cut and representation metric like average balance. Figure \ref{fig:real_data_comparison_norm} presents analogous results for \textsc{NRepSC (approx.)}. \section{Conclusion} \label{section:conclusion} The primary focus of this work has been on studying the consistency of constrained spectral clustering under an individual-level representation constraint. The proposed representation constraint naturally generalizes similar population-level constraints \citep{ChierichettiEtAl:2017:FairClusteringThroughFairlets} by using auxiliary information encoded in a representation graph $\mathcal{R}$. We showed that the constraint can be expressed as a linear expression that when added to the optimization problem solved by spectral clustering results in the representation-aware variants of the algorithm. An interesting consequence of this problem is a variant of the stochastic block model that plants the properties of $\mathcal{R}$ in a similarity graph in addition to the given clusters to provide a hard problem instance to our algorithms. Under this model, we derive a high-probability upper bound on the number of mistakes made by the algorithms and establish conditions under which they are weakly consistent. To the best of our knowledge, these are the first consistency results for constrained spectral clustering under individual-level constraints. Next, we make a few additional remarks. \paragraph*{The $d$-regularity assumption} The $d$-regularity assumption on $\mathcal{R}$ ensures the representation-awareness of the ground-truth clusters in our analysis. Note that the representation graph that recovers the statistical-level constraint is also $d$-regular (see Appendix \ref{appendix:constraint}), hence our analysis strictly generalizes the previously known results. It would be interesting to study the performance of our algorithms under weaker assumptions on $\mathcal{R}$. One can also use a similar strategy as ours to modify more expressive variants of the stochastic block model, like the degree-corrected SBM \citep{KarrerNewman:2011:StochasticBlockmodelsAndCommunityStructureInNetworks}, to establish the consistency of the algorithms on more realistic similarity graphs. \paragraph*{Computational complexity} Our current approach involves finding the null space of a $N \times N$ matrix. This operation has $O(N^3)$ complexity. Existing methods for speeding up the standard spectral clustering algorithm focus on making the eigen-decomposition and/or the $k$-means step faster (see \citet{TremblayEtAl:2016:CompressiveSpectralClustering} and the references within). However, even with these modifications, the null space computation would still be the computationally dominant step. \citet{XuEtAl:2009:FastNormalizedCutWithLinearConstraints} proposed an efficient algorithm for solving the normalized cut problem under a linear constraint. However, their algorithm assumes that $K = 2$. Developing similar algorithms for general values of $K$ and exploring their theoretical guarantees will enable the application domains that involve very large graphs to utilise our ideas. Other possible extensions of our work include similar algorithms for weighted similarity graphs, overlapping clusters, and other types of graphs such as hypergraphs. This paper provides the first step towards consistency analysis of spectral clustering under individual-level constraints. \begin{appendix} \section{Representation constraint: Additional details} \label{appendix:constraint} In this section, we make two additional remarks about the properties of the proposed constraint, both in the context of fairness. \paragraph*{Statistical fairness as a special case} Recall that our constraint specifies an individual fairness notion. Contrast this with several existing approaches that assign each node to one of the $P$ \textit{protected groups} $\mathcal{P}_1, \dots, \mathcal{P}_P \subseteq \mathcal{V}$ \citep{ChierichettiEtAl:2017:FairClusteringThroughFairlets}, and require these protected groups to have a proportional representation in all clusters, i.e., \begin{equation*} \frac{\abs{\mathcal{P}_i \cap \mathcal{C}_j}}{\abs{\mathcal{C}_j}} = \frac{\abs{\mathcal{P}_i}}{N}, \,\, \forall i \in [P],\,\, j \in [K]. \end{equation*} This is an example of \textit{statistical fairness}. In Example \ref{example:statistical_vs_individual_fairness}, we argued that statistical fairness may not be enough in some cases. We now show that the constraint in Definition \ref{def:representation_constraint} is equivalent to a statistical fairness notion for an appropriately constructed representation graph $\mathcal{R}$ from the given protected groups $\mathcal{P}_1, \dots, \mathcal{P}_P$. Namely, let $\mathcal{R}$ be such that $R_{ij} = 1$ if and only if $v_i$ and $v_j$ belong to the same protected group. In this case, it is easy to verify that the constraint in Definition \ref{def:representation_constraint} reduces to the statistical fairness criterion given above. In general, for other configurations of the representation graph, we strictly generalize the statistical fairness notion. We also strictly generalize the approach presented in \citet{KleindessnerEtAl:2019:GuaranteesForSpectralClusteringWithFairnessConstraints}, where the authors use spectral clustering to produce statistically fair clusters. Also noteworthy is the assumption made by statistical fairness, namely that every pair of vertices in a protected group can represent each others' interests ($R_{ij} = 1 \Leftrightarrow v_i$ and $v_j$ are in the same protected group), or they are very similar with respect to some sensitive attributes. This assumption becomes unreasonable as protected groups grow in size. \paragraph*{Sensitive attributes and protected groups} Viewed as a fairness notion, the proposed constraint only requires a representation graph $\mathcal{R}$. It has two advantages over existing fairness criteria: \textbf{(i)} it does not require observable sensitive attributes (such as age, gender, and sexual orientation), and \textbf{(ii)} even if sensitive attributes are provided, one need not specify the number of protected groups or explicitly compute them. This ensures data privacy and helps against individual profiling. Our constraint only requires access to the representation graph $\mathcal{R}$. This graph can either be directly elicited from the individuals or derived as a function of several sensitive attributes. In either case, once $\mathcal{R}$ is available, we no longer need to expose any sensitive attributes to the clustering algorithm. For example, individuals in $\mathcal{R}$ may be connected if their age difference is less than five years and if they went to the same school. Crucially, the sensitive attributes used to construct $\mathcal{R}$ may be numerical, binary, categorical, etc. \end{appendix} \bibliographystyle{plainnat}
{'timestamp': '2022-03-07T02:03:04', 'yymm': '2203', 'arxiv_id': '2203.02005', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.02005'}
arxiv
\section{Todo for revision} \section{Introduction} Zero-shot cross-lingual transfer is the ability of a model to learn from labeled data in one language and transfer the learning to another language without any labeled data. Transformer ~\cite{NIPS2017_3f5ee243} based multilingual models pre-trained on unlabeled data from multiple languages are the state-of-the-art means for cross-lingual transfer \cite{ruder-etal-2019-transfer,Devlin2019}. While pre-training based cross-lingual transfer holds great promise for low web-resource languages (LRLs), such techniques are found to be more effective for transfer within high web-resource languages (HRLs) \cite{wu-dredze-2020-languages}. Vocabulary generation is an important step in multilingual model training, where vocabulary size directly impacts model capacity. Usually, the vocabulary is generated from a union of HRL{} and LRL{} data. This often results in under-allocation of vocabulary bandwidth to LRL{}s, as LRL{} data is significantly smaller in size compared to HRL{}. This under-allocation of model capacity results in lower LRL{} performance \cite{wu-dredze-2020-languages}, as mentioned previously. In response, prior research has explored development of region-specific models \cite{antoun2020arabert,khanuja2021muril}, generating vocabulary specific to language clusters \cite{chung-etal-2020-improving}, and exploring relatedness among languages to build better LMs for LRL{}s \cite{khemchandani-etal-2021-exploiting}. However, none of these methods have utilized relatedness among languages for better vocabulary generation during multilingual pre-training. \begin{table}[!t] \centering \resizebox{\linewidth}{!}{ \begin{tabular}{|p{2.5cm}|p{6cm}|} \hline Language and Token frequencies & English: {\color{red}Universit}y (10), versity (6); German: {\color{red}Universit}aten (2); Dutch: {\color{red}Universit}eit (1); Western Frisian: {\color{red}Universit}eiten (1) \\ \hline Starting Vocab & Uni, versit, U,n,i,v,e,r,s,i,t,y,a \\ \hline BPE Vocab & versity, Uni, versit, U,n,i,v,e,r,s,i,t,y,a \\ \hline \textsc{OBPE}{} Vocab & {\color{red}Universit}, Uni, versit, U,n,i,v,e,r,s,i,t,y,a \\ \hline \end{tabular} } \caption{\label{tab:overlap-example}First row shows lexically overlapping tokens in four different languages with their corpus frequencies (in brackets), with English (En) as the High Web-Resource Language (HRL{}). From a starting vocabulary shown in the second row, BPE merges tokens based on greater overall frequency, adding new vocabulary item \textit{versity} as it has the highest overall frequency (16). \textsc{OBPE}{} instead adds \textit{Universit} since it also rewards cross-lingual overlap, even though \textit{Universit} has lower overall frequency (15). } \end{table} In this paper, we hypothesize that exploiting language relatedness can result in an overall more effective vocabulary, which is also better representative of LRLs. Closely related languages (e.g., languages belonging to a single family) have common origins for words with similar meanings. We show some examples across three different families of related languages in Table~\ref{tab:overlap-exampleAll}. Morphological inflections of the root word lead to lexically overlapping tokens across languages. Learning representations for such subwords in lexically overlapping words shared across HRL and its related LRLs can enable better transfer of supervision from HRL to LRLs. During Masked Language Modelling (MLM) pretraining \cite{Devlin2019}, the shared tokens can serve as anchors in learning contextual representations of neighboring tokens. However, choosing the correct granularity of sharing automatically is tricky. On one extreme, we can choose a vocabulary which favours longer units frequent in HRL without regard for sharing, thereby leading to better semantic representation of the tokens but no cross-lingual transfer. On the other extreme, we can choose character-level vocabulary \cite{ma-etal-2020-charbert}, where every token is shared across languages but have no semantic significance. % Given text from a mix of high and low Web-resource languages (HRL and LRL, respectively), Byte Pair Encoding (BPE)~\cite{sennrich-etal-2016-neural} and its variants like Wordpiece \cite{schuster2012japanese} and Sentencepiece \cite{kudo-richardson-2018-sentencepiece} prefer frequent tokens, most of those from the HRLs. This would cause most long HRL tokens to get included, leaving only a limited budget of short tokens for the LRL. Any sub-token level overlap between HRL and LRL could get lost in this process. In a zero-shot setting, since available supervision is HRL based, this creates a bottleneck when transferring supervision from HRL to LRLs. Oversampling LRLs is a common strategy to offset this imbalance but that hurts HRL performance as shown in \cite{conneau-etal-2020-unsupervised}. In this paper, we propose Overlap BPE (\textsc{OBPE}{}). \textsc{OBPE}{} chooses a vocabulary % by giving token overlap among HRL and LRLs a primary consideration. \textsc{OBPE}{} prefers vocabulary units which are shared across multiple languages, while also encoding the input corpora compactly. Thus, \textsc{OBPE}{} tries to balance the trade-off between cross-lingual subword sharing and the need for robust representation of individual languages in the vocabulary. This results in a more balanced vocabulary, resulting in improved performance for LRLs without hurting HRL accuracy. Table~\ref{tab:overlap-example} shows an example to highlight this difference between \textsc{OBPE}\ and BPE. Recently ~\citet{K2020Cross-Lingual,conneau-etal-2020-emerging} concluded that token overlap is unimportant for cross-lingual transfer. However, they studied language pairs where either both languages had a large corpus, or where the languages were not sufficiently related. We focus on related languages within a family and observe drastic drop in zero-shot accuracy when we synthetically reduce the overlap to zero (58\% F1 drops to 17\% for NER, 71\% drops to 30\% for text classification). This paper offers the following contributions \begin{itemize} \item We present \textsc{OBPE}{}, a simple yet effective modification to the popular BPE algorithm to promote overlap between LRLs and a related HRL during vocabulary generation. \textsc{OBPE}{} uses a generalized mean based formulation to quantify token overlap among languages. \item We evaluate \textsc{OBPE}{} on twelve languages across three related families, and show consistent improvement in zero-shot transfer over state-of-the art baselines on four NLP tasks. We analyse the reasons behind the gains obtained by OBPE and show that OBPE increases the percentage of LRL tokens in the vocabulary without reducing HRL tokens. This is unlike over-sampling strategies where increasing one reduces the other. \item Through controlled experiments on the amount of token overlap on a related HRL-LRL pair, we show that token overlap is extremely important in the low-resource, related language setting. Recent literature which conclude that token overlap is unimportant may have overlooked this important setting. \end{itemize} The source code for our experiments is available at \href{https://github.com/Vaidehi99/OBPE}{https://github.com/Vaidehi99/OBPE}. \section{Related Work} Transformer-based multilingual language models such as mBERT \cite{devlin-etal-2019-bert} and XLM-R \cite{conneau-etal-2020-unsupervised} are now established as the de-facto method for zero-shot cross-lingual transferability, and thus hold promise for low resource domains. However, recent studies have indicated that even the current state-of-the-art models such as XLM-R (Large) do not yield reasonable transfer performance across low resource target languages with limited data~\cite{wu-dredze-2020-languages}. This has led to a surge of interest in enhancing cross-lingual transfer of multilingual models to the low-resource setting. We categorize existing work based on the stage of the pre-training pipeline where it is relevant: \noindent{\bf Input Data} In the data creation stage, \citet{conneau-etal-2020-unsupervised} propose over-sampling of LRL documents to improve LRL representation in the vocabulary and pre-training steps. \citet{khemchandani-etal-2021-exploiting} specifically target related languages and propose transliteration of LRL documents to the script of related HRL for greater lexical overlap. We deploy both these tricks in this paper. \noindent{\bf Tokenization} \citet{rust-etal-2021-good} study that even the tokenization step could have a crucial impact on performance accrued to each language in a multilingual models. They propose the use of dedicated tokenizer for each language instead of the automatically generated multilingual mBERT tokenizer. However, they continue to use the default mBERT vocabulary generator. \noindent{\bf Vocabulary Generation} \citet{sennrich-etal-2016-neural} highlighted the importance of subword tokens in the vocabulary and proposed use of the BPE algorithm~\cite{gage1994new} for efficiently growing such a vocabulary incrementally. Variants like Wordpiece \cite{schuster2012japanese} and Sentencepiece \cite{kudo-richardson-2018-sentencepiece} either build on top of BPE or follow a very similar process. \citet{kudo-2018-subword} is a variant method that chooses tokens based on unigram LM score. We obtained better results with BPE and continued with that. All these BPE variants incrementally add subwords based on overall frequency in the combined corpus, and they all ignore language boundaries. \citet{chung-etal-2020-improving} observed that such a combined approach could under-represent several languages, and proposed instead to separately create vocabularies for clusters of related languages and take a union of each cluster-specific vocabulary. However, within each cluster they continue to use the default vocabulary generator. Our approach can be used as a drop-in replacement to further enhance the quality of the cluster-specific vocabulary that they obtain. \citet{wang2018multilingual,gao-etal-2020-improving} propose a soft-decoupled encoding approach for exploiting subword overlap between LRLs and HRLs. However, their focus is NMT models and does not easily integrate in existing multilingual models such as mBERT. \cite{maronikolakis-etal-2021-wine-v} targets tokenization compatibility based purely on vocabulary size and does not focus on choosing the tokens that go in the vocabulary. \noindent{\bf Pre-Training and Adaptation} Several previous works have proposed to include additional alignment loss between parallel~\cite{DBLP:conf/iclr/CaoKK20} or pseudo-parallel~\cite{khemchandani-etal-2021-exploiting} sentences to co-embed HRLs and LRLs. Another approach is to design language-specific Adapter layers~\cite{pfeiffer-etal-2020-adapterhub, pfeiffer-etal-2020-mad,artetxe-etal-2020-cross,ustun-etal-2020-udapter} that can be easily fine-tuned for each new language. ~\citet{pfeiffer-etal-2021-unks} leverages the pre-trained embeddings of lexically overlapping tokens between the vocabulary of pre-trained model and that of unseen target language to initialize the corresponding embeddings of target language. However, they did not attempt to increase the fraction of such tokens in the vocabulary. We are not aware of any prior work that explicitly promotes overlapping tokens between LRLs and HRLs in the vocabulary of multilingual models. \section{Overlap-based Vocabulary Generation} We are given monolingual data ${D_{1},...,D_n}$ in a set of $n$ languages $\mathcal{L}=\{{L_{1},...,L_n}\}$ and a vocabulary budget $\text{V}$. Our goal is to generate a vocabulary $\mathcal{V}$ that when used to tokenize each $D_i$ in a multilingual model would provide cross-lingual transfer to LRL s from related HRL s. We use $\cL_\text{\lrl}$ to denote the subset of the $n$ languages that are low-resource, the remaining languages $\mathcal{L}-\cL_\text{\lrl}$ are denoted as the set $\cL_\text{\hrl}$ of high resource languages. Existing methods of vocabulary creation start with a union $D$ of monolingual data ${D_{1},...,D_n}$, and choose a vocabulary $\mathcal{V}$ that most compactly represents $D$. We first present an overview of BPE, a popular algorithm for vocabulary generation \subsection{Background: BPE} Byte Pair Encoding (BPE) \cite{gage1994new} is a simple data compression technique that chooses a vocabulary $\mathcal{V}$ that minimizes total size of $D=\cup_i D_i$ when encoded using $\mathcal{V}$. \begin{equation} \label{eq:bpe:goal} \mathcal{V} = \argmin\limits_{S: |S|=\text{V}}\sum_{i=1}^n \lvert \text{encode}(D_{i},S) \rvert \end{equation} The size of the encoding $\lvert \text{encode}(D_{i},S) \rvert$ can be alternately expressed as the sum of frequency of tokens in $S$ when $D_i$ is tokenized using $S$. This motivates the following efficient greedy algorithm to implement the above optimization~\cite{sennrich-etal-2016-neural}. Let $f_{ki}$ denote the frequency of a candidate token $k$ in the corpus $D_i$ of language $L_i$. The BPE algorithm grows $\mathcal{V}$ incrementally. Initially, $\mathcal{V}$ comprises of characters in $D$. Then, until $|\mathcal{V}| \le \text{V}$, it chooses the token $k$ obtained by merging two existing tokens in $\mathcal{V}$ for which the frequency in $D$ is maximum. \vspace{-0.3cm} \begin{equation} \label{eq:bpe:step} \mathcal{V} = \mathcal{V} \cup arg\,max_{k=[u,v]:u,v\in \mathcal{V}} \sum_i f_{ki} \end{equation} A limitation of BPE on multilingual data is that tokens that appear largely in low-resource $D_i$ may not get added to $\mathcal{V}$, leading to sentences in $L_i$ being over-tokenized. For a low resource language, the available monolingual data $D_i$ is often orders of magnitude smaller than another high-resource language. Models like mBERT and XLM-R address this limitation by over-sampling documents of low-resource languages. However, over-sampling LRL s might compromise learned representation of HRL s where task-specific labeled data is available. We propose an alternative strategy of vocabulary generation called \textsc{OBPE}{} that seeks to maximize transfer from HRL\ to LRL. \begin{algorithm}[t] \begin{small} \caption{Overlap based BPE (\textsc{OBPE}{})} \begin{algorithmic} \For{$i \in \{1,2,...,n\}$} \State Split words in $D_{i}$ into characters $C_{i}$ with a special marker after every word \EndFor\\ $\mathcal{V}$ = $\cup_{i=1}^n C_{i}$ \While{$\lvert\mathcal{V}\rvert < \text{V}$} \State Update token and pair frequency on $\{D_i\},\mathcal{V}$ \State Add to $\mathcal{V}$ token $k$ formed by merging pairs $u,v \in \mathcal{V}$ \hspace{1cm}with the largest value of \vspace{-0.5cm} \begin{equation*} (1-\alpha)\sum_{j}f_{kj} + \alpha\sum\limits_{i\in \cL_\text{\lrl}{}}\max\limits_{h \in \cL_\text{\hrl}{}}\left(\frac{f^p_{ki} + f^p_{kh}}{2}\right)^{\frac{1}{p}} \end{equation*} \EndWhile \end{algorithmic} \end{small} \end{algorithm} \subsection{Our Proposal: OBPE} The key idea in OBPE{} is to maximize the overlap between an LRL\ and a closely related HRL\ while simultaneously encoding the input corpora compactly as in BPE. When labeled data $D^T_h$ for a task $T$ is available in an HRL\ $L_h$, then a multilingual model fine-tuned with $D^T_h$ is likely to transfer better to a related LRL\ $L_i$ when $L_i$ and $L_h$ share several tokens in common. Thus, the objective that OBPE\ seeks to optimize when creating a vocabulary is: \begin{equation} \begin{aligned} \label{eq:obpe:goal} \mathcal{V} = & \argmin \limits_{S: |S|=\text{V}} \left[ (1-\alpha) \sum_{i=1}^n \lvert \text{encode}(D_{i},S) \rvert \right. \\ &-\left. \alpha\sum\limits_{i\in \cL_\text{\lrl}}\max\limits_{j\in \cL_\text{\hrl}}\text{overlap}(L_{i}, L_{j}, S) \right] \end{aligned} \end{equation} where $0 \le \alpha \le 1$ determines importance of the two terms. The first term in the objective compactly represents the total corpus, as in BPE's (Eq~\eqref{eq:bpe:goal}). The second term additionally biases towards vocabulary with greater overlap of each LRL to one HRL\ where we expect task-specific labeled data to be present. There are several ways in which we can measure the overlap between two languages with respect to a current vocabulary. First, we encode each of $D_i$ and $D_j$ using the vocabulary $S$, which then yields a multiset of tokens in each corpus. Inspired by the literature on fair allocation~\cite{barman2021universal}, we explore a continuously parameterized function that expresses overlap between two languages' encoding as a generalized mean function as follows: \begin{equation} \text{overlap}(L_{i}, L_{h}, S) = \sum_{k \in S} \left(\frac{f_{ki}^{p} + f_{kh}^{p}}{2}\right)^\frac{1}{p},~~p \le 1 \label{Bilingual overlap defn} \end{equation} where $f_{ki}$ denotes the frequency of token $k$ when $D_i$ is encoded with $S$. For different values of $p$, we get different tradeoffs between fairness to each language and overall goodness. When $p=-\infty$, generalized mean reduces to the minimum function, and we get the most egalitarian allocation. However, this ignores the larger of the two frequencies. When $p=1$, we get a simple average which is what the first term in Equation~\eqref{eq:obpe:goal} already covers. For $p=0,-1$, we get the geometric and harmonic means respectively. Due to smaller size of LRL monolingual data, the frequency of a token which is shared across languages is likely to be much higher in HRL monolingual data as compared to that in LRL monolingual data, Hence, setting $p$ to large negative values will increase the weight given to LRLs and thus increase overlap. We will present an exploration of the effect of $p$ on zero-shot transfer in the experiment section. \begin{table*}[h] \begin{small} \centering \begin{tabular}{|l|l|l|r|r|} \hline Family & HRL & LRLs & \multicolumn{2}{|c|}{Number of HRL Docs} \\ & & & {\sc balanced} & {\sc skewed} \\ \hline West Germanic & English (en) & German (de), Dutch (nl), Western\ Frisian (fy) & 0.16M & 1.00M \\ \hline Romance & French (fr) & Spanish (es), Portuguese (pt), Italian (it) & 0.16M & 0.50M \\ \hline Indo-Aryan & Hindi (hi) & Marathi (mr), Punjabi (pa), Gujarati (gu) & 0.16M & 0.16M \\ \hline \end{tabular} \caption{Twelve Languages \emph{simulated} as HRLs and LRLs across with two different corpus distribution: {\sc balanced}\ and {\sc skewed}. Number of documents in languages simulated as LRLs is 20K.} \label{tab:langs} \end{small} \end{table*} The greedy version of the above objective that controls the candidate vocabulary item to be inducted in each iteration of OBPE is thus: \begin{equation} \label{eq:obpe:step} \begin{split} \mathcal{V} = \mathcal{V} \cup arg\,max_{k=[u,v]:u,v\in \mathcal{V}} (1-\alpha)\sum_{j}f_{kj} \\ + \alpha\sum_{i\in \cL_\text{\lrl}}\max_{h \in \cL_\text{\hrl}}\left(\frac{f_{ki}^{p} + f_{kh}^{p}}{2}\right)^\frac{1}{p} \end{split} \end{equation} The data structure maintained by BPE to efficiently conduct such merges can be applied with little changes to the OBPE algorithm. The only difference is that we need to separately maintain the frequency in each language in addition to overall frequency. Since the time and resources used to create the vocabulary is significantly smaller than the model pre-training time, this additional overhead to the pre-training step is negligible. \section{Experiments} \label{sec:expts} We evaluate by measuring the efficacy of zero-shot transfer from the HRL\ on four different tasks: named entity recognition (NER), part of speech tagging (POS), text classification(TC), and Cross-lingual Natural Language Inference (XNLI). Through our experiments, we evaluate the following questions: \begin{enumerate} \item Is OBPE more effective than BPE for zero-shot transfer? (\refsec{sec:effective-obpe}) \item What is the effect of token overlap on overall accuracy? (\refsec{sec:analysis}) \item How does increased LRL representation in the vocabulary impact accuracy? (\refsec{sec:samp}) \end{enumerate} We report additional ablation and analysis experiments in \refsec{sec:ablation}. \noindent \subsection{Setup} {\bf Pre-training Data and Languages} As our pre-training dataset $\{D_i\}$, we use the Wikipedia dumps of all the languages as used in mBERT. We pre-train with 12 languages grouped into three families of four related languages as shown in Table~\ref{tab:langs}. In each family, we simulate as HRL the most populous language, and call the remaining as LRLs. The number of documents for languages simulated as LRLs is set to 20K. For the HRLs, we consider two corpus distributions: \begin{itemize} \item {\sc balanced}\ : all three HRLs get 160K documents each \item {\sc skewed}\ : English gets one million, French half million, and Hindi 160K documents \end{itemize} We evaluate twelve-language models in each of these settings, and present results for separate four language models per family in Table \ref{tab:4_lang} in the Appendix. For the Indo-Aryan languages set, the monolingual data of Punjabi and Gujarati is transliterated to Devanagari, the script of Hindi and Marathi. We use libindic’s indictrans library ~\cite{Bhat:2014:ISS:2824864.2824872} for transliteration. Languages in the other two sets do not require transliteration as they have a common script. Thus, all four languages in each set are in the same script so their lexical overlap can be leveraged. \begin{table}[t] \centering \resizebox{\linewidth}{!}{ \begin{tabular}{|l|l|r|r|r|r|} \hline \multirow{3}{*}{Dataset split} & Lang & \multicolumn{4}{|c|}{Number of sentences} \\ \hline ~ & ~ & NER & POS & TC & XNLI \\ \hline \multirow{3}{*}{Train:HRL} & hi & 5.0 & 53.0 & 25.0 & ~ \\ & en & 10.5 & 18.0 & 10.0 & 393.0 \\ & fr & 7.5 & 16.5 & 10.0 & 393.0 \\ \hline \multirow{3}{*}{Validation:HRL} & hi & 1.0 & 3.0 & 4.0 & \\ ~ & en & 6.0 & 4.0 & 10.0 & 2.5 \\ ~ & fr & 4.0 & 2.0 & 10.0 & 2.5 \\ \hline \multirow{3}{*}{Test data} & hi & 0.2 & 12.0 & 7.0 & ~ \\ ~ & en & 6.0 & 4.6 & 10.0 & 5.0 \\ ~ & fr & 4.0 & 4.1 & 10 & 5.0 \\ ~ & mr & 0.8 & 9.5 & 6.5 & - \\ ~ & pa & 0.2 & 13.4 & 7.9 & - \\ ~ & gu & 0.3 & 14.0 & 8.0 & - \\ ~ & de & 12.0 & 19.3 & 10.0 & 5.0 \\ ~ & nl & 8.0 & 1.0 & - & - \\ ~ & fy & 0.8 & - & - & - \\ ~ & es & 5.0 & 3.1 & 10.0 & 5.0 \\ ~ & pt & 4.0 & 2.5 & - & - \\ ~ & it & 5.0 & 3.4 & - & - \\ \hline \end{tabular} } \caption{\label{tab:task:stats}Task-specific data sizes. Number of sentences in thousands.} \end{table} \noindent {\bf Pre-Training Details} To ensure that LRLs are not under-represented, we over-sample using exponentially smoothed weighting similar to multilingual BERT \cite{devlin-etal-2019-bert} with exponentiation factor 0.7. We perform MLM pretraining on a BERT base model with 110M parameters from scratch. We generate a vocabulary of size of 30k. We chose batch size as 2048, learning rate as 3e-5 and maximum sequence length as 128. Pre-training of BERT was done with duplication factor 5 for for 64k iterations for HRLs. For all LRLs, duplication factor was 20 and training was done for 24K iterations. MLM pre-training was done on Google v3-8 Cloud TPUs where 10K iterations required 2.1 TPU hours. \begin{table*}[!ht] \centering \begin{adjustbox}{max width=1.0\textwidth,center} \begin{tabular}{|l|l| l|l| l|l |l|l |l|} \hline \multirow{2}{*}{Method} & \multicolumn{4}{c|}{LRL Performance ($\uparrow$)} &\multicolumn{4}{c|}{HRL Performance ($\uparrow$)} \\ & NER & TC & XNLI & POS & NER & TC & XNLI & POS \\ \hline BPE \cite{sennrich-etal-2016-neural} & 64.48 & 65.52 & 52.07 & 84.64 & 83.26 & \textbf{82.07} & 62.71 & \textbf{95.20} \\ BPE-dp \cite{provilkov-etal-2020-bpe} & 63.92 & 64.15 & 52.66 & 84.75 & 81.73 & 81.07 & 63.74 & 94.61 \\ CV \cite{chung-etal-2020-improving} & 59.58 & 61.91 & 49.30 & 81.68 & 81.15 & 80.93& 64.51 & 94.47 \\ TokComp \cite{maronikolakis-etal-2021-wine-v} & 63.79 & 65.77 & 53.94 & \textbf{85.49} & 82.43 & 80.93& 66.10 & 94.86 \\ {\textsc{OBPE}{} (This paper)} & \textbf{65.72}& \textbf{68.02} & \textbf{54.03} & 85.26 & \textbf{83.98} & 81.91 & \textbf{66.27} & 95.09\\ \hline \end{tabular} \end{adjustbox} \caption{Zero-shot performance of models in the Balanced-12 setting trained on 9 LRL and 3 HRL languages. Performance is measured on four tasks: NER (F1), Text Classification (Accuracy), POS (Accuracy), and XNLI (Accuracy). For all metrics, higher is better ($\uparrow$). Zero-shot transfer to LRL improves without hurting HRL\ accuracy. P-value of paired-t-test between BPE and OBPE LRL gains has values $0.01,0.04, 0.02,0.01$ for each of the 4 tasks establishing statistical significance. Detailed results for each language is pesented in Table~\ref{tab:varying_p}. \refsec{sec:effective-obpe} has further discussion.} \label{tab:overall} \end{table*} \begin{table*}[htb] \centering \begin{adjustbox}{max width=1.1\textwidth,center} \begin{tabular}{|l|l| l|l| l|l |l|l |l|} \hline \multirow{2}{*}{Method} & \multicolumn{4}{c|}{LRL Performance ($\uparrow$)} &\multicolumn{4}{c|}{HRL Performance ($\uparrow$)} \\ & NER & TC & XNLI & POS & NER & TC & XNLI & POS \\ \hline BPE \cite{sennrich-etal-2016-neural} & 52.91 & 51.68 & 48.57 & 74.79 & 81.78 & 80.04 & 64.96 & 95.03 \\ CV \cite{chung-etal-2020-improving} & 52.73 & 54.40 & 44.28 & 76.70 & 79.84 & 77.74 & 57.18 & 94.60 \\ {\textsc{OBPE}{}\ (This paper)} & {\bf 55.09} & {\bf 55.37} & {\bf 50.01} & {\bf 75.05} & {\bf 82.94} & {\bf 80.31} & {\bf 65.57} & {\bf 95.09}\\ \hline \end{tabular} \end{adjustbox} \caption{Zero-shot performance of models in the Skewed-12 setting of Table~\ref{tab:langs} on same four tasks as Table~\ref{tab:overall}. \textsc{OBPE}{} shows gains here too. Detailed numbers in Table~\ref{tab:12_lang:skew} of Supplementary. \refsec{sec:effective-obpe} has further discussion.} \label{tab:overall:skew} \end{table*} \noindent {\bf Task-specific Data} We evaluate on four down-stream tasks: (1) NER: data from WikiANN \cite{pan-etal-2017-cross} and XTREME \cite{pmlr-v119-hu20b}, (2) XNLI: data from \cite{conneau-etal-2018-xnli}, (3) POS: data from XTREME \cite{pmlr-v119-hu20b} and TDIL\footnote{Technology Development for Indian Languages (TDIL), https://www.tdil-dc.in}, and (4) Text Classification (TC): data from TDIL and XGLUE \cite{liang-etal-2020-xglue}. We downsampled the TDIL data for each language to make them class-balanced. The POS tagset for Indo-Aryan languages used was the BIS Tagset \cite{sardesai-etal-2012-bis}. Table~\ref{tab:task:stats} presents a summary. The test set to compute LRL perplexity was formed by sampling 10K sentences from Samanantar corpus\cite{ramesh2021samanantar} for Indic languages and from Tatoeba corpus\footnote{Tatoeba , https://tatoeba.org} for other languages. The perplexity reported for a language is the average of sentence perplexity over all the sentences sampled from that language's corpus.\\ \noindent {\bf Task-specific fine-tuning details} We perform task-specific fine-tuning of pre-trained BERT on the task-specific training data of HRL\ and evaluate on all languages in the same family. Here we used learning-rate 2e-5 and batch size 32, with training duration as 16 epochs for NER, 8 epochs for POS and 3200 iterations for Text Classification and XNLI. The models were evaluated on a separate validation dataset of the HRL and the model with the minimum validation loss, maximum F1-score, accuracy and minimum validation loss was selected for final evaluation for XNLI, NER, POS and Text Classification respectively. All fine-tuning experiments were performed on Google Colaboratory. The results reported for all the experiments are an average of 3 independent runs. \subsection{Effectiveness of \textsc{OBPE}{}} \label{sec:effective-obpe} We evaluate the impact of \textsc{OBPE}{} on improving zero-shot transfer from HRLs to LRLs within the same family across four different tasks. We compare with four existing methods that represent different methods of vocabulary creation and allocation of budget across languages: \noindent {\bf Methods compared} \begin{enumerate} \item \textbf{BPE} \cite{sennrich-etal-2016-neural}, the existing default method of vocabulary generation. \item \textbf{Clustered vocabulary (CV)} \cite{chung-etal-2020-improving} Since the paper uses a SentencePiece unigram for vocabulary, we followed the same approach for this comparison. We allocate each family equal number of vocabulary tokens which is \text{V}/3. \item \textbf{BPE-dropout (BPE-dp)} \cite{provilkov-etal-2020-bpe} uses the vocabulary generated by BPE but tokenizes the text using a dropout rate of 0.1. This allows the training of tokens that are subsumed by larger tokens in the vocabulary. \item \textbf{Compatibility of Tokenizations (TokComp)} \cite{maronikolakis-etal-2021-wine-v} uses a method to select meaningful vocabulary sizes in an automated manner for all language using compression rates. Since their best performances are found, when the compression rates are similar, we choose a size for each language corresponding to compression rate of 0.5. The tokenizer used in this method is WordPiece. . \item \textbf{\textsc{OBPE}{}} (Ours) with default $\alpha=0.5, p = -\infty$. We also do ablation on these. \end{enumerate} In Table~\ref{tab:overall} we observe that across all four tasks, zero-shot LRL accuracy improves compared to BPE. For example, the average accuracy on XNLI for the LRL languages improves from 55.6 to 58.1 just by changing the set of tokens in the vocabulary. These gains are obtained without compromising HRL performance on the tasks. The Clustered Vocabulary (CV) approach is much worse than BPE. These experiments are on the Balanced-12 model. In the supplementary section, we report the results on the Skewed-12 (Table~\ref{tab:overall:skew}) and Balanced-4 models (Table~\ref{tab:4_lang}) and show similar gains even with these models. In this table, we averaged the gains over nine LRLs, and in the Supplementary Table~\ref{tab:varying_p} we show consistent gains for individual languages. In addition to improving zero-shot transfer from HRLs to LRLs on downstream tasks, OBPE\ also leads to better intrinsic representation of LRLs. We validate that by measuring the pseudo-perplexity~\cite{salazar-etal-2020-masked} of a test set of LRL sentences. We find that average perplexity of LRL sentences drops by 2.6\% when we go from the BPE to OBPE vocabulary. More details on this experiment appear in Figure~\ref{fig:ppl}. \begin{figure}[t] \centering \includegraphics[scale =0.32]{PPL.pdf} \caption{Percentage reduction in Pseudo perplexity~\cite{salazar-etal-2020-masked} for different LRLs as we go from BPE to OBPE\ vocabulary. (Section \ref{sec:effective-obpe})} \label{fig:ppl} \end{figure} \input{samplegraph} In order to investigate the reasons behind the OBPE gains, we first inspected the percentage of tokens in the vocabulary that belong to LRLs, HRLs, and in their overlap. We find that with OBPE both LRL tokens and overlapping tokens increase. Either of these could have led to the observed gains. We analyze the effect of each of these factors in the following two sections. \subsection{Effect of Token Overlap} \label{sec:analysis} \begin{table}[!ht] \begin{small} \centering \begin{tabular}{|l|c|c|} \hline ~ &\multicolumn{2}{c|}{en-es} \\ \hline ~ & \multicolumn{1}{c|}{High (es: 1 GB)} & \multicolumn{1}{c|}{Low: (es: 20K)} \\ \hline NER & -1.4 & -11.7 \\ \hline XNLI & 0.7 & -1.3 \\ \hline ~ &\multicolumn{2}{c|}{hi-mr} \\ \hline ~ & \multicolumn{1}{c|}{High (mr: 110K)} & \multicolumn{1}{c|}{Low (mr: 20K)} \\ \hline NER & -12.2 & -41.6 \\ \hline TC & -2.7 & -41.3 \\ \hline POS & -6.6 & -7.8 \\ \hline \end{tabular} \caption{Drop in Accuracy of Zero-shot transfer when we synthetically reduce token overlap to zero. Transfer is from English (en) as HRL to Spanish (es) and from Hindi (hi) as HRL to Marathi (mr) in two settings: (1) High where es, mr have sizes comparable to the HRL and (2) Low where their sizes are only 20K. Token overlap is important in the low-resource and related language setting (Section~\ref{sec:analysis})} \label{tab:overlapHL} \end{small} \end{table} We present the impact of token overlap via two sets of experiments: first, a controlled setup where we synthetically vary the fraction of overlap and second where we measure correlation between overlap and gains of OBPE on the data as-is. For the controlled setup we follow \cite{K2020Cross-Lingual} for synthetically controlling the amount of overlap between HRL and LRL. We trained a bilingual model between Hindi (HRL 160K) and Marathi (LRL 20K) --- two closely related languages in the Indo-Aryan family. To find the set of overlapping tokens between Hindi and Marathi, we first run \textsc{OBPE}{} on Hindi-Marathi language pair to generate a vocabulary and label all tokens present in both languages as \emph{overlapping tokens}. We then incrementally sample 10\%, 40\%, 50\%, 90\% of the tokens from this set. We shift the Unicode of the entire Hindi monolingual data except the set of sampled tokens so that there are no overlapping tokens between Hindi (hi) and Marathi (mr) monolingual data other than the sampled tokens. Let us call this Hindi data \textbf{SynthHindi}. We then run \textsc{OBPE}{} on SynthHindi-Marathi language pair to generate a vocabulary to pretrain the model. The task-specific Hindi data is also converted to SynthHindi during fine-tuning and testing of the model. \reffig{fig:unicode} shows results with increasing overlap. We observe increasing gains in LRL accuracy as we go from no overlap to full overlap on all three tasks. NER accuracy increases from 17\% to 58\% for the LRL (mr) even while the HRL (hi) accuracy stays unchanged. For TC we observe similar gains. For POS, even without token overlap, we get good cross-lingual transfer because POS tags are more driven by structural similarity, and Hindi and Marathi follow similar structure. \begin{table*}[h] \centering \parbox{0.55\textwidth}{ \begin{small} \setlength\tabcolsep{3.0pt} \begin{tabular}{|l|l| l|l| l|l |l|l |l|} \hline \multirow{2}{*}{Method} & \multicolumn{4}{c|}{LRL Performance ($\uparrow$)} &\multicolumn{4}{c|}{HRL Performance ($\uparrow$)} \\ & NER & TC & XNLI & POS & NER & TC & XNLI & POS \\ \hline BPE & 64.5 & 65.5 & 52.1 & 84.6 & 83.3 & \textbf{82.1} & 62.7 & \textbf{95.2} \\ +overSample & 64.4 & 67.6 & 52.1 & 84.6 & 82.4 & 82.0 & 62.0 & 95.2 \\ \hline {\textsc{OBPE}{} } & \textbf{65.7}& \textbf{68.0} & \textbf{54.0} & \textbf{85.3} & \textbf{84.0} & 81.9 & \textbf{66.3} & 95.1\\ +overSample & 64.6 & 67.9 & 53.5 & 85.1 & 82.7 & 81.7 & 65.7 & 94.8 \\ \hline \end{tabular} \caption{\label{tab:sample}Zero-shot performance of models in the same setting as Table~\ref{tab:overall} but comparing default sampling with oversampling (exponentiation factor S=0.5). Note, even if BPE\_overSamp improves LRL somewhat, it causes HRL to drop. OBPE with default sampling is best for both LRLs and HRLs. Also OBPE\_overSampled is better than BPE\_overSampled (Section~\ref{sec:samp}). } \end{small} } \vspace{-0.6 cm} \qquad \begin{minipage}[c]{0.38\textwidth}% \centering \includegraphics[scale =0.3]{chart.pdf} \caption{Percentage rise over BPE in representation of LRL, HRL and Shared (percentage of tokens shared between HRL and LRL weighted by frequency) in vocabulary generated by OBPE and BPE\_overSample and OBPE\_overSample (Section~\ref{sec:samp}). } \label{img:vocabstats} \end{minipage} \end{table*} Our results contradict the conclusions of \cite{K2020Cross-Lingual} which claimed that token overlap is unimportant for cross-lingual transfer. However, there are two key differences with our setting: (1) unlike \cite{K2020Cross-Lingual}, we explore low-resource settings, and (2) except for English-Spanish, the other language pairs they considered are not linguistically related. To explain the importance of both these factors, in \reftbl{tab:overlapHL} we present accuracy of English-Spanish in a simulated low-resource setting where we sample 20K Spanish documents and 160K English documents. Also, we repeat our Hindi-Marathi experiments where Marathi is not low-resource. We observe that (1) Spanish as LRL benefits significantly on overlap with English. (2) Marathi gains from token overlap with Hindi even in the high resource setting. Thus, we conclude that as long as languages are related, token overlap is important and the benefit from overlap is higher in the low resource setting. \paragraph{Overlap Vs Gain: Real data setup} \label{sec:real} \begin{table}[t] \begin{small} \centering \begin{tabular}{|l|l|c|} \hline Lang family & Task & Pearson Correlation\\ \hline \multirow{2}{*}{Indo-Aryan} & NER & 0.835 \\ & POS & 0.690 \\ \hline \multirow{2}{*}{West Germanic} & NER & 0.387 \\ & POS & 0.348 \\ \hline \multirow{2}{*}{Romance} & NER & 0.946 \\ & POS & 0.595 \\ \hline \end{tabular} \caption{\label{tab:corr}Correlation coefficient between performance gain and overlap gain within languages in a family for various tasks. (Section~\ref{sec:real}).} \end{small} \end{table} \vspace{-0.2cm} We further substantiate our hypothesis that the shared tokens across languages favoured by \textsc{OBPE}{} enable transfer of supervision from HRL to LRL via statistics on real-data. In Table~\ref{tab:corr} we show the Pearson product-moment correlation coefficient between overlap gain and performance gain within LRLs of the same family and task. We get a high positive correlation coefficient, with an average of 0.644. \subsection{Effect of Increased LRL representation} \label{sec:samp} We next investigate the impact of increased representation of LRL tokens in the vocabulary. OBPE increases LRL representation by favoring overlapping tokens, but LRL tokens can also be increased by just over-sampling LRL documents. We train another {\sc balanced} 12 model but with further over-sampling LRLs with exponentiation factor of 0.5 instead of 0.7. We observe in Figure~\ref{img:vocabstats} that this increases LRL fraction but reduces HRL tokens in the vocabulary. Table~\ref{tab:sample} also shows the comparison of zero-shot transfer accuracy with over-sampled BPE against over-sampled OBPE. We find that OBPE even with default exponentiation factor achieves highest LRL gains, whereas aggressively over-sampled BPE hurts HRL accuracy. Within the same sampling setting, OBPE is better than corresponding BPE. \subsection{Ablation study} \label{sec:ablation} \vspace{-0.2cm} We conducted experiments for different values of $p$ that controls the amount of overlap in the generalized mean function (\refeqn{eq:obpe:step}). Figure \ref{fig:p} and Table \ref{tab:varying_p} show the results for various $p$. Setting $p=1$ gives the original BPE algorithm. Setting $p=0,-1$ gives geometric and harmonic mean respectively, setting $p=-\infty$ gives minimum. We compare the task-specific results for different values of $p$ as shown in Table~\ref{tab:varying_p} and find that the gains we obtain are highest in the $p=-\infty$ (minimum) setting (Figure~\ref{fig:p}). \input{p_graph} We also experiment with $\alpha = 0.7$, and find that for most languages the results were not better than our default $\alpha = 0.5$. \section{Conclusion} In this paper, we address the problem of cross-lingual transfer from HRL{}s to LRL{}s by exploiting relatedness among them. We focus on lexical overlap during the vocabulary generation stage of multilingual pre-training. We propose Overlap BPE (\textsc{OBPE}{}), a simple yet effective modification to the BPE algorithm, which chooses a vocabulary that maximizes overlap across languages. \textsc{OBPE}{} encodes input corpora compactly while also balancing the trade-off between cross-lingual subword sharing and language-specific vocabularies. We focus on three sets of closely related languages from diverse language families. Our experiments provide evidence that \textsc{OBPE}{} is effective in leveraging overlap across related languages to improve LRL{} performance. In contrast to prior work, through controlled experiments on the amount of token overlap between two related HRL{}-LRL{} language pairs, we establish that token overlap is important when a LRL is paired with a related HRL. \paragraph{Acknowledgements} We thank Yash Khemchandani and Sarvesh Mehtani for participating in the early phases of this research. We thank Dan Garrette and Srini Narayanan for comments on the draft. We thank Technology Development for Indian Languages (TDIL) Programme initiated by the Ministry of Electronics Information Technology, Govt. of India for providing us datasets used in this study. The experiments reported in the paper were made possible by a Tensor Flow Research Cloud (TFRC) TPU grant. The IIT Bombay authors thank Google Research India for supporting this research.
{'timestamp': '2022-03-24T01:23:10', 'yymm': '2203', 'arxiv_id': '2203.01976', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.01976'}
arxiv
\section{Introduction} \label{sec:intro} Robots supporting people in their daily activities at home or at the workplace need to accurately and robustly perceive objects, such as containers, and their physical properties, for example when they are manipulated by a person prior to a human-to-robot handover~\cite{Sanchez-Matilla2020,Medina2016,Rosenberger2021RAL,Ortenzi2021TRO,Yang2021ICRA}. Audio-visual perception should adapt -- on-the-fly and with limited or no prior knowledge -- to changing conditions in order to guarantee the correct execution of the task and the safety of the person. For assistive scenarios at home, audio-visual perception should accurately and robustly estimate the physical properties (e.g., weight and shape) of household containers, such as cups, drinking glasses, mugs, bottles, and food boxes~\cite{Sanchez-Matilla2020,Ortenzi2021TRO,Liang2020MultimodalPouring,Modas2021ArXiv,Xompero2021_ArXiv}. However, the material, texture, transparency and shape can vary considerably across containers and also change with their content, which may not be visible due to the opaqueness of the container or occlusions, and hence should be inferred through the behaviour of the human~\cite{Sanchez-Matilla2020,Modas2021ArXiv,Xompero2021_ArXiv,Mottaghi2017ICCV,Duarte2020ICDL_EpiRob}. In this paper, we present the tasks and the results of the CORSMAL challenge at IEEE ICASSP 2022, supporting the design and evaluation of audio-visual solutions for the estimation of the physical properties of a range of containers manipulated by a person prior to a handover (see Fig.~\ref{fig:avsamples}). The specific containers and fillings are not known in advance, and the only priors are the sets of object categories ({drinking glasses}, {cups}, {food boxes}) and filling types ({water}, {pasta}, {rice}). The estimation of the mass and dimensions of the containers are novel tasks of this challenge, and complement the tasks of its previous version~\cite{Xompero2021_ArXiv}, such as the estimation of the container capacity and the type, mass and amount of the content. We carefully defined a set of performance scores to directly evaluate and systematically compare the algorithms on each task. Moreover, to assess the accuracy of the estimations and visualise the safeness of human-to-robot handovers, we implemented a real-to-simulation framework~\cite{Pang2021ROMAN} that provides indirect high-level evaluations on the impact of these tasks (see Fig.~\ref{fig:challengetasksdiagram}). The source code of the entries to the challenge and the up-to-date leaderboards are available at \mbox{\url{http://corsmal.eecs.qmul.ac.uk/challenge.html}}. \begin{figure}[t!] \centering \includegraphics[width=\linewidth]{challenge_image.png} \caption{Sample video frames and audio spectrograms of people manipulating objects prior to handing them over to a robot.} \label{fig:avsamples} \end{figure} \begin{figure*}[t!] \centering \includegraphics[width=\textwidth]{diagram_tasks.eps} \caption{The challenge tasks feeding into the CORSMAL simulator~\cite{Pang2021ROMAN} to evaluate the impact of estimation errors. Given video frames and audio signals from the CORSMAL Containers Manipulation (CCM) dataset~\cite{Xompero2021_ArXiv,Xompero_CCM}), the results of T1 (filling level), T2 (filling type), and T3 (container capacity) are used to compute the filling mass, which is added to T4 (container mass) for estimating the mass of the object (container + filling). The estimated dimensions (T5) are used to visualise the container. The simulator also uses object annotations, such as 6D poses over time, the true weight (container + filling), a 3D mesh model reconstructed offline with a vision baseline~\cite{Pang2021ROMAN}, and the frame where the object is ready to be grasped by the simulated robot arm, for performing and visualising the handover. } \label{fig:challengetasksdiagram} \end{figure*} \section{The tasks} \label{sec:tasks} In the scope of the challenge and based on the reference dataset~\cite{Xompero2021_ArXiv,Xompero_CCM}, containers vary in shape and size, and may be empty or filled with an unknown content at 50\% or 90\% of its capacity. We define a configuration as the manipulation of a container with a filling type and amount under a specific setting (i.e., background, illumination, scenario). The challenge features five tasks (Ts), each associated with a physical property to estimate for each configuration $j$. \begin{description} \item[Filling level classification (T1).] The goal is to classify the filling level ($\tilde{\lambda}^j$) as empty, 50\%, or 90\%. \item[Filling type classification (T2).] The goal is to classify the type of filling ($\tilde{\tau}^j$), if any, as one of these classes: 0 (no content), 1 (pasta), 2 (rice), 3 (water). \item[Container capacity estimation (T3).] The goal is to estimate the capacity of the container ($\tilde{\gamma}^j$, in mL). \item[Container mass estimation (T4).] The goal is to estimate the mass of the (empty) container ($\tilde{m}_{c}^j$, in g). \item[Container dimensions estimation (T5).] The goal is to estimate the width at the top ($\tilde{w}_t^j$, in mm) and at the bottom ($\tilde{w}_b^j$, in mm), and height ($\tilde{h}^j$, in mm) of the container. \end{description} Algorithms designed for the challenge are expected to estimate these physical properties to compute the mass of the filling as \begin{equation} \tilde{m}_f^j = \tilde{\lambda}^j \tilde{\gamma}^j D(\tilde{\tau}^j), \label{eq:fillingmass} \end{equation} where $D(\cdot)$ selects a pre-computed density based on the classified filling type. The mass of the object $\tilde{m}$ is calculated as the sum of the mass of the empty container and the mass of the content, if any. \section{The evaluation} \label{sec:evaluation} \subsection{Data} CORSMAL Containers Manipulation (CCM)~\cite{Xompero2021_ArXiv,Xompero_CCM} is the reference dataset for the challenge and consists of 1,140 visual-audio-inertial recordings of people interacting with 15 container types: 5 drinking cups, 5 drinking glasses, and 5 food boxes. These containers are made of different materials, such as plastic, glass, and cardboard. Each container can be empty or filled with water, rice or pasta at two different levels of fullness: 50\% or 90\% with respect to the capacity of the container. In total, 12 subjects of different gender and ethnicity\footnote{An individual who performs the manipulation is referred to as \textit{subject}. Ethical approval (QMREC2344a) was obtained at Queen Mary University of London, and consent from each person was collected prior to data collection.} were invited to execute a set of 95 configurations as a result of the combination of containers and fillings, and for one of three manipulation scenarios. The scenarios are designed with an increasing level of difficulty caused by occlusions or subject motions, and recorded with two different backgrounds and two different lighting conditions to increase the visual challenges for the algorithms. The annotation of the data includes the capacity, mass, maximum width and height (and depth for boxes) of each container, and the type, level, and mass of the filling. The density of pasta and rice is computed from the annotation of the filling mass, capacity of the container, and filling level for each container. Density of water is 1 g/mL. For validation, CCM is split into a training set (recordings of 9 containers), a public test set (recordings of 3 containers), and a private test set (recordings of 3 containers). The containers for each set are evenly distributed among the three categories. The annotations are provided publicly only for the training set. \subsection{Real-to-sim visualisation} The challenge adopts a real-to-simulation framework~\cite{Pang2021ROMAN} that complements the CCM dataset with a human-to-robot handover in the PyBullet simulation environment~\cite{coumans2019pybullet}. The framework uses the physical properties of a manipulated container estimated by a perception algorithm. The handover setup recreated in simulation consists of a 6 DoF robotic arm (UR5) equipped with a 2-finger parallel gripper (Robotiq 2F-85), and two tables. The simulator renders a 3D object model reconstructed offline by a vision baseline in manually selected frames with no occlusions~\cite{Pang2021ROMAN}. The weight of the object used by the simulator is the true, annotated value. We manually annotated the poses of the containers for each configuration of CCM every 10 frames and interpolated the intermediate frames. We also annotated the frame where the person started delivering the object to the robot arm. We use the annotated and interpolated poses to render the motion of the object in simulation and control the robot arm to approach the object at the annotated frame for the handover. If the robot is not able to reach the container before the recording ends, the last location of the container is kept for 2~s. When reaching the container, the simulated robot arm closes the gripper to 2~cm less than the object width to ensure good contact with the object, and applies an amount of force determined by the estimated weight of the object to grasp the container. Note that in the scope of the challenge, we avoid simulating the human hands so that the object is fully visible and can be grasped by the robot arm. The simulator visualises whether the estimations enable the robot to successfully grasp the container without dropping it or squeezing it. After grasping the container, the robot delivers it to a target area on a table via a predefined trajectory. \subsection{Scores} To provide sufficient granularity into the behaviour of the various components of the audio-visual algorithms and pipelines, we compute {13 performance scores} individually for the public test set (no annotations available to the participants), the private test set (neither data nor annotations are available to the participants), and their combination. All scores are in the range $[0,1]$. With reference to Table~\ref{tab:scores}, the first 7 scores quantify the accuracy of the estimations for the 5 main tasks and include filling level, filling type, container capacity, container width at the top, width at the bottom, and height, and container mass. Other 3 scores evaluate groups of tasks and assess filling mass, joint filling type and level classification, joint container capacity and dimensions estimation. The last 2 scores are an indirect evaluation of the impact of the estimations (i.e., the object mass) on the quality of human-to-robot handover and delivery of the container by the robot in simulation. \textbf{T1 and T2.} For filling level and type classification, we compute precision, recall, and F1-score for each class $k$ across all the configurations of that class, $J_k$. \textit{Precision} is the number of true positives divided by the total number of true positives and false positives for each class $k$ ($P_k$). \textit{Recall} is the number of true positives divided by the total number of true positives and false negatives for each class $k$ ($R_k$). \textit{F1-score} is the harmonic mean of precision and recall, defined as \begin{equation} F_k = 2\frac{P_k R_k}{P_k + R_k}. \end{equation} We compute the weighted average F1-score across $K$ classes as, \begin{equation} \bar{F}_1 = \sum_{k=1}^K \frac{J_k F_k}{J}, \label{eq:wafs} \end{equation} where $J$ is the total number of configurations (for either the public test set, the private test set, or their combination). Note that $K=3$ for the task of filling level classification and $K=4$ for the task of filling type classification. \textbf{T3, T4 and T5.} For container capacity and mass estimation, we compute the relative absolute error between the estimated measure, $a \in \{\tilde{\gamma}^j, \tilde{m}_c^j \}$, and the true measure, $b \in \{\gamma^j, m_c^j \}$: \begin{equation} \varepsilon(a, b) = \frac{|a - b |}{b}. \label{eq:ware} \end{equation} For container dimensions estimation, where $a \in \left\{\tilde{w}_t^j,\tilde{w}_b^j,\tilde{h}^j\right\}$ and $b$ is the corresponding annotation, we use the normalisation function $\sigma_1(\cdot,\cdot)$~\cite{Sanchez-Matilla2020}: \begin{equation} \sigma_1(a,b)= \begin{cases} 1 - \frac{|a - b |}{b} & \text{if} \quad | a - b | < b, \\ 0 & \text{otherwise}. \end{cases} \end{equation} For filling mass estimation\footnote{Note that an algorithm with lower scores for T1, T2 and T3, may obtain a higher filling mass score than other algorithms due to the multiplicative formula to compute the filling mass for each configuration.}, we compute the relative absolute error between the estimated, $\tilde{m}_{f}^j$, and the true filling mass, $m_{f}^j$, unless the annotated mass is zero (empty filling level), \begin{equation} \epsilon(\tilde{m}_f^j, m_f^j) = \begin{cases} 0, & \text{if } m_f^j = 0 \land \tilde{m}_f^j=0, \\ \tilde{m}_f^j & \text{if } m_f^j = 0 \land \tilde{m}_f^j \neq 0, \\ \frac{|\tilde{m}_f^j - m_f^j |}{m_f^j} & \text{otherwise}. \end{cases} \label{eq:ware2} \end{equation} With reference to Table~\ref{tab:scores}, we compute the score, $s_i$, with \mbox{$i=\left\{3,\dots,8\right\}$}, across all the configurations $J$ for each measure as: \begin{equation} \noindent s_i = \begin{cases} \frac{1}{J}\sum_{j=1}^{J}{ \mathds{1}_j e^{-\varepsilon(a, b)}} & \text{if} \, a \in \left\{\tilde{\gamma}^j, \tilde{m}_c^j\right\},\\ \frac{1}{J}\sum_{j=1}^{J}{\mathds{1}_j \sigma_1(a,b)} & \text{if} \, a \in \left\{\tilde{w}^j,\tilde{w}_b^j,\tilde{h}^j\right\},\\ \frac{1}{J}\sum_{j=1}^{J}{ \mathds{1}_j e^{-\epsilon(a, b)}} & \text{if} \, a=\tilde{m}_f^j.\\ \end{cases} \end{equation} The value of the indicator function, \mbox{$\mathds{1}_j \in \{0,1\}$}, is 0 only when \mbox{$a \in \left\{ \tilde{\gamma}^j, \tilde{m}_c^j, \tilde{w}_t^j,\tilde{w}_b^j,\tilde{h}^j, \tilde{m}_f^j \right\}$} is not estimated in configuration $j$. Note that estimated and annotated measures are strictly positive, $a>0$ and $b>0$, except for filling mass in the empty case (i.e., $\tilde{\lambda}^j = 0$ or $\tilde{\tau}^j = 0$). \begin{table*}[t!] \centering \scriptsize \renewcommand{\arraystretch}{1.2} \setlength\tabcolsep{1.3pt} \caption{Results of the CORSMAL challenge entries on the combination of the public and private CCM test sets~\cite{Xompero2021_ArXiv,Xompero_CCM}. For a measure $a$, its corresponding ground-truth value is $\hat{a}$. All scores are normalised and presented in percentages. $\bar{F}_1(\cdot)$ is the weighted average F1-score. Filling amount and type are sets of classes (no unit). } \begin{tabular}{ccccclllllccrrrrrrrrr} \specialrule{1.2pt}{3pt}{0.6pt} T1 & T2 & T3 & T4 & T5 & Description & Unit & Measure & Score & Weight & Type & R2S & RAN & AVG & \cite{Donaher2021EUSIPCO_ACC} & \cite{Liu2020ICPR} & \cite{Ishikawa2020ICPR} & \cite{Iashin2020ICPR} & \cite{Apicella_GC_ICASSP22} & \cite{Matsubara_GC_ICASSP22} & \cite{Wang_GC_ICASSP22} \\ \specialrule{1.2pt}{3pt}{1pt} \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & Filling level & & $\lambda^j$ & $s_1 = \bar{F}_1(\lambda^1, \ldots, \lambda^J, \hat{\lambda}^1, \ldots, \hat{\lambda}^J)$ & $\pi_1 = 1/8$ & D & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & 37.62 & 33.15 & \textbf{80.84} & 43.53 & 78.56 & 79.65 & \multicolumn{1}{c}{--} & 65.73 & 77.40 \\ \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & Filling type & & $\tau^j$ & $s_2 = \bar{F}_1(\tau^1, \ldots, \tau^J, \hat{\tau}^1, \ldots, \hat{\tau}^J)$ & $\pi_2 = 1/8$ & D & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & 24.38 & 23.01 & 94.50 & 41.83 & 96.95 & 94.26 & \multicolumn{1}{c}{--} & 80.72 & \textbf{99.13} \\ \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & Capacity & mL & $\gamma^j$ & $s_3 = \frac{1}{J} \sum_{j=1}^{J} \mathds{1}_j e^{-\varepsilon^j(\gamma^j, \hat{\gamma}^j)}$ & $\pi_3 = 1/8$ & D & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & 24.58 & 40.73 & \multicolumn{1}{c}{--} & 62.57 & 54.79 & 60.57 & \multicolumn{1}{c}{--} & \textbf{72.26} & 59.51 \\ \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & Container mass & g & $m_c^j$ & $s_4 = \frac{1}{J} \sum_{j=1}^{J} \mathds{1}_j e^{-\varepsilon^j(m_c^j, \hat{m}_c^j)}$ & $\pi_4 = 1/8$ & D & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & 29.42 & 22.06 & \multicolumn{1}{c}{--} & \multicolumn{1}{c}{--} & \multicolumn{1}{c}{--} & \multicolumn{1}{c}{--} & 49.64 & 40.19 & \textbf{58.78} \\ \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & Width at top & mm & $w_t^j$ & $s_5 = \frac{1}{J}\sum_{j=1}^{J}{\mathds{1}_j \sigma_1(w_t^j, \hat{w_t}^j)}$ & $\pi_5 = 1/24$ & D & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & 32.33 & 76.89 & \multicolumn{1}{c}{--} & \multicolumn{1}{c}{--} & \multicolumn{1}{c}{--} & \multicolumn{1}{c}{--} & \multicolumn{1}{c}{--} & 69.09 & \textbf{80.01} \\ \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & Width at bottom & mm & $w_b^j$ & $s_6 = \frac{1}{J}\sum_{j=1}^{J}{\mathds{1}_j \sigma_1(w_b^j, \hat{w_b}^j)}$ & $\pi_6 = 1/24$ & D & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & 25.36 & 58.19 & \multicolumn{1}{c}{--} & \multicolumn{1}{c}{--} & \multicolumn{1}{c}{--} & \multicolumn{1}{c}{--} & \multicolumn{1}{c}{--} & 59.74 & \textbf{76.09} \\ \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & Height & mm & $h^j$ & $s_7 = \frac{1}{J}\sum_{j=1}^{J}{ \mathds{1}_j \sigma_1(h^j, \hat{h}^j)}$ & $\pi_7 = 1/24$ & D & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & 42.48 & 64.32 & \multicolumn{1}{c}{--} & \multicolumn{1}{c}{--} & \multicolumn{1}{c}{--} & \multicolumn{1}{c}{--} & \multicolumn{1}{c}{--} & 70.07 & \textbf{74.33} \\ \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & Filling mass & g & $m_f^j$ & $s_8 = \frac{1}{J} \sum_{j=1}^{J} \mathds{1}_j e^{-\epsilon^j(m_f^j, \hat{m}_f^j)}$ & $\pi_8 = 1/8$* & I & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & 35.06 & 42.31 & 25.07 & 53.47 & 62.16 & 65.06 & \multicolumn{1}{c}{--} & \textbf{70.50} & 65.25 \\ \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & Object mass & g & $m^j$ & $s_9 = \frac{1}{J}\sum_{j=1}^{J}{\mathds{1}_j \psi^j(m^j, \hat{F}^j)}$ & $\pi_9 = 1/8$* & I & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & 56.31 & 58.30 & 55.22 & 64.13 & 66.84 & 65.04 & 53.54 & 60.41 & \textbf{71.19} \\ \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & Pose at delivery & (mm, $^\circ$) & ($\alpha^j$,$\beta^j$) & $s_{10} = \frac{1}{J}\sum_{j=1}^{J}{\Delta_j(\alpha^j,\beta^j,\eta,\phi)}$ & $\pi_{10} = 1/8$* & I & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & 72.11 & 70.01 & 73.94 & 78.76 & 72.91 & \textbf{80.40} & 60.54 & 73.17 & 79.32 \\ \midrule \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \multicolumn{3}{l}{Joint filling type and level} & $s_{11} = \bar{F}_1(\lambda^1, \tau^1, \ldots, \hat{\lambda}^1, \hat{\tau}^1, \ldots)$ & \multicolumn{1}{c}{--} & D & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & 10.49 & 8.88 & 77.15 & 24.32 & 77.81 & 76.45 & \multicolumn{1}{c}{--} & 59.32 & \textbf{78.16} \\ \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & \multicolumn{3}{l}{Container capacity and dimensions} & $s_{12} = {s_3}/{2} + (s4 + s5 + s6)/{6}$ & \multicolumn{1}{c}{--} & D & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=white] (1,1) circle (0.5ex);} & 28.99 & 53.60 & \multicolumn{1}{c}{--} & 31.28 & 27.39 & 30.28 & \multicolumn{1}{c}{--} & \textbf{69.28} & 68.16 \\ \specialrule{1.2pt}{3pt}{1pt} \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & \protect\raisebox{1pt}{\protect\tikz \protect\draw[black,fill=black] (1,1) circle (0.5ex);} & Overall score & & & $S = \sum_{l=1}^{10} \pi_l s_l$ & \multicolumn{1}{c}{--} & I & \multicolumn{1}{c}{--} & 39.11 & 44.51 & 31.52 & 35.89 & 47.04 & 48.35 & 9.05 & 66.16 & \textbf{73.43} \\ \specialrule{1.2pt}{3pt}{1pt} \multicolumn{21}{l}{\scriptsize{Best performing results for each row highlighted in bold. Results of tasks not addressed shown with a hyphen (--).}}\\ \multicolumn{21}{l}{\scriptsize{For $s_9$ and $s_{10}$, configurations with failures in grasping and/or delivering the containers in simulation using true physical properties as input are annotated and discarded.}}\\ \multicolumn{21}{l}{\scriptsize{For fairness, the residual between 100 and the scores obtained with true measures of the physical properties are added to $s_9$ and $s_{10}$ to remove the impact of the simulator.}}\\ \multicolumn{21}{l}{\scriptsize{KEY -- T:~task, D:~direct score, I:~indirect score, R2S:~measured in the real-to-simulation framework, RAN:~random estimation, AVG:~average from the training set.}}\\ \multicolumn{21}{l}{\scriptsize{* weighted by the number of performed tasks.}}\\ \end{tabular} \label{tab:scores} \vspace{-10pt} \end{table*} \textbf{Object safety and accuracy of delivery.} Object safety is the probability that the force applied by the robot, $\tilde{F}$, enables a gripper to hold the container without dropping it or breaking it~\cite{Pang2021ROMAN}. We approximate the force required to hold the container as \begin{equation} \hat{F} \approx \frac{\hat{m} (g + a_{max})}{\mu}, \label{equ:grasp_force_theoretical} \end{equation} where $\hat{m}$ is the annotated object mass; $g=9.81$~m/s$^2$ is the gravitational earth acceleration; $a_{max}$ is the maximum acceleration of the robot arm when carrying the object; and $\mu$ is the coefficient of friction between the container and the gripper ($\mu=1.0$~\cite{Pang2021ROMAN}). The value of the force applied by the robot to grasp the object is calculated with Eq.~\ref{equ:grasp_force_theoretical} using the predicted object mass $\tilde{m}$. We compute object safety as an exponential function that accounts for the difference between the applied normal force $\tilde{F}^j$ (measured in simulation) and the required normal force, $\hat{F}^j$: \begin{equation} \psi^j = e^{\frac{| \tilde{F}^j - \hat{F}^j |}{\hat{F}^j} \ln{(1-c)}} = {\ln{(1-c)}}^{\frac{| \tilde{F}^j - \hat{F}^j |}{\hat{F}^j}}, \label{eq:forcesafety} \end{equation} where the normal force is the component of the contact force perpendicular to the contact surface and $c$ controls the sensitivity of $\psi^j$~\cite{Pang2021ROMAN}. A negative difference represents a higher probability of dropping the container, and a positive difference represents a higher probability of breaking the container. We quantify the accuracy of delivering the container upright and within the target area as \begin{equation} \Delta_j = \begin{cases} 1 - \frac{\alpha}{\eta} & \text{if } (\alpha < \eta) \text{ and } (\beta < \phi), \\ 0 & \text{otherwise}, \\ \end{cases} \end{equation} where $\alpha$ is the distance from the centre of the base of the container to the target location $\boldsymbol{d}$; $\eta$ is the maximum distance allowed from the delivery target location; $\beta$ is the angle between the vertical axis of the container and the vertical axis of the world coordinate system; and $\phi$ is the value of $\beta$ at which the container would tip over. We compute the score for object safety, $s_9$, as \begin{equation} s_{9} = \frac{1}{J}\sum_{j=1}^{J}{ \mathds{1}_j \psi^j(m^j, \hat{F}^j)}, \label{eq:totobjsafetyscore} \end{equation} where the value of the indicator function, $\mathds{1}_j$, is 0 only when either the filling mass or the containers mass is not estimated for each configuration $j$; and the score for the delivery accuracy, $s_{10}$, as \begin{equation} s_{10} = \frac{1}{J}\sum_{j=1}^{J}{ \Delta_j(\alpha^j,\beta^j,\eta,\phi)}. \label{eq:deliveryscore} \end{equation} The scores $s_9$ and $s_{10}$ are partially influenced by the simulator conditions (e.g, friction, contact, robot control), but we aimed at making the simulated handover reproducible across different algorithms through the annotated object trajectory, starting handover frame, and reconstructed 3D model. {\bf Group tasks and overall score.} For joint filling type and level classification ($s_{11}$), estimations and annotations of both filling type and level are combined in $K=7$ feasible classes, and $\bar{F}_1$ is recomputed based on these classes. For joint container capacity and dimensions estimation, we compute the following weighted average: \begin{equation} s_{12} = \frac{s_3}{2} + \frac{s4 + s5 + s6}{6}. \end{equation} Finally, the overall score is computed as the weighted average of the scores from $s_1$ to $s_{10}$. Note that $s_8$, $s_9$, and $s_{10}$ may use random estimations for either of the tasks not addressed by an algorithm. \subsection{IEEE ICASSP 2022 Challenge entries} Nine teams registered for the IEEE ICASSP 2022 challenge; three algorithms were submitted for container mass estimation (T4), two algorithms were submitted for classifying the filling level (T1) and type (T2), and two other algorithms were submitted for estimating the container properties (T3, T4, T5) by three teams. We refer to the submissions of the three teams as A1~\cite{Apicella_GC_ICASSP22}, A2~\cite{Matsubara_GC_ICASSP22}, and A3~\cite{Wang_GC_ICASSP22}. A1 solved only the task of container mass estimation (T4) using RGB-D data from the fixed frontal view and by regressing the mass with a shallow Convolutional Neural Network (CNN)~\cite{Christmann2020NTNU}. To increase the accuracy, A1 extracted a set of patches of the detected container from automatically selected frames in a video, and averaged their predicted masses. To classify the filling level (T1) and type (T2), A2 used Vision Transformers~\cite{Dosovitskiy2021ICLR}, whereas A3 used pre-trained CNNs (e.g., Mobilenets~\cite{Howard2017Arxiv}) combined with Long Short-Term Memory units or majority voting~\cite{Hochreiter1997LSTM}. Only audio or audio with visual information (RGB) from the fixed, frontal view is preferred as input. To estimate the container properties (T3, T4, T5), A2 used RGB data from the three fixed views, and A3 used RGB-D data from the fixed frontal view. A2 used a modified multi-view geometric approach that iteratively fits a hypothetical 3D model~\cite{Xompero2020ICASSP_LoDE}. A3 fine-tunes multiple Mobilenets via transfer learning from the task of dimensions estimation (T5) to the tasks of container capacity (T3) and mass (T4) estimation~\cite{Wang_GC_ICASSP22}. These Mobilenets regress the properties using patches extracted from automatically selected frames where the container is mostly visible~\cite{Wang_GC_ICASSP22}. To overcome over-fitting of the limited training data and improve generalisation on novel containers, these Mobilenets are fine-tuned with geometric-based augmentations and variance evaluation~\cite{Wang_GC_ICASSP22}. Overall, A3 is designed to process a continuous stream (online), thus being more suitable for human-to-robot handovers. Table~\ref{tab:scores} shows the scores of the submissions on the combined CCM test sets. As reference, we provide the results for the properties estimated by a pseudo-random generator (RAN), by using the average (AVG) of the training set for container capacity, mass, and dimensions; or by the algorithms of four earlier entries to the challenge~\cite{Donaher2021EUSIPCO_ACC,Liu2020ICPR,Ishikawa2020ICPR,Iashin2020ICPR}. A3 achieves the highest $\bar{F}_1$ for filling type classification ($s_2 = 99.13$), and joint filling type and level classification ($s_{11} = 78.16$). A3 is also the most accurate in estimating the container mass ($s_4 = 58.78$), followed by A1 ($s_4=49.64$), and the container dimensions. A2 is the most accurate in estimating the capacity ($s_3 = 72.26$). A2 is also the most accurate for filling mass ($s_8 = 70.50$). A3 has a high accuracy for filling level and type classification, but is affected by its lower accuracy for capacity estimation. Among the entries of the challenge at IEEE ICASSP 2022, A3 achieves the best score for object safety ($s_9 = 71.19$) and delivery accuracy ($s_{10} = 79.32$). In conclusion, A3 reaches the highest overall score ($S = 73.43$), followed by A2 ($S = 66.16$). \section{Conclusion} \label{sec:conclusion} Recent, fast advances in machine learning and artificial intelligence have created an expectation on the ability of robots to seamlessly operate in the real world by accurately and robustly perceiving and understanding dynamic environments, including the actions and intentions of humans. However, several challenges in audio-visual perception and modelling humans with their hard-to-predict behaviours hamper the deployment of robots in real-world scenarios. We presented the tasks, the real-to-simulation framework, the scores and the entries to the CORSMAL challenge at IEEE ICASSP 2022 . These new entries complement the algorithms previously submitted to the challenge~\cite{Donaher2021EUSIPCO_ACC,Liu2020ICPR,Ishikawa2020ICPR,Iashin2020ICPR}. \bibliographystyle{IEEEbib}
{'timestamp': '2022-03-07T02:01:33', 'yymm': '2203', 'arxiv_id': '2203.01977', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.01977'}
arxiv
\section{Introduction} Engineering systems are nowadays systematically designed for optimal efficiency in a resource-scarce environment. The optimization process is most often carried out using computational models predicting the behavior of the system for any given configuration. While these models are becoming more and more accurate thanks to algorithmic advances and the availability of low-cost computing power, the parameters required to describe the system are not always accurately known. This is due to the inherent variability of the system parameters or simply to the designer's lack of knowledge. Regardless of their nature, \emph{uncertainties} need to be accounted for in the design process as they affect the prediction made by the computational model and henceforth the design solution. Within the probabilistic framework, various techniques have been developed for optimization under uncertainties \citep{Schueller2008, Beck2015,Lelievre2016}. The optimization problem of interest in this paper comprises two components often treated separately in the literature, namely \emph{robust design optimization} and \emph{multi-objective optimization}. The first one, which directly deals with uncertainties, entails finding an optimal solution which is at the same time not sensitive to perturbations in its vicinity. This technique has been widely studied in the literature and state-of-the-art reviews can be found in \citet{Zang2005,Beyer2007}, among others. By introducing the so-called sigma-to-noise ratio and using an experimental design strategy, Taguchi laid the conceptual basis for robust design \citep{Taguchi1989}. In this pioneering work, the sources of uncertainties were identified and their effects on the performance functions were reduced using various means. However, the most widespread approach in recent contributions relies on a different paradigm where the performance function and the effects of uncertainty are minimized simultaneously. These two quantities of interest may be represented by the first- and second-order moments (mean and variance) of the performance function. In practice, they are generally combined to form a scalar function which can then be minimized using traditional optimization techniques \citep{Doltsinis2004,Beck2015}. When the probability distribution of the uncertain parameters are not well-known but bound estimates exist, worst-case approaches have proven to be effective despite their known extreme conservativeness. A more general robustness measure may be obtained by considering quantiles of the performance function instead \citep{Pujol2009,Razaaly2020,Sabater2021}. Owing to its simplicity and straightforward account of uncertainties through a unique scalar, this approach is considered in the present work. The second component, \emph{i.e.}, multi-objective optimization, relates to the presence of multiple performance functions. Very often the objectives described by these functions are conflicting and a compromise needs to be found. The associated methods may be classified into \emph{a priori} and \emph{a posteriori} approaches, according to when the decision maker sets preferences among the different objectives. In the former, the designer reformulates the multi-objective problem into one or a series of single objectives by aggregation. A scalar objective function is often obtained using various scalarization techniques, including linear or exponential weighted sums and the Tchebycheff or $\epsilon$-constraint methods \citep{Miettinen1999,Weck2004,Liang2017}. Alternatively, nonscalarizing methods, which are often prompted by an inherent hierarchical ordering of the objectives, may be used, \emph{e.g.}, lexicographic or max-ordering methods \citep{Ehrgott2005}. In contrast, in \emph{a posteriori} methods no preference is set before the optimization is carried out. Trade-off solutions are found first and only then are the decision makers given possible design solutions to choose from. In some cases, the preference setting parameters of \emph{a priori} methods may be used as a mathematical tool to provide multiple equivalent solutions. The difficulty with such approaches is that the continuous variations of the resulting weights does not necessarily lead to an even exploration of the objective space \citep{Marler2004}. Evolutionary algorithms are another class of methods that have emerged and have shown to be powerful and particularly suited for multi-objective optimization, as they possess several desirable characteristics \citep{Zitzler2004, Emmerich2018}. These are basically metaheuristics that evolve a set of candidate designs by various mechanisms so as to converge to an approximation of the so-called \emph{Pareto front}, \emph{i.e.}, a series of optimal design solutions describing a trade-off between competing objectives. Examples of such methods include the vector evaluated genetic algorithm \citep{Schaffer1985}, the multi-objective genetic algorithm \citep{Fonseca1993}, the strength Pareto evolutionary algorithm 2 (SPEA2) \citep{Zitzler1999} or the Pareto archived evolution strategy \citep{Knowles2000}. The last two algorithms possess an elite-preservation mechanism by which best solutions are never lost within iterations. Such mechanisms have proven to increase the rate of convergence of the algorithms. The non-dominated sorting genetic algorithm II (NSGA-II) \citep{Deb2002} belongs to this class of solvers and has been widely used in the literature. Considering its proven record of efficiency and its ease of implementation, NSGA-II is considered as the basis for the methodology developed in this paper. A commonly known drawback of evolutionary algorithms, and in particular of NSGA-II, is their high computational cost. This is even more problematic when the objective function stems from the propagation of uncertainties through a possibly expensive-to-evaluate computational model. Surrogate modelling is a proven solution to address these cost issues and has been widely used in both uncertainty quantification and design optimization fields. A surrogate model is an inexpensive approximation of a model that aims at replacing it in analyses requiring its repeated evaluation. One of the most popular methods, namely Kriging a.k.a. Gaussian process modelling \citep{Sacks1989, Santner2003, Rasmussen2006}, is considered in this work. Kriging has been extensively used for both multi-objective and robust optimization problems, as the brief literature review in Section~\ref{sec:Kriging:LitRev} shows. Finally, the developments in this paper were motivated by an application related to the optimal selection of renovation scenarios for building renovation under uncertainties \citep{GalimshinaBE2020, GalimshinaENB2021}. The formulated optimization problem is not only multi-objective and robust but also contains a subset of parameters which are categorical. \emph{Categorical variables} are characterized by the fact that they are composed of a discrete and finite set of values which do not have any intrinsic ordering. There are also often referred to as \emph{qualitative} or \emph{nominal}. In the case of building renovation, a typical example is the heating system, which may be selected from technical solutions such as oil, gas, heat pump, etc. Both NSGA-II and Kriging, which are the two main methods used in the proposed methodology, were developed and are still mainly used for problems involving \emph{only continuous parameters}, thus the need of further developments to tackle the problem of interest. In this paper, we consider adaptations of these two algorithms to handle mixed categorical-continuous problems. Based on these premises, the goal of this paper is to develop a general purpose multi-criterion algorithm for robust optimization problems using an adaptive Kriging model and capable of handling mixed categorical-continuous variables. The paper is organized as follows. In Section~\ref{sec:ProbDef}, the quantile-based formulation of the optimization problem is presented considering separately the robust and multi-objective components. Section~\ref{sec:Solution} presents a nested level solution scheme which couples optimization and quantile estimation. Section~\ref{sec:Kriging} introduces Kriging to the framework following a short literature review. Section~\ref{sec:Categorical} presents the adaptations of the proposed methodology to handle mixed categorical-continuous variables. Finally, Section~\ref{sec:Applications} presents two applications: an analytical example and a real case study which deals with the optimal renovation of a building under uncertainties using life cycle assessment. \section{Problem formulation}\label{sec:ProbDef} In this paper, we are interested in solving multi-objective \emph{and} robust optimization problems. Even though robust design often involves minimizing two conflicting objectives (\emph{e.g.}, a measure of performance and a measure of dispersion), these two classes of problems are most often treated separately in the literature. As briefly mentioned in the introduction, the state-of-the-art in robust optimization comprises various formulations. In this work, we are interested in minimizing conservative quantiles of the objective function given the uncertainties in the input. Mathematically, the following problem is solved: \begin{equation}\label{eq:RobustOptim} \ve{d}^{\ast} = \arg \min_{\ve{d} \in \mathbb{D}} Q_{\alpha} \prt{\mathfrak{c};\ve{X}\prt{\ve{d}}, \ve{Z}} \quad \text{subject to:} \quad f_j \prt{\ve{d}} \leq 0 \quad \acc{j = 1, \ldots, c}, \end{equation} where $Q_{\alpha}$, which represents the $\alpha$-quantile of the cost function $\mathfrak{c}$ and reads \begin{equation}\label{eq:Quantile} Q_{\alpha} \prt{ \mathfrak{c}; \ve{X}\prt{\ve{d}},\ve{Z}} \equiv \inf \acc{q \in \mathbb{R} : \textrm{Prob}\bra{\mathfrak{c} \prt{\ve{X}\prt{\ve{d}},\ve{Z}} \leq q } \geq \alpha}. \end{equation} This quantile is minimized with respect to the design parameters $\ve{d} \in \mathbb{D} \subset{R}^{M_d}$ under a set of $c$ constraint functions $\acc{f_j, \, j = 1 \enum c}$. In this work, the latter are assumed to be simple and easy-to-evaluate analytical functions bounding the design space. No other hard constraints are considered and to simplify the following developments, we will denote the subset of the design space that is feasible by $\mathbb{S} = \acc{\ve{d} \in \mathbb{D}: f_j\prt{\ve{d}} \leq 0, j = 1 \enum c}$. In contrast, the cost function is assumed to result from the evaluation of a complex, and possibly expensive-to-evaluate, computational model $\mathcal{M}$. This model takes as inputs the uncertain random parameters of the analysis, which are here split into two groups: the random variables $\ve{X} \sim f_{\ve{X}|\ve{d}}$ represent the variability associated to the design parameters $\ve{d}$ whereas $\ve{Z} \sim f_{\ve{Z}}$ are the so-called \emph{environmental variables} which affect the system response without necessarily being controlled by the designer. Manufacturing tolerances (design) and loading (environmental) are typical examples of the two categories of uncertain parameters in the context of structural engineering design. As in the applications considered in this work, engineering systems sometimes require the simultaneous optimization of multiple quantities of interest. Considering a set of $m$ cost functions denoted by $\acc{\mathfrak{c}_k, \, k = 1 \enum m}$, the optimization problem of interest now becomes \begin{equation}\label{eq:RobustMultiObjOptim} \ve{d}^{\ast} = \arg \min_{\ve{d} \in \mathbb{S}} \acc{Q_{\alpha_1} \prt{\mathfrak{c}_1;\ve{X}\prt{\ve{d}}, \ve{Z}} \enum Q_{\alpha_m} \prt{\mathfrak{c}_m;\ve{X}\prt{\ve{d}}, \ve{Z}} }, \end{equation} where $\acc{\alpha_1 \enum \alpha_m} \in \bra{0,\,1}^m$ are the levels of the quantiles as introduced in Eq.~\eqref{eq:Quantile}. It is assumed here without loss of generality that the $m$ objective functions are derived from the same computational model $\mathcal{M}$. \section{Problem solution}\label{sec:Solution} \subsection{Nested levels solution scheme} The direct solution of the optimization problem stated in Eq.~\eqref{eq:RobustMultiObjOptim} classically involves two nested levels. In the outer level, the design space is explored whereas in the inner one the quantiles corresponding to a given design choice are computed. Even though variance-reduction simulation techniques can be used for the computation of quantiles \citep{Glynn1996,Dong2017}, we consider here crude Monte Carlo simulation (MCS). Due to the fact that relatively large values of $\alpha$ are considered for robust design optimization, MCS may indeed provide accurate estimates of the quantiles with relatively few sample points. More specifically, we consider $\alpha_1 = \alpha_2 = ... = \alpha_m = \alpha = 0.90$ throughout this paper. The first step in the inner level is to draw a Monte Carlo sample set for a given design choice $\ve{d}^{(i)}$: \begin{equation} \mathcal{C}\prt{\ve{d}^{(i)}} = \acc{\prt{\ve{x}^{(j)},\ve{z}^{(j)}}, j = 1 \enum N}, \end{equation} where $\ve{x}^{(j)}$ and $\ve{z}^{(j)}$ are realizations of $X \sim f_{\ve{X}|\ve{d}^{(i)}}$ and $Z \sim f_{\ve{Z}}$, respectively. The computational model is then evaluated on each of these points and henceforth the corresponding cost function values are obtained. After ordering the latter, the quantiles corresponding to each output are eventually empirically estimated and denoted by $q_{_k}\prt{\ve{d}^{(i)}}$. By their very nature, quantiles are random variables and plugging Monte Carlo estimates in Eq.~\eqref{eq:RobustOptim}~or~\eqref{eq:RobustMultiObjOptim} would lead to a stochastic optimization problem. Solving such a problem may be cumbersome, and even more so in the presence of multiple objectives. To avoid dealing with the resulting issues, the concept of \emph{common random numbers} is considered \citep{Spall2003}. This essentially translates into using the same stream of random numbers within iterations of the optimization problem. More specifically, the random variables $\acc{\ve{x}\prt{\ve{d}^{(1)}}, \ve{x}\prt{\ve{d}^{(2)}}, \ve{x}\prt{\ve{d}^{(3)}}, ...}$ generated at each iteration of the optimization procedure share the same seed. For the environmental variables, the same set of realizations of $\acc{\ve{z}^{(j)}, j= 1 \enum N}$ is used throughout the optimization. Using this trick, the mapping $\ve{d}^{(i)} \mapsto q_k \prt{\ve{d}^{(i)}}$ becomes deterministic. As such, Eq.~\eqref{eq:RobustMultiObjOptim} can be simplified into \begin{equation}\label{eq:RMO_deter} \ve{d}^{\ast} = \arg \min_{\ve{d} \in \mathbb{S}} \acc{q_{1}\prt{\ve{d}} \enum q_{m}\prt{\ve{d}} }. \end{equation} This problem can then be solved using any classical multi-objective optimization solver. Such problems are however ill-defined in a sense, as there is generally no single solution that minimizes all the objective functions simultaneously. Therefore, the traditional approach is to seek for a set of solutions representing a compromise. To define such solutions, a widely-used concept is that of \emph{Pareto dominance} \citep{Miettinen1999,Ehrgott2005}. Given two solutions $\ve{a}, \ve{b} \in \mathbb{D}$, $\ve{a}$ dominates $\ve{b}$ (denoted by $\ve{a} \prec \ve{b}$) if and only if the following two conditions hold: \begin{equation*} \left\{ \begin{array}{ll} \forall k \in \acc{1 \enum m}, \quad q_k\prt{\ve{a}} \leq q_k\prt{\ve{b}}, \\ \exists k \in \acc{1 \enum m}, \quad q_k\prt{\ve{a}} < q_k\prt{\ve{b}}. \end{array} \right. \end{equation*} The goal of the search is then to find solutions which are not dominated by any other feasible point. A set of such solutions is said to be \emph{Pareto optimal} and defined as follows: \begin{equation} \mathcal{D}^{\ast} = \acc{\ve{d} \in \mathbb{S}:\, \nexists\, \ve{d}^\prime \in \mathbb{S}, \, \ve{d}^\prime \prec \ve{d}}. \end{equation} The \emph{Pareto front} $\mathcal{F} = \acc{\ve{q}\prt{\ve{d}} \in \mathbb{R}^m : \ve{d} \in \mathcal{D}^\ast}$ is the image of $\mathcal{D}^\ast$ in the objective space. Typically, a discrete approximation of the Pareto front is sought. As mentioned in the introduction, we will consider in this paper an elitist evolutionary algorithm, namely the \emph{non-dominated sorting genetic algorithm II} (NSGA-II) \citep{Deb2002}. This algorithm is one of the most popular in the field of multi-objective optimization and is briefly described in the sequel. \subsection{Non-dominated sorting genetic algorithm II} Generally speaking, genetic algorithms \citep{Goldberg1989} are a sub-class of evolutionary methods where a population of individuals is evolved so as to produce better and better solutions until convergence. Genetic algorithms attempt to mimic natural evolution theory where individuals are combined through so-called \emph{cross-over} and \emph{mutation} operators, the idea being that the fittest individuals would pass their genes to the next generation. The non-dominated sorting genetic algorithm II (NSGA-II) belongs to a class of algorithms developed specifically to handle multi-objective optimization problems. The latter introduce a new approach for assigning fitness according to a rank derived from a non-dominated sorting. NSGA-II is an elitist and fast non-dominated sorting algorithm introduced by \citet{Deb2002} as an enhancement of the original NSGA \citep{Deb1999}. Even though NSGA has shown to be a popular evolutionary method, it features a computationally complex and slow sorting algorithm and, most of all, lacks elitism. Elitism, a property by which the fittest solutions in a given generation are copied to the next one so as not to lose the best genes, has indeed proved to accelerate convergence \citep{Zitzler2000}. The general workflow of NSGA-II is illustrated in Figure~\ref{fig:FlowchartNSGA}. The following section details the important steps of NSGA-II as described in Algorithm~\ref{alg:nsga2}: \begin{figure}[!ht] \centering \includegraphics[width=0.65\textwidth]{NSGAII_Flowchart}% \caption{Flowchart of NSGA-II (adapted from \citet{Deb2002}).} \label{fig:FlowchartNSGA} \end{figure} \begin{algorithm}[!ht] \caption{Non-dominated sorting genetic algorithm II \citep{Deb2002}} \begin{algorithmic}[1] \Require{} \Statex Sample initial population $\mathcal{P}_0$ of size $L$ \Comment{\color{DarkBlue} {\scriptsize{\emph{e.g.}, $L = 100$ }} \color{black}} \Statex Set maximum number of iterations $G_{\textrm{max}}$ \Comment{\color{DarkBlue} {\scriptsize{\emph{e.g.}, $G_{\textrm{max}} = 100$ }} \color{black}} \Statex Set $g = 0$; \texttt{NotConverged} $= \texttt{true}$, \Statex \hrulefill \While{\texttt{NotConverged} $== \texttt{true}$} \State Perform tournament selection: $\mathcal{P}_g^\prime \leftarrow \mathcal{P}_g$ \Comment{\color{DarkGreen} {\scriptsize{$\mathcal{P}_g^\prime$ is also of size $L$ }} \color{black}} \State Generate offsprings $Q_g$ \Comment{\color{DarkGreen} {\scriptsize{using cross-over and mutation operators}} \color{black}} \State Set $\mathcal{R}_g = \mathcal{P}_g^\prime \cup \mathcal{Q}_g$ \Comment{\color{DarkGreen} {\scriptsize{Combine parents and offspring }} \color{black}} \State Perform non-dominated sorting $\mathcal{F} = \acc{\mathcal{F}_1, \mathcal{F}_2, ...}$ \State Set $\mathcal{P}_{g+1} = \emptyset, \quad i = 1$ \While{$\textrm{Card}\prt{\mathcal{P}_{g+1}} < L$} \State $\mathcal{P}_{g+1} = \mathcal{P}_{g+1} \cup \mathcal{F}_i$ \State $i \leftarrow i+1$ \EndWhile \State Sort $\mathcal{F}_i$ \Comment{\color{DarkGreen} {\scriptsize{w.r.t. the individuals crowding distance}} \color{black}} \State Set $\mathcal{F}_i^\prime = $ \texttt{sorted}$\prt{\mathcal{F}_i}\bra{1:L-\textrm{Card}\prt{\mathcal{P}_{g+1}} }$ \Comment{\color{DarkGreen} {\scriptsize{Select the $L-\textrm{Card}\prt{\mathcal{P}_{g+1}}$ best elements in $\mathcal{F}_i$ }} \color{black}} \State Set $\mathcal{P}_{g+1} = \mathcal{P}_{g+1} \cup \mathcal{F}_i^\prime$ \Let{$g$}{$g+1$} \If{Convergence is achieved or $g = G_{\textrm{max}}$} \State \texttt{NotConverged} $= \texttt{false}$ \EndIf \EndWhile \end{algorithmic} \label{alg:nsga2} \end{algorithm} \begin{enumerate} \item \textbf{Children generation:} Following the initialization where the population $\mathcal{P}_g$ is sampled, the first step in Algorithm~\ref{alg:nsga2} is binary tournament selection, which is used to pre-select good individuals for reproduction. The idea is to form a new population $\mathcal{P}^\prime_g$ by selecting the best among two (or more) randomly selected individuals. The new population is then of the same size as the original but comprises repetitions. Individuals in this population constitute the basis for the generation of children using cross-over and mutation operators. The former consists in combining two parents to generate two offsprings. There exists a wide variety of cross-over operators \citep{Umbarkar2015} and NSGA-II uses the so-called \emph{simulated binary cross-over} (SBX). Mutation is used to prevent premature convergence to a local minimum. Following a predefined probability, a new offspring is mutated, \emph{i.e.}, some of its components are randomly perturbed, thus allowing for more exploration of the design space. The \emph{polynomial mutation} operator has been developed for NSGA-II. The resulting set of offsprings is denoted by $\mathcal{Q}_g$. \item \textbf{Non-dominated sorting:} Once the new population $\mathcal{R}_g$ is generated by assembling $\mathcal{P}^\prime_g$ and $\mathcal{Q}_g$, it is subjected to a recursive non-dominated sorting. This means that the set of all non-dominated individuals are identified and assigned rank one. This set, denoted by $\mathcal{F}_1$, is then set aside and non-dominated sorting is again performed on $\mathcal{R}_g \setminus \mathcal{F}_1$ to find the front of rank two $\mathcal{F}_2$. The process is repeated until all individuals have been assigned a rank. The population for the next generation is then composed of the individuals of the first ranks whose cumulated cardinality is smaller than $L$. \item \textbf{Crowding distance assignment:} To reach $L$ offsprings, it is necessary to select only a subset of the population in the following front. To do so, the crowding distance, which measures the distance of a given solution to the closest individuals in its rank, is used. Diversity in the Pareto front is hence enforced by choosing for the same rank solutions with the largest crowding distance. Once the remaining solutions are chosen according to their crowding distance ranking, the new population $\mathcal{P}_{g+1}$ is defined. \end{enumerate} This entire process is repeated until convergence is reached. NSGA-II is a powerful algorithm for multi-objective optimization. However, as all evolutionary algorithms, its effectiveness comes at the expense of a high computational cost. In this paper, a population of size $L=100$ is sampled per generation. Tens of generations are usually necessary to reach convergence. On top of that, computing the fitness, \emph{i.e.}, the quantiles for each individual solution, requires thousands of evaluations of the computational model. The overall computational cost is then prohibitive, especially when the computational model is expensive (\emph{e.g.}, results from a finite element analysis). To alleviate this burden, we consider surrogate models, more precisely Kriging, as described in the next section. \section{Use of Kriging surrogates}\label{sec:Kriging} \subsection{Basics of Kriging}\label{sec:Kriging:Basics} Several types of surrogate models have been used to reduce the computational cost of multi-objective evolutionary algorithms \citep{Manriquez2016}. These surrogates are often embedded in an active learning scheme where they are iteratively updated so as to be especially accurate in areas of interest. Gaussian process modelling a.k.a. Kriging naturally lends itself to such approaches as it features a built-in error measure that can be used to sequentially improve its own accuracy. Kriging (a.k.a. Gaussian process modelling) is a stochastic method that considers the model to approximate as a realization of a Gaussian process indexed by $\ve{w} \in \mathbb{R}^M$ and defined by \citep{Sacks1989, Santner2003, Rasmussen2006} \begin{equation} \widehat{\mathcal{M}}\prt{\ve{w}} = \ve{\beta}^T \ve{f} + Z\prt{\ve{w}}, \end{equation} where $\ve{\beta}^T \ve{f} = \sum_{j=1}^{p} \beta_j f_j\prt{\ve{w}}$ is a deterministic trend described here in a polynomial form (universal Kriging) and $Z\prt{\ve{w}}$ is a zero-mean stationary Gaussian process. The latter is completely defined by its auto-covariance function $\text{Cov}\bra{Z\prt{\ve{w}},Z\prt{\ve{w}^\prime}} = \sigma^2 R\prt{\ve{w},\ve{w}^\prime;\ve{\theta}}$, where $\sigma^2$ is the process variance, $R$ is an auto-correlation function and $\ve{\theta}$ are hyperparameters to calibrate. The auto-correlation function, which is also referred to as \emph{kernel}, encodes various assumptions about the process of interest such as its degree of regularity or smoothness. In this paper, we consider the Gaussian auto-correlation function, which is defined in its anisotropic form as \begin{equation} R\prt{\ve{w},\ve{w}^\prime;\ve{\theta}} = \prod_{i=1}^{M}\exp \bra{-\frac{1}{2} \prt{\frac{w_i-w_i^\prime}{\theta_i^2}}^2}. \end{equation} The calibration of the Kriging model consists in training it on an experimental design \\ $\mathcal{D} = \acc{\prt{\ve{w}^{(1)}, \mathcal{M}\prt{\ve{w}^{(1)}}} \enum \prt{\ve{w}^{(n_0)}, \mathcal{M}\prt{\ve{w}^{(n_0)}}}}$ and hence finding estimates of the three sets of hyperparameters $\acc{\ve{\beta},\ve{\theta}, \sigma^2}$. This can be achieved using methods such as maximum likelihood estimation or cross-validation \citep{Santner2003,Bachoc2013b,Lataniotis2018}. Once the parameters are found, it is assumed that for any new point $\ve{w}$, $\widehat{\mathcal{M}}\prt{\ve{w}}$ follows a Gaussian distribution $\mathcal{N}\prt{\mu_{\widehat{\mathcal{M}}}, \sigma_{\widehat{\mathcal{M}}}^2 }$ defined by its mean and variance as follows: \begin{equation}\label{eq:KRGpred} \begin{split} \mu_{\widehat{\mathcal{M}}}\prt{\ve{w}} & = \ve{f}^T\prt{\ve{w}} \widehat{\beta} + r\prt{\ve{w}} \ve{R}^{-1} \prt{\mathcal{Y} - \ve{F} \widehat{\beta}},\\ \sigma_{\widehat{\mathcal{M}}}^2\prt{\ve{w}} & = \widehat{\sigma}^2 \prt{ 1 - \ve{r}\prt{\ve{w}}^T \ve{R}^{-1} \ve{r}\prt{\ve{w}} + \ve{u}\prt{\ve{w}}^T \prt{\ve{F}^T \ve{R}^{-1} \ve{F}}^{-1} \ve{u}\prt{\ve{w}} }, \end{split} \end{equation} where $\widehat{\ve{\beta}} = \prt{\ve{F}^T \ve{R}^{-1} \ve{F}}^{-1} \ve{F}^T \ve{R}^{-1} \mathcal{Y}$ is the generalized least-square estimate of the regression coefficients $\ve{\beta}$, $\widehat{\sigma}^2 = \frac{1}{N} \prt{\mathcal{Y} - \ve{F} \widehat{\ve{\beta}}}^T \ve{R}^{-1} \prt{\mathcal{Y} - \ve{F} \widehat{\ve{\beta}}}$ is the estimate of the process variance with $\ve{F} = \acc{f_j\prt{\ve{w}^{(i)}}, \, j = 1 \enum p, \, i = 1 \enum n_0 }$ being the Vandermonde matrix, $\ve{R}$ the correlation matrix with $R_{ij} = R\prt{\ve{w}^{(i)},\ve{w}^{(j)};\ve{\theta}}$ and $\mathcal{Y} = \acc{\mathcal{Y}^{(i)} = \mathcal{M}\prt{\ve{w}^{(i)}}, i = 1 \enum n_0}$. Furthermore, $\ve{r}\prt{\ve{w}}$ is a vector gathering the correlation between the current point $\ve{w}$ and the experimental design points and finally, $\ve{u}\prt{\ve{w}} = \ve{F}^T \ve{R}^{-1} \ve{r}\prt{\ve{w}} - \ve{f}\prt{\ve{w}}$ has been introduced for convenience. The prediction for any point $\ve{w}$ is then given by the mean $\mu_{\widehat{\mathcal{M}}}\prt{\ve{w}}$ in Eq.~\eqref{eq:KRGpred}. On top of that, Kriging also provides a prediction variance $\sigma_{\widehat{\mathcal{M}}}^2\prt{\ve{w}}$ which is a built-in error measure that can be used to compute confidence intervals about the prediction. This variance is the main ingredient that has favored the development of adaptive methods such as Bayesian global optimization, as shown in the next section. \subsection{Kriging for multi-objective and robust optimization}\label{sec:Kriging:LitRev} \paragraph{Multi-objective optimization\\} The naive and direct approach to leverage the optimization CPU cost with Kriging is to calibrate the latter using the experimental design $\mathcal{D}$ and then to use it in lieu of the original model throughout the optimization process. This approach is however expensive as it would require an accurate Kriging model in the entire design space. A more elaborate technique has been developed under the framework of \emph{efficient global optimization} (EGO, \citet{Jones1998}) where the experimental design is sequentially enriched to find the minimizer of the approximated function. This enrichment is made by maximizing the \emph{expected improvement} (EI), which is a merit function indicating how likely a point is to improve the currently observed minimum given the Kriging prediction and variance. The EGO framework has shown to be very efficient and new merit functions have been proposed to include other considerations such as a better control of the exploration/exploitation balance and the inclusion of constraints \citep{Schonlau1998,Bichon2008}. The first extension for multi-objective optimization was proposed by \citet{Knowles2006} through the ParEGO algorithm. In ParEGO, the expected improvement is applied on the scalarized objective function derived using the augmented Tchebycheff approach. By varying weights in the scalarization, a Pareto front can be found. \citet{Zhang2010} proposed a similar approach using both the Tchebycheff and weighted sum decomposition techniques with the possibility of adding multiple well-spread points simultaneously. However, such approaches inherit the pitfalls of the underlying decomposition methods. \citet{Keane2006} proposed new extensions of EI that allows one to directly find a Pareto front without transforming the multi-objective problem into a mono-objective one. Another adaptation of a mono-objective criterion has been proposed by \citet{Svenson2010} with their expected maximin improvement function. This is based on the Pareto dominance concept and involves a multi-dimensional integration problem which is solved by Monte Carlo simulation, except for the case when $m=2$ for which an analytical solution is provided. Apart from such adaptations, some researchers have proposed new improvement functions directly built for a discrete approximation of the Pareto front. Moving away from the EGO paradigm, \citet{Picheny2015} proposed a stepwise uncertainty reduction (SUR) method for multi-objective optimization. Alternatively, the hypervolume measure of a set, which is the volume of the subspace dominated by the set up to a reference point, has been used to derive infill criteria. Namely, \citet{Emmerich2006} proposed a hypervolume-based improvement criterion. Originally based on Monte Carlo simulation, \citet{Emmerich2011} proposed a procedure to compute the criterion numerically. This method, however, does not scale well with the number of objective functions or samples in the approximated Pareto set. Efforts have been put in reducing this computational cost. This includes the contributions of \citet{Couckyut2014,Hupkens2015,Yang2019}. They all involve solving numerically the underlying integration problems by partitioning the space into slices using various methods. Finally, another attempt at decreasing the cost has been made by \citet{Gaudrie2020} where the authors proposed to focus the search of the Pareto front to a subspace according to some design preference. By doing so, the size of the discrete Pareto set can be reduced and the CPU cost of estimating the expected hypervolume improvement altogether. In this work, we rather use a two-level nested approach as described in Section~\ref{sec:PropAppr}. We do not consider a direct Bayesian global optimization approach for two reasons. First, as shown above, such techniques in the context of multi-objective optimization are computationally intensive. Second, and most of all, the functions to optimize are not the direct responses of the model that would be approximated by a surrogate because of the robustness component of the problem that is now explained in details in the next section. \paragraph{Robust optimization\\} In robust optimization, one aims at finding an optimal solution which shows little sensitivity to the various uncertainties in the system. This is generally achieved by minimizing a measure of robustness, \eg the variance and/or mean or a quantile of the cost function (See Eq.~\eqref{eq:RobustOptim}). The computation of the robustness measure coupled to the optimization incur a prohibitive computational cost to the analysis. Hence, surrogate-assisted techniques, which are a means to reduce this cost, have received a lot of attention lately. However, due to the fact that the robustness measure that is minimized is only a by-product of the performance function which is usually approximated by a Kriging model, Bayesian optimization techniques are seldom considered. Instead, most of the literature focuses on non-adaptive schemes. In an early contribution, \citet{Chatterjee2019} performed a benchmark using several surrogate models for robust optimization. \citet{Lee2006} proposed approximating the logarithm of the variance of the performance function, which is then minimized using a simulated annealing algorithm. Some contributions however addressed the problem while considering active learning in a nested loop scheme, \emph{e.g.}, \citet{Razaaly2020} where a quantile or the mean of the response is minimized. In this work, the authors built local surrogate models for each design and used them to estimate the quantiles. Similarly, \citet{Ribaud2020} proposed to minimize the Taylor expansions of the performance function's expectation and variance. They considered various configurations for which they used either the expected improvement (or its multi-points version) of the quantities of interest. Finally, \citet{Sabater2021} developed a method based on Bayesian quantile regression to which they added an infill sampling criterion for the minimization of the quantile. \subsection{Proposed approach}\label{sec:PropAppr} In the previous section, we have very briefly reviewed the literature for multi-objective and robust optimization. The two topics were treated separately because, to the authors' best knowledge, very little to no research has been done for the combined problem (except for cases where the multi-objective formulation is due to minimizing two conflicting robustness measures). \citet{Zhang2019} proposed a framework for the solution of multi-objective problems under uncertainties using an adaptive Kriging model built in an augmented space. The latter is introduced as a means to combine the design and random variables space and hence to allow for the construction of a unique surrogate model that could simultaneously support optimization and uncertainty propagation \citep{Kharmanda2002,Au2005,Taflanidis2008}. Earlier works considering the augmented random space for optimization include \citet{Dubourg2011, Taflanidis2014, MoustaphaSMO2016}. In this work, we also consider building a surrogate model in an augmented space, however using an optimizer and enrichment scheme that are different from the ones proposed in \citet{Zhang2019}. The latter proposed to use the $\varepsilon$-constraint method to solve the multi-objective problem and devised a hybrid enrichment scheme enabled by the fact that their robustness measure is the expectation of the objective function. \citet{Ribaud2020} estimated the expected improvement for the variance of the objective function by Monte Carlo simulation, which can be computationally expensive. In this paper, we consider a nested level approach, hence allowing us to rely on a surrogate of the objective function itself rather than that of the robustness measure, herein the quantile. The latter is then estimated using Monte Carlo simulation with the obtained surrogate and the resulting optimization problem is solved using an evolutionary algorithm, namely \emph{NSGA-II}. Coupling the optimization and the surrogate model construction in the augmented space, an enrichment scheme is devised as described in Step 6 of the algorithm described in the next section. The workflow of the algorithm is detailed in Figure~\ref{fig:Flowchart} and summarized in the following: \begin{figure}[!ht] \centering \begin{tikzpicture}[node distance=2cm,auto,scale=0.8,transform shape] \node(init)[init] {Initialization: $\mathbb{W}$, $\{\mathcal{W},\mathcal{Y}\}$, $\bar{\ve{\eta}}_q$, $\ve{G}_\textrm{max}$, $K$, ... } ; \node (i0) [counter, below of = init, node distance = 1.7cm] {$j=1$}; \node(S0)[init, below of = i0, node distance = 1.7cm]{Build inner surrogate model $\widehat{\mathcal{M}}^{(j)}$ in the augmented space $\mathbb{W}$}; \node(NSGA)[init, below of = S0, node distance = 1.9cm]{Run NSGA-II with $G^{(j)}_\textrm{max}$ generations}; \node(Acc)[init, below of = NSGA, node distance = 2.3cm]{Estimate the accuracy of the surrogate on the Pareto solutions using Eq.~\eqref{eq:QRelErr}}; \node (eta) [decision, below of = Acc, node distance = 2.5cm ,aspect=3] {Is all $\eta_{q_{k}}^{(j)} \leq \bar{\eta}_q^{(j)}$ ?}; \node(doe)[init, right = 1cm of Acc]{Enrich the experimental design following Step 6.}; % \node (meta)[init, left = 1cm of S0 ]{Build outer surrogate model on the design space $\mathbb{D}$}; \node (fin) [Fin, below = 0.5 cm of eta, node distance = 2cm] {End}; \node (ii1) [counter, above of = doe] {$j \leftarrow j+1$}; % \draw [arrow] (init) -- (i0); \draw [arrow] (i0) -- (S0); \draw[line] (S0) -- (NSGA); \draw [arrow] (NSGA) -- (Acc); \draw [arrow] (Acc) -- (eta); \path [line] (eta) -| node[near start] {no} (doe); \draw [arrow] (doe) -- (ii1); \path [line] (ii1) |- (S0); \draw [arrow] (Acc) -- (eta); \draw [arrow, dashed] (S0) -- (meta); \path [line, dashed] (meta) |- (NSGA); \path [line] (eta) -- node[near start] {yes} (fin); \end{tikzpicture} \caption{Flowchart of the proposed approach.} \label{fig:Flowchart} \end{figure} \begin{enumerate} \item \textbf{Initialization:} The various parameters of the algorithm are initialized. This includes: \begin{itemize} \item the augmented random space, which is defined as in \citet{MoustaphaSMO2019}, \emph{i.e.} \begin{equation} \mathbb{W} = \mathbb{X} \times \mathbb{Z}, \end{equation} where $\mathbb{Z}$ is the support of the random variables $\ve{Z} \sim f_{\ve{Z}}$ and $\mathbb{X}$ is the design space extended to account for the variability in the extreme values of the design variables. This \emph{confidence space}, which is defined considering the cumulative distribution of the random variables at the lower and upper design bounds, respectively denoted by $F_{X_i|d_i^-}$ and $F_{X_i|d_i^+}$, reads \begin{equation} \mathbb{X} = \prod_{i=1}^{M_d} \bra{x_i^-, \, x_i^+}, \end{equation} where $x_i^{-} = F_{X_i|d_i^-}\prt{\alpha_{d_i^-}}$ and $x_i^{+} = F_{X_i|d_i^+}\prt{1 - \alpha_{d_i^+}}$ are bounds on the design random variable space with respect to confidence levels of $\alpha_{d_i^-}$ and $\alpha_{d_i^+}$. Note that if there were no uncertainties on the design parameters, we would simply use $\mathbb{X} = \mathbb{D}$; \item the initial experimental design $\mathcal{D} = $ \\ $\acc{\prt{\mathcal{W}, \mathcal{Y}} = \prt{\ve{w}^{(i)},\ve{\mathcal{Y}}^{(i)}}: \ve{w}^{(i)} \in \mathbb{W} \subset \mathbb{R}^M, \, \ve{\mathcal{Y}}^{(i)} = \mathcal{M}\prt{\ve{w}^{(i)}} \in \mathbb{R}^m, \, i = 1 \enum n_0 }$, where the inputs are sampled using Latin hypercube sampling (LHS, \citet{McKay1979}); \item the NSGA-II related parameters and convergence threshold such as the maximum number of generations $G_{\textrm{max}}^{(j)}$, and \item the enrichment parameters, such as the number of enrichment points $K$ per iteration. \end{itemize} \item \textbf{Surrogate model construction:} A Kriging model, denoted by $\widehat{\mathcal{M}}^{(j)}$, is built in the augmented space $\mathbb{W}$ using $\mathcal{D}$, as described in Section~\ref{sec:Kriging:Basics}. \item \textbf{Optimization:} The NSGA-II algorithm is then run to solve the problem in Eq.~\eqref{eq:RMO_deter} where the quantiles are computed using the surrogate model $\widehat{\mathcal{M}}^{(j)}$ in lieu of the original model. Apart from the actual convergence criteria of NSGA-II, a maximum number of generations $G_\text{max}^{(j)}$ is set. Its value is chosen arbitrarily low at the first iterations. The idea is that at first, emphasis is put more on the exploration of the design space. Since NSGA-II starts with a space-filling LHS over the entire design space, the first generations are still exploring. By stopping the algorithm then, we can enrich the ED by checking the accuracy of the quantiles estimated by the early sets of design samples. This allows us to direct part of the computational budget for enrichment in areas pointing towards the Pareto front without skipping some intermediate areas of interest. \item \textbf{Accuracy estimation:} The local accuracy of the points in the current Pareto front $\mathcal{F}^{(j)}$ is estimated by considering the variance of the Kriging model. More specifically, the relative quantile error for each objective in every point of the Pareto set is estimated as follows: \begin{equation}\label{eq:QRelErr} \eta_{q_k}^{(i)} = \frac{q_{\alpha_k}^{+}\prt{\ve{d}^{(i)}} - q_{\alpha_k}^{-}\prt{\ve{d}^{(i)}} }{q_{\alpha_k}\prt{\ve{d}^{(i)}}}, \qquad \acc{\ve{d}^{(i)} \in \mathcal{F}^{(j)}, i = 1 \enum \textrm{Card}\prt{\mathcal{F}^{(j)}}}, \end{equation} where $q_{\alpha_k}^{\pm}$ are upper and lower bounds of the $k$-th objective quantile estimated using the predictors $\ve{\mu}_{\widehat{\mathcal{M}}_k^{(j)}} \pm 1.96 \, \ve{\sigma}_{\widehat{\mathcal{M}}_k^{(j)}}$. These are not actual bounds \emph{per se} but a "kind of" $95\%$-confidence interval indicating how accurate the Kriging models are locally. Note that when the quantiles response are close to $0$, it is possible to replace the denominator in Eq.~\eqref{eq:QRelErr} by another another normalizing quantity, such as the variance of the model responses at the first iteration. \item \textbf{Convergence check:} The convergence criterion is checked for all the points of the Pareto set with outliers filtered out to accelerate convergence. Samples with values larger than $\eta_{q_k}^{\textrm{90}} + 1.5 \, (\eta_{q_k}^{\textrm{90}} - \eta_{q_k}^{\textrm{10}})$ are considered to be outliers, where $\eta_{q_k}^{\textrm{90}}$ and $\eta_{q_k}^{\textrm{10}}$ are respectively the $90$-th and $10$-th percentile of the convergence criterion for the $k$-th objective. A usual definition of outliers is based on the interquartile range \citep{McGil1978} but we consider here a more conservative definition by rather using the interdecile range. Convergence is assumed if the relative quantile errors $\eta_{q_k}^{(i)}$ for all the points of the Pareto front (potential outliers excluded), as computed by Eq.~\eqref{eq:QRelErr}, are below a threshold $\bar{\eta}_q^{(j)}$. The latter can also be set adaptively so as to be loose in the initial exploratory cycles of the algorithm. The algorithm then goes to Step 8 if convergence is achieved or proceeds with the next step otherwise. \item \textbf{Enrichment:} $K$ points are added per iteration. The enrichment is carried out in two steps. The idea is to add multiple points to the ED within a single iteration by splitting them into two sets. While the first set consists of the points that directly maximize the learning function, the second set is spread out evenly among the best candidates for enrichment. In practice, they are obtained as follows: \begin{enumerate} \item First set: For each objective that does not satisfy the convergence criterion, the point in the Pareto set with the largest error is identified and denoted by $\ve{d}_k^{\textrm{max}}$. The corresponding enrichment sample is then chosen as the one which maximizes the local Kriging variance, \emph{i.e.},: \begin{equation}\label{eq:enr} \ve{w}_\textrm{next} = \arg \max_{\ve{w} \in \mathcal{C}_{q_k}} \sigma_{\widehat{\mathcal{M}}_{k}^{(j)}}\prt{\ve{w}}, \end{equation} where $\mathcal{C}_{q_k} = \acc{\prt{\ve{x}^{(i)}\prt{\ve{d}_k^{\textrm{max}}}, \; \ve{z}^{\ve{(i)}}}, i = 1 \enum N}$ is the sample set used to compute the quantiles for the design point $\ve{d}_k^{\textrm{max}}$. The number of added points is denoted by $K_1$ and corresponds to the number of objectives for which the convergence criterion is not respected. \item Second set: The remaining $K_2 = K-K_1$ points are identified by first selecting all the design solutions in the Pareto front that produce errors larger than the threshold $\bar{\eta}_q^{(j)}$. This set is then reduced into $K_2$ evenly distributed points using K-means clustering. For each of these points, the corresponding enrichment sample is chosen as the one maximizing the Kriging variance among the samples used to compute the corresponding quantiles, similarly to Eq.~\eqref{eq:enr}. \end{enumerate} \item \textbf{Experimental design update:} The original computational model is then evaluated on the $K$ enrichment points identified in the previous step, hence leading to $K$ new pairs of samples $\mathcal{D}^{(j)}_{\textrm{next}} = \acc{\prt{\ve{w}_{\textrm{next}}^{(1)}, \mathcal{M}\prt{\ve{w}_{\textrm{next}}^{(1)}}} \enum \prt{\ve{w}_{\textrm{next}}^{(K)}, \mathcal{M}\prt{\ve{w}_{\textrm{next}}^{(K)}}}}$. These samples are then added to the current experimental design, \emph{i.e.}, $\mathcal{D} \leftarrow \mathcal{D} \cup \mathcal{D}^{(j)}_{\textrm{next}}$ and the algorithm returns to Step 2. \item \textbf{Termination:} The outliers identified at Step 5, if any, are removed and the remaining points in the Pareto front and set are returned. \end{enumerate} To accelerate the whole procedure, we propose to optionally build at each iteration, and for each objective, an outer surrogate model to be used by the optimizer. The corresponding experimental design reads: \begin{equation} \mathcal{D}^{(j)}_{\textrm{out}} = \acc{\prt{\ve{d}^{(i)}, \widehat{q}_{\alpha_k}\prt{\ve{d}^{(i)}}}, i = 1 \enum n_\text{out}^{(j)}} \end{equation} where $\widehat{q}_{\alpha_k}$ is the quantile estimated using the current surrogate model $\widehat{\mathcal{M}}^{(i)}_k$. Since this surrogate is built using another surrogate model, it is not necessary to use active learning at this stage. Instead, we simply draw a unique and large space-filling experimental design of size $n_\textrm{out}^{(j)}$. To increase the accuracy around the Pareto front in the outer surrogate, the experimental design inputs are updated after each cycle considering two different aspects. First, the samples in the Pareto set of the previous cycle are added to the space-filling design. Second, the accuracy of the outer surrogate w.r.t. the inner one in estimating the quantiles in the Pareto front is checked after each cycle. The related error is monitored and calculated as follows: \begin{equation} \eta_{{q_k},\text{out}}^{(j)} = \max_{i \in \acc{1 \enum \text{Card}\prt{\mathcal{F}^{(j)}}}} \frac{\abs{\widehat{q}_{\alpha_k}\prt{\ve{d}^{(i)}} - \mu_{\widehat{q}_k}\prt{\ve{d}^{(i)}}} }{\widehat{q}_{\alpha_k}\prt{\ve{d}^{(i)}}}, \end{equation} where $\mu_{\widehat{q}_k}$ is the quantile predicted by the outer surrogate model. If this error is larger than a threshold $\bar{\eta}_{q,\textrm{out}}$ the size of the ED for the outer surrogate is increased before the next cycle. \section{The case of categorical variables}\label{sec:Categorical} The methodology presented in the previous section assumes that all variables are continuous. However, in some cases, and particularly in the applications considered in this paper, some of the design variables may be categorical. Categorical variables are defined in a discrete and finite space and have the particularity that they are qualitative and cannot be meaningfully ordered. As such, the Euclidean distance metric does not apply to such variables. However, NSGA-II, Kriging and $K$-means clustering rely on such a metric since it is used in the definition of the cross-over and mutation operators, and in the evaluation of the kernel function. It is thus necessary to adapt these definitions to handle the mixed categorical-continuous problems treated in this paper. To highlight the nature of the variables, we introduce the notations $\ve{w} = \prt{\ve{w}_\text{con},\ve{w}_\text{cat}}$ where $\ve{w}_\text{con} \in \mathbb{R}^{M_\text{con}}$ is a vector gathering the continuous variables while $\ve{w}_\text{cat} \in \mathbb{R}^{M_\text{cat}}$ gathers the categorical parameters. Each component $w_{\text{cat}_j}$ can take one of $b_j$ values, called levels, and denoted by $\acc{\ell_1 \enum \ell_{b_j}}$. Hence, there is a total of $b = \prod_{j=1}^{M_\text{cat}} b_j$ levels. \paragraph{NSGA-II with mixed continuous-categorical variables\\} Prompted by their reliance on heuristics, a large variety of both cross-over and mutation operators have been proposed in the literature throughout the years. The ones developed for NSGA-II, \emph{i.e.}, the simulated binary crossover (SBX) and polynomial mutation, are dedicated to continuous variables only. Various adaptations have been proposed but they may only be used for discrete variables as they involve numerical rounding. For operators dedicated to categorical variables, we look into those developed for binary genetic algorithm \citep{Umbarkar2015}. Since GA allows for treating each variable separately, we first split the continuous and categorical variables into two groups. For the continuous variables, the original operators for NSGA-II are used without any modification. For the categorical variables, we consider two operators typically used in binary genetic algorithms, namely the one-point crossover operator and a simple random mutation. In practice, let us consider two parents whose categorical components are denoted by $\ve{w}_\text{cat}^{(1)}$ and $\ve{w}_\text{cat}^{(2)}$. One-point cross-over is achieved by randomly choosing an integer $p$ such that $1 \leq p < M_\text{cat} $ which will serve as a cross-over point where the parents are split and swapped to create two offsprings, \emph{i.e.}, \begin{equation} \left\{ \begin{array}{ll} \ve{w}_\textrm{cat}^{\textrm{offspring},(1)} = \acc{\ell_{1}^{(1)} \enum \ell_{p}^{(1)}, \ell_{p+1}^{(2)} \enum \ell_{M_\text{cat}}^{(2)}}, \\ \ve{w}_\textrm{cat}^{\textrm{offspring},(2)} = \acc{\ell_{1}^{(2)} \enum \ell_{p}^{(2)}, \ell_{p+1}^{(1)} \enum \ell_{M_\text{cat}}^{(1)}}. \\ \end{array} \right. \end{equation} As for the mutation, the components to be mutated are simply replaced by another level of the same variables drawn with equi-probability. Let us assume that the component $w_{\textrm{cat},j}^{\textrm{offspring},(1)} = \ell_q$ of an offspring has been selected for mutation. It is then replaced by drawing uniformly from the set $\acc{\ell_1 \enum \ell_{M_\text{cat}}} \setminus \ell_q$, where each level has a probability of $1/(M_\text{cat}-1)$ to be selected. It should be noted at this point that mutation is only performed with a probability of $1/M$, meaning that on average only one variable (both categorical and continuous) is mutated per iteration. \paragraph{Kriging with mixed continuous-categorical variables \\} One of the most important features of Kriging is the auto-correlation or kernel function, which encodes assumptions about the centered Gaussian process $Z\prt{\ve{w}}$. Most Kriging applications rely on continuous variables and there is a rich list of possible kernel functions for such variables. Examples include the polynomial, Gaussian, exponential or Mat\'ern kernels \citep{Santner2003}. Such kernels are built exclusively for quantitative variables and need some tedious adaptations or pre-processing such as one-hot encoding when it comes to qualitative variables. An alternative yet cumbersome technique is to build multiple models, one associated to each level of the categorical space. A more convenient way of handling mixed categorical-continuous variable problems is through the definition of adapted kernels. This is facilitated by an important property which allows one to build valid kernels by combining other valid kernels through operators such as product, sum or ANOVA \citep{Roustant2020}. Considering the product operator and splitting the input variables into their continuous and categorical components, a kernel can be obtained as follows: \begin{equation} k \prt{\ve{w},\ve{w}^\prime} = k_\text{con} \prt{\ve{w}_{\text{con}}, \ve{w}_{\text{con}}^\prime} \cdot k_\text{cat} \prt{\ve{w}_{\text{cat}}, \ve{w}_{\text{cat}}^\prime}, \end{equation} where $k_\text{con}$ and $k_\text{cat}$ are kernels defined on the space of continuous and categorical variables, respectively. Thanks to this property, it is possible to build a different kernel for each type of variables separately. At the lowest level, it is actually possible to build a kernel for each dimension, which is the approach considered here. For the continuous variables, the traditional kernels can be used without any modification. As for the categorical variables, a few approaches have been proposed in the literature. One of the earliest contributions is that of \citet{Qian2008} which however involved a tedious calibration procedure. \citet{Zhou2011} proposed an enhancement based on hypersphere decomposition with a much more simplified calibration procedure. However, they use the most generic parametrization approach which does not scale well with the overall number of levels $b$. More parsimonious representations have been proposed, \emph{e.g.,} the so-called \emph{compound symmetry} which assumes the same correlation among different levels of the same categorical variables. Using such an approach and the Gower distance \citep{Gower1971}, \citet{Halstrup2016} proposed a novel kernel function for mixed problems. The Gower distance measure is able to deal with mixed variables and reads as follows \citep{Gower1971}: \begin{equation} d_{\text{Gow}}\prt{\ve{w},\ve{w}^\prime} = \frac{1}{M} \sum_{k=1}^{M} S_{w_k w_{k}^\prime} \end{equation} where $S_{w_k w_{k}^\prime}$ is a similarity measure between the components $w_k$ and $w_k^\prime$ and reads: \begin{itemize} \item for the categorical components: \begin{equation} S_{w_k w_{k}^\prime} = \left\{ \begin{array}{ll} 0 \quad \mbox{if} \quad w_k = w_k^\prime,\\ 1 \quad \mbox{if} \quad w_k \neq w_k^\prime; \\ \end{array} \right. \end{equation} \item for the continuous components: \begin{equation} S_{w_k w_{k}^\prime} = \frac{\abs{w_k - w_k^\prime}}{\Delta_k}, \end{equation} with $\Delta_k$ being the range of the parameters in the $k$-th dimension. \end{itemize} \citet{Halstrup2016} uses this distance within the Mat\'ern auto-correlation function. In this work, we consider the Gaussian kernel by combining the Euclidian distance for the continuous part and the similarity measure of the Gower distance for the categorical variables. The resulting kernel therefore reads \begin{equation} k\prt{\ve{w},\ve{w}^\prime} = \exp\prt{ -\frac{1}{2} \sum_{k=1}^{M_\text{con}} \prt{\frac{w_{\text{con}} - w_{\text{con}}^\prime} {\theta_k}}^2 - \frac{1}{2} \sum_{k=1}^{M_\text{cat}} \prt{\frac{S_{w_{\text{cat}_k} w_{\text{cat}_k}^\prime}}{\theta_k}}^2 }. \end{equation} It is flexible enough and can be implemented easily within a generic software such as \textsc{UQLab} \citep{MarelliUQLab2014}. However, as shown in \citet{Pelematti2020}, such kernels may be limited when there are a high number of levels. In fact, a kind of stationary assumption is embedded in this construction as the kernel only depends on the difference between two levels, regardless of their actual values. More advanced techniques such as group kernels have been proposed in the literature but they are not considered in this work \citep{Roustant2020}. Let us eventually note that the Gower distance measure is also used to compute distances in the $K$-means clustering algorithm in the enrichment scheme. In our implementation, the cluster centers are updated by calculating, in each cluster, the mean for the continuous variables and the mode for the categorical values. \section{Applications}\label{sec:Applications} In this section, we will consider three applications examples. The first two ones are analytical and will serve to illustrate and validate the proposed algorithm. The last one is the engineering application related to optimal building renovation strategies. To assess the robustness of the proposed methodology, the analysis is repeated $10$ times for the first two examples. The reference solution is obtained by solving this problem using NSGA-II and without surrogates. The accuracy is assessed by evaluating the closeness of the obtained Pareto front with the reference one. The hypervolume, which is the volume of the space dominated by the Pareto front, is chosen as basis for comparison. It is often computed up to a given reference point as illustrated in Figure~\ref{fig:Hypervolume}. In this work, the reference point is considered as the Nadir point, \emph{i.e.}, \begin{equation} R = \prt{R_1, R_2}= \prt{\max_{\ve{d} \in \mathcal{D}^\ast_\textrm{ref}} \mathfrak{c}_1\prt{\ve{d}}, \max_{\ve{d} \in \mathcal{D}^\ast_\textrm{ref}} \mathfrak{c}_2\prt{\ve{d}}} , \end{equation} where $\mathcal{D}^\ast_\textrm{ref}$ is the Pareto set corresponding to the reference Pareto front $\mathcal{F}_\textrm{ref}$ . \begin{figure}[!ht] \centering \includegraphics[width=0.49\textwidth]{Hypervolume}% \caption{Illustration of the hypervolume as the red shaded area. The reference Pareto front $ \mathcal{F}_\textrm{ref}$ is repesented by the blue line while the Nadir point $R$ is shown by the black dot.} \label{fig:Hypervolume} \end{figure} The hypervolume (here area) up to the reference point $R$ is approximated using the trapezoidal rule for integration. By denoting the one obtained from the $i$-th repetition by $A^{\prt{i}}$, the resulting relative error measure reads \begin{equation}\label{eq:Delta_HV} \Delta_{\textrm{HV}}^{(i)} = \frac{\abs{A^{\prt{i}}-A_\textrm{ref}}}{A_\textrm{ref}}, \end{equation} where $A_\textrm{ref}$ is the hypervolume estimated using the reference solution. To estimate the part of the error due to the outer surrogate model, we compute the same error again, but this time using the original model and the Pareto set. Denoting the corresponding hypervolume by $A^\prime$, the following relative error is estimated: \begin{equation}\label{eq:Delta_HVprime} \Delta_{\textrm{HV}}^{\prime (i)} = \frac{\abs{A^{\prime \prt{i}}-A_\textrm{ref}}}{A_\textrm{ref}}. \end{equation} \subsection{Example 1: $7$-dimensional analytical problem} The first example considered here is an analytical problem built for illustration and validation purposes. The original problem, referred to as BNH, is popular in benchmarks for multi-objective optimization and was introduced in \citet{Binh1997}. It is a two-dimensional problem which is however deterministic and only contains continuous variables. We therefore add two categorical variables and three random variables so as to build a multi-objective and robust optimization problem. The original problem, which reads \begin{equation} \begin{split} \ve{d}^\ast = & \arg \min_{\ve{d} \in \bra{0, \, 5} \times \bra{0, \, 3}} \acc{\tilde{\mathfrak{c}}_1 = 4 \prt{d_{1}^{2} + d_{2}^{2}} \, ; \, \tilde{\mathfrak{c}}_2 = {\prt{d_1 - 5}}^2 + \prt{d_2 - 5}^2 } \\ \text{subjet to:} & \acc{ \prt{d_1-5}^2 + d_{1}^{2} - 25 \leq 0 \, ; \, - \prt{d_1-8}^2 - \prt{d_2+3}^2 + 7.7 \leq 0}, \end{split} \end{equation} is modified using the following two steps: \begin{itemize} \item First, the two objective functions are modified to include two categorical variables $d_3$ and $d_4$, which can take each three possible levels: \begin{equation} \begin{split} \left\{ \begin{array}{lll} \bar{\mathfrak{c}}_1 = \tilde{\mathfrak{c}}_1 + 5 & \bar{\mathfrak{c}}_2 = \tilde{\mathfrak{c}}_2 + 5 & \text{if} \quad d_3 = 1,\\ \bar{\mathfrak{c}}_1 = \tilde{\mathfrak{c}}_1 - 2 & \bar{\mathfrak{c}}_2 = \tilde{\mathfrak{c}}_2 - 2& \text{if} \quad d_3 = 2, \\ \bar{\mathfrak{c}}_1 = \tilde{\mathfrak{c}}_1 & \bar{\mathfrak{c}}_2 = \tilde{\mathfrak{c}}_2 & \text{if} \quad d_3 = 3, \end{array} \right. \end{split} \end{equation} \begin{equation} \begin{split} \left\{ \begin{array}{lll} \hat{\mathfrak{c}}_1 = 2 \, \bar{\mathfrak{c}}_1 & \hat{\mathfrak{c}}_2 = 2 \, \bar{\mathfrak{c}}_2 & \text{if} \quad d_4 = 1,\\ \hat{\mathfrak{c}}_1 = 0.8 \, \bar{\mathfrak{c}}_1 & \hat{\mathfrak{c}}_2 = 0.95 \, \bar{\mathfrak{c}}_2 & \text{if} \quad d_4 = 2,\\ \hat{\mathfrak{c}}_1 = 0.95 \, \bar{\mathfrak{c}}_1 & \hat{\mathfrak{c}}_2 = 0.8 \, \bar{\mathfrak{c}}_2 & \text{if} \quad d_4 = 3,\\ \end{array} \right. \end{split} \end{equation} \item Then the random variables are added as follows: \begin{equation} \begin{split} \left\{ \begin{array}{ll} \mathfrak{c}_1 = (\hat{\mathfrak{c}}_1 + z_5^2) \, z_7,\\ \mathfrak{c}_2 = (\hat{\mathfrak{c}}_2 + z_6^2) \, z_7, \end{array} \right. \end{split} \end{equation} where $Z_5 \sim \text{Lognormal}(5, \, 0.5^2)$, $Z_6 \sim \text{Lognormal}(4, \, 0.4^2)$ and $Z_7 \sim \text{Gumbel}(1, \, 0.2^2)$. In this notation, the two parameters are the mean and variance of $Z_5$, $Z_6$ and $Z_7$, respectively. \end{itemize} The final optimization problem therefore reads: \begin{equation}\label{eq:Example1} \begin{split} \ve{d}^{\ast} = & \arg \min_{\ve{d} \in \bra{0, \, 5} \times \bra{0, \, 3}} \acc{Q_{\alpha} \prt{\mathfrak{c}_1;\ve{X}\prt{\ve{d}}, \ve{Z}}, \, Q_{\alpha} \prt{\mathfrak{c}_2; \ve{X}\prt{\ve{d}}, \ve{Z}} } \\ \text{subject to:} & \acc{ \prt{d_1-5}^2 + d_{1}^{2} - 25 \leq 0 \, ; \, - \prt{d_1-8}^2 - \prt{d_2+3}^2 + 7.7 \leq 0} \end{split} \end{equation} For each of the $10$ repetitions, the analysis is started with an initial experimental design of size $n_0 = 3 M = 21$. We consider five values of the stopping criterion, namely $\bar{\eta}_q = \acc{0.1, \, 0.05, \, 0.03, \, 0.01, \, 0.001}$ (See Eq.~\eqref{eq:QRelErr}). Figure~\ref{fig:Example1:Delta} shows the relative error on the hypervolumes (as in Eq.~\eqref{eq:Delta_HV}~and~\eqref{eq:Delta_HVprime}) for each of these cases. As expected, the accuracy of the results increases as the convergence criterion is made tighter. This is however true only up to a given point. With $\bar{\eta}_q = 10^{-3}$, the criterion $\Delta_{\textrm{HV}}^{\prime}$, which is based on the Pareto set keeps decreasing while it increases noticeably when considering $\Delta_{\textrm{HV}}$ which is directly computed using the estimated Pareto front. This discrepancy can be attributed to the outer surogate model that becomes less accurate, probably due to overfitting, as the number of samples sizes is increased. It should be reminded here that the outer surrogate is built using a unique experimental design whose size may increase together with the iterations. Finally, we note that the number of evaluations of the original model increases rapidly together with the threshold for convergence, as shown in Figure~\ref{fig:Example1:Neval}. \begin{figure}[!ht] \centering \subfloat[Relative error w.r.t. surrogate model]{\label{fig:Example1:Delta:a}\includegraphics[width=0.49\textwidth]{Example1_Delta}}% \subfloat[Relative error w.r.t. original model]{\label{fig:Example1:Delta:b}\includegraphics[width=0.49\textwidth]{Example1_Delta_prime}}% \caption{Example 1: Relative errors w.r.t. the reference hypervolume for various thresholds of the stopping criterion.} \label{fig:Example1:Delta} \end{figure} \begin{figure}[!ht] \centering \includegraphics[width=0.5\textwidth]{Example1_Neval}% \caption{Example 1: Number of model evaluations for various thresholds of the stopping criterion.} \label{fig:Example1:Neval} \end{figure} To further explore these results, we consider the run with the median accuracy at the threshold of $\bar{\eta}_q = 0.03$. Figure~\ref{fig:Example1:Conv} shows the convergence of the selected analysis with the boxplots representing the relative error on the quantile for each point of the Pareto fronts. The green lines correspond to the worst quantile relative error after excluding outliers. The vertical dashed lines together with the triangular markers show where the algorithm would stop for various thresholds of the convergence criterion. After $20$ iterations, the rate of convergence decreases considerably, which explains the large added number of model evaluations required to reach the target of $\bar{\eta}_q = 10^{-3}$. \begin{figure}[!ht] \centering \subfloat[Convergence for $\mathfrak{c}_1$]{\label{fig:Example1:Conv:a}\includegraphics[width=0.49\textwidth]{Example1_Conv_1}}% \subfloat[Convergence for $\mathfrak{c}_2$]{\label{fig:Example1:Conv:b}\includegraphics[width=0.49\textwidth]{Example1_Conv_2}}% \caption{Example 1: Relative error of the $90\%$ quantiles of the costs $\mathfrak{c}_1$ and $\mathfrak{c}_2$ for the entire Pareto front at the end of each cycle. The upper convergence limit is shown by the continuous line.} \label{fig:Example1:Conv} \end{figure} Figure~\ref{fig:Example1:Pareto} shows the corresponding Pareto front (Figure~\ref{fig:Example1:Pareto:a}) and set (Figure~\ref{fig:Example1:Pareto:b}) together with the reference ones. As expected, given the way the categorical variables were introduced, there are two combinations of the categorical variables in the Pareto set: $\prt{d_3, d_4} = \prt{2, \,2}$ or $\prt{2, \,3}$. The two fronts cover the same volume and are spread in a similar way. In the input space, we can also see that the solutions cover roughly the same area. For this highlighted example, convergence is achieved in $16$ cycles with a total of $101$ evaluations of the original model. This contrasts with the total of $5 \cdot 10^7$ model evaluations ($100$ iterations of NSGA-II with $100$ samples per generation and $5,000$ samples for the estimation of the quantile for each design) required for the reference solution using a brute force approach. \begin{figure}[!ht] \centering \subfloat[Pareto front ]{\label{fig:Example1:Pareto:a}\includegraphics[width=0.49\textwidth]{Example1_Pareto_Front}}% \subfloat[Pareto set]{\label{fig:Example1:Pareto:b}\includegraphics[width=0.49\textwidth]{Example1_Pareto_Set}}% \caption{Example 1: Comparison of the Pareto fronts and sets for the results with median relative hypervolume error and the reference solution.} \label{fig:Example1:Pareto} \end{figure} \subsection{Example 2: Analytical problem with discontinuous Pareto front} This second analytical example is adapted from \citet{Manson2021}. The Pareto front for this example is concave and presents two discontinuities. Further it only features design variables (\ie, there is no environmental variables), some of which are random. This allows us to showcase the versatility of the proposed algorithm. The two deterministic cost functions read \begin{equation} \begin{split} \mathfrak{c}_1 = & \left\{ \begin{array}{ll} 1 - \exp\prt{- \sum_{i=1}^{2} \prt{d_i - 1/\sqrt{2}}^2} & \quad \text{if} \quad d_3 = 1,\\ 1.25 - \exp\prt{- \sum_{i=1}^{2} \prt{d_i - 1/\sqrt{2}}^2} & \quad \text{if} \quad d_3 = 2,\\ \end{array} \right. \\ \mathfrak{c}_2 = & \left\{ \begin{array}{ll} 1 - \exp\prt{- \sum_{i=1}^{2} \prt{d_i + 1/\sqrt{2}}^2} & \quad \text{if} \quad d_3 = 1,\\ 0.75 - \exp\prt{- \sum_{i=1}^{2} \prt{d_i + 1/\sqrt{2}}^2} & \quad \text{if} \quad d_3 = 2.\\ \end{array} \right. \end{split} \end{equation} We then add some random variables which we associate to the design variables $d_1$ and $d_2$. Both are assumed normal, \ie{} $X_i \sim \mathcal{N}\prt{d_i,0.1^2}, \, i = \acc{1,2}$. For this example, the variations in accuracy due to tighter convergence criteria are not so noticeable. In fact, the resulting Pareto front is already accurate enough with $\bar{\eta}_q = 0.1$. It should be noted that some of the variability in estimating the relative error is due to the approximations inherent to computing the hypervolume using the trapezoidal rule for integration and the limited set of points it relies upon. \begin{figure}[!ht] \centering \subfloat[Relative error w.r.t. surrogate model]{\label{fig:Example2:Delta:a}\includegraphics[width=0.49\textwidth]{Example2_Delta}}% \subfloat[Relative error w.r.t. original model]{\label{fig:Example2:Delta:b}\includegraphics[width=0.49\textwidth]{Example2_Delta_prime}}% \caption{Example 2: Relative errors w.r.t. the reference hypervolume for various thresholds of the stopping criterion.} \label{fig:Example2:Delta} \end{figure} \begin{figure}[!ht] \centering \includegraphics[width=0.5\textwidth]{Example2_Neval}% \caption{Example 2: Number of model evaluations for various thresholds of the stopping criterion.} \label{fig:Example2:Neval} \end{figure} This rapid convergence may also be seen on the small increase in number of model evaluations and cycles to convergence as shown in Figures~\ref{fig:Example2:Neval}~and~\ref{fig:Example2:Conv}. \begin{figure}[!ht] \centering \subfloat[Convergence for $\mathfrak{c}_1$]{\label{fig:Example2:Conv:a}\includegraphics[width=0.49\textwidth]{Example2_Conv_1}}% \subfloat[Convergence for $\mathfrak{c}_2$]{\label{fig:Example2:Conv:b}\includegraphics[width=0.49\textwidth]{Example2_Conv_2}}% \caption{Example 2: Relative error of the quantiles of the costs $\mathfrak{c}_1$ and $\mathfrak{c}_2$ for the entire Pareto front at the end of each cycle. The upper convergence limit is shown by the continuous line.} \label{fig:Example2:Conv} \end{figure} Finally, we show in Figure~\ref{fig:Example2:Pareto} the Pareto front and sets obtained for the median solution at the threshold $\bar{\eta}_q = 0.03$. The two Pareto fronts coincide in the objective space, showing good convergence of the algorithm. Similarly, the Pareto sets of the reference and approximated solutions overlap in the input space. \begin{figure}[!ht] \centering \subfloat[Pareto front ]{\label{fig:Example2:Pareto:a}\includegraphics[width=0.49\textwidth]{Example2_Pareto_Front}}% \subfloat[Pareto set]{\label{fig:Example2:Pareto:b}\includegraphics[width=0.49\textwidth]{Example2_Pareto_Set}}% \caption{Example 2: Comparison of the Pareto fronts and sets for the results with median relative hypervolume error and the reference solution.} \label{fig:Example2:Pareto} \end{figure} \subsection{Example 3: Application to building renovation} This third example deals with building renovation, which is actually the application that has motivated this work. Because buildings are responsible for $40 \%$ of energy consumption and $36 \%$ of greenhouse gas emissions from energy in Europe, the European union has recently pledged to renovate $35$ million buildings in the next $10$ years \citep{EC2020_24102020}. Building renovation is indeed an important lever since current buildings are not energy-efficient but yet are expected for the most part to still stand by 2050. Renovation thus needs to take into account the entire life cycle of the building, which may span over decades. This implies accounting for various uncertainties, be it in socio-economic and environmental conditions or in the variability of the parameters of the selected renovation strategies. This can be achieved using life cycle analysis where two quantities of interest are often considered: the \emph{life cycle cost} ($LCC$) and the \emph{life cycle environmental impact} ($LCEI$). The former includes various costs such as the cost of production of new materials, the related cost of replacement or repair, the labor cost, etc. The latter refers to the overall greenhouse gas emissions over the entire life cycle of the building posterior to the renovation. The stakeholders need to weigh these two quantities to decide which are the optimal renovation strategies for a given building while accounting for the various sources of uncertainty. To this aim, robust multi-objective optimization may be used as a reliable way of exploring the extremely large design space (\emph{i.e.}, the combination of all possible choices available to the stakeholders). Using $\mathfrak{c}_1 = LCC$ and $\mathfrak{c}_2 = LCEI$, the problem may be formulated as in Eq.~\eqref{eq:RMO_deter} and the proposed methodology may be used to solve it. As an application, we consider in this paper, a building situated in Western Switzerland and constructed in 1911 (See Figure~\ref{fig:Example3}). The LCA is carried out using a model developed in \citet{GalimshinaBE2020}. The computational model is implemented in Python and a single run lasts a few seconds. The model contains more than a hundred parameters. However, using expert knowledge and global sensitivity analysis, screening allowed us to reduce the input to $23$ parameters, among which $6$ are design parameters and $13$ are environmental variables \citep{GalimshinaBE2020}. The design parameters include $4$ categorical variables as shown in Table~\ref{tab:Example3:Param}, which lead to $3,600$ levels. This includes the $6$ types of heating system: oil, gas, heat pump, wood pellets, electricity and district heating. Various types of walls and windows with different characteristics that are selected from a publicly available catalog are also considered. The remaining two design parameters are the insulation thickness associated to the selected walls and slabs. The environmental variables are all random and their distributions are shown in Table~\ref{tab:Example3:EnvironParam}. They are split into three groups which pertain to the occupancy usage, economic parameters and renovation components variability. \begin{figure}[!ht] \centering \subfloat[Building facade]{\label{fig:Example3a}\includegraphics[width=0.39\textwidth]{Borde.jpg}}% \subfloat[Possible renovation scenarios]{\label{fig:Example3:b}\includegraphics[width=0.55\textwidth]{BORDE_RenovationStrategies.jpg}}% \caption{Building considered from renovation together with a few possible renovation scenarios (adapted from \citet{GalimshinaBE2020}).} \label{fig:Example3} \end{figure} \begin{table}[!ht] \centering \caption{Design parameters selected for the building renovation application. Curly brackets $\acc{\cdot}$ correspond to categorical variables. Square brackets $\bra{\cdot}$ define the interval of interest for continuous variables.} \label{tab:Example3:Param} \begin{tabular}{lc} \hline Parameter & Range \\ \hline Heating system & $\acc{1, \, 2, \enum 6}$ \\ Exterior wall type & $\acc{1, \, 2 \enum 10}$\\ Exterior wall insulation thickness (m) & $\bra{0.1, \,0.5}$ \\ Windows type & $\acc{1, \, 2 \enum 10}$ \\ Slab against unheated type & $\acc{1, \, 2 \enum 6}$ \\ Slab against unheated insulation thickness (m) & $\bra{0.1, \,0.5}$ \\ \hline \end{tabular} \end{table} \begin{table}[!ht] \centering \caption{Distribution of the environmental variables for the building renovation application.} \label{tab:Example3:EnvironParam} \begin{threeparttable} \begin{tabular}{lccc} \toprule Parameter & Distribution & Parameter 1\tnote{a} & Parameter 2\tnote{b}\\ \hline Room temperature (degree C) & Uniform & ${ 20}$ & ${23}$ \\ Airflow (m$^3/$h,m$^2$) & Uniform & ${0.7}$ & ${1}$ \\ \hline Inflation rate ($\%$) & Uniform & ${0.005}$ & ${0.02}$ \\ Discount rate ($\%$) & Uniform & ${0.035}$ & ${0.045}$ \\ \hline Uncertainty on exterior wall cost ($\%$) & Uniform & ${ -20}$ & ${ 20}$ \\ Uncertainty on exterior wall GWP\tnote{c} ($\%$) & Uniform & ${ -20}$ & ${ 20}$ \\ Uncertainty on windows cost ($\%$) & Uniform & ${ -20}$ & ${20}$ \\ Uncertainty on windows GWP ($\%$) & Uniform & ${ -20}$ & ${20}$ \\ Uncertainty on slab against unheated cost ($\%$) & Uniform & ${ -20}$ & ${ 20}$ \\ Uncertainty on slab against unheated GWP ($\%$) & Uniform & ${ -20}$ & ${ 20}$ \\ Uncertainty on slab against unheated RSL\tnote{d} ($\%$) & Uniform & ${ -20}$ & ${ 20}$ \\ Heating efficiency loss ($\%$) & Uniform & ${15}$ & ${25}$ \\ Exterior wall conductivity & Gumbel & ${ 0.69}$ & ${ 0.18}$ \\ Exterior wall RSL (years) & Lognormal & ${ 32}$ & ${ 2}$ \\ Windows RSL (years) & Lognormal & ${ 32}$ & ${ 2}$ \\ \bottomrule \end{tabular} {\footnotesize \begin{tablenotes} \item[a] Corresponds to the lower bound for uniform distributions and to the mean for non uniform distributions. \item[b] Corresponds to the upper bound for uniform distributions and to the standard deviation for non uniform distributions. \item[c] GWP stands for global warming potential. \item[d] RSL stands for reference service life. \end{tablenotes} } \end{threeparttable} \end{table} The analysis is initialized with an experimental design of size $n_0 = 3 M = 69$ points drawn using an optimized Latin hypercube sampling scheme. The threshold for convergence is set to $\bar{\eta}_q = 0.03$, which resulted in $57$ cycles of the algorithm as shown in Figure~\ref{fig:Example3:Conv}. This corresponds to a total of $271$ model evaluations. The Pareto front is shown in Figure~\ref{fig:Example3:Pareto}. It features some discontinuities which are due to some noticeable changes in the properties of the categorical variables. The main driver to decrease both $LCC$ and $LCEI$ is the heating system. The upper part of the Pareto front corresponds to a heat pump which leads to small values of $LCC$ and larger values of $LCEI$. This is in contrast with the wood pellets which correspond to the lower part of the Pareto front. For this example, we eventually select one solution, which is in the upper part and is highlighted by the red diamond in Figure~\ref{fig:Example3:Pareto}. This choice reflects a preference on the cost with respect to the environmental impact. Table~\ref{tab:Example3:Result} shows the detailed values of this selected renovation strategy. \begin{figure}[!ht] \centering \subfloat[Convergence for $\mathfrak{c}_1 = LCC$]{\label{fig:Example3:Conv:a}\includegraphics[width=0.49\textwidth]{Example3_Conv_1}}% \subfloat[Convergence for $\mathfrak{c}_2= LCEI$]{\label{fig:Example3:Conv:b}\includegraphics[width=0.49\textwidth]{Example3_Conv_2}}% \caption{Example 3: Relative quantile error of the entire Pareto front at the end of each cycle.} \label{fig:Example3:Conv} \end{figure} \begin{figure}[!ht] \centering \includegraphics[width=0.50\textwidth]{Example3_Pareto}% \caption{Example 3: Pareto front and selected solution.} \label{fig:Example3:Pareto} \end{figure} \begin{table}[!ht] \centering \caption{Selected renovation strategy from the Pareto front for the building renovation.} \label{tab:Example3:Result} \begin{tabular}{lc} \hline Parameter & Value \\ \hline Heating system & Heat pump \\ Exterior wall type & $\#4$ \\ Exterior wall insulation thickness (m) & $0.4778$ \\ Windows type & $\#9$ \\ Slab against unheated type & $\#5$ \\ Slab against unheated insulation thickness (m) & $0.4070$ \\ \hline \end{tabular} \end{table} Finally, to assess the accuracy of this analysis, we sample a validation set \\ $\mathcal{C}_{\textrm{val}} = \acc{\prt{\ve{d}^\ast, \ve{z}^{(i)}}, i = 1 \enum 500}$, where $\ve{d}^\ast$ is the selected solution. Figure~\ref{fig:Example3:Y_Y} compares the prediction by the final surrogate model and the original response on this validation set. As expected, the surrogate model is able to correctly approximate the original model around the chosen solution. This is confirmed by comparing the normalized mean-square error (NMSE) and the $90\%$-quantile shown in Table~\ref{tab:Example3:NMSE_Q}. Even though the Monte Carlo sample set size is reduced, the estimated quantiles allow us to have an idea of how accurate the surrogate models are. More specifically the relative errors of the quantiles of $LCC$ and $LCEI$ due to the introduction of the surrogates are approximately $0.2\%$ and $0.4\%$, respectively. The NMSE for $LCEI$ is slightly larger compared to that of $LCC$, which is consistent with the convergence history in Figure~\ref{fig:Example3:Conv}. This value could be reduced by selecting a smaller value of $\bar{\eta}_q$. This would however lead to a larger computational cost and analysis run time. {\color{red} \begin{figure}[!ht] \centering \subfloat[Building facade]{\label{fig:Example3:Y_Y:a}\includegraphics[width=0.49\textwidth]{Example3_Y_Y_1}}% \subfloat[Possible renovation scenarios]{\label{fig:Example3:Y_Y:b}\includegraphics[width=0.49\textwidth]{Example3_Y_Y_2}}% \caption{Example 3: Original \emph{vs.} predicted responses for a subset of the Monte Carlo set used to compute the quantiles at the selected solution.} \label{fig:Example3:Y_Y} \end{figure} \begin{table}[!ht] \centering \caption{Validation of the selected solution.} \label{tab:Example3:NMSE_Q} \begin{tabular}{lcccc} \hline & \multicolumn{2}{c}{$LCC$ (kCHF)} & \multicolumn{2}{c}{$LCEI$ (T. CO$_{2}$ eq. / year)} \\ Parameter & Original & Surrogate & Original & Surrogate \\ \hline Quantile & $8.9386$ & $8.9530$ & $11.0599$ & $11.0183$ \\ NMSE & & $0.0095$ & & $0.0146$ \\ \hline \end{tabular} \end{table} } \section{Conclusion} In this paper, we proposed a methodology for the solution of multi-objective robust optimization problems involving categorical and continuous variables. The problem was formulated using quantiles as a measure of robustness, the level of which can be set to control the desired degree of robustness of the solution. A nested solution scheme was devised, where optimization is carried out in the outer loop while uncertainty propagation is performed in the inner loop. This however results in a stochastic optimization problem which may be cumbersome to solve. The concept of common random numbers was introduced to approximate this stochastic problem by a deterministic one, which is much easier to solve. This allows us then to use a general-purpose multi-objective solver, namely the non-dominated sorting genetic algorithm II (NSGA-II). To reduce the computational burden of this nested solution scheme, Kriging was introduced in the proposed framework using an adaptive sampling scheme. This is enabled by checking the accuracy of the quantile estimates in areas of interest, namely the area around the Pareto front. Finally, the proposed approach was adapted to account for mixed categorical-continuous parameters. A first validation example was built analytically while considering all the characteristics of the problem at hand. The methodology was then applied to the optimization of renovation scenarios for a building considering uncertainties in its entire life cycle post-renovation. This has shown that a driving parameter for such a renovation is the replacement of the heating system by either wood pellets or heat pump. This result was validated by running the original model around the selected solution, hence showing that the final surrogate model was accurate. This methodology was eventually applied in a detailed analysis presented in \citet{GalimshinaENB2021}. \section{Competing interests} The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper. \section{Replication of results} The results presented in this paper were obtained using an implementation of the proposed methodology within \textsc{UQLab}, a \textsc{Matlab}-based framework for uncertainty quantification. The codes can be made available upon request. \bibliographystyle{chicago}
{'timestamp': '2022-03-07T02:02:48', 'yymm': '2203', 'arxiv_id': '2203.01996', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.01996'}
arxiv
\subsection{Experimental Evaluations of Channel Pruning and Weight Allocation Techniques}\label{pruning sec} \noindent\textbf{Empirical benefits of our proposed FLOP-aware pruning.} }%\textcolor{blue}{Both SplitCIFAR100 (Table~\ref{CIFARtable}) and MNIST (Figure~\ref{fig:mnist}) experiments show that our pruning algorithm performs well (by comparison between Individual-0.2/-1)}\ylm{Table~\ref{CIFARtable} shows that our algorithm performs well in our CL manner}, but missing additional experimental comparisons to alternative channel-pruning techniques. In this section, we evaluate our FLOP-aware pruning algorithm separately without continual learning and compare our results to $\ell_1$-based~\cite{liu2017learning} and Polarization-based~\cite{zhuang2020neuron} channel pruning methods. For all the experiments, we use the same ResNet18 architecture and hyperparameters as Table~\ref{CIFARtable} and train over CIFAR10 dataset. Results are presented in Figure~\ref{fig:CIFAR10_acc} \& \ref{fig:CIFAR10_ratio} and they are all averaged from 5 trials. We implement these three methods over different FLOPs constraints and also track the fraction of nonzero channels after pruning. Figure~\ref{fig:CIFAR10_acc} shows test accuracy after pruning. We observe our FLOP-aware pruning method (shown in the Blue curve) does well in maintaining high accuracy compared to the other methods. The benefit of our approach is most visible when the FLOPs constraint is more aggressive (e.g., around 1\% FLOPs). The green curve shows the Polarization-based method and demonstrate that it does not execute the pruning task successfully with less than 50\% FLOPs constraint. We found that this is because below a certain threshold, Polarization tends to prune a whole layer resulting in disconnectivity within the network. Figure~\ref{fig:CIFAR10_ratio} shows the fraction of nonzero channels that remained after pruning, and our method succeeds in keeping more channels while pruning the same number of FLOPs. Here, we emphasize keeping more channels is a measure of connectivity within the network (as we wish to avoid very sparse layers). We also observe that $\ell_1$ works well even for small FLOPs; however, it uses the same $\lambda_l$ penalization for all layers thus it is not FLOP-aware and performs uniformly worse than our FLOP-aware algorithm. \begin{figure*}[t] \vspace{-7pt} \centering \begin{subfigure}[t]{.33\textwidth} \centering \begin{tikzpicture}\hspace{-0pt} \node at (0,0) [scale=1.] {\includegraphics[width=\linewidth]{figs/CIFAR10.pdf}}; \node at (0,-1.9) [scale=0.8] {{FLOPs constraint $\gamma$}}; \node at (-2.5,0) [scale=0.8,rotate=90] {Accuracy}; \end{tikzpicture} \centering \caption{Test accuracy} \hspace{-0pt}\label{fig:CIFAR10_acc} \end{subfigure}\hspace{0pt}\begin{subfigure}[t]{.33\textwidth} \centering \begin{tikzpicture}\hspace{-0pt} \node at (-0,0) [scale=1.] {\includegraphics[width=\linewidth]{figs/CIFAR10_channel_num.pdf}}; \node at (0,-1.9) [scale=0.8] {FLOPs constraint $\gamma$}; \node at (-2.75,0) [scale=0.9,rotate=90] {Fraction of Nonzero Channels}; \end{tikzpicture} \caption{{Fraction of nonzero channels }}\label{fig:CIFAR10_ratio} \end{subfigure}\hspace{0pt}\begin{subfigure}[t]{.33\textwidth} \centering \begin{tikzpicture}\hspace{-0pt} \node at (0,0) [scale=1.] {\includegraphics[width=\linewidth]{figs/FLOP.pdf}}; \node at (0,-1.9) [scale=0.8] {FLOPs constraint $\gamma$}; \node at (-2.5,0) [scale=0.9,rotate=90] {Accuracy}; \end{tikzpicture} \centering \caption{{Impact of weight allocation $\alpha$ }}\label{fig:FLOP} \end{subfigure}\vspace{-10pt} \caption{{ \red{Experimental evaluations of our FLOP-aware channel pruning and weight allocation techniques.} Fig.~\ref{fig:CIFAR10_acc} \& \ref{fig:CIFAR10_ratio} show channel pruning results for different methods. We compare our FLOP-aware pruning algorithm to the $\ell_1$-based~\cite{liu2017learning} and Polarization-based~\cite{zhuang2020neuron} methods over ResNet18 model used in our CL experiments. These experiments are conducted for standard classification tasks on CIFAR10 dataset and only focus on pruning performance (rather than CL setting). Our FLOP-aware pruning is displayed as the Blue curve, and it broadly outperforms the alternative approaches ($\ell_1$-based and Polarization-based). The performance gap is most notable in the very-few FLOPs regime (which is of more interest for inference-time efficiency ). In Fig.~\ref{fig:FLOP}, we display the impact of weight allocation $\alpha$ (Eq.~\eqref{wa-eq}) and FLOPs constraint $\gamma$ on \emph{task-averaged ESPN accuracy} for SplitCIFAR100. Setting $\alpha$ too small (Blue curve) degrades performance as tasks do not get enough nonzeros to train on. Setting both $\alpha$ and $\gamma$ to be large also degrades performance (Red \& Green curves), because the first few tasks get to occupy the whole supernetwork at the expense of future tasks. Finally $\alpha=0.1$ (Orange) achieves competitive performance for all $\gamma$ choices. }}\vspace{-7pt} \end{figure*} \section{Application to Shallow Networks}\label{app:application} As a concrete instantiation of Theorem \ref{cl thm} let us consider a realizable regression setting with a shallow network. More sophisticated examples are deferred to future work. Fix positive integers $d$ and $r_\text{frz}\leq r$. Here, $d$ is the raw feature dimension and $r$ is the representation dimension which is often much smaller than $d$. The ingredients of our neural net example are as follows. \begin{myenumerate} \item Let $\psi:\mathbb{R}\rightarrow\mathbb{R}$ be a Lipschitz activation function with $\psi(0)=0$ such as Identity or (parametric) ReLU. }%\textcolor{blue}{\item Let $\sigma:\mathbb{R}\rightarrow[-1,1]$ be a Lipschitz link function such as logistic function $1/(1+e^{-x})$.} \item Let $Z$ be a zero-mean noise variable taking values on $[-1,1]$. \item Fix vectors $(\vct{v}^\star_t)_{t=1}^T\in\mathbb{R}^r$ with $\ell_2$ norms bounded by some $B>0$. \item Fix matrix $\mtx{W}^\star\in\mathbb{R}^{r\times d}$ with spectral norm (maximum singular value) upper bounded by some $\bar{B}>0$. \item Given input $\vct{x}\in\mathbb{R}^d$, task $t$ samples an independent $Z$ and assigns the label \begin{align} y=\sigma({\vct{v}^\star_t}^\top \psi(\mtx{W}^\star\vct{x}))+Z.\label{planted} \end{align} \item Fix $r_\text{frz}\leq r$. Let $\mtx{W}_\text{frz}\in\mathbb{R}^{r\times d}$ be the matrix where the first $r_\text{frz}$ rows }%\textcolor{blue}{are same as $\mtx{W}^\star$}\ylm{This assumes no mismatch} whereas the last $r_\text{new}:=r-r_\text{frz}$ rows are equal to zero. \end{myenumerate} This setting assumes that first $r_\text{frz}$ features are generated by $\mtx{W}_\text{frz}$ and \eqref{crl} should learn remaining features $\mtx{W}^\star_\text{new}:=\mtx{W}^\star-\mtx{W}_\text{frz}$ and the classifier heads $(\vct{v}^\star_t)_{t=1}^T$. We remark that above one can use arbitrary $[-C,C]$ limits rather than $[-1,1]$ or one can replace $[-1,1]$ limits with subgaussian tail conditions. }%\textcolor{blue}{For some $\bar{B}\geq \|\mtx{W}^\star\|_F$}, we choose search space ${\cal{W}}$ to be the set of all matrices $\mtx{W}_\text{new}$ such that spectral norm obeys $\|\mtx{W}_\text{new}\|\leq \bar{B}$ and the first $r_\text{frz}$ rows of $\mtx{W}_\text{new}$ are zero. This way, we focus on learning the missing part of the representation $\mtx{W}^\star$. Let us fix the loss function $\ell$ to be quadratic and denote ${\mtx{V}}=(\vct{v}_t)_{t=1}^T$. Then, \eqref{crl} takes the following parametric form \begin{align} &\hat{{\mtx{V}}},\hat{\mtx{W}}_\text{new}=\underset{\mtx{W}=\mtx{W}_\text{frz}+\mtx{W}_\text{new}}{\underset{\tn{\vct{v}_t}\leq B,\mtx{W}_\text{new}\in {\cal{W}}}{\arg\min}}{\widehat{\cal{L}}}({\mtx{V}},\mtx{W}):=\frac 1 T\sum_{t=1}^T}%_{\text{new}} {\widehat{\cal{L}}}_{\mathcal{S}_t}(\vct{v}_t,\mtx{W}) \nonumber\\ &\text{WHERE}\quad {\widehat{\cal{L}}}_{\mathcal{S}_t}(\vct{v}_t,\mtx{W})=\frac{1}{N}\sum_{i=1}^N (y_{ti}-\sigma(\vct{v}_t^\top \psi(\mtx{W}\vct{x}_{ti})))^2. \n \end{align} We have the following result regarding this optimization. It is essentially a corollary of Theorem \ref{cl thm}. The proof is deferred to the Appendix \ref{app B}. \begin{theorem}\label{cl thm3} Consider the problem above with $T$ tasks containing $N$ samples each with datasets $(\mathcal{S}_t)_{t=1}^T$ generated according to \eqref{planted}. Suppose input domain $\mathcal{X}\in\mathbb{R}^d$ has bounded $\ell_2$ norm. With probability at least $1-2e^{-\tau}$, the task-averaged population risk of the solution $(\hat{{\mtx{V}}},\hat{\mtx{W}}_\text{new})$ obeys \begin{align} {\cal{L}}(\hat{{\mtx{V}}},\hat{\mtx{W}}_\text{new})\leq \operatorname{\mathbb{E}}[Z^2]+ \sqrt{\frac{\ordet{T}%_{\text{new}} r+r_\text{new} d+\tau}}{T}%_{\text{new}} N}}.\nonumber \end{align} \end{theorem} \textbf{Interpretation:} Observe that the minimal risk is ${\cal{L}}^\star=\operatorname{\mathbb{E}}[Z^2]$ which is the noise independent of features. The additional components are the excess risk due to finite samples. In light of Theorem \ref{cl thm}, we simply plug in $\cc{{\mtx{H}}}=r$, $\cc{{\boldsymbol{\Phi}}_{\text{new}}}=r_\text{new} d$ and ${\cal{L}}^\star_{\phi_{\text{frz}}}={\cal{L}}^\star$. The first two arise from counting number of trainable parameters: each classifier has $r$ parameters and representation ${\boldsymbol{\Phi}}_{\text{new}}$ has $r_\text{new} d$ parameters. ${\cal{L}}^\star_{\phi_{\text{frz}}}={\cal{L}}^\star$ arises from the fact that we chose $\mtx{W}_\text{frz}$ to be subset of $\mtx{W}^\star$ thus there is no mismatch. }%\textcolor{blue}{When $\mtx{W}_\text{frz}=0$} (i.e.~learning representation from scratch), this bound is comparable to prior works \cite{tripuraneni2020provable,du2020few}, and in fact, it leads to (slightly) improved sample-complexity bounds. }%\textcolor{blue}{For instance, when $\psi$ is identity activation (i.e.~linear setting) \cite{tripuraneni2020provable} requires $TN\gtrsim r^2d$ samples to learn the whereas our sample size grows only linear in $r$ and requires $TN\gtrsim rd$. Additionally, \cite{du2020few} requires per-task sample sizes to obey $N\gtrsim d$ samples whereas we only require $N\gtrsim r$.} \section{Appendix B: Proof of Theorem \ref{cl thm}} In this section, we prove our main theoretical result Theorem~\ref{cl thm}. \begin{proof} To be start, let ${\mtx{H}}_\varepsilon$ and ${\boldsymbol{\Phi}}_{\text{NEW},\varepsilon}$ be $\varepsilon$-covers of ${\mtx{H}}$ and ${\boldsymbol{\Phi}}_{\text{new}}$ and define $\vct\mathcal{F}={\mtx{H}}_\varepsilon^T\times{\boldsymbol{\Phi}}_{\text{NEW},\varepsilon}$. Following the Def.~\ref{def:cov} we have \begin{align} \log|\vct\mathcal{F}|\leq D ~~~\text{where}~~~\red{D:=(T\mathcal{C}({\mtx{H}})+\mathcal{C}({\boldsymbol{\Phi}}_{\text{new}}))\log((\bar{C}/\varepsilon))}. \nonumber \end{align} Set $t=\sqrt{\frac{D+\tau}{cNT}}$ where $c>$ is an absolute constant. Since loss function $\ell(\cdot)$ is bounded in $[0,1]$, then following Hoeffding inequality we have \begin{align} \P(|{\cal{L}}({\vct{\hat{h}}},\hat{\phi})- {\cal{L}}^{\st}_{{\phi}_{\text{frz}}}|\geq t)&\leq2|\vct\mathcal{F}|e^{-cNTt^2}, \nonumber\\ &\leq2|\vct\mathcal{F}|e^{-D-\tau}, \nonumber\\ &\leq2e^{-\tau}. \label{prob} \end{align} Now consider about the task-averaged risk perturbation introduce by covered set. Let $\phi_{\text{new}},\phi_{\text{new}}'\in{\boldsymbol{\Phi}}_{\text{new}},{\boldsymbol{\Phi}}_{\text{NEW},\varepsilon}$ and $h,h'\in{\mtx{H}},{\mtx{H}}_{\varepsilon}$ be $L$-Lipschitz functions (in Euclidean distance). Then $\phi:=\phi_{\text{new}}+\phi_{\text{frz}}$ and $\phi':=\phi_{\text{new}}'+\phi_{\text{frz}}$ also satisfy $L$-Lipschitz constraint. \begin{align} {\cal{L}}({\vct{h}},\phi)- {\cal{L}}({\vct{h}}',\phi')&\leq|{\cal{L}}({\vct{h}},\phi)- {\cal{L}}({\vct{h}}',\phi')|, \nonumber\\ &\leq \sup_{t\in[T]}|{\cal{L}}_{\mathcal{S}_t}(h_t,\phi)-{\cal{L}}(h_t',\phi')|, \nonumber\\ &\leq \sup_{t\in[T], i\in[N]}|\ell(y_{ti},h_t\circ\phi(\vct{x}_{ti}))-\ell(y_{ti},h_t'\circ\phi'(\vct{x}_{ti}))|, \nonumber \\ &\leq \Gamma\sup_{t\in[T], i\in[N]}|h_t\circ\phi(\vct{x}_{ti})-h_t'\circ\phi'(\vct{x}_{ti})|, \nonumber\\ &\leq\Gamma\sup_{t\in[T], i\in[N]}|h_t\circ\phi(\vct{x}_{ti})-h_t\circ\phi'(\vct{x}_{ti})|+|h_t\circ\phi'(\vct{x}_{ti})-h_t'\circ\phi'(\vct{x}_{ti})|, \nonumber\\ &\leq \Gamma (L+1)\varepsilon. \label{pert} \end{align} Combine results from \ref{prob} and \ref{pert} by setting $\varepsilon=$, then we find that with probability at least $1-2e^{-\tau}$ \begin{align} {\cal{L}}({\vct{\hat{h}}},\hat{\phi})- {\cal{L}}^{\st}_{{\phi}_{\text{frz}}}\leq\Gamma(L+1)\varepsilon+\sqrt{\frac{D+\tau}{cNT}}\nonumber. \end{align} \end{proof} \section{Experimental Setting of Figure~\ref{fig:diversity}}\label{app:imagenet} Following \cite{mallya2018packnet,hung2019compacting}, we conduct experiments in Sec.~\ref{sec:crl_exp} to study how task order and diversity benefits CL, we use $6$ image classification tasks, where ImageNet-1k~\cite{krizhevsky2012imagenet} is the first task, followed by CUBS~\cite{wah2011caltech}, Stanford Cars~\cite{krause20133d}, Flowers~\cite{nilsback2008automated}, WikiArt~\cite{saleh2015large} and Sketch~\cite{eitz2012humans}, Table~\ref{table:crl_dataset} provides the detail information of all datasets. In the experiment, we train a standard ResNet50 model on the last 5 tasks (CUBS to Sketch) to explore how the representation learned from ImageNet can benefit CRL. We follow the same learning hyperparameter setting as Table~\ref{CIFARtable}, where we use batch size of 128 and Adam optimizer with $(\beta_1,\beta_2)=(0,0.999)$. Also we train $60$ and $90$ epochs for pre-training and pruning with learning rate $0.01$, and then we fine-tune the free weights for $100$ epochs using cosine decay over learning rate starting from $0.01$. Specifically, we employ weight allocation $\alpha=0.1$ (Sec.~\ref{appsec: espnalgo}) in both individual and ESPN to enable continue representation learning. Compared with Individual/ESPN without pretrain, the ESPN with ImageNet pretrain employs a sparse pretrained ImageNet model from \cite{Wortsman2019DiscoveringNW} with 20\% non-zero weights. Table~\ref{table:crl_exp} shows the test accuracy when learning the last 5 tasks and performances get improved in all 5 tasks. } \section{Proof of Theorems \ref{cl thm} and \ref{cl thm3}}\label{app B} In this section and in Appendix \ref{app C}, we provide two main theorems: Theorem \ref{cl thm} and Theorem \ref{seq thm}. We will first prove Theorem \ref{cl thm} which adds $T$ new tasks by leveraging a frozen feature extractor $\phi_{\text{frz}}$. Secondly, observe that Theorem \ref{cl thm} adds the $T$ new tasks in a multitask fashion which models the setting where new tasks arrive in batches of size $T$. This still captures continual learning due to the use of the frozen feature-extractor that corresponds to the features built by earlier tasks. Also, setting $T=1$ in Theorem \ref{cl thm} corresponds to adding a single new task and updating the representation. Using this observation, we provide an additional result Theorem \ref{seq thm} where the tasks are added to the super-network sequentially. Theorem \ref{seq thm}, provided in Appendix \ref{app C}, arguably better captures the CL setting. In essence, it follows as an iterative applications of Theorem \ref{cl thm} after introducing proper definitions that capture the impact of imperfections due to finite sample learning (see Definition \ref{def pop seq} and Assumption \ref{fin comp}). \subsection{Proof of Theorem \ref{cl thm}} The original statement of Theorem \ref{cl thm} does not introduce certain terms formally due to space limitations. Here, we first add some clarifying remarks on this. Let $\mathcal{B}(S)$ return the smallest Euclidean ball containing the set $S$ (that lies on an Euclidean space). For a function $f:\mathcal{Z}\rightarrow\mathcal{Z}'$, define the $\lin{\cdot}$ norm to be the Lipschitz constant $\lin{f}:=\lin{f}^{\mathcal{Z}}=\sup_{\vct{x},\vct{y}\in \mathcal{B}(\mathcal{Z})}\frac{\tn{f(\vct{x})-f(\vct{y})}}{\tn{\vct{x}-\vct{y}}}$. Below, we assume that $\phi_{\text{frz}}$ and all $\phi_{\text{new}}\in{\boldsymbol{\Phi}}_{\text{new}}$, $h\in{\mtx{H}}$ are $L$-Lipschitz (on their sets of input features). Suppose $\mathcal{X}$ is the set of feasible input features and $\mathcal{X}$ has bounded Euclidian radius $R=\sup_{\vct{x}\in\mathcal{X}}\tn{\vct{x}}$. This means that input features of the classifier $h$ lie on the set $\mathcal{X}'=\phi_{\text{frz}}\circ{\mtx{X}}+{\boldsymbol{\Phi}}_{\text{new}}\circ{\mtx{X}}$ with Euclidian radius bounded by $2LR$. Thus both raw features and intermediate features \ylm{(output of $\phi\in{\boldsymbol{\Phi}}$)} are bounded {and we use these sets in Def.~\ref{def:cov}.} {Thus, we set $\bar{C}:=\max(\bar{C}_{\mathcal{X}},\bar{C}_{\mathcal{X}'})$ below.} \begin{theorem}[Theorem \ref{cl thm} restated] \label{cl thm2} Recall that $({\vct{\hat{h}}},\hat{\phi}=\hat{\phi}_{\text{new}}+{\phi}_{\text{frz}})$ is the solution of \eqref{crl}. Suppose that the loss function $\ell(y,\hat{y})$ takes values on $[0,B]$ and is $\Gamma$-Lipschitz w.r.t.~$\hat{y}$. Draw $T$ independent datasets $\{(\vct{x}_{ti},y_{ti})\}_{i=1}^N\subset \mathcal{X}\times \mathcal{Y}$ for $t\in [T]$ where each dataset is distributed i.i.d.~according to ${\cal{D}}_t$. Suppose the input set $\mathcal{X}$ has bounded Euclidean radius. Suppose $\lin{\phi_{\text{frz}}},\lin{\phi_{\text{new}}},\lin{h}\leq L$ for all $\phi_{\text{new}}\in{\boldsymbol{\Phi}}_{\text{new}},h\in{\mtx{H}}$. With probability at least $1-2e^{-\tau}$, for some absolute constant $C>0$, the task-averaged population risk of the solution $({\vct{\hat{h}}},\hat{\phi})$ obeys \begin{align} {\cal{L}}({\vct{\hat{h}}},\hat{\phi})&\leq {\cal{L}}^{\st}_{{\phi}_{\text{frz}}}+ CB\sqrt{\frac{(T\cc{{\mtx{H}}}+\cc{{\boldsymbol{\Phi}}_{\text{new}}})\log(\bar{C}\Gamma (L+1)NT)+\tau}{TN}},\nonumber\\ &\leq {\cal{L}}^{\st}+\text{MM}_{\text{frz}}}%^{\text{new}+CB\sqrt{\frac{(T\cc{{\mtx{H}}}+\cc{{\boldsymbol{\Phi}}_{\text{new}}})\log(\bar{C}\Gamma (L+1)NT)+\tau}{TN}}\nonumber. \end{align} \end{theorem} \begin{proof} Below $c,C>0$ denote absolute constants. For a scalar $a$, define $a_+=a+1$. The proof uses a covering argument following the definition of the covering dimension. Fix $1>\varepsilon>0$. To start with, let ${\boldsymbol{\Phi}}_{\text{new},\eps}$ and ${\mtx{H}}_\varepsilon$ be $\varepsilon$-covers (per Definition \ref{def:cov}) of the sets ${\boldsymbol{\Phi}}_{\text{new}}$ and ${\mtx{H}}$ respectively. Let ${\mtx{H}}_\varepsilon^T$ be $T$-times Cartesian product of ${\mtx{H}}_\varepsilon$. Our goal is bounding the supremum of the gap between the empirical and population risks to conclude with the result. \noindent\textbf{$\bullet$ Step 1: Union bound over the cover.} Following Definition \ref{def:cov}, we have that $\log|{\mtx{H}}^T_\varepsilon|\leq T\cc{{\mtx{H}}}\log(\bar{C}/\varepsilon)$, $\log|{\boldsymbol{\Phi}}_{\text{new},\eps}| \leq \cc{{\boldsymbol{\Phi}}_{\text{new}}}\log(\bar{C}/\varepsilon)$. Define $\mathcal{S}={\boldsymbol{\Phi}}_{\text{new},\eps}\times {\mtx{H}}^T_{\varepsilon}$. These imply that \[ \log|\mathcal{S}|\leq D\quad\text{where}\quad D:=(\cc{{\boldsymbol{\Phi}}_{\text{new}}}+T\cc{{\mtx{H}}})\log\left(\frac{\bar{C}}{\varepsilon}\right) \] Set $t=B\sqrt{\frac{D+\tau}{cNT}}$ for an absolute constant $c>0$ which corresponds to the concentration rate of the Hoeffding inequality that follows next. Using the fact that the loss function is bounded in $[0,B]$, applying a Hoeffding bound over all elements of the cover, we find that for all }%\textcolor{blue}{$(\vct{{\vct{h}}},\phi)\in \mathcal{S}$} \begin{align} \mathbb{P}(|{\cal{L}}(\vct{{\vct{h}}},\phi)-{\widehat{\cal{L}}}(\vct{{\vct{h}}},\phi)|\geq t)&\leq 2|\mathcal{S}|e^{-\frac{cNTt^2}{B^2}}\nonumber\\ &\leq 2|\mathcal{S}|e^{-D-\tau}=2e^{\log|\mathcal{S}|-D-\tau}\nonumber\\ &\leq 2e^{-\tau}.\label{prob bound} \end{align} \noindent\textbf{$\bullet$ Step 2: Perturbation analysis.} We showed the concentration on the cover. Now we need to relate the cover to the continuous set. Given any candidate $\phi=\phi_{\text{new}}+\phi_{\text{frz}}$ with $\phi_{\text{new}}\in{\boldsymbol{\Phi}}_{\text{new}},\vct{{\vct{h}}}:=(h_t)_{t=1}^T\in{\mtx{H}}^T$, we draw a neighbor $\phi'=\phi_{\text{new}}'+\phi_{\text{frz}}$ with $\phi_{\text{new}}'\in{\boldsymbol{\Phi}}_{\text{new},\eps},\vct{{\vct{h}}}':=(h'_t)_{t=1}^T\in{\mtx{H}}_\varepsilon^T$. Recall that $\lin{\phi_{\text{new}}},\lin{h}\leq L$ for all $\phi_{\text{new}}\in{\boldsymbol{\Phi}}_{\text{new}},h\in{\mtx{H}}$. The task-averaged risk perturbation relates to the individual risks which in turn relates to individual examples as follows. Let $f_t=h_t\circ \phi$ for all $t\in[T]$. \begin{align} |{\cal{L}}(\vct{{\vct{h}}},\phi)-{\cal{L}}(\vct{{\vct{h}}}',\phi')|&\leq \sup_{1\leq t\leq T} |{\cal{L}}_t(h_t,\phi)-{\cal{L}}_t(h_t',\phi')|\\ &\leq\sup_{i\in[n],t\in[T]}|\ell(y_{ti},f_t(\vct{x}_{ti}))-\ell(y_{ti},f'_t(\vct{x}_{ti}))|\\ &\leq\Gamma\sup_{i\in[n],t\in[T]}|f_t(\vct{x}_{ti})-f'_t(\vct{x}_{ti})|.\label{pert1 bound} \end{align} The perturbations for the individual examples are bounded via triangle inequalities as follows. \begin{align} |f_t(\vct{x}_{ti})-f'_t(\vct{x}_{ti})|\leq &|h_t\circ\phi(\vct{x}_{ti})-h'_t\circ\phi'(\vct{x}_{ti})|\nonumber\\ \leq & (|h_t\circ\phi(\vct{x}_{ti})-h_t\circ\phi'(\vct{x}_{ti})|+|h_t\circ\phi'(\vct{x}_{ti})-h'_t\circ\phi'(\vct{x}_{ti})|)\nonumber\\ \leq& (L+1)\varepsilon:=L_+\varepsilon.\label{last line} \end{align} The last line follows from the triangle inequality via $\varepsilon$-covering and $L$-Lipschitzness of $h$ and ${\phi}$ as follows \begin{itemize} \item Since $\tn{\phi(\vct{x}_{ti})-\phi'(\vct{x}_{ti})}=\tn{\phi_{\text{new}}(\vct{x}_{ti})-\phi_{\text{new}}'(\vct{x}_{ti})}\leq \varepsilon\implies |h_t\circ\phi(\vct{x}_{ti})-h_t\circ\phi'(\vct{x}_{ti})|\leq L\varepsilon$. \item Set $\vct{v}=\phi'(\vct{x}_{ti})$. Since $\tn{h(\vct{v})-h'(\vct{v})}\leq \varepsilon\implies |h'_t\circ\phi'(\vct{x}_{ti})-h_t\circ\phi'(\vct{x}_{ti})|\leq \varepsilon$. \end{itemize} Combining these, following \eqref{pert1 bound}, and repeating the identical perturbation argument \eqref{last line} for the empirical risk ${\widehat{\cal{L}}}$, we obtain \begin{align} \max(|{\cal{L}}(\vct{{\vct{h}}},\phi)-{\cal{L}}(\vct{{\vct{h}}}',\phi')|, |{\widehat{\cal{L}}}(\vct{{\vct{h}}},\phi)-{\widehat{\cal{L}}}(\vct{{\vct{h}}}',\phi')|)\leq \Gamma L_+\varepsilon.\label{pert bound} \end{align} \noindent\textbf{$\bullet$ Step 3: Putting things together.} Combining \eqref{prob bound} and \eqref{pert bound}, we found that, with probability at least $1-2e^{-\tau}$, for all ${\phi}=\phi_{\text{new}}+\phi_{\text{frz}}$ with $\phi_{\text{new}}\in{\boldsymbol{\Phi}}_{\text{new}}$ and all $\vct{{\vct{h}}}\in{\mtx{H}}^T$, we have that \begin{align} |{\cal{L}}(\vct{{\vct{h}}},\phi)-{\widehat{\cal{L}}}(\vct{{\vct{h}}},\phi)|\leq 2\Gamma L_+\varepsilon+B\sqrt{\frac{D+\tau}{cNT}}. \end{align} Setting }%\textcolor{blue}{$\varepsilon=\frac{1}{\Gamma L_+NT}$}, for an updated constant $C>0$, we find \begin{align} |{\cal{L}}(\vct{{\vct{h}}},\phi)-{\widehat{\cal{L}}}(\vct{{\vct{h}}},\phi)|\leq CB\sqrt{\frac{D+\tau}{NT}}.\label{unif conv} \end{align} where }%\textcolor{blue}{$D=(\cc{{\boldsymbol{\Phi}}_{\text{new}}}+T\cc{{\mtx{H}}})\log(\bar{C}\Gamma L_+NT)$} following the above definition of $D$. Note that, the uniform concentration above also implies the identical bound for the minimizer of the empirical risk. Let $(\hat\vct{{\vct{h}}},\hat{\phi})$ be the minimizer of the empirical risk. Specifically, let $(\vct{{\vct{h}}}^{\star,\phi_{\text{frz}}},\phi_{\text{new}}^{\star,\phi_{\text{frz}}})$ be the optimal hypothesis in $({\mtx{H}},{\boldsymbol{\Phi}}_{\text{new}})$ minimizing the population risk subject to using frozen feature extractor $\phi_{\text{frz}}$, that is, ${\cal{L}}(\vct{{\vct{h}}}^{\star,\phi_{\text{frz}}},\phi_{\text{new}}^{\star,\phi_{\text{frz}}}+\phi_{\text{frz}})={\cal{L}}^\star_{\phi_{\text{frz}}}$. Then, we note that \[ {\cal{L}}(\hat\vct{{\vct{h}}},\hat{\phi})\leq {\widehat{\cal{L}}}(\hat\vct{{\vct{h}}},\hat{\phi})+CB\sqrt{\frac{D+\tau}{NT}}\leq {\widehat{\cal{L}}}(\vct{{\vct{h}}}^{\star,\phi_{\text{frz}}},\phi_{\text{new}}^{\star,\phi_{\text{frz}}}+\phi_{\text{frz}})+CB\sqrt{\frac{D+\tau}{NT}}\leq {\cal{L}}^\star_{\phi_{\text{frz}}}+2CB\sqrt{\frac{D+\tau}{NT}}. \] This concludes the proof of the main statement (first line). The second statement follows directly from the definition of mismatch, that is, using the fact that $\text{MM}_{\text{frz}}}%^{\text{new}={\cal{L}}^\star_{\phi_{\text{frz}}}-{\cal{L}}^\star$. \end{proof} \subsection{Proof of Theorem \ref{cl thm3}} \begin{proof} Within this setting, classifier heads correspond to $h(\vct{a}):=h_{\vct{v}}(\vct{a})=\sigma(\vct{v}^\top\psi(\vct{a}))$ and ${\mtx{H}}=\{h_{\vct{v}}{~\big |~} \tn{\vct{v}}\leq B\}$. Similarly, feature representations correspond to $\phi(\vct{x})=\mtx{W}\vct{x}$, $\phi_{\text{frz}}(\vct{x})=\mtx{W}_\text{frz}\vct{x}$, $\phi_{\text{new}}(\vct{x}):=\phi_{\text{new}}^{\mtx{W}_\text{new}}(\vct{x})=\mtx{W}_\text{new}\vct{x}$ where $\mtx{W}=\mtx{W}_\text{frz}+\mtx{W}_\text{new}\in\mathbb{R}^{r\times d}$. The hypothesis set becomes ${\boldsymbol{\Phi}}_{\text{new}}=\{\phi_{\text{new}}^{\mtx{W}_\text{new}}{~\big |~} \mtx{W}_\text{new}\in{\cal{W}}\}$. Here $\mtx{W}_\text{new}\in{\cal{W}}$ is the weights of the new feature representation to learn on top of $\mtx{W}_\text{frz}$. Importantly, $\mtx{W}_\text{new}$ only learns the last $r_\text{new}$ rows since first $r_\text{frz}$ rows are fixed by frozen feature extractor $\mtx{W}_\text{frz}$. For the proof, we simply need to plug in the proper quantities within Theorem \ref{cl thm}. First, observe that ${\cal{L}}^\star=\operatorname{\mathbb{E}}[Z]^2$ since $Z$ is independent zero-mean noise thus for any predictor using $\hat{y}:=\hat{y}(\vct{x})$ input features we have \[ \operatorname{\mathbb{E}}[\ell(y,\hat{y})]=\operatorname{\mathbb{E}}[(y(\vct{x})+Z-\hat{y}(\vct{x}))^2]\geq \operatorname{\mathbb{E}}[Z^2], \] where $y(\vct{x})=\sigma({\vct{v}^\star_t}^\top \psi(\mtx{W}^\star\vct{x}))$ is the noiseless label. We next prove that ${\cal{L}}^\star_\text{frz}={\cal{L}}^\star=\operatorname{\mathbb{E}}[Z^2]$. This simply follows from the fact that frozen representation $\mtx{W}_\text{frz}$ is perfectly compatible with ground-truth representation $\mtx{W}^\star$. Specifically, observe that $\mtx{W}^\star_\text{new}:=\mtx{W}^\star-\mtx{W}_\text{frz}$ lies within the hypothesis set ${\cal{W}}$ since by construction $\|\mtx{W}^\star_\text{new}\|\leq \|\mtx{W}^\star\|\leq \bar{B}$ and $\mtx{W}^\star_\text{new}$ is zero in the first $r_\text{frz}$ rows. Similarly $(\vct{v}^\star_t)_{t=1}^T$ obey the $\ell_2$ norm constraint $\tn{\vct{v}^\star_t}\leq B$. Thus, $\mtx{W}^\star_\text{new},{\mtx{V}}^\star=(\vct{v}^\star_t)_{t=1}^T$ are feasible solutions of the hypothesis space and since $\mtx{W}^\star_\text{new}+\mtx{W}_\text{frz}=\mtx{W}^\star$, for this choice we have that $\hat{y}(\vct{x})=y(\vct{x})$ thus task-specific risks induced by $(\vct{v}^\star_t,\mtx{W}^\star)$ obey ${\cal{L}}_t(\vct{v}^\star_t,\mtx{W}^\star)=\operatorname{\mathbb{E}}[Z^2]$ for all $t\in[T]$. Consequently, the task-averaged risk obeys ${\cal{L}}({\mtx{V}}^\star,\mtx{W}^\star)=\operatorname{\mathbb{E}}[Z^2]$ proving aforementioned claim. The remaining task is bounding the covering dimensions of the hypothesis sets ${\mtx{H}}$ and ${\boldsymbol{\Phi}}_{\text{new}}$ and verifying Lipschitzness. The Lipschitzness of $h(\vct{a})=\sigma(\vct{v}^\top\psi(\vct{a}))\in{\mtx{H}}$, $\phi_{\text{frz}}(\vct{x})=\mtx{W}_\text{frz}\vct{x}$, $\phi_{\text{new}}(\vct{x})=\mtx{W}_\text{new}\vct{x}\in{\boldsymbol{\Phi}}_{\text{new}}$ follows from the fact that all $\mtx{W}_\text{new}\in{\cal{W}},\mtx{W}^\star,\mtx{W}_\text{frz}$ have spectral norms bounded by $\bar{B}$, and the fact that, the Lipschitz constant of $h$ (denoted by $\frac{5B^2\tn{\vct{y}}}{\laz^2}{\cdot}$) can be bounded as $\frac{5B^2\tn{\vct{y}}}{\laz^2}{h}\leq \frac{5B^2\tn{\vct{y}}}{\laz^2}{\sigma} \frac{5B^2\tn{\vct{y}}}{\laz^2}{\psi}\tn{\vct{v}}\leq \bar{L}^2 B$ where $\bar{L}=\max(\frac{5B^2\tn{\vct{y}}}{\laz^2}{\psi},\frac{5B^2\tn{\vct{y}}}{\laz^2}{\sigma})$. Recall that dependence on the Lipschitz constant is logarithmic. {What remains is determining the covering dimensions of ${\mtx{H}},{\boldsymbol{\Phi}}_{\text{new}}$ which simply follows from covering the parameter spaces of $\vct{v}\in\mathcal{B}^d(B),\mtx{W}_\text{new}\in{\cal{W}}$. Here $\mathcal{B}^d(B)$ is defined to be the Euclidean ball of radius $B$. Suppose $\mathcal{X}$ lies on an Euclidean ball of radius $R$ and let $\mathcal{F}=(\{\phi_{\text{frz}}\}+{\boldsymbol{\Phi}}_{\text{new}})\circ \mathcal{X}$ be the feature representations. Since $\mtx{W}_\text{frz}$ and $\mtx{W}_\text{new}$ have spectral norm at most $\bar{B}$, $\mathcal{F}$ is subset of Euclidean ball of radius $2\bar{B} R$.} {Fix an $\varepsilon_0=\frac{\varepsilon}{2\bar{B} R\bar{L}^2}$ $\ell_2$-cover of $\mathcal{B}^d(B)$. This cover has cardinality at most $(\frac{6B\bar{B} R\bar{L}^2}{\varepsilon})^d$ and induces an $\varepsilon$ cover of ${\mtx{H}}$. To see this, given any $\vct{f}\in\mathcal{F}$ and $\vct{v}\in \mathcal{B}^d(B)$, there exists a cover element $\vct{v}'$ with $\tn{\vct{v}'-\vct{v}}\leq \varepsilon_0$, as a result $|h_{\vct{v}'}(\vct{f})-h_{\vct{v}}(\vct{f})|\leq \bar{L}^2\tn{\vct{f}}\tn{\vct{v}'-\vct{v}}\leq \varepsilon$. Consequently $\cc{{\mtx{H}}}=d$. Similarly, since elements of ${\cal{W}}$ has $r_\text{new} d$ nonzero parameters (and recalling that ${\cal{W}}$ is also subset of spectral norm ball of radius $\bar{B}$) ${\cal{W}}$ admits a $\frac{\varepsilon}{R}$ Frobenius cover of cardinality $(\frac{3R\bar{B}\sqrt{r_\text{new}}}{\varepsilon})^{r_\text{new} d}$. Consequently, for any $\phi_{\mtx{W}}$ with $\mtx{W}=\mtx{W}_\text{new}+\mtx{W}_\text{frz}$, there exists a cover element $\phi_{\mtx{W}'}$ with $\|\mtx{W}'_{\text{new}}-\mtx{W}_\text{new}\|\leq \tf{\mtx{W}'_\text{new}-\mtx{W}_\text{new}}\leq \frac{\varepsilon}{R}$, such that for all $\vct{x}\in\mathcal{X}$, we have that $|\phi_{\mtx{W}}-\phi_{\mtx{W}'}|\leq \|\mtx{W}'_{\text{new}}-\mtx{W}_\text{new}\|\tn{\vct{x}}\leq \varepsilon$. Consequently $\cc{{\boldsymbol{\Phi}}_{\text{new}}}\leq r_\text{new} d$. These bounds on covering dimensions conclude the proof after applying Theorem \ref{cl thm}.} \end{proof} \section{Theoretical Analysis of Adding $T$ New Tasks Sequentially (Theorem \ref{seq thm})}\label{app C} Theorem \ref{cl thm} adds $T$ tasks simultaneously on frozen feature extractor $\phi_{\text{frz}}$. Below, we consider the setting where we add these tasks sequentially via repeated applications of Theorem \ref{cl thm} and a new task $t$ builds upon the cumulative representation learned from tasks $1$ to $t-1$. This setting better reflects what actually happens in continual learning and in our experiments but is more involved because representation quality of an earlier task will impact the accuracy of the future tasks. To this end, we first describe the learning setting and assumptions on the representation mismatch. \noindent\textbf{Sequential learning setting:} We will learn a new task with index $t$ over the hypothesis set ${\boldsymbol{\Phi}}_{\text{new}}^t$ for $t\in[T]$. Suppose we are at task $t$. That is, we assume that we have already built incremental (continual) feature-extractors $\phi_{\text{new}}^1,\dots,\phi_{\text{new}}^{t-1}$ for tasks $1$ through $t-1$ where each one obeys $\phi_{\text{new}}^\tau\in{\boldsymbol{\Phi}}_{\text{new}}^\tau$. Thus, the (cumulative) frozen representation at time $t$ is given by \[ \phi_{\text{frz}}^t=\phi_{\text{frz}}+\sum_{i=1}^{t-1} \phi_{\text{new}}^i. \] Here $\phi_{\text{frz}}:=\phi_{\text{frz}}^1$ is the representation built before any new task arrived. Using $\phi_{\text{frz}}^t$, we solve the following (essentially identical) variation of \eqref{crl} where \textbf{we focus on task $t$ given the outcome of the continual learning procedure until task $t-1$.} \begin{align} h^t,&\phi_{\text{new}}^t=\underset{\phi=\phi_{\text{new}}+{\phi}_{\text{frz}}^t}{\underset{h\in{\mtx{H}},\phi_{\text{new}}\in{\boldsymbol{\Phi}}_{\text{new}}^t}{\arg\min}} {\widehat{\cal{L}}}_{\mathcal{S}_t}(f)=\frac{1}{N}\sum_{i=1}^N \ell(y_{ti},f(\vct{x}_{ti}))\quad\text{where}\quad f=h\circ\phi. \tag{CRL-SEQ}\label{crlseq} \end{align} After obtaining $\phi_{\text{new}}^t$, the feature-extractor of task $t$ is given by $\phi^t=\phi_{\text{frz}}^t+\phi_{\text{new}}^t$ and prediction function becomes $f^t=h^t\circ \phi^t$. Finally, $\phi^t$ of task $t$ becomes the next frozen feature-extractor i.e.~$\phi_{\text{frz}}^{t+1}=\phi^t$. In this sequential setting, intuitively $({\boldsymbol{\Phi}}_{\text{new}}^\tau)_{\tau=1}^T$ are less complex hypothesis spaces compared to ${\boldsymbol{\Phi}}_{\text{new}}$ of Theorem \ref{cl thm}. This is because we learn ${\boldsymbol{\Phi}}_{\text{new}}^\tau$ using a single task. In that sense, the proper scaling of hypothesis set complexity is $\cc{{\boldsymbol{\Phi}}_{\text{new}}^\tau}\propto \cc{{\boldsymbol{\Phi}}_{\text{new}}}/T$ for $\tau\in[T]$. Specifically, we assume that for some global value $\mathcal{C}^{{\boldsymbol{\Phi}}}_{\text{new}}>0$ \begin{align} \cc{{\boldsymbol{\Phi}}_{\text{new}}^\tau}\leq \mathcal{C}^{{\boldsymbol{\Phi}}}_{\text{new}}\quad \text{for all}\quad 1\leq\tau\leq T.\label{ccn decay} \end{align} Secondly, compared to Theorem \ref{cl thm}, we need to introduce a more intricate compatibility condition to assess the benefit of the representations learned from finite data $\phi_{\text{new}}^1,\dots,\phi_{\text{new}}^{t-1}$ for the new task $t$. This will be accomplished by first introducing population level compatibility and then introducing an assumption that controls the impact of finite sample learning on the new task. These definition and assumption arise naturally to control the learnability of a new task given features of earlier tasks. Related assumptions (e.g.~\emph{task diversity} condition) have been used by other works for transfer/meta learning purposes \cite{tripuraneni2020theory,oymak2021generalization,du2020few,xu2021representation}. Let $(h^{\star,1},\phi_{\text{new}}^{\star,1}),\dots,(h^{\star,t},\phi_{\text{new}}^{\star,t}),\dots$ be the (classifier, representation) sequence obtained by solving \eqref{crlseq} using infinite samples $N=\infty$ (that is, solving the population-level optimization rather than finite-sample ERM). The following definition introduces the representation mismatch at task $t$ to capture the suitability of the population-level representations $(\phi_{\text{new}}^{\star,\tau})_{\tau=1}^{t-1}$ for a new task $t$. Set $\phi_{\text{frz}}^{\star,t}=\phi_{\text{frz}}+\sum_{\tau=1}^{t-1}\phi_{\text{new}}^{\star,\tau}$ and define the set of all feasible representations for task $t$ as }%\textcolor{blue}{${\boldsymbol{\Phi}}^t=\sum_{\tau=1}^t{\boldsymbol{\Phi}}_{\text{new}}^\tau+{\boldsymbol{\Phi}}_{\text{frz}}$\red{$\subseteq{\boldsymbol{\Phi}}$}.} \begin{definition}[Population quantities and representation mismatch]\label{def pop seq}For task $t$, define the population (infinite-sample) risk as ${\cal{L}}_t(h,\phi)=\operatorname{\mathbb{E}}[{\widehat{\cal{L}}}_{\mathcal{S}_t}(h,\phi)]$. Define the optimal risk of task $t$ over all feasible representations in \red{${\boldsymbol{\Phi}}$} as $\Lci{t}=$ $\min_{h\in{\mtx{H}},\phi\in\red{{\boldsymbol{\Phi}}}}{\cal{L}}_t(h,\phi)$. Note that the optimal risk gets to choose the best representations within $({\boldsymbol{\Phi}}_{\text{new}}^\tau)_{\tau=1}^t$ and ${\boldsymbol{\Phi}}_{\text{frz}}$ \red{since $\sum_{\tau=1}^t{\boldsymbol{\Phi}}_{\text{new}}^\tau+{\boldsymbol{\Phi}}_{\text{frz}}\subseteq {\boldsymbol{\Phi}}$.} Finally, define the optimal risk with fixed frozen model $\phi_{\text{frz}}^{\star,t}=\phi_{\text{frz}}+\sum_{\tau=1}^{t-1}\phi_{\text{new}}^{\star,\tau}$ to be $\Lci{t}_\text{seq}=\min_{h\in{\mtx{H}},\phi_{\text{new}}^t\in{\boldsymbol{\Phi}}_{\text{new}}^t}{\cal{L}}_t(h,\phi)$ s.t.~$\phi=\phi_{\text{new}}^t+\phi_{\text{frz}}^{\star,t}$. The sequential representation mismatch at task $t$ is defined as \begin{align} \MS{t}=\Lci{t}_\text{seq}-\Lci{t}.\label{mst} \end{align} \end{definition} This definition is the sequential counterpart of Definitions \ref{def pop} and \ref{def MM}. It quantifies the cost of continual learning with respect to choosing the best (oracle) representation. It also aims to capture the properties of the task distributions thus it uses infinite samples for tasks $1\leq \tau\leq t$. In practice, a new task $t$ is learned on top of finite sample tasks. We need to make a plausible assumption to formalize \begin{quote} \emph{With enough samples, representations learned from finite sample tasks are almost as useful as representations learned from infinite sample tasks.} \end{quote} We accomplish this by introducing empirical/population compatibility below. The basic idea is that, quality of the representation should decay gracefully as we move from infinite to finite samples. \begin{assumption} [Empirical/population compatibility] \label{fin comp} For task $t$, define the population risk ${\cal{L}}_t(h,\phi)=\operatorname{\mathbb{E}}[{\widehat{\cal{L}}}_{\mathcal{S}_t}(h,\phi)]$. Recall the definitions of $\phi_{\text{frz}},(h^{\star,t},\phi_{\text{new}}^{\star,t})_{t\geq 1}$ from Def.~\ref{def pop seq}. Given a sequence of incremental feature-extractors ${\phi}=(\phi_{\text{new}}^\tau)_{t\geq 1}$, recall from \eqref{crlseq} that task $\tau-1$ uses the extractor $\phi_{\text{frz}}^{\tau}=\phi_{\text{frz}}+\sum_{i=1}^{\tau-1}\phi_{\text{new}}^{i}$. \emph{To quantify representation quality}, we introduce the risks ${\bar{\cal{L}}}^t_\text{seq}:={\bar{\cal{L}}}^{t,{\phi}}_\text{seq},{\cal{L}}^t_\text{seq}:={\cal{L}}^{t,{\phi}}_\text{seq}$ induced by ${\phi}$ (similar to Def.~\ref{def pop seq}) \begin{align} &{\bar{\cal{L}}}^t_\text{seq}=\min_{h\in{\mtx{H}}}{\cal{L}}_t(h,\phi_{\text{frz}}^{t+1})\nonumber\\ &{\cal{L}}^t_\text{seq}=\min_{h\in{\mtx{H}},\phi_{\text{new}}\in{\boldsymbol{\Phi}}_{\text{new}}^t}{\cal{L}}_t(h,\phi)~\text{s.t.}~\phi=\phi_{\text{new}}+\phi_{\text{frz}}^t.\label{ltseq} \end{align} Here ${\bar{\cal{L}}}^t_\text{seq}$ uses the given $\phi_{\text{new}}^t$ (within ${\phi}$) whereas ${\cal{L}}^t_\text{seq}$ chooses the optimal $\phi_{\text{new}}^t\in {\boldsymbol{\Phi}}_{\text{new}}^t$\footnote{${\cal{L}}^t_\text{seq}$ definition is needed to quantify the representation quality of a new task where incremental update $\phi_{\text{new}}^t$ has not been built yet. In contrast, ${\bar{\cal{L}}}^t_\text{seq}$ quantifies the representation quality of previous tasks for which (full) feature extractors are known.}. Thus ${\bar{\cal{L}}}^t_\text{seq}\geq {\cal{L}}^t_\text{seq}$. Based on these, define the mismatch between empirical and population-level optimizations \begin{align}\nonumber \ME{t}={\cal{L}}^t_\text{seq}-\Lci{t}_\text{seq}\quad\text{and}\quad\MA{t}={\bar{\cal{L}}}^t_\text{seq}-\Lci{t}_\text{seq}. \end{align} Again by construction {$\MA{t}\geq \ME{t}$}. We say \textbf{empirical and population representations} are compatible if there exists a constant $\eps_0>0$ such that, for all choices of $(\phi_{\text{new}}^\tau)_{\tau=1}^t\in {\boldsymbol{\Phi}}_{\text{new}}^1\times \dots{\boldsymbol{\Phi}}_{\text{new}}^t$, we have that \ }%\textcolor{blue}{\underbrace{\ME{t}}_{\text{subopt on new task}}\leq\underbrace{\eps_0}_{\text{additive mismatch}}+\underbrace{\frac{1}{t-1} \sum_{\tau=1}^{t-1} \MA{\tau}}_{\text{avg subopt on first $t-1$ tasks}}} \] \end{assumption} \textbf{Interpretation:} Here, }%\textcolor{blue}{$\frac{1}{t-1} \sum_{\tau=1}^{t-1} \MA{\tau}$} quantifies the suboptimality of the representations used by first $t-1$ tasks. Recall that task $\tau$ uses representation $\phi_{\text{frz}}^\tau$ for $\tau\leq t-1$. Verbally, this assumption guarantees that, task $t$ can find an (incremental) representation $\phi_{\text{new}}^t\in{\boldsymbol{\Phi}}_{\text{new}}^t$ and classifier $h\in{\mtx{H}}$ such that its suboptimality to population-optimal risk $\Lci{t}_\text{seq}$ is upper bounded in terms of the average of the suboptimalities over the first $t-1$ tasks. Note that, this can also be viewed as a \textbf{sequential task diversity} condition because we are assuming that good quality representations on the first $t-1$ tasks (w.r.t.~population minima) ensure a small excess risk (w.r.t.~population minima) on the new task. Following this assumption, theorem below is our main guarantee on sequential CRL. It is obtained by stitching $T$ applications of Lemma \ref{lem seq} which adds a single new task. The statement of Lemma \ref{lem seq} is provided within the proof of Theorem \ref{seq thm} below. \begin{theorem}\label{seq thm} Suppose we solve the sequential continual learning problem \eqref{crlseq} for each task $1\leq t\leq T$ to obtain hypothesis $(h^t,\phi_{\text{new}}^t)_{t=1}^T$. The $t$'th model uses the prediction $h^t\circ \phi_{\text{frz}}^{t+1}$ where $\phi_{\text{frz}}^t=\phi_{\text{frz}}+\sum_{\tau=1}^{t-1}\phi_{\text{new}}^t$. Consider the same core setting as in Theorem \ref{cl thm}: Namely, we assume Lipschitz hypothesis sets ${\boldsymbol{\Phi}}_{\text{new}}^t,{\mtx{H}}$, Lipschitz loss function $\ell:\mathbb{R}\times \mathbb{R}\rightarrow[0,1]$ and bounded input feature set $\mathcal{X}$ all with respect to Euclidean distance. Recall that $\Lci{t}$ is the optimal risk for task $t$. Suppose the complexity of each ${\boldsymbol{\Phi}}_{\text{new}}^t$ is upper bounded by $\mathcal{C}^{{\boldsymbol{\Phi}}}_{\text{new}}$ as in \eqref{ccn decay} for $t\in [T]$. For some absolute constant $C>0$, with probability $1-2Te^{-\tau}$, the solutions $(h^t,\phi_{\text{new}}^t)_{t=1}^T$ of \eqref{crlseq} satisfies the following cumulative generalization bound (summed over all $T$ tasks) \begin{align \underbrace{\sum_{t=1}^T\left({\cal{L}}_t(h^t,\phi^t)-\Lci{t}\right)}_{\text{excess test risk w.r.t.~oracle}}&\leq \underbrace{\sum_{t=1}^T\MS{t}}_{\text{sequential representation mismatch}}+\underbrace{T^2(\eps_0+C\sqrt{\frac{\cc{{\mtx{H}}}+\mathcal{C}^{{\boldsymbol{\Phi}}}_{\text{new}}+\tau}{N}})}_{\text{cost of finite sample learning}}.\label{gen bound 3} \end{align} In light of Def.~\ref{def pop seq}, we can write the suboptimality with respect to solving sequential problems with $N=\infty$ as \begin{align \underbrace{\sum_{t=1}^T\left({\cal{L}}_t(h^t,\phi^t)-\Lci{t}_\text{seq}\right)}_{\text{excess test risk w.r.t.~sequential learning}}&\leq \underbrace{T^2(\eps_0+C\sqrt{\frac{\cc{{\mtx{H}}}+\mathcal{C}^{{\boldsymbol{\Phi}}}_{\text{new}}+\tau}{N}})}_{\text{cost of finite sample learning}}.\label{gen bound 4} \end{align} \end{theorem} \noindent \textbf{Discussion.} Before providing the proof in the next section, a few remarks are in place. First, we state the sum of test errors rather than the average. Secondly, observe that \eqref{gen bound 3} compares the test errors to the optimal possible errors $\Lci{t}$. On the right hand side there are two terms: ``representation mismatch'' and ``cost of finite sample learning''. ``Representation mismatch'' quantifies the population-level error that arises even if each task had access to infinite samples. This is because, even if each task solved \eqref{crlseq} perfectly, the resulting sequence of representations does not have to be optimal for the next task and $\MS{t}$ precisely captures this suboptimality. Recall that this population-level gap arises from Definition \ref{def pop seq}. \red{This also emphasizes that we should train diverse tasks firstly, since diverse features learned from previous tasks help reduce $\MS{t}$ due to its highly relevant representation. } The ``cost of finite sample learning'' term originally captures the finite sample effects, and it is proportional to the statistical error rate of solving \eqref{crlseq} for the first task-only i.e.~$\sqrt{\frac{\mathcal{C}({\mtx{H}})+\mathcal{C}^{{\boldsymbol{\Phi}}}_{\text{new}}}{N}}$. Here, recall from \eqref{ccn decay} that $\mathcal{C}^{{\boldsymbol{\Phi}}}_{\text{new}}$ is an upper bound to the complexities of ${\boldsymbol{\Phi}}_{\text{new}}^1,\dots,{\boldsymbol{\Phi}}_{\text{new}}^T$. Perhaps unexpected dependence is the quadratic growth in $T$. This is in contrast to linear growth one would get from adding tasks simultaneously as in Theorem \ref{cl thm}. This quadratic growth arises from the accumulation of the finite-sample representation suboptimalities as we add more tasks. Specifically, Assumption \ref{fin comp} helps guarantee that feature-extractors of tasks $1,\dots,t-1$ are useful for task $t$; however, as more tasks are added they incur more divergence from $(\phi^{\star,t})_{t=1}^T$. Each new task has a finite sample and contributes to this divergence and our analysis leads to $\order{T^2}$ upper bound on the error. $\eps_0$ is an additional mismatch term that makes Assumption \ref{fin comp} significantly more flexible (albeit ideally, it is close to zero). Finally, it would be interesting to explore the tightness of these bounds for concrete analytical settings (e.g.~\ref{crlseq} with linear models or neural nets), running more experiments and further studying the role of finite sample effects \& representation divergences. \subsection{Proof of Theorem \ref{seq thm}} \begin{proof} Applying Lemma \ref{lem seq} for each task $1\leq t\leq T$ and union bounding, }%\textcolor{blue}{with probability $1-2Te^{-\tau}$}, for all $T$ applications of \eqref{crlseq}, we have that \begin{align} &{\cal{L}}(h^t,\phi_{\text{new}}^t+\phi_{\text{frz}}^t)-\Lci{t}\leq \MS{t}+\underbrace{\ME{t}+\sqrt{\frac{\ordet{\cc{{\mtx{H}}}+\mathcal{C}^{{\boldsymbol{\Phi}}}_{\text{new}}+\tau}}{N}}}_{\text{excess empirical error}}\label{gen bound}\\ &\MA{t}\leq \sqrt{\frac{\ordet{\cc{{\mtx{H}}}+\mathcal{C}^{{\boldsymbol{\Phi}}}_{\text{new}}+\tau}}{N}}+\ME{t}.\nonumber \end{align} }%\textcolor{blue}{We simply need to control $\ME{t}$ at time $t$. Following Assumption \ref{fin comp}, observe that at $t=1$ we simply have $\ME{1}=0$. For $\ME{t}$ we have that \begin{align} &\ME{t}\leq \eps_0+\frac{1}{t-1} \sum_{\tau=1}^{t-1} \MA{\tau}\nonumber\\ &\implies \MA{t}\leq \left[\eps_0+\sqrt{\frac{\ordet{\cc{{\mtx{H}}}+\mathcal{C}^{{\boldsymbol{\Phi}}}_{\text{new}}+\tau}}{N}}\right]+\frac{\sum_{\tau=1}^{t-1}\MA{\tau}}{t-1}.\label{required eq} \end{align} Declare $B:=\eps_0+\sqrt{\frac{\ordet{\cc{{\mtx{H}}}+\mathcal{C}^{{\boldsymbol{\Phi}}}_{\text{new}}+\tau}}{N}}$. We will inductively prove that for all $t$ \begin{align} \MA{t}\leq (t-1) B.\label{induct} \end{align} For $t=1$, obviously it works. Suppose claim holds until time $t-1$. Using \eqref{required eq} this implies that \[ \MA{t}\leq B+\frac{\sum_{\tau=1}^{t-1}\MA{\tau}}{t-1}\leq B+ \frac{\sum_{\tau=1}^{t-1}(\tau-1)}{t-1}B=B+\frac{t-2}{2}B=\frac{Bt}{2}\leq B(t-1). \] The last inequality holds since $t\geq 2$. Thus the claim holds for $t$ as well. }Q To proceed, using the fact that $\ME{t}\leq \MA{t}$ and using the upper bound \eqref{induct}, the excess error in \eqref{gen bound} is upper bounded by $tB=(t-1)B+B$ to obtain \begin{align} {\cal{L}}(h^t,\phi_{\text{new}}^t+\phi_{\text{frz}}^t)-\Lci{t}\leq \MS{t}+t (\eps_0+\sqrt{\frac{\ordet{\cc{{\mtx{H}}}+\mathcal{C}^{{\boldsymbol{\Phi}}}_{\text{new}}+\tau}}{N}}).\label{bound fin gen} \end{align} To conclude, we simply sum up \eqref{bound fin gen} for $1\leq t\leq T$ to obtain the advertised bound where the total excess finite-sample error grows as $\frac{T(T+1)}{2}B\leq T^2B$. This yields \eqref{gen bound 3}. \eqref{gen bound 4} is identical to \eqref{gen bound 3} via \eqref{mst}. \end{proof} Following Def.~\ref{def pop seq} and Assumption \ref{fin comp}, the lemma below probabilistically quantifies the generalization risk when we add one task. Using this lemma, we will state our main result which quantifies the generalization risk when adding $T$ tasks. \begin{lemma}\label{lem seq} Suppose we are given the output pairs $(h^\tau,\phi_{\text{new}}^\tau)_{\tau=1}^{t-1}$ of the first $t-1$ applications of sequential CRL problem \eqref{crlseq}. Now, we solve for the $t$'th solution denoted by the pair $h^t,\phi_{\text{new}}^t$. Under same conditions as in Theorem \ref{cl thm} (Lipschitz hypothesis ${\boldsymbol{\Phi}}_{\text{new}}^t,{\mtx{H}}$, Lipschitz loss $\ell:\mathbb{R}\times \mathbb{R}\rightarrow [0,1]$ and bounded input features $\mathcal{X}$), for some absolute constant $C>0$, with probability $1-2e^{-\tau}$, the solution $(h^t,\phi_{\text{new}}^t)$ of \eqref{crlseq} satisfies the following two properties \begin{align}\label{eq mm} &{\cal{L}}(h^t,\phi_{\text{new}}^t+\phi_{\text{frz}}^t)-\Lci{t}\leq \MS{t}+\ME{t}+\sqrt{\frac{\ordet{\cc{{\mtx{H}}}+\cc{{\boldsymbol{\Phi}}_{\text{new}}^t}+\tau}}{N}}\\ &\MA{t}\leq \sqrt{\frac{\ordet{\cc{{\mtx{H}}}+\cc{{\boldsymbol{\Phi}}_{\text{new}}^t}+\tau}}{N}}+\ME{t}.\nonumber \end{align} Here, $\MS{t},\ME{t},\MA{t}$ are mismatch definitions introduced in Def.~\ref{def pop seq} and Assumption \ref{fin comp}. \end{lemma} \begin{proof} As introduced in \eqref{ltseq}, the representation quality of the new task will be captured by \[ {\cal{L}}^t_\text{seq}=\min_{h\in{\mtx{H}},\phi_{\text{new}}\in{\boldsymbol{\Phi}}_{\text{new}}^t}{\cal{L}}_t(h,\phi)~\text{s.t.}~\phi=\phi_{\text{new}}+\phi_{\text{frz}}^t. \] Similarly, recall the empirical mismatch $\ME{t}={\cal{L}}^t_\text{seq}-\Lci{t}_\text{seq}$. Based on this and recalling $\MS{t}$ definition \eqref{mst}, applying Theorem \ref{cl thm} with $T=1$, we obtain that, with probability $1-2^{-\tau}$ we have the following bounds (on the same event) \begin{align} {\cal{L}}(h^t,\phi_{\text{new}}^t+\phi_{\text{frz}}^t)&\leq{\cal{L}}^t_\text{seq}+\sqrt{\frac{\ordet{\cc{{\mtx{H}}}+\cc{{\boldsymbol{\Phi}}_{\text{new}}^t}+\tau}}{N}}\nonumber\\ {\cal{L}}(h^t,\phi_{\text{new}}^t+\phi_{\text{frz}}^t)&\leq \Lci{t}+\MS{t}+\ME{t}+\sqrt{\frac{\ordet{\cc{{\mtx{H}}}+\cc{{\boldsymbol{\Phi}}_{\text{new}}^t}+\tau}}{N}}.\nonumber \end{align} The second equation establishes \eqref{eq mm}. The remaining challenge is simply relating the population and empirical mismatches i.e.~controlling $\ME{t}$. Recall $h^t$ is the ERM solution of \eqref{crlseq} associated with $\phi_{\text{new}}^t$. Using the uniform concentration event (implied within the application of Theorem \ref{cl thm} via \eqref{unif conv}), we have \[ |{\widehat{\cal{L}}}_{\mathcal{S}_t}(h,\phi_{\text{new}}+\phi_{\text{frz}}^t)-{\cal{L}}_t(h,\phi_{\text{new}}+\phi_{\text{frz}}^t)|\leq \sqrt{\frac{\ordet{\cc{{\mtx{H}}}+\cc{{\boldsymbol{\Phi}}_{\text{new}}^t}+\tau}}{N}}, \] Now, using the optimality of $h^t$ for $\phi_{\text{new}}^t$ and the fact that $(h^t,\phi_{\text{new}}^t)$ minimizes the empirical risk, observe that \begin{align*} \MA{t}&=\min_{h\in{\mtx{H}}}{\cal{L}}(h,\phi_{\text{frz}}^{t+1})-\Lci{t}_\text{seq}\\ &\leq [\min_{h\in{\mtx{H}}}{\cal{L}}(h,\phi_{\text{frz}}^{t+1})-{\cal{L}}^t_\text{seq}]+\ME{t}\\ &\leq [{\cal{L}}(h^t,\phi_{\text{frz}}^{t+1})-{\cal{L}}^t_\text{seq}]+\ME{t}\\ &\leq \sqrt{\frac{\ordet{\cc{{\mtx{H}}}+\cc{{\boldsymbol{\Phi}}_{\text{new}}^t}+\tau}}{N}}+\ME{t}, \end{align*} to conclude with the second line of \eqref{eq mm}. \end{proof} \section{Introduction} \emph{Continual learning} (CL) or lifelong learning aims to build a model for a non-stationary and never-ending sequence of tasks, without access to previous or future data \cite{thrun1998lifelong,chen2018lifelong,parisi2019continual}. The main challenge in CL is that a standard learning procedure usually results in performance reduction on previously trained tasks if their data are not available. The phenomenon is termed as \emph{catastrophic forgetting} \cite{mccloskey1989catastrophic,kirkpatrick2017overcoming,pfulb2019comprehensive}. Importance of continual learning in real-life inference and decision making scenarios led to a rich set of CL techniques~\cite{delange2021continual,van2019three}\ylm{methods including replay-based, regularization-based, and architecture-based strategies}. However, the theoretical principles of continual learning is relatively less understood and the progress is under-whelming compared to the algorithmic advances despite recent progress {(see \cite{bennani2020generalisation,doan2021theoretical,lee2021continual})}. In this work, for the first time, we investigate the problem of \emph{Continual Representation Learning (CRL)} to answer \begin{center} \fbox{\centering\begin{minipage}{0.84\textwidth} \centering\textit{ What are the statistical benefits of previous feature representations for learning a new task? Can we build an insightful theory explaining empirical performance?} \end{minipage}} \end{center} Our key contribution is addressing both questions affirmatively. We develop our algorithms and theory for architecture-based zero-forgetting CL which includes PackNet~\cite{mallya2018packnet}, CPG~\cite{hung2019compacting}, and RMN~\cite{wu2020understanding}. These methods eliminate forgetting by training a sub-network for each task and freezing the trained parameters. At a high level, all of these methods inherently have the potential of continual representation learning by allowing new tasks to reuse the frozen feature representations built for earlier tasks. However, quantifying the empirical benefits/performance of these representations and building the associated theory have been elusive. We overcome this via innovations in experiment design, theory, and algorithms: \noindent$\bullet$ \textbf{Theoretical and empirical benefits of continual representations.} We establish theoretical results and sample complexity bounds for CRL by using tools from empirical process theory. Within our model, a new task uses frozen feature map $\phi_{\text{frz}}$ of previous tasks and learns an additional task-specific representation $\phi_{\text{new}}$. For PackNet \cite{mallya2018packnet}, $\phi_{\text{frz}}$ corresponds to all the nonzero weights so far and $\phi_{\text{new}}$ is the nonzeros allocated to the new task, thus $\phi_{\text{frz}}$ requires a lot more data to learn. Our theory (see Section~\ref{sec:crl_theory}) explains (1) how the new task can reuse the frozen feature map to greatly reduce the sample size and (2) how to quantify the representational compatibility between old and new tasks. Specifically, we fully avoid the statistical cost of learning $\phi_{\text{frz}}$ and replace it with a \emph{``representational mismatch''} term between the new task and frozen features. }%\textcolor{blue}{We also extend our results from a single task to learning a sequence of tasks by quantifying the aggregate impact of finite data on representation $\phi_{\text{frz}}$ which evolves as new tasks arrive (deferred to appendix)}. An important conclusion is that ideally frozen representation $\phi_{\text{frz}}$ should contain \textbf{diverse and high-quality features} so that it has small \emph{mismatch} with new tasks. This is consistent with the results on transfer learning \cite{tripuraneni2020theory} and motivates the following CL principle supported by our experiments: \begin{center} \hspace{-10pt}\fbox{\begin{minipage}{0.84\linewidth} \centering\textit{ First learn diverse and large-data tasks so that their representations help upcoming tasks.} \end{minipage}} \end{center} Indeed, we show in Fig.~\ref{fig:LS} that a new task with small data achieves significantly higher accuracy if it is added later in the task sequence (so that $\phi_{\text{frz}}$ becomes more diverse). Then, we show in Fig.~\ref{fig:diversity} that choosing the first task to be diverse (such as ImageNet) helps all the downstream tasks. Finally, we show in Fig.~\ref{fig:Sample} that it is better to first learn tasks with large sample sizes to ensure high-quality features. \red{Our results on the importance of task order also relate to curriculum learning \cite{bengio2009curriculum} where the agent gets to choose the order tasks are learned. However, instead of curriculum learning, which aims to learn one task from easy to hard, our work is based on a more general continual learning setup. Our conclusion on task diversity provides a new perspective on the learning order of curriculum learning that we should first learn more representative tasks instead of an easier task. } \noindent$\bullet$ \textbf{Algorithms for inference-efficient CRL.} Zero-forgetting CL methods often need a large neural network (dubbed as supernetwork) to load numerous tasks into subnetworks, or dynamically expand the model to avoid forgetting \cite{delange2021continual}. Thus, CL/CRL may incur a large computational cost during inference. This leads us to ask whether one can retain the accuracy benefits of CRL while ensuring that each new task utilizes an \textbf{inference-efficient} sub-network, thus achieving the best of both worlds. We quantify inference-efficiency via floating point operations (FLOPs) required to compute the task subnetwork. To this end, we propose Efficient Sparse PackNet (ESPN) algorithm (Fig.~\ref{overview fig}). In a nutshell, ESPN guarantees inference-efficiency by incorporating a channel-pruning stage within PackNet-style approaches. Via extensive evaluations, we find that, ESPN incurs minimal loss of accuracy while greatly reducing FLOPs (as much as 80\% in our SplitCIFAR-100 experiments, Table \ref{CIFARtable}). {In summary, this work makes key contributions to continual representation learning from empirical, theoretical, and algorithmic perspectives. In the remainder of the paper, we discuss related work, detail our empirical and theoretical findings on CRL, and present the ESPN algorithm and its evaluations.} \section{Efficient Sparse PackNet (ESPN) Algorithm}\label{sec: espnalgo} We will use PackNet and ESPN throughout the paper to study continual representation learning. Thus, we first introduce the high-level idea of our ESPN algorithm which augments PackNet. Suppose we have a single model referred to as supernetwork and a sequence of tasks. Our goal is to train and find optimal sparse sub-networks within the supernet that satisfy both FLOPs and sparsity restrictions without any performance reduction or forgetting of earlier tasks. Figure~\ref{overview fig} illustrates our proposed algorithm. We propose a joint channel and weight pruning strategy in which FLOPs constraint (in channel pruning) is important for efficient inference and sparsity constraint (in weight pruning) is important for \emph{packing} all tasks into the network even for a large number of tasks $T$. In essence, ESPN equips PackNet-type methods with inference-efficiency using an innovative FLOP-aware channel pruning strategy. }%\textcolor{blue}{Section \ref{sec: espn_detail} and appendix provide implementation details and inference-time evaluations on ESPN. \noindent{\textbf{Notation.}} ESPN admits FLOPs constraint as an input parameter, which is a critical aspect of the experimental evaluations. Let MAX\_FLOPs be the FLOPs required for one forward propagation through the dense supernetwork. In our evaluations, for $\gamma\in (0,1]$, we use \textbf{ESPN-$\gamma$} to denote our CL Algorithm \ref{algo 1} in which each task obeys the FLOPs constraint $\gamma\times \text{MAX\_FLOPs}$. Similarly, \textbf{Individial-$\gamma$} will be the baseline that each task is trained individually (from scratch) on the full supernetwork while using at most $\gamma\times \text{MAX\_FLOPs}$. \textbf{Individual} is same as \textbf{Individual}-1 where we train the whole network without pruning. \section{Conclusion and Discussion} To summarize, our work elucidates the benefit of continual representation learning theoretically and empirically and sheds light on the role of task ordering, diversity and sample size. We also propose a new CL algorithm to learn good representations subject to inference considerations. Extensive experimental evaluations on the proposed Efficient Sparse PackNet demonstrate its ability to achieve good accuracy as well as fast inference. \noindent \textbf{Limitations and future directions.} Although we highlight the importance of task order in CRL, the task sequence is not always under our control. It would be desirable to develop adaptive learning schemes that can better identify an exploit diverse tasks and discover semantic connections across task pairs even for a predetermined task sequence. Another potential direction is to develop similar inference-efficient continual learning schemes for other architectures by appropriately adapting our joint weight and channel pruning strategy. An example is transformer-based models where computation and memory efficiency is particularly critical. \section*{Acknowledgements}\vspace{-10pt} This work is supported in part by the National Science Foundation under grants CCF-2046816, CCF-2046293, CNS-1932254, and by the Army Research Office under grant W911NF-21-1-0312. \section{Inference-efficient continual representations via Efficient Sparse PackNet (ESPN)} \label{sec: espn_detail} In this section, we provide an in depth discussion of our ESPN algorithm and evaluate its benefit in inference efficiency. ESPN (Algorithm~\ref{algo 1}) learns the new sub-network in three phases: pre-training (over all free weights), gradual pruning (to prune weights and channels), and fine-tuning (to refine the new allocated weights). While not shown in Algorithm~\ref{algo 1}, we also introduce the following innovations. \input{sec/algo_oc} \noindent$\bullet$ \textbf{FLOP-aware pruning.} We propose a FLOP-aware pruning strategy that provides up to 80\% FLOPs reduction in our experiments. In practice, Algorithm~\ref{algo 1} minimizes a regularized objective ${\cal{L}}_{\mathcal{S}_t}({\boldsymbol{\theta}}\odot\vct{m})+\mathcal{R}({\boldsymbol{\Gamma}},\vct{m})$, with \begin{align} \label{eq:reg}\mathcal{R}({\boldsymbol{\Gamma}},\vct{m})&=\sum_{l\in [L]}\lambda_l\|{\boldsymbol{\Gamma}}_l\|_1,~~\lambda_l=g(\text{FLOP}_l(\vct{m})). \end{align} ${\boldsymbol{\Gamma}}_l$ denotes the channel scores of $l^{\text{th}}$ layer, $L$ is the number of layers, and $g(\cdot)$ is a monotonically increasing function. In this manner, channels costing more FLOPs are assigned larger $\lambda_l$, pushed towards zero, and subsequently pruned. Additionally, $\text{FLOP}_l(\cdot)$ computes FLOPs of $l^{\text{th}}$ layer. Since we use gradual pruning (Line~\ref{algo:pruning} in Algorithm~\ref{algo 1}), FLOPs are changed over time and $\lambda_l$ is automatically tuned. In our experiments, we use $g(x)=C\sqrt{x}$ for a proper scaling choice $C>0$. }%\textcolor{blue}{The evaluation of our FLOP-aware channel pruning algorithm is presented in \ylm{Section~\ref{pruning sec} of} appendix.} \som{discuss $\alpha$ better} \noindent$\bullet$ \textbf{Weight allocation.} {Inspired by our theoretical finding that CL improves data efficiency,} we introduce a simple weight allocation scheme to assign free weights for new task. Let $p$ be the total number of weights and $p_{t-1}$ be the number of used weights after training tasks $1$ to $t-1$. Then we assign $\lceil(p-p_{t-1})\cdot\alpha\rceil$ free weights to task $t$, where $0<\alpha<1$ is {the \emph{weight-allocation} level}. We emphasize that weight allocation controls the number of new nonzeros allocated to a task. A new task is allowed to use all of the (frozen) nonzeros that are allocated to the previous tasks (as long as FLOPs constraint is not violated). }%\textcolor{blue}{We evaluate the empirical performance of our weight allocation technique \ylm{in Section~\ref{sec:wa}} in appendix.} \subsection{Experimental Setup}\label{sec:setting} We evaluate the performance of our proposed ESPN in terms of accuracy and efficiency metrics on three datasets: SplitCIFAR100, RotatedMNIST, and PermutedMNIST. We compare ESPN to numerous baselines, which include training each task individually, multitask learning (MTL), PackNet~\cite{mallya2018packnet}, CPG~\cite{hung2019compacting}, RMN~\cite{kaushik2021understanding}, and SupSup~\cite{wortsman2020supermasks}. The last four methods are zero-forgetting CL methods. \som{Emphasize SUPSUP is learning full-dimensional parameter mask} \som{Emphasize no one is efficient} \som{Empirically verifying our FLOP constraint vs theirs} \noindent{\textbf{Datasets. }} SplitCIFAR100, RotatedMNIST and PermutedMNIST are popular datasets for continual learning that we also use in our experiments. We follow the same setting as in \cite{wortsman2020supermasks}. For SplitCIFAR100 dataset, we randomly split CIFAR100 \cite{krizhevsky2009learning} into 20 tasks where each task contains $5$ classes, $2500$ training samples, and $500$ test samples. RotatedMNIST is generated by rotating all images in MNIST by the same degree. In our experiments, we generate $36$ tasks with $10,20,\ldots, 360$ degree rotations { and train in a random order}. PermutedMNIST dataset is created by applying a fixed pixel permutation to all images, and we created $36$ tasks with independent random permutations. \input{sec/table_oc} \noindent{\textbf{Models and implementation. }} For SplitCIFAR100, {following \cite{lopez2017gradient} we use a variation of ResNet18 model with fewer channels.} For each task, we use a batch size of 128 and Adam optimizer \cite{kingma2014adam} with hyperparameters $(\beta_1,\beta_2)=(0,0.999)$. As shown in Algorithm~\ref{algo 1}, for each task we apply pretraining, pruning, and finetuning strategies. First, we pretrain the model for $60$ epochs with learning rate $0.01$. Then, we gradually prune the channels and weights within $90$ epochs using the same learning rate. For the finetuning stage, we apply cosine decay \cite{loshchilov2016sgdr} over learning rate, starting from $0.01$, and train for $100$ epochs. Therefore, each task trains for $250$ epochs in total. For RotatedMNIST and PermutedMNIST experiments, we use the same setting }%\textcolor{blue}{of FC1024 model} in \cite{wortsman2020supermasks}. This is a fully connected network with two hidden layers of size $1024$. We train for $10$ epochs with RMSprop optimizer \cite{graves2013generating}, batch size of $256$, and learning rate $0.001$. The number of pretraining, pruning, and finetuning epochs are $3$, $4$, and $3$, respectively. As for comparison baselines, MTL and individual training baselines follow the same configurations (e.g.~architecture, hyperparameters) as ESPN. In SplitCIFAR100 experiments, labels are not shared among different tasks. Thus, each task is assigned a separate classifier head while sharing the same backend supernet as a feature extractor. {Unlike SplitCIFAR100, all the tasks in RotatedMNIST and PermutedMNIST experiments share the same head via weight pruning.} MTL simultaneously trains all 20 tasks while sharing the backend supernet. In individual training, each task trains their own backend. Finally, CPG, RMN, and SupSup are all trained with their own publicly available codes but over the same ResNet18 model. To ensure fair comparison, we do not allow dynamic model expansion/enlargement in CPG. Similarly, for PackNet, instead of using its original setting with fixed pruning ratio for each task, we run it with our \emph{weight allocation} strategy to make it easier to compare. These baselines are all evaluated in Table~\ref{CIFARtable} which is discussed below. \subsection{Investigation of Inference Efficiency} \noindent{\textbf{SplitCIFAR100.}} Table~\ref{CIFARtable} presents results for our experiments on SplitCIFAR100. We use our FLOP-aware pruning technique to prune the channels and apply weight allocation with parameter $\alpha=0.1$. }%\textcolor{blue}{Since the impact of classifier head is rather negligible as it contains $<0.1\%$ weights and $<0.01\%$ FLOPs of the backend, we evaluate the FLOPs for each task inside backend.} To compare the performance of different methods, we use the same random seed to generate $20$ tasks so that task sequence is exactly the same over all experiments. We conduct ESPN experiments with $20\%$, $50\%$}%\textcolor{blue}{, and $100\%$} of FLOPs constraints corresponding to ESPN-0.2, ESPN-0.5}%\textcolor{blue}{, and ESPN-1} in Table~\ref{CIFARtable}. The results of Individual-0.2/-1 show that our FLOP-aware pruning technique can effectively reduce the computation requirements while maintaining the same level of model accuracy. Moreover, PackNet performing better than both CPG and RMN shows the benefit of our weight allocation technique. }%\textcolor{blue}{We remark that CPG method performs pruning and fine-tuning multiple times until it finds the optimal pruning ratio, which costs significantly more time in training compared to PackNet{/ESPN}.} ESPN-0.2/-0.5 results show that our continual learning algorithm outperforms both baselines in accuracy despite up to 80\% FLOP reduction. \ylm{Our accuracy improvement over PackNet arises from the trainable task-specific BatchNorm weights described under Algorithm \ref{algo 1}.} \ylm{In practice, for all CPG, RMN, PackNet, and SupSup methods, task-specific running mean and running variance inside BatchNorm layers are essential to reconstruct the same performance. Therefore, despite our method applies additional BatchNorm weights for each task, since we prune BatchNorm layers and less replay memory is needed overall compared to the other methods (except ESPN-1).} \noindent\textbf{RotatedMNIST and PermutedMNIST.} Figure~\ref{fig:mnist} presents the RotatedMNIST and PermutedMNIST results. We run experiments on ESPN, PackNet, and individual training and report the average accuracy over $5$ trials. Note that, for fully-connected layers, we prune neurons to reduce FLOPs (rather than channels of CNN). In our experiments, we assigned neurons with a pruning parameter ${\boldsymbol{\Gamma}}$. We use our FLOP-aware pruning technique to prune neurons based on ${\boldsymbol{\Gamma}}$ and use weight allocation with parameter $\alpha=0.05$. \ylm{${\boldsymbol{\Gamma}}$ is released after pruning.} Similar to channel-sharing in Figure \ref{overview fig}, different tasks are allowed to share the same neuron. Unlike SplitCIFAR100 experiments, all the tasks in both MNIST experiments share the same classifier head because they use the same 10 classes }%\textcolor{blue}{and FLOPs evaluation includes this head}. }%\textcolor{blue}{Therefore, \ylm{same as other zero-forgetting methods,} only binary mask is needed to restore performance.} \input{sec/fig/mnist_oc} Results of RotatedMNIST and PermutedMNIST experiments are shown in Figure~\ref{fig:mnist}. Blue curves show the results of ESPN-0.2. For fair comparison, PackNet (Orange curves) use the same weight allocation parameter $\alpha=0.05$. The Green and Red dashed lines show the task-averaged accuracy of Individual-0.2/-1 baselines that train each task with separate models for $20\%/100\%$ of FLOPs constraints. }%\textcolor{blue}{In both experiments, the gap between Individual-0.2 (Green) and Individual-1 (Red) curves is negligible and it again shows the benefit of our FLOP-aware pruning technique. While PackNet performs well for the first few tasks, it degrades gradually as more tasks arrive. Thus, when there are more than a few tasks, we see that ESPN algorithm works better than PackNet despite enforcing inference-efficiency and despite using the same weight allocation method. Figure \ref{fig:rotated} shows that ESPN-0.2 on RotatedMNIST exhibits mild accuracy degradation over $36$ tasks.} While in Figure \ref{fig:permuted}, test accuracy decreases more noticeably as the tasks are added. A plausible explanation is that, because each PermutedMNIST task corresponds to a random permutation, the tasks are totally unrelated. Thus, knowledge gained from earlier tasks are not useful for training new tasks and CRL does not really help in this case. In contrast, since tasks in RotatedMNIST are semantically relevant, ESPN and PackNet both achieve higher accuracy thanks to representation reuse across tasks. Specifically, the significant accuracy gap between the Blue curves in Figures \ref{fig:rotated} and \ref{fig:permuted} (especially for larger Task IDs) demonstrate the clear benefit of CRL. \section{Efficient Sparse PackNet (ESPN) Algorithm}\label{appsec: espnalgo} In this section, we introduce more implementation and evaluation details of our ESPN algorithm. Denote $[p]=\{1,2,\dots,p\}$. We use the phrases \emph{mask} and \emph{sub-network} interchangeably because we obtain the task sub-network by masking weights of the supernet. This sub-network is the nonzero support of the task, that is, the task-specific model is obtained by setting other weights to zero. We assume a sequence of tasks $\{\mathcal{T}_t$, $1\leq t\leq T\}$ are received during training time, where $t$ is task identifier and $T$ is the number of tasks. Let $\mathcal{S}_t=\{(\vct{x}_{ti},y_{ti})\}_{i=1}^{N_t}$ be labeled training pairs of $\mathcal{T}_t$, which consists of $N_t$ samples. Given task sequence and a single model, our goal is to find optimal sparse sub-networks that satisfy both FLOPs and sparsity restrictions without performance reduction and knowledge forgetting. FLOPs constraint is important for efficient inference whereas sparsity constraint is important for adding all tasks into the network even for large number of tasks $T$. {To this end, we use joint channel and weight pruning strategy.} Let $\ell$ be a loss function, $f$ be a hypothesis (prediction function) and ${\boldsymbol{\theta}}\in\mathbb{R}^p$ denote the weights of $f$. We focus on task $\mathcal{T}_t$, assuming $\mathcal{T}_1,...,\mathcal{T}_{t-1}$ are already trained. Let $\vct{m}_t\subset[p]$ be the nonzero support of task $t$ and $\vct{m}^{\text{all}}_t=\cup_{\tau=1}^t \vct{m}_\tau$ be the combined support until task $t$. Initially $\vct{m}^{\text{all}}_0=\emptyset$. Let ${\boldsymbol{\theta}}_t\in\mathbb{R}^p$ be the model weights at time $t$. Note that all the trained weights of the tasks lie on the sub-network $\vct{m}^{\text{all}}_t$. We use the notation ${\boldsymbol{\theta}}\odot\vct{m}$ to set the weights of ${\boldsymbol{\theta}}$ outside of the mask $\vct{m}$ to zero. Define the loss ${\cal{L}}_{\mathcal{S}_t}({\boldsymbol{\theta}})=\frac{1}{N_t}\sum_{i=1}^{N_t}\ell(f(\vct{x}_{ti};{\boldsymbol{\theta}}),y_{ti})$. The procedure for learning task $\mathcal{T}_t$ is formulated as the following optimization task that updates {supernet} weight/mask pair and {returns $({\boldsymbol{\theta}}_t,\vct{m}^{\text{all}}_t:=\vct{m}_t\cup \vct{m}^{\text{all}}_{t-1})$} given $({\boldsymbol{\theta}}_{t-1},\vct{m}^{\text{all}}_{t-1})$: \begin{align} {\boldsymbol{\theta}}_t,\vct{m}_t=\arg&\min_{{\boldsymbol{\theta}},\vct{m}}~~~{\cal{L}}_{\mathcal{S}_t}({\boldsymbol{\theta}}\odot\vct{m})\tag{ESPN-OPT}\label{cl_prob}\\ \text{s.t.} &~~~\text{FLOP}(\vct{m})\leq \overline{\text{FLOP}}_t,\nonumber\\ &~~~\vct{m}_{\text{new}}=\vct{m}\setminus\vct{m}^{\text{all}}_{t-1},\nonumber\\ &~~~\text{NNZ}(\vct{m}_{\text{new}})\leq \overline{\text{NNZ}}_t,\nonumber\\ &~~~{{\boldsymbol{\theta}}\odot\vct{m}^{\text{all}}_{t-1}}={\boldsymbol{\theta}}_{t-1}\odot\vct{m}^{\text{all}}_{t-1}.\nonumber \end{align} Here $\vct{m}_t$ is the channel-constrained mask that corresponds to the sub-network of $\mathcal{T}_t$ and ${\boldsymbol{\theta}}_t\odot\vct{m}_t$ are the weights we use for task $\mathcal{T}_t$ and the prediction function is $f(\cdot;{\boldsymbol{\theta}}_t\odot\vct{m}_t)$. {The updated mask until task $t$ is obtained by $\vct{m}^{\text{all}}_t=\vct{m}_t\cup \vct{m}^{\text{all}}_{t-1}$.} $\text{FLOP}(\cdot)$ and $\text{NNZ}(\cdot)$ returns the FLOPs and nonzeros of a given mask $\vct{m}$. $\overline{\text{FLOP}}_t$ and $\overline{\text{NNZ}}_t$ are the FLOPs and nonzero constraints of task $t$. Observe that we only enforce NNZ constraint on the new weights $\vct{m}_{\text{new}}$ whereas FLOPs constraint applies on the whole sub-network. {The last equation in \eqref{cl_prob} highlights that the weights of earlier tasks on $\vct{m}^{\text{all}}_{t-1}$ are kept frozen}. \som{Discuss algo in more detail} In practice, FLOPs \& NNZ constraints in \eqref{cl_prob} lead to a combinatorial problem. We propose Algorithm \ref{algo 1} to (approximately) solve this problem efficiently which learns the new sub-network in three phases: pre-training (over all free weights), gradual pruning (to satisfy constraints and obtain $\vct{m}_{\text{new},t}$), and fine-tuning (to refine the weights on $\vct{m}_{\text{new},t}$). While not shown in Algorithm \ref{algo 1}, we also introduce the following innovations. \noindent$\bullet$ \textbf{Trainable task-specific BatchNorm.} We train separate BatchNorm layers for each task. This has multiple synergistic benefits. First, our algorithm trains faster and generalizes better than PackNet which does not train BatchNorm weights (see Table \ref{CIFARtable}). Specifically, training BatchNorm weights allows ESPN to re-purpose the (frozen) weights of the earlier tasks with negligible memory cost. BatchNorm weights also guide our channel pruning scheme described next. \noindent$\bullet$ \textbf{FLOP-aware pruning.} Many of the prior works on channel pruning \cite{liu2017learning,zhuang2020neuron} focus on reducing the number of channels rather than the computation/FLOPs cost of the channels which varies across layers. As \red{shown in Fig.~\ref{fig:CIFAR10_ratio} that to satisfy FLOPs constraint $\gamma$, numerous channels are pruned}. This results in unsatisfactory performance especially under aggressive FLOPs constraint \red{(shown in Fig.~\ref{fig:CIFAR10_acc})}. However in CL setup, in order to train a single model with many tasks, a significantly larger supernet with high capacity is needed compared to a single task requirement, and we aim to find a sub-network with very few FLOPs without compromising performance. To fit our specific needs for channel pruning, in this paper we present an innovative channel pruning algorithm called {FLOP-aware channel pruning} that preserves the performance up to 80\% FLOPs reduction in our SplitCIFAR100 experiments (Table \ref{CIFARtable}). Following \cite{liu2017learning}, we consider BatchNorm weights as a trainable saliency score for convolutional channels and prune all channels with scores lower than a certain threshold by setting them to zero. Let ${\boldsymbol{\Gamma}}$ be the BatchNorm vectors. Given dataset $\{(\vct{x}_i,y_i)\}_{i=1}^N$, in practice, rather than solving the constrained problem \eqref{cl_prob}, Algorithm~\ref{algo 1} minimizes a regularized objective ${\cal{L}}_{\mathcal{S}_t}({\boldsymbol{\theta}}\odot\vct{m})+\mathcal{R}({\boldsymbol{\Gamma}},\vct{m})$. Here $\mathcal{R}$ is a regularization term to promote channel sparsity in \eqref{app eq:reg}. For an $L$ layer network, use ${\boldsymbol{\Gamma}}_l$ to denote the $l^{\text{th}}$ {BatchNorm weights} for $l\in[L]$. Intuitively, we wish to use $\ell_1$-regularization on ${\boldsymbol{\Gamma}}$. However, since layers of the network show variation, layerwise regularization parameters $(\lambda_l)_{l=1}^L$ are needed where $L$ is number of layers. Instead of designing $\lambda_l$ by trial-and-error -- which is time-consuming and expert-dependent -- we introduce a method that chooses $\lambda_l$ automatically, fine-tunes $\lambda_l$ during gradual pruning and adapts to the global FLOPs constraint. Specifically, $\lambda_l$ is chosen based on the {FLOPs load of a channel} determined by its input feature dimensions and operations. Here an implicit goal is pruning as few channels as possible while achieving maximum FLOPs reduction. To achieve these goals, we use the following FLOP-weighted sparsity regularization (as also stated in the main body) \begin{align} \label{app eq:reg}\mathcal{R}({\boldsymbol{\Gamma}},\vct{m})&=\sum_{l\in [L]}\lambda_l\|{\boldsymbol{\Gamma}}_l\|_1,~~\lambda_l=g(\text{FLOP}_l(\vct{m}^{(l)})). \end{align} Here $\vct{m}^{(l)}$ denotes the restriction of the sub-network $\vct{m}$ to $l^{\text{th}}$ layer, $\text{FLOP}_l(\cdot)$ is the FLOPs load for a channel in the $l^{\text{th}}$ layer of the subnet, and $g(\cdot)$ is a monotonically increasing function. We use $\ell_1$-penalty to enforce unimportant elements to zeros and prune the channels with smallest weights over all layers. Since $g(\cdot)$ is increasing, channels costing more FLOPs are assigned with larger $\lambda_l$ and are pushed towards zero, thus they are easier to prune. Additionally, since $\text{FLOP}_l(\cdot)$ is based on subnet $\vct{m}^{(l)}$, $\lambda_l$ is automatically tuned while we use gradual pruning (Line~\ref{algo:pruning} in Algorithm \ref{algo 1}). In our experiments, we use $g(x)=C\sqrt{x}$ for a proper scaling choice $C>0$. \red{Here $C$ can be seen as a normalized term and in detail we have \begin{align*} \lambda_l=\frac{\sqrt{\text{FLOP}_l(\vct{m}^{(l)})}}{\sum_{i=1}^L\sqrt{\text{FLOP}_i(\vct{m}^{(i)})}}. \end{align*}} \noindent$\bullet$ \textbf{Weight allocation.} Since we do not modify the supernet architecture, without care, supernet might run out of free weights if there is a huge number of tasks. While original PackNet paper \cite{mallya2018packnet} also uses weight pruning, since they consider relatively fewer tasks, they don't develop an algorithmic strategy for allocating the free weights to new tasks. In our experiments, we introduce a simple weight allocation scheme to assign $\overline{\text{NNZ}}_t$ {depending on the number of remaining free weights}. Let $p$ be the total number of weights, $p_t$ be the total number of weights used by tasks $1$ to $t$ and $p_0=0$. We set \begin{align}\label{wa-eq} \overline{\text{NNZ}}_t=\lceil (p-p_{t-1})\cdot\alpha\rceil\quad\text{for some}\quad 0<\alpha<1. \end{align} Here $\alpha$ is {the \emph{weight-allocation} level} and a new task gets to use $\alpha$ fraction of all unused weights in the supernet. We emphasize that weight allocation controls the number of new nonzeros allocated to a task. A new task is allowed to use all of the (frozen) nonzeros that are allocated to the previous tasks (as long as FLOPs constraint is not violated). \section{Appendix C: Expanded Related Work} \section{Expanded Related Work}\label{app:related} Our contributions are most closely related to the continual learning literature. Our theory and algorithms also connect to representation learning and neural network pruning. \noindent\textbf{Continual learning.} A number of methods for continual and lifelong learning have been proposed to tackle the problem of catastrophic forgetting and existing approaches can be broadly categorized into three groups~\cite{delange2021continual}: replay-based~\cite{lopez2017gradient,rebuffi2017icarl,rolnick2018experience,buzzega2021rethinking,aljundi2019gradient}, regularization-based~\cite{kirkpatrick2017overcoming,zenke2017continual,li2017learning}, and parameter isolation methods~\cite{fernando2017pathnet,yoon2017lifelong,mallya2018piggyback,rusu2016progressive}. In our work, we focus on a branch of parameter isolation methods called zero-forgetting CL such as PackNet~\cite{mallya2018packnet}, CPG~\cite{hung2019compacting}, RMN~\cite{kaushik2021understanding}, and SupSup~\cite{wortsman2020supermasks} that completely eliminates forgetting by training a sub-network for each task and freezing the trained parameters (SupSup excepted). However, finding of \cite{frankle2018lottery} shows that a network can reduce by over 90\% of parameters without performance reduction. This inspires our weight-allocation strategy to adapt PackNet to more sparse sub-networks. Unlike PackNet which prunes the network by keeping largest absolute weights in each layer and reuses all the frozen weights, CPG and RMN apply real-valued mask to each fixed entry and prune by keeping the largest values of the mask. SupSup is motivated by \cite{ramanujan2020s,zhou2019deconstructing,malach2020proving} which show that a sufficiently over-parameterized random network contains a sub-network with roughly the same accuracy as the target network without training. In essence, it aims to find masks only over random network and it is adaptable to infinite tasks. However it leads to inefficient inference (due to using the full network) and potentially large memory requirements (as one has to store a mask as large as supernet rather than a subnet). In CL, in order to load a network with a large number of tasks, often, a large model is needed, which naturally leads to inefficiency during inference-time without proper safeguards. Addressing this challenge appears to be an unexplored avenue as far as we are aware. While in this work, we present Efficient Sparse PackNet (ESPN) that implements zero-forgetting CL and achieves state-of-the-art accuracy with less computational demand. We also emphasize that there are several interesting works on the theory of continual learning such as \cite{lee2021continual, doan2021theoretical,bennani2020generalisation,mirzadeh2020understanding,yin2020optimization}. These works focus on NTK-based analysis for deep nets, theoretical investigation of orthogonal gradient descent \cite{farajtabar2020orthogonal}, and task-similarity. However, to the best of our knowledge, ours is the first work on the representation learning ability and the associated data-efficiency. \noindent\textbf{Representation learning theory.} The rise of deep learning motivated a growing interest in theoretical principles behind representation learning. Similar in spirit to this project, \cite{maurer2016benefit} provides generalization bounds for representation-based transfer learning in terms of the Rademacher complexities associated with the source and target tasks. Some of the earliest works towards this goal include \cite{baxter2000model}~and linear settings of \cite{lounici2011oracle,pontil2013excess,wang2016distributed,cavallanti2010linear}. More recent works \cite{hanneke2020no,lu2021power,kong2020meta,wu2020understanding,garg2020functional,gulluk2021sample,du2020few,tripuraneni2020theory,qin2022non,tripuraneni2020provable,sun2021towards,maurer2016benefit,arora2019theoretical} consider variations beyond supervised learning, concrete settings or established more refined upper/lower performance bounds. There is also a long line of works related to model agnostic meta-learning \cite{finn2017model,denevi2019online,balcan2019provable,khodak2019adaptive}. Unlike these works, we consider the CL setting and show how the representation learned by earlier tasks provably helps learning the new tasks with fewer samples and better accuracy. \noindent\textbf{Neural network pruning.} Our work is naturally related to neural network pruning methods and compression techniques as we embed tasks into sub-networks. Large model sizes in deep learning have led to a substantial interest in model pruning/quantization \cite{han2015deep,hassibi1993second,lecun1990optimal}. DNN pruning has a diverse literature with various architectural, algorithmic, and hardware considerations \cite{sze2017efficient,han2015learning}. Here, we mention the ones related our work. \cite{frankle2018lottery} empirically shows that a large DNN contains a small subset of favorable weights (for pruning), which can achieve similar performance to the original network when trained with the same initialization. \cite{zhou2019deconstructing,malach2020proving,pensia2020optimal} demonstrate that there are subsets with good test performance even without any training and provide theoretical guarantees. In relation \cite{chang2021provable} establishes the theoretical benefits of training large over-parameterized networks to improve downstream pruning performance. Although weight pruning is proven to be a good way to reduce model parameters and maintain performance, practically, it does not lead to compute efficiency except for some dedicated hardwares~\cite{han2016eie}. Unlike weight pruning, structured/channel pruning prunes the model at the channel level which results in a slim sub-network carrying much less FLOPs than the original dense model~\cite{liu2017learning, zhuang2020neuron, wen2016learning, ye2018rethinking}. For example~\cite{wen2016learning,zhou2016less,alvarez2016learning,lebedev2016fast,he2017channel} prune models by adding a sparse regularization over model weights whereas \cite{liu2017learning, zhuang2020neuron} only add regularization over channel factors, and prune channels with lower scaling factors. However, these prior works don't focus on the scenario where almost all of FLOPs pruned, for example with only 1\% of original FLOPs remained. To achieve this goal, we present an innovative channel pruning method based on FLOP-aware penalization. Our technique is inspired from \cite{liu2017learning, zhuang2020neuron} (it uses sparsity regularization over BatchNorm weights only) however it outperforms both methods as demonstrated in Appendix~\ref{pruning sec}. \section{Theoretical Analysis of Data Efficiency and Continual Representation Learning} \section{Empirical and Theoretical Insights for Continual Representation Learning}\label{sec:crl} In this section, we discuss continual learning from the representation learning perspective. {We first present our experimental insights which show that (1) features learned from previous tasks help reduce the sample complexity of new tasks and (2) the order of task sequence (in terms of diversity and sample size) is critical for the success of CRL. In Section~\ref{sec:crl_theory}, we present our theoretical framework and a rigorous analysis in support of our experimental findings.} \subsection{Empirical Investigation of CRL}\label{sec:crl_exp} We further elucidate upon Figure \ref{figure 2 label} and discuss the role of sample size (for both past and new tasks) and task diversity. \noindent\textbf{Investigating data efficiency (Fig \ref{fig:LS})} A good test to assess benefit of CRL is by constructing settings where new tasks have fewer samples. Consider SplitCIFAR100 for which $100$ classes are randomly partitioned into $20$ tasks. We partition the tasks into two sets: a continual learning set ${\cal{D}}_{cl}=\{\mathcal{T}_1,\dots,\mathcal{T}_{15}\}$ and a test set ${\cal{D}}_t=\{\mathcal{T}_{16},\dots,\mathcal{T}_{20}\}$. Test set is used to assess data efficiency and therefore, (intentionally) contains only 10\% of the original sample size (250 samples per task instead of 2500). We first train the network sequentially using ${\cal{D}}_{cl}$ via ESPN/PackNet and create checkpoints of the supernetwork at different task IDs: At time $t$, we get a supernet \ylm{$s_t$ that is} trained with $\mathcal{T}_1,\dots,\mathcal{T}_t$, for $t\leq15$. {$t=0$} stands for the initial supernet without any training. Then we assess the representation quality of different supernet by individually training tasks in ${\cal{D}}_t$ on it. Fig.~\ref{fig:LS} displays the test accuracy of tasks in ${\cal{D}}_t$ where we used SplitCIFAR100 setting detailed in Sec.~\ref{sec:setting}. Figure~\ref{fig:LS} shows that ESPN-0.2, ESPN-1, and PackNet methods all benefit from features trained by earlier tasks since the accuracy is above $75\%$ when we use supernets trained sequentially with multiple tasks. In contrast, individual learning trains separate models for each task where no knowledge is transferred; the accuracy is close to $68\%$. Note that the performance of ESPN gradually increases with the growing number of continual tasks. This reveals its ability to successfully transfer knowledge from previous learned tasks and reduce sample complexity. \input{sec/fig/diversity} \noindent\textbf{Importance of task order and diversity.} To study how task order and diversity benefits CL, similar to \cite{mallya2018packnet,hung2019compacting}, we use $6$ image classification tasks, where ImageNet-1k~\cite{krizhevsky2012imagenet} is the first task, followed by CUBS~\cite{wah2011caltech}, Stanford Cars~\cite{krause20133d}, Flowers~\cite{nilsback2008automated}, WikiArt~\cite{saleh2015large} and Sketch~\cite{eitz2012humans}. Intuitively, ImageNet should be trained first because of its higher diversity. Figure~\ref{fig:diversity} shows the accuracy improvement on the $5$ tasks that follow ImageNet pretraining compared to individual training. The results are displayed in Fig.~\ref{fig:diversity} where Green bars are CL with ImageNet as the first task, Orange is CL without ImageNet, and Blue is Individual training. In essence, this shows the importance of initial representation diversity in CL since results with the ImageNet pretraining (Green) are consistently and strictly better than no pretraining (Orange) and Individual (Blue). We note that related findings for zero-forgetting CL have been reported in \cite{hung2019compacting,mallya2018piggyback,mallya2018packnet,mallya2018piggyback,tu2020extending} which further motivates our theory in Sec \ref{sec:crl_theory}. Unlike these works, our experiment aims to isolate the CRL benefit of ImageNet by training other 5 tasks continually without ImageNet. }%\textcolor{blue}{We defer experimental details to the supplementary material.} \noindent\textbf{Importance of sample size.} Finally, we show that the sample size is also critical for CRL because one can build higher-quality (less noisy) features with more data. To this end, we devise another experiment based on SplitCIFAR100 dataset. Instead of using original tasks each with 5 classes and 2,500 samples, we train the first task (task ID 1 in Fig.~\ref{fig:Sample}) with 2,500 samples, then decrease the sample size for all the following tasks using the rule $2,500\times (1/20)^{\text{(ID-1)}/19}$ until the last task (task ID 20 in Fig.~\ref{fig:Sample}) has only 125 training samples. Figure~\ref{fig:Sample} presents the results, where solid curves are obtained by training Task ID 1 to 20 with decreasing sample size, dashed curves are for training Task ID 20 to 1 with increasing sample size, and dotted curves are for individual training where task order does not matter. The accuracy curves are smoothed with a moving average and displayed in the decreasing order from Task ID 1 to 20. The results support our intuition that training large sample tasks first (decreasing order) performs better, as larger tasks build high quality representations that benefit generalization for future small tasks with less data. More strikingly, the dotted Individual line falls strictly between solid and dashed curves. This means that increasing order actually \emph{hurts accuracy} whereas decreasing order \emph{helps accuracy} compared to training from scratch (i.e.~no representation). Specifically, decreasing helps (solid$>$dotted) on the right side of the figure where tasks are small (thanks to good initial representations) whereas increasing hurts on the left side where tasks are large. The latter is likely due to the fact that, adding a large task requires a larger/better subnetwork to achieve high accuracy, however, since we train small tasks first, supernetwork runs out of sufficient free weights for a large subnetwork. \subsection{Theoretical Analysis and Performance Bounds for Continual Representation Learning}\label{sec:crl_theory} In this section, we provide theoretical analysis to explain how CRL provably promotes sample efficiency and benefits from initial tasks with large diversity and sample size. We use $\ordet{\cdot}$ to denote equality up to a factor involving at most logarithmic terms. Following our experiments as well as \cite{maurer2016benefit}, a realistic model for deep representation learning is the compositional hypothesis $f=h\circ \phi$ where $h\in{\mtx{H}}$ is the classifier head and $\phi\in{\boldsymbol{\Phi}}$ is the shared backend feature extractor. In practice, $\phi$ has many more parameters than $h$. To model continual learning, let us assume that we already trained a frozen feature extractor $\phi_{\text{frz}}\in{\boldsymbol{\Phi}}_{\text{frz}}$\ylm{ on earlier tasks {from which $\phi$ can be learned faster}}. {Here ${\mtx{H}},{\boldsymbol{\Phi}},{\boldsymbol{\Phi}}_{\text{frz}}$ are the hypothesis sets to learn from.} Suppose we are now given a set of $T}%_{\text{new}}$ new tasks represented by independent datasets $\mathcal{S}_t=\{(\vct{x}_{ti},y_{ti})\}_{i=1}^N{\subset \mathcal{X}\times \mathcal{Y}}$, each drawn i.i.d.~from different distributions ${\cal{D}}_t$ for $1\leq t\leq T$. \ylm{$\mathcal{X},~\mathcal{Y}$ are the sets of feasible input features and labels respectively.} Our goal is to build the hypotheses $(f_t)_{t=1}^{T}%_{\text{new}}}:\mathcal{X}\rightarrow\mathbb{R}$ for these new tasks with small sample size $N$ while leveraging $\phi_{\text{frz}}\in{\boldsymbol{\Phi}}_{\text{frz}}$. \textbf{CRL setting.} In a realistic CL setting the new tasks are allowed to learn new features. We will capture this with an \emph{incremental} feature extractor {$\phi_{\text{new}}\in {\boldsymbol{\Phi}}_{\text{new}}$, and represent the hypothesis of each task via the composition $f_t=h_t\circ \phi$ where $\phi=\phi_{\text{new}}+\phi_{\text{frz}}$. For PackNet/ESPN, ${\boldsymbol{\Phi}}_{\text{new}}$ corresponds to the free/trainable weights allocated to the new task, $\phi_{\text{frz}}$ corresponds to the trained weights of the earlier tasks and $\phi$ corresponds to the eventual task subnetwork and its weights. We will evaluate the quality of $\phi$ (which lies in the Minkowski sum ${\boldsymbol{\Phi}}_{\text{new}}+{\boldsymbol{\Phi}}_{\text{frz}}$) with respect to a global representation space ${\boldsymbol{\Phi}}$ which is chosen to be a superset: ${\boldsymbol{\Phi}}_{\text{new}}+{\boldsymbol{\Phi}}_{\text{frz}}\subseteq {\boldsymbol{\Phi}}$. For instance, in PackNet, ${\boldsymbol{\Phi}}_{\text{new}}+{\boldsymbol{\Phi}}_{\text{frz}}$ denotes the sparse sub-networks allocated to the \ylm{new and previous} tasks whereas ${\boldsymbol{\Phi}}$ corresponds to the full supernet.} This motivates us to pose a CRL problem that builds a continual representation by searching for $\phi_{\text{new}}$ and combining with $\phi_{\text{frz}}$. Let ${\vct{h}}=(h_t)_{t=1}^T}%_{\text{new}}\in {\mtx{H}}^T}%_{\text{new}}$ denote all $T}%_{\text{new}}$ task-specific classifier heads, we solv \begin{align} \underset{\phi=\phi_{\text{new}}+\phi_{\text{frz}}}{\underset{{\vct{h}}\in{\mtx{H}}^T}%_{\text{new}},\phi_{\text{new}}\in{\boldsymbol{\Phi}}_{\text{new}}}{\arg\min}}&{\widehat{\cal{L}}}({\vct{h}},\phi):=\frac{1}{T}%_{\text{new}}}\sum_{t=1}^T}%_{\text{new}} {\widehat{\cal{L}}}_{\mathcal{S}_t}(h_t\circ\phi)\nonumber\\ \text{WHERE}\quad &{\widehat{\cal{L}}}_{\mathcal{S}_t}(f):=\frac{1}{N}\sum_{i=1}^N \ell(y_{ti},f(\vct{x}_{ti})) \tag{CRL}\label{crl}. \end{align} \noindent \textbf{Intuition:} \eqref{crl} aims to learn the task-specific headers ${\vct{h}}$ and the shared incremental representation $\phi_{\text{new}}$. Let $\cc{\cdot}$ be a complexity measure for a function class (e.g.~VC-dimension). Intuitions from the MTL literature would advocate that when the total sample size obeys $N\times T}%_{\text{new}}\gtrsim T}%_{\text{new}}\cc{{\mtx{H}}}+\cc{{\boldsymbol{\Phi}}_{\text{new}}}$, then \eqref{crl} would return generalizable solutions ${\vct{\hat{h}}},\hat{\phi}_{\text{new}}$. This is desirable as in practice $\phi_{\text{frz}}$ is a much more complex hypothesis obtained by training on many earlier tasks. Thus, from continual learning perspective, theoretical goals are: \begin{enumerate} \item The sample size should only depend on the complexity $\cc{{\boldsymbol{\Phi}}_{\text{new}}}$ of the incremental representation rather than the combined complexity that can potentially be much larger ($\cc{{\boldsymbol{\Phi}}_{\text{new}}}+\cc{{\boldsymbol{\Phi}}_{\text{frz}}}\gg \cc{{\boldsymbol{\Phi}}_{\text{new}}}$). \item To explain Figure \ref{fig:LS}, we would like to quantify how frozen representation $\phi_{\text{frz}}$ can provably help accuracy. Ideally, thanks to $\phi_{\text{frz}}$, we can discover a near-optimal $\phi$ from the larger hypothesis set ${\boldsymbol{\Phi}}$. \item Finally, we emphasize that, we add the $T$ new tasks to the network in one round for the sake of cleaner exposition. }%\textcolor{blue}{In appendix, we provide synergistic theory and detailed investigation of the scenario where tasks are learned sequentially in a continual fashion and frozen features $\phi_{\text{frz}}$ evolve as we add more tasks.} In a nutshell, this theory explains Figure \ref{fig:Sample} by quantifying the role of sample size in the quality of continual representations. \end{enumerate} Before stating our technical results, we need to introduce a few definitions. To quantify the complexities of the search spaces ${\boldsymbol{\Phi}}_{\text{new}},{\mtx{H}}$, we introduce \emph{metric dimension} \cite{mendelson2003few}, which is a generalization of the VC-dimension \cite{vapnik2015uniform}. \begin{definition}[Metric dimension] \label{def:cov} Let ${\mtx{G}}:\mathcal{Z}\rightarrow\mathcal{Z}'$ be a set of functions. {Let $\bar{C}_{\mathcal{Z}}>0$ be a scalar that is allowed to depend on $\mathcal{Z}$.} Let ${\mtx{G}}_{\varepsilon}$ be a minimal-size $\varepsilon$-cover of ${\mtx{G}}$ such that for any $g\in{\mtx{G}}$ there exists $g'\in {\mtx{G}}_{\varepsilon}$ that ensures $\sup_{\vct{x}\in\mathcal{Z}}\tn{g(\vct{x})-g'(\vct{x})}\leq \varepsilon$. The metric dimension $\cc{{\mtx{G}}}$ is the smallest number that satisfies $\log|{\mtx{G}}_{\varepsilon}|\leq \cc{{\mtx{G}}}\log(\bar{C}_{\mathcal{Z}}/\varepsilon)$ for all $\varepsilon>0$. \end{definition} {$\bar{C}_{\mathcal{Z}}$ typically depends only logarithmically on the Euclidean radius of the feature space under mild Lipschizness conditions, thus, $\bar{C}_{\mathcal{Z}}$ dependence will be dropped for cleaner exposition.} In practice, for neural networks or other parametric hypothesis, metric dimension is bounded by the number of trainable weights up to logarithmic factors \cite{barron2018approximation}. Metric dimension will help us characterize the sample complexity. However, we also would like to understand when ${\boldsymbol{\Phi}}_{\text{frz}}$ can help. To this end, we introduce definitions that capture the population loss (infinite data limit) of new tasks and the \emph{feature compatibility} between the new tasks and $\phi_{\text{frz}}$ of old tasks. These definitions help decouple the finite sample size $N$ and the distribution of the new tasks. \begin{definition}[Distributional quantities]\label{def pop}Define the population (infinite-sample) risk as ${\cal{L}}({\vct{h}},\phi)=\operatorname{\mathbb{E}}[{\widehat{\cal{L}}}({\vct{h}},\phi)]$. Define the optimal risk over representation ${\boldsymbol{\Phi}}$ as ${\cal{L}}^{\st}=\min_{{\vct{h}}\in{\mtx{H}}^T}%_{\text{new}},\phi\in{\boldsymbol{\Phi}}}{\cal{L}}({\vct{h}},\phi)$. Note that the optimal risk can always choose the best representations within ${\boldsymbol{\Phi}}_{\text{new}}$ and ${\boldsymbol{\Phi}}_{\text{frz}}$ since ${\boldsymbol{\Phi}}_{\text{new}}+{\boldsymbol{\Phi}}_{\text{frz}}\subseteq {\boldsymbol{\Phi}}$. Finally, define the optimal population risk using frozen $\phi_{\text{frz}}$ to be ${\cal{L}}^{\st}_{{\phi}_{\text{frz}}}=\min_{{\vct{h}}\in{\mtx{H}}^T}%_{\text{new}},\phi_{\text{new}}\in{\boldsymbol{\Phi}}_{\text{new}}}{\cal{L}}({\vct{h}},\phi)$ s.t.~$\phi=\phi_{\text{new}}+\phi_{\text{frz}}$. \end{definition} Following this, the \emph{representation mismatch} introduced below assesses the suboptimality of $\phi_{\text{frz}}$ for the new task distributions compared to the optimal hypothesis within ${\boldsymbol{\Phi}}$. \begin{definition}[New \& old tasks mismatch]\label{def MM} {The representation mismatch between the frozen features $\phi_{\text{frz}}$ and the new tasks} is defined as \vspace{-8pt} \begin{align*} \text{MM}_{\text{frz}}}%^{\text{new}={\cal{L}}^{\st}_{\phi_{\text{frz}}}-{\cal{L}}^{\st}. \end{align*} \end{definition} By construction, $\text{MM}_{\text{frz}}}%^{\text{new}$ is guaranteed to be non-negative. Additionally, $\text{MM}_{\text{frz}}}%^{\text{new}=0$ if we choose global space to be ${\boldsymbol{\Phi}}={\boldsymbol{\Phi}}_{\text{new}}+{\boldsymbol{\Phi}}_{\text{frz}}$ and $\phi_{\text{frz}}$ to be the optimal hypothesis wihin ${\boldsymbol{\Phi}}_{\text{frz}}$. With these definitions, we have the following generalization bound regarding \eqref{crl} problem. }%\textcolor{blue}{The proof is deferred to appendix\ylm{the Appendix \ref{app B}}.} \begin{theorem}\label{cl thm} Let ${\vct{h}},{\vct{\hat{h}}}$ denote the set of classifiers $(h_t)_{t=1}^T}%_{\text{new}},({\hat{h}}_t)_{t=1}^T}%_{\text{new}}$ respectively and $({\vct{\hat{h}}},\hat{\phi}=\hat{\phi}_{\text{new}}+\phi_{\text{frz}})$ be the solution of \eqref{crl}. Suppose that the loss function $\ell(y,\hat{y})$ takes values on $[0,1]$ and is $\Gamma$-Lipschitz w.r.t.~$\hat{y}$. {Suppose that input set $\mathcal{X}$ is bounded and all $\phi_{\text{new}}\in{\boldsymbol{\Phi}}_{\text{new}},~h\in{\mtx{H}}$, \ylm{${\boldsymbol{\Phi}}_{\text{new}}\in\{{\boldsymbol{\Phi}}_{\text{new}}^i,1\leq i\leq k\}$,} and $\phi_{\text{frz}}$ have Lipschitz constants upper bounded with respect to Euclidean distance}. With probability at least $1-2e^{-\tau}$, the task-averaged population risk of the solution $({\vct{\hat{h}}},\hat{\phi})$ obeys { \begin{align} {\cal{L}}({\vct{\hat{h}}},\hat{\phi})&\leq {\cal{L}}^{\st}_{\phi_{\text{frz}}}+ \sqrt{\frac{\ordet{T}%_{\text{new}}\cc{{\mtx{H}}}+\cc{{\boldsymbol{\Phi}}_{\text{new}}}+\tau}}{T}%_{\text{new}} N}},\nonumber\\ &\leq {\cal{L}}^{\st}+{\text{MM}_{\text{frz}}}%^{\text{new}}+{\sqrt{\frac{\ordet{T}%_{\text{new}}\cc{{\mtx{H}}}+\cc{{\boldsymbol{\Phi}}_{\text{new}}}+\tau}}{T}%_{\text{new}} N}}}.\nonumber \end{align}} \end{theorem} In words, this theorem shows that as soon as the total sample complexity obeys $T}%_{\text{new}} N\gtrsim T}%_{\text{new}} \cc{{\mtx{H}}}+\cc{{\boldsymbol{\Phi}}_{\text{new}}}$, we achieve small excess statistical risk and avoid the sample cost of learning $\phi_{\text{frz}}$ from scratch. {Importantly, the sample cost $\cc{{\boldsymbol{\Phi}}_{\text{new}}}$ of learning the incremental representation is shared between the tasks since per-task sample size $N$ only needs to grow with $\cc{{\boldsymbol{\Phi}}_{\text{new}}}/T$.} Reusing ${\boldsymbol{\Phi}}_{\text{frz}}$ comes at the cost of a prediction bias $\text{MM}_{\text{frz}}}%^{\text{new}$ arising from the feature mismatch. Also, with access to a larger sample size (e.g.~$T}%_{\text{new}} N\gtrsim T}%_{\text{new}}\cc{{\mtx{H}}}+ \cc{{\boldsymbol{\Phi}}}$), new tasks can learn a near-optimal $\phi^\star\in{\boldsymbol{\Phi}}$ from scratch\footnote{In this statement, we ignore the continual nature of the problem and allow $\phi_{\text{frz}}$ to be overridden for the new tasks if necessary.}. Thus, the benefit of \ref{crl} on data-efficiency is most visible when the new tasks have few samples, which is exactly the setting in Figure \ref{fig:LS}. \noindent$\bullet$ \textbf{${\boldsymbol{\Phi}}_{\text{new}}$ \& representation diversity.} Imagine the scenario where $\phi_{\text{frz}}$ is already very rich and approximately coincides with the optimal hypothesis within the global space ${\boldsymbol{\Phi}}$. This is precisely the ImageNet setting of Figure \ref{fig:diversity} where even fine-tuning $\phi_{\text{frz}}$ will achieve respectable results. Mathematically, this corresponds to the scenario where ${\boldsymbol{\Phi}}_{\text{new}}$ is empty set but the mismatch is $\text{MM}_{\text{frz}}}%^{\text{new}\approx 0$. In this case, our theorem reduces to the standard few-shot learning risk where the only cost is learning ${\mtx{H}}$ i.e.~${\cal{L}}({\vct{\hat{h}}},\hat{\phi})\leq {\cal{L}}^{\st}+ \sqrt{{\ordet{\cc{{\mtx{H}}}}}/{N}}$. \noindent$\bullet$ \textbf{$\text{MM}_{\text{frz}}}%^{\text{new}$ \& initial sample size.} Note that $\phi_{\text{frz}}$ is built using previous tasks which has finite samples. }%\textcolor{blue}{The sequential CL analysis we develop in appendix decomposes mismatch as $\text{MM}_{\text{frz}}}%^{\text{new}\lesssim\text{MM}_{\text{frz}}}%^{\text{new}^\star+\ordet{\cc{{\boldsymbol{\Phi}}_{\text{frz}}}/N_{\text{prev}}}$ where $\text{MM}_{\text{frz}}}%^{\text{new}^\star$ is the mismatch if previous tasks had $N_{\text{prev}}=\infty$ samples and $\ordet{\cc{{\boldsymbol{\Phi}}_{\text{frz}}}/N_{\text{prev}}}$ is the excess mismatch due to finite samples shedding light on Figure \ref{fig:Sample}. } Our analysis is related to the literature on representation learning theory \cite{maurer2016benefit,kong2020meta,wu2020understanding,du2020few,gulluk2021sample,tripuraneni2020theory,arora2019theoretical}. Unlike these works, we consider the CL setting and show how the representation learned by earlier tasks provably helps learning the new tasks with fewer samples and how initial representation diversity and sample size benefit CRL. }%\textcolor{blue}{Importantly, we also specialize our general results to neural networks (see Theorem \ref{cl thm3} and Appendix \ref{app:application}) to obtain tight sample complexity bounds (in the degrees of freedom).} }%[1]{\textcolor{red}{#1}}% \textcolor{red}{ \noindent$\bullet$ \textbf{Adding tasks sequentially.} Theorem \ref{seq thm} in the appendix also provides guarantees for the practical setting where $T$ tasks are added sequentially to the network. Informally, this theorem provides the following cumulative generalization bound on $T$ tasks (see Line \eqref{gen bound 3}) \[ \sum_{i=1}^T \text{``excess risk of task $t$''} \leq \sum_{i=1}^T \text{``mismatch of task $t$''}+T^2 \times \text{``statistical error per task''}. \] Here, ``mismatch of task $t$'' is evaluated with respect to earlier $t-1$ tasks assuming those $t-1$ tasks have infinite samples. ``statistical error per task'' is the generalization risk arising from each task having finite samples. In our bound, the growth of statistical error is quadratic in $T$ because when the new task $t$ uses imperfect representations learned by the earlier $t-1$ tasks (which have finite samples), the statistical error may aggregate. The overall proof idea is decoupling the population risk from empirical risk by defining the `mismatch of task $t$'' in terms of the landscape of the population loss (see Definition \ref{def pop seq}).} \section{Preliminaries} \textbf{Notation.} Let $\{\mathcal{T}_\tau, \tau\in \mathbb N^+\}$ be task identifier and ${\cal{D}}_\tau$ be its sample distribution. $\{(\vct{x}_{\tau,i},y_{\tau,i})\}_{i=1}^{n_\tau}$ are input-output pairs sampled from ${\cal{D}}_\tau$ to generate $\mathcal{T}_\tau$ where $n_\tau$ is the sample size. In the following discussion, we consider $\tau\leq T$ where $T\in\mathbb N^+$. \subsection{} \begin{align*} {\boldsymbol{\theta}}^M&:=\arg\min_{{\boldsymbol{\theta}}}\sum_{\tau=1}^T\sum_{i=1}^{n_\tau}\ell(f(\vct{x}_{\tau,i};{\boldsymbol{\theta}}),y_{\tau,i})\\ {\boldsymbol{\theta}}^I_\tau&:=\arg\min_{{\boldsymbol{\theta}}}\sum_{i=1}^{n_\tau}\ell(f(\vct{x}_{\tau,i};{\boldsymbol{\theta}}),y_{\tau,i})\\ {\boldsymbol{\theta}}_\tau^{CL}&:=\arg\min_{{\boldsymbol{\theta}},f_\tau}\sum_{i=1}^{n_\tau}\ell(f_\tau(\vct{x}_{\tau,i};{\boldsymbol{\theta}}_{\tau-1}^{CL},{\boldsymbol{\theta}}),y_{\tau,i}) \end{align*} \section{Related Work Our contributions are closely related to the representation learning theory as well as continual learning methods. \noindent\textbf{Representation learning theory.} The rise of deep learning motivated a growing interest in theoretical principles behind representation learning. Similar in spirit to this project, \cite{maurer2016benefit} provides generalization bounds for representation-based transfer learning in terms of the Rademacher complexities associated with the source and target tasks. Some of the earliest works towards this goal include \cite{baxter2000model}~and linear settings of \cite{lounici2011oracle,pontil2013excess,wang2016distributed,cavallanti2010linear}. More recent works \cite{hanneke2020no,lu2021power,kong2020meta,qin2022non,wu2020understanding,garg2020functional,gulluk2021sample,xu2021statistical,du2020few,tripuraneni2020theory,tripuraneni2020provable,maurer2016benefit,arora2019theoretical,chen2021weighted,sun2021towards} consider variations beyond supervised learning, concrete settings or established more refined upper/lower performance bounds. There is also a long line of works related to model agnostic meta-learning \cite{finn2017model,denevi2019online,balcan2019provable,khodak2019adaptive}. {Unlike these works, we consider the CL setting where tasks arrive sequentially and establish how the representations learned by earlier tasks help learning the new tasks with fewer samples and better accuracy.} \noindent \textbf{Continual learning.} A number of methods for continual and lifelong learning have been proposed to tackle the problem of catastrophic forgetting. Existing approaches can be broadly categorized into three groups: replay-based~\cite{lopez2017gradient,borsos2020coresets}, regularization-based~\cite{kirkpatrick2017overcoming, jung2020continual}, and architecture-based methods~\cite{yoon2017lifelong}. }%[1]{\textcolor{red}{#1}}% \textcolor{red}{Recent work \cite{ramesh2021model} explores statistical challenges associated with continual learning in terms of the relatedness across tasks through replay-based strategies. In comparison, we focus on the benefits of representation learning and establish how representation built for previous tasks can drastically reduce the sample complexity on new tasks in terms of representation mismatch without access to past data. Another key difference is that our analysis allows for learning multiple sequential tasks rather than a single task.} In our work, consistent with our theory, we focus on zero-forgetting CL~\cite{mallya2018packnet,hung2019compacting,mallya2018piggyback,wortsman2020supermasks,kaushik2021understanding,tu2020extending}, which is a sub-branch of architecture-based methods and completely eliminates forgetting. \cite{hung2019compacting, kaushik2021understanding, mallya2018packnet} train a sub-network for each task and implement zero-forgetting by freezing the trained parameters, while \cite{mallya2018piggyback} trains masks only over pretrained model. Inspired by \cite{ramanujan2020s}, SupSup \cite{wortsman2020supermasks} trains a binary mask for each task while keeping the underlying model fixed at initialization. However in order to embed the super-network with many tasks or to achieve acceptable performance over a masked random network, sufficiently large networks are needed. Additionally, without accounting for the network structure, the inference-time compute cost of these networks is high even for simple tasks. Our proposed method is designed to overcome these challenges. In addition to achieving zero-forgetting, our algorithm also provides efficient inference in terms of FLOPs. \subsection{Linear regression} Consider a linear feature matrix $\vct\Phi=[\vct \phi_1, \vct \phi_2,...,\vct \phi_r]\in\mathbb{R}^{d\times r}$ where $d\gg r$ and $\{\vct\phi_i\}_{i=1}^r$ are orthogonal. Given $\{(\vct{x}_{\tau,i},y_{\tau,i})\}_{i=1}^{n_\tau}\sim{\cal{D}}_\tau$, describe a linear regression problem as \begin{align*} y=\vct{x}^\top\vct\beta+\epsilon~~\text{where}~~\vct\beta=\vct\Phi \vct{w}=\sum_{i=1}^r\vct{w}_i\vct\phi_i \end{align*} where $\vct{w}\in\mathbb{R}^r$ and $\epsilon$ is random noise. Therefore we have $\vct\beta\in\text{Span}\{\vct\phi_1,...,\vct\phi_r\}$. Define linear continual regression problem as \begin{align*} \tau\leq r:&\min_{\vct\phi}\|{\mtx{X}}_\tau\vct\phi-Y_\tau\|_2\\ &\Longrightarrow\hat{\vct\phi}_\tau=({\mtx{X}}_\tau^\top {\mtx{X}}_\tau)^{-1}{\mtx{X}}_\tau^\top Y_\tau\\ \tau > r:&\min_{\vct{w}}\|{\mtx{X}}_\tau\hat\Phi\cdot\vct{w}-Y_\tau\|_2~~\text{where}~~\hat{\vct\Phi}=[\hat{\vct\phi}_1,...,\hat{\vct\phi}_r]\\ &\Longrightarrow\hat{\vct{w}}_\tau =(({\mtx{X}}_\tau\hat{\vct\Phi})^\top{\mtx{X}}_\tau\hat{\vct\Phi})^{-1}{\mtx{X}}_\tau\hat{\vct\Phi} Y_\tau \end{align*} \subsection{General case} Consider feature extractor $\phi\in\Phi$ and task-specific function $h\in\mathcal{H}$. Denote task predictor $f:=h\circ\phi\in\mathcal{H}\times \Phi$, where $\mathcal{H}$ and $\Phi$ are continuous search spaces. Let $\phi^M$ be optimal representation that trained from multitasks learning. \begin{align*} \hat\phi^M&=\arg\min_{\phi\in\Phi}\frac{1}{T}\sum_{\tau=1}^T{\cal{L}}(h_\tau\circ\phi(\vct{x}_\tau),y_\tau)\\ &\text{s.t.}~~h_\tau=\arg\min_{\vct{h}_\tau\in\mathcal{H}}\frac{1}{n_\tau}\sum_{i=1}^{n_\tau}{\cal{L}}(h_\tau\circ\phi(\vct{x}_{\tau,i}),y_{\tau,i}) \end{align*} In practical problem, $\Phi$ is not uniformly distributed. Here let $\Phi'=(\Phi_1\times\Phi_2\times...\times\Phi_T)$ and assume that for any $\phi\in\Phi$, there exists $\phi'\in\Phi'$ that ${\cal{L}}(\phi')-{\cal{L}}(\phi)<\varepsilon$. Define our continual learning problem as \begin{align*} \hat\phi_1&=\arg\min_{\phi\in\Phi_1, h_1\in\mathcal{H}}{\cal{L}}_{{\cal{D}}_1}(h_1\circ\phi)\\ \hat\phi_\tau&=\arg\min_{\phi\in(\hat\phi_1\times...\times\hat\phi_{\tau-1})\times\Phi_\tau, h_\tau\in\mathcal{H}}{\cal{L}}_{{\cal{D}}_\tau}(h_\tau\circ\phi) \end{align*} We will show that for all $\phi\in(\hat\phi_1\times...\times\hat\phi_{\tau-1})\times\Phi_\tau$ \begin{align*} Dist(\hat\phi^M,\phi) =\mathcal{O}() \end{align*} Consider about individual learning that \begin{align*} \hat\phi^I_\tau=\arg\min_{\phi\in\Phi,h_\tau\in\mathcal{H}}{\cal{L}}(h_\tau\circ\phi) \end{align*} Then we will have \begin{align*} Dist(\hat\phi^M,\hat\phi_\tau^I)=\mathcal{O}() \end{align*} \section{Experimental Evidences in CL}\label{sec:exp} \subsection{Investigation of Data Efficiency To investigate how features learned from earlier tasks help in training new tasks in continual representation learning, we introduce a new experimental setting based on SplitCIFAR100 described in Sec~\ref{sec:setting} where 100 classes are randomly partitioned into 20 5-class classification tasks. Let us denote the original $20$ tasks as $\mathcal{T}_1,...,\mathcal{T}_{20}$. First, we split the tasks into a continual learning task set ${\cal{D}}_{cl}=\{\mathcal{T}_1,..,\mathcal{T}_{15}\}$ and a test task set ${\cal{D}}_t=\{\mathcal{T}_{16},...,\mathcal{T}_{20}\}$. Tasks in ${\cal{D}}_{cl}$ {retain} all $2500$ training samples per task. To test the data efficiency of CL, ${\cal{D}}_t$ tasks only have 10\% of their original training samples (i.e., $250$ for each task). We use ResNet18 described in Sec~\ref{sec:setting}. To quantify the benefits of learned feature representations in the continual learning process, we train the network sequentially using tasks in ${\cal{D}}_{cl}$ and test knowledge transferability separately over ${\cal{D}}_t$ after each task in ${\cal{D}}_{cl}$ added to the network. \red{Our goal is to quantify the benefits of learned feature representations in the continual learning process. To this aim, we train the network using samples from test tasks in ${\cal{D}}_t$ after every task in ${\cal{D}}_{cl}$ and use the test accuracy of ${\cal{D}}_t$ as a proxy for quantifying the quality of representations learned in previous tasks}. \input{sec/fig/cifar_oc} First, we use the CL method to sequentially learn tasks ${\cal{D}}_{cl}$ and save the supernet after every task. In this manner, we get 16 different supernets $\vct{s}_0,\vct{s}_1,...,\vct{s}_{15}$, where $\vct{s}_0$ stands for the initial supernet with no task, and $\vct{s}_i$ stands for the supernet after training $\mathcal{T}_1,\dots,\mathcal{T}_i$ using CL algorithm for $i\leq 15$. The source of the knowledge in $\vct{s}_i$ is the first $i$ tasks of the ${\cal{D}}_{cl}$ dataset. The test dataset ${\cal{D}}_t$ is used to test the transferability of the knowledge contained in supernet $\vct{s}_i$. {We separately train each of the 5 tasks of ${\cal{D}}_t$ by adding them into $\vct{s}_i$ in a continual learning manner (i.e.~by preserving the weights trained for ${\cal{D}}_{cl}$ }%\textcolor{blue}{and following the same channel pruning and weight allocation rules}).} This is done for all $16$ supernets $\vct{s}_i$. Training at supernet $\vct{s}_0$ is equivalent to training the network from scratch. Training at supernet $\vct{s}_i$ shows how features learned from $\mathcal{T}_1,\dots,\mathcal{T}_i$ help the test tasks in terms of data efficiency. We plot the average test accuracy on }%\textcolor{blue}{$5$ trails in Fig.~\ref{fig:LS} for each $\vct{s}_i$ and test accuracy in each trail is averaged over $5$ test tasks.} Figure~\ref{fig:LS} summarizes the results of our experiment. Orange and Blue curves display ESPN-1 and ESPN-0.2 results. We also run PackNet, SupSup, and Individual-0.2/-1 baselines using the same setting as in Table~\ref{CIFARtable}\som{ with only difference being weight allocation $\alpha=0.05$ rather than $\alpha=0.1$}. Since SupSup uses a fixed model with random initialization and learns a mask for each task separately, no knowledge is transferred. This is why dashed lines are strictly horizontal. Figure~\ref{fig:LS} shows that ESPN-0.2, ESPN-1, and PackNet methods benefit from features trained by earlier tasks since the test accuracy significantly improves when we train the new task on top of a network containing more continual tasks. Observe that, the performance of ESPN gradually increases with the growing number of continual tasks. This reveals its ability to successfully transfer knowledge from previous learned tasks. \ylm{We believe ESPN's advantage over PackNet arises from the Task-specific BatchNorm weights which allow ESPN to better re-purpose the features learned by earlier tasks. The small gap between ESPN-0.2 and ESPN-1 also shows that our ESPN algorithm performs well in finding the most relevant features despite channel sparsity restrictions.} Complementing these experiments, the next section provides theoretical insights into the representation learning ability of PackNet/ESPN. \subsection{Importance of task order: diversity and sample size} \input{sec/fig/sample_size} \section{Appendix} \subsection{Channel Pruning} To prune channel effectively and iteratively, we introduce channel mask in continuous value ($\mathcal{M}_l\in\mathbb{R}^{n_l}, l\in [L]$) to induce sparsity where $L$ is layer count each with $n_l$ channels/neurons. In our experiments, inspired by \cite{liu2017learning} we adopt BatchNorm layers and extract their weights as masks. Then we have \begin{align*} \vct{x}_l=(\mathcal{M}_l\cdot \text{norm}(\text{conv}(\vct{x}_{l-1})))_+,~~\text{norm}({\vct{z}})=\frac{{\vct{z}}-\mu_{\vct{z}}}{\sqrt{\sigma_{\vct{z}}^2+\epsilon}} \end{align*} where $\vct{x}_l$ is the output feature of $l^{th}$ layer and $\mathcal{M}_l$ is trainable masked weights of BN layer. Given a single task, structure pruning is trying to find and remove insignificant channels/neurons without hurting performance. To achieve this goal, we propose a FLOP-base sparsity regularization \begin{align*} \mathcal{R}(\mathcal{M})&=\sum_{l\in [L]}\lambda_l\|\mathcal{M}_l\|_1\\ &=\sum_{l\in[L]}\frac{g(\text{FLOP}_l(\mathcal{M}))}{\sum_{j\in[L]}g(\text{FLOP}_j(\mathcal{M}))}\|\mathcal{M}_l\|_1 \end{align*} where $\lambda_l$, $\mathcal{M}_l$ and $\text{FLOP}_l(\cdot)$ denote regularization parameter, channel mask and FLOP calculation function of $l^{th}$ layer. We apply $\ell_1$-norm to achieve sparsity, since it enforces unimportant elements to zeros. $g(\cdot)$ is monotonically increasing function used to calculate $\lambda_l$ automatically. In deep neural network, different layer has different FLOPs load corresponding to its input/output feature size and operations. Therefore, it is unfair to use global regularization parameters. We adopt layerwise regularization parameter $\lambda_l$ and relate it to FLOPs load. Our goal is to push layers with more FLOPs sparser. Results show that this approach achieves good results especially when the network is pruned to very sparse. In our experiments, we use $g(x)=\sqrt{x}$. \begin{table}[t] \small \caption{\small{Continual learning results}} \centering \begin{tabular}{lcc} \midrule & RotatedMNIST & PermutedMNIST\\ \midrule ESPN-0.2 &97.21$\pm$0.007 95.78$\pm$0.015\\ PackNet &95.66$\pm$0.014 & 92.88$\pm$0.024\\ Individual-0.2&95.48$\pm$0.370 & 95.36$\pm$0.303\\ Individual-1 &97.36$\pm$0.149 & 97.31$\pm$0.107\\ \midrule \end{tabular}\label{MNISTtable} \end{table} \section*{Organization of the Appendix} Supplementary material is organized as follows. \begin{enumerate} \item Appendix~\ref{appsec: espnalgo} discusses additional details of our ESPN algorithm. In Appendix~\ref{pruning sec} we evaluate the benefits of our FLOP-aware pruning and weight allocation strategies. \item Appendix~\ref{app:application} discusses an application of CRL, that is we introduce a shallow network by setting feature extractor $\phi$ and classifier $h$ to be specific functions. \item Appendix~\ref{app B} provides the proof of our Theorem \ref{cl thm} and also proves Theorem~\ref{cl thm3} proposed in Appendix~\ref{app:application}. \item Appendix~\ref{app C} proposes Theorem \ref{seq thm} which provides guarantee for continual representation learning when the $T$ tasks are added into the super-network in a sequential fashion. This theorem adds further insights into the bias-variance tradeoffs surrounding sequential learning (e.g.~how representation mismatch might aggregate as we add more tasks). \item Appendix~\ref{app:related} provides an expanded discussion of related work on continual learning, representation learning and neural network pruning. \item Appendix~\ref{app:imagenet} discusses our implementation setting of experiment in Figure~\ref{fig:diversity}. \end{enumerate} }
{'timestamp': '2022-03-07T02:03:54', 'yymm': '2203', 'arxiv_id': '2203.02026', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.02026'}
arxiv
\section{Introduction} In recent years, recommendation algorithms on social platforms have greatly enhanced confirmation bias by showing users content that is the most susceptible to match their interests --- the so-called \emph{filter bubble} effect \citep{pariser}. As a consequence, more and more isolated, tightly clustered online communities of similar-minded individuals, often referred to as \emph{echo chambers}, have arisen in various domains such as politics \citep{cota2019,delvicario2017,garimella2018}, healthcare \citep{allington2020,health_polarisation,monsted2022} or science \citep{williams2015}. Because of the so-called \emph{backfire effect}, presenting these users with opposing information might have the adverse effect of reinforcing their prior beliefs \citep{bail2018,schaewitz2020}. Finding ways to prevent such polarisation of opinion is a great challenge in the actual world. This paper is a step in this direction, as we propose ways of maximising the diversity of beliefs as well as the exposure to adverse views in a social group. To this end we rely on the well-known voter model, in which each user holds one of two possible opinions (e.g.\ liberal of conservative, pro or anti-abortion) and updates it randomly under the distribution of others' beliefs. Independently introduced by \cite{clifford_sudbury} and \cite{holley1975} in the context of particles interaction, this model has since been used to describe in a simple and intuitive manner social dynamics where people are divided between two parties and form their opinion by observing that of others around them. We assume some of the users are stubborn and never change opinion. We call them \emph{zealots} as in \cite{mobilia2003,mobilia2007}. They can represent lobbyists, politicians or activists for example. Long time dynamics and limiting behaviour of such processes have been subject to several studies \citep{mobilia2007,mukhopadhyay2020,binary_opinion}. To achieve our goal we propose equilibrium formulas for both the opinion diversity $\sigma$ and density of active links $\rho$, which is the proportion of connections that join opposite-minded users. The former is based on earlier results from \cite{masuda2015}. The latter uses a mean-field approximations and we show that it performs well when compared to numerical simulations. We then study the problems of maximising these quantities by turning \emph{free} (\emph{i.e.}\ non-zealous) users into zealots under the presence of a backfire effect. This effect we model by assuming that any increase in the number of zealots entails the \emph{radicalisation} of some non-zealous users, turning them into zealots with the opposite opinion. We provide exact solutions in the specific case of a complete, unweighted network for both the problems of $\sigma$ and maximising $\rho$. For $\sigma$ we also propose a method to optimise it in general networks. Finally we apply our findings on a real-life dataset. Namely, we study the evolution of the composition of the US House of Representatives since 1947. We assimilate it to a realisation of the voter model and estimate the corresponding quantity of zealots based on empirical values of the equilibrium metrics $\sigma$ and $\rho$. We then solve our maximisation problems in this case and find that maximising $\rho$ by acting on Democrat zealots can help increase both $\rho$ and $\sigma$. All code used is available online\footnote{\url{https://github.com/antoinevendeville/howopinionscrystallise}}. \section{Related Literature} Perhaps the earliest milestone in the study of opinion dynamics are the works from \cite{french} and \cite{degroot} who studied how a society of individuals may or may not come to an agreement on some given topic. Assuming the society is connected and people repeatedly update their belief by taking weighted averages of those of their neighbours, they showed that consensus is reached. That is, everyone eventually agrees. Various other models have been developed since, to tackle the question of under which circumstances and how fast a population is able to reach consensus. Amongst others, \cite{friedkin_johnsen} introduce immutable innate preferences, \cite{axelrod} studies the effect of homophily, \cite{word_of_mouth} assume individuals are perfectly rational and \cite{nbsl} account for the influence of external events. The voter model was introduced independently by \cite{clifford_sudbury} and \cite{holley1975} in the context of particles interaction. They proved that consensus is reached on the infinite $\mathbb{Z}^d$ lattice. Several works have since looked at different network topologies, wondering whether consensus is reached, on which opinion and at what speed. Complete graphs \citep{yehuda2002,sood2008,perron2009,yildiz2010}, Erdös-Rényi random graphs \citep{sood2008,yildiz2010}, scale-free random graphs \citep{sood2008,fernley2019}, and other various structures \citep{sood2008,yildiz2010} have been addressed. Variants where nodes deterministically update to the most common opinion amongst their neighbours have also been studied \citep{chen2005,mossel2013}. An interesting case to consider is the one where zealots -- \emph{i.e.}\ stubborn agents who always keep the same opinion, are present in the graph. Such agents may for example represent lobbyists, politicians or activists, \emph{i.e.}\ entities looking to lead rather than follow and who will not easily change side. One of those placed within the network can singlehandedly change the outcome of the process \citep{mobilia2003,sood2008}. If several of them are present on both sides, consensus is usually not reachable and instead opinions converge to a steady-state in which they fluctuate indefinitely \citep{mobilia2007,binary_opinion}. Recently, \cite{mukhopadhyay2020} considered zealots with different degrees of zealotry and proved that time to reach consensus grows linearly with their number. They also showed that if one opinion is initially preferred --- \emph{i.e.}\ agents holding that opinion have a lesser probability of changing their mind --- consensus is reached on the preferred opinion with a probability that converges to 1 as the network size increases. \cite{klamser2017} studied the impact of zealots on a dynamically evolving graph, and showed that the two main factors shaping their influence are their degrees and the dynamical rewiring probabilities. With the increasing importance of social networks in the political debate and information diffusion, there has been a recent surge in research aiming at controlling opinions, often with the goal to reduce polarisation. With the Friedkin-Johnsen model, \cite{goyal2019} provide algorithms for selecting an optimal sets of stubborn nodes in order to push opinions in a chosen direction. \cite{yi2019disagreement} formulate different constrained optimisation problems under the French-Degroot and the Friedkin-Johnsen models. They provide solutions in the form of optimal graph construction methods. Still within the Friedkin-Johnsen paradigm, \cite{chitra2020} prove that dynamically nudging edge weights in the user graph can reduce polarisation while preserving relevance of the content shown by the recommendation algorithm. \cite{garimella2017bis} propose a method to reduce polarisation through addition of edges in the network. The focus is put on which nodes to connect in order to get the best reduction in polarisation, while being sure that the edge is ``accepted'' --- as extreme recommendations might not work because of the backfire effect. Finally, \cite{cen2020} propose a data-driven procedure to moderate the gap between opinions influenced by a neutral or a personalised newsfeed. Importantly, they show that this can be done even without knowledge of the process through which opinions are derived from the newsfeed. Of particular interest to us, \citep{binary_opinion,masuda2015,moreno2021} study the voter model and propose strategies to find optimal sets of zealots in order to push opinions in a chosen direction. This work places itself in a similar vein but the objective is different, as we are trying to adjust the balance between both opinions rather than promoting one of the two. \paragraph{Our contribution} In a previous work \citep{vendeville2022} we studied the voter model with zealots in connected graphs with arbitrary degree distribution. Extending a result from the literature, we proved that the expected average opinion $\bar{x}^*$ of the population at equilibrium is given by the proportion of opinion 1 amongst zealots. Furthermore we solved the problem of controlling $\bar{x}^*$ via injection of zealots in the presence of a backfire effect. In the present paper, we turn ourselves to the case where the network is weighted, directed and not necessarily connected. The vector $x^*$ of individual average opinions at equilibrium is then given by the solution of a linear system \cite[eq.~(4)]{masuda2015}. We adapt the problem of controlling $\bar{x}^*$ under backfire effect to that of controlling diversity, that we define as a function of $\bar{x}^*$. We show that it can be solved efficiently by gradient descent. This approach however does not guarantee the existence of a dialogue between users, as even with $\bar{x}^*\approx 1/2$ the network might clusterise into hermetic echo chambers with opposite opinions. Thus we suggest a novel, alternative approach for the diversification of opinion in social networks. Instead of controlling the average opinion, we propose to control the density of active links -- \emph{i.e.}\ the proportion of edges that connect users with different opinions. With the profusion of theoretical works and models on opinion dynamics in recent years, the need for real data validation has got more and more pressing. An attempt to fit the voter model with election results in the UK and in the US was the object of a previous publication from us \citep{vendeville2020}. In the present paper we illustrate our findings as we apply the developed methods to the evolving network of the House of Representatives in the United States. With the gradual disappearance of independent members and the fading of cross-party agreement, it has become a prime example of a polarised network divided in two antagonistic camps \citep{andris2015}. We find that the network exhibits high levels of opinion diversity but lower levels of active links density. In this context we solve the optimisation problems developed in the theoretical sections, providing optimal numbers of zealots that maximise either $\sigma$ or $\rho$. We find that both can be increased in some cases. \section{The Voter Model with Zealots} \label{voter_model} In the traditional voter model, users are placed on the $\mathbb{Z}^d$ lattice and hold individual opinions in $\{0,1\}$. Given an initial distribution of opinion, each user updates their opinion at the times of an independent Poisson process of parameter 1 by copying a neighbour chosen uniformly at random. Letting $x_i(t)$ denote the opinion of user $i$ at time $t$, we say that consensus is reached if almost surely all users eventually agree, \emph{i.e.}\ if \begin{equation} \label{consensus} \forall i,j, \quad \mathbb{P} \left(x_i(t) = x_j(t) \right) \underset{t \rightarrow \infty}{\longrightarrow} 1. \end{equation} On any finite connected network, consensus is reached \citep{aldous_fill_2014}. Intuitively, no matter the current number of opinion-0 and opinion-1 users, there exists a succession of individual opinion changes with strictly positive probability that results in everyone holding the same opinion. It is might however seem unrealistic to imagine that all people in a group are willing to change opinions. An interesting extension of the traditional voter model is to include stubborn agents who never change their opinions, often referred to as \emph{zealots} \citep{mobilia2007,binary_opinion}. They form an inflexible core of partisans who bear great power of persuasion over the population. If all zealots defend the same opinion then via similar arguments as for eq.~(\ref{consensus}) this opinion is eventually adopted by all. When both camps count such agents within their ranks however, there always exists a strictly positive number of users with each opinion. This prevents consensus and instead the system reaches state of equilibrium in which it fluctuates indefinitely. \paragraph{Framework} Although we will consider a complete and unweighted user graph in our application, most of the analysis is presented in the general case of a directed, weighted network. We assume there are $N$ users among which $z$ are zealots. The remaining $F:=N-z$ users are referred to as \emph{free}. The set of free users is denoted by $\mathcal{F}$, the set of zealots with opinion 0 by $\mathcal{Z}_0$, the set of zealots with opinion 1 by $\mathcal{Z}_1$ and the set of all zealots by $\mathcal{Z}:=\mathcal{Z}_0\cup\mathcal{Z}_1$. For any pair $(i,j)$ of users we let $w_{ij}\ge 0$ be the weight of the directed edge $j\rightarrow i$, representing the power of influence that $j$ has over $i$. If $i\in\mathcal{Z}$ we set $w_{ij}=0$ for all $j$. We do not assume uniform choice anymore and when updating their opinion, $i$ will copy $j$ with probability proportional to $w_{ij}$. We assume $w_{ii}$ to be zero, meaning users cannot choose to copy themselves -- this assumption may be relaxed in the future and we expect the results presented here to hold. Opinions thus evolve as follows. Assume $i\in\mathcal{F}$ updates their opinion at time $t$ when the vector of opinions is $x(t)$. Then $i$ will adopt opinion 1 with probability $d_i^{-1}\sum_{j=1}^N w_{ij}x_j(t)$ where $d_i$ is the total influence exerted on them, defined by $d_i = \sum_{j=1}^N w_{ij}$. This quantity can be seen as the in-degree of node $i$. Zealots do not update their opinions and receive no external influence, thus they have in-degree 0. Finally we let $z_0$ and $z_1$ be the $F$-dimensional vectors of zealot influence over free users, where $z_{0,i}=\sum_{j\in\mathcal{Z}_0} w_{ij}$ is the total influence exerted by all zealots with opinion 0 onto user $i\in\mathcal{F}$. The definition of $z_1$ is analog. The in-degree of a free node $i$ can then be written as $d_i = \sum_{j\in\mathcal{F}} w_{ij} +z_{0,i} +z_{1,i}$. \section{Control of Opinion Diversity} \label{opinion_diversity_section} We define the average diversity of opinion at equilibrium by \begin{equation} \sigma = 4\bar{x}^*(1-\bar{x}^*) \end{equation} where $\bar{x}^*$ is the average opinion over all users at equilibrium, \emph{i.e.}\ the expected result when punctually observing the opinion of a random node. It is also the average share of opinion 1 within the network and often referred to as \emph{magnetisation} in the literature. $\sigma$ is the variance of the Bernoulli distribution of parameter $\bar{x}^*$, scaled by 4 so that it ranges in $[0,1]$. It describes the diversity of the system in that it is maximal when users are equally divided between both opinions ($\bar{x}^*=1/2$), and minimal when only one opinion is represented ($\bar{x}^*=0$ or $1$). \subsection{Maximisation in General Networks} Let $L=(L_{ij})_{i,j\in\mathcal{F}}$ be the Laplacian of the \emph{free} graph, \emph{i.e.}\ the $F\times F$ matrix with elements $L_{ij} = \delta_{ij}\sum_{k\in\mathcal{F}} w_{ik} - (1-\delta_{ij}) w_{ij}$ where $\delta_{ij}$ is the Kronecker delta. \cite{masuda2015} showed that the average opinion amongst free users is: \begin{equation} \bar{x}^*_f=\frac{1}{F}\mathbf{1}^\top[L + \text{diag}(z_0+z_1)]^{-1}z_1, \end{equation} where $\mathbf{1}$ is the $N$-dimensional vector filled with ones. The $i^{\text{th}}$ entry of the vector $x_f^*:=[L + \text{diag}(z_0+z_1)]^{-1}z_1$ is the average opinion of $i$ at equilibrium, given by \begin{equation} \label{xfi} x_{f,i}^* = \frac{\sum_{j\in\mathcal{F}}w_{ij}x_{f,j}^*+z_{1,i}}{d_i}. \end{equation} Finally we have \begin{equation} \bar{x}^* = \frac{F \bar{x}^*_f + \vert\mathcal{Z}_1\vert}{N}. \end{equation} Now consider a network where the set $\mathcal{Z}_0$ of 0-zealots and their influence vector $z_0$ is fixed. Given a predetermined quantity $\mathcal{Z}_1$ of 1-zealots, how should we set the values of $z_1$ to maximise the opinion diversity at equilibrium? Formally, we seek to solve \begin{align} \label{P} \underset{z_1\ge0}{\text{argmax}} \quad &\sigma. \tag{P} \end{align} Recall that the objective is function of $\bar{x}^*$ which is itself function of $z_1$. Because $\bar{x}^*$ is increasing with $\Vert z_1\Vert$ and equals zero when $\Vert z_1\Vert=0$, there exists at least one optimal vector $z_1^\star$ for which $\bar{x}^*=1/2$ and thus (\ref{P1}) is solved. This optimal vector can be found efficiently using gradient ascent on $\sigma$, as \cite{moreno2021} show that $\bar{x}^*_f$ (and thus $\bar{x}^*$) is concave with respect to $z_1$. \subsection{Maximisation in Complete Networks} In our application, we will consider a complete, unweighted network: $w_{ij}=\mathds{1}_{i\notin\mathcal{Z}}$ for all $i$. In that case all entries of $z_0$ are equal to the same value, which is the amount of 0-zealots nodes within the graph. For the sake of simplicity we denote this unique value by $z_0$. We proceed similarly for $z_1$. In that case it is known \citep{mobilia2007,masuda2015} that \begin{equation} \label{xbars_complete} \bar{x}^* = \bar{x}^*_f = x_{f,1}^* = \ldots = x_{f,{F}}^* = \frac{z_1}{z_0+z_1}. \end{equation} In a previous work \citep{vendeville2022} we proved that this result also holds on expectation for any connected, unweighted graph where the position of zealots is drawn uniformly at random. Hence the following. \begin{theorem} \label{rho_complete} In a complete unweighted user graph with $z_0$ zealots with opinion 0 and $z_1$ zealots with opinion 1, \begin{equation} \sigma = \frac{4z_0z_1}{(z_0+z_1)^2}. \end{equation} This quantity is trivially maximal when $z_0=z_1$. \end{theorem} In the same paper we studied the following problem: given a quantity $z_0$ of 0-zealots and a target diversity $\lambda$, what is the optimal number $z_1^\star$ of free users that should be turned into 1-zealots in order for $\bar{x}^*$ to be as close to $\lambda$ as possible? This is a generalisation of the diversity maximisation problem presented above which corresponds to the specific case $\lambda=1/2$. Numerous empirical studies have found that rather incentivising a change in opinion, presenting certain people with opposing views might actually entrench them even deeper in their beliefs. This is often referred to as the \emph{backfire effect}. To account for this phenomenon, we assumed that the creation of $z_1$ zealots with opinion 1 will \emph{radicalise} a quantity $\alpha z_1$ of free users, who will then become 0-zealots. Thus necessarily $z_0+(1+\alpha)z_1\le N$ and the constraint $z_1\le(N-z_0)/(1+\alpha)$. The real parameter $\alpha \in [0,1)$ quantifies the intensity of the backfire effect. We quickly summarise our findings as they will be useful to us. We also take this opportunity to correct a small mistake that was found in the paper. \begin{theorem} Assume there are $z_0$ zealots with opinion 0 into the system, and there exists a backfire effect of intensity $\alpha$. Set $z_1^{\textnormal{max}}:=(N-z_0)/(1+\alpha)$. After turning $z_1$ free users into zealots with opinion 1, $z_0$ is updated to $z_0+\alpha z_1$ and the average equilibrium opinion is \begin{equation} \label{xbars_complete_formula} \bar{x}^* = \frac{z_1}{z_0+(1+\alpha)z_1}. \end{equation} The solution to the problem \begin{align} \label{P1} \underset{0\le z_1\le z_1^\textnormal{max}}{\textnormal{argmin}} \quad &(\bar{x}^*-\lambda)^2 \tag{P1} \end{align} is given by \begin{equation} \label{optim_backfire} \begin{cases} z_1^\star = \textnormal{min} \left(z_1^{\textnormal{max}}, \lambda z_0d^{-1} \right) &\text{ if } d>0,\\ z_1^\star = z_1^{\textnormal{max}} &\text{ if } d\leq0, \end{cases} \end{equation} where $d:=1-\lambda-\alpha \lambda$. Discarding the constraint $z_1\le z_1^\textnormal{max}$ results in an unbounded problem if $d\le 0$ and $z_1^\star=\lambda z_0d^{-1}$ if $d>0$. \end{theorem} In our previous work we had mistakenly claimed that $z_0$ was updated to $z_0+\alpha z_0z_1$, leading to $\bar{x}^*=z_1/(z_1+(1+\alpha z_1)z_0)$ and $d=1-\lambda-\alpha \lambda z_0$. All results presented then do still hold qualitatively. Finally note that in general $z_1^\star$ will not be an integer so that in practical cases it would need to be rounded. In the present context we restrict ourselves to $\lambda=1/2$. The objective function $(\bar{x}^*-1/2)^2$ is equal to $\frac{1}{4}-\sigma$ and the condition $d>0$ becomes $\alpha<1$ which is true by definition. Hence the following theorem. \begin{theorem} The problem of maximising diversity in a complete unweighted graph with $z_0$ 0-zealots and backfire effect $\alpha$ is formally written as \begin{equation}\label{P2}\tag{P2} \begin{aligned} \underset{0\le z_1\le z_1^\textnormal{max}}{\textnormal{argmax}} \quad &\sigma_{z_0,\alpha}(z_1) \\ \textnormal{s.t.} \quad &\sigma_{z_0,\alpha}(z_1) = \frac{4(z_0+\alpha z_1)z_1}{(z_0+(1+\alpha)z_1)^2} \end{aligned} \end{equation} where $z_1^{\textnormal{max}}=(N-z_0)/(1+\alpha)$. Its solution is given by \begin{equation} z_1^\star = \textnormal{min} \left(z_1^{\textnormal{max}}, \frac{z_0}{1-\alpha} \right). \end{equation} \end{theorem} \section{Density of Active Links at Equilibrium} \label{active_links_section} Because maximising diversity does not guarantee that the network will not clusterise into echo chambers, we are also interested in maximising the proportion of \emph{active links} at equilibrium. A link is said to be active if it joins two users with opposite opinions. We derive a mean-field approximation for this quantity that shows a tight fit with empirical averages obtained via numerical simulations. Let us first precise what we mean by \emph{active links} and their average density. We denote by $\mathcal{E}'$ the set of all edges present in the graph that join two users, one of them at least being free. We write $(i,j)$ to designate the edge $j\rightarrow i$ pointing outwards from $j$ and towards $i$. Because the graph is oriented, $(i,j)$ and $(j,i)$ are two separate objects and one might exist without the other. Moreover when both are present in the graph we do not necessarily have $w_{ij}=w_{ji}$. \begin{definition}[Active link] At any time $t$ the directed link $(i,j)\in\mathcal{E}'$ is said to be \emph{active} if $x_i(t)\neq x_j(t)$, and inactive otherwise. \end{definition} \begin{definition}[Average density of active links] Let $q_{ij}$ be the equilibrium probability of the event $\{x_i\neq x_j\}$. We define the average density of active links at equilibrium by \begin{equation} \label{rho_def} \rho = \frac{1}{\vert\mathcal{E}'\vert} \sum_{(i,j)\in\mathcal{E}'} q_{ij} \end{equation} and its weighted version by \begin{equation} \label{rhow_def} \rho_w = \frac{\sum_{(i,j)\in\mathcal{E}'} w_{ij}q_{ij}}{\sum_{(i,j)\in\mathcal{E}'} w_{ij}}. \end{equation} \end{definition} In the weighted case, heavier edges count more towards the average and lighter ones count less. Note that $q$ is a non-oriented metric in that $q_{ij}=q_{ji}$. When $i$ and $j$ are both free users, $q_{ij}$ will be counted twice in the sum above if both $w_{ij}$ and $w_{ji}$ are positive, once if only one of them is and not counted at all if they are not connected with each other. Because zealots receive no influence from others, if $i$ is in $\mathcal{Z}$ then $w_{ij}=0$ and $q_{ij}$ is counted once if $w_{ji}>0$, not counted otherwise. If $j$ is a zealot as well then $q_{ij}$ is not counted in the sum. The following theorem is the main theoretical contribution of this paper. \begin{theorem} \label{rhoij_theorem} A mean-field approximation for the values $q_{ij}$ is given by the solution of the following linear system: \begin{align} \label{rhoij} q_{ij}(d_i+d_j) & -\sum_{k\in\mathcal{F}\backslash\{i,j\}} (w_{ik}q_{jk}+w_{jk}q_{ik}) = \tilde{z}_j x^*_i + \tilde{z}_i x^*_j + z_{1,i} + z_{1,j}, \end{align} where $(i,j)$ describes $\mathcal{E}'$, $\tilde{z}_k := z_{0,k}-z_{1,k}$, $d_k=\sum_{l=1}^N w_{kl}$ is the in-degree of node $k$, $x_k^*:=x_{f,k}^*$ for $k\in\mathcal{F}$, $x_k^*:=0$ for $k\in\mathcal{Z}_0$ and $x_k^*:=1$ for $k\in\mathcal{Z}_1$. \end{theorem} The proof can be found in \Cref{proof_section}. Consistent with intuition, if $j\in\mathcal{Z}_0$ (resp.\ $j\in\mathcal{Z}_1$) then the above yields $q_{ij}=\bar{x}^*_{f,i}$ (resp.\ $q_{ij}=1-\bar{x}^*_{f,i}$), which is simply the probability for $i$ to hold opinion 1 (resp.\ opinion 0). \subsection{Numerical Validation} We validate the above through a series of numerical simulations. Let us place ourselves in an Erdös-Rényi random graph with $N=100$ users, $\vert\mathcal{Z}_0\vert=23$ zealots with opinion 0 and $\vert\mathcal{Z}_1\vert=18$ zealots with opinion 1. The graph is directed and we set its density to $0.1$ so that about $10\%$ of all possible edges are present. Each edge is then attributed a weight generated uniformly at random between 0 and 1. We perform a single simulation of the voter model on this graph for 50,000 time units. The empirical density of active links $\hat\rho$ is computed every 100 updates, starting once 10,000 time units have passed to ensure that the system has had time to stabilise. In \Cref{rho_simu_vs_theo} \emph{(top left)} we plot $\hat\rho$ over the last 1,000 time units against $\rho$. Averaging $\hat\rho$ over time yields our final empirical estimate. We proceed similarly for $\rho_w$ \emph{(top right)} and do it all as well in a Barabasi-Albert graph with weights generated under an exponential distribution of parameter 1 \emph{(bottom left and right)}. This graph has density $\approx 0.1$ as well. In all cases the theoretical values $\rho$ and $\rho_w$ are roughly the same. Thus for the same density of edges, the topology of the graph does not seem to play an very important role here. We obtain rather small errors between theory and simulation, in the order of $10^{-4}$ for the Erdös-Rényi graph and $10^{-3}$ for the Barabasi-Albert graph. Other experiments with different quantities of zealots, weights distribution and graph topologies have shown similarly small errors as well, confirming that our mean-field approximation of $q$ performs well in practice. The error for the Barabasi-Albert network being higher is not too surprising, as the second graph is inherently less regular and the variance in the weights is higher (exponential distribution of parameter 1 against uniform distribution over $[0,1]$). This can also be seen in the oscillations of $\hat\rho$ and $\hat\rho_w$ over time, which demonstrate more variability by spanning a larger range in this case. \begin{figure}[t] \centering \begin{subfigure}[b]{.5\textwidth} \includegraphics[width=\textwidth]{ER_weightedFalse_plot} \end{subfigure}~ \begin{subfigure}[b]{.5\textwidth} \includegraphics[width=\textwidth]{ER_weightedTrue_plot} \end{subfigure}\\ \begin{subfigure}[b]{.5\textwidth} \includegraphics[width=\textwidth]{BA_weightedFalse_plot} \end{subfigure}~ \begin{subfigure}[b]{.5\textwidth} \includegraphics[width=\textwidth]{BA_weightedTrue_plot} \end{subfigure} \caption{Verifying \Cref{rhoij_theorem} in simulation. $N=100$ users, simulation time 50,000. Last 1,000 time units are plotted. \textbf{Top:} Erdös-Rényi graph with random uniform weights. \textbf{Bottom:} Barabasi-Albert graph with random exponential weights. \textbf{Left:} theoretical density of active links as per eq.~(\ref{rho_def}) (dotted red lines) and empirical value over time for a single simulation (blue oscillations). \textbf{Right:} same with weighted density of active links (\ref{rhow_def}). In each plot we also indicate the average over the whole simulation $(\hat\rho$ or $\hat\rho_w)$ as well as the theoretical value $(\rho$ or $\rho_w)$, both rounded to $10^{-4}$.} \label{rho_simu_vs_theo} \end{figure} \subsection{Maximisation in Complete Networks} Now consider a complete unweighted graph. Again we let $z_0$ denote the amount of 0-zealots and $z_1$ the amount of 1-zealots in the network. Becomes of the asymmetry between free users and zealots it is convenient to still assume edges to be directed. Then the following holds. \begin{theorem} \label{rho_complete} In a complete unweighted user graph with $z_0$ zealots with opinion 0 and $z_1$ zealots with opinion 1, \begin{equation} \label{rhoc_eq} \rho = \frac{2z_0z_1(N-z_0-z_1)}{(N-1)(z_0+z_1)(z_0+z_1+1)}. \end{equation} \end{theorem} The proof can be found in \Cref{proof_section}. Now we are interested in finding the optimal number $z_1^\star$ of free users that should be turned into 1-zealots in order to maximise $\rho$ (which is equal to $\rho_w$ as the graph is weighted). Because of the backfire effect $\alpha$, creating $z_1$ zealots with opinion 1 with entail a change in the number of 0-zealots, from $z_0$ to $z_0+\alpha z_1$. \begin{theorem} \label{optim_rho_complete_theo} The problem of maximising the density of active links in a complete unweighted graph with $z_0$ 0-zealots and backfire effect $\alpha$ is formally written as \begin{equation} \label{P3} \tag{P3} \begin{aligned} \underset{0\le z_1\lez_1^{\textnormal{max}}}{\textnormal{argmax}} \quad &\rho_{z_0,\alpha}(z_1) \\ \textnormal{s.t.} \quad &\rho_{z_0,\alpha}(z_1) = \frac{2(z_0+\alpha z_1)z_1}{(z_0+(1+\alpha)z_1)(z_0+(1+\alpha)z_1+1)} \end{aligned} \end{equation} where $z_1^{\textnormal{max}}=(N-z_0)/(1+\alpha)$. It has at least one solution which is either $z_1^{\textnormal{max}}$ or a real positive root of the derivative. \end{theorem} This results directly from the fact that the objective function is continue, one-dimensional, and that the optimum cannot be reached for $z_1=0$ as \begin{equation} \rho_{z_0,\alpha}(z_1) >0 = \rho_{z_0,\alpha}(0) \end{equation} for all $z_1>0$. \section{Application to US Congress Data} We evaluate our results on real-life data from American politics. The Voteview dataset \citep{voteview} contains very detailed information about the United States congress since its inception in 1789. Members of each Senate and House of Representatives are listed with their affiliations and what they voted in each rollcall. We discard voting data and simply focus on the composition of the House of Representatives since 1947. During this time, the proportion represented by Democrats and Republicans therein is always superior to 99.5\%, which justifies a binary approach such as the voter model. Let $D_k,R_k$ be the respective amounts of Democrat and Republican representatives in the House during the $k^\text{th}$ congress. In 1947 started the $80^\text{th}$ congress and in 2021 the $117^\text{th}$ one so that $k$ would range in $\{80,\ldots,117\}$. For the sake of simplicity however we shift the indices by 79 and let $k\in\{1,\ldots,38\}$. We discard members of other parties from our analysis---they never represent more that 0.5\% of the House. We find ourselves with two vectors $D,R$ of length $K=38$ and assume they correspond to punctual observations of a single realisation of the voter model with zealots on a complete, unweighted graph. Because members of the House change between congresses, users cannot represent \emph{persons} here. Rather, they represent \emph{seats} of the House, and their \emph{opinion} is the \emph{party} to which the representative occupying it is affiliated. In an effort for clarity and consistency we employ the traditional words of users and opinions, but it is important to keep in mind what they precisely mean here. In each congress there is a small number of non-voting delegates. They are included in our analysis but their exact number may vary so that the total number of seats $N_k$ is not always the same. In the congresses considered here, and with non-Democrat, non-Republican members discarded, $N_k$ varies between 438 (3 non-voting delegates) and 453 (18 non-voting delegates). \subsection{Parameters Estimation} The quantity of zealots on each side is unkown to us. They represent the quantity of seats that are ``locked'' by each party and we denote these by $z_D$ (Democrat zealots) and $z_R$ (Republican zealots). To infer their number, one could for example consider as zealots users who most often agree with others from their party. This would require however the choice of aheuristic threshold to define what counts as ``most''. Moreover, we do not have the vote of every member for each rollcall, entailing the addition of uncertainty and potential errors. Rather, we choose to infer $z_D$ and $z_R$ from the two equilibrium metrics presented in sections \ref{opinion_diversity_section} and \ref{active_links_section}: $\sigma$ and $\rho$. We propose the following estimate $\hat z=(\hat z_D, \hat z_R)$ for $(z_D,z_R)$: \begin{equation} \label{zhat} \tag{Q} \begin{aligned} \hat z = \underset{(z_D,z_R)\in Z}{\text{argmin}} \quad &\epsilon \\ \text{s.t.} \quad &\epsilon=\frac{\vert\hat\sigma-\sigma\vert + \vert\hat\rho-\rho\vert}{2}, \end{aligned} \end{equation} where $\hat\sigma$ is an empirical estimate of $\sigma$ and $\hat\rho$ is an empirical estimate of $\rho$. Thus $\hat z$ is a minimiser of the mean distance between theoretical and empirical values of our metrics. The set $Z:=\{1,\ldots,D_\text{min}\}\times\{1,\ldots,R_\text{min}\}$ constrains the number of zealots in each party to never be higher than the quantity of members this party has in the House. The empirical diversity of opinions is directly derived as \begin{equation} \hat\sigma := \frac{4}{K}\sum_{k=1}^K \frac{D_kR_k}{(D_k+R_k)^2} \end{equation} where $K=38$ is the total number of observations. The empirical estimation of $\rho$ is a bit trickier, as links are considered differently whether they join two free users, two zealots or a free user and a zealot. Hence we need be aware of what nodes are free and which ones are zealous. The empirical density of active links is given by \begin{equation} \hat\rho := \frac{1}{K}\sum_{k=1}^K \frac{2D_kR_k-D_kz_R-R_kz_D}{N_k(N_k-1)}. \end{equation} $N_k$ is the number of nodes in the $k^{th}$ observation, so that the denominator is the total number of links in the corresponding graph. The numerator of the fraction was simplified from \begin{equation} 2(D_k-z_D)(R_k-z_R)+(D_k-z_D)z_R+(R_k-z_R)z_D \end{equation} where the first term is the number of links between all free nodes, the second term the number of links between free Democrats and zealous Republicans, and the third term the number of links between free Republicans and zealous Democrats. The cardinal of $Z$ is small enough that (\ref{zhat}) can be solved by performing an exhaustive search over the whole set. We find: \begin{align*} (D_\text{min},R_\text{min}) &= (190,143), \\ (\hat z_D, \hat z_R) &= (89, 63), \\ (\hat\sigma,\hat\rho) &\simeq (0.97, 0.32), \\ \epsilon &\simeq 3.8\cdot 10^{-5}. \end{align*} The small error $\epsilon$ guarantees that the optimisation was efffective. The diversity is close to the theoretical optimal, indicating that the number of members from both parties is balanced over time. The majority switches back and forth between Democrats and Republicans but neither seem to truly have an upper hand over time. The density of active links is fairly high but could be better, as it pales in comparison to the values we obtained during simulations on synthetic networks (\Cref{rho_simu_vs_theo}). \subsection{Optimising Diversity and Activity} In this section, we investigate how $\sigma$ and $\rho$ could be optimised by changing the number of zealots. To this extent, we solve problems (\ref{P2}) and (\ref{P3}) for intensities of the backfire effect $\alpha$ spanning the whole range $[0,1)$. In a first time we consider that Democrats correspond to opinion 0, Republicans to opinion 1 and we optimise on $z_D$ keeping $z_R=\hat z_R$ fixed. Doing this we obtain a optimal number $z_D^\star$ of zealous Democrats when the number of zealous Republicans is given by the one inferred from the data. In a second time we do the opposite and optimise on $z_R$ keeping $z_D=\hat z_D$ fixed, obtaining a maximiser $z_R^\star$. The two plots on the left part of \Cref{data_optim} describe the solution of (\ref{P2}) function of $\alpha$. The upper plot contains the values of the maximiser $z_D^\star$, its upper-bound $z_D^\text{max}$ and the empirical number of zealots $\hat z_D$ inferred from the data. Similarly for the Republican party with $z_R^\star$, $z_R^\text{max}$ and $\hat z_R$. The bottom plot contains the optimal values $\sigma(z_D^\star)$ and $\sigma(z_R^\star)$ of the objective, when optimising respectively on $z_D$ and on $z_R$. Its empirical value inferred from data $\hat\sigma$ is also represented. In addition we also show $\rho(z_D^\star)$, $\rho(z_R^\star)$ and $\hat\rho$. This is to assess what effect optimising the diversity has on the active link density. We observe that for values of $\alpha$ up to about $0.7$, $\sigma$ can be fully optimised to its maximum value 1 whether we act on Democrat or Republican zealots. Even for the highest values of $\alpha$ it is very close to the empirical value. The impact of optimising $\sigma$ on $\rho$ is rather negative, as for almost all $\alpha$ the resulting density of active links is lower than its empirical value. Looking at the upper plot, we see that the maximisers are always above empirical values, meaning zealots would have to be added in order to improve diversity. Starting from $\alpha\simeq 0.6$ (Republicans) and $\alpha\simeq 0.7$ (Democrats), the maximiser is equal to its maximum possible value so that the system is saturated, with all nodes being zealots. We now turn ourselves to the problem of maximising the density of active links (\ref{P3}). Its solution is described by the two plots on the right part of \Cref{data_optim}. Unlike before, here the optimal number of zealots decreases with $\alpha$, is constantly lower than its empirical estimate and never approaches its upper bound. Morevoer this time, optimising $\rho$ can also entail an improvement on $\sigma$. This happens when the number of Democrat zealots is acted upon, and for $\alpha\le 0.5$ roughly. Finally, we remark that acting upon Democratic zealots is always more effective than upon Republican ones. This might stem from the fact that the former are in superior number from our empirical estimation, leaving more room to act efficiently on the objective functions. \begin{figure}[t] \centering \begin{subfigure}[b]{\textwidth} \includegraphics[width=\textwidth]{data_argoptim} \end{subfigure}\\ \vspace{.2cm} \begin{subfigure}[b]{\textwidth} \includegraphics[width=\textwidth]{data_optim} \end{subfigure} \caption{Optimal opinion diversity \textbf{(left)} and active links density \textbf{(right)} function of the backfire effect $\alpha$. \textbf{Top:} maximisers compared with empirical estimates and maximum possible values. \textbf{Bottom:} objective values and impact on the other metric, compared with empiriucal estimates.} \label{data_optim} \end{figure} \section{Proofs} \label{proof_section} \begin{proof}[Proof of \Cref{rhoij_theorem}.] Let $\lambda_{ij}$ be the average rate at which user $i$ adopts the same opinion as $j$ while in equilibrium. Remember that each user updates their opinion at the times of an exponential clock of parameter 1. There are four different events that lead to $i$ adopting $j$'s opinion, described below with the associated frequency rates. \begin{itemize} \item $i$ may copy $j$ directly, which happens at rate $d_i^{-1}w_{ij}$, or \item $i$ may copy a third free user $k$ holding the same opinion as $j$, which happens at rate $d_i^{-1}\sum_{k\in\mathcal{F}\backslash\{i,j\}} w_{ik}(1-q_{jk})$, or \item $i$ may copy a 1-zealot while $j$ has opinion 1, which happens at rate $d_i^{-1}z_{1,i}x^*_j$, \item $i$ may copy a 0-zealot while $j$ has opinion 0, which happens at rate $d_i^{-1}z_{0,i}(1-x^*_j)$. \end{itemize} By using $q_{jk}$ and $x^*_j$ we made the mean-field assumption that $i$ interacts with the average system at equilibrium rather than with its exact state. Through comparison with simulations we will show that this approximation performs well numerically. Putting it all together, \begin{align} \lambda_{ij} &= d_i^{-1} \left(w_{ij} + \sum_{k\in\mathcal{F}\backslash\{i,j\}} w_{ik}(1-q_{jk}) + z_{1,i}x^*_j + z_{0,i}(1-x^*_j)\right). \intertext{Via an analogous reasoning, at equilibrium $i$ adopts the opinion opposite of $j$'s with rate} \mu_{ij} &= d_i^{-1} \left(\sum_{k\in\mathcal{F}\backslash\{i,j\}} w_{ik}q_{jk} + z_{1,i}(1-x^*_j) + z_{0,i}x^*_j \right). \end{align} We obtain $\lambda_{ji}$ and $\mu_{ji}$ in a similar fashion. The discrete quantity $\mathds{1}_{x_i\neq x_j}$ describes a continuous-time Markov chain with two states 0 and 1, transitioning from 0 to 1 with rate $\mu_{ij}+\mu_{ji}$ and from 1 to 0 with rate $\lambda_{ij}+\lambda_{ji}$. The stationary probability of state 1 is exactly $q_{ij}$, so that \begin{equation} q_{ij} = \frac{\mu_{ij}+\mu_{ji}}{\lambda_{ij}+\mu_{ij}+\lambda_{ji}+\mu_{ji}}. \end{equation} After simplifications we obtain eq.~(\ref{rhoij}). \end{proof} \begin{proof}[Proof of \Cref{rho_complete}.] Let $(i,j)\in\mathcal{E}'$. First if $i\in\mathcal{F}$ is free and $j\in\mathcal{Z}_0$, then as discussed before eq.~(\ref{rhoij}) immediately yields $q_{ij}=\bar{x}^*$. If $j\in\mathcal{Z}_1$ then $q_{ij}=1-\bar{x}^*$ and in both cases, $q_{ji}=0$. Now assume $i,j\in\mathcal{F}$. Because all free nodes are topologically equivalent, they share the same value $q_f$ for $q$---just as they have the same average opinion $\bar{x}^*=z_1/(z_0+z_1)$, \emph{c.f.}\ (\ref{xbars_complete}). Replacing edge weights with 1, in-degrees with $N-1$ and zealots influence $z_{0,k},z_{1,k}$ with $z_0,z_1$, equation~(\ref{rhoij}) becomes \begin{equation} 2q_f(N-1)-(F-2)2q_f = 2(z_0-z_1)\bar{x}^* + 2z_1 \end{equation} and after simplifications \begin{equation} q_f = \frac{2z_0z_1}{(z_0+z_1)(z_0+z_1+1)}. \end{equation} Because there are $F(F-1)$ directed edges between zealots, $Fz_0$ edges between free users and 0-zealots and $Fz_1$ edges between free users and 1-zealots, the total \textbf{number} (and not density) of active links is given by \begin{align} n_{\text{active}} &= F(F-1)q_f + Fz_0\bar{x}^* + Fz_1(1-\bar{x}^*). \intertext{Replacing $F$ by $N-z_0-z_1$ and $q_f,\bar{x}^*$ by their respective values we find} n_{\text{active}} &= \frac{2z_0z_1N(N-z_0-z_1)}{(z_0+z_1)(z_0+z_1+1)}. \end{align} Finally there are $N(N-1)$ directed edges in the complete graph so that we immediately obtain (\ref{rhoc_eq}) via $\rho=n_{\text{active}}/(N(N-1))$. \end{proof \section{Conclusion and Future Work} \label{futurework} In this paper we analysed the voter model with zealots on directed, weighted networks. We proposed formulas for the opinion diversity ($\sigma$) as well as for the density of active links ($\rho$) at equilibrium. The latter relied on a mean-field approximation that we showed performs well against numerical simulations. For both metrics we studied the problem of maximising it by turning free (\emph{i.e.}\ non-zealous) users into zealots in the presence of a backfire effect. We provided explicit solutions for the specific case of a complete unweighted network, and for opinion diversity we also exposed how it could be maximised in the general directed, weighted case. As an example application, we applied our findings to a dataset detailing the evolution of members in the US House of Representatives since 1947. Assuming the data was a realisation of the voter model with zealots, we estimated the number of zealots by minimising the distance between empirical and theoretical values of the equilibrium metrics $\sigma$ and $\rho$. The opinion diversity was found to be almost maximal, indicating a balanced mix of Democrats and Republicans. We then used the optimisation problems exposed in the theoretical sections to find optimal quantities of zealots users maximising $\sigma$ and $\rho$. Of note, we found that maximising $\rho$ by acting on Democrat zealots can help increase both $\rho$ and $\sigma$. There are many open leads for further investigation. First, we considered multiple congresses at once. It could be interesting to subdivise in several windows, separated by impactful historical moments (fuel crisis in the seventies, end of the USSR in the early nineties, etc.). There might be patterns inherent to specific periods that are not apparent in our analysis. Data from online social networks could provide interesting examples of polarised systems. On the theoretical side, an efficient algorithm for the optimisation of $\rho$ on directed, weighted networks could help study more refined data. In the case of social media data, it could also be a good idea to optimise not on the number of zealots but on the edge weights. This would mean standing from the point of view of a platform administrator, trying to update its recommendation algorithm in order to improve opinion diversity or active links density. Such approaches have been tried in other models of opinion dynamics \citep{chitra2020,santos2021}. Finally because we are studying polarised systems, incorporating signed edges in the model could also yield more informative results \citep{keuchenius2021}. \justify{ \subsubsection*{Data Availability} The data used in the application is taken from \cite{voteview}. All code used and simulation data are available online at \url{https://github.com/antoinevendeville/howopinionscrystallise}.} \justify{ \subsubsection*{Acknowledgements} The authors have no competing interests to declare. This project was funded by the UK EPSRC grant EP/S022503/1 that supports the Centre for Doctoral Training in Cybersecurity delivered by UCL's Departments of Computer Science, Security and Crime Science, and Science, Technology, Engineering and Public Policy.} \bibliographystyle{abbrvnat
{'timestamp': '2022-03-07T02:02:59', 'yymm': '2203', 'arxiv_id': '2203.02002', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.02002'}
arxiv
\section{Introduction} \begin{figure}[t] \includegraphics[width=\columnwidth]{OptiTrap_teaser.png} \caption{While previously, shapes demonstrated on levitation displays were limited to simple shapes with almost constant curvature \cite{Fushimi19,Hirayama19,Plasencia20}, our approach allows to render generic complex paths. Shapes that have not been demonstrated before include sharp edges as with the heart (B) and dolphin (D), as well as significant changes of the curvature, as with the cat (A) and flower (C) (see Supplementary Video). Photos of the physical particle are made with an exposure time ranging from 0.2 to 1~s, such that each photo shows multiple periods of the orbit.} \label{fig:teaser} \Description{Four photos labelled A, B, C and D show different graphics generated with the levitation display. Image A shows an outline of a 2.4 centimetres wide cat, rendered at 5 Hertz. Image B shows an outline of a 5.4 centimetres wide heart, rendered at 10 Hertz. Image C shows an outline of a 5.6 centimetres wide three-petal flower, rendered at 10 Hertz. Image D shows an outline of a 4.7 centimetres wide dolphin, rendered at 3.3 Hertz. A human index finger is petting the dolphin. The volumetric dolphin graphics and the index finger are of similar size.} \end{figure} \begin{figure*}[!tb] \includegraphics[width=2\columnwidth]{OptiTrap_flowchart.png} \caption{\emph{OptiTrap} is an automated method to compute trap trajectories to reveal generic mid-air shapes on levitation displays. The method accepts a reference path (e.g., the shape of a heart) without any timing information as an input (A). Our approach considers the capabilities of the device and its trap-particle dynamics and combines these with a path following approach (B). The approach produces feasible trap trajectories, describing when and where the traps must be created (C). The resulting particle motion can be presented on the actual device, yielding feasible paths and supporting complex objects with sharp edges and/or significant changes of the curvature (D).} \label{fig:teaser_diagram} \Description{A flowchart with four elements sequentially connected with flow links. The starting state A is a reference path q of theta, which captures the positions of a reference shape of a heart. A flows to B, the OptiTrap algorithm, composed of the trap-particle dynamics and optimal path following components. The algorithm outputs a trap trajectory u of t, in state C, which contains both the trap positions and timings. An image shows that the trap trajectories do not overlap with the shape positions that were fed to the algorithm in state A. Finally, the ending state D is the particle motion. A photo of the rendered heart shape on the levitation display is shown above a stretched out hand, indicating that the shape is three dimensional and rendered in mid-air.} \end{figure*} Acoustic levitation has recently demonstrated the creation of volumetric content in mid-air by exploiting the Persistence of Vision (PoV) effect. This is achieved by using acoustic traps to rapidly move single~\cite{Hirayama19} or multiple~\cite{Plasencia20} particles along a periodic reference path, revealing a shape within $0.1s$ (i.e., the integration interval of human eyes~\cite{Bowen74}). However, the way to define such PoV content remains unsolved. That is, there are no automated approaches to compute the \emph{trap trajectories}, i.e., the positioning and timing of the acoustic traps that will allow us to reveal the desired shape. Currently, content creators can only rely on trial and error to find physically feasible trap trajectories resembling their intended target shapes, resulting in a time consuming and challenging process. For instance, the creator will need to define the timing of the path (i.e., not only \emph{where} the particle must be, but also \emph{when}). Such timing is not trivial and will affect the overall rendering time and the accelerations applied to the particle, which must be within the capabilities of the levitator. The way forces distribute around the acoustic trap will also need to be considered to decide where traps must be located. Considering these challenges is crucial to design feasible trap trajectories, as a single infeasible point along the trajectory typically results in the particle being ejected from the levitator (e.g., approaching a sharp corner too quickly). Thus, while it has been theorised that linear PoV paths of up to 4m and peak speeds of 17m/s are possible~\cite{FushimiLimits}, actual content demonstrated to date has been limited to simple shapes with almost constant curvature along the path and much lower speeds (e.g., 0.72m/s in~\cite{Ochiai14}; 1.2m/s in~\cite{Hirayama19}; 2.25m/s in \cite{Plasencia20}, combining six particles). In this paper, we present \emph{OptiTrap}, the first structured numerical approach to compute trap trajectories for acoustic levitation displays. \emph{OptiTrap} automates the definition of levitated PoV content, computing physically feasible and nearly time-optimal trap trajectories given only a reference path, i.e., the desired shape. As shown in Figure~\ref{fig:teaser}, this allows for larger and more complex shapes than previously demonstrated, as well as shapes featuring significant changes in curvature and/or sharp corners. Our approach is summarised in Figure~\ref{fig:teaser_diagram}. \emph{OptiTrap} assumes only a generic reference path $\textbf{q}(\theta)$ as an input, with no temporal information (see~Figure~\ref{fig:teaser_diagram}(A)). \emph{OptiTrap} formulates this as a path following problem (see~Figure~\ref{fig:teaser_diagram}(B)), computing the optimum timing in which a particle can traverse such path. Our formulation considers the \emph{Trap-Particle Dynamics} of the system, using a 3D model of acoustic forces around a trap. This results in a non-invertible model, which cannot exploit differential flatness~\cite{Fliess95a}, on which most path following approaches rely. We instead provide a coupling stage for the dynamics of our system and numerically invert the system. This approach produces a trap trajectory $\textbf{u}(t)$ (Figure~\ref{fig:teaser_diagram}(C)) that results in the intended and nearly time-optimal particle motion. That is, $\textbf{u}(t)$ defines the positions and timing of the traps that cause the particle to reveal the target shape $\textbf{q}(\theta)$, according to the capabilities of the actual device, cf.~Figure~\ref{fig:teaser_diagram}(D). In summary, we contribute the first structured numerical approach to compute physically feasible and nearly time-optimal trap trajectories for levitation displays, given only a reference path that the particle should follow. As a core contribution, we provide a theoretical formulation of the problem in terms of path following approaches, allowing optimum timing and device properties (e.g., trap-particle dynamics) to be jointly considered. All the details of the approach we propose are provided in Section~\ref{sec:opt}. We illustrate the potential of our approach by rendering shapes featuring straight lines, sharp corners, and complex shapes, such as those in Figure~\ref{fig:teaser}. We then provide an experimental validation of our approach, demonstrating increases of up to 563\% in the size of rendered objects, up to 150\% in the rendering frequency, and improvements in accuracy (e.g., shape revealed more accurately). While the baseline shapes we compare against require trial and error to determine optimal sizes or frequencies, our approach always yields feasible paths (i.e., working in at least 9 out of 10 attempts) and makes consistent use of accelerations very close to (but not exceeding) the maximum achievable by the device, independently of the target shape. These features allow \emph{OptiTrap} to render complex objects involving sharp edges and significant changes in curvature that have never been demonstrated before. Even more importantly, it provides a tool to systematically explore the range of contents that levitation displays can create, as a key step to exploit their potential. \section{Background and Challenges} \label{sec:prob_stat} \begin{figure*}[!tb] \includegraphics[width=2\columnwidth]{OptiTrap_sampling_strategy.png} \caption{ Three different path timings for the cardioid shape with fixed traversal time: (A) equidistant sampling of the arc length, (B) equidistant sampling of the path parameter~$\theta$, and (C) \emph{OptiTrap}. The corresponding acceleration magnitudes are depicted in (D). Strategy (A) is physically infeasible due to infinite required acceleration at the corner ($\theta=\pi$). Strategy (B) does not share this problem, but requires careful parametrization of the path, while \emph{OptiTrap} (C) yields the timing automatically.} \label{fig:timings} \Description{The figure consists of four subplots. The first three plots show a cardioid shape in two dimentional space. The x-axis denotes the horizontal spatial component from -4 to 4 centimetres and the y-axis the vertical from 8 to 16 centimetres, both at increments of two centimetres. Subplot D shows the acceleration magnitude resulting from the timing strategies from A to C, on a scale from 0 to 1000 metres per seconds squared as a function of the path parameter theta, going from 0 to two pi. The most notable difference in the timing strategies occurs at the sharp corner of the cardioid shape, where the equidistant arc length strategy results in infinite acceleration. } \end{figure*} Our goal is is to minimise complexity for content creators. Thus, given a reference path (i.e., a shape defined by the content creator), our approach must produce physically feasible trap trajectories, which accurately reveal the desired path, while making optimal use of the capabilities of the device. We formalise our content as a reference path $Q$, provided by the content creator without any preassigned time information. It is an explicitly parametrized curve \begin{equation} \label{eq:path} Q:=\{\xi \in \mathbb{R}^3 \mid \theta \in [\theta_{0},\theta_{f}] \mapsto \textbf{q}(\theta) \}, \end{equation} where $\textbf{q}\colon\mathbb{R} \rightarrow \mathbb{R}^3$, as later justified in Section~\ref{ssec:OPT}, must be a twice continuously differentiable function with respect to~$\theta$, which is called the path parameter. Increasing values of~$\theta$ denote forward movement along the path~$Q$. The starting point on the path is $\textbf{q}(\theta_0)$, while $\textbf{q}(\theta_f)$ marks the end of the path. For periodic paths, such as a particle cyclically revealing a PoV shape, $\textbf{q}(\theta_0) = \textbf{q}(\theta_f)$ and $\dot{\textbf{q}}(\theta_0) = \dot{\textbf{q}}(\theta_f)$ hold. Please note that while splines would provide a generic solution to this parametrization (i.e., twice continuously differentiable fitting the points in $Q$), any other parametric functions can be used. For example, taking $\theta\in[0, 2\pi]$ and $r>0$, a cardioid as in Figure~\ref{fig:timings}, can be described by: \begin{equation}\label{eq:cardioid} \textbf{q}(\theta)=(0, r\sin(\theta)(1+\cos(\theta)), -r\cos(\theta)(1+\cos(\theta))+r)^\top. \end{equation} Whatever the approach used, revealing such reference paths typically involves rapid particle movements, as PoV content must be revealed within about $0.1s$~\cite{Bowen74}) and must consider the feasibility of the path (i.e., the trap-particle dynamics, the topology of the trap, and the capabilities of the levitator). This results in the following two main challenges for \emph{OptiTrap}: 1) determining the optimal timing for the particle revealing the path; and 2) computing the trap positions generating the required forces on the particle. \subsection{Challenge 1: Determining an Optimal Path Timing} The reference path $Q$ defines the geometry but not the timing (i.e., it describes \emph{where} the particle needs to be, but not \emph{when} it needs to be there). Our approach must compute such a timing, and the strategy followed will have important implications on the velocity and accelerations applied to the particle and, hence, on the physical feasibility of the content. Different timing strategies and their effects on the feasibility can be illustrated using the cardioid example from~\eqref{eq:cardioid}. Figure~\ref{fig:timings} depicts various timing strategies applied to this shape, all of them traversing the same path in the same overall time. A straight-forward approach would be to sample equidistantly along the path, as shown in Figure~\ref{fig:timings}(A). This works well for lines and circles, where a constant speed can be maintained, but fails at sudden changes in curvature due to uncontrolled accelerations (see the acceleration at the corner of cardioid in Figure~\ref{fig:timings}(D), at $\theta=\pi$). The second example in Figure~\ref{fig:timings}(B) shows a simple equidistant sampling on the path parameter $\theta$. As shown in Figure~\ref{fig:timings}(D), this results in areas of strong curvature naturally involving low accelerations, and can work particularly well for low-frequency path parametrizations in terms of sinusoidals (e.g., \cite{FushimiLimits} showed such sinusoidal timing along straight paths, to theorise optimum/optimistic content sizes). In any case, the quality of the result obtained by this approach will vary depending on the specific shape and parametrization used. As an alternative, the third example shows the timing produced by our approach, based on the shape and capabilities of the device (i.e., forces it can produce in each direction). Please note how this timing reduces the maximum accelerations required (i.e., retains them below the limits of the device), by allowing the particle to travel faster in parts that were unnecessarily slow (e.g., Figure~\ref{fig:timings}(D), at $\theta=\pi$). For the same maximum accelerations (i.e., the same device), this timing strategy could produce larger shapes or render them in shorter times, for better refresh rates. This illustrates the impact of a careful timing strategy when revealing any given reference path. We address this challenge in Section~\ref{ssec:OPT}. \subsection{Challenge 2: Computation of Trap Positions} In addition to the timing, the approach must also compute the location of the traps. Previous approaches \cite{Hirayama19, Plasencia20, FushimiLimits} placed the traps along the shape to be presented, under the implied assumption that the particle would remain in the centre of such trap. However, the location where the traps must be created almost never matches the location of the particle. Acoustic traps feature (almost) null forces at the centre of the trap and high restorative forces around them \cite{Marzo15}. As such, the only way a trap can accelerate a particle is by having it placed at a distance from the centre of the trap. Such trap-particle distances were measured by \cite{Hirayama19} to assess performance achieved during their speed tests. Distortions related to rendering fast moving PoV shapes were also shown in \cite{Fushimi19}. However, none of them considered or corrected for such displacements. Please note the specific displacement between the trap and the particle will depend on several factors, such as the particle acceleration required at each point along the shape, as well as the trap topology (i.e., how forces distribute around it). No assumptions can be made that the traps will remain constrained to positions along or tangential to the target shape. We describe how our approach solves this challenge in Section~\ref{ssec:extract-trap-trajectory}. \section{Related Work} \emph{OptiTrap} addresses the challenges above by drawing from advances in the fields of acoustic levitation and control theory, which we review in this section. \subsection{Acoustic Levitation} Single frequency sound-waves were first observed to trap dust particles in the lobes of a standing wave more than 150 years ago~\cite{Stevens1899}. This has been used to create mid-air displays with particles acting as 3D voxels~\cite{Ochiai14,Omirou15,Omirou16, Sahoo16}, but such standing waves do not allow control of individual particles. Other approaches have included Bessel beams~\cite{Norasikin19}, self-bending beams~\cite{Norasikin18}, boundary holograms~\cite{Inoue19} or near-field levitation~\cite{NearFieldLevitation}. However, most display approaches have relied on the generic levitation framework proposed by~\cite{Marzo15}, combining a focus pattern and a levitation signature. Although several trap topologies (i.e., twin traps, vortex traps or bottle beams) and layouts (i.e., one-sided, two-sided, v-shape) are possible, most displays proposed have adopted a top-bottom levitation setup and twin traps, as these result in highest vertical trapping forces. This has allowed individually controllable particles/voxels~\cite{Marzo19} or even particles attached to other props and projection surfaces for richer types of content~\cite{Morales19, FenderArticulev}. The use of single~\cite{Fushimi19,Hirayama19} or multiple~\cite{Plasencia20} fast moving particles have allowed for dynamic and free-form volumetric content, but is still limited to small sizes and simple vector graphics~\cite{FushimiLimits}. Several practical aspects have been explored around such displays, such as selection~\cite{Freeman18} and manipulation techniques~\cite{Bachynskyi18}, content detection and initialisation~\cite{FenderArticulev} or collision avoidance~\cite{Reynal20}. However, no efforts have been made towards optimising content considering the capabilities (i.e., the dynamics) of such displays, particularly for challenging content such as the one created by PoV high-speed particles. \cite{Hirayama19} showed sound-fields must be updated at very high rates for the trap-particle system to engage in high accelerations, identifying optimum control for rates above 10kHz. However, they only provided a few guidelines (e.g., maximum speed in corners, maximum horizontal/vertical accelerations) to guide the definition of the PoV content. \cite{FushimiLimits} provided a theoretical exploration of this topic, looking at maximum achievable speeds and content sizes, according to the particle sizes and sound frequency used. While the dynamics of the system were considered, these were extremely simplified, using a model of acoustic trap forces and system dynamics that are only applicable for oscillating recti-linear trajectories along the vertical axis of the levitator. \cite{Paneva20} proposed a generic system simulating the dynamics of a top-bottom levitation system. This operates as a forward model simulating the behaviour of the particle given a specific path for the traps, but unlike our approach it does not address the inverse problem. Thus, \emph{OptiTrap} is the first algorithm allowing the definition of PoV content of generic shapes, starting only from a geometric definition (i.e., shape to present, no timing information) and optimising it according to the capabilities of the device and the dynamics of the trap-particle system. \subsection{Path Following and Optimal Control} \label{sec:PFopt} The particle in the trap constitutes a dynamical system, which can be controlled by setting the location of the trap. As such, making the particle traverse the reference path can be seen as an optimal control problem (OCP). In the context of computer graphics, optimal control approaches have been studied particularly in the areas of physics-based character animation~\cite{geijtenbeek12animation} and aerial videography~\cite{nageli2017real}. Such OCPs can be considered as function-space variants of nonlinear programs, whereby nonlinear dynamics are considered as equality constraints. In engineering applications, OCPs are frequently solved via direct discretization~\cite{Stryk93,Bock84}, which leads to finite-dimensional nonlinear programs. In physics-based character animation, such direct solution methods are known as spacetime constraints~\cite{witkin88spacetime, rose96spacetime}. If framed as \emph{a levitated particle along a given geometric reference path (i.e., the PoV shape)}, the problem can be seen as an instance of a path following problem~\cite{Faulwasser12}. Such problems also occur in aerial videography, when a drone is to fly along a reference path~\cite{nageli2017real, roberts16generating}. In order to yield a physically feasible trajectory, it is necessary to adjust the timing along that trajectory. This can be done by computing feed-forward input signals~\cite{Faulwasser12, roberts16generating} or, if the system dynamics and computational resources allow, using closed-loop solutions, such as Model Predictive Control in~\cite{nageli2017real}. However, optimal control of acoustically levitated particles cannot be approached using such techniques. All of the above approaches require {\em differential flatness}~\cite{Fliess95a}. That is, the underlying system dynamics must be invertible, allowing for the problem to be solved by projecting the dynamics of the moving object onto the path manifold~\cite{Nielsen08a}. This inversion approach also enables formulating general path following problems in the language of optimal control, encoding desired objectives (e.g., minimum time, see~\cite{Shin85a, Verscheure09b, ifat:faulwasser14b}). As discussed later in Section~\ref{ssec:model-acoustic-forces}, the distribution of forces around the acoustic trap (i.e., our system dynamics) are not invertible, requiring approaches that have not been widely developed in the literature. We do this by coupling the non-invertible particle dynamics into a virtual system, solvable with a conventional path following approach. We then use these coupling parameters and our model of particle dynamics to solve for the location of the traps. \section{Optimal Control for Levitation Displays}\label{sec:opt} This section provides a description of our \emph{OptiTrap} approach, which automates the definition of levitated content, computing physically feasible and nearly time-optimal trap trajectories using only a reference path as an input. In Section~\ref{ssec:model-acoustic-forces}, we first describe our specific hardware setup and the general mathematical framework, then we consider existing models of the trap-particle dynamics (Subsection~\ref{sssec:exsting-models}), before introducing our proposed model (Subsection~\ref{sssec:our-model}). Next, we describe the two stages in our algorithm, which match the challenges identified in Section~\ref{sec:prob_stat}. That is, Section~\ref{ssec:OPT} describes the computation of optimum timing, approached as an optimal path following problem, while Section~\ref{ssec:extract-trap-trajectory} explains how to compute the trap locations. Please note that Section~\ref{sec:opt} focuses on the general case of presenting levitated content, that is, particles cyclically traversing a reference path (shape) as to reveal it. Other cases, such as a particle accelerating from rest as to reach the initial state (i.e., initial position and speed) required to render the content can be easily derived from the general case presented here, and are detailed in the Supplementary Material S1. \begin{figure}[b] \includegraphics[width=\columnwidth]{OptiTrap_setup.png} \caption{Overview of the components in our setup. We used two opposed arrays of transducers at a distance of 23.9 cm and an OptiTrack system to track the position of levitated particles in real time. } \label{fig:setup} \Description{A photo of equipment. Two square array boards of transducers with dimension 16.8 centimetres are aligned to exactly face each other at a vertical distance of 23.9 centimetres. Two optical motion cameras mounted on the side, are faced towards the volume between the boards.} \end{figure} \subsection{Modelling the Trap-Particle Dynamics}\label{ssec:model-acoustic-forces} We start by describing the model of the trap-particle dynamics used for our specific setup, shown in Figure \ref{fig:setup}. This setup uses two opposed arrays of 16×16 transducers controlled by an FPGA and an OptiTrack tracking system (Prime 13 motion capture system at a frequency of 240Hz). The design of the arrays is a reproduction of the setup in~\cite{Morales21}, modified to operate at 20Vpp and higher update rates of 10kHz. The device generates a single twin-trap using the method described in \cite{Hirayama19}, allowing for vertical and horizontal forces of $4.2\cdot10^{-5}$N and $2.1\cdot10^{-5}$N, respectively, experimentally computed using the linear speed tests in \cite{Hirayama19} (i.e., 10cm paths, binary search with 9 out 10 success ratios, with particle mass $m\approx 0.7\cdot10^{-7}$ kg). Note the substantial difference between the maximum forces in the vertical and horizontal directions. Our approach will need to remain aware of direction as this determines maximum accelerations. In general, the trap-particle dynamics of such system can be described by simple Newtonian mechanics, i.e., \begin{equation}\label{eq:system} m\ddot{\textbf{p}}(t) = F(\textbf{p}(t),\dot{\textbf{p}}(t),\textbf{u}(t)). \end{equation} Here, $\textbf{p}(t)=(p_x, p_y, p_z)^\top \in \mathbb{R}^3$ represents the particle position in Cartesian $(x,y,z)$ coordinates at time $t\in\mathbb{R}_0^+$, and $\dot{\textbf{p}}(t)$ and $\ddot{\textbf{p}}(t)$ are the velocity and acceleration of the particle, respectively. The force acting on the particle is mostly driven by the acoustic radiation forces and, as such, drag and gravitational forces can be neglected \cite{Hirayama19}. Therefore, the net force acting on the particle will depend only on $\textbf{p}(t)$ and on the position of the acoustic trap at time $t$ denoted by $\textbf{u}(t)=(u_x(t),u_y(t),u_z(t))^\top\in\mathbb{R}^3$. As a result, our approach requires an accurate and ideally invertible model of the acoustic forces delivered by an acoustic trap. That is, we seek an accurate model predicting forces at any point around a trap only in terms of $\textbf{u}(t)$ and $\textbf{p}(t)$. Moreover, an invertible model would allow us to analytically determine where to place the trap as to produce a specific force on the particle given the particle location. For spherical particles considerably smaller than the acoustic wavelength and operating in the far-field regime, such as those used by our device, the acoustic forces exerted can be modelled by the gradient of the Gor'kov potential~\cite{Bruus2012}. This is a generic model, suitable to model acoustic forces resulting from any combination of transducer locations and transducer activations, but it also depends on all these parameters, making it inadequate for our approach. Our case, using a top-bottom setup and vertical twin traps is much more specific. This allows for simplified analytical models with forces depending only on the relative position of the trap and the particle, which we compare to forces as predicted from the Gor'kov potential in Figure~\ref{fig:modelForces}. \subsubsection{Existing Models of the Trap-Particle Dynamics}\label{sssec:exsting-models} \begin{figure}[!tb] \includegraphics[width=\columnwidth]{OptiTrap_F_max.png} \caption{Analytical models of horizontal (A) and vertical (B) acoustic forces around a trap. The plots on the left show forces along the main axes X and Z, and analytical models provide a good fit. The plots on the right show horizontal (A) and vertical (B) forces across 2D slices through the trap centre along the X and Z axes. Spring and Sinusoidal models fail to predict forces outside the main axes, while our proposed model provides accurate reconstruction within the region of interest (highlight).} \label{fig:modelForces} \Description{Two subplots A and B showing the acoustic force on the y-axis going from F maximum to F minimum, as a function of the displacement between the acoustic trap and the particle, ranging from -0.01 to 0.01 metres. } \end{figure} Simple \emph{spring} models have been used extensively \cite{Paneva20, Fushimi18Nonlin, FushimiLimits}, modelling trapping forces according to a \emph{stiffness} parameter $\mathcal{K}_i$, that is, with forces being proportional to the distance of the particle to the centre of the trap: \begin{equation*} F_i(\textbf{p},\textbf{u}) := \mathcal{K}_i \cdot |u_i-p_i|, \quad i \in \{x,y,z\}. \end{equation*} Such models are usually refined by providing specific stiffness values for each dimension, but they are only suitable for particles remaining in close proximity to the centre of the trap, i.e., the linear region near the centre of the trap. As a result, \emph{spring} models are only accurate for systems moving particles slowly, requiring low acceleration and forces (so that particles remain within the linear region). \emph{Sinusoidal} models have been proposed as an alternative~\cite{Fushimi18Nonlin,FushimiLimits}, providing accurate fitting from the centre of the trap to the peaks of the force distribution in Figure~\ref{fig:modelForces}, according to the peak trapping force $\mathcal{A}_i$ and characteristic frequency $\mathcal{V}_i$: \begin{equation*} F_i(\textbf{p},\textbf{u}) := \mathcal{A}_i \cdot \sin(\mathcal{V}_i \cdot (u_i-p_i)), \quad i \in \{x,y,z\}, \end{equation*} However, both of these models (i.e., \emph{spring} and \emph{sinusoidal}) are only suitable for particles placed along one of the main axes of the acoustic trap, not for particles arbitrarily placed at any point around it. This is illustrated on the right of Figure~\ref{fig:modelForces}, which provides an overview of how forces distribute on a horizontal and vertical 2D plane around a trap, according to each model (i.e., Gor'kov, \emph{spring}, \emph{sinusoidal}, and \emph{Ours}, detailed in the next subsection). Please note how the three previous models show good matching along the horizontal and vertical axes (represented as blue and red lines). However, the \emph{spring} and \emph{sinusoidal} models are of one-dimensional nature (e.g., force $F_x$ only depends on X distance $(u_x-p_x)$) and become inaccurate at points deviating from the main axes. \subsubsection{Our Model} \label{sssec:our-model} The complexity of the force distribution modelled by the Gor'kov potential increases as the distance to the centre of the trap increases. However, we only need to derive a model allowing us to predict where to place the trap to produce a specific force on the particle. This allows us to limit our considerations to the region corresponding to the peaks designated by $\mathcal{A}_r$ and $\mathcal{A}_z$ in Figure~\ref{fig:modelForces}. For points within this region, forces around twin traps distribute in a mostly \emph{axis-symmetric} fashion, which can be approximated as: \begin{subequations}\label{eq:FrFz} \begin{align} F_r(\textbf{p},\textbf{u}) :=\ & \mathcal{A}_r \cdot \cos\left(\mathcal{V}_z \cdot {(u_z-p_z)}\right) \cdot \\ &\sin\left(\mathcal{V}_{xr} \cdot {\sqrt{(u_x-p_x)^2+(u_y-p_y)^2}}\right), \notag \\ F_z(\textbf{p},\textbf{u}) :=\ & \mathcal{A}_z \cdot \sin\left(\mathcal{V}_z \cdot (u_z-p_z)\right) \cdot \\ & \cos\left(\mathcal{V}_{zr} \cdot \sqrt{(u_x-p_x)^2+(u_y-p_y)^2}\right), \notag \end{align} \end{subequations} where $\mathcal{A}_r, \mathcal{A}_z$ represent peak trapping forces along the radial and vertical directions of the trap, respectively. $\mathcal{V}_z$, $\mathcal{V}_{xr}$, $\mathcal{V}_{zr}$ represent characteristic frequencies of the sinusoidals describing how the forces evolve around the trap. The resulting forces can be converted into acoustic forces in 3D space from these cylindrical coordinates, with azimuth $\phi = \arctan ((u_y-p_y)/(u_x-p_x))$: \begin{equation} \label{eq:Facou} F(\textbf{p},\textbf{u}) = \begin{pmatrix} F_x(\textbf{p},\textbf{u}) \\ F_y(\textbf{p},\textbf{u}) \\ F_z(\textbf{p},\textbf{u}) \end{pmatrix} := \begin{pmatrix} F_r(\textbf{p},\textbf{u}) \cos\phi \\ F_r(\textbf{p},\textbf{u}) \sin\phi \\ F_z(\textbf{p},\textbf{u}) \end{pmatrix}. \end{equation} We validated our model by comparing its accuracy against the forces predicted by the gradient of the Gor'kov potential. More specifically, we simulated 729 single traps homogeneously distributed across the working volume of our levitator (i.e., 8x8x8cm, in line with \cite{Hirayama19, Fushimi19}), testing 400 points around each trap for a total of 400x729 force estimations. \begin{table}[t] \caption{Fit parameters for the Spring, Sinusoidal and Axis-symmetric models and the respective average relative errors when compared to Gor'kov.} \centering \begin{tabular}{ |c|c|c|c|c|c|c|} \hline Model & \multicolumn{2}{|c|}{Spring}& \multicolumn{2}{|c|}{Sinusoidal}& \multicolumn{2}{|c|}{Axis-symmetric} \\ \hline \multirow{6}{*}{Fit}&$\mathcal{K}_x$&-0.0071&$\mathcal{A}_x$ &0.00009 &$\mathcal{A}_r$ & 0.0004636\\ &$\mathcal{K}_y$ & -0.0071&$\mathcal{A}_y$ &0.00009 &$\mathcal{A}_z$ & 0.0002758\\ &$\mathcal{K}_z$&-0.94&$\mathcal{A}_z$ &-0.0019 &$\mathcal{V}_z$ & 1307.83\\ & & &$\mathcal{V}_x$ &-68.92 &$\mathcal{V}_{xr}$ & -476.49\\ &&&$\mathcal{V}_y$ &-68.92 &$\mathcal{V}_{zr}$ & 287.87\\ & & &$\mathcal{V}_z$ &1307.83 &&\\ \hline Error & \multicolumn{2}{|c|}{63.3\%}& \multicolumn{2}{|c|}{35.9\%}& \multicolumn{2}{|c|}{4.3\%} \\ \hline \end{tabular} \label{table:fit_parameters} \end{table} Table~\ref{table:fit_parameters} summarises the error distribution achieved by these three models when compared to Gor'kov, showing an average relative error as low as 4\% for our model and much poorer fitting for the other two models. Full details and raw data used in this validation can be found in the Supplementary Material S2. As a final summary, this results in a model for our trap-particle dynamics that only depends on $\textbf{p}$ and $\textbf{u}$ and which fits the definition of a second-order ordinary differential equation: \begin{equation}\label{eq:system_acoustic} m\ddot{\textbf{p}}(t) = F(\textbf{p}(t),\textbf{u}(t)). \end{equation} While the resulting model is accurate (4\% relative error), we note that it is not invertible, which will complicate the formulation of our solution approach. For instance, for a particle at $\textbf{p}=(0,0,0)$, force $F(\textbf{p},\textbf{u}) = (0,0, \mathcal{A}_z \cdot \cos\left(\mathcal{V}_{zr} \cdot x \right))$ can be obtained with either $\textbf{u}= (x, 0, \pi/(2\mathcal{V}_z))$ or $\textbf{u}= (-x, 0, \pi/(2\mathcal{V}_z))$. \subsection{Open-Loop Optimal Path Following} \label{ssec:OPT} This section computes the timing for the particle, so that it moves along the given reference path $Q$ from~\eqref{eq:path} in minimum time and according to the dynamics of the system. We approach this as an open-loop (or feed-forward) path following problem, as typically done in robotics~\cite{Faulwasser12}. That is, we design an optimal control problem that computes the timing $t \mapsto\theta(t)$ as to keep the levitated particle on the prescribed path, to traverse the path in optimum (minimum) time while considering the trap-particle dynamics (i.e., minimum \emph{feasible} time). Our non-invertible model of particle dynamics calls for a more complex treatment of the problem, which we split in two parts. In the first part we derive a virtual system for the timing law, which we describe as a system of first-order differential equations, solvable with traditional methods. In the second part we couple the timing law with our non-invertible dynamics, introducing auxiliary variables that will later enable pseudo-inversion (i.e., to compute trap placement for a given force) as described in Section~\ref{ssec:extract-trap-trajectory}. \subsubsection{Error Dynamics and the Timing Law.}\label{sssec:OPT_timing} The requirement that the particle follows the path $Q$ exactly and for all times means that the deviation from the path equals zero for all $t\in\mathbb{R}^+_0$, i.e., \[ \textbf{e}(t) := \textbf{p}(t) -\textbf{q}(\theta(t)) \equiv 0. \] If the path deviation $\textbf{e}(t)$ is $0$ during the whole interval $[t_0, t_1]$, this implies that the time derivatives of $\textbf{e}(t)$ also have to vanish on $(t_0, t_1)$. Considering this (i.e., $\dot e(t)\equiv 0$ and $\ddot e(t)\equiv 0$) results in: \begin{subequations}\label{eq:dpath_para} \begin{align} \textbf{p}(t) &=\textbf{q}(\theta(t)), \label{eq:dpath_dpara0} \\ \dot{\textbf{p}}(t)&=\dot{\textbf{q}}(\theta(t))=\frac{\partial \textbf{q}}{\partial \theta}\dot{\theta}(t),\\ \ddot{\textbf{p}}(t)&= \ddot{\textbf{q}}(\theta(t))=\frac{\partial^2 \textbf{q}}{\partial \theta^2}\dot{\theta}(t)^2+\frac{\partial \textbf{q}}{\partial \theta}\ddot{\theta}(t). \label{eq:dpath_dpara_2} \end{align} \end{subequations} Thus, for particles on the path~$Q$, system dynamics of the form~\eqref{eq:system_acoustic}, and provided we are able to express $\textbf{u}$ as a function of $\textbf{p}$ and $\ddot{\textbf{p}}$ (i.e., the system inversion described in Section~\ref{sec:PFopt}), the position, the velocity, and the acceleration of the particle can be expressed via $\theta, \dot\theta, \ddot\theta$, respectively. For details, a formal derivation, and tutorial introductions we refer to~\cite{Faulwasser12,epfl:faulwasser15c}. Observe that in~\eqref{eq:dpath_para} the partial derivatives $\frac{\partial^2 \textbf{q}}{\partial \theta^2}$ and $\frac{\partial \textbf{q}}{\partial \theta}$, as well as $\dot\theta$ and~$\ddot\theta$ appear. This leads to two additional observations: First, the parametrisation $\textbf{q}$ from~\eqref{eq:path} should be at least twice continuously differentiable with respect to $\theta$, so that the partial derivatives are well-defined. This justifies our constraint in Section~\ref{sec:prob_stat}. Please note this does not rule out corners in the path~$Q$, as shown by the parametrisation~\eqref{eq:cardioid} of the cardioid. Second, the time evolution of $\theta$ should be continuously differentiable, as otherwise large jumps can occur in the acceleration. To avoid said jumps, we generate the timing $t\mapsto \theta(t)$ via the double integrator \begin{equation}\label{eq:timingLaw} \ddot\theta(t) = v(t), \end{equation} where $v(t) \in \mathbb{R}$ is a computational degree of freedom, used to control the progress of the particle along~$Q$. The function $v(t)$ enables us to later cast the computation of time-optimal motions along reference paths as an OCP, see~\eqref{eq:OCP2}. The in-homogeneous second-order ordinary differential equation~\eqref{eq:timingLaw} takes care of jumps, but needs to be augmented by conditions on~$\theta$ and~$\dot{\theta}$ at initial time $t=0$ and final time $t=T$. This is done to represent the periodic nature of our content (i.e., the particle reveals the same path many times per second): \begin{equation}\label{eq:timingLaw_bc} \theta(0)=\theta_0, \quad \theta(T)=\theta_f, \quad \dot{\theta}(0)=\dot{\theta}(T), \end{equation} where $\theta_0$ and $\theta_f$ are taken from~\eqref{eq:path} and the total time~$T$ will be optimally determined by the OCP. The first two equations in~\eqref{eq:timingLaw_bc} ensure that the path~$Q$ is fully traversed, while the third one ensures the speeds at the beginning and end of the path match. With these additional considerations, we define the (state) vector $\textbf{z}(t):=(\theta(t), \dot{\theta}(t))^\top$, which finally allows us rewrite our second-order differential equations in~\eqref{eq:timingLaw} as a system of first-order differential equations: \begin{equation} \label{eq:dz_dt} \dot{\textbf{z}}(t)= \begin{pmatrix} 0&1\\ 0&0 \end{pmatrix}\textbf{z}(t)+\begin{pmatrix} 0\\ 1 \end{pmatrix}v(t), \quad \textbf{z}(0)=\textbf{z}_0, ~\textbf{z}(T) = \textbf{z}_T. \end{equation} Please note that \eqref{eq:dz_dt} is an equivalent \emph{virtual} system to~\eqref{eq:timingLaw} and~\eqref{eq:timingLaw_bc}, solvable using standard Runge-Kutta methods~\cite{butcher2016numerical}. The system~\eqref{eq:dz_dt} is suitable to generate the timing law, but the particle dynamics~\eqref{eq:system_acoustic} still need to be included, as described next. \subsubsection{Coupling of non-invertible particle dynamics:}\label{sssec:OPT_trap_placement} To include the particle dynamics~\eqref{eq:system_acoustic} in the computation of the timing, we need to couple them with the system~\eqref{eq:dz_dt}. The typical approach is to rewrite~\eqref{eq:system_acoustic} as: \begin{equation}\label{eq:M_implicit} M(\ddot{\textbf{p}}(t), {\textbf{p}}(t), {\textbf{u}}(t)):= m\ddot{\textbf{p}}(t) - F(\textbf{p}(t),\textbf{u}(t)) = 0 \end{equation} and make sure that this equation locally admits an inverse function: \begin{equation} \label{eq:invModel} {\textbf{u}}(t) = M^{-1}(\ddot{\textbf{p}}(t), {\textbf{p}}(t)), \end{equation} This would allow us to easily compute the location of our traps. However, such inversion is not straightforward for our model, and to the best of our knowledge, standard solution methods do not exist for such cases. We deal with this challenge by introducing constraints related to our particle dynamics. These will allow us to compute feasible timings while delaying the computation of the exact trap location to a later stage in the process. More specifically, we introduce auxiliary variables~$\zeta_1,...,\zeta_6$ for each trigonometric term in the force~$F$, and we replace $p_i = q_i(\theta)$ for $i \in \{x,y,z\}$ (i.e., particle position exactly matches our reference path): \begin{subequations}\label{eq:zeta} \begin{align} \zeta_1 &= \sin\left(\mathcal{V}_{xr} {\sqrt{(u_x-q_x(\theta))^2+(u_y-q_y(\theta))^2}}\right),\\ \zeta_2 &= \cos\left(\mathcal{V}_z \cdot {(u_z-q_z(\theta)}\right),\\ \zeta_3 &= \sin\left(\mathcal{V}_z \cdot {(u_z-q_z(\theta)}\right), \\ \zeta_4 &= \cos\left(\mathcal{V}_{zr} {\sqrt{(u_x-q_x(\theta))^2+(u_y-q_y(\theta))^2}}\right),\\ \zeta_5 &= \sin\phi,\\ \zeta_6 &= \cos\phi. \end{align} \end{subequations} With this, we are now able to formally express the force~\eqref{eq:Facou} in terms of $\zeta:=(\zeta_1,...,\zeta_6)$, i.e., \begin{equation} \tilde{F}(\zeta) := \begin{pmatrix} \mathcal{A}_r \zeta_1\zeta_2 \zeta_6 \\ \mathcal{A}_r \zeta_1\zeta_2 \zeta_5\\ \mathcal{A}_z \zeta_4\zeta_3 \end{pmatrix}. \end{equation} Using these auxiliary variables, we can now couple the trap-particle dynamics~\eqref{eq:system_acoustic} with the virtual system~\eqref{eq:dz_dt}. To this end, similar to~\eqref{eq:M_implicit}, we define the following constraint along path~$Q$: \begin{equation} \widetilde M(\theta(t), \dot\theta(t), v(t), \zeta(t)) := m\ddot{\textbf{q}}(\theta(t)) - \tilde{F}({\zeta}(t)) = 0. \end{equation} Observe that i) we need~$\dot{\theta}(t)$ due to~\eqref{eq:dpath_dpara_2}; and ii) $\ddot{\theta}(t)$ can be replaced by~$v(t)$ due to~\eqref{eq:timingLaw}. Finally, combining this with the prior first-order differential system allows us to conceptually formulate the problem of computing a minimum-time motion along the path~$Q$ as: \begin{equation}\label{eq:OCP2} \begin{aligned} \min_{v,T, \zeta}&~T + \gamma\int_0^T v(t)^2 \mathrm{d}t \\ \text{subject to}& \\ \dot{\textbf{z}}(t)&= \begin{pmatrix}0&1\\0&0\end{pmatrix}\textbf{z}(t)+\begin{pmatrix} 0\\1\end{pmatrix}v(t), \quad \textbf{z}(0) =\textbf{z}_0, ~\textbf{z}(T) = \textbf{z}_T, \\ 0&=\widetilde M(\textbf{z}(t), v(t), \zeta(t)), \\ \zeta(t)&\in [-1,1]^6. \end{aligned} \end{equation} The constraint on $\zeta(t)$ is added since the trigonometric structure of~\eqref{eq:zeta} is not directly encoded in the OCP, while $\gamma\geq 0$ is a regularisation parameter. \begin{figure}[tb] \includegraphics[width=1\columnwidth]{OptiTrap_gamma_comparison.png} \caption{Effect of the regularisation parameter $\gamma$ on the position of the optimised traps. } \label{fig:gamma_comparison} \Description{Three subplots A, B and C show a cardioid shape in two dimensional space. The x-axis shows the horizontal spatial component from -5 to 5 centimetres, at steps of 5, while the y-axis shows the vertical from 8 to 16 centimetres, at steps of 4. Subplot A shows the computed trap positions when the regularisation parameter gamma is low. Sudden jumps at the highest and lowest vertical position, as well as at the sharp edge of the shape are highlighted.} \end{figure} The case~$\gamma=0$ corresponds to strictly minimising time, which typically leads to an aggressive use of the forces around the trap. The example in Figure \ref{fig:gamma_comparison}(A) shows the trap accelerating the particle before arriving at the corner, then applying aggressive deceleration before it reaches the corner. At the top and bottom of the shape, again the particle is accelerated strongly, then it is suddenly decelerated by the traps placed behind it, in order to move around the curve. This would be the optimum solution in an ideal case (i.e., a device working \emph{exactly} as per our model), but inaccuracies in the real device can make them unstable. Moreover, we observed the overall reductions in rendering time to usually be quite small. The regularisation ($\gamma>0$) enables \emph{nearly} time-optimal solutions. More specifically, this is a strictly convex regularisation that penalises high magnitudes of the virtual input $v = \ddot{\theta}$. This is most closely related to the accelerations applied to the particle, hence avoiding aggressive acceleration/deceleration as shown in Figures~\ref{fig:gamma_comparison}(B) and (C). Several heuristics could be proposed to automate selection of a suitable value for $\gamma$ (e.g., use smallest $\gamma$ ensuring that the dot product of $\dot{\textbf{p}}(t)$ and $\dot{\textbf{u}}(t)$ remains always positive), but this step is considered beyond the scope of the current paper. Note that the OCP in~\eqref{eq:OCP2} yields the (nearly) optimal timing along the path~$Q$, respecting the particle dynamics and hence solving \emph{Challenge 1}. More\-over, it yields the required forces through $\zeta(t)$. However, it does not give the trap trajectory~$\textbf{u}(t)$ that generates these forces. To obtain the trap trajectory and thus solve \emph{Challenge~2}, we refine~\eqref{eq:OCP2} in the following section. \subsection{Computing the Trap Trajectory}\label{ssec:extract-trap-trajectory} The second stage in our approach deals with \emph{Challenge 2}, computing the trap trajectory~$\textbf{u}(t)$ based on the solution of~\eqref{eq:OCP2}. In theory, we would use the values for $\zeta_i(t)$, $i=1,...,6$ and $q_j(\theta(t))$, $j\in\{x,y,z\}$ to determine the particle position and force required at each moment in time, obtaining the required trap position~$\textbf{u}(t)$ by solving~\eqref{eq:zeta}. In practice, solving~$\textbf{u}(t)$ from~\eqref{eq:zeta} numerically is not trivial, particularly for values of $\zeta_i$ close to $\pm 1$, where numerical instabilities could occur, particularly for $\zeta_1$ and $\zeta_4$. We attenuate these difficulties by providing further structure to the OCP~\eqref{eq:OCP2}, specifically regarding~$\zeta$: \begin{equation}\label{eq:zeta_trig_pythagoras} \zeta_2^2+\zeta_3^2 = 1, \quad \zeta_5^2+\zeta_6^2 = 1. \end{equation} We also constrain the solvability of~\eqref{eq:zeta} by using a constant back-off $\varepsilon\in\interval[open]{0}{1}$ in order to avoid numerical instabilities: \begin{equation}\label{eq:consistConstraints} -1+\varepsilon \leq \zeta_i \leq 1-\varepsilon, \quad i=1,...,6. \end{equation} For the sake of compact notation, we summarise the above constraints in the following set notation \begin{equation} \mathcal{Z} := \left\{\zeta \in \mathbb{R}^6 ~ | ~\eqref{eq:zeta_trig_pythagoras} \text{ and } \eqref{eq:consistConstraints} \text{ are satisfied}\right\}. \end{equation} The final OCP is then given by \begin{equation}\label{eq:OCP3} \begin{aligned} \min_{v,T, \zeta}&~T + \gamma\int_0^T v(t)^2 \mathrm{d}t \\ \text{subject to}& \\ \dot{\textbf{z}}(t)&= \begin{pmatrix}0&1\\0&0\end{pmatrix}\textbf{z}(t)+\begin{pmatrix} 0\\1\end{pmatrix}v(t), \quad \textbf{z}(0) =\textbf{z}_0, ~\textbf{z}(T) = \textbf{z}_T, \\ 0&=\widetilde M(\textbf{z}(t), v(t), \zeta(t)), \\ \zeta(t)&\in \mathcal{Z}. \end{aligned} \end{equation} Finally, given $\zeta(t) \in \mathcal{Z}$ and $\theta(t)$ from the solution of~\eqref{eq:OCP3}, we numerically solve~\eqref{eq:zeta} for $u_i$, $i\in\{x,y,z\}$, using Powell's dog leg method~\cite{Mangasarian94}. Please note that higher values of $\varepsilon$ will limit the magnitudes of the forces exploited by our approach. A simple solution is to perform a linear search over $\varepsilon$, only increasing its value and recomputing the solution if Powell's method fails to converge to a feasible trap location. For details on discretising the OCP~\eqref{eq:OCP3}, we refer to the Supplementary Material S3. \section{Evaluation} \label{sec:eval} This section evaluates the capability of our algorithm to support content creation by generating physically feasible trap trajectories given only a reference path (i.e., a shape) as an input. We select a range of shapes and analyse the effects each step in our approach has on the final achievable size, rendering frequency, and reconstruction error, for each shape. We also inspect how these steps influence the presence of visual distortions in the end result. Finally, we analyse the resulting acceleration profiles. \begin{figure}[b] \includegraphics[width=\columnwidth]{OptiTrap_evaluation_shapes.png} \caption{Test shapes used for evaluation, as rendered by our \emph{OptiTrap} approach. The circle (A) provides a trivial timing case. The cardioid (B) and squircle (C) represent simple shapes featuring sharp corners and straight lines. The fish (D) is used as an example of composite shape featuring corners, straight lines, and curves.} \label{fig:EvalShapes} \Description{The image consists of four photos A, B, C and D. The photos show illuminated outlines of the different shapes rendered by the levitation interface in mid-air.} \end{figure} \subsection{Test Shapes} \label{ssec:eval_test_shapes} We used four test shapes for the evaluation: a circle, a cardioid, a squircle, and a fish, all shown in Figure~\ref{fig:EvalShapes}. The circle is selected as a trivial case in terms of timing. It can be optimally sampled by using a constant angular speed (i.e., constant acceleration), and is there to test whether our solution converges towards such optimum solutions. The cardioid and squircle represent simple shapes featuring sharp corners (cardioid) and straight lines (squircle), both of them challenging features. Finally, the fish is selected as an example composite shape, featuring all elements (i.e., corners, straight lines, and curves). All of these shapes can be parameterised by low-frequency sinusoids (see Supplementary Material S4), ensuring the path parameter~$\theta$ progresses slowly in areas of high curvature. This provides a good starting point for our baseline comparison that we explain in Section~\ref{ssec:eval_conditions}. While our approach works for content in 3D, we perform the evaluation on shapes in a 2D plane of the 3D space to facilitate the analysis of accelerations in Section~\ref{ssec:eval_accelerations}, which we will perform in terms of horizontal and vertical accelerations (i.e., the independent factors given our axis-symmetric model of forces), allowing us to validate \emph{OptiTrap}'s awareness of particle directions and how close it can get to the maximum accelerations allowed by the dynamics of acoustic traps, as discussed in Section~\ref{ssec:model-acoustic-forces}. Notice in Figure~\ref{fig:EvalShapes}, that due to the timing differences, different shape elements exhibit different levels of brightness. To obtain homogeneous brightness along the shape, please refer to the solution proposed by \cite{Hirayama19}, where the particle illumination is adjusted to the particle speed. \subsection{Conditions Compared} \label{ssec:eval_conditions} We compare three approaches to rendering levitated shapes, where each approach subsequently addresses one of the challenges introduced in Section~\ref{sec:prob_stat}. This will help us assess the impact that each challenge has on the final results obtained. The first condition is a straight-forward \emph{Baseline}, with homogeneous sampling of the path parameter, which matches the example strategy shown in Figure~\ref{fig:timings}(B), and placing traps where the particle should be. The \emph{Baseline} still does not address any of the challenges identified (i.e., optimum timing or trap placement), but it matches approaches used in previous works \cite{Hirayama19, Plasencia20, FushimiLimits} and will illustrate their dependence on the specific shape and initial parametrisation used. The second condition, \emph{OCP\_Timing}, makes use of our \emph{OptiTrap} approach to compute optimum and feasible timing (see Subsection~\ref{sssec:OPT_timing}), but still ignores \emph{Challenge 2}, assuming that particles match trap location (i.e., it skips Subsection~\ref{sssec:OPT_trap_placement}). The third condition is the full \emph{OptiTrap} approach, which considers feasibility and trap-particle dynamics and deals with both the timing and trap placement challenges. These conditions are used in a range of comparisons involving size, frequency, reconstruction error as well as comparative analysis of the effects of each condition on the resulting particle motion, detailed in the following sections. \subsection{Maximum Achievable Sizes} \label{ssec:eval_sizes} This section focuses on the maximum sizes that can be achieved for each test shape and condition, while retaining an overall rendering time of 100ms\footnote{The circle rendered at 100ms would exceed the size of our device's working volume. Thus, this shape was rendered at 67ms.} (i.e., PoV threshold). For each of these cases, we report the maximum achievable size and reliability, which were determined as follows. Maximum size is reported in terms of shape width and in terms of meters of \emph{content per second} rendered \cite{Plasencia20}, and their determination was connected to the feasibility of the trap trajectories, particularly for the \emph{Baseline} condition. \begin{table*} \caption{Maximum shape width and meters of content per second achieved with the \emph{Baseline}, \emph{OCP\_Timing}, and \emph{OptiTrap} approach at constant rendering frequency. Successful trials out of 10.} \centering \begin{tabular}{ c|c|c|c|c|c|c|c|c|c|c|c|} \cline{3-12} \multicolumn{2}{c}{}&\multicolumn{3}{|c}{\emph{Baseline}}& \multicolumn{3}{|c}{\emph{OCP\_Timing}}&\multicolumn{3}{|c|}{\emph{OptiTrap}}&\multicolumn{1}{c|}{Increase }\\ \cline{1-11} \multicolumn{1}{|l|}{Shape} &Freq.& Width & Content per & Success & Width & Content per& Success & Width & Content per& Success & in Width w.r.t.\\ \multicolumn{1}{|l|}{} & (Hz) & (cm) & Second (m)& Rate & (cm) & Second (m)& Rate& (cm) & Second (m)& Rate &the \emph{Baseline}\\ \hline \multicolumn{1}{|l|}{Circle} & 15& 7.00& 3.30 & 10/10&7.00 & 3.30 & 10/10 &7.00 & 3.30 & 10/10 & 0\% \\ \hline \multicolumn{1}{|l|}{Cardioid} &10 & 8.05 & 2.48& 10/10& 9.09& 2.80& 10/10 & 9.09 &2.80 & 10/10 &12.9\% \\ \hline \multicolumn{1}{|l|}{Squircle} &10& 0.80& 0.29 & 9/10&5.30& 1.90 & 10/10 & 5.30& 1.90 & 10/10 & 562.5\%\\ \hline \multicolumn{1}{|l|}{Fish} &10& 7.77& 2.42 & 10/10&8.76 & 2.75 &10/10 &8.76& 2.75 & 10/10 & 12.7\% \\ \hline \end{tabular} \label{table:shape_sizes_results} \end{table*} More specifically, we determined maximum feasible sizes for the \emph{Baseline} condition by conducting an iterative search. That is, we increased the size at each step and tested the reliability of the resulting shape. We considered the shape feasible if it could be successfully rendered at least 9 out of 10 times in the actual levitator. On a success, we would increase size by increasing the shape width by half a centimetre. On a failure, we would perform a binary search between the smallest size failure and the largest size success, stopping after two consecutive failures and reporting the largest successful size. This illustrates the kind of trial and error that a content designer would need to go through without our approach and it was the most time consuming part of this evaluation. For the other two conditions (i.e., \emph{OCP\_Timing} and \emph{OptiTrap}), maximum sizes could be determined without needing to validate their feasibility in the final device. Again, we iteratively increased the shape size using the same search criteria as before (i.e., 5mm increases, binary search). We assumed any result provided would be feasible (which is a reasonable assumption; see below) and checked the resulting total rendering time, increasing the size if the time was still less than 100ms. At each step, a linear search was used, iteratively increasing $\varepsilon$, until feasible trap locations could be found (i.e., equation~\eqref{eq:zeta} could be solved without numerical instabilities). Adjusting the value of the regularisation parameter $\gamma$ was done by visually inspecting the resulting trap trajectories, until no discontinuities could be observed (see Figure \ref{fig:gamma_comparison}). Please note that this is a simple and quick task, which, unlike the \emph{Baseline} condition, does not involve actual testing on the levitation device and could even be automated. All solutions provided can be assumed feasible, and the designer only needs to choose the one that better fits their needs. Once the maximum achievable sizes were determined, these were tested in the actual device. We determined the feasibility of each shape and condition by conducting ten tests and reporting the number of cases where the particle succeeded to reveal the shape. This included the particle accelerating from rest, traversing/revealing the shape for 6 seconds and returning to rest. Table \ref{table:shape_sizes_results} summarises the results achieved for each test shape and condition. First of all, it is worth noting that all trials were successful for \emph{OptiTrap} and \emph{OCP\_Timing} approaches, confirming our assumption that the resulting paths are indeed feasible and underpinning \emph{OptiTrap}'s ability to avoid trial and error on the actual device during content creation. The results and relative improvements in terms of size vary according to the particular condition and shape considered. For instance, it is interesting to see that all conditions yield similar final sizes for the circle, showing that \emph{OptiTrap} (and \emph{OCP\_Timing}) indeed converge towards optimum solutions. More complex shapes where the \emph{Baseline} parametrisation is not optimal (i.e., cardioid, squircle, and fish), show increases in size when using \emph{OCP\_Timing} and \emph{OptiTrap}. More interestingly, the increases in size vary greatly between shapes, showing increases of around $12\%$ for the fish and cardioid, and up to $562\%$ for the squircle. This is the result of the explicit parametrisation used, with reduced speeds at corners in the fish and cardioid cases, but not in the case of the squircle. It is also interesting to see that \emph{OCP\_Timing} and \emph{OptiTrap} maintain high values of \emph{content per second} rendered, independently of the shape. That is, while the performance of the \emph{Baseline} approach is heavily determined by the specific shape (and parametrisation) used, the OCP-based approaches (\emph{OCP\_Timing} and \emph{OptiTrap}) yield results with consistent \emph{content per second}, determined by the capabilities of the device (but not so much by the specific shape). Finally, please note that no changes in terms of maximum size can be observed between \emph{OCP\_Timing} and \emph{OptiTrap}. \subsection{Maximum Rendering Frequencies} \label{ssec:eval_frequencies} \begin{table}[b] \caption{Maximum rendering frequencies achieved with the \emph{Baseline}, \emph{OCP\_Timing}, and \emph{OptiTrap} approach, for shapes of equal size. Successful trials out of 10.} \centering \begin{tabular}{ c|c|c|c|c|c|c|} \cline{2-7} &\multicolumn{2}{c|}{\emph{Baseline}}&\multicolumn{2}{c}{\emph{OCP\_Timing}}&\multicolumn{2}{|c|}{\emph{OptiTrap}}\\ \cline{1-7} \multicolumn{1}{|l|}{Shape}& Freq. & Success & Freq. & Success &Freq. & Success \\ \multicolumn{1}{|l|}{} & (Hz)& Rate& (Hz)& Rate& (Hz)& Rate \\ \hline \multicolumn{1}{|l|}{Circle} &15 & 10/10 & 15 &10/10 & 15 & 10/10 \\ \hline \multicolumn{1}{|l|}{Cardioid}& 8 & 10/10 & 10 &10/10 &10 & 10/10 \\ \hline \multicolumn{1}{|l|}{Squircle} & 4 & 10/10 & 10 &10/10 &10 & 10/10 \\ \hline \multicolumn{1}{|l|}{Fish} & 9 & 9/10& 10 &10/10 &10 & 10/10\\ \hline \end{tabular} \label{table:shape_frequency_results} \end{table} In this second evaluation, we assessed the effect of the timing strategy on the maximum achievable rendering frequencies. To do this, we selected the maximum achievable sizes obtained in the prior evaluation for each shape. We then reproduced such sizes with the \emph{Baseline} approach, searching for the maximum frequency at which this approach could reliably render the shape (using the same searching and acceptance criteria as above). That is, while we knew \emph{OCP\_Timing} and \emph{OptiTrap} could provide 10Hz for these shapes and sizes, we wanted to determine the maximum frequency at which the \emph{Baseline} would render them, as to characterise the benefits provided by optimising the timing. The results are summarised in Table \ref{table:shape_frequency_results}. As expected, no changes are produced for the circle. However, there is a 25\% increase for the cardioid, 150\% for the squircle, and 11\% increase for the fish using the \emph{OptiTrap} method. Again, please note that no differences can be observed in terms of maximum frequency between \emph{OCP\_Timing} and \emph{OptiTrap}. \subsection{Reconstruction Accuracy} \label{ssec:eval_accuracy} To evaluate the reconstruction accuracy, we recorded each of the trials in our maximum size evaluations (see Section~\ref{ssec:eval_sizes}) using an OptiTrack camera system. We then computed the Root Mean Squared Error (RMSE) between the recorded data and the intended target shape, taking 2s of shape rendering into account (exclusively during the cyclic part, ignoring ramp-up/ramp-down). For a fair comparison across trials, we normalise the RMSE with respect to the traversed paths, by dividing the RMSE by the total path length of each individual test shape. The results are summarised in Table~\ref{table:RMSE_results}. \begin{table}[b] \caption{RMSE and Path-normalised (PN) RMSE with respect to the total path length of each test shape, for the \emph{Baseline}, \emph{OCP\_Timing}, and \emph{OptiTrap} approach, at constant rendering frequency.} \centering \begin{tabular}{ c|c|c|c|c|c|c|} \cline{2-7} &\multicolumn{2}{|c}{\emph{Baseline}}& \multicolumn{2}{|c}{\emph{OCP\_Timing}}& \multicolumn{2}{|c|}{\emph{OptiTrap}}\\ \hline \multicolumn{1}{|l|}{Shape} & RMSE & PN & RMSE & PN & RMSE & PN\\ \multicolumn{1}{|l|}{} & (cm) & RMSE & (cm) & RMSE & (cm) & RMSE\\ \hline \multicolumn{1}{|l|}{Circle} & 0.196 & 0.893 & 0.146 & 0.666& 0.114 & 0.521\\ \hline \multicolumn{1}{|l|}{Cardioid} & 0.142 & 0.575 & 0.153 & 0.545 & 0.120 & 0.429\\ \hline \multicolumn{1}{|l|}{Squircle} & 0.056 & 1.956& 0.0824 &0.434 & 0.080 & 0.421\\ \hline \multicolumn{1}{|l|}{Fish} & 0.111 &0.458 & 0.147&0.536 &0.0581 & 0.212\\ \hline \end{tabular} \label{table:RMSE_results} \end{table} On average, both \emph{OCP\_Timing} and \emph{OptiTrap} provide better results in terms of accuracy, when compared to the \emph{Baseline}. It is particularly worth noting that the accuracy results, in terms of the raw RMSE for \emph{OptiTrap} and \emph{OCP\_Timing}, are better for the cardioid when compared to the \emph{Baseline}, even though a larger shape is being rendered. While the raw RMSE of \emph{OCP\_Timing} and \emph{OptiTrap} is slightly larger for the squircle, we need to take into account that the size rendered by \emph{OCP\_Timing} and \emph{OptiTrap} is almost 6 times larger. Comparing accuracy in terms of normalised RMSE shows consistent increases of accuracy for \emph{OptiTrap} compared to the \emph{Baseline}, with overall decreases in the RMSE of $41.7\%$ (circle), $25.4\%$ (cardioid), $78.5\%$ (squircle), and $53.8\%$ (fish). \emph{OCP\_Timing} shows a decrease of $25.4\%$, $5.14\%$, and $77.8\%$ of the normalised RMSE for the circle, cardioid, and squircle, with the exception of the fish, where the normalised RMSE increased by $17.1\%$, when compared to the \emph{Baseline}. Comparing the reconstruction accuracy of \emph{OCP\_Timing} and \emph{OptiTrap} highlights the relevance of considering trap dynamics to determine trap locations (i.e., Section~\ref{ssec:extract-trap-trajectory}). \emph{OptiTrap} consistently provides smaller RMSE than \emph{OCP\_Timing}, as a result of considering and accounting for the trap-to-particle displacements required to apply specific accelerations. We obtain a $21.8\%$, $21.3\%$, $2.9\%$ and $60.5\%$ decrease in the normalised RMSE, for the circle, cardioid, squircle, and fish, respectively. Such differences are visually illustrated in Figure \ref{fig:eval_trap_location}, showing the effects on the cardioid and fish, for the \emph{OCP\_Timing} and \emph{OptiTrap} approaches. It is worth noting how placing the traps along the reference path results in the cardioid being horizontally stretched, as the particle needs to retain larger distances to the trap to keep the required acceleration (horizontal forces are weaker than vertical ones). This also results in overshooting of the particle at corner locations, which can be easily observed at the corner of the cardioid and in the fins of the fish. For completeness, the visual comparison for the remaining two test shapes is provided in the Supplementary Material S5. \begin{figure}[tb] \includegraphics[width=\columnwidth]{OptiTrap_distortions.png} \caption{Visual comparison between shapes rendered with traps located according to particle dynamics using \emph{OptiTrap} (left) and traps placed along the reference path using \emph{OCP\_Timing} (right) for the cardioid (top) and the fish (bottom) test shapes. Please note undesired increases in size and error in sharp features, such as corners.} \label{fig:eval_trap_location} \Description{The image consists of a two-by-two photo matrix. There are two photos of a rendered cardioid in the first row, and fish in the second row. The cardioid and the fish in the first column are rendered using the OptiTrap algorithm, and in the second column the two shapes are rendered using OCP_Timing. The levitated graphics in the second column are a bit larger in size and less precise than those in the first column. } \end{figure} \subsection{Analysis of Acceleration profiles} \label{ssec:eval_accelerations} \begin{figure}[b] \includegraphics[width=1\columnwidth]{OptiTrap_Acc_Speed_Fish.png} \caption{Particle acceleration and speed for the fish rendered at 10~Hz using \emph{OptiTrap} (solid black) and the \emph{Baseline} (dash-dotted purple). While the speed profiles (D) of both trap trajectories are similar, the trap trajectory generated by our approach is feasible, whereas the one generated by the \emph{Baseline} is not. The main reason is that the \emph{Baseline} exceeds the feasible horizontal acceleration, while our approach caps it to feasible values (B). Our approach compensates by using higher (available) vertical acceleration (C). Note that the times where the \emph{Baseline} applies a higher total acceleration (A) than our approach are those where our approach respects the constraints on the feasible horizontal acceleration (B).} \label{fig:force_plots} \Description{The figure consists of four subplots. Subplot A shows the total acceleration in metres per seconds squared from 0 to 400, in steps of 200. Subplot B shows the horizontal acceleration in metres per seconds squared from -200 to 400, in steps of 200. Subplot C shows the vertical acceleration in metres per seconds squared from -500 to 500, in steps of 500. Subplot D shows the total speed in metres per seconds from 0 to 4, in steps of 2. All quantities are plotted as functions of time, going from 0 to 100 milliseconds, at steps of 20.} \end{figure} Finally, we examined the acceleration profiles produced by \emph{OptiTrap} and how these differ from the pre-determined acceleration profiles of the \emph{Baseline}. Please note that we only compare and discuss \emph{OptiTrap} and \emph{Baseline} in Figure \ref{fig:force_plots}, and only for the fish shape. \emph{OCP\_Timing} is not included, as it results in similar acceleration profiles as \emph{OptiTrap}. Only the fish is discussed, as it already allows us to describe the key observations that can be derived from our analysis. For completeness, the acceleration profiles for all remaining test shapes are included in the Supplementary Material S6. As introduced above, Figure \ref{fig:force_plots} shows the particle accelerations and speeds of a particle revealing a fish shape of maximum size (i.e., a width of 8.76cm), rendered over 100ms using the \emph{OptiTrap} and \emph{Baseline} approaches. It is worth noting that while \emph{OptiTrap} succeeded in rendering this shape, \emph{Baseline} did not (the maximum width for \emph{Baseline} was 7.77cm). A first interesting observation is that although \emph{OptiTrap} provides lower total accelerations than the \emph{Baseline} during some parts of the path (see Figure \ref{fig:force_plots}(A)), it still manages to reveal the shape in the same time. The key observation here is that the regions where the total acceleration is lower for \emph{OptiTrap} match with the parts of the path where the horizontal acceleration is very close to its maximum; for example, note the flat regions in Figure~\ref{fig:force_plots}(B) of around $\pm 300 m/{s}^2$). This is an example of \emph{OptiTrap}'s awareness of the dynamics and capabilities of the actual device, limiting the acceleration applied as to retain the feasibility of the path. Second, it is worth noting that maximum horizontal accelerations are significantly smaller than vertical accelerations. As such, it does make sense for horizontal displacements to become the limiting factor. In any case, neither acceleration exceeds its respective maximum value. The \emph{OptiTrap} approach recovers any missing time by better exploiting areas where acceleration is unnecessarily small. It is also worth noting that the value of the horizontal and vertical accelerations are not simply being capped to a maximum acceleration value per direction (e.g., simultaneously maxing out at $\pm 300 m/{s}^2$ and $\pm 600 m/{s}^2$ in the horizontal and vertical directions), as such cases are not feasible according to the dynamics of our acoustic traps. Third, it is interesting to note that the final acceleration profile is complex, retaining little resemblance with the initial parametrisation used. This is not exclusive for this shape and can be observed even in relatively simple shapes, such as the cardioid in Figure~\ref{fig:timings}(D) or the remaining shapes, provided in the Supplementary Material S6. The complexity of these profiles is even more striking if we look at the final speeds resulting from both approaches (see Figure \ref{fig:force_plots}(D)). Even if the acceleration profiles of \emph{Baseline} and \emph{OptiTrap} are very different, their velocity profiles show only relatively subtle differences. But even if these differences are subtle, they mark the difference between a feasible path (i.e., \emph{OptiTrap}) and a failed one (i.e., \emph{Baseline}). These complex yet subtle differences also illustrate how it is simply not sensible to expect content designers to deal with such complexity, and how \emph{OptiTrap} is a necessary tool to enable effective exploitation of PoV levitated content. \section{Discussion} This paper presented \emph{OptiTrap}, an automated approach for optimising timings and trap placements, as to achieve feasible target shapes. We believe this is a particularly relevant step for the adoption of levitation PoV displays, as it allows the content creator to focus on the shapes to present, with feasible solutions being computed automatically, while making effective usage of the capabilities of the device. As such, we hope \emph{OptiTrap} to become an instrumental tool in helping explore the actual potential of these displays. However, \emph{OptiTrap} is far from a complete content creation tool. Such a tool should consider the artist's workflows and practices. Similarly, testing and identifying most useful heuristics to tune our approach (e.g., the regularisation) or visualisation tools identifying tricky parts of the shapes (i.e., requiring high accelerations) should be included as a part of this process. Our goal is simply to provide the base approach enabling this kind of tools. Even this base approach can be extended in a variety of ways. Our levitator prototype is built from off-the-shelf hardware, and is still subject to inaccuracies that result in distortions in the sound-fields generated \cite{Fushimi19}. As such, more accurate levitation hardware or, alternatively, a model reflecting the dynamics of the system in a more accurate manner would be the most obvious pathway to improve our approach. It is worth noting that both factors should be advanced jointly. A more accurate model could also be less numerically stable, potentially leading to worse results if the hardware is not accurate enough. The high update rates of 10kHz required by the levitator and the millisecond delays introduced by optical tracking systems indicate that closed-loop approaches can be both promising and challenging avenues to explore. Assuming a tracking device synchronised with the levitation device (as to map current trap locations with real particle positions), \emph{OptiTrap} could be combined with learning-based approaches. These learning-based approaches will require example paths (i.e., with initial timing and trap placement), and their achievable complexity and convergence will be limited by the examples provided. In such cases, \emph{OptiTrap} can be used to always generate feasible initial trajectories (i.e., to avoid system restarts on failure). Thus learning-based approaches could be used to further refine \emph{OptiTrap} beyond our current model, as to account for device inaccuracies such as those discussed by~\cite{Fushimi19}. However, higher gains can be obtained from more radical changes in the approach. For instance, our approach optimises the timing and trap placement, but it does not modify the target shapes. As illustrated in Figure~\ref{fig:force_plots}, slight changes in speed have significant effects on the acceleration profiles (and feasibility) of the shapes. This is even more prominent for position, where small changes can heavily influence the acceleration and feasibility of target shapes. As such, approaches exploiting subtle modifications to the shape could lead to significant gains in rendering performance. Another interesting possibility would be extending our approach to use several particles. As shown in \cite{Plasencia20}, while the use of several particles does not increase the overall power that can be leveraged, it does allow for increased flexibility. That is, the intensity/forces of each trap can be individually and dynamically adjusted, as to match the needs of the region of the path that each particle is revealing. Also, particles can each be rendering specific independent features, so the content is not limited to a single connected path, and the particles do not waste time/accelerations traversing parts of the path that will not be illuminated (i.e., visible). This approach, however, entails significant challenges. The first obvious challenge is the reliability of the intensity control of the traps. \cite{Plasencia20} demonstrate accurate control of the stiffness at the centre of the traps, but the effects of multiple (interfering) traps in each trap's topology (i.e., how forces distribute around the trap) is yet to be studied. A second challenge is that each particle is not forced to traverse the path at the same speed/rates, with such independent timing progression becoming an additional degree of freedom to account for. Finally, further extensions to our work can come from its application to domains other than PoV displays. An obvious next step would be to adapt \emph{OptiTrap} to photophoretic displays, which trap particles using optical traps instead of acoustic traps \cite{Smalley18,Kumagai21}. This would involve including a model of the dynamics of such optical traps, but it can also involve further challenges, such as modelling the response times of galvanometers and LC panels involved in creating the trap. Our approach can also be adapted to applications requiring objects to be transported quickly and accurately. For example, contactless transportation of matter has a wealth of applications in areas such as the study of physical phenomena, biochemical processes, materials processing, or pharmaceutics \cite{Foresti12549}. Our method can help solving such problems by directly computing a rest-to-rest solution of the matter to be transported, given an estimation of the mass of that matter, the acoustic force acting on the matter, and a path from start to target position. \section{Conclusion} In this paper we proposed the first structured numerical approach to compute trap trajectories for acoustic levitation displays. \emph{OptiTrap} automatically computes physically feasible and nearly time-optimal trap trajectories to reveal generic mid-air shapes, given only a reference path. Building on a novel multi-dimensional approximation of the acoustic forces around the trap, we formulate and show how to solve a non-linear path following problem without requiring or exploiting differential flatness of the system dynamics. We demonstrate increases of up to 563\% in size and up to 150\% in frequency for several shapes. Additionally, we obtain better reconstruction accuracy with up to a 79\% decrease in the path-normalised RMSE. While previously, feasible trap trajectories needed to be tuned manually for each shape and levitator, our approach requires calibration of each individual levitator just once. We are confident that the ideas in this paper could form the basis for future content authoring tools for acoustic levitation displays and bring them a key step closer to real-world applications. \begin{acks} This research has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement \#737087 (Levitate) and from the AHRC UK-China Research-Industry Creative Partnerships (AH/T01136X/2). \end{acks} \bibliographystyle{ACM-Reference-Format} \section{Introduction} \begin{figure}[t] \includegraphics[width=\columnwidth]{OptiTrap_teaser.png} \caption{While previously, shapes demonstrated on levitation displays were limited to simple shapes with almost constant curvature \cite{Fushimi19,Hirayama19,Plasencia20}, our approach allows to render generic complex paths. Shapes that have not been demonstrated before include sharp edges as with the heart (B) and dolphin (D), as well as significant changes of the curvature, as with the cat (A) and flower (C) (see Supplementary Video). Photos of the physical particle are made with an exposure time ranging from 0.2 to 1~s, such that each photo shows multiple periods of the orbit.} \label{fig:teaser} \Description{Four photos labelled A, B, C and D show different graphics generated with the levitation display. Image A shows an outline of a 2.4 centimetres wide cat, rendered at 5 Hertz. Image B shows an outline of a 5.4 centimetres wide heart, rendered at 10 Hertz. Image C shows an outline of a 5.6 centimetres wide three-petal flower, rendered at 10 Hertz. Image D shows an outline of a 4.7 centimetres wide dolphin, rendered at 3.3 Hertz. A human index finger is petting the dolphin. The volumetric dolphin graphics and the index finger are of similar size.} \end{figure} \begin{figure*}[!tb] \includegraphics[width=2\columnwidth]{OptiTrap_flowchart.png} \caption{\emph{OptiTrap} is an automated method to compute trap trajectories to reveal generic mid-air shapes on levitation displays. The method accepts a reference path (e.g., the shape of a heart) without any timing information as an input (A). Our approach considers the capabilities of the device and its trap-particle dynamics and combines these with a path following approach (B). The approach produces feasible trap trajectories, describing when and where the traps must be created (C). The resulting particle motion can be presented on the actual device, yielding feasible paths and supporting complex objects with sharp edges and/or significant changes of the curvature (D).} \label{fig:teaser_diagram} \Description{A flowchart with four elements sequentially connected with flow links. The starting state A is a reference path q of theta, which captures the positions of a reference shape of a heart. A flows to B, the OptiTrap algorithm, composed of the trap-particle dynamics and optimal path following components. The algorithm outputs a trap trajectory u of t, in state C, which contains both the trap positions and timings. An image shows that the trap trajectories do not overlap with the shape positions that were fed to the algorithm in state A. Finally, the ending state D is the particle motion. A photo of the rendered heart shape on the levitation display is shown above a stretched out hand, indicating that the shape is three dimensional and rendered in mid-air.} \end{figure*} Acoustic levitation has recently demonstrated the creation of volumetric content in mid-air by exploiting the Persistence of Vision (PoV) effect. This is achieved by using acoustic traps to rapidly move single~\cite{Hirayama19} or multiple~\cite{Plasencia20} particles along a periodic reference path, revealing a shape within $0.1s$ (i.e., the integration interval of human eyes~\cite{Bowen74}). However, the way to define such PoV content remains unsolved. That is, there are no automated approaches to compute the \emph{trap trajectories}, i.e., the positioning and timing of the acoustic traps that will allow us to reveal the desired shape. Currently, content creators can only rely on trial and error to find physically feasible trap trajectories resembling their intended target shapes, resulting in a time consuming and challenging process. For instance, the creator will need to define the timing of the path (i.e., not only \emph{where} the particle must be, but also \emph{when}). Such timing is not trivial and will affect the overall rendering time and the accelerations applied to the particle, which must be within the capabilities of the levitator. The way forces distribute around the acoustic trap will also need to be considered to decide where traps must be located. Considering these challenges is crucial to design feasible trap trajectories, as a single infeasible point along the trajectory typically results in the particle being ejected from the levitator (e.g., approaching a sharp corner too quickly). Thus, while it has been theorised that linear PoV paths of up to 4m and peak speeds of 17m/s are possible~\cite{FushimiLimits}, actual content demonstrated to date has been limited to simple shapes with almost constant curvature along the path and much lower speeds (e.g., 0.72m/s in~\cite{Ochiai14}; 1.2m/s in~\cite{Hirayama19}; 2.25m/s in \cite{Plasencia20}, combining six particles). In this paper, we present \emph{OptiTrap}, the first structured numerical approach to compute trap trajectories for acoustic levitation displays. \emph{OptiTrap} automates the definition of levitated PoV content, computing physically feasible and nearly time-optimal trap trajectories given only a reference path, i.e., the desired shape. As shown in Figure~\ref{fig:teaser}, this allows for larger and more complex shapes than previously demonstrated, as well as shapes featuring significant changes in curvature and/or sharp corners. Our approach is summarised in Figure~\ref{fig:teaser_diagram}. \emph{OptiTrap} assumes only a generic reference path $\textbf{q}(\theta)$ as an input, with no temporal information (see~Figure~\ref{fig:teaser_diagram}(A)). \emph{OptiTrap} formulates this as a path following problem (see~Figure~\ref{fig:teaser_diagram}(B)), computing the optimum timing in which a particle can traverse such path. Our formulation considers the \emph{Trap-Particle Dynamics} of the system, using a 3D model of acoustic forces around a trap. This results in a non-invertible model, which cannot exploit differential flatness~\cite{Fliess95a}, on which most path following approaches rely. We instead provide a coupling stage for the dynamics of our system and numerically invert the system. This approach produces a trap trajectory $\textbf{u}(t)$ (Figure~\ref{fig:teaser_diagram}(C)) that results in the intended and nearly time-optimal particle motion. That is, $\textbf{u}(t)$ defines the positions and timing of the traps that cause the particle to reveal the target shape $\textbf{q}(\theta)$, according to the capabilities of the actual device, cf.~Figure~\ref{fig:teaser_diagram}(D). In summary, we contribute the first structured numerical approach to compute physically feasible and nearly time-optimal trap trajectories for levitation displays, given only a reference path that the particle should follow. As a core contribution, we provide a theoretical formulation of the problem in terms of path following approaches, allowing optimum timing and device properties (e.g., trap-particle dynamics) to be jointly considered. All the details of the approach we propose are provided in Section~\ref{sec:opt}. We illustrate the potential of our approach by rendering shapes featuring straight lines, sharp corners, and complex shapes, such as those in Figure~\ref{fig:teaser}. We then provide an experimental validation of our approach, demonstrating increases of up to 563\% in the size of rendered objects, up to 150\% in the rendering frequency, and improvements in accuracy (e.g., shape revealed more accurately). While the baseline shapes we compare against require trial and error to determine optimal sizes or frequencies, our approach always yields feasible paths (i.e., working in at least 9 out of 10 attempts) and makes consistent use of accelerations very close to (but not exceeding) the maximum achievable by the device, independently of the target shape. These features allow \emph{OptiTrap} to render complex objects involving sharp edges and significant changes in curvature that have never been demonstrated before. Even more importantly, it provides a tool to systematically explore the range of contents that levitation displays can create, as a key step to exploit their potential. \section{Background and Challenges} \label{sec:prob_stat} \begin{figure*}[!tb] \includegraphics[width=2\columnwidth]{OptiTrap_sampling_strategy.png} \caption{ Three different path timings for the cardioid shape with fixed traversal time: (A) equidistant sampling of the arc length, (B) equidistant sampling of the path parameter~$\theta$, and (C) \emph{OptiTrap}. The corresponding acceleration magnitudes are depicted in (D). Strategy (A) is physically infeasible due to infinite required acceleration at the corner ($\theta=\pi$). Strategy (B) does not share this problem, but requires careful parametrization of the path, while \emph{OptiTrap} (C) yields the timing automatically.} \label{fig:timings} \Description{The figure consists of four subplots. The first three plots show a cardioid shape in two dimentional space. The x-axis denotes the horizontal spatial component from -4 to 4 centimetres and the y-axis the vertical from 8 to 16 centimetres, both at increments of two centimetres. Subplot D shows the acceleration magnitude resulting from the timing strategies from A to C, on a scale from 0 to 1000 metres per seconds squared as a function of the path parameter theta, going from 0 to two pi. The most notable difference in the timing strategies occurs at the sharp corner of the cardioid shape, where the equidistant arc length strategy results in infinite acceleration. } \end{figure*} Our goal is is to minimise complexity for content creators. Thus, given a reference path (i.e., a shape defined by the content creator), our approach must produce physically feasible trap trajectories, which accurately reveal the desired path, while making optimal use of the capabilities of the device. We formalise our content as a reference path $Q$, provided by the content creator without any preassigned time information. It is an explicitly parametrized curve \begin{equation} \label{eq:path} Q:=\{\xi \in \mathbb{R}^3 \mid \theta \in [\theta_{0},\theta_{f}] \mapsto \textbf{q}(\theta) \}, \end{equation} where $\textbf{q}\colon\mathbb{R} \rightarrow \mathbb{R}^3$, as later justified in Section~\ref{ssec:OPT}, must be a twice continuously differentiable function with respect to~$\theta$, which is called the path parameter. Increasing values of~$\theta$ denote forward movement along the path~$Q$. The starting point on the path is $\textbf{q}(\theta_0)$, while $\textbf{q}(\theta_f)$ marks the end of the path. For periodic paths, such as a particle cyclically revealing a PoV shape, $\textbf{q}(\theta_0) = \textbf{q}(\theta_f)$ and $\dot{\textbf{q}}(\theta_0) = \dot{\textbf{q}}(\theta_f)$ hold. Please note that while splines would provide a generic solution to this parametrization (i.e., twice continuously differentiable fitting the points in $Q$), any other parametric functions can be used. For example, taking $\theta\in[0, 2\pi]$ and $r>0$, a cardioid as in Figure~\ref{fig:timings}, can be described by: \begin{equation}\label{eq:cardioid} \textbf{q}(\theta)=(0, r\sin(\theta)(1+\cos(\theta)), -r\cos(\theta)(1+\cos(\theta))+r)^\top. \end{equation} Whatever the approach used, revealing such reference paths typically involves rapid particle movements, as PoV content must be revealed within about $0.1s$~\cite{Bowen74}) and must consider the feasibility of the path (i.e., the trap-particle dynamics, the topology of the trap, and the capabilities of the levitator). This results in the following two main challenges for \emph{OptiTrap}: 1) determining the optimal timing for the particle revealing the path; and 2) computing the trap positions generating the required forces on the particle. \subsection{Challenge 1: Determining an Optimal Path Timing} The reference path $Q$ defines the geometry but not the timing (i.e., it describes \emph{where} the particle needs to be, but not \emph{when} it needs to be there). Our approach must compute such a timing, and the strategy followed will have important implications on the velocity and accelerations applied to the particle and, hence, on the physical feasibility of the content. Different timing strategies and their effects on the feasibility can be illustrated using the cardioid example from~\eqref{eq:cardioid}. Figure~\ref{fig:timings} depicts various timing strategies applied to this shape, all of them traversing the same path in the same overall time. A straight-forward approach would be to sample equidistantly along the path, as shown in Figure~\ref{fig:timings}(A). This works well for lines and circles, where a constant speed can be maintained, but fails at sudden changes in curvature due to uncontrolled accelerations (see the acceleration at the corner of cardioid in Figure~\ref{fig:timings}(D), at $\theta=\pi$). The second example in Figure~\ref{fig:timings}(B) shows a simple equidistant sampling on the path parameter $\theta$. As shown in Figure~\ref{fig:timings}(D), this results in areas of strong curvature naturally involving low accelerations, and can work particularly well for low-frequency path parametrizations in terms of sinusoidals (e.g., \cite{FushimiLimits} showed such sinusoidal timing along straight paths, to theorise optimum/optimistic content sizes). In any case, the quality of the result obtained by this approach will vary depending on the specific shape and parametrization used. As an alternative, the third example shows the timing produced by our approach, based on the shape and capabilities of the device (i.e., forces it can produce in each direction). Please note how this timing reduces the maximum accelerations required (i.e., retains them below the limits of the device), by allowing the particle to travel faster in parts that were unnecessarily slow (e.g., Figure~\ref{fig:timings}(D), at $\theta=\pi$). For the same maximum accelerations (i.e., the same device), this timing strategy could produce larger shapes or render them in shorter times, for better refresh rates. This illustrates the impact of a careful timing strategy when revealing any given reference path. We address this challenge in Section~\ref{ssec:OPT}. \subsection{Challenge 2: Computation of Trap Positions} In addition to the timing, the approach must also compute the location of the traps. Previous approaches \cite{Hirayama19, Plasencia20, FushimiLimits} placed the traps along the shape to be presented, under the implied assumption that the particle would remain in the centre of such trap. However, the location where the traps must be created almost never matches the location of the particle. Acoustic traps feature (almost) null forces at the centre of the trap and high restorative forces around them \cite{Marzo15}. As such, the only way a trap can accelerate a particle is by having it placed at a distance from the centre of the trap. Such trap-particle distances were measured by \cite{Hirayama19} to assess performance achieved during their speed tests. Distortions related to rendering fast moving PoV shapes were also shown in \cite{Fushimi19}. However, none of them considered or corrected for such displacements. Please note the specific displacement between the trap and the particle will depend on several factors, such as the particle acceleration required at each point along the shape, as well as the trap topology (i.e., how forces distribute around it). No assumptions can be made that the traps will remain constrained to positions along or tangential to the target shape. We describe how our approach solves this challenge in Section~\ref{ssec:extract-trap-trajectory}. \section{Related Work} \emph{OptiTrap} addresses the challenges above by drawing from advances in the fields of acoustic levitation and control theory, which we review in this section. \subsection{Acoustic Levitation} Single frequency sound-waves were first observed to trap dust particles in the lobes of a standing wave more than 150 years ago~\cite{Stevens1899}. This has been used to create mid-air displays with particles acting as 3D voxels~\cite{Ochiai14,Omirou15,Omirou16, Sahoo16}, but such standing waves do not allow control of individual particles. Other approaches have included Bessel beams~\cite{Norasikin19}, self-bending beams~\cite{Norasikin18}, boundary holograms~\cite{Inoue19} or near-field levitation~\cite{NearFieldLevitation}. However, most display approaches have relied on the generic levitation framework proposed by~\cite{Marzo15}, combining a focus pattern and a levitation signature. Although several trap topologies (i.e., twin traps, vortex traps or bottle beams) and layouts (i.e., one-sided, two-sided, v-shape) are possible, most displays proposed have adopted a top-bottom levitation setup and twin traps, as these result in highest vertical trapping forces. This has allowed individually controllable particles/voxels~\cite{Marzo19} or even particles attached to other props and projection surfaces for richer types of content~\cite{Morales19, FenderArticulev}. The use of single~\cite{Fushimi19,Hirayama19} or multiple~\cite{Plasencia20} fast moving particles have allowed for dynamic and free-form volumetric content, but is still limited to small sizes and simple vector graphics~\cite{FushimiLimits}. Several practical aspects have been explored around such displays, such as selection~\cite{Freeman18} and manipulation techniques~\cite{Bachynskyi18}, content detection and initialisation~\cite{FenderArticulev} or collision avoidance~\cite{Reynal20}. However, no efforts have been made towards optimising content considering the capabilities (i.e., the dynamics) of such displays, particularly for challenging content such as the one created by PoV high-speed particles. \cite{Hirayama19} showed sound-fields must be updated at very high rates for the trap-particle system to engage in high accelerations, identifying optimum control for rates above 10kHz. However, they only provided a few guidelines (e.g., maximum speed in corners, maximum horizontal/vertical accelerations) to guide the definition of the PoV content. \cite{FushimiLimits} provided a theoretical exploration of this topic, looking at maximum achievable speeds and content sizes, according to the particle sizes and sound frequency used. While the dynamics of the system were considered, these were extremely simplified, using a model of acoustic trap forces and system dynamics that are only applicable for oscillating recti-linear trajectories along the vertical axis of the levitator. \cite{Paneva20} proposed a generic system simulating the dynamics of a top-bottom levitation system. This operates as a forward model simulating the behaviour of the particle given a specific path for the traps, but unlike our approach it does not address the inverse problem. Thus, \emph{OptiTrap} is the first algorithm allowing the definition of PoV content of generic shapes, starting only from a geometric definition (i.e., shape to present, no timing information) and optimising it according to the capabilities of the device and the dynamics of the trap-particle system. \subsection{Path Following and Optimal Control} \label{sec:PFopt} The particle in the trap constitutes a dynamical system, which can be controlled by setting the location of the trap. As such, making the particle traverse the reference path can be seen as an optimal control problem (OCP). In the context of computer graphics, optimal control approaches have been studied particularly in the areas of physics-based character animation~\cite{geijtenbeek12animation} and aerial videography~\cite{nageli2017real}. Such OCPs can be considered as function-space variants of nonlinear programs, whereby nonlinear dynamics are considered as equality constraints. In engineering applications, OCPs are frequently solved via direct discretization~\cite{Stryk93,Bock84}, which leads to finite-dimensional nonlinear programs. In physics-based character animation, such direct solution methods are known as spacetime constraints~\cite{witkin88spacetime, rose96spacetime}. If framed as \emph{a levitated particle along a given geometric reference path (i.e., the PoV shape)}, the problem can be seen as an instance of a path following problem~\cite{Faulwasser12}. Such problems also occur in aerial videography, when a drone is to fly along a reference path~\cite{nageli2017real, roberts16generating}. In order to yield a physically feasible trajectory, it is necessary to adjust the timing along that trajectory. This can be done by computing feed-forward input signals~\cite{Faulwasser12, roberts16generating} or, if the system dynamics and computational resources allow, using closed-loop solutions, such as Model Predictive Control in~\cite{nageli2017real}. However, optimal control of acoustically levitated particles cannot be approached using such techniques. All of the above approaches require {\em differential flatness}~\cite{Fliess95a}. That is, the underlying system dynamics must be invertible, allowing for the problem to be solved by projecting the dynamics of the moving object onto the path manifold~\cite{Nielsen08a}. This inversion approach also enables formulating general path following problems in the language of optimal control, encoding desired objectives (e.g., minimum time, see~\cite{Shin85a, Verscheure09b, ifat:faulwasser14b}). As discussed later in Section~\ref{ssec:model-acoustic-forces}, the distribution of forces around the acoustic trap (i.e., our system dynamics) are not invertible, requiring approaches that have not been widely developed in the literature. We do this by coupling the non-invertible particle dynamics into a virtual system, solvable with a conventional path following approach. We then use these coupling parameters and our model of particle dynamics to solve for the location of the traps. \section{Optimal Control for Levitation Displays}\label{sec:opt} This section provides a description of our \emph{OptiTrap} approach, which automates the definition of levitated content, computing physically feasible and nearly time-optimal trap trajectories using only a reference path as an input. In Section~\ref{ssec:model-acoustic-forces}, we first describe our specific hardware setup and the general mathematical framework, then we consider existing models of the trap-particle dynamics (Subsection~\ref{sssec:exsting-models}), before introducing our proposed model (Subsection~\ref{sssec:our-model}). Next, we describe the two stages in our algorithm, which match the challenges identified in Section~\ref{sec:prob_stat}. That is, Section~\ref{ssec:OPT} describes the computation of optimum timing, approached as an optimal path following problem, while Section~\ref{ssec:extract-trap-trajectory} explains how to compute the trap locations. Please note that Section~\ref{sec:opt} focuses on the general case of presenting levitated content, that is, particles cyclically traversing a reference path (shape) as to reveal it. Other cases, such as a particle accelerating from rest as to reach the initial state (i.e., initial position and speed) required to render the content can be easily derived from the general case presented here, and are detailed in the Supplementary Material S1. \begin{figure}[b] \includegraphics[width=\columnwidth]{OptiTrap_setup.png} \caption{Overview of the components in our setup. We used two opposed arrays of transducers at a distance of 23.9 cm and an OptiTrack system to track the position of levitated particles in real time. } \label{fig:setup} \Description{A photo of equipment. Two square array boards of transducers with dimension 16.8 centimetres are aligned to exactly face each other at a vertical distance of 23.9 centimetres. Two optical motion cameras mounted on the side, are faced towards the volume between the boards.} \end{figure} \subsection{Modelling the Trap-Particle Dynamics}\label{ssec:model-acoustic-forces} We start by describing the model of the trap-particle dynamics used for our specific setup, shown in Figure \ref{fig:setup}. This setup uses two opposed arrays of 16×16 transducers controlled by an FPGA and an OptiTrack tracking system (Prime 13 motion capture system at a frequency of 240Hz). The design of the arrays is a reproduction of the setup in~\cite{Morales21}, modified to operate at 20Vpp and higher update rates of 10kHz. The device generates a single twin-trap using the method described in \cite{Hirayama19}, allowing for vertical and horizontal forces of $4.2\cdot10^{-5}$N and $2.1\cdot10^{-5}$N, respectively, experimentally computed using the linear speed tests in \cite{Hirayama19} (i.e., 10cm paths, binary search with 9 out 10 success ratios, with particle mass $m\approx 0.7\cdot10^{-7}$ kg). Note the substantial difference between the maximum forces in the vertical and horizontal directions. Our approach will need to remain aware of direction as this determines maximum accelerations. In general, the trap-particle dynamics of such system can be described by simple Newtonian mechanics, i.e., \begin{equation}\label{eq:system} m\ddot{\textbf{p}}(t) = F(\textbf{p}(t),\dot{\textbf{p}}(t),\textbf{u}(t)). \end{equation} Here, $\textbf{p}(t)=(p_x, p_y, p_z)^\top \in \mathbb{R}^3$ represents the particle position in Cartesian $(x,y,z)$ coordinates at time $t\in\mathbb{R}_0^+$, and $\dot{\textbf{p}}(t)$ and $\ddot{\textbf{p}}(t)$ are the velocity and acceleration of the particle, respectively. The force acting on the particle is mostly driven by the acoustic radiation forces and, as such, drag and gravitational forces can be neglected \cite{Hirayama19}. Therefore, the net force acting on the particle will depend only on $\textbf{p}(t)$ and on the position of the acoustic trap at time $t$ denoted by $\textbf{u}(t)=(u_x(t),u_y(t),u_z(t))^\top\in\mathbb{R}^3$. As a result, our approach requires an accurate and ideally invertible model of the acoustic forces delivered by an acoustic trap. That is, we seek an accurate model predicting forces at any point around a trap only in terms of $\textbf{u}(t)$ and $\textbf{p}(t)$. Moreover, an invertible model would allow us to analytically determine where to place the trap as to produce a specific force on the particle given the particle location. For spherical particles considerably smaller than the acoustic wavelength and operating in the far-field regime, such as those used by our device, the acoustic forces exerted can be modelled by the gradient of the Gor'kov potential~\cite{Bruus2012}. This is a generic model, suitable to model acoustic forces resulting from any combination of transducer locations and transducer activations, but it also depends on all these parameters, making it inadequate for our approach. Our case, using a top-bottom setup and vertical twin traps is much more specific. This allows for simplified analytical models with forces depending only on the relative position of the trap and the particle, which we compare to forces as predicted from the Gor'kov potential in Figure~\ref{fig:modelForces}. \subsubsection{Existing Models of the Trap-Particle Dynamics}\label{sssec:exsting-models} \begin{figure}[!tb] \includegraphics[width=\columnwidth]{OptiTrap_F_max.png} \caption{Analytical models of horizontal (A) and vertical (B) acoustic forces around a trap. The plots on the left show forces along the main axes X and Z, and analytical models provide a good fit. The plots on the right show horizontal (A) and vertical (B) forces across 2D slices through the trap centre along the X and Z axes. Spring and Sinusoidal models fail to predict forces outside the main axes, while our proposed model provides accurate reconstruction within the region of interest (highlight).} \label{fig:modelForces} \Description{Two subplots A and B showing the acoustic force on the y-axis going from F maximum to F minimum, as a function of the displacement between the acoustic trap and the particle, ranging from -0.01 to 0.01 metres. } \end{figure} Simple \emph{spring} models have been used extensively \cite{Paneva20, Fushimi18Nonlin, FushimiLimits}, modelling trapping forces according to a \emph{stiffness} parameter $\mathcal{K}_i$, that is, with forces being proportional to the distance of the particle to the centre of the trap: \begin{equation*} F_i(\textbf{p},\textbf{u}) := \mathcal{K}_i \cdot |u_i-p_i|, \quad i \in \{x,y,z\}. \end{equation*} Such models are usually refined by providing specific stiffness values for each dimension, but they are only suitable for particles remaining in close proximity to the centre of the trap, i.e., the linear region near the centre of the trap. As a result, \emph{spring} models are only accurate for systems moving particles slowly, requiring low acceleration and forces (so that particles remain within the linear region). \emph{Sinusoidal} models have been proposed as an alternative~\cite{Fushimi18Nonlin,FushimiLimits}, providing accurate fitting from the centre of the trap to the peaks of the force distribution in Figure~\ref{fig:modelForces}, according to the peak trapping force $\mathcal{A}_i$ and characteristic frequency $\mathcal{V}_i$: \begin{equation*} F_i(\textbf{p},\textbf{u}) := \mathcal{A}_i \cdot \sin(\mathcal{V}_i \cdot (u_i-p_i)), \quad i \in \{x,y,z\}, \end{equation*} However, both of these models (i.e., \emph{spring} and \emph{sinusoidal}) are only suitable for particles placed along one of the main axes of the acoustic trap, not for particles arbitrarily placed at any point around it. This is illustrated on the right of Figure~\ref{fig:modelForces}, which provides an overview of how forces distribute on a horizontal and vertical 2D plane around a trap, according to each model (i.e., Gor'kov, \emph{spring}, \emph{sinusoidal}, and \emph{Ours}, detailed in the next subsection). Please note how the three previous models show good matching along the horizontal and vertical axes (represented as blue and red lines). However, the \emph{spring} and \emph{sinusoidal} models are of one-dimensional nature (e.g., force $F_x$ only depends on X distance $(u_x-p_x)$) and become inaccurate at points deviating from the main axes. \subsubsection{Our Model} \label{sssec:our-model} The complexity of the force distribution modelled by the Gor'kov potential increases as the distance to the centre of the trap increases. However, we only need to derive a model allowing us to predict where to place the trap to produce a specific force on the particle. This allows us to limit our considerations to the region corresponding to the peaks designated by $\mathcal{A}_r$ and $\mathcal{A}_z$ in Figure~\ref{fig:modelForces}. For points within this region, forces around twin traps distribute in a mostly \emph{axis-symmetric} fashion, which can be approximated as: \begin{subequations}\label{eq:FrFz} \begin{align} F_r(\textbf{p},\textbf{u}) :=\ & \mathcal{A}_r \cdot \cos\left(\mathcal{V}_z \cdot {(u_z-p_z)}\right) \cdot \\ &\sin\left(\mathcal{V}_{xr} \cdot {\sqrt{(u_x-p_x)^2+(u_y-p_y)^2}}\right), \notag \\ F_z(\textbf{p},\textbf{u}) :=\ & \mathcal{A}_z \cdot \sin\left(\mathcal{V}_z \cdot (u_z-p_z)\right) \cdot \\ & \cos\left(\mathcal{V}_{zr} \cdot \sqrt{(u_x-p_x)^2+(u_y-p_y)^2}\right), \notag \end{align} \end{subequations} where $\mathcal{A}_r, \mathcal{A}_z$ represent peak trapping forces along the radial and vertical directions of the trap, respectively. $\mathcal{V}_z$, $\mathcal{V}_{xr}$, $\mathcal{V}_{zr}$ represent characteristic frequencies of the sinusoidals describing how the forces evolve around the trap. The resulting forces can be converted into acoustic forces in 3D space from these cylindrical coordinates, with azimuth $\phi = \arctan ((u_y-p_y)/(u_x-p_x))$: \begin{equation} \label{eq:Facou} F(\textbf{p},\textbf{u}) = \begin{pmatrix} F_x(\textbf{p},\textbf{u}) \\ F_y(\textbf{p},\textbf{u}) \\ F_z(\textbf{p},\textbf{u}) \end{pmatrix} := \begin{pmatrix} F_r(\textbf{p},\textbf{u}) \cos\phi \\ F_r(\textbf{p},\textbf{u}) \sin\phi \\ F_z(\textbf{p},\textbf{u}) \end{pmatrix}. \end{equation} We validated our model by comparing its accuracy against the forces predicted by the gradient of the Gor'kov potential. More specifically, we simulated 729 single traps homogeneously distributed across the working volume of our levitator (i.e., 8x8x8cm, in line with \cite{Hirayama19, Fushimi19}), testing 400 points around each trap for a total of 400x729 force estimations. \begin{table}[t] \caption{Fit parameters for the Spring, Sinusoidal and Axis-symmetric models and the respective average relative errors when compared to Gor'kov.} \centering \begin{tabular}{ |c|c|c|c|c|c|c|} \hline Model & \multicolumn{2}{|c|}{Spring}& \multicolumn{2}{|c|}{Sinusoidal}& \multicolumn{2}{|c|}{Axis-symmetric} \\ \hline \multirow{6}{*}{Fit}&$\mathcal{K}_x$&-0.0071&$\mathcal{A}_x$ &0.00009 &$\mathcal{A}_r$ & 0.0004636\\ &$\mathcal{K}_y$ & -0.0071&$\mathcal{A}_y$ &0.00009 &$\mathcal{A}_z$ & 0.0002758\\ &$\mathcal{K}_z$&-0.94&$\mathcal{A}_z$ &-0.0019 &$\mathcal{V}_z$ & 1307.83\\ & & &$\mathcal{V}_x$ &-68.92 &$\mathcal{V}_{xr}$ & -476.49\\ &&&$\mathcal{V}_y$ &-68.92 &$\mathcal{V}_{zr}$ & 287.87\\ & & &$\mathcal{V}_z$ &1307.83 &&\\ \hline Error & \multicolumn{2}{|c|}{63.3\%}& \multicolumn{2}{|c|}{35.9\%}& \multicolumn{2}{|c|}{4.3\%} \\ \hline \end{tabular} \label{table:fit_parameters} \end{table} Table~\ref{table:fit_parameters} summarises the error distribution achieved by these three models when compared to Gor'kov, showing an average relative error as low as 4\% for our model and much poorer fitting for the other two models. Full details and raw data used in this validation can be found in the Supplementary Material S2. As a final summary, this results in a model for our trap-particle dynamics that only depends on $\textbf{p}$ and $\textbf{u}$ and which fits the definition of a second-order ordinary differential equation: \begin{equation}\label{eq:system_acoustic} m\ddot{\textbf{p}}(t) = F(\textbf{p}(t),\textbf{u}(t)). \end{equation} While the resulting model is accurate (4\% relative error), we note that it is not invertible, which will complicate the formulation of our solution approach. For instance, for a particle at $\textbf{p}=(0,0,0)$, force $F(\textbf{p},\textbf{u}) = (0,0, \mathcal{A}_z \cdot \cos\left(\mathcal{V}_{zr} \cdot x \right))$ can be obtained with either $\textbf{u}= (x, 0, \pi/(2\mathcal{V}_z))$ or $\textbf{u}= (-x, 0, \pi/(2\mathcal{V}_z))$. \subsection{Open-Loop Optimal Path Following} \label{ssec:OPT} This section computes the timing for the particle, so that it moves along the given reference path $Q$ from~\eqref{eq:path} in minimum time and according to the dynamics of the system. We approach this as an open-loop (or feed-forward) path following problem, as typically done in robotics~\cite{Faulwasser12}. That is, we design an optimal control problem that computes the timing $t \mapsto\theta(t)$ as to keep the levitated particle on the prescribed path, to traverse the path in optimum (minimum) time while considering the trap-particle dynamics (i.e., minimum \emph{feasible} time). Our non-invertible model of particle dynamics calls for a more complex treatment of the problem, which we split in two parts. In the first part we derive a virtual system for the timing law, which we describe as a system of first-order differential equations, solvable with traditional methods. In the second part we couple the timing law with our non-invertible dynamics, introducing auxiliary variables that will later enable pseudo-inversion (i.e., to compute trap placement for a given force) as described in Section~\ref{ssec:extract-trap-trajectory}. \subsubsection{Error Dynamics and the Timing Law.}\label{sssec:OPT_timing} The requirement that the particle follows the path $Q$ exactly and for all times means that the deviation from the path equals zero for all $t\in\mathbb{R}^+_0$, i.e., \[ \textbf{e}(t) := \textbf{p}(t) -\textbf{q}(\theta(t)) \equiv 0. \] If the path deviation $\textbf{e}(t)$ is $0$ during the whole interval $[t_0, t_1]$, this implies that the time derivatives of $\textbf{e}(t)$ also have to vanish on $(t_0, t_1)$. Considering this (i.e., $\dot e(t)\equiv 0$ and $\ddot e(t)\equiv 0$) results in: \begin{subequations}\label{eq:dpath_para} \begin{align} \textbf{p}(t) &=\textbf{q}(\theta(t)), \label{eq:dpath_dpara0} \\ \dot{\textbf{p}}(t)&=\dot{\textbf{q}}(\theta(t))=\frac{\partial \textbf{q}}{\partial \theta}\dot{\theta}(t),\\ \ddot{\textbf{p}}(t)&= \ddot{\textbf{q}}(\theta(t))=\frac{\partial^2 \textbf{q}}{\partial \theta^2}\dot{\theta}(t)^2+\frac{\partial \textbf{q}}{\partial \theta}\ddot{\theta}(t). \label{eq:dpath_dpara_2} \end{align} \end{subequations} Thus, for particles on the path~$Q$, system dynamics of the form~\eqref{eq:system_acoustic}, and provided we are able to express $\textbf{u}$ as a function of $\textbf{p}$ and $\ddot{\textbf{p}}$ (i.e., the system inversion described in Section~\ref{sec:PFopt}), the position, the velocity, and the acceleration of the particle can be expressed via $\theta, \dot\theta, \ddot\theta$, respectively. For details, a formal derivation, and tutorial introductions we refer to~\cite{Faulwasser12,epfl:faulwasser15c}. Observe that in~\eqref{eq:dpath_para} the partial derivatives $\frac{\partial^2 \textbf{q}}{\partial \theta^2}$ and $\frac{\partial \textbf{q}}{\partial \theta}$, as well as $\dot\theta$ and~$\ddot\theta$ appear. This leads to two additional observations: First, the parametrisation $\textbf{q}$ from~\eqref{eq:path} should be at least twice continuously differentiable with respect to $\theta$, so that the partial derivatives are well-defined. This justifies our constraint in Section~\ref{sec:prob_stat}. Please note this does not rule out corners in the path~$Q$, as shown by the parametrisation~\eqref{eq:cardioid} of the cardioid. Second, the time evolution of $\theta$ should be continuously differentiable, as otherwise large jumps can occur in the acceleration. To avoid said jumps, we generate the timing $t\mapsto \theta(t)$ via the double integrator \begin{equation}\label{eq:timingLaw} \ddot\theta(t) = v(t), \end{equation} where $v(t) \in \mathbb{R}$ is a computational degree of freedom, used to control the progress of the particle along~$Q$. The function $v(t)$ enables us to later cast the computation of time-optimal motions along reference paths as an OCP, see~\eqref{eq:OCP2}. The in-homogeneous second-order ordinary differential equation~\eqref{eq:timingLaw} takes care of jumps, but needs to be augmented by conditions on~$\theta$ and~$\dot{\theta}$ at initial time $t=0$ and final time $t=T$. This is done to represent the periodic nature of our content (i.e., the particle reveals the same path many times per second): \begin{equation}\label{eq:timingLaw_bc} \theta(0)=\theta_0, \quad \theta(T)=\theta_f, \quad \dot{\theta}(0)=\dot{\theta}(T), \end{equation} where $\theta_0$ and $\theta_f$ are taken from~\eqref{eq:path} and the total time~$T$ will be optimally determined by the OCP. The first two equations in~\eqref{eq:timingLaw_bc} ensure that the path~$Q$ is fully traversed, while the third one ensures the speeds at the beginning and end of the path match. With these additional considerations, we define the (state) vector $\textbf{z}(t):=(\theta(t), \dot{\theta}(t))^\top$, which finally allows us rewrite our second-order differential equations in~\eqref{eq:timingLaw} as a system of first-order differential equations: \begin{equation} \label{eq:dz_dt} \dot{\textbf{z}}(t)= \begin{pmatrix} 0&1\\ 0&0 \end{pmatrix}\textbf{z}(t)+\begin{pmatrix} 0\\ 1 \end{pmatrix}v(t), \quad \textbf{z}(0)=\textbf{z}_0, ~\textbf{z}(T) = \textbf{z}_T. \end{equation} Please note that \eqref{eq:dz_dt} is an equivalent \emph{virtual} system to~\eqref{eq:timingLaw} and~\eqref{eq:timingLaw_bc}, solvable using standard Runge-Kutta methods~\cite{butcher2016numerical}. The system~\eqref{eq:dz_dt} is suitable to generate the timing law, but the particle dynamics~\eqref{eq:system_acoustic} still need to be included, as described next. \subsubsection{Coupling of non-invertible particle dynamics:}\label{sssec:OPT_trap_placement} To include the particle dynamics~\eqref{eq:system_acoustic} in the computation of the timing, we need to couple them with the system~\eqref{eq:dz_dt}. The typical approach is to rewrite~\eqref{eq:system_acoustic} as: \begin{equation}\label{eq:M_implicit} M(\ddot{\textbf{p}}(t), {\textbf{p}}(t), {\textbf{u}}(t)):= m\ddot{\textbf{p}}(t) - F(\textbf{p}(t),\textbf{u}(t)) = 0 \end{equation} and make sure that this equation locally admits an inverse function: \begin{equation} \label{eq:invModel} {\textbf{u}}(t) = M^{-1}(\ddot{\textbf{p}}(t), {\textbf{p}}(t)), \end{equation} This would allow us to easily compute the location of our traps. However, such inversion is not straightforward for our model, and to the best of our knowledge, standard solution methods do not exist for such cases. We deal with this challenge by introducing constraints related to our particle dynamics. These will allow us to compute feasible timings while delaying the computation of the exact trap location to a later stage in the process. More specifically, we introduce auxiliary variables~$\zeta_1,...,\zeta_6$ for each trigonometric term in the force~$F$, and we replace $p_i = q_i(\theta)$ for $i \in \{x,y,z\}$ (i.e., particle position exactly matches our reference path): \begin{subequations}\label{eq:zeta} \begin{align} \zeta_1 &= \sin\left(\mathcal{V}_{xr} {\sqrt{(u_x-q_x(\theta))^2+(u_y-q_y(\theta))^2}}\right),\\ \zeta_2 &= \cos\left(\mathcal{V}_z \cdot {(u_z-q_z(\theta)}\right),\\ \zeta_3 &= \sin\left(\mathcal{V}_z \cdot {(u_z-q_z(\theta)}\right), \\ \zeta_4 &= \cos\left(\mathcal{V}_{zr} {\sqrt{(u_x-q_x(\theta))^2+(u_y-q_y(\theta))^2}}\right),\\ \zeta_5 &= \sin\phi,\\ \zeta_6 &= \cos\phi. \end{align} \end{subequations} With this, we are now able to formally express the force~\eqref{eq:Facou} in terms of $\zeta:=(\zeta_1,...,\zeta_6)$, i.e., \begin{equation} \tilde{F}(\zeta) := \begin{pmatrix} \mathcal{A}_r \zeta_1\zeta_2 \zeta_6 \\ \mathcal{A}_r \zeta_1\zeta_2 \zeta_5\\ \mathcal{A}_z \zeta_4\zeta_3 \end{pmatrix}. \end{equation} Using these auxiliary variables, we can now couple the trap-particle dynamics~\eqref{eq:system_acoustic} with the virtual system~\eqref{eq:dz_dt}. To this end, similar to~\eqref{eq:M_implicit}, we define the following constraint along path~$Q$: \begin{equation} \widetilde M(\theta(t), \dot\theta(t), v(t), \zeta(t)) := m\ddot{\textbf{q}}(\theta(t)) - \tilde{F}({\zeta}(t)) = 0. \end{equation} Observe that i) we need~$\dot{\theta}(t)$ due to~\eqref{eq:dpath_dpara_2}; and ii) $\ddot{\theta}(t)$ can be replaced by~$v(t)$ due to~\eqref{eq:timingLaw}. Finally, combining this with the prior first-order differential system allows us to conceptually formulate the problem of computing a minimum-time motion along the path~$Q$ as: \begin{equation}\label{eq:OCP2} \begin{aligned} \min_{v,T, \zeta}&~T + \gamma\int_0^T v(t)^2 \mathrm{d}t \\ \text{subject to}& \\ \dot{\textbf{z}}(t)&= \begin{pmatrix}0&1\\0&0\end{pmatrix}\textbf{z}(t)+\begin{pmatrix} 0\\1\end{pmatrix}v(t), \quad \textbf{z}(0) =\textbf{z}_0, ~\textbf{z}(T) = \textbf{z}_T, \\ 0&=\widetilde M(\textbf{z}(t), v(t), \zeta(t)), \\ \zeta(t)&\in [-1,1]^6. \end{aligned} \end{equation} The constraint on $\zeta(t)$ is added since the trigonometric structure of~\eqref{eq:zeta} is not directly encoded in the OCP, while $\gamma\geq 0$ is a regularisation parameter. \begin{figure}[tb] \includegraphics[width=1\columnwidth]{OptiTrap_gamma_comparison.png} \caption{Effect of the regularisation parameter $\gamma$ on the position of the optimised traps. } \label{fig:gamma_comparison} \Description{Three subplots A, B and C show a cardioid shape in two dimensional space. The x-axis shows the horizontal spatial component from -5 to 5 centimetres, at steps of 5, while the y-axis shows the vertical from 8 to 16 centimetres, at steps of 4. Subplot A shows the computed trap positions when the regularisation parameter gamma is low. Sudden jumps at the highest and lowest vertical position, as well as at the sharp edge of the shape are highlighted.} \end{figure} The case~$\gamma=0$ corresponds to strictly minimising time, which typically leads to an aggressive use of the forces around the trap. The example in Figure \ref{fig:gamma_comparison}(A) shows the trap accelerating the particle before arriving at the corner, then applying aggressive deceleration before it reaches the corner. At the top and bottom of the shape, again the particle is accelerated strongly, then it is suddenly decelerated by the traps placed behind it, in order to move around the curve. This would be the optimum solution in an ideal case (i.e., a device working \emph{exactly} as per our model), but inaccuracies in the real device can make them unstable. Moreover, we observed the overall reductions in rendering time to usually be quite small. The regularisation ($\gamma>0$) enables \emph{nearly} time-optimal solutions. More specifically, this is a strictly convex regularisation that penalises high magnitudes of the virtual input $v = \ddot{\theta}$. This is most closely related to the accelerations applied to the particle, hence avoiding aggressive acceleration/deceleration as shown in Figures~\ref{fig:gamma_comparison}(B) and (C). Several heuristics could be proposed to automate selection of a suitable value for $\gamma$ (e.g., use smallest $\gamma$ ensuring that the dot product of $\dot{\textbf{p}}(t)$ and $\dot{\textbf{u}}(t)$ remains always positive), but this step is considered beyond the scope of the current paper. Note that the OCP in~\eqref{eq:OCP2} yields the (nearly) optimal timing along the path~$Q$, respecting the particle dynamics and hence solving \emph{Challenge 1}. More\-over, it yields the required forces through $\zeta(t)$. However, it does not give the trap trajectory~$\textbf{u}(t)$ that generates these forces. To obtain the trap trajectory and thus solve \emph{Challenge~2}, we refine~\eqref{eq:OCP2} in the following section. \subsection{Computing the Trap Trajectory}\label{ssec:extract-trap-trajectory} The second stage in our approach deals with \emph{Challenge 2}, computing the trap trajectory~$\textbf{u}(t)$ based on the solution of~\eqref{eq:OCP2}. In theory, we would use the values for $\zeta_i(t)$, $i=1,...,6$ and $q_j(\theta(t))$, $j\in\{x,y,z\}$ to determine the particle position and force required at each moment in time, obtaining the required trap position~$\textbf{u}(t)$ by solving~\eqref{eq:zeta}. In practice, solving~$\textbf{u}(t)$ from~\eqref{eq:zeta} numerically is not trivial, particularly for values of $\zeta_i$ close to $\pm 1$, where numerical instabilities could occur, particularly for $\zeta_1$ and $\zeta_4$. We attenuate these difficulties by providing further structure to the OCP~\eqref{eq:OCP2}, specifically regarding~$\zeta$: \begin{equation}\label{eq:zeta_trig_pythagoras} \zeta_2^2+\zeta_3^2 = 1, \quad \zeta_5^2+\zeta_6^2 = 1. \end{equation} We also constrain the solvability of~\eqref{eq:zeta} by using a constant back-off $\varepsilon\in\interval[open]{0}{1}$ in order to avoid numerical instabilities: \begin{equation}\label{eq:consistConstraints} -1+\varepsilon \leq \zeta_i \leq 1-\varepsilon, \quad i=1,...,6. \end{equation} For the sake of compact notation, we summarise the above constraints in the following set notation \begin{equation} \mathcal{Z} := \left\{\zeta \in \mathbb{R}^6 ~ | ~\eqref{eq:zeta_trig_pythagoras} \text{ and } \eqref{eq:consistConstraints} \text{ are satisfied}\right\}. \end{equation} The final OCP is then given by \begin{equation}\label{eq:OCP3} \begin{aligned} \min_{v,T, \zeta}&~T + \gamma\int_0^T v(t)^2 \mathrm{d}t \\ \text{subject to}& \\ \dot{\textbf{z}}(t)&= \begin{pmatrix}0&1\\0&0\end{pmatrix}\textbf{z}(t)+\begin{pmatrix} 0\\1\end{pmatrix}v(t), \quad \textbf{z}(0) =\textbf{z}_0, ~\textbf{z}(T) = \textbf{z}_T, \\ 0&=\widetilde M(\textbf{z}(t), v(t), \zeta(t)), \\ \zeta(t)&\in \mathcal{Z}. \end{aligned} \end{equation} Finally, given $\zeta(t) \in \mathcal{Z}$ and $\theta(t)$ from the solution of~\eqref{eq:OCP3}, we numerically solve~\eqref{eq:zeta} for $u_i$, $i\in\{x,y,z\}$, using Powell's dog leg method~\cite{Mangasarian94}. Please note that higher values of $\varepsilon$ will limit the magnitudes of the forces exploited by our approach. A simple solution is to perform a linear search over $\varepsilon$, only increasing its value and recomputing the solution if Powell's method fails to converge to a feasible trap location. For details on discretising the OCP~\eqref{eq:OCP3}, we refer to the Supplementary Material S3. \section{Evaluation} \label{sec:eval} This section evaluates the capability of our algorithm to support content creation by generating physically feasible trap trajectories given only a reference path (i.e., a shape) as an input. We select a range of shapes and analyse the effects each step in our approach has on the final achievable size, rendering frequency, and reconstruction error, for each shape. We also inspect how these steps influence the presence of visual distortions in the end result. Finally, we analyse the resulting acceleration profiles. \begin{figure}[b] \includegraphics[width=\columnwidth]{OptiTrap_evaluation_shapes.png} \caption{Test shapes used for evaluation, as rendered by our \emph{OptiTrap} approach. The circle (A) provides a trivial timing case. The cardioid (B) and squircle (C) represent simple shapes featuring sharp corners and straight lines. The fish (D) is used as an example of composite shape featuring corners, straight lines, and curves.} \label{fig:EvalShapes} \Description{The image consists of four photos A, B, C and D. The photos show illuminated outlines of the different shapes rendered by the levitation interface in mid-air.} \end{figure} \subsection{Test Shapes} \label{ssec:eval_test_shapes} We used four test shapes for the evaluation: a circle, a cardioid, a squircle, and a fish, all shown in Figure~\ref{fig:EvalShapes}. The circle is selected as a trivial case in terms of timing. It can be optimally sampled by using a constant angular speed (i.e., constant acceleration), and is there to test whether our solution converges towards such optimum solutions. The cardioid and squircle represent simple shapes featuring sharp corners (cardioid) and straight lines (squircle), both of them challenging features. Finally, the fish is selected as an example composite shape, featuring all elements (i.e., corners, straight lines, and curves). All of these shapes can be parameterised by low-frequency sinusoids (see Supplementary Material S4), ensuring the path parameter~$\theta$ progresses slowly in areas of high curvature. This provides a good starting point for our baseline comparison that we explain in Section~\ref{ssec:eval_conditions}. While our approach works for content in 3D, we perform the evaluation on shapes in a 2D plane of the 3D space to facilitate the analysis of accelerations in Section~\ref{ssec:eval_accelerations}, which we will perform in terms of horizontal and vertical accelerations (i.e., the independent factors given our axis-symmetric model of forces), allowing us to validate \emph{OptiTrap}'s awareness of particle directions and how close it can get to the maximum accelerations allowed by the dynamics of acoustic traps, as discussed in Section~\ref{ssec:model-acoustic-forces}. Notice in Figure~\ref{fig:EvalShapes}, that due to the timing differences, different shape elements exhibit different levels of brightness. To obtain homogeneous brightness along the shape, please refer to the solution proposed by \cite{Hirayama19}, where the particle illumination is adjusted to the particle speed. \subsection{Conditions Compared} \label{ssec:eval_conditions} We compare three approaches to rendering levitated shapes, where each approach subsequently addresses one of the challenges introduced in Section~\ref{sec:prob_stat}. This will help us assess the impact that each challenge has on the final results obtained. The first condition is a straight-forward \emph{Baseline}, with homogeneous sampling of the path parameter, which matches the example strategy shown in Figure~\ref{fig:timings}(B), and placing traps where the particle should be. The \emph{Baseline} still does not address any of the challenges identified (i.e., optimum timing or trap placement), but it matches approaches used in previous works \cite{Hirayama19, Plasencia20, FushimiLimits} and will illustrate their dependence on the specific shape and initial parametrisation used. The second condition, \emph{OCP\_Timing}, makes use of our \emph{OptiTrap} approach to compute optimum and feasible timing (see Subsection~\ref{sssec:OPT_timing}), but still ignores \emph{Challenge 2}, assuming that particles match trap location (i.e., it skips Subsection~\ref{sssec:OPT_trap_placement}). The third condition is the full \emph{OptiTrap} approach, which considers feasibility and trap-particle dynamics and deals with both the timing and trap placement challenges. These conditions are used in a range of comparisons involving size, frequency, reconstruction error as well as comparative analysis of the effects of each condition on the resulting particle motion, detailed in the following sections. \subsection{Maximum Achievable Sizes} \label{ssec:eval_sizes} This section focuses on the maximum sizes that can be achieved for each test shape and condition, while retaining an overall rendering time of 100ms\footnote{The circle rendered at 100ms would exceed the size of our device's working volume. Thus, this shape was rendered at 67ms.} (i.e., PoV threshold). For each of these cases, we report the maximum achievable size and reliability, which were determined as follows. Maximum size is reported in terms of shape width and in terms of meters of \emph{content per second} rendered \cite{Plasencia20}, and their determination was connected to the feasibility of the trap trajectories, particularly for the \emph{Baseline} condition. \begin{table*} \caption{Maximum shape width and meters of content per second achieved with the \emph{Baseline}, \emph{OCP\_Timing}, and \emph{OptiTrap} approach at constant rendering frequency. Successful trials out of 10.} \centering \begin{tabular}{ c|c|c|c|c|c|c|c|c|c|c|c|} \cline{3-12} \multicolumn{2}{c}{}&\multicolumn{3}{|c}{\emph{Baseline}}& \multicolumn{3}{|c}{\emph{OCP\_Timing}}&\multicolumn{3}{|c|}{\emph{OptiTrap}}&\multicolumn{1}{c|}{Increase }\\ \cline{1-11} \multicolumn{1}{|l|}{Shape} &Freq.& Width & Content per & Success & Width & Content per& Success & Width & Content per& Success & in Width w.r.t.\\ \multicolumn{1}{|l|}{} & (Hz) & (cm) & Second (m)& Rate & (cm) & Second (m)& Rate& (cm) & Second (m)& Rate &the \emph{Baseline}\\ \hline \multicolumn{1}{|l|}{Circle} & 15& 7.00& 3.30 & 10/10&7.00 & 3.30 & 10/10 &7.00 & 3.30 & 10/10 & 0\% \\ \hline \multicolumn{1}{|l|}{Cardioid} &10 & 8.05 & 2.48& 10/10& 9.09& 2.80& 10/10 & 9.09 &2.80 & 10/10 &12.9\% \\ \hline \multicolumn{1}{|l|}{Squircle} &10& 0.80& 0.29 & 9/10&5.30& 1.90 & 10/10 & 5.30& 1.90 & 10/10 & 562.5\%\\ \hline \multicolumn{1}{|l|}{Fish} &10& 7.77& 2.42 & 10/10&8.76 & 2.75 &10/10 &8.76& 2.75 & 10/10 & 12.7\% \\ \hline \end{tabular} \label{table:shape_sizes_results} \end{table*} More specifically, we determined maximum feasible sizes for the \emph{Baseline} condition by conducting an iterative search. That is, we increased the size at each step and tested the reliability of the resulting shape. We considered the shape feasible if it could be successfully rendered at least 9 out of 10 times in the actual levitator. On a success, we would increase size by increasing the shape width by half a centimetre. On a failure, we would perform a binary search between the smallest size failure and the largest size success, stopping after two consecutive failures and reporting the largest successful size. This illustrates the kind of trial and error that a content designer would need to go through without our approach and it was the most time consuming part of this evaluation. For the other two conditions (i.e., \emph{OCP\_Timing} and \emph{OptiTrap}), maximum sizes could be determined without needing to validate their feasibility in the final device. Again, we iteratively increased the shape size using the same search criteria as before (i.e., 5mm increases, binary search). We assumed any result provided would be feasible (which is a reasonable assumption; see below) and checked the resulting total rendering time, increasing the size if the time was still less than 100ms. At each step, a linear search was used, iteratively increasing $\varepsilon$, until feasible trap locations could be found (i.e., equation~\eqref{eq:zeta} could be solved without numerical instabilities). Adjusting the value of the regularisation parameter $\gamma$ was done by visually inspecting the resulting trap trajectories, until no discontinuities could be observed (see Figure \ref{fig:gamma_comparison}). Please note that this is a simple and quick task, which, unlike the \emph{Baseline} condition, does not involve actual testing on the levitation device and could even be automated. All solutions provided can be assumed feasible, and the designer only needs to choose the one that better fits their needs. Once the maximum achievable sizes were determined, these were tested in the actual device. We determined the feasibility of each shape and condition by conducting ten tests and reporting the number of cases where the particle succeeded to reveal the shape. This included the particle accelerating from rest, traversing/revealing the shape for 6 seconds and returning to rest. Table \ref{table:shape_sizes_results} summarises the results achieved for each test shape and condition. First of all, it is worth noting that all trials were successful for \emph{OptiTrap} and \emph{OCP\_Timing} approaches, confirming our assumption that the resulting paths are indeed feasible and underpinning \emph{OptiTrap}'s ability to avoid trial and error on the actual device during content creation. The results and relative improvements in terms of size vary according to the particular condition and shape considered. For instance, it is interesting to see that all conditions yield similar final sizes for the circle, showing that \emph{OptiTrap} (and \emph{OCP\_Timing}) indeed converge towards optimum solutions. More complex shapes where the \emph{Baseline} parametrisation is not optimal (i.e., cardioid, squircle, and fish), show increases in size when using \emph{OCP\_Timing} and \emph{OptiTrap}. More interestingly, the increases in size vary greatly between shapes, showing increases of around $12\%$ for the fish and cardioid, and up to $562\%$ for the squircle. This is the result of the explicit parametrisation used, with reduced speeds at corners in the fish and cardioid cases, but not in the case of the squircle. It is also interesting to see that \emph{OCP\_Timing} and \emph{OptiTrap} maintain high values of \emph{content per second} rendered, independently of the shape. That is, while the performance of the \emph{Baseline} approach is heavily determined by the specific shape (and parametrisation) used, the OCP-based approaches (\emph{OCP\_Timing} and \emph{OptiTrap}) yield results with consistent \emph{content per second}, determined by the capabilities of the device (but not so much by the specific shape). Finally, please note that no changes in terms of maximum size can be observed between \emph{OCP\_Timing} and \emph{OptiTrap}. \subsection{Maximum Rendering Frequencies} \label{ssec:eval_frequencies} \begin{table}[b] \caption{Maximum rendering frequencies achieved with the \emph{Baseline}, \emph{OCP\_Timing}, and \emph{OptiTrap} approach, for shapes of equal size. Successful trials out of 10.} \centering \begin{tabular}{ c|c|c|c|c|c|c|} \cline{2-7} &\multicolumn{2}{c|}{\emph{Baseline}}&\multicolumn{2}{c}{\emph{OCP\_Timing}}&\multicolumn{2}{|c|}{\emph{OptiTrap}}\\ \cline{1-7} \multicolumn{1}{|l|}{Shape}& Freq. & Success & Freq. & Success &Freq. & Success \\ \multicolumn{1}{|l|}{} & (Hz)& Rate& (Hz)& Rate& (Hz)& Rate \\ \hline \multicolumn{1}{|l|}{Circle} &15 & 10/10 & 15 &10/10 & 15 & 10/10 \\ \hline \multicolumn{1}{|l|}{Cardioid}& 8 & 10/10 & 10 &10/10 &10 & 10/10 \\ \hline \multicolumn{1}{|l|}{Squircle} & 4 & 10/10 & 10 &10/10 &10 & 10/10 \\ \hline \multicolumn{1}{|l|}{Fish} & 9 & 9/10& 10 &10/10 &10 & 10/10\\ \hline \end{tabular} \label{table:shape_frequency_results} \end{table} In this second evaluation, we assessed the effect of the timing strategy on the maximum achievable rendering frequencies. To do this, we selected the maximum achievable sizes obtained in the prior evaluation for each shape. We then reproduced such sizes with the \emph{Baseline} approach, searching for the maximum frequency at which this approach could reliably render the shape (using the same searching and acceptance criteria as above). That is, while we knew \emph{OCP\_Timing} and \emph{OptiTrap} could provide 10Hz for these shapes and sizes, we wanted to determine the maximum frequency at which the \emph{Baseline} would render them, as to characterise the benefits provided by optimising the timing. The results are summarised in Table \ref{table:shape_frequency_results}. As expected, no changes are produced for the circle. However, there is a 25\% increase for the cardioid, 150\% for the squircle, and 11\% increase for the fish using the \emph{OptiTrap} method. Again, please note that no differences can be observed in terms of maximum frequency between \emph{OCP\_Timing} and \emph{OptiTrap}. \subsection{Reconstruction Accuracy} \label{ssec:eval_accuracy} To evaluate the reconstruction accuracy, we recorded each of the trials in our maximum size evaluations (see Section~\ref{ssec:eval_sizes}) using an OptiTrack camera system. We then computed the Root Mean Squared Error (RMSE) between the recorded data and the intended target shape, taking 2s of shape rendering into account (exclusively during the cyclic part, ignoring ramp-up/ramp-down). For a fair comparison across trials, we normalise the RMSE with respect to the traversed paths, by dividing the RMSE by the total path length of each individual test shape. The results are summarised in Table~\ref{table:RMSE_results}. \begin{table}[b] \caption{RMSE and Path-normalised (PN) RMSE with respect to the total path length of each test shape, for the \emph{Baseline}, \emph{OCP\_Timing}, and \emph{OptiTrap} approach, at constant rendering frequency.} \centering \begin{tabular}{ c|c|c|c|c|c|c|} \cline{2-7} &\multicolumn{2}{|c}{\emph{Baseline}}& \multicolumn{2}{|c}{\emph{OCP\_Timing}}& \multicolumn{2}{|c|}{\emph{OptiTrap}}\\ \hline \multicolumn{1}{|l|}{Shape} & RMSE & PN & RMSE & PN & RMSE & PN\\ \multicolumn{1}{|l|}{} & (cm) & RMSE & (cm) & RMSE & (cm) & RMSE\\ \hline \multicolumn{1}{|l|}{Circle} & 0.196 & 0.893 & 0.146 & 0.666& 0.114 & 0.521\\ \hline \multicolumn{1}{|l|}{Cardioid} & 0.142 & 0.575 & 0.153 & 0.545 & 0.120 & 0.429\\ \hline \multicolumn{1}{|l|}{Squircle} & 0.056 & 1.956& 0.0824 &0.434 & 0.080 & 0.421\\ \hline \multicolumn{1}{|l|}{Fish} & 0.111 &0.458 & 0.147&0.536 &0.0581 & 0.212\\ \hline \end{tabular} \label{table:RMSE_results} \end{table} On average, both \emph{OCP\_Timing} and \emph{OptiTrap} provide better results in terms of accuracy, when compared to the \emph{Baseline}. It is particularly worth noting that the accuracy results, in terms of the raw RMSE for \emph{OptiTrap} and \emph{OCP\_Timing}, are better for the cardioid when compared to the \emph{Baseline}, even though a larger shape is being rendered. While the raw RMSE of \emph{OCP\_Timing} and \emph{OptiTrap} is slightly larger for the squircle, we need to take into account that the size rendered by \emph{OCP\_Timing} and \emph{OptiTrap} is almost 6 times larger. Comparing accuracy in terms of normalised RMSE shows consistent increases of accuracy for \emph{OptiTrap} compared to the \emph{Baseline}, with overall decreases in the RMSE of $41.7\%$ (circle), $25.4\%$ (cardioid), $78.5\%$ (squircle), and $53.8\%$ (fish). \emph{OCP\_Timing} shows a decrease of $25.4\%$, $5.14\%$, and $77.8\%$ of the normalised RMSE for the circle, cardioid, and squircle, with the exception of the fish, where the normalised RMSE increased by $17.1\%$, when compared to the \emph{Baseline}. Comparing the reconstruction accuracy of \emph{OCP\_Timing} and \emph{OptiTrap} highlights the relevance of considering trap dynamics to determine trap locations (i.e., Section~\ref{ssec:extract-trap-trajectory}). \emph{OptiTrap} consistently provides smaller RMSE than \emph{OCP\_Timing}, as a result of considering and accounting for the trap-to-particle displacements required to apply specific accelerations. We obtain a $21.8\%$, $21.3\%$, $2.9\%$ and $60.5\%$ decrease in the normalised RMSE, for the circle, cardioid, squircle, and fish, respectively. Such differences are visually illustrated in Figure \ref{fig:eval_trap_location}, showing the effects on the cardioid and fish, for the \emph{OCP\_Timing} and \emph{OptiTrap} approaches. It is worth noting how placing the traps along the reference path results in the cardioid being horizontally stretched, as the particle needs to retain larger distances to the trap to keep the required acceleration (horizontal forces are weaker than vertical ones). This also results in overshooting of the particle at corner locations, which can be easily observed at the corner of the cardioid and in the fins of the fish. For completeness, the visual comparison for the remaining two test shapes is provided in the Supplementary Material S5. \begin{figure}[tb] \includegraphics[width=\columnwidth]{OptiTrap_distortions.png} \caption{Visual comparison between shapes rendered with traps located according to particle dynamics using \emph{OptiTrap} (left) and traps placed along the reference path using \emph{OCP\_Timing} (right) for the cardioid (top) and the fish (bottom) test shapes. Please note undesired increases in size and error in sharp features, such as corners.} \label{fig:eval_trap_location} \Description{The image consists of a two-by-two photo matrix. There are two photos of a rendered cardioid in the first row, and fish in the second row. The cardioid and the fish in the first column are rendered using the OptiTrap algorithm, and in the second column the two shapes are rendered using OCP_Timing. The levitated graphics in the second column are a bit larger in size and less precise than those in the first column. } \end{figure} \subsection{Analysis of Acceleration profiles} \label{ssec:eval_accelerations} \begin{figure}[b] \includegraphics[width=1\columnwidth]{OptiTrap_Acc_Speed_Fish.png} \caption{Particle acceleration and speed for the fish rendered at 10~Hz using \emph{OptiTrap} (solid black) and the \emph{Baseline} (dash-dotted purple). While the speed profiles (D) of both trap trajectories are similar, the trap trajectory generated by our approach is feasible, whereas the one generated by the \emph{Baseline} is not. The main reason is that the \emph{Baseline} exceeds the feasible horizontal acceleration, while our approach caps it to feasible values (B). Our approach compensates by using higher (available) vertical acceleration (C). Note that the times where the \emph{Baseline} applies a higher total acceleration (A) than our approach are those where our approach respects the constraints on the feasible horizontal acceleration (B).} \label{fig:force_plots} \Description{The figure consists of four subplots. Subplot A shows the total acceleration in metres per seconds squared from 0 to 400, in steps of 200. Subplot B shows the horizontal acceleration in metres per seconds squared from -200 to 400, in steps of 200. Subplot C shows the vertical acceleration in metres per seconds squared from -500 to 500, in steps of 500. Subplot D shows the total speed in metres per seconds from 0 to 4, in steps of 2. All quantities are plotted as functions of time, going from 0 to 100 milliseconds, at steps of 20.} \end{figure} Finally, we examined the acceleration profiles produced by \emph{OptiTrap} and how these differ from the pre-determined acceleration profiles of the \emph{Baseline}. Please note that we only compare and discuss \emph{OptiTrap} and \emph{Baseline} in Figure \ref{fig:force_plots}, and only for the fish shape. \emph{OCP\_Timing} is not included, as it results in similar acceleration profiles as \emph{OptiTrap}. Only the fish is discussed, as it already allows us to describe the key observations that can be derived from our analysis. For completeness, the acceleration profiles for all remaining test shapes are included in the Supplementary Material S6. As introduced above, Figure \ref{fig:force_plots} shows the particle accelerations and speeds of a particle revealing a fish shape of maximum size (i.e., a width of 8.76cm), rendered over 100ms using the \emph{OptiTrap} and \emph{Baseline} approaches. It is worth noting that while \emph{OptiTrap} succeeded in rendering this shape, \emph{Baseline} did not (the maximum width for \emph{Baseline} was 7.77cm). A first interesting observation is that although \emph{OptiTrap} provides lower total accelerations than the \emph{Baseline} during some parts of the path (see Figure \ref{fig:force_plots}(A)), it still manages to reveal the shape in the same time. The key observation here is that the regions where the total acceleration is lower for \emph{OptiTrap} match with the parts of the path where the horizontal acceleration is very close to its maximum; for example, note the flat regions in Figure~\ref{fig:force_plots}(B) of around $\pm 300 m/{s}^2$). This is an example of \emph{OptiTrap}'s awareness of the dynamics and capabilities of the actual device, limiting the acceleration applied as to retain the feasibility of the path. Second, it is worth noting that maximum horizontal accelerations are significantly smaller than vertical accelerations. As such, it does make sense for horizontal displacements to become the limiting factor. In any case, neither acceleration exceeds its respective maximum value. The \emph{OptiTrap} approach recovers any missing time by better exploiting areas where acceleration is unnecessarily small. It is also worth noting that the value of the horizontal and vertical accelerations are not simply being capped to a maximum acceleration value per direction (e.g., simultaneously maxing out at $\pm 300 m/{s}^2$ and $\pm 600 m/{s}^2$ in the horizontal and vertical directions), as such cases are not feasible according to the dynamics of our acoustic traps. Third, it is interesting to note that the final acceleration profile is complex, retaining little resemblance with the initial parametrisation used. This is not exclusive for this shape and can be observed even in relatively simple shapes, such as the cardioid in Figure~\ref{fig:timings}(D) or the remaining shapes, provided in the Supplementary Material S6. The complexity of these profiles is even more striking if we look at the final speeds resulting from both approaches (see Figure \ref{fig:force_plots}(D)). Even if the acceleration profiles of \emph{Baseline} and \emph{OptiTrap} are very different, their velocity profiles show only relatively subtle differences. But even if these differences are subtle, they mark the difference between a feasible path (i.e., \emph{OptiTrap}) and a failed one (i.e., \emph{Baseline}). These complex yet subtle differences also illustrate how it is simply not sensible to expect content designers to deal with such complexity, and how \emph{OptiTrap} is a necessary tool to enable effective exploitation of PoV levitated content. \section{Discussion} This paper presented \emph{OptiTrap}, an automated approach for optimising timings and trap placements, as to achieve feasible target shapes. We believe this is a particularly relevant step for the adoption of levitation PoV displays, as it allows the content creator to focus on the shapes to present, with feasible solutions being computed automatically, while making effective usage of the capabilities of the device. As such, we hope \emph{OptiTrap} to become an instrumental tool in helping explore the actual potential of these displays. However, \emph{OptiTrap} is far from a complete content creation tool. Such a tool should consider the artist's workflows and practices. Similarly, testing and identifying most useful heuristics to tune our approach (e.g., the regularisation) or visualisation tools identifying tricky parts of the shapes (i.e., requiring high accelerations) should be included as a part of this process. Our goal is simply to provide the base approach enabling this kind of tools. Even this base approach can be extended in a variety of ways. Our levitator prototype is built from off-the-shelf hardware, and is still subject to inaccuracies that result in distortions in the sound-fields generated \cite{Fushimi19}. As such, more accurate levitation hardware or, alternatively, a model reflecting the dynamics of the system in a more accurate manner would be the most obvious pathway to improve our approach. It is worth noting that both factors should be advanced jointly. A more accurate model could also be less numerically stable, potentially leading to worse results if the hardware is not accurate enough. The high update rates of 10kHz required by the levitator and the millisecond delays introduced by optical tracking systems indicate that closed-loop approaches can be both promising and challenging avenues to explore. Assuming a tracking device synchronised with the levitation device (as to map current trap locations with real particle positions), \emph{OptiTrap} could be combined with learning-based approaches. These learning-based approaches will require example paths (i.e., with initial timing and trap placement), and their achievable complexity and convergence will be limited by the examples provided. In such cases, \emph{OptiTrap} can be used to always generate feasible initial trajectories (i.e., to avoid system restarts on failure). Thus learning-based approaches could be used to further refine \emph{OptiTrap} beyond our current model, as to account for device inaccuracies such as those discussed by~\cite{Fushimi19}. However, higher gains can be obtained from more radical changes in the approach. For instance, our approach optimises the timing and trap placement, but it does not modify the target shapes. As illustrated in Figure~\ref{fig:force_plots}, slight changes in speed have significant effects on the acceleration profiles (and feasibility) of the shapes. This is even more prominent for position, where small changes can heavily influence the acceleration and feasibility of target shapes. As such, approaches exploiting subtle modifications to the shape could lead to significant gains in rendering performance. Another interesting possibility would be extending our approach to use several particles. As shown in \cite{Plasencia20}, while the use of several particles does not increase the overall power that can be leveraged, it does allow for increased flexibility. That is, the intensity/forces of each trap can be individually and dynamically adjusted, as to match the needs of the region of the path that each particle is revealing. Also, particles can each be rendering specific independent features, so the content is not limited to a single connected path, and the particles do not waste time/accelerations traversing parts of the path that will not be illuminated (i.e., visible). This approach, however, entails significant challenges. The first obvious challenge is the reliability of the intensity control of the traps. \cite{Plasencia20} demonstrate accurate control of the stiffness at the centre of the traps, but the effects of multiple (interfering) traps in each trap's topology (i.e., how forces distribute around the trap) is yet to be studied. A second challenge is that each particle is not forced to traverse the path at the same speed/rates, with such independent timing progression becoming an additional degree of freedom to account for. Finally, further extensions to our work can come from its application to domains other than PoV displays. An obvious next step would be to adapt \emph{OptiTrap} to photophoretic displays, which trap particles using optical traps instead of acoustic traps \cite{Smalley18,Kumagai21}. This would involve including a model of the dynamics of such optical traps, but it can also involve further challenges, such as modelling the response times of galvanometers and LC panels involved in creating the trap. Our approach can also be adapted to applications requiring objects to be transported quickly and accurately. For example, contactless transportation of matter has a wealth of applications in areas such as the study of physical phenomena, biochemical processes, materials processing, or pharmaceutics \cite{Foresti12549}. Our method can help solving such problems by directly computing a rest-to-rest solution of the matter to be transported, given an estimation of the mass of that matter, the acoustic force acting on the matter, and a path from start to target position. \section{Conclusion} In this paper we proposed the first structured numerical approach to compute trap trajectories for acoustic levitation displays. \emph{OptiTrap} automatically computes physically feasible and nearly time-optimal trap trajectories to reveal generic mid-air shapes, given only a reference path. Building on a novel multi-dimensional approximation of the acoustic forces around the trap, we formulate and show how to solve a non-linear path following problem without requiring or exploiting differential flatness of the system dynamics. We demonstrate increases of up to 563\% in size and up to 150\% in frequency for several shapes. Additionally, we obtain better reconstruction accuracy with up to a 79\% decrease in the path-normalised RMSE. While previously, feasible trap trajectories needed to be tuned manually for each shape and levitator, our approach requires calibration of each individual levitator just once. We are confident that the ideas in this paper could form the basis for future content authoring tools for acoustic levitation displays and bring them a key step closer to real-world applications. \begin{acks} This research has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement \#737087 (Levitate) and from the AHRC UK-China Research-Industry Creative Partnerships (AH/T01136X/2). \end{acks} \bibliographystyle{ACM-Reference-Format}
{'timestamp': '2022-03-07T02:02:14', 'yymm': '2203', 'arxiv_id': '2203.01987', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.01987'}
arxiv
\section{Introduction} Constructing open source software (OSS) depends on contributors with a diverse set of skills. Each skill is vital to OSS: problem-solving skills allow software developers to build new features to address issues; organizational skills help software maintainers manage the moving parts of an OSS project; and communication skills enable writers to generate clear, concise documentation and facilitate collaboration. Unlike in software engineering, where programmers primarily write code, many OSS contributors provide equally valuable non-code contributions \cite{allcontributors2022, trinkenreich2020hidden}. While OSS-related skills include a subset of software engineering skills, contributors also work in contexts unique to OSS (e.g., wrangling contributors, identifying funding, consistently collaborating in a distributed form). Despite the importance of skills related to OSS development, to our knowledge, there are no tools that currently exist which detect such skills. Related work in software engineering has developed techniques to detect specific software engineering skills, for example, Java programming skills \cite{bergersen2014construction} and general programming experience \cite{siegmund2014measuring}. Meanwhile, other work detects programming-related skills by pulling data from version control systems such as GitHub\xspace \cite{papoutsoglou2019extracting, greene2016cvexplorer, montandon2019identifying, mockus2002icse, montandon2021mining, hauff2015matching}. Montandon et al. showed that this data could help identify experts in OSS communities \cite{montandon2019identifying} and predict technical roles of GitHub\xspace users \cite{montandon2021mining}. Other work has demonstrated that GitHub\xspace data can be used to extract skills for job recommendations \cite{greene2016cvexplorer, hauff2015matching}. % These studies have significantly advanced the field, but focus largely on a single topic: mining technical programming skills. Thus, a gap still remains in mining OSS expertise, which encapsulates both soft and hard skills \cite{vadlamani2020studying} across many roles aside from software engineering. Rather than simply focusing on technical software development skills, our work focuses on mining GitHub\xspace data to detect both soft skills and hard skills, which are vital to OSS development. In this paper, we introduce a method to detect OSS skills and implement it in a tool called \ADDED{\toolname (\textbf{D}etect\textbf{I}ng \textbf{SK}ills in \textbf{O}SS)}, with promising results. Our approach relies on identifying accurate \emph{signals}, which are measurable activities or cues associated with a skill used to identify the presence of having that skill. For example, having proficiency in a programming language could be measured using a certain number of lines of code written in that language \cite{bergersen2014construction}. The notion of signals follows prior work, such as Marlow et al., who identified cues that GitHub\xspace users utilized to judge a contributor's coding ability, project-relevant skills, and personality \cite{marlow2013activity}. We discuss how we identify relevant signals (Section \ref{sec:SkillsSignalsModel}) and outline \toolname's features (Section \ref{sec:ImplementingTool}). We then present an evaluation of \toolname and its results (Section \ref{sec:Evaluation}). Finally, we discuss the implications (Section \ref{sec:Discussion}) and next steps for this research (Section \ref{sec:FuturePlans}). \section{Identifying Signals for Skills} \label{sec:SkillsSignalsModel} \input{tables/skills-signals-table} To develop \toolname, OSS skills and signals need to be identified. The first author extracted relevant \textbf{OSS skills} by reading prior literature on software engineering expertise \cite{baltes2018towards, ahmed2012evaluating, li2020distinguishes, papoutsoglou2017mining} and social factors of OSS \cite{dias2021makes, gousios2015work, marlow2013activity, steinmacher2015social, tsay2014influence}. These papers were selected to include a broad set of roles and contribution types. The first author read each manuscript and identified key skills. % Next, we performed additional literature review to identify \textbf{signals} for each skill. In this work, \emph{signals are expressed as true or false statements} (i.e., the signal is either present or not). Potential signals were elicited through the nine papers to identify OSS skills \cite{dias2021makes, tsay2014influence, gousios2015work, steinmacher2015social, baltes2018towards, ahmed2012evaluating, li2020distinguishes, marlow2013activity, papoutsoglou2017mining} and relevant literature on mining OSS activity \cite{bergersen2014construction, hata2021github, chouchen2021anti, chatterjee2021aid, zhou2012make, lee2017one, eluri2021predicting, bao2019large, raman2020stress}. We read through each manuscript, identified potential signals for as many OSS skills as possible, and recorded the source of each signal. We finalized the signals from literature by converting each one as a true or false statement by defining thresholds (e.g., an activity happens at least $N$ times, an activity occurs with a frequency at least at the $N$th percentile). We then generated signals which seemed viable to compute and were representative of the skill. We designed our own signals for \skill{Is familiar with OSS practices} because it was cited often in literature \cite{ahmed2012evaluating, gousios2015work, steinmacher2015social}, but prior work did not define clear signals for this skill. During this process, authors consulted three OSS community experts who made significant contributions to OSS and regularly work with OSS stakeholders for their profession. They provided insight on important skills and signals. Based on the experts' feedback and the frequency of the skills cited in literature, we reduced the final model to four skills, which is shown in Table \ref{tab:SkillsSignalsTable}. \section{Automatically Detecting Skills} \label{sec:ImplementingTool} After developing a model of OSS skills and their associated signals (see Section \ref{sec:SkillsSignalsModel}), the first author implemented \toolname in Python to detect a contributor's OSS skills from the model based on GitHub\xspace user data. We use the GitHub\xspace GraphQL API \cite{github2021graphql}, GitHub\xspace REST API \cite{github2021rest}, and GHTorrent \cite{gousios2012ghtorrent} as sources of GitHub\xspace data. Our tool rates skills on a zero to five scale, where zero represents no proficiency and five represents a high level of proficiency. % We use the function $rate(N, M)$ to determine skill level, where $N$ represents the number of signals present and $M$ represents the total number of signals a skill has. This function weights each signal equally. \[ rate(N, M) = \begin{cases} 0 & \tfrac{N}{M} = 0 \\ 1 & 0 < \tfrac{N}{M} \leq 0.2 \\ 2 & 0.2 < \tfrac{N}{M} \leq 0.4 \\ 3 & 0.4 < \tfrac{N}{M} \leq 0.6 \\ 4 & 0.6 < \tfrac{N}{M} \leq 0.8 \\ 5 & 0.8 < \tfrac{N}{M} \leq 1.0 \\ \end{cases} \] \subsubsection*{Selecting programming languages} Programming languages that the tool detected were selected based on if they were present in both the 2020 State of the Octoverse \cite{github2020state} and the 2020 Stack Overflow Developer Survey \cite{stackoverflow2020developer}. This resulted in 9 programming languages: C, C\#, Java, JavaScript, PHP, Python, Ruby, Shell, and TypeScript. \subsubsection*{\ADDEDZ{Excluding third-party libraries as} user contributions} Contributors often included code from third-party libraries in their commits, which has also been shown in prior work \cite{lopes2017dejavu}. \ADDED{Code from third-party libraries thus should be excluded from contributors' mined contributions.} To that end, we identify popular package managers for each programming language from a Wikipedia article on popular package managers \cite{wikipedia2021list}. We compile a list of installation folder names across all the package managers. Next, we analyze the top folder names for each programming language. We use a list of OSS for social good (OSS4SG) projects (i.e., OSS projects which address a societal issue and target a specific community) from Huang et al. \cite{huang2021leaving} We download the contents of each repository in this list and record its file tree. From this, we identify files written in the language based on file extensions and extract the path from the repository folder. We then retrieve the top 50 folder names associated with each programming language. For each language, we exclude the entire file tree under a folder name from the analysis when: 1) the folder name corresponds to an installation location of the programming language's package manager(s), or 2) the folder name is in the top 50 folder names for the programming language and the list of installation folder names across all package managers. \subsubsection{Computing distributions} Some signals rely on the user activity being at a certain percentile and thus depends on an underlying distribution to compare to. To compute this, we generate a list of OSS contributors by recording the top 30 contributors \ADDEDZ{per project} from Huang et al.'s list of 437 OSS4SG projects~\cite{huang2021leaving}. We randomly select 500 GitHub\xspace users from this list. Each distribution is computed based on these 500 users' relevant activity for the distribution. \section{Evaluation} \label{sec:Evaluation} \subsection{Design} We designed a two-part survey to validate \toolname (see Section \ref{sec:ImplementingTool}): \begin{enumerate} \item a Qualtrics survey where participants submitted anonymized responses and \item a Microsoft Forms survey where participants submitted personal identifying information (PII). \ADDEDZ{This survey was displayed after the completion of the Qualtrics survey.} \end{enumerate} \ADDEDZ{The survey was implemented in two parts so PII was linked only to a small number of questions.} Participants could choose to only take the Qualtrics survey \ADDEDZ{and not provide any PII}. Topics in the Qualtrics survey included the importance of our tool's OSS skills and the participants' willingness to display their skills and ratings on GitHub\xspace. Topics in the Microsoft Forms survey included GitHub\xspace usernames and self-assessments of the skills from \toolname. Some survey questions are shown in Figure~\ref{fig:survey} and the full survey instrument is available as supplemental material~\cite{supplemental-materials}. We sent the survey to a subset of contributors who authored commits, opened issues and pull requests, or commented on others’ issues and pull requests from Huang et al.'s list of 1,079 OSS and OSS4SG projects \cite{huang2021leaving}. \ADDED{Our survey was sent to a total of 9,095 OSS contributors with a response rate of 5\%.} The Qualtrics survey received 455 responses. The Microsoft Forms survey received 386 responses, resulting in 316 valid usernames with public code contributions from merged pull requests. After completing the survey, participants could join a sweepstakes to win one of four \$100 Amazon.com gift cards. \ADDEDZ{The GitHub\xspace usernames allowed us to compare the skill self-assessments with the skills scores computed by \toolname.} To evaluate \toolname, we focus on its precision---that is, when the participant is confident they have a skill, does \toolname agree? We used two measurements of precision: 1) the precision of users who had self-evaluated skill levels greater than 0 (i.e., detecting the presence of a skill) and 2) the precision of users who had self-evaluated skill levels greater than 3 (i.e., detecting moderate to high skill proficiency). For the analysis of the survey, we only look at close-ended questions and use standard statistical analysis techniques. We report percentages on how frequently participants agreed or strongly agreed with a statement and how frequently participants said a skill was important or very important. This follows Kitchenham's and Pfleeger's best practices to analyze survey data~\cite{survey-guidelines}. \begin{figure} \begin{tcolorbox}[left=-14pt,right=2pt,top=2pt,bottom=2pt] {\sc \hspace{16pt}Part 1: Qualtrics Survey Questions (anonymous)} \begin{itemize} \item \questiontext{Q16} \item \questiontext{Q34} \item \questiontext{Q35} \end{itemize} \end{tcolorbox} \vspace{0.5\baselineskip} \begin{tcolorbox}[left=-14pt,right=2pt,top=2pt,bottom=2pt] {\sc \hspace{16pt}Part 2: Microsoft Forms Survey Questions} \begin{itemize} \item \ADDEDZ{\questiontext{MF5}} \item \questiontext{MF6} \item \questiontext{MF7} \vspace{0.5\baselineskip} \end{itemize} \vspace{-0.5\baselineskip} \end{tcolorbox} \caption{A subset of the survey questions. The complete survey instrument is in the supplemental materials~\cite{supplemental-materials}. } \label{fig:survey} \end{figure} \subsection{Preliminary Results} \input{tables/skills-importance} \input{tables/merged} \subsubsection{Skill importance} All the detected skills were important to participants; the results are shown in Table \ref{tab:SkillsImportanceTable}. A majority of participants found the soft skills (\skill{Teaches others to be involved in the OSS project}, \skill{Shows commitment towards the OSS project}) to be important. Notably, participants found soft skills more important than hard skills. \skill{Is familiar with OSS practices} was also rated as important by a majority of participants, but was less important than the soft skills. \subsubsection{Displaying skills} All detected skills would be displayed by a majority of participants (see Table \ref{tab:MergedTable}). Participants were most willing to share \skill{Is familiar with OSS practices}, \skill{JavaScript}, and \skill{Python}. \skill{PHP} was the least popular skill to share. Overall, there was variation in how willing participants were to share certain skills. In the free response, some participants were excited by sharing skills and suggested new languages to detect (e.g., Golang, Rust) or expressed encouragement. Others expressed concerns about the impact of \toolname, questioning whether it should be deployed. \subsubsection{Tool accuracy} \toolname's performance is displayed in Table \ref{tab:MergedTable}. We find that \toolname identifies the presence of OSS skills with impressive performance, with precision scores ranging from 77\% (\skill{Ruby}) to 97\% (\skill{Is familiar with OSS practices}, \skill{Teaches others to be involved in the OSS project}). However, the overall performance of \toolname drops while detecting moderately skilled to expert users. It is also notable that the rating distributions for \skill{Teaches others to be involved in the OSS project}, \skill{Shows commitment towards the OSS project}, and \skill{Is familiar with OSS practices} are skewed positively in the survey. \section{Discussion} \label{sec:Discussion} Our evaluation shows encouraging results for \toolname. Participants are most excited to display programming language-related skills, which our tool detects with reasonable confidence. However, the high importance placed on soft skills by our participants should not be overlooked. This is especially relevant with emerging neural models that generate code with high quality, such as GitHub\xspace Copilot \cite{github2021copilot}. Given its importance, future versions of \toolname could be enhanced to more accurately detect soft skills. \subsubsection*{Potential applications.} \ADDED{Our results indicate a potential future for skill detection approaches within OSS development and software engineering.} While skills underlie these activities, they are not widely supported in tooling. Skills detection methods such as ours could be applied in practice to transform existing experiences. For example, \toolname could assist project maintainers with OSS team formation by supporting a search engine for potential collaborators based on skills or automatically recommending contributors for particular OSS roles. Furthermore, \toolname's skill ratings could be used to identify a contributor's potential areas of growth or recommend mentors with the expertise for the contributor's professional goals. Skills could also be displayed publicly to GitHub\xspace profiles---users could self-select skills they were proficient in, while the platform could display a verified badge for detected skills. \subsubsection*{Limitations.} One limitation of our evaluation is that self-rated skills is a biased measure, as participants may systematically overestimate or underestimate their skills. Additionally, limitations in describing skills in a survey may cause mismatched expectations of a skill. These may contribute to lower evaluation scores. For example, the signals for \skill{Is familiar with OSS practices} was designed to be simple to compute and beginner friendly, but participants rated themselves more harshly on the skill. Thus, when designing experiences with automatic skills detection, transparency in how the skill rating is computed is paramount and should be communicated clearly. \section{Future Plans} \label{sec:FuturePlans} Our preliminary results indicate that there are some promising directions for \toolname. However, additional steps are required to improve upon our current approach, which we outline below. \smallskip \emph{Identifying additional signals from practitioners.} We hope to interview OSS contributors to understand how they evaluate their peers' expertise for the skills our tool detects. This could generate new signals to improve the accuracy of our tool. 258 participants have agreed to be interviewed for this work. \smallskip \emph{Defining weights of the signals.} In practice, each signal is not equally weighted in predicting a contributor's skill. Since our current approach does not support this, one next step could use a linear regression model to examine the relationship between signals and participants' self-evaluated skill level and then use the resulting model weights to weigh each signal in our tool. \smallskip \emph{Evaluating the tool with other measures of skill.} We hope to run an additional evaluation using data sources less impacted by personal bias. For example, soft skills may be evaluated using peer evaluations, while hard skills may be evaluated using skill tests. Previous work has administered skill tests to determine Java expertise \cite{bergersen2014construction}. \section{Conclusion} We present \toolname, a tool to detect OSS-related skills which identifies \emph{signals} (i.e., measurable activities or cues associated with the skill) and then computes them from GitHub\xspace data. \toolname detects the following skills: \skill{Teaches others to be involved in the OSS project}, \skill{Shows commitment towards the OSS project}, \skill{Has knowledge in specific programming languages}, and \skill{Is familiar with OSS practices}. We demonstrate this approach yields positive results, as \toolname detects the presence of OSS skills with precision scores between 77\% to 97\%. Additionally, a near majority of participants find the detected skills important to OSS. We expect to improve the tool and perform more rigorous evaluations in the future. Future work could design tools to augment existing OSS experiences or improve upon our current approach. Our supplemental materials are publicly available at \cite{supplemental-materials}. \begin{acks} We thank our survey participants for their insight and Christian Bird, Mala Kumar, Victor Grau Serrat, and Lucy Harris for their feedback. Jenny T. Liang conducted this work for an internship at Microsoft Research's Software Analysis and Intelligence Group. \end{acks} \bibliographystyle{ACM-Reference-Format}
{'timestamp': '2022-03-07T02:03:54', 'yymm': '2203', 'arxiv_id': '2203.02027', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.02027'}
arxiv
\section{Introduction} Randomized experimentation is a fundamental tool for obtaining counterfactual estimates. The efficacy of randomization comes from a very simple intuition--by randomly assigning treatment status dependence between observed (and unobserved) treatment and pre-treatment covariates necessarily tends to zero as a function of the number of units. In the context of experimentation, this independence condition on observed covariates, commonly known as balance~\citep{imai2008misunderstandings, imai2014covariate}, reduces the variance of estimates of the average treatment effect~\citep{greevy2004optimal, higgins2016improving, kallus2018optimal, li2018asymptotic, harshaw2020balancing}. Under the appropriate conditions such corrections can result in large increases in effective sample size, allowing for the detection of the small effects which are commonplace in many large scale studies and industrial applications~\citep{dimmery2019shrinkage, azevedo2020b}. These contexts rely heavily on experimentation for decision-making, so reduced variance directly translates into more reliable decisions~\citep{kohavi2012trustworthy}. Traditional experimental design like blocking~\citep{greevy2004optimal, higgins2016improving} or even the novel Gram-Schmidt Walk design~\citep{harshaw2020balancing} require more than one pass over the sample and their sample complexity is greater than $\mathcal{O}(n)$. Even algorithms which admit sequential assignment such as \citet{moore2017blocking} suffer from the fact that the algorithm is not linear time and, thus, respondents late in the experiment may take substantially longer to receive a treatment assignment~\citep{cavaille2018implementing}. Our work is motivated by this setting to provide a linear-time, single-pass (i.e. sequential) algorithm for balancing experimental design. Our focus is on linear measures of balance (often of particular interest to applied researchers). This provides a new avenue through which experimenters can ensure that their experiments optimize the information they gain from costly samples. We start by presenting four desiderata for effective, practical online experimental design. First, a method must be computationally efficient. In a review of existing methods for online assignment in the case of survey experiments, \citet{cavaille2018implementing} finds that existing methods become slow to unusable as increasingly more respondents are included in a study. This resulting speed is fundamentally incompatible with effective administration of an experiment. In short, high latency will cause disproportionately large dropoff in an experiment, which may completely nullify the gains from using more sophisticated experimental design. Any algorithm with greater than linear time complexity exacerbate this problem: higher latency for later subjects than earlier subjects will tend to cause non-random sample attrition, as later subjects (who may be different than earlier respondents) will be more likely to drop out. Second, an experimental design must reduce covariate imbalance to be effective. This is the entire justification for using methods more sophisticated than Bernoulli randomization, so if the design is not able to improve on balance, then there will be no subsequent reduction in variance and therefore no compelling reason to use it. Third, the design must incorporate randomization. \citet{harshaw2020balancing} provides an extensive discussion on the inherent tradeoff between robustness and balance within experimental design. A design which solely optimizes for balance will tend to operate on a knife-edge of accidental bias~\citep{efron1971forcing}: the potential bias from an adversarially chosen confounder. With higher accidental bias than Bernoulli randomization, if units do not arrive precisely i.i.d., then the entire design may be compromised. Given that experimental settings are prized specifically for their unbiasedness, this could completely undermine any gains from improved balance. Strong theoretical guarantees on robustness are extremely important in this setting in order to ensure that inferences rest squarely on the design. If assumptions about sampling procedures or data generating processes are necessary to ensure the reliability of estimation, then inferences are not based solely on properties of the experiment, but rather on factors outside the control of the experimenter~\citep{aronow2021nonparametric}. Fourth, units which do not show up in the sample should not be included in the balancing. An offline algorithm used in an online environment would fail this condition, because to use it would require to balance the entire population of units \emph{expected} to show up to an experiment. Units within that population who fail to show would nevertheless be assigned a treatment. Depending on the distribution of units who actually show up in the sample, there are no longer any guarantees that balance will obtain. Our approach satisfies all four of these desiderata. We propose an online method for covariate balancing requiring linear time and space which provably provides variance reduction. Building upon recent work on discrepancy minimization---the self-balancing walk~\citep{alweiss2020discrepancy} and kernel thinning~\citep{dwivedi2021kernel}---we provide an algorithm whose $L_2$-imbalance matches the best known \emph{online} discrepancy algorithm. Where $\delta$ is a failure probability, performing this optimization online results in a $\log(n/\delta)$ cost in convergence of the average treatment effect over the offline algorithm of discrepancy minimization by~\citet{harshaw2020balancing}. A conjectured lower bound for online discrepancy minimization would further reduce this cost by a square root. We also provide an extension to multiple treatments and non-uniform treatment probabilities. The rest of the paper is organized as follows. Section~\ref{sec:related} with a discussion of related work to position our contribution in the literature. Section~\ref{sec:problem} defines notation and formally introduces the problem. Section~\ref{sec:method} provides our proposed algorithms and methods. Section~\ref{sec:simulations} provides a detailed simulation study of the behavior of the proposed algorithms. \section{Related Work} \label{sec:related} There are two common approaches for achieving improved covariate balance in experiments. The first, and most common especially within industrial settings, approach is to perform a post-hoc regression adjustment which includes pre-treatment covariates~\citep{deng2013improving, lin2013agnostic}. The second approach is to consider covariate balance during the design phase of the experiment, i.e., explicitly optimizing treatment assignment in order to minimize imbalance between treatment groups~\citep{greevy2004optimal, higgins2016improving, kallus2018optimal}. Post-hoc stratification may be seen as asymptotically equivalent in terms of variance reduction to its analogous pre-stratified design as shown by \citet{miratrix2013adjusting}. \posscite{miratrix2013adjusting} analysis is limited by two factors: it assumes a fixed number of stratification cells (that do not grow with sample size) and it is conditioned on the post-stratification estimator being defined (e.g. treatment and control units within each stratification cell). These limitations may weaken it's asymptotic equivalence argument. A key limitation of post-hoc adjustment approaches is that the desire for simplicity and scalability implies that practitioners typically adjust for only a linear function of the pre-treatment covariates. Indeed, in the common ``CUPED'' approach, adjustment is performed solely on a linear function of a single pre-treatment outcome measurement~\citep{deng2013improving}. Second, many common approaches for constructing stratification cells (i.e. clustering algorithms) may be computationally infeasible in practice for industrial applications when the number of simultaneous experiments and the number of outcome variables of interest are large. Third, without sample splitting (or when naively applied) advanced machine-learning based methods for adjustment may slip in assumptions of correct-specification of the outcome model, or have confidence intervals with poor coverage properties. While cross-fitting may ameliorate some of these problems in larger samples, sample splitting may prove too high a cost when sample sizes are low. A key shortcoming of design-based covariate balance is the lack of computationally efficient algorithms which provide theoretical guarantees over worst case behavior. Blocking~\citep{fisher1935design} partitions variables into non-overlapping sets and performs complete randomization within each partition~("blocks"). \citet{higgins2016improving} introduced a computationally approximation of blocking which runs in $\mathcal{O}(n\log(n))$ time. \citet{kallus2018optimal, bertsimas2015power} propose an optimization based approach, \citet{kallus2018optimal} additionally considers a partially random approach using semi-definite programming. \citet{zhou2018sequential} provide a method combining \emph{batch-based} sequential experimentation with rerandomization to achieve balance, but which is not computationally feasible in moderate to large sample sizes. Perhaps the closest to the current work is \citet{harshaw2020balancing} which propose a balancing design using the Gram-Schmidt walk, an offline method for (linear) discrepancy minimization. Current state of the art for balancing treatment assignment requires polynomial running time and generally requires knowing all of the covariate vectors prior to determining assignment~\citep{higgins2016improving, harshaw2020balancing,arbour2021efficient}. As we discuss in section \ref{sec:problem}, this is a non-starter for online treatment assignment. In this setting, subjects must be allocated as they arrive; it does no good to know how you \emph{should have} assigned a user at the end of the experiment; you need to know when that subject arrives. It's crucial that when a subject in an experiment arrives they be swiftly allocated to a unit. Especially in an online environment, high latency will lead to attrition, which may counteract any potential gains from greater efficiency. Moreover, the users who attrit may be the very subjects of interest~\citep{munger2021accessibility}. By inducing differential attrition based on patience, the sample in the experiment may differ greatly from the population of interest on unobserved characteristics that make it difficult to extrapolate to a population-level effect~\citep{egami2020elements}. There is also a variety of methods aimed at sequential, online assignment in experiments. The seminal work in this literature is \citet{efron1971forcing} which introduced an online variant of complete randomization which aims to ensure that a pre-specified marginal treatment probability is met without introducing too much accidental bias. \citet{smith1984sequential} provides a generalization of the \citet{efron1971forcing} approach which extends gracefully to multiple treatments. There are a variety of online balanced coin designs which seek to reduce covariate imbalance~\citep[e.g.][]{baldi2011covariate, moore2017blocking}. \citet{moore2017blocking} is based around Mahalanobis distance. As such, it has polynomial time-complexity \emph{at each arrival time}. In addition to inefficiency, the theoretical worst-case behavior of this algorithm has not been resolved, even in the stochastic setting. Theoretical guarantees of this sort are paramount in the design setting, as practitioners need to know the credibility of their inferences (and how they may differ from simple Bernoulli randomization). \section{Background and Problem Setting} \label{sec:problem} We first fix notation. Random variables will be denoted in upper case, with sets in bold. The problem setting, which we refer to as experimental treatment allocation, is as follows. We assume that we observe $1, \dots, n$ i.i.d. observations of $\boldsymbol{X} \in \mathbb{R}^{n \times d}$: the covariates\footnote{We assume linear feature maps throughout. We note that nonlinearities can be handled with the same guarantees following \citet{dwivedi2021kernel} at the cost of additional computational complexity.}. The experimenter is asked to assign a treatment assignment, $A \in \{1, -1\}$ (we will later loosen this to multiple discrete treatment values). We will refer to the assignments of $A$ as treatment and control, respectively. Each unit is imbued with \emph{potential outcomes} for each treatment, the value of the outcome if that unit had been assigned to the given group: $y(1)$ for treatment and $y(-1)$ for control. After assignment we observe only the potential outcome corresponding to the realized treatment assignment, $Y$. We assume that the outcomes are not available until the conclusion of the experiment. At the end of the experiment we are interested in measuring the sample average treatment effect~(SATE) between any two treatments, $k$ and $k'$ with the difference in means estimator: \begin{align} \label{eq:SATE} \hat{\tau}_{kk'} = \frac{1}{n}\sum_i^n \frac{A_i}{p(A_i)} Y_i \end{align} where $p(A_i)$ denotes the probability of assigning treatment $A_i$ to instance $i$. Note that this is simply the difference-in-means rather than the more general Horwitz-Thompson estimator~\citep{horwitz1952generalization}, as the treatment probability is marginal rather than conditional. More sophisticated estimators are usable in this setting~\citep[e.g.][]{tsiatis2008,aronow2013}, but we will focus on the simplest as we optimize design as is commonplace for studying design~\citep{kallus2017balanced, harshaw2020balancing}. If propensity scores are constant, the estimator of the SATE given by equation~\ref{eq:SATE} will be unbiased and consistent for its oracle counterpart, \begin{align} \tau_{kk'} = \frac{1}{n}\sum_i^n y_i(k) - y_i(k'), \end{align} the difference of potential outcomes of the $k$ and $k'$ treatments. This SATE is our estimand of interest, as estimated by equation~\ref{eq:SATE}. We will maintain the following assumptions: \begin{assumption}[Consistency] $Y_i = y_i(k)$ if $A_i = k \quad \forall i, k$. \end{assumption} The problem of experimental allocation is to observe covariate vectors and assign $A$ to units so as to achieve desirable properties of the SATE (for instance, to minimize variance). In the most general setting where no assumptions are placed the relationship between the covariates and outcome complete randomization---randomly drawing assignments without respect to background covariates---is known to be minimax optimal~\citep{kallus2018optimal}. \subsection{Robustness in sequential design} Experiments are prized for their ability to provide unbiased estimates of causal effects with relatively mild assumptions. These assumptions, in fact, typically flow from the \emph{design} of the experiment rather than more difficult assumptions about the data used in the course of analysis~\citep{sekhon2009opiates,aronow2021nonparametric}. In the study of vector balancing, there are three main sampling schemes of interest, listed in order of how adversarial they are: \begin{enumerate*} \item Stochastic arrivals. \item Oblivious adversarial arrivals. \item Fully adversarial arrivals. \end{enumerate*} In the stochastic arrivals setting, units are sampled i.i.d. from some fixed (possibly infinite) population. As such, a given covariate vector is just as likely to arrive early in the sequence as late. In the oblivious adversarial setting, the adversary knows the process which will be used to assign units to groups, but cannot condition specifically on those assignments in making its decisions about the order of arrival of units. This implies the following conditional independence: \begin{assumption}[Oblivious Adversary] $$ \boldsymbol{w}_{i-1} \indep \boldsymbol{x}_i | \mathcal{H}_{i-1} $$ where $\mathcal{H}_i$ is the history of $\boldsymbol{x}$ up to and including $\boldsymbol{x}_i$. \end{assumption} This stands in contrast to the fully adversarial case, in which the adversary is able to condition its decision in each period on the full set of past assignments in addition to the history of the covariate vector. We will focus on the oblivious adversary in this paper. \section{Online Assignment of Treatments} \label{sec:method} \textbf{Weighted Online Discrepancy Minimization:} We consider a variant of the online Koml\'os problem~\citep{spencer1977balancing}, where vectors $\boldsymbol{x}_1, \ldots \boldsymbol{x}_n$ arrive one by one and must be immediately assigned a weighted sign of either $-2q$ or $2(1-q)$, for $0 < q < 1$, such that the weighed discrepancy $\left\| \sum_{i=1}^n \eta_i \boldsymbol{x}_i \right\|_{\infty}$, where $\eta_i$ is the weighted sign given to $\boldsymbol{x}_i$, is minimized. Notice that when $q = 1/2$, the signs become $\pm 1$. Algorithm \ref{alg:weighted}, takes $i=1,\dots,n$ unit vectors in sequentially and assigns them to a treatment and control, represented by the value of $\eta_i$. The procedure, an extension of recent work in online discrepancy minimization~\citep{alweiss2020discrepancy, dwivedi2021kernel}, assigns treatment with probability proportional to the inner product between a running sum of the signed prior observations. The algorithm and analysis differs from prior work for discrepancy in two aspects which are necessary for use in experimentation. One is to give a ridge regression guarantee, we need to characterize the random vectors output by the algorithm in terms of the projection matrix $\boldsymbol{P}.$ \citet{harshaw2020balancing} do that for an offline discrepancy minimization algorithm, and here we do it for an online version. The other way we differ is that our algorithm is a slight generalization of the one in \citet{dwivedi2021kernel} in that we have a parameter $q$. This allows for the case of imbalanced treatment assignments. A straightforward adoption of the analysis in \citet{dwivedi2021kernel} to this case results in a worse dependence on $1/q.$ Therefore, we derive a sub-exponential concentration bound and get a better dependence on $1/q.$ \begin{algorithm} \label{alg:main} \caption{takes each input vector ${\boldsymbol{x}}_i$ and assigns it $\{-2q, 2(1-q)\}$ signs online to maintain low weighted discrepancy with probability $1-\delta$.} \begin{algorithmic} \STATE {\bfseries Input: } {${\boldsymbol{x}}, q$} $c \gets \min(1/q, 9.3) \log(2n/\delta)$ \\ \FOR {$i$ from 1 to $n$} \IF {$|\boldsymbol{w}_{i-1}^{\top} {\boldsymbol{x}}_i| > c$} \STATE ${\boldsymbol{w}_{i}} \gets {\boldsymbol{w}_{i-1}} - 2 q \frac{\boldsymbol{w}_{i-1}^{\top} {\boldsymbol{x}}_i}{c} \boldsymbol{x}_i $ \ELSE \STATE $\eta_i \gets \begin{cases} 2(1-q), & \text{ w.p. } q(1 - \boldsymbol{w}_{i-1}^{\top} {\boldsymbol{x}}_i / c)\\ -2q,& \text{ w.p. } 1- q(1 - \boldsymbol{w}_{i-1}^{\top} {\boldsymbol{x}}_i / c) \end{cases} $ \STATE ${\boldsymbol{w}_{i}} \gets {\boldsymbol{w}_{i-1}} + \eta_i {\boldsymbol{x}_i}$ \ENDIF \ENDFOR \STATE {\bfseries Output: } {$\boldsymbol{\eta}, \boldsymbol{w}$} \end{algorithmic} \label{alg:weighted} \end{algorithm} {\bf Notation: }Let $\boldsymbol{P}_i, \, i\in [n]$ be orthogonal projection matrices onto the span of $\{\boldsymbol{x}_1,..,\boldsymbol{x}_i\},$ that is, \[\boldsymbol{P}_i = \boldsymbol{X}_i^{\top} \br{\boldsymbol{X}_i \boldsymbol{X}_i^{\top}}^{-1} \boldsymbol{X}_i ,\] where $\boldsymbol{X}_i$ is the $i \times d$ submatrix of $\boldsymbol{X}$ corresponding to covariates $\{\boldsymbol{x}_1,..,\boldsymbol{x}_i\}.$ Let $A = 0.5803, B = 0.4310$ and $ \alpha = 2/B $. \begin{definition} [Sub-Gaussian] A mean zero random variable $X$ is sub-Gaussian with parameter $\sigma$ if for all $\lambda \in \mathbb{R}$, $ \mathrm{E} [ \exp\br{ \lambda X } ] \leq \exp \br{ \frac{\lambda^2 \sigma^2}{2}}. $ A mean zero random vector $\boldsymbol{w}$ is $(\sigma, \boldsymbol{P})$ sub-Gaussian if for all unit vectors $\boldsymbol{u}$ and $\lambda \in \mathbb{R}$, $ \mathrm{E} [ \exp\br{ \lambda \boldsymbol{w}^{\top} \boldsymbol{u} } ] \leq \exp \br{ \frac{\lambda^2 \sigma^2 \boldsymbol{u}^{\top} \boldsymbol{P} \boldsymbol{u} }{2}}. $ In particular, $\boldsymbol{w}^{\top} \boldsymbol{u}$ is $\sigma^2 \boldsymbol{u}^{\top} \boldsymbol{P} \boldsymbol{u}$ sub-Gaussian. \end{definition} \begin{definition} [Sub-exponential] A mean zero random variable $X$ is $(\nu, \alpha)$ sub-exponential if for all $|\lambda| \leq \frac{1}{\alpha}$, $ \mathrm{E} [ \exp\br{ \lambda X } ] \leq \exp \br{ \frac{\lambda^2 \nu^2}{2}}. $ A mean zero random vector $\boldsymbol{w}$ is $(\nu, \alpha, \boldsymbol{P})$ sub-exponential if for all unit vectors $\boldsymbol{u}$ and $|\lambda| \leq \frac{1}{\alpha \sqrt{ \boldsymbol{u}^{\top} \boldsymbol{P} \boldsymbol{u}}}$, $ \mathrm{E} [ \exp\br{ \lambda \boldsymbol{w}^{\top} \boldsymbol{u} } ] \leq \exp \br{ \frac{\lambda^2 \nu^2 \boldsymbol{u}^{\top} \boldsymbol{P} \boldsymbol{u} }{2}}. $ In particular, $\boldsymbol{w}^{\top} \boldsymbol{u}$ is $(\nu \sqrt{\boldsymbol{u}^{\top} \boldsymbol{P} \boldsymbol{u}}, \alpha \sqrt{\boldsymbol{u}^{\top} \boldsymbol{P} \boldsymbol{u}})$ sub-exponential. \end{definition} \begin{restatable}[Main]{theorem}{main} \label{thm:main} Let $\boldsymbol{w}_1, ... \boldsymbol{w}_n$ be as in Algorithm~\ref{alg:main}. Then \begin{enumerate} \item $\boldsymbol{w}_i$ is mean zero $\br{\sqrt{c/2q}, P_i}$ sub-Gaussian. \item $\boldsymbol{w}_i$ is mean zero $\br{\sqrt{8Ac}, \alpha, P_i}$ sub-exponential. \item With probability $1-\delta,$ for all $i,$ $|\boldsymbol{w}_i^T \boldsymbol{x}_i| \leq c .$ \end{enumerate} \end{restatable} Note that $\eta_i$ is defined only when $|\boldsymbol{w}_{i-1}^{\top} \boldsymbol{x}_i| \leq c$. Therefore, $\boldsymbol{\eta}$ is defined with probability at least $1-\delta.$ \begin{remark} If $\boldsymbol{w}_i$ is a is a mean zero $\br{\sigma, \boldsymbol{P}_i}$ sub-Gaussian random vector, then $\mathrm{Cov}(\boldsymbol{w}_i) \leq \sigma^2 \boldsymbol{P}_i.$ Similarly, we have that if $\boldsymbol{w}_i$ is a is a mean zero $\br{\nu, \alpha, P_i}$ sub-exponential random vector, then $\mathrm{Cov}(\boldsymbol{w}_i) \leq \frac{3}{2} \nu^2 \boldsymbol{P}_i$. A proof is given in Lemma~\ref{lem:vector-var}. \end{remark} We will use Threorem~\ref{thm:main} to derive results on the average treatment effect using the framework developed by \cite{harshaw2020balancing}. Let $z_i = \eta_i + 2q - 1 \in \{-1, 1\}.$ We will show that $\mathrm{E}[\eta_i] = 0,$ and so we have $\mathrm{E}[z_i] = 2q-1$ and $\boldsymbol{z} - \mathrm{E}[\boldsymbol{z}] = \boldsymbol{\eta}.$ Let $ \boldsymbol{\mu} = \frac{\boldsymbol{Y}(1)}{4 q} + \frac{\boldsymbol{Y}(0)}{4(1-q)}.$ \citet{harshaw2020balancing} give a linear algberaic expression for the error of HT-estimators in terms of $\boldsymbol{\mu}$. In particular, they show \begin{lemma}[Lemma A2 and Corollary A1 in \cite{harshaw2020balancing}] \label{lem:ate-err} \[ \hat{\tau} - \tau = \frac{2}{n} \br{\boldsymbol{z} - \mathrm{E}[\boldsymbol{z}]}^{\top} \boldsymbol{\mu} = \frac{2}{n} \boldsymbol{\eta}^{\top}\boldsymbol{\mu} \] and hence, \[ \mathrm{Var}(\hat{\tau}) = \mathrm{E} \brs{ (\hat{\tau} - \tau)^2 } = \frac{4}{n^2} \boldsymbol{\mu}^{\top} \mathrm{Cov}(\boldsymbol{z}) \boldsymbol{\mu}. \] \end{lemma} Theorem~\ref{thm:main} immediately implies that assignments generated by Algorithm~\ref{alg:main} are well balanced. But optimizing just for balance can lead to accidental bias~\citep{efron1971forcing}. We have from Lemma~\ref{lem:ate-err} that $\text{Var}(\hat{\tau}) = \frac{4}{n^2} \lambda_{\max}\br{\mathrm{Cov}(\boldsymbol{z})} \|\boldsymbol{\mu}\|^2 $ in the worst case when $\boldsymbol{\mu}$ is along the top eigenvector of $\mathrm{Cov}(\boldsymbol{z})$. % Therefore, to control accidental bias we need to make sure $\lambda_{\max}\br{\mathrm{Cov}(\boldsymbol{z})}$ is not high. We achieve this by augmenting the original covariates $\boldsymbol{x}_i$ by $\sqrt{\phi} \boldsymbol{e}_i$ to get $\left[ \begin{array}{c} \sqrt{\phi} \boldsymbol{e}_i \\ \sqrt{1-\phi} \boldsymbol{x}_i \end{array} \right] ,$ where $\phi \in [0, 1]$ is a parameter which controls the extent of the covariate balance, and $\boldsymbol{e}_i$ is a basis vector in dimension $n$. By a simple calculation, we can see that running Algorithm~\ref{alg:main} on $\boldsymbol{x}_i$ augmented with $\sqrt{\phi} \boldsymbol{e}_i$ is equivalent to running it with $\boldsymbol{x}_i$ and replacing $\boldsymbol{w}_{i-1}^{\top} \boldsymbol{x}_i$ by $\sqrt{1- \phi} \boldsymbol{w}_{i-1}^{\top} \boldsymbol{x}_i$ everywhere. Therefore, we don't have to explicitly augment the covariates in the algorithm. We note that with augmented covariates, $\boldsymbol{w}_n = \left[\begin{array}{c} \sqrt{\phi} \boldsymbol{\eta} \\ \sqrt{1-\phi} \boldsymbol{X}^{\top} \boldsymbol{\eta} \end{array}\right]$ is a sub-Gaussian or a sub-exponential random vector as in Theorem~\ref{thm:main}. {\small Let $\phi \in (0,1)$ be fixed, and $\boldsymbol{Q} = \br{\phi \boldsymbol{I} + (1-\phi)\boldsymbol{X} \boldsymbol{X}^{\top}}^{-1}.$} \begin{proposition} \label{prop:z-dist} When Algorithm~\ref{alg:main} is run with augmented covariates as described above, then $\boldsymbol{\eta} = \boldsymbol{z} - \mathrm{E}[\boldsymbol{z}]$ is a mean zero $(\sqrt{c/2q}, \boldsymbol{Q})$ sub-Gaussian random vector and also, $\boldsymbol{\eta}$ is a mean zero $(\sqrt{8Ac},\alpha, \boldsymbol{Q})$ sub-exponential random vector. \end{proposition} Proposition~\ref{prop:z-dist} shows that $\mathrm{E}[\boldsymbol{\eta}] = 0$ for all $i.$ \begin{proposition}[Unbiasedness] When Algorithm~\ref{alg:main} is run with augmented covariates, we have with probability at least $1-\delta$, $\mathrm{E} \brs{\sum_i \boldsymbol{x}_i \eta_i} = 0.$ \end{proposition} For rest of the section, we let $\sigma^2 = c/2q$ if $c = \log(2n/\delta)/q$ and $\sigma^2 = 12Ac$ if $c = 9.3 \log(2n/\delta).$ \begin{proposition}[Eigenvalues of Treatment Covariance] \label{prop:spectral-bound} With probability at least $1-\delta$, Algorithm~\ref{alg:main} produces $\boldsymbol{\eta}$ satisfying $ \mathrm{Cov}(\boldsymbol{z}) = \mathrm{Cov}(\boldsymbol{\eta}) \preceq \sigma^2 \boldsymbol{Q}. $ \end{proposition} \subsection{Balance} \label{sec:balance} \begin{proposition} \label{prop:balance} Let $\boldsymbol{w} = \sum_i \eta_i \boldsymbol{x}_i$. With probability at least $1-\delta$, { \small \[ \left \| \boldsymbol{w} \right \|_{2} \leq \sqrt{d} \left \| \boldsymbol{w} \right \|_{\infty} \leq \min \left( \frac{1}{q}, 9.3 \right) \sqrt{\frac{ {d \log (4d/\delta)\log(4n/\delta)} }{2 (1-\phi) \phi}}. \] } \end{proposition} \subsection{Error bounds} \begin{proposition}[Concentration of ATE] \label{prop:ate-concentration} Algorithm~\ref{alg:main} when run with augmented covariates, generates a random assignment $\boldsymbol{z}$ such that \[ |\hat{\tau} - \tau| = \frac{2}{n} | \boldsymbol{\eta}^{\top} \boldsymbol{\mu}| \leq \frac{2c}{n} \sqrt{\boldsymbol{\mu}^{\top} \boldsymbol{Q} \boldsymbol{\mu}}. \] with probability $1-\delta.$ \end{proposition} Lemma A10 in~\cite{harshaw2020balancing} shows that $\boldsymbol{\mu}^{\top} \boldsymbol{Q} \boldsymbol{\mu} = \min _{\boldsymbol{\beta} \in \mathbb{R}^{d}}\left[\frac{1}{\phi }\|\boldsymbol{\mu}-\boldsymbol{X} \boldsymbol{\beta}\|^{2}+\frac{\|\boldsymbol{\beta}\|^{2}}{(1-\phi) } \right].$ \begin{proposition} \label{prop:ate-worstcase} The worst-case mean squared error of the online balancing walk design is upper bounded by % \begin{align*} &\mathrm{E}\left[(\widehat{\tau}-\tau)^{2}\right] \leq \frac{4 \sigma^2}{\phi n^2} \sum_{i=1}^{n} \mu_{i}^{2}\\ % \end{align*} where $\phi \in(0,1]$ with probability $1 - \delta$. \end{proposition} \begin{proof}[Proof of Proposition~\ref{prop:ate-worstcase}] This follows from Lemma~\ref{lem:ate-err} and Proposition~\ref{prop:spectral-bound}. We note that $\boldsymbol{Q} \preceq \frac{\sigma^2}{\phi} \boldsymbol{I}.$ \end{proof} \begin{proposition}[Ridge Connection] \label{prop:ate-ridge} The worst-case mean squared error of the online balancing walk design is upper bounded by an implicit ridge regression estimator with regularization proportional to $\phi$. That is, % \begin{align*} &\mathrm{E} \left[(\widehat{\tau}-\tau)^{2}\right] \leq \frac{4 \sigma^2 L}{n} \\ &\text { where } \quad L=\min _{\boldsymbol{\beta} \in \mathbb{R}^{d}}\left[\frac{1}{\phi n}\|\boldsymbol{\mu}-\boldsymbol{X} \boldsymbol{\beta}\|^{2}+\frac{\|\boldsymbol{\beta}\|^{2}}{(1-\phi) n}\right] \end{align*} with probability $1 - \delta$. \end{proposition} \subsection{Algorithm with Restart} \label{sec:restart} We saw earlier that $\boldsymbol{\eta}, \boldsymbol{z}$ are defined only with probability $1-\delta.$ This is because with our choice of $c$, only with probability $1-\delta$ we have for all $i, |\boldsymbol{w}_i^{\top} \boldsymbol{x}_i| \leq c.$ This means our treatment assignment fails with probability $\delta.$ There is a simple way to make sure that the algorithm never fails and have same error bound guarantees with a slightly worse constant. This is achieved by slightly modifying Algorithm~\ref{alg:main} so that whenever we have $|\boldsymbol{w}_{i-1}^{\top} \boldsymbol{x}_i| > c$ for a particular $i,$ we start a new instance of the algorithm for covariates $\boldsymbol{x}_{i+1}, ...\boldsymbol{x}_n.$ This is equivalent to setting $\boldsymbol{w}_{i-1} = 0$ and continuing with the algorithm. Since for any treat assignment procedure $\mathrm{E} \br{\hat{\tau}-\tau}^2$ just depends on $\mathrm{Cov}(\boldsymbol{z})$, and Algorithm~\ref{alg:main} fails with probability $\geq \delta,$ we can show that \begin{align*} \mathrm{Cov}(\boldsymbol{z}) &\preceq (1-\delta)\boldsymbol{Q} + \delta \boldsymbol{Q} + \delta^2 \boldsymbol{Q} + ...\\ &\preceq 2 \boldsymbol{Q} \text{ when } \delta \leq 1/2. \end{align*} Therefore, for the modified algorithm, we will have error guarantees as in Propositions~\ref{prop:ate-worstcase} and \ref{prop:ate-ridge} (but worse by at most a factor of $2$) and with probability one. \subsection{Multiple Treatments} In this section, we consider an online multi-treatment setting, where each vector is assigned to a group in $M = \{m_1, m_2, \ldots, m_k\}$ immediately on arrival. For each $1 \leq i\leq k$, group $m_i$ is associated with a weight $\alpha_i$. The goal is to minimize the multi-treatment discrepancy: \begin{align*} &\max_{m_1, m_2 \in M} 2 \left\| \frac{\boldsymbol{s}(m_1)/{\alpha_1} - \boldsymbol{s}(m_2)/{\alpha_2}}{ {1}/{\alpha_1} + {1}/{\alpha_2}} \right\|_{\infty} \end{align*} where $\boldsymbol{s}(m)$ is the sum of all vectors assigned to treatment $m$. Notice that by setting $\alpha_1 = \frac{1}{1-q}$ and $\alpha_2 = \frac{1}{q}$, we can recover the definition given for the weighted discrepancy between two treatments $m_1$ and $m_2$. Our algorithm can leverage any oracle (we call it \texttt{BinaryBalance} in Algorithm~\ref{alg:multi}) that minimizes the weighted discrepancy for two treatments. Our results are obtained by using Algorithm~\ref{alg:weighted}. We first build a binary tree where each leaf of the tree corresponds to one of the $k$ treatments in $M$. Let $h$ be the smallest integer such that $2^{h} \geq k$. We start with a complete binary tree of height $h$, and then remove $2^h - k$ leaves from the tree such that no two siblings are removed. Note that this is possible by the definition of $h$. We further contract each internal node with only one child to its child. This process does not change the number of leaves in the tree. Let $T$ be the obtained tree. By construction, all internal nodes of $T$ have 2 children and $T$ has exactly $k$ leaves. We then associate each leaf of $T$ with a treatment in $M$. For each vector assigned to treatment $m_i$, we also say that it is assigned to the leaf corresponding to $m_i$, $\forall 1 \leq i \leq k$. For each node $v \in T$, denote by $\boldsymbol{s}(v)$ the sum of all vectors assigned to leaves under $v$. In addition, let $\alpha(v)$ be the sum of all weights assigned to leaves under $v$. For each internal node $v$ of $T$, the weighted discrepancy vector at $v$ is defined as: \begin{align*} \boldsymbol{w}(v) &= \frac{\alpha(v_r)}{\alpha(v_l) + \alpha(v_r)} \boldsymbol{s}(v_l) - \frac{\alpha(v_l)}{\alpha(v_l) + \alpha(v_r)} \boldsymbol{s}(v_r) \\ &= \frac{{\boldsymbol{s}(v_l)}/{\alpha(v_l)} - {\boldsymbol{s}(v_r)}/{\alpha(v_r)}}{{ 1}/{\alpha(v_l)} + { 1}/{\alpha(v_r)}}, \end{align*} where $v_l$ and $v_r$ are the left and right child of $v$ respectively. For each internal node $v$ in $T$, we maintain an independent run of a two-treatment algorithm that minimizes $\|\boldsymbol{w}(v)\|_{\infty}$. At a high level, we minimize the weighted discrepancies at all internal nodes simultaneously. When a new vector $\boldsymbol{x}$ arrives, we first feed it to the algorithm at root $r$. If the result is $+$, we continue with the left sub-tree of $r$. Otherwise, we go to the right sub-tree. We continue in that manner until we reach a leaf $l$. $\boldsymbol{x}$ will then be assigned to $l$ (and the treatment associated with $l$). \begin{restatable}{theorem}{multi} \label{thm:multi} Let \texttt{BinaryBalance} be Algorithm~\ref{alg:weighted}. Then Algorithm~\ref{alg:multi} obtains $O\left(\log k \sqrt{\frac{ {(1-\phi)d \log (dk/\delta)\log(nk/\delta)} }{\phi}} \right)$ multi-treatment discrepancy with probability $1-\delta$. \end{restatable} \begin{algorithm}[h] \caption{\texttt{KGroupBalance} takes each input vector ${x}_i$ and assigns it to one of the groups online to maintain low discrepancy with probability $1-\delta$.} \begin{algorithmic} \STATE {\bfseries Input:} ${\boldsymbol{x}}, k, \alpha$. \STATE $h$ $\gets$ smallest integer such that $2^h \geq k$. \STATE $T \gets$ complete binary tree with height $h$. Remove $2^h - k$ leaves from $T$ such that no two siblings are removed. Associate each treatment to a leaf of $T$. Contract each internal node in $T$ with one child to its child. \FOR{node $v$ in $T$} \STATE $\alpha(v) \gets$ sum of all weights of groups associating with leaves under $v$. \ENDFOR \FOR{internal node $v$ of $T$} \STATE Instantiate \texttt{BinaryBalance}($v$) $\gets$ oracle for weighted discrepancy problem at $v$ with weighted signs $\frac{\alpha(v_r)}{\alpha(v_l) + \alpha(v_r)}$ and $-\frac{\alpha(v_l)}{\alpha(v_l) + \alpha(v_r)}$. \ENDFOR \FOR{i from 1 to n} \STATE $v \gets $ root of $T$. \FOR{$v$ is an internal node of $T$} \STATE Feed $\boldsymbol{x}_i$ to \texttt{BinaryBalance}($v$) \STATE $v \gets $ one of the children of $v$ according to the assignment of \texttt{BinaryBalance}($v$) on input $\boldsymbol{x}_i$ \ENDFOR \STATE Assign $x_i$ to the group corresponding to $v$. \ENDFOR \end{algorithmic} \label{alg:multi} \end{algorithm} \begin{figure} \centering \includegraphics[width=0.375\textwidth]{figures/time-1.pdf} \caption{Time to design. All timings performed on a \texttt{ml.r5.2xlarge} instance of Amazon SageMaker. The y-axis is scaled by the square root for easier visualization.} \label{fig:time} \end{figure} \section{Experiments} \label{sec:simulations} In this section, we provide simulation evidence on the efficacy of our proposed methods. In particular, we use a wide variety of data generating processes, many of which do not assume that units arrive i.i.d. as is often standard in simulation settings for this problem. Subjects are unlikely to arrive truly i.i.d. in the real world. Earlier arrivals will typically be more active than late-arriving units, for example. All data generating processes used in simulations are shown in Table~\ref{tab:dgps}. If not otherwise specified, the sample size is $1000$ subjects, the number of groups is two and the marginal probability of treatment is $\frac{1}{2}$. Methods compared in the simulations are simple randomization (Bernoulli coin flips), complete randomization (fixed-margins randomization), the biased coin designs of \citet{efron1971forcing} and of \citet{smith1984sequential}, QuickBlock of \citet{higgins2016improving}, and \citet{alweiss2020discrepancy}. These are compared to our proposed methods which are generalized versions of the discrepancy minimization procedure of \citet{dwivedi2021kernel}. We provide three versions of our proposed algorithms, called BWD for "Balancing Walk Design". The most basic version (BWDRandom) reverts to simple random assignment for all remaining periods once $|\boldsymbol{w}_{i-1}^{\top} \boldsymbol{x}_i| > c$. Our preferred approach restarts the algorithm in this case as described in section~\ref{sec:restart}. We examine this with two levels of robustness, $\phi$: 0 (purely balancing) and 0.5 (a uniform mix between randomization and balancing): BWD(0) and BWD(0.5) respectively. For further details, see section~\ref{sec:robust}. In these comparisons, BWD need not out-perform all methods in all data-generating processes. QuickBlock, for instance, is a fully off-line method, so comparable performance by an online method is noteworthy. In general, Alweiss and BWD will be most effective when the true relationship between covariates and outcome is linear, since they seek linear balance. All plots incorporate 95\% confidence intervals. \begin{figure} \centering \includegraphics[width=0.4\textwidth]{figures/mse-1.pdf} \caption{MSE. BWD provides effective variance reduction across a wide array of simulation environments.} \label{fig:mse} \end{figure} \subsection{Binary treatment} \paragraph{Timing.} Our proposed method (BWD) is highly efficient, scaling substantially better than other balancing methods. This analysis of runtime directly compares online methods to a widely used offline balancing method (QuickBlock). It's important to note that the QuickBlock algorithm cannot be used in the online setting, even if its runtime did not make that prohibitive. While QuickBlock is $\mathcal{O}(n \log n)$, the proposed online balancing methods are all linear-time. Given QuickBlock's runtime, the following simulations only include it for comparisons up to sample sizes of $10^4$. \paragraph{MSE.} Next, we demonstrate in Figure~\ref{fig:mse} how imbalance minimization translates to improved estimation of causal effects, measured by the mean squared-error of our estimate of the average treatment effect. We normalize this graph based on $n$, the rate of convergence of the difference-in-means estimator under simple randomization. The results depend strongly on the true nature of the data-generating process. In short, on non-linear data generating processes, offline blocking performs better than anything else, but in many settings BWD converges to similar error rates as QuickBlock. On linear or near-linear data-generating processes, our proposed algorithms perform very strongly, outperforming QuickBlock even in small sample-sizes. When there is a break from the purely i.i.d. stochastic setting (such as \texttt{LinearDriftDGP} and \texttt{LinearSeasonDGP}), BWD behaves well, as expected. \subsection{Multiple Treatments} \paragraph{MISE.} BWD gracefully extends to the multiple-treatment setting, which we demonstrate in Figure~\ref{fig:mse-multi}. This chart measures the mean integrated squared-error of our estimates of the ATEs (relative to a single control group). Figure~\ref{fig:mse-multi} shows the results. BWD consistently outperforms existing online assignment methods by substantial margins. \begin{figure} \centering \includegraphics[width=0.4\textwidth]{figures/multi_mse-1.pdf} \caption{MISE. BWD effective reduces variance no matter the number of treatments.} \label{fig:mse-multi} \end{figure} An array of additional simulation results may be found in Appendix~\ref{app:sims}. \section{Conclusion} Experiments are a crucial part of how humans learn about the world and make decisions. This paper is aimed at providing a way to more effectively run experiments in the online setting. Practitioners must commonly operate their experiments in this environment, but due to the lack of suitable options for design fall back to simple randomization as the assignment mechanism. In this paper, we have shown how the Balancing Walk Design can be an effective tool in this setting. It is efficient, effective at reducing imbalance (and, therefore, the variance of resulting causal estimates), robust and it is fully suited to the particularities of online treatment assignment. Simulations have shown it to work well across a range of diverse settings. The Balancing Walk Design can improve the practice of large-scale online experimentation. \begin{appendix} \setcounter{figure}{0} \setcounter{table}{0} \renewcommand\thefigure{A\arabic{figure}} \renewcommand\thetable{A\arabic{table}} \section{Proofs} \subsection{Proof of Theorem~\ref{thm:main}} \begin{restatable}[Loewner Order]{proposition}{loewner} \label{prop:loewner} Let $\boldsymbol{M} \succeq 0, C \geq 1, L \geq 0 .$ If $$\boldsymbol{M} \preceq CL\boldsymbol{P} \coloneqq CL\boldsymbol{B}^\top\left(\boldsymbol{B}^\top\boldsymbol{B}\right)^{-1}\boldsymbol{B}$$ then for any vector $\boldsymbol{v} \in \mathbb{R}^{n}$ with $\|\boldsymbol{v}\|_{2} \leq 1$ $$ \boldsymbol{M}^{\prime}=\left(\boldsymbol{I}-C^{-1} \boldsymbol{v} \boldsymbol{v}^{\top}\right) \boldsymbol{M}\left(\boldsymbol{I}-C^{-1} \boldsymbol{v} \boldsymbol{v}^{\top}\right)+L \boldsymbol{v} \boldsymbol{v}^{\top} $$ satisfies $$0 \preceq \boldsymbol{M}^{\prime} \preceq CL\boldsymbol{P}' \coloneqq CL\boldsymbol{P} + CL\frac{\left(\boldsymbol{I} - \boldsymbol{P}\right)\boldsymbol{v} \boldsymbol{v}^\top\left(\boldsymbol{I} - \boldsymbol{P}\right)}{\boldsymbol{v}^\top\left(\boldsymbol{I} - \boldsymbol{P}\right)\boldsymbol{v}}.$$ \end{restatable} \begin{proof} By definition of $\boldsymbol{M}'$ and the assumption $\boldsymbol{M} \preceq cL\boldsymbol{P},$ we have \[ \boldsymbol{M}^{\prime} \preceq CL \left(\boldsymbol{I}-C^{-1} \boldsymbol{v} \boldsymbol{v}^{\top}\right) \boldsymbol{P}\left(\boldsymbol{I}-C^{-1} \boldsymbol{v} \boldsymbol{v}^{\top}\right)+L \boldsymbol{v} \boldsymbol{v}^{\top}. \] Therefore, it is sufficient to prove \[ \left(\boldsymbol{I}-C^{-1} \boldsymbol{v} \boldsymbol{v}^{\top}\right) \boldsymbol{P}\left(\boldsymbol{I}-C^{-1} \boldsymbol{v} \boldsymbol{v}^{\top}\right)+ C^{-1} \boldsymbol{v} \boldsymbol{v}^{\top} \preceq \boldsymbol{P} + \frac{\left(\boldsymbol{I} - \boldsymbol{P}\right)\boldsymbol{v}\vv^\top\left(\boldsymbol{I} - \boldsymbol{P}\right)}{\boldsymbol{v}^\top\left(\boldsymbol{I} - \boldsymbol{P}\right)\boldsymbol{v}}. \] Also note that, since $\|\boldsymbol{v}\| \leq 1$ and $C \geq 1,$ we can absorb $C$ into $\boldsymbol{v}$ (by taking $\boldsymbol{v} \coloneqq \boldsymbol{v}/\sqrt{C}$) and therefore without loss of generality assume that $C=1$ and $\|\boldsymbol{v}\| \leq 1.$ Define: \begin{align*} &\boldsymbol{P}_x = \boldsymbol{B}^\top\left(\boldsymbol{B}^\top\boldsymbol{B}\right)^{-1}\boldsymbol{B}\quad &\boldsymbol{Q}_x \coloneqq \left(\boldsymbol{I} - \boldsymbol{P}\right)\quad &\boldsymbol{P}_v = \boldsymbol{v}\vv^\top\quad &\boldsymbol{Q}_v = \left(\boldsymbol{I} - \boldsymbol{v}\vv^\top\right)\\ &\boldsymbol{a} \coloneqq \boldsymbol{P}_x \boldsymbol{v}\quad &\boldsymbol{b} \coloneqq \boldsymbol{Q}_x \boldsymbol{v}\quad &\alpha \coloneqq \|\boldsymbol{a}\|^2\quad &\beta \coloneqq \|\boldsymbol{b}\|^2 \end{align*} We want to show \begin{align*} \boldsymbol{Q}_v\boldsymbol{P}_x\boldsymbol{Q}_v + \boldsymbol{P}_v \preccurlyeq \boldsymbol{P}_x + \frac{\boldsymbol{Q}_x\boldsymbol{P}_v\boldsymbol{Q}_x}{\beta} \end{align*} Beginning by rewriting the LHS \begin{align*} &\boldsymbol{Q}_v\boldsymbol{P}_x\boldsymbol{Q}_v + \boldsymbol{P}_v = (\boldsymbol{I} - \boldsymbol{P}_v)\boldsymbol{P}_x(\boldsymbol{I} - \boldsymbol{P}_v) + \boldsymbol{P}_v\\ &=\boldsymbol{P}_x - \boldsymbol{P}_v\boldsymbol{P}_x - \boldsymbol{P}_x\boldsymbol{P}_v + \boldsymbol{P}_v\boldsymbol{P}_x\boldsymbol{P}_v + \boldsymbol{P}_v\\ &=\boldsymbol{P}_x - \boldsymbol{v}\boldsymbol{a}^\top - \boldsymbol{a}\boldsymbol{v}^\top + \boldsymbol{v}\vv^\top\alpha + \boldsymbol{P}_v\\ &=\boldsymbol{P}_x - (\boldsymbol{a} + \boldsymbol{b})\boldsymbol{a}^\top - \boldsymbol{a}(\boldsymbol{a} + \boldsymbol{b})^\top + (\boldsymbol{a} + \boldsymbol{b})(\boldsymbol{a} + \boldsymbol{b})^\top\alpha + \boldsymbol{P}_v \end{align*} Expanding $\boldsymbol{P}_v$ as $\boldsymbol{P}_v = \left(\boldsymbol{a} + \boldsymbol{b}\right)\left(\boldsymbol{b} + \boldsymbol{a}\right)^\top = \boldsymbol{a}\aaa^\top + \boldsymbol{b}\bb^\top + \boldsymbol{a}\boldsymbol{b}^\top + \boldsymbol{b}\boldsymbol{a}^\top$ gives \begin{align*} &\boldsymbol{P}_x - \left(\boldsymbol{a} + \boldsymbol{b}\right)\boldsymbol{a}^\top - \boldsymbol{a}\left(\boldsymbol{a} + \boldsymbol{b}\right)^\top + (1 + \alpha)\left(\boldsymbol{a}\aaa^\top + \boldsymbol{b}\bb^\top + \boldsymbol{a}\boldsymbol{b}^\top + \boldsymbol{b}\boldsymbol{a}^\top\right)\\ = &\boldsymbol{P}_x + (\alpha - 1)\boldsymbol{a}\aaa^\top + \alpha\left(\boldsymbol{a}\boldsymbol{b}^\top + \boldsymbol{b}\boldsymbol{a}^\top\right) + (1 + \alpha)\boldsymbol{b}\bb^\top \end{align*} Since $\| \boldsymbol{v}\|^2 \leq 1$, we have $\alpha + \beta \leq 1.$ Now considering the difference of the LHS from the RHS after multiplying both sides by $\beta$ we arrive at \begin{align*} \beta (\text{RHS} - \text{LHS}) = &\boldsymbol{b}\bb^\top(\underbrace{1 - \beta(1 + \alpha)}_{1 - \beta - \beta\alpha \geq \alpha(1 - \beta) \geq \alpha^2}) + \beta(1 - \alpha)\boldsymbol{a}\aaa^\top - \alpha\beta(\boldsymbol{a}\boldsymbol{b}^\top + \boldsymbol{b}\boldsymbol{a}^\top)\\ \succcurlyeq &\alpha^2\boldsymbol{b}\bb^\top + \beta^2\boldsymbol{a}\aaa^\top - \alpha\beta(\boldsymbol{a}\boldsymbol{b}^\top + \boldsymbol{b}\boldsymbol{a}^\top)\\ = &\left(\alpha \boldsymbol{b} - \beta \boldsymbol{a}\right)\left(\alpha \boldsymbol{b} - \beta \boldsymbol{a}\right)^\top \succcurlyeq 0. \end{align*} \end{proof} \begin{lemma} When $|\boldsymbol{w}_{i-1}^{\top} {\boldsymbol{x}}_i| < c$, we have $$ \mathrm{E} \left[ \eta_i \right] = - 2 q \boldsymbol{w}_{i-1}^{\top} {\boldsymbol{x}}_i / c .$$ \end{lemma} \begin{proof} \begin{align*} \mathrm{E} \left[ \eta_i \right] &= 2(1-q) \cdot (q(1 - \boldsymbol{w}_{i-1}^{\top} {\boldsymbol{x}}_i / c)) + (-2q) \cdot (1- q(1 - \boldsymbol{w}_{i-1}^{\top} {\boldsymbol{x}}_i / c)) \\ &= 0 + 2(1-q)(- q \boldsymbol{w}_{i-1}^{\top} {\boldsymbol{x}}_i / c) + (-2q)(q \boldsymbol{w}_{i-1}^{\top} {\boldsymbol{x}}_i / c) \\ &= - 2 q \boldsymbol{w}_{i-1}^{\top} {\boldsymbol{x}}_i / c. \end{align*} \end{proof} For all $i$ and $\boldsymbol{u} \in \mathbb{R}^d$, we have \begin{align*} \langle \boldsymbol{w}_i, \boldsymbol{u} \rangle &= \left \langle \boldsymbol{w}_{i-1}, \boldsymbol{u} - 2 q \frac{\boldsymbol{x}_i^{\top} \boldsymbol{u}}{c} \boldsymbol{x}_i \right \rangle + \epsilon_i \boldsymbol{x}_i^{\top} \boldsymbol{u}\\ & = \langle \boldsymbol{w}_i, \left( \boldsymbol{I} - \frac{2q}{c} \boldsymbol{x}_i \boldsymbol{x}_i^{\top} \right) \boldsymbol{u} \rangle + \epsilon_i \boldsymbol{x}_i^{\top} \boldsymbol{u} \\ & = \langle \boldsymbol{w}_i, \boldsymbol{Q}_{\boldsymbol{x}_i, c} \boldsymbol{u} \rangle + \epsilon_i \boldsymbol{x}_i^{\top} \boldsymbol{u}, \end{align*} where $\epsilon_i =0$ if $|\boldsymbol{w}_{i-1}^{\top}\boldsymbol{x}_i| > c$ and $\epsilon_i = \eta_i - E [\eta_i]$ otherwise and $\boldsymbol{Q}_{\boldsymbol{x}_i, c} = \left( \boldsymbol{I} - \frac{2q}{c} \boldsymbol{x}_i \boldsymbol{x}_i^{\top} \right).$ Consider the case when $|\boldsymbol{w}_{i-1}^{\top} \boldsymbol{x}_i| \leq c$ and $\epsilon_i = \eta_i - E [\eta_i]$. Let $\tilde{q} = q(1 - \boldsymbol{w}_{i-1}^{\top} {\boldsymbol{x}}_i / c).$ Note that $0 \leq \tilde{q} \leq 2q.$ We have $$\epsilon_i \gets \begin{cases} 2(1 - \tilde{q}) & \text{ with probability } \tilde{q},\\ -2\tilde{q}& \text{ with probability } 1- \tilde{q}. \end{cases} $$ \begin{definition} [Sub-Gaussian] A mean zero random variable $X$ is sub-Gaussian with parameter $\sigma$ if for all $\lambda \in \mathbb{R}$, \[ \mathrm{E} [ \exp\br{ \lambda X } ] \leq \exp \br{ \frac{\lambda^2 \sigma^2}{2}}. \] A mean zero random vector $\boldsymbol{w}$ is $(\sigma, \boldsymbol{P})$ sub-Gaussian if for all unit vectors $\boldsymbol{u}$ and $\lambda \in \mathbb{R}$, \[ \mathrm{E} [ \exp\br{ \lambda \boldsymbol{w}^{\top} \boldsymbol{u} } ] \leq \exp \br{ \frac{\lambda^2 \sigma^2 \boldsymbol{u}^{\top} \boldsymbol{P} \boldsymbol{u} }{2}}. \] In particular, $\boldsymbol{w}^{\top} \boldsymbol{u}$ is $\sigma'$ sub-Gaussian, where $\sigma'^2 = \sigma^2 \boldsymbol{u}^{\top} \boldsymbol{P} \boldsymbol{u}$. \end{definition} \begin{definition} [Sub-exponential] A mean zero random variable $X$ is $(\nu, \alpha)$ sub-exponential if for all $|\lambda| \leq \frac{1}{\alpha}$, \[ \mathrm{E} [ \exp\br{ \lambda X } ] \leq \exp \br{ \frac{\lambda^2 \nu^2}{2}}. \] A mean zero random vector $\boldsymbol{w}$ is $(\nu, \alpha, \boldsymbol{P})$ sub-exponential if for all unit vectors $\boldsymbol{u}$ and $|\lambda| \leq \frac{1}{\alpha \sqrt{ \boldsymbol{u}^{\top} \boldsymbol{P} \boldsymbol{u}}}$, \[ \mathrm{E} [ \exp\br{ \lambda \boldsymbol{w}^{\top} \boldsymbol{u} } ] \leq \exp \br{ \frac{\lambda^2 \nu^2 \boldsymbol{u}^{\top} \boldsymbol{P} \boldsymbol{u} }{2}}. \] In particular, $\boldsymbol{w}^{\top} \boldsymbol{u}$ is $(\nu', \alpha')$ sub-exponential, where $\nu'^2 = \nu^2 \boldsymbol{u}^{\top} \boldsymbol{P} \boldsymbol{u}$ and $\alpha' = \alpha \sqrt{\boldsymbol{u}^{\top} \boldsymbol{P} \boldsymbol{u}}$. \end{definition} The following concentration bounds for sub-Gaussian and sub-exponential vectors are obtained from standard bounds for scalar sub-Gaussian and sub-exponential random variables \cite{wainwright_2019} by scaling $\sigma$, $\nu$ and $\alpha$ by appropriate factors. \begin{lemma}[Sub-Gaussian Concentration] \label{lem:subgaussian-bound} If a random vector $\boldsymbol{w}$ is $(\sigma, \boldsymbol{P})$ sub-Gaussian, then for all unit vectors $\boldsymbol{u}$, $$ P\br{|\boldsymbol{w}^{\top}\boldsymbol{u}| \geq t} \leq 2 \exp \br{-\frac{t^2}{2\sigma^2 \boldsymbol{u}^{\top} \boldsymbol{P} \boldsymbol{u}}}. $$ \end{lemma} \begin{lemma}[Sub-exponential Concentration] \label{lem:subexp-bound} If a random vector $\boldsymbol{w}$ is $(\nu, \alpha, \boldsymbol{P})$ sub-exponential, then for all unit vectors $\boldsymbol{u}$, $$ P\br{|\boldsymbol{w}^{\top}\boldsymbol{u}| \geq t} \leq \begin{cases} 2\exp \br{-\frac{t^2}{2 \nu^2 \boldsymbol{u}^{\top} \boldsymbol{P} \boldsymbol{u}}} & \text{ if } 0 \leq t \leq \frac{\nu^2 \sqrt{ \boldsymbol{u}^{\top} \boldsymbol{P} \boldsymbol{u}}}{\alpha} \\ 2\exp \br{- \frac{t}{2 \alpha \sqrt{\boldsymbol{u}^{\top} \boldsymbol{P} \boldsymbol{u}}}} & \text{ if } t > \frac{\nu^2 \sqrt{\boldsymbol{u}^{\top} \boldsymbol{P} \boldsymbol{u}}}{\alpha}. \end{cases} $$ \end{lemma} \begin{lemma} \label{lem:subexp-var} Suppose $X$ is a $(\nu, \alpha)$ sub-exponential random variable with $\frac{2}{\nu^2} \leq \frac{1}{\alpha^2}$. Then \[ \mathrm{Var}(X) \leq \frac{3}{2}\nu^2. \] \end{lemma} \begin{proof} We will use the inequality $x^2 \leq C \br{e^x + e^{-x}}, \, \forall x$ and $C = 1.5/e.$ This gives \begin{align*} \text{Var}(\lambda X) & \leq C \mathrm{E} \br{e^{\lambda X} + e^{- \lambda X}} \\ & \leq 2C\exp(0.5 \lambda^2 \nu^2) , \text{ if } |\lambda| \leq \frac{1}{\alpha}. \end{align*} We therefore have \begin{align*} \text{Var}(X) &\leq C \nu^2 \frac{\exp(0.5 \lambda^2 \nu^2)}{0.5 \lambda^2 \nu^2} \\ &= eC \nu^2 \text{ when } 0.5 \lambda^2 \nu^2 = 1. \end{align*} We get the result with $C = 1.5/e.$ \end{proof} \begin{lemma} \label{lem:vector-var} If $\boldsymbol{w}$ is a is a mean zero $\br{\sigma, \boldsymbol{P}}$ sub-Gaussian random vector, then $\mathrm{Cov}(\boldsymbol{w}) \preceq \sigma^2 \boldsymbol{P}$. If $\boldsymbol{w}$ is a is a mean zero $\br{\nu, \alpha, \boldsymbol{P}}$ sub-exponential random vector with $\frac{2}{\nu^2} \leq \frac{1}{\alpha^2}$, $\mathrm{Cov}(\boldsymbol{w}) \preceq \frac{3}{2} \nu^2 \boldsymbol{P}$. \end{lemma} \begin{proof} For all unit vector $\boldsymbol{u}$, we have \[ \boldsymbol{u}^{\top} \mathrm{Cov}(\boldsymbol{w}) \boldsymbol{u} = \boldsymbol{u}^{\top} \mathrm{E}(\boldsymbol{w} \boldsymbol{w}^{\top}) \boldsymbol{u} = \mathrm{E}[(\boldsymbol{w}^{\top} \boldsymbol{u} )^2] = \mathrm{Var}(\boldsymbol{w}^{\top} \boldsymbol{u}). \] By definition, if $\boldsymbol{w}$ is a is a mean zero $\br{\sigma, \boldsymbol{P}}$ sub-Gaussian random vector, $\boldsymbol{w}^{\top} \boldsymbol{u}$ is $\sigma^2 \boldsymbol{u}^{\top} \boldsymbol{P} \boldsymbol{u}$ sub-Gaussian. Therefore, \[ \boldsymbol{u}^{\top} \mathrm{Cov}(\boldsymbol{w}) \boldsymbol{u} = \mathrm{Var}(\boldsymbol{w}^{\top} \boldsymbol{u}) \leq \sigma^2 \boldsymbol{u}^{\top} \boldsymbol{P} \boldsymbol{u} \] as desired. Similarly, if $\boldsymbol{w}$ is a is a mean zero $\br{\nu, \alpha, \boldsymbol{P}}$ sub-exponential random vector, $\boldsymbol{w}^{\top} \boldsymbol{u}$ is $(\nu \sqrt{\boldsymbol{u}^{\top} \boldsymbol{P} \boldsymbol{u}}, \alpha \sqrt{\boldsymbol{u}^{\top} \boldsymbol{P} \boldsymbol{u}})$ sub-exponential. By Lemma~\ref{lem:subexp-var}, \[ \boldsymbol{u}^{\top} \mathrm{Cov}(\boldsymbol{w}) \boldsymbol{u} = \mathrm{Var}(\boldsymbol{w}^{\top} \boldsymbol{u}) \leq \frac{3}{2} \nu^2 \boldsymbol{u}^{\top} \boldsymbol{P} \boldsymbol{u}. \] \end{proof} \begin{lemma} \label{lem:epsilon} For all $i \in [n]$ \begin{enumerate} \item $\epsilon_i$ is sub-Gaussian with $\sigma = 1$, and \item $\epsilon_i$ is $(4\sqrt{Aq}, 2/B)$ sub-exponential for any $A,B > 0$ satisfying $e^x < 1 + x + Ax^2$ for $x < B$. \end{enumerate} \end{lemma} \begin{proof} For the first claim, note that a random variable bounded in $[a, b]$ is sub-Gaussian with $\sigma^2 = \frac{(b-a)^2}{4}$. To prove second claim, we have \begin{align*} \exp(\lambda \epsilon_i) &= \tilde{q} \exp(2 \lambda(1-\tilde{q})) + (1-\tilde{q}) \exp(-2 \lambda \tilde{q}) \\ &= \exp(-2 \lambda \tilde{q}) (1 + \tilde{q}(\exp(2 \lambda)-1) ) \\ & < \exp \br{-2 \lambda \tilde{q}} \exp \br{\tilde{q}(\exp(2 \lambda)-1) )} \\ & \leq \exp \br{\tilde{q} A (2 \lambda)^2}, \end{align*} for $2\lambda < B.$ The last step follows from $e^x \leq 1+ x + Ax^2$ for $x <B.$ Recall that $\tilde{q} < 2q$, we have $$ \exp(\lambda \epsilon_i) \leq \exp \br{ \frac{16qA\lambda^2}{2}} $$ for $\lambda < B/2$ as desired. \end{proof} Let $\boldsymbol{P}_i, \, i\in [n]$ be orthogonal projection matrices onto the span of $\{\boldsymbol{x}_1,..,\boldsymbol{x}_i\},$ that is, \[\boldsymbol{P}_i := \boldsymbol{P}_{i-1} + \frac{(\boldsymbol{I} - \boldsymbol{P}_{i-1}) \boldsymbol{x}_i \boldsymbol{x}_i^{\top} (\boldsymbol{I} - \boldsymbol{P}_{i-1})}{\|(\boldsymbol{I} - \boldsymbol{P}_{i-1})\boldsymbol{x}_i \|^2}, \] with $\boldsymbol{P}_0 = 0.$ \begin{lemma} \label{lem:main} Suppose $A,B > 0$ satisfy $e^x < 1 + x + Ax^2$ for all $x < B$. Let $\sigma^2 :=c/2q$, $\nu^2 := 8Ac$ and $\alpha := 2/B$. Then \begin{enumerate} \item If $\boldsymbol{w}_{i-1}$ is $(\sigma, \boldsymbol{P}_{i-1})$ sub-Gaussian, $\boldsymbol{w}_i$ is $(\sigma, \boldsymbol{P}_i)$ sub-Gaussian. \item If $\boldsymbol{w}_{i-1}$ is $(\nu, \alpha, \boldsymbol{P}_{i-1})$ sub-exponential, $\boldsymbol{w}_i$ is $(\nu, \alpha, \boldsymbol{P}_i)$ sub-exponential. \end{enumerate} \end{lemma} \begin{proof} We have \begin{align*} \mathrm{E} \left[ \exp( \lambda \boldsymbol{w}_i^{\top} \boldsymbol{u}) \right] &= \mathrm{E} \brs{ \mathrm{E} \brs{ \exp( \lambda \boldsymbol{w}_i^{\top} \boldsymbol{u}) \big| \boldsymbol{w}_{i-1} } } \\ &= \mathrm{E} \brs{ \mathrm{E} \brs{ e^{ \lambda \left \langle \boldsymbol{w}_{i-1}, \boldsymbol{u} - 2 q \frac{\boldsymbol{x}_i^{\top} \boldsymbol{u}}{c} \boldsymbol{x}_i \right \rangle + \lambda \epsilon_i \boldsymbol{x}_i^{\top} \boldsymbol{u}} \big| \boldsymbol{w}_{i-1}}} \\ & = \mathrm{E} \brs{ e^{ \lambda \langle \boldsymbol{w}_{i-1}, \boldsymbol{Q}_{\boldsymbol{x}_i, c} \boldsymbol{u} \rangle} \mathrm{E} \brs{ e^{\lambda \epsilon_i \boldsymbol{x}_i^{\top} \boldsymbol{u}} \big| \boldsymbol{w}_{i-1}}}. \end{align*} First, suppose that $\boldsymbol{w}_{i-1}$ is $(\sigma, \boldsymbol{P}_{i-1})$ sub-Gaussian, we will prove that $\boldsymbol{w}_i$ is $(\sigma, \boldsymbol{P}_i)$ sub-Gaussian. By Lemma~\ref{lem:epsilon}, $\epsilon_i$ is 1-sub-Gaussian. Therefore, \begin{align*} \mathrm{E} \brs{ e^{ \lambda \langle \boldsymbol{w}_{i-1}, \boldsymbol{Q}_{\boldsymbol{x}_i, c} \boldsymbol{u} \rangle} \mathrm{E} \brs{ e^{\lambda \epsilon_i \boldsymbol{x}_i^{\top} \boldsymbol{u}} | \boldsymbol{w}_{i-1}}} & \leq \mathrm{E} \brs{ e^{ \lambda \langle \boldsymbol{w}_{i-1}, \boldsymbol{Q}_{\boldsymbol{x}_i, c} \boldsymbol{u} \rangle} \cdot e^{\frac{1}{2} \lambda^2 \|\boldsymbol{x}_i^{\top} \boldsymbol{u}\|^2 }} \\ & \leq e^{ \frac{ \lambda^2 \sigma^2}{2} \br{ \boldsymbol{Q}_{\boldsymbol{x}_i, c} \boldsymbol{u}}^{\top} \boldsymbol{P}_{i-1} \br{ \boldsymbol{Q}_{\boldsymbol{x}_i, c} \boldsymbol{u}} +\frac{\lambda^2 }{2} (\boldsymbol{u}^{\top} \boldsymbol{x}_i \boldsymbol{x}_i^{\top} \boldsymbol{u}) }. \end{align*} We now consider the exponent (divided by the common factor $\lambda^2 $). It is sufficient to show \begin{align*} \frac{\sigma^2}{2} \br{ \boldsymbol{Q}_{\boldsymbol{x}_i, c} \boldsymbol{u}}^{\top} \boldsymbol{P}_{i-1} \br{ \boldsymbol{Q}_{\boldsymbol{x}_i, c} \boldsymbol{u}} + \frac{1}{2}u^{\top} \boldsymbol{x}_i \boldsymbol{x}_i^{\top} \boldsymbol{u} \leq \frac{\sigma^2}{2} \boldsymbol{u}^{\top} \boldsymbol{P}_i \boldsymbol{u} \, \, \forall \boldsymbol{u}\\ \iff {\sigma^2} \boldsymbol{Q}_{\boldsymbol{x}_i, c} ^{\top} \boldsymbol{P}_{i-1} \boldsymbol{Q}_{\boldsymbol{x}_i, c} + \boldsymbol{x}_i \boldsymbol{x}_i^{\top} \preceq {\sigma^2} \boldsymbol{P}_i. \end{align*} Using Proposition~\ref{prop:loewner} (with $L \leftarrow 1, C \leftarrow c/2q$) and assuming $ \sigma^2 = c/2q \geq 1$, we have \begin{align*} \boldsymbol{Q}_{\boldsymbol{x}_i, c} \boldsymbol{P}_{i-1} \boldsymbol{Q}_{\boldsymbol{x}_i, c} \sigma^2 + \boldsymbol{P}_{\boldsymbol{x}_i} &= \frac{c}{2q} \left( \boldsymbol{I} - \frac{2q}{c} \boldsymbol{x}_i \boldsymbol{x}_i^{\top} \right) \boldsymbol{P}_{i-1} \left( \boldsymbol{I} - \frac{2q}{c} \boldsymbol{x}_i \boldsymbol{x}_i^{\top} \right) + \boldsymbol{x}_i \boldsymbol{x}_i^{\top} \\ &\preceq \frac{c}{2q} \boldsymbol{P}_i. \end{align*} Therefore, $\boldsymbol{w}_i$ is a $(c/2q, \boldsymbol{P}_i) $ sub-Gaussian random vector. Now suppose that $\boldsymbol{w}_{i-1}$ is $(\nu, \alpha, \boldsymbol{P}_{i-1})$ sub-exponential, we will prove that $\boldsymbol{w}_i$ is $(\nu, \alpha, \boldsymbol{P}_{i})$ sub-exponential. Again, by Lemma~\ref{lem:epsilon}, $\epsilon_i$ is $(4\sqrt{Aq}, 2/B)$ sub-exponential. Therefore, \begin{align*} \mathrm{E} \brs{ e^{ \lambda \langle \boldsymbol{w}_{i-1}, \boldsymbol{Q}_{\boldsymbol{x}_i, c} \boldsymbol{u} \rangle} \mathrm{E} \brs{ e^{\lambda \epsilon_i \boldsymbol{x}_i^{\top} \boldsymbol{u}} | \boldsymbol{w}_{i-1}}} & \leq \mathrm{E} \brs{ e^{ \lambda \langle \boldsymbol{w}_{i-1}, \boldsymbol{Q}_{\boldsymbol{x}_i, c} \boldsymbol{u} \rangle} \cdot e^{8Aq \lambda^2 \|\boldsymbol{x}_i^{\top} \boldsymbol{u}\|^2 }} \end{align*} for $|\lambda| < \frac{2}{B|\boldsymbol{x}_i^{\top} \boldsymbol{u}|} = \frac{1}{\alpha \sqrt{\boldsymbol{u}^{\top} \boldsymbol{x}_i \boldsymbol{x}_i^{\top} \boldsymbol{u}}}$. Since $\boldsymbol{w}_{i-1}$ is $(\nu, \alpha, \boldsymbol{P}_{i-1})$ sub-exponential, \[ \mathrm{E} \brs{ e^{ \lambda \langle \boldsymbol{w}_{i-1}, \boldsymbol{Q}_{\boldsymbol{x}_i, c} \boldsymbol{u} \rangle} } \leq e^{ \frac{ \lambda^2 \nu^2}{2} \br{ \boldsymbol{Q}_{\boldsymbol{x}_i, c} \boldsymbol{u}}^{\top} \boldsymbol{P}_{i-1} \br{ \boldsymbol{Q}_{\boldsymbol{x}_i, c} \boldsymbol{u}}} \] for $|\lambda| < \frac{1}{\alpha \sqrt{ \boldsymbol{u}^{\top} \boldsymbol{P}_{i-1} \boldsymbol{u}}}$. Note that $\boldsymbol{u}^{\top} \boldsymbol{P}_{i} \boldsymbol{u}$ is greater than both $\boldsymbol{u}^{\top} \boldsymbol{P}_{i-1} \boldsymbol{u}$ and $\boldsymbol{u}^{\top} \boldsymbol{x}_i \boldsymbol{x}_i^{\top} \boldsymbol{u}$. We have \begin{align*} \mathrm{E} \brs{ e^{ \lambda \langle \boldsymbol{w}_{i-1}, \boldsymbol{Q}_{\boldsymbol{x}_i, c} \boldsymbol{u} \rangle} \mathrm{E} \brs{ e^{\lambda \epsilon_i \boldsymbol{x}_i^{\top} \boldsymbol{u}} | \boldsymbol{w}_{i-1}}} \leq e^{ \frac{ \lambda^2 \nu^2}{2} \br{ \boldsymbol{Q}_{\boldsymbol{x}_i, c} \boldsymbol{u}}^{\top} \boldsymbol{P}_{i-1} \br{ \boldsymbol{Q}_{\boldsymbol{x}_i, c} \boldsymbol{u}} +\ {8Aq\lambda^2 } (\boldsymbol{u}^{\top} \boldsymbol{x}_i \boldsymbol{x}_i^{\top} \boldsymbol{u}) } \end{align*} for all $|\lambda| < \frac{1}{\alpha \sqrt{\boldsymbol{u}^{\top} \boldsymbol{P}_{i} \boldsymbol{u}}}$. Hence, it is sufficient to show \begin{align*} \frac{\nu^2}{2} \br{ \boldsymbol{Q}_{\boldsymbol{x}_i, c} \boldsymbol{u}}^{\top} \boldsymbol{P}_{i-1} \br{ \boldsymbol{Q}_{\boldsymbol{x}_i, c} \boldsymbol{u}} + 8Aq \boldsymbol{u}^{\top} \boldsymbol{x}_i \boldsymbol{x}_i^{\top} \boldsymbol{u} \leq \frac{\nu^2}{2} \boldsymbol{u}^{\top} \boldsymbol{P}_i \boldsymbol{u} \, \, \forall \boldsymbol{u}\\ \iff {\nu^2} \boldsymbol{Q}_{\boldsymbol{x}_i, c} ^{\top} \boldsymbol{P}_{i-1} \boldsymbol{Q}_{\boldsymbol{x}_i, c} + 16Aq \boldsymbol{x}_i \boldsymbol{x}_i^{\top} \preceq {\nu^2} \boldsymbol{P}_i. \end{align*} This follows from Proposition~\ref{prop:loewner} by substituting $L \leftarrow 16Aq$ and $C \leftarrow c/2q$ and noting that $\nu^2 = 8Ac = Lc$. \end{proof} \begin{lemma} \label{lem:success-prob} If $c = \min(1/q, 9.3) \log(2n/\delta)$ then with probability at least $1-\delta$, we have \[ |\boldsymbol{w}_{i-1}^{\top} \boldsymbol{x}_{i}| < c \text{ for all } i \in [n]. \] \end{lemma} \begin{proof} By definition, $c$ is either equal to $\log(2n/\delta)/q$ or $9.3 \log(2n/\delta)$. We consider these two cases. First suppose $c = \log(2n/\delta)/q$. With $\sigma^2 = c/2q$, we have $$ c = \log(2n/\delta)/q = \sigma \sqrt{2 \log(2 n/ \delta)}. $$ By Lemma~\ref{lem:subgaussian-bound}, \begin{align*} P\br{|\boldsymbol{w}_{i-1}^{\top} \boldsymbol{x}_{i}| > c} &\leq P\br{|\boldsymbol{w}_{i-1}^{\top} \boldsymbol{x}_{i}| > c \sqrt{\boldsymbol{x}_i^{\top} \boldsymbol{P}_{i-1} \boldsymbol{x}_i}} \\ &\leq 2 \exp \br{ -\frac{c^2}{2 \sigma^2 }} \leq \delta/n. \end{align*} The result then follows by a union bound over $i \in [n].$ Now suppose $c = 9.3 \log(2n/\delta)$. Note that $A = 0.5803$ and $B = 0.4310$ satisfy $e^x < 1 + x + Ax^2$ for $x < B$. Let $\nu^2 =8Ac$ and $\alpha = 2/B$. We have $$ \frac{\nu^2}{\alpha} = \frac{8Ac }{2/B} = {4ABc} > c . $$ Therefore, by Lemma~\ref{lem:subexp-bound}, \begin{align*} P\br{|\boldsymbol{w}_{i-1}^{\top} \boldsymbol{x}_{i}| > c} &\leq P\br{|\boldsymbol{w}_{i-1}^{\top} \boldsymbol{x}_{i}| > c \sqrt{\boldsymbol{x}_i^{\top} \boldsymbol{P}_{i-1} \boldsymbol{x}_i}} \\ &\leq 2 \exp \br{ -\frac{c^2}{2 \nu^2 }} = 2 \exp \br{-\frac{c}{16A}} \\ &< 2 \exp \br{-\frac{c}{9.3}} \leq \delta/n. \end{align*} Again, the result follows by union bounding over $i \in [n].$ \end{proof} Lemma~\ref{lem:success-prob} and Lemma~\ref{lem:main} together prove Theorem~\ref{thm:main}. \subsection{Proof of Theorem~\ref{thm:multi}} \begin{proof}[Proof of Theorem~\ref{thm:multi}] Let $D(\delta)$ be the discrepancy obtained by \texttt{BinaryBalance} as a function of the failure probability $\delta$. We will show that $(2 \log k) D(\delta/k)$ is the corresponding discrepancy obtained by Algorithm~\ref{alg:multi}. Theorem~\ref{thm:multi} will then follow from Proposition~\ref{prop:balance}. Notice that with probability $\delta/k$, each run of \texttt{BinaryBalance} at an internal node of $T$ has discrepancy $D(\delta/k)$. By union bounding over $O(k)$ internal nodes, we have that with probability $1-\delta$, all of the discrepancies are bounded by $D(\delta/k)$. Assume all the discrepancies at the internal nodes in $T$ are bounded, we show how to bound the discrepancy between any two treatments. Let $l$ and $l'$ be any two leaves in $T$. The goal is to show that $$\left\| \frac{\alpha(l')}{\alpha(l') + \alpha(l)}s(l) - \frac{\alpha(l)}{\alpha(l') + \alpha(l)}s(l')\right\|_\infty$$ is small. First we relate $s(v)$ to $s(v_l)$ and $s(v_r)$ where $v_l, v_r$ are the left and right children of $v$. By definition, \[ w(v) = \frac{\alpha(v_r)}{\alpha(v_l) + \alpha(v_r)} s(v_l) - \frac{\alpha(v_l)}{\alpha(v_l) + \alpha(v_r)} s(v_r) \] and \[s(v) = s(v_l) + s(v_r).\] Therefore, \[w(v) = s(v_l) - \frac{\alpha(v_l)}{\alpha(v_l) + \alpha(v_r)} s(v),\] and \[- w(v) = s(v_r) - \frac{\alpha(v_r)}{\alpha(v_l) + \alpha(v_r)} s(v).\] Hence, both \[ \left\|s(v_l) - \frac{\alpha(v_l)}{\alpha(v)} s(v) \right\|_{\infty} \hspace{0.5cm} \text{and} \hspace{0.5cm} \left\|s(v_r) - \frac{\alpha(v_r)}{\alpha(v)} s(v) \right\|_{\infty} \] are bounded by $D(\delta/k)$. Now consider $v_1, v_2$ and $v_3$ in $T$ such that $v_1$ is a child of $v_2$ and $v_2$ is a child of $v_3$. We have, by triangle inequality, \[ \left\|s(v_1) - \frac{\alpha(v_1)}{\alpha(v_3)} s(v_3) \right\|_{\infty} \leq \left\|s(v_1) - \frac{\alpha(v_1)}{\alpha(v_2)} s(v_2) \right\|_{\infty} + \frac{\alpha(v_1)}{\alpha(v_2)}\left\|s(v_2) - \frac{\alpha(v_2)}{\alpha(v_3)} s(v_3) \right\|_{\infty} \leq \left(1+ \frac{\alpha(v_1)}{\alpha(v_2)}\right) D(\delta/k). \] Let $l$ be a leaf in $T$ and let $l,v_1,v_2 \ldots r$ be the path from $l$ to the root $r$. Repeatedly applying the above relation along the path gives \begin{equation} \label{eqn:sum-path} \left\|s(l) - \frac{\alpha(l)}{\alpha(r)} s(r) \right\|_{\infty} \leq \left( 1 + \frac{\alpha(l)}{\alpha(v_1)} + \frac{\alpha(l)}{\alpha(v_2)} \ldots + \frac{\alpha(l)}{\alpha(r)} \right) D(\delta/k). \end{equation} Since there are at most $\log k$ nodes in the path from $l$ to $r$, \[ \left\|s(l) - \frac{\alpha(l)}{\alpha(r)} s(r) \right\|_{\infty} \leq (\log k) D(\delta/k).\] Finally, for any two leaves $l$ and $l'$, \[ \left\|\frac{s(l)/\alpha(l) - s(l') /\alpha(l')}{1/\alpha(l) + 1/\alpha(l') }\right\|_{\infty} \leq \left\|\frac{s(l)/\alpha(l) - s(r) /\alpha(r)}{1/\alpha(l) + 1/\alpha(l') }\right\|_{\infty} + \left\|\frac{s(l')/\alpha(l') - s(r) /\alpha(r)}{1/\alpha(l) + 1/\alpha(l') }\right\|_{\infty} \leq (2 \log k) D(\delta/k).\] \end{proof} \begin{remark} If all weights are uniform, the summation in (\ref{eqn:sum-path}) becomes a geometric series and can be bounded by a constant. Therefore, we can remove the factor $\log k$ in Theorem~\ref{thm:multi}. \end{remark} \subsection{Other Proofs} \begin{proof}[Proof of Proposition~\ref{prop:z-dist}] Let $\boldsymbol{B}=\left[\begin{array}{c} \sqrt{\phi} \boldsymbol{I} \\ \sqrt{1-\phi} \boldsymbol{X}^{\top} \end{array}\right]$. We have from Threorem~\ref{thm:main} that $\boldsymbol{w}_n = \boldsymbol{B} \boldsymbol{\eta} = \left[\begin{array}{c} \sqrt{\phi} \boldsymbol{\eta} \\ \sqrt{1-\phi} \boldsymbol{X}^{\top} \boldsymbol{\eta} \end{array}\right] $ is a mean zero $(c/2q, \boldsymbol{P})$ sub-Gaussian random vector, where \begin{align*} \boldsymbol{P} & = \boldsymbol{B} (\boldsymbol{B}^{\top} \boldsymbol{B})^{-1} \boldsymbol{B}^{\top} \\ & = \left[ \begin{array}{cc} \phi \boldsymbol{Q} & *\\ * & * \end{array} \right]. \end{align*} Therefore, by sub-Gaussianity of $\boldsymbol{w}_n,$ for any vector $\boldsymbol{u},$ we have \[ \mathrm{E} \brs{ \exp\br{\sqrt{\phi}\boldsymbol{\eta}^{\top} \boldsymbol{u} }} \leq \exp \br{ \frac{c}{4q} \boldsymbol{u}^{\top} \br{\phi \boldsymbol{Q}} \boldsymbol{u}.} \] We therefore have the sub-Gaussian claim. The sub-exponential result follows similarly. \end{proof} \begin{proof}[Proof of Proposition~\ref{prop:spectral-bound}] Suppose $c = \log(2n/\delta)/q.$ We have from Proposition~\ref{prop:z-dist} that $\boldsymbol{z}$ is a $(\sqrt{c/2q}, \boldsymbol{Q})$ sub-Gaussian vector. This implies that $\mathrm{Cov}(\boldsymbol{z}) \preceq \frac{c}{2q} \boldsymbol{Q}.$ When $c= 9.3 \log(2n/\delta),$ we have from Proposition~\ref{prop:z-dist} that $\boldsymbol{\eta}$ is a $(\sqrt{8Ac}, \alpha, \boldsymbol{Q})$ sub-exponential vector. Now, Lemma~\ref{lem:subexp-var} gives that \begin{align*} \mathrm{Cov}(\boldsymbol{z}) \preceq \frac{3}{2} 8Ac \boldsymbol{Q} = 12 A c \boldsymbol{Q}. \end{align*} \end{proof} \begin{proof}[Proof of Proposition~\ref{prop:balance}] When $c = \frac{\log(4n/\delta)}{q}$ we have that with probability at least $1-\delta/2,$ $\boldsymbol{B} \boldsymbol{\eta}$ is a $\br{\sqrt{c/2q}, \boldsymbol{Q}}$ sub-Gaussian vector. Since $\boldsymbol{B} \boldsymbol{\eta} = \left[\begin{array}{c} \sqrt{\phi} \boldsymbol{\eta} \\ \sqrt{1-\phi} \boldsymbol{X}^{\top} \boldsymbol{\eta} \end{array}\right]$ and $\boldsymbol{Q} \preceq \phi \boldsymbol{I},$ we have $\sqrt{1-\phi} \sum_i \eta_i \boldsymbol{x}_i = \sqrt{1-\phi} \boldsymbol{X}^{\top}\boldsymbol{\eta}$ is a $\br{\sqrt{1/\phi}\sqrt{c/2q}, \boldsymbol{I} } $ sub-Gaussian random vector. By sub-Gaussian concentration, we have with probability at least $1-\delta/2d$, $|\br{\boldsymbol{X}^{\top} \boldsymbol{\eta}}^{\top} \boldsymbol{e}_i| \leq \br{\sqrt{(c/2\phi (1-\phi) q}} \sqrt{4d/\delta}. $ The result follows by a union bound over $\boldsymbol{e}_1,...,\boldsymbol{e}_d$ and $\|\boldsymbol{X}^{\top}\boldsymbol{\eta} \|_{2} \leq \sqrt{d}\|\boldsymbol{X}^{\top}\boldsymbol{\eta} \|_{\infty}. $ When $c = 9.3 \log(4n /\delta),$ then with probability $1-\delta,$ $ \left[\begin{array}{c} \sqrt{\phi} \boldsymbol{\eta} \\ \sqrt{1-\phi} \boldsymbol{X}^{\top} \boldsymbol{\eta} \end{array}\right]$ is a $(\sqrt{8Ac}, \alpha, \boldsymbol{Q})$ random vector. Like before, this implies $\sqrt{1-\phi} \boldsymbol{X}^{\top} \boldsymbol{\eta}$ is a $(\sqrt{8Ac}, \alpha, \phi \boldsymbol{I})$ random vector. By sub-exponential concentration, we have \begin{align*} P \br{ \left|\sqrt{1-\phi} \br{\boldsymbol{X}^{\top} \boldsymbol{\eta}}^{\top} \boldsymbol{e}_i \right| \geq t} \leq \left\{ \begin{array}{cc} 2 \exp \br{-t^2 \phi/2 \nu^2} & \text{ when } t \leq \frac{\nu^2}{\alpha \sqrt{\phi}} \\ 2 \exp \br{ -t/2 \alpha} & \text{ otherwise } \end{array} \right . \end{align*} Setting $t = \sqrt{ 2 \log (4d \delta) (8Ac)} \leq c \leq \nu^2/\alpha, $ (when $n \geq d$), we get that with probability at least $1-\delta/2d,$ we have \[ |\sqrt{1-\phi} \br{\boldsymbol{X}^{\top} \boldsymbol{\eta}}^{\top} \boldsymbol{e}_i| \leq 9.3 \sqrt{ \frac{ \log (4d /\delta) \log (4n/\delta)}{\phi}.} \] The rest follows by a union bound. \end{proof} \begin{proof}[Proof of Proposition~\ref{prop:ate-concentration}.] First consider the case when $c = \log(2n/\delta)/q = \sigma \sqrt{2 \log(2 n/ \delta)}$. By Proposition~\ref{prop:z-dist}, $\boldsymbol{\eta}$ is $(\sigma, \boldsymbol{Q})$ sub-Gaussian with $\sigma = \sqrt{c/2q}$. From Lemma~\ref{lem:subgaussian-bound}, we have \begin{align*} P(|\boldsymbol{\eta}^{\top}\boldsymbol{\mu}| > c\sqrt{\boldsymbol{\mu}^T\boldsymbol{Q}\boldsymbol{\mu}}) \leq 2 \exp \br{ - \frac{c^2}{2\sigma^2}} = \delta / n. \end{align*} Now consider $c = 9.3 \log(2n/ \delta)$. By Proposition~\ref{prop:z-dist}, $\boldsymbol{\eta}$ is $(\nu,\alpha, \boldsymbol{Q})$ sub-exponential with $\nu = \sqrt{8Ac}$. Note that $$ {\nu^2}/{\alpha} = {8Ac } /{(2/B)} = {4ABc} > c . $$ From Lemma~\ref{lem:subexp-bound}, we have \begin{align*} P(|\boldsymbol{\eta}^{\top}\boldsymbol{\mu}| > c\sqrt{\boldsymbol{\mu}^T\boldsymbol{Q}\boldsymbol{\mu}}) \leq 2 \exp \br{ - \frac{c^2}{2\nu^2}} \\ = 2 \exp \br{ - \frac{c}{16A}}\leq \delta / n. \end{align*} The result then follows by a union bound. \end{proof} \begin{proof}[Proof of Proposition~\ref{prop:ate-ridge}.] This follows from Proposition~\ref{prop:spectral-bound} and the proof of Theorem 3 in \cite{harshaw2020balancing}. \end{proof} \subsection{Robustness} \label{sec:robust} Proposition~\ref{prop:spectral-bound} immediately gives a bound on $\lambda_{\max}(\mathrm{Cov}(\boldsymbol{z}))$ and hence bounds accidental bias. \begin{remark}[Accidental Bias] With probability $\geq 1-\delta$ the maximum eigenvalue of $\mathrm{Cov}(\boldsymbol{z})$ satisfies \[ \lambda_{\max}\br{\mathrm{Cov}(\boldsymbol{z})} \leq \frac{\sigma^2}{\phi}. \] \end{remark} \section{Simulations} \label{app:sims} \subsection{Description} \begin{table*}[h!] \centering \begin{tabular}{rccc} \toprule \textbf{DGP Name} & $\mathbf{X}$ & $\mathbf{y(0)}$ & $\mathbf{y(a)\; \mathrm{\bf s.t.}\; a \neq 0}$\\ \midrule \textbf{QuickBlockDGP} & $X_{i,k} \sim \mathcal{U}(0,10), \forall k \in \{1,2\}$ & $\prod_{k=1}^2 X_{k} + \epsilon$ & 1 + y(0) \\ \midrule \textbf{LinearDGP} & $X_{i,k} = \epsilon_{k}, k \in \{1,\dots,4\}$& $\mathbf{X} \beta + \frac{1}{10}\epsilon_{y(0)}$ & 1 + $\mathbf{X} \beta + \frac{1}{10}\epsilon_{y(1)}$\\ \midrule \textbf{LinearDriftDGP} & $X_{i,k} = \frac{i}{N} + \epsilon_{k}, k \in \{1,\dots,4\}$& $\mathbf{X} \beta + \frac{1}{10}\epsilon_{y(0)}$ & 1 + $\mathbf{X} \beta + \frac{1}{10}\epsilon_{y(1)}$\\ \midrule \textbf{LinearSeasonDGP} & $X_{i,k} = \sin(2\pi\frac{i}{N}) + \epsilon_{k}, k \in \{1,\dots,4\}$& $\mathbf{X} \beta + \frac{1}{10}\epsilon_{y(0)}$ & 1 + $\mathbf{X} \beta + \frac{1}{10}\epsilon_{y(1)}$\\ \midrule \textbf{QuadraticDGP} & $X_{i,k} = 2\beta_k - 1, k \in \{1, 2\}$& $\mu_0 + \frac{1}{10}\epsilon_{y(0)}$ & 1 + $\mu_0 + \frac{1}{10}\epsilon_{y(1)}$\\ &$\mu_0 = X_1 - X_2 + X_1^2 + X_2^2 - 2 X_1 X_2$&& \\ \midrule \textbf{CubicDGP} & $X_{i, k} = 2\beta_k - 1, k \in \{1, 2\}$& $\mu_0 + \frac{1}{10}\epsilon_{y(0)}$ & 1 + $\mu_0 + \frac{1}{10}\epsilon_{y(1)}$\\ &$\mu_0 = X_1 - X_2 + X_1^2 + X_2^2 - 2 X_1 X_2$&& \\ &$+ X_1^3 -X_2^3 - 3 X_1^2 X_2 + 3X_1 X_2^2$&&\\ \midrule \textbf{SinusoidalDGP} & $X_{i,k} = 2\beta_k - 1, k \in \{1, 2\}$& $\mu_0 + \frac{1}{10}\epsilon_{y(0)}$ & 1 + $\mu_0 + \frac{1}{10}\epsilon_{y(1)}$\\ &$\mu_0 = \sin\left(\frac{\pi}{3} + \frac{\pi X_1}{3} - \frac{2 \pi X_2}{3}\right)$&& \\ &$-6 \sin(\frac{\pi X_1}{3} + \frac{\pi X_2}{4}) +6 \sin(\frac{\pi X_1}{3} + \frac{\pi X_2}{6})$&&\\ \bottomrule \end{tabular} \caption{Data generating processes used in simulations. All $\epsilon$s indicate a standard normal variate and all $\beta$s indicate a standard uniform variate. $i$ indicates a unit's index. Covariate vectors are row-normalized to unit norm, except for the QuickBlock simulation which just normalized relative to the maximum row norm.} \label{tab:dgps} \end{table*} \clearpage \subsection{Binary Treatments} \paragraph{Bias.} Figure~\ref{fig:bias} shows that none of the examined methods are biased (but that does not imply that they are robust \citep{efron1971forcing, harshaw2020balancing}). \begin{figure} \centering \includegraphics[width=0.475\textwidth]{figures/bias-1.pdf} \caption{Bias} \label{fig:bias} \end{figure} \paragraph{Imbalance.} To measure linear imbalance, we calculate the $L_2$ norm of the difference in covariate means. While this is far from the only measure of imbalance, it serves as an effective metric to demonstrate how well various metrics serve to eliminate linear imbalances, a common diagnostic used my experimenters. We further normalize across sample-size by multiplying by the sample size. Since all methods are unbiased, this has the effect of showing parametric convergence rates as a flat line in the graph. Unsurprisingly, methods which directly optimize for linear imbalance perform very well in Figure~\ref{fig:imba}. Our proposed algorithm has better finite sample imbalance minimization than does the algorithm of \citep{alweiss2020discrepancy} due to the finite sample improvements of \citep{dwivedi2021kernel}. \begin{figure} \centering \includegraphics[width=0.45\textwidth]{figures/imba-1.pdf} \caption{Imbalance. BWD is highly effective at eliminating linear imbalance between groups.} \label{fig:imba} \end{figure} \subsection{Non-uniform assignment} \paragraph{MSE.} Figure~\ref{fig:mse-q} shows the resulting mean squared-error attained by methods which support marginal probabilities not equal to one-half. All methods perform well, with DM performing effectively on nearly linear processes, and QuickBlock performing slightly better when the true process is highly non-linear. \begin{figure} \centering \includegraphics[width=0.475\textwidth]{figures/q-mse-1.pdf} \caption{Marginal probability of treatment} \label{fig:mse-q} \end{figure} \paragraph{Marginal probability.} The evaluation in Figure~\ref{fig:marginal-q} examines how closely each method hews to the desired marginal probability of treatment. All methods do a good job of ensuring the appropriate marginal distribution. \begin{figure} \centering \includegraphics[width=0.475\textwidth]{figures/q-marginal-1.pdf} \caption{Marginal probability of treatment} \label{fig:marginal-q} \end{figure} \subsection{Multiple Treatments} \paragraph{Entropy.} To ensure that treatment is being assigned with the correct marginal probability, we can measure the normalized entropy of the empirical marginal treatment probabilities. If the values are perfectly uniform, then the value will be exactly one. As the normalized entropy decreases, the marginal probabilities are more uneven, indicating a failure to match the desired marginal distribution. BWD performs very similarly to complete randomization (which almost exactly matches the desired marginal probabilities), slightly out-performing \citep{smith1984sequential}. Note that while \citet{smith1984sequential} only seeks to optimize the marginal probability of treatment for each unit, BWD additionally balances covariates. \begin{figure} \centering \includegraphics[width=0.475\textwidth]{figures/multi-marginal-entropy-1.pdf} \caption{Entropy} \label{fig:entropy} \end{figure} \end{appendix} \bibliographystyle{abbrvnat}
{'timestamp': '2022-03-07T02:03:50', 'yymm': '2203', 'arxiv_id': '2203.02025', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.02025'}
arxiv
\section{Introduction}\label{sec:introduction} The Brazilian Supreme Court (\textit{Supremo Tribunal Federal} (STF) in Portuguese) is the highest court of law in Brazil. It is primarily responsible for guarding the rights in the Brazilian Constitution. There are eleven justices, nominated by the President and confirmed by the Senate. Among its multiple attributions, STF can provide a final judgment on appeals from other courts and a judicial review on some norms created in the country. In 2004, Brazil had more than 100 million pending cases in the Judiciary\cite{cnjpendingcases}. To reduce those numbers and avoid conflicting decisions, the National Congress amended the Constitution that same year, allowing STF to create binding precedents (Súmulas Vinculantes in Portuguese). These precedents consolidate understandings on judicial issues that both Executive and lower Judiciary branches must follow. From 2004 to 2020, the Court ruled 58 of those precedents, covering some of the most critical discussions from crime to tax law\cite{stfsumulas}. For example, binding precedent 37 addresses the issue of salaries of public servants and has the following statement: \textit{``It is not up to the Judiciary, which has no legislative function, to increase the salaries of public servants, on the grounds of isonomy.''} At first, the intention was to end the controversy. Still, the STF ends up later resolving thousands of cases that present a divergence on the application of a binding precedent (BP). Consequently, STF's justices regularly cite these binding precedents in their decisions. We consider a decision as a justice's ruling on a particular legal case, written and published on a legal document afterward. The terms ``decision'' and ``legal document'' are used interchangeably in this paper. Given the large number of decisions in STF\,---\,more than 1 million from 2011 to 2020 \cite{stfnumberrulings}\,---\,, lawyers and other judicial experts face difficulties finding citations to BPs and analyzing them. Such difficulties arise from the lack of a computational tool to help the experts to find, for instance, decisions that cite a particular BP of interest. Moreover, it is usual to have decisions with hundreds of pages, making it hard for lawyers and other experts to find parts of interest where justices cite, quote, or implicitly mention a BP. We worked alongside a domain expert to address these challenges to develop a web-based visual analytic tool named LegalVis. We designed this system to explore and analyze the texts of STF's legal documents, particularly their explicit or implicit relationships with binding precedents. In contrast to an explicit citation to a BP, which can be easily found by searching ``Binding Precedent \#X'' (in free translation) in the document's content, finding potential citations to a BP is not a straightforward task. To tackle this issue, LegalVis relies on a machine learning model to identify potential citations, building upon an interpretability mechanism to provide reliable explanations for the model's decisions. This system also provides mechanisms for quickly identifying documents and BPs of interest through multiple linked views and interactive tools. These features permit easy analysis of the content of the documents and, at the same time, allow us to interpret the relationships that exist between similar documents and their relation with the BPs. We demonstrate the potential of LegalVis through two usage scenarios that show insightful and relevant findings. Our usage scenarios were validated by six domain experts not involved in the system's development, who also outlined the usefulness and potential of LegalVis. Both components in LegalVis, the potential citation identification model and the visual analytics tool, could be applied to any court within the judicial system. We have chosen to deal with STF's decisions due to their relevance in the national context. Our main contributions are: \begin{itemize} \item A pipeline for the identification of potential (\emph{i.e.}\xspace, non-explicit) citations that relies on (i) a machine learning model and (ii) an interpretability mechanism that provides reliable explanations for the model's decisions. Properly handling legal data, especially non-English data, is a sensitive task by its nature. Our pipeline and obtained results benefit this application domain and may inspire other applications. \item LegalVis, a visual analytics system that assists lawyers and other judicial experts in exploring legal documents and binding precedents. \item Two usage scenarios, validated by six domain experts not involved in the system's development, showing relevant judicial findings concerning STF's decisions. \end{itemize} \section{Conclusion} In this paper, we presented LegalVis, a web-based visual analytic system designed to assist lawyers and other judicial experts in analyzing legal documents that cite or could potentially cite binding precedents. LegalVis first identifies potential citations by implementing a simple yet powerful machine learning model based on classification. Then, an interpretability mechanism also incorporated into the system provides reliable explanations for the model's decisions. Finally, all this information becomes accessible through the three interactive and linked views that compose the system. Qualitative and quantitative analyses validated the performance of the proposed model and two usage scenarios demonstrated the usefulness and effectiveness of LegalVis system. Both scenarios were validated by six domain experts not involved in the system's development, who also reported positive feedback. \section{Related Work} In this paper, we are interested in identifying and analyzing decisions somehow related to binding precedents, either by explicitly citing or implicitly mentioning them. In this context, a crucial step is to compute and visualize the similarity between the binding precedent and parts of a legal document. In the following, we discuss related research under two perspectives: visualization of similarities between parts of documents and works related to legal documents analysis. \subsection{Visualizing Similarities between Parts of Documents} Several text visualization techniques have been proposed for many tasks, domains, and data types. We point the reader to the surveys by Alharbi and Laramee~\cite{alharbi2018sos} and by Kucher and Kerren~\cite{kucher2015text} for a broader understanding of this topic. One particular category of techniques focuses on visualizing document-level similarity, which is generally achieved by representing documents as points in a 2D or 3D visualization plane and positioning them accordingly~\cite{cao2016overview, alsakran2011streamit, van2008visualizing}. Rather than just knowing whether two documents are similar to each other, one may be interested in exploring similarity at a fragment-level, \emph{i.e.}\xspace, by visually comparing parts (or fragments) of documents (\emph{e.g.}\xspace, paragraphs or sentences) to a reference text and highlighting their similarities. A high similarity between the two parts is expected when there is text repetition, which is one of the text reuse possibilities~\cite{surveyTextAlignment}. Still, even parts that do not share many words may be similar to each other depending on the underlying semantics~\cite{use}. Either way, a visual analysis of these similar parts' contents is helpful in various contexts, as in tasks related to technical writing~\cite{soto2015similarity} and plagiarism identification~\cite{potthast2013overview,riehmann2015visual}. Examples include \textit{PicaPica}~\cite{riehmann2015visual}, a visual analytic tool that highlights differences and commonalities between two documents to help users in detecting plagiarism, and the \textit{Text Re-use Browser}~\cite{janicke2014visualizations}, which highlights pairs of similar sentences of the Bible via a dot plot matrix. Different visualization techniques support the comparison between documents at a fragment-level, from grid-based heatmaps~\cite{janicke2014visualizations, abdul2017constructive} to side-by-side views~\cite{riehmann2015visual}. They usually fall into one of two basic categories depending on the level of details on the raw text they provide~\cite{janicke2017visual}: while \emph{close reading} techniques allow the analysis of the text itself (words, phrases, ideas, and so on\,---\,see, \emph{e.g.}\xspace, \textit{Text Re-use Reader}~\cite{janicke2014visualizations}), \emph{distant reading} techniques\footnote{\emph{Close reading} and \emph{distant reading} are terms firstly created to categorize visualization techniques applied to digital humanities~\cite{cheema2016annotatevis}.} generate abstract representations that summarize the texts' information (see, \emph{e.g.}\xspace, \textit{Compare Cloud}~\cite{diakopoulos2015compare} and ViTA~\cite{ abdul2017constructive}). As stated by Jänicke et al.~\cite{janicke2017visual}, hybrid strategies that guide users from distant to close reading (top-down approach) successfully apply the well-established visual information-seeking mantra \emph{``overview first, zoom and filter, then details-on-demand"}~\cite{visualmantra}. Visual analytic tools usually rely on linked views to accomplish hybrid visualizations. One such example is the system proposed by Kiesel et al. to compare argument structures in essays~\cite{kiesel2020visual}. Our approach computes syntactic and semantic similarities (for explicit and potential citations, respectively) between parts of a document and the binding precedent being cited. To show such similarities intuitively and effectively, we rely on a hybrid approach that allows both distant and close readings in a top-down manner. Contrary to the mentioned systems, LegalVis is designed to handle Brazilian legal documents and particularities. We discuss studies related to the analysis of legal documents in the following section. Finally, different visual encoding strategies may be employed to optimize the analysis of similar parts' contents when in close reading. One such choice is the use of colors (in the background or font color) to indicate common words or shared ideas~\cite{riehmann2015visual}. Other possibilities include changes in the font size, connections, and glyphs~\cite{janicke2017visual}. LegalVis employs the first option. \subsection{Legal Documents Analysis} In common law countries, such as the United States and Australia, lawyers and other judicial experts often search for precedents, looking at how old decisions could help solve open cases~\cite{zhang2007semantics}. In this context, automated text processing becomes a valuable tool that allows these professionals to search and analyze legal documents~\cite{barros2018case,legal_document_review}, especially when the task of interest involves finding relevant precedents or similar decisions~\cite{correia2019exploratory, mandal2017measuring}. Given the many benefits of visual analytics, some authors have created visualization tools to help users explore such a high amount of legal data. An example is \textit{Knowlex}~\cite{lettieri2017legal}, a visual analytic system that links and exhibits Italian legal documents from different sources related to the user's law of interest. By employing citation networks, \textit{EUCaseNet}~\cite{lettieri2016computational} allows one to visually explore citations involving judgments from the European Court of Justice through network structural properties that will enable, \emph{e.g.}\xspace, recognizing relevant precedents and judges' behaviors. Visualizations applied to other countries' legal data also exist, for example, in Netherlands~\cite{wyner2017answering} and Portugal~\cite{carvalho2018transforming}. Despite advances in the development of visual frameworks to assist in legal documents analysis, users are still challenged in exploring and visualizing legal data in Brazil. The Brazilian courts' websites and other official platforms usually exhibit copious pages of results, each containing several and long decisions\cite{barros2018case}. A few efforts have been made to enhance the visualization of these data. One of them is the \textit{Supremo 2.0} system~\cite{chada2015visualizing}, a tool designed to visualize STF's quantitative and multidimensional data. By working with a dataset similar to ours, Gomez-Nieto et al.~\cite{gomez2015understanding} proposed a visual analytic tool that allows exploring case-related aggregated information from STF through different representations (\emph{e.g.}\xspace, stacked graphs, treemaps, and heatmaps). Our approach addresses a challenge not pursued by any other tool, even though some of them have characteristics in common with ours, such as linked views or the use of STF's data. LegalVis's primary goal is to provide a compelling exploration of legal documents that explicitly or potentially cite binding precedents. This involves an effective visualization and suitable machine learning and interpretability methods to identify and explain potential (non-explicit) citations. Not even those studies that also rely on STF's data~\cite{gomez2015understanding,chada2015visualizing} consider this type of citation information in their work. \myparagraph{Other tools and search engines.} Various platforms developed search engines for legal documents and jurisprudence. In Brazil, \textit{Buscador Dizer o Direito}~\cite{dizerDireito} presents commented documents, although the number of commentaries may be considered small, and \textit{OAB Juris~}\cite{oabjuris} uses artificial intelligence algorithms to present more relevant results. Other Brazilian platforms include \textit{JusBrasil}~\cite{jusbrasil} and \textit{LexML}~\cite{lexml}. In the Netherlands, \textit{Bluetick}~\cite{bluetick} offers suggestions and similarity concepts during the search. In general, however, these platforms do not offer efficient visualization or natural language processing (NLP) algorithms that could improve results and time during a user's search. Some other tools are more elaborate, offering solutions based on analytics, visualization, machine learning, digitalization, and process automation. In Brazil, \textit{Finch Platform}~\cite{finchplatform} and \textit{Legal One}~\cite{legalone} are some of the most known tools, and, in United States, there are \textit{Lexis}~\cite{lexis}, \textit{Westlaw}~\cite{westlaw}, and \textit{Casetext}~\cite{casetext}. The last one, in particular, allows the use of Transformer-based models~\cite{transformer} to search for case laws that are similar to given sentences. As stated, none of these tools and search engines meets LegalVis's objectives. \section{System Overview} After several weekly meetings with a domain expert, we identified the challenges behind exploring legal documents and binding precedents. We characterize a set of questions/requirements to be addressed by the analytical tool. We present the system's requirements and the concrete visualization tasks that guided our visual design throughout this section. We also provide an overview of the system's workflow. \figWorkflow \subsection{System Requirements} After elucidating the domain experts' needs, we came up with several questions grouped into three categories. The first category comprises questions related to the identification of decisions that cite or could potentially cite a binding precedent: \myparagraph{Q1.1.} Which decisions in the STF (overall, per Justice rapporteur, and type of decision) explicitly cite a specific binding precedent? \myparagraph{Q1.2.} Which decisions in the STF (overall, per Justice rapporteur, and type of decision) could potentially cite a specific binding precedent? In other words, which decisions end up citing a particular binding precedent in a non-explicit manner? \myparagraph{Q1.3.} Are there decisions related to a to-be-created binding precedent? \vspace{0.2cm} The second category of questions are related to the filtering and analysis of relevant decisions: \myparagraph{Q2.1} Which decisions cite a specific binding precedent on a given date? \myparagraph{Q2.2.} Given a date, are there similar decisions that cite the same binding precedent? \myparagraph{Q2.3.} Which are the most relevant decisions among those that cite a specific binding precedent on a given date regarding the similarity between binding precedent and decision? Finally, the third category of questions addresses issues related to the similarity between parts of decisions and BPs and the relevance of those parts: \myparagraph{Q3.1.} How similar is each part of a decision to the corresponding binding precedent? \myparagraph{Q3.2.} Which parts of a decision cite or are likely to cite a specific binding precedent? \myparagraph{Q3.3.} Given many decisions, can one quickly access multiple decisions of interest and their relevant parts when analyzing different dates and binding precedents? \subsection{Design Tasks} Based on the requirements described above, we raised concrete visualization tasks to guide the LegalVis system's development, following the mantra \emph{``overview first, zoom and filter, then details-on-demand"}~\cite{visualmantra}. \myparagraph{T1 - Identification of explicit and potential citations:} The system should exhibit decisions that explicitly cite a specific binding precedent (Q1.1) and identify/exhibit those that could potentially mention it (non-explicit citation) (Q1.2, Q1.3). \myparagraph{T2 - Overview of decisions and binding precedents:} The system should provide an overview of all the decisions and binding precedents, highlighting the chronological order they appear (Q1.3). \myparagraph{T3 - Filtering and selecting decisions:} The system should allow filtering decisions by Justice rapporteur, by decision type, and by type of citation (explicit or potential) (Q1.1, Q1.2, Q1.3). It should also allow selecting decisions based on the date and binding precedent (Q2.1). \myparagraph{T4 - Grouping and ordering decisions:} The system should identify and group similar decisions that cite the same binding precedent on a given date (Q2.2) and order them in the layout according to the similarity between binding precedent and parts of a decision (Q2.3). \myparagraph{T5 - Highlight in decisions' relevant parts:} The system should quickly identify the most similar paragraphs/sentences to the binding precedent (Q3.1). It should also highlight those parts that (either explicitly or potentially) cite that precedent (Q3.2). \myparagraph{T6 - Document browsing history:} The system must provide means to access decisions already analyzed quickly, regardless of the date and binding precedent (Q3.3). \subsection{Workflow} After mapping the requirements into design tasks, we define the system's workflow (see \figref{fig:workflow}). In the first stage, \textbf{data collection (a)}, we consult the digitized decisions stored in a database. They already contain the explicit citations that were found using regular expressions. However, it is necessary to query and label the decisions and binding precedents that we will use in the following stages (details in \secref{sec:data_set}). In the second stage, \textbf{identification of potential citations (b)}, we use the collected data to train a machine learning model that characterizes a citation to a particular binding precedent. After that, the procedure infers potential citations and explains the reason behind the decision by employing an interpretability method (details in \secref{sec:potentialCitation}). Finally, in the third stage, \textbf{visualization (c)}, users explore and visualize documents that explicitly cite or that can potentially be citing binding precedents. LegalVis comprises three linked view components: Global View, which presents an overview of the data under a temporal perspective; Paragraph Similarities View, which allows for filtering and grouping relevant documents; and Document Reader, which shows a document's content and points out which parts of the document are likely to mention a binding precedent (details in \secref{sec:visual}). \section{Dataset} \label{sec:data_set} \figCitations When an STF justice decides a case, this decision is consolidated in a document. Each document contains the decision's text, publication date, the justice that conducted the process (justice rapporteur), and the document type (\emph{e.g.}\xspace, Complaint or Extraordinary Appeal). In this work, we are interested in STF decisions that are somehow related to a binding precedent, explicitly or \emph{potentially} citing it. In total, we have 58 binding precedents, idealized as a mechanism to create a consolidated understanding among the STF's justices. We collected our dataset from a partnership with the \emph{Supremo em Números} (``STF in Numbers'', in free translation) project~\cite{falcao2013relatorio}\,---\,a project that seeks to assess legal and computer knowledge to produce unprecedented data on the Supreme Court. This dataset contains more than 2,500,000 documents since 1988 and metadata such as the number of the BP being cited (if that is the case) and document type. Considering only decisions that explicitly cite at least one of the 58 BPs, there are 38,364 documents, totaling 41,031 citations (some documents may mention more than one BP). The number of citations per BP does not follow a uniform distribution, as we can see in \figref{fig:citations_bp}. As requested by the domain experts, the name of the justice rapporteur is essential for the analysis. % However, this information was not in the initial dataset, so we extracted it using regular expressions in the document's content. As part of the data cleaning process, we had some difficulties: (i) documents with different titles but same content (we refer to them as \emph{duplicated} documents), and (ii) documents in which it is not trivial to extract out the justice name. However, these problems did not impact our work's development, and we give more details in~\secref{sec:limitations}. In this work, we decided to deal with documents that explicitly cite at least one of the ten most-cited BPs (\emph{i.e.}\xspace, 3, 4, 10, 11, 14, 17, 20, 26, 33, and 37). We made this decision to have a representative sample of documents and citations. In fact, after ignoring the ``duplicated" documents and considering only documents that cite just one BP each, we gathered 29,743 documents and 31,070 citations related to these 10 BPs, which corresponds to 77.5\% and 75.7\%, respectively, compared to all documents and citations from the initial dataset. Besides these 29,743 documents, we also consider other 30 thousand documents, without explicit citations, that we will use to identify potential citations (details in~\secref{sec:potentialCitation}). Finally, our documents generally have less than four thousand words (we have a word count histogram in Appendix B). \section{Identification of Potential Citations} \label{sec:potentialCitation} In the context of citations to binding precedents, relevant questions may arise. For instance, \emph{``are there documents that potentially cite a BP?''} (\emph{i.e.}\xspace, the document should have cited the BP but it has not), or \emph{``are the document and the BP related enough?''} These questions can help understand how STF works and if the BPs are correctly applied. In this section, we investigate the possibility of potential citations and how to find them. We describe our modeling of identification of potential citations as a classification task, and we discuss how to use classifiers to infer the citations. Our pipeline for identifying potential citations (\figref{fig:potential_pipeline}) is composed of two main steps: (a) the learning process, when the models learn what makes a citation, and (b) the potential citation inference, when we use the models to identify a potential citation and an interpretability technique to explain this decision. We give more details about these stages in the following. \subsection{Learning Process} \label{sec:learning_process} Suppose there is a function $d_{X} \colon U \to \mathbb{R}$ that takes a document $D$ from our corpus $U$ and returns a score of citing the binding precedent $X$. When a document has a ``good'' score through $d_X$, we can assign it to a potential citation group. Motivated by this reasoning, the potential citation identification process starts searching for such a function $d_X$. There are many ways to model the problem above. Two possible approaches are to consider the score $d_X$ as the distance between the document $D$ and the BP $X$ in some latent space or compute the probability of $D$ citing the BP $X$. With these approaches, when the distance between $D$ and BP $X$ is small, or $D$ citing $X$'s probability is high, we say that we found a potential citation. The distance between $D$ and BP $X$ can be computed by embedding $D$ and BP $X$ in a high dimensional vector space (\emph{e.g.}\xspace, Doc2vec~\cite{doc2vec}) and then calculating the distance in this space. In the second case, we could compute the probability of a document $D$ citing BP $X$ by modeling the problem as a classification task. If we fit a classification model in documents that cite the BP $X$, the model can learn what makes a document cite the precedent. Therefore, we could employ the trained classifier to verify whether a new document cites the BP $X$, using the model's probability as a confidence level for this assignment. In this work, we rely on the classification approach to identify potential citations to BPs. The distance-based approach is similar to clustering with centers in the BPs, so the approach is unsupervised by nature. On the other hand, the classification is supervised and leverages the labels of the other documents. It is also easier to identify a potential citation confidence threshold in terms of probabilities than distances (\emph{e.g.}\xspace, documents with model's probability greater than $t_c$ are assigned to a potential citation). Moreover, it is more straightforward to apply interpretability techniques to classification models' decisions (\emph{e.g.}\xspace, using Lime \cite{lime} or Anchors \cite{ribeiro2018anchors}) instead of trying to interpret citation inference using vector representations. \myparagraph{Data Pre-processing:} Before training our models, we need to process our data and create a balanced sample dataset, further split into training, validation, and test datasets. We generate the sample dataset by choosing a random sample of documents that cite one of the ten most-cited BPs. As described in~\secref{sec:data_set}, we do not consider ``duplicated'' documents or documents citing more than one BP. Avoiding duplicated documents is necessary to prevent the classifier from overfitting the data. Having documents citing only one BP ensures they only have one label, making the classification task more straightforward. We chose only to consider the ten most-cited precedents. The reasons for this decision are twofold. First, the number of documents associated with less frequent BPs is not enough to train the models, demanding extra effort to remedy this situation, such as using a data augmentation scheme. Second, the reduced number of documents associated with the less frequent BPs can quickly be inspected manually, so there is no need to undertake efforts to develop sophisticated resources to analyze them. In total, our sample dataset contains 6,730 documents balanced among the ten classes. Given that most documents explicitly contain the text ``Binding Precedent \#X'' (in free translation), we remove these citations using regular expressions to avoid hints during the classification process. The documents also underwent a standard NLP text pre-processing, which included converting the text to lowercase, \emph{tokenization}, removing punctuation and stop words, and \emph{lemmatization}. \myparagraph{Text Embedding:} As mentioned above, we use a classification model to assess the probability of a document citing a BP. To assess different classifiers' performance, we rely on text embedding methods to generate a vector representation of the documents. We test different embeddings to evaluate their performance: TF-IDF~\cite{Robertson2004}, Doc2vec~\cite{doc2vec}, Universal Sentence Encoder (USE)~\cite{use}, and Longformer~\cite{beltagy2020longformer}. In TF-IDF's particular case, we have also applied a dimensionality reduction procedure to map the documents to a 50-dimensional space using Truncated Singular Value Decomposition (SVD)~\cite{truncated_svd}. We call the final representation Truncated TF-IDF. The reason to consider Longformer, instead of a more popular language model, \emph{e.g.}\xspace BERT \cite{bert}, is that Longformer overcomes BERT's limitation of 512 tokens. Note that USE and Longformer do not need a pre-processed text (as described in the previous paragraph) because both have their tokenization mechanism. \figPipeline \myparagraph{Classification:} Support Vector Machines (SVM) are complex enough for real-world classification problems and simple enough to be analyzed mathematically~\cite{svm}. Our study considers SVM with linear and Radial Basis Function (RBF) kernels. Moreover, given that Longformer~\cite{beltagy2020longformer} has a linear classification neural network layer plugged into it, we also fine-tuned it to assess its classification performance in our context. The described classifiers are used to search for potential citations in unlabeled data, assigning probabilities to each document to belong to each class. To get probabilities from an SVM, we need to make calibration: using labeled data, create a map from the classifier's output (SVM scores) to a probability estimate for each class, which sum up to 1. To create this map, we use the calibration method from Platt et al.~\cite{platt1999probabilistic} for SVM with linear kernel and the Wu et al.~\cite{wu2004probability} method for RBF kernel. Platt et al.'s method, precisely, does not support the multiclass case, so we calibrate each class in a ``one-vs-rest'' approach and normalize the results in the end to sum up to 1. This map will receive the SVM scores from a data instance and output a probability estimate for each class. \subsection{Potential Citation Inference} \label{sec:pot-ite-inf} This section describes how we use the classifiers to identify potential citations and understand the models' decisions (see~\figref{fig:potential_pipeline}~(b)). \myparagraph{Citation Inference:} The association between a text embedding technique and a classifier gives us what we call a \emph{model}. A model receives the raw text and returns the classifier's probabilities, which we interpret as the document's probability to cite each precedent. We consider a potential citation when the citation probability is greater or equal to a threshold $t_c \in [0,1]$ (chosen by the user). \myparagraph{Interpretability:} A concern when dealing with machine learning models is their interpretability. For instance, if Truncated TF-IDF combined with SVM points out that a document potentially cites BP 10 because of high returned probability, how can we understand the reasons behind this decision? Generally speaking, \emph{how can we trust this model?} Understanding why a model is taking a particular decision is of paramount importance~\cite{lime}, especially in sensitive scenarios like a legal document analysis. Consider document $X$ and its embedding vector $\mathbf{x} \in \mathbb{R}^d$ (\emph{e.g.}\xspace, TF-IDF vector). This document's probability of belonging to class $C$ is given by $f_C(\mathbf{x})$, with $f_C \colon \mathbb{R}^d \to [0,1]$ a model's returned probability for class $C$. Our particular interest is to know the importance of each sentence from document $X$ to the given probability, \emph{i.e.}\xspace, if each sentence has positive, negative, or neutral importance, and the magnitude of this importance. After preliminary tests have discarded the employment of the \emph{leave-one-out feature importance} (LOO)~\cite{loo} for interpretability due to its high sensitivity, we chose the \emph{Local Interpretable Model-agnostic Explanations} (Lime)~\cite{lime} method to tackle this issue. The intuition is that, by removing a specific sentence and obtaining the variation of probability $\Delta f_C$, we can measure the importance of this sentence for the prediction $f_C(\mathbf{x})$. More formally, we randomly remove some sentences from document $X$, vectorize this new document to $\mathbf{z}$, and add it to set $Z$. Doing this many times, we have a collection $Z$ of vectors around $\mathbf{x}$ in high dimensional space. We approximate $f_C(\mathbf{z})$ using a linear model $g(\mathbf{z})$, minimizing the approximation error $\mathcal{L}(f_C, g, \mathbf{z})$ in $\mathbf{z} \in Z$, but also constraining the complexity $\Omega(g)$ of $g$. This task can be interpreted as a weighted linear regression with regularization. We end with a model $g(\mathbf{z})$ that is linear over the sentences (\emph{i.e.}\xspace, the presence or absence of a sentence), where the linear model's coefficients can be interpreted as the importance score of each sentence to the final prediction $f_C(\mathbf{x})$. By default, Lime works with words, and there is also the possibility of interpreting entire paragraphs. A word division brings some advantages, such as detailing. Still, it does not immediately assess each sentence's importance to the decision (\emph{e.g.}\xspace, sentences similar to the BP text). A paragraph division is also interesting for visualization purposes (see, for example, \secref{sec:document_reader}), but it merges various sentences into one, hampering the precise identification of relevant parts. Therefore, our choice of working with sentences comprises the ``best of both worlds''. In our experiments, Lime proved to be very robust and reliable when dealing with sentences. \subsection{Modeling Results} \label{sec:modeling_results} The modeling described in \figref{fig:potential_pipeline} (\emph{i.e.}\xspace, fitting classifiers to data, using the classifiers to infer citations, and interpreting these inferences) needs to be validated. In this section, we evaluate the modeling process quantitatively and qualitatively. \figConfusion \myparagraph{Quantitative Analysis.} We fit the classifiers with the text embedding to a training set corresponding to 80\% of our labeled, balanced sample dataset (randomly chosen, preserving balancing). Before applying SVM, each text embedding coordinate was standardized, improving SVM classification performance~\cite{standardizeSVM}. Then, we performed a grid search and cross-validation to optimize SVM parameters (linear and RBF). We also fine-tuned the Longformer model for four epochs, with a batch size of 12 and a linear decrease of the learning rate. In general, all models performed well in the validation set (10\% of the sample dataset, preserving balancing), especially TF-IDF-based models and Longformer, as depicted in \tabref{tab:accuracies}. In particular, Truncated TF-IDF with linear SVM has an excellent performance when predicting the correct BP on this set, as shown in the confusion matrix comparing the true with the predicted BPs from \figref{fig:confusion_matrix}. Recall that the explicit mentions of the BPs were removed from the documents in the pre-processing step. \begin{table}[t!] \color{black} \footnotesize \centering \caption{Evaluation of models' performance on validation portion of the sample dataset. Precision, recall, and F1 score are the average of each class' metrics weighted by number of class instances.} \label{tab:accuracies} \begin{tabular}{cc|cccc} \textbf{Embedding} & \textbf{Classifier} & \textbf{Acc.} & \textbf{Precision} & \textbf{Recall} & \textbf{F1 score} \\ \hline \multirow{2}{*}{Trunc. TF-IDF} & Linear & 0.94 & 0.94 & 0.94 & 0.94 \\ & RBF & 0.94 & 0.94 & 0.94 & 0.94 \\ \hline \multirow{2}{*}{TF-IDF} & Linear & 0.94 & 0.94 & 0.94 & 0.94 \\ & RBF & 0.93 & 0.93 & 0.93 & 0.93 \\ \hline \multicolumn{2}{c|}{Longformer} & 0.93 & 0.93 & 0.93 & 0.93 \\ \hline \multirow{2}{*}{Doc2vec} & Linear & 0.84 & 0.85 & 0.84 & 0.84 \\ & RBF & 0.88 & 0.88 & 0.88 & 0.88 \\ \hline \multirow{2}{*}{USE} & Linear & 0.85 & 0.86 & 0.85 & 0.85 \\ & RBF & 0.86 & 0.87 & 0.86 & 0.86 \\ \hline \end{tabular} \end{table} \myparagraph{Qualitative Analysis.} The models' quantitative results support the idea that searching for potential citations can be solved as a classification task. Moreover, TF-IDF combined with SVM and Longformer presented pretty good results. However, Longformer tends to assign probability close to 1 to a particular class and the remaining probabilities close to zero. This fact makes it hard to interpret the probabilities returned by Longformer as a confidence level. In contrast, Truncated TF-IDF with SVM better distributes probabilities between 0 and 1. This fact added to other properties\,---\,ease of implementation, low dimensionality, and validation performance\,---\,rendered Truncated TF-IDF with linear SVM the better choice in our context. \myparagraph{Chosen model on test data.} The chosen model (Truncated TF-IDF with linear SVM), which had good performance on validation data (\autoref{tab:accuracies}), also performed well on test data (10\% of a sample dataset, balanced), achieving 0.96 in all metrics of \autoref{tab:accuracies}. \myparagraph{Identification Analysis.} To search for potential citations, we run our model with a document collection containing 30,000 documents that do not cite any BP (\secref{sec:data_set}). For sanity check, we also run our model in documents that explicitly cite the ten chosen BPs. Of course, when the model assigns a potential citation that is the same as the explicit citation, we continue calling it explicit citation. The goal is to rely on the classification model to find potential citations as one of the ten chosen BPs. The larger the user-defined threshold $t_c$ (\secref{sec:pot-ite-inf}, Citation Inference), the smaller the number of documents with potential citations, as presented in~\tabref{tab:potential_citations}. \figVisualComp \begin{table}[t!] \footnotesize \centering \caption{Number of documents with potential citations of each BP found by Truncated TF-IDF, for three different $t_c$ values.} \label{tab:potential_citations} \begin{tabularx}{\columnwidth}{XXXXXXXXXXX} \multirow{2}{*}{\textbf{$t_c$}} & \multicolumn{10}{c}{\textbf{BP}} \\ & \textbf{3} & \textbf{4} & \textbf{10} & \textbf{11} & \textbf{14} & \textbf{17} & \textbf{20} & \textbf{26} & \textbf{33} & \textbf{37}\\ \hline \textbf{0.99} & 4 & 73 & 1 & 1 & 2 & 7 & 4 & 5 & 50 & 1 \\ \hline \textbf{0.95} & 45 & 237 & 65 & 8 & 78 & 184 & 59 & 118 & 344 & 42\\ \hline \textbf{0.90} & 124 & 374 & 476 & 85 & 212 & 524 & 88 & 368 & 469 & 119\\ \hline \end{tabularx} \end{table} We use Lime (\secref{sec:pot-ite-inf}) to understand why the model assigned a potential citation to a document. The local model fitted by Lime is a linear classifier. We can interpret this model's weights as the importance of each sentence to the model's decision, \emph{i.e.}\xspace, the potential citation assignment. These weights were mapped into a color range in the document background to visually indicate which sentences are more important. The validation of this assignment's interpretability, so as the potential citation assignment, is established in the usage scenarios discussed in~\secref{sec:case_studies}. \section{LegalVis} \label{sec:visual} In this section we describe the visual components that compose LegalVis and also provide implementation details. As shown in~\figref{fig:visualComponents}, the system is made up of three main components, namely \textit{Global View}, \textit{Paragraph Similarities View}, and \textit{Document Reader}, that address the proposed design tasks as depicted in~\tabref{tab:views_tasks}. \begin{table}[t!] \footnotesize \centering \caption{Visual components of LegalVis and the addressed tasks.} \label{tab:views_tasks} \begin{tabular}{lllllllllll} \multirow{2}{*}{} & \multicolumn{6}{c}{\textbf{Design Task}} \\ & \textbf{T1} & \textbf{T2} & \textbf{T3} & \textbf{T4} & \textbf{T5} & \textbf{T6} \\ \hline \textbf{Global View} & \checkmark & \checkmark & \checkmark & & & \\ \hline \textbf{Parag. Similarities} & \checkmark & & & \checkmark & \checkmark & \\ \hline \textbf{Document Reader} & \checkmark & & & & \checkmark & \checkmark \end{tabular} \end{table} \subsection{Global View} \textit{Global View} (\figref{fig:visualComponents}~(a)) is the main and first opened panel. This view is responsible for showing an overview of the dataset under a temporal perspective (T2) and providing interactive tools that guide the user in searching for documents of interest (T3). Some documents in the dataset do not have valid date information, as will be discussed in~\secref{sec:limitations}. Since Global View depends on this attribute, these documents were potentially used to train the classification model (\secref{sec:potentialCitation}) but ignored in the visualization. In this view, the $x$-axis represents the time a document was published (monthly resolution), and the $y$-axis represents the BP. The red pins (\img{pin.png}) refer to the publication date of the corresponding BPs. For each one, a vertical bar on a particular date indicates the existence of documents published on that date that cite such BP (T1). The height of each bar reflects the number of documents published on that date, and its color is defined such that (i) blue bars (without borders) indicate that every document in that month cites the BP explicitly, (ii) orange bars (without borders) suggest that every document potentially (rather than explicitly) cites the BP, and (iii) blue bars with orange edges indicate the presence of both explicit and potential citations. For better understanding and exploration of regions of interest, users can \textit{zoom~in}, \textit{zoom~out} and \textit{pan}. Other interactions include filtering documents by (i) the type of citation (explicit and/or potential); (ii) Justice rapporteur; (iii) document type (\emph{e.g.}\xspace, complaints or appeals); and (iv) potential citation confidence (threshold $t_c$). Finally, a tooltip showing the number of the BP, the date, and the number of documents (total, with explicit citations, and with potential citations) appears when a bar has hovered over. The publication date of the BP is also shown alongside the red pin. We considered other design choices for \textit{Global View}, for example, fixed-size squares with the number of documents mapped by a color-scale (a strategy similar to the \textit{Temporal Activity Map}~\cite{TAM}) and varying-size circles instead of vertical bars. Since color coding was already considered the more suitable strategy to represent explicit/potential citations in this view (and in \textit{Paragraph Similarities View}, as we show in the next section), and given the high level of overlaps and cluttering obtained with varying-size circles, mapping the number of documents through bars with varying heights was preferred. \subsection{Paragraph similarities View} Once the user has found a set of documents (\emph{i.e.}\xspace, a bar) of interest in \textit{Global View}, he/she can select such a set by clicking on the bar. The user is then redirected to the \textit{Paragraph Similarities View} (\figref{fig:visualComponents}~(b)), which presents in the $y$-axis all documents from the selected bar, that is, documents that cite a particular BP on a given date. Each document is divided into paragraphs, indicated by the horizontal stack of bars. The bar's size means the size of the paragraph, and the color intensity reflects the similarity between the corresponding paragraph and the BP text; the darker the color, the greater the similarity, and the more common parts exist between the BP and the paragraph (T5). Similarly to Global View, the color of each stacked bar stands for explicit (blue) or potential (orange) citation (T1). The similarity is given by the angular distance~\cite{use} between two Truncated-TF-IDF vectors, but other embeddings and similarities (\emph{e.g.}\xspace, the raw cosine similarity) could be adopted. To guide users further exploring the set of documents, we group them into clusters (T4 -- details below). Inside each cluster, the documents are positioned in descending order of similarity between the document and the BP, which is defined as the maximum similarity between its paragraphs and the BP (T4). Showing documents in descending order of similarity is helpful because the user can promptly identify the top-$k$ most similar, and therefore most interesting, documents. Furthermore, to quickly assess the document distribution w.r.t. the similarity values, we also show an interactive bar chart above each color bar. \myparagraph{Document Clustering.} Since a binding precedent may cover decisions related to different subjects, the Brazilian Supreme Court website provides, for each BP, some clusters of decisions created according to their subjects. There are only a few clusters for each BP, each containing a few labeled documents (for instance, there are 8 clusters for BP 4, each containing two documents on average). We employed NLP text pre-processing and applied topic modeling strategies to cluster documents according to their relevant words to take advantage of this limited but useful ground truth. We have tested different and well-established topic extraction methods, including LDA~\cite{blei2003latent}, NMF~\cite{nmf}, SNMF~\cite{snmf}, and PSMF~\cite{psmf}. The NMF (Frobenius norm) method presented the best results, so we adopted it as the default method. In the Paragraph Similarities View, users are free to choose the desired number of clusters/topics. A word cloud with the top-10 most relevant keywords is shown alongside each cluster to optimize the task of finding clusters of interest. Buttons \img{next.png} and \img{previous.png} allow one to navigate between the detected clusters. \subsection{Document Reader} \label{sec:document_reader} After finding a decision that seems interesting, the user selects one of its paragraphs by clicking on it. At this moment, he/she is redirected to \textit{Document Reader} (\figref{fig:visualComponents}~(c)), a view that enables the analysis of both the document's content and the BP text. In this view, the colored bars from the Paragraph Similarities View are also visible alongside the paragraphs (\figref{fig:visualComponents}~(c) and \figref{fig:show_text_similarity}). When a paragraph is hovered over, its content and the BP text are shown as illustrated in~\figref{fig:show_text_similarity}, with the common parts highlighted or not depending on the user's needs (T5 --- flag ``\textit{Show text similarity}''). In the example shown in the figure, one may notice that the text of the paragraph associated with the darkest blue bar is contained in the BP text (see yellow highlights). To analyze any other paragraph of the current document, one may hover over its text without revisiting Paragraph Similarities View. Document Reader also incorporates Lime when the opened document refers to a potential citation (T1, T5). In this case, instead of just showing the document's raw text (as in \figref{fig:show_text_similarity}), the parts of the document's content are highlighted according to their influence (negative, neutral, or positive) in the potential citation identification process (see~\figref{fig:visualComponents}~(c)). \figShowTextSimilarity Since one may analyze many documents published on different dates and citing different BPs, Document Reader also keeps track of recently opened documents (T6), allowing the user to quickly revisit them through the document browsing history (\figref{fig:show_text_similarity}). In practice, it is not uncommon to find complex cases in which a single justice writes his or her decision in a document with more than 100 pages. Document Reader minimizes experts' reading time by tracking recently opened documents of interest and pointing out exactly which paragraphs of the document are likely to mention the binding precedent, even if not explicitly. These characteristics increase the time efficiency of those who search for specific citations in long documents. \subsection{Implementation Details} \label{sec:implementation_details} Our system adopts a client-server architecture. From the client perspective (front-end), all three visual components were implemented using the D3 library~\cite{d3js}. The server-side (back-end) was implemented in Python and employs some well-established libraries and tools, such as Flask~\cite{flask}, Scikit-learn~\cite{scikit-learn}, NLTK~\cite{nltk}, ElasticSearch~\cite{elastic}, and others. For storing and retrieving documents' and binding precedents' information, LegalVis relies on a MySQL database. \section{Usage Scenarios} \label{sec:case_studies} In this section, we discuss two usage scenarios that demonstrate the capabilities of LegalVis in exploring legal documents related to binding precedents. The first usage scenario is related to tasks T1, T2, T5 and highlights the system's effectiveness in identifying potential citations under three different situations. The second usage scenario addresses T2, T3, T4, and T6 by showing an exploratory analysis involving related decisions reported by two particular justice rapporteurs. Unless explicitly stated otherwise, all analyses adopt $t_c = 0.95$. To better understand, we also translated those parts of documents and binding precedents crucial for the analyses to English. The original text contents (in Portuguese) are available in Appendix A. \subsection{Exploring Potential Citations} As observed in the explicit citations, potential citations are expected to exist in documents published after the publication of the binding precedent they refer to. There are, though, documents with potential citations to a particular BP whose publishing date is before the creation date of that BP. Recall that a binding precedent represents a consolidated understanding among the Supreme Court's justices. Thus a series of decisions may have existed related to this underlying judicial issue that led to the precedent's creation. In this usage scenario, we explore three particular potential citations (\figref{fig:caseStudy1}), two of them identified in documents prior to the binding precedent publication (\figref{fig:caseStudy1},~left~and~middle). The first potential citation involves a document published in Feb. 2013 containing an instrument appeal (\textit{``agravo de instrumento''}, in free translation). According to the system, this document potentially cites BP~37, even though this BP was published in Oct. 2014 (\figref{fig:caseStudy1}~(a)). When analyzing how similar the paragraphs of this document are to BP~37 in the Paragraph Similarities View, we see that one of them is very close to it (the darkest orange bar in~\figref{fig:caseStudy1}~(b)). By looking at the content of this presumable relevant paragraph in the Document Reader (\figref{fig:caseStudy1}~(c)), one may notice that Lime considered a long part of it as of great importance in the citation identification process (see the darkest green background on the text). Recall that Document Reader also allows users to compare the text of the corresponding binding precedent with any selected paragraph, with the possibility of highlighting their common parts. By using this feature (\figref{fig:caseStudy1}~(d)), we can easily perceive that this paragraph contains the entire BP text, with a single modification (``on the'' \textit{vs} ``on''). At this point, a relevant question emerges: \textit{How can a document have the text of a BP before its creation?} In fact, this document does not quote BP 37; instead, it quotes Precedent 339 (\textit{Súmula 339}), a precedent that was eventually converted into BP 37 \cite{sv37} (see explicit mention to Precedent 339 just before the highlighted parts in~\figref{fig:caseStudy1}~(d)). A potential citation with the explicit BP text is an exception, especially for documents published before the creation of the BP. The expected behavior is that documents and BPs involved in potential citations have the same implicit reasoning. Our second analysis (\figref{fig:caseStudy1}~(middle)) illustrates this case by considering an instrument appeal, published in Nov. 2004 (\figref{fig:caseStudy1}~(e)), that potentially cites BP 4 (created in April 2008). After selecting one of its paragraphs in the Paragraph Similarities View (\figref{fig:caseStudy1}~(f)), we can compare its text with the BP text in the Document Reader. When analyzing the BP text and also two parts that were considered relevant by Lime in two adjacent paragraphs (the selected one and a neighbor), we see that both the document and the BP refer to the prohibition of using the minimum wage as an indexing factor (\figref{fig:caseStudy1}~(g)), which supports the claim of a valid potential citation; they however describe this subject in different ways. The two cases described so far demonstrate the usefulness of LegalVis for identifying and analyzing documents published before creating the binding precedent they are somehow related to. Identifying and exploring these documents help users to understand why the Supreme Court creates binding precedents, one of the key needs pointed out by judicial experts that LegalVis successfully addresses through tasks T1 (identification of potential citations), T2 (overview of documents under a temporal perspective), and T5 (highlight in relevant parts of the documents). In practice, a justice may refer to a binding precedent X as ``binding entry \#X of the precedent" (\textit{``verbete vinculante no X da súmula''}, in free translation). This latter terminology was not considered when labeling the documents, so (i) documents adopting it were marked as not having explicit citations (\emph{i.e.}\xspace, unlabeled documents), and (ii) it can be used as ground-truth to validate the identification process. To study this case, we rely on a complaint (\textit{``reclamação''}) that potentially cites BP 10 when adopting $t_c = 0.91$ (\figref{fig:caseStudy1}~(right)). This document was selected among all documents that (explicitly or potentially) cite BP 10 in Sep. 2013 (\figref{fig:caseStudy1}~(h-i)). When comparing the text of the BP with one of the paragraphs marked as of great importance by Lime (\figref{fig:caseStudy1}~(j)), we can notice that both refer to some violation of the so-called plenary reserve clause. Still, while the BP defines the rule, the document brings a real-world and related situation. Although this common subject suggests a coherent and valid potential citation, we can validate it by observing an explicit mention to ``Binding Entry \#10 of the Precedent of the Supreme Court" in another document's paragraph (\figref{fig:caseStudy1}~(j)). This example supports once more the usefulness of LegalVis in identifying and exploring potential citations and demonstrates the potential of the system to optimize and validate document labeling. \subsection{Related Decisions} Users may explore LegalVis to search for patterns involving decisions and/or BPs. As shown in~\figref{fig:caseStudy2}, this usage scenario presents an exploratory analysis focusing on related decisions reported by two Supreme Court's justices, Teori Zavascki and Edson Fachin. \figCaseTwo BP 14 covers a criminal law theme. It grants lawyers the right to access every documented evidence already collected during an investigation that could help them prove their client's innocence. It was applied, for example, at the \textit{Lava Jato} case, a criminal investigation started in 2014 in Brazil on alleged irregularities involving several individuals and companies, among them Petrobras, the largest state-owned company in Brazil \cite{lavajato}. Among the 64 documents of type ``petition'' (\textit{``petição''}, in Portuguese) that cite or are likely to cite BP 14, 33 are associated with Teori Zavascki and 21 to Edson Fachin. Likewise, among the 67 documents of type ``investigation'' (\textit{``inquérito''}) related to this BP, Zavascki is the rapporteur of 26, and Fachin has 18, followed by other justices. Except for a single document, Fachin only started dealing with documents of these types after Zavascki stopped, as illustrated by \figref{fig:caseStudy2}~(a) for documents ``investigation''. A brief background is required to understand this behavior: Teori Zavascki was the Supreme Court's justice rapporteur for the Lava Jato operation cases. Several of Zavascki's decisions, therefore, were related to Lava Jato. He passed away in Jan. 2017 due to an airplane crash, and Fachin was appointed as a new rapporteur for the Lava Jato's cases from that moment on \cite{lavajatonovorelatorstf}. In this usage scenario, rather than validating potential citation identification, we want to find out if there is a relation between decisions from Zavascki and Fachin connected to Lava Jato. We begin our exploratory analysis by selecting in Global View all documents associated with Edson Fachin for BP~14 in Sep. 2017. The five retrieved documents are shown in Paragraph Similarities View as a single cluster. After asking for two clusters using topic modeling, the documents are clustered as shown in~\figref{fig:caseStudy2}~(b), \emph{i.e.}\xspace, a cluster ``Topic~1'' containing two complaints (documents of type ``Rcl'') that explicitly cite BP 14 and a cluster ``Topic~2'', containing three investigations (documents of type ``Inq'') that potentially cite BP 14. We also see terms related to investigation (\emph{e.g.}\xspace, ``investigar'' and ``apurar'') and ``petrobras'' in the word-cloud relative to Topic~2 (\figref{fig:caseStudy2}~(c)), which is interesting for our search. It is worth noting that the quality of this clustering supports the suitability of topic modeling for separating the documents. As expected, documents of different types tend to be characterized by different words, and consequently, separated into different clusters. By exploring Topic 2's last document (``Inq 4413'') with Document Reader, we can identify three parts in the text that are relevant for our analysis (\figref{fig:caseStudy2}~(d)). By observing these parts, we can finally establish the relationship we were looking for: Fachin explicitly agrees with Zavascki's decision at ``Investigation 4,231'' (\figref{fig:caseStudy2}~(d-2)). This decision, which is related to Lava Jato and Petrobras (\figref{fig:caseStudy2}~(d-3)), is unfortunately under legal secrecy and is not available for analysis. In his decision, Fachin also mentions two other investigations (ids 4,325 and 4,326 -- see \figref{fig:caseStudy2}~(d-1)), where one may find other agreements or controversies. By identifying this kind of relation between decisions or justices, experts can understand and explore the adopted arguments in new and related processes or anticipate possible outcomes of ongoing ones. The system also facilitates comparisons of decisions. If we open multiple documents in the system (\emph{e.g.}\xspace, those related to these investigations), we can promptly switch between them by using the document browsing history. Recall that LegalVis has identified a potential citation between ``Inq 4413'' and BP 14 with confidence $t_c = 0.95$. Even though we could not establish reasons that justify this identification, the presented usage scenario showed the system's effectiveness in assisting users in finding patterns and behaviors related to particular justices and documents' types. Since LegalVis properly tackles tasks T2 and T3, finding the temporal relationship between cases reported by Zavasci and Fachin was easy in the explored scenario. Reaching the analyzed document of interest was easy, mainly because of the topic modeling clustering (T4). Finally, comparisons among different decisions are possible and uncomplicated through the document browsing history~(T6). \section{Evaluation from Experts} \label{sec:experts} This section describes an evaluation with experts performed to collect detailed feedback about the presented usage scenarios, the usefulness and usability of the tool, and ideas for further improvement. \subsection{Participants} We recruited six domain experts not involved in the tool's development to evaluate our proposal. They work as attorneys (2), researchers (2), legal assistants (1), and trainees (1) and have from 1.5 to 22 years of experience in analyzing legal documents and/or binding precedents. The participation was voluntary and without payment. \subsection{Evaluation Process} The expert evaluation involved three steps. First, the participants had to watch a video presenting the pipeline to identify potential citations, the visual components of LegalVis, and the two usage scenarios described in \secref{sec:case_studies}. After that, we invited them to explore the tool through two well-defined tasks: \myparagraph{T1:} We asked the participants to select the documents associated with Justice Ricardo Lewandowski and: (i) identify the BP least cited by him; (ii) identify the time interval in which he did not cite any BP (if any); (iii) based on the provided word cloud, give their opinion on what they think the 16 decisions associated to him and explicitly citing BP 20 on May 2014 refer to; (iv) find a decision, reported by him, that not only explicitly cites a BP (any BP) but also contains the BP's text. While we consider (i) and (ii) relatively straightforward as they can be answered through Global View with few interactions (filtering options), our goal with (iii) was to guide the participants to Paragraph Similarities View and evaluate how helpful and trustful the word cloud containing relevant keywords is. We also aimed to assess the system for exploring decisions with explicit citations (iv). \myparagraph{T2:} We asked the participants to find any decision with a potential citation ($t_c = 0.95$) and inform which part of the decision's text they consider relevant w.r.t. the corresponding BP. Besides evaluating the system for explorations involving potential citations, we aimed to assess the quality of the results found by LegalVis on this matter. Finally, the experts answered a set of quantitative (QT) and qualitative (QL) questions. Regarding the quantitative ones, participants had to answer, through a 5-point Likert scale, whether they agree with the following statements: ``\textit{Usage scenario 1 is relevant.}'' (QT1); ``\textit{Usage scenario 2 is relevant.}'' (QT2); ``\textit{It is easy to find decisions with explicit or potential citations throughout time.}'' (QT3); ``\textit{It is easy to filter interesting decisions for analysis.}'' (QT4); ``\textit{It is easy to identify parts of decisions related to the BP of interest.}'' (QT5); ``\textit{LegalVis is useful.}'' (QT6); ``\textit{It is easy to learn how to use LegalVis.}'' (QT7); ``\textit{LegalVis is efficient and would optimize my time.}'' (QT8); ``\textit{LegalVis is easy to use.}'' (QT9); ``\textit{LegalVis has an intuitive interface.}'' (QT10). Besides asking for comments on QT3-QT6, and also a general comment on QT7-QT10, the qualitative questions include: ``\textit{What is your impression about the proposed pipeline for the identification of potential citations?}'' (QL1); ``\textit{What do you highlight as relevant or interesting in usage scenarios 1 (QL2) and 2 (QL3)? }''; ``\textit{Without LegalVis, what are the challenges in performing analysis similar to the ones you have made?}'' (QL4); ``\textit{What other tools that allow this type of analysis do you know?}'' (QL5); ``\textit{What are the advantages (QL6) and disadvantages (QL7) of LegalVis compared to other tools you are used to?}''; ``\textit{In your opinion, which are the most helpful visual components?}'' (QL8); ``\textit{Besides the existing visual components, which other components do you think could be incorporated in LegalVis?}'' (QL9); ``\textit{Would you like to leave a final comment?}'' (QL10). We only asked QL6 and Q7 to those who know other tools that allow similar analyses (QL5). \subsection{Results} Five of the six participants responded to T1(i) correctly, and all six provided similar/correct answers for T1(ii-iv). We invalidated one answer for T2 because the participant used a document with explicit citation (instead of a potential one) to answer it; four of the other participants provided answers in line with Lime. We present in the following the experts' opinions about (i) the pipeline of identification of potential citations, (ii) relevance of the usage scenarios described in~\secref{sec:case_studies}, (iii) system's usefulness, (iv) usability, and (v) scope for further improvements. \myparagraph{Potential citation identification (QL1, QL10):} The experts considered the pipeline interesting, robust, and promising. One of the participants commented: \emph{``Although I don't know how the machine learning works, the proposal is exciting and, without doubt, of great value not only to lawyers but also to all careers that depend on the analysis of judicial decisions."} For another expert, \emph{``The pipeline seems excellent. The use and improvement of machine learning algorithms lead to great results"}. According to a third participant, \emph{``It enhances the search for binding precedents and similar decisions, which helps attorneys to support their petitions"}. \myparagraph{Usage scenarios (QT1, QT2, QL2, QL3):} The first usage scenario was considered relevant by five of the six participants (\figref{fig:likert}~(QT1)). According to their comments, they were particularly delighted because it \textit{``clearly demonstrates the applicability of the tool''} and its results show that LegalVis \textit{``enables and facilitates the identification of previous court positions that led to the creation of BPs''} in a \textit{``practical and intelligent way''}. \figLikert Although the overall rating for the second usage scenario is also positive (\figref{fig:likert}~(QT2)), one participant considered it not relevant. He/she stated: \textit{``This analysis involves going through several steps that seem less necessary. If the objective is to compare decisions, a simpler way would be to compare the decisions they cite and their content directly''}. It is worth noting that this usage scenario describes the comparison between decisions and demonstrates how users can find relevant decisions and justices to be compared. For another participant, this usage scenario is relevant because it shows that the system \textit{``helps to find similar decisions, which bring unity to the judiciary''}. A third expert commented: \textit{``I foresee great applicability in the field of legal arguments. Great.''} \myparagraph{System's usefulness (QT6, QT8, QL4-QL6, QL10):} All participants consider LegalVis a useful tool, and all but one think it is efficient and time-saving (\figref{fig:likert}~(QT6, QT8)). One of them commented: \textit{``While learning the features, I already anticipated using the tool better illustrate my classes, opinions, and scientific articles''}. According to another participant: \textit{``It will greatly help all law professionals, bringing more quality to the services provided and reducing research time''}. A third expert commented: \textit{``I hope I can use the tool for professional purposes as soon as possible.''} According to the experts, LegalVis is useful because it addresses some critical issues related to large-scale data analysis (3 participants mentioned this issue), filtering options (2), and searches based only on keywords (3). Only two participants responded `yes' when asked whether they know similar tools. The tools they mentioned are the STF's website and a platform named JusBrasil~\cite{jusbrasil}. According to one participant, \textit{``the search offered by these websites is based only on keywords and some filters. Thus, LegalVis proves to be much more complete and useful for the better development of activities related to legal arguments. In my opinion, the LegalVis proposal is broader and more useful.''} Another participant commented: \textit{``LegalVis seems to have a proposal that simplifies large-scale data analysis. Most jurists I know rely on search tools based on not much more than keywords. In that sense, LegalVis would be an important tool''}. A third expert highlighted one problem with keyword-based search engines: \textit{``Without LegalVis, we would have to search for keywords on the STF's website. The problem is that it is not always possible to think of good keywords to use. Sometimes even their search engine is poor.''} Besides the advantages mentioned above, LegalVis was also considered useful because \textit{``potential citations seem to be an excellent source of argument to use in the Courts.''} This participant's comment continues: \textit{``I consider the tool very useful, not only in terms of litigation but also in the development of academic activities (scientific articles, research, classes, etc.).''} \myparagraph{System's usability (QT3-QT5, QT7, QT9, QT10, QL8):} Five of the six participants consider it easy to find decisions with citations throughout time (\figref{fig:likert}~(QT3)), especially those with explicit citations. They also agree that one can quickly identify parts of decisions related to the BP of interest (\figref{fig:likert}~(QT5)). Filtering interesting decisions for analysis, on the other hand, was considered a more difficult task (\figref{fig:likert}~(QT4)). About that, one participant commented: \textit{``The learning curve of the system is a little slower at first due to the complexity and a large number of utilities that can be extracted. However, I emphasize that it is possible to filter very interesting documents for analysis''}. Despite this comment about the learning curve, most experts agree that it is easy to learn how to use LegalVis (\figref{fig:likert}~(QT7)). According to most participants, LegalVis is easy to use and has an intuitive interface (\figref{fig:likert}~(QT9, QT10)). Regarding the most helpful visual components, the experts reported different opinions: \textit{``the similarity color scale''}, \textit{``highlight in relevant excerpts''}, \textit{``timeline visualization''}, \textit{``similarity bar alongside the decision's paragraph''}, \textit{``all of them are useful''}. \myparagraph{Scope for improvements (QT4, QT10, QL7, QL9, QL10):} Although LegalVis shows strong capabilities to enhance the analysis of legal documents and binding precedents, it can still be improved as suggested by the domain experts. Regarding filtering interesting decisions and new features, received suggestions include \textit{``filtering by justice and document type are interesting, but I think more important is a keyword filter, similar to the one offered by the STF's website, to make it easier to search for a specific subject.''} and \textit{``it would be nice if LegalVis could incorporate subject filtering''}. It is worth mentioning that, since we have both the decisions' texts and the capability to detect relevant keywords through topic modeling, LegalVis could incorporate these features with little effort. Some experts felt that LegalVis could become more user-friendly and offer more filtering possibilities. One of them commented: \textit{``The system is really cool! I think, however, that it is still possible to improve the visual aspect, for example, by removing from the visualization those BPs that are not subject of the person's research''}. Another expert also suggested filtering decisions based on time intervals defined by the user. LegalVis can naturally incorporate these filtering options. About the quality of the potential citation identification, one participant reported that \textit{``there seem to be a few cases where the potential citation is not very related to the BP''}. We will discuss ideas for improving our model in the next section. \section{Discussion and Limitations} \label{sec:limitations} The presented usage scenarios and experts' evaluations show that LegalVis is a helpful tool to assist judicial experts in analyzing legal documents. LegalVis can also be adapted to assist experts from the legal field in deciding whether or not a BP should be associated with a process under analysis, reducing the processing times. A similar framework could also be applied to other domains like medicine and public purchases. Medical prescriptions and government purchases can be seen as legal documents while the regulatory rules as BPs, for example. Another potential application is in scientific research, where papers to be cited can be seen as precedents for new ones. \myparagraph{TF-IDF performance.} An important question from our results is why TF-IDF presents better performance than the new generation of text representations tools (Doc2vec, USE, and Longformer). One hypothesis is that the presence of specific words dictates the behavior of the classifier (SVM in our case). We performed several experiments considering both a decision tree classifier over bag-of-words and a logistic regression using TF-IDF with L1 regularization in a one-vs-rest multiclass classification approach to analyze this aspect further. Both experiments showed that the presence of specific words led to high accuracy in the classification (over 85\% on validation set). However, each classification method highlights a different set of relevant words, making it hard to establish a consensus on which words are essential for classifying each BP. This fact reinforces the critical role of Lime, as it allows for breaking the document into sentences rather than words, facilitating the interpretation. Moreover, Lime explanations are local (per sample), enabling individual understanding of the model's decision. The issue related to the inferior performance of Doc2vec, USE, and Longformer may also be associated with the lack of pre-trained models with Brazilian Portuguese, in particular with Brazilian Portuguese legal language, which has several particularities in the writing style and terms used throughout the documents. This key factor might be negatively impacting the models' performance. Training models to suit the characteristics of legal data is a task we are very interested in, and the accomplishment of this task is in our near future plans. It is essential to mention that in certain cases, TF-IDF can, indeed, outperform Doc2vec, as already reported by some previous work~\cite{7822730, Wang_2017, tfidf_melhor_alguns_datasets}. \myparagraph{Problems with data.} The dataset we use came from a partnership with another project (recall~\secref{sec:data_set}). Unfortunately, it presents some limitations that required some adaptations in our system: (i) presence of some ``duplicated'' documents, \emph{i.e.}\xspace, documents with different titles but same raw texts that had to be ignored in the classification to avoid overfitting the data; (ii) presence of some documents without valid date attribute (marked as Jan. 1970), which were ignored in the visualization; (iii) presence of some documents for which it was impossible to automatically extract justice information (marked as ``unknown justice''). \myparagraph{Potential citation identification model.} Although efficient, our model is simple in the sense that it only considers the documents' raw texts. As future work, we intend to incorporate metadata (\emph{e.g.}\xspace, justice rapporteur and date) directly into the process. These metadata already exist as parts of the texts, but we hypothesize that giving more weight to them would improve the identification. We also plan to experiment with other models (\emph{e.g.}\xspace, \textit{Big Bird}~\cite{zaheer2020big}) and analyze their performance. A promising experiment would be to test with Transformer-based models pretrained using Portuguese texts (\emph{e.g.}\xspace, BERTimbau~\cite{souza2020bertimbau}), differently of Longformer, which we hypothesize is a downside in our case. Not least, the system's current version does not allow users to influence the model's decisions. We now intend to aggregate user relevance feedback to improve the performance through additional training. Such feedback would be especially relevant when dealing with more (and imbalanced) BPs or citations to multiple BPs. \myparagraph{Number of documents and binding precedents.} There are 58 binding precedents up to this moment, and we chose to explore only the ten most cited of them. Before increasing this number, one should be aware that there are binding precedents with just a few citations, consequently impairing the classification task. To address these issues, we intend to explore data augmentation methods (\emph{e.g.}\xspace, EDA~\cite{wei2019eda}) and other unbalanced classification methods \cite{krawczyk_learning_2016}. We also plan to exhibit each class performance and each document's potential citation probability. This way, users are better informed and can influence the system's decisions through the relevance feedback mentioned. \myparagraph{Topic Modeling.} As shown in the second usage scenario, our clustering strategy based on topic modeling is helpful to guide users to documents of interest. However, the lack of ground truth with a representative sample of decisions impaired a formal evaluation of its quality. Although validated by domain experts for particular cases, we intend to augment our ground truth and perform a more robust analysis. \section{Original Images in Portuguese} Through two usage scenarios (Sect.~7) validated by domain experts, our paper demonstrates the usefulness of LegalVis to assist users in exploring legal documents and binding precedents. In the first usage scenario, we focused on highlighting the system's capabilities in identifying potential citations under different situations. Here, we show in~\figref{fig:supcaseStudy1} the original texts (in Portuguese) of those parts of the binding precedents and documents explored throughout this scenario. Our second usage scenario, by its turn, showed an exploratory analysis that aimed to find patterns and behaviors related to particular justices and types of documents. To help in the analysis, we presented parts of a decision reported by justice Edson Fachin (Fig.~8~(d)). Here,~\figref{fig:supcaseStudy2} shows the original texts (in Portuguese) that compose those parts. \figSupMatCaseTwo \newpage \section{Word Count Histogram} \figref{fig:histogram} shows a word count histogram of the documents considered in our study (i.e., 29,743 documents that explicitly cite at least one of the ten most cited BPs plus 30,000 documents without explicit citations). In general, we have less than four thousand words. \figHistogram \end{document}
{'timestamp': '2022-03-07T02:02:58', 'yymm': '2203', 'arxiv_id': '2203.02001', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.02001'}
arxiv
\section{INTRODUCTION} Finding a time-optimal way to follow a reference path while respecting kinematic joint limits is one of the most prevalent tasks in industrial robotics. However, just like a race driver needs to know the exact course of the race track to achieve an optimal lap time, time-optimal path parameterization (TOPP) requires the desired reference path to be fully known in advance. For that reason, existing offline methods for time-optimal path parameterization are not applicable to reactive online scenarios in which the reference path needs to be adjustable during motion execution. The same is true if sensory feedback is needed to successfully perform the path tracking task. As shown in Fig.~\ref{fig:header}, this applies, for example, to the bipedal humanoid robot ARMAR-4, which can lose its balance when its arms are moved or to an industrial robot that balances a ball on a plate while following a reference path. \begin{figure}[t] \def-14.15cm{-14.15cm} \def-6.35cm{-6.35cm} \captionsetup[subfigure]{margin=80pt} \begin{tikzpicture} \def\xminPlot{0.151} \def\xmaxPlot{0.949} \SUBTRACT{\xmaxPlot}{\xminPlot}{\xdeltaPlot} \DIVIDE{\xdeltaPlot}{3}{\xdeltaPlotNorm} \def0.135{0.135} \def0.985{0.985} \def0.364{0.364} \def0.535{0.535} \SUBTRACT{0.985}{0.135}{\ydeltaPlot} \SUBTRACT{0.535}{0.364}{\ydeltaAcc} \MULTIPLY{\ydeltaAcc}{4}{\ydeltaGraph} \SUBTRACT{\ydeltaPlot}{\ydeltaGraph}{\ydeltaTmp} \DIVIDE{\ydeltaTmp}{3}{\ydeltaGap} \node[text width=4cm] at (0.0cm, 0cm) (origin){}; \node[align=left, scale=0.9] at ($(origin.center)+(-0.15cm, -0.275cm)$) {Without sensory feedback}; \node[align=left, scale=0.9] at ($(origin.center)+(4.35cm, -0.275cm)$) {With sensory feedback}; % \draw [draw=black!50, line width=1.0pt, scale=0.7] ($(origin.center)+(3.075cm, -0.1cm)$) -- + (0.0cm, -13.3cm) node[pos=1, right, yshift=0.01cm, align=left, scale=0.85]{}; \end{tikzpicture} \begin{subfigure}[c]{0.23\textwidth} \vspace{-14.15cm} % \vspace{-0.0cm} % \begin{tikzpicture}[scale=1.0, every node/.style={scale=1.0}, node distance=2cm] \node[image_frame] at (0, 0.0cm) { \includegraphics[trim=800 340 800 220, clip, height=0.92\textwidth]{figures/header/one_industrial/header_2_1_small.jpg}}; \end{tikzpicture} % % % \vspace{-0.38cm}\hspace*{-2.5cm}\subcaptionbox{Kuka iiwa}[9cm] % % \end{subfigure} \hspace{0.0065\textwidth} \begin{subfigure}[c]{0.23\textwidth} \vspace{-14.15cm} \vspace{-0.0cm} % \begin{tikzpicture}[scale=1.0, every node/.style={scale=1.0}, node distance=2cm] \node[image_frame] at (0, 0.0cm) {\includegraphics[trim=800 340 800 220, clip, height=0.92\textwidth]{figures/header/ball_balancing/header_2_3_small.jpg}}; \end{tikzpicture} % \vspace{-0.38cm}\hspace*{-2.94cm}\subcaptionbox{KUKA with balance board}[10cm] \end{subfigure} \vspace{0.18cm} \begin{subfigure}[c]{0.23\textwidth} \vspace{-6.35cm} \vspace{0.0cm} \begin{tikzpicture}[scale=1.0, every node/.style={scale=1.0}, node distance=2cm] \node[image_frame] at (0, 0.0cm) {\includegraphics[trim=800 450 800 110, clip, height=0.92\textwidth]{figures/header/armar_6/header_2_1_small.jpg}}; \end{tikzpicture} % % \vspace{-0.425cm}\hspace*{-2.05cm}\subcaptionbox{ARMAR-6}[8cm] % % \end{subfigure} \hspace{0.0065\textwidth} \begin{subfigure}[c]{0.23\textwidth} \vspace{-6.35cm} \vspace{0.0cm} \begin{tikzpicture}[scale=1.0, every node/.style={scale=1.0}, node distance=2cm] \node[image_frame] at (0, 0.0cm) { \includegraphics[trim=790 435 760 80, clip, height=0.92\textwidth]{figures/header/armar_4/header_2_5_small.jpg}}; \end{tikzpicture} % % \vspace{-0.425cm}\hspace*{-2.55cm}\subcaptionbox{ARMAR-4}[9cm] \end{subfigure} \vspace{-1.2cm} \caption{% Our evaluation environments for learning time-optimized path tracking. Using sensory feedback, our method can incorporate additional goals such as ball balancing or maintaining balance with the bipedal \mbox{robot ARMAR-4}. }% \vspace{-0.75cm} \label{fig:header} \end{figure} In this work, we address the problem of time-optimized path tracking for online scenarios like those shown in Fig. \ref{fig:header} by learning a well-performing trade-off between the execution speed, the deviation from the reference path and additional objectives like ball balancing via model-free reinforcement learning (RL). For this purpose, a neural network is trained in a simulation environment using thousands of different reference paths. At each time step, only the directly following part of the reference path is made available to the neural network as an input signal. Once the training process is finished, the neural network can generate optimized actions even for paths not included in the training set. Our action space ensures that all generated trajectories comply with predefined kinematic joint limits. Additional optimization objectives like ball balancing can be easily added to the reward function as they do not have to be differentiable with respect to the selected action. \\ Our main contributions can be summarized as follows: \begin{itemize} \item We introduce an online method to track reference paths based on reinforcement learning that ensures compliance with kinematic joint limits at all times. \item We show that our approach can incorporate sensory feedback to account for additional objectives such as maintaining the balance of a bipedal humanoid robot. \item We evaluate our method using robots with up to 30 degrees of freedom and demonstrate successful sim-2-real transfer for a time-optimized ball-on-plate task. % \end{itemize} Our source code will be made publicly available.\href{https://www.github.com/translearn}{$^2$} \begin{figure*}[t] \input{figures/overview_training} \caption{% The principle of online trajectory generation with our approach illustrated for a single time step $t$ of a \mbox{ball-on-plate task.}} \label{fig:basic_principle} \vspace{-0.6cm} \end{figure*} \section{Related work} \subsection{Time-optimal path parameterization (TOPP)} The problem of finding a time-optimal path parameterization subject to kinematic joint constraints has been studied for decades with methods proposed based on dynamic programming \cite{shin85Time}, numerical integration \cite{bobrow1985time}, convex optimization \cite{verscheure2009time} and reachability analysis \cite{pham2018Toppra}. Widely used implementations that can consider velocity and acceleration constraints include \cite{kunz2012time} for paths consisting of line segments and circular blends and \cite{pham2018Toppra} for paths defined as cubic splines. While our approach additionally supports jerk limits, TOPP subject to jerk constraints is still an open research problem~\cite{pham2017structure}. Methods related to TOPP have also been used for ball balancing \cite{kiemel2020truerma} or to keep bipedal humanoid robots in balance e.g. by defining multi-contact friction constraints \cite{hauser2014fast, pham2018Toppra} or by imposing constraints on the zero moment point (ZMP) \cite{pham2012time}. However, as time-optimal path parameterization requires the desired path to be known in advance, all calculations have to be performed offline. As a consequence, it is not possible to consider sensory feedback to compensate for external disturbances or model errors. The latter is particularly problematic as existing methods often require simplified contact models. \subsection{Online trajectory generation (OTG)} Time-optimal point-to-point motions subject to kinematic joint constraints can be computed online, for instance, with the Reflexxes motion library \cite{kroger2011opening}. This is done by specifying a desired kinematic target state at each control time step. In contrast to our work, this method does not allow to specify a desired reference path. An online method for computing a feasible and jerk-limited path-accurate robot trajectory is presented in \cite{lange2015path}. However, unlike our work, the method does not put focus on generating time-optimized trajectories. % Another line of research aims at finding optimized robot trajectories based on model-predictive control (MPC) \cite{faulwasser2016implementation, carron2019data, nubert2020safe}. Compared to MPC, model-free RL offers the advantage that no differentiable dynamics model is required and that the reward function does not have to be differentiable with respect to the selected action. In addition, generating optimized motions with neural networks trained via RL is very fast which allows real-time execution even for systems with many degrees of freedom. As a consequence, model-free RL can be used for a wide range of applications and has attracted increasing attention from the research community over the past few years. % Exemplary learning tasks presented in the past include in-hand manipulation \cite{andrychowicz2020learning}, locomotion with bipedal robots \cite{siekmann2021sim} or collision-free target point reaching \cite{kiemel2021collision}, to name but a few. Model-free RL has also been used to adjust reference trajectories in order to meet additional objectives \cite{peng2018deepmimic, kiemel2020trueadapt}. Compared to these approaches, we consider reference paths instead of reference trajectories, meaning that the velocity profile of the resulting trajectory is part of the optimization rather than being specified in advance. Considering that additional objectives like balancing become more difficult the faster the reference path is traversed, optimizing the traversing speed during the training process is an important factor for learning well-performing trajectories. \label{sec:citations} \section{Approach} \subsection{Overview} Fig.~\ref{fig:basic_principle} illustrates the basic principle of our method based on a ball-on-plate task with sensory feedback. The goal of the task is to quickly follow a reference path (shown in green) while avoiding a ball to fall from a balance board attached to the last link of the robot. The position of the ball on the board is measured and provided as sensory feedback. Using the mathematical framework of a Markov decision process, we formalize the online generation of optimized robot trajectories as a discrete-time control problem with a constant time~$\Delta t_N$ between decision steps. % At each decision step~$t$, a state description $s_t$ containing information on the reference path, the kinematic state of the robot and the ball position is given as input to a neural network. The neural network outputs an action~$\underline{a}_{t}$ that is used to compute a continuous trajectory from the current time step~$t$ to the subsequent time step $t+1$. During training, the trajectory is executed in a physics simulator and a scalar reward is computed to evaluate the performance of the generated action~$\underline{a}_{t}$. As part of the reward computation, the path resulting from the trajectory execution (shown in red) is assessed based on its length and its deviation to the reference path. In addition, the balancing performance is rated based on the distance between the ball and the center of the board. Using model-free RL, the neural network is trained to output actions that maximize the sum of rewards received over time. This way, the network learns to generate robot trajectories that are optimized with respect to the execution time, the path deviation and the balancing performance. The following subsection provides further details on the Markov decision process. Subsequently, we explain how the reference paths used to train the neural network are generated. \begin{figure}[b] \centering \vspace{0.0cm} \begin{tikzpicture}[auto, node distance=5cm,>=latex', scale=1.0, every node/.style={scale=1.0}] \def0.9{0.9} \node[image_frame](observation_spline) {\includegraphics[trim=500 440 550 1300, clip, width=0.47\textwidth]{figures/observation_spline_sharpen_3_small.jpg}}; \node[minimum height=0cm, minimum width=0.0cm](annotation_center) at ($(observation_spline.center) + (0.28cm, -0.15cm)$){}; \draw [|-|, draw=black!80, thick] plot [smooth, tension=0.5] coordinates { ($(annotation_center.center) + (-1.7cm, 0.125cm)$) ($(annotation_center.center) + (-1.55cm, -0.02cm)$) ($(annotation_center.center) + (-1.4cm, -0.14cm)$)}; \draw [|-|, draw=black!80, thick] plot [smooth, tension=0.5] coordinates { ($(annotation_center.center) + (-1.85cm, -0.9cm)$) ($(annotation_center.center) + (-0.93cm, -1.35cm)$) ($(annotation_center.center) + (0.6cm, -1.15cm)$) ($(annotation_center.center) + (1.5cm, -0.4cm)$) ($(annotation_center.center) + (2.4cm, 0.7cm)$)}; \node[minimum height=0cm, minimum width=0.0cm, align=center, scale=0.9] at ($(annotation_center.center) + (2.8cm, -0.5cm)$){Path length \\$l_{\textrm{State}}$}; \node[minimum height=0cm, minimum width=0.0cm, align=center, scale=0.9] at ($(annotation_center.center) + (-3.25cm, -0.5cm)$){Reference \\ path}; % \draw [-stealth, draw=black!80, thick] ($(annotation_center.center) + (-3.2cm, 0.0cm)$) -- ($(annotation_center.center) + (-2.7cm, 0.5cm)$); \draw [-stealth, draw=black!80, thick] ($(annotation_center.center) + (-1.85cm, 0.975cm)$) -- ($(annotation_center.center) + (-1.85cm, 0.1cm)$) node[pos=0.0, above, minimum height=0cm, minimum width=0.0cm, xshift=0.05cm, scale=0.9]{Knot $1$}; \draw [-stealth, draw=black!80, thick] ($(annotation_center.center) + (1.4cm, 1.175cm)$) -- ($(annotation_center.center) + (1.85cm, 1.175cm)$) node[pos=0.0, left, minimum height=0cm, minimum width=0.0cm, scale=0.9]{Knot $N$}; \draw [-stealth, draw=black!80, thick, scale=0.9] ($(annotation_center.center) + (-1.15cm, 0.05cm)$) -- ($(annotation_center.center) + (-1.5cm, -0.33cm)$) node[pos=0.0, right=-0.0cm, minimum height=0cm, minimum width=0.0cm, align=center, yshift=0.3cm, scale=0.9]{Current \\path position}; \end{tikzpicture} \caption{The figure illustrates how the following part of the reference path is included in the state using $N=5$ knots.} \label{fig:observation_spline} \end{figure} \subsection{Details on the Markov decision process} The problem of generating optimized robot trajectories is formalized as a Markov decision process $(\mathcal{S}, \mathcal{A}, P_{\underline{a}}, R_{\underline{a}})$, with $\mathcal{S}$ being the state space, $\mathcal{A}$ being the action space, $P_{\underline{a}}$ representing (unknown) transition probabilities and $R_{\underline{a}}$ being the reward resulting from action $\underline{a}$. In the following, details on the state space, the action space, the reward calculation and the termination of episodes are provided. \subsubsection{Composition of states ${s} \in \mathcal{S}$} A state ${s}$ contains information on the following part of the reference path and on the kinematic state of the robot. For tasks that require sensory feedback, the sensor signals are included in the state as well. In our work, the reference paths are described as cubic splines. A spline is a mathematical representation that can be used to define a piecewise polynomial path between specified waypoints, called knots. To provide the neural network with information about the reference path, $N$ of these knots are included in the state. Note that the reference path is defined in joint space, meaning that each knot is a vector of joint positions. For illustration purposes, however, we apply forward kinematics to visualize the reference path in Cartesian space. Fig. \ref{fig:observation_spline} illustrates how the knots are selected. The red cross indicates the current position on the reference path. At the beginning of an episode, this position is set to the start of the reference path. During an episode, each action causes the robot to move along a certain path. % After each action, the current position on the reference path is shifted forward according to the length of the path generated by the action. As shown in Fig. \ref{fig:observation_spline}, the state contains the knot preceding the current path position and $N\!-\!1$ following knots. In addition, the path length labeled $l_{\textrm{State}}$ and the path length between the first knot and the current path position are included in the state. If the remaining part of the reference path consists of less than $N\!-\!1$ knots, the last knot is inserted into the state multiple times. In this case, the decreasing path length $l_{\textrm{State}}$ indicates to the network that the robot must be slowed down. \begin{figure}[t] \centering \captionsetup[subfigure]{margin=0pt} \vspace{0.2cm} \begin{tikzpicture} \def\xminPlot{0.151} \def\xmaxPlot{0.949} \SUBTRACT{\xmaxPlot}{\xminPlot}{\xdeltaPlot} \DIVIDE{\xdeltaPlot}{3}{\xdeltaPlotNorm} \def0.135{0.135} \def0.985{0.985} \def0.364{0.364} \def0.535{0.535} \SUBTRACT{0.985}{0.135}{\ydeltaPlot} \SUBTRACT{0.535}{0.364}{\ydeltaAcc} \MULTIPLY{\ydeltaAcc}{4}{\ydeltaGraph} \SUBTRACT{\ydeltaPlot}{\ydeltaGraph}{\ydeltaTmp} \DIVIDE{\ydeltaTmp}{3}{\ydeltaGap} \hspace{0.23cm} \node[text width=4cm] at (0.2cm, 4.35cm) (origin){}; \draw [draw=REFERENCE_PATH_GREEN, line width=1.5pt, scale=0.7] ($(origin.center)+(-9.3cm, -0.0cm)$) -- + (0.45cm, 0cm) node[pos=1, right, yshift=0.01cm, align=left, scale=0.85]{Reference path}; \draw [draw=OBSERVATION_PATH_CYAN, line width=1.5pt, scale=0.7] ($(origin.center)+(-5.72cm, -0.0cm)$) -- + (0.45cm, 0cm) node[pos=1, right, yshift=0.01cm, align=left, scale=0.85]{Waypoints in state}; \draw [draw=GENERATED_PATH_RED, line width=1.5pt, scale=0.7] ($(origin.center)+(-1.5cm, 0.0cm)$) -- + (0.45cm, 0cm) node[pos=1, right, yshift=0.00cm, align=left, scale=0.85]{Generated path}; % \end{tikzpicture} \begin{subfigure}[c]{0.23\textwidth} % \vspace{-0.0cm} % \begin{tikzpicture}[scale=1.0, every node/.style={scale=1.0}, node distance=2cm] \node[image_frame] at (0, 0.0cm) {\includegraphics[trim=450 300 1400 475, clip, height=0.85\textwidth]{figures/path_change/path_change_1_2_small.jpg}}; \end{tikzpicture} % \vspace{-0.40cm}\hspace*{-0.7cm}\subcaptionbox{Initial reference path}[5cm] % % \end{subfigure} \begin{subfigure}[c]{0.23\textwidth} \vspace{-0.0cm} % \begin{tikzpicture}[scale=1.0, every node/.style={scale=1.0}, node distance=2cm] \node[image_frame] at (0, 0.0cm) { \includegraphics[trim=450 300 1400 475, clip, height=0.85\textwidth]{figures/path_change/path_change_3_2_small.jpg}}; \end{tikzpicture} % % \vspace{-0.4cm}\hspace*{-0.645cm}\subcaptionbox{Adjusted reference path}[5cm] \end{subfigure} \caption{Adjusting the reference path during motion execution.} \label{fig:spline_change} \vspace{-0.38cm} \end{figure} As illustrated in Fig. \ref{fig:spline_change}, the reference path can be adjusted during motion execution. We note that the reference path can be traversed faster if more knots are included in the state. In return, however, a larger part of the reference path needs to be known in advance. The kinematic state of the robot is described by the position~$p$, velocity~$v$ and acceleration~$a$ of each robot joint. For the ball-on-plate task, the position of the ball on the plate is included in the state as sensory feedback. To maintain balance with the humanoid robot \mbox{ARMAR-4}, the position and the rotation of the robot's pelvis relative to its initial upright pose is included in the state. While we extract the data from simulation, it could also be provided by an inertia measurement unit (IMU). \vspace{0.15cm} \subsubsection{Trajectory generation based on actions $\underline{a} \in \mathcal{A}$} \hfill\\ Each action $\underline{a}$ defines a trajectory with a duration of $\Delta t_N$. The generated trajectory must satisfy the following kinematic joint constraints for each robot joint and at all times: \begin{alignat}{3} p_{min} &{}\le{}& \theta &{}\le{}& p_{max} \label{eq:constraint_p} \\ v_{min} &{}\le{}& \dot{\theta} &{}\le{}& v_{max} \label{eq:constraint_v}\\ a_{min} &{}\le{}& \ddot{\theta}&{}\le{}& a_{max} \label{eq:constraint_a} \\ j_{min} &{}\le{}& \dddot{\theta} &{}\le{}& j_{max}, \label{eq:constraint_j} \end{alignat} where $\theta$ is the joint position and $p$, $v$, $a$ and $j$ stand for position, velocity, acceleration and jerk, respectively. \begin{figure}[t] \begin{tikzpicture}[auto, node distance=5cm,>=latex', scale=0.7, every node/.style={scale=0.85}] \node[text width=4cm] at (0, 0) (origin){}; \draw [draw=LINE_COLOR_BLUE, line width=1.5pt] ($(origin.center)+(-3.8cm, -0.0cm)$) -- + (0.45cm, 0cm) node[pos=1, right, yshift=-0.01cm, align=left]{\small{Generated trajectory}}; \draw [solid, draw=LINE_COLOR_RED, line width=1.5pt] ($(origin.center)+(0.4cm, 0.0cm)$) -- + (0.45cm, 0cm) node[pos=1, right, yshift=-0.01cm, align=left]{\small{Kinematically feasible acceleration setpoints}}; % \end{tikzpicture} \hspace{-5.5cm} \resizebox{0.8\textwidth}{!}{ \input{figures/action_space} } % \caption{% The figure illustrates for a single joint how actions $\underline{a}$ are mapped to kinematically feasible accelerations. } \vspace{-0.5cm} \label{fig:action_space} \end{figure} Each action $\underline{a} \in \mathcal{A}$ is a vector consisting of a scalar $\in [-1, 1]$ per robot joint controlled by the neural network. At time step $t$, the action $\underline{a_t}$ specifies the joint acceleration $a_{t+1}$. Compliance with the specified joint limits is ensured by mapping the action $\underline{a_t}$ along the range of kinematically feasible acceleration setpoints $[a_{t+1_{min}}, a_{t+1_{max}}]$: \begin{align} a_{t+1} = a_{t+1_{min}} + \frac{1 + \underline{a}_t}{2} \cdot \left(a_{t+1_{max}} - a_{t+1_{min}}\right) \end{align} The method to compute the range $[a_{t+1_{min}}, a_{t+1_{max}}]$ is explained in \cite{kiemel2020learning}. Fig. \ref{fig:action_space} demonstrates how the acceleration of a single joint is controlled using three exemplary actions $\underline{a_t}$, $\underline{a_{t+1}}$ and $\underline{a_{t+2}}$. To generate a continuous trajectory, the acceleration is linearly interpolated between the discrete time steps. Once the course of the joint acceleration is known, velocity and position setpoints for a trajectory controller can be calculated by integration. \subsubsection{Calculation of rewards $R_{\underline{a}}$} We consider the tracking of reference paths as a multi-objective optimization problem. The reward function formalizes the trade-off between the time to traverse the reference path, the deviation from the reference path and additional task-specific objectives: \begin{align} R_{\underline{a}} = \alpha \cdot R_l + \beta \cdot R_d + \gamma \cdot R_{s_1} + \ldots + \delta \cdot R_{s_n}, \label{eq:reward} \end{align} where $R_l$ is the path length reward, $R_d$ is the path deviation reward and $R_{s_1}$ to $ R_{s_n}$ represent task-specific objectives. % The reward components $R_l$, $R_d$, $R_{s_1} \ldots R_{s_n}$ are defined to be in the range $[0.0, 1.0]$. Non-negative weighting factors \mbox{$\alpha$, $\beta$, $\gamma \ldots \delta$} control the influence of each objective. To determine the path length reward $R_l$ and the path deviation reward $R_d$, we calculate the path traversed as a result of action $\underline{a}$. In the reward calculation box of Fig.~\ref{fig:basic_principle}, this path is shown in red. \begin{figure}[b] \centering \captionsetup[subfigure]{margin=0pt} \vspace{-0.2cm} \begin{subfigure}[c]{0.23\textwidth} % \vspace{-0.0cm} % \input{figures/reward/distance} % % % % \end{subfigure} \begin{subfigure}[c]{0.23\textwidth} \vspace{-0.0cm} % \input{figures/reward/deviation} % % \end{subfigure} \vspace{-0.1cm} \caption{Path length reward $R_l$ and path deviation reward $R_d$.} \label{fig:rewards} \vspace{-0.1cm} \end{figure} We then compute the length of the path $l$ and its average deviation from the \mbox{reference path $d$}. To calculate $d$, the Euclidian distance between waypoints on the generated path and waypoints on the reference path is averaged. The first waypoint of the generated path is compared with the waypoint of the reference path that is marked with a red cross in Fig.~\ref{fig:observation_spline}. Further comparison points are shifted by the same arc length on each of the two paths. Fig.~\ref{fig:rewards} illustrates how $l$ and $d$ are mapped to $R_l$ and $R_d$. The path length reward $R_l$ controls the speed of traversing the reference path. Under normal conditions, a fast traversal is preferred. For that reason, larger path lengths receive higher rewards. However, towards the end of the reference path, the robot should slow down and finally come to a standstill. To achieve this behavior, the reward is reduced if the path length exceeds $l_\text{State}$, the length of the path included in the state. % Once the end of the reference spline is reached, $l_\text{State}$ is zero and the constant length $l_\text{End}$ controls how much the robot is penalized for further movements. The path deviation reward $R_d$ encourages the robot to stay close to the reference path. It is defined as a decreasing quadratic function yielding a value of zero if the deviation $d$ exceeds a predefined threshold $d_{\textrm{max}}$. For the ball-on-plate task, an additional reward component $R_{s_1}$ is determined based on the distance between the ball and the center of the plate, using a decreasing quadratic function like that shown for $R_d$. To maintain balance with the bipedal humanoid \mbox{ARMAR-4}, we reward small angles between the robot's pelvis and an upward pointing z-axis. This angle is \SI{0}{\degree} when the robot is upright and \SI{90}{\degree} when the robot is lying on the ground. If the legs of the robot are not fixed, we additionally reward a small positional displacement of the pelvis to prevent the robot from moving around. \subsubsection{Termination of episodes} In the case of a successful task execution, an episode is terminated after a specified number of time steps. However, during training we define additional conditions that lead to an early termination of an episode. For path tracking without sensory feedback, an episode is terminated if the deviation $d$ between the generated path and the reference path exceeds a predefined threshold. The ball-on-plate task is additionally terminated if the ball falls from the plate. In case of the bipedal humanoid \mbox{ARMAR-4}, an episode is terminated if the robot falls over. Note that the reward assigned to an action is never negative. For that reason, early termination is avoided during the learning process as it leads to a smaller sum of rewards. \subsection{Generation of reference paths} \subsubsection{Datasets used for the training process} When using model-free RL, the aim of the training process is to find a policy that optimizes the sum of future rewards. Transferred to our specific problem, this means that the learning algorithm tries to find an optimized tracking strategy for the entire reference path, although only a part of it is known. The best optimization results can be achieved if the reference paths used within the training process are similar to those encountered during deployment. For our evaluation, we use three datasets with different path characteristics. Fig.~\ref{fig:datasets} visualizes some of the reference paths for each dataset. The random dataset is generated by selecting random actions at each decision step and storing the paths resulting from the random robot motions. We use a method described in \cite{kiemel2021collision} to ensure that only collision-free paths are generated. As can be seen in Fig.~\ref{fig:datasets}a, the reference paths cover the entire working space of the robot. In typical industrial applications, however, robots do not move randomly. Instead, they often move between Cartesian target points. To recreate such a situation, we train a neural network to generate collision-free trajectories between randomly sampled target points using the method from \cite{kiemel2021collision}. The target point dataset shown in Fig.~\ref{fig:datasets}b is composed of paths produced by this network. For the ball-on-plate task, the reference paths are computed in such a way that the plate is always aligned horizontally. The corresponding dataset is visualized in Fig.~\ref{fig:datasets}c. We note that the datasets used for training and testing are created in the same way, but do not contain the same paths. \begin{figure}[t] \captionsetup[subfigure]{margin=0pt} \vspace{0.2cm} \hspace{-0.0025\textwidth} \begin{subfigure}[c]{0.155\textwidth} % \vspace{-0.0cm} % % \begin{tikzpicture}[scale=1.0, every node/.style={scale=1.0}, node distance=2cm] \node[image_frame] at (0, 0.0cm) { \includegraphics[trim=925 300 900 350, clip, height=1.025\textwidth]{figures/datasets/random_small.jpg}}; \end{tikzpicture} \vspace{-0.40cm}\hspace*{-1.2cm}\subcaptionbox{Random}[5cm] % % \end{subfigure} \begin{subfigure}[c]{0.155\textwidth} \vspace{-0.0cm} % \begin{tikzpicture}[scale=1.0, every node/.style={scale=1.0}, node distance=2cm] \node[image_frame] at (0, 0.0cm) { \includegraphics[trim=925 300 900 350, clip, height=1.025\textwidth]{figures/datasets/target_point_small.jpg}}; \end{tikzpicture} % % \vspace{-0.4cm}\hspace*{-1.2cm}\subcaptionbox{Target point}[5cm] \end{subfigure} \begin{subfigure}[c]{0.155\textwidth} \vspace{0.0cm} \begin{tikzpicture}[scale=1.0, every node/.style={scale=1.0}, node distance=2cm] \node[image_frame] at (0, 0.0cm) { \includegraphics[trim=925 300 900 350, clip, height=1.025\textwidth]{figures/datasets/balancing_small.jpg}}; \end{tikzpicture} % \vspace{-0.4cm}\hspace*{-1.2cm}\subcaptionbox{Ball balancing}[5cm] % % \end{subfigure} \caption{Visualization of the datasets used for our evaluation.}% \label{fig:datasets} \vspace{-0.28cm} \end{figure} \subsubsection{Spline knots included in the state} \begin{figure}[h] \captionsetup[subfigure]{margin=0pt} \vspace{-0.5cm} \centering \begin{tikzpicture} \definecolor{ORIGINAL_PATH_BLUE}{RGB}{0, 0, 255} \definecolor{MATPLOTLIB_ORANGE}{RGB}{255, 127, 14} \definecolor{MATPLOTLIB_DIMGREY}{RGB}{105, 105, 105} \hspace{0.23cm} \node[text width=4cm] at (0.2cm, 4.35cm) (origin){}; \draw [draw=ORIGINAL_PATH_BLUE, line width=1.5pt, scale=0.7] ($(origin.center)+(-9.3cm, -0.0cm)$) -- + (0.45cm, 0cm) node[pos=1, right, yshift=0.01cm, align=left, scale=0.85]{Original path\strut}; \draw [draw=black, line width=0.9pt, scale=0.7] ($(origin.center)+(-6.0cm, -0.075cm)$) -- + (0.2cm, 0.2cm) node[pos=1, right, yshift=0.01cm, align=left, scale=0.85]{}; \draw [draw=black, line width=0.9pt, scale=0.7] ($(origin.center)+(-6.0cm, +0.125cm)$) -- + (0.2cm, -0.2cm) node[pos=1, right, yshift=0.01cm, align=left, scale=0.85]{}; \node[align=left, scale=0.85] at ($(origin.center)+(-3.12cm, -0.0cm)$) {Spline knots\strut}; \draw [draw=REFERENCE_PATH_GREEN, line width=1.5pt, scale=0.7] ($(origin.center)+(-3.0cm, -0.0cm)$) -- + (0.45cm, 0cm) node[pos=1, right, yshift=0.01cm, align=left, scale=0.85]{Resulting reference path\strut}; % \end{tikzpicture} \begin{subfigure}[c]{0.23\textwidth} % \vspace{-0.0cm} % \begin{tikzpicture}[scale=1.0, every node/.style={scale=1.0}, node distance=2cm] \node[image_frame](eight_equal_sampling) at (0, 0.0cm) {\includegraphics[trim=200 970 270 950, clip, height=0.6\textwidth]{figures/spline_sampling/eight_equal_sampling_original.png}}; \end{tikzpicture} % \vspace{-0.40cm}\hspace*{-0.65cm}\subcaptionbox{Distance-based sampling}[5cm] % % \end{subfigure} \begin{subfigure}[c]{0.23\textwidth} \vspace{-0.0cm} % \begin{tikzpicture}[scale=1.0, every node/.style={scale=1.0}, node distance=2cm] \node[image_frame](eight_curvature) at (0, 0.0cm) {\includegraphics[trim=200 970 270 950, clip, height=0.6\textwidth]{figures/spline_sampling/eight_curvature_original.png}}; \end{tikzpicture} % % \vspace{-0.4cm}\hspace*{-0.645cm}\subcaptionbox{Curvature-based sampling}[5cm] \end{subfigure} \begin{subfigure}[c]{0.475\textwidth} \vspace{0.1cm} \begin{tikzpicture} \definecolor{MATPLOTLIB_BLUE}{RGB}{31, 119, 180} \definecolor{MATPLOTLIB_ORANGE}{RGB}{255, 127, 14} \definecolor{MATPLOTLIB_DIMGREY}{RGB}{105, 105, 105} \hspace{0.23cm} \node[text width=4cm] at (0.2cm, 4.35cm) (origin){}; \draw [draw=MATPLOTLIB_BLUE, line width=1.5pt, scale=0.7] ($(origin.center)+(-9.3cm, -0.0cm)$) -- + (0.45cm, 0cm) node[pos=1, right, yshift=0.01cm, align=left, scale=0.85]{$x(s)$}; \draw [draw=MATPLOTLIB_ORANGE, line width=1.5pt, scale=0.7] ($(origin.center)+(-7.4cm, -0.0cm)$) -- + (0.45cm, 0cm) node[pos=1, right, yshift=0.01cm, align=left, scale=0.85]{$y(s)$}; \draw [draw=MATPLOTLIB_DIMGREY, line width=1.5pt, scale=0.7] ($(origin.center)+(-5.5cm, 0.0cm)$) -- + (0.45cm, 0cm) node[pos=1, right, yshift=0.00cm, align=left, scale=0.85]{Curvature $\kappa(s)=\sqrt{x''(s)^2 + y''(s)^2}$}; % \end{tikzpicture} \vspace{0.1cm} % \includegraphics[trim=8 62 0 0, clip, width=\textwidth]{figures/spline_sampling/eight_equal_pos_curvature.pdf} \includegraphics[trim=8 60 0 0, clip, width=\textwidth]{figures/spline_sampling/eight_curvature_pos_original.pdf} \includegraphics[trim=8 0 0 54, clip, width=\textwidth]{figures/spline_sampling/eight_equal_pos_curvature.pdf} \vspace{-0.4cm}\hspace*{-0.845cm}\subcaptionbox{Knot position over arc length for both sampling strategies.}[10cm] \end{subfigure} \caption{% Strategies for the sampling of spline knots.}% \label{fig:spline_sampling} \vspace{-0.28cm} \end{figure} The reference path is described in the state based on a fixed number of following spline knots. Different strategies can be used to place the knots along a given path. Fig. \ref{fig:spline_sampling} illustrates two of them using an exemplary two-dimensional path shaped like a lemniscate. With distance-based sampling, the knots are placed so that the arc length between them is equal. When using curvature-based sampling, the curvature of the path is computed and integrated. The knots are selected such that the integrated curvature between the knots is equal. With distance-based sampling, the length of the path included in the state is always the same, except at the end of the reference path. When using curvature-based sampling, however, the included path length depends on the curvature of the reference path. Sections of low curvature that can be traversed quickly lead to a larger path being included in the state. \section{Evaluation} We evaluate our method by learning to track reference paths with and without additional objectives. Our evaluation environments are shown in Fig. \ref{fig:header}. The KUKA iiwa is an industrial lightweight robot with 7 joints. The humanoid robot \mbox{ARMAR-6}, shown in Figure \ref{fig:header}c, is controlled by 17~joints. The bipedal humanoid ARMAR-4 has 30 joints, with 18 used for the upper body and 12 used for the legs. In the case of ARMAR-4, the reference path specifies the joint positions of the upper body only. For the other two robots, the positions of all joints are defined by the reference path. Our neural networks are trained using proximal policy optimization (PPO) \cite{schulman2017proximal} based on data generated by the physics engine PyBullet\cite{coumans2016pybullet}. We use networks with two hidden layers, the first one consisting of 256 neurons and the second one consisting of 128 neurons. The time between decision steps is set to $\Delta t_{N}=$ \SI{0.1}{\s}. The results shown in the following tables were obtained by averaging data from 1200 episodes, with reference paths taken from separate test datasets. For the random dataset and the target point dataset, we use curvature-based sampling with $N=9$ knots included in the state. In the case of the ball balancing dataset, distance-based sampling with $N=5$ knots is used. \begin{figure}[b] \captionsetup[subfigure]{margin=0pt} \vspace{-0.3cm} \centering \begin{tikzpicture} \def\xminPlot{0.151} \def\xmaxPlot{0.949} \SUBTRACT{\xmaxPlot}{\xminPlot}{\xdeltaPlot} \DIVIDE{\xdeltaPlot}{3}{\xdeltaPlotNorm} \def0.135{0.135} \def0.985{0.985} \def0.364{0.364} \def0.535{0.535} \SUBTRACT{0.985}{0.135}{\ydeltaPlot} \SUBTRACT{0.535}{0.364}{\ydeltaAcc} \MULTIPLY{\ydeltaAcc}{4}{\ydeltaGraph} \SUBTRACT{\ydeltaPlot}{\ydeltaGraph}{\ydeltaTmp} \DIVIDE{\ydeltaTmp}{3}{\ydeltaGap} \node[text width=4cm] at (-1.2cm, 0cm) (origin){}; \draw [draw=REFERENCE_PATH_GREEN, line width=1.5pt, scale=0.7] ($(origin.center)+(-6.75cm, 0.075cm)$) -- + (0.45cm, 0cm) node[pos=1, right, yshift=-0.05cm, align=left, scale=0.85]{Reference path}; \draw [draw=REFERENCE_PATH_PURPLE, line width=1.5pt, scale=0.7] ($(origin.center)+(-6.75cm, -0.0cm)$) -- + (0.45cm, 0cm); \draw [draw=GENERATED_PATH_RED, line width=1.5pt, scale=0.7] ($(origin.center)+(-0.75cm, 0.0cm)$) -- + (0.45cm, 0cm) node[pos=1, right, yshift=0.00cm, align=left, scale=0.85]{Generated path}; % \end{tikzpicture} \begin{subfigure}[c]{0.23\textwidth} % \vspace{-0.0cm} % \begin{tikzpicture}[scale=1.0, every node/.style={scale=1.0}, node distance=2cm] \node[image_frame] at (0, 0.0cm) { \includegraphics[trim=855 420 860 250, clip, height=0.85\textwidth]{figures/final_path/one_industrial/final_2.png}}; \end{tikzpicture} % \vspace{-0.40cm}\hspace*{-0.7cm}\subcaptionbox{KUKA iiwa}[5cm] % % \end{subfigure} \begin{subfigure}[c]{0.23\textwidth} \vspace{-0.0cm} % \begin{tikzpicture}[scale=1.0, every node/.style={scale=1.0}, node distance=2cm] \node[image_frame] at (0, 0.0cm) { \includegraphics[trim=800 390 800 170, clip, height=0.85\textwidth]{figures/final_path/armar_6/final_5_small.jpg}}; \end{tikzpicture} % % \vspace{-0.4cm}\hspace*{-0.645cm}\subcaptionbox{ARMAR-6}[5cm] \end{subfigure} \caption{% Path tracking without additional objectives.}% \label{fig:example_path_no_feedback} \vspace{-0.28cm} \end{figure} \begin{table*}[t] \caption{Training results for time-optimized path tracking without additional objectives obtained based on 1200 episodes.} \vspace{-0.15cm} \makegapedcells \begin{tabular*}{\textwidth}{p{34.5mm}p{19mm}p{8.7mm}p{8.7mm}p{8.7mm}p{8.7mm}p{8.7mm}p{8.7mm}p{8.7mm}p{8.7mm}p{8.7mm}} \toprule \multirow[t]{2}{*}{Configuration} & \multicolumn{1}{c}{Duration [s]} & \multicolumn{3}{c}{Joint position deviation [rad]} & \multicolumn{3}{c}{Cart. position deviation [cm]} & \multicolumn{3}{c}{Cart. orientation deviation [°]}\\ & (robot stopped) & \multicolumn{1}{c}{mean} & \multicolumn{1}{c}{max} & \multicolumn{1}{c}{final} & \multicolumn{1}{c}{mean} & \multicolumn{1}{c}{max} & \multicolumn{1}{c}{final} & \multicolumn{1}{c}{mean} & \multicolumn{1}{c}{max} & \multicolumn{1}{c}{final}\\ \hline Kuka iiwa & & & & \\ ~~\llap{\textbullet}~~ Random dataset & \hfil $4.28$ \hfil & \hfil $ 0.11$ \hfil & \hfil $0.19$ \hfil & \hfil $0.09$ \hfil & \hfil $3.3$ \hfil & \hfil $7.5$ \hfil & \hfil $2.7$ \hfil & \hfil $5.8$ \hfil & \hfil $11.8$ \hfil & \hfil $5.1$ \hfil \\ ~~\llap{\textbullet}~~ Target point dataset % & \hfil $4.99$ \hfil & \hfil $0.12$ \hfil & \hfil $0.21$ \hfil & \hfil $0.12$ \hfil & \hfil $3.7$ \hfil & \hfil $8.1$ \hfil & \hfil $3.8$ \hfil & \hfil $6.7$ \hfil & \hfil $13.5$ \hfil & \hfil $6.3$ \hfil \\ ~~\llap{\textbullet}~~ Ball balancing dataset & \hfil $2.44$ \hfil & \hfil $0.04$ \hfil & \hfil $0.08$ \hfil & \hfil $0.03$ \hfil & \hfil $1.4$ \hfil & \hfil $3.0$ \hfil & \hfil $1.4$ \hfil & \hfil $1.7$ \hfil & \hfil $3.9$ \hfil & \hfil $1.5$ \hfil \\ \hline ARMAR-6 & & & & \\ ~~\llap{\textbullet}~~ Random dataset & \hfil $4.98$ \hfil & \hfil $0.14$ \hfil & \hfil $0.20$ \hfil & \hfil $0.16$ \hfil & \hfil $5.5$ \hfil & \hfil $13.6$ \hfil & \hfil $6.2$ \hfil & \hfil $5.3$ \hfil & \hfil $11.5$ \hfil & \hfil $6.0$ \hfil \\ \hline % ARMAR-4 (fixed base) & & & & \\ ~~\llap{\textbullet}~~ Random dataset & \hfil $5.09$ \hfil & \hfil $0.14$ \hfil & \hfil $0.20$ \hfil & \hfil $0.14$ \hfil & \hfil $3.3$ \hfil & \hfil $7.8$ \hfil & \hfil $3.5$ \hfil & \hfil $5.6$ \hfil & \hfil $11.7$ \hfil & \hfil $5.7$ \hfil \\ ~~\llap{\textbullet}~~ Target point dataset & \hfil $5.48$ \hfil & \hfil $0.14$ \hfil & \hfil $0.21$ \hfil & \hfil $0.15$ \hfil & \hfil $3.6$ \hfil & \hfil $8.8$ \hfil & \hfil $3.8$ \hfil & \hfil $5.6$ \hfil & \hfil $12.4$ \hfil & \hfil $6.2$ \hfil \\ \bottomrule \end{tabular*} \label{table:tracking_no_feedback} \vspace{-0.33cm} \end{table*} \subsection{Path tracking without additional objectives} When tracking paths without additional targets, the networks are trained to minimize the duration of the trajectory and the average deviation from the reference path. TABLE \ref{table:tracking_no_feedback} shows the training results obtained for the different robots and datasets. Note that the learning algorithm tries to minimize the average joint position deviation, given in the second column. However, to give a better idea of the results, we also specify deviations with respect to the position and orientation in Cartesian space. For this purpose, the reference path and the generated path are converted to Cartesian space using forward kinematics. The tool center point (TCP) is used as the reference point for the KUKA iiwa, whereas the fingertips are used for the humanoid robots. Renderings of two exemplary episodes can be seen in Fig. \ref{fig:example_path_no_feedback}. To compute the deviations, points on the reference path are compared with points on the generated path. The comparison points are selected such that they are equally far away from the beginning of the respective path. To specify a trajectory duration and a final position deviation, the robot joints are decelerated as soon as the end of the reference path is reached. Using the ball balancing dataset, an average Cartesian deviation of \SI{1.4}{\cm} and \SI{1.7}{\degree} is obtained. The paths in the random and the target point dataset show a larger variance, resulting in a Cartesian deviation of approximately \SI{4}{\cm} and~\SI{6}{\degree}. In the following, we evaluate how the trajectory duration and the position deviation can be influenced. \subsubsection{Trade-off traversing time vs. path deviaton} \begin{table}[t] \vspace{-0.0cm} \caption{% Trade-off traversing time vs. path deviation. } \vspace{-0.15cm} \makegapedcells \begin{tabular*}{0.49\textwidth}{@{}p{27.0mm}p{17.5mm}p{8.7mm}p{8.7mm}p{8.7mm}} \toprule \hspace{0.05cm}Kuka iiwa with & \multicolumn{1}{c}{Duration [s]} & \multicolumn{3}{c}{Cart. position deviation [cm]} \\ \hspace{0.05cm}random dataset & (robot stopped) & \multicolumn{1}{c}{mean} & \multicolumn{1}{c}{max} & \multicolumn{1}{c}{final} \\ \hline \hspace{0.05cm}~~\llap{\textbullet}~~ Length $<$ deviation & \hfil $4.76$ \hfil & \hfil $2.7$ \hfil & \ \hfil $6.4$ \hfil & \hfil $2.3$ \hfil\\ \hspace{0.05cm}~~\llap{\textbullet}~~ Length $\approx$ deviation & \hfil $4.28$ \hfil & \hfil $3.3$ \hfil & \ \hfil $7.5$ \hfil & \hfil $2.7$ \hfil\\ \hspace{0.05cm}~~\llap{\textbullet}~~ Length $>$ deviation & \hfil $4.08$ \hfil & \hfil $3.6$ \hfil & \ \hfil $8.0$ \hfil & \hfil $3.1$ \hfil\\ \bottomrule \end{tabular*} \vspace{-0.54cm} \label{table:trade_off} \end{table} Our reward function (\ref{eq:reward}) allows us to assign different weights to the path length reward $R_l$ and to the path deviation reward $R_d$. TABLE \ref{table:trade_off} shows how the weighting affects the traversing time and the path deviation. If the weighting of the deviation reward is increased, the path deviation decreases whereas the trajectory duration increases. Likewise, faster trajectories with a higher path deviation are learned when the weighting of the path length reward is increased. \subsubsection{Number of knots included in the state} TABLE \ref{table:knots} shows how the training results are affected by the the number of knots $N$ used to describe the following part of the reference path. If more knots are included in the state, the reference path can be traversed faster. In return, however, a larger part of the reference path has to be known in advance. \begin{table}[t] \vspace{-0.0cm} \caption{% Impact of the knots included in the state. } \vspace{-0.15cm} \makegapedcells \begin{tabular*}{0.49\textwidth}{p{22.5mm}p{19mm}p{8.7mm}p{8.7mm}p{8.7mm}} \toprule Kuka iiwa with & \multicolumn{1}{c}{Duration [s]} & \multicolumn{3}{c}{Cart. position deviation [cm]} \\ random dataset & (robot stopped) & \multicolumn{1}{c}{mean} & \multicolumn{1}{c}{max} & \multicolumn{1}{c}{final} \\ \hline ~~\llap{\textbullet}~~ 5 knots & \hfil $5.20$ \hfil & \hfil $2.5$ \hfil & \ \hfil $5.6$ \hfil & \hfil $2.8$ \hfil\\ ~~\llap{\textbullet}~~ 7 knots & \hfil $4.52$ \hfil & \hfil $3.4$ \hfil & \ \hfil $7.5$ \hfil & \hfil $3.0$ \hfil\\ ~~\llap{\textbullet}~~ 9 knots & \hfil $4.28$ \hfil & \hfil $3.3$ \hfil & \ \hfil $7.5$ \hfil & \hfil $2.7$ \hfil\\ \bottomrule \end{tabular*} \vspace{-0.5cm} \label{table:knots} \end{table} \begin{table}[b] \vspace{-0.25cm} \caption{% Generalization ability between datasets. } \vspace{-0.15cm} \makegapedcells \begin{tabular*}{0.49\textwidth}{@{}p{27.0mm}p{17.5mm}p{8.5mm}p{7.5mm}p{7.5mm}} \toprule \hspace{0.05cm} & \multicolumn{1}{c}{Duration [s]} & \multicolumn{3}{c}{Cart. position deviation [cm]} \\ \hspace{0.05cm} & (robot stopped) & \hfil mean \hfil & \hfil max \hfil & \hfil final \hfil \\ \hline \hspace{0.05cm}Kuka iiwa & & & & \\ \hspace{0.05cm}~~\llap{\textbullet}~~ Random dataset to \newline \hspace*{0.05cm}\phantom{~~\llap{\textbullet}~~ }target point dataset & \hfil $4.87$ \hfil & \hfil $3.9$ \hfil & \hfil $9.2$ \hfil & \hfil $2.7$ \hfil\\ \hspace{0.05cm}ARMAR-4 (fixed base) & & & & \\ \hspace{0.05cm}~~\llap{\textbullet}~~ Random dataset to \newline \hspace*{0.05cm}\phantom{~~\llap{\textbullet}~~ }target point dataset & \hfil $5.40$ \hfil & \hfil $3.8$ \hfil & \hfil $9.2$ \hfil & \hfil $4.1$ \hfil\\ \bottomrule \end{tabular*} \vspace{-0.1cm} \label{table:random_to_target} \end{table} \begin{table}[b] \vspace{-0.1cm} \caption{Feature comparison with TOPP-RA \cite{pham2018Toppra}} \vspace{-0.15cm} \makegapedcells \begin{tabular*}{0.49\textwidth}{p{44mm}p{15.5mm}p{15.5mm}} \toprule \hspace{0.02cm} & \multicolumn{1}{c}{TOPP-RA} & \multicolumn{1}{c}{Ours} \\ \hline Supports velocity limits & \hfil \textcolor{TABLE_GOOD}{\ding{51}} \hfil & \hfil \textcolor{TABLE_GOOD}{\ding{51}} \hfil \\ Supports acceleration limits & \hfil \textcolor{TABLE_GOOD}{\ding{51}} \hfil & \hfil \textcolor{TABLE_GOOD}{\ding{51}} \hfil \\ Supports jerk limits & \hfil \textcolor{PATH_COLLISION}{\ding{55}} \hfil & \hfil \textcolor{TABLE_GOOD}{\ding{51}} \hfil \\ Supports path adjustments & \hfil \textcolor{PATH_COLLISION}{\ding{55}} \hfil & \hfil \textcolor{TABLE_GOOD}{\ding{51}} \hfil \\ Supports sensory feedback & \hfil \textcolor{PATH_COLLISION}{\ding{55}} \hfil & \hfil \textcolor{TABLE_GOOD}{\ding{51}} \hfil \\ \bottomrule \end{tabular*} \vspace{0ex} \label{table:feature_toppra} \vspace{-0.0cm} \end{table} \vspace{-0.3cm} \subsubsection{Generalization ability between datasets} To analyze the generalization ability with respect to different path characteristics, we evaluate networks trained using the random dataset with reference paths from the target point dataset. TABLE \ref{table:random_to_target} shows the results for the Kuka iiwa and the humanoid \mbox{ARMAR-4}. Compared to the networks trained directly with the target point dataset, the resulting trajectories are slightly faster but also a little less accurate in tracking the reference path. Overall, however, the differences are small, indicating that networks trained on random paths can also be used to track paths with different path characteristics. In the accompanying \href{https://youtu.be/gCPN8mqPVHg}{\textcolor{blue}{video}}, we additionally show how a network trained on random paths performs on reference paths that resemble geometric shapes in Cartesian space. \vspace{0.05cm} \subsubsection{Comparison with time-optimal path parameterization} We benchmark our approach with TOPP-RA \cite{pham2018Toppra}, a state-of-the-art offline method for time-optimal path parameterization. TABLE \ref{table:feature_toppra} compares the features of both methods. \begin{figure*}[t] \input{figures/real_robot_balancing} \caption{% The ball-on-plate task performed by a real KUKA iiwa. When the balancing performance is rewarded (bottom), the reference path is traversed less quickly, but the ball is kept close to the center of the plate. } \label{fig:real_robot_balancing} \vspace{-0.45cm} \end{figure*} While our method additionally supports jerk limits and online adjustments of the reference path, the offline method TOPP-RA generates faster trajectories that track the reference path almost perfectly. A quantitative analysis is shown in TABLE \ref{table:toppra_timing}. Trajectories for the KUKA iiwa generated with TOPP-RA require around \SI{78}{\percent} of the time needed by our method. For the humanoid \mbox{ARMAR-4}, around \SI{65}{\percent} of the time is needed. In return, the reference paths need to be known in advance and it is not possible to consider additional objectives that require sensory feedback. \subsection{Path tracking with objectives based on sensory feedback} \subsubsection{Ball-on-plate task} The goal of the ball-on-plate task is to traverse a reference path while balancing a ball. During the motion execution, the position of the ball on the plate is provided as sensory feedback. TABLE \ref{table:ball_balancing} shows the training results with and without an additional reward component based on the balancing performance. Without the balancing reward, the ball falls off the plate in all evaluated episodes. However, when the balancing performance is rewarded, the ball falls down in less than \SI{0.5}{\percent} of the episodes. In return, the reference path is traversed less quickly and less precisely. Fig. \ref{fig:real_robot_balancing} visualizes the results based on an exemplary reference path traversed by a real KUKA iiwa. The robot is controlled using the networks trained in simulation and the ball position is provided by a resistive touch panel. \begin{table}[b] \vspace{-0.1cm} \caption{% Comparison with the offline method \mbox{TOPP-RA.} } \vspace{-0.15cm} \makegapedcells \begin{tabular*}{0.49\textwidth}{p{22.0mm}p{17.5mm}p{14.5mm}p{18.0mm}} \toprule & \hfil Duration [s] \hfil& \hfil Relative \hfil & \hfil Max. joint pos. \hfil \\ & \hfil (robot stopped) \hfil & \hfil duration [\%] \hfil & \hfil deviation [rad] \hfil \\ \hline Kuka iiwa & & & \\ ~~\llap{\textbullet}~~ Random & \hfil $3.36$ \hfil & \hfil $78.5$ \hfil & \hfil $0.00$ \hfil \\ ~~\llap{\textbullet}~~ Target point & \hfil $3.79$ \hfil & \hfil $76.0$ \hfil & \hfil $0.00$ \hfil \\ ~~\llap{\textbullet}~~ Ball balancing & \hfil $1.91$ \hfil & \hfil $78.3$ \hfil & \hfil $0.00$ \hfil \\ \mbox{ARMAR-4 (fixed base)}& & & \\ ~~\llap{\textbullet}~~ Random & \hfil $3.31$ \hfil & \hfil $65.0$ \hfil & \hfil $0.00$ \hfil \\ ~~\llap{\textbullet}~~ Target point & \hfil $3.68$ \hfil & \hfil $67.2$ \hfil & \hfil $0.00$ \hfil \\ \bottomrule \end{tabular*} \vspace{-0.0cm} \label{table:toppra_timing} \end{table} \begin{table}[t] \vspace{0.05cm} \caption{% Training results for the ball-on-plate task. } \vspace{-0.15cm} \makegapedcells \begin{tabular*}{0.49\textwidth}{@{}p{19.2mm}p{14.95mm}p{11.0mm}p{10.5mm}p{14.5mm}} \toprule \hspace{0.05cm}Ball balancing & \multicolumn{1}{c}{Duration [s]} & \multicolumn{1}{c}{Balancing} & \multicolumn{2}{c}{Cart. pos. deviation [cm]} \\ \hspace{0.05cm}dataset & \hfil (end of path) \hfil & \hfil error [\%] \hfil & \multicolumn{1}{c}{mean} & \multicolumn{1}{c}{max} \\ \hline \hspace{0.05cm}Kuka iiwa & & & & \\ \hspace{0.00cm}~~\llap{\textbullet}~~ No balancing \newline \hspace*{0.00cm}\phantom{~~\llap{\textbullet}~~ }reward & \hfil $2.24$ \hfil & \hfil $100.0$ \hfil & \hfil $1.4$ \hfil & \hfil $3.0$ \hfil\\ \hspace{0.00cm}~~\llap{\textbullet}~~ Balancing \newline \hspace*{0.00cm}\phantom{~~\llap{\textbullet}~~ }reward & \hfil $2.99$ \hfil & \hfil $0.3$ \hfil & \hfil $2.3$ \hfil & \hfil $4.9$ \hfil\\ \bottomrule \end{tabular*} \vspace{-0.56cm} \label{table:ball_balancing} \end{table} \begin{table}[b] \vspace{-0.3cm} \caption{% Maintaining balance with ARMAR-4. } \vspace{-0.15cm} \makegapedcells \begin{tabular*}{0.49\textwidth}{@{}p{19.2mm}p{14.95mm}p{11.0mm}p{10.5mm}p{14.5mm}} \toprule \hspace{0.05cm}Target point & \multicolumn{1}{c}{Duration [s]} & \multicolumn{1}{c}{Balancing} & \multicolumn{2}{c}{Cart. pos. deviation [cm]} \\ \hspace{0.05cm}dataset & \hfil (end of path) \hfil & \hfil error [\%] \hfil & \multicolumn{1}{c}{mean} & \multicolumn{1}{c}{max} \\ \hline \hspace{0.05cm}ARMAR-4 with \newline \hspace*{0.05cm}fixed legs& & & & \\ \hspace{0.00cm}~~\llap{\textbullet}~~ No balancing \newline \hspace*{0.00cm}\phantom{~~\llap{\textbullet}~~ }reward & \hfil $5.28$ \hfil & \hfil $26.1$ \hfil & \hfil $3.6$ \hfil & \hfil $8.8$ \hfil\\ \hspace{0.00cm}~~\llap{\textbullet}~~ Balancing \newline \hspace*{0.00cm}\phantom{~~\llap{\textbullet}~~ }reward & \hfil $5.63$ \hfil & \hfil $5.3$ \hfil & \hfil $4.1$ \hfil & \hfil $9.6$ \hfil\\ \hspace{0.05cm}ARMAR-4 with \newline \hspace*{0.05cm}controlled legs& & & & \\ \hspace{0.00cm}~~\llap{\textbullet}~~ Balancing \newline \hspace*{0.00cm}\phantom{~~\llap{\textbullet}~~ }reward & \hfil $5.59$ \hfil & \hfil $0.8$ \hfil & \hfil $4.2$ \hfil & \hfil $9.8$ \hfil\\ \bottomrule \end{tabular*} \vspace{-0.0cm} \label{table:armar_balancing} \end{table} \subsubsection{Maintaining balance with ARMAR-4} The additional objective of this task is to prevent a bipedal robot from falling over. For that purpose, the pose of the robot's pelvis is provided as sensory feedback. TABLE \ref{table:armar_balancing} shows the training results for three different experimental configurations. In the first two experiments, the legs of the robot are fixed in an outstretched position. Without an additional balancing term in the reward function, the robot falls over in \SI{26}{\percent} of the episodes. With an additional reward for standing upright, the robot loses balance in approximately \SI{5}{\percent} of the episodes. In the third experiment, the 12 joints of the legs are also controlled by the neural network. % Thus, the network can use the legs to stabilize the motions of the upper body. As a result, the robot falls over in less than \SI{1}{\percent} of the episodes. \begin{figure}[t] \hspace{-0.6cm} \resizebox{0.53\textwidth}{!}{ \input{figures/armar_balancing} } % \caption{% Top: Without a balancing reward, the robot falls over. Bottom: With a reward for standing upright, the legs of the robot are used to keep the robot in balance. } \label{fig:armar_balancing} \vspace{-0.45cm} \end{figure} An exemplary episode of the first and the third experiment is shown in Fig. \ref{fig:armar_balancing} and in the accompanying \href{https://youtu.be/gCPN8mqPVHg}{\textcolor{blue}{video}}. \subsection{Real-time capability} As shown in Fig. \ref{fig:real_robot_balancing} and in the accompanying \href{https://youtu.be/gCPN8mqPVHg}{\textcolor{blue}{video}}, we successfully applied our method to a real KUKA iiwa robot using networks trained in simulation. The transfer is performed by sending the trajectory setpoints specified by each action to a real trajectory controller instead of a virtual one simulated by PyBullet. % To analyze the computational requirements of our method, we calculate 1200 episodes for each of the three robots shown in this paper using an Intel i7-8700K CPU. We then calculate the quotient of the computation time and the trajectory duration and provide the highest value of all episodes in TABLE \ref{table:computation_times}. The results show that the computation time is significantly smaller than the trajectory duration, making our method well-suited for real-time trajectory generation. \begin{table}[h] \vspace{-0.15cm} \caption{Evaluation of the computational effort.} \vspace{-0.15cm} \makegapedcells \begin{tabular*}{0.49\textwidth}{@{}p{25.5mm}p{12mm}p{23.5mm}p{11mm}} \toprule \hspace{0.02cm} & \hfil Kuka iiwa \hfil & ARMAR-4 with legs & \multicolumn{1}{c}{ARMAR-6} \\ \hline \hspace{0.05cm}\scalebox{1.4}{$\frac{\text{Computation time}}{\text{Trajectory duration}}$} & \hfil \SI{7.50}{\percent} & \hfil \SI{34.97}{\percent} & \hfill \SI{10.59}{\percent} \\ \bottomrule \end{tabular*} \vspace{-0.5cm} \label{table:computation_times} \end{table} \section{Conclusion and future work} This paper presented a learning-based approach to follow reference paths that can be changed during motion execution. Trajectories are generated by a neural network trained to maximize the traversing speed while minimizing the deviation from the reference path. Additional task-specific objectives can be considered by including sensory feedback into the state. The mapping of network actions to joint accelerations ensures that no kinematic joint limits are violated. We evaluated our method with and without additional objectives on robotic systems with up to 30 degrees of freedom showing that well-performing trajectories can be learned for reference paths with different path characteristics. % We also demonstrated successful \mbox{sim-2-real} transfer for a ball-on-plate task performed by an industrial robot. % In future work, we would like to investigate ways to additionally control the traversing speed during motion execution. \section*{ACKNOWLEDGMENT} This research was supported by the German Federal Ministry of Education and Research (BMBF) and the Indo-German Science \& Technology Centre (IGSTC) as part of the project TransLearn (01DQ19007A). We thank Tamim Asfour for his valuable feedback and advice. \bibliographystyle{IEEEtran}
{'timestamp': '2022-03-07T02:01:10', 'yymm': '2203', 'arxiv_id': '2203.01968', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.01968'}
arxiv
\section{Experimental details on CIFAR10} \label{sec:app_cifar10} In this section, we give the experimental details on the CIFAR10-based experiments shown in Figures \ref{fig:teaserplot} and \ref{fig:K_plot}. Moreover, we also conduct similar experiments using different neural network architectures. First, we give the full experimental details and then provide the results of the experiments using the different architectures. \paragraph{Subsampling CIFAR10} In all our experiments we subsample CIFAR10 to simulate the low sample size regime. We ensure that for all subsampled versions the number of samples of each class are equal. Hence, if we subsample to $500$ training images, then each class has exactly $50$ images, which are drawn uniformly from the $5k$ training images of the respective class. \paragraph{Mask perturbation on CIFAR10} We consider square black-mask perturbations; the attacker can set in the image a patch of size $2 \times 2$ to zero. The attack is a simplification of the patch-attack as considered in \cite{Wu20}. We show an example of a black-mask attack on each of the classes in CIFAR10 in Figure \ref{fig:cifar10_masks}. Clearly, the mask reduces the information about the class in the image as it occludes part of the object in the image. \begin{figure}[!ht] \centering \includegraphics[width=0.8\linewidth]{plotsAistats/cifar10_black_mask_attack.png} \caption{We show an example of a mask perturbation for all $10$ classes of CIFAR10. Even though the attack occludes part of the images, a human can still easily classify all images correctly.} \label{fig:cifar10_masks} \end{figure} During test time, we evaluate the attack exactly by means of a full grid search over all possible windows. Note that a full grid search requires $900$ forward passes to evaluate one image, which computationally too expensive during training time. Therefore, we use the same approximation as in \cite{Wu20} at training time. For each image in the training batch, we compute the gradient from the loss with respect to the input. Using that gradient, which is a tensor in $\mathbb{R}^{3 \times 32 \times 32}$, we compute the $l_1$-norm of each patch by a full grid search and save the upper left coordinates of the $K$ windows with largest $l_1$-norm. The intuition is that windows with high $l_1$-norm are more likely to change the prediction. Out of the $K$ identified candidate windows, we take the most loss worsening by means of a full list-search. \begin{wrapfigure}{r}{0.4\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/K_plot_cifar.png} \caption{We plot the standard error, robust error and susceptibility for varying attack strengths $K$. We see that the larger $K$, the lower the susceptibility, but the higher the standard error.} \label{fig:K_plot} \end{wrapfigure} \paragraph{Experimental training details} For all our experiments on CIFAR10, we adjusted the code provided by \cite{Phan21}. As typically done for CIFAR10, we augment the data with random cropping and horizontal flipping. For the experiments with results depicted in Figures \ref{fig:teaserplot} and \ref{fig:K_plot}, we use a ResNet18 network and train for $100$ epochs. We tune the parameters learning rate and weight decay for low robust error. For standard standard training, we use a learning rate of $0.01$ with equal weight decay. For adversarial training, we use a learning rate of $0.015$ and a weight decay of $10^{-4}$. We run each experiment three times for every dataset with different initialization seeds, and plot the average and standard deviation over the runs. For the experiments in Figure \ref{fig:teaserplot} and \ref{fig:num_obs_CIFAR} we use an attack strength of $K = 4$. Recall that we perform a full grid search at test time and hence have a good approximation of the robust accuracy and susceptibility score. \paragraph{Increasing training attack strength} We investigate the influence of the attack strength $K$ on the robust error for adversarial training. We take $\eps_{\text{tr}} = 2$ and $n = 500$ and vary $K$. The results are depicted in Figure \ref{fig:K_plot}. We see that for increasing $K$, the susceptibility decreases, but the standard error increases more severely, resulting in an increasing robust error. \paragraph{Robust error decomposition} In Figure \ref{fig:teaserplot}, we see that the robust error increases for adversarial training compared to standard training in the low sample size regime, but the opposite holds when enough samples are available. For completeness, we provide a full decomposition of the robust error in standard error and susceptibility for standard and adversarial training. We plot the decomposition in Figure \ref{fig:num_obs_CIFAR}. \begin{figure*}[!b] \centering \begin{subfigure}[b]{0.32\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/cifar10_robust_numobs.png} \caption{Robust error} \label{fig:RA_CIFAR_10_n} \end{subfigure} \begin{subfigure}[b]{0.32\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/cifar10_standard_numobs.png} \caption{Standard error} \label{fig:SA_CIFAR_10_n} \end{subfigure} \begin{subfigure}[b]{0.32\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/cifar10_sus_numobs.png} \caption{Susceptibility} \label{fig:Robustness_n} \end{subfigure} \caption{We plot the standard error, robust error and susceptibility of the subsampled datasets of CIFAR10 after adversarial and standard training. For small sample size, adversarial training has higher robust error then standard training. We see that the increase in standard error in comparison to the drop in susceptibility of standard versus robust training, switches between the low and high sample size regimes.} \label{fig:num_obs_CIFAR} \end{figure*} \paragraph{Multiple networks on CIFAR10} We run adversarial training for multiple network architectures on subsampled CIFAR10 ($n=500$) with mask perturbations of size $2 \times 2$ and an attack strength of $K=4$. We plot the results in Table \ref{CIFAR10_diffArchitectures}. For all the different architectures, we notice a similar increase in robust error when trained with adversarial training instead of standard training. \begin{table}[!ht] \centering \caption{We subsample CIFAR10 to a dataset of sample size $500$ and perform both standard training (ST) and adversarial training (AT) using different networks. We evaluate the resulting susceptibility score and the robust and standard error. } \begin{tabular}{ |p{2cm}||p{2cm}||p{1cm}||p{1cm}|p{2cm}|p{2cm}|p{2cm}|} \hline \multicolumn{7}{|c|}{Adversarial training on CIFAR10} \\ \hline Architecture & learning rate & weight decay & Train type & standard error & robust error & Susceptibility\\ \hline ResNet34 & $ 0.02$ & $0.025$ & ST & 44 & 64 & 50 \\ ResNet34 & $0.015$ & $10^{-4}$ & AT & 52 & 66 & 40\\ ResNet50 & $0.015$ & $0.03$ & ST & 45 & 62 & 47\\ ResNet50 & $0.015$ & $10^{-4}$ & AT & 53 & 68 & 45\\ VGG11bn & $0.03$ & $0.01$ & ST & 40 & 55 & 43\\ VGG11bn & $0.015$ & $10^{-4}$ & AT & 48 &63 & 34\\ VGG16bn & $0.02$ & $0.01$ & ST & 41 & 60 & 48\\ VGG16bn & $0.015$ & $10^{-4}$ & AT & 50 & 65 & 42\\ \hline \end{tabular} \label{CIFAR10_diffArchitectures} \end{table} \section{Static hand gesture recognition} \label{sec:handgestures} The goal of static hand gesture or posture recognition is to recognize hand gestures such as a pointing index finger or the okay-sign based on static data such as images \cite{Oudah20, Yang13}. The current use of hand gesture recognition is primarily in the interaction between computers and humans \cite{Oudah20}. More specifically, typical practical applications can be found in the environment of games, assisted living, and virtual reality \cite{Mujahid21}. In the following, we conduct experiments on a hand gesture recognition dataset constructed by \cite{Mantecon19}, which consists of near-infrared stereo images obtained using the Leap Motion device. First, we crop or segment the images after which we use logistic regression for classification. We see that adversarial logistic regression deteriorates robust generalization with increasing $\eps_{\text{tr}}$. \paragraph{Static hand-gesture dataset} We use the dataset made available by \cite{Mantecon19}. This dataset consists of near-infrared stereo images taken with the Leap Motion device and provides detailed skeleton data. We base our analysis on the images only. The size of the images is $640 \times 240$ pixels. The dataset consists of $16$ classes of hand poses taken by $25$ different people. We note that the variety between the different people is relatively wide; there are men and women with different posture and hand sizes. However, the different samples taken by the same person are alike. We consider binary classification between the index-pose and L-pose, and take as a training set $30$ images of the users $16$ to $25$. This results in a training dataset of $300$ samples. We show two examples of the training dataset in Figure \ref{fig:original_examples}, each corresponding to a different class. Observe that the near-infrared images darken the background and successfully highlight the hand-pose. As a test dataset, we take $10$ images of each of the two classes from the users $1$ to $10$ resulting in a test dataset of size $200$. \begin{figure} \centering \begin{subfigure}{0.49\textwidth} \includegraphics[width=.80\linewidth]{plotsAistats/Lpose.png} \caption{L pose} \label{fig:L_pose_or_example} \end{subfigure} \begin{subfigure}{0.49\textwidth} \includegraphics[width=.80\linewidth]{plotsAistats/Indexpose.png} \caption{Index pose} \label{fig:index_pose_or_example} \end{subfigure} \caption{We plot two images, where both correspond to the two different classes. We recognize the "L"-sign in Figure \ref{fig:L_pose_or_example} and the index sign in Figure \ref{fig:index_pose_or_example}. Observe that the near-infrared images highlight the hand pose well and blends out much of the non-useful or noisy background. } \label{fig:original_examples} \end{figure} \paragraph{Cropping the dataset} To speed up training and ease the classification problem, we crop the images from a size of $640 \times 240$ to a size of $200 \times 200$. We crop the images using a basic image segmentation technique to stay as close as possible to real-world applications. The aim is to crop the images such that the hand gesture is centered within the cropped image. For every user in the training set, we crop an image of the L-pose and the index pose by hand. We call these images the training masks $\{\text{masks}_i \}_{i=1}^{20}$. We note that the more a particular window of an image resembles a mask, the more likely that the window captures the hand gesture correctly. Moreover, the near-infrared images are such that the hands of a person are brighter than the surroundings of the person itself. Based on these two observations, we define the best segment or window, defined by the upper left coordinates $(i,j)$, for an image $x$ as the solution to the following optimization problem: \begin{equation} \label{preprocessing} \argmin_{i \in [440], \Hquad j \in [40]} \sum_{l=1}^{20}\|\text{masks}_l-x_{\{i:i+200,j:j+200\}}\|^2_2 - \frac{1}{2}\|x_{\{i+w,j+h\}}\|_1. \end{equation} Equation \ref{preprocessing} is solved using a full grid search. We use the result to crop both training and test images. Upon manual inspection of the cropped images, close to all images were perfectly cropped. We replace the handful poorly cropped training images with hand-cropped counterparts. \begin{figure}[!ht] \centering \begin{subfigure}{0.31\textwidth} \centering \includegraphics[width=.80\linewidth]{plotsAistats/L_147.png} \caption{Cropped L pose} \label{fig:cropped_L} \end{subfigure} \begin{subfigure}{0.31\textwidth} \centering \includegraphics[width=.80\linewidth]{plotsAistats/index_28.png} \caption{Cropped index pose} \label{fig:cropped_index} \end{subfigure} \begin{subfigure}{0.31\textwidth} \centering \includegraphics[width=.80\linewidth]{plotsAistats/L_pose_with_mask.png} \caption{Black-mask perturbation} \label{fig:cropped_L_mask} \end{subfigure} \caption{In Figure \ref{fig:cropped_L} and \ref{fig:cropped_index} we show an example of the images cropped using Equation \ref{preprocessing}. We see that the hands are centered and the images have a size of $200 \times 200$. In Figure \ref{fig:cropped_L_mask} we show an example of the square black-mask perturbation.} \label{fig:preprocessing} \end{figure} \paragraph{Square-mask perturbations} Since we use logistic regression, we perform a full grid search to find the best adversarial perturbation at training and test time. For completeness, the upper left coordinates of the optimal black-mask perturbation of size $\eps_{\text{tr}} \times \eps_{\text{tr}}$ can be found as the solution to \begin{equation} \label{square_perturbations_logistic_regression} \text{arg}\max_{i \in [200-\eps_{\text{tr}}], \Hquad j \in [200-\eps_{\text{tr}}]} \sum_{l,m \in [\eps_{\text{tr}}]}\theta_{[i:i+l,j:j+m]}. \end{equation} The algorithm is rather slow as we iterate over all possible windows. We show a black-mask perturbation on an $L$-pose image in Figure \ref{fig:cropped_L_mask}. \paragraph{Results} We run adversarial logistic regression with square-mask perturbations on the cropped dataset and vary the adversarial training budget and plot the result in Figure \ref{fig:eps_mask}. We observe attack that adversarial logistic regression deteriorates robust generalization. Because we use adversarial logistic regression, we are able to visualize the classifier. Given the classifier induced by $\theta$, we can visualize how it classifies the images by plotting $\frac{\theta - \min_{i \in [d]}\theta_{[i]}}{\max_{i \in [d]}\theta_{[i]}} \in [0,1]^{d}$. Recall that the class-prediction of our predictor for a data point $(x,y)$ is given by $\text{sign}(\theta^{\top} x) \in \{\pm 1\}$. The lighter parts of the resulting image correspond to the class with label $1$ and the darker patches with the class corresponding to label $-1$. \begin{wrapfigure}{r}{0.4\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/mask_plot_main.png} \caption{We plot the standard error and robust error for varying adversarial training budget $\eps_{\text{tr}}$. We see that the larger $\eps_{\text{tr}}$ the higher the robust error.} \label{fig:eps_mask} \end{wrapfigure} We plot the classifiers obtained by standard logistic regression and adversarial logistic regression with training adversarial budgets $\eps_{\text{tr}}$ of $10$ and $25$ in Figure \ref{fig:visulation_log}. The darker parts in the classifier correspond to patches that are typically bright for the $L$-pose. Complementary, the lighter patches in the classifier correspond to patches that are typically bright for the index pose. We see that in the case of adversarial logistic regression, the background noise is much higher than for standard logistic regression. In other words, adversarial logistic regression puts more weight on non-signal parts in the images to classify the training dataset and hence exhibits worse performance on the test dataset. \newpage \begin{figure}[!ht] \centering \begin{subfigure}{0.31\textwidth} \centering \includegraphics[width=.80\linewidth]{plotsAistats/natural_log_regr_result.png} \caption{$\eps_{\text{tr}} = 0 $} \label{fig:log_natural} \end{subfigure} \begin{subfigure}{0.31\textwidth} \centering \includegraphics[width=.80\linewidth]{plotsAistats/perTrain10logisticReg.png} \caption{$\eps_{\text{tr}} = 10 $} \label{fig:log_e10} \end{subfigure} \begin{subfigure}{0.31\textwidth} \centering \includegraphics[width=.80\linewidth]{plotsAistats/perTrain25logisticReg.png} \caption{$\eps_{\text{tr}} = 25$} \label{fig:log_e25} \end{subfigure} \caption{We visualize the logistic regression solutions. In Figure \ref{fig:log_natural} we plot the vector that induces the classifier obtained after standard training. In Figure \ref{fig:log_e10} and Figure \ref{fig:log_e25} we plot the vector obtained after training with square-mask perturbations of size $10$ and $25$, respectively. We note the non-signal enhanced background correlations at the parts highlighted with the red circles in the image projection of the adversarially trained classifiers. } \label{fig:visulation_log} \end{figure} \section{Adversarial training hurts robust generalization for nonlinear feature learning} \label{sec:app_theorycs} \fy{i've no idea what your statement was, it was a whole blurb was redundant definitions so this butchering is the fastest guess after scanning it} In this section, we give a mathematical explanation for the effect of adversarial training with directed attacks\xspace increasing the robust error for nonlinear feature learning models. In particular, we construct a dataset, the concentric spheres dataset, that has exactly one discriminative feature: the norm of the datapoints. Figure \ref{fig:app_cs_repeat} and Figure \ref{fig:cs_numsamp_rob} show that the behaviour of the feature learning model on our synthetic setting matches the behaviour we observe on the linear synthetic \emph{and} on the real-world datasets: in the low sample size regime, adversarial training increasingly hurts robust generalization with increasing perturbation set size. More concretely, we discuss a two-layer neural network and conclude the same intuitive explanation as in the linear example. First, we introduce the dataset and model. Then, we discuss some theoretical results. Lastly, we plot and discuss experiments. \subsection{Problem Setting} In this subsection, we first introduce the concentric spheres distribution, 2-layer quadratic neural networks and the directed attack\xspace that we consider. Then, we show that the optimal robust classifier is included in our function space. \paragraph{Distribution for concentric spheres} We study the concentric spheres distribution as also used in \cite{gilmer18, kolter19}. In particular, for $0<\radius_{-1}<\radius_{1}$, we draw $(x,y) \sim \mathbb{P}_{\text{CS}}$ as follows: we draw a binary label $y\in \{+1, -1\}$ equiprobably and a covariate vector $x \in \mathbb{R}^{d}$ that is, conditional on the label, distributed uniformly on the sphere of radius $R_{y}$. \paragraph{Perturbation sets} In this example, the radius of the input corresponds to the signal, hence, for a training perturbation size $0< \eps_{\text{tr}} < \frac{\radius_{1}-\radius_{-1}}{2}$ and a covariate $x$ we may define a directed attack\xspace as an attack out of the perturbation set \begin{equation} \label{eq:pertsetsphere} \mathcal{S}_C(x, \eps_{\text{tr}}) = \left\{\delta \in \mathbb{R}^{d} \mid \delta = \frac{x}{\norm{x}_2}\eta, \Hquad |\eta|<\eps_{\text{tr}}\right\}. \end{equation} \paragraph{Neural network classifier} Similar to prior work on concentric spheres such as \cite{gilmer18}, we consider two-layer neural networks with quadratic activations as our parameterized function class with \begin{equation*} f_\theta(x) = \left(x^T W_1 \right)^2 W_2 + b, \end{equation*} where $\theta =(W_1 , W_2,b)$ and $W_1 \in \mathbb{R}^{d \times p}$, $ W_2 \in \mathbb{R}^p$, $b\in \mathbb{R}$. Every function induces a decision boundary defined by \begin{equation} \label{eq:decisionboundary} db(f_\theta) = \{x \in \mathbb{R}^{d} \mid f_{\theta}(x) = 0\}. \end{equation} \fy{defined by} We note the function space of all neural networks as $\mathcal{F}_{\text{QNN}} = \{f_\theta(x): W_1 \in \mathbb{R}^{d \times p}, W_2 \in \mathbb{R}^p\}$. In particular, the function space includes a \fy{ perfectly robust classifier: this an expression that is not defined}. \fy{more like a fact than lemma} \begin{lemma} If $p>d$, the function space $\mathcal{F}_{\text{QNN}}$ contains a classifier that minimizes the robust error against perturbations~\eqref{eq:pertsetsphere} defined by the distribution $\mathbb{P}_{\text{CS}}$. \end{lemma} \fy{given $f_\theta$ what even is the $db(f_\theta)$? - i fixed it} \begin{proof} Clearly, for any consistent $\eps_{\text{te}}$, one perfectly robust classifier is a classifier with decision boundary ($db\left(f_{\theta}\right)$) the sphere with radius $R_{opt} = \frac{\radius_{-1}+\radius_{1}}{2}$. For a visualization see Figure \ref{fig:teaser_concentric_spheres}. Hence, it suffices to show that $\mathcal{F}_{\text{QNN}}$ includes a function that induces a decision boundary that is the sphere with radius $R_{opt}$. When $p>d$, choosing \begin{equation*} W_1 = \begin{pmatrix} I_d & 0 \end{pmatrix}, \end{equation*} $W_2 = 1_{\{p\}}$ and $b = -\radius_{-1}^2-\frac{\radius_{1}^2-\radius_{-1}^2}{2}$induces the decision boundary of $db\left(f_{\theta}\right)$ that is equivalent to a sphere of radius $R_{opt}$. Note that this is only one particular parameter constellation. In fact, there exist infinitely many $\theta$ that induce the same decision boundary. \end{proof} \subsection{Geometric characterization of the two layer quadratic neural network} \fy{this is again super poor language} A decision boundary that is ellipsoid uses primarily the signal (norm), else hyperboloid, using angular information (useless features). In experiments, we show that adversarial training learns networks with hyperboloids as decision boundary. In contrast, standard training leads to an ellipsoid. This explains why the ``phenomenon'' also appears for CS observed in experiments. In this section we describe how we can quantify and plot the ``hyperboloidity'' in learned classifiers with respect to $\eps_{\text{tr}}$ \fy{why not numsamp} \fy{this is A HUGE SECTION for just one plot of explanation ... } \paragraph{Decision boundary of a two layer quadratic network.} To ease the flow of the text, we introduce a lemma close to the computation made in \cite{gilmer18}, which brings the quadratic neural network to a classical known form, here. We provide the proof in Subsection\ref{subsec:proof_lemma}. \begin{lemma} \label{lem:quadratic_symm_matrix} For any 2-layer quadratic neural network with $p>d$, there exists a real symmetric matrix $A \in \mathbb{R}^{d \times d}$ such that \begin{equation} f_{\theta}(x) = x^{\top} A x + b, \end{equation} for any $x \in \mathbb{R}^{d}$. \end{lemma} Let $A, b$ be the characterization of a two-layer quadratic neural network as per Lemma \ref{lem:quadratic_symm_matrix}. Then, recalling the definition of a decision boundary ~\eqref{eq:decisionboundary} induced by $f_\theta$, we can define $A_{db}= -\frac{A}{b}$ such that \begin{equation} \label{db_quadrnetwork} db(f_\theta) = \{ x \in \mathbb{R}^{d} \mid x^{\top} A_{db} x = 1 \}, \end{equation} where we note that $A_{db}$ is a real symmetric matrix. \fy{another fact} \begin{fact} Let $\lambda^{\theta}$ be the vector with as entries all eigenvalues of $A_{db}$ induced by $f_{\theta}$. If $\lambda^{\theta}_{i} > 0$ for all $i \in [d]$, then $db(f_{\theta})$ is an ellipsoid, otherwise, $db(f_{\theta})$ is an hyperboloid. \end{fact} \fy{this should go to experimental section, here its theory still} See Figure \ref{fig:teaser_concentric_spheres} for a visualization of ellipsoids and hyperboloids \fy{this is actually already experimental}. \fy{future work would be to show that this is indeed what happens} \paragraph{The dissimilarity score.} \fy{please use a macro for this score ...} Since we cannot visualize the dec. boundaries in high dimensions, we can characterize how close the decision boundary is to the truth by calculating the ... \fy{what is this notation $1_{d}$ -> please use macro and fix} Observe that any robust optimal two-layer quadratic neural network has $\lambda^{\theta}_i = \lambda_{opt} = \frac{4}{(\radius_{-1}+\radius_{1})^2}$ for all $i \in [d]$. We define our dissimilarity score as follows \begin{equation} \text{dissim}(f_{\theta}) := \frac{1}{d}\norm{\lambda^{\theta}-1_{\{d\}}\lambda_{opt}}_2. \end{equation} We note the following properties of our dissimilarity score: \fy{what the hell is happening here, the $R$ don't have values here yet do they?} \begin{enumerate} \item $\text{Dissim}(f_{\theta})=0$ if and only if $f_{\theta}$ is a perfect robust classifier. \item If $f_{\theta}$ achieves perfect standard accuracy, then $\text{dissim}(f_{\theta})< \sqrt{\frac{1}{d}}(\lambda_{opt}-\frac{1}{\radius_{1}^2}) = 1.03 \cdot 10^{-3}$. \item Given we classify a training dataset correctly, if $\text{dissim}(f_{\theta}) > \sqrt{\frac{1}{d}}(\lambda_{opt}-\frac{1}{\radius_{1}^2})$, then $db(f_{\theta})$ is necessarily a hyperboloid. Moreover, the larger $\text{dissim}(f_{\theta})$, the more skewed the hyperboloid. \item If $\text{Dissim}(f_{\theta})$ is large, we have either a stretched out ellipsoid or a sharp hyperboloid. See Figure \ref{fig:teaser_concentric_spheres} for a visualisation of a 2D cut of a hyperboloid and an ellipsoid. \end{enumerate} Intuitively, the larger the dissimilarity score, the worse the robust accuracy of the classifier, because the classifier uses more angular information to interpolate the training points. \begin{figure}[!ht] \centering \includegraphics[width=0.5\linewidth]{plotsAistats/CS_teaser.png} \caption{2D cut along the first two dimensions of the concentric spheres example for $d=500$ to visualize the decision boundaries obtained via adversarial (left) and standard training (right) of a two-layer network with quadratic activations on training points not shown. The learned robust classifier has an hyperbolic decision boundary and uses angle information for classification, whereas the standard classifiers perfectly separates the classes. } \label{fig:teaser_concentric_spheres} \end{figure} \subsection{Experimental details on concentric spheres example} \label{sec:app_expcs} \fy{what did you do here before? how were these two sections? why figure 3b?} In this section, we further study the concentric spheres example experimentally and give experimental details on Figure \ref{fig:eps_cs}. More precisely, we observe that attack-model overfitting on the concentric spheres dataset is possible for multiple adversarial test perturbation budgets $\eps_{\text{te}}$. \paragraph{Experimental details to Figure \ref{fig:eps_cs}} We sample $5$ datasets of size $n =10^5$ samples with varying dimensions $\dim{} = 350, \Hquad 500$ and $750$ of the concentric spheres distribution with radii $\radius_{-1} = 1$ and $\radius_{1} = 1.3$. The results we plot in Figure \ref{fig:eps_cs} are the average robust accuracies over the $5$ datasets and the shaded areas the respective standard deviations. For optimization, we use Tensorflow \cite{tensorflow2015-whitepaper} and its Adam optimizer with a learning rate of $0.001$ and a batch size of $10$. We train for $100$ epochs or until all training points are correctly classified with a two-layer squared neural network of width $p = 1000$. We implement adversarial training by solving the inner maximization using \begin{equation} \label{eq:csATmaximization} x' = x-\eps_{\text{tr}}\frac{x}{\norm{x}_2}\text{sign}\left(x^T \partial_x f_{\theta}(x)\right). \end{equation} \subsection{Experimental results and discussion} In this subsection we show the experimental results and discuss their implications. In all experiments, we adversarially train a two-layer neural network with quadratic activations and width $1000$ on the concentric spheres dataset with $\radius_{-1}=1$ and $\radius_{1}=11$. We minimize the cross-entropy loss until convergence. More experimental details can be found in Section~\ref{sec:app_expcs}. \begin{figure}[!t] \vskip 0.2in \centering \begin{subfigure}[b]{0.33\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/cs_eps_standard_app.png} \caption{Standard accuracy} \label{fig:app_cs_dissim} \end{subfigure} \begin{subfigure}[b]{0.33\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/cs_eps_main.png} \caption{Robust accuracy} \label{fig:app_cs_repeat} \end{subfigure} \begin{subfigure}[b]{0.33\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/cs_dissim_app.png} \caption{Dissimilarity score} \label{fig:app_cs_dissim} \end{subfigure} \caption{Experiments with the 2-layer quadratic network on the concentric spheres dataset with different adversarial budgets (x-axis). We use an input dimension of $d = 500$. Note that the robust and standard accuracy monotonically decrease for increasing $\eps_{\text{tr}}$. Moreover, the dissimilarity score monotonically increases with increasing $\eps_{\text{tr}}$, meaning that the network converge to sharper hyperbolic solutions, and hence uses more angular information to classify the training points. See Subsection \ref{sec:app_expcs} for experimental details.} \label{fig:app_eps_cs} \end{figure} \paragraph{AT hurts robust generalization} \fy{show by Varying the perturbation set size $\eps_{\text{tr}}$} To understand the effect of increasing adversarial training budget from standard training $(\eps_{\text{tr}} = 0)$ to training with a large adversarial budget, we perform several experiments. We fix the dimension to be $d=500$, choose varying dataset sizes $n = 50, 100$ and $200$ and log the standard accuracy, robust accuracy ($\eps_{\text{te}} = 3$) and dissimilarity score. We plot the results In Figure \ref{fig:app_eps_cs}. Observe that similar to the linear case and the real-world experiments the robust accuracy decreases with increasing adversarial training budget $\eps_{\text{tr}}$. Moreover, the aggravating trend is more severe when $\frac{d}{n}$ is large. \paragraph{Explanation: AT makes DB more hyperboloid} To understand the change in decision boundaries, we look at the dissimilarity score. In Figure \ref{fig:app_cs_dissim}, we note that the dissimilarity score monotonically increases with increasing $\eps_{\text{tr}}$. In particular, we see that the dissimilarity score is strictly larger than $1.03 \cdot 10^{-3}$ for all $\frac{d}{n}$ when $\eps_{\text{tr}} > 2.5$. By property 3 of the dissimilarity score, listed in the subsection above, this means that for large $\eps_{\text{tr}}$, the decision boundary is an hyperboloid; the classifier uses angular information the interpolate the training dataset. Moreover, the larger the dissimilarity score the more sharp the hyperboloid. For visualization of a hyperbolic and ellipsoidal decision boundary, we refer to Figure \ref{fig:teaser_concentric_spheres}. Lastly, we also investigate the robustness score with varying $\eps_{\text{tr}}$. In Figure \ref{fig:cs_trade_off}, we plot the decomposition after adversarial training with increasing $\eps_{\text{tr}}$ and $n = 50$. Similar to the linear example, plotted in Figure \ref{fig:app_tradeoff_logreg}, we recognize an U-shape. Together with the increasing dissimilarity score, we can make the following arguments. For large $\eps_{\text{tr}}$, when the dissimilarity score is also large, we converge to networks with sharp hyperboloid decision boundaries. These are highly robust but have low standard accuracy. In contrast, when using standard training ($\eps_{\text{tr}} = 0$) we converge to decision boundaries close to the optimal robust one, which has high standard accuracy and robustness. In summary, first steering away from the optimal decision boundary (increasing $\eps_{\text{tr}}$) decreases standard accuracy and robust accuracy. Thereafter, when the decision boundary is a hyperboloid, increasing $\eps_{\text{tr}}$ causes to further decrease standard accuracy, but increase the robustness. The increase in robustness is the result of converging to a sharper hyperboloid decision boundary, which uses less the norm of the samples to classify them. \begin{figure}[!b] \vskip 0.2in \centering \begin{subfigure}[b]{0.49\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/cs_rob_acc_numsamp_half.png} \caption{Robust accuracy} \label{fig:numobs} \end{subfigure} \begin{subfigure}[b]{0.49\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/cs_trade_off_decomposition_app.png} \caption{Standard-robust accuracy trade-off} \label{fig:cs_trade_off} \end{subfigure} \caption{ We set $d = 500, \radius_{-1} = 1, \radius_{1} = 11$ and $\eps_{\text{te}} = 3$. (a) Adversarial training on the concentric spheres dataset with increasing sample size. We see that for low sample sizes, adversarial training hurts robust accuracy, but for high sample sizes, we recognize the known regime where it helps robust generalization. (b) Robust accuracy decomposition of adversarial training with increasing perturbation budget $\eps_{\text{tr}}$. For large $\eps_{\text{tr}}$, we note how the robust accuracy decreases, while the robustness increases. The decrease is hence a result of decreasing standard accuracy. See Subsection \ref{sec:app_expcs} for experimental details.} \label{fig:numobs_trade_off} \end{figure} \subsection{Proof of Lemma \ref{lem:quadratic_symm_matrix}} \label{subsec:proof_lemma} Let us start by recalling the two-layer squared neural network. A two-layer neural network is a function $f:\mathbb{R}^d\xrightarrow{}\mathbb{R}$, of the form \begin{equation*} f_{\theta}(x) = \left(x^T W_1\right)^2 W_2+b. \end{equation*} We rewrite this equation in a quadratic form: \begin{equation*} \begin{split} f(x) &= \left(\sum_{i=1}^d x_i W_{1,i}\right)^2 W_2 + b\\ &= \sum_{j=1}^p\left(\sum_{i=1}^d x_i W_{1,i}\right)^2_j W_{2,j} + b\\ &= \sum_{i,j = 1}^d a_{i,j}x_i x_j + b\\ &= x^T A x + b, \end{split} \end{equation*} where \begin{equation*} a_{i,j} = \begin{cases} \sum_{m=1}^p W_{1,i,m}^2 W_{2,m} & \text{if i = j},\\ \sum_{m=1}^p W_{1,i,m} W_{1,j,m} W_{2,m} & \text{if i $\neq$ j.} \end{cases} \end{equation*} Hence, the decision boundary of $f$ is a quadratic equation and any two-layer quadratic neural network can be written in the form $f(x) = x^T A x + b$. \subsection{Attack-model overfitting for multiple adversarial test budgets $\eps_{\text{te}}$} The choice of $\eps_{\text{te}} = 0.075$ is reasonable but somewhat arbitrary. Hence, we also conduct the same experiment with experimental details as in Section \ref{app_csexpdetails_main} with a different adversarial test perturbation budget $\eps_{\text{te}}=0.1$ and include standard accuracy ($\eps_{\text{te}}=0$). We plot the results of the experiments in Figure \ref{fig:n_d_exp_robust}. Again, we observe attack-model overfitting. \section{Bounds on the susceptibility score} \label{app:susc} In Theorem \ref{thm:linlinf}, we give non-asymptotic bounds on the robust and standard error of a linear classifier trained with adversarial logistic regression. Moreover, we use the robust error decomposition in susceptibility and standard error to gain intuition about how adversarial training may hurt robust generalization. In this section, we complete the result of Theorem \ref{thm:linlinf} by also deriving non-asymptotic bounds on the susceptibility score of the max $\ell_2$-margin classifier. Using the results in Appendix \ref{sec:app_theorylinear}, we can prove following Corollary \ref{cor:robustness}, which gives non asymptotic bounds on the susceptibility score. \begin{corollary} \label{cor:robustness} Assume $d-1>n$. For the $\eps_{\text{te}}$-susceptibility on test samples from $\mathbb{P}_{r}$ with $2 \eps_{\text{te}} < r$ and perturbation sets in Equation~\eqref{eq:linfmaxpert} and~\eqref{eq:l1maxpert} the following holds: For $\eps_{\text{tr}} < \frac{r}{2} - \tilde{\gamma}_{\max}$, with probability at least $1-2\text{e}^{-\frac{\alpha^2 (d-1)}{2}}$ for any $0<\alpha<1$, over the draw of a dataset $D$ with $n$ samples from $\mathbb{P}_{r}$, the $\eps_{\text{te}}$-susceptibility is upper and lower bounded by \begin{equation} \begin{split} &\suscept{\thetahat{\epstrain}} \leq \Phi \left(\frac{(r-2 \eps_{\text{tr}}) (\eps_{\text{te}} - \frac{r}{2})}{2 \tilde{\gamma}_{\max} \sigma}\right) - \Phi \left( \frac{(r-2 \eps_{\text{tr}})( -\eps_{\text{te}} - \frac{r}{2})}{2 \tilde{\gamma}_{\min}\sigma} \right)\\ &\suscept{\thetahat{\epstrain}} \geq \Phi \left(\frac{(r-2 \eps_{\text{tr}}) (\eps_{\text{te}} - \frac{r}{2})}{2 \tilde{\gamma}_{\min}\sigma}\right) - \Phi \left( \frac{(r-2 \eps_{\text{tr}})( -\eps_{\text{te}} - \frac{r}{2})}{2 \tilde{\gamma}_{\max} \sigma} \right) \end{split} \end{equation} \end{corollary} We give the proof in Subsection \ref{sec:proof_robust_cor}. Observe that the bounds on the susceptibility score in Corollary \ref{cor:robustness} consist of two terms each, where the second term decreases with $\eps_{\text{tr}}$, but the first term increases. We recognise following two regimes: the max $\ell_2$-margin classifier is close to the ground truth $e_1$ or not. Clearly, the ground truth classifier has zero susceptibility and hence classifiers close to the ground truth also have low susceptibility. On the other hand, if the max $l_2$-margin classifier is not close to the ground truth, then putting less weight on the first coordinate increases invariance to the perturbations along the first direction. Recall that by Lemma \ref{lem:maxmargin}, increasing $\eps_{\text{tr}}$, decreases the weight on the first coordinate of the max $\ell_2$-margin classifier. Furthermore, in the low sample size regime, we are likely not close to the ground truth. Therefore, the regime where the susceptibility decreases with increasing $\eps_{\text{tr}}$ dominates in the low sample size regime. To confirm the result of Corollary \ref{cor:robustness}, we plot the mean and standard deviation of the susceptibility score of $5$ independent experiments. The results are depicted in Figure \ref{fig:logreg_robust}. We see that for low standard error, when the classifier is reasonably close to the optimal classifier, the susceptibility increases slightly with increasing adversarial budget. However, increasing the adversarial training budget, $\eps_{\text{tr}}$, further, causes the susceptibility score to drop greatly. Hence, we can recognize both regimes and validate that, indeed, the second regime dominates in the low sample size setting. \begin{figure*}[!b] \centering \begin{subfigure}[b]{0.4\textwidth} \centering \includegraphics[width=0.99\linewidth]{plotsAistats/app_susceptibilty.png} \caption{Susceptibility score decreases with $\eps_{\text{tr}}$} \label{fig:app_robustness} \end{subfigure} \begin{subfigure}[b]{0.4\textwidth} \centering \includegraphics[width=0.99\linewidth]{plotsAistats/logreg_trade_off_plot.png} \caption{Robust error decomposition} \label{fig:app_tradeoff_logreg} \end{subfigure} \caption{We set $r = 6$, $d = 1000$, $n = 50$ and $\eps_{\text{te}} = 2.5$. (a) We plot the average susceptibility score and the standard deviation over 5 independent experiments. Note how the bounds closely predict the susceptibility score. (b) For comparison, we also plot the robust error decomposition in susceptibility and standard error. Even though the susceptibility decreases, the robust error increases with increasing adversarial budget $\eps_{\text{tr}}$.} \vspace{-0.2in} \label{fig:logreg_robust} \end{figure*} \subsection{Proof of Corollary \ref{cor:robustness}} \label{sec:proof_robust_cor} We proof the statement by bounding the robustness of a linear classifier. Recall that the robustness of a classifier is the probability that a classifier does not change its prediction under an adversarial attack. The susceptibility score is then given by \begin{equation} \label{eq:rob_sus} \suscept{\thetahat{\epstrain}} = 1 - \robness{\thetahat{\epstrain}}. \end{equation} The proof idea is as follows: since the perturbations are along the first basis direction, $e_1$, we compute the distance from the robust $l_2$-max margin $\thetahat{\epstrain}$ to a point $(X,Y) \sim \mathbb{P}$. Then, we note that the robustness of $\thetahat{\epstrain}$ is given by the probability that the distance along $e_1$, from $X$ to the decision plane induced by $\thetahat{\epstrain}$ is greater then $\eps_{\text{te}}$. Lastly, we use the non-asymptotic bounds of Lemma \ref{lem:boundsmaxmargin}. Recall, by Lemma \ref{lem:maxmargin}, the max $l_2$-margin classifier is of the form of \begin{equation} \label{eq:robustmaxmarg} \thetahat{\epstrain} = \frac{1}{\sqrt{(r-2 \eps_{\text{tr}})^2 + 4 \tilde{\gamma}^{2}}}\left[r-2\eps_{\text{tr}}, 2 \tilde{\gamma} \tilde{\theta} \right]. \end{equation} Let $(X, Y) \sim \mathbb{P}$. The distance along $e_1$ from $X$ to the decision plane induced by $\thetahat{\epstrain}$, $\decplanegen{\thetahat{\epstrain} }$, is given by \begin{equation*} d_{e_1}(X, \decplanegen{\thetahat{\epstrain}}) = \left| \indof{X}{1}+ \frac{1}{ \indof{\thetahat{\epstrain}}{0}} \sum_{i=2}^{ d } \indof{\thetahat{\epstrain}}{i} \indof{X}{i} \right|. \end{equation*} Substituting the expression of $\thetahat{\epstrain}$ in Equation \ref{eq:robustmaxmarg} yields \begin{equation*} d_{e_1}(X, \decplanegen{\thetahat{\epstrain}}) = \left| \indof{X}{1} + 2 \tilde{\gamma} \frac{1}{(r-\eps_{\text{tr}})} \sum_{i=2}^{d} \indof{\tilde{\theta}}{i} \indof{X}{i} \right|. \end{equation*} Let $N$ be a standard normal distributed random variable. By definition $\| \tilde{\theta}\|_2^2 = 1$ and using that a sum of Gaussian random variables is again a Gaussian random variable, we can write \begin{equation*} d_{e_1}(X,\decplanegen{\thetahat{\epstrain}}) = \left| \indof{X}{1} + 2 \tilde{\gamma} \frac{\sigma}{(r-\eps_{\text{tr}})} N \right|. \end{equation*} The robustness of $\thetahat{\epstrain}$ is given by the probability that $d_{e_1}(X,\decplanegen{\thetahat{\epstrain}}) > \eps_{\text{te}}$. Hence, using that $X_1 = \pm \frac{r}{2}$ with probability $\frac{1}{2}$, we get \begin{equation} \label{eq:robustness_form} \robness{\thetahat{\epstrain}} = P\left[ \frac{r}{2} + 2 \tilde{\gamma} \frac{\sigma}{(r-2\eps_{\text{tr}})} N > \eps_{\text{te}} \right] + P \left[ \frac{r}{2} + 2 \tilde{\gamma} \frac{\sigma}{(r-\eps_{\text{tr}})} N < -\eps_{\text{te}} \right]. \end{equation} We can rewrite Equation \ref{eq:robustness_form} in the form \begin{equation*} \robness{\thetahat{\epstrain}} = P \left[ N > \frac{(r-2\eps_{\text{tr}}) (\eps_{\text{te}} - \frac{r}{2})}{2 \tilde{\gamma}\sigma} \right] + P \left[ N < \frac{(r-2\eps_{\text{tr}})( -\eps_{\text{te}} -\frac{ r}{2})}{2 \tilde{\gamma}\sigma} \right]. \end{equation*} Recall, that $N$ is a standard normal distributed random variable and denote by $\Phi$ the cumulative standard normal density. By definition of the cumulative denisity function, we find that \begin{equation*} \robness{\thetahat{\epstrain}} = 1 - \Phi \left(\frac{(r-2\eps_{\text{tr}}) (\eps_{\text{te}} - \frac{r}{2})}{2 \tilde{\gamma}\sigma}\right) + \Phi \left( \frac{(r-2 \eps_{\text{tr}})( -\eps_{\text{te}} - \frac{r}{2})}{2 \tilde{\gamma}\sigma} \right). \end{equation*} Substituting the bounds on $\tilde{\gamma}$ of Lemma \ref{lem:boundsmaxmargin} gives us the non-asymptotic bounds on the robustness score and by Equation \ref{eq:rob_sus} also on the susceptibility score. \section{Experimental details on the linear model} \label{sec:logregapp} In this section, we provide detailed experimental details to Figures \ref{fig:main_theorem} and \ref{fig:lineartradeoff}. We implement adversarial logistic regression using stochastic gradient descent with a learning rate of $0.01$. Note that logistic regression converges logarithmically to the robust max $l_2$-margin solution. As a consequence of the slow convergence, we train for up to $10^7$ epochs. Both during training and test time we solve $\max_{x_i' \in \pertset{x_i}{\eps_{\text{tr}}}} L(f_\theta(x_i') y_i)$ exactly. Hence, we exactly measure the robust error. Unless specified otherwise, we set $\sigma= 1$, $r = 12$ and $\eps_{\text{te}} = 4$. \paragraph{Experimental details on Figure \ref{fig:main_theorem}} (a) We draw $5$ datasets with $n= 50$ samples and input dimension $d=1000$ from the distribution $\mathbb{P}$. We then run adversarial logistic regression on all $5$ datasets with adversarial training budgets, $\eps_{\text{tr}} = 1$ to $5$. To compute the resulting robust error gap of all the obtained classifiers, we use a test set of size $10^{6}$. Lastly, we compute the lower bound given in part 2. of Theorem \ref{thm:linlinf}. (b) We draw $5$ datasets with different sizes $n$ between $50$ and $10^4$. We take an input dimension of $d = 10^4$ and plot the mean and standard deviation of the robust error after adversarial and standard logistic regression over the $5$ samples.(c) We again draw $5$ datasets for each $d/n$ constellation and compute the robust error gap for each dataset. \paragraph{Experimental details on Figure \ref{fig:lineartradeoff}} For both (a) and (b) we set $d = 1000$, $\eps_{\text{te}} = 4$, and vary the adversarial training budget ($\eps_{\text{tr}}$) from $1$ to $5$. For every constellation of $n$ and $\eps_{\text{tr}}$, we draw $10$ datasets and show the average and standard deviation of the resulting robust errors. In (b), we set $n = 50$. \section{Theoretical statements for the linear model} \label{sec:app_theorylinear} Before we present the proof of the theorem, we introduce two lemmas are of separate interest that are used throughout the proof of Theorem 1. Recall that the definition of the (standard normalized) maximum-$\ell_2$-margin solution (max-margin solution in short) of a dataset $D =\{(x_i, y_i)\}_{i=1}^n$ corresponds to \begin{equation} \label{eq:stdmaxmargin} \thetahat{} := \argmax_{\|\theta\|_2\leq 1} \min_{i\in [n]} y_i \theta^\top x_i, \end{equation} by simply setting $\eps_{\text{tr}} = 0$ in Equation~\eqref{eq:maxmargin}. The $\ell_2$-margin of $\thetahat{}$ then reads $\min_{i\in[n]} y_i \thetahat{\top} x_i$. Furthermore for a dataset $D = \{(x_i, y_i)\}_{i=1}^n$ we refer to the induced dataset $\widetilde{D}$ as the dataset with covariate vectors stripped of the first element, i.e. \begin{equation} \widetilde{D} = \{(\tilde{x}_i, y_i)\}_{i=1}^n := \{ ((x_i)_{[2:d]}, y_i) \}_{i=1}^n, \end{equation} where $(x_i)_{[2:d]}$ refers to the last $d-1$ elements of the vector $x_i$. Furthermore, remember that for any vector $z$, $\indof{z}{j}$ refers to the $j$-th element of $z$ and $e_j$ denotes the $j$-th canonical basis vector. Further, recall the distribution $\mathbb{P}_r$ as defined in Section~\ref{logreg_linear_model}: the label $y \in \{+1, -1\}$ is drawn with equal probability and the covariate vector is sampled as $x = [y\frac{r}{2}, \tilde{x}]$ where $\tilde{x} \in \mathbb{R}^{d-1}$ is a random vector drawn from a standard normal distribution, i.e. $\tilde{x} \sim \mathcal{N}(0, \sigma^2 I_{d-1})$. We generally allow $r$, used to sample the training data, to differ from $r_{\text{test}}$, which is used during test time. The following lemma derives a closed-form expression for the normalized max-margin solution for any dataset with fixed separation $r$ in the signal component, and that is linearly separable in the last $d-1$ coordinates with margin $\tilde{\gamma}$. \begin{lemma} \label{lem:maxmargin} Let $D = \{(x_i,y_i)\}_{i=1}^{n}$ be a dataset that consists of points $(x,y) \in \mathbb{R}^{d}\times\{\pm 1\}$ and $\xind{1} = y\frac{r}{2}$, i.e. the covariates $x_i$ are deterministic in their first coordinate given $y_i$ with separation distance $r$. Furthermore, let the induced dataset $\widetilde{D}$ also be linearly separable by the normalized max-$\ell_2$-margin solution $\tilde{\theta}$ with an $\ell_2$-margin $\tilde{\gamma}$. Then, the normalized max-margin solution of the original dataset $D$ is given by \begin{equation} \label{eq:lemmaxmargin} \thetahat{} = \frac{1}{\sqrt{r^2 + 4 \tilde{\gamma}^{2}}}\left[r, 2 \tilde{\gamma} \tilde{\theta} \right]. \end{equation} Further, the standard accuracy of $\thetahat{}$ for data drawn from $\mathbb{P}_{r_{\text{test}}}$ reads \begin{equation} \label{eq:stdaccmaxmargin} \mathbb{P}_{r_{\text{test}}}(Y \thetahat{\top} X > 0) = \Phi\left( \frac{r \:r_{\text{test}} }{4\sigma\: \tilde{\gamma}} \right). \end{equation} \end{lemma} The proof can be found in Section~\ref{sec:maxmarginproof}. The next lemma provides high probability upper and lower bounds for the margin $\tilde{\gamma}$ of $\widetilde{D}$ when $\tilde{x}_i$ are drawn from the normal distribution. \begin{lemma} \label{lem:boundsmaxmargin} Let $\widetilde{D}=\{(\Tilde{x}_i,y_i)\}_{i=1}^{n}$ be a random dataset where $y_i \in \{\pm 1\}$ are equally distributed and $\tilde{x}_i \sim \mathcal{N}(0,\sigma I_{d-1})$ for all $i$, and $\tilde{\gamma}$ is the maximum $\ell_2$ margin that can be written as \begin{equation*} \tilde{\gamma}= \max_{\|\tilde{\theta}\|_2 \leq 1} \min_{i \in [n]} y_i \tilde{\theta}^{\top} \Tilde{x}_i . \end{equation*} Then, for any $t \geq 0$, with probability greater than $1-2e^{-\frac{t^2}{2}}$, we have $\tilde{\gamma}_{\min}(t) \leq \tilde{\gamma} \leq \tilde{\gamma}_{\max}(t)$ where \begin{align*} \label{Crude_bounds_subsequent_maxmar} &\tilde{\gamma}_{\max}(t) = \sigma \left( \sqrt{\frac{d-1}{n}} + 1 + \frac{t}{\sqrt{n}}\right), \:\: \tilde{\gamma}_{\min}(t)= \sigma \left( \sqrt{\frac{d-1}{n}} -1 - \frac{t}{\sqrt{n}}\right). \end{align*} \end{lemma} \subsection{Proof of Theorem~\ref{thm:linlinf}} \label{sec:thmproof} Given a dataset $D = \{(x_i, y_i)\}$ drawn from $\mathbb{P}_r$, it is easy to see that the (normalized) $\eps_{\text{tr}}$-robust max-margin solution~\eqref{eq:maxmargin} of $D$ with respect to signal-attacking perturbations $\pertset{\eps_{\text{tr}}}{x_i}$ as defined in Equation~\eqref{eq:linfmaxpert}, can be written as \begin{equation} \begin{aligned} \label{eq:robmaxmargin} \thetahat{\eps_{\text{tr}}} &= \argmax_{\|\theta\|_2\leq 1} \min_{i\in [n], x_i' \in \pertset{x_i}{\eps_{\text{tr}}}} y_i \theta^\top x'_i \\ &= \argmax_{\|\theta\|_2\leq 1}\min_{i\in [n],|\beta|\leq \eps_{\text{tr}}}y_i \theta^\top (x_i + \beta e_1) \nonumber\\ &= \argmax_{\|\theta\|_2\leq 1} \min_{i\in [n]} y_i \theta^\top (x_i - y_i \eps_{\text{tr}} \sign(\thetaind{1}) e_1). \nonumber \end{aligned} \end{equation} Note that by definition, it is equivalent to the (standard normalized) max-margin solution $\thetahat{}$ of the shifted dataset ${D_{\epstrain} = \{(x_i - y_i \eps_{\text{tr}} \sign(\thetaind{1}) e_1, y_i)\}_{i=1}^n}$. Since $D_{\epstrain}$ satisfies the assumptions of Lemma~\ref{lem:maxmargin}, it then follows directly that the normalized $\eps_{\text{tr}}$-robust max-margin solution reads \begin{equation} \label{eq:appmaxmargin} \thetahat{\eps_{\text{tr}}} = \frac{1}{\sqrt{(r -2\eps_{\text{tr}})^2 + 4 \tilde{\gamma}^{2}}}\left[r-2\eps_{\text{tr}}, 2 \tilde{\gamma} \tilde{\theta} \right], \end{equation} by replacing $r$ by $r - 2\eps_{\text{tr}}$ in Equation~\eqref{eq:lemmaxmargin}. Similar to above, $\tilde{\theta} \in R^{d-1}$ is the (standard normalized) max-margin solution of $\{(\tilde{x}_i, y_i)\}_{i=1}^n$ and $\tilde{\gamma}$ the corresponding margin. \paragraph{Proof of 1.} We can now compute the $\eps_{\text{te}}$-robust accuracy of the $\eps_{\text{tr}}$-robust max-margin estimator $\thetahat{\eps_{\text{tr}}}$ for a given dataset $D$ as a function of $\tilde{\gamma}$. Note that in the expression of $\thetahat{\eps_{\text{tr}}}$, all values are fixed for a fixed dataset, while $0\leq \eps_{\text{tr}}\leq r-2\tilde{\gamma}_{\max}$ can be chosen. First note that for a test distribution $\mathbb{P}_r$, the $\eps_{\text{te}}$-robust accuracy, defined as one minus the robust error (Equation~\eqref{eq:roberr}), for a classifier associated with a vector $\theta$, can be written as \begin{align} \label{eq:robacc_closed} \robacc{\theta} &= \mathbb{E}_{X,Y\sim \mathbb{P}_r} \left[\Indi{\min_{x' \in \pertset{X}{\eps_{\text{te}}}} Y \theta^\top x'>0}\right] \\ &= \mathbb{E}_{X,Y\sim \mathbb{P}_{r}} \left[ \Indi{ Y \theta^\top X - \eps_{\text{te}} \thetaind{1} >0}\right] = \mathbb{E}_{X,Y\sim \mathbb{P}_{r}} \left[\Indi{ Y \theta^\top (X - Y\eps_{\text{te}} \sign(\thetaind{1}) e_1) >0}\right] \nonumber \end{align} Now, recall that by Equation~\eqref{eq:appmaxmargin} and the assumption in the theorem, we have $r-2\eps_{\text{tr}}>0$, so that $\sign(\thetahat{\eps_{\text{tr}}})=1$. Further, using the definition of the $\pertset{\eps_{\text{tr}}}{x}$ in Equation~\eqref{eq:linfmaxpert} and by definition of the distribution $\mathbb{P}_r$, we have $\indof{X}{1} = Y \frac{r}{2}$. Plugging into Equation~\eqref{eq:robacc_closed} then yields \begin{align*} \robacc{\thetahat{\eps_{\text{tr}}}}&= \mathbb{E}_{X,Y\sim \mathbb{P}_{r}} \left[\Indi{ Y \thetahat{\eps_{\text{tr}} \top} (X - Y\eps_{\text{te}} e_1) >0}\right] \\ &= \mathbb{E}_{X,Y\sim \mathbb{P}_{r}}\left[\Indi{ Y \thetahat{\eps_{\text{tr}} \top} (X_{-1} + Y\left(\frac{r}{2} - \eps_{\text{te}}\right) e_1) >0}\right] \\ &= \mathbb{P}_{r- 2 \eps_{\text{te}}} (Y\thetahat{\eps_{\text{tr}} \top} X >0 ) \end{align*} where $X_{-1}$ is a shorthand for the random vector $X_{-1} = (0; \indof{X}{2}, \dots, \indof{X}{d})$. The assumptions in Lemma~\ref{lem:maxmargin} ($D_{\epstrain}$ is linearly separable) are satisfied whenever the $n<d-1$ samples are distinct, i.e. with probability one. Hence applying Lemma~\ref{lem:maxmargin} with $r_{\text{test}} = r - 2\eps_{\text{te}}$ and $r = r - 2\eps_{\text{tr}}$ yields \begin{equation} \label{eq:arsenal} \robacc{\thetahat{\eps_{\text{tr}}}} = \Phi\left(\frac{r(r-2\eps_{\text{te}})}{4\sigma \tilde{\gamma}} - \eps_{\text{tr}} \frac{r-2\eps_{\text{te}}}{2\sigma \tilde{\gamma}}\right). \end{equation} Theorem statement a) then follows by noting that $\Phi$ is a monotically decreasing function in $\eps_{\text{tr}}$. The expression for the robust error then follows by noting that $1-\Phi(-z) = \Phi(z)$ for any $z \in \mathbb{R}$ and defining \begin{equation} \label{eq:varphidef} \tilde{\varphi} = \frac{\sigma \tilde{\gamma}}{r/2 - \eps_{\text{te}}}. \end{equation} \paragraph{Proof of 2.} First define $\varphi_{\text{min}}, \varphi_{\text{max}}$ using $\tilde{\gamma}_{\min}, \tilde{\gamma}_{\max}$ as in Equation~\eqref{eq:varphidef}. Then we have by Equation~\eqref{eq:arsenal} \begin{align*} \roberr{\thetahat{\eps_{\text{tr}}}} - \roberr{\thetahat{0}} &= \robacc{\thetahat{0}} - \robacc{\thetahat{\eps_{\text{tr}}}}\\ &= \Phi\left(\frac{r/2}{\tilde{\varphi}}\right) - \Phi\left(\frac{r/2 - \eps_{\text{tr}}}{\tilde{\varphi}}\right)\\ &= \int_{r/2-\eps_{\text{tr}}}^{r/2} \frac{1}{\sqrt{2\pi}\tilde{\varphi}} \text{e}^{- \frac{x^2 }{\tilde{\varphi}^2}} d x \end{align*} By plugging in $t = \sqrt{\frac{2 \log 2/\delta}{n}}$ in Lemma~\ref{lem:boundsmaxmargin}, we obtain that with probability at least $1-\delta$ we have \begin{equation*} \tilde{\gamma}_{\min} := \sigma \left[\sqrt{\frac{d-1}{n}} - \left(1+\sqrt{\frac{2 \log (2/\delta)}{n}}\right)\right] \leq \tilde{\gamma} \leq \sigma \left[\sqrt{\frac{d-1}{n}} + \left(1+\sqrt{\frac{2 \log (2/\delta)}{n}}\right)\right] =: \tilde{\gamma}_{\max} \end{equation*} and equivalently $\varphi_{\text{min}} \leq \tilde{\varphi} \leq \varphi_{\text{max}}$. Now note the general fact that for all $\tilde{\varphi} \leq \sqrt{2} x$ the density function $f(\tilde{\varphi}; x) = \frac{1}{\sqrt{2\pi}\tilde{\varphi}} \text{e}^{- \frac{x^2 }{\tilde{\varphi}^2}} $ is monotonically increasing in $\tilde{\varphi}$. By assumption of the theorem, $\tilde{\varphi} \leq \sqrt{2} (r/2-\eps_{\text{tr}})(r/2-\eps_{\text{te}})$ so that $f(\tilde{\varphi}; x) \geq f(\varphi_{\text{min}};x)$ for all $x\in [r/2-\eps_{\text{tr}},r/2]$ and therefore \begin{equation*} \int_{r/2-\eps_{\text{tr}}}^{r/2} \frac{1}{\sqrt{2\pi}\tilde{\varphi}} \text{e}^{- \frac{x^2 }{\tilde{\varphi}^2}} d x \geq \int_{r/2-\eps_{\text{tr}}}^{r/2} \frac{1}{\sqrt{2\pi}\varphi_{\text{min}}} \text{e}^{- \frac{x^2 }{\tilde{\varphi}^2}} d x = \Phi\left(\frac{r/2}{\varphi_{\text{min}}}\right) - \Phi\left(\frac{r/2-\eps_{\text{tr}}}{\varphi_{\text{min}}}\right). \end{equation*} and the statement is proved. \subsection{Proof of Corollary~\ref{cor:l1extension}} We now show that Theorem~\ref{thm:linlinf} also holds for $\ell_1$-ball perturbations with at most radius $\epsilon$. Following similar steps as in Equation~\eqref{eq:appmaxmargin}, the $\eps_{\text{tr}}$-robust max-margin solution for $\ell_1$-perturbations can be written as \begin{equation} \label{eq:maxmarginl1} \thetahat{\eps_{\text{tr}}} := \argmax_{\|\theta\|_2 \leq 1}\min_{i\in [n]} y_i \theta^\top (x_i - y_i \eps_{\text{tr}} \sign(\indof{\theta}{j^\star(\theta)}) e_{j^\star(\theta)}) \end{equation} where $j^\star(\theta) := \argmax_j |\theta_j|$ is the index of the maximum absolute value of $\theta$. We now prove by contradiction that the robust max-margin solution for this perturbation set~\eqref{eq:l1maxpert} is equivalent to the solution~\eqref{eq:appmaxmargin} for the perturbation set~\eqref{eq:linfmaxpert}. We start by assuming that $\thetahat{\epstrain}$ does not solve Equation~\eqref{eq:appmaxmargin}, which is equivalent to assuming $1\not \in j^\star(\thetahat{\epstrain})$ by definition. We now show how this assumption leads to a contradiction. Define the shorthand $\maxind := j^\star(\thetahat{\epstrain}) -1$. Since $\thetahat{\epstrain}$ is the solution of~\eqref{eq:maxmarginl1}, by definition, we have that $\thetahat{\epstrain}$ is also the max-margin solution of the shifted dataset $D_{\epstrain} :=(x_i - y_i \eps_{\text{tr}} \sign(\thetaind{\maxind+1}) e_{\maxind+1}, y_i)$. Further, note that by the assumption that $1 \not \in j^\star(\thetahat{\epstrain})$, this dataset $D_{\epstrain}$ consists of input vectors $x_i = (y_i \frac{r}{2}, \tilde{x}_i - y_i \eps_{\text{tr}} \sign(\thetaind{\maxind+1}) e_{\maxind+1} )$. Hence via Lemma~\ref{lem:maxmargin}, $\thetahat{\epstrain}$ can be written as \begin{equation} \label{eq:sml} \thetahat{\epstrain} = \frac{1}{\sqrt{r^2 - 4 (\tilde{\gamma}^{\eps_{\text{tr}}})^2}} [r, 2 \tilde{\gamma}^{\eps_{\text{tr}}} \tilde{\theta}^{\eps_{\text{tr}}}], \end{equation} where $\tilde{\theta}^{\eps_{\text{tr}}}$ is the normalized max-margin solution of $\widetilde{D} := (\tilde{x}_i - y_i \eps_{\text{tr}} \sign(\indof{\tilde{\theta}}{\maxind}) e_{\maxind}, y_i)$. We now characterize $\tilde{\theta}^{\eps_{\text{tr}}}$. Note that by assumption, $\maxind = j^\star(\tilde{\theta}^{\eps_{\text{tr}}}) = \argmax_j |\indof{\tilde{\theta}^{\eps_{\text{tr}}}}{j}|$. Hence, the normalized max-margin solution $\tilde{\theta}^{\eps_{\text{tr}}}$ is the solution of \begin{equation} \label{eq:maxmarginsmall} \tilde{\theta}^{\eps_{\text{tr}}} := \argmax_{\|\tilde{\theta}\|_2 \leq 1} \min_{i\in [n]} y_i \tilde{\theta}^\top \tilde{x}_i - \eps_{\text{tr}} |\indof{\tilde{\theta}}{\maxind}| \end{equation} Observe that the minimum margin of this estimator $\tilde{\gamma}^{\eps_{\text{tr}}}=\min_{i\in [n]} y_i (\tilde{\theta}^{\eps_{\text{tr}}})^\top \tilde{x}_i - \eps_{\text{tr}} |\indof{\tilde{\theta}^{\eps_{\text{tr}}}}{\maxind}|$ decreases with $\eps_{\text{tr}}$ as the problem becomes harder $\tilde{\gamma}^{\eps_{\text{tr}}} \leq \tilde{\gamma}$, where the latter is equivalent to the margin of $\tilde{\theta}^{\eps_{\text{tr}}}$ for $\eps_{\text{tr}} = 0$. Since $r > 2\tilde{\gamma}_{\max}$ by assumption in the Theorem, by Lemma~\ref{lem:boundsmaxmargin} with probability at least $1-2\text{e}^{-\frac{\alpha^2 (d-1)}{n}}$, we then have that $r> 2\tilde{\gamma} \geq 2\tilde{\gamma}^{\eps_{\text{tr}}}$. Given the closed form of $\thetahat{\epstrain}$ in Equation~\eqref{eq:sml}, it directly follows that $\indof{\thetahat{\epstrain}}{1} = r > 2\tilde{\gamma}^{\eps_{\text{tr}}} \|\tilde{\theta}^{\eps_{\text{tr}}}\|_2 = \|\indof{\thetahat{\epstrain}}{2:d}\|_2$ and hence $1\in j^\star(\thetahat{\epstrain})$. This contradicts the original assumption $1\not \in j^\star(\thetahat{\epstrain})$ and hence we established that $\thetahat{\eps_{\text{tr}}}$ for the $\ell_1$-perturbation set~\eqref{eq:l1maxpert} has the same closed form~\eqref{eq:robmaxmargin} as for the perturbation set~\eqref{eq:linfmaxpert}. The final statement is proved by using the analogous steps as in the proof of 1. and 2. to obtain the closed form of the robust accuracy of $\thetahat{\eps_{\text{tr}}}$. \subsection{Proof of Lemma~\ref{lem:maxmargin}} \label{sec:maxmarginproof} We start by proving that $\thetahat{}$ is of the form \begin{equation} \label{Eq:max_margin_param_form_total_D} \thetahat{} = \left[a_1, a_2 \tilde{\theta} \right], \end{equation} for $a_1, a_2 > 0$. Denote by $\decplanegen{\theta}$ the plane through the origin with normal $\theta$. We define $d\left((x,y), \decplanegen{\theta} \right)$ as the signed euclidean distance from the point $(x,y) \in D \sim \mathbb{P}_{r}$ to the plane $\decplanegen{\theta}$. The signed euclidean distance is the defined as the euclidean distance from x to the plane if the point $(x,y)$ is correctly predicted by $\theta$, and the negative euclidean distance from $x$ to the plane otherwise. We rewrite the definition of the max $l_2$-margin classifier. It is the classifier induced by the normalized vector $\thetahat{}$, such that \begin{equation*} \max_{\theta \in \mathbb{R}^{d}} \min_{(x,y) \in D}d\left( \left(x,y\right),\decplanegen{\theta}\right) = \min_{(x,y) \in D} d\left( \left(x,y \right),\decplanegen{\thetahat }\right). \end{equation*} We use that $D$ is deterministic in its first coordinate and get \begin{equation*} \begin{split} \max_{\theta}\min_{(x,y) \in D}d\left(\left(x,y\right), \decplanegen{\theta} \right) &= \max_{\theta}\min_{(x,y) \in D} y (\thetaind{1} \xind{1} + \tilde{\theta}^{\top} \tilde{x})\\ &= \max_{\theta} \theta_1 \frac{r}{2} + \min_{(x,y) \in D} y \tilde{\theta}^{\top} \Tilde{x}. \end{split} \end{equation*} Because $r >0$, the maximum over all $\theta$ has $\thetahatind{}{1} \geq 0$. Take any $a > 0$ such that $\|\tilde{\theta}\|_2 = a$. By definition the max $l_2$-margin classifier, $\tilde{\theta}$, maximizes $\min_{(x,y) \in D} d\left(\left(x,y\right), \decplanegen{\theta} \right)$. Therefore, $\thetahat{}$ is of the form of Equation \eqref{Eq:max_margin_param_form_total_D}. Note that all classifiers induced by vectors of the form of Equation \eqref{Eq:max_margin_param_form_total_D} classify $D$ correctly. Next, we aim to find expressions for $a_1$ and $a_2$ such that Equation \eqref{Eq:max_margin_param_form_total_D} is the normalized max $l_2$-margin classifier. The distance from any $x \in D$ to $\decplanegen{\thetahat{}}$ is \begin{equation*} d\left(x,\decplanegen{\thetahat{}} \right) = \left| a_1 \xind{1} + a_2 \tilde{\theta}^{\top} \tilde{x} \right|. \end{equation*} Using that $\xind{1} = y \frac{r}{2}$ and that the second term equals $a_2 d\left(x, \decplanegen{\tilde{\theta}}\right)$, we get \begin{equation} \label{eq:distance_to_opt_intermidate} d\left(x, \decplanegen{\thetahat{}}\right) = \left| a_1 \frac{r}{2} + a_2 d\left(x, \decplanegen{\tilde{\theta}}\right) \right| = a_1 \frac{r}{2} + \sqrt{1-a_1^2} d\left(x, \decplanegen{\tilde{\theta}}\right). \end{equation} Let $(\tilde{x},y) \in \widetilde{D}$ be the point closest in Euclidean distance to $\tilde{\theta}$. This point is also the closest point in Euclidean distance to $\decplanegen{\thetahat{}}$, because by Equation \eqref{eq:distance_to_opt_intermidate} $d\left(x, \decplanegen{\thetahat{}}\right)$ is strictly decreasing for decreasing $d\left(x, \decplanegen{\tilde{\theta}}\right)$. We maximize the minimum margin $d\left(x, \decplanegen{\thetahat{}} \right)$ with respect to $a_1$. Define the vectors $a = \left[a_1, a_2\right]$ and $v = \left[\frac{r}{2}, d\left(x, \decplanegen{\tilde{\theta}}\right)\right]$. We find using the dual norm that \begin{equation*} a = \frac{v}{\|v\|_2}. \end{equation*} Plugging the expression of $a$ into Equation \eqref{Eq:max_margin_param_form_total_D} yields that $\thetahat{}$ is given by \begin{equation*} \thetahat{} = \frac{1}{\sqrt{r^2 + 4 \tilde{\gamma}^2}}\left[r, 2 \tilde{\gamma}\tilde{\theta} \right]. \end{equation*} For the second part of the lemma we first decompose \begin{equation} \label{eq:jacob} \mathbb{P}_{r_{\text{test}}} (Y\thetahat{\top} X >0 ) = \frac{1}{2}\mathbb{P}_{r_{\text{test}}} \left[ \thetahat{\top} X >0 \mid Y=1 \right] +\frac{1}{2}\mathbb{P}_{r_{\text{test}}} \left[\thetahat{\top} X <0 \mid Y=-1\right]\nonumber \end{equation} We can further write \begin{align} \label{eq:cumul1} \mathbb{P}_{r_{\text{test}}} \left[\thetahat{\top} X > 0 \mid Y = 1\right] &=\mathbb{P}_{r_{\text{test}}} \left[\sum_{i=2}^{d}\indof{\thetahat{}}{i} \indof{X}{i} > - \indof{\thetahat{}}{1} \: \indof{X}{1} \mid Y=1\right]\\ &= \mathbb{P}_{r_{\text{test}}} \left[2 \tilde{\gamma} \sum_{i=1}^{d-1}\indof{\tilde{\theta}}{i} \indof{X}{i} > - r \: \frac{r_{\text{test}}}{2} \mid Y=1\right]\nonumber\\ &= 1-\Phi\left(-\frac{r\: r_{\text{test}}}{4\sigma \tilde{\gamma}} \right) = \Phi\left(\frac{r \: r_{\text{test}}}{4\sigma \tilde{\gamma}} \right) \nonumber \end{align} where $\Phi$ is the cumulative distribution function. The second equality follows by multiplying by the normalization constant on both sides and the third equality is due to the fact that $\sum_{i=1}^{d-1}\indof{\tilde{\theta}}{i} \indof{X}{i}$ is a zero-mean Gaussian with variance $\sigma^2\|\tilde{\theta}\|^2_2 = \sigma^2$ since $\tilde{\theta}$ is normalized. Correspondingly we can write \begin{align} \label{eq:cumul2} \mathbb{P}_{r_{\text{test}}} \left[\thetahat{\top} X < 0 \mid Y = -1\right] &=\mathbb{P}_{r_{\text{test}}} \left[2\tilde{\gamma} \sum_{i=1}^{d-1}\indof{\tilde{\theta}}{i} \indof{X}{i} < - r \left(- \frac{r_{\text{test}}}{2}\right) \mid Y=-1\right] = \Phi\left(\frac{r \:r_{\text{test}}}{4\sigma \tilde{\gamma}}\right) \end{align} so that we can combine~\eqref{eq:jacob} and~\eqref{eq:cumul1} and \eqref{eq:cumul2} to obtain $\mathbb{P}_{r_{\text{test}}} (Y\thetahat{\top} X >0 ) = \Phi \left(\frac{r \:r_{\text{test}}}{4\sigma \tilde{\gamma}}\right)$. This concludes the proof of the lemma. \subsection{Proof of Lemma \ref{lem:boundsmaxmargin}} \label{sec:boundsmaxmargin} The proof plan is as follows. We start from the definition of the max $\ell_2$-margin of a dataset. Then, we rewrite the max $\ell_2$-margin as an expression that includes a random matrix with independent standard normal entries. This allows us to prove the upper and lower bounds for the max-$\ell_2$-margin in Sections~\ref{sec:gammaupperbound} and ~\ref{sec:gammalowerbound} respectively, using non-asymptotic estimates on the singular values of Gaussian random matrices. Given the dataset $\widetilde{D} = \{(\tilde{x}_i, y_i)\}_{i=1}^{n}$, we define the random matrix \begin{equation} \label{eq:randmatrixsamples} X = \begin{pmatrix} \tilde{x}_1^{\top}\\ \tilde{x}_2^{\top}\\ ...\\ \tilde{x}_{n}^{\top} \end{pmatrix}. \end{equation} where $\tilde{x}_i \sim \mathcal{N}(0,\sigma I_{d-1})$. Let $\mathcal{V}$ be the class of all perfect predictors of $\widetilde{D}$. For a matrix $A$ and vector $b$ we also denote by $|Ab|$ the vector whose entries correspond to the absolute values of the entries of $Ab$. Then, by definition \begin{equation} \label{maxmargindefgammaproof} \tilde{\gamma} = \max_{v \in \mathcal{V}, \|v\|_2=1} \min_{j \in [n]} \indof{|X v|}{j} = \max_{v \in \mathcal{V}, \|v\|_2=1} \min_{j \in [n]} \sigma \indof{|Q v|}{j}, \end{equation} where $Q = \frac{1}{\sigma} X$ is the scaled data matrix. In the sequel we will use the operator norm of a matrix $A \in \mathbb{R}^{n \times d-1}$. \begin{equation*} \| A\|_2 = \sup_{v \in \mathbb{R}^{d-1} \mid \|v\|_2=1} \|A v \|_2 \end{equation*} and denote the maximum singular value of a matrix $A$ as $s_{\text{max}} (A)$ and the minimum singular value as $s_{\text{min}}(A)$. \subsubsection{Upper bound} \label{sec:gammaupperbound} Given the maximality of the operator norm and since the minimum entry of the vector $|Q v|$ must be smaller than $\frac{\|Q\|_2}{\sqrt{n}}$, we can upper bound $\tilde{\gamma}$ by \begin{equation*} \tilde{\gamma} \leq \sigma \frac{1}{\sqrt{n}} \|Q{}\|_2. \end{equation*} Taking the expectation on both sides with respect to the draw of $\widetilde{D}$ and noting $\|Q\|_2 \leq s_{\text{max}}\left(Q\right)$, it follows from Corollary 5.35 of \cite{vershynin12} that for all $t\geq 0$: \begin{equation*} \mathbb{P} \left[\sqrt{d-1}+\sqrt{n}+t \geq s_{\text{max}}\left(Q\right) \right] \geq 1-2e^{-\frac{t^2}{2}}. \end{equation*} Therefore, with a probability greater than $1-2e^{-\frac{t^2}{2}}$, \begin{equation*} \tilde{\gamma} \leq \sigma \left(1+ \frac{t+\sqrt{d-1}}{\sqrt{n}}\right). \end{equation*} \subsubsection{Lower bound} \label{sec:gammalowerbound} By the definition in Equation \eqref{maxmargindefgammaproof}, if we find a vector $v \in \mathcal{V}$ with $\|v\|_2=1$ such that for an $a>0$, it holds that $\Hquad \min_{j \in n} \sigma \indof{|X v|}{j} > a$, then $\tilde{\gamma} > a$. Recall the definition of the max-$\ell_2$-margin as in Equation \ref{eq:randmatrixsamples}. As $n < d-1$, the random matrix $Q$ is a wide matrix, i.e. there are more columns than rows and therefore the minimal singular value is $0$. Furthermore, $Q$ has rank $n$ almost surely and hence for all $c >0$, there exists a $v \in \mathbb{R}^{d-1}$ such that \begin{equation} \label{eq:existencerhs} \sigma Q v= 1_{\{ n\}}c> 0, \end{equation} where $ 1_{\{ n \}}$ denotes the all ones vector of dimension $n$. The smallest non-zero singular value of $Q$, $s_{\text{min, nonzero}}(Q)$, equals the smallest non-zero singular value of its transpose $Q^{\top}$. Therefore, there also exists a $v \in \mathcal{V}$ with $\|v\|_2=1$ such that \begin{equation} \label{minimum_step_gamma} \tilde{\gamma} \geq \min_{j \in [n]} \sigma \indof{|Q v|}{j} \geq \sigma s_{\text{min,nonzeros}}\left(Q^{\top}\right)\frac{1}{\sqrt{n}}, \end{equation} where we used the fact that any vector $v$ in the span of non-zero eigenvectors satisfies $\|Q v \|_2 \geq s_{\text{min, nonzeros}}(Q)$ and the existence of a solution $v$ for any right-hand side as in Equation \ref{eq:existencerhs}. Taking the expectation on both sides, Corollary 5.35 of \cite{vershynin12} yields that with a probability greater than $1-2e^{-\frac{t^2}{2}}, t\geq 0$ we have \begin{equation} \tilde{\gamma} \geq \sigma\left( \frac{\sqrt{d-1}-t}{\sqrt{n}}-1\right). \end{equation} \section{Experimental details on the Waterbirds dataset} \label{sec:waterbirds} In this section, we discuss the experimental details and construction of the Waterbirds dataset in more detail. We also provide ablation studies of attack parameters such as the size of the motion blur kernel, plots of the robust error decomposition with increasing $n$, and some experiments using early stopping. \paragraph{The waterbirds dataset} To build the Waterbirds dataset, we use the CUB-200 dataset \cite{Welinder10}, which contains images and labels of $200$ bird species, and $4$ background classes (forest, jungle/bamboo, water ocean, water lake natural) of the Places dataset \cite{zhou17}.The aim is to recognize whether or not the bird, in a given image, is a waterbird (e.g. an albatros) or a landbird (e.g. a woodpecker). To create the dataset, we randomly sample equally many water- as landbirds from the CUB-200 dataset. Thereafter, we sample for each bird image a random background image. Then, we use the segmentation provided in the CUB-200 dataset to segment the birds from their original images and paste them onto the randomly sampled backgrounds. The resulting images have a size of $256 \times 256$. Moreover, we also resize the segmentations such that we have the correct segmentation profiles of the birds in the new dataset as well. For the concrete implementation, we use the code provided by \cite{Sagawa20}. \paragraph{Experimetal training details} Following the example of \cite{Sagawa20}, we use a ResNet50 pretrained on the ImageNet dataset for all experiments, a weight-decay of $10^{-4}$, and train for $300$ epochs using the Adam optimizer. Extensive fine-tuning of the learning rate resulted in an optimal learning rate of $0.006$ for all experiments in the low sample size regime. Adversarial training is implemented as suggested in \cite{madry18}: at each iteration we find the worst case perturbation with an exact or approximate method. In all our experiments, the resulting classifier interpolates the training set. We plot the mean over all runs and the standard deviation of the mean. \paragraph{Specifics to the motion blur attack} Fast moving objects or animals are hard to photograph due to motion blur. Hence, when trying to classify or detect moving objects from images, it is imperative that the classifier is robust against reasonable levels of motion blur. We implement the attack as follows. First, we segment the bird from the original image, then use a blur filter and lastly, we paste the blurred bird back onto the background. We are able to apply more severe blur, by enlarging the kernel of the filter. See Figure \ref{fig:motion_blur_panel} for an ablation study of the kernel size. The motion blur filter is implemented as follows. We use a kernel of size $M \times M$ and build the filter as follows: we fill the row $(M-1)/2$ of the kernel with the value $1/M$. Thereafter, we use the 2D convolution implementation of OpenCV (filter2D) \cite{opencv_library} to convolute the kernel with the image. Note that applying a rotation before the convolution to the kernel, changes the direction of the resulting motion blur. Lastly, we find the most detrimental level of motion blur using a list-search over all levels up to $M_{max}$. \begin{figure*}[!t] \centering \begin{subfigure}[b]{0.19\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/waterbird_original_example.png} \caption{Original} \label{fig:motion_blur_or} \end{subfigure} \begin{subfigure}[b]{0.19\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/motion_blur_5.png} \caption{$M = 5$} \label{fig:motion_blur_5} \end{subfigure} \begin{subfigure}[b]{0.19\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/motion_blur_10.png} \caption{$M = 10$} \label{fig:motion_blur_10} \end{subfigure} \begin{subfigure}[b]{0.19\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/motion_blur_15.png} \caption{$M = 15$} \label{fig:motion_blur_15} \end{subfigure} \begin{subfigure}[b]{0.19\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/motion_blur_20.png} \caption{$M = 20$} \label{fig:motion_blur_20} \end{subfigure} \caption{We perform an ablation study of the motion blur kernel size, which corresponds to the severity level of the blur. We see that for increasing $M$, the severity of the motion blur increases. In particular, note that for $M = 15$ and even $M = 20$, the bird remains recognizable: we do not semantically change the class, i.e. the perturbations are consistent.} \label{fig:motion_blur_panel} \end{figure*} \begin{figure*}[!b] \centering \begin{subfigure}[b]{0.136\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/bird_light_03_dark.png} \caption{$\epsilon = -0.3$} \label{fig:dark_03} \end{subfigure} \begin{subfigure}[b]{0.136\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/bird_light_02_dark.png} \caption{$\epsilon = -0.2$} \label{fig:dark_02} \end{subfigure} \begin{subfigure}[b]{0.136\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/bird_light_01_dark.png} \caption{$\epsilon = -0.1$} \label{fig:dark_01} \end{subfigure} \begin{subfigure}[b]{0.136\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/waterbird_original_example.png} \caption{Original} \label{fig:light_or} \end{subfigure} \begin{subfigure}[b]{0.136\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/bird_light_01_light.png} \caption{$\epsilon = 0.1$} \label{fig:light_01} \end{subfigure} \begin{subfigure}[b]{0.136\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/bird_light_02_light.png} \caption{$\epsilon = 0.2$} \label{fig:light_02} \end{subfigure} \begin{subfigure}[b]{0.136\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/bird_light_03_light.png} \caption{$\epsilon = 0.3$} \label{fig:light_03} \end{subfigure} \caption{We perform an ablation study of the different lighting changes of the adversarial illumination attack. Even though the directed attack\xspace attacks the signal component in the image, the bird remains recognizable in all cases.} \label{fig:light_panel} \end{figure*} \paragraph{Specifics to the adversarial illumination attack} An adversary can hide objects using poor lightning conditions, which can for example arise from shadows or bright spots. To model poor lighting conditions on the object only (or targeted to the object), we use the adversarial illumination attack. The attack is constructed as follows: First, we segment the bird from their background. Then we apply an additive constant $\epsilon$ to the bird, where the absolute size of the constant satisfies $|\epsilon| < \eps_{\text{te}} = 0.3$. Thereafter, we clip the values of the bird images to $[0, 1]$, and lastly, we paste the bird back onto the background. See Figure \ref{fig:light_panel} for an ablation of the parameter $\epsilon$ of the attack. It is non-trivial how to (approximately) find the worst perturbation. We find an approximate solution by searching over all perturbations with increments of size $\eps_{\text{te}}/K_{\text{max}}$. Denote by seg\xspace, the segmentation profile of the image $x$. We consider all perturbed images in the form of \begin{equation*} x_{pert} = (1-seg) x + seg (x + \epsilon \frac{K}{K_{\text{max}}} 1_{255 \times 255}), \Hquad K \in [-K_{max}, K_{max}]. \end{equation*} During training time we set $K_{max} = 16$ and therefore search over $33$ possible images. During test time we search over $65$ images ($K_{max} = 32$). \paragraph{Early stopping} In all our experiments on the Waterbirds dataset, a parameter search lead to an optimal weight-decay and learning rate of $10^{-4}$ and $0.006$ respectively. Another common regularization technique is early stopping, where one stops training on the epoch where the classifier achieves minimal robust error on a hold-out dataset. To understand if early stopping can mitigate the effect of adversarial training aggregating robust generalization in comparison to standard training, we perform the following experiment. On the Waterbirds dataset of size $n = 20$ and considering the adversarial illumination attack, we compare standard training with early stopping and adversarial training $(\eps_{\text{tr}} = \eps_{\text{te}} = 0.3)$ with early stopping. Considering several independent experiments, early stopped adversarial training has an average robust error of $33.5$ a early stopped standard training $29.1$. Hence, early stopping does decrease the robust error gap, but does not close it. \paragraph{Error decomposition with increasing $n$} In Figure \ref{fig:waterbirds_light_numobs}, we see that adversarial training hurts robust generalization in the small sample size regime. For completeness, we plot the robust error composition for adversarial and standard training in Figure \ref{fig:light_numsamp_decomposition}. We see that in the low sample size regime, the drop in susceptibility that adversarial training achieves in comparison to standard training, is much lower than the increase in standard error. Conversely, in the high sample regime, the drop of susceptibility from adversarial training over standard training is much bigger than the increase in standard error. \begin{figure*}[!t] \centering \begin{subfigure}[b]{0.32\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/numsamp_waterbirds_light.png} \caption{Robust error} \label{fig:app_waterbirds_robust_error} \end{subfigure} \begin{subfigure}[b]{0.32\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/waterbirds_standard_numsamp.png} \caption{Standard error} \label{fig:app_waterbirds_standard_error} \end{subfigure} \begin{subfigure}[b]{0.32\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/waterbirds_susceptibility_decomposition.png} \caption{Susceptibility} \label{fig:app_waterbirds_susceptibility} \end{subfigure} \caption{We plot the robust error decomposition of the experiments depicted in Figure \ref{fig:waterbirds_light_numobs}. The plots depict the mean and standard deviation of the mean over several independent experiments. We see that, in comparison to standard training, the reduction in susceptibility for adversarial training is minimal in the low sample size regime. Moreover, the increase in standard error of adversarial training is quite severe, leading to an overall increase in robust error in the low sample size regime.} \label{fig:light_numsamp_decomposition} \end{figure*} \section{Future work} This paper aims to caution the practitioner against blindly following current widespread practices to increase the robust performance of machine learning models. Specifically, adversarial training is currently recognized to be one of the most effective defense mechanisms for $\ell_p$-perturbations, significantly outperforming robust performance of standard training. However, we prove that this common wisdom is not applicable for directed attacks -- that are perceptible (albeit consistent) but efficiently focus their attack budget to target ground truth class information -- in the low-sample size regime. In particular, in such settings adversarial training can in fact yield worse accuracy than standard training. In terms of follow-up work on directed attacks in the low-sample regime, there are some concrete questions that would be interesting to explore. For example, as discussed in Section~\ref{sec:relatedwork}, it would be useful to test whether some methods to mitigate the standard accuracy vs. robustness trade-off would also relieve the perils of adversarial training for directed attacks. Further, we hypothesize, independent of the attack during test time, it is important in the small sample-size regime to choose perturbation sets during training that align with the ground truth signal (such as rotations for data with inherent rotation). If this hypothesis were to be confirmed, it would break with yet another general rule that the best defense perturbation type should always match the attack during evaluation. The insights from this study might also be helpful in the context of searching for good defense perturbations. \section{Discussion and related work} \section{Introduction} \label{sec:intro} \begin{wrapfigure}{r}{0.43\textwidth} \centering \vspace{-0.1in} \includegraphics[width=0.99\linewidth]{plotsAistats/teaser_try_2.png} \caption{ On subsampled \mbox{CIFAR10} attacked by $2\times 2$ masks, adversarial training yields higher robust error than standard training when the sample size is small, even though it helps for large sample sizes. (see Sec.~\ref{sec:app_cifar10} for details).} \vspace{-0.2in} \label{fig:teaserplot} \end{wrapfigure} Today's best-performing classifiers are vulnerable to adversarial attacks \cite{goodfellow15, szegedy14} and exhibit high \emph{robust error}: for many inputs, their predictions change under adversarial perturbations, even though the true class stays the same. For example, in image classification tasks, we distinguish between two categories of such attacks that are content-preserving \cite{gilmer18b} (or consistent \cite{raghunathan20}) if their strength is limited --- perceptible and imperceptible perturbations. Most work to date studies imperceptible attacks such as bounded $\ell_p$-norm perturbations \cite{goodfellow15, madry18, moosavi16}, small transformations using image processing techniques \cite{ghiasi19, zhao20, laidlaw21, Luo18} or nearby samples on the data manifold \cite{Lin20, Zhou20}. They can often use their limited budget to successfully fool a learned classifier but, by definition, do not visibly reduce information about the actual class: the object in the perturbed image looks exactly the same as in the original version. On the other hand, perceptible perturbations may occur more naturally in practice or are physically realizable. For example, stickers can be placed on traffic signs \cite{Eykholt18}, masks of different sizes may cover important features of human faces \cite{Wu20}, images might be rotated or translated \cite{Logan19}, animals in motion may appear blurred in photographs depending on the shutter speed, or the lighting conditions could be poor (see Figure~\ref{fig:sig_att_examples}). Some perceptible attacks can effectively use the perturbation budget to reduce actual class information in the input (the \emph{signal}) while still preserving the original class. For example, a stop sign with a small sticker doesn't lose its semantic meaning or a flying bird does not become a different species because it induces motion blur in the image. We refer to these attacks as \emph{directed attacks\xspace} (see Section~\ref{sec:robustness} for a more formal characterization). In this paper, we demonstrate that one of the most common beliefs for adversarial attacks does not transfer to directed attacks\xspace, in particular when the sample size is small. Specifically, it is widely acknowledged that adversarial training often achieves significantly lower adversarial error than standard training. This holds in particular if the perturbation type \cite{madry18, zhang19, Bai21} and perturbation budget match the attack during test time. Intuitively, the improvement is a result of decreased \emph{attack-susceptibility}: independent of the true class, adversarial training explicitly encourages the classifier to predict the same class for all perturbed points. \begin{figure}[t] \vskip 0.2in \begin{center} \begin{subfigure}[b]{0.2\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/CIFAR10_class_boat.png} \caption{Masking} \label{fig:CIFAR10_boat} \end{subfigure} \begin{subfigure}[b]{0.2\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/light_darker.png} \caption{Illumination} \label{fig:WB_light_dark} \end{subfigure} \begin{subfigure}[b]{0.2\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/water-bird_motion_blurred.png} \caption{Motion blur} \label{fig:WB_motion_blur} \end{subfigure} \begin{subfigure}[b]{0.2\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/waterbird_original_example.png} \caption{Original} \label{fig:fig:WB_original} \end{subfigure} \caption{Examples of directed attacks\xspace on CIFAR10 and the Waterbirds dataset. In Figure \ref{fig:CIFAR10_boat}, we corrupt the image with a black mask of size $2 \times 2$ and in Figure \ref{fig:WB_light_dark} and \ref{fig:WB_motion_blur} we change the lighting conditions (darkening) and apply motion blur on the bird in the image respectively. All perturbations effectively reduce the information about the class in the images: they are the result of directed attacks\xspace.} \label{fig:sig_att_examples} \end{center} \vskip -0.2in \end{figure} In this paper, we question the efficacy of adversarial training to increase robust accuracy for directed attacks\xspace. In particular, we show that adversarial training not only increases standard test error as noted in \cite{zhang19, tsipras19, Stutz19, raghunathan20}), but surprisingly, \begin{center} \emph{adversarial training may even increase the robust test error compared to standard training!} \end{center} Figure \ref{fig:teaserplot} illustrates the main message of our paper for CIFAR10 subsets: Although adversarial training outperforms standard training when enough training samples are available, it is inferior in the low-sample regime. More specifically, our contributions are as follows: \begin{itemize} \item We prove that, almost surely, adversarially training a linear classifier on separable data yields a monotonically increasing robust error as the perturbation budget grows. We further establish high-probability non-asymptotic lower bounds on the robust error gap between adversarial and standard training. \item Our proof provides intuition for why this phenomenon is particularly prominent for directed attacks\xspace in the small sample size regime. \item We show that this phenomenon occurs on a variety of real-world datasets and perceptible directed attacks\xspace in the small sample size regime. \end{itemize} \section{Real-world experiments} \label{sec:realworldexpapp} In this section, we demonstrate that adversarial training may hurt robust accuracy in a variety of image attack scenarios on the Waterbirds and CIFAR10 dataset. The corresponding experimental details and more experimental results (including on an additional hand gestures dataset) can be found in Appendices \ref{sec:waterbirds}, \ref{sec:app_cifar10} and \ref{sec:handgestures}. \subsection{Datasets} We now describe the datasets and models that we use for the experiments. In all our experiments on CIFAR10, we vary the sample size by subsampling the dataset and use a ResNet18 \cite{He16} as model. We always train on the same (randomly subsampled) dataset, meaning that the variances arise from the random seed of the model and the randomness in the training algorithm. In Appendix \ref{sec:app_cifar10}, we complement the results of this section by reporting the results of similar experiments with different architectures. As a second dataset, we build a new version of the Waterbirds dataset, consisting of images of water- and landbirds of size $256 \times 256$ and labels that distinguish the two types of birds. We construct the dataset as follows: First, we sample equally many water- and landbirds from the CUB-200 dataset \cite{Welinder10}. Then, we segment the birds and paste them onto a background that is randomly sampled (without replacement) from the Places-256 dataset \cite{zhou17}. For the implementation of the dataset we used the code provided by \citet{Sagawa20}. Also, following the choice of \citet{Sagawa20}, we use as model a ResNet50 that was pretrained on ImageNet and which achieves near perfect standard accuracy. \subsection{Evaluation of directed attacks\xspace} We consider three types of directed attacks\xspace on our real world datasets: square masks, motion blur and adversarial illumination. The mask attack is a model used to simulate sticker-attacks and general occlusions of objects in images \cite{Eykholt18, Wu20}. On the other hand, motion blur may arise naturally for example when photographing fast moving objects with a slow shutter speed. Further, adversarial illumination may result from adversarial lighting conditions or smart image corruptions. Next, we describe the attacks in more detail. \paragraph{Mask attacks} On CIFAR10, we consider the square black mask attack: the adversary can set a mask of size $\eps_{\text{te}} \times \eps_{\text{te}}$ to zero in the image. To ensure that the mask does not cover the whole signal in the image, we restrict the size of the masks to be at most $2 \times 2$. Hence, the search space of the attack consists of all possible locations of the masks in the targeted image. For exact robust error evaluation, we perform a full grid search over all possible locations during test time. See Figure \ref{fig:CIFAR10_boat} for an example of a mask attack on CIFAR10. \paragraph{Motion blur} On the Waterbirds dataset we consider two directed attacks\xspace: motion blur and adversarial illumination. For the motion blur attack, the bird may move at different speeds without changing the background. The aim is to be robust against all motion blur severity levels up to $M_{max} = 15$. To simulate motion blur, we first segment the birds and then use a filter with a kernel of size $M$ to apply motion blur on the bird only. Lastly, we paste the blurred bird back onto the background image. We can change the severity level of the motion blur by increasing the kernel size of the filter. See Appendix \ref{sec:waterbirds} for an ablation study and concrete expressions of the motion blur kernel. At test time, we perform a full grid search over all kernel sizes to exactly evaluate the robust error. We refer to Figure \ref{fig:WB_motion_blur} and Section \ref{sec:waterbirds} for examples of our motion blur attack. \paragraph{Adversarial illumination} As a second attack on the Waterbirds dataset, we consider adversarial illumination. The adversary can darken or brighten the bird without corrupting the background of the image. The attack aims to model images where the object at interest is hidden in shadows or placed against bright light. To compute the adversarial illumination attack, we segment the bird, then darken or brighten the it, by adding a constant $a \in [-\eps_{\text{te}}, \eps_{\text{te}}]$, before pasting the bird back onto the background image. We find the most adversarial lighting level, i.e. the value of $a$, by equidistantly partitioning the interval $[-\eps_{\text{te}}, \eps_{\text{te}}]$ in $K$ steps and performing a full list-search over all steps. See Figure \ref{fig:WB_light_dark} and Section \ref{sec:waterbirds} for examples of the adversarial illumination attack. \subsection{Adversarial training procedure} For all datasets, we run SGD until convergence on the \emph{robust} cross-entropy loss~\eqref{eq:emploss}. In each iteration, we search for an adversarial example and update the weights using a gradient with respect to the resulting perturbed example \cite{goodfellow15, madry18}. For every experiment, we choose the learning rate and weight decay parameters that minimize the robust error on a hold-out dataset. We now describe the implementation of the adversarial search for the three types of directed attacks\xspace. \paragraph{Mask attacks} Unless specified otherwise, we use an approximate attack similar to \citet{Wu20} during training time: First, we identify promising mask locations by analyzing the gradient, $\nabla_x L(f_\theta(x), y)$, of the cross-entropy loss with respect to the input. Masks that cover part of the image where the gradient is large, are more likely to increase the loss. Hence, we compute the $K$ mask locations $(i, j)$, where $\|\nabla_x L(f_\theta(x), y)_{[i:i+2, j:j+2]} \|_1$ is the largest and take using a full list-search the mask that incurs the highest loss. Our intuition from the theory predicts that higher $K$, and hence a more exact ``defense'', only increases the robust error of adversarial training, since the mask could then more efficiently cover important information about the class. We indeed confirm this effect and provide more details in Section~\ref{sec:app_cifar10}. \paragraph{Motion blur} Intuitively the worst attack should be the most severe blur, rendering a search over a range of severity superfluous. However, similar to rotations, this is not necessarily true in practice since the training loss on neural networks is generally nonconvex. Hence, during training time, we perform a search over kernels with sizes $2i$ for $i = 1,\dots, M_{max}/2$. Note that, at test time, we do an exact search over all kernels of sizes in $[1, 2, \dots, M_{max}]$. \paragraph{Adversarial illumination} Similar to the motion blur attack, intuitively the worst perturbation should be the most severe lighting changes; either darkening or illuminating the object maximally. However, again this is not necessarily the case, since finding the worst attack is a nonconvex problem. Therefore, during training and testing we partition the interval $[-\eps_{\text{tr}}, \eps_{\text{tr}}]$ in $33$ and $65$ steps respectively, and perform a full grid-search to find the worst perturbation. \subsection{Adversarial training can hurt robust generalization} Further, we perform the following experiments on the Waterbirds dataset using the motion blur and adversarial illumination attack. We vary the adversarial training budget $\eps_{\text{tr}}$, while keeping the number of samples fixed, and compute the resulting robust error. We see in Figure \ref{fig:waterbirds_light_d_n} and \ref{fig:motion_lines} that, indeed, adversarial training can hurt robust generalization with increasing perturbation budget $\eps_{\text{tr}}$. Furthermore, to gain intuition as described in Section~\ref{logreg_proof_sketch} and, we also plot the robust error decomposition (Equation~\ref{eq:decomposition}) consisting of the standard error and susceptibility in Figure \ref{fig:light_trade_off} and \ref{fig:motion_blur_trade_off}. Recall that we measure susceptibility as the fraction of data points in the test set for which the classifier predicts a different class under an adversarial attack. As in our linear example, we observe an increase in robust error despite a slight drop in susceptibility, because of the more severe increase in standard error. Similar experiments for the hand gesture dataset can be found in~\ref{sec:handgestures}. \begin{figure*}[!t] \centering \begin{subfigure}[b]{0.4\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/waterbirds_motion_d_n.png} \caption{Robust error with increasing $\eps_{\text{tr}}$} \label{fig:motion_lines} \end{subfigure} \begin{subfigure}[b]{0.4\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/waterbirds_trade-off.png} \caption{Robust error decomposition} \label{fig:motion_blur_trade_off} \end{subfigure} \caption{ (a) We plot the robust error with increasing adversarial training budget $\eps_{\text{tr}}$ of $5$ experiments on the subsampled Waterbirds datasets of sample sizes $20$ and $30$. Even though adversarial training hurts robust generalization for low sample size ($n = 20$), it helps for $n = 50$. (b) We plot the decomposition of the robust error in standard error and susceptibility with increasing adversarial budget $\eps_{\text{tr}}$. We plot the mean and standard deviation of the mean of $5$ experiments on a subsampled Waterbirds dataset of size $n = 20$. The increase in standard error is more severe than the drop in susceptibility, leading to a slight increase in robust error. For more experimental details see Section \ref{sec:waterbirds}.} \label{fig:motion_blur_real_world} \end{figure*} As predicted by our theorem, the phenomenon where adversarial training hurts robust generalization is most pronounced in the small sample size regime. Indeed, the experiments depicted in Figures \ref{fig:waterbirds_light_d_n} and \ref{fig:motion_lines} are conducted on small sample size datasets of $n = 20$ or $50$. In Figure \ref{fig:teaserplot} and \ref{fig:waterbirds_light_numobs}, we observe that the as sample size increases, adversarial training does improve robust generalization compared to standard training, even for directed attacks\xspace. Moreover, on the experiments of CIFAR10 using the mask perturbation, which can be found in Figure \ref{fig:teaserplot} and Appendix \ref{sec:app_cifar10}, we observe the same behaviour: Adversarial training hurts robust generalization in the low sample size regime, but helps when enough samples are available. \subsection{Discussion} In this section, we discuss how different algorithmic choices, motivated by related work, affect when and how adversarial training hurts robust generalization. \paragraph{Strength of attack and catastrophic overfitting} In many cases, the worst case perturbation during adversarial training is found using an approximate algorithm such as projected gradient descent. It is common belief that using the strongest attack (in the mask-perturbation case, full grid search) during training should also result in better robust generalization. In particular, the literature on catastrophic overfitting shows that weaker attacks during training lead to bad performance on stronger attacks during testing \cite{Wong20Fast, andriushchenko20, li21}. Our result suggests the opposite is true in the low-sample size regime for directed attacks\xspace : the weaker the attack, the better adversarial training performs. \paragraph{Robust overfitting} Recent work observes empirically \cite{rice20} and theoretically \cite{sanyal20, donhauser21}, that perfectly minimizing the adversarial loss during training might in fact be suboptimal for robust generalization; that is, classical regularization techniques might lead to higher robust accuracy. The phenomenon is often referred to as robust overfitting. May the phenomenon be mitigated using standard regularization techniques? In Appendix \ref{sec:waterbirds} we shed light on this question and show that adversarial training hurts robust generalization even with standard regularization methods such as early stopping are used. \section{Related work} \label{sec:relatedwork} We now discuss how our results relate to phenomena that have been observed or proven in the literature before. \paragraph{Robust and non-robust useful features} In the words of \citet{ilyas19, springer21}, for directed attacks, all robust features become less useful, but adversarial training uses robust features more. In the small sample-size regime $n<d-1$ in particular, robust learning assigns so much weight on the robust (possibly non-useful) features, that the signal in the non-robust features is drowned. This leads to an unavoidable and large increase in standard error that dominates the decrease in susceptibility and hence ultimately leads to an increase of the robust error. \paragraph{Small sample size and robustness} A direct consequence of Theorem~\ref{thm:linlinf} is that in order to achieve the same robust error as standard training, adversarial training requires more samples. This statement might remind the reader of sample complexity results for robust generalization in \citet{schmidt18, Yin19, Khim18}. While those results compare sample complexity bounds for standard vs. robust error, our theorem statement compares two algorithms, standard vs. adversarial training, with respect to the robust error. \paragraph{Trade-off between standard and robust error} Many papers observed that even though adversarial training decreases robust error compared to standard training, it may lead to an increase in standard test error \cite{madry18, zhang19}. For example, \citet{tsipras19, zhang19, javanmard20, dobriban20, chen20} study settings where the Bayes optimal robust classifier is not equal to the Bayes optimal (standard) classifier (i.e. the perturbations are inconsistent or the dataset is non-separable). \cite{raghunathan20} study consistent perturbations, as in our paper, and prove that for small sample size, fitting adversarial examples can increase standard error even in the absence of noise. In contrast to aforementioned works, which do not refute that adversarial training decreases robust error, we prove that for directed attacks\xspace perturbations, in the small sample regime adversarial training may also increase \emph{robust error}. \paragraph{Mitigation of the trade-off} A long line of work has proposed procedures to mitigate the trade-off phenomenon. For example \citet{alayrac19, Carmon19, zhai20, raghunathan20} study robust self training, which leverages a large set of unlabelled data, while \citet{lee20, lamb19, xu20} use data augmentation by interpolation. \citet{Ding20, balaji19, Cheng20} on the other hand propose to use adaptive perturbation budgets $\eps_{\text{tr}}$ that vary across inputs. Our intuition from the theoretical analysis suggests that the standard mitigation procedures for imperceptible perturbations may not work for perceptible directed attacks\xspace, because all relevant features are non-robust. We leave a thorough empirical study as interesting future work. \section{Robust classification} \label{sec:robustness} We first introduce our robust classification setting more formally by defining the notions of adversarial robustness, directed attacks\xspace and adversarial training used throughout the paper. \paragraph{Adversarially robust classifiers} For inputs $x \in \mathbb{R}^d$, we consider multi-class classifiers associated with parameterized functions $f_\theta:\mathbb{R}^d \to \mathbb{R}^K$, where $K$ is the number of labels. In the special case of binary classification ($K = 2$), we use the output predictions $y=\textrm{sign}(f_\theta(x))$. For example, $f_\theta(x)$ could be linear models (as in Section~\ref{sec:theoryresults}) or neural networks (as in Section~\ref{sec:realworldexpapp}). One key step to encourage deployment of machine learning based classification in real-world applications, is to increase the robustness of classifiers against perturbations that do not change the ground truth label. Mathematically speaking, we would like to have a small \emph{$\eps_{\text{te}}$-robust error}, defined as \begin{equation} \label{eq:roberr} \roberr{\theta} := \mathbb{E}_{(x, y)\sim \mathbb{P}} \max_{x' \in \pertset{x}{\eps_{\text{te}}}} \ell(f_\theta (x'),y), \end{equation} where $\ell$ is the multi-class zero-one loss, which only equals $1$ if the predicted output using $f_\theta(x)$ does not match the true label $y$. Further, $\pertset{x}{\eps_{\text{te}}}$ is a perturbation set associated with a \emph{transformation type} and size $\eps_{\text{te}}$. Note that the \emph{(standard) error} of a classifier corresponds to evaluating $\roberr{\theta}$ at $\eps_{\text{te}} = 0$, yielding the standard error $\stderr{\theta} =\mathbb{E}_{(x, y)\sim \mathbb{P}} \ell(f_\theta (x),y)$. \paragraph{(Signal)-Directed attacks} Most works in the existing literature consider consistent perturbations where $\eps_{\text{te}}$ is small enough such that all samples in the perturbation set have the same ground truth or expert label. Note that the ground truth model $f_{\theta^{\star}}$ is therefore robust against perturbations and achieves the same error for standard and adversarial evaluation. The inner maximization in Equation~\eqref{eq:roberr} is often called the adversarial \emph{attack} of the model $f_\theta$ and the corresponding solution is referred to as the adversarial example. In this paper, we consider \emph{directed attacks\xspace}, as described in Section~\ref{sec:intro}, that effectively reduce the information about the ground truth classes. Formally, we characterize \emph{directed attacks\xspace} by the following property: for any model $f_\theta$ with low standard error, the corresponding adversarial example is well-aligned with the adversarial example found using the ground truth model $f_{\theta^{\star}}$. An example for such an attack are additive perturbations that are constrained to the direction of the ground truth decision boundary. We provide concrete examples for linear classification in Section~\ref{logreg_linear_model}. \paragraph{Adversarial training} In order to obtain classifiers with a good robust accuracy, it is common practice to minimize a (robust) training objective $\mathcal{L}_{\eps_{\text{tr}}}$ with a surrogate classification loss $L$ such as \begin{equation} \label{eq:emploss} \robloss{\theta} := \frac{1}{n} \sum_{i=1}^n \max_{x_i' \in \pertset{x_i}{\eps_{\text{tr}}}} L(f_\theta(x_i') y_i), \end{equation} which is called adversarial training. In practice, we often use the cross entropy loss $L(z) = \log (1+ \text{e}^{-z})$ and minimize the robust objective by using first order optimization methods such as (stochastic) gradient descent. SGD is also the algorithm that we focus on in both the theoretical and experimental sections. When the desired type of robustness is known in advance, it is standard practice to use the same perturbation set for training as for testing, i.e. $\pertset{x}{\eps_{\text{tr}}}=\pertset{x}{\eps_{\text{te}}}$. For example, \citet{madry18} shows that the robust error sharply increases for $\eps_{\text{tr}} < \eps_{\text{te}}$. In this paper, we show that for directed attacks\xspace in the small sample size regime, in fact, the opposite is true. \section{Theoretical results} \label{sec:theoryresults} In this section, we prove for linear functions $f_\theta(x) = \theta^\top x$ that in the case of directed attacks, robust generalization deteriorates with increasing $\eps_{\text{tr}}$. The proof, albeit in a simple setting, provides explanations for why adversarial training fails in the high-dimensional regime for such attacks. \subsection{Setting} \label{logreg_linear_model} We now introduce the precise linear setting used in our theoretical results. \paragraph{Data model} In this section, we assume that the ground truth and hypothesis class are given by linear functions $f_\theta(x) = \theta^\top x$ and the sample size $n$ is lower than the ambient dimension $d$. In particular, the generative distribution $\mathbb{P}_r$ is similar to \cite{tsipras19, kolter19}: The label $y \in \{+1, -1\}$ is drawn with equal probability and the covariate vector is sampled as $x = [y\frac{r}{2}, \tilde{x}]$ with the random vector $\tilde{x} \in \mathbb{R}^{d-1}$ drawn from a standard normal distribution, i.e. $\tilde{x} \sim \mathcal{N}(0, \sigma^2 I_{d-1})$. We would like to learn a classifier that has low robust error by using a dataset $D = {(x_i, y_i)}_{i=1}^n$ with $n$ i.i.d. samples from $\mathbb{P}_{r}$. Notice that the distribution $\mathbb{P}_{r}$ is noiseless: for a given input $x$, the label $y = \sign(\xind{1})$ is deterministic. Further, the optimal linear classifier (also referred to as the \emph{ground truth}) is parameterized by $\theta^{\star} = e_1$.\footnote{Note that the result more generally holds for non-sparse models that are not axis aligned by way of a simple rotation $z = U x$. In that case the distribution is characterized by $\theta^\star = u_1$ and a rotated Gaussian in the $d-1$ dimensions orthogonal to $\theta^\star$.} By definition, the ground truth is robust against all consistent perturbations and hence the optimal robust classifier. \paragraph{Directed attacks\xspace} The focus in this paper lies on consistent directed attacks\xspace that by definition efficiently concentrate their attack budget in the direction of the signal. For our linear setting, we can model such attacks by additive perturbations in the first dimension \begin{equation} \label{eq:linfmaxpert} \pertset{x}{\epsilon} = \{x'=x+\delta \mid \delta = \beta e_1 \text{ and } -\epsilon \leq \beta\leq \epsilon\}. \end{equation} Note that this attack is always in the direction of the true signal dimension, i.e. the ground truth. Furthermore, when $\epsilon < \frac{r}{2}$, it is a consistent directed attack\xspace. Observe how this is different from $\ell_p$ attacks - an $\ell_p$ attack, depending on the model, may add a perturbation that only has a very small component in the signal direction. \paragraph{Robust max-$\ell_2$-margin classifier} A long line of work studies the implicit bias of interpolators that result from applying stochastic gradient descent on the logistic loss until convergence \cite{liu20, Ji19, Chizat20, nacson19}. For linear models, we obtain the $\eps_{\text{tr}}$-robust maximum-$\ell_2$-margin solution (\emph{robust max-margin} in short) \begin{equation} \label{eq:maxmargin} \thetahat{\eps_{\text{tr}}} := \argmax_{\|\theta\|_2\leq 1} \min_{i\in [n], x_i' \in \pertset{x_i}{\eps_{\text{tr}}}} y_i \theta^\top x_i'. \end{equation} This can for example be shown by a simple rescaling argument using Theorem 3.4 in \cite{liu20}. Even though our result is proven for the max-$\ell_2$-margin classifier, it can easily be extended to other interpolators. \begin{figure*}[!t] \centering \begin{subfigure}[b]{0.3\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/gap_lower_final_main_theorem.png} \caption{Robust error increase with $\eps_{\text{tr}}$} \label{fig:main_lower_bound_eps} \end{subfigure} \begin{subfigure}[b]{0.3\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/robust_error_ST_AT.png} \caption{Standard-adversarial training} \label{fig:main_numobs} \end{subfigure} \begin{subfigure}[b]{0.3\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/gap_final_good_colours.png} \caption{Effect of over-parameterization} \label{fig:main_numobs_bound} \end{subfigure} \caption{Experimental verification of Theorem \ref{thm:linlinf}. (a) We set $d = 1000$, $r = 12$, $n = 50$ and plot the robust error gap between standard and adversarial training with increasing adversarial budget $\eps_{\text{tr}}$ of $5$ independent experiments. For comparison, we also plot the lower bound given in Theorem \ref{thm:linlinf}. In (b) and (c), we set $d = 10000$ and vary the number of samples $n$. (b) We plot the robust error of standard and adversarial training ($\eps_{\text{tr}} = 4.5$). (c) We compute the error gap and the lower bound of Theorem \ref{thm:linlinf}. For more experimental details see Appendix~\ref{sec:logregapp}.} \vspace{-0.2in} \label{fig:main_theorem} \end{figure*} \subsection{Main results} \label{logreg_main_theorem} We are now ready to characterize the $\eps_{\text{te}}$-robust error as a function of $\eps_{\text{tr}}$, the separation $r$, the dimension $d$ and sample size $n$ of the data. In the theorem statement we use the following quantities \begin{align*} \varphi_{\text{min}} &= \frac{\sigma}{r/2-\eps_{\text{te}}} \left( \sqrt{\frac{d-1}{n}} - \left(1 + \sqrt{\frac{2 \log (2/\delta)}{n}}\right)\right)\\ \varphi_{\text{max}} &= \frac{\sigma}{r/2-\eps_{\text{te}}} \left( \sqrt{\frac{d-1}{n}} + \left(1 + \sqrt{\frac{2 \log (2/\delta)}{n}}\right)\right) \end{align*} that arise from concentration bounds for the singular values of the random data matrix. Further, let $\tilde{\epsilon} := \frac{r}{2} - \frac{\varphi_{\text{max}}}{\sqrt{2}}$ and denote by $\Phi$ the cumulative distribution function of a standard normal. \begin{theorem} \label{thm:linlinf} Assume $d-1>n$. For any $\eps_{\text{te}} \geq 0$, the $\eps_{\text{te}}$-robust error on test samples from $\mathbb{P}_{r}$ with $2 \eps_{\text{te}} < r$ and perturbation sets in Equation~\eqref{eq:linfmaxpert} and~\eqref{eq:l1maxpert}, the following holds: \begin{enumerate} \item The $\eps_{\text{te}}$-robust error of the $\eps_{\text{tr}}$-robust max-margin estimator reads \begin{equation} \roberr{\thetahat{\eps_{\text{tr}}}} = \Phi \left( -\frac{\left( \frac{r}{2}-\eps_{\text{tr}} \right) }{\tilde{\varphi}} \right) \end{equation} for a random quantity $\tilde{\varphi}>0$ depending on $\sigma, r,\eps_{\text{te}}$, which is a strictly increasing function with respect to $\eps_{\text{tr}}$. \item With probability at least $1-\delta$, we further have $\varphi_{\text{min}} \leq \tilde{\varphi}\leq \varphi_{\text{max}}$ and the following lower bound on the robust error increase by adversarially training with size $\eps_{\text{tr}}$ \begin{equation} \roberr{\thetahat{\eps_{\text{tr}}}} - \roberr{\thetahat{0}} \geq \Phi \left(\frac{r/2}{\varphi_{\text{min}}} \right) - \Phi \left( \frac{r/2 -\min\{\eps_{\text{tr}}, \tilde{\epsilon}\}}{ \varphi_{\text{min}}} \right). \end{equation} \end{enumerate} \end{theorem} The proof can be found in Appendix~\ref{sec:app_theorylinear} and primarily relies on high-dimensional probability. Note that the theorem holds for any $0\leq \eps_{\text{te}} <\frac{r}{2}$ and hence also directly applies to the standard error by setting $\eps_{\text{te}} = 0$. In Figure~\ref{fig:main_theorem}, we empirically confirm the statements of Theorem \ref{thm:linlinf} by performing multiple experiments on synthetic datasets as described in Subsection \ref{logreg_linear_model} with different choices of $d/n$ and $\eps_{\text{tr}}$. In the first statement, we prove that for small sample-size ($n<d-1$) noiseless data, almost surely, the robust error increases monotonically with adversarial training budget $\eps_{\text{tr}} >0$. In Figure~\ref{fig:main_lower_bound_eps}, we plot the robust error gap between standard and adversarial logistic regression in function of the adversarial training budget $\eps_{\text{tr}}$ for $5$ runs. The second statement establishes a simplified lower bound on the robust error increase for adversarial training (for a fixed $\eps_{\text{tr}} = \eps_{\text{te}}$) compared to standard training. In Figures~\ref{fig:main_lower_bound_eps} and \ref{fig:main_numobs_bound}, we show how the lower bound closely predicts the robust error gap in our synthetic experiments. Furthermore, by the dependence of $\varphi_{\text{min}}$ on the overparameterization ratio $d/n$, the lower bound on the robust error gap is amplified for large $d/n$. Indeed, Figure~\ref{fig:main_numobs_bound} shows how the error gap increases with $d/n$ both theoretically and experimentally. However, when $d/n$ increases above a certain threshold, the gap decreases again, as standard training fails to learn the signal and yields a high error (see Figure~\ref{fig:main_numobs}). \begin{figure*}[!t] \centering \begin{subfigure}[b]{0.32\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/d_n_logreg.png} \caption{Robust error vs $\eps_{\text{tr}}$} \label{fig:eps_logreg} \end{subfigure} \begin{subfigure}[b]{0.32\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/logreg_trade_off_plot.png} \caption{Robust error decomposition} \label{fig:main_robust} \end{subfigure} \begin{subfigure}[b]{0.32\textwidth} \includegraphics[width=0.99\linewidth]{plotsAistats/linear_intuition_try.png} \caption{Intuition in 2D} \label{fig:2D_dataset_intuition} \end{subfigure} \caption{(a) We set $d=1000$ and $r = 12$ and plot the robust error with increasing adversarial training budget ($\eps_{\text{tr}}$) and with increasing $d/n$. (b) We plot the robust error decomposition in susceptibility and standard error for increasing adversarial budget $\eps_{\text{tr}}$. Full experimental details can be found in Section~\ref{sec:logregapp}. (c) 2D illustration providing intuition for the linear setting: Training on directed attacks\xspace (yellow) effectively corresponds to fiting the original datapoints (blue) after shifting them closer to the decision boundary. The robust max-$\ell_2$-margin (yellow dotted) is heavily tilted if the points are far apart in the non-signal dimension, while the standard max-$\ell_2$-margin solution (blue dashed) is much closer to the ground truth (gray solid). } \label{fig:lineartradeoff} \end{figure*} \subsection{Proof idea: intuition and surprises} \label{logreg_proof_sketch} The reason that adversarial training hurts robust generalization is based on an extreme robust vs. standard error tradeoff. We provide intuition for the effect of directed attacks\xspace and the small sample regime on the solution of adversarial training by decomposing the robust error $\roberr{\theta}$. Notice that $\eps_{\text{te}}$-robust error $\roberr{\theta}$ can be written as the probability of the union of two events: the event that the classifier based on $\theta$ is wrong and the event that the classifier is susceptible to attacks: \begin{equation} \label{eq:decomposition} \begin{aligned} \roberr{\theta} &= \mathbb{E}_{x, y\sim \mathbb{P}} \left[\Indi{y f_\theta (x) <0} \vee \max_{x' \in \pertset{x}{\eps_{\text{te}}}} \Indi{f_\theta(x) f_\theta(x')<0} \right] \\ &\leq \stderr{\theta} + \suscept{\theta} \end{aligned} \end{equation} where $\suscept{\theta}$ is the expectation of the maximization term in Equation \eqref{eq:decomposition}. $\suscept{\theta}$ represents the $\eps_{\text{tr}}$-\emph{attack-susceptibility} of a classifier induced by $\theta$ and $\stderr{\theta}$ its standard error. Equation~\eqref{eq:decomposition} suggests that the robust error can only be small if both the standard error and susceptibility are small. In Figure~\ref{fig:main_robust}, we plot the decomposition of the robust error in standard error and susceptibility for adversarial logistic regression with increasing $\eps_{\text{tr}}$. We observe that increasing $\eps_{\text{tr}}$ increases the standard error too drastically compared to the decrease in susceptibility, leading to an effective drop in robust accuracy. For completeness, in Appendix \ref{app:susc}, we provide upper and lower bounds for the susceptibility score. We now explain why, in the small-sample size regime, adversarial training with directed attacks\xspace ~\eqref{eq:linfmaxpert} may increase standard error to the extent that it dominates the decrease in susceptibility. A key observation is that the robust max-$\ell_2$-margin solution of a dataset $D= \{(x_i, y_i)\}_{i=1}^n$ maximizes the minimum margin that reads ${\min_{i\in [n]} y_i \theta^\top (x_i - y_i \eps_{\text{tr}} |\thetaind{1}| e_1)}$, where $\indof{\theta}{i}$ refers to the $i$-th entry of vector $\theta$. Therefore, it simply corresponds to the max $\ell_2$-margin solution of the dataset shifted towards the decision boundary ${D_{\epstrain} = \{(x_i - y_i \eps_{\text{tr}} |\indof{\thetahat{\eps_{\text{tr}}}}{1}| e_1, y_i)\}_{i=1}^n}$. Using this fact, we obtain a closed-form expression of the (normalized) max-margin solution~\eqref{eq:maxmargin} as a function of $\eps_{\text{tr}}$ that reads \begin{equation} \label{eq:maxmarginmaintext} \thetahat{\eps_{\text{tr}}} = \frac{1}{(r-2\eps_{\text{tr}})^2 + 4 \tilde{\gamma}^2} \left[r - 2\eps_{\text{tr}}, 2 \tilde{\gamma} \tilde{\theta} \right], \end{equation} where $\|\tilde{\theta}\|_2 = 1$ and $\tilde{\gamma} >0$ is a random quantity associated with the max-$\ell_2$-margin solution of the $d-1$ dimensional Gaussian inputs orthogonal to the signal direction (see Lemma~\ref{lem:maxmargin} in Section~\ref{sec:app_theorylinear}). In high dimensions, with high probability any two Gaussian random vectors are far apart -- in our distributional setting, this corresponds to the vectors being far apart in the non-signal directions. In Figure~\ref{fig:2D_dataset_intuition}, we illustrate the phenomenon using a simplified 2D cartoon, where the few samples in the dataset are all far apart in the non-signal direction. We see how shifting the dataset closer to the true decision boundary, may result in a max-margin solution (yellow) that aligns much worse with the ground truth (gray), compared to the estimator learned from the original points (blue). Even though the new (robust max-margin) classifier (yellow) is less susceptible to directed attacks in the signal dimension, it also uses the signal dimension less. Mathematically, this is directly reflected in the expression of the max-margin solution in Equation~\eqref{eq:maxmarginmaintext}: Even without the definition of $\tilde{\gamma}, \tilde{\theta}$, we can directly see that the first (signal) dimension is used less as $\eps_{\text{tr}}$ increases. \subsection{Generality of the results} In this section we discuss how the theorem might generalize to other perturbation sets, models and training procedures. \paragraph{Signal direction is known} The type of additive perturbations used in Theorem~\ref{thm:linlinf}, defined in Equation~\eqref{eq:linfmaxpert}, is explicitly constrained to the direction of the true signal. This choice is reminiscent of corruptions where every possible perturbation in the set is directly targeted at the object to be recognized, such as motion blur of moving objects. Such corruptions are also studied in the context of domain generalization and adaptation \cite{Schneider20}. Directed attacks\xspace in general, however, may also consist of perturbation sets that are only strongly biased towards the true signal direction, such as mask attacks. They may find the true signal direction only when the inner maximization is exact. The following corollary extends Theorem~\ref{thm:linlinf} to small $\ell_1$-perturbations \begin{equation} \label{eq:l1maxpert} \pertset{x}{\epsilon} = \{x'=x+\delta \mid \|\delta\|_1 \leq \epsilon\}, \end{equation} for $0<\epsilon<\frac{r}{2}$ that reflect such attacks. We state the corollary here and give the proof in Appendix \ref{sec:app_theorylinear}. \begin{corollary} \label{cor:l1extension} Theorem~\ref{thm:linlinf} also holds for ~\eqref{eq:maxmargin} with perturbation sets defined in \eqref{eq:l1maxpert}. \end{corollary} The proof uses the fact that the inner maximization effectively results in a sparse perturbation equivalent to the attack resulting from the perturbation set~\eqref{eq:linfmaxpert}. \paragraph{Other models} Motivated by the implicit bias results of (stochastic) gradient descent on the logistic loss, Theorem~\ref{thm:linlinf} is proven for the max-$\ell_2$-margin solution. We would like to conjecture that for the data distribution in Section \ref{sec:theoryresults}, adversarial training can hurt robust generalization also for other models with zero training error (\emph{interpolators} in short). For example, Adaboost is a widely used algorithm that converges to the max-$\ell_1$-margin classifier \cite{telgarsky13}. One might argue that for a sparse ground truth, the max-$\ell_1$-margin classifier should (at least in the noiseless case) have the right inductive bias to alleviate large bias in high dimensions. Hence, in many cases the (sparse) max-$\ell_1$-margin solution might align with the ground truth for a given dataset. However, we conjecture that even in this case, the \emph{robust} max-$\ell_1$-margin solution (of the dataset shifted towards the decision boundary) would be misled to choose a wrong sparse solution. This can be seen with the help of the cartoon illustration in Figure \ref{fig:2D_dataset_intuition}.
{'timestamp': '2022-03-07T02:03:06', 'yymm': '2203', 'arxiv_id': '2203.02006', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.02006'}
arxiv
\section{Method} We conduct our work according to the methodology used by~\cite{Mentis2014}. The examples presented in this paper come from the Champalimaud Foundation in Lisbon, PT~\cite{Zorzal2020}. At that site, we observed laparoscopic surgeries on one of the Foundation's surgical rooms and talked to surgeons before and after the procedures, who explained what was about to happen or what took place. Also, during the surgery, nurses provided insight into the several stages of the surgery, or what was happening at that time. We also had the opportunity to ask questions of the surgeons at appropriate moments during the surgery. Besides that, we video recorded for further analysis in addition to our field notes. A total of five (5) laparoscopic surgeries were observed for a total of approximately 10 hours. The observed cases included the surgical team is composed of mostly male members, with only one female surgeon in it, and their ages range from 34 to 42 years of age. During surgery, there are at least six people involved in the procedure A head surgeon, who coordinates the entire procedure, 1 or 2 assistant surgeons, who mostly observe but also participate in parts of the surgery, a nurse solely responsible for passing the surgeons tools they may require throughout the operation, an anesthetist keeping track of the patient's vital signs, a nurse supporting the anesthetist and a circulating nurse. Additionally, a senior surgeon may come in and serve as an advisor, providing insight and making remarks about what is being seen on camera. \bgroup We collected images and videos using smartphones and tablets, as well as the notes made during the observations. The inductive bottom-up approach to data analysis was used in which the authors analyzed their field notes and videos. The findings and the discussion are presented in the subsequent section. \section{Results and Discussion} Performing user and task analysis allowed us to better understand the existing problems in the procedure of laparoscopy, while identifying several constraints and design requirements, which a solution has to follow in order to address those problems. For the following, we will discuss the design requirements identified through the analysis. Problems statements, requirements, and the proposed design solutions also are summarized in Table~\ref{table:problem_requirements_solution}. \begin{table*}[htb] \caption{Problem statements, design requirements and design solution for a prototype that supports laparoscopy}\label{table:problem_requirements_solution} \begin{tabular}{|p{0.31\textwidth}|p{0.31\textwidth}|p{0.31\textwidth}|} \hline {\bfseries \small Problem Statements} & {\bfseries \small Design Requirements} & {\bfseries \small Design Solution}\\ \hline \small Visualizing the laparoscopic video during extended periods of time is exhausting for the neck. & \small The solution should allow the user to adopt more comfortable neck postures instead of forcing the user to look to the side to see what the other surgeons are seeing. & \small Following display: The laparoscopic video follows user head movement, so users can look around and assume a neck posture that is more comfortable for them. \\ \hline \small Current interactions surgeons have, such as pointing or consulting patient data, require them to let go of their tools, which interrupts the procedure. & \small Surgeons should have hands-free interactions in order to operate in an uninterrupted fashion. & \small Hands-free interaction: Every interaction is either done with the head or using the feet. \\ \hline \small Browsing patient data interoperatively takes too long because it requires to call in an assistant, who browses the images for the surgeon. & \small Users should be able to look at patient data by themselves, without interrupting and adding extra time to the surgery. & \small Patient data image browser: users can look to the side to see and browse magnetic resonance images from the patient. \\ \hline \small Users may have to move around the patient in order to adopt better positions to hold their tools. & \small Interaction using the foot should not rely on pedals, as these would need to be moved around to cope with user movement. & \small Foot browsing: Users can use the foot to navigate the patient images, rotating it on its heel to change images faster or slower. \\ \hline \small Pointing is unclear and ambiguous: different users have different interpretations of where a surgeon is pointing at. & \small Users should be able to point precisely and understand where other users are pointing at, regardless of position in the operating room. & \small Pointing reticle: users can place a reticle on both laparoscopic video and patient images, controlling it with head motion. This cursor is visible on other users’ headsets.\\ \hline \small Surgeons operate in a crowded area, as they are usually very close together. & \small Augmented space should present information close to the surgeon to prevent it from appearing intersected with a colleague. & \small Close quarters: Positioning of interface elements is no further than at an elbow's reach.\\ \hline \end{tabular} \end{table*} \subsection{Following display} Laparoscopy is an intensive process, not just mentally but physically as well. The procedure is already very demanding in itself due to surgeons having to expend extra mental effort thanks to a lack of hand-eye coordination that is caused by indirect visualization (Fig.~\ref{fig:neck}). That effort extends to the physical plane when we consider that they have look at the screen all the time, which places a continuous strain on their necks. Laparoscopy currently faces the glaring problem of monitor positioning. During surgery, screens are usually placed far away and at an uncomfortable angle, causing neck and eye strain over the course of a surgery, especially if it drags for longer periods of time. Given this, it was important to allow the surgeons some freedom in how they want to see the video, and then the video, while visible, should follow user head movements so users do not have to reposition it in the augmented space, should they feel the need to assume another posture with the neck. \begin{figure*}[!htbp] \centering \includegraphics[width=0.65\textwidth,keepaspectratio]{Figure_3.png} \caption{All doctors look to the same screen and, sometimes, this means having to assume an uncomfortable position. Visualizing the laparoscopic video during extended periods of time is exhausting for the neck.} \label{fig:neck} \end{figure*} The surgeons have to look at screens placed outside the field of operation, which results in discomfort~\cite{Batmaz2017}, affecting the surgeon's efficiency due to a disconnect between the visual and motor axis, because the surgeon cannot look at the instruments or hands and the field of surgery simultaneously. To be successful, more training is required to adapt to this condition, as extra mental effort must be applied~\cite{Leite2016}. In addition, almost all display screens are limited in sense that they do not support techniques to improve communication and visual collaboration with the rest of the surgical team~\cite{HenryFuchs1MarkA.Livingston1RameshRaskar1DnardoColucci11963,HMentis2019}. Muratore et al.~\cite{Muratore2007} suggest for the future, the ideal display system would be a 3D high definition image HMD, citing the comfort of looking at the endoscopic image in any preferred head position, improving ergonomics and reducing neck strain. The use of an HMD is also seen as beneficial in the sense that it alleviates equipment clutter in the operating room. It is further noted the usefulness of individualized image manipulation features like zooming, which allows each surgeon to see the endoscopic video in the way they find most comfortable. Also, the works of~\cite{Walczak2015,Maithel2005,Batmaz2017,Kihara2012} seem to support the usage of a HMD for laparoscopic surgery, with the video following the user’s head movements. With this, users can assume their preferred head position instead of being forced to look sideways in order to see the video. \subsection{Hands-free interaction} From our field observations, we noticed that surgeons place down their tools to perform some secondary tasks, which interrupts the procedure (Fig.~\ref{fig:losing}). We suggest that projects avoid this type of situation, with a completely hands-free approach, using both head gaze and foot movement as sources of input. \begin{figure*}[!bhtpb] \centering \includegraphics[width=1\textwidth,keepaspectratio]{Figure_4.png} \caption{Surgeons can't look at their hands, thus losing hand-eye coordination.} \label{fig:losing} \end{figure*} Other studies~\cite{Kim2017,Jayender} looked at using head movements, and gaze to select targets, especially when the content follows head movements~\cite{Grinshpoon}. A more elaborate approach takes the form of the eye gazing~\cite{Esteves2015,Velloso2016}, which was well-received by users, but may not transition well onto the surgical operating field: these controls would have to be displayed continuously and right in front of the user, unlike in the presented works, which could be distractive for users, but more importantly, it would take valuable space from the HMD's already limited field of view. In terms of feet, two different approaches emerge: using a foot pedal as a means to activate a selected control~\cite{Jayender} and using foot movement to select and activate controls~\cite{Muller2019}. After comparing the two, we conclude using foot movement would be a more flexible choice, as it does not rely on extra hardware that is situated in a given position in space. \subsection{Patient data image browser and foot browsing} Consulting patient data intra-operatively, such as MRIs and computed tomographies, may be unfeasible. On the one hand, the data are extensive and may require some time to identify the required set. On the other, surgeons must abandon the operating table to sit at a computer and browse the desired images. The surgeon then gives directions on where to look and when to stop while an assistant handles the computer. Surgeons usually do not browse the images themselves when sterilized. Indeed each interaction with non-sterile equipment such as the keyboard and mouse would entail a new sterilization procedure, wasting additional resources. This has been discussed in \cite{ohara-2014,Lopes-2019,Johnson2011}. This is a design opportunity for AR as discussed in \cite{Zorzal2019}. In the work of \cite{Muratore2007}, the authors emphasize the importance of the HMD, stating preoperative imaging could be individually manipulated through its use, as well as grant surgeons extra comfort by allowing them to see the laparoscopic image regardless of head positioning. Hands-free interaction is again considered, with the suggestion of using foot pedals instead. Also discussed is the issue of paradoxical imaging, which occurs when the camera faces the surgeon, causing movements with the tool to appear inverted compared to the hand movements. However, in an interview with the surgeons of the Champalimaud Foundation, this did not appear to be an issue, since the surgeon can move around the operating table, which ensures the camera always faces the opposite direction. This freedom to move around also impacts the practicality of using foot pedals to ensure hands-free interaction, as the authors suggest, as the surgeon would have to either have the same pedals on multiple sides, or move the pedals around. In this case, exploring foot movement, as proposed by \cite{Muller2019}, could be more useful \subsection{Pointing reticle and close quarters} Although they are close quarters, surgeons also currently face problems in communication. In fact, according to the inquired surgeons, just as they complain about difficulty in maintaining proper posture, so do they complain about not being able to let other surgeons know what part of the video they are pointing at, or to understand what others are pointing at as well. Several works have approached this by looking at proxemics \cite{Mentis2012} and embodied vision~\cite{Mentis2013}. \begin{figure*}[!htpb] \centering \includegraphics[width=0.65\textwidth,keepaspectratio]{Figure_6.png} \caption{Doctor point at the screen to communicate. Communication is unclear and ambiguous: different users have different interpretations of where a surgeon is pointing at.} \label{fig:pointing2} \end{figure*} The instructor can point at the screen for the other surgeons to understand what anatomical structure he/she is referring to and use gestures for others to understand the motion of the tools better and envision cutting lines. Sometimes, pointing can also be done with the tools themselves, but even though it may be effective, it is not always correct because if both hands are occupied, it implies letting go of a structure to point with the tool or asking someone else to hold it. Additionally, pointing from a distance with the hand is ambiguous at best, as there is no clear way to tell where precisely a surgeon is pointing at, as can be seen in Fig.~\ref{fig:pointing2}. For Prescher et al.~\cite{Prescher}, the impact of the pointer in a real operating scenario may be lessened because target selection is not random but rather contextual, meaning that the following targets may be located through the description of what is being displayed on-screen. Also, the pointer is embedded in the laparoscope. Thus the camera must be displaced to move the pointer, causing the view plane to change and forcing the surgeon to readjust to the new perspective, losing perceived depth. Therefore, it would be more useful if the cursor moved independently of the camera, controlled via gestures or head tracking for a hands-free approach, as suggested by 3D interactions performed above a table~\cite{mendes2014,mendes2016}. \section{Conclusion} This paper presents the requirements and design solutions for laparoscopy through a user and task analysis. During a task analysis, we map out the sequence of activities surgeons go through and the actions required to achieve that goal. Drawing on observations and analysis of video recordings of laparoscopic surgeries, we identify several constraints and design requirements, which a solution will have to follow in order to address those problems. These requirements propose to inform the design solutions towards improved surgeons' comfort and make the surgical procedure less laborious. \begin{comment} \section*{Summary points} \noindent \setlength{\fboxsep}{10pt} \fbox{\parbox{0.9\columnwidth}{\textbf{What is already known on the topic?} \begin{itemize} \setlength\itemsep{0pt} \item Laparoscopy suffers some problems that can cause the surgical procedure more laborious. \item A variety of different problems influence the performance of surgeons in laparoscopic procedures. \end{itemize} \textbf{What does this study add to our knowledge?} \begin{itemize} \setlength\itemsep{0pt} \item Identification of problems related to design for laparoscopy. \item Design requirements propose to inform the design solutions towards improved surgeons' comfort and make the surgical procedure less laborious. \end{itemize} }} \end{comment} \section*{Acknowledgments} This work was supported by national funds through FCT, Fundação para a Ciência e a Tecnologia, under project UIDB/50021/2020. The authors would like to thank the Champalimaud Foundation for its collaboration and support in the development of the study. \bibliographystyle{abbrv-doi} \section{Introduction} This template is for papers of VGTC-sponsored conferences which are \emph{\textbf{not}} published in a special issue of TVCG. \section{Using the Style Template} \begin{itemize} \item If you receive compilation errors along the lines of ``\texttt{Package ifpdf Error: Name clash, \textbackslash ifpdf is already defined}'' then please add a new line ``\texttt{\textbackslash let\textbackslash ifpdf\textbackslash relax}'' right after the ``\texttt{\textbackslash documentclass[journal]\{vgtc\}}'' call. Note that your error is due to packages you use that define ``\texttt{\textbackslash ifpdf}'' which is obsolete (the result is that \texttt{\textbackslash ifpdf} is defined twice); these packages should be changed to use ifpdf package instead. \item The style uses the hyperref package, thus turns references into internal links. We thus recommend to make use of the ``\texttt{\textbackslash autoref\{reference\}}'' call (instead of ``\texttt{Figure\~{}\textbackslash ref\{reference\}}'' or similar) since ``\texttt{\textbackslash autoref\{reference\}}'' turns the entire reference into an internal link, not just the number. Examples: \autoref{fig:sample} and \autoref{tab:vis_papers}. \item The style automatically looks for image files with the correct extension (eps for regular \LaTeX; pdf, png, and jpg for pdf\LaTeX), in a set of given subfolders (figures/, pictures/, images/). It is thus sufficient to use ``\texttt{\textbackslash includegraphics\{CypressView\}}'' (instead of ``\texttt{\textbackslash includegraphics\{pictures/CypressView.jpg\}}''). \item For adding hyperlinks and DOIs to the list of references, you can use ``\texttt{\textbackslash bibliographystyle\{abbrv-doi-hyperref-narrow\}}'' (instead of ``\texttt{\textbackslash bibliographystyle\{abbrv\}}''). It uses the doi and url fields in a bib\TeX\ entry and turns the entire reference into a link, giving priority to the doi. The doi can be entered with or without the ``\texttt{http://dx.doi.org/}'' url part. See the examples in the bib\TeX\ file and the bibliography at the end of this template.\\[1em] \textbf{Note 1:} occasionally (for some \LaTeX\ distributions) this hyper-linked bib\TeX\ style may lead to \textbf{compilation errors} (``\texttt{pdfendlink ended up in different nesting level ...}'') if a reference entry is broken across two pages (due to a bug in hyperref). In this case make sure you have the latest version of the hyperref package (i.\,e., update your \LaTeX\ installation/packages) or, alternatively, revert back to ``\texttt{\textbackslash bibliographystyle\{abbrv-doi-narrow\}}'' (at the expense of removing hyperlinks from the bibliography) and try ``\texttt{\textbackslash bibliographystyle\{abbrv-doi-hyperref-narrow\}}'' again after some more editing.\\[1em] \textbf{Note 2:} the ``\texttt{-narrow}'' versions of the bibliography style use the font ``PTSansNarrow-TLF'' for typesetting the DOIs in a compact way. This font needs to be available on your \LaTeX\ system. It is part of the \href{https://www.ctan.org/pkg/paratype}{``paratype'' package}, and many distributions (such as MikTeX) have it automatically installed. If you do not have this package yet and want to use a ``\texttt{-narrow}'' bibliography style then use your \LaTeX\ system's package installer to add it. If this is not possible you can also revert to the respective bibliography styles without the ``\texttt{-narrow}'' in the file name.\\[1em] DVI-based processes to compile the template apparently cannot handle the different font so, by default, the template file uses the \texttt{abbrv-doi} bibliography style but the compiled PDF shows you the effect of the \texttt{abbrv-doi-hyperref-narrow} style. \end{itemize} \section{Bibliography Instructions} \begin{itemize} \item Sort all bibliographic entries alphabetically but the last name of the first author. This \LaTeX/bib\TeX\ template takes care of this sorting automatically. \item Merge multiple references into one; e.\,g., use \cite{Max:1995:OMF,Kitware:2003} (not \cite{Kitware:2003}\cite{Max:1995:OMF}). Within each set of multiple references, the references should be sorted in ascending order. This \LaTeX/bib\TeX\ template takes care of both the merging and the sorting automatically. \item Verify all data obtained from digital libraries, even ACM's DL and IEEE Xplore etc.\ are sometimes wrong or incomplete. \item Do not trust bibliographic data from other services such as Mendeley.com, Google Scholar, or similar; these are even more likely to be incorrect or incomplete. \item Articles in journal---items to include: \begin{itemize} \item author names \item title \item journal name \item year \item volume \item number \item month of publication as variable name (i.\,e., \{jan\} for January, etc.; month ranges using \{jan \#\{/\}\# feb\} or \{jan \#\{-{}-\}\# feb\}) \end{itemize} \item use journal names in proper style: correct: ``IEEE Transactions on Visualization and Computer Graphics'', incorrect: ``Visualization and Computer Graphics, IEEE Transactions on'' \item Papers in proceedings---items to include: \begin{itemize} \item author names \item title \item abbreviated proceedings name: e.\,g., ``Proc.\textbackslash{} CONF\_ACRONYNM'' without the year; example: ``Proc.\textbackslash{} CHI'', ``Proc.\textbackslash{} 3DUI'', ``Proc.\textbackslash{} Eurographics'', ``Proc.\textbackslash{} EuroVis'' \item year \item publisher \item town with country of publisher (the town can be abbreviated for well-known towns such as New York or Berlin) \end{itemize} \item article/paper title convention: refrain from using curly brackets, except for acronyms/proper names/words following dashes/question marks etc.; example: \begin{itemize} \item paper ``Marching Cubes: A High Resolution 3D Surface Construction Algorithm'' \item should be entered as ``\{M\}arching \{C\}ubes: A High Resolution \{3D\} Surface Construction Algorithm'' or ``\{M\}arching \{C\}ubes: A high resolution \{3D\} surface construction algorithm'' \item will be typeset as ``Marching Cubes: A high resolution 3D surface construction algorithm'' \end{itemize} \item for all entries \begin{itemize} \item DOI can be entered in the DOI field as plain DOI number or as DOI url; alternative: a url in the URL field \item provide full page ranges AA-{}-BB \end{itemize} \item when citing references, do not use the reference as a sentence object; e.\,g., wrong: ``In \cite{Lorensen:1987:MCA} the authors describe \dots'', correct: ``Lorensen and Cline \cite{Lorensen:1987:MCA} describe \dots'' \end{itemize} \section{Example Section} Lorem\marginpar{\small You can use the margins for comments while editing the submission, but please remove the marginpar comments for submission.} ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua~\cite{Kitware:2003,Max:1995:OMF}. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est. \section{Exposition} Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat~\cite{Kindlmann:1999:SAG}. \begin{equation} \sum_{j=1}^{z} j = \frac{z(z+1)}{2} \end{equation} Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. \subsection{Lorem ipsum} Lorem ipsum dolor sit amet (see \autoref{tab:vis_papers}), consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. \begin{table}[tb] \caption{VIS/VisWeek accepted/presented papers: 1990--2016.} \label{tab:vis_papers} \scriptsize% \centering% \begin{tabu}{% r% *{7}{c}% *{2}{r}% } \toprule year & \rotatebox{90}{Vis/SciVis} & \rotatebox{90}{SciVis conf} & \rotatebox{90}{InfoVis} & \rotatebox{90}{VAST} & \rotatebox{90}{VAST conf} & \rotatebox{90}{TVCG @ VIS} & \rotatebox{90}{CG\&A @ VIS} & \rotatebox{90}{VIS/VisWeek} \rotatebox{90}{incl. TVCG/CG\&A} & \rotatebox{90}{VIS/VisWeek} \rotatebox{90}{w/o TVCG/CG\&A} \\ \midrule 2016 & 30 & & 37 & 33 & 15 & 23 & 10 & 148 & 115 \\ 2015 & 33 & 9 & 38 & 33 & 14 & 17 & 15 & 159 & 127 \\ 2014 & 34 & & 45 & 33 & 21 & 20 & & 153 & 133 \\ 2013 & 31 & & 38 & 32 & & 20 & & 121 & 101 \\ 2012 & 42 & & 44 & 30 & & 23 & & 139 & 116 \\ 2011 & 49 & & 44 & 26 & & 20 & & 139 & 119 \\ 2010 & 48 & & 35 & 26 & & & & 109 & 109 \\ 2009 & 54 & & 37 & 26 & & & & 117 & 117 \\ 2008 & 50 & & 28 & 21 & & & & 99 & 99 \\ 2007 & 56 & & 27 & 24 & & & & 107 & 107 \\ 2006 & 63 & & 24 & 26 & & & & 113 & 113 \\ 2005 & 88 & & 31 & & & & & 119 & 119 \\ 2004 & 70 & & 27 & & & & & 97 & 97 \\ 2003 & 74 & & 29 & & & & & 103 & 103 \\ 2002 & 78 & & 23 & & & & & 101 & 101 \\ 2001 & 74 & & 22 & & & & & 96 & 96 \\ 2000 & 73 & & 20 & & & & & 93 & 93 \\ 1999 & 69 & & 19 & & & & & 88 & 88 \\ 1998 & 72 & & 18 & & & & & 90 & 90 \\ 1997 & 72 & & 16 & & & & & 88 & 88 \\ 1996 & 65 & & 12 & & & & & 77 & 77 \\ 1995 & 56 & & 18 & & & & & 74 & 74 \\ 1994 & 53 & & & & & & & 53 & 53 \\ 1993 & 55 & & & & & & & 55 & 55 \\ 1992 & 53 & & & & & & & 53 & 53 \\ 1991 & 50 & & & & & & & 50 & 50 \\ 1990 & 53 & & & & & & & 53 & 53 \\ \midrule \textbf{sum} & \textbf{1545} & \textbf{9} & \textbf{632} & \textbf{310} & \textbf{50} & \textbf{123} & \textbf{25} & \textbf{2694} & \textbf{2546} \\ \bottomrule \end{tabu}% \end{table} \subsection{Mezcal Head} Lorem ipsum dolor sit amet (see \autoref{fig:sample}), consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. \subsubsection{Duis Autem} Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est. Lorem ipsum dolor sit amet. \begin{figure}[tb] \centering \includegraphics[width=\columnwidth]{paper-count-w-2015-new} \caption{A visualization of the 1990--2015 data from \autoref{tab:vis_papers}. The image is from \cite{Isenberg:2017:VMC} and is in the public domain.} \label{fig:sample} \end{figure} \subsubsection{Ejector Seat Reservation} Duis autem~\cite{Lorensen:1987:MCA}\footnote{The algorithm behind Marching Cubes \cite{Lorensen:1987:MCA} had already been described by Wyvill et al. \cite{Wyvill:1986:DSS} a year earlier.} vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat,\footnote{Footnotes appear at the bottom of the column.} vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. \paragraph{Confirmed Ejector Seat Reservation} Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat~\cite{Nielson:1991:TAD}. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. \paragraph{Rejected Ejector Seat Reservation} Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie \section{Conclusion} Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. \acknowledgments{ The authors wish to thank A, B, and C. This work was supported in part by a grant from XYZ.} \bibliographystyle{abbrv-doi}
{'timestamp': '2022-03-07T02:05:20', 'yymm': '2203', 'arxiv_id': '2203.02044', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.02044'}
arxiv
\subsection{Heterogeneous graph} \label{sec:preliminaries:hg} Heterogeneous graphs are an important abstraction for modeling the relational data of multi-modal systems. Formally, a heterogeneous graph is defined as $\mathcal{G} = (\mathcal{V}, \mathcal{E}, \mathcal{T}, \mathcal{R})$ where the node set $\mathcal{V}: = \{1,\ldots,|\mathcal{V}|\}$; the edge set $\mathcal{E}$ consisting of ordered tuples $e_{ij}:=(i, j)$ with $i, j\in\mathcal{V}$, where $e_{ij}\in\mathcal{E}$ iff an edge exists from $i$ to $j$; the set of node types $\mathcal{T}$ with associated map $\tau:\mathcal{V}\mapsto\mathcal{T}$; the set of relation types $\mathcal{R}$ with associated map $\phi:\mathcal{E}\mapsto\mathcal{R}$. This flexible formulation allows directed, multi-type edges. We additionally assume the existence of a node feature vector $x_i\in\mathcal{X}_{\tau(i)}$ for each $i\in\mathcal{V}$, where $\mathcal{X}_{t}$ is a feature space specific to nodes of type $t$ . This allows $\mathcal{G}$ to represent nodes with different feature modalities such as images, text, locations, or booleans. Note that these modalities are not necessarily exclusive (e.g.\ two node types $s,t$ might share the same feature space, $\mathcal{X}_s = \mathcal{X}_t$). \begin{figure*}[t!] \centering \vspace{-4mm} \subfigure[Toy graph] { \label{fig:toy:hg} \includegraphics[width=0.15\linewidth]{FIG/Toy_HG.png} } \hspace{10mm} \subfigure[Gradient path for feature extractor $f_s(\cdot)$] { \label{fig:toy:source_cg} \includegraphics[width=.26\linewidth]{FIG/Toy_CG_source.png} } \hspace{10mm} \subfigure[Gradient path for feature extractor $f_t(\cdot)$] { \label{fig:toy:target_cg} \includegraphics[width=.26\linewidth]{FIG/Toy_CG_target.png} } \caption { Illustration of a toy heterogeneous graph and the gradient paths for feature extractors $f_s$ and $f_t$. We see that the same HGNN nonetheless produces different feature extractors for each feature domain $\mathcal{X}_s$ and $\mathcal{X}_t$. Colored arrows in figures (b) and (c) show the gradient paths for feature domains $\mathcal{X}_s$ and $\mathcal{X}_t$, respectively. Note the over-emphasis of the respective gradients in the (b) source and (c) target feature extractors, which can lead to poor generalization. } \label{fig:toy} \end{figure*} \begin{figure*}[t!] \centering \subfigure[Test accuracy across various feature extractors] { \label{fig:toy_exp:accuracy} \includegraphics[width=0.32\linewidth]{FIG/Micro_accuracy.png} } \hspace{5mm} \subfigure[L2 norms of gradients of $W_{\tau(\cdot)}^{(l)}$] { \label{fig:toy_exp:transform_w} \includegraphics[width=.28\linewidth]{FIG/Transform_w.png} } \hspace{5mm} \subfigure[L2 norms of gradients of $M_{\phi(\cdot)}^{(l)}$] { \label{fig:toy_exp:message_w} \includegraphics[width=.28\linewidth]{FIG/Message_w.png} } \caption { HGNNs trained on a source domain underfit a target domain and perform poorly on a ``nice" heterogeneous graph. Our theoretically-induced version of \textsc{HGNN-KTN}\xspace adapts the model to the target domain successfully. In (a) we see performance on the simulated heterogeneous graph, for 4 kinds of feature extractors; (\textit{source}: source extractor $f_s$ on source domain, \textit{target-src-path}: $f_s$ on target domain, \textit{target-org-path}: target extractor $f_t$ on target domain, and \textit{theoretical-KTN}: $f_t$ on target domain using \textsc{HGNN-KTN}\xspace.) In (b-c), here L2 norms of gradients of parameters $W_{\tau(\cdot)}$ and $M_{\phi(\cdot)}$ in HGNN models. } \label{fig:toy_exp} \end{figure*} \subsection{Heterogeneous GNNs} \label{sec:preliminaries:hgnn} A graph neural network (GNN) can be regarded as a graph encoder which uses the input graph data as the basis for the neural network's computation graph \cite{chami2020machine}. At a high-level, for any node $j$, the embedding of node $j$ at the $l$-\emph{th} GNN layer is obtained with the following generic formulation: \begin{equation}\label{eq:gnn} \small h_j^{(l)} = \textbf{Transform}^{(l)}\left(\textbf{Aggregate}^{(l)}(\mathcal{E}(j))\right) \end{equation} where $\mathcal{E}(j) = \{(i, k)\in\mathcal{E}: i,k\in\mathcal{V}, k = j\}$ denotes all the edges which connect (directionally) to $j$. HGNNs are a recently-introduced class of GNNs for modeling heterogeneous graphs. For HGNNs, the above operations typically involve type-specific parameters to exploit the inherent multiplicity of modalities in heterogeneous graphs. We now define the commonly-used versions of \textbf{Aggregate} and \textbf{Transform} for HGNNs, which we use throughout this paper. First, we define a linear \textbf{Message} function \begin{equation} \label{eq:message} \small \textbf{Message}^{(l)}(i, j) = M_{\phi((i, j))}^{(l)}\cdot \left(h_i^{(l-1)}\mathbin\Vert h_j^{(l-1)}\right) \end{equation} where $M_r^{(l)}$ are the specific message passing parameters for each $r\in\mathcal{R}$ and each of $L$ GNN layers. Then defining $\mathcal{E}_r(j)$ as the set of edges of type $r$ pointing to node $j$, our HGNN \textbf{Aggregate} function mean-pools messages by edge type, and concatenates: \begin{equation}\label{eq:aggregate} \small \textbf{Aggregate}^{(l)}(\mathcal{E}(j)) = \underset{r \in\mathcal{R}}{\mathbin\Vert}\tfrac{1}{|\mathcal{E}_r(j)|}\sum_{e\in\mathcal{E}_r(j)}\textbf{Message}^{(l)}(e) \end{equation} Finally, \textbf{Transform} maps the message into a type-specific latent space: \begin{equation}\label{eq:transform} \small \textbf{Transform}^{(l)}(j) = \alpha(W_{\tau(j)}\cdot\textbf{Aggregate}^{(l)}(\mathcal{E}(j))) \end{equation} The above formulation of HGNNs allows for full handling of the complexities of a real-world heterogeneous graph. By stacking HGNN blocks for $L$ layers, each node aggregates a larger proportion of nodes --- with different types and relations --- in the full graph, which generates highly contextualized node representations. The final node representations can be fed into another model to perform downstream heterogeneous network tasks, such as node classification or link prediction. \subsection{Feature extractors for a toy heterogeneous graph}\label{sec:motivation:feature_extractor} We first reason intuitively about the differences between $f_s(x_i)$ and $f_t(x_j)$ when $s\ne t$, using a toy heterogeneous graph shown in Figure~\ref{fig:toy:hg}. In that graph, consider nodes $v_1$ and $v_2$, noticing that $\tau(1)\ne \tau(2)$. Using Equations~\eqref{eq:message}-\eqref{eq:transform} from Section \ref{sec:preliminaries:hgnn}, for any $l\in\{0, \ldots, L-1\}$ we have \begin{equation}\label{eq:tpynode1} \small h_1^{(l)} = W_s^{(l)}\left[M_{ss}^{(l)}\left(h_3^{(l-1)}\mathbin\Vert h_1^{(l-1)}\right)\mathbin\Vert M_{ts}^{(l)}\left(h_2^{(l-1)}\mathbin\Vert h_1^{(l-1)}\right)\right] \end{equation} and \begin{equation}\label{eq:tpynode1} \small h_2^{(l)} = W_t^{(l)}\left[M_{st}^{(l)}\left(h_1^{(l-1)}\mathbin\Vert h_2^{(l-1)}\right)\mathbin\Vert M_{tt}^{(l)}\left(h_4^{(l-1)}\mathbin\Vert h_2^{(l-1)}\right)\right], \end{equation} where $h_j^{(0)} = x_j$. From these equations, we see that the features of nodes $v_1$ and $v_2$, which are of different types, are extracted using \emph{disjoint} sets of model parameters at each layer. In a 2-layer HGNN, this creates unique gradient backpropagation paths between the two node types, as illustrated in Figures~\ref{fig:toy:source_cg}-\ref{fig:toy:target_cg}. In other words, even though the same HGNN is applied to node types $s$ and $t$, the feature extractors $f_s$ and $f_t$ have different computational paths. Therefore they project node features into different latent spaces, and have different update equations during training. We study the consequences of this next. \subsection{Empirical gap between $f_s$ and $f_t$} \label{sec:motivation:experiments} Here we study the experimental consequences of the above observation via simulation. We first construct a synthetic graph extending the 2-type graph in Figure~\ref{fig:toy:hg} to have multiple nodes per-type, and multiple classes. Next, we include well-separated classes in both the graph and feature space, where edges and Euclidean node features are well-clustered within-type and within-class (more details available in Appendix~\ref{appendix:graph-generator:toy}). On such a well-separated graph, without considering the observation in Section~\ref{sec:motivation:feature_extractor}, there may seem to be no need for domain adaptation from $f_t$ to $f_s$. However, when we train the HGNN model solely on $s$-type nodes, as shown in Figure~\ref{fig:toy_exp:accuracy} we find the test accuracy for $s$-type nodes to be high ($90\%$) and the test accuracy for $t$-type nodes to be quite low ($25\%$). Now if instead we make the $t$-type nodes use the source feature extractor $f_s$, much more transfer learning is possible (${\sim}65\%$, orange line). This shows the performance drop mainly comes from the different feature extractors present in the HGNN model, and so domain adaptation on it can not be solved by simply matching data distributions. To analyze this phenomenon at the level of backpropagation, in Figures~\ref{fig:toy_exp:transform_w}-\ref{fig:toy_exp:message_w} we show the magnitude of gradients passed to parameters of source and target node types. As we intuited in Section~\ref{sec:motivation:feature_extractor}, and as illustrated in Figures~\ref{fig:toy:source_cg}-\ref{fig:toy:target_cg}, we find that the final-layer \textbf{Transform} parameter $W^{(2)}_t$ for type-$t$ nodes have zero gradients (Figure~\ref{fig:toy_exp:transform_w}), and similarly for the final-layer \textbf{Message} parameters (Figure~\ref{fig:toy_exp:message_w}). Additionally, those same parameters in the first-layer for $t$-type nodes have much smaller gradients than their $s$-type counterparts: $W^{(1)}_{t}$ (blue line in Figure~\ref{fig:toy_exp:transform_w}), $M^{(1)}_{st}$ and $M^{(1)}_{tt}$ (blue and orange lines in Figure~\ref{fig:toy_exp:message_w}) appear below than other lines. This is because they contribute to $f_s$ less than $f_t$ \subsection{Relationship between feature extractors in HGNNs} \label{sec:motivation:theoretical_analysis} The case study introduced in Section~\ref{sec:motivation:experiments} shows that even when an HGNN is trained on a relatively simple, balanced, and class-separated heterogeneous graph, a model trained only on the source domain node type cannot transfer to the target domain node type. Here, to rigorously describe this phenomenon and the intuition behind it, we derive a strict transformation between $f_s$ and $f_t$, which will motivate the core domain adaptation component of \textsc{HGNN-KTN}\xspace. The following theorem assumes an HGNN as in Equations \eqref{eq:message}-\eqref{eq:transform} without skip-connections, a simplification which we define and explain along with the proof in the Appendix: \begin{theorem}\label{theorem} Given a heterogeneous graph $\mathcal{G} = \{\mathcal{V}, \mathcal{E}, \mathcal{T}, \mathcal{R}\}$. For any layer $l>0$, define the set of $(l-1)$-\emph{th} layer HGNN parameters as \begin{equation} \label{eq:thm} \small \mathcal{Q}^{(l-1)} = \{M_r^{(l-1)}: r\in\mathcal{R}\}\cup\{W_t^{(l-1)}: t\in\mathcal{T}\}. \end{equation} Let $A$ be the total $n\times n$ adjacency matrix. Then for any $s,t\in\mathcal{T}$ there exist matrices $A_{ts}^\ast = a_{ts}(A)$ and $Q_{ts}^\ast = q_{ts}(\mathcal{Q}^{(l-1)})$ such that \begin{equation} \label{eq:relationship} \small H_s^{(l)} = A_{ts}^\ast H_t^{(l)} Q_{ts}^\ast \end{equation} where $a_{ts}(\cdot)$ and $q_{ts}(\cdot)$ are matrix functions that depend only on $s,t$. \end{theorem} The full proof of Theorem 1 can be found in Appendix \ref{appendix:theorem1}. Notice how in Equation~\ref{eq:relationship}, $Q_{ts}^{\ast}$ acts as a macro- $\textbf{Message}/\textbf{Transform}$ operator that maps $H^{(L)}_t$ into the source domain, then $A_{ts}^{\ast}$ aggregates the mapped embeddings into $s$-type nodes. To examine the implications of Theorem~\ref{theorem}, we run the same experiment as described in Section~\ref{sec:motivation:experiments}, while this time mapping the target features $H^{(L)}_t$ into the source domain by multiplying with $Q_{ts}^{\ast}$ in Equation~\ref{eq:relationship} before passing over to a task classifier. We see via the red line in Figure~\ref{fig:toy_exp:accuracy} that, with this mapping, the accuracy in the target domain becomes much closer to the accuracy in the source domain (${\sim}70\%$). Thus, we use this theoretical transformation as a foundation for our trainable HGNN domain adaptation module, introduced in the following section. \subsection{Algorithm} \label{sec:matching_loss:algorithm} We minimize a classification loss $\mathcal{L}_{\text{CL}}$ and a transfer loss $\mathcal{L}_{\text{KTN}}$ jointly with regard to a HGNN model $\textbf{f}$, a classifier $\textbf{g}$, and a knowledge transfer network $\textbf{t}_{\text{KTN}}$ as follows: \begin{align*} \small \underset{\textbf{f},~\textbf{g},~\textbf{t}_{\text{KTN}}}{min}\mathcal{L}_{\text{CL}}(\textbf{g}(\textbf{f}(X_{s})), Y_{s}) + \lambda \left\|\textbf{f}(X_{s}) - \textbf{t}_{\text{KTN}}(\textbf{f}(X_{t}))\right\|_{2} \end{align*} where $\lambda$ is a hyperparameter regulating the effect of $\mathcal{L}_{\text{KTN}}$. Algorithm~\ref{alg:train} describes a training step with a minibatch. After computing the node embeddings $H^{(L)}_s, H^{(L)}_t$ using a HGNN model $\textbf{f}$, we map $H^{(L)}_t$ to the source domain using $\textbf{t}_{\text{KTN}}$ and compute $\mathcal{L}_{\text{KTN}}$. Finally, we update the models using gradients of $\mathcal{L}_{\text{CL}}$ and $\mathcal{L}_{\text{KTN}}$. Algorithm~\ref{alg:test} describes the test phase on the target domain. After we get node embeddings $H^{(L)}_t$ from the trained HGNN model $\textbf{f}$, we map $H^{(L)}_t$ into the source domain using the trained transformation matrix $T_{ts}$. Finally we pass the transformed target embeddings $H^{*}_t$ into the classifier $\textbf{g}$ which was trained on the source domain. \noindent \textbf{Indirect Connections} We note that in practice, the source and target node types can be indirectly connected in heterogeneous graphs via other node types. Appendix~\ref{appendix:indirect} describes how we can easily extend \textsc{HGNN-KTN}\xspace to cover domain adaption scenarios in this case. \subsection{Datasets} \label{sec:experiments:dataset} \noindent \textbf{Open Academic Graph (OAG).}~ A dataset introduced in \cite{zhang2019oag} composed of five types of nodes: papers, authors, institutions, venues, fields and their corresponding relationships. Paper and author nodes have text-based attributes, while institution, venue, and field nodes have text- and graph structure-based attributes. Paper, author, and venue nodes are labeled with research fields in two hierarchical levels, L1 and L2. To test the generalization of the proposed model, we construct three field-specific subgraphs from OAG: computer science, computer networks, and machine learning academic graphs. \vspace{-5pt} \noindent \textbf{PubMed.} A network of genes, diseases, chemicals, and species \citep{yang2020heterogeneous}, which has 11 types of edges. Gene and chemical nodes have graph structure-based attributes, while disease and species nodes have text-based attributes. Each gene or disease is labeled with a set of diseases they belong to or cause. \vspace{-5pt} \noindent \textbf{Synthetic heterogeneous graphs.} We generate stochastic block models \citep{abbe2017community} with multiple classes and multiple node types. We control within-type edge signal-to-noise ratio by within/between-class edge probabilities, and multivariate Normal feature signal-to-noise ratio by within/between-class variance. We also control \emph{between}-type edge signal-to-noise ratio by allowing nodes of the different types to connect if they are in the same class. A complete definition of the generative model is given in Appendix~\ref{appendix:graph-generator}. \subsection{Baselines} \label{sec:experiments:baseline} We compare \textsc{HGNN-KTN}\xspace with two MMD-based DA methods (DAN~\cite{long2015learning}, JAN~\cite{long2017deep}), three adversarial DA methods (DANN~\cite{ganin2016domain}, CDAN~\cite{long2017conditional}, CDAN-E~\cite{long2017conditional}), one optimal transport-based method (WDGRL~\cite{shen2018wasserstein}), and two traditional graph mining methods (LP and EP~\cite{zhu2005semi}). For DA methods, we use a HGNN model as their feature extractors. More information of each method is described in Appendix~\ref{appendix:baseline}. \begin{table*}[] \caption{ \textbf{Open Academic Graph on Computer Network field} } \label{tab:oag:cn} \centering \small \begin{tabular}{l|l|c|cc|ccc|c|cc|r} \toprule\hline \textbf{Task} & \textbf{Metric} & \textbf{Source} & \textbf{DAN} & \textbf{JAN} & \textbf{DANN} & \textbf{CDAN} & \textbf{CDAN-E} & \textbf{WDGRL} & \textbf{LP} & \textbf{EP} & \textbf{KTN (gain)} \\ \hline\midrule \multirow{2}{*}{\textbf{P-A (L2)}} & \textbf{NDCG} & 0.331 & 0.344 & o.o.m & 0.335 & o.o.m & o.o.m & 0.287 & 0.221 & 0.270 & \textbf{0.382 (16$\%$)} \\ & \textbf{MRR} & 0.250 & 0.277 & o.o.m & 0.280 & o.o.m & o.o.m & 0.199 & 0.130 & 0.270 & \textbf{0.360 (44$\%$)} \\ \hline \multirow{2}{*}{\textbf{A-P (L2)}} & \textbf{NDCG} & 0.313 & 0.290 & o.o.m & 0.250 & 0.234 & 0.168 & 0.266 & 0.114 & 0.319 & \textbf{0.364 (17$\%$)} \\ & \textbf{MRR} & 0.250 & 0.233 & o.o.m & 0.130 & 0.116 & 0.051 & 0.212 & 0.038 & 0.296 & \textbf{0.368 (47$\%$)} \\ \hline \multirow{2}{*}{\textbf{A-V (L2)}} & \textbf{NDCG} & 0.539 & 0.521 & 0.519 & 0.510 & 0.467 & 0.362 & 0.471 & 0.232 & 0.443 & \textbf{0.567 (5$\%$)} \\ & \textbf{MRR} & 0.584 & 0.528 & 0.461 & 0.510 & 0.293 & 0.294 & 0.365 & 0.000 & 0.406 & \textbf{0.628 (8$\%$)} \\ \hline \multirow{2}{*}{\textbf{V-A (L2)}} & \textbf{NDCG} & 0.256 & 0.343 & 0.345 & 0.265 & 0.328 & 0.316 & 0.263 & 0.133 & 0.119 & \textbf{0.348 (33$\%$)} \\ & \textbf{MRR} & 0.117 & 0.296 & 0.286 & 0.151 & 0.285 & 0.275 & 0.147 & 0.000 & 0.000 & \textbf{0.296 (141$\%$)} \\ \hline \bottomrule \end{tabular} \normalsize \end{table*} \begin{table*}[] \caption{ \textbf{Open Academic Graph on Machine Learning field} } \label{tab:oag:ml} \centering \small \begin{tabular}{l|l|c|cc|ccc|c|cc|r} \toprule\hline \textbf{Task} & \textbf{Metric} & \textbf{Source} & \textbf{DAN} & \textbf{JAN} & \textbf{DANN} & \textbf{CDAN} & \textbf{CDAN-E} & \textbf{WDGRL} & \textbf{LP} & \textbf{EP} & \textbf{KTN (gain)} \\ \hline\midrule \multirow{2}{*}{\textbf{P-A (L2)}} & \textbf{NDCG} & 0.268 & 0.290 & o.o.m & 0.291 & o.o.m & 0.249 & 0.232 & 0.272 & 0.215 & \textbf{0.318 (19$\%$)} \\ & \textbf{MRR} & 0.134 & 0.220 & o.o.m & 0.222 & o.o.m & 0.095 & 0.098 & 0.195 & 0.143 & \textbf{0.269 (102$\%$)} \\ \hline \multirow{2}{*}{\textbf{A-P (L2)}} & \textbf{NDCG} & 0.261 & 0.225 & o.o.m & 0.234 & 0.228 & 0.241 & 0.241 & 0.119 & 0.267 & \textbf{0.319 (22$\%$)} \\ & \textbf{MRR} & 0.207 & 0.127 & o.o.m & 0.155 & 0.152 & 0.095 & 0.182 & 0.035 & 0.214 & \textbf{0.287 (39$\%$)} \\ \hline \multirow{2}{*}{\textbf{A-V (L2)}} & \textbf{NDCG} & 0.465 & 0.493 & 0.463 & 0.477 & 0.408 & 0.422 & 0.393 & 0.224 & 0.424 & \textbf{0.538 (16$\%$)} \\ & \textbf{MRR} & 0.469 & 0.542 & 0.537 & 0.519 & 0.412 & 0.240 & 0.213 & 0.001 & 0.391 & \textbf{0.632 (35$\%$)} \\ \hline \multirow{2}{*}{\textbf{V-A (L2)}} & \textbf{NDCG} & 0.252 & 0.293 & 0.292 & 0.237 & 0.242 & 0.255 & 0.250 & 0.137 & 0.119 & \textbf{0.302 (20$\%$)} \\ & \textbf{MRR} & 0.131 & 0.212 & 0.199 & 0.086 & 0.085 & 0.129 & 0.118 & 0.000 & 0.000 & \textbf{0.227 (73$\%$)} \\ \hline\bottomrule \end{tabular} \normalsize \end{table*} \subsection{Zero-shot domain adaptation} \label{sec:experiments:zero-shot} We run $18$ different zero-shot domain adaptation tasks across three OAG and PubMed graphs. Each heterogeneous graph has node classification tasks for both source and target node types. Only source node types have labels, while target node types have none during training. The performance is evaluated by NDCG and MRR --- widely adopted ranking metrics~\cite{hu2020heterogeneous, hu2020gpt}. In Tables~\ref{tab:oag:cs},~\ref{tab:pubmed},~\ref{tab:oag:cn}, and~\ref{tab:oag:ml}, our proposed method \textsc{HGNN-KTN}\xspace consistently outperforms all baselines on all tasks and graphs by up to $73.3\%$ higher in MRR (P-A(L1) task in OAG-CS, Table \ref{tab:oag:cs}). When we compare with the original accuracy possible using the model pretrained on the source domain without any domain adaptation ($3$rd column, \textit{Source}), the results are even more impressive. Here we see our method \textsc{HGNN-KTN}\xspace provides relative gains of up to $340\%$ higher MRR without using any labels from the target domain. These results show the clear effectiveness of \textsc{HGNN-KTN}\xspace on zero-shot domain adaptation tasks on a heterogeneous graph. We note that in OAG graphs, the paper and author node types have different modalities (text and graph embeddings), and in the PubMed graph, disease and gene node types have different modalities (text and graph embeddings). In all cases, \textsc{HGNN-KTN}\xspace still transfers knowledge successfully while all baselines show poor performance even between domains of the same modalities (as they do not consider different feature extractors in HGNN models). Finally, we mention that venue and author node types are not directly connected in the OAG graphs (Figure~\ref{fig:schema1:oag}), but \textsc{HGNN-KTN}\xspace successfully transfer knowledge by passing the intermediate nodes. \noindent \textbf{Baseline Performance.} \label{sec:experiments:zero-shot-analysis} Among baselines, MMD-based models (DAN and JAN) outperform adversarial based methods (DANN, CDAN, and CDAN-E) and optimal transport-based method (WDGRL), unlike results reported in~\cite{long2017conditional, shen2018wasserstein}. These reversed results are a consequence of HGNN's unique feature extractors for source and target domains. DANN and CDAN define their adversarial losses as a cross entropy loss ($\mathbb{E}[log\textbf{f}_s(x_s)] - \mathbb{E}[log\textbf{f}_t(x_t)]$) where gradients of the subloss $\mathbb{E}[log\textbf{f}_s(x_s)]$ computed from the source feature extractor $f_s(x_s)$ are passed only back to $\textbf{f}_s(x_s)$, while gradients of the subloss $\mathbb{E}[log\textbf{f}_t(x_t)]$ computed from the target feature extractor $\textbf{f}_t(x_t)$ are passed only back to $\textbf{f}_t(x_t)$. Importantly, source and target feature extractors do not share any gradient information, resulting in divergence. This did not occur in their original test environments where source and target domains share a single feature extractor. Similarly, WDGRL measures the first-order Wasserstein distance as an adversarial loss, which also brings the same effect as the cross-entropy loss we described above, leading to divergent gradients between source and target feature extractors. On the other hand, DAN and JAN define a loss in terms of higher-order MMD between source and target features. Then the gradients of the loss passed to each feature extractor contain both source and target feature information, resulting in a more stable gradient estimation. This shows again the importance of considering different feature extractors in HGNNs. More analysis can be found in Appendix~\ref{appendix:analysis} \begin{figure}[t!] \centering \includegraphics[width=0.7\linewidth]{FIG/synthetic-legend.png} \\ \subfigure[Edge probability (easy)] { \label{fig:2-type-simple:edge} \includegraphics[width=0.47\linewidth]{FIG/2type-simple-edge.png} } \subfigure[Feature distribution (easy)] { \label{fig:2-type-simple:feat} \includegraphics[width=.47\linewidth]{FIG/2type-simple-feat.png} } \subfigure[Edge probability (hard)] { \label{fig:2-type-hard:edge} \includegraphics[width=0.47\linewidth]{FIG/2type-hard-edge.png} } \subfigure[Feature distribution (hard)] { \label{fig:2-type-hard:feat} \includegraphics[width=.47\linewidth]{FIG/2type-hard-feat.png} } \caption { Effects of edge probabilities and feature distributions across classes and types in $2$-node type heterogeneous graphs. } \label{fig:2-type} \end{figure} \subsection{Sensitivity analysis} \label{sec:experiments:sensitivity} \newcommand{\sigma_e}{\sigma_e} \newcommand{\sigma_f}{\sigma_f} Using our synthetic heterogeneous graph generator described in Section \ref{sec:experiments:dataset}, we generate non-trivial 2-type heterogeneous graphs to examine how the feature and edge distributions of heterogeneous graphs affect the performance of \textsc{HGNN-KTN}\xspace and other baselines. We generate a \emph{range} of test-case scenarios by manipulating (1) signal-to-noise ratio $\sigma_e$ of within-class edge probability and (2) signal-to-noise ratio $\sigma_f$ of within-class feature distributions (details in Appendix~\ref{appendix:graph-generator}) across all of the (a) source-source ($s\leftrightarrow s$), (b) target-target ($t\leftrightarrow t$), and (c) source-target ($s\leftrightarrow t$) relationships. A higher signal-to-noise ratio for a particular data dimension (edges vs features) across a particular relationship $r\in \{s\leftrightarrow s,\ t\leftrightarrow t,\ s\leftrightarrow s\}$ means that classes are more \emph{separable} in that data dimension, when comparing within $r$, and hence easier for HGNNs. Note that while tuning one $\sigma$ on the range $[1.0, 10.0]$ for one of the six $(\sigma, r)$ pairs, the $\sigma$ in all five other pairs are held at $10.0$. Additionally, we vary $\sigma$ across two scenarios: (I) ``easy": source and target node types have same number of classes and same feature dimensions, (II) ``hard" source and target node types have different number of classes and feature dimensions. At each unique value of $\sigma$ across the six ($\sigma, r$) pairs, we generate 5 heterogeneous graphs, train HGNN-KTN and other DA baselines using source class labels, and test using target class labels. The findings from our synthetic data study are shown in Figure~\ref{fig:2-type}. Figures~\ref{fig:2-type-simple:edge} and \ref{fig:2-type-hard:edge} show results from changing $\sigma_e$ across the three relation types. We see that \textsc{HGNN-KTN}\xspace is affected only by $\sigma_e$ across the $s\leftrightarrow t$ relationship, which accords with our theory, since \textsc{HGNN-KTN}\xspace exploits the between-type computation (adjacency) matrix. Surprisingly, as seen in Figures~\ref{fig:2-type-simple:feat} and \ref{fig:2-type-hard:feat}, we do not find a similar dependence of \textsc{HGNN-KTN}\xspace on $\sigma_f$, which shows that \textsc{HGNN-KTN}\xspace is robust by learning purely from edge homophily in the absence of feature homophily. This robustness is a result of our theoretically-motivated formulation of KTN, allowing the full expressivity of HGNNs within the transfer-learning task. Regarding the performance of other baselines, EP shows similar tendencies as \textsc{HGNN-KTN}\xspace --- only affected by cross-type $\sigma_e$ --- because EP also relies on cross-type propagation along edges. However, its accuracy is bounded above due to the fact that it does not model or propagate the (unlabelled) target features. DAN and DANN, which do not exploit cross-type edges, are not affected by cross-type $\sigma_e$. However, they show either low or unstable performance across different scenarios. DAN shows especially poor performance in the ``hard" scenarios (Figure~\ref{fig:2-type-hard:edge} and~\ref{fig:2-type-hard:feat}), failing to deal with different feature spaces for source and target domains. \begin{table}[] \caption{ \textbf{Different types of HGNNs:} sharing more parameters does not improve domain adaptation. } \label{tab:hgnn-type} \centering \small \begin{tabular}{l|l|ll|ll} \toprule \hline \multirow{2}{*}{\textbf{Task}} & \multirow{2}{*}{\textbf{Model}} & \multicolumn{2}{c|}{\textbf{NDCG}} & \multicolumn{2}{c}{\textbf{MRR}} \\ & & \textbf{Source} & \textbf{Target} & \textbf{Source} & \textbf{Target} \\ \hline \multirow{3}{*}{\textbf{\begin{tabular}[c]{@{}l@{}}P-A\\ (L1)\end{tabular}}} & HGNN-v1 & 0.634 & 0.564 & 0.604 & 0.519 \\ & HGNN-v2 & 0.794 & 0.613 & 0.788 & 0.617 \\ & HGNN & 0.792 & 0.623 & 0.785 & 0.629 \\ \hline \multirow{3}{*}{\textbf{\begin{tabular}[c]{@{}l@{}}A-V\\ (L1)\end{tabular}}} & HGNN-v1 & 0.675 & 0.568 & 0.690 & 0.543 \\ & HGNN-v2 & 0.69 & 0.669 & 0.695 & 0.687 \\ & HGNN & 0.689 & 0.671 & 0.693 & 0.698 \\ \hline \bottomrule \end{tabular} \normalsize \end{table} \subsection{Different types of HGNNs} \label{sec:experiments:hgnn-types} Using different parameters for each node and edge types in HGNNs result in different feature extractors for source and target node types. By sharing more parameters among node/edge types, could we see domain adaptation effect? Here, we design two variants of HGNNs. HGNN-v1 provides node-wise input layer that maps different modalities into the shared dimension then shares all the remaining parameters across nodes and layers. HGNN-v2 provides node-wise transformation matrices and edge-wise message matrices, but sharing them across layers. In Table~\ref{tab:hgnn-type}, HGNN-v1 shows lower accuracy for both source and target node types. More parameters specialized to each node/edge types, HGNN models show higher accuracy on source domain, thus higher performance could be transferred to target domain. Regardless of HGNN model types, \textsc{HGNN-KTN}\xspace transfers knowledge between source and target node types consistently. \subsection{Effect of trade-off coefficient $\lambda$} \label{sec:experiments:lambda} We examine the effect of $\lambda$ on the domain adaptation performance. In Table~\ref{tab:lambda}, as $\lambda$ decreases, target accuracy decreases as expected. Source accuracy also sees small drops since $\mathcal{L}_{\text{KTN}}$ functions as a regularizer; by removing the regularization effect, source accuracy decreases. When $\lambda$ becomes large, both source and target accuracy drop significantly. Source accuracy drops since the effect of $\mathcal{L}_{\text{KTN}}$ becomes bigger than the classification loss $\mathcal{L}_{\text{CL}}$. Even the effect of transfer learning become bigger by having bigger $\lambda$, since the source accuracy which will be transferred to the target domain is low, the target accuracy is also low. Thus we set $\lambda$ to $1$ throughout the experiments. \begin{table}[] \caption{ \textbf{Effect of $\lambda$} } \label{tab:lambda} \centering \small \begin{tabular}{l|cccc} \toprule \hline \multicolumn{1}{c|}{\textbf{Task}} & \multicolumn{4}{c}{\textbf{P-A (L1)}} \\ \hline \multicolumn{1}{c|}{\textbf{Metric}} & \multicolumn{2}{c|}{\textbf{NDCG}} & \multicolumn{2}{c}{\textbf{MRR}} \\ \hline $\lambda$ & \textbf{source} & \multicolumn{1}{c|}{\textbf{target}} & \textbf{source} & \textbf{target} \\ \hline \midrule \textbf{$10^{-4}$} & 0.780 & \multicolumn{1}{c|}{0.587} & 0.772 & 0.595 \\ \textbf{$10^{-2}$} & 0.788 & \multicolumn{1}{c|}{0.58} & 0.779 & 0.576 \\ \textbf{$1$} & 0.792 & \multicolumn{1}{c|}{0.621} & 0.788 & 0.633 \\ \textbf{$10^{2}$} & 0.75 & \multicolumn{1}{c|}{0.617} & 0.757 & 0.623 \\ \textbf{$10^{4}$} & 0.143 & \multicolumn{1}{c|}{0.177} & 0.007 & 0.031 \\ \hline \midrule \multicolumn{1}{c|}{\textbf{Task}} & \multicolumn{4}{c}{\textbf{A-V (L1)}} \\ \hline \multicolumn{1}{c|}{\textbf{Metric}} & \multicolumn{2}{c|}{\textbf{NDCG}} & \multicolumn{2}{c}{\textbf{MRR}} \\ \hline \textbf{$\lambda$} & \textbf{source} & \multicolumn{1}{c|}{\textbf{target}} & \textbf{source} & \textbf{target} \\ \hline \midrule \textbf{$10^{-4}$} & 0.689 & \multicolumn{1}{c|}{0.626} & 0.690 & 0.642 \\ \textbf{$10^{-2}$} & 0.687 & \multicolumn{1}{c|}{0.654} & 0.689 & 0.677 \\ \textbf{$1$} & 0.689 & \multicolumn{1}{c|}{0.67} & 0.692 & 0.696 \\ \textbf{$10^{2}$} & 0.654 & \multicolumn{1}{c|}{0.644} & 0.659 & 0.668 \\ \textbf{$10^{4}$} & 0.411 & \multicolumn{1}{c|}{0.432} & 0.373 & 0.421 \\ \hline \bottomrule \end{tabular} \normalsize \end{table} \subsection{Proof of Theorem 1}\label{appendix:theorem1} The proof of Theorem \ref{theorem} is below. As stated in the assumptions of the theorem, we adopt a simplified version of our message-passing function that ignores the skip-connection: \begin{equation} \small \textbf{Message}^{(l)}(i, j) = M_{\phi(i,j)}^{(l)}h_i^{(j)}. \end{equation} This lets the Theorem match the experimental results shown in Figure \ref{fig:toy_exp}, as the HGNN trained in that experiment does not use skip-connections and hence represents an ``idealized" HGNN without skip-connections, and with a theoretically-exact KTN component. In the real experiments, we use (1) skip-connections, exploiting their usual benefits~\cite{hamilton2017inductive}, and (2) the trainable version of KTN. \begin{proof} Without loss of generality, we prove the result for the case where $\mathcal{R} = \{(s, t): s,t\in\mathcal{T}\}$, meaning the type of an edge is identified with the (ordered) types of the neighbor nodes. In other words, there is only one edge modality possible, such as a social networks with multiple node types (e.g.\ ``users", ``groups") but only one edge modality (``friendship"). In the case of multiple edge modalities (e.g. ``friendship" and ``message"), the result is extended trivially (though with more algebraically-dense forms of $a_{ts}$ and $q_{ts}$). Throughout this proof, we use the following notation for the set of all $j$-adjacent edges of relation type $r$: \begin{equation} \small \mathcal{E}_r(j):=\{(i,j): i\in\mathcal{V}, (i,j) = r\}. \end{equation} We write $A_{x_1x_2}$ to denote the sub-matrix of the total $n\times n$ adjacency matrix $A$ corresponding to node types $x_1,x_2\in\mathcal{T}$, and $\bar{A}_{x_1x_2}$ to denote the same matrix divided by its sum. $H_x^{(l)}$ is the (row-wise) $n_x\times d_l$ embedding matrix of $x$-type nodes at layer $l$. To begin, we first compute the $l$-\emph{th} output $g_j^{(l)}$ of the $\textbf{Aggregate}$ step defined for HGNNs in Equation \eqref{eq:aggregate}, for any node $j\in\mathcal{V}$ such that $\tau(j) = s$. The output of \textbf{Aggregate} is in fact a concatenation of edge-type-specific aggregations (see Equation~\ref{eq:aggregate}). Note that at most $T = |\mathcal{T}|$ elements of this concatenation are non-zero, since the node $j$ only participates in $T$ out of $T^2$ relation types in $\mathcal{R}$. Thus we can write $g_j^{(l)}$ as \begin{align*} \small g_j^{(l)} &= \underset{r\in\mathcal{R}}{\mathbin\Vert}\tfrac{1}{|\mathcal{E}_r(j)|}\sum_{e\in\mathcal{E}_r(j)}\textbf{Message}^{(l)}(e)\\ &= \underset{x\in\mathcal{T}}{\mathbin\Vert}\tfrac{1}{|\mathcal{E}_{xs}(j)|}\sum_{e\in\mathcal{E}_{xs}(j)}\textbf{Message}^{(l)}(e)\\ &=\underset{x\in\mathcal{T}}{\mathbin\Vert}\tfrac{1}{|\mathcal{E}_{xs}(j)|}\sum_{(i,j)\in\mathcal{E}_{xs}(j)}M_{xs}^{(l)}h_i^{(l-1)}\\ &=\underset{x\in\mathcal{T}}{\mathbin\Vert}\tfrac{1}{|\mathcal{E}_{xs}(j)|}M_{xs}^{(l)}\sum_{(i,j)\in\mathcal{E}_{xs}(j)}h_i^{(l-1)}\\ &=\underset{x\in\mathcal{T}}{\mathbin\Vert}M_{xs}^{(l)}\left(H_x^{(l-1)}\right)'\bar{A}_{xs}^{(j)}, \end{align*} where $\bar{A}_{xs}^{(j)}$ denotes the $j$-\emph{th} column of $\bar{A}_{xs}$. Notice that \begin{equation} \small h_j^{(l)} = \textbf{Transform}^{(l)}(j) = W_s^{(l)}g_j^{(l)}, \end{equation} and (again) at most $T$ elements of the concatenation $g_j^{(l)}$ are non-zero. Therefore let $W_{xs}^{(l)}$ be the columns of $W_s^{(l)}$ that select the concatenated element of $g_j^{(l)}$ corresponding to node type $x$. Then we can write \begin{equation} \small h_j^{(l)} = \sum_{x\in\mathcal{T}}W_{xs}^{(l)}M_{xs}^{(l)}\left(H_x^{(l-1)}\right)'\bar{A}_{xs}^{(j)}. \end{equation} \begin{algorithm}[t!] \caption{Test step for a target domain (indirect version)} \label{alg:test-extend} \begin{algorithmic}[1] \small \REQUIRE pretrained HGNN $\textbf{f}$, classifier $\textbf{g}$, \textsc{HGNN-KTN}\xspace $\textbf{t}_{\text{KTN}}$ \ENSURE target node label matrix $Y_t$ \STATE $H^{(L)}_t = \textbf{f}(H^{(0)} = X, \mathcal{G})$, $H^{*}_{t} = \textbf{0}$ \FOR{each meta-path $p = t \rightarrow s$} \STATE $x = t$, $Z = H^{(L)}_t$ \FOR{each node type $y \in p$} \STATE $X = ZT_{xy}$ \STATE $x = y$ \ENDFOR \STATE $H^{*}_{t} = H^{*}_{t} + Z$ \ENDFOR \RETURN $\textbf{g}(H^{*}_{t})$ \normalsize \end{algorithmic} \end{algorithm} Defining the operator $Q_{xs}^{(l)} := \left(W_{xs}^{(l)}M_{xs}^{(l)}\right)'$, this implies that \begin{align*} \small &H^{(l)}_s = \sum_{x\in\mathcal{T}}\bar{A}_{xs}H_x^{(l-1)}Q_{xs}^{(l)} \\ &= [\bar{A}_{x_{1}s},\ldots,\bar{A}_{x_{T}s}] \begin{bmatrix} H^{(l-1)}_{x_1} & 0 & 0\\ 0 & \ldots & 0\\ 0 & 0 & H^{(l-1)}_{x_T} \end{bmatrix} \begin{bmatrix} Q_{x_1s}^{(l-1)}\\ \ldots\\ Q_{x_Ts}^{(l-1)} \end{bmatrix} \\ & = \bar{A}_{\cdot s}H_{\cdot}^{(l-1)}Q_{\cdot s}^{(l-1)} \end{align*} Similarly we have $H^{(l)}_t = \bar{A}_{\cdot t}H_{\cdot}^{(l-1)}Q_{\cdot t}^{(l-1)}$. Since $H^{(l)}_s$ and $H^{(l)}_t$ share the term $H_\cdot^{(l-1)}$, we can write \begin{equation} \label{eq:thoretical} \small H_s^{(l)} = \bar{A}_{\cdot s}\bar{A}^{-1}_{\cdot t} H^{(l)}_{t} (Q_{\cdot t}^{(l-1)})^{-1}Q_{\cdot s}^{(l-1)}, \end{equation} where $X^{-1}$ denotes the pseudo-inverse. This proves the result. \end{proof} \subsection{Indirectly Connected Source and Target Node Types} \label{appendix:indirect} When source and target node types are indirectly connected by another node type $x$, we can simply extend $\textbf{t}_{\text{KTN}}(H^{(L)}_{t})$ to $(A_{xs}(A_{tx}H^{(L)}_{t}T_{tx})T_{xs})$ where $T_{tx}T_{xs}$ becomes a mapping function from target to source domains. Algorithm~\ref{alg:train-extend} and~\ref{alg:test-extend} show how \textsc{HGNN-KTN}\xspace is extended. For every step ($x \rightarrow y$) in a meta-path ($t \rightarrow \cdots \rightarrow s$) connecting from target node type $t$ to source node type $s$, we define a transformation matrix $T_{xy}$, run a convolution operation with an adjacency matrix $A_{xy}$, and map the transformed embedding to the source domain. We run the same process for all meta-paths connecting from target node type $t$ to source node type $s$, and sum up them to match with the source embeddings. In the test phase, we run the same process to get the transformed target embeddings, but this time, without adjacency matrices. We run Algorithm~\ref{alg:train-extend} and~\ref{alg:test-extend} for domain adaptation tasks between author and venue nodes which are indirectly connected by paper nodes in OAG graphs (Figure~\ref{fig:schema1:oag}). As shown in Tables~\ref{tab:oag:cs},~\ref{tab:oag:cn}, and~\ref{tab:oag:ml}, we successfully transfer HGNN models between author and venue nodes (A-V and V-A) for both L1 and L2 tasks. Which meta-path between source and target node types should we choose? Will lengths of meta-paths affect the performance? We examine the performance of \textsc{HGNN-KTN}\xspace varying the length of meta-paths. In Table~\ref{tab:meta-path}, accuracy decreases with longer meta-paths. When we add additional meta-paths than the minimum path, it also brings noise in every edge types. Note that author and venue nodes are indirectly connected by paper nodes; thus the minimum length of meta-paths in the A-V (L1) task is $2$. The accuracy in the A-V (L1) task with a meta-path of length $1$ is low because \textsc{HGNN-KTN}\xspace fails to transfer anything with a meta-path shorter than the minimum. Using the minimum length of meta-paths is enough for \textsc{HGNN-KTN}\xspace. \subsection{Analysis for Baselines in Section~\ref{sec:experiments:zero-shot}} \label{appendix:analysis} JAN, CDAN, and CDAN-E often show out of memory issues in Tables~\ref{tab:oag:cs},~\ref{tab:oag:cn}, and~\ref{tab:oag:ml}. These baselines consider the classifier prediction whose dimension is equal to the number of classes in a given task. That is why JAN, CDAN, and CDAN-E fail at the L2 field prediction tasks in OAG graphs where the number of classes is $17,729$. LP performs worst among the baselines, showing the limitation of relying only on graph structures. LP maintains a label vector with the length equal to the number of classes for each node, thus shows out-of-memory issues on tasks with large number of classes on large-size graphs (L2 tasks with $17,729$ labels on the OAG-CS graph). EP performs moderately well similar to other DA methods, but lower than \textsc{HGNN-KTN}\xspace up to $60\%$ absolute points of MRR, showing the limitation of not using target node attributes. \begin{table}[] \caption{ \textbf{Meta-path length in \textsc{HGNN-KTN}\xspace:} increasing the meta-path longer than the minimum does not bring significant improvement to \textsc{HGNN-KTN}\xspace. Note that the minimum length of meta-paths in the A-V (L1) task is $2$. } \label{tab:meta-path} \centering \small \begin{tabular}{c|llll} \toprule \hline \textbf{Task} & \multicolumn{2}{c}{\textbf{P-A (L1)}} & \multicolumn{2}{c}{\textbf{A-V (L1)}} \\ \hline \textbf{\begin{tabular}[c]{@{}c@{}}Meta-path\\ length\end{tabular}} & \textbf{NDCG} & \multicolumn{1}{l|}{\textbf{MRR}} & \textbf{NDCG} & \textbf{MRR} \\ \hline \midrule \textbf{1} & 0.623 & \multicolumn{1}{l|}{0.621} & 0.208 & 0.010 \\ \textbf{2} & 0.627 & \multicolumn{1}{l|}{0.628} & 0.673 & 0.696 \\ \textbf{3} & 0.608 & \multicolumn{1}{l|}{0.611} & 0.627 & 0.648 \\ \textbf{4} & 0.61 & \multicolumn{1}{l|}{0.623} & 0.653 & 0.671 \\ \hline \bottomrule \end{tabular} \normalsize \end{table} \subsection{Synthetic Heterogeneous Graph Generator} \label{appendix:graph-generator} Our synthetic heterogeneous graph generator is based on attributed Stochastic Block Models (SBM)~\cite{tsitsulin2020graph,tsitsulin2021synthetic}, using clusters (blocks) as the node classes. In the attributed SBM, graphs exhibit \emph{within-type} cluster homophily at the \emph{edge-level} (nodes most-frequently connect to other nodes in their cluster), and at the \emph{feature-level} (nodes are closest in feature space to other nodes in their cluster). To produce heterogeneous graphs, we additionally introduce \emph{between-type} cluster homophily, which allows us to model real-world heterogeneous graphs in which knowledge can be shared across node types. The first step in generating a heterogeneous SBM is to decide how many clusters will partition each node type. Assume within-type cluster counts $k_1, \ldots, k_T$. We allow for cross-type homophily with a $K_T:=\min_t\{k_t\}$-partition of clusters such that each cluster group has at least one cluster from each node type. Secondly, edge-level homophily is controlled by signal-to-noise ratios $\sigma_e = p/q$ where nodes within-cluster are connected with probability $p$ and nodes between-cluster are connected with probability $q$. Additionally, nodes within the same cluster group across-types (see previous paragraph) can generate between-edges with some $\sigma_e>1.0$. In Section \ref{sec:experiments:sensitivity} we describe the manipulation of multiple $\sigma_e$ parameters within-and-across types. Finally, node attributes are generated by a multivariate Normal mixture model, using the cluster partition as the mixture groups. Thus feature-level homophily is controlled by increasing the variance of the cluster centers $\sigma_f$, while keeping the within-cluster variance fixed. Note that features of different types are allowed to have different dimensions, as we generate different mixture-model cluster centers for each cluster \emph{within each type}. Cross-type feature homophily is not necessary, since HGNN-KTN learns a transformation function between the type feature spaces. \subsubsection{Toy Heterogeneous Graph in Section~\ref{sec:motivation:experiments}} \label{appendix:graph-generator:toy} Using the synthetic graph procedure described above, we used the following hyperparameters to simulate the toy heterogeneous graph shown in Figure~\ref{fig:toy_exp}. We generate the graph with two node types and four edge types as described in Figure~\ref{fig:toy:hg}, then we divide each node type into $4$ classes of $400$ nodes. To generate an easy-to-transfer scenario, signal-to-noise ratio $\sigma_f$ between means of feature distributions are all set to $10$. The ratio $\sigma_e$ of the number of intra-class edges to the number of inter-class edges is set to $10$ among the same node types and across different node types. The dimension of features is set to $24$ for both node types. \subsubsection{Sensitivity test in Section~\ref{sec:experiments:sensitivity}} \label{appendix:graph-generator:sensitivity} Figure~\ref{fig:schema2} shows the structures of graphs we used in Section~\ref{sec:experiments:sensitivity}. The dimension of features are set to $24$ for both node types for the ``easy" scenario and, and $32,48$ for types $s$ and $t$ (respectively) for the ``hard" scenario. Additionally, for the ``hard" scenario, we divide the $t$ nodes into 8 clusters instead of 4. The other hyperparameters $\sigma_e$ and $\sigma_f$ are described in Section~\ref{sec:experiments:sensitivity}. \begin{table*}[t!] \caption{ \textbf{Statistics of Open Academic Graph} } \label{tab:oag:statistics} \centering \small \begin{tabular}{l|l|l|l|l|l|l} \toprule\hline \textbf{Domain} & \textbf{\#papers} & \textbf{\#authors} & \textbf{\#fields} & \textbf{\#venues} & \textbf{\#institues} & \\ \hline\midrule \textbf{Computer Science} & 544,244 & 510,189 & 45,717 & 6,934 & 9,097 & \\ \textbf{Computer Network} & 75,015 & 82,724 & 12,014 & 2,115 & 4,193 & \\ \textbf{Machine Learning} & 90,012 & 109,423 & 19,028 & 3,226 & 5,455 & \\ \hline \textbf{Domain} & \textbf{\#P-A} & \textbf{\#P-F} & \textbf{\#P-V} & \textbf{\#A-I} & \textbf{\#P-P} & \textbf{\#F-F} \\ \hline\midrule \textbf{Computer Science} & 1,091,560 & 3,709,711 & 544,245 & 612,873 & 11,592,709 & 525,053 \\ \textbf{Computer Network} & 155,147 & 562,144 & 75,016 & 111,180 & 1,154,347 & 110,869 \\ \textbf{Machine Learning} & 166,119 & 585,339 & 90,013 & 156,440 & 1,209,443 & 163,837 \\ \hline\bottomrule \end{tabular} \normalsize \end{table*} \begin{table*}[t!] \caption{ \textbf{Statistics of PubMed Graph} } \label{tab:pubmed:statistics} \centering \small \begin{tabular}{p{1.5cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}} \toprule\hline \textbf{\#gene} & \textbf{\#disease} & \textbf{\#chemicals} & \textbf{\#species} & \\ \hline\midrule 13,561 & 20,163 & 26,522 & 2,863 & \\ \hline \textbf{\#G-G} & \textbf{\#G-D} & \textbf{\#D-D} & \textbf{\#C-G} & \textbf{\#C-D} \\ \hline\midrule 32,211 & 25,963 & 68,219 & 31,278 & 51,324 \\ \hline \textbf{\#C-C} & \textbf{\#C-S} & \textbf{\#S-G} & \textbf{\#S-D} & \textbf{\#S-S} \\ \hline\midrule 124,375 & 6,298 & 3,156 & 5,246 & 1,597 \\ \hline\bottomrule \end{tabular} \normalsize \end{table*} \subsection{Real-world Dataset} \label{appendix:dataset} \paragraph{Open Academic Graph (OAG)}~\cite{sinha2015overview, tang2008arnetminer, zhang2019oag} is the largest publicly available heterogeneous graph. It is composed of five types of nodes: papers, authors, institutions, venues, fields and their corresponding relationships. Papers and authors have text-based attributes, while institutions, venues, and fields have text- and graph structure-based attributes. To test the generalization of the proposed model, we construct three field-specific subgraphs from OAG: the Computer Science (OAG-CS), Computer Networks (OAG-CN), and Machine Learning (OAG-ML) academic graphs. Papers, authors, and venues are labeled with research fields in two hierarchical levels, L1 and L2. OAG-CS has both L1 and L2 labels, while OAG-CN and OAG-ML have only L2 labels (their L1 labels are all "computer science"). Domain adaptation is performed on the L1 and L2 field prediction tasks between papers, authors, and venues for each of the aforementioned subgraphs. Note that paper-author (P-A) and paper-venue (P-V) are directly connected, while author-venue (A-V) are indirectly connected via papers. The number of classes in the L1 task is $275$, while the number of classes in the L2 task is $17,729$. The graph statistics are listed in Table~\ref{tab:oag:statistics}, in which P–A, P–F, P–V, A–I, P–P, and F-F denote the edges between paper and author, paper and field, paper and venue, author and institute, the citation links between two papers, the hierarchical links between two fields. The graph structure is described in Figure~\ref{fig:schema1:oag}. For paper nodes, features are generated from each paper's title using a pre-trained XLNet~\cite{wolf2020transformers}. For author nodes, features are averaged over features of papers they published. Feature dimension of paper and author nodes is $769$. For venue, institution, and field node types, features of dimension $400$ are generated from their heterogeneous graph structures using metapath2vec~\cite{dong2017metapath2vec}. \begin{figure}[t!] \centering \includegraphics[width=0.36\linewidth]{FIG/Synthetic_2.png} \caption { Schema of synthetic heterogeneous graphs used in the sensitivity test in Section~\ref{sec:experiments:sensitivity}. } \label{fig:schema2} \end{figure} \begin{figure}[t!] \centering \subfigure[OAG] { \label{fig:schema1:oag} \includegraphics[width=0.55\linewidth]{FIG/oag.png} } \subfigure[PubMed] { \label{fig:schema1:pubmed} \includegraphics[width=.39\linewidth]{FIG/Pubmed.png} } \caption { Schema of real-world heterogeneous graphs } \label{fig:schema1} \end{figure} \paragraph{PubMed}~\cite{yang2020heterogeneous} is a novel biomedical network constructed through text mining and manual processing on biomedical literature. PubMed is composed of genes, diseases, chemicals, and species. Each gene or disease is labeled with a set of diseases (e.g., cardiovascular disease) they belong to or cause. Domain adaptation is performed on a disease prediction task between genes and disease node types. The number of classes in the disease prediction task is $8$. The graph statistics are listed in Table~\ref{tab:pubmed:statistics}, in which G, D, C, and S denote genes, diseases, chemicals, and species node types. The graph structure is described in Figure~\ref{fig:schema1:pubmed}. For gene and chemical nodes, features of dimension $200$ are generated from related PubMed papers using word2vec~\cite{mikolov2013distributed}. For diseases and species nodes, features of dimension $50$ are generated based on their graph structures using TransE~\cite{bordes2013translating}. \subsection{Baselines} \label{appendix:baseline} Zero-shot domain adaptation can be categorized into three groups --- MMD-based methods, adversarial methods, and optimal-transport-based methods. MMD-based methods~\cite{long2015learning, sun2016return, long2017deep} minimize the maximum mean discrepancy (MMD)~\cite{gretton2012kernel} between the mean embeddings of two distributions in reproducing kernel Hilbert space. DAN~\cite{long2015learning} enhances the feature transferability by minimizing multi-kernel MMD in several task-specific layers. JAN~\cite{long2017deep} aligns the joint distributions of multiple domain-specific layers based on a joint maximum mean discrepancy (JMMD) criterion. Adversarial methods~\cite{ganin2016domain, long2017conditional} are motivated by theory in~\cite{ben2007analysis, ben2010theory} suggesting that a good cross-domain representation contains no discriminative information about the origin of the input. They learn domain invariant features by a min-max game between the domain classifier and the feature extractor. DANN~\cite{ganin2016domain} learns domain invariant features by a min-max game between the domain classifier and the feature extractor. CDAN~\cite{long2017conditional} exploits discriminative information conveyed in the classifier predictions to assist adversarial adaptation. CDAN-E~\cite{long2017conditional} extends CDAN to condition the domain discriminator on the uncertainty of classifier predictions, prioritizing the discriminator on easy-to-transfer examples. Optimal transport-based methods~\cite{shen2018wasserstein} estimate the empirical Wasserstein distance~\cite{redko2017theoretical} between two domains and minimizes the distance in an adversarial manner Optimal transport-based method are based on a theoretical analysis~\cite{redko2017theoretical} that Wasserstein distance can guarantee generalization for domain adaptation. WDGRL~\cite{shen2018wasserstein} estimates the empirical Wasserstein distance between two domains and minimizes the distance in an adversarial manner. \subsection{Experimental Settings} \label{appendix:experiment-setting} All experiments were conducted on the same p2.xlarge Amazon EC2 instance. Here, we describe the structure of HGNNs used in each heterogeneous graph. \paragraph{Open Academic Graph:} We use a $4$-layered HGNN with transformation and message parameters of dimension $128$ for \textsc{HGNN-KTN}\xspace and other baselines. Learning rate is set to $10^{-4}$. \paragraph{PubMed:} We use a single-layered HGNN with transformation and message parameters of dimension $10$ for \textsc{HGNN-KTN}\xspace and other baselines. Learning rate is set to $5 \times 10^{-5}$. \paragraph{Synthetic Heterogeneous Graphs:} We use a $2$-layered HGNN with transformation and message parameters of dimension $128$ for \textsc{HGNN-KTN}\xspace and other baselines. Learning rate is set to $10^{-4}$. We implement LP, EP and \textsc{HGNN-KTN}\xspace using Pytorch. For the domain adaptation baselines (DAN, JAN, DANN, CDAN, CDAN-E, and WDGRL), we use a public domain adaptation library ADA~\footnote{\url{https://github.com/criteo-research/pytorch-ada}}. \section{Introduction} \label{sec:introduction} \input{001introduction.tex} \section{Related Work} \label{sec:related_work} \input{002related_work.tex} \section{Preliminaries} \label{sec:preliminaries} \input{003preliminaries.tex} \section{Cross-Type Transformations in HGNNs} \label{sec:motivation} \input{004motivation.tex} \section{Method: \textsc{HGNN-KTN}\xspace} \label{sec:matching_loss} \input{005matching_loss.tex} \section{Experiments} \label{sec:experiments} \input{006experiments.tex} \section{Conclusion} \label{sec:conclusion} \input{007conclusion.tex} \section*{Acknowledgement} \label{sec:ackonwledgement} \input{008acknowledgement.tex}
{'timestamp': '2022-03-07T02:03:36', 'yymm': '2203', 'arxiv_id': '2203.02018', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.02018'}
arxiv
\section{General Bids} \label{sec:general-bids} It is natural to consider negative values and bids in a matching market. Negative values model \emph{costs} incurred for a match, such as in a job market. When a worker is matched as an employee to a company, she experiences some cost for which she must be compensated. The goal of the matching market is to find an efficient price for her labor. However, negative costs complicate matters because they also introduce negative bids. A participant can make it difficult for a match to occur by bidding an arbitrary negative amount. The result is that equilibrium is no longer sufficient for good welfare, even in bipartite graphs. In this section, we first formalize the failure of equilibrium. We then turn to \emph{stability} as a possible saviour. We observe that approximate \emph{ex post} stability indeed implies good welfare in \emph{any mechanism}, and that the MM satisfies approximate ex post stability when participants are truthful. However, ex post stability is a very strong requirement. We formulate an alternative, \emph{ex ante} stability, and show that a ``rebate'' variant of the MM has approximately optimal welfare in any ex-ante stable \emph{Nash} equilibrium. We explain the benefit of the rebate payment rule in terms of aligning individual surplus with market clearing without requiring detailed knowledge or communication from the participants. Finally, however, we observe that this result does not naturally extend to Bayes-Nash equilibrium and illustrate the apparent difficulty involving coordinated communication. \subsection{Model and failure of equilibrium} We make one restriction on the general model of Section \ref{sec:prelim}: we assume the graph is bipartite. This is primarily for notational and narrative convenience. To make our presentation more intuitive, we adopt terminology in which the two sides of the bipartite market are asymmetric: One side (e.g. employers) are \emph{bidders}, while the other side (e.g. workers) are \emph{askers}. The bidders are indexed by $i$. They have values $v_{ij}$ and make bids $b_{ij}$. The askers are indexed by $j$. We assume they have \emph{costs} $c_{ij}$ and make \emph{asks} $a_{ij}$. The surplus of a match between $i$ and $j$ is $s_{ij} = v_{ij} - c_{ij}$, the utility of an asker $j$ for being matched to $i$ is $u_j = -c_{ij} - \pi_i$, and so on. In other words, for the askers, all values and bids have been negated and renamed. We generally picture values, bids, costs, and asks all as positive numbers, so a bidder has a positive value for matching to an asker, who incurs a positive cost from the match. However, our results are all fully general and would allow for any value, bid, cost, or ask to be either positive or negative. \bo{TODO decide if strategy profile should still just be $b$ for simplicity} \paragraph{The $1/4$-rebate Marshallian Match.} This section considers on a variant of the payment rule, which has been proposed in \cite{waggoner2019matching} without theoretical results. Namely, in the $1/4$-rebate MM, after a pair $(i,j)$ are matched and make their respective payments $b_{ij}$ and $-a_{ij}$, the mechanism returns to each participant $1/4$ of the total payment, i.e. each participant receives a rebate of $(b_{ij} - a_{ij})/4$. Thus, half the reported surplus is kept by the mechanism as payment and half is returned to the participants. We will discuss the benefit of this payment rule in Section \ref{subsec:ex_ante} when we prove a price of anarchy result. \paragraph{Failure of equilibrium.} When asks are allowed, equilibrium becomes insufficient to provide welfare guarantees. Participants in the mechanism can place bids and asks such as to effectively refuse matches with one another, by asking above value or bidding below cost. If two players both ``refuse'' matches with one another, neither can unilaterally fix the situation. We prove this result for the MM with 1/4 rebate, but the same profile is also a zero welfare equilibrium with no rebate. \begin{proposition} \label{prop:bad-welfare-bipartite} In the bipartite setting with general values and costs, there always exist Nash equilibria of the Marshallian Match with zero welfare. \end{proposition} \begin{proof} Consider a complete bipartite graph in which each bidder $i$'s values all satisfy $v_{ij} = 2$ and each asker $j$'s costs all satisfy $c_{ji} = 1$. The optimal welfare is $n$ if there are $n$ bidders and $n$ askers. An equilibrium profile is for each bidder $i$ to bid $b_{ij} = 0$ on all askers while each asker $j$ asks $a_{ji} = 4$ on all bidders. The net bid on each edge is $-4$, so no matches are made and welfare is zero. It is an equilibrium because no agent can benefit from a unilateral deviation: Bidders $i$ can only cause a match by bidding $b_{ij} \geq 4$, in which case $i$'s utility would be at most $v_{ij} - 3b_{ij}/4 \leq -1$. Similarly, askers $j$ can only cause a match by asking $a_{ji} \leq 0 < c_{ji}$. They would be matched at price 0 and obtain no rebate, giving negative utility. \end{proof} In this example, any single player cannot deviate alone to improve her welfare. However, any pair of bidders sharing an edge can coordinate a deviation together and guarantee themselves higher welfare. This pairwise deviation for improved welfare mirrors \emph{stability}, a key concept in matching algorithm design. \subsection{Ex Post Stability} In classical ``stable matching'' problems~\cite{gale1962college}, the goal is that, once the mechanism produces a final matching, no two participants $i,j$ both prefer to leave their assigned partners and switch to matching each other instead. We use \emph{ex post} to refer to the fact that this evaluation occurs after all randomness and the matching's outcome have been realized. In our setting, if $i$ and $j$ chose to match each other, they would obtain a net utility of their surplus $s_{ij} = v_{ij} - c_{ij}$. If this amount is larger than their total utility in the mechanism, then they could switch to each other and split the surplus so as to make them both better off. On the other hand, making this switch presumably involves some amount of friction. Therefore, we introduce an approximate version of stability, as a more lenient requirement of a mechanism. \begin{definition}[Approximate ex post stability] A strategy profile $(b,a)$ in a mechanism is $k$-ex post stable if, for all realizations of costs and values and for all feasible pairs of bidder $i$ and asker $j$, \[u_i(b,a) + u_j(b,a)\geq \frac{1}{k}s_{ij} .\] \end{definition} We note that ex post stability is an extremely strong notion. For any matching mechanism, an ex post stable strategy profile produces an approximately optimal matching. \begin{observation} \label{obs:ex-post-approx} For any matching mechanism, any $k$-ex post stable strategy is a $\tfrac{1}{k}$-approximation of the first-best welfare. \end{observation} \begin{proof} Recall that in the Bayes-Nash setting agents' types are drawn from from a joint distribution $\mathcal{D}$. Let $(b,a)$ be a $k$-ex post stable strategy profile for some matching mechanism, and $M$ the associated matching. The expected welfare over all realizations of types and strategies is at least the total utility of participants, \begin{align*} \mathrm{Welfare}(b,a) \geq \E\left[\sum_{\{i,j\}\in M}u_i(b,a) + u_j(b,a)\right] = \E\left[\sum_{\{i,j\}\in M^*}u_i(b,a) + u_j(b,a)\right], \end{align*} where $M^*$ is the maximal matching by surplus. Ex post stability gives a lower-bound on utility for all pairs, regardless of realization, so \begin{align*} \mathrm{Welfare}(b,a) \geq \E\left[\sum_{\{i,j\}\in M^*}\frac{s_{ij}}{k}\right] = \frac{1}{k}\mathrm{Welfare}(\textsc{Opt}) \end{align*} \end{proof} Observation \ref{obs:ex-post-approx} also arises directly from a primal-dual analysis of the linear program for bipartite matching, in which the dual variables are the utilities of the agents and $k$-approximate satisfaction of the dual constraints is precisely $k$-ex post stability. We note that while there exist deferred-acceptance style ``stable'' matching mechanisms that technically involve money, such as matching with contracts~\cite{hatfield2005matching}, we have not ascertained if they can be made to satisfy approximate ex post stability in our sense. \paragraph{Ex post stability of the Marshallian Match under truthfulness.} Ideally, a matching mechanism would admit equilibria in ex post stable strategies, so that welfare would be high and participants would adhere to the outcomes of the mechanism. But as a weaker requirement, we would like an indication of whether approximately ex post stable strategies might be reasonable in a mechanism. We present a simple $2$-ex post stable strategy profile for the $1/4$-rebate MM, for all realizations of costs and values. \begin{proposition} \label{prop:truthful-ex-post} The truthful strategy in which all participants bid or ask their true value or cost is $4$-ex post stable in the $1/4$-rebate Marshallian Match. \end{proposition} \begin{proof} When all participants truthfully report their values and costs, Marshallian Match produces the greedy maximum weighted matching $M$, where edge weights are supluses $s_{ij} = v_{ij} - c_{ij}$ (and negative edges are discarded). Let $(b^*,a^*)$ denote the strategy profile in which all agents are truthful. Consider an edge $\{i,j\}$. If $\{i,j\}\in M$, then $i$ and $j$ each receive utility exactly $s_{ij}/4$ via the mechanism's split. If $\{i,j\}\notin M$, then either $i$ or $j$ must have obtained a higher-surplus match before $s_{ij}$. Without loss of generality, say $i$ matched to $k$ before $s_{ij}$, with $s_{ik} > s_{ij}$. By truthfulness, $i$ obtains welfare $u_i(b^*,a^*) = s_{ik}/4 > s_{ij}/4$. The same argument applies to $j$ if she matches first, implying that $u_i(b^*,a^*) + u_j(b^*,a^*) \geq s_{ij}/4$ for all $i$, $j$. \end{proof} Again, once one connects the truthful MM to greedy matching, Proposition \ref{prop:truthful-ex-post} follows from a basic primal-dual analysis combined with the rebate payment rule. While truthful reporting from all participants produces approximately optimal social welfare (and the participants capture half of it), truthfulness is not in general even an approximate equilibrium. We provide an example in the $1/4$-rebate MM setting in which a player can increase her welfare arbitrarily by overstating her true value for a match. If players can make significant gains by deviating from the truthful strategy, it is likely that they will no adhere to an ex post stable profile. \begin{example}[Figure \ref{fig:non-truthful}] Consider the bipartite graph with three participants: $A$ and $B$ place bids on matching to $C$. $C$ has cost $c_{CA} = c_{CB} = 0$ for both matches, $A$ has value $v_{AC} = k+1$ and $B$ has value $v_{BC} = k$ for matching with $C$. In the truthful profile, $A$ is matched to $C$, and $B$ goes unmatched with welfare $0$. If $B$ deviates to the non-truthful strategy of bidding $b'_{BC} = k+2$, $B$ would be matched with $C$ and would receive utility $u_B(b_{-B}^*,a^*,b') = k - (k+2) + (k+2)/4 = k/4-3/2$. Thus, picking $k$ appropriately, $B$ can benefit arbitrarily by deviating from the truthful strategy. \begin{figure} \begin{center} \begin{tikzpicture}[ every node/.style={circle,draw},scale=.75] \node (A) at (-2,1.5) {$A$}; \node (B) at (-2,-1.5) {$B$}; \node (C) at (2,0) {$C$}; \draw (A) node[right,rectangle,above,sloped,draw=none,fill=none,outer ysep=8pt]{$v_{AC} = k+1$} -- (C) node[left,rectangle,above ,sloped,draw=none,fill=none,outer ysep=8pt]{$c_{CA} = 0$}; \draw (B) node[right,rectangle,above,sloped,draw=none,fill=none,outer ysep=8pt]{$v_{BC} = k$} -- (C) node[left,rectangle,below ,sloped,draw=none,fill=none,outer ysep=8pt]{$c_{CB} = 0$}; \end{tikzpicture} \caption{In the $1/4$-rebate MM, $B$ is incentivized to deviate from truthfulness to the non-truthful bid $k+2$.} \label{fig:non-truthful} \end{center} \end{figure} \end{example} \paragraph{Drawbacks of ex post stability.} If one can prove that a mechanism is ex post stable in equilibrium, that is an ideal result as a welfare guarantee immediately follows. However, without such a result, the value of ex post stability is questionable. Consider the following somewhat subtle point. Intuitively, it may seem reasonable to suppose that participants prefer stable strategy profiles as a sort of equilibrium refinement. In particular, if strategy profile $b$ is not approximately stable, then (one would think) there are two participants $i$ and $j$ who would prefer to jointly switch their strategies so as to match to each other. However, \emph{ex post} stability does not give this kind of guarantee. It can only tell $i$ and $j$ whether they are satisfied after the mechanism happens. To capture the above intuition, we turn to \emph{ex ante} stability. \subsection{Ex Ante Stability}\label{subsec:ex_ante} We now consider a model of stability that generalizes equilibrium by supposing no \emph{pair} of participants has an incentive to \emph{bilaterally} deviate. Importantly, the incentive is relative to expected utility, so it involves an \emph{ex ante} calculation by the participants rather than ex post. \begin{definition}[ex ante stability] \label{def:ex-ante} A strategy profile $(b,a)$ is $k$-ex ante stable if, for all feasible pairs of bidder $i$ and asker $j$, for all strategies $b_i'$ of $i$ and $a_j'$ of $j$, \[\E[u_i(b,a) + u_j(b,a)]\geq \frac{1}{k}\E[u_i(b_{-i},a_{-j},b_i',a_j') + u_j(b_{-i},a_{-j},b_i',a_j')] , \] with randomness taken over realizations of types and strategies. \end{definition} That is, a profile is $k$-ex ante stable if there exists no deviation for any pair of players by which they could expect to increase their collective welfare by a factor of more than $k$. There are two primary differences between ex ante and ex post stability. First, ex ante applies to preferences ``before the fact'', i.e. in expectation, while ex post applies to preferences ``after the fact''. Second, ex post stability postulates the ability of two participants to completely bypass the rules of the mechanism and match to each other. In ex ante stability, the participants are limited to deviating to strategies actually allowed by the mechanism. We observe that an ex ante stable profile is by definition a Bayes-Nash equilibrium, as one can in particular consider profiles where only one of the two participants deviates. We show that for deterministic values and costs, ex ante stability is in fact sufficient to guarantee an approximation of optimal welfare. \paragraph{Benefit of the rebate mechanism.} Our price of anarchy result has a similar structure but very different underpinnings compared to the result for positive bids. It relies crucially on the rebate version of the Marshallian Match, which returns to each participant $1/4$ of the total bid on the edge. This might not appear to be a significant difference from the original version with no rebate; after all, wouldn't participants simply rescale their bids to achieve the same result? However, in our smoothness approach, we obtain a significant benefit. In the positive-values setting, $i$ can deviate to bids $v_{ij}/2$, knowing that each corresponding $j$'s bid is nonnegative. In deviation, $i$ is assured that her net utility is exactly the price at which she is matched; earlier (higher price) meaning higher utility; and at the latest, $i$ matches at time $\max_j v_{ij}/2$. This fails to hold when values and bids may be negative. For example, $i$ might be bidding $b_{ij} = v_{ij}/2$, but if $j$ is asking $a_{ji} = v_{ij}/2 - \epsilon$, then this match (with high utility for $i$) will not happen until time $\epsilon$. By that time, $i$ might be matched along an edge generating much less utility. So $i$ cannot bid defensively in order to align the timing of matches with her own utility. In the $1/4$-rebate MM, however, we recover this property. If $i$ deviates to truthful bids $v_{ij}$, then any match at price $p(t)$ will result in a utility of exactly $v_{ij} - \pi_i + (v_{ij} - a_{ij})/4 = (v_{ij} - a_{ij})/4 = p(t)/4$. The analogous fact holds for askers $j$. So the $1/4$ rebate allows participants to align their utility with the order of market clearing without needing to know details of other participants' bids. The final ingredient needed is ex ante stability: when $i$ deviates to truthfulness, she needs some partner $j$ to also do so, ensuring that some reasonable match is available. \paragraph{Smoothness and deviation strategies.} We define a pairwise deviation of $\{i,j\}$ to truthfulness for bids and asks as follows: $b_{i\ell}' = v_{i\ell}$ for all feasible neighbors $\ell$, and similarly $a_{j\ell}' = c_{j\ell}$ for all neighbors $\ell$. For any pairwise deviation to truthfulness, we show that that pair collectively achieves a constant fraction of their welfare in the $1/4$-rebate MM. \begin{lemma}\label{mechanism-splits-smoothness} For any pair of feasible neighbors $i$ and $j$, for any strategy profile $(b,a)$, \begin{equation*} u_i(b_{-i}a_{-j},b_i'a_j') + u_j(b_{-i}a_{-j},b_i'a_j') \geq \frac{s_{ij}}{4} . \end{equation*} \end{lemma} \begin{proof} If $i$ and $j$ are still unmatched in deviation when the price reaches $s_{ij}$, then they will be matched and each get utility $s_{ij}/4$, since their bid-ask spread is $s_{ij}$. If $i$ matches to some $\ell\neq j$ before $s_{ij}$, we claim $i$ still achieves high utility. Since $i$ is truthful, she obtains utility $u_i(b_{-i}a_{-j},b_i'a_j') = v_{i\ell} - b_{i\ell}' + (b_{i\ell}' - a_{\ell i})/4 = (b_{i\ell}' - a_{\ell i})/4 > s_{ij}/4$, since in deviation the bid-ask spread on the edge $(i,\ell)$ is greater than that on edge $(i,j)$. If $j$ matches to some $\ell\neq i$ before $s_{ij}$, then $j$ achieves high utility. Since $j$ is truthful, she obtains utility $u_j(b_{-i}a_{-j},b_i'a_j') = a_{\ell j}' - c_{\ell j} + (b_{\ell j} - a_{j \ell}')/4 = (b_{\ell j} - a_{j \ell}')/4 > s_{ij}/4$, again since $(\ell,j)$ has a higher bid-ask spread in deviation than $(i,j)$. \end{proof} \begin{theorem} \label{thm:mechanism-splits-PoA} For deterministic values and costs, and strategy profile $(b,a)$ that is $k$-ex ante stable, the $1/4$-rebate Marshallian Match achieves a $\frac{1}{4k}$-approximation of the optimal expected welfare. \end{theorem} Surprisingly, in this result, the contribution of payments to overall welfare can be ignored. We will actually obtain that total participant surplus is a constant fraction of the optimal welfare. \begin{proof}[Proof of Theorem \ref{thm:mechanism-splits-PoA}] Let $M$ denote the matching produced by the strategy profile $(b,a)$, and $M^*$ denote the first-best welfare matching. The welfare of $M$ is \begin{align*} \textsc{Welf}(b,a) &= \E\left[\sum_{\{i,j\}\in M}u_i(b,a) + u_j(b,a) + p_i(b,a)\right]\\ &\geq \E\left[\sum_{\{i,j\}\in M^*}u_i(b,a) + u_j(b,a)\right]\\ &\geq \E\left[\frac{1}{k}\sum_{\{i,j\}\in M^*}u_i(b_{-i},a_{-i},b_i',a_j') + u_j(b_{-i},a_{-i},b_i',a_j')\right] \end{align*} since the values and costs of agents are deterministic and common knowledge, each agent can compute her partner in the first-best welfare matching, and can coordinate to deviate as a pair, guaranteeing a lower bound on welfare for both. Applying Lemma \ref{mechanism-splits-smoothness}, \begin{align*} \textsc{Welf}(b,a) \geq \frac{1}{k}\E\left[\sum_{\{i,j\}\in M^*} \frac{s_{ij}}{4}\right] = \frac{1}{4k}\textsc{Welf}(\textsc{Opt}) \end{align*} \end{proof} This result relies heavily on participants' ability to calculate the fixed matching with optimal social welfare, and coordinate deviations with their partner. We exploit the deterministic costs and values considered to fix the optimal matching $M^*$ across realizations of potentially mixed strategies. \subsection{Discussion: failure of the proof in the Bayes-Nash setting} In this section, we discuss the main open problem: proving welfare guarantees in the Bayes-Nash setting under a reasonable stability definition. \begin{openprob} Give a ``reasonable'' stability assumption and a mechanism for the matching model of \ref{sec:prelim}, with general values, such that, in the Bayes Nash setting, every ``stable'' strategy profile generates a constant factor of the optimal expected welfare. \end{openprob} In the Bayes-Nash setting, the distributions over values and costs are common knowledge, but their realizations are not. As a result, the optimal matching $M^*$ is dependent on the realizations of players' types. This causes our proof of welfare approximation under ex ante stability to fail in an interesting way. In fact, even the definition of ex ante stability (Definition \ref{def:ex-ante}) has nuanced implications. Consider a complete bipartite $n \times n$ graph with a ``star-crossed lovers'' distribution on types\footnote{One can create a version where type distributions are independent that makes roughly the same point.}: there is a uniformly random perfect matching $M^*$ in which the edges have positive surplus, while all edges not in $M^*$ have high costs and low values. Even if we take a very bad mechanism, such as one that always assigns the same matching $M$ regardless of types, it can be ex ante stable: any particular pair are getting low utility, but if they are able to jointly deviate to matching with each other deterministically, they also get low utility in expectation over the type distribution. They are unlikely to be fated for each other once the types are realized. Similarly, recall that the proof of Theorem \ref{thm:mechanism-splits-PoA} used ex ante stability in the following step: \begin{align*} \E\left[\sum_{(i,j)\in M^*}u_i(b,a) + u_j(b,a)\right] &\geq \E\left[\frac{1}{k}\sum_{(i,j)\in M^*}u_i(b_{-i},a_{-i},b_i',a_j') + u_j(b_{-i},a_{-i},b_i',a_j')\right] . \end{align*} In the Nash setting, $M^*$ was fixed, and so were the deviation strategies $b_i',a_j'$ which depended on $M^*$. So the expectation could move inside the sum, followed by an application of ex ante stability. But in a Bayes-Nash setting, $M^*$ is a random variable depending on the realizations of the types. We cannot move the expectation inside the sum. A tempting fix is some sort of \emph{ex interim stability} assumption, where the deviation strategies of $i$ and $j$ can depend on the types of both players. In the star-crossed lovers example, this is appealing: the pairs with high surplus know this fact from their types and can easily coordinate a deviation. So it is reasonable to assume that strategy profiles played in the mechanism are not much worse than such coordinated deviations. However, the amount of coordination required grows significantly if type distributions are more complicated. For example, suppose each value and cost comes from an independent power-law distribution. Finding blocking joint deviations seems to require significant knowledge by the agents, perhaps of global properties of the type space (such as who would be matched under the greedy matching or optimal matching). To assume agents play strategies that eliminate such deviations appears to unjustly relieve the mechanism of responsibility to coordinate agents' information and decisionmaking. \section{Conclusion and Future Work} \label{sec:conclusion} Two-sided matching is difficult, even in such simplified abstract models as in this paper, for at least three reasons: \begin{itemize} \item We would like the process to accommodate information acquisition in a way that is compatible with optimal search theory. \item The process is generally dynamic and sequential (for the previous reason), and strategic behavior in dynamic settings is complicated. \item The constraints are complex and interlocking, i.e. $i$ can match to $j$ if and only $j$ matches to $i$, yet their preferences over this event can be conflicting and contextualized by their other options. \end{itemize} The variants of the Marshallian Match studied in this paper address each challenge to some extent. At least in the nonnegative values setting, the MM is compatible with optimal search because matches are coordinated to occur approximately in order from highest surplus to lowest. This allows inspections to occur approximately in order of their ``index'' (``strike price'') from the Pandora's box problem. In particular, it enables the useful technical property of ``exercising in the money'', i.e. a bidder who inspects at a late stage and discovers a very valuable match is able to unilaterally lock in that match. Dynamic strategizing is addressed by strictly limiting information leakage, i.e. each participant can only see their own bid and learn when they match. It is unclear whether this feature actually makes the mechanism better, but it does make it easier to analyze. We believe that all of our results extend if participants are able to observe when any match occurs, but this would require careful formalization as the game becomes truly dynamic in that case. The complex constraints are addressed to an extent by the coordination of matches in order of value. A bidder $i$ in the MM, whether pay-your-bid or $1/4$-rebate, has deviation strategies available in which the timing of their match corresponds to their utility. If another participant bids high enough to lock in a match with $i$ early, this is out of $i$'s direct control, but $i$ can bid so that they are assured of enough utility to make the match worthwhile. \paragraph{Future work.} There are a number of appealing variants on the model and directions for future investigation. In the job market application, an interview is a \emph{simultaneous} inspection event between a worker and employer. Can the MM's welfare guarantees extend to a model where inspection is simultaneous, even in the positive-values setting? Other variations can include multiple stages of inspection (an extension in \citet{kleinberg2016descending}) or matching where inspection is optional (studied algorithmically by \citet{beyhaghi2019pandora}). Another direction involves reasonable stability assumptions and their impact on monetary mechanism design for matching. For example, a strategy profile seems somewhat unlikely if it allows for the following sorts of ``Stackelberg deviations'': participant $i$ announces a deviation strategy to all of their neighbors on the other side of the market, and those neighbors respond with their own deviations (perhaps best responses). Finally, the MM itself admits a number of possible variations. One additional benefit of the rebate payment rule is that it disincentivizes overbidding and under-asking, because participants do not need to strategically bid to capture value: the payment rule returns it to them as a rebate. A more sophisticated approach involves a two-part bid consisting of a reserve bid $b_{ij}$ and a ``surplus bid'' $\beta_{ij} \in (0,1)$ (respectively for askers, a reserve $a_{ji}$ and surplus $\alpha_{ji}$). When a match occurs at $p(t) = b_{ij} - a_{ij}$, the bidder receives a rebate of $\beta_{ij} p(t)$ while the asker receives a rebate of $\alpha_{ji} p(t)$. Perhaps a variant like this achieves a price of anarchy result, or a stability-based welfare guarantee, for the general setting. \section{Introduction} A primary goal of designing mechanisms is to coordinate groups to arrive at collectively good allocations or outcomes. For example, in auctioning a set of items to unit-demand buyers, the problem is to coordinate among the varied preferences of the buyers to achieve an overall good matching of buyers to items. In such auction settings, ``good'' is usually formalized via \emph{price of anarchy}~\citep{roughgarden2017price}: in any equilibrium of the auction game, the expected social welfare (total utility) should be approximately optimal. Matching people to people, with preferences on both sides, appears to require even more coordination. \citet{gale1962college} introduced the foundational deferred-acceptance algorithm -- a matching mechanism without money -- for participants with ordinal preferences. The key ``good'' property it achieves (if all participants are truthful) is \emph{stability}: no pair prefers to switch away from the given matching and match to each other instead. Variants of deferred acceptance have had significant impact in applications from kidney exchange to the National Residency Matching Program (NRMP) for doctors and hospitals~(e.g. \citet{iwama2008survey}). We are motivated by two drawbacks of deferred-acceptance-style approaches. First, the \emph{social welfare} generated by such mechanisms is unclear, even in settings where money is explicitly modeled such as matching with contracts~\citep{hatfield2005matching}. While their criterion of stability is a nice property, its relationship to welfare is not obvious. We would like to investigate this relationship and obtain explicit welfare guarantees. Second, it is unclear the extent to which such mechanisms are compatible with \emph{inspection} stages in which participants must invest effort to discover their preferences. For example, in practice, the design of the NRMP requires relatively expensive and time-constrained interviews, which must be completed before matching begins. While such concerns have motivated significant work on information acquisition in matching markets, particularly variants of deferred acceptance~(e.g. \cite{immorlica2021designing}; see Section \ref{sec:related-work}), to our knowledge none of it incorporates monetary mechanisms with quantitative welfare guarantees. On the other hand, prior work of \cite{kleinberg2016descending} has shown that even in the special case of matching people to items (which have no preferences), approximately optimal welfare \emph{requires} a market design with dynamically interspersed matching and information acquisition. \cite{kleinberg2016descending} showed that descending-price mechanisms tend to be compatible with costly inspection stages and still yield high social welfare, due to a connection with the Pandora's box problem~\citep{weitzman1979optimal}. \paragraph{The Marshallian Match.} Inspired by \citet{kleinberg2016descending}, \citet{waggoner2019matching} propose the ``Marshallian Match'' (MM) for two-sided matching with money. In \citet{marshall1920principles}, its namesake describes a theory of market clearing in which the buyer-seller matches that generate the largest surplus -- i.e. the most net utility between the pair -- occur first, and so on down.\footnote{This dynamic eventually leads to the market clearing price (e.g. \citet{plott2013marshall}), after which no more positive-surplus matches are possible. Indeed, in a simple commodity market it is possible to ignore Marshall's dynamics and focus on the calculation of the clearing price. But in a more complex two-sided matching problem, we appear to require dynamics in order to properly coordinate matches.} A similar dynamic is observed in decentralized matching markets~\cite{chade2017sorting}, yet it does not directly underly standard centralized designs such as deferred acceptance. Similarly, the MM begins with a high price that descends over time. Participants maintain a bid on each of their potential matches, with the sum of the two bids ideally representing the total surplus generated by the match. When the price reaches the sum of any pair's bids on each other, that pair is matched. They pay their bids and drop out of the mechanism, which continues. \citet{waggoner2019matching} speculate on the dynamics, strategy, and benefits of this mechanism, but do not obtain theoretical results. \subsection{Our results} We first consider a setting where all participants' values are nonnegative. Under this restriction, we show a general \emph{price of anarchy (PoA)} guarantee for the Marshallian Match, i.e. in any Bayes-Nash equilibrium the expected social welfare is within a constant factor of the optimal possible. We use a smoothness approach (e.g. \cite{roughgarden2017price}) along with several key properties of our variant of the MM, including limited information leakage. The positive-bids setting can model, for example, matching of industrial plants to geographic areas (an application of \cite{koopmans1957assignment}) or matching local businesses to municipal-owned locations. We also show robustness of this result via several extensions. It not only holds for non-bipartite graphs, but also extends to a \emph{group formation} setting. There, agents must be partitioned into subsets of size at most $k$, the edges of a hypergraph. Each agent $i$ has a private valuation for joining each possible subset. We modify the MM by keeping the global descending price and clearing a subset when the price reaches the sum of its bids. We obtain a $\Omega(1/k^2)$ price of anarchy for this problem. Next, we show that the welfare guarantee also extends to a model with information acquisition costs. It is natural in many matching settings that participants do not initially know their values for a potential match. It requires time, effort, and/or money to investigate and discover one's value. A good mechanism should carefully coordinate these investigations to happen at appropriate times, or else significant welfare will be lost: participants will either waste too much utility on unnecessary inspections, or they will forego valuable matches due to the inspection cost and uncertainty about the match. Adapting techniques of \cite{kleinberg2016descending} for analyzing welfare in models of inspection, we show that the price of anarchy of the MM is also constant in this setting. \begin{theorem*} With nonnegative values, the Marshallian Match has the following guarantees: \begin{enumerate} \item For matching on general graphs, a Bayes-Nash price of anarchy of at least $1/8$. \item For matching on hypergraphs with group size at most $k$, a Bayes-Nash price of anarchy of at least $1/2k^2$. \item For matching on general graphs with inspection costs, a Bayes-Nash price of anarchy of at least $1/8$. \end{enumerate} \end{theorem*} \paragraph{Possibly-negative values.} We then consider a general two-sided matching setting where values may be negative. Understanding this setting is desirable because it more accurately captures job markets, where workers incur a cost (i.e. negative value) for being matched to a job and must be compensated more than that cost. Here we see for natural reasons that a PoA result for the MM is impossible: if all participants set their bids so as to refuse all matches, no single participant can deviate to cause any change and the equilibrium obtains zero welfare. In general, this suggests that a kind of stability condition may be natural and necessary for high-welfare matching mechanisms of any kind. We observe that \emph{approximate ex post} stability implies approximately optimal welfare, and show that the MM achieves approximate ex post stability if participants bid truthfully. We use a simple ``rebate'' tweak to return half this surplus to the bidders, resulting in a generally favorable outcome. \begin{proposition*} In any $k$-approximate ex post stable strategy profile, the $(1/4)$-rebate Marshallian Match (in fact, \emph{any} mechanism) achieves at least $1/k$ of the optimal expected welfare. Truthful bidding in the $(1/4)$-rebate Marshallian Match is $4$-approximately ex post stable. \end{proposition*} However, truthfulness is not generally an equilibrium.\footnote{We note that even for deferred acceptance, which is also stable \emph{if all participants are truthful}, in general only one side of the market optimizes their outcomes by being truthful.} This raises the question of whether it is reasonable to assume participants will adopt approximately stable strategy profiles. We argue that ex post stability is too strong an assumption, and instead propose \emph{ex ante} stability. We show that in a Nash setting (not Bayes-Nash) with fixed valuations, if strategies are approximately \emph{ex ante stable}, then the welfare of MM is approximately optimal. This result crucially relies on the ``rebate'' payment rule: it allows participants the option of a strategy deviation that aligns their personal utility with the order of market clearing. This variant of the payment rule appears necessary to coordinate market clearing by amount of surplus while limiting the amount of communication and knowledge required. \begin{theorem*} In the general Nash setting with fixed valuations, in any strategy profile that is $k$-approximate ex ante stable, the $(1/4)$-rebate Marshallian Match achieves at least a $1/4k$ fraction of the optimal welfare. \end{theorem*} In fact, the stability property also ensures that participants keep a large fraction of the welfare; the proof uses that participant surplus alone (i.e. welfare minus payments) is at least $1/4k$ of the optimal welfare. Unfortunately, this stable-price-of-anarchy result is fragile and the proof does not extend to the \emph{Bayes-Nash} setting where private valuations are drawn from a common-knowledge prior. This is roughy due to the difficulty of coordinating and communicating deviations between ``blocking pairs''. Therefore, the main problem of proving a welfare guarantee in a general negative-bids setting and under a reasonable stability assumption remains open. \begin{openprob*} Give a well-justified stability assumption and a mechanism such that, in the \emph{Bayes-Nash setting} with general values, stable strategy profiles guarantee a constant factor of the optimal expected welfare. \end{openprob*} \subsection{Related work} \label{sec:related-work} We have not found any mechanisms in the literature involving a two-sided matching market with money and quantifiable welfare results.\footnote{One can always apply a general Vickrey-Clarke-Groves (VCG) mechanism, which has an equilibrium with optimal social welfare. But VCG is undesirable because it appears incompatible with both price of anarchy results and models with inspection costs, cf. \citet{kleinberg2016descending}.} However, the literature on matching with strategic agents is very broad, including with inspection stages, and we highlight a number of papers that are related to our problem. Probably closest to our work is \citet{immorlica2021designing}, which considers design of a platform to coordinate two-sided matchings with inspection costs and quantifiable welfare guarantees. Motivated by e.g. matching platforms for romantic dating, the paper studies agents coming from specific populations with a known distribution of types. The mechanism uses its knowledge of the type distributions to compute strategies for directing inspection stages (e.g. first dates). The computational problem is challenging and intricate. \citet{immorlica2021designing} is able to show the structure of equilibria and use this to give welfare guarantees, all in a setting without money. In contrast, we are interested in monetary mechanisms, motivated (eventually) by e.g. labor markets. We consider a very simple descending-price mechanism that has no access to knowledge about the agent types or distributions. Beyond \citet{immorlica2021designing} there is an extensive literature on matching marketplaces and dynamics. Work in that literature involving money (transferable utility) historically often takes a Walrasian equilibrium perspective, while ours is in the tradition of auction design. We refer to the survey of \citet{chade2017sorting} for more on this literature. As mentioned above, a number of recent works study matching markets with information acquisition, but generally consider variants of deferred acceptance without money. Works of this kind include \citet{he2020application,che2019efficiency,ashlagi2020clearing,chen2021information,fernandez2021centralized,immorlica2020information,hakimov2021costly}. Among these, \citet{immorlica2020information} uses a lens of optimal search theory similar to ours. It studies matching of students to schools. Its matching problem is almost one-sided, in the sense that schools have known and fixed preferences. The focus is on coordinating efficient acquisition of information by students. Unlike our social-welfare perspective, that work focuses on the more standard criterion of stability and introduces regret-free stable outcomes. In particular, it does not involve money. Similarly, \citet{hakimov2021costly} study a serial-dictator mechanism for coordinating student inspection without money. We refer to \citet{immorlica2020information} for an extensive discussion of further work related to information acquisition in matching markets. Our notions of stability are naturally closely related to others in the literature. Ex post stability is only a quantitative version of stability in matching; a more sophisticated version of it is used by \citet{immorlica2020information}, for example. \cite{fernandez2021centralized} also utilizes a similar notion of stability, in a setting of incomplete information. \section{Results for Positive Valuations} In this section, we consider a restriction of the general setting where all values $v_{ij}$ are nonnegative. First, we show that the Marshallian Match achieves a constant approximation of optimal welfare for matching. Second, we extend the result to the group formation (i.e. matchings on hypergraphs) setting. Finally, we extend the result in a different direction to the case where participants do not initially know their valuations and can choose to expend effort to discover them. \subsection{The vanilla positive valuations model} Here, we take the general model of Section \ref{sec:prelim} and assume that each valuation satisfies $v_{ij} \geq 0$. We modify the Marshallian Match to require all bids $b_{ij}$ to be nonnegative at all times. \paragraph{Intuition.} The nonnegative MM is similar to running multiple interlocking descending-price unit-demand auctions simultaneously.\footnote{Although general price of anarchy results are available for these kinds of auctions for goods, e.g. \citet{lucier2015greedy,feldman2016price}, we do not know of any that apply to two-sided matching.} This parallel is most obvious in the bipartite case: any bidder $i$ competes against other bidders in the same set for her favorite matches. Extending this perspective, each bidder $i$ could hypothetically bid as though her neighbors $j$ were simply items with no preferences. By analyzing the failure of this hypothetical strategy, we find in the MM that it is connected with a different high-welfare event, namely $j$ matching early. This intuition underlies our smoothness lemma, discussed next. \paragraph{Smoothness for two-sided matching.} We give a smoothness lemma that powers our price of anarchy result. Recall (e.g. \citet{roughgarden2017price}) that smoothness proofs of PoA proceed by guaranteeing high-welfare events in a counterfactual world where $i$ deviates to a less-preferred strategy. One challenge is that in a dynamic mechanism that proceeds over time, a deviation could cause chain reactions that make it impossible to reason about the outcomes. Here, we rely on our variant of MM that does not leak any information about bids or strategies. The only piece of information the agent receives from the mechanism comes at the moment they are matched, after which they cannot react. A second key challenge is that in a matching market, $i$ may not match $j$ \emph{and} the prices that $i$ and $j$ each pay may still be low, obstructing an adaptation of a standard smoothness proof. In the MM there is, however, a high \emph{total} price paid for an edge that obstructs the match. Recall that while $\pi_i(b)$ is $i$'s payment, $p_i(b)$ is the \emph{total} payment on the edge containing $i$ that is matched (zero if $i$ is unmatched). \paragraph{The deviation and smoothness lemma.} Let $b$ be any strategy profile. For any bidder $i$, define the deviation strategy $b_i'$ as $b_{ij}'(t) = v_{ij}/2$ for all feasible neighbors $j$ and all times $t$. Observe that if $i$ matches at any price $p(t)$ in deviation, their utility is $p(t)$. In other words, the key property of the Marshallian Match in combination with this deviation strategy is that it coordinates surplus generation with the order of matching. \begin{lemma} \label{lemma:nonneg-smooth} In the nonnegative values setting, for any feasible pair $\{i,j\}$, any strategy profile $b$, and any realization of types, \begin{align} u_i(b_{-i},b_i') + \frac{p_i(b)}{4} + \frac{p_j(b)}{4} &\geq \frac{v_{ij}}{8} . \end{align} \end{lemma} \begin{proof} Observe that all three terms are nonnegative. For $u_i(b_{-i},b_i')$, this follows by definition of $b_i'$. Therefore, if $p_j(b) \geq v_{ij}/2$ or $p_i(b)\geq v_{ij}/2$, then the result is immediate. Otherwise, under $b$, both $i$ and $j$ are unmatched by the time the price has dropped to $v_{ij}/2$. Observe that $b$ and $(b_{-i},b_i')$ are indistinguishable to all participants until $i$ matches, which at the latest is to $j$ at time $v_{ij}/2$. By definition of $b_i'$, it follows that $u_i(b_{-i},b_i') \geq v_{ij}/2$. \end{proof} \begin{theorem} \label{thm:nonneg-welfare} In the nonnegative values setting, the Marshallian Match has a Bayes-Nash price of anarchy of at least $1/8$. \end{theorem} \begin{proof} Letting $b$ be any Bayes-Nash equilibrium and $M^*$ be the optimal matching (a random variable), we have the following. We will use that, in equilibrium, $i$ prefers $b_i$ to $b_i'$; that $M^*$ contains at most every participant, and utilities and payments are nonnegative; and Lemma \ref{lemma:nonneg-smooth}. \begin{align*} \mathrm{Welfare}(b) &= \E \sum_i \left(u_i(b) + \frac{p_i(b)}{2}\right) \\ &\geq \E \sum_i \left(u_i(b_{-i},b_i') + \frac{p_i(b)}{2}\right) \\ &\geq \E\left[\sum_{\{i,j\}\in M^*} \left(u_i(b_{-i},b_i') + u_j(b_{-j},b_j') + \frac{p_{i}(b)}{2} + \frac{p_{j}(b)}{2}\right)\right]\\ &= \E\left[\sum_{\{i,j\}\in M^*} \left(u_i(b_{-i},b_i') + \frac{p_{i}(b)}{4} + \frac{p_{j}(b)}{4} + u_j(b_{-j},b_j') + \frac{p_{i}(b)}{4} + \frac{p_{j}(b)}{4} \right) \right]\\ &\geq \E\left[\sum_{\{i,j\}\in M^*} \left( \frac{v_{ij}}{8} + \frac{v_{ji}}{8} \right) \right] = \frac{1}{8}\mathrm{Welfare}(\textsc{Opt}) . \end{align*} \end{proof} \subsection{Matchings on hypergraphs} We now extend to the problem of coordinating formation of groups of size up to $k$. We will be brief because the proof is similar to the matching case above, i.e. the special case where $k=2$ and groups of size one are disallowed. Instead of a graph, we are given a hypergraph where agents are vertices and a hyperedge $S$ represents a feasible group, i.e. subset of agents of size at most $k$. The value of agent $i$ for being assigned to group $S$ is $v_{iS} \geq 0$. A ``matching'' or assignment $M$ consists of a subset of the hyperedges such that no agent is in two different groups $S,S' \in M$. The surplus of a group $S$ is $s_S = \sum_{i \in S} v_{iS}$. The social welfare of an assignment $M$ is $\sum_{S \in M} s_S$. The Marshallian Match for this setting is modified as follows. Participants $i$ maintain bids $b_{iS}$ on all of their feasible groups $S$. When the descending price matches the total sum of bids on any group, i.e. $p(t) = \sum_{i \in S} b_{iS}$, that group is matched and drops out of the mechanism; all members pay their bids. Again considering the deviation $b_i'$ where $b_{iS}'(t) = v_{iS}/2$ for all feasible $S$ and all $t$, we have: \begin{lemma} \label{lemma:group-smoothness} For any strategy profile $b$, realizations of types, agent $i$, and hyperedge $S$ containing $i$, \[ u_i(b_{-i},b_i') + \frac{1}{k^2}\sum_{j \in S} p_j(b) \geq \frac{v_{iS}}{2k^2} . \] \end{lemma} \begin{proof} All terms are nonnegative. If under $b$ there exists $j \in S$ with $p_j(b) \geq \frac{v_{iS}}{2}$, then we are done. Otherwise, in $(b_{-i},b_i')$ all members of $S$ are unmatched at least until $i$ matches, which at the latest occurs at $p(t) = v_{iS}/2$, yielding $i$ utility at least $v_{iS}/2$. \end{proof} \begin{theorem} \label{thm:group-welfare} In the hyperedge matching (group formation) setting with nonnegative values and group size up to $k$, the Marshallian Match has a Bayes-Nash price of anarchy of at least $\frac{1}{2k^2}$. \end{theorem} \begin{proof} Letting $b$ be a Bayes-Nash equilibrium and $M^*$ the optimal assignment (a random variable), we have the following. The first line follows because groups have size at most $k$, so the total payment of a group $S$ is at least $\sum_{i \in S} p_i(b)/k$. \begin{align*} \mathrm{Welfare}(b) &\geq \E \sum_i \left( u_i(b) + \frac{p_i(b)}{k} \right) \\ &\geq \E \sum_i \left( u_i(b_{-i},b_i') + \frac{p_i(b)}{k} \right) \\ &\geq \E \sum_{S^* \in M^*} \sum_{i \in S^*} \left( u_i(b_{-i},b_i') + \frac{p_i(b)}{k} \right) \\ &\geq \E \sum_{S^* \in M^*} \sum_{i \in S^*} \left( u_i(b_{-i},b_i') + \sum_{j \in S^*} \frac{p_j(b)}{k^2} \right) \\ &\geq \E \sum_{S^* \in M^*} \sum_{i \in S^*} \frac{v_{iS^*}}{2k^2} \quad= \frac{\mathrm{Welfare}(\textsc{Opt})}{2k^2} . \end{align*} \end{proof} It remains to be seen if the factor can be improved to $\Omega(1/k)$. We appear to lose one factor of $k$ because the greedy algorithm (e.g. the MM where all participants are truthful) is only a $1/k$ approximation to optimal, and then another factor from strategic behavior. \subsection{Inspection} \label{sec:inspection} We now extend our welfare result for graphs to a model with information acquisition costs. We again do not require the graph to be bipartite. The model is augmented as follows, following e.g. \citet{kleinberg2016descending}. The type of a participant consists of, for each feasible partner $j$, a cost of inspection $r_{ij} \geq 0$ and a distribution $D_{ij}$ over the nonnegative reals. Our setting is Bayes-Nash, i.e. all types are drawn jointly from a common-knowledge prior. When $i$ inspects an edge $\{i,j\}$, they incur a cost of $r_{ij}$ and observe a value $v_{ij} \sim D_{ij}$ independently of all other randomness in the game. The cost $r_{ij}$ can model a financial investment, or the cost of time or effort required for $i$ to learn their value $v_{ij}$. Let $I_{ij} \in \{0,1\}$ be the random variable indicator that $i$ inspects $j$ and let $A_{ij} \in \{0,1\}$ be the indicator that $i$ is matched to $j$. We adopt the standard assumption (although recent algorithmic work of \citet{beyhaghi2019pandora} has weakened it) that $i$ must inspect $j$ prior to being matched to $j$; i.e. if the match occurs, $i$ must inspect and incur cost $r_{ij}$ if they haven't yet. In other words, $A_{ij} \leq I_{ij}$ pointwise. We also assume that, in the game, inspection is instantaneous with respect to the movement of the price $p(t)$. An agent $i$'s utility is their value for their match (if any) minus the sum of all inspection costs and the price they pay. Formally, we have $u_i(b) = \sum_j \left(A_{ij} v_{ij} - I_{ij} r_{ij}\right) - \pi_i(b)$, where the sum is over feasible neighbors. Social welfare is the sum of all agent utilities and revenue, i.e. $\mathrm{Welfare} = \sum_{i,j} \left( A_{ij} v_{ij} - I_{ij} r_{ij} \right)$. \paragraph{Covered call values and exercising in the money.} \citet{kleinberg2016descending} give technical tools, based on a solution of the Pandora's box problem~\citep{weitzman1979optimal}, utilizing finance-inspired definitions.\footnote{We refer the reader to \citet{kleinberg2016descending} for explanation of the terminology, but in brief, the idea is to imagine that when $i$ inspects $j$, the cost $r_{ij}$ is subsidized by an investor in return for a ``call option'', i.e. the right to the excess surplus $v_{ij} - \sigma_{ij}$ beyond a threshold $\sigma_{ij}$, if any. The agent's surplus for that match becomes $\kappa_{ij}$, and the investor breaks even if $(i,j)$ exercises in the money, otherwise loses money.} \begin{definition} \label{def:strike-covered-call} Given a cost $r_{ij}$ and distribution $D_{ij}$, the \emph{strike price} is the unique value $\sigma_{ij}$ satisfying \[ \E_{v_{ij}\sim D_{ij}} \left(v_{ij} - \sigma_{ij}\right)^+ = r_{ij} , \] where $\left(\cdot\right)^+ = \max\{\cdot ~,~ 0\}$. The \emph{covered call value} is the random variable $\kappa_{ij} = \min\{\sigma_{ij}, v_{ij}\}$. \end{definition} We assume $\E_{v_{ij} \sim D_{ij}} v_{ij} \geq r_{ij}$ if $\{i,j\}$ is a feasible match. As we have nonnegative values, this is equivalent to the condition $\sigma_{ij} \geq 0$. A \emph{matching process} is any procedure that involves sequentially inspecting some of the potential matches and making matches, according to any algorithm or mechanism. The following property, along with Lemma \ref{lemma:covered-call}, allows us to relate surplus in a matching process to that of a world with zero inspection costs and values $\kappa_{ij}$. \begin{definition} \label{def:exercise-money} In any matching process, we say that the ordered pair $(i,j)$ \emph{exercises in the money} if, for all realizations of the process, if $I_{ij} = 1$ and $v_{ij} > \sigma_{ij}$ then $A_{ij} = 1$. We say that agent $i$ exercises in the money if $(i,j)$ exercises in the money for all feasible partners $j$. \end{definition} \begin{lemma}[\cite{kleinberg2016descending}] \label{lemma:covered-call} For any feasible partners $\{i,j\}$, any fixed types of all agents, and any matching process, \[ \E\left[ A_{ij} v_{ij} - I_{ij} r_{ij} \right] \leq \E \left[ A_{ij} \kappa_{ij} \right], \] with equality if and only if $(i,j)$ exercises in the money. \end{lemma} \begin{proof} Using the definitions, independence of $v_{ij} \sim D_{ij}$ from the variable $I_{ij}$, and the assumption $A_{ij} \leq I_{ij}$, \begin{align*} \E \left[ A_{ij} v_{ij} - I_{ij} r_{ij} \right] &= \E \left[ A_{ij} v_{ij} - I_{ij} \E_{v'_{ij} \sim D_{ij}} ( v_{ij}' - \sigma_{ij})^+ \right] \\ &= \E \left[ A_{ij} v_{ij} - I_{ij} ( v_{ij} - \sigma_{ij})^+ \right] \\ &\leq \E \left[ A_{ij} v_{ij} - A_{ij} ( v_{ij} - \sigma_{ij})^+ \right] \\ &= \E \left[ A_{ij} \min\{\sigma_{ij}, v_{ij}\} \right]. \end{align*} We observe that the inequality is strict if and only if there is positive probability of the event that $I_{ij} = 1$, $A_{ij} = 0$, and $v_{ij} > \sigma_{ij}$ all occur, i.e. $(i,j)$ fails to exercise in the money. \end{proof} \paragraph{The deviation strategy.} For a strategy profile $b$, define the random variable $\kappa_i(b)$ to be the covered call value of $i$ for its match in profile $b$, i.e. $\min\{\sigma_{ij}, v_{ij}\}$ when $i$ is matched to $j$. Let $\bar{u}_i(b)$ denote $i$'s ``covered call utility'', i.e. $\bar{u}_i(b) = \kappa_i(b) - \pi_i(b)$. Define the deviation strategy $b'_{i}$ for agent $i$ as follows: Initially bid $0$ on each neighbor $j$; when the clock reaches $\sigma_{ij}/2$, inspect neighbor $j$ and update bid to $v_{ij}/2$. The key technical property of the deviation strategy, in combination with the Marshallian Match, is that it allows bidders to control their own destiny: If they inspect and discover a high value, they can bid high and immediately lock in the match. That is, their strategy can ``exercise in the money''. \begin{lemma} \label{lemma:inspect-exercise} The deviation strategy $b_i'$ exercises in the money and ensures $\bar{u}_i(b_i',b_{-i}) \geq 0$, for any strategy profile $b$. \end{lemma} \begin{proof} (Exercises in the money.) We consider the two possible scenarios where $i$ inspects a neighbor $j$, i.e. when $I_{ij} = 1$. If the inspection occurs because the mechanism has just matched $i$ to a previously-uninspected neighbor $j$, then $A_{ij} = 1$ and the requirement of exercising in the money is satisfied. Otherwise, the clock $p(t)$ has reached $\sigma_{ij}/2$, and after inspecting, $i$ updates that bid to $v_{ij}/2$. If $v_{ij} \geq \sigma_{ij}$, then $b_{ij} \geq p(t)$ and the match occurs immediately, so $A_{ij} = 1$. (Nonnegative covered call utility.) If $i$ is matched to some previously-uninspected $j$, then $\pi_i(b) = 0$, so $\bar{u}_i(b) \geq 0$. If $i$ is matched to some $j$ that $i$ has already inspected, then $\pi_i(b) = \kappa_{ij}/2$, so $\bar{u}_i(b) = \kappa_{ij}/2 \geq 0$. Finally, if $i$ is unmatched, then $\bar{u}_i(b) = 0$. \end{proof} \begin{lemma}[Covered call smoothness] \label{lemma:inspect-smooth} For any feasible neighbors $\{i,j\}$ and any strategy profile $b$, for all realizations of types and values: \[ \bar{u}_i(b_{-i},b_i') + \frac{p_i(b)}{4} + \frac{p_j(b)}{4} \geq \frac{\kappa_{ij}}{8} . \] \end{lemma} \begin{proof} Fix a realization of all types and values. The quantities $p_i(b)$, $p_j(b)$, and $\bar{u}_i(b_{-i},b_i')$ are all nonnegative. If $p_i(b) \geq \kappa_{ij}/2$ or $p_j(b) \geq \kappa_{ij}/2$, then we are already done. So suppose neither holds. Then in profile $b$, $i$ is not yet matched at time $\kappa_{ij}/2$. Observe that in $(b_{-i},b_i')$, all other agents' bids and behavior are unchanged until $i$ is matched or $\kappa_{ij}/2$, because they continue playing their strategies in $b$ and no information available to them indicates the change in $i$'s strategy. The first possibility is that in $(b_{-i},b_i')$, agent $i$ is unmatched when the price reaches $\kappa_{ij}/2$. Then by definition of $b_i'$ they match to $j$ at this time, obtaining $\kappa_i(b_{-i},b_i') = \kappa_{ij}$ and $\pi_i(b_{-i},b_i') = \kappa_{ij}/2$, and we are done. The other possibility is that in $(b_{-i}, b_i')$, agent $i$ matches before the price reaches $\kappa_{ij}/2$. In this case, we claim the match is on some neighbor that $i$ has inspected. This follows because $i$ bids zero on all neighbors prior to inspection, which is weakly lower than whatever $i$ bids in profile $b_i$, where they are not matched until at least time $\kappa_{ij}/2$. So $i$ can only match at price $p(t) \geq \kappa_{ij}/2$ on a neighbor $j'$ that $i$ has inspected, which means they are bidding $\kappa_{ij'}/2$ on $j'$, so we have $\bar{u}_i(b_{-i},b_i') = \kappa_i(b_{-i},b_i') - \pi_i(b_{-i},b_i) = \kappa_{ij'}/2 \geq \kappa_{ij}/2$, completing the proof. \end{proof} \begin{theorem} \label{theorem:inspect-welfare} In the inspection setting with nonnegative values, the Marshallian Match guarantees a Bayes-Nash price of anarchy of at least $1/8$. \end{theorem} \begin{proof} Let the random variable $M^*$ be the max-weight matching where the weight on edge $\{i,j\}$ is $\kappa_{ij} + \kappa_{ji}$. Lemma \ref{lemma:covered-call} also implies that $\mathrm{Welfare}(\textsc{Opt})$ is at most the total weight of $M^*$, as follows. Here $I_{ij},A_{ij}$ are the indicators under the $\textsc{Opt}$ procedure, and notice $A_{ij} = A_{ji}$ in any matching. \begin{align*} \mathrm{Welfare}(\textsc{Opt}) &= \E \sum_{\{i,j\} \in E} \left[ \left( A_{ij} v_{ij} - I_{ij} r_{ij} \right) + \left( A_{ji} v_{ji} - I_{ji} r_{ji} \right) \right] \\ &\leq \E \sum_{\{i,j\}} \left(A_{ij} \kappa_{ij} + A_{ji} \kappa_{ji}\right) & \text{Lemma \ref{lemma:covered-call}}\\ &\leq \E \sum_{\{i,j\} \in M^*} \left( \kappa_{ij} + \kappa_{ji} \right) &\text{the solution must form a matching.} \end{align*} (We note that we have no idea what $\textsc{Opt}$ actually is in this setting, or if it can even be computed in polynomial time; nevertheless, this upper bound cannot be too loose, since the MM approximates it.) Lemma \ref{lemma:inspect-exercise} states that the deviation strategy $b_i'$ exercises in the money, so Lemma \ref{lemma:covered-call} implies $\E u_i(b_{-i},b_i') = \E \bar{u}_i(b_{-i}, b_i')$. Therefore, \begin{align*} \mathrm{Welfare}(b) &= \E \sum_{i} \left[u_i(b) + \frac{p_i(b)}{2} \right] \\ &\geq \E\sum_{i} \left[ u_i(b_{-i},b_i') + \frac{p_{i}(b)}{2} \right] \\ &= \E\sum_{i} \left[ \bar{u}_i(b_{-i},b_i') + \frac{p_{i}(b)}{2} \right] \\ &\geq \E\sum_{\{i,j\}\in M^*} \left( \left[ \bar{u}_i(b_{-i},b_i') + \frac{p_i(b)}{4} + \frac{p_j(b)}{4} \right] + \left[ \bar{u}_j(b_{-j},b_j') + \frac{p_{i}(b)}{4} + \frac{p_{j}(b)}{4} \right] \right) \\ &\geq \E \sum_{\{i,j\}\in M^*} \left[ \frac{\kappa_{ij}}{8} + \frac{\kappa_{ji}}{8} \right] \quad \geq \frac{1}{8} \mathrm{Welfare}(\textsc{Opt}) . \end{align*} \end{proof} \section{Preliminaries} \label{sec:prelim} We now define the model and the variant of the Marshallian Match mechanism studied in this paper, originally described by \citet{waggoner2019matching}. We define a general model, in which the graph is possibly non-bipartite and bids and values are possibly negative. Later, we will consider different special cases or variations. There is a finite set of $n$ agents, forming vertices of an undirected graph $G = (\{1,\dots,n\}, E)$. For now, we do not assume that $G$ is bipartite. The presence of an edge $\{i,j\} \in E$ represents that it is feasible to match agents $i$ and $j$. In this case, agent $i$ has a \emph{value} $v_{ij} \in \mathbb{R}$ for being matched to $j$, and symmetrically, $j$ has a value $v_{ji}$ for being matched to $i$. If $i$ and $j$ are neighbors, we let $s_{ij} = v_{ij} + v_{ji}$ denote the \emph{surplus} of the edge $\{i,j\}$. An agent $i$'s \emph{type} consists of their values $v_{ij}$ for each feasible partner $j$. In the \emph{Nash} setting, each agent has a fixed type, and types are common knowledge. In the better-motivated \emph{Bayes-Nash} setting, types are drawn from a common-knowledge joint distribution $\mathcal{D}$ and each agent observes their own type. \subsection{The Marshallian Match} In the MM, a global price $p(t)$ begins at $+\infty$, i.e. $p(0)=\infty$, and descends continuously in time until it reaches zero at time $1$, i.e. $p(1) = 0$.\footnote{This can be accomplished in theory by letting the price be e.g. $p(t) = \frac{1}{2t}$ for $t \in [0,1/2]$ and $p(t) = 2-2t$ for $t \in [1/2,1]$.} Each agent $i$ maintains, for all neighbors $j$, a bid $b_{ij}(t)$ at each time $t$. The mechanism can observe all bids at all times, but agents cannot observe any bids besides their own. For convenience, we will generally drop the dependence on $t$ from the bid notation. When the sum of bids on any edge exceeds the global price, i.e. $b_{ij} + b_{ji} \geq p(t)$, then $i$ and $j$ are immediately matched to each other. Each player pays their respective bid to the mechanism. (We will modify the payment rule in Section \ref{sec:general-bids}.) \paragraph{Intuition for the mechanism.} Why might this mechanism be good, and how might participants strategize? We briefly describe some intuition, referring the reader to \citet{waggoner2019matching} for more detailed discussion. Social welfare and price of anarchy will be formally defined below. First, the edges of the graph are in competition with each other to match first. When an edge $\{i,j\}$ is matched, it produces a surplus of $s_{ij} = v_{ij} + v_{ji}$. The first-best solution, i.e. the optimal solution for a central planner who holds all information, is to select a maximum matching where $s_{ij}$ are the edge weights. However, as discussed in \cite{kleinberg2016descending}, algorithms for maximum matching are complex and appear to interact poorly with inspection stages. More robust is an approximate first-best solution: the \emph{greedy} matching, where the highest-weight edge is matched first, and so on down. This procedure obtains at least half of the optimal welfare, and can be simulated by a Marshallian Match in which all participants bid truthfully. In \cite{kleinberg2016descending}, this fact was used to obtain a constant price of anarchy for matching people to items, including in the presence of inspection costs. However, two-sided matching introduces new strategic considerations. ``Within'' an edge $\{i,j\}$, there is a competition or bargaining for how to split the surplus generated. An agent $i$ with many edges (many outside options) may be able to underbid significantly, while her counterpart $j$ with very few outside options must offer a very high bid along that edge. The question is whether this strategizing and competition between $i$ and $j$ destroys the cooperation incentives for the overall bid on the edge $\{i,j\}$. \subsection{Welfare and price of anarchy} A full strategy profile is denoted $b$. We let $v_i(b)$ be $i$'s value for their match when $b$ is played (zero if none), a random variable depending on the randomization in the strategies and, in the Bayes-Nash setting, on the random draw of the types. Similarly, $\pi_i(b)$ denotes $i$'s payment. Finally, $p_i(b)$ denotes the \emph{total} payment on the edge that $i$ is matched along, i.e. $p_i(b) = \pi_i(b) + \pi_j(b)$ when $i$ is matched to $j$. We assume all agents are Bayesian, rational, and have preferences quasilinear in payment. That is, given a mechanism and a particular strategy profile $b$, the \emph{utility} of a participant $i$ is the random variable \[ u_i(b) = v_i(b) - \pi_i(b) . \] A \emph{Nash equilibrium} of a mechanism with given types $\{v_{ij}\}$ is a strategy profile $b$, consisting of a plan for how to set bids at each moment in time\footnote{We observe that usual nuances around equilibrium in dynamic games, such as non-credible threats, refinements such as subgame perfect equilibrium, etc., do not arise here. In our variant of the MM, each agent $i$ observes nothing until they are matched, after which they can no longer affect the game. So without loss of generality, $i$ commits in advance to a plan $\{ b_{ij}(t) \}$ and follows it until matched.}, where each participant maximizes their expected utility, i.e. \[ \E u_i(b) \geq \E u_i(b_{-i}, b_i') \] for all $i$ and for any other strategy $b_i'$ of $i$, where the randomness is taken over the strategies. A \emph{Bayes-Nash equilibrium} is defined in exactly the same way, but in a setting consisting of a joint distribution over types. In that case, the randomness is taken over both types and strategies (which are maps from an agent's type to a plan for bidding over time). We use $\mathrm{Welfare}(b)$ to denote the expected social welfare, i.e. sum of utilities and payments: \[ \mathrm{Welfare}(b) = \E \left[ \sum_i v_i(b) + \sum_j v_j(b) \right] , \] where the expectation is over all randomness. In the setting with inspection costs, utility and social welfare also accounts for the loss of utility from the inspection processes; this will be formalized at the relevant point, Section \ref{sec:inspection}. $\mathrm{Welfare}(\textsc{Opt})$ refers to the optimal social welfare. In the Nash setting, \[ \mathrm{Welfare}(\textsc{Opt}) = \max_M \sum_{\{i,j\} \in M} v_{ij} + v_{ji} , \] where the maximum is over all matchings $M$. In the Bayes-Nash setting, \[ \mathrm{Welfare}(\textsc{Opt}) = \E \left[ \max_M \sum_{\{i,j\} \in M} v_{ij} + v_{ji} \right], \] where the expectation is over the realizations of types. The \emph{price of anarchy} measures the worst-case ratio of $\mathrm{Welfare}(b)$ to $\mathrm{Welfare}(\textsc{Opt})$ in any equilibrium $b$. For Nash equilibrium, we have \[ \text{PoA} = \min \frac{\mathrm{Welfare}(b)}{\mathrm{Welfare}(\textsc{Opt})} ,\] where the minimum is taken over all settings (i.e. all types of the participants) and all Nash equilibria $b$. The Bayes-Nash price of anarchy is defined in exactly the same way, but the minimum is now over all Bayes-Nash settings (i.e. joint distributions on types) and all Bayes-Nash equilibrium strategy profiles $b$. Note that a Nash equilibrium is a special case of Bayes-Nash where the type distributions are degenerate. Therefore, a Bayes-Nash price of anarchy result immediately implies a Nash price of anarchy.
{'timestamp': '2022-03-07T02:03:42', 'yymm': '2203', 'arxiv_id': '2203.02023', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.02023'}
arxiv
\section{Introduction} \label{sec:intro} Deep Generative Networks (DGNs) have emerged as the go-to framework for generative modeling of high-dimensional dataset, such as natural images. Within the realm of DGNs, different frameworks can be used to produce an approximation of the data distribution e.g. Generative Adversarial Networks (GANs) \cite{goodfellow2020generative}, Variational AutoEncoders (VAEs) \cite{kingma2013auto} or flow-based models \cite{prenger2019waveglow}. But despite the different training settings and losses that each of these frameworks aim to minimize, the evaluation metric of choice that is used to characterize the overall quality of generation is the {\em Fr\'echet Inception Distance} (FID) \cite{heusel2017gans}. The FID is obtained by taking the Fr\'echet Distance in the InceptionV3 \cite{szegedy2016rethinking} embedding space between two distributions; the distributions are usually taken to be the training dataset and samples from a DGN trained on the dataset. It has been established in prior work \cite{sajjadi2018assessing} that FID non-linearly combines measures of quality and diversity of the samples, which has inspired further research into disentanglement of these quantities as {\em precision} and {\em recall} \cite{sajjadi2018assessing, kynkaanniemi2019improved} metrics respectively. Recent state-of-the-art DGNs such as BigGAN \cite{brock2018large}, StyleGAN2/3 \cite{karras2020analyzing,karras2021alias}, and NVAE \cite{vahdat2020nvae} have reached FIDs nearly as low as one could get when comparing subsets of real data with themselves. This has led to the deployment of DGNs in a variety of applications, such as real-world high-quality content generation or data-augmentation. However, it is clear that {\bf depending on the domain of application, generating samples from the best FID model could be suboptimal}. For example, realistic content generation might benefit more from high-quality (precision) samples, while data-augmentation might benefit more from samples of high-diversity (recall), even if in each case, the overall FID slightly diminishes \cite{giacomello2018doom,islam2021crash}. Therefore, a number of state-of-the-art DGNs have introduced a controllable parameter to trade-off between the precision and recall of the generated samples, e.g., truncated latent space sampling \cite{brock2018large}, interpolating truncation \cite{karras2019style, karras2020analyzing}. However, those methods do not always work ``out-of-the-box'' \cite{brock2018large} as they require orthogonal regularization of the DGN's parameters during training; those methods also lack a clear theoretical understanding which can limit their deployment for sensitive applications. {\bf In this paper, we propose a principled solution to control the quality (precision) and diversity (recall) of DGN samples that does not require retraining nor specific conditioning of model training.} Our proposed method, termed {\em Polarity Sampling}, is based on the analytical form of the learned DGN sample distribution and introduces a new hyperparameter, that we dub the {\em polarity} $\rho \in \mathbb{R}$, that adapts the latent space distribution for post-training control. {\bf The polarity parameter provably forces the latent distribution to concentrate on the modes of the DGN distribution, i.e., regions of high probability ($\rho<0$), or on the anti-modes, i.e., regions of low-probability ($\rho>0$); with $\rho=0$ recovering the original DGN distribution.} The Polarity Sampling process depends only on the top singular values of the DGN's output Jacobian matrices evaluated at each input sample and can be implemented to perform online sampling. A crucial benefit of Polarity Sampling lies in its theoretical derivation from the analytical DGN data distribution, where the product of the DGN Jacobian matrices singular values -- raised to the power $\rho$ -- provably controls the DGN samples distribution as desired. See Fig.~\ref{fig:teaser} for an initial example of Polarity Sampling in action. Our main contributions are as follows. \noindent[C1] We first provide the theoretical derivation of Polarity Sampling based on the singular values of the generator Jacobian matrix. We provide pseudocode for Polarity Sampling and an approximation scheme to control its computational complexity as desired (\cref{sec:method}). \noindent[C2] We demonstrate on a range of DGNs and and datasets that polarity sampling not only allows one to move on the precision-recall Pareto frontier (\cref{sec:pareto}), i.e., it controls the quality and diversity efficiently, but it also reaches improved FID scores for each model (\cref{sec:sota}). \noindent[C3] We leverage the fact that negative polarity sampling provides access to the modes of the learned DGN distribution, enabling us to explore several timely and important questions regarding DGNs. We provide visualization of the modes of trained GANs and VAEs (\cref{sec:mode}) and assess whether latent space truncation brings samples closer to the DGN modes, using the relation between DGN modes and perceptual-path-length (\cref{sec:PPL}). \\ \section{Related Work} \label{sec:related} \noindent{\bf Deep Generative Networks as Piecewise-Linear Mappings.}~In most DGN settings, once training has been completed, sampling new data points is done by first sampling latent space samples ${\bm{z}}_i \in \mathbb{R}^{K}$ from a latent space distribution ${\bm{z}}_i\sim p_{{\bm{z}}}$ and then processing those samples through a DGN $G:\mathbb{R}^{K} \mapsto \mathbb{R}^{D}$ to obtain the sample ${\bm{x}}_i\triangleq G({\bm{z}}_i),\forall i$. One recent line of research that we will rely on through our study consists in formulating DGNs as Continuous Piecewise Affine (CPA) mappings \cite{montufar2014number,balestriero2018spline}, that be expressed as \begin{align} G({\bm{z}}) = \sum_{\omega \in \Omega}({\bm{A}}_{\omega}{\bm{z}}+{\bm{b}}_{\omega})1_{\{{\bm{z}} \in \omega\}},\label{eq:CPA} \end{align} where $\Omega$ is the input space partition induced by the DGN architecture, $\omega$ is a partition-region where $z$ resides, and ${\bm{A}}_{\omega}, {\bm{b}}_{\omega}$ are the corresponding slope and offset parameters. The CPA formulation of \cref{eq:CPA} either represents the exact DGN mapping, when the nonlinearities are CPA e.g. (leaky-)ReLU, max-pooling, or represents a first-order approximation of the DGN mapping. For more background on CPA networks, see \cite{balestriero2020mad}. {\em The key result from \cite{daubi} that we will leverage is that \cref{eq:CPA} is either exact, or can be made close enough to the true mapping $G$, to be considered exact for practical purposes}. \noindent{\bf Post-Training Improvement of a DGN's Latent Distribution.} The idea that the training-time latent distribution $p_{{\bm{z}}}$ might be sub-optimal for test-time evaluation has led to multiple research directions to improve quality of samples post-training. \cite{tanaka2019discriminator,che2020your} proposed to optimize the samples ${\bm{z}} \sim p_{{\bm{z}}}$ based on a Wasserstein discriminator, leading to the {\em Discriminator Optimal Transport} (DOT) method. That is, after sampling a latent vector ${\bm{z}}$, the latter is repeatedly updated such that the produced datum has greater quality. \cite{tanielian2020learning} proposes to simply remove the samples that produce data out of the true manifold. This can be viewed as a binary rejection decision of any new sample ${\bm{z}} \sim p_{{\bm{z}}}$. \cite{azadi2018discriminator} were the first to formally introduce rejection sampling based on a discriminator providing a quality estimate used for the rejection sampling of candidate vectors ${\bm{z}} \sim p_{{\bm{z}}}$. Replacing rejection sampling with the Metropolis-Hasting algorithm \cite{hastings1970monte} led to the method of \cite{turner2019metropolis}, coined MH-GAN. An improvement made by \cite{grover2019bias} was to use the {\em Sampling-Importance-Resampling} (SIR) algorithm \cite{rubin1988using}. \cite{issenhuth2021latent} proposes {\em latentRS} which consists in training a WGAN-GP \cite{gulrajani2017improved} on top of any given DGN to learn an improved latent space distribution producing higher-quality samples. \cite{issenhuth2021latent} also proposes {\em latentRS+GA}, where the generated samples from that learned distribution are further improved through gradient ascent. \noindent{\bf Truncation of the Latent Distribution.} Latent space truncation was introduced for high-resolution face image generation by \cite{marchesi2017megapixel} as a method of removing generated artifacts. The authors employed a latent prior of ${\bm{z}} \sim \mathcal{U}[-1,1]$ during training and ${\bm{z}} \sim \mathcal{U}[-.5,.5]$ for qualitative improvement during evaluation. The ``truncation trick'' was formally introduced by \cite{brock2018large} where the authors propose resampling latents $z$ if they exceed a specified threshold as truncation. The authors also use weight orthogonalization during training to make truncation amenable. It is also speculated in \cite{brock2018large} that reducing the truncation parameter $\psi$, makes the samples converge to the DGN distribution modes, we will argue against that in \cref{sec:truncation}. Style-based architectures \cite{karras2019style,karras2020analyzing} introduce a linear interpolation based truncation in the style-space, which is also designed to converge to the average of the dataset \cite{karras2019style}. Ablations for truncation for style-based generators are provided in \cite{kynkaanniemi2019improved}. \section{Introducing The Polarity Parameter From First Principles} \label{sec:method} In this section, we introduce \textit{Polarity Sampling} method that enables us to control generation quality and diversity of DGNs. This is done by first expressing the analytical form of DGNs' output distribution, and parametrizing the latent space distribution by the singular values of its Jacobian matrix and our {\em polarity} parameter (\cref{sec:theory}). We provide pseudo-code and an approximation strategy to allow for fast sampling (\cref{sec:pseudocode}). \subsection{Analytical Output-Space Density Distribution} \label{sec:theory} Given a DGN $G$, samples are obtained by sampling $G({\bm{z}})$ with a given latent space distribution, as in ${\bm{z}} \sim p_{{\bm{z}}}$. This produces samples that will lie on the {\em image} of $G$, the distribution of which is subject to $p_{{\bm{z}}}$, the DGN latent space partition $\Omega$ and per-region affine parameters ${\bm{A}}_{\omega},{\bm{b}}_{\omega}$. We denote the DGN output space distribution as $p_{G}$. Under an injective DGN mapping assumption ($g(z)=g(z') \implies z=z'$) (which holds for various architectures, see, e.g., \cite{puthawala2020globally}) it is possible to obtain the analytical form of the DGN output distribution $p_{G}$ \cite{humayun2021magnet}. For a reason that will become clear in the next section, we only focus here on the case ${\bm{z}} \sim U(\mathcal{D})$ i.e., using a Uniform latent space distribution over the domain $\mathcal{D}$. Leveraging the Moore-Penrose pseudo inverse \cite{trefethen1997numerical} ${\bm{A}}^{\dag}\triangleq ({\bm{A}}^T{\bm{A}})^{-1}{\bm{A}}^T$, we obtain the following. \begin{thm} \label{thm:general_density} For ${\bm{z}} \sim U(\mathcal{D})$, the probability density $p_{G}({\bm{x}})$ is given by \begin{equation} p_{G}({\bm{x}}) \propto \sum_{\omega \in \Omega} \det({\bm{A}}_{\omega}^T{\bm{A}}_{\omega})^{-\frac{1}{2}}\mathds{1}_{\{{\bm{A}}^{\dag}_{\omega}({\bm{x}}-{\bm{b}}_{\omega}) \in \omega \cap \mathcal{D}\}}, \end{equation} where $\det$ is the pseudo-determinant, i.e., the product of the nonzero eigenvalues of ${\bm{A}}_{\omega}^T{\bm{A}}_{\omega}$. (Proof in Appendix~\ref{proof:general_density}.) \end{thm} Note that one can also view $\det({\bm{A}}_{\omega}^T{\bm{A}}_{\omega})^{1/2}$ as the product of the nonzero singular values of ${\bm{A}}_{\omega}$. Theorem \ref{thm:general_density} is crucial to our development since it demonstrates that the probability of a sample ${\bm{x}} = g({\bm{z}})$ is proportional to the change in volume $(\det({\bm{A}}_{\omega}^T{\bm{A}}_{\omega})^{1/2})$ produced by the coordinate system ${\bm{A}}_{\omega}$ of the region $\omega$ in which ${\bm{z}}$ lies in (recall \cref{eq:CPA}). If a region $\omega \in \Omega$ has a slope matrix ${\bm{A}}_{\omega}$ that contracts the space ($\det({\bm{A}}_{\omega}^T{\bm{A}}_{\omega})<1$) then the output density on that region --- mapped to the output space region $\{{\bm{A}}_{\omega}{\bm{u}}+{\bm{b}}_{\omega}:{\bm{u}} \in \omega\}$ --- is increased, as opposed to other regions that either do not contract the space as much, or even expand it ($\det({\bm{A}}_{\omega}^T{\bm{A}}_{\omega})>1$). Hence, the concentration of samples in each output space region depends on how that region's slope matrix contracts or expands the space, relative to all other regions. \subsection{Controlling the Density Concentration with a Single Parameter} Given \cref{thm:general_density}, we directly obtain an explicit parametrization of $p_{{\bm{z}}}$ that enables us to control the distribution of samples in the output space, i.e., to control $p_{G}$. In fact, note that one can sample from the mode of the DGN distribution by employing ${\bm{z}} \sim U(\omega^*), \omega^* = \argmin_{\omega \in \Omega}\det({\bm{A}}_{\omega}^T{\bm{A}}_{\omega})$. Alternatively, one can sample from the region of lowest probability, i.e., the anti-mode, by employing ${\bm{z}} \sim U(\omega^*), \omega^* = \argmax_{\omega \in \Omega}\det({\bm{A}}_{\omega}^T{\bm{A}}_{\omega})$. This directly leads to our Polarity Sampling formulation that adapts the latent space distribution based on the per-region pseudo-determinants. \begin{cor} \label{cor:pol_density} The latent space distribution \begin{equation} p_{\rho}({\bm{z}}) \propto \sum_{\omega \in \Omega}\det({\bm{A}}_{\omega}^T{\bm{A}}_{\omega})^{\frac{\rho}{2}} \mathds{1}_{\{{\bm{z}} \in \omega\}},\label{eq:latent_distribution} \end{equation} where ${\rho}\in\mathbb{R}$ is the polarity parameter, produces the DGN output distribution \begin{equation} p_{G}({\bm{x}})\propto \sum_{\omega \in \Omega} \det({\bm{A}}_{\omega}^T{\bm{A}}_{\omega})^{\frac{{\rho}-1}{2}}\mathds{1}_{\{{\bm{A}}^{\dag}_{\omega}({\bm{x}}-{\bm{b}}_{\omega}) \in \omega \cap \mathcal{D}\}},\label{eq:density_rho} \end{equation} which falls back to the standard DGN distribution for ${\rho}=0$, to sampling of the mode(s) for ${\rho} \to -\infty$ and to sampling of the the anti-mode(s) for ${\rho} \to \infty$. (Proof in Appendix~\ref{proof:pol_density}.) \end{cor} Polarity Sampling consists of using the latent space distribution \cref{eq:latent_distribution} with a polarity parameter $\rho$, that is either negative, concentrating the samples toward the mode(s) of the DGN distribution $p_{G}$, positive, concentrating the samples towards the anti-modes(s) of the DGN distribution $p_{G}$ or zero, which removes the effect of polarity. Intuitively, $\rho<0$ will produce samples from ``higher-confidence'' regions of the data manifold, and $\rho>0$ will produce samples from ``lower-confidence'' regions. Note that Polarity Sampling provides a method to change the output density in a continuous fashion. Its practical effect, as we will see in Sec.~\ref{sec:pareto}, is to control the quality and diversity of the obtained samples. \subsection{Approximation and Implementation} \label{sec:pseudocode} We now provide the details and pseudo-code for the Polarity Sampling procedure that implements \cref{cor:pol_density}. \noindent{\bf Computing the ${\bm{A}}_{\omega}$ Matrix.}~The per-region slope matrix as in \cref{eq:CPA}, can be obtained given any DGN by first sampling a latent vector ${\bm{z}} \in \omega$, and then obtaining the Jacobian matrix of the DGN ${\bm{A}}_{\omega} = {\bm{J}}_{{\bm{z}}}G({\bm{z}}),\forall {\bm{z}} \in \omega$. This has the benefit of directly employing automatic differentiation libraries and thus does not require any exhaustive implementation nor derivation. Computing ${\bm{J}}_{{\bm{z}}}G({\bm{z}})$ of a generator is not uncommon in practice, e.g., it is employed during path length regularization of StyleGAN2 \cite{karras2020analyzing}. \noindent{\bf Discovering the Regions $\omega \in \Omega$.}~As per \cref{eq:latent_distribution}, we need to obtain the singular values of ${\bm{A}}_{\omega}$ (see next paragraph) for each region $\omega \in \Omega$. This is often a complicated task, especially for state-of-the-art DGNs that can have a partition $\Omega$ made of a number of regions growing with the architecture depth and width \cite{montufar2021sharp}. Furthermore, checking if ${\bm{z}} \in \omega$ requires one to solve a linear program \cite{fischetti2017deep}, which is expensive. As a result, we develop an approximation which consists of sampling many ${\bm{z}} \sim U(\mathcal{D})$ vectors from the latent space (hence our uniform prior assumption in \cref{cor:pol_density}), and computing their corresponding matrices ${\bm{A}}_{\omega({\bm{z}})}$. This way, we are guaranteed that ${\bm{A}}_{\omega({\bm{z}})}$ corresponds to the slope of the region $\omega$ in which ${\bm{z}}$ falls in, removing the need to check whether ${\bm{z}} \in \omega$. We do so over $N$ samples obtained uniformly from the DGN latent space (based on the original latent space domain). Selection of $N$ can impact performance as this exploration needs to discover as many regions from $\Omega$ as possible. \noindent{\bf Singular Value Computation.}~Computing the singular values of ${\bm{A}}_{\omega}$ is an $\mathcal{O}(\min(K,D)^3)$ operation \cite{golub1971singular}. However, not all singular values might be relevant, e.g., the smallest singular values that are nearly constant across regions $\omega$ can be omitted without altering \cref{cor:pol_density}. Hence, we employ only the top-$k$ singular values of ${\bm{A}}_{\omega}$ to speed up singular value computation to $\mathcal{O}(k^3)$. (Further approximation could be employed if needed, e.g., power iteration \cite{packard1988power}). While the required number of latent space samples $N$ and the number of top singular values $k$ might seem to be a limitation of Polarity Sampling, we have found in practice that $N$ and $k$ for state-of-the-art DGNs can be set at $N \approx 200K$, $k \in [30,100]$. We conduct a careful ablation study and demonstrate the impact of different choices for $N$ and $k$ in \cref{fig:topk_dets,tab:ablation_N,tab:ablation_topk} in \cref{sec:effect_N_k}. Computation times and software/hardware details are provided in \cref{sec:times}. To reduce round-off errors that can occur for extreme values of $\rho$, we compute the product of singular values in log-space, as shown in \cref{alg:sampling}. \begin{algorithm}[t!] \caption{ Polarity Sampling procedure with polarity $\rho$; the online version is given in \cref{alg:online} in \cref{sec:online_algorithm}. For implementation details, see \cref{sec:pseudocode}.}\label{alg:sampling} \begin{algorithmic} \Require $K>0,S>0,N \gg S,G,\mathcal{D},\rho \in \mathbb{R}$ \State ${\mathcal{Z}},{\mathcal{S}},{\mathcal{R}} \gets [],[],[]$ \For{$n=1,\dots,N$} \State ${\bm{z}} \sim U(\mathcal{D})$ \State $\sigma = {\rm SingularValues}({\bm{J}}_{{\bm{z}}}G({\bm{z}}),{\rm decreasing=True})$ \State ${\mathcal{Z}}.{\rm append}({\bm{z}})$ \State ${\mathcal{S}}.{\rm append}(\rho \sum_{k=1}^{K}\log(\sigma[k]+\epsilon))$ \EndFor \For{$n=1,\dots,S$} \State $i \sim {\rm Categorical}({\rm prob}={\rm softmax}({\mathcal{S}}))$ \State ${\mathcal{R}}.{\rm append}({\mathcal{Z}}[i])$ \EndFor \Ensure ${\mathcal{R}}$ \end{algorithmic} \end{algorithm} \begin{figure}[t!] \begin{center} \begin{minipage}{0.02\linewidth} \centering \rotatebox{90}{\footnotesize \hspace{0.7cm}FID} \end{minipage} \begin{minipage}{0.48\linewidth} \centering \includegraphics[width=\linewidth]{ffhq/ffhq_incpol_topksweep.pdf}\\[-0.5em] {\footnotesize polarity $(\rho)$} \end{minipage} \begin{minipage}{0.48\linewidth} \centering \includegraphics[width=\linewidth]{ffhq/ffhq_incpol_ndetz.pdf}\\[-0.5em] {\footnotesize polarity $(\rho)$} \end{minipage} \end{center} \vspace{-0.5cm} \caption{ Effect of Polarity Sampling on FID of a StyleGAN2-F model pretrained on FFHQ for varying number of top-$k$ singular values ({\bf left}) and varying number of latent space samples $N$ used to obtain per-region slope matrix ${\bm{A}}_{\omega}$ singular values ({\bf right}) (recall \cref{sec:pseudocode,alg:sampling}). The trend in FIDs to evaluate the impact of $\rho$ stabilizes when using around $k=40$ singular values and $N\approx$200,000 latent space samples. For the effect of $k$ and $N$ on precision and recall, see \cref{fig:topk_prec_recall}. } \label{fig:topk_dets} \end{figure} We summarize how to obtain $S$ samples using the above steps in the pseudo-code given in \cref{alg:sampling} and provide an efficient solution to reduce the memory requirement incurred when computing the large matrix ${\bm{A}}_{\omega}$ in \cref{sec:memory}. We also provide an implementation that enables online sampling in \cref{alg:online} (\cref{sec:online_algorithm}). It is also possible to control the DGN prior $p_{{\bm{z}}}$ with respect to a different space than the data-space e.g. inception-space, or with a different input space than the latent-space e.g. style-space in StyleGAN2/3. This incurs no changes in \cref{alg:sampling} except that the DGN is now considered to either be a subset of the original one, or to be composed with a VGG/InceptionV3 network. We provide implementation details for style-space, VGG-space, and Inception-space in \cref{sec:other_space}. In fact, in those cases, the partition $\Omega$ and the per-region mapping parameters ${\bm{A}}_{\omega},{\bm{b}}_{\omega}$ are the ones of the corresponding sub-network or composition of networks (recall \cref{eq:CPA}). Polarity Sampling adapts the DGN prior distribution to get the modes or anti-modes with respect to the considered output spaces. \section{Controlling Precision, Recall, and FID via Polarity} \label{sec:experiments} We now provide empirical validation of Polarity Sampling with an extensive array of experiments. Since calculation of distribution metrics such as FID, precision, and recall are sensitive to image processing nuances, we use each model's original code repository except for BigGAN-deep on ImageNet \cite{deng2009imagenet}, for which we use the evaluation pipeline specified for ADM \cite{dhariwal2021diffusion}. For NVAE (trained on colored-MNIST \cite{arjovsky2019invariant}), we use a modified version of the StyleGAN3 evaluation pipeline. Precision and recall metrics are all based on the implementation of \cite{kynkaanniemi2019improved}. Metrics in \cref{tab:main_result} are calculated for 50K training samples to be able to compare with existing latent reweighing methods. For all other results, the metrics are calculated using $\min\{N_{D},100K\}$ training samples, where $N_{D}$ is the number of samples in the dataset. \subsection{Polarity Efficiently Parametrizes the Precision-Recall Pareto Frontier} \label{sec:pareto} \begin{figure}[t!] \begin{center} \begin{minipage}{0.02\linewidth} \centering \rotatebox{90}{\small \hspace{1cm}Precision\hspace{2.7cm}Precision\hspace{2.7cm}Precision} \end{minipage} \begin{minipage}{0.48\linewidth} \centering \includegraphics[width=\linewidth]{pareto/pareto_lsun_car_stg2f_vggpol.pdf}\\ \includegraphics[width=\linewidth]{sec/pareto_afhq_stg3_pixelpol.pdf}\\ \includegraphics[width=\linewidth]{pareto/pareto_lsun_church_stg2f_vggpol.pdf}\\[-0.4em] {\small Recall} \end{minipage} \begin{minipage}{0.48\linewidth} \centering \includegraphics[width=\linewidth]{pareto/pareto_ffhq_stg3_pixelpol.pdf}\\ \includegraphics[width=\linewidth]{pareto/pareto_lsun_cats_stg2f_stypol.pdf}\\ \includegraphics[width=\linewidth]{pareto/pareto_ffhq_stg2f_vggpol.pdf}\\[-0.4em] {\small Recall} \end{minipage} \end{center} \vspace{-0.5cm} \caption{Pareto frontier of the precision-recall metrics can be obtained solely by varying the polarity parameter, for any given truncation level. We depict here six different models and datasets. Results for additional models and datasets are provided in \cref{fig:teaser} and \cref{fig:more_pareto}. } \label{fig:pareto} \end{figure} \begin{figure*}[t!] \centering \begin{minipage}{0.02\linewidth} \hfill \end{minipage} \begin{minipage}{0.10\linewidth} \centering {\scriptsize (modes\reflectbox{$\to$})}\\ $\rho=-2$ \end{minipage} \begin{minipage}{0.10\linewidth} \centering\vspace{0.28cm} $\rho=-1$ \end{minipage} \begin{minipage}{0.10\linewidth} \centering\vspace{0.28cm} $\rho=-0.5$ \end{minipage} \begin{minipage}{0.10\linewidth} \centering\vspace{0.28cm} $\rho=-0.2$ \end{minipage} \begin{minipage}{0.10\linewidth} \centering {\scriptsize (baseline)}\\ $\rho=0$ \end{minipage} \begin{minipage}{0.10\linewidth} \centering\vspace{0.28cm} $\rho=0.2$ \end{minipage} \begin{minipage}{0.10\linewidth} \centering\vspace{0.28cm} $\rho=0.5$ \end{minipage} \begin{minipage}{0.10\linewidth} \centering\vspace{0.28cm} $\rho=1$ \end{minipage} \begin{minipage}{0.10\linewidth} \centering {\scriptsize ($\to$ anti-modes)}\\ $\rho=2$ \end{minipage}\\ \begin{minipage}{0.02\linewidth} \rotatebox[origin=c]{90}{LSUN Cars} \end{minipage} \begin{minipage}{0.97\textwidth} \includegraphics[width=\linewidth]{alpha_sweep/cars_alpha_stylespace_sweep.png} \end{minipage}\\ \begin{minipage}{0.02\linewidth} \rotatebox[origin=c]{90}{LSUN Cats} \end{minipage} \begin{minipage}{0.97\textwidth} \includegraphics[width=\linewidth]{alpha_sweep/cats_alpha_stylespace_sweep_blurred.png} \end{minipage}\\ \begin{minipage}{0.02\linewidth} \rotatebox[origin=c]{90}{LSUN Church} \end{minipage} \begin{minipage}{0.97\textwidth} \includegraphics[width=\linewidth]{alpha_sweep/church_alpha_sweep_pixel_blurred.png} \end{minipage} \vspace{-0.2cm} \caption{Curated samples of cars and cats for Polarity Sampling in style-space, and church for Polarity Sampling in pixel-space. Full batch submitted with the supplementary materials. (Qualitative comparison with truncation sweep in \cref{fig:truncation_sweep_images} and nearest training samples in \cref{fig:nearest} in the Appendix.) None of the images correspond to training samples, as we discuss in \cref{sec:mode}. } \label{fig:qualitative_alpha_sweep} \end{figure*} As we have discussed above, Polarity Sampling can explicitly sample from the modes or anti-modes of any learned DGN distribution. Since the DGN is trained to fit the training distribution, sampling from the modes and anti-modes correspond to sampling from regions of the data manifold that are approximated better/worse by the DGN . Therefore Polarity Sampling is an efficient parameterization of the trade-off between precision and recall of generation \cite{kynkaanniemi2019improved} since regions with higher precision are regions where the manifold approximation is more accurate. As experimental proof, we provide in \cref{fig:pareto} the precision-recall trade-off when sweeping polarity, and compare it with truncation \cite{karras2019style} for pretrained StyleGAN\{2,3\} architectures. We see that Polarity Sampling offers a competitive alternative to truncation for controlling the precision-recall trade-off of DGNs across datasets and models. For any given precision, the $\rho$ parameter allows us to reach greater recall than what is possible via latent space truncation \cite{karras2019style}. And conversely, for any given recall, it is possible to reach a higher precision than what can be attained using latent space truncation. We see that diversity collapses rapidly for latent truncation compared to Polarity Sampling, across all architectures, which is a major limitation. In addition to that, controlling both truncation and polarity allows us to further extend the Pareto frontier for all of our experiments. Apart from the results presented here, we also see that polarity can be used to effectively control the precision-recall trade-off for BigGAN-deep \cite{brock2018large} and ProGAN \cite{karras2017progressive}. ProGAN unlike BigGAN and StyleGAN, is not compatible with truncation based methods, i.e., latent space truncation has negligible effect on precision-recall. Hence polarity offers a great benefit over those existing solutions: Polarity Sampling can be applied regardless of training or controllability factors that are preset in the DGN design. We provide additional results in \cref{appendix:extra}. \subsection{Polarity Improves Any DGN's FID} \label{sec:sota} We saw in \cref{sec:pareto} that polarity can be used to control quality versus diversity in a meaningful and controllable manner. In this section, we connect the effect of polarity with FID. Recall that the FID metric nonlinearly combines quality and diversity \cite{sajjadi2018assessing} into a distribution distance measure. Since polarity allows us to control the output distribution of the DGN, an indirect result of polarity is the reduction of FID by matching the inception embedding distribution of the DGN with that of the training set distribution. Recall that $\rho=0$ recovers the baseline DGN sampling; for all the state-of-the-art methods in question, we reach lower (better) FID by using a nonzero polarity. In \cref{tab:prior_art}, we compare Polarity Sampling with state-of-the-art solutions that propose to improve FID by learning novel DGN latent space distributions, as were discussed in \cref{sec:related}. We see that for a StyleGAN2 pre-trained on the LSUN church \cite{yu2015lsun} dataset, by increasing the diversity ($\rho=0.2$) of the Vgg embedding distribution, Polarity Sampling surpasses the FID of methods reported in literature that post-hoc improves quality of generation. \begin{table}[t!] \centering \def\arraystretch{0.6}% \begin{tabular}{@{}lrrr@{}} \toprule \multicolumn{4}{r}{\textbf{LSUN Church 256$\times$256}} \\ \midrule \hline StyleGAN2 variant & \multicolumn{1}{l}{FID $\downarrow$} & \multicolumn{1}{l}{Prec $\uparrow$} & \multicolumn{1}{l}{Recall $\uparrow$} \\ \midrule Standard & 6.29 & .60 & .51 \\ SIR$^\dagger$ \cite{rubin1988using} & 7.36 & .61 & \textbf{.58} \\ DOT$^\dagger$ \cite{tanaka2019discriminator} & 6.85 & .67 & .48 \\ latentRS$^\dagger$ \cite{issenhuth2021latent} & 6.31 & .63 & .58 \\ latentRS+GA$^\dagger$ \cite{issenhuth2021latent} & 6.27 & \textbf{.73} & .43 \\ $\rho$-sampling 0.2 & \textbf{6.02} & .57 & .53 \\ \bottomrule \end{tabular} \vspace{-0.2cm} \caption{ Comparison of Polarity Sampling with latent reweighting techniques from literature. FID, Precision and Recall is calculated using 50,000 samples. $^\dagger$Metrics reported from papers due to unavailability of code. $^\dagger$Precision-recall is calculated with $1024$ samples only. } \label{tab:prior_art} \end{table} \begin{table*}[t!] \centering \setlength\tabcolsep{0.5em} \begin{tabular}{llrrrllrr} \hline Model & FID $\downarrow$ & \multicolumn{1}{l}{Precision $\uparrow$} & \multicolumn{1}{l}{Recall $\uparrow$} & & Model & FID $\downarrow$ & \multicolumn{1}{l}{Precision $\uparrow$} & \multicolumn{1}{l}{Recall $\uparrow$} \\ \hline \multicolumn{4}{r}{\textbf{LSUN Church 256$\times$256}} & & \multicolumn{4}{r}{\textbf{LSUN Cat 256$\times$256}} \\ \cline{1-4} \cline{6-9} DDPM$^\dagger$ \cite{ho2020denoising} & 7.86 & - & - & & ADM (dropout)$^\dagger$ & {\bf 5.57} & 0.63 & \textbf{0.52} \\ StyleGAN2 & 3.97 & 0.59 & 0.39 & & StyleGAN2 & 6.49 & 0.62 & 0.32 \\ + $\rho$-sampling Vgg 0.001 & 3.94 & 0.59 & 0.39 & & + $\rho$-sampling Pix 0.01 & 6.44 & 0.62 & 0.32 \\ + $\rho$-sampling Pix -0.001 & \textbf{3.92} & \textbf{0.61} & \textbf{0.39} & & + $\rho$-sampling Sty -0.1 & 6.39 & \textbf{0.64} & 0.32 \\ \cline{1-4} \cline{6-9} \multicolumn{4}{r}{\textbf{LSUN Car 512$\times$384}} & & \multicolumn{4}{r}{\textbf{FFHQ 1024$\times$1024}} \\ \cline{1-4} \cline{6-9} StyleGAN$^\dagger$ & 3.27 & \textbf{0.70} & 0.44 & & StyleGAN2-E & 3.31 & \textbf{0.71} & 0.45 \\ StyleGAN2 & 2.34 & 0.67 & 0.51 & & Projected GAN$^\dagger$ \cite{sauer2021projected} & 3.08 & 0.65 & 0.46 \\ + $\rho$-sampling Vgg -0.001 & 2.33 & 0.68 & 0.51 & & StyleGAN3-T & 2.88 & 0.65 & 0.53 \\ + $\rho$-sampling Sty 0.01 & \textbf{2.27} & 0.68 & \textbf{0.51} & & + $\rho$-sampling Vgg -0.01 & 2.71 & 0.66 & \textbf{0.54} \\ + $\rho$-sampling Pix 0.01 & 2.31 & 0.68 & 0.50 & & & & & \\ \cline{1-4} \multicolumn{4}{r}{\textbf{ImageNet 256$\times$256}} & & StyleGAN2-F & 2.74 & 0.68 & 0.49 \\ \cline{1-4} DCTransformer$^\dagger$ \cite{nash2021generating} & 36.51 & 0.36 & 0.67 & & + $\rho$-sampling Ic3 0.01 & \textbf{2.57} & 0.67 & 0.5 \\ VQ-VAE-2$^\dagger$ \cite{razavi2019generating} & 31.11 & 0.36 & 0.57 & & + $\rho$-sampling Pix 0.01 & 2.66 & 0.67 & 0.5 \\ SR3 $^\dagger$\cite{saharia2021image} & 11.30 & - & - & & & & & \\ \cline{6-9} IDDPM$^\dagger$\cite{nichol2021improved} & 12.26 & 0.70 & 0.62 & & \multicolumn{4}{r}{\textbf{AFHQv2 512$\times$512}} \\ \cline{6-9} ADM$^\dagger$\cite{dhariwal2021diffusion} & 10.94 & 0.69 & \textbf{0.63} & & StyleGAN2$^\dagger$ & 4.62 & - & - \\ ICGAN+DA$^\dagger$\cite{casanova2021instanceconditioned} & 7.50 & - & - & & StyleGAN3-R$^\dagger$ & 4.40 & - & - \\ BigGAN-deep & 6.86 & 0.85 & 0.29 & & StyleGAN3-T & 4.05 & 0.70 & 0.55 \\ + $\rho$-sampling Pix 0.0065 & 6.82 & \textbf{0.86} & 0.29 & & + $\rho$-sampling Vgg -0.001 & \textbf{3.95} & \textbf{0.71} & \textbf{0.55} \\ ADM+classifier guidance & \textbf{4.59} & 0.82 & 0.52 & & & & & \\ \hline \end{tabular} \vspace{-0.2cm} \caption{$^\dagger$Paper reported metrics. We observe that moving away from $\rho=0$, Polarity Sampling improves FID across models and datasets, empirically validating that the top singular values of a DGN's Jacobian matrices contain meaningful information to improve the overall quality of generation}. \label{tab:main_result} \end{table*} In \cref{tab:main_result}, we present for LSUN \{Church, Car, Cat\} \cite{yu2015lsun}, ImageNet \cite{deng2009imagenet}, FFHQ \cite{karras2019style}, and AFHQv2 \cite{choi2020stargan,karras2021alias} improved FID obtained \textit{solely by changing the polarity $\rho$} of a state-of-the-art DGN. This implies that Polarity Sampling provides an efficient solution to adapt the DGN latent space. We observe that, given any specific setting, $\rho \not = 0$ always improves a model's FID. We see that in a case specific manner, both positive and negative $\rho$ improves the FID.For StyleGAN2-F trained on FFHQ, \textit{increasing the diversity} of the inception space embedding distribution helps reach a new state-of-the-art FID. By \textit{increasing the precision} of StyleGAN3-T via Polarity Sampling in the Vgg space, we are able to surpass the FID of baseline StyleGAN2-F \cite{karras2021alias}. We observe that controlling the polarity of the InceptionV3 embedding distribution of StyleGAN2-F gives the most significant gains in terms of FID. This is due to the fact that the Frechet distance between real and generated distributions is directly affected while performing Polarity Sampling in the Inception space. We provide generated samples in \cref{fig:qualitative_alpha_sweep} varying the style-space $\rho$ for LSUN cars and LSUN cats, whereas varying the pixel-space $\rho$ for LSUN Church. It is clear that $\rho<0$ i.e. sampling closer to the DGN distribution modes produce samples of high visual quality, while $\rho>0$ i.e. sampling closer to the regions of low-probability produce samples of high-diversity, with some samples which are off the data manifold due to the approximation quality of the DGN in that region. Using Polarity Sampling, we are able to advance the state-of-the-art performance on three different settings: for StyleGAN2 on the FFHQ \cite{karras2019style} Dataset to FID 2.57, StyleGAN2 on the LSUN \cite{yu2015lsun} Car Dataset to FID 2.27, and StyleGAN3 on the AFHQv2 \cite{karras2021alias} Dataset to FID 3.95. For additional experiments with NVAE and color-MNIST under controlled training and reference dataset distribution shift, see \cref{sec:shift}. \vspace{-0.2cm} \section{New Insights into DGN Distributions} \vspace{-0.2cm} In \cref{sec:experiments} we demonstrated that Polarity Sampling is a practical method to manipulate DGN output distributions to control their quality and diversity. We now demonstrate that Polarity Sampling has more foundational theoretical applications as well. In particular, we dive into several timely questions regarding DGNs that can be probed using our framework. \vspace{-0.3cm} \subsection{Are GAN/VAE Modes Training Samples?} \label{sec:mode} \vspace{-0.3cm} Mode collapse \cite{metz2016unrolled,srivastava2017veegan,bang2021mggan} has complicated GAN training for many years. It consists of the entire DGN collapsing to generating a few different samples or modes. For VAEs, modes can be expected to be related to the modes of the empirical dataset distribution, as reconstruction is part of the objective. But this might not be the case with GANs e.g., the modes can correspond to parts of the space where the discriminator is the least good at differentiating between true and fake samples. There has been no reported methods in literature that allows us to observe the modes of a trained GAN. Existing visualization techniques focus on finding the role of each DGN unit \cite{bau2018gan} or finding images that GANs cannot generate \cite{bau2019seeing}. Using Polarity Sampling, we can visualize the DGN modes of DGNs for the first time. In \cref{fig:modes}, we present samples from the modes of BigGAN-deep trained on ImageNet, StyleGAN3 trained on AFHQv2, and NVAE trained on colored-MNIST. We observe that BigGAN modes tend to reproduce the unique features of the class, removing the background and focusing more on the object the class is assigned to. AFHQv2 modes on the other hand, focus on younger animal faces and smoother textures. NVAE modes predominately samples the digit `1' which corresponds to the dataset mode (digit with the least intra-class variation). We also provide in \cref{fig:nn_hist} the distribution of the $l_2$ distances between generated samples and their $3$ nearest training samples for modal ($\rho=$ $-5$) and anti-modal ($\rho=1$) polarity. We see that changing the polarity has negligible effect on the StyleGAN2 nearest neighbor distribution, but for NVAE the modes come closer to the training samples. \begin{figure}[t!] \begin{center} \begin{minipage}{0.32\linewidth} \begin{minipage}{\columnwidth} \centering {\tiny BigGAN Samoyed} \end{minipage} \includegraphics[width=.99\columnwidth]{sec/samoyed_modes.png}\\ \includegraphics[width=.99\columnwidth]{sec/tinca_modes_blurred.png} \begin{minipage}{\columnwidth} \centering \vspace{-1em} {\tiny BigGAN Tench} \end{minipage} \end{minipage} \begin{minipage}{0.32\linewidth} \begin{minipage}{\columnwidth} \centering {\tiny BigGAN Flamingo} \end{minipage} \includegraphics[width=.99\columnwidth]{sec/flamingo_modes.png} \includegraphics[width=.99\columnwidth]{sec/afhqmode.PNG} \begin{minipage}{\columnwidth} \centering \vspace{-1em} {\tiny StyleGAN3 AFHQv2} \end{minipage} \end{minipage} \begin{minipage}{0.32\linewidth} \begin{minipage}{\columnwidth} \centering {\tiny BigGAN Egyptian cat} \end{minipage} \includegraphics[width=.99\columnwidth]{sec/egyptianmodes.png}\\ \includegraphics[width=.99\columnwidth]{sec/nvae_modes.png} \begin{minipage}{\columnwidth} \centering \vspace{-1em} {\tiny NVAE colored-MNIST} \end{minipage} \end{minipage} \end{center} \vspace{-0.5cm} \caption{Modes for BigGAN-deep, StyleGAN3-T and NVAE obtained via $\rho\ll0$ Polarity Sampling. {\bf This is, to the best of our knowledge, the first visualization of the modes of DGNs in pixel space.}} \label{fig:modes} \end{figure} \begin{figure}[t!] \begin{center} \begin{minipage}{0.49\linewidth} \includegraphics[width=.99\columnwidth]{nn_hist_lsun_church_stg2.pdf} \end{minipage} \begin{minipage}{0.49\linewidth} \includegraphics[width=.99\columnwidth]{nn_hist_nvae.pdf} \end{minipage} \end{center} \vspace{-0.5cm} \caption{Distribution of $l_2$ distance to 3 training set nearest neighbors, for 1000 generated samples from LSUN Church StyleGAN2 {\bf (left)} and colored-MNIST NVAE {\bf (right)}. Samples closer to the modes ($\rho<0$) for NVAE get significant closer to the training sampling while nearly no changes occurs for StyleGAN2. This behavior is expected as {\bf VAE models are encouraged to position their modes on the training samples, as opposed to GANs whose modes depend on the discriminator}. } \label{fig:nn_hist} \end{figure} \begin{figure}[t!] \begin{center} \begin{minipage}{0.49\linewidth} \includegraphics[width=.99\columnwidth]{ffhq/ppl_zendpoints_ffhqstg2_vggpol.pdf} \end{minipage} \begin{minipage}{0.49\linewidth} \includegraphics[width=.99\columnwidth]{ffhq/ppl_Wendpoints_ffhqstg2_vggpol.pdf} \end{minipage} \end{center} \vspace{-0.5cm} \caption{Distribution of PPL for StyleGAN2-F trained on FFHQ with varying Polarity Sampling (in VGG space) setting ($\rho$ given in the legend) for endpoints in the input latent space ({\bf left}) and endpoints in style-space ({\bf right}). The means of the distributions (PPL score) are provided as markers on the horizontal axis. } \label{fig:PPL} \end{figure} \vspace{-0.3cm} \subsection{Perceptual Path Length Around Modes} \label{sec:truncation} \label{sec:PPL} \vspace{-0.1cm} Perceptual Path Length (PPL) is the VGG space distance between two latent space points, that is used as a measure of perceptual distance \cite{karras2020analyzing}. In \cref{fig:PPL}, we report the PPL of a StyleGAN2-F trained on FFHQ, for an interpolation step of length $10^{-4}$ between endpoints from the latent/style space. We sample points using Polarity Sampling varying $\rho \in [1,-1]$, essentially measuring the PPL for regions of the data manifold with increasing density. We see that for negative values of polarity (close to the modes), we have significantly lower PPL compared to positive polarity or even baseline sampling ($\rho=0$). This result shows that for StyleGAN2, there are smoother perceptual transitions closer to modes. We tabulate PPL values in \cref{appendix:extra}. While truncation also reduces the PPL, it essentially does so by sampling points closer to the style space mean \cite{karras2019style}. Polarity Sampling on the other hand can be used to sample from Vgg modes, making it the first method that can be used to explicitly sample regions that are perceptually smoother. Polarity Sampling may therefore lead to the development of new sophisticated interpolation methods where, instead of linear or spherical interpolation between latent space points, the interpolation is done along a low PPL region of the manifold. \section{Conclusions} \vspace{-0.3cm} We have demonstrated in this paper that the analytical form of a DGN's output space distribution provides a new mechanism to parameterize the DGN prior $p_{{\bm{z}}}$ in terms of a single additional hyperparameter --- the polarity $\rho$--- and force the DGN samples to concentrate near the distribution modes or anti-modes (\cref{sec:method}). Our experiments with Polarity Sampling have demonstrated convincingly that the polarity $\rho$ provides a novel solution to control the quality and diversity of samples, improving upon the usual solution of latent space truncation (\cref{sec:pareto}). As a significant practical bonus, $\rho$ also improved a range of DGNs' FIDs to reach state-of-the-art performance. On the theoretical side, Polarity Sampling's guarantee that it samples from the modes of a DGN enabled us to explore some timely open questions, including the relation between distribution modes and training samples (\cref{sec:mode}), the impact of truncation on producing samples (not) near the distribution modes, and the effect of going from mode to anti-mode generation on the perceptual-path-length (\cref{sec:PPL}). We believe that Polarity Sampling will open the door to even more research directions and applications in the future. \section{Introduction} \label{sec:intro} Please follow the steps outlined below when submitting your manuscript to the IEEE Computer Society Press. This style guide now has several important modifications (for example, you are no longer warned against the use of sticky tape to attach your artwork to the paper), so all authors should read this new version. \subsection{Language} All manuscripts must be in English. \subsection{Dual submission} Please refer to the author guidelines on the CVPR\ 2022\ web page for a discussion of the policy on dual submissions. \subsection{Paper length} Papers, excluding the references section, must be no longer than eight pages in length. The references section will not be included in the page count, and there is no limit on the length of the references section. For example, a paper of eight pages with two pages of references would have a total length of 10 pages. {\bf There will be no extra page charges for CVPR\ 2022.} Overlength papers will simply not be reviewed. This includes papers where the margins and formatting are deemed to have been significantly altered from those laid down by this style guide. Note that this \LaTeX\ guide already sets figure captions and references in a smaller font. The reason such papers will not be reviewed is that there is no provision for supervised revisions of manuscripts. The reviewing process cannot determine the suitability of the paper for presentation in eight pages if it is reviewed in eleven. \subsection{The ruler} The \LaTeX\ style defines a printed ruler which should be present in the version submitted for review. The ruler is provided in order that reviewers may comment on particular lines in the paper without circumlocution. If you are preparing a document using a non-\LaTeX\ document preparation system, please arrange for an equivalent ruler to appear on the final output pages. The presence or absence of the ruler should not change the appearance of any other content on the page. The camera-ready copy should not contain a ruler. (\LaTeX\ users may use options of cvpr.sty to switch between different versions.) Reviewers: note that the ruler measurements do not align well with lines in the paper --- this turns out to be very difficult to do well when the paper contains many figures and equations, and, when done, looks ugly. Just use fractional references (\eg, this line is $087.5$), although in most cases one would expect that the approximate location will be adequate. \subsection{Paper ID} Make sure that the Paper ID from the submission system is visible in the version submitted for review (replacing the ``*****'' you see in this document). If you are using the \LaTeX\ template, \textbf{make sure to update paper ID in the appropriate place in the tex file}. \subsection{Mathematics} Please number all of your sections and displayed equations as in these examples: \begin{equation} E = m\cdot c^2 \label{eq:important} \end{equation} and \begin{equation} v = a\cdot t. \label{eq:also-important} \end{equation} It is important for readers to be able to refer to any particular equation. Just because you did not refer to it in the text does not mean some future reader might not need to refer to it. It is cumbersome to have to use circumlocutions like ``the equation second from the top of page 3 column 1''. (Note that the ruler will not be present in the final copy, so is not an alternative to equation numbers). All authors will benefit from reading Mermin's description of how to write mathematics: \url{http://www.pamitc.org/documents/mermin.pdf}. \subsection{Blind review} Many authors misunderstand the concept of anonymizing for blind review. Blind review does not mean that one must remove citations to one's own work---in fact it is often impossible to review a paper unless the previous citations are known and available. Blind review means that you do not use the words ``my'' or ``our'' when citing previous work. That is all. (But see below for tech reports.) Saying ``this builds on the work of Lucy Smith [1]'' does not say that you are Lucy Smith; it says that you are building on her work. If you are Smith and Jones, do not say ``as we show in [7]'', say ``as Smith and Jones show in [7]'' and at the end of the paper, include reference 7 as you would any other cited work. An example of a bad paper just asking to be rejected: \begin{quote} \begin{center} An analysis of the frobnicatable foo filter. \end{center} In this paper we present a performance analysis of our previous paper [1], and show it to be inferior to all previously known methods. Why the previous paper was accepted without this analysis is beyond me. [1] Removed for blind review \end{quote} An example of an acceptable paper: \begin{quote} \begin{center} An analysis of the frobnicatable foo filter. \end{center} In this paper we present a performance analysis of the paper of Smith \etal [1], and show it to be inferior to all previously known methods. Why the previous paper was accepted without this analysis is beyond me. [1] Smith, L and Jones, C. ``The frobnicatable foo filter, a fundamental contribution to human knowledge''. Nature 381(12), 1-213. \end{quote} If you are making a submission to another conference at the same time, which covers similar or overlapping material, you may need to refer to that submission in order to explain the differences, just as you would if you had previously published related work. In such cases, include the anonymized parallel submission~\cite{Authors14} as supplemental material and cite it as \begin{quote} [1] Authors. ``The frobnicatable foo filter'', F\&G 2014 Submission ID 324, Supplied as supplemental material {\tt fg324.pdf}. \end{quote} Finally, you may feel you need to tell the reader that more details can be found elsewhere, and refer them to a technical report. For conference submissions, the paper must stand on its own, and not {\em require} the reviewer to go to a tech report for further details. Thus, you may say in the body of the paper ``further details may be found in~\cite{Authors14b}''. Then submit the tech report as supplemental material. Again, you may not assume the reviewers will read this material. Sometimes your paper is about a problem which you tested using a tool that is widely known to be restricted to a single institution. For example, let's say it's 1969, you have solved a key problem on the Apollo lander, and you believe that the CVPR70 audience would like to hear about your solution. The work is a development of your celebrated 1968 paper entitled ``Zero-g frobnication: How being the only people in the world with access to the Apollo lander source code makes us a wow at parties'', by Zeus \etal. You can handle this paper like any other. Do not write ``We show how to improve our previous work [Anonymous, 1968]. This time we tested the algorithm on a lunar lander [name of lander removed for blind review]''. That would be silly, and would immediately identify the authors. Instead write the following: \begin{quotation} \noindent We describe a system for zero-g frobnication. This system is new because it handles the following cases: A, B. Previous systems [Zeus et al. 1968] did not handle case B properly. Ours handles it by including a foo term in the bar integral. ... The proposed system was integrated with the Apollo lunar lander, and went all the way to the moon, don't you know. It displayed the following behaviours, which show how well we solved cases A and B: ... \end{quotation} As you can see, the above text follows standard scientific convention, reads better than the first version, and does not explicitly name you as the authors. A reviewer might think it likely that the new paper was written by Zeus \etal, but cannot make any decision based on that guess. He or she would have to be sure that no other authors could have been contracted to solve problem B. \medskip \noindent FAQ\medskip\\ {\bf Q:} Are acknowledgements OK?\\ {\bf A:} No. Leave them for the final copy.\medskip\\ {\bf Q:} How do I cite my results reported in open challenges? {\bf A:} To conform with the double-blind review policy, you can report results of other challenge participants together with your results in your paper. For your results, however, you should not identify yourself and should not mention your participation in the challenge. Instead present your results referring to the method proposed in your paper and draw conclusions based on the experimental comparison to other results.\medskip\\ \begin{figure}[t] \centering \fbox{\rule{0pt}{2in} \rule{0.9\linewidth}{0pt}} \caption{Example of caption. It is set in Roman so that mathematics (always set in Roman: $B \sin A = A \sin B$) may be included without an ugly clash.} \label{fig:onecol} \end{figure} \subsection{Miscellaneous} \noindent Compare the following:\\ \begin{tabular}{ll} \verb'$conf_a$' & $conf_a$ \\ \verb'$\mathit{conf}_a$' & $\mathit{conf}_a$ \end{tabular}\\ See The \TeX book, p165. The space after \eg, meaning ``for example'', should not be a sentence-ending space. So \eg is correct, {\em e.g.} is not. The provided \verb'\eg' macro takes care of this. When citing a multi-author paper, you may save space by using ``et alia'', shortened to ``\etal'' (not ``{\em et.\ al.}'' as ``{\em et}'' is a complete word). If you use the \verb'\etal' macro provided, then you need not worry about double periods when used at the end of a sentence as in Alpher \etal. However, use it only when there are three or more authors. Thus, the following is correct: ``Frobnication has been trendy lately. It was introduced by Alpher~\cite{Alpher02}, and subsequently developed by Alpher and Fotheringham-Smythe~\cite{Alpher03}, and Alpher \etal~\cite{Alpher04}.'' This is incorrect: ``... subsequently developed by Alpher \etal~\cite{Alpher03} ...'' because reference~\cite{Alpher03} has just two authors. \begin{figure*} \centering \begin{subfigure}{0.68\linewidth} \fbox{\rule{0pt}{2in} \rule{.9\linewidth}{0pt}} \caption{An example of a subfigure.} \label{fig:short-a} \end{subfigure} \hfill \begin{subfigure}{0.28\linewidth} \fbox{\rule{0pt}{2in} \rule{.9\linewidth}{0pt}} \caption{Another example of a subfigure.} \label{fig:short-b} \end{subfigure} \caption{Example of a short caption, which should be centered.} \label{fig:short} \end{figure*} \section{Formatting your paper} \label{sec:formatting} All text must be in a two-column format. The total allowable size of the text area is $6\frac78$ inches (17.46 cm) wide by $8\frac78$ inches (22.54 cm) high. Columns are to be $3\frac14$ inches (8.25 cm) wide, with a $\frac{5}{16}$ inch (0.8 cm) space between them. The main title (on the first page) should begin 1 inch (2.54 cm) from the top edge of the page. The second and following pages should begin 1 inch (2.54 cm) from the top edge. On all pages, the bottom margin should be $1\frac{1}{8}$ inches (2.86 cm) from the bottom edge of the page for $8.5 \times 11$-inch paper; for A4 paper, approximately $1\frac{5}{8}$ inches (4.13 cm) from the bottom edge of the page. \subsection{Margins and page numbering} All printed material, including text, illustrations, and charts, must be kept within a print area $6\frac{7}{8}$ inches (17.46 cm) wide by $8\frac{7}{8}$ inches (22.54 cm) high. Page numbers should be in the footer, centered and $\frac{3}{4}$ inches from the bottom of the page. The review version should have page numbers, yet the final version submitted as camera ready should not show any page numbers. The \LaTeX\ template takes care of this when used properly. \subsection{Type style and fonts} Wherever Times is specified, Times Roman may also be used. If neither is available on your word processor, please use the font closest in appearance to Times to which you have access. MAIN TITLE. Center the title $1\frac{3}{8}$ inches (3.49 cm) from the top edge of the first page. The title should be in Times 14-point, boldface type. Capitalize the first letter of nouns, pronouns, verbs, adjectives, and adverbs; do not capitalize articles, coordinate conjunctions, or prepositions (unless the title begins with such a word). Leave two blank lines after the title. AUTHOR NAME(s) and AFFILIATION(s) are to be centered beneath the title and printed in Times 12-point, non-boldface type. This information is to be followed by two blank lines. The ABSTRACT and MAIN TEXT are to be in a two-column format. MAIN TEXT. Type main text in 10-point Times, single-spaced. Do NOT use double-spacing. All paragraphs should be indented 1 pica (approx.~$\frac{1}{6}$ inch or 0.422 cm). Make sure your text is fully justified---that is, flush left and flush right. Please do not place any additional blank lines between paragraphs. Figure and table captions should be 9-point Roman type as in \cref{fig:onecol,fig:short}. Short captions should be centred. \noindent Callouts should be 9-point Helvetica, non-boldface type. Initially capitalize only the first word of section titles and first-, second-, and third-order headings. FIRST-ORDER HEADINGS. (For example, {\large \bf 1. Introduction}) should be Times 12-point boldface, initially capitalized, flush left, with one blank line before, and one blank line after. SECOND-ORDER HEADINGS. (For example, { \bf 1.1. Database elements}) should be Times 11-point boldface, initially capitalized, flush left, with one blank line before, and one after. If you require a third-order heading (we discourage it), use 10-point Times, boldface, initially capitalized, flush left, preceded by one blank line, followed by a period and your text on the same line. \subsection{Footnotes} Please use footnotes\footnote{This is what a footnote looks like. It often distracts the reader from the main flow of the argument.} sparingly. Indeed, try to avoid footnotes altogether and include necessary peripheral observations in the text (within parentheses, if you prefer, as in this sentence). If you wish to use a footnote, place it at the bottom of the column on the page on which it is referenced. Use Times 8-point type, single-spaced. \subsection{Cross-references} For the benefit of author(s) and readers, please use the {\small\begin{verbatim} \cref{...} \end{verbatim}} command for cross-referencing to figures, tables, equations, or sections. This will automatically insert the appropriate label alongside the cross-reference as in this example: \begin{quotation} To see how our method outperforms previous work, please see \cref{fig:onecol} and \cref{tab:example}. It is also possible to refer to multiple targets as once, \eg~to \cref{fig:onecol,fig:short-a}. You may also return to \cref{sec:formatting} or look at \cref{eq:also-important}. \end{quotation} If you do not wish to abbreviate the label, for example at the beginning of the sentence, you can use the {\small\begin{verbatim} \Cref{...} \end{verbatim}} command. Here is an example: \begin{quotation} \Cref{fig:onecol} is also quite important. \end{quotation} \subsection{References} List and number all bibliographical references in 9-point Times, single-spaced, at the end of your paper. When referenced in the text, enclose the citation number in square brackets, for example~\cite{Authors14}. Where appropriate, include page numbers and the name(s) of editors of referenced books. When you cite multiple papers at once, please make sure that you cite them in numerical order like this \cite{Alpher02,Alpher03,Alpher05,Authors14b,Authors14}. If you use the template as advised, this will be taken care of automatically. \begin{table} \centering \begin{tabular}{@{}lc@{}} \toprule Method & Frobnability \\ \midrule Theirs & Frumpy \\ Yours & Frobbly \\ Ours & Makes one's heart Frob\\ \bottomrule \end{tabular} \caption{Results. Ours is better.} \label{tab:example} \end{table} \subsection{Illustrations, graphs, and photographs} All graphics should be centered. In \LaTeX, avoid using the \texttt{center} environment for this purpose, as this adds potentially unwanted whitespace. Instead use {\small\begin{verbatim} \centering \end{verbatim}} at the beginning of your figure. Please ensure that any point you wish to make is resolvable in a printed copy of the paper. Resize fonts in figures to match the font in the body text, and choose line widths that render effectively in print. Readers (and reviewers), even of an electronic copy, may choose to print your paper in order to read it. You cannot insist that they do otherwise, and therefore must not assume that they can zoom in to see tiny details on a graphic. When placing figures in \LaTeX, it's almost always best to use \verb+\includegraphics+, and to specify the figure width as a multiple of the line width as in the example below {\small\begin{verbatim} \usepackage{graphicx} ... \includegraphics[width=0.8\linewidth] {myfile.pdf} \end{verbatim} } \subsection{Color} Please refer to the author guidelines on the CVPR\ 2022\ web page for a discussion of the use of color in your document. If you use color in your plots, please keep in mind that a significant subset of reviewers and readers may have a color vision deficiency; red-green blindness is the most frequent kind. Hence avoid relying only on color as the discriminative feature in plots (such as red {\bm{s}} green lines), but add a second discriminative feature to ease disambiguation. \section{Final copy} You must include your signed IEEE copyright release form when you submit your finished paper. We MUST have this form before your paper can be published in the proceedings. Please direct any questions to the production editor in charge of these proceedings at the IEEE Computer Society Press: \url{https://www.computer.org/about/contact}. \section{Implementation Details and Online Sampling Solution} \label{sec:implementation} \subsection{Online Algorithm} \label{sec:online_algorithm} One important aspect of polarity-sampling, as summarized in \cref{alg:sampling} is the need to first sample the DGN latent space to obtain the top singular values of as much per-region slope matrices ${\bm{A}}_{\omega}$ as possible. This might seem as a bottleneck if one wants to repeatedly apply polarity-sampling on a same DGN. However, this is to provide an estimate of the DGN per-region change of variables, and as the DGN is not retrained nor fine-tuned, it only needs to be done once. Furthermore, this allows for an online sampling algorithm that we provide in \cref{alg:online}. In short, one first perform this task of estimating as much per-region top singular values as possible, once this is completed, only sampling of latent vectors ${\bm{z}}$ and rejection sampling based on the corresponding ${\bm{A}}_{\omega}$ matrix is done online, ${\bm{A}}_{\omega}$ of the sampled ${\bm{z}}$ being obtained easily via ${\bm{A}}_{\omega}={\bm{J}} G ({\bm{z}})$. \begin{algorithm}[] \caption{Online Rejection Sampling Algorithm} \begin{algorithmic} \Require Latent space domain, $\mathcal{D}$; Generator ${\bm{G}}$; $N$ change of volume scalars $\{\sigma_1, \sigma_2,...,\sigma_N \}$; Number of singular values $K$; \While{True}{} \State $z \sim U(\mathcal{D})$ \State $\alpha \sim U[0,1]$ \State ${\bm{A}} = {\bm{J}}_{{\bm{G}}}(z)$ \State $\sigma_z = \prod^K_{k=1} K$-$SingularValues({\bm{A}},K)$ \vspace{.5em} \State \algorithmicif $\frac{\sigma_z^\rho}{\sigma_z^\rho + \sum_{i=1}^N \sigma_i^\rho} \geq \alpha$ \algorithmicthen\ \vspace{.5em} $x \gets {\bm{G}}(z)$ \Return $x$ \EndWhile \end{algorithmic} \label{alg:online} \end{algorithm} \subsection{Effect of $N$ and $k$} \label{sec:effect_N_k} One important aspect of our algorithm comes from the two hyper-parameters $N$ and $k$. They represent respectively the number of latent space samples to use to estimate as much ${\bm{A}}_{\omega}$ as possible (recall \cref{alg:sampling}), and the number of top singular values to compute. Both represent a trade-off between exact polarity-sampling, and computation complexity. We argue that in practice, $N\approx 150K$ and $k\approx 100$ is enough to obtain a good estimate of the polarity-sampling distribution (\cref{eq:density_rho}). To demonstrate that, we first provide an ablation study of the number of $N$ and $k$ used for polarity sampling in \cref{tab:ablation_N} and \cref{tab:ablation_topk}. We also present a visual inspection of the impact of $N$ and $k$ on the precision and recall in \cref{fig:topk_prec_recall}. \begin{table}[] \centering \resizebox{\linewidth}{!}{% \begin{tabular}{@{}crrrccc@{}} \toprule & \multicolumn{3}{c}{FFHQ 1024$\times$1024} & \multicolumn{3}{c}{LSUN Cat 256$\times$256} \\ \midrule $N$ & \multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}FID\\ (lowest)\end{tabular}} & \multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}Precision\\ (max)\end{tabular}} & \multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}Recall\\ (max)\end{tabular}} & \begin{tabular}[c]{@{}c@{}}FID\\ (lowest)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Precision\\ (max)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Recall\\ (max)\end{tabular} \\ \midrule 100K & 2.63 & 0.80 & 0.59 & 6.38 & 0.69 & 0.31 \\ 200K & 2.62 & 0.82 & 0.63 & 6.38 & 0.71 & 0.32 \\ 250K & 2.59 & 0.84 & 0.64 & 6.39 & 0.74 & 0.31 \\ 300K & 2.61 & 0.87 & 0.65 & 6.37 & 0.75 & 0.33 \\ 500K & 2.58 & 0.90 & 0.67 & 6.34 & 0.77 & 0.33 \end{tabular} } \caption{Ablation of $N$ and its effect on best FID, Precision and Recall values that can be obtained by a StyleGAN2 ($\psi=1$) on the FFHQ and LSUN Cat dataset. We vary the polarity in the VGG space for FFHQ dataset, and style space for LSUN Cats, for number of singular values $k=30$.} \label{tab:ablation_N} \end{table} \begin{table}[] \centering \begin{tabular}{@{}crrr@{}} \toprule & \multicolumn{3}{c}{FFHQ 1024$\times$1024} \\ \midrule $K$ & \multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}FID\\ (lowest)\end{tabular}} & \multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}Precision\\ (max)\end{tabular}} & \multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}Recall\\ (max)\end{tabular}} \\ \midrule 10 & 2.71 & 0.89 & 0.65 \\ 20 & 2.67 & 0.90 & 0.66 \\ 40 & 2.57 & 0.90 & 0.67 \\ 60 & 2.62 & 0.90 & 0.66 \\ 80 & 2.67 & 0.90 & 0.66 \\ 100 & 2.70 & 0.90 & 0.67 \\ \bottomrule \end{tabular} \caption{Ablation of $K$ and its effect on the best FID, Precision and Recall values that can be obtained by a StyleGAN2 ($\psi=1$) on the FFHQ dataset. We vary the polarity in the inception space for FFHQ dataset} \label{tab:ablation_topk} \end{table} \subsection{Computation Times and Employed Software/Hardware} \label{sec:times} All the experiments were run on a Quadro RTX 8000 GPU, which has 48 GB of high-speed GDDR6 memory and 576 Tensor cores. For the software details we refer the reader to the provided codebase. In short, we employed TF2 (2.4 at the time of writing), all the usual Python scientific libraries such as NumPy and PyTorch. We employed the official repositories of the various models we employed with official pre-trained weights. As a note, most of the architectures can not be run on GPUs with less or equal to 12 GB of memory. We report here the Jacobian computation times for Tensorflow 2.5 with CUDA 11 and Cudnn 8 on an NVIDIA Titan RTX GPU. For StyleGAN2 pixel space, 5.03s/it; StyleGAN2 style-space, 1.12s/it; BigGAN 5.95s/it; ProgGAN 3.02s/it. For NVAE on Torch 1.6 it takes 20.3s/it. Singular value calculation for StyleGAN2 pixel space takes .005s/it, StyleGAN2 style space .008s/it, BigGAN .001s/it, ProgGAN .004s/it and NVAE .02s/it on NumPy. According to this, for StyleGAN2-e, N=250,000 requires ~14 days to obtain. This only needs to be done once, and it is also possible to perform online sampling once it is calculated. The time required for this is relatively small compared to the training time required for only one set of hyperparameters, which is ~35 days and 11 hours\footnote{https://github.com/NVlabs/stylegan2}. We have added pseudocode for MaGNET sampling and online sampling in Appendix G. \subsection{Reducing Memory Requirements} \label{sec:memory} The core of polarity-sampling relies on computing the top-singular values of the possibly large matrix ${\bm{A}}_{\omega}$ for a variety of regions $\omega \in \Omega$, discovered through latent space sampling (recall \cref{alg:sampling}). One challenge for state-of-the-art DGNs lies in the size of the matrices ${\bm{A}}_{\omega}$. Multiple solutions exist, such as computing the top singular values through block power iterations. Doing so, the matrices ${\bm{A}}_{\omega}$ do not need to be computed entirely, only the matrix-matrix product ${\bm{A}}_{\omega}{\bm{W}}$ and ${\bm{A}}^T_{\omega}{\bm{V}}$ needs to be performed repeatedly (interleaved with QR decompositions). After many iterations, ${\bm{W}}$ estimate the top right-singular vectors of ${\bm{A}}_{\omega}$, and ${\bm{V}}$ the corresponding top left-singular vectors from which the singular values can be obtained. However, we found this solution to remain computationally extensive, and found that in practice, a simpler approximation that we now describe provided sufficiently accurate estimates. Instead of the above iterative estimation, one can instead compute the top-singular values of ${\bm{W}}{\bm{A}}_{\omega}$ with ${\bm{W}}$ a semi-orthogonal matrix of shape $D'\times D$ with $D'<D$ (recall that ${\bm{A}}_{\omega}$ is of shape $D \times K$). Doing so, we are now focusing on the singular values of ${\bm{A}}_{\omega}$ whose left-singular vectors are not orthogonal with the right singular vectors of ${\bm{W}}$. While this possible incur an approximation error, we found that the above was sufficient to provide polarity-sampling an adequate precision-recall control. \subsection{Applying Polarity Sampling in Style, VGG and Inception Space} \label{sec:other_space} We call the ambient space of the images the pixel-space, because each dimension in this space corresponds to individual pixels of the images. Apart from controlling the density of the pixel-space manifold, polarity can also be used to control the density of the style-space manifold for style based architectures such as StyleGAN\{1,2,3\} \cite{karras2019style,karras2020analyzing,karras2021alias}. We also extend the idea of intermediate manifolds to feature space manifolds such as VGG or InceptionV3 space, which can be assumed continuous mappings of the pixel space to the corresponding models' bottleneck embedding space. In \cref{fig:more_pareto}-left we present comparisons between Style, Pixel, VGG and Inception space precision-recall curves for StyleGAN2-F FFHQ with $\psi=1$, top-$k=30$ and $\rho=[-2,2]$. We see that the VGG and InceptionV3 curves trace almost identically. This is expected behavior since both these feature spaces correspond to perceptual features, therefore the transform they induce on the pixel space distribution is almost identical. On the other hand, the pixel space distribution saturates at high polarity at almost equal values. The point of equal precision and recall for both the Inception and VGG spaces, occur at a polarity of 0.1. Its clear from the figures that feature space polarity changes have a larger effect on precision and recall compared to pixel-space and style-space has the least effect on precision and recall. This could be due to the number of density transforms the style-space distribution undergoes until the VGG space, where precision and recall is calculated. In \cref{fig:more_pareto}-right we present the polarity characteristics for StyleGAN2-E, StyleGAN2-F and StyleGAN3. For each model, we choose the best space w.r.t the pareto frontier, VGG and Inception space for StyleGAN2-E and StyleGAN2-F, and pixel-space for StyleGAN3. Notice that StyleGAN3 exceeds the recall of the other two models for negative polarity, while matching the precision for StyleGAN2-E. \section{Proofs} \label{sec:proofs} The proofs of the two main claims of the paper heavily rely on the spline form of the DGN input-output mapping from \cref{eq:CPA}. For more background on the form of the latent space partition $\Omega$, the per-region affine mappings ${\bm{A}}_{\omega},{\bm{b}}_{\omega},\forall \omega \in \Omega$ and further discussion on how to deal with DGN including smooth activation functions, we refer the reader to \cite{balestriero2020mad}. \subsection{Proof of \cref{thm:general_density}} \label{proof:general_density} \begin{proof} We will be doing the change of variables ${\bm{z}}=({\bm{A}}^T_{\omega}{\bm{A}}_{\omega})^{-1}{\bm{A}}_{\omega}^T({\bm{x}} - {\bm{b}}_{\omega})\triangleq {\bm{A}}_{\omega}^\dagger({\bm{x}} - {\bm{b}}_{\omega})$, also notice that $J_{G^{-1}}({\bm{x}})=A^\dagger$. First, we know that $ P_{G({\bm{z}})}({\bm{x}} \in w)= P_{{\bm{z}}}({\bm{z}} \in G^{-1}(w))= \int_{G^{-1}(w)}p_{{\bm{z}}}({\bm{z}}) d{\bm{z}} $ which is well defined based on our full rank assumptions. We then proceed by \begin{align*} P_{G}({\bm{x}} \in w)=& \sum_{\omega \in \Omega}\int_{\omega \cap w} p_{{\bm{z}}}(G^{-1}({\bm{x}})) \\ &\times \sqrt{ \det(J_{G^{-1}}({\bm{x}})^TJ_{G^{-1}}({\bm{x}}))} d{\bm{x}}\\ =& \sum_{\omega \in \Omega}\int_{\omega \cap w}p_{{\bm{z}}}(G^{-1}({\bm{x}})) \\ &\times \sqrt{ \det(({\bm{A}}_{\omega}^{+})^T{\bm{A}}_{\omega}^{+})} d{\bm{x}}\\ =& \sum_{\omega \in \Omega}\int_{\omega \cap w} p_{{\bm{z}}}(G^{-1}({\bm{x}}))\frac{1}{\sqrt{\det({\bm{A}}_{\omega}^T{\bm{A}}_{\omega})}} d{\bm{x}},\\ \end{align*} where the second to third equality follows by noticing that $\sigma_i(A^\dagger)=(\sigma_i(A))^{-1}$ which can be showed easily be replacing ${\bm{A}}_{\omega}$ with its SVD and unrolling the product of matrices. Now considering a uniform latent distribution case on a bounded domain $U$ in the DGN latent space we obtain by substitution in the above result \begin{align} p_{G}({\bm{x}}) = \frac{\sum_{\omega \in \Omega}\mathrm{1}_{{\bm{x}} \in \omega}\det({\bm{A}}_{\omega}^T{\bm{A}}_{\omega})^{-\frac{1}{2}}}{Vol(U)}, \end{align} leading to the desired result. \end{proof} \subsection{Proof of \cref{cor:pol_density}} \label{proof:pol_density} \begin{proof} The proof of this result largely relies on \cref{thm:general_density}. Taking back our previous result, we know that \begin{equation} p_{G}({\bm{x}})=\sum_{\omega \in \Omega} p_{{\bm{z}}}(G^{-1}({\bm{x}}))\mathrm{1}_{\{G^{-1}({\bm{x}}) \in \omega\}}\frac{1}{\sqrt{\det({\bm{A}}_{\omega}^T{\bm{A}}_{\omega})}} d{\bm{x}}. \end{equation} However, recall that polarity sampling leverages the prior probability given by \begin{equation} p_{\rho}({\bm{z}}) =\frac{1}{\kappa} \sum_{\omega \in \Omega}\det({\bm{A}}_{\omega}^T{\bm{A}}_{\omega})^{\frac{\rho}{2}} \mathds{1}_{\{{\bm{z}} \in \omega\}}, \end{equation} which, after replacing $G^{-1}({\bm{x}})$ with its corresponding ${\bm{z}}$ becomes \begin{equation} p_{G}({\bm{x}})=\sum_{\omega \in \Omega} \frac{1}{\kappa} \frac{\det({\bm{A}}_{\omega}^T{\bm{A}}_{\omega})^{\frac{\rho}{2}}}{\sqrt{\det({\bm{A}}_{\omega}^T{\bm{A}}_{\omega})}}\mathds{1}_{\{{\bm{z}} \in \omega'\}} d{\bm{x}}, \end{equation} and simplifies to \begin{equation} p_{G}({\bm{x}})=\sum_{\omega \in \Omega} \frac{1}{\kappa} \det({\bm{A}}_{\omega}^T{\bm{A}}_{\omega})^{\frac{\rho-1}{2}}\mathds{1}_{\{{\bm{z}} \in \omega'\}} d{\bm{x}}, \end{equation} leading to the desired result. Note that when $\rho=1$ then the density is uniform onto the DGN manifold, when $\rho=0$, one recovers the original DGN density onto the manifold, and in the extrema cases, only the region with highest or lowest probability would be sample i.e. the modes or anti-modes. \end{proof} \section{Extra experiments} \label{appendix:extra} \begin{figure}[t!] \begin{center} \begin{minipage}{0.02\linewidth} \centering \rotatebox{90}{\footnotesize \hspace{0.3cm}Precision/Recall} \end{minipage} \begin{minipage}{0.48\linewidth} \centering \includegraphics[width=\linewidth]{ffhq/ffhq_vgg-pix-inc_precrecall.pdf}\\[-0.5em] {\footnotesize polarity $(\rho)$} \end{minipage} \begin{minipage}{0.48\linewidth} \centering \includegraphics[width=\linewidth]{ffhq/ffhq_stg3-2f-2e_precrecall.pdf}\\[-0.5em] {\footnotesize polarity $(\rho)$} \end{minipage} \end{center} \vspace{-0.5cm} \includegraphics[width=0.49\linewidth]{pareto/image.png} \includegraphics[width=0.49\linewidth]{pareto/image-2.png} \caption{ Top: Precision Recall tradeoff for polarity sweep on VGG, Inception and Pixel space distributions. Bottom: BigGAN-deep Imagenet pareto curves obtained for a few classes, in red is the baseline while each other scatter point can be reach by varying truncation and $\rho$ Calculated with $1300$ real and generated samples. } \label{fig:more_pareto} \end{figure} \begin{figure}[t!] \begin{center} \begin{minipage}{0.02\linewidth} \centering \rotatebox{90}{\footnotesize \hspace{0.7cm}Precision} \end{minipage} \begin{minipage}{0.48\linewidth} \centering \includegraphics[width=\linewidth]{ffhq/ffhq_vggpol_num_detz_prec.pdf} \end{minipage} \begin{minipage}{0.48\linewidth} \centering \includegraphics[width=\linewidth]{ffhq/ffhq_vggpol_topksweep_prec.pdf} \end{minipage} \begin{minipage}{0.02\linewidth} \centering \rotatebox{90}{\footnotesize \hspace{0.7cm}Recall} \end{minipage} \begin{minipage}{0.48\linewidth} \centering \includegraphics[width=\linewidth]{ffhq/ffhq_vggpol_num_detz_recall.pdf}\\[-0.5em] {\footnotesize polarity $(\rho)$} \end{minipage} \begin{minipage}{0.48\linewidth} \centering \includegraphics[width=\linewidth]{ffhq/ffhq_vggpol_topksweep_recall.pdf}\\[-0.5em] {\footnotesize polarity $(\rho)$} \end{minipage} \end{center} \vspace{-0.5cm} \caption{ Effect of Polarity Sampling on Precision (top) and Recall (bottom) of a StyleGAN2-F model pretrained on FFHQ for varying number of top-$k$ singular values (right) and varying number of latent space samples $N$ (left) used to obtain per-region slope matrix ${\bm{A}}_{\omega}$ singular values (recall \cref{sec:pseudocode,alg:sampling}). The trend in metrics stabilizes when using around $N\approx$300,000 latent space samples. Increasing the number of top-$k$ singular values to use, amplifies the effect of polarity, saturating at around $k=50$. } \label{fig:topk_prec_recall} \end{figure} \begin{figure*}[t!] \begin{center} \begin{minipage}{\linewidth} \includegraphics[width=.49\columnwidth]{modes/pug_modes.png} \includegraphics[width=.49\columnwidth]{modes/lionmodes.png}\\ \includegraphics[width=.49\columnwidth]{modes/cheeseburger_modes.png} \includegraphics[width=.49\columnwidth]{modes/pomerian_modes.png}\\ \end{minipage} \end{center} \caption{Modes for BigGAN-deep trained on Imagenet, and conditioned on the a specific class: ``pug'' (top left), ``lion'' (top right), ``cheeseburger'' (bottom left) and ``pomerian'' (bottom right). We observe that the modes correspond to nearly aligned faces with little to no background. Variation of colors and sizes can be seen across the modes. The same observation can be made for the cheeseburger, nearly no background is present, and the shape is consistent to a typical cheeseburger ''template''. See \cref{fig:modes_per_class} for additional classes. } \label{fig:truncation_sweep_images} \end{figure*} \begin{figure}[t!] \begin{center} \begin{minipage}{0.48\linewidth} \includegraphics[width=.99\columnwidth]{nn_vae_biased_both.png} \end{minipage} \begin{minipage}{0.48\linewidth} \includegraphics[width=.99\columnwidth]{nn_vae_biased_both2.png} \end{minipage} \end{center} \caption{Modes for VAE with 8 nearest neighbors. Notice the higher prevalence of digit 1. Due to low pixel variations, digit 1 samples have high density on the manifold.} \label{fig:nearest} \end{figure} \subsection{Polarity Helps Under Distribution Shift} \label{sec:shift} \begin{figure}[t!] \centering \begin{minipage}{0.49\linewidth} \centering \includegraphics[width=\linewidth]{NVAE/biasedNVAE-biasedTest.pdf}\\[-0.5em] {\small polarity ($\rho$)} \end{minipage} \begin{minipage}{0.49\linewidth} \centering \includegraphics[width=\linewidth]{NVAE/biasedNVAE-unifTest.pdf}\\[-0.5em] {\small polarity ($\rho$)} \end{minipage} \vspace{-0.2cm} \caption{{\bf Left:} training of NVAE on color-MNIST with hue bias and computing FID, precision and recall with the test set of color-MNIST that has the same bias. {\bf Right:} reproduction of the left experiment but now using a uniform hue for the test set. We see that {\bf the polarity allow to adapt the DGN distribution to balance possible distribution shifts}.} \label{fig:nvae} \end{figure} A last benefit of Polarity-sampling is to adapt a sampling distribution to a reference distribution that suffered a distribution shift. For example, this could occur when training a DGN on a training set, and using it for content generation with a slightly different type target samples. In fact, as long as the distribution shift remains reachable by the model i.e. in the support of $p_{G}$, altering the value of $\rho$ will help to shift the sampling distribution, possible to better match the target one. In all generality, there is no guarantee that any benefit would happen for $\rho \not = 0$, however, for the particular case where the distribution shift only changes the way the samples are distributed (on the same domain), we observe in \cref{fig:nvae} that $\rho \not = 0$ can provide benefit. To control the experimental setting, we took the color-MNIST dataset and the NVAE DGN model \cite{vahdat2020nvae} and produce a training set with a Gaussian hue distribution favoring blue and two test set, one with same hue distribution and one with uniform hue distribution. We observe that $\rho$ can provide a beneficial distribution shift to go from the biased-hue samples to the uniform-hue one. \subsection{ProGAN Polarity Sweep} \label{sec:progan} Previously in \cref{sec:pareto}, we have drawn note to the fact that ProGAN \cite{karras2017progressive}, an architecture which is widely used, but does not incorporate truncation, can also be controlled via polarity sampling. In \cref{tab:progan} we present precision-recall characteristics for polarity sweep on ProGAN. As control, we also perform latent space truncation as in \cite{brock2018large} by sampling a truncated gaussian distribution, parameterized by its support $[-\beta,\beta]$. We change $\beta$ between $[10^{-10},10]$ and notice that for $\beta$ smaller than $10^{-4}$, the generator collapses to 0 precision and recall. Other than that, it maintains a precision of $0.72$ and recall of $0.34$. Using polarity sweep, we also exceed the baseline FID on CelebAHQ 1024x1024 attained by ProGAN; polarity of $-.01$ in pixel-space reduces the FID from $7.37$ to $7.28$. \begin{table}[] \centering \resizebox{\linewidth}{!}{% \begin{tabular}{@{}ccccccc@{}} \toprule & \multicolumn{6}{r}{CelebAHQ 1024$\times$1024} \\ \midrule \multicolumn{1}{l}{} & \multicolumn{3}{c}{$\rho \leq 0$} & \multicolumn{3}{c}{$\rho > 0$} \\ $|\rho|$ & FID & Precision & \multicolumn{1}{c|}{Recall} & FID & Precision & Recall \\ \midrule 0 & 7.37 & .73 & .34 & - & - & - \\ 0.01 & \textbf{7.28} & .73 & .34 & 7.45 & .73 & .35 \\ 0.1 & 7.41 & .76 & .31 & 8.95 & .68 & .38 \\ 1 & 12.65 & .85 & .19 & 17.96 & .58 & .48 \\ 2 & 13.09 & \textbf{.86} & .19 & 18.54 & .58 & \textbf{.48} \\ \hline \end{tabular} } \caption{FID, Precision and Recall metrics of ProGAN \cite{karras2017progressive} with polarity sweep in the pixel space.} \label{tab:progan} \end{table} \section{Dataset description} \label{sec:datasets} \subsection{colored-MNIST} \label{sec:hue_dataset} We perform controlled experiments on NVAE \cite{vahdat2020nvae} by training on datasets with and without controllable distribution shifts. To control the shift, we colorize MNIST with hue ranging $[0,\pi]$ by 1) uniformly sampling the hue and 2) sampling the hue for each image from a truncated normal distribution, with a truncation scale of $2$. \subsection{LSUN Dataset} We use the LSUN dataset \cite{yu2015lsun} available at the official website\footnote{https://www.yf.io/p/lsun}. We preprocess the dataset using the StyleGAN2 repository\footnote{https://github.com/NVlabs/stylegan2}. \subsection{AFHQv2 and FFHQ} We use the version 2 of AFHQ that was released prepackaged with StyleGAN3 for our experiments. For FFHQ we use also use TFRecords provided with StyleGAN2. \subsection{License} NVAE, StyleGAN2 and StyleGAN3 are released under Nvidia Source Code License-NC. The ADM repository\footnote{https://github.com/openai/guided-diffusion/blob/main/LICENSE} is licensed under MIT license. \section{Qualitative results} \label{sec:quality} We provide in this section \cref{fig:qualitative_alpha_sweep,fig:qualitative_alpha_sweep_cars,fig:qualitative_alpha_sweep_afhq} that correspond to LSUN Cats, LSUN Cars and AFHQv2 samples with varying polarity $\rho$ values. \begin{figure*}[t!] \centering \begin{center} \begin{minipage}{0.97\textwidth} \centering \includegraphics[width=.86\linewidth]{sweeps/cats_trunc_pol_matched_blurred.png} \end{minipage}\\ \begin{minipage}{0.97\textwidth} \centering \includegraphics[width=.86\linewidth]{sweeps/cat_trunc_sweep_blurred.png} \end{minipage} \end{center} \vspace{-0.2cm} \caption{Uncurated samples of LSUN Cats using (top) $\rho=\{-1,-.5,-.2,-.1,0\}, \psi=.8$ and (bottom) $\psi=\{.7,.73,.75,.77,.8\}$; both representing regions with roughly an equal span of recall score on \cref{fig:pareto}. Notice the significant precision of the left-most columns of top compared to the left-most of bottom, where at equal diversity, top has significantly higher precision score.} \label{fig:qualitative_alpha_sweep} \end{figure*} \begin{figure*}[t!] \centering \begin{center} \begin{minipage}{\textwidth} \includegraphics[width=\linewidth]{sweeps/lsun_car_equiprec_polsweep.png} \end{minipage}\\ \begin{minipage}{\textwidth} \includegraphics[width=\linewidth]{sweeps/lsun_car_equiprec_truncsweep.png} \end{minipage} \end{center} \vspace{-0.2cm} \caption{Uncurated samples of LSUN Cars using (top) $\rho=\{-.1,-.075,-.05,-.025,0\}, \psi=.7$ and (bottom) $\psi=\{.5,.55,.6,.65,.7\}$; both representing regions with roughly an equal span of precision score on \cref{fig:pareto} Notice the significant diversity in (top) especially in the leftmost columns, where the recall score is significantly higher than that of the leftmost column of bottom left, with equal precision. } \label{fig:qualitative_alpha_sweep_cars} \end{figure*} \begin{figure*}[t!] \centering \begin{center} \begin{minipage}{0.97\textwidth} \centering \includegraphics[width=0.93\linewidth]{sweeps/afhqalphasweep.png} \end{minipage} \end{center} \vspace{-0.2cm} \caption{Uncurated samples of AFHQv2 using $\rho=\{-2,-1,-.5,-.2,0,.01,.1,.2,.5\}$ and $\psi=.9$ in pixel-space. As we move right from baseline (middle column) we see an increase in texture diversity of images, whereas, moving left, we see images with smoother textures. } \label{fig:qualitative_alpha_sweep_afhq} \end{figure*} \begin{figure*}[t!] \centering \includegraphics[width=0.8\linewidth]{modes/imagenet_blurred.png} \caption{Depiction of a single mode (large negative $\rho$) for each class of the first $800$ Imagenet classes.} \label{fig:modes_per_class} \end{figure*}
{'timestamp': '2022-03-07T02:02:47', 'yymm': '2203', 'arxiv_id': '2203.01993', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.01993'}
arxiv